필터 지우기
필터 지우기

how center of mass of an image is calculated

조회 수: 30 (최근 30일)
raj kumar
raj kumar 2014년 6월 4일
댓글: Image Analyst 2017년 2월 1일
sir, do you have any matlab code for finding center of mass of an image.

채택된 답변

Image Analyst
Image Analyst 2014년 6월 4일
편집: Image Analyst 2014년 6월 5일
Probably the easiest is to use regionprops(). Something like (untested)
binaryImage = true(size(grayImage));
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, grayImage, 'WeightedCentroid');
centerOfMass = measurements.WeightedCentroid;
  댓글 수: 5
Walter Roberson
Walter Roberson 2017년 2월 1일
Raghu Rao, it is not possible to do that completely automatically. "foreground" and "background" depend on intent. For example there are telescopes that study the Sun. For most purposes the Sun is the foreground in those images. However exactly the same images are also studied to detect solar comets, and to study those you have to block out the Sun and your foreground becomes everything else. A program cannot possibly know whether you intend to look at the Sun in the image or if you intend to look at the comets in the same image.
Therefore you need to define the characteristics you want your program to look for and write the program to match those.
Image Analyst
Image Analyst 2017년 2월 1일
The original poster, Raj, didn't have a foreground and background. He asked about the entire image. If you have a foreground and background Raghu, I suggest you look at my Image Processing Tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 If you're lucky, you can get them from simple thresholding. Otherwise you might need to do some preprocessing steps in order to get to a point where you can do thresholding. It all depends on what your image looks like. If you still need help, read this link and post your ENTIRE error message in a new discussion thread just for you.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by