why i get this error

2 visualizaciones (últimos 30 días)
sk ibrar ahmed
sk ibrar ahmed el 19 de Sept. de 2020
Respondida: KSSV el 19 de Sept. de 2020
i=imread('leaf_Pic_small.jpg');
s=imadjust(i,stretchlim(i,[0.05 0.95]),[]);
subplot(2,2,1), imshow(i), title('original');
subplot(2,2,2), imshow(s), title('stretched');
subplot(2,2,3), imhist(i), title('histogram of original img');
subplot(2,2,4), imhist(s), title('hist of stretched img');
>> leafproj
Error using imhist
Expected input number 1, I or X, to be two-dimensional.
Error in imhist>parse_inputs (line 278)
validateattributes(a,
{'double','uint8','int8','logical','uint16','int16','single','uint32',
'int32'}, ...
Error in imhist (line 60)
[a, n, isScaled, top, map] = parse_inputs(varargin{:});
Error in leafproj (line 5)
subplot(2,2,3), imhist(i), title('histogram of original img');

Respuestas (1)

KSSV
KSSV el 19 de Sept. de 2020
Your image seems to be a RGB image. You have to use imhist on a 2D matrix. Not 3D image.
R = i(:,:,1) ;
G = i(:,:,2) ;
B = i(:,:,3) ;
figure
imhist(R)
figure
imhist(B)
figure
imhist(G)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by