![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/196786/image.png)
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/196786/image.png)
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 日
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/192157/image.bmp)
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 月 2 日
編集済み: Image Analyst
2018 年 10 月 3 日
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/192479/image.png)
yes, I not get perimeter from regionprops()
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/192507/image.bmp)
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!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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 (한국어)