why i get this error
Show older comments
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');
Answers (1)
KSSV
on 19 Sep 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)
Categories
Find more on Contrast Adjustment in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!