필터 지우기
필터 지우기

Finding centroid of an image with a summed pixel area greater than 120 pixels squared

조회 수: 4 (최근 30일)
Hi,
I am trying to find the position of an object in an image. I need to first find connected pixels with intensity values above threshold, which I used imregionalmax function. I know need to identify centroid's with areas greater than 120 pixels squared. I am having no problem using imregionalmax and then regionprops function to find centroid, but am having issues figuring out how to find centroids of objects with pixel areas greater than 120 pixels squared.
Any suggestions?

채택된 답변

Image Analyst
Image Analyst 2016년 8월 12일
Heath, no, don't use imregionalmax. Use thresholding followed by bwareaopen followed by bwlabel followed by regionprops:
binaryImage = grayImage > 120;
binaryImage = bwareaopen(binaryImage, 120); % Keep blobs 120 pixels and bigger.
labeledImage = bwlabel(binaryImage);
props = regionprops(labeledImage, 'Centroid');
allCentroids = [props.Centroid];
xCentroids = allCentroids(1:2:end);
yCentroids = allCentroids(2:2:end);
See my thresholding application (to visually/interactively threshold the image) and Image Segmentation Tutorial in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
  댓글 수: 3
Krispy Scripts
Krispy Scripts 2016년 8월 12일
편집: Krispy Scripts 2016년 8월 12일
I am very new to image analysis, so is finding the intensity values above a regional maxima intensity value (use of the imregionalmax) equivalent to thresholding?
I used imregionalmax as my first step then ran bwareaopen and so on. I apologize my wording of my question was not correct, I should not have said thresholding.
Image Analyst
Image Analyst 2016년 8월 12일
Well maybe. But if you used imregionalmax(), you get a mask back, and if you do
mask = imregionalmax(grayImage);
pixelValues = grayImage(mask);
meanOfLocalPeaks = mean(pixelValues);
That will give you the mean of all pixels that are local regional maxima. Not sure if that's what you want. But it doesn't involve thresholding, just masking.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by