Changing of image will result in error in code.
古いコメントを表示
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 件のコメント
Jan
2012 年 12 月 19 日
You cannot get 3 errors. Matlab stops after the first. You see the calling stack of one error.
回答 (1 件)
Image Analyst
2012 年 12 月 19 日
What does it report if you say
whos I1
2 件のコメント
Walter Roberson
2012 年 12 月 19 日
Speculation: the image is empty.
Image Analyst
2012 年 12 月 19 日
Can it return empty? Or would it just throw an exception?
カテゴリ
ヘルプ センター および File Exchange で Images についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!