FishEye Picture Effect (Barrel Distortion) Algorithm (with Java)?

I am looking for an algorithm (bitmap pixel manipulation) to simulate a Barrel Distortion from ordinary images. So far I have found an implementation involving external libraries such as OpenCV, OpenGL or jhlabs. Since I am doing a class in the field of digital image processing and I am doing a course assessment project, I am not sure that using any external library will bring me a good grade. So will someone give me a link to such an algorithm?

Ps. I will be asked to implement it in Java, but an example from any language will do.

+3
source share
3 answers

, , , . - , , , , . , .

, - , - , . , . .

, OpenCV . , cv:

$ grep -o "cv\\w*" barrel.cpp | sort | uniq
cv
cvCreateImage
cvGet2D
cvGetSize
cvLoadImage
cvNamedWindow
cvSaveImage
cvSet2D
cvShowImage
cvWaitKey

API OpenCV, , , , , .. . , OpenCV.

, :

float getRadialX(float x,float y,float cx,float cy,float k){
  x = (x*xscale+xshift);
  y = (y*yscale+yshift);
  float res = x+((x-cx)*k*((x-cx)*(x-cx)+(y-cy)*(y-cy)));
  return res;
}

float getRadialY(float x,float y,float cx,float cy,float k){
  x = (x*xscale+xshift);
  y = (y*yscale+yshift);
  float res = y+((y-cy)*k*((x-cx)*(x-cx)+(y-cy)*(y-cy)));
  return res;
}

- , . , OpenCV.

+5

Source: https://habr.com/ru/post/1791667/


All Articles