Does Otsu is also used for color image segmentation.
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Aamir Ishaq
el 29 de Mzo. de 2018
Respondida: Walter Roberson
el 1 de Jul. de 2018
I have applied Otsu on this image and get this black & white segmented image. Is it possible to get the same segment in its original color. I mean the dog, flowers and some grass under the dog should by as it is in original and rest of the image becomes black.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/171658/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/171659/image.jpeg)
I = imread('D:\Dog.jpg');
I = rgb2gray(I);
imshow(I)
level = multithresh(I);
seg_I = imquantize(I,level);
figure
imshow(seg_I,[]);
1 comentario
KALYAN ACHARJYA
el 29 de Mzo. de 2018
Editada: KALYAN ACHARJYA
el 29 de Mzo. de 2018
It may be possible. In segmented images, there are two descriptors, whether it is a dog or flower? You can consider it by assuming blob area, largest is dog and rest are flowers. Based on the position of pixel information (Edit original Image).
Respuesta aceptada
Guillaume
el 29 de Mzo. de 2018
The whole principle of Otsu is to work on intensities. So you could apply Otsu to the grayscale intensities, or the red channel intensities, or the blue channel intensities, etc, or some intensity derived from all 3 RGB channels, but the Otsu method has no concept of colour.
For colour segmentation, you need a different technique. You could use the Colour Thresholder App. Also look at the various topics at the bottom of the Segmentation help page.
2 comentarios
KALYAN ACHARJYA
el 29 de Mzo. de 2018
Sir his question title is different, question description is different, I have commented on it. Am I right?
Image Analyst
el 1 de Jul. de 2018
Different than what? I think Guillaume's answer is fine and addresses the posters need.
Más respuestas (1)
Walter Roberson
el 1 de Jul. de 2018
Yes,
I = imread('D:\Dog.jpg');
Ig = rgb2gray(I);
imshow(Ig)
level = multithresh(Ig);
seg_Ig = imquantize(Ig,level);
figure
imshow(seg_Ig,[]);
I_masked = I .* repmat( cast(seg_Ig-1, class(I)), 1, 1, size(I,3) );
figure
imshow(I_masked);
imquantize returns double when used in that form, and when given a single input value, the results of imquantize are 1 (value less than the threshold) and 2 (value greater than the threshold) . We subtract 1 to make those into 0 and 1, make the result into the same data type as the input image is, and replicate it along the third dimension to have the same number of color planes that the input image has. The multiplication then acts to mask the original image, turning the pixels black whereever the image intensity was lower than the threshold.
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!