필터 지우기
필터 지우기

Separate the rock in the image below from the background

조회 수: 11 (최근 30일)
john
john 2019년 5월 24일
댓글: Image Analyst 2023년 4월 28일
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.

답변 (2개)

KALYAN ACHARJYA
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);
uu.png
  댓글 수: 6
Vaishnavi Gulave
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
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
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).

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by