Changing of image will result in error in code.
Afficher commentaires plus anciens
Whenever I change the jpg image name in the imread section (code attached below) the codes will fail to load, indicating that an error has occurred.
My codes:
--------------------------
clc;clear all;close all;
dat=[];
I1=imread('ab.jpg');
b=rgb2gray(I1);
[invmo]=invmoments(b);
features=[invmo];
dat=[dat ; features];
-----------------------------------
A total of 3 errors are present. The error reads like this:
(1st error)
Error using rgb2gray>parse_inputs (line 84)
MAP should be a double m x 3 array with values in the range [0,1]. Convert your map to double
using IM2DOUBLE.
(2nd error)
Error in rgb2gray (line 35)
X = parse_inputs(varargin{:});
(3rd error)
Error in invmoment (line 7)
b=rgb2gray(I1);
I ensured that that the new image file was in the same folder as the codes. As soon as i changed the image name to the original 1st file the codes run perfectly. I am puzzled as to why by just changing the image name the codes would not work. My goal was to run the same codes for other images but it don't work for some reason. Any guidance? Thanks.
1 commentaire
Jan
le 19 Déc 2012
You cannot get 3 errors. Matlab stops after the first. You see the calling stack of one error.
Réponses (1)
Image Analyst
le 19 Déc 2012
What does it report if you say
whos I1
2 commentaires
Walter Roberson
le 19 Déc 2012
Speculation: the image is empty.
Image Analyst
le 19 Déc 2012
Can it return empty? Or would it just throw an exception?
Catégories
En savoir plus sur Convert Image Type dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!