MATLAB Answers

Ann G
0

How to choose a specific area of an image?

Asked by Ann G
on 5 Oct 2015
Latest activity Commented on by Image Analyst
on 9 Dec 2017
I would like to ask you how to choose a specific area of an image and then use the elements of this content?

  5 Comments

Define "select". I offered to give you masking demos in my answer but you didn't ask. So, I don't know what you mean now by "select". Please define it. Do you want all the pixel in the area in a 1-D list of intensity values? Do you want a 2D image with outside the polygon blacked out? Do you want the polygon part cropped out to a new image? What??? Be specific.
Hi, I have a question here. Lets say, I have defined an area of polygon using its x and y coordinates. But,how do I able to find out the mean pixels intensity of this area of polygon? Secondly,how should I apply the"if" condition to thershold a certain value of mean intensity of this polygon area.
Kindly advice
Make a mask and then use mean on the masked image:
mask = poly2mask(x, y, rows, columns);
theMeanIntensity = mean(grayImage(mask));

Sign in to comment.

2 Answers

Answer by Stephen Cobeldick on 5 Oct 2015
 Accepted Answer

You need to use some kind of array indexing. Often the easiest is to use logical indexing, which would allow you to select the area that you want.

  0 Comments

Sign in to comment.


Answer by Image Analyst
on 5 Oct 2015

If you want masking demos, ask me.

  0 Comments

Sign in to comment.