Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function oImage=transformImage(iType,iImage,iDim,iP,iBgr)
- [Y,X]=size(iImage);
- oImage=ones(Y,X)*iBgr;
- if strcmp(iType,'afine')
- for y=1:Y
- for x=1:X
- pt=[x,y]*iDim;
- pt=inv(iP)*[pt';1]; %transponiranje???, apostrof smo dodali sele pol
- pt=pt(1:2)';
- pt=pt./iDim;
- px=round(pt)
- if(px(1)<x&&px(2)<y&&px(1)>0&&px(2)>0)
- oImage(x,y)=iImage(px(2),px(1));
- end
- end
- end
- elseif strcmp(iType,"radial")
- for y=1:Y
- for x=1:X
- pt=[x,y]*iDim;
- pt=[U'*iP{2}(:,1),U'*iP{2}(:,2)];
- pt=pt./iDim;
- px=round(pt);
- if(px(1)<x&&px(2)<y&&px(1)>0&&px(2)>0)
- oImage(x,y)=iImage(px(2),px(1));
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement