Error using cd Argument must contain a string
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
I am getting this error while executing this code :
w = cd;
cd(DIAGPATH);
imwrite(image,[eyeimage_filename,'-normal.jpg'],'jpg');
cd(w);
% end diagnostics
%replace NaNs before performing feature encoding
coords = find(isnan(polar_array));
polar_array2 = polar_array;
polar_array2(coords) = 0.5;
avg = sum(sum(polar_array2)) / (size(polar_array,1)*size(polar_array,2));
polar_array(coords) = avg;
can anybody please explain it to me..need help. thankyou in advance.
採用された回答
im_path = fullfile(DIAGPATH, [eyeimage_filename,'-normal.jpg'] );
imwrite(image,im_path,'jpg');
Then you do not need any cd calls at all: this is a much faster and more robust way to write code. You will also find that the variable DIAGPATH is not a string, which it needs to be.
7 件のコメント
nisha chauhan
2016 年 2 月 22 日
編集済み: Stephen23
2016 年 2 月 22 日
hey thank you for ur positive reply. after making modification to my code :
% write out rings overlaying original iris image
im_path = fullfile('D:\matlab',[eyeimage_filename,'-normal.jpg'] );
imwrite(image,im_path,'jpg');
% end diagnostics
%replace NaNs before performing feature encoding
coords = find(isnan(polar_array));
polar_array2 = polar_array;
polar_array2(coords) = 0.5;
avg = sum(sum(polar_array2)) / (size(polar_array,1)*size(polar_array,2));
polar_array(coords) = avg;
following errors are occurring now can u please help me in this -
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
Error in normaliseiris (line 167)
im_path = fullfile('D:\matlab',[eyeimage_filename,'-normal.jpg'] );
Stephen23
2016 年 2 月 22 日
You need to check the variable eyeimage_filename: is it a string? What size is it? Tell me exactly the output of these commands:
class(eyeimage_filename)
size(eyeimage_filename)
nisha chauhan
2016 年 2 月 22 日
ans =
double
ans =
150 200
these are the outputs.
Jan
2016 年 2 月 22 日
@nisha: Do you see, that the variable "eyeimage_filename" does not contain a file name?
nisha chauhan
2016 年 2 月 23 日
編集済み: Stephen23
2016 年 2 月 23 日
@jan can't i just pass the variable which may containing eyeimage_filename instead of passing 'Img_89_1_1.jpg'.
my code :
clear all;
close all;
clc;
I=imread('Img_89_1_1.jpg');
figure();imshow(I);
title('INPUT IMAGE');
grey_img=rgb2gray(I);
figure();imshow(grey_img);
title('Gray image');
edge_image=edge(grey_img,'canny');
figure();imshow(edge_image);
title('CANNY IMAGE');
figure; imshow(edge_image);
[ci,cp,out]=thresh(grey_img,38,50);
figure();imshow(out);
class(I)
size(I)
[polar_array, polar_noise] = normaliseiris(out, 84, 101,47,...
81, 106, 12,I, 302, 24);
for eyeimage_filename = I it prompt following error :
ans =
uint8
ans =
150 200 3
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
Error in normaliseiris (line 167)
im_path = fullfile('D:\matlab',[eyeimage_filename,'-normal.jpg'] );
but when i put eyeimage_filename= 'Img_89_1_1.jpg', an image is created in my matlab folder like this.
please help !!


"can't i just pass the variable which may containing eyeimage_filename instead of passing 'Img_89_1_1.jpg'."
No, you can't.
An image is not a filename, an image is a numeric array of data, usually of class double or uint8.
A filename is a string, such as your string 'Img_89_1_1.jpg'.
You cannot use an array of numeric data for a filename. This makes no sense. Read the documentation for imwrite, or fullfile, or any other function that uses filenames: they all use strings. There is no mention of numeric arrays. Numeric arrays do not contain meta-data such as their origin filename, the date of creation or modification, your cousin's telephone number, or any other meta-data. Surprisingly, a numeric array contains numeric data!
To write an image to file you need two pieces of information: the image data (a numeric array) and the filename (a string). What do you possibly hope to achieve by giving imwrite two images arrays and no filename? Try this:
imwrite(I,im_path,'jpg');
That is all there is to it.
Jonathan Bonaparte
2018 年 9 月 20 日
Nisha. Can you help me out with iris recognition code. I'm getting same error as you got in findcircle.m functions.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Convert Image Type についてさらに検索
タグ
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
