how to calculate irregular shape area in the image
이전 댓글 표시
hi..i have i project that need me to detect and extract the irregular shape in the image.then i should to calculate the area in the unit cm.can you help me,how can i detect the irregular shape in the image automatic and how can i calculate that irregular shape area.i hope you can help me.Thank you.
댓글 수: 8
Walter Roberson
2011년 12월 28일
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
Sean de Wolski
2011년 12월 28일
Assuming cm is centimeters, I don't know how you could extract an area in it because centimeters are a meaure of length not area. Do you mean cm^2?
norfaizayu
2011년 12월 31일
Mansi N
2017년 5월 15일
sir i have a doubt ....in order to find the area ....first the image has to be clear of all noise and other irregularities right sir ? ....after all these rectifications is it necessary the image has to be segmented before finding the area ?
Walter Roberson
2017년 5월 15일
The image only has to be free of noise and irregularities that would change the area to within the accuracy you need.
For example, whether a particular pixel reading is 82 or 83 (because gaussian noise caused the reading to be higher than it "really" should be) does not matter if your threshold for inclusion of the location is (say) 39.
You might not need to segment, depending on what you are doing. Image Analyst indicates that segmentation is needed much less frequently than most people tend to expect.
Image Analyst
2017년 5월 15일
To find the area you may need to segment your image. If you just want to define the area's vertices somehow, like with roipoly() or imfreehand(), then you can get the area with polyarea(). However if the area is defined by something like intensity, texture, or whatever, then you need to segment the image. Segmentation means undergoing a series of steps such as filtering or morphology or something until you eventually get to an image that can be thresholded to form a binary image (your segmented image). With that binary image you can then label it with bwlabel() or bwconncomp() and then call regionprops(). Or you can call bwarea() for a different definition of area, weighted by how the boundary winds around, whereas regionprops() gives area as a simple count of pixels in the blobs.
Piya
2019년 4월 11일
What is the unit of area
Image Analyst
2019년 4월 12일
Pixels.
답변 (3개)
Florin Neacsu
2012년 1월 4일
1 개 추천
Hi,
Given your example I would suggest this approach:
after your edge detection:
create structural element of radius 4 (or 5 or whatever works for you)
dilate your edge map
erode (with the same strel)
imclearborder
create metric to eliminate "noise" (you can do something similar to circle detection : perimeter/area)
determine the area (in pixels; you need to know the spatial resolution of your initial image to obtain it in cm2).
Hope this helps.
Regards, Florin
댓글 수: 10
norfaizayu
2012년 1월 5일
Florin Neacsu
2012년 1월 5일
Hello,
In the code you gave us, you actually use a structural element. The command strel creates one. Look at the help of that command and create a circular strel of radius 4 or 5.
norfaizayu
2012년 1월 6일
Florin Neacsu
2012년 1월 9일
Hello,
Yes disk works. Try something like :
se=strel('disk',4);
norfaizayu
2012년 1월 26일
Walter Roberson
2012년 1월 26일
Number of pixels in the area, multiplied by the real-world area represented by one pixel -- which you would need external information to calculate.
Walter Roberson
2012년 1월 26일
There is nothing in the image you posted earlier that would allow anyone calculate the real-world area represented by one pixel.
If your original picture (from the camera) is in JPEG or TIFF mode, there is a possibility that your camera recorded EXIF information that included the camera aperture (not uncommon) and the focus distance (not so common). Sometimes the EXIF information has enough information to estimate real-world distances... but more often it does not.
You need a scale of some sort in the image, or else you need to have some real-world physical distances measured. There is no way to calculate real-world distances from an image alone.
http://www.mathworks.com/matlabcentral/answers/18380-getting-x-and-y-for-3d
norfaizayu
2012년 1월 26일
Image Analyst
2012년 1월 26일
Have you imaged your known object yet? When you have, call improfile() to interactively get the length by calculating the two line endpoints that improfile will provide to you. Then you conversion factor is your real world length (e.g. 10 mm) divided by the number of pixels that the distance is.
Walter Roberson
2012년 1월 26일
Urgency does not make the impossible possible.
Perhaps, though, it would be appropriate to ask about your accuracy goals. If your accuracy goals are not especially high, then you could make use of the average of the real-world measurements that have been studied; see http://uclue.com/?xq=4504
Image Analyst
2011년 12월 28일
0 개 추천
You might be able to adapt my BlobsDemo tutorial to your image:
댓글 수: 11
norfaizayu
2011년 12월 28일
Walter Roberson
2011년 12월 28일
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
norfaizayu
2012년 1월 1일
Image Analyst
2012년 1월 1일
I can't see it. I clicked around 6 things on that page and still can't see it. Try tinypic.com instead.
norfaizayu
2012년 1월 3일
Walter Roberson
2012년 1월 3일
Corrected URL:
http://img834.imageshack.us/img834/6446/images1zpw.jpg
norfiazayu, please do not include the [URL] and so on. This forum does not recognize [URL] tags anywhere, and the comments section (here) does not recognize any formatting codes at all.
norfaizayu
2012년 1월 3일
norfaizayu
2012년 1월 3일
norfaizayu
2012년 1월 4일
Sean de Wolski
2012년 1월 4일
How about a threshold, a borderclearing, and a sum?
norfaizayu
2012년 1월 5일
Gyaneshwar dubacharla
2016년 1월 22일
0 개 추천
how to find area from contour plots????
댓글 수: 1
Image Analyst
2016년 1월 22일
Contour() returns the coordinates. You could then use polyarea() or poly2mask() followed by regionprops().
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!