hi, please help me to find perimeter, area, aspect ratio, form factor, rectangularity, narrow factor from an binary object of leaf ?
1 次查看(过去 30 天)
显示 更早的评论
I using regionprops() for perimeter and area but can't. I don't understand how to define it and put it in each formula, cause I confused with the code I see in matlab and some example. please help me
采纳的回答
Image Analyst
2018-9-29
See my Image Segmentation Tutorial: https://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862&sort=downloads_desc
If you still don't understand it, explain why.
17 个评论
Image Analyst
2018-9-30
No, you haven't shared your image but I'd bet you don't need edge detection. It's almost never required. Even though beginners think every image processing algorithm starts with an edge detection, in actual practice it's almost never needed and usually a simple thresholding will work fine. It probably will for you also. But again, I haven't seen your image. Search for the tag "leaf" - I have posted leaf algorithms many times. Also see attached demo.
Oman Wisni
2018-9-30
编辑:Oman Wisni
2018-9-30
this sir, I have example binary image. what should I do to count the area, Perimeter, etc ? I already see your code in https://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862&sort=downloads_desc, but I don't understand the with this code 'blobArea = blobMeasurements(k).Area;'
Oman Wisni
2018-9-30
sir, this is another question, I thresholding using im2bw, can you explain the range of values used in determining the binary? is im2bw the global otsu thresholding?
And using code imfill, what the difference imfill with closing ? is that same for fills holes in the binary image BW?
thanks sir
Oman Wisni
2018-9-30
编辑:Oman Wisni
2018-9-30
sir, this is another question, I thresholding using im2bw, can you explain the range of values used in determining the binary? is im2bw the global otsu thresholding? I use imbinarize but I get error
And using code imfill, what the difference imfill with closing ? is that same for fills holes in the binary image BW?
thanks sir
Image Analyst
2018-9-30
im2bw() is the older, deprecated version of imbinarize(). They both do Otsu thresholding, though imbinarize() can change the threshold to adapt spatially to varying background in the image. imbinarize() was introduced in R2016a. im2bw() does only global thresholding.
The range of values used in determining the threshold are all the values in the image. If you use imbinarize() and choose locally adaptive thresholding then it will use only the values within the sliding window.
imfill() will fill all holes in a white/true/1 blob. It does not change the shape of outer boundaries - they remain exactly the same as before the fill.
If you use imclose(), it will dilate the blob which will fill in little bays in the outline and possible fill in some interior holes. Then it will erode the blob to try to bring it back to roughly the same size. The end result is that the blob will have a more rounded shape because all the little nooks and crannies and bays are filled in. It won't necessarily fill all interior holes unless you used a big enough kernel such that those holes were covered up during the dilation phase of the closing.
Oman Wisni
2018-9-30
Yes sir. Now I understand. Thanks!
But sir, I still not yet know how to create to find the perimeter and area, count the around of the image and how to save the result in Ms.excel for continue clasification?
I still in my last project in university, and there are no same topic for every students so only I'm get this topic, I really new in matlab so Im new learning. So I need some explain and example can help me. It will great and helpfull if you can help me.
Image Analyst
2018-9-30
I don't understand why you don't understand 'blobArea = blobMeasurements(k).Area;'
You do know that blobMeasurements is a structure array, don't you? So, each structure in the array has fields, Area, Perimeter, and whatever you ask for. So when I do 'blobArea = blobMeasurements(k).Area;' I'm just assigning the Area measurement (the area of the k'th blob) to its own variable called blobArea. Same for perimeter. Just like you'd save any variable into MATLAB into a new variable. If A was a vector and I did B=A(7) then I'm taking the 7th element of A and assigning it to B. It's the same here, it's just that I'm taking the field of a structure instead of an element from an array, but it's still a single number.
If you looked at my tutorial, you would have seen that you can also get all the values into a single array with brackets
allAreas = [blobMeasurements.Area]
allPerimeters = [blobMeasurements.Perimeter]
Oman Wisni
2018-10-2
Sir, how to find the length and width of the object leaf ? here I have formula (slimness = Lp/Wp) where :
Lp = length of the leaf and
Wp = width of the leaf,
how to find and create the code slimness/aspect ratio ?
should I use majorAxisLength to find length? or have another way ?
thanks
Oman Wisni
2018-10-2
thanks sir, I new understand your code in BlobsDemo, it is work. But Perimeter I not get result, only in Perimeter. What wrong sir ?
Image Analyst
2018-10-2
I don't understand what "Perimeter I not get result, only in Perimeter." means. Did you get the perimeter from regionprops() or not? It DOES return it if you ask for it.
Oman Wisni
2018-10-3
this my file and the image sir, please save all the value from regionprops and momen in Ms.Excel and make new folder for save all image sir. In code to find invariant moment I get problem, please fix it too sir. thanks
Oman Wisni
2018-10-3
Sir, I need find length leaf, width leaf and diameter of leaf too sir. To find aspect ratio, roundness and rectangularity. Thanks sir
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)