image processing with parallel approach

s=load('matlab.mat','imagest1','imagest2','Train_Number');
imagest1=s.imagest1;
imagest2=s.imagest2;
Train_Number=s.Train_Number;
eyeimage=imread('C:\Users\PRIYAM\Desktop\project\project pictures and links\CASIA Iris Image Database (version 1.0)\002\1\009.bmp');
%imshow(eyeimage)
radpixels=50;
angpixels=1000;
[circleiris, circlepupil, imagewithnoise,] = segmentiris(eyeimage);
[polar_array, noise_array] = normaliseiris(imagewithnoise, circleiris(2),circleiris(1), circleiris(3),circlepupil(2), circlepupil(1), circlepupil(3),...
eyeimage,radpixels,angpixels);
subplot(2,2,2)
imshow(polar_array)
%imshow(polar_array)
[icodeV,icodeH]= irisfeature(polar_array);
for i=1:Train_Number
HD=0;
for j=1:500
HD=HD+((xor(icodeV(1,j),imagest2(i,j))+xor(icodeH(1,j),imagest1(i,j)))/2);
end
hd(i)=HD;
end
loc=0;
for i=1:Train_Number
if (hd(i)<149.5)
loc=i;
fprintf('image matched with image number %d \n with hamming distance %d',loc,hd(i));
end
end
if (loc==0)
disp('image not matched with any image');
end;toc
How to parallelize it? I have used parfor, but the exexcution time remains same. Please help me to make the code snippet parallel. What should be the alternative parfor code for it?

답변 (1개)

Walter Roberson
Walter Roberson 2012년 2월 22일

1 개 추천

Vectorize, not parfor!
For example,
loc = find(hd < 149.5, 1, 'first');
if ~isempty(loc)
fprintf('image matched etc');
else
fprintf('image not matched');
end

댓글 수: 1

Edric Ellis
Edric Ellis 2012년 2월 22일
I would say: vectorize first, and then you'll probably be in a better position to use PARFOR if you wish. Plus, of course, vectorization might get you intrinsic multithreading (depending on your operation), which definitely beats PARFOR on a single machine.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 DICOM Format에 대해 자세히 알아보기

질문:

2012년 2월 22일

편집:

Ved
2013년 10월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by