仿射变换函数

近期要用到,所以记一下
$ \bigcirc$Name

 

fproj 使用插值的方法来进行仿射变换或者透视变换

$ \bigcirc$Command Synopsis

 

fproj [-x sx][-y sy][-b bg][-o o][-p p][-i] in out X1 Y1 X2 Y2 X3 Y3 [x4 y4 ] 

-x  sx  : x-size of outputimage, default 512

 

-y  sy  : y-size of outputimage, default 512

 

-b  bg  : background greyvalue, default: 0.0

 

-o  o  : order:0,1=linear,-3=cubic,3,5..11=spline, default 3(选择插值方式,线性的,或者)

 

-p  p  : Keys' parameter(when o=-3), in [-1,0], default -0.5

 

-i :compute inverse transform

 

in  : input Fimage

 

out  : output Fimage

 

X1  : upleft corner

 

Y1  : upleft corner

 

X2  : upright corner

 

Y2  : upright corner

 

X3  : downleft corner

 

Y3  : downleft corner

 

x4  : downright corner (for projectivetransform)

 

y4  : downright corner (for projectivetransform)

$ \bigcirc$Function Summary

 

void fproj(in , out , sx , sy , bg , o , p , i , X1 , Y1 , X2 , Y2 , X3 , Y3, x4 , y4 )

Fimage in , out ;

int*sx , *sy , *o ;

char*i ;

float *bg , *p , X1 , Y1 , X2 , Y2 , X3 , Y3 , *x4 , *y4 ;

$ \bigcirc$Description

 

This moduleapplies an affine or a projective transformation to an image. Theoriginal (interpolated) image (x, y) $ \mapsto$ u(x, y)is transformed into the image (x, y) $ \mapsto$ v(x, y)= u(F(x, y))where Fisdefined by its values on three (affine case) or four (projectivecase) points of the original image.

 

$ \bullet$ Inthe affine case, one has

 

F( x y) =( ax  by  c dx  ey  f  ),

 

andthe constants  a b c d e f  arecomputed in order that 
F(x1y1)=(0, 0) 
F(x2y2)=(sx, 0) 
F(x3y3)=(0, sy). 

Thismeans that the new image is extracted from the original one in aparallelogram domain.

 

$ \bullet$ Inthe projective case, one has

 

F( x y)=  $\displaystyle \left(\vphantom{\frac{a x + b y +c}{gx + hy +1}, \frac{d x + e y + f}{gx + hy +1}}\right.$ $\displaystyle {\frac{​{a x + b y +c}}{​{gx + hy +1}}}$, $\displaystyle {\frac{​{d x + e y + f}}{​{gx + hy +1}}}$ $\displaystyle \left.\vphantom{\frac{a x + b y +c}{gx + hy +1}, \frac{d x + e y + f}{gx + hy +1}}\right)$,

 

andthe constants  a b c d e f g h  arecomputed in order that 
F(x1y1)=(0, 0) 
F(x2y2)=(sx, 0) 
F(x3y3)=(0, sy) 
F(x4y4)=(sxsy) 

Thismeans that the new image is extracted from the original one in aquadrilateral domain.

 

 


Theinterpolation method is the same asthe fcrop module.However, for generic transforms the separability of theinterpolation functions cannot be used, which results in a muchslower algorithm. Hence, whenever it is possible (extraction of arectangular region with vertical and horizontal sides) it is betterto usethe fcrop module (upto 10 times faster) instead.

 

The -i optionperforms the (approximate) inverse transform.

 

NB :calling this module with out=in is not possible


$ \bigcirc$See Also

 


finvspline.

fzrt

$ \bigcirc$Version 2.0

 

LastModification date : Thu Nov 29 20:23:56 2001 

$ \bigcirc$Author

 

LionelMoisan

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值