Error regarding imresize.m

function [template, mask] = createiristemplate(eyeimage_filename)
eyeimage_filename='aeval2.bmp';
% path for writing diagnostic images
global DIAGPATH
DIAGPATH = 'diagnostics';
%normalisation parameters
radial_res = 20;
angular_res = 240;
% with these settings a 9600 bit iris template is
% created
%feature encoding parameters
nscales=1;
minWaveLength=18;
mult=1; % not applicable if using nscales = 1
sigmaOnf=0.5;
eyeimage = imread(eyeimage_filename);
savefile = [eyeimage_filename,'-houghpara.mat'];
[stat,mess]=fileattrib(savefile);
if stat == 1
% if this file has been processed before
% then load the circle parameters and
% noise information for that file.
load(savefile);
else
% if this file has not been processed before
% then perform automatic segmentation and
% save the results to a file
[circleiris circlepupil imagewithnoise] = segmentiris(eyeimage);
save(savefile,'circleiris','circlepupil','imagewithnoise');
end
% WRITE NOISE IMAGE
%
imagewithnoise2 = uint8(imagewithnoise);
imagewithcircles = uint8(eyeimage);
%get pixel coords for circle around iris
[x,y] = circlecoords([circleiris(2),circleiris(1)],circleiris(3),size(eyeimage));
ind2 = sub2ind(size(eyeimage),double(y),double(x));
%get pixel coords for circle around pupil
[xp,yp] = circlecoords([circlepupil(2),circlepupil(1)],circlepupil(3),size(eyeimage));
ind1 = sub2ind(size(eyeimage),double(yp),double(xp));
% Write noise regions
imagewithnoise2(ind2) = 255;
imagewithnoise2(ind1) = 255;
% Write circles overlayed
imagewithcircles(ind2) = 255;
imagewithcircles(ind1) = 255;
w = cd;
cd(DIAGPATH);
imwrite(imagewithnoise2,[eyeimage_filename,'-noise.jpg'],'jpg');
imwrite(imagewithcircles,[eyeimage_filename,'-segmented.jpg'],'jpg');
cd(w);
% perform normalisation
[polar_array noise_array] = normaliseiris(imagewithnoise, circleiris(2),...
circleiris(1), circleiris(3), circlepupil(2), circlepupil(1), circlepupil(3),eyeimage_filename, radial_res, angular_res);
% WRITE NORMALISED PATTERN, AND NOISE PATTERN
w = cd;
cd(DIAGPATH);
imwrite(polar_array,[eyeimage_filename,'-polar.jpg'],'jpg');
imwrite(noise_array,[eyeimage_filename,'-polarnoise.jpg'],'jpg');
cd(w);
% perform feature encoding
[template mask] = encode(polar_array, noise_array, nscales, minWaveLength, mult, sigmaOnf);

9 Comments

I am getting error..
??? Error using ==> iptcheckinput
Function IMRESIZE expected its first input, A, to be nonempty.
Error in ==> imresize>parsePreMethodArgs at 358
iptcheckinput(A, {'numeric', 'logical'}, {'nonsparse', 'nonempty'}, mfilename, 'A', 1);
Error in ==> imresize>parseInputs at 263
[params.A, params.map, params.scale, params.output_size] = ...
Error in ==> imresize at 140
params = parseInputs(varargin{:});
Error in ==> canny at 42
im = imresize(im, scaling);
Error in ==> findline at 23
[I2 or] = canny(image, 2, 1, 0.00, 1.00);
Error in ==> segmentiris at 106
lines = findline(topeyelid);
Error in ==> createiristemplate at 57
[circleiris circlepupil imagewithnoise] = segmentiris(eyeimage);
Matt J
Matt J on 2 Dec 2013
Edited: Matt J on 2 Dec 2013
FYI. I formatted your code for you.
The error isn't coming from code you've shown. It's coming from segmentiris().
In particular, that routine is returning the empty matrix for the third output
Here is the code for segmentiris. I also tried to run the code separately.Still same error.
function [circleiris, circlepupil, imagewithnoise] = segmentiris(eyeimage)
eyeimage =imread('aeval2.bmp');
% define range of pupil & iris radii
%CASIA
lpupilradius = 28; upupilradius = 75; lirisradius = 80; uirisradius = 150;
% %LIONS % lpupilradius = 32; % upupilradius = 85; % lirisradius = 145; % uirisradius = 169;
% define scaling factor to speed up Hough transform
scaling = 0.4;
reflecthres = 240;
% find the iris boundary
[row, col, r] = findcircle(eyeimage, lirisradius, uirisradius, scaling, 2, 0.20, 0.19, 1.00, 0.00);
circleiris = [row col r];
rowd = double(row); cold = double(col); rd = double(r);
irl = round(rowd-rd); iru = round(rowd+rd); icl = round(cold-rd); icu = round(cold+rd);
imgsize = size(eyeimage);
if irl < 1 irl = 1; end
if icl < 1 icl = 1; end
if iru > imgsize(1) iru = imgsize(1); end
if icu > imgsize(2) icu = imgsize(2); end
% to find the inner pupil, use just the region within the previously % detected iris boundary
imagepupil = eyeimage( irl:iru,icl:icu);
%find pupil boundary
[rowp, colp, r] = findcircle(imagepupil, lpupilradius, upupilradius ,0.6,2,0.25,0.25,1.00,1.00);
rowp = double(rowp); colp = double(colp); r = double(r);
row = double(irl) + rowp; col = double(icl) + colp;
row = round(row); col = round(col);
circlepupil = [row col r];
% set up array for recording noise regions % noise pixels will have NaN values
imagewithnoise = double(eyeimage);
%find top eyelid
topeyelid = imagepupil(1:(rowp-r),:); lines = findline(topeyelid);
if size(lines,1) > 0 [xl yl] = linecoords(lines, size(topeyelid)); yl = double(yl) + irl-1; xl = double(xl) + icl-1;
yla = max(yl);
y2 = 1:yla;
ind3 = sub2ind(size(eyeimage),yl,xl);
imagewithnoise(ind3) = NaN;
imagewithnoise(y2, xl) = NaN;
end
%find bottom eyelid
bottomeyelid = imagepupil((rowp+r):size(imagepupil,1),:); lines = findline(bottomeyelid);
if size(lines,1) > 0
[xl yl] = linecoords(lines, size(bottomeyelid));
yl = double(yl)+ irl+rowp+r-2;
xl = double(xl) + icl-1;
yla = min(yl);
y2 = yla:size(eyeimage,1);
ind4 = sub2ind(size(eyeimage),yl,xl);
imagewithnoise(ind4) = NaN;
imagewithnoise(y2, xl) = NaN;
end
%For CASIA, eliminate eyelashes by thresholding
ref = eyeimage < 100; coords = find(ref==1); imagewithnoise(coords) = NaN;
Hey previous problem is solved. Now new error when i try to run createiristemplate...
??? Error using ==> cd Cannot CD to diagnostics (Name is nonexistent or not a directory).
Error in ==> createiristemplate at 84 cd(DIAGPATH);
You need a directory named "diagnostics" under the directory you start running the program in.
balender kumar
balender kumar on 15 Feb 2015
Edited: balender kumar on 15 Feb 2015
@Umme Tania ..can anyone plz tell me how resolve previous error" @IMRESIZE expected its first input, A, to be nonempty" facing same problem
balender kumar
balender kumar on 15 Feb 2015
Edited: balender kumar on 15 Feb 2015
@Walter Roberson @Umme Tania , If i am applying J=imread('e.bmp'); I = histeq(J); %h=fspecial('gaussian'); h = fspecial('gaussian', [5 5], 3); I=imfilter(I,h); [cc]=segmentiris(I) then it showing the error ..if i simply call [cc]=segmentiris('e.bmp') then its work fine ..

Sign in to comment.

Answers (0)

Asked:

on 2 Dec 2013

Commented:

on 17 Feb 2015

Community Treasure Hunt

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

Start Hunting!