Extracting part of an image

6 vues (au cours des 30 derniers jours)
Jaeyong Oh
Jaeyong Oh le 8 Août 2019
Modifié(e) : Matt J le 9 Août 2019
Hi, I am trying to extract a part of an image to get average pixel intensity of that part.
Attached image '1.jpg' is the original image and '1.. line.jpg' shows the part that I want to extract.
I cannot use the imcrop command since the part I want is not rectangular.
I tried using the drawpolygon command and got the vertices of the polygon, but I couldn't take it any further.
Can anybody help me?
Thank you in advance.

Réponses (1)

Matt J
Matt J le 9 Août 2019
Modifié(e) : Matt J le 9 Août 2019
Use impoly instead of drawpolygon. Use the createMask() method of the impoly object h to extract the ROI pixels
pixelvalues = yourImage(h.creatMask)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by