Extracting part of an image

6 visualizzazioni (ultimi 30 giorni)
Jaeyong Oh
Jaeyong Oh il 8 Ago 2019
Modificato: Matt J il 9 Ago 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.

Risposte (1)

Matt J
Matt J il 9 Ago 2019
Modificato: Matt J il 9 Ago 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