Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. function oImage=transformImage(iType,iImage,iDim,iP,iBgr)
  2.  
  3. [Y,X]=size(iImage);
  4. oImage=ones(Y,X)*iBgr;
  5. if strcmp(iType,'afine')
  6. for y=1:Y
  7. for x=1:X
  8. pt=[x,y]*iDim;
  9. pt=inv(iP)*[pt';1]; %transponiranje???, apostrof smo dodali sele pol
  10. pt=pt(1:2)';
  11. pt=pt./iDim;
  12.  
  13. px=round(pt)
  14.  
  15. if(px(1)<x&&px(2)<y&&px(1)>0&&px(2)>0)
  16. oImage(x,y)=iImage(px(2),px(1));
  17. end
  18.  
  19.  
  20. end
  21. end
  22.  
  23. elseif strcmp(iType,"radial")
  24.  
  25. for y=1:Y
  26. for x=1:X
  27. pt=[x,y]*iDim;
  28. pt=[U'*iP{2}(:,1),U'*iP{2}(:,2)];
  29. pt=pt./iDim;
  30. px=round(pt);
  31. if(px(1)<x&&px(2)<y&&px(1)>0&&px(2)>0)
  32. oImage(x,y)=iImage(px(2),px(1));
  33. end
  34.  
  35. end
  36. end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement