How can I segment circle shaped skin pimples with no clear difference with background?
1 次查看(过去 30 天)
显示 更早的评论
I tried some techniques like thresholding and kmeans to segment the pimples on hand, foot and mouth parts of body but did not get the desired result. I want the output image to have only the segmented pimples no other areas. Some input images have been attached.
Below is the code I tried to segment using kmeans.
% Read image
I = imread('hand1.jpg');
% Convert to L*a*b color space
lab_he = rgb2lab(I);
% Extract first channel (L)
ab = lab_he(:, :, 2:3);
% Convert to data type single
ab = im2single(ab);
% Perform clustering using K-Means
nColors = 3;
pixel_labels = imsegkmeans(ab, nColors, "NumAttempts", 3);
imshow(pixel_labels, []);
% Display each cluster with their objects
mask1 = pixel_labels == 1;
cluster1 = I .* uint8(mask1);
imshow(cluster1); title('Objects in cluster1');
mask2 = pixel_labels == 2;
cluster2 = I .* uint8(mask2);
imshow(cluster2); title('Objects in cluster2');
mask3 = pixel_labels == 3;
cluster3 = I .* uint8(mask3);
imshow(cluster3); title('Objects in cluster3');
Any help is appreciated.
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!