how to calculate the area of an object?
2 ビュー (過去 30 日間)
古いコメントを表示
I have a set of images: 5 images, I calculated the suface of these images and then I saved them in a matrix and I have another set of images that contains 5 images, I calucled in another scipt their areas and I saved them in a matrix.
here are the surface values of each group of images :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/220197/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/220198/image.png)
but the problem when I calul the area of 2 groups of images in a single script, the values will be unorganized, here is:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/220199/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/220200/image.png)
that is, I want the values of the images to remain like this:
107, 410, 281, 200, 266, 20, 25, 13, 23, 16
10 件のコメント
Rik
2019 年 5 月 21 日
You have a list of 10 files. What are their exact names and in what order do you want to have their results in the output array?
採用された回答
Image Analyst
2019 年 5 月 20 日
You shouldn't calculate areas based on the grayscale image. You must segment it first into foreground and background areas and pass in the binary image to regionprops(). See my Image Segmentation Tutorial: in my File Exchange
5 件のコメント
Image Analyst
2019 年 5 月 21 日
Save each areas matrix to a mat file, then read in all the mat files and stitch them together
s1 = load(filename1);
areas1 = s1.areas
s2 = load(filename1);
areas2 = s2.areas
allAreas = [areas1, areas2]
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Segmentation and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!