MATLAB Answers

0

Extracting part of an image

Asked by Jaeyong Oh on 8 Aug 2019
Latest activity Edited by Matt J
on 9 Aug 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.

  0 Comments

Sign in to comment.

1 Answer

Matt J
Answer by Matt J
on 9 Aug 2019
Edited by Matt J
on 9 Aug 2019

Use impoly instead of drawpolygon. Use the createMask() method of the impoly object h to extract the ROI pixels
pixelvalues = yourImage(h.creatMask)

  0 Comments

Sign in to comment.