наложение гистограммы с медианой цветного изображения - PullRequest
0 голосов
/ 13 июля 2020

Мне нужна гистограмма цвета по оси x, и мне нужно среднее значение с той же оси, поэтому я пытаюсь наложить медианное значение на гистограмму, как я могу это сделать?

`%% load picture
[picName,pathName] = uigetfile({'*.jpg;*.JPG'},'Select pictures','MultiSelect','on'); %For one picture only

% If only one picture, convert that to a cell.
if ischar(picName)
    picName = {picName};
end

for  ii   = 1 : length(picName)
MyImrgb = double(imread([pathName picName{ii}]))/255;
MyImrgb = MyImrgb.^2.2; 
[x, y, z] = size(MyImrgb);

%% transform my picture in a DKL color space
% Define a DKL2RGB mat based on the classic calibration technic
% this P matrix defines DKL in RGB color space
                    % ld      % rg      %yv
ldrgyv2rgbMat =  [1,1,0.236748566577269;
                   1,-0.299338211934457,-0.235643322285071;
                   1,0.0137437185685517,1];  % B
MyImrgbCol = reshape(MyImrgb, [x*y, z]);
% define each RGB pixe lin DKL (inverse matrix Q or P with \)
MyImldrgyvCol = ldrgyv2rgbMat\(MyImrgbCol'*2 - 1);
LM = MyImldrgyvCol(2,:);
medLM = median(LM)
figure (1), imhist(LM, 0:0.01:1); (% want to get the histogram of x axis and the median value)
S = MyImldrgyvCol(1,:);
figure (2),imhist(S, 0:0.01:1)
medS = median(S)
`
...