Find the Euclidean distance of each pixel from a user-selected pixel in color space and displays scaled images from 0 to the current max distance.

5 vues (au cours des 30 derniers jours)
Hi,
Can someone help me? Sorry for bad english
I need to find the Euclidean distance of each pixel from a user-selected pixel in RGB space and other in Lab space. Then displays 2 scaled images either from 0 to the current max distance, or from 0 to the theoretically maximum possible distance in a given color space. The result should be like
I'm new to this
Here is my current code
I dont know if im on the right way
Thanks everyone
  4 commentaires
KALYAN ACHARJYA
KALYAN ACHARJYA le 23 Jan 2021
Modifié(e) : KALYAN ACHARJYA le 23 Jan 2021
"I need to calculate the Euclidean distance between pixel colors, not between their coordinates"
Distance measure between to positions/locations, the indices (row number and column number) of particular color level exactly represent the same.
Arsen Driashkaba
Arsen Driashkaba le 23 Jan 2021
Sorry, im new to this. Can you help me please? Thanks a lot for replying

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 23 Jan 2021
Just do this
[x, y] = ginput(1);
row = round(y);
col = round(x);
rp = double(rgbImage(row, col, 1));
gp = double(rgbImage(row, col, 2));
bp = double(rgbImage(row, col, 3));
[r, g, b] = imsplit(double(rgbImage));
colorDistance = sqrt((r - rp).^2 + (g - gp).^2 + (b - bp).^2);
imshow(colorDistance, []);
See attached demo for Delta E demos. Delta E is the coor distance in LAB color space.
  4 commentaires
Arsen Driashkaba
Arsen Driashkaba le 23 Jan 2021
I did the same just forgot [ ] as parameter of imshow(). Now it is working
Thank you very much for help!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by