フィルターのクリア

problem in imfinfo give me the following error

3 ビュー (過去 30 日間)
Biza Ferreira
Biza Ferreira 2016 年 6 月 29 日
編集済み: Biza Ferreira 2016 年 6 月 29 日
I have done the following code
clear all,close all,clc;
originalImage = imread('101_1.tif');
testImage = imread('101_1.tif');
originalInfo = imfinfo(originalImage)
fakelInfo = imfinfo(testImage);
if(getfield(originalInfo,'ColorType')=='truecolor')
originalImage=rgb2gray(imread('101_1.tif'));
else if(getfield(originalInfo,'ColorType')=='grayscale')
originalImage=imread('101_1.tif');
else
error('The Color Type of Left Image is not acceptable. Acceptable color types are truecolor or grayscale.');
end
end
if(getfield(fakelInfo,'ColorType')=='truecolor')
testImage=rgb2gray(imread('101_1.tif'));
else if(getfield(fakelInfo,'ColorType')=='grayscale')
fakelInfo=imread('101_1.tif');
else
error('The Color Type of Left Image is not acceptable. Acceptable color types are truecolor or grayscale.');
end
end
But when I run this code it shows me the following error:
Error using imfinfo (line 80)
Expected FILENAME to be one of these types:
char
Instead its type was uint8.
Error in teste (line 20)
originalInfo = imfinfo(originalImage)
how can I solve this.

採用された回答

Walter Roberson
Walter Roberson 2016 年 6 月 29 日
orig_fname = '101_1.tif';
test_fname = '101_1.tif';
originalImage = imread(orig_fname);
testImage = imread(test_fname);
originalInfo = imfinfo(orig_fname);
  1 件のコメント
Biza Ferreira
Biza Ferreira 2016 年 6 月 29 日
編集済み: Biza Ferreira 2016 年 6 月 29 日
thank you

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by