|
Im doing a project on comparing consecutive frames and storing its threshold in an array. But the computation time is very high. Is there any way to reduce the computation time ??
Framerate=get(trafficObj,'FrameRate');
ht=trafficObj.Height;
wd=trafficObj.Width;
max=0;
Y=eye(numFrames,numFrames)
i=1;
while(i<numFrames)
im=read(trafficObj,i)
img=imresize(im,'Outputsize',[ht wd])
x=double(img);
hg=hist(x);
j=i+1;
while(j<=numFrames)
a=0;
b=0;
img1=read(trafficObj,j)
x1=double(img1)
hg1=hist(x1)
histdiff=(abs(hg-hg1))
thresh=histdiff>3
a=sum(thresh)
b=sum(a)
Y(i,j)=b;
if Y(i,j)<Y(i,j-1)
i=j-1;
break;
end
j=j+1;
end
end
|