How to segment this image better?

조회 수: 3 (최근 30일)
Tao Hu
Tao Hu 2023년 5월 18일
댓글: Image Analyst 2023년 5월 23일
I'm tring to segment the below image using imsegkmeans. The objective is to segment the leaves from the background. Some dark part and yellow part are misclassified. Could anyone point some directions for me to improve the results? Really appreciate it! Below are the original image and the results.

답변 (2개)

Vinayak
Vinayak 2023년 5월 22일
To improve the segmentation results of leaves from the background using imsegkmeans, you can try implementing the following,
  1. Adjust the number of clusters: imsegkmeans requires the number of clusters to be specified. You can try adjusting this parameter to see if it improves the segmentation. For example, you can try reducing the number of clusters to segment the leaves from the background more accurately. More information about this method can be inferred from here https://www.mathworks.com/help/images/ref/imsegkmeans.html#d124e195494
  2. Preprocessing: Prior to segmentation, you can preprocess the image to improve the results. For example, you can apply noise reduction filters like Median filter or Gaussian filter to remove noise from the image.
  3. you can try combining imsegkmeans with other segmentation methods like active contours or thresholding to improve the results.
  4. Post-processing: After segmentation, you can perform post-processing to refine the segmentation results. For example, you can fill the holes in the segmented regions using morphological operations like imfill and imopen.
  댓글 수: 2
Tao Hu
Tao Hu 2023년 5월 23일
Thank you. I got the above result with the number of clusters set to 2. The main problem is that dark colors are classified as background. There are very limited paramerters to be tuned with imsegkmeans
Image Analyst
Image Analyst 2023년 5월 23일
Right. Your image is bad. Did you see my Answer below? Please fix your image capture conditions and repost your improved images.

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2023년 5월 22일
The two main problems in the image are poor lighting and lens shading. Try to put the paper in a light booth where the lighting is uniform and you'll have no shadows. It should be like an integrating sphere, in other words, a box with lighting from above with the insides of the booth painted white or gray. If you still can't get rid of the shadows, then add some led light bars down low.
It also looks like you have a really bad lens because you have severe lens shading. The center is much, much brighter than the edges. You need to do a background correction where you divide your image by the percentage of light at each pixel location. This will "flatten" the image and undo the effects of lens shading and allow for much better segmentation, perhaps even with a simple global threshold. I'm attaching a background correction demo.

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by