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.

 채택된 답변

Stephen23
Stephen23 2016년 2월 22일
편집: Stephen23 2016년 2월 22일

0 개 추천

Don't use cd for trivial code like this: simply construct the filepath using fullfile
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
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
Jan 2016년 2월 22일
@nisha: Do you see, that the variable "eyeimage_filename" does not contain a file name?
nisha chauhan
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 !!
Stephen23
Stephen23 2016년 2월 23일
편집: Stephen23 2016년 2월 23일
"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에 대해 자세히 알아보기

태그

질문:

2016년 2월 22일

댓글:

2018년 9월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by