I'm trying to modify a function to create fisheye effect on image (i use a software that permit to modify every single pixel of an image).
At the moment i use this function:
float kk=width*0.5;
float ll=height*0.5;
float dx=(x-kk);
float dy=(y-ll);
float aa=atan2(dy,dx);
float rr=hypot(dy,dx);
float rs=rr*rr/hypot(kk,ll);
int px=kk+rs*cos(aa);
int py=ll+rs*sin(aa);
where:
width
: image width;height
: image height;x
andy
: original pixel position and px and py are pixel from where i take result.
Using this fonction i substitute pixel at {x,y}
with pixel at {px,py}
.
This work,and create a fisheye effect correctly, but i need to add a variable/parameter to control final effect.
Someone could help me to find how to add this parameter on that function ?