why i get this error

1 回表示 (過去 30 日間)
sk ibrar ahmed
sk ibrar ahmed 2020 年 9 月 19 日
回答済み: KSSV 2020 年 9 月 19 日
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');

回答 (1 件)

KSSV
KSSV 2020 年 9 月 19 日
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)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by