Error using images.internal.imageDisplayValidateParams>validateCData (line 122) If input is logical (binary), it must be two-dimensional.
이전 댓글 표시
a=imread('c1.jpg');
imshow(a)
cd=double(a);
imshow(cd)
imshow(cd/255)
cd1=im2double(a);
figure, imshow(cd1)
c= a>120;
imshow(c)
impixelinfo
OUTPUT
Error using images.internal.imageDisplayValidateParams>validateCData (line 122)
If input is logical (binary), it must be two-dimensional.
Error in images.internal.imageDisplayValidateParams (line 30)
common_args.CData = validateCData(common_args.CData,image_type);
Error in images.internal.imageDisplayParseInputs (line 79)
common_args = images.internal.imageDisplayValidateParams(common_args);
Error in imshow (line 253)
images.internal.imageDisplayParseInputs({'Parent','Border','Reduce'},preparsed_varargin{:});
Error in img (line 9)
imshow(c)
답변 (2개)
Walter Roberson
2020년 2월 8일
1 개 추천
Nearly all jpg are rgb. You are not converting to grayscale before doing your test against 120
Lahiru Karunathilaka
2021년 12월 12일
0 개 추천
imshow(cd/255);
댓글 수: 1
Walter Roberson
2021년 12월 12일
They already have that in their code, and the line is not a problem for them. Their problem was with
c= a>120;
imshow(c)
and imshow() is complaining that logical values must be 2 dimensional.
Th is likely caused by a being 3 dimensional instead of 2 dimensional. The input file is JPG. and the overwhelming majority of JPG files are RGB images instead of grayscale images. The initial specification for JPG did not permit grayscale images, so for maximum compatibility with old readers, most JPG writing software converts grayscale images to the equivalent RGB images and writes those.
카테고리
도움말 센터 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!