how to select a specified region in an image based on location and calculate its area
古いコメントを表示

I want to calculate the area of the material included in each pucket?
2 件のコメント
Image Analyst
2014 年 12 月 26 日
What is the material, and what is a pucket?
The lighting is very bad. Try to improve it and your task will be a LOT easier.
See my File Exchange for several image segmentation demos http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
helwan ghgs
2014 年 12 月 26 日
採用された回答
その他の回答 (1 件)
Image Analyst
2014 年 12 月 26 日
0 投票
I don't know what/where the bucket is, what/where the sand is, and where the shadows are. The lighting is horrible and could definitely be improved. Plus who's idea was it to have a sand-colored background when you want to find sand pouring in front of it?!?! The disc thing should be black or at least some contrasting color. I'd fix all that first since it's far easier to design an image analysis algorithm if you have a good image to start with.
11 件のコメント
helwan ghgs
2014 年 12 月 28 日
helwan ghgs
2014 年 12 月 28 日
Image Analyst
2014 年 12 月 28 日
編集済み: Image Analyst
2014 年 12 月 28 日
Trust me, you will spend less time painting your disc than you would designing an image processing algorithm to handle exceptionally poor images. Paint the round part black and paint the ends of the lifters some bight non-sand color like white or bright green.
See my File Exchange for demos on image segmentation and color segmentation.
You'll see how to crop the region and redisplay it, which has the effect of scaling/magnifying it. You'll also learn how to segment the regions and measure things like area and perimeter and color/intensity.
helwan ghgs
2014 年 12 月 30 日
helwan ghgs
2014 年 12 月 30 日
Image Analyst
2014 年 12 月 30 日
I don't know what the "sacle" is. If you want the convex hull, you can use bwconvhull(BW, 'union'). Then you can find the centroid if you want that.
Until you can get your disc repainted, I suggest you just use impoly() or roipolyold() to hand-draw the lifter regions.
2. There are code samples for processing a bunch of files in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
helwan ghgs
2014 年 12 月 30 日
helwan ghgs
2014 年 12 月 31 日
編集済み: Image Analyst
2014 年 12 月 31 日
Image Analyst
2014 年 12 月 31 日
Before the loop just set a counter:
filesProcessed = 0;
Then right after you call imread(), increment it
filesProcessed = filesProcessed + 1;
then I guess you could set Area_1 to be filesProcessed, but I'm not really sure Area_1 would be a good name for the number of files that were processed, plus I don't know who Area_1 would be a matrix (2-D array) if it was just the number of files being processed.
helwan ghgs
2015 年 1 月 1 日
Image Analyst
2015 年 1 月 1 日
編集済み: Image Analyst
2015 年 1 月 1 日
You said "I need Area_1 to be a matrix of the number of the number of image files being processed. " A matrix is a 2D array and I already saw that you were using that equation for one of them so I figured the second column would be the "number" like you asked for. But now it seems like you just want a row or column vector (1-D array) rather than a matrix. To get that, simply index Area_1 with filesProcessed. Don't use k because some k's may be skipped if there is no image for that k.
Area_1(filesProcessed) = (d_1 / b) * 1963.5;
You don't need to credit me specifically in your work but maybe you can just say something like "I wish to thank the volunteers in the MATLAB Answers forum for their helpful guidance and suggestions" or something similar.
カテゴリ
ヘルプ センター および File Exchange で Repeated Measures and MANOVA についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

