Search 3D RGB array for the closest match?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Roger Breton
le 24 Fév 2022
Commenté : Roger Breton
le 25 Fév 2022
In my humble script, I managed to capture the 3D location on a scatter3 graph (see my previous question) out of a pushbutton uicontrol. Now, in the callback function, I have to find a way to locate the closest x,y coordinates corresponding this 3D data point :
Granted, there are many possibilities here, to approach the problem.
This is my call back function so far :
function plot2D(src,event)
global clickedCIE_L clickedCIE_a clickedCIE_b;
figure(1);
Clicked_Pixel_RGB = lab2rgb([clickedCIE_L clickedCIE_a clickedCIE_b], 'WhitePoint','d50');
plot(x,y);
end
So I convert CIE Lab to RGB values (double). I still have to contend with negative RGB values and RGB values greater than 1.0. If you have any suggestions for this too, I'm all ears.
This is my original RGB data :
img = imread(RGBimage);
img_double = double(img)./255;
img2Lab = rgb2lab(img_double, 'WhitePoint','d50');
So, I think I either have to search the img_double array or the img array? But how? Could I use something like this :
row = find(img(:)~= Clicked_Pixel_RGB ); % Assume I multiplied Clicked_Pixel_RGB by 255
But it's not working... I have the intution that I have to search the whol array. That's why I use img(:). But I am not sure that's the right syntax.
2 commentaires
Walter Roberson
le 24 Fév 2022
Side point:
img_double = double(img)./255;
instead you should use
img_double = im2double(img);
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!