How to create a linkage between different blob?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tan Wen Kun
el 1 de Dic. de 2015
Editada: Tan Wen Kun
el 3 de Dic. de 2015
For example I using watershed and get different color piece.
I want to create a matrix to show the linkage.
1 1 1 1 1 1 1 1 1 1 1
1 2 2 1 3 3 1 4 4 0 1
1 2 1 3 3 1 0 4 4 0 1
1 1 1 1 1 1 1 1 1 1 1
so when loop vertical and horizontal I wish to get the result like matrix.jpg
I want check before 1 and after 1,
if check got 2,3 so return 1 to matrix(3,2)=1 matrix(2,3)=1
if check got 3,4 so return 1 to matrix(3,4)=1 matrix(4,3)=1
if 0 then ignore.
How to do this?
6 comentarios
Walter Roberson
el 2 de Dic. de 2015
You need to define when two colors are "nearly the same" or not. It is not an easy question, especially when you are working with the darker colors. For example, is [10,0,0] "nearly the same" as [0,0,0] because the values are within 10, or is [10,0,0] definitely "red" whereas [0,0,0] is "black" ?
You should look for some of what Image Analyst has posted about "Delta E"
Respuesta aceptada
Walter Roberson
el 2 de Dic. de 2015
Use glcm on the blob numbers. This will give you counts instead of just yes/no, but you can get the yes/no by just testing whether the count > 0.
5 comentarios
Walter Roberson
el 3 de Dic. de 2015
If you have a function that can return whether two rgb colors are "close" or not, then you pass in to that table the pseudocolor map indexed at the blob number. For example,
[ind_image, cmap] = rgb2ind(TheColorImage);
labeled_image = ind_image + 1; %because first color of ind is 0
first_lab = labeled_image(7,38); %label of one place in the image
second_lab = labeled_image(11,20); %label of a different place in the image
first_color = cmap(first_lab,:); %rgb corresponding
second_color = cmap(second_lab,:); %rgb corresponding
if YourFunctionToTellIfColorsAreClose(first_color, second_color)
....
end
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!