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'] );
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)
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.
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!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 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)
