필터 지우기
필터 지우기

how to calculate the center of an object in binary image

조회 수: 4 (최근 30일)
haider alnaqeeb
haider alnaqeeb 2016년 2월 27일
댓글: Image Analyst 2016년 2월 28일
hellow dears i need support to calculate the center of an object in binary image, the binary image has only one object so that i need to find the center of that object in order to crop the object from the binary image as in attached image

채택된 답변

Image Analyst
Image Analyst 2016년 2월 27일
You do not need the center of the blob to crop it from the image. You need the bounding box.
measurements = regionprops(binaryImage, 'BoundingBox');
croppedImage = imcrop(binaryImage, measurements.BoundingBox);
  댓글 수: 8
haider alnaqeeb
haider alnaqeeb 2016년 2월 28일
Dear Image Analyst: first thing i am very grateful for your kind and fast support i really appreciate your kindness and i test your code it is excellent and give me the right result, if you don't mind can you give me your email in case i need your kind support. Kind Regards
Image Analyst
Image Analyst 2016년 2월 28일
You're welcome. Thanks for accepting. You don't need my email because if you need help again you can post back here in Answers and possibly get more answers than from just me.

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

추가 답변 (2개)

haider alnaqeeb
haider alnaqeeb 2016년 2월 27일
the attached image

Walter Roberson
Walter Roberson 2016년 2월 27일
Use regionprops() and ask for Centroid
  댓글 수: 7
haider alnaqeeb
haider alnaqeeb 2016년 2월 27일
can we make the object in the binary image as an array which it is pixels has value of 1 and we find the center of this array which is the center of the object?? i mean we find the center of array of pixels which has value 1 ??
Walter Roberson
Walter Roberson 2016년 2월 27일
regionprops should already act that way.
Note: the page you posted, aaaaa.png, has two or more blobs, because it has the grayscale image at the left and the diagram at the right. You need to be operating on just the grayscale image.

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

Community Treasure Hunt

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

Start Hunting!

Translated by