Вобщем показали мне демо код который вытаскивает три составляющих цвета из матрицы. только после этого нужно применить формулу RGB8 = uint8(round(RGB64*255)); и получить номер цвета!
Код
% Change the current folder to the folder of this m-file.
if(~isdeployed)
cd(fileparts(which(mfilename)));
end
clc; % Clear command window.
clear; % Delete all variables.
close all; % Close all figure windows except those created by imtool
imtool close all; % Close all figure windows created by imtool.
workspace; % Make sure the workspace panel is showing.
fontSize = 20;
% Make a 554-by-564 double matrix with values in the range of 0-255.
doubleImage = 128 * rand(554, 564);
% Display it.
image(doubleImage);
% Apply a jet colormap
cMap = jet(256);
colormap(cMap);
colorbar;
title('Original color Image', 'FontSize', fontSize);
set(gcf, 'Position', get(0,'Screensize')); % Enlarge figure to full screen
% Ask user to click on a point.
uiwait(msgbox('Click on a point in the image'));
[x,y] = ginput(1);
% Round to the nearest pixel
x = int32(x)
y = int32(y)
% Get the matrix value at that pixel.
grayLevel = doubleImage(y, x)
% Get the color map row for that grayLevel.
cMapIndex = floor(grayLevel) + 1;
% Get the color triplet for that grayLevel.
colorTriplet = cMap(cMapIndex, :)
% Report results.
message = sprintf('The value at (%d, %d) is %.3f.\nThe index in the color map table is %d.\nThe color triplet for that is [%.3f, %.3f, %.3f].',...
x, y, grayLevel, cMapIndex, colorTriplet(1), colorTriplet(2),colorTriplet(3));
uiwait(msgbox(message));