Separate the rock in the image below from the background
4 ビュー (過去 30 日間)
古いコメントを表示
I want to separate this rock in the following image from the background. Although I am new in this field, would you tell me, step by step, how to do it? Thanks in advance.
0 件のコメント
回答 (2 件)
KALYAN ACHARJYA
2019 年 5 月 25 日
編集済み: KALYAN ACHARJYA
2019 年 5 月 25 日
You can do that by image segmentation. Here the background of Image is distinctly different from foreground object (therefore it may easy).
Adjust the threshold vale, but for complex images (that menas where foregorunf objects are mixed with background) such cases you have to look for little advance segmentation algorithms.
See Otsu method, Adaptive threshold, Edge detection and many more basic segmentation algorithms, if this not works perfectly. Those Matlab function I have used are basics, read in Matlab documentation.
Suggested Book: Read Image Segmenation Chapter in Digital Image Processing using Matlab by Gonzalez
im=imread('image.jpeg');
grayImage=rgb2gray(im);
%% Basic Thresholding
thresholdValue=180;
result=imcomplement(grayImage<=thresholdValue);
mask=imcomplement(bwareafilt(result,1,'Largest'));
RGB_result=bsxfun(@times,im,cast(mask,'like',im));
imshow(RGB_result);
6 件のコメント
Vaishnavi Gulave
2023 年 4 月 28 日
- Assessment result: incorrectIs the binary mask a valid mask for this image?The submission must contain a variable named curlingMask.Check the red feedback message for specific hints.
- Assessment result: incorrectDoes the mask successfully separate the curling stones from the background?
- If your segmentation has more or less regions than curling stones, you may want to try using either morphology or the Image Region Analyzer App to help you. You may have very small regions that are hard to see. Run you code in MATLAB and zoom in.
- If your mask needs refinement, a good way to identify where the mask is not working well is to create a masked image and look at the mask along the borders of a curling stone. If you're struggling, try converting the image to grayscale and testing different approaches in the Image Segmenter App. Then examine the generated code.
showing these errors
Image Analyst
2023 年 4 月 28 日
@Vaishnavi Gulave Where did that come from? I don't see any curling stones in the original poster's submission up at the top. No idea what you're talking about. You should probably start your own discussion thread and post your m-file and your image file.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
Image Analyst
2019 年 5 月 25 日
I would try the Color Thresholder on the Apps tab of the MATLAB tool ribbon. Experiment with different color spaces, though I think HSV might be your best bet. You can have it export code once you've found the thresholds.
You then might do some clean up by using bwareafilt() to extract the largest blob, or blobs within some size range that you this is valid (in case you also want the small stone posts).
参考
カテゴリ
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!