2011-06-01 16 views

答えて

18

this paperのセクション2は、変換を説明しています。基本的には:

enter image description here

ここで私はMathematicaで例を作った:

enter image description here

+2

このコードを(最初の2枚の写真と同じように)トリミングせずにOpenGLで再現すると、画像がばらばらに見えます。私はこのアルゴリズムを使ってより多くの成功を収めました。http://www.geeks3d.com/20140213/glsl-shader-library-fish-eye-and-dome-and-barrel-distortion-post-processing-filters/2/ – user819640

+0

あなたのトランスフォーム直線画像を歪んだ画像に変換する場合にのみ有効です。その歪みを逆にするには、 'p1 = cbrt(2 /(3 * a))の逆関数が必要です。 (27 * a * x * x + 4) - 9 * a * x); c2 = cbrt(sqrt(3 * a)* sqrt \t p3 = cbrt(2)* pow(3 * a、2/3); \t return p1/p2-p2/p3; ' –

0

シンプルなバレル\ OpenCVのCでのピンクッション歪み++

IplImage* barrel_pincusion_dist(IplImage* img, double Cx,double Cy,double kx,double ky) 
{ 
    IplImage* mapx = cvCreateImage(cvGetSize(img), IPL_DEPTH_32F, 1); 
    IplImage* mapy = cvCreateImage(cvGetSize(img), IPL_DEPTH_32F, 1); 

    int w= img->width; 
    int h= img->height; 

    float* pbuf = (float*)mapx->imageData; 
    for (int y = 0; y < h; y++) 
    { 
     for (int x = 0; x < w; x++) 
     {   
      float u= Cx+(x-Cx)*(1+kx*((x-Cx)*(x-Cx)+(y-Cy)*(y-Cy))); 
      *pbuf = u; 
      ++pbuf; 
     } 
    } 

    pbuf = (float*)mapy->imageData; 
    for (int y = 0;y < h; y++) 
    { 
     for (int x = 0; x < w; x++) 
     { 
      *pbuf = Cy+(y-Cy)*(1+ky*((x-Cx)*(x-Cx)+(y-Cy)*(y-Cy))); 
      ++pbuf; 
     } 
    } 

    /*float* pbuf = (float*)mapx->imageData; 
    for (int y = 0; y < h; y++) 
    { 
     int ty= y-Cy; 
     for (int x = 0; x < w; x++) 
     { 
      int tx= x-Cx; 
      int rt= tx*tx+ty*ty; 

      *pbuf = (float)(tx*(1+kx*rt)+Cx); 
      ++pbuf; 
     } 
    } 

    pbuf = (float*)mapy->imageData; 
    for (int y = 0;y < h; y++) 
    { 
     int ty= y-Cy; 
     for (int x = 0; x < w; x++) 
     { 
      int tx= x-Cx; 
      int rt= tx*tx+ty*ty; 

      *pbuf = (float)(ty*(1+ky*rt)+Cy); 
      ++pbuf; 
     } 
    }*/ 

    IplImage* temp = cvCloneImage(img); 
    cvRemap(temp, img, mapx, mapy); 
    cvReleaseImage(&temp); 
    cvReleaseImage(&mapx); 
    cvReleaseImage(&mapy); 

    return img; 
} 

より複雑な形 http://opencv.willowgarage.com/documentation/camera_calibration_and_3d_reconstruction.html

1

あなたはFitzgibbon, 2001で見つけることができる多項式の半径歪みモデルの近似値は、RD及びRUは、歪みの中心からの距離です

enter image description here

です。これは、コンピュータビジョンおよび画像処理の目的で、広角カメラ画像からの歪みをフィルタリングするためにも使用されます。

あなたがここに歪み補正フィルタリング(とも順変換)を実装するための原則とシェーダコードのより詳細な説明を見つけることができます:http://marcodiiga.github.io/radial-lens-undistortion-filtering

私はまた、あなたが見てみる必要があるの論文を掲載しています投稿したメソッドの数学的な詳細を知りたい場合は

  • Zhang Z(1999)です。未知の方向から平面を見ることによる柔軟なカメラ較正
  • Andrew W. Fitzgibbon(2001)。多視点ジオメトリとレンズひずみの同時線形推定