- 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
- 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.
- you can try combining imsegkmeans with other segmentation methods like active contours or thresholding to improve the results.
- 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.
How to segment this image better?
2 次查看(过去 30 天)
显示 更早的评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1387139/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1387144/image.png)
0 个评论
回答(2 个)
Vinayak
2023-5-22
To improve the segmentation results of leaves from the background using imsegkmeans, you can try implementing the following,
2 个评论
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
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!