Error using images.internal.imageDisplayValidateParams>validateCData (line 122) If input is logical (binary), it must be two-dimensional.
23 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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)
0 commentaires
Réponses (2)
Walter Roberson
le 8 Fév 2020
Nearly all jpg are rgb. You are not converting to grayscale before doing your test against 120
0 commentaires
Lahiru Karunathilaka
le 12 Déc 2021
imshow(cd/255);
1 commentaire
Walter Roberson
le 12 Déc 2021
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.
Voir également
Catégories
En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!