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!