--- /srv/rebuilderd/tmp/rebuilderd70VgVr/inputs/opencv-doc_5.0.0+dfsg-1~exp1_all.deb +++ /srv/rebuilderd/tmp/rebuilderd70VgVr/out/opencv-doc_5.0.0+dfsg-1~exp1_all.deb ├── file list │ @@ -1,3 +1,3 @@ │ -rw-r--r-- 0 0 0 4 2026-07-05 13:50:58.000000 debian-binary │ --rw-r--r-- 0 0 0 248288 2026-07-05 13:50:58.000000 control.tar.xz │ --rw-r--r-- 0 0 0 100877996 2026-07-05 13:50:58.000000 data.tar.xz │ +-rw-r--r-- 0 0 0 248248 2026-07-05 13:50:58.000000 control.tar.xz │ +-rw-r--r-- 0 0 0 100760740 2026-07-05 13:50:58.000000 data.tar.xz ├── control.tar.xz │ ├── control.tar │ │ ├── ./control │ │ │ @@ -1,13 +1,13 @@ │ │ │ Package: opencv-doc │ │ │ Source: opencv │ │ │ Version: 5.0.0+dfsg-1~exp1 │ │ │ Architecture: all │ │ │ Maintainer: Debian Science Team │ │ │ -Installed-Size: 298452 │ │ │ +Installed-Size: 298338 │ │ │ Depends: libjs-jquery, libjs-mathjax │ │ │ Section: doc │ │ │ Priority: optional │ │ │ Multi-Arch: foreign │ │ │ Homepage: https://opencv.org │ │ │ Description: OpenCV documentation and examples │ │ │ This package contains the OpenCV documentation and example programs. │ │ ├── ./md5sums │ │ │ ├── ./md5sums │ │ │ │┄ Files differ ├── data.tar.xz │ ├── data.tar │ │ ├── file list │ │ │ @@ -12185,15 +12185,15 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 11337 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/oc_1d_clustered.png │ │ │ -rw-r--r-- 0 root (0) root (0) 8955 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/oc_1d_testdata.png │ │ │ -rw-r--r-- 0 root (0) root (0) 10486 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/oc_2d_clustered.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 31684 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/oc_color_quantization.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 12012 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/oc_feature_representation.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 2155 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/opencv-logo-small.png │ │ │ -rw-r--r-- 0 root (0) root (0) 1114 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/opencv.ico.gz │ │ │ --rw-r--r-- 0 root (0) root (0) 1474044 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/opencv.tag.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 1474450 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/opencv.tag.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 83154 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/opencv_bus_res.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 5327 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/opencv_logo.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 60324 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/opencv_resnet50_test_res_c.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 2082 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/opening.png │ │ │ -rw-r--r-- 0 root (0) root (0) 6146 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/optical_flow_basic1.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 24600 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/opticalfb.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 22792 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/opticalflow_lk.jpg │ │ │ @@ -12273,15 +12273,15 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 40188 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/resultOutputWideoWrite.png │ │ │ -rw-r--r-- 0 root (0) root (0) 11120 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/result_normal.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 12503 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/result_rotated.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 13646 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/retinaInput.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 22461 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/retinaOutput_default.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 19131 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/retinaOutput_realistic.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 150688 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/retina_TreeHdr_retina.jpg │ │ │ --rw-r--r-- 0 root (0) root (0) 166872 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/retina_TreeHdr_small.jpg │ │ │ +-rw-r--r-- 0 root (0) root (0) 50051 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/retina_TreeHdr_small.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 39694 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/robot-world_hand-eye_figure.png │ │ │ -rw-r--r-- 0 root (0) root (0) 27080 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/roi.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 28547 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/root_group_single_channel.png │ │ │ -rw-r--r-- 0 root (0) root (0) 1831 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/rotatedrect.png │ │ │ -rw-r--r-- 0 root (0) root (0) 24109 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/rotation.jpg │ │ │ -rw-r--r-- 0 root (0) root (0) 14301 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/run_app.png │ │ │ -rw-r--r-- 0 root (0) root (0) 29564 2026-07-05 13:50:58.000000 ./usr/share/doc/opencv-doc/opencv5/html/sagrada_familia_input.jpg │ │ ├── ./usr/share/doc/opencv-doc/opencv5/html/javadoc/org/opencv/face/Face.html │ │ │┄ Ordering differences only │ │ │ @@ -59,29 +59,29 @@ │ │ │
  • Constructor Details │ │ │
      │ │ │
    1. Face()
    2. │ │ │
    │ │ │
  • │ │ │
  • Method Details │ │ │
      │ │ │ +
    1. createFacemarkAAM()
    2. │ │ │ +
    3. createFacemarkLBF()
    4. │ │ │ +
    5. createFacemarkKazemi()
    6. │ │ │
    7. getFacesHAAR(Mat, Mat, String)
    8. │ │ │
    9. loadDatasetList(String, String, List, List)
    10. │ │ │
    11. loadTrainingData(String, List, Mat, char, float)
    12. │ │ │
    13. loadTrainingData(String, List, Mat, char)
    14. │ │ │
    15. loadTrainingData(String, List, Mat)
    16. │ │ │
    17. loadTrainingData(String, String, List, Mat, float)
    18. │ │ │
    19. loadTrainingData(String, String, List, Mat)
    20. │ │ │
    21. loadTrainingData(List, List, List)
    22. │ │ │
    23. loadFacePoints(String, Mat, float)
    24. │ │ │
    25. loadFacePoints(String, Mat)
    26. │ │ │
    27. drawFacemarks(Mat, Mat, Scalar)
    28. │ │ │
    29. drawFacemarks(Mat, Mat)
    30. │ │ │ -
    31. createFacemarkAAM()
    32. │ │ │ -
    33. createFacemarkLBF()
    34. │ │ │ -
    35. createFacemarkKazemi()
    36. │ │ │
    │ │ │
  • │ │ │ │ │ │ │ │ │
    │ │ │ │ │ │
    │ │ │ @@ -252,14 +252,38 @@ │ │ │ │ │ │ │ │ │
  • │ │ │
    │ │ │

    Method Details

    │ │ │
      │ │ │
    • │ │ │ +
      │ │ │ +

      createFacemarkAAM

      │ │ │ +
      │ │ │ +
      public static Facemark createFacemarkAAM()
      │ │ │ +
      │ │ │ +
      │ │ │ +
    • │ │ │ +
    • │ │ │ +
      │ │ │ +

      createFacemarkLBF

      │ │ │ +
      │ │ │ +
      public static Facemark createFacemarkLBF()
      │ │ │ +
      │ │ │ +
      │ │ │ +
    • │ │ │ +
    • │ │ │ +
      │ │ │ +

      createFacemarkKazemi

      │ │ │ +
      │ │ │ +
      public static Facemark createFacemarkKazemi()
      │ │ │ +
      │ │ │ +
      │ │ │ +
    • │ │ │ +
    • │ │ │
      │ │ │

      getFacesHAAR

      │ │ │
      │ │ │
      public static boolean getFacesHAAR(Mat image, │ │ │ Mat faces, │ │ │ String face_cascade_name)
      │ │ │
      Default face detector │ │ │ @@ -685,38 +709,14 @@ │ │ │ face::drawFacemarks(frame, landmarks[j], Scalar(0,0,255)); │ │ │ } │ │ │ │ │ │ │ │ │
      │ │ │
      │ │ │
    • │ │ │ -
    • │ │ │ -
      │ │ │ -

      createFacemarkAAM

      │ │ │ -
      │ │ │ -
      public static Facemark createFacemarkAAM()
      │ │ │ -
      │ │ │ -
      │ │ │ -
    • │ │ │ -
    • │ │ │ -
      │ │ │ -

      createFacemarkLBF

      │ │ │ -
      │ │ │ -
      public static Facemark createFacemarkLBF()
      │ │ │ -
      │ │ │ -
      │ │ │ -
    • │ │ │ -
    • │ │ │ -
      │ │ │ -

      createFacemarkKazemi

      │ │ │ -
      │ │ │ -
      public static Facemark createFacemarkKazemi()
      │ │ │ -
      │ │ │ -
      │ │ │ -
    • │ │ │
    │ │ │
    │ │ │
  • │ │ │ │ │ │ │ │ │ │ │ │
    ...
  • .
    .< │ │ │ -0005bd30: 6833 3e66 696e 6448 6f6d 6f67 7261 7068 h3>findHomograph │ │ │ -0005bd40: 793c 2f68 333e 0a3c 6469 7620 636c 6173 y.
    .
    pub │ │ │ -0005bda0: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static Mat │ │ │ -0005be10: 3c2f 613e 3c2f 7370 616e 3e26 6e62 7370   │ │ │ -0005be20: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;find │ │ │ -0005be40: 486f 6d6f 6772 6170 6879 3c2f 7370 616e Homography( │ │ │ -0005be70: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfPoint2 │ │ │ -0005bec0: 663c 2f61 3e26 6e62 7370 3b73 7263 506f f srcPo │ │ │ -0005bed0: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. MatO │ │ │ -0005bf20: 6650 6f69 6e74 3266 3c2f 613e 266e 6273 fPoint2f&nbs │ │ │ -0005bf30: 703b 6473 7450 6f69 6e74 732c 0a20 696e p;dstPoints,. in │ │ │ -0005bf40: 7426 6e62 7370 3b6d 6574 686f 642c 0a20 t method,. │ │ │ -0005bf50: 646f 7562 6c65 266e 6273 703b 7261 6e73 double rans │ │ │ -0005bf60: 6163 5265 7072 6f6a 5468 7265 7368 6f6c acReprojThreshol │ │ │ -0005bf70: 642c 0a20 3c61 2068 7265 663d 222e 2e2f d,. │ │ │ -0005bfb0: 4d61 743c 2f61 3e26 6e62 7370 3b6d 6173 Mat mas │ │ │ -0005bfc0: 6b29 3c2f 7370 616e 3e3c 2f64 6976 3e0a k)
    . │ │ │ -0005bfd0: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Finds a persp │ │ │ -0005bff0: 6563 7469 7665 2074 7261 6e73 666f 726d ective transform │ │ │ -0005c000: 6174 696f 6e20 6265 7477 6565 6e20 7477 ation between tw │ │ │ -0005c010: 6f20 706c 616e 6573 2e3c 2f64 6976 3e0a o planes.
    . │ │ │ -0005c020: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ -0005c040: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    srcPoints - Coordinates │ │ │ -0005c070: 206f 6620 7468 6520 706f 696e 7473 2069 of the points i │ │ │ -0005c080: 6e20 7468 6520 6f72 6967 696e 616c 2070 n the original p │ │ │ -0005c090: 6c61 6e65 2c20 6120 6d61 7472 6978 206f lane, a matrix o │ │ │ -0005c0a0: 6620 7468 6520 7479 7065 2043 565f 3332 f the type CV_32 │ │ │ -0005c0b0: 4643 320a 6f72 2076 6563 746f 7226 6c74 FC2.or vector< │ │ │ -0005c0c0: 3b50 6f69 6e74 3266 2667 743b 202e 3c2f ;Point2f> ..
    ds │ │ │ -0005c0e0: 7450 6f69 6e74 733c 2f63 6f64 653e 202d tPoints - │ │ │ -0005c0f0: 2043 6f6f 7264 696e 6174 6573 206f 6620 Coordinates of │ │ │ -0005c100: 7468 6520 706f 696e 7473 2069 6e20 7468 the points in th │ │ │ -0005c110: 6520 7461 7267 6574 2070 6c61 6e65 2c20 e target plane, │ │ │ -0005c120: 6120 6d61 7472 6978 206f 6620 7468 6520 a matrix of the │ │ │ -0005c130: 7479 7065 2043 565f 3332 4643 3220 6f72 type CV_32FC2 or │ │ │ -0005c140: 0a61 2076 6563 746f 7226 6c74 3b50 6f69 .a vector<Poi │ │ │ -0005c150: 6e74 3266 2667 743b 202e 3c2f 6464 3e0a nt2f> .
    . │ │ │ -0005c160: 3c64 643e 3c63 6f64 653e 6d65 7468 6f64
    method │ │ │ -0005c170: 3c2f 636f 6465 3e20 2d20 4d65 7468 6f64 - Method │ │ │ -0005c180: 2075 7365 6420 746f 2063 6f6d 7075 7465 used to compute │ │ │ -0005c190: 2061 2068 6f6d 6f67 7261 7068 7920 6d61 a homography ma │ │ │ -0005c1a0: 7472 6978 2e20 5468 6520 666f 6c6c 6f77 trix. The follow │ │ │ -0005c1b0: 696e 6720 6d65 7468 6f64 7320 6172 6520 ing methods are │ │ │ -0005c1c0: 706f 7373 6962 6c65 3a0a 3c75 6c3e 0a20 possible:.
      . │ │ │ -0005c1d0: 203c 6c69 3e0a 2020 203c 623e 303c 2f62
    • . 0 - a regular me │ │ │ -0005c1f0: 7468 6f64 2075 7369 6e67 2061 6c6c 2074 thod using all t │ │ │ -0005c200: 6865 2070 6f69 6e74 732c 2069 2e65 2e2c he points, i.e., │ │ │ -0005c210: 2074 6865 206c 6561 7374 2073 7175 6172 the least squar │ │ │ -0005c220: 6573 206d 6574 686f 640a 2020 3c2f 6c69 es method.
    • .
    • . REF: │ │ │ -0005c240: 2052 414e 5341 4320 2d20 5241 4e53 4143 RANSAC - RANSAC │ │ │ -0005c250: 2d62 6173 6564 2072 6f62 7573 7420 6d65 -based robust me │ │ │ -0005c260: 7468 6f64 0a20 203c 2f6c 693e 0a20 203c thod.
    • . < │ │ │ -0005c270: 6c69 3e0a 2020 2052 4546 3a20 4c4d 4544 li>. REF: LMED │ │ │ -0005c280: 5320 2d20 4c65 6173 742d 4d65 6469 616e S - Least-Median │ │ │ -0005c290: 2072 6f62 7573 7420 6d65 7468 6f64 0a20 robust method. │ │ │ -0005c2a0: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020 .
    • . │ │ │ -0005c2b0: 2052 4546 3a20 5248 4f20 2d20 5052 4f53 REF: RHO - PROS │ │ │ -0005c2c0: 4143 2d62 6173 6564 2072 6f62 7573 7420 AC-based robust │ │ │ -0005c2d0: 6d65 7468 6f64 0a20 203c 2f6c 693e 0a3c method.
    • .< │ │ │ -0005c2e0: 2f75 6c3e 3c2f 6464 3e0a 3c64 643e 3c63 /ul>
    .
    ransacReproj │ │ │ -0005c300: 5468 7265 7368 6f6c 643c 2f63 6f64 653e Threshold │ │ │ -0005c310: 202d 204d 6178 696d 756d 2061 6c6c 6f77 - Maximum allow │ │ │ -0005c320: 6564 2072 6570 726f 6a65 6374 696f 6e20 ed reprojection │ │ │ -0005c330: 6572 726f 7220 746f 2074 7265 6174 2061 error to treat a │ │ │ -0005c340: 2070 6f69 6e74 2070 6169 7220 6173 2061 point pair as a │ │ │ -0005c350: 6e20 696e 6c69 6572 0a28 7573 6564 2069 n inlier.(used i │ │ │ -0005c360: 6e20 7468 6520 5241 4e53 4143 2061 6e64 n the RANSAC and │ │ │ -0005c370: 2052 484f 206d 6574 686f 6473 206f 6e6c RHO methods onl │ │ │ -0005c380: 7929 2e20 5468 6174 2069 732c 2069 660a y). That is, if. │ │ │ -0005c390: 5c28 5c7c 205c 7465 7874 7474 7b64 7374 \(\| \texttt{dst │ │ │ -0005c3a0: 506f 696e 7473 7d20 5f69 202d 2020 5c74 Points} _i - \t │ │ │ -0005c3b0: 6578 7474 747b 636f 6e76 6572 7450 6f69 exttt{convertPoi │ │ │ -0005c3c0: 6e74 7348 6f6d 6f67 656e 656f 7573 7d20 ntsHomogeneous} │ │ │ -0005c3d0: 2820 5c74 6578 7474 747b 487d 205c 6364 ( \texttt{H} \cd │ │ │ -0005c3e0: 6f74 205c 7465 7874 7474 7b73 7263 506f ot \texttt{srcPo │ │ │ -0005c3f0: 696e 7473 7d20 5f69 2920 5c7c 5f32 2020 ints} _i) \|_2 │ │ │ -0005c400: 2667 743b 2020 5c74 6578 7474 747b 7261 > \texttt{ra │ │ │ -0005c410: 6e73 6163 5265 7072 6f6a 5468 7265 7368 nsacReprojThresh │ │ │ -0005c420: 6f6c 647d 5c29 0a74 6865 6e20 7468 6520 old}\).then the │ │ │ -0005c430: 706f 696e 7420 5c28 695c 2920 6973 2063 point \(i\) is c │ │ │ -0005c440: 6f6e 7369 6465 7265 6420 6173 2061 6e20 onsidered as an │ │ │ -0005c450: 6f75 746c 6965 722e 2049 6620 7372 6350 outlier. If srcP │ │ │ -0005c460: 6f69 6e74 7320 616e 6420 6473 7450 6f69 oints and dstPoi │ │ │ -0005c470: 6e74 7320 6172 6520 6d65 6173 7572 6564 nts are measured │ │ │ -0005c480: 2069 6e20 7069 7865 6c73 2c0a 6974 2075 in pixels,.it u │ │ │ -0005c490: 7375 616c 6c79 206d 616b 6573 2073 656e sually makes sen │ │ │ -0005c4a0: 7365 2074 6f20 7365 7420 7468 6973 2070 se to set this p │ │ │ -0005c4b0: 6172 616d 6574 6572 2073 6f6d 6577 6865 arameter somewhe │ │ │ -0005c4c0: 7265 2069 6e20 7468 6520 7261 6e67 6520 re in the range │ │ │ -0005c4d0: 6f66 2031 2074 6f20 3130 2e3c 2f64 643e of 1 to 10.
    │ │ │ -0005c4e0: 0a3c 6464 3e3c 636f 6465 3e6d 6173 6b3c .
    mask< │ │ │ -0005c4f0: 2f63 6f64 653e 202d 204f 7074 696f 6e61 /code> - Optiona │ │ │ -0005c500: 6c20 6f75 7470 7574 206d 6173 6b20 7365 l output mask se │ │ │ -0005c510: 7420 6279 2061 2072 6f62 7573 7420 6d65 t by a robust me │ │ │ -0005c520: 7468 6f64 2028 2052 414e 5341 4320 6f72 thod ( RANSAC or │ │ │ -0005c530: 204c 4d65 4453 2029 2e20 4e6f 7465 2074 LMeDS ). Note t │ │ │ -0005c540: 6861 7420 7468 6520 696e 7075 740a 6d61 hat the input.ma │ │ │ -0005c550: 736b 2076 616c 7565 7320 6172 6520 6967 sk values are ig │ │ │ -0005c560: 6e6f 7265 642e 0a0a 5468 6520 6675 6e63 nored...The func │ │ │ -0005c570: 7469 6f6e 2066 696e 6473 2061 6e64 2072 tion finds and r │ │ │ -0005c580: 6574 7572 6e73 2074 6865 2070 6572 7370 eturns the persp │ │ │ -0005c590: 6563 7469 7665 2074 7261 6e73 666f 726d ective transform │ │ │ -0005c5a0: 6174 696f 6e20 5c28 485c 2920 6265 7477 ation \(H\) betw │ │ │ -0005c5b0: 6565 6e20 7468 6520 736f 7572 6365 2061 een the source a │ │ │ -0005c5c0: 6e64 2074 6865 0a64 6573 7469 6e61 7469 nd the.destinati │ │ │ -0005c5d0: 6f6e 2070 6c61 6e65 733a 0a0a 5c28 735f on planes:..\(s_ │ │ │ -0005c5e0: 6920 205c 7665 6374 6872 6565 7b78 275f i \vecthree{x'_ │ │ │ -0005c5f0: 697d 7b79 275f 697d 7b31 7d20 5c73 696d i}{y'_i}{1} \sim │ │ │ -0005c600: 2048 2020 5c76 6563 7468 7265 657b 785f H \vecthree{x_ │ │ │ -0005c610: 697d 7b79 5f69 7d7b 317d 5c29 0a0a 736f i}{y_i}{1}\)..so │ │ │ -0005c620: 2074 6861 7420 7468 6520 6261 636b 2d70 that the back-p │ │ │ -0005c630: 726f 6a65 6374 696f 6e20 6572 726f 720a rojection error. │ │ │ -0005c640: 0a5c 285c 7375 6d20 5f69 205c 6c65 6674 .\(\sum _i \left │ │ │ -0005c650: 2028 2078 275f 692d 205c 6672 6163 7b68 ( x'_i- \frac{h │ │ │ -0005c660: 5f7b 3131 7d20 785f 6920 2b20 685f 7b31 _{11} x_i + h_{1 │ │ │ -0005c670: 327d 2079 5f69 202b 2068 5f7b 3133 7d7d 2} y_i + h_{13}} │ │ │ -0005c680: 7b68 5f7b 3331 7d20 785f 6920 2b20 685f {h_{31} x_i + h_ │ │ │ -0005c690: 7b33 327d 2079 5f69 202b 2068 5f7b 3333 {32} y_i + h_{33 │ │ │ -0005c6a0: 7d7d 205c 7269 6768 7420 295e 322b 205c }} \right )^2+ \ │ │ │ -0005c6b0: 6c65 6674 2028 2079 275f 692d 205c 6672 left ( y'_i- \fr │ │ │ -0005c6c0: 6163 7b68 5f7b 3231 7d20 785f 6920 2b20 ac{h_{21} x_i + │ │ │ -0005c6d0: 685f 7b32 327d 2079 5f69 202b 2068 5f7b h_{22} y_i + h_{ │ │ │ -0005c6e0: 3233 7d7d 7b68 5f7b 3331 7d20 785f 6920 23}}{h_{31} x_i │ │ │ -0005c6f0: 2b20 685f 7b33 327d 2079 5f69 202b 2068 + h_{32} y_i + h │ │ │ -0005c700: 5f7b 3333 7d7d 205c 7269 6768 7420 295e _{33}} \right )^ │ │ │ -0005c710: 325c 290a 0a69 7320 6d69 6e69 6d69 7a65 2\)..is minimize │ │ │ -0005c720: 642e 2049 6620 7468 6520 7061 7261 6d65 d. If the parame │ │ │ -0005c730: 7465 7220 6d65 7468 6f64 2069 7320 7365 ter method is se │ │ │ -0005c740: 7420 746f 2074 6865 2064 6566 6175 6c74 t to the default │ │ │ -0005c750: 2076 616c 7565 2030 2c20 7468 6520 6675 value 0, the fu │ │ │ -0005c760: 6e63 7469 6f6e 2075 7365 7320 616c 6c20 nction uses all │ │ │ -0005c770: 7468 6520 706f 696e 740a 7061 6972 7320 the point.pairs │ │ │ -0005c780: 746f 2063 6f6d 7075 7465 2061 6e20 696e to compute an in │ │ │ -0005c790: 6974 6961 6c20 686f 6d6f 6772 6170 6879 itial homography │ │ │ -0005c7a0: 2065 7374 696d 6174 6520 7769 7468 2061 estimate with a │ │ │ -0005c7b0: 2073 696d 706c 6520 6c65 6173 742d 7371 simple least-sq │ │ │ -0005c7c0: 7561 7265 7320 7363 6865 6d65 2e0a 0a48 uares scheme...H │ │ │ -0005c7d0: 6f77 6576 6572 2c20 6966 206e 6f74 2061 owever, if not a │ │ │ -0005c7e0: 6c6c 206f 6620 7468 6520 706f 696e 7420 ll of the point │ │ │ -0005c7f0: 7061 6972 7320 2820 5c28 7372 6350 6f69 pairs ( \(srcPoi │ │ │ -0005c800: 6e74 735f 695c 292c 205c 2864 7374 506f nts_i\), \(dstPo │ │ │ -0005c810: 696e 7473 5f69 5c29 2029 2066 6974 2074 ints_i\) ) fit t │ │ │ -0005c820: 6865 2072 6967 6964 2070 6572 7370 6563 he rigid perspec │ │ │ -0005c830: 7469 7665 0a74 7261 6e73 666f 726d 6174 tive.transformat │ │ │ -0005c840: 696f 6e20 2874 6861 7420 6973 2c20 7468 ion (that is, th │ │ │ -0005c850: 6572 6520 6172 6520 736f 6d65 206f 7574 ere are some out │ │ │ -0005c860: 6c69 6572 7329 2c20 7468 6973 2069 6e69 liers), this ini │ │ │ -0005c870: 7469 616c 2065 7374 696d 6174 6520 7769 tial estimate wi │ │ │ -0005c880: 6c6c 2062 6520 706f 6f72 2e20 496e 2074 ll be poor. In t │ │ │ -0005c890: 6869 7320 6361 7365 2c0a 796f 7520 6361 his case,.you ca │ │ │ -0005c8a0: 6e20 7573 6520 6f6e 6520 6f66 2074 6865 n use one of the │ │ │ -0005c8b0: 2074 6872 6565 2072 6f62 7573 7420 6d65 three robust me │ │ │ -0005c8c0: 7468 6f64 732e 2054 6865 206d 6574 686f thods. The metho │ │ │ -0005c8d0: 6473 2052 414e 5341 432c 204c 4d65 4453 ds RANSAC, LMeDS │ │ │ -0005c8e0: 2061 6e64 2052 484f 2074 7279 206d 616e and RHO try man │ │ │ -0005c8f0: 7920 6469 6666 6572 656e 740a 7261 6e64 y different.rand │ │ │ -0005c900: 6f6d 2073 7562 7365 7473 206f 6620 7468 om subsets of th │ │ │ -0005c910: 6520 636f 7272 6573 706f 6e64 696e 6720 e corresponding │ │ │ -0005c920: 706f 696e 7420 7061 6972 7320 286f 6620 point pairs (of │ │ │ -0005c930: 666f 7572 2070 6169 7273 2065 6163 682c four pairs each, │ │ │ -0005c940: 2063 6f6c 6c69 6e65 6172 2070 6169 7273 collinear pairs │ │ │ -0005c950: 2061 7265 2064 6973 6361 7264 6564 292c are discarded), │ │ │ -0005c960: 2065 7374 696d 6174 6520 7468 6520 686f estimate the ho │ │ │ -0005c970: 6d6f 6772 6170 6879 206d 6174 7269 780a mography matrix. │ │ │ -0005c980: 7573 696e 6720 7468 6973 2073 7562 7365 using this subse │ │ │ -0005c990: 7420 616e 6420 6120 7369 6d70 6c65 206c t and a simple l │ │ │ -0005c9a0: 6561 7374 2d73 7175 6172 6573 2061 6c67 east-squares alg │ │ │ -0005c9b0: 6f72 6974 686d 2c20 616e 6420 7468 656e orithm, and then │ │ │ -0005c9c0: 2063 6f6d 7075 7465 2074 6865 2071 7561 compute the qua │ │ │ -0005c9d0: 6c69 7479 2f67 6f6f 646e 6573 7320 6f66 lity/goodness of │ │ │ -0005c9e0: 2074 6865 0a63 6f6d 7075 7465 6420 686f the.computed ho │ │ │ -0005c9f0: 6d6f 6772 6170 6879 2028 7768 6963 6820 mography (which │ │ │ -0005ca00: 6973 2074 6865 206e 756d 6265 7220 6f66 is the number of │ │ │ -0005ca10: 2069 6e6c 6965 7273 2066 6f72 2052 414e inliers for RAN │ │ │ -0005ca20: 5341 4320 6f72 2074 6865 206c 6561 7374 SAC or the least │ │ │ -0005ca30: 206d 6564 6961 6e20 7265 2d70 726f 6a65 median re-proje │ │ │ -0005ca40: 6374 696f 6e20 6572 726f 7220 666f 720a ction error for. │ │ │ -0005ca50: 4c4d 6544 5329 2e20 5468 6520 6265 7374 LMeDS). The best │ │ │ -0005ca60: 2073 7562 7365 7420 6973 2074 6865 6e20 subset is then │ │ │ -0005ca70: 7573 6564 2074 6f20 7072 6f64 7563 6520 used to produce │ │ │ -0005ca80: 7468 6520 696e 6974 6961 6c20 6573 7469 the initial esti │ │ │ -0005ca90: 6d61 7465 206f 6620 7468 6520 686f 6d6f mate of the homo │ │ │ -0005caa0: 6772 6170 6879 206d 6174 7269 7820 616e graphy matrix an │ │ │ -0005cab0: 640a 7468 6520 6d61 736b 206f 6620 696e d.the mask of in │ │ │ -0005cac0: 6c69 6572 732f 6f75 746c 6965 7273 2e0a liers/outliers.. │ │ │ -0005cad0: 0a52 6567 6172 646c 6573 7320 6f66 2074 .Regardless of t │ │ │ -0005cae0: 6865 206d 6574 686f 642c 2072 6f62 7573 he method, robus │ │ │ -0005caf0: 7420 6f72 206e 6f74 2c20 7468 6520 636f t or not, the co │ │ │ -0005cb00: 6d70 7574 6564 2068 6f6d 6f67 7261 7068 mputed homograph │ │ │ -0005cb10: 7920 6d61 7472 6978 2069 7320 7265 6669 y matrix is refi │ │ │ -0005cb20: 6e65 6420 6675 7274 6865 7220 2875 7369 ned further (usi │ │ │ -0005cb30: 6e67 0a69 6e6c 6965 7273 206f 6e6c 7920 ng.inliers only │ │ │ -0005cb40: 696e 2063 6173 6520 6f66 2061 2072 6f62 in case of a rob │ │ │ -0005cb50: 7573 7420 6d65 7468 6f64 2920 7769 7468 ust method) with │ │ │ -0005cb60: 2074 6865 204c 6576 656e 6265 7267 2d4d the Levenberg-M │ │ │ -0005cb70: 6172 7175 6172 6474 206d 6574 686f 6420 arquardt method │ │ │ -0005cb80: 746f 2072 6564 7563 6520 7468 650a 7265 to reduce the.re │ │ │ -0005cb90: 2d70 726f 6a65 6374 696f 6e20 6572 726f -projection erro │ │ │ -0005cba0: 7220 6576 656e 206d 6f72 652e 0a0a 5468 r even more...Th │ │ │ -0005cbb0: 6520 6d65 7468 6f64 7320 5241 4e53 4143 e methods RANSAC │ │ │ -0005cbc0: 2061 6e64 2052 484f 2063 616e 2068 616e and RHO can han │ │ │ -0005cbd0: 646c 6520 7072 6163 7469 6361 6c6c 7920 dle practically │ │ │ -0005cbe0: 616e 7920 7261 7469 6f20 6f66 206f 7574 any ratio of out │ │ │ -0005cbf0: 6c69 6572 7320 6275 7420 6e65 6564 2061 liers but need a │ │ │ -0005cc00: 2074 6872 6573 686f 6c64 2074 6f0a 6469 threshold to.di │ │ │ -0005cc10: 7374 696e 6775 6973 6820 696e 6c69 6572 stinguish inlier │ │ │ -0005cc20: 7320 6672 6f6d 206f 7574 6c69 6572 732e s from outliers. │ │ │ -0005cc30: 2054 6865 206d 6574 686f 6420 4c4d 6544 The method LMeD │ │ │ -0005cc40: 5320 646f 6573 206e 6f74 206e 6565 6420 S does not need │ │ │ -0005cc50: 616e 7920 7468 7265 7368 6f6c 6420 6275 any threshold bu │ │ │ -0005cc60: 7420 6974 2077 6f72 6b73 0a63 6f72 7265 t it works.corre │ │ │ -0005cc70: 6374 6c79 206f 6e6c 7920 7768 656e 2074 ctly only when t │ │ │ -0005cc80: 6865 7265 2061 7265 206d 6f72 6520 7468 here are more th │ │ │ -0005cc90: 616e 2035 3025 206f 6620 696e 6c69 6572 an 50% of inlier │ │ │ -0005cca0: 732e 2046 696e 616c 6c79 2c20 6966 2074 s. Finally, if t │ │ │ -0005ccb0: 6865 7265 2061 7265 206e 6f20 6f75 746c here are no outl │ │ │ -0005ccc0: 6965 7273 2061 6e64 2074 6865 0a6e 6f69 iers and the.noi │ │ │ -0005ccd0: 7365 2069 7320 7261 7468 6572 2073 6d61 se is rather sma │ │ │ -0005cce0: 6c6c 2c20 7573 6520 7468 6520 6465 6661 ll, use the defa │ │ │ -0005ccf0: 756c 7420 6d65 7468 6f64 2028 6d65 7468 ult method (meth │ │ │ -0005cd00: 6f64 3d30 292e 0a0a 5468 6520 6675 6e63 od=0)...The func │ │ │ -0005cd10: 7469 6f6e 2069 7320 7573 6564 2074 6f20 tion is used to │ │ │ -0005cd20: 6669 6e64 2069 6e69 7469 616c 2069 6e74 find initial int │ │ │ -0005cd30: 7269 6e73 6963 2061 6e64 2065 7874 7269 rinsic and extri │ │ │ -0005cd40: 6e73 6963 206d 6174 7269 6365 732e 2048 nsic matrices. H │ │ │ -0005cd50: 6f6d 6f67 7261 7068 7920 6d61 7472 6978 omography matrix │ │ │ -0005cd60: 2069 730a 6465 7465 726d 696e 6564 2075 is.determined u │ │ │ -0005cd70: 7020 746f 2061 2073 6361 6c65 2e20 4966 p to a scale. If │ │ │ -0005cd80: 205c 2868 5f7b 3333 7d5c 2920 6973 206e \(h_{33}\) is n │ │ │ -0005cd90: 6f6e 2d7a 6572 6f2c 2074 6865 206d 6174 on-zero, the mat │ │ │ -0005cda0: 7269 7820 6973 206e 6f72 6d61 6c69 7a65 rix is normalize │ │ │ -0005cdb0: 6420 736f 2074 6861 7420 5c28 685f 7b33 d so that \(h_{3 │ │ │ -0005cdc0: 337d 3d31 5c29 2e0a 3c62 3e4e 6f74 653a 3}=1\)..Note: │ │ │ -0005cdd0: 3c2f 623e 2057 6865 6e65 7665 7220 616e Whenever an │ │ │ -0005cde0: 205c 2848 5c29 206d 6174 7269 7820 6361 \(H\) matrix ca │ │ │ -0005cdf0: 6e6e 6f74 2062 6520 6573 7469 6d61 7465 nnot be estimate │ │ │ -0005ce00: 642c 2061 6e20 656d 7074 7920 6f6e 6520 d, an empty one │ │ │ -0005ce10: 7769 6c6c 2062 6520 7265 7475 726e 6564 will be returned │ │ │ -0005ce20: 2e0a 0a53 4545 3a0a 6765 7441 6666 696e ...SEE:.getAffin │ │ │ -0005ce30: 6554 7261 6e73 666f 726d 2c20 6573 7469 eTransform, esti │ │ │ -0005ce40: 6d61 7465 4166 6669 6e65 3244 2c20 6573 mateAffine2D, es │ │ │ -0005ce50: 7469 6d61 7465 4166 6669 6e65 5061 7274 timateAffinePart │ │ │ -0005ce60: 6961 6c32 442c 2067 6574 5065 7273 7065 ial2D, getPerspe │ │ │ -0005ce70: 6374 6976 6554 7261 6e73 666f 726d 2c20 ctiveTransform, │ │ │ -0005ce80: 7761 7270 5065 7273 7065 6374 6976 652c warpPerspective, │ │ │ -0005ce90: 0a70 6572 7370 6563 7469 7665 5472 616e .perspectiveTran │ │ │ -0005cea0: 7366 6f72 6d3c 2f64 643e 0a3c 6474 3e52 sform
    .
    R │ │ │ -0005ceb0: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    automatically g │ │ │ -0005ced0: 656e 6572 6174 6564 3c2f 6464 3e0a 3c2f enerated
    ..
    ..
  • .
  • │ │ │ -0005cf00: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    findHomo │ │ │ -0005cf80: 6772 6170 6879 3c2f 6833 3e0a 3c64 6976 graphy

    .
    .
    public static< │ │ │ -0005cff0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> Mat │ │ │ -0005d060: 266e 6273 703b 3c73 7061 6e20 636c 6173  findHomography< │ │ │ -0005d090: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(MatOfP │ │ │ -0005d100: 6f69 6e74 3266 3c2f 613e 266e 6273 703b oint2f  │ │ │ -0005d110: 7372 6350 6f69 6e74 732c 0a20 3c61 2068 srcPoints,. MatOfPoint2f dstPoints │ │ │ -0005d180: 2c0a 2069 6e74 266e 6273 703b 6d65 7468 ,. int meth │ │ │ -0005d190: 6f64 2c0a 2064 6f75 626c 6526 6e62 7370 od,. double  │ │ │ -0005d1a0: 3b72 616e 7361 6352 6570 726f 6a54 6872 ;ransacReprojThr │ │ │ -0005d1b0: 6573 686f 6c64 293c 2f73 7061 6e3e 3c2f eshold).
    Finds a │ │ │ -0005d1e0: 7065 7273 7065 6374 6976 6520 7472 616e perspective tran │ │ │ -0005d1f0: 7366 6f72 6d61 7469 6f6e 2062 6574 7765 sformation betwe │ │ │ -0005d200: 656e 2074 776f 2070 6c61 6e65 732e 3c2f en two planes..
    .
    Para │ │ │ -0005d230: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    srcPoints │ │ │ -0005d250: 3c2f 636f 6465 3e20 2d20 436f 6f72 6469 - Coordi │ │ │ -0005d260: 6e61 7465 7320 6f66 2074 6865 2070 6f69 nates of the poi │ │ │ -0005d270: 6e74 7320 696e 2074 6865 206f 7269 6769 nts in the origi │ │ │ -0005d280: 6e61 6c20 706c 616e 652c 2061 206d 6174 nal plane, a mat │ │ │ -0005d290: 7269 7820 6f66 2074 6865 2074 7970 6520 rix of the type │ │ │ -0005d2a0: 4356 5f33 3246 4332 0a6f 7220 7665 6374 CV_32FC2.or vect │ │ │ -0005d2b0: 6f72 266c 743b 506f 696e 7432 6626 6774 or<Point2f> │ │ │ -0005d2c0: 3b20 2e3c 2f64 643e 0a3c 6464 3e3c 636f ; .
    .
    dstPoints - Coordinate │ │ │ -0005d2f0: 7320 6f66 2074 6865 2070 6f69 6e74 7320 s of the points │ │ │ -0005d300: 696e 2074 6865 2074 6172 6765 7420 706c in the target pl │ │ │ -0005d310: 616e 652c 2061 206d 6174 7269 7820 6f66 ane, a matrix of │ │ │ -0005d320: 2074 6865 2074 7970 6520 4356 5f33 3246 the type CV_32F │ │ │ -0005d330: 4332 206f 720a 6120 7665 6374 6f72 266c C2 or.a vector&l │ │ │ -0005d340: 743b 506f 696e 7432 6626 6774 3b20 2e3c t;Point2f> .< │ │ │ -0005d350: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e6d /dd>.
    m │ │ │ -0005d360: 6574 686f 643c 2f63 6f64 653e 202d 204d ethod - M │ │ │ -0005d370: 6574 686f 6420 7573 6564 2074 6f20 636f ethod used to co │ │ │ -0005d380: 6d70 7574 6520 6120 686f 6d6f 6772 6170 mpute a homograp │ │ │ -0005d390: 6879 206d 6174 7269 782e 2054 6865 2066 hy matrix. The f │ │ │ -0005d3a0: 6f6c 6c6f 7769 6e67 206d 6574 686f 6473 ollowing methods │ │ │ -0005d3b0: 2061 7265 2070 6f73 7369 626c 653a 0a3c are possible:.< │ │ │ -0005d3c0: 756c 3e0a 2020 3c6c 693e 0a20 2020 3c62 ul>.
  • . 0 - a regul │ │ │ -0005d3e0: 6172 206d 6574 686f 6420 7573 696e 6720 ar method using │ │ │ -0005d3f0: 616c 6c20 7468 6520 706f 696e 7473 2c20 all the points, │ │ │ -0005d400: 692e 652e 2c20 7468 6520 6c65 6173 7420 i.e., the least │ │ │ -0005d410: 7371 7561 7265 7320 6d65 7468 6f64 0a20 squares method. │ │ │ -0005d420: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020
  • .
  • . │ │ │ -0005d430: 2052 4546 3a20 5241 4e53 4143 202d 2052 REF: RANSAC - R │ │ │ -0005d440: 414e 5341 432d 6261 7365 6420 726f 6275 ANSAC-based robu │ │ │ -0005d450: 7374 206d 6574 686f 640a 2020 3c2f 6c69 st method.
  • .
  • . REF: │ │ │ -0005d470: 204c 4d45 4453 202d 204c 6561 7374 2d4d LMEDS - Least-M │ │ │ -0005d480: 6564 6961 6e20 726f 6275 7374 206d 6574 edian robust met │ │ │ -0005d490: 686f 640a 2020 3c2f 6c69 3e0a 2020 3c6c hod.
  • . . REF: RHO - │ │ │ -0005d4b0: 2050 524f 5341 432d 6261 7365 6420 726f PROSAC-based ro │ │ │ -0005d4c0: 6275 7374 206d 6574 686f 640a 2020 3c2f bust method. .
    .< │ │ │ -0005d4e0: 6464 3e3c 636f 6465 3e72 616e 7361 6352 dd>ransacR │ │ │ -0005d4f0: 6570 726f 6a54 6872 6573 686f 6c64 3c2f eprojThreshold - Maximum │ │ │ -0005d510: 616c 6c6f 7765 6420 7265 7072 6f6a 6563 allowed reprojec │ │ │ -0005d520: 7469 6f6e 2065 7272 6f72 2074 6f20 7472 tion error to tr │ │ │ -0005d530: 6561 7420 6120 706f 696e 7420 7061 6972 eat a point pair │ │ │ -0005d540: 2061 7320 616e 2069 6e6c 6965 720a 2875 as an inlier.(u │ │ │ -0005d550: 7365 6420 696e 2074 6865 2052 414e 5341 sed in the RANSA │ │ │ -0005d560: 4320 616e 6420 5248 4f20 6d65 7468 6f64 C and RHO method │ │ │ -0005d570: 7320 6f6e 6c79 292e 2054 6861 7420 6973 s only). That is │ │ │ -0005d580: 2c20 6966 0a5c 285c 7c20 5c74 6578 7474 , if.\(\| \textt │ │ │ -0005d590: 747b 6473 7450 6f69 6e74 737d 205f 6920 t{dstPoints} _i │ │ │ -0005d5a0: 2d20 205c 7465 7874 7474 7b63 6f6e 7665 - \texttt{conve │ │ │ -0005d5b0: 7274 506f 696e 7473 486f 6d6f 6765 6e65 rtPointsHomogene │ │ │ -0005d5c0: 6f75 737d 2028 205c 7465 7874 7474 7b48 ous} ( \texttt{H │ │ │ -0005d5d0: 7d20 5c63 646f 7420 5c74 6578 7474 747b } \cdot \texttt{ │ │ │ -0005d5e0: 7372 6350 6f69 6e74 737d 205f 6929 205c srcPoints} _i) \ │ │ │ -0005d5f0: 7c5f 3220 2026 6774 3b20 205c 7465 7874 |_2 > \text │ │ │ -0005d600: 7474 7b72 616e 7361 6352 6570 726f 6a54 tt{ransacReprojT │ │ │ -0005d610: 6872 6573 686f 6c64 7d5c 290a 7468 656e hreshold}\).then │ │ │ -0005d620: 2074 6865 2070 6f69 6e74 205c 2869 5c29 the point \(i\) │ │ │ -0005d630: 2069 7320 636f 6e73 6964 6572 6564 2061 is considered a │ │ │ -0005d640: 7320 616e 206f 7574 6c69 6572 2e20 4966 s an outlier. If │ │ │ -0005d650: 2073 7263 506f 696e 7473 2061 6e64 2064 srcPoints and d │ │ │ -0005d660: 7374 506f 696e 7473 2061 7265 206d 6561 stPoints are mea │ │ │ -0005d670: 7375 7265 6420 696e 2070 6978 656c 732c sured in pixels, │ │ │ -0005d680: 0a69 7420 7573 7561 6c6c 7920 6d61 6b65 .it usually make │ │ │ -0005d690: 7320 7365 6e73 6520 746f 2073 6574 2074 s sense to set t │ │ │ -0005d6a0: 6869 7320 7061 7261 6d65 7465 7220 736f his parameter so │ │ │ -0005d6b0: 6d65 7768 6572 6520 696e 2074 6865 2072 mewhere in the r │ │ │ -0005d6c0: 616e 6765 206f 6620 3120 746f 2031 302e ange of 1 to 10. │ │ │ -0005d6d0: 0a6d 6173 6b20 7661 6c75 6573 2061 7265 .mask values are │ │ │ -0005d6e0: 2069 676e 6f72 6564 2e0a 0a54 6865 2066 ignored...The f │ │ │ -0005d6f0: 756e 6374 696f 6e20 6669 6e64 7320 616e unction finds an │ │ │ -0005d700: 6420 7265 7475 726e 7320 7468 6520 7065 d returns the pe │ │ │ -0005d710: 7273 7065 6374 6976 6520 7472 616e 7366 rspective transf │ │ │ -0005d720: 6f72 6d61 7469 6f6e 205c 2848 5c29 2062 ormation \(H\) b │ │ │ -0005d730: 6574 7765 656e 2074 6865 2073 6f75 7263 etween the sourc │ │ │ -0005d740: 6520 616e 6420 7468 650a 6465 7374 696e e and the.destin │ │ │ -0005d750: 6174 696f 6e20 706c 616e 6573 3a0a 0a5c ation planes:..\ │ │ │ -0005d760: 2873 5f69 2020 5c76 6563 7468 7265 657b (s_i \vecthree{ │ │ │ -0005d770: 7827 5f69 7d7b 7927 5f69 7d7b 317d 205c x'_i}{y'_i}{1} \ │ │ │ -0005d780: 7369 6d20 4820 205c 7665 6374 6872 6565 sim H \vecthree │ │ │ -0005d790: 7b78 5f69 7d7b 795f 697d 7b31 7d5c 290a {x_i}{y_i}{1}\). │ │ │ -0005d7a0: 0a73 6f20 7468 6174 2074 6865 2062 6163 .so that the bac │ │ │ -0005d7b0: 6b2d 7072 6f6a 6563 7469 6f6e 2065 7272 k-projection err │ │ │ -0005d7c0: 6f72 0a0a 5c28 5c73 756d 205f 6920 5c6c or..\(\sum _i \l │ │ │ -0005d7d0: 6566 7420 2820 7827 5f69 2d20 5c66 7261 eft ( x'_i- \fra │ │ │ -0005d7e0: 637b 685f 7b31 317d 2078 5f69 202b 2068 c{h_{11} x_i + h │ │ │ -0005d7f0: 5f7b 3132 7d20 795f 6920 2b20 685f 7b31 _{12} y_i + h_{1 │ │ │ -0005d800: 337d 7d7b 685f 7b33 317d 2078 5f69 202b 3}}{h_{31} x_i + │ │ │ -0005d810: 2068 5f7b 3332 7d20 795f 6920 2b20 685f h_{32} y_i + h_ │ │ │ -0005d820: 7b33 337d 7d20 5c72 6967 6874 2029 5e32 {33}} \right )^2 │ │ │ -0005d830: 2b20 5c6c 6566 7420 2820 7927 5f69 2d20 + \left ( y'_i- │ │ │ -0005d840: 5c66 7261 637b 685f 7b32 317d 2078 5f69 \frac{h_{21} x_i │ │ │ -0005d850: 202b 2068 5f7b 3232 7d20 795f 6920 2b20 + h_{22} y_i + │ │ │ -0005d860: 685f 7b32 337d 7d7b 685f 7b33 317d 2078 h_{23}}{h_{31} x │ │ │ -0005d870: 5f69 202b 2068 5f7b 3332 7d20 795f 6920 _i + h_{32} y_i │ │ │ -0005d880: 2b20 685f 7b33 337d 7d20 5c72 6967 6874 + h_{33}} \right │ │ │ -0005d890: 2029 5e32 5c29 0a0a 6973 206d 696e 696d )^2\)..is minim │ │ │ -0005d8a0: 697a 6564 2e20 4966 2074 6865 2070 6172 ized. If the par │ │ │ -0005d8b0: 616d 6574 6572 206d 6574 686f 6420 6973 ameter method is │ │ │ -0005d8c0: 2073 6574 2074 6f20 7468 6520 6465 6661 set to the defa │ │ │ -0005d8d0: 756c 7420 7661 6c75 6520 302c 2074 6865 ult value 0, the │ │ │ -0005d8e0: 2066 756e 6374 696f 6e20 7573 6573 2061 function uses a │ │ │ -0005d8f0: 6c6c 2074 6865 2070 6f69 6e74 0a70 6169 ll the point.pai │ │ │ -0005d900: 7273 2074 6f20 636f 6d70 7574 6520 616e rs to compute an │ │ │ -0005d910: 2069 6e69 7469 616c 2068 6f6d 6f67 7261 initial homogra │ │ │ -0005d920: 7068 7920 6573 7469 6d61 7465 2077 6974 phy estimate wit │ │ │ -0005d930: 6820 6120 7369 6d70 6c65 206c 6561 7374 h a simple least │ │ │ -0005d940: 2d73 7175 6172 6573 2073 6368 656d 652e -squares scheme. │ │ │ -0005d950: 0a0a 486f 7765 7665 722c 2069 6620 6e6f ..However, if no │ │ │ -0005d960: 7420 616c 6c20 6f66 2074 6865 2070 6f69 t all of the poi │ │ │ -0005d970: 6e74 2070 6169 7273 2028 205c 2873 7263 nt pairs ( \(src │ │ │ -0005d980: 506f 696e 7473 5f69 5c29 2c20 5c28 6473 Points_i\), \(ds │ │ │ -0005d990: 7450 6f69 6e74 735f 695c 2920 2920 6669 tPoints_i\) ) fi │ │ │ -0005d9a0: 7420 7468 6520 7269 6769 6420 7065 7273 t the rigid pers │ │ │ -0005d9b0: 7065 6374 6976 650a 7472 616e 7366 6f72 pective.transfor │ │ │ -0005d9c0: 6d61 7469 6f6e 2028 7468 6174 2069 732c mation (that is, │ │ │ -0005d9d0: 2074 6865 7265 2061 7265 2073 6f6d 6520 there are some │ │ │ -0005d9e0: 6f75 746c 6965 7273 292c 2074 6869 7320 outliers), this │ │ │ -0005d9f0: 696e 6974 6961 6c20 6573 7469 6d61 7465 initial estimate │ │ │ -0005da00: 2077 696c 6c20 6265 2070 6f6f 722e 2049 will be poor. I │ │ │ -0005da10: 6e20 7468 6973 2063 6173 652c 0a79 6f75 n this case,.you │ │ │ -0005da20: 2063 616e 2075 7365 206f 6e65 206f 6620 can use one of │ │ │ -0005da30: 7468 6520 7468 7265 6520 726f 6275 7374 the three robust │ │ │ -0005da40: 206d 6574 686f 6473 2e20 5468 6520 6d65 methods. The me │ │ │ -0005da50: 7468 6f64 7320 5241 4e53 4143 2c20 4c4d thods RANSAC, LM │ │ │ -0005da60: 6544 5320 616e 6420 5248 4f20 7472 7920 eDS and RHO try │ │ │ -0005da70: 6d61 6e79 2064 6966 6665 7265 6e74 0a72 many different.r │ │ │ -0005da80: 616e 646f 6d20 7375 6273 6574 7320 6f66 andom subsets of │ │ │ -0005da90: 2074 6865 2063 6f72 7265 7370 6f6e 6469 the correspondi │ │ │ -0005daa0: 6e67 2070 6f69 6e74 2070 6169 7273 2028 ng point pairs ( │ │ │ -0005dab0: 6f66 2066 6f75 7220 7061 6972 7320 6561 of four pairs ea │ │ │ -0005dac0: 6368 2c20 636f 6c6c 696e 6561 7220 7061 ch, collinear pa │ │ │ -0005dad0: 6972 7320 6172 6520 6469 7363 6172 6465 irs are discarde │ │ │ -0005dae0: 6429 2c20 6573 7469 6d61 7465 2074 6865 d), estimate the │ │ │ -0005daf0: 2068 6f6d 6f67 7261 7068 7920 6d61 7472 homography matr │ │ │ -0005db00: 6978 0a75 7369 6e67 2074 6869 7320 7375 ix.using this su │ │ │ -0005db10: 6273 6574 2061 6e64 2061 2073 696d 706c bset and a simpl │ │ │ -0005db20: 6520 6c65 6173 742d 7371 7561 7265 7320 e least-squares │ │ │ -0005db30: 616c 676f 7269 7468 6d2c 2061 6e64 2074 algorithm, and t │ │ │ -0005db40: 6865 6e20 636f 6d70 7574 6520 7468 6520 hen compute the │ │ │ -0005db50: 7175 616c 6974 792f 676f 6f64 6e65 7373 quality/goodness │ │ │ -0005db60: 206f 6620 7468 650a 636f 6d70 7574 6564 of the.computed │ │ │ -0005db70: 2068 6f6d 6f67 7261 7068 7920 2877 6869 homography (whi │ │ │ -0005db80: 6368 2069 7320 7468 6520 6e75 6d62 6572 ch is the number │ │ │ -0005db90: 206f 6620 696e 6c69 6572 7320 666f 7220 of inliers for │ │ │ -0005dba0: 5241 4e53 4143 206f 7220 7468 6520 6c65 RANSAC or the le │ │ │ -0005dbb0: 6173 7420 6d65 6469 616e 2072 652d 7072 ast median re-pr │ │ │ -0005dbc0: 6f6a 6563 7469 6f6e 2065 7272 6f72 2066 ojection error f │ │ │ -0005dbd0: 6f72 0a4c 4d65 4453 292e 2054 6865 2062 or.LMeDS). The b │ │ │ -0005dbe0: 6573 7420 7375 6273 6574 2069 7320 7468 est subset is th │ │ │ -0005dbf0: 656e 2075 7365 6420 746f 2070 726f 6475 en used to produ │ │ │ -0005dc00: 6365 2074 6865 2069 6e69 7469 616c 2065 ce the initial e │ │ │ -0005dc10: 7374 696d 6174 6520 6f66 2074 6865 2068 stimate of the h │ │ │ -0005dc20: 6f6d 6f67 7261 7068 7920 6d61 7472 6978 omography matrix │ │ │ -0005dc30: 2061 6e64 0a74 6865 206d 6173 6b20 6f66 and.the mask of │ │ │ -0005dc40: 2069 6e6c 6965 7273 2f6f 7574 6c69 6572 inliers/outlier │ │ │ -0005dc50: 732e 0a0a 5265 6761 7264 6c65 7373 206f s...Regardless o │ │ │ -0005dc60: 6620 7468 6520 6d65 7468 6f64 2c20 726f f the method, ro │ │ │ -0005dc70: 6275 7374 206f 7220 6e6f 742c 2074 6865 bust or not, the │ │ │ -0005dc80: 2063 6f6d 7075 7465 6420 686f 6d6f 6772 computed homogr │ │ │ -0005dc90: 6170 6879 206d 6174 7269 7820 6973 2072 aphy matrix is r │ │ │ -0005dca0: 6566 696e 6564 2066 7572 7468 6572 2028 efined further ( │ │ │ -0005dcb0: 7573 696e 670a 696e 6c69 6572 7320 6f6e using.inliers on │ │ │ -0005dcc0: 6c79 2069 6e20 6361 7365 206f 6620 6120 ly in case of a │ │ │ -0005dcd0: 726f 6275 7374 206d 6574 686f 6429 2077 robust method) w │ │ │ -0005dce0: 6974 6820 7468 6520 4c65 7665 6e62 6572 ith the Levenber │ │ │ -0005dcf0: 672d 4d61 7271 7561 7264 7420 6d65 7468 g-Marquardt meth │ │ │ -0005dd00: 6f64 2074 6f20 7265 6475 6365 2074 6865 od to reduce the │ │ │ -0005dd10: 0a72 652d 7072 6f6a 6563 7469 6f6e 2065 .re-projection e │ │ │ -0005dd20: 7272 6f72 2065 7665 6e20 6d6f 7265 2e0a rror even more.. │ │ │ -0005dd30: 0a54 6865 206d 6574 686f 6473 2052 414e .The methods RAN │ │ │ -0005dd40: 5341 4320 616e 6420 5248 4f20 6361 6e20 SAC and RHO can │ │ │ -0005dd50: 6861 6e64 6c65 2070 7261 6374 6963 616c handle practical │ │ │ -0005dd60: 6c79 2061 6e79 2072 6174 696f 206f 6620 ly any ratio of │ │ │ -0005dd70: 6f75 746c 6965 7273 2062 7574 206e 6565 outliers but nee │ │ │ -0005dd80: 6420 6120 7468 7265 7368 6f6c 6420 746f d a threshold to │ │ │ -0005dd90: 0a64 6973 7469 6e67 7569 7368 2069 6e6c .distinguish inl │ │ │ -0005dda0: 6965 7273 2066 726f 6d20 6f75 746c 6965 iers from outlie │ │ │ -0005ddb0: 7273 2e20 5468 6520 6d65 7468 6f64 204c rs. The method L │ │ │ -0005ddc0: 4d65 4453 2064 6f65 7320 6e6f 7420 6e65 MeDS does not ne │ │ │ -0005ddd0: 6564 2061 6e79 2074 6872 6573 686f 6c64 ed any threshold │ │ │ -0005dde0: 2062 7574 2069 7420 776f 726b 730a 636f but it works.co │ │ │ -0005ddf0: 7272 6563 746c 7920 6f6e 6c79 2077 6865 rrectly only whe │ │ │ -0005de00: 6e20 7468 6572 6520 6172 6520 6d6f 7265 n there are more │ │ │ -0005de10: 2074 6861 6e20 3530 2520 6f66 2069 6e6c than 50% of inl │ │ │ -0005de20: 6965 7273 2e20 4669 6e61 6c6c 792c 2069 iers. Finally, i │ │ │ -0005de30: 6620 7468 6572 6520 6172 6520 6e6f 206f f there are no o │ │ │ -0005de40: 7574 6c69 6572 7320 616e 6420 7468 650a utliers and the. │ │ │ -0005de50: 6e6f 6973 6520 6973 2072 6174 6865 7220 noise is rather │ │ │ -0005de60: 736d 616c 6c2c 2075 7365 2074 6865 2064 small, use the d │ │ │ -0005de70: 6566 6175 6c74 206d 6574 686f 6420 286d efault method (m │ │ │ -0005de80: 6574 686f 643d 3029 2e0a 0a54 6865 2066 ethod=0)...The f │ │ │ -0005de90: 756e 6374 696f 6e20 6973 2075 7365 6420 unction is used │ │ │ -0005dea0: 746f 2066 696e 6420 696e 6974 6961 6c20 to find initial │ │ │ -0005deb0: 696e 7472 696e 7369 6320 616e 6420 6578 intrinsic and ex │ │ │ -0005dec0: 7472 696e 7369 6320 6d61 7472 6963 6573 trinsic matrices │ │ │ -0005ded0: 2e20 486f 6d6f 6772 6170 6879 206d 6174 . Homography mat │ │ │ -0005dee0: 7269 7820 6973 0a64 6574 6572 6d69 6e65 rix is.determine │ │ │ -0005def0: 6420 7570 2074 6f20 6120 7363 616c 652e d up to a scale. │ │ │ -0005df00: 2049 6620 5c28 685f 7b33 337d 5c29 2069 If \(h_{33}\) i │ │ │ -0005df10: 7320 6e6f 6e2d 7a65 726f 2c20 7468 6520 s non-zero, the │ │ │ -0005df20: 6d61 7472 6978 2069 7320 6e6f 726d 616c matrix is normal │ │ │ -0005df30: 697a 6564 2073 6f20 7468 6174 205c 2868 ized so that \(h │ │ │ -0005df40: 5f7b 3333 7d3d 315c 292e 0a3c 623e 4e6f _{33}=1\)..No │ │ │ -0005df50: 7465 3a3c 2f62 3e20 5768 656e 6576 6572 te: Whenever │ │ │ -0005df60: 2061 6e20 5c28 485c 2920 6d61 7472 6978 an \(H\) matrix │ │ │ -0005df70: 2063 616e 6e6f 7420 6265 2065 7374 696d cannot be estim │ │ │ -0005df80: 6174 6564 2c20 616e 2065 6d70 7479 206f ated, an empty o │ │ │ -0005df90: 6e65 2077 696c 6c20 6265 2072 6574 7572 ne will be retur │ │ │ -0005dfa0: 6e65 642e 0a0a 5345 453a 0a67 6574 4166 ned...SEE:.getAf │ │ │ -0005dfb0: 6669 6e65 5472 616e 7366 6f72 6d2c 2065 fineTransform, e │ │ │ -0005dfc0: 7374 696d 6174 6541 6666 696e 6532 442c stimateAffine2D, │ │ │ -0005dfd0: 2065 7374 696d 6174 6541 6666 696e 6550 estimateAffineP │ │ │ -0005dfe0: 6172 7469 616c 3244 2c20 6765 7450 6572 artial2D, getPer │ │ │ -0005dff0: 7370 6563 7469 7665 5472 616e 7366 6f72 spectiveTransfor │ │ │ -0005e000: 6d2c 2077 6172 7050 6572 7370 6563 7469 m, warpPerspecti │ │ │ -0005e010: 7665 2c0a 7065 7273 7065 6374 6976 6554 ve,.perspectiveT │ │ │ -0005e020: 7261 6e73 666f 726d 3c2f 6464 3e0a 3c64 ransform.Returns:. │ │ │ -0005e040: 3c64 643e 6175 746f 6d61 7469 6361 6c6c
    automaticall │ │ │ -0005e050: 7920 6765 6e65 7261 7465 643c 2f64 643e y generated
    │ │ │ -0005e060: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    .
    ..
  • .< │ │ │ -0005e080: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    . │ │ │ -0005e0f0: 3c68 333e 6669 6e64 486f 6d6f 6772 6170

    findHomograp │ │ │ -0005e100: 6879 3c2f 6833 3e0a 3c64 6976 2063 6c61 hy

    .
    .
    pu │ │ │ -0005e160: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static Ma │ │ │ -0005e1d0: 743c 2f61 3e3c 2f73 7061 6e3e 266e 6273 t&nbs │ │ │ -0005e1e0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;fin │ │ │ -0005e200: 6448 6f6d 6f67 7261 7068 793c 2f73 7061 dHomography │ │ │ -0005e230: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (MatOfPoint │ │ │ -0005e280: 3266 3c2f 613e 266e 6273 703b 7372 6350 2f srcP │ │ │ -0005e290: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat │ │ │ -0005e2e0: 4f66 506f 696e 7432 663c 2f61 3e26 6e62 OfPoint2f&nb │ │ │ -0005e2f0: 7370 3b64 7374 506f 696e 7473 2c0a 2069 sp;dstPoints,. i │ │ │ -0005e300: 6e74 266e 6273 703b 6d65 7468 6f64 293c nt method)< │ │ │ -0005e310: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ -0005e330: 4669 6e64 7320 6120 7065 7273 7065 6374 Finds a perspect │ │ │ -0005e340: 6976 6520 7472 616e 7366 6f72 6d61 7469 ive transformati │ │ │ -0005e350: 6f6e 2062 6574 7765 656e 2074 776f 2070 on between two p │ │ │ -0005e360: 6c61 6e65 732e 3c2f 6469 763e 0a3c 646c lanes.
    .
    . │ │ │ -0005e380: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -0005e390: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e73 /dt>.
    s │ │ │ -0005e3a0: 7263 506f 696e 7473 3c2f 636f 6465 3e20 rcPoints │ │ │ -0005e3b0: 2d20 436f 6f72 6469 6e61 7465 7320 6f66 - Coordinates of │ │ │ -0005e3c0: 2074 6865 2070 6f69 6e74 7320 696e 2074 the points in t │ │ │ -0005e3d0: 6865 206f 7269 6769 6e61 6c20 706c 616e he original plan │ │ │ -0005e3e0: 652c 2061 206d 6174 7269 7820 6f66 2074 e, a matrix of t │ │ │ -0005e3f0: 6865 2074 7970 6520 4356 5f33 3246 4332 he type CV_32FC2 │ │ │ -0005e400: 0a6f 7220 7665 6374 6f72 266c 743b 506f .or vector<Po │ │ │ -0005e410: 696e 7432 6626 6774 3b20 2e3c 2f64 643e int2f> .
    │ │ │ -0005e420: 0a3c 6464 3e3c 636f 6465 3e64 7374 506f .
    dstPo │ │ │ -0005e430: 696e 7473 3c2f 636f 6465 3e20 2d20 436f ints - Co │ │ │ -0005e440: 6f72 6469 6e61 7465 7320 6f66 2074 6865 ordinates of the │ │ │ -0005e450: 2070 6f69 6e74 7320 696e 2074 6865 2074 points in the t │ │ │ -0005e460: 6172 6765 7420 706c 616e 652c 2061 206d arget plane, a m │ │ │ -0005e470: 6174 7269 7820 6f66 2074 6865 2074 7970 atrix of the typ │ │ │ -0005e480: 6520 4356 5f33 3246 4332 206f 720a 6120 e CV_32FC2 or.a │ │ │ -0005e490: 7665 6374 6f72 266c 743b 506f 696e 7432 vector<Point2 │ │ │ -0005e4a0: 6626 6774 3b20 2e3c 2f64 643e 0a3c 6464 f> .
    .
    method - Method us │ │ │ -0005e4d0: 6564 2074 6f20 636f 6d70 7574 6520 6120 ed to compute a │ │ │ -0005e4e0: 686f 6d6f 6772 6170 6879 206d 6174 7269 homography matri │ │ │ -0005e4f0: 782e 2054 6865 2066 6f6c 6c6f 7769 6e67 x. The following │ │ │ -0005e500: 206d 6574 686f 6473 2061 7265 2070 6f73 methods are pos │ │ │ -0005e510: 7369 626c 653a 0a3c 756c 3e0a 2020 3c6c sible:.
      . . 0 - │ │ │ -0005e530: 2061 2072 6567 756c 6172 206d 6574 686f a regular metho │ │ │ -0005e540: 6420 7573 696e 6720 616c 6c20 7468 6520 d using all the │ │ │ -0005e550: 706f 696e 7473 2c20 692e 652e 2c20 7468 points, i.e., th │ │ │ -0005e560: 6520 6c65 6173 7420 7371 7561 7265 7320 e least squares │ │ │ -0005e570: 6d65 7468 6f64 0a20 203c 2f6c 693e 0a20 method. . │ │ │ -0005e580: 203c 6c69 3e0a 2020 2052 4546 3a20 5241
    • . REF: RA │ │ │ -0005e590: 4e53 4143 202d 2052 414e 5341 432d 6261 NSAC - RANSAC-ba │ │ │ -0005e5a0: 7365 6420 726f 6275 7374 206d 6574 686f sed robust metho │ │ │ -0005e5b0: 640a 2020 3c2f 6c69 3e0a 2020 3c6c 693e d.
    • .
    • │ │ │ -0005e5c0: 0a20 2020 5245 463a 204c 4d45 4453 202d . REF: LMEDS - │ │ │ -0005e5d0: 204c 6561 7374 2d4d 6564 6961 6e20 726f Least-Median ro │ │ │ -0005e5e0: 6275 7374 206d 6574 686f 640a 2020 3c2f bust method. .
    • . RE │ │ │ -0005e600: 463a 2052 484f 202d 2050 524f 5341 432d F: RHO - PROSAC- │ │ │ -0005e610: 6261 7365 6420 726f 6275 7374 206d 6574 based robust met │ │ │ -0005e620: 686f 640a 2020 3c2f 6c69 3e0a 3c2f 756c hod.
    • .
    .(used in the R │ │ │ -0005e640: 414e 5341 4320 616e 6420 5248 4f20 6d65 ANSAC and RHO me │ │ │ -0005e650: 7468 6f64 7320 6f6e 6c79 292e 2054 6861 thods only). Tha │ │ │ -0005e660: 7420 6973 2c20 6966 0a5c 285c 7c20 5c74 t is, if.\(\| \t │ │ │ -0005e670: 6578 7474 747b 6473 7450 6f69 6e74 737d exttt{dstPoints} │ │ │ -0005e680: 205f 6920 2d20 205c 7465 7874 7474 7b63 _i - \texttt{c │ │ │ -0005e690: 6f6e 7665 7274 506f 696e 7473 486f 6d6f onvertPointsHomo │ │ │ -0005e6a0: 6765 6e65 6f75 737d 2028 205c 7465 7874 geneous} ( \text │ │ │ -0005e6b0: 7474 7b48 7d20 5c63 646f 7420 5c74 6578 tt{H} \cdot \tex │ │ │ -0005e6c0: 7474 747b 7372 6350 6f69 6e74 737d 205f ttt{srcPoints} _ │ │ │ -0005e6d0: 6929 205c 7c5f 3220 2026 6774 3b20 205c i) \|_2 > \ │ │ │ -0005e6e0: 7465 7874 7474 7b72 616e 7361 6352 6570 texttt{ransacRep │ │ │ -0005e6f0: 726f 6a54 6872 6573 686f 6c64 7d5c 290a rojThreshold}\). │ │ │ -0005e700: 7468 656e 2074 6865 2070 6f69 6e74 205c then the point \ │ │ │ -0005e710: 2869 5c29 2069 7320 636f 6e73 6964 6572 (i\) is consider │ │ │ -0005e720: 6564 2061 7320 616e 206f 7574 6c69 6572 ed as an outlier │ │ │ -0005e730: 2e20 4966 2073 7263 506f 696e 7473 2061 . If srcPoints a │ │ │ -0005e740: 6e64 2064 7374 506f 696e 7473 2061 7265 nd dstPoints are │ │ │ -0005e750: 206d 6561 7375 7265 6420 696e 2070 6978 measured in pix │ │ │ -0005e760: 656c 732c 0a69 7420 7573 7561 6c6c 7920 els,.it usually │ │ │ -0005e770: 6d61 6b65 7320 7365 6e73 6520 746f 2073 makes sense to s │ │ │ -0005e780: 6574 2074 6869 7320 7061 7261 6d65 7465 et this paramete │ │ │ -0005e790: 7220 736f 6d65 7768 6572 6520 696e 2074 r somewhere in t │ │ │ -0005e7a0: 6865 2072 616e 6765 206f 6620 3120 746f he range of 1 to │ │ │ -0005e7b0: 2031 302e 0a6d 6173 6b20 7661 6c75 6573 10..mask values │ │ │ -0005e7c0: 2061 7265 2069 676e 6f72 6564 2e0a 0a54 are ignored...T │ │ │ -0005e7d0: 6865 2066 756e 6374 696f 6e20 6669 6e64 he function find │ │ │ -0005e7e0: 7320 616e 6420 7265 7475 726e 7320 7468 s and returns th │ │ │ -0005e7f0: 6520 7065 7273 7065 6374 6976 6520 7472 e perspective tr │ │ │ -0005e800: 616e 7366 6f72 6d61 7469 6f6e 205c 2848 ansformation \(H │ │ │ -0005e810: 5c29 2062 6574 7765 656e 2074 6865 2073 \) between the s │ │ │ -0005e820: 6f75 7263 6520 616e 6420 7468 650a 6465 ource and the.de │ │ │ -0005e830: 7374 696e 6174 696f 6e20 706c 616e 6573 stination planes │ │ │ -0005e840: 3a0a 0a5c 2873 5f69 2020 5c76 6563 7468 :..\(s_i \vecth │ │ │ -0005e850: 7265 657b 7827 5f69 7d7b 7927 5f69 7d7b ree{x'_i}{y'_i}{ │ │ │ -0005e860: 317d 205c 7369 6d20 4820 205c 7665 6374 1} \sim H \vect │ │ │ -0005e870: 6872 6565 7b78 5f69 7d7b 795f 697d 7b31 hree{x_i}{y_i}{1 │ │ │ -0005e880: 7d5c 290a 0a73 6f20 7468 6174 2074 6865 }\)..so that the │ │ │ -0005e890: 2062 6163 6b2d 7072 6f6a 6563 7469 6f6e back-projection │ │ │ -0005e8a0: 2065 7272 6f72 0a0a 5c28 5c73 756d 205f error..\(\sum _ │ │ │ -0005e8b0: 6920 5c6c 6566 7420 2820 7827 5f69 2d20 i \left ( x'_i- │ │ │ -0005e8c0: 5c66 7261 637b 685f 7b31 317d 2078 5f69 \frac{h_{11} x_i │ │ │ -0005e8d0: 202b 2068 5f7b 3132 7d20 795f 6920 2b20 + h_{12} y_i + │ │ │ -0005e8e0: 685f 7b31 337d 7d7b 685f 7b33 317d 2078 h_{13}}{h_{31} x │ │ │ -0005e8f0: 5f69 202b 2068 5f7b 3332 7d20 795f 6920 _i + h_{32} y_i │ │ │ -0005e900: 2b20 685f 7b33 337d 7d20 5c72 6967 6874 + h_{33}} \right │ │ │ -0005e910: 2029 5e32 2b20 5c6c 6566 7420 2820 7927 )^2+ \left ( y' │ │ │ -0005e920: 5f69 2d20 5c66 7261 637b 685f 7b32 317d _i- \frac{h_{21} │ │ │ -0005e930: 2078 5f69 202b 2068 5f7b 3232 7d20 795f x_i + h_{22} y_ │ │ │ -0005e940: 6920 2b20 685f 7b32 337d 7d7b 685f 7b33 i + h_{23}}{h_{3 │ │ │ -0005e950: 317d 2078 5f69 202b 2068 5f7b 3332 7d20 1} x_i + h_{32} │ │ │ -0005e960: 795f 6920 2b20 685f 7b33 337d 7d20 5c72 y_i + h_{33}} \r │ │ │ -0005e970: 6967 6874 2029 5e32 5c29 0a0a 6973 206d ight )^2\)..is m │ │ │ -0005e980: 696e 696d 697a 6564 2e20 4966 2074 6865 inimized. If the │ │ │ -0005e990: 2070 6172 616d 6574 6572 206d 6574 686f parameter metho │ │ │ -0005e9a0: 6420 6973 2073 6574 2074 6f20 7468 6520 d is set to the │ │ │ -0005e9b0: 6465 6661 756c 7420 7661 6c75 6520 302c default value 0, │ │ │ -0005e9c0: 2074 6865 2066 756e 6374 696f 6e20 7573 the function us │ │ │ -0005e9d0: 6573 2061 6c6c 2074 6865 2070 6f69 6e74 es all the point │ │ │ -0005e9e0: 0a70 6169 7273 2074 6f20 636f 6d70 7574 .pairs to comput │ │ │ -0005e9f0: 6520 616e 2069 6e69 7469 616c 2068 6f6d e an initial hom │ │ │ -0005ea00: 6f67 7261 7068 7920 6573 7469 6d61 7465 ography estimate │ │ │ -0005ea10: 2077 6974 6820 6120 7369 6d70 6c65 206c with a simple l │ │ │ -0005ea20: 6561 7374 2d73 7175 6172 6573 2073 6368 east-squares sch │ │ │ -0005ea30: 656d 652e 0a0a 486f 7765 7665 722c 2069 eme...However, i │ │ │ -0005ea40: 6620 6e6f 7420 616c 6c20 6f66 2074 6865 f not all of the │ │ │ -0005ea50: 2070 6f69 6e74 2070 6169 7273 2028 205c point pairs ( \ │ │ │ -0005ea60: 2873 7263 506f 696e 7473 5f69 5c29 2c20 (srcPoints_i\), │ │ │ -0005ea70: 5c28 6473 7450 6f69 6e74 735f 695c 2920 \(dstPoints_i\) │ │ │ -0005ea80: 2920 6669 7420 7468 6520 7269 6769 6420 ) fit the rigid │ │ │ -0005ea90: 7065 7273 7065 6374 6976 650a 7472 616e perspective.tran │ │ │ -0005eaa0: 7366 6f72 6d61 7469 6f6e 2028 7468 6174 sformation (that │ │ │ -0005eab0: 2069 732c 2074 6865 7265 2061 7265 2073 is, there are s │ │ │ -0005eac0: 6f6d 6520 6f75 746c 6965 7273 292c 2074 ome outliers), t │ │ │ -0005ead0: 6869 7320 696e 6974 6961 6c20 6573 7469 his initial esti │ │ │ -0005eae0: 6d61 7465 2077 696c 6c20 6265 2070 6f6f mate will be poo │ │ │ -0005eaf0: 722e 2049 6e20 7468 6973 2063 6173 652c r. In this case, │ │ │ -0005eb00: 0a79 6f75 2063 616e 2075 7365 206f 6e65 .you can use one │ │ │ -0005eb10: 206f 6620 7468 6520 7468 7265 6520 726f of the three ro │ │ │ -0005eb20: 6275 7374 206d 6574 686f 6473 2e20 5468 bust methods. Th │ │ │ -0005eb30: 6520 6d65 7468 6f64 7320 5241 4e53 4143 e methods RANSAC │ │ │ -0005eb40: 2c20 4c4d 6544 5320 616e 6420 5248 4f20 , LMeDS and RHO │ │ │ -0005eb50: 7472 7920 6d61 6e79 2064 6966 6665 7265 try many differe │ │ │ -0005eb60: 6e74 0a72 616e 646f 6d20 7375 6273 6574 nt.random subset │ │ │ -0005eb70: 7320 6f66 2074 6865 2063 6f72 7265 7370 s of the corresp │ │ │ -0005eb80: 6f6e 6469 6e67 2070 6f69 6e74 2070 6169 onding point pai │ │ │ -0005eb90: 7273 2028 6f66 2066 6f75 7220 7061 6972 rs (of four pair │ │ │ -0005eba0: 7320 6561 6368 2c20 636f 6c6c 696e 6561 s each, collinea │ │ │ -0005ebb0: 7220 7061 6972 7320 6172 6520 6469 7363 r pairs are disc │ │ │ -0005ebc0: 6172 6465 6429 2c20 6573 7469 6d61 7465 arded), estimate │ │ │ -0005ebd0: 2074 6865 2068 6f6d 6f67 7261 7068 7920 the homography │ │ │ -0005ebe0: 6d61 7472 6978 0a75 7369 6e67 2074 6869 matrix.using thi │ │ │ -0005ebf0: 7320 7375 6273 6574 2061 6e64 2061 2073 s subset and a s │ │ │ -0005ec00: 696d 706c 6520 6c65 6173 742d 7371 7561 imple least-squa │ │ │ -0005ec10: 7265 7320 616c 676f 7269 7468 6d2c 2061 res algorithm, a │ │ │ -0005ec20: 6e64 2074 6865 6e20 636f 6d70 7574 6520 nd then compute │ │ │ -0005ec30: 7468 6520 7175 616c 6974 792f 676f 6f64 the quality/good │ │ │ -0005ec40: 6e65 7373 206f 6620 7468 650a 636f 6d70 ness of the.comp │ │ │ -0005ec50: 7574 6564 2068 6f6d 6f67 7261 7068 7920 uted homography │ │ │ -0005ec60: 2877 6869 6368 2069 7320 7468 6520 6e75 (which is the nu │ │ │ -0005ec70: 6d62 6572 206f 6620 696e 6c69 6572 7320 mber of inliers │ │ │ -0005ec80: 666f 7220 5241 4e53 4143 206f 7220 7468 for RANSAC or th │ │ │ -0005ec90: 6520 6c65 6173 7420 6d65 6469 616e 2072 e least median r │ │ │ -0005eca0: 652d 7072 6f6a 6563 7469 6f6e 2065 7272 e-projection err │ │ │ -0005ecb0: 6f72 2066 6f72 0a4c 4d65 4453 292e 2054 or for.LMeDS). T │ │ │ -0005ecc0: 6865 2062 6573 7420 7375 6273 6574 2069 he best subset i │ │ │ -0005ecd0: 7320 7468 656e 2075 7365 6420 746f 2070 s then used to p │ │ │ -0005ece0: 726f 6475 6365 2074 6865 2069 6e69 7469 roduce the initi │ │ │ -0005ecf0: 616c 2065 7374 696d 6174 6520 6f66 2074 al estimate of t │ │ │ -0005ed00: 6865 2068 6f6d 6f67 7261 7068 7920 6d61 he homography ma │ │ │ -0005ed10: 7472 6978 2061 6e64 0a74 6865 206d 6173 trix and.the mas │ │ │ -0005ed20: 6b20 6f66 2069 6e6c 6965 7273 2f6f 7574 k of inliers/out │ │ │ -0005ed30: 6c69 6572 732e 0a0a 5265 6761 7264 6c65 liers...Regardle │ │ │ -0005ed40: 7373 206f 6620 7468 6520 6d65 7468 6f64 ss of the method │ │ │ -0005ed50: 2c20 726f 6275 7374 206f 7220 6e6f 742c , robust or not, │ │ │ -0005ed60: 2074 6865 2063 6f6d 7075 7465 6420 686f the computed ho │ │ │ -0005ed70: 6d6f 6772 6170 6879 206d 6174 7269 7820 mography matrix │ │ │ -0005ed80: 6973 2072 6566 696e 6564 2066 7572 7468 is refined furth │ │ │ -0005ed90: 6572 2028 7573 696e 670a 696e 6c69 6572 er (using.inlier │ │ │ -0005eda0: 7320 6f6e 6c79 2069 6e20 6361 7365 206f s only in case o │ │ │ -0005edb0: 6620 6120 726f 6275 7374 206d 6574 686f f a robust metho │ │ │ -0005edc0: 6429 2077 6974 6820 7468 6520 4c65 7665 d) with the Leve │ │ │ -0005edd0: 6e62 6572 672d 4d61 7271 7561 7264 7420 nberg-Marquardt │ │ │ -0005ede0: 6d65 7468 6f64 2074 6f20 7265 6475 6365 method to reduce │ │ │ -0005edf0: 2074 6865 0a72 652d 7072 6f6a 6563 7469 the.re-projecti │ │ │ -0005ee00: 6f6e 2065 7272 6f72 2065 7665 6e20 6d6f on error even mo │ │ │ -0005ee10: 7265 2e0a 0a54 6865 206d 6574 686f 6473 re...The methods │ │ │ -0005ee20: 2052 414e 5341 4320 616e 6420 5248 4f20 RANSAC and RHO │ │ │ -0005ee30: 6361 6e20 6861 6e64 6c65 2070 7261 6374 can handle pract │ │ │ -0005ee40: 6963 616c 6c79 2061 6e79 2072 6174 696f ically any ratio │ │ │ -0005ee50: 206f 6620 6f75 746c 6965 7273 2062 7574 of outliers but │ │ │ -0005ee60: 206e 6565 6420 6120 7468 7265 7368 6f6c need a threshol │ │ │ -0005ee70: 6420 746f 0a64 6973 7469 6e67 7569 7368 d to.distinguish │ │ │ -0005ee80: 2069 6e6c 6965 7273 2066 726f 6d20 6f75 inliers from ou │ │ │ -0005ee90: 746c 6965 7273 2e20 5468 6520 6d65 7468 tliers. The meth │ │ │ -0005eea0: 6f64 204c 4d65 4453 2064 6f65 7320 6e6f od LMeDS does no │ │ │ -0005eeb0: 7420 6e65 6564 2061 6e79 2074 6872 6573 t need any thres │ │ │ -0005eec0: 686f 6c64 2062 7574 2069 7420 776f 726b hold but it work │ │ │ -0005eed0: 730a 636f 7272 6563 746c 7920 6f6e 6c79 s.correctly only │ │ │ -0005eee0: 2077 6865 6e20 7468 6572 6520 6172 6520 when there are │ │ │ -0005eef0: 6d6f 7265 2074 6861 6e20 3530 2520 6f66 more than 50% of │ │ │ -0005ef00: 2069 6e6c 6965 7273 2e20 4669 6e61 6c6c inliers. Finall │ │ │ -0005ef10: 792c 2069 6620 7468 6572 6520 6172 6520 y, if there are │ │ │ -0005ef20: 6e6f 206f 7574 6c69 6572 7320 616e 6420 no outliers and │ │ │ -0005ef30: 7468 650a 6e6f 6973 6520 6973 2072 6174 the.noise is rat │ │ │ -0005ef40: 6865 7220 736d 616c 6c2c 2075 7365 2074 her small, use t │ │ │ -0005ef50: 6865 2064 6566 6175 6c74 206d 6574 686f he default metho │ │ │ -0005ef60: 6420 286d 6574 686f 643d 3029 2e0a 0a54 d (method=0)...T │ │ │ -0005ef70: 6865 2066 756e 6374 696f 6e20 6973 2075 he function is u │ │ │ -0005ef80: 7365 6420 746f 2066 696e 6420 696e 6974 sed to find init │ │ │ -0005ef90: 6961 6c20 696e 7472 696e 7369 6320 616e ial intrinsic an │ │ │ -0005efa0: 6420 6578 7472 696e 7369 6320 6d61 7472 d extrinsic matr │ │ │ -0005efb0: 6963 6573 2e20 486f 6d6f 6772 6170 6879 ices. Homography │ │ │ -0005efc0: 206d 6174 7269 7820 6973 0a64 6574 6572 matrix is.deter │ │ │ -0005efd0: 6d69 6e65 6420 7570 2074 6f20 6120 7363 mined up to a sc │ │ │ -0005efe0: 616c 652e 2049 6620 5c28 685f 7b33 337d ale. If \(h_{33} │ │ │ -0005eff0: 5c29 2069 7320 6e6f 6e2d 7a65 726f 2c20 \) is non-zero, │ │ │ -0005f000: 7468 6520 6d61 7472 6978 2069 7320 6e6f the matrix is no │ │ │ -0005f010: 726d 616c 697a 6564 2073 6f20 7468 6174 rmalized so that │ │ │ -0005f020: 205c 2868 5f7b 3333 7d3d 315c 292e 0a3c \(h_{33}=1\)..< │ │ │ -0005f030: 623e 4e6f 7465 3a3c 2f62 3e20 5768 656e b>Note: When │ │ │ -0005f040: 6576 6572 2061 6e20 5c28 485c 2920 6d61 ever an \(H\) ma │ │ │ -0005f050: 7472 6978 2063 616e 6e6f 7420 6265 2065 trix cannot be e │ │ │ -0005f060: 7374 696d 6174 6564 2c20 616e 2065 6d70 stimated, an emp │ │ │ -0005f070: 7479 206f 6e65 2077 696c 6c20 6265 2072 ty one will be r │ │ │ -0005f080: 6574 7572 6e65 642e 0a0a 5345 453a 0a67 eturned...SEE:.g │ │ │ -0005f090: 6574 4166 6669 6e65 5472 616e 7366 6f72 etAffineTransfor │ │ │ -0005f0a0: 6d2c 2065 7374 696d 6174 6541 6666 696e m, estimateAffin │ │ │ -0005f0b0: 6532 442c 2065 7374 696d 6174 6541 6666 e2D, estimateAff │ │ │ -0005f0c0: 696e 6550 6172 7469 616c 3244 2c20 6765 inePartial2D, ge │ │ │ -0005f0d0: 7450 6572 7370 6563 7469 7665 5472 616e tPerspectiveTran │ │ │ -0005f0e0: 7366 6f72 6d2c 2077 6172 7050 6572 7370 sform, warpPersp │ │ │ -0005f0f0: 6563 7469 7665 2c0a 7065 7273 7065 6374 ective,.perspect │ │ │ -0005f100: 6976 6554 7261 6e73 666f 726d 3c2f 6464 iveTransform
    .
    Returns:.
    automati │ │ │ -0005f130: 6361 6c6c 7920 6765 6e65 7261 7465 643c cally generated< │ │ │ -0005f140: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    ..
    ..
  • .
    . │ │ │ -0005f1d0: 3c68 333e 6669 6e64 486f 6d6f 6772 6170

    findHomograp │ │ │ -0005f1e0: 6879 3c2f 6833 3e0a 3c64 6976 2063 6c61 hy

    .
    .
    pu │ │ │ -0005f240: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static Ma │ │ │ -0005f2b0: 743c 2f61 3e3c 2f73 7061 6e3e 266e 6273 t&nbs │ │ │ -0005f2c0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;fin │ │ │ -0005f2e0: 6448 6f6d 6f67 7261 7068 793c 2f73 7061 dHomography │ │ │ -0005f310: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (MatOfPoint │ │ │ -0005f360: 3266 3c2f 613e 266e 6273 703b 7372 6350 2f srcP │ │ │ -0005f370: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat │ │ │ -0005f3c0: 4f66 506f 696e 7432 663c 2f61 3e26 6e62 OfPoint2f&nb │ │ │ -0005f3d0: 7370 3b64 7374 506f 696e 7473 293c 2f73 sp;dstPoints)
    .
    Fi │ │ │ -0005f400: 6e64 7320 6120 7065 7273 7065 6374 6976 nds a perspectiv │ │ │ -0005f410: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ -0005f420: 2062 6574 7765 656e 2074 776f 2070 6c61 between two pla │ │ │ -0005f430: 6e65 732e 3c2f 6469 763e 0a3c 646c 2063 nes.
    .
    .Parameters:.
    src │ │ │ -0005f470: 506f 696e 7473 3c2f 636f 6465 3e20 2d20 Points - │ │ │ -0005f480: 436f 6f72 6469 6e61 7465 7320 6f66 2074 Coordinates of t │ │ │ -0005f490: 6865 2070 6f69 6e74 7320 696e 2074 6865 he points in the │ │ │ -0005f4a0: 206f 7269 6769 6e61 6c20 706c 616e 652c original plane, │ │ │ -0005f4b0: 2061 206d 6174 7269 7820 6f66 2074 6865 a matrix of the │ │ │ -0005f4c0: 2074 7970 6520 4356 5f33 3246 4332 0a6f type CV_32FC2.o │ │ │ -0005f4d0: 7220 7665 6374 6f72 266c 743b 506f 696e r vector<Poin │ │ │ -0005f4e0: 7432 6626 6774 3b20 2e3c 2f64 643e 0a3c t2f> .
    .< │ │ │ -0005f4f0: 6464 3e3c 636f 6465 3e64 7374 506f 696e dd>dstPoin │ │ │ -0005f500: 7473 3c2f 636f 6465 3e20 2d20 436f 6f72 ts - Coor │ │ │ -0005f510: 6469 6e61 7465 7320 6f66 2074 6865 2070 dinates of the p │ │ │ -0005f520: 6f69 6e74 7320 696e 2074 6865 2074 6172 oints in the tar │ │ │ -0005f530: 6765 7420 706c 616e 652c 2061 206d 6174 get plane, a mat │ │ │ -0005f540: 7269 7820 6f66 2074 6865 2074 7970 6520 rix of the type │ │ │ -0005f550: 4356 5f33 3246 4332 206f 720a 6120 7665 CV_32FC2 or.a ve │ │ │ -0005f560: 6374 6f72 266c 743b 506f 696e 7432 6626 ctor<Point2f& │ │ │ -0005f570: 6774 3b20 2e0a 3c75 6c3e 0a20 203c 6c69 gt; ..
      .
    • . 0 - │ │ │ -0005f590: 6120 7265 6775 6c61 7220 6d65 7468 6f64 a regular method │ │ │ -0005f5a0: 2075 7369 6e67 2061 6c6c 2074 6865 2070 using all the p │ │ │ -0005f5b0: 6f69 6e74 732c 2069 2e65 2e2c 2074 6865 oints, i.e., the │ │ │ -0005f5c0: 206c 6561 7374 2073 7175 6172 6573 206d least squares m │ │ │ -0005f5d0: 6574 686f 640a 2020 3c2f 6c69 3e0a 2020 ethod.
    • . │ │ │ -0005f5e0: 3c6c 693e 0a20 2020 5245 463a 2052 414e
    • . REF: RAN │ │ │ -0005f5f0: 5341 4320 2d20 5241 4e53 4143 2d62 6173 SAC - RANSAC-bas │ │ │ -0005f600: 6564 2072 6f62 7573 7420 6d65 7468 6f64 ed robust method │ │ │ -0005f610: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ -0005f620: 2020 2052 4546 3a20 4c4d 4544 5320 2d20 REF: LMEDS - │ │ │ -0005f630: 4c65 6173 742d 4d65 6469 616e 2072 6f62 Least-Median rob │ │ │ -0005f640: 7573 7420 6d65 7468 6f64 0a20 203c 2f6c ust method. .
    • . REF │ │ │ -0005f660: 3a20 5248 4f20 2d20 5052 4f53 4143 2d62 : RHO - PROSAC-b │ │ │ -0005f670: 6173 6564 2072 6f62 7573 7420 6d65 7468 ased robust meth │ │ │ -0005f680: 6f64 0a20 203c 2f6c 693e 0a3c 2f75 6c3e od.
    • .
    │ │ │ -0005f690: 0a28 7573 6564 2069 6e20 7468 6520 5241 .(used in the RA │ │ │ -0005f6a0: 4e53 4143 2061 6e64 2052 484f 206d 6574 NSAC and RHO met │ │ │ -0005f6b0: 686f 6473 206f 6e6c 7929 2e20 5468 6174 hods only). That │ │ │ -0005f6c0: 2069 732c 2069 660a 5c28 5c7c 205c 7465 is, if.\(\| \te │ │ │ -0005f6d0: 7874 7474 7b64 7374 506f 696e 7473 7d20 xttt{dstPoints} │ │ │ -0005f6e0: 5f69 202d 2020 5c74 6578 7474 747b 636f _i - \texttt{co │ │ │ -0005f6f0: 6e76 6572 7450 6f69 6e74 7348 6f6d 6f67 nvertPointsHomog │ │ │ -0005f700: 656e 656f 7573 7d20 2820 5c74 6578 7474 eneous} ( \textt │ │ │ -0005f710: 747b 487d 205c 6364 6f74 205c 7465 7874 t{H} \cdot \text │ │ │ -0005f720: 7474 7b73 7263 506f 696e 7473 7d20 5f69 tt{srcPoints} _i │ │ │ -0005f730: 2920 5c7c 5f32 2020 2667 743b 2020 5c74 ) \|_2 > \t │ │ │ -0005f740: 6578 7474 747b 7261 6e73 6163 5265 7072 exttt{ransacRepr │ │ │ -0005f750: 6f6a 5468 7265 7368 6f6c 647d 5c29 0a74 ojThreshold}\).t │ │ │ -0005f760: 6865 6e20 7468 6520 706f 696e 7420 5c28 hen the point \( │ │ │ -0005f770: 695c 2920 6973 2063 6f6e 7369 6465 7265 i\) is considere │ │ │ -0005f780: 6420 6173 2061 6e20 6f75 746c 6965 722e d as an outlier. │ │ │ -0005f790: 2049 6620 7372 6350 6f69 6e74 7320 616e If srcPoints an │ │ │ -0005f7a0: 6420 6473 7450 6f69 6e74 7320 6172 6520 d dstPoints are │ │ │ -0005f7b0: 6d65 6173 7572 6564 2069 6e20 7069 7865 measured in pixe │ │ │ -0005f7c0: 6c73 2c0a 6974 2075 7375 616c 6c79 206d ls,.it usually m │ │ │ -0005f7d0: 616b 6573 2073 656e 7365 2074 6f20 7365 akes sense to se │ │ │ -0005f7e0: 7420 7468 6973 2070 6172 616d 6574 6572 t this parameter │ │ │ -0005f7f0: 2073 6f6d 6577 6865 7265 2069 6e20 7468 somewhere in th │ │ │ -0005f800: 6520 7261 6e67 6520 6f66 2031 2074 6f20 e range of 1 to │ │ │ -0005f810: 3130 2e0a 6d61 736b 2076 616c 7565 7320 10..mask values │ │ │ -0005f820: 6172 6520 6967 6e6f 7265 642e 0a0a 5468 are ignored...Th │ │ │ -0005f830: 6520 6675 6e63 7469 6f6e 2066 696e 6473 e function finds │ │ │ -0005f840: 2061 6e64 2072 6574 7572 6e73 2074 6865 and returns the │ │ │ -0005f850: 2070 6572 7370 6563 7469 7665 2074 7261 perspective tra │ │ │ -0005f860: 6e73 666f 726d 6174 696f 6e20 5c28 485c nsformation \(H\ │ │ │ -0005f870: 2920 6265 7477 6565 6e20 7468 6520 736f ) between the so │ │ │ -0005f880: 7572 6365 2061 6e64 2074 6865 0a64 6573 urce and the.des │ │ │ -0005f890: 7469 6e61 7469 6f6e 2070 6c61 6e65 733a tination planes: │ │ │ -0005f8a0: 0a0a 5c28 735f 6920 205c 7665 6374 6872 ..\(s_i \vecthr │ │ │ -0005f8b0: 6565 7b78 275f 697d 7b79 275f 697d 7b31 ee{x'_i}{y'_i}{1 │ │ │ -0005f8c0: 7d20 5c73 696d 2048 2020 5c76 6563 7468 } \sim H \vecth │ │ │ -0005f8d0: 7265 657b 785f 697d 7b79 5f69 7d7b 317d ree{x_i}{y_i}{1} │ │ │ -0005f8e0: 5c29 0a0a 736f 2074 6861 7420 7468 6520 \)..so that the │ │ │ -0005f8f0: 6261 636b 2d70 726f 6a65 6374 696f 6e20 back-projection │ │ │ -0005f900: 6572 726f 720a 0a5c 285c 7375 6d20 5f69 error..\(\sum _i │ │ │ -0005f910: 205c 6c65 6674 2028 2078 275f 692d 205c \left ( x'_i- \ │ │ │ -0005f920: 6672 6163 7b68 5f7b 3131 7d20 785f 6920 frac{h_{11} x_i │ │ │ -0005f930: 2b20 685f 7b31 327d 2079 5f69 202b 2068 + h_{12} y_i + h │ │ │ -0005f940: 5f7b 3133 7d7d 7b68 5f7b 3331 7d20 785f _{13}}{h_{31} x_ │ │ │ -0005f950: 6920 2b20 685f 7b33 327d 2079 5f69 202b i + h_{32} y_i + │ │ │ -0005f960: 2068 5f7b 3333 7d7d 205c 7269 6768 7420 h_{33}} \right │ │ │ -0005f970: 295e 322b 205c 6c65 6674 2028 2079 275f )^2+ \left ( y'_ │ │ │ -0005f980: 692d 205c 6672 6163 7b68 5f7b 3231 7d20 i- \frac{h_{21} │ │ │ -0005f990: 785f 6920 2b20 685f 7b32 327d 2079 5f69 x_i + h_{22} y_i │ │ │ -0005f9a0: 202b 2068 5f7b 3233 7d7d 7b68 5f7b 3331 + h_{23}}{h_{31 │ │ │ -0005f9b0: 7d20 785f 6920 2b20 685f 7b33 327d 2079 } x_i + h_{32} y │ │ │ -0005f9c0: 5f69 202b 2068 5f7b 3333 7d7d 205c 7269 _i + h_{33}} \ri │ │ │ -0005f9d0: 6768 7420 295e 325c 290a 0a69 7320 6d69 ght )^2\)..is mi │ │ │ -0005f9e0: 6e69 6d69 7a65 642e 2049 6620 7468 6520 nimized. If the │ │ │ -0005f9f0: 7061 7261 6d65 7465 7220 6d65 7468 6f64 parameter method │ │ │ -0005fa00: 2069 7320 7365 7420 746f 2074 6865 2064 is set to the d │ │ │ -0005fa10: 6566 6175 6c74 2076 616c 7565 2030 2c20 efault value 0, │ │ │ -0005fa20: 7468 6520 6675 6e63 7469 6f6e 2075 7365 the function use │ │ │ -0005fa30: 7320 616c 6c20 7468 6520 706f 696e 740a s all the point. │ │ │ -0005fa40: 7061 6972 7320 746f 2063 6f6d 7075 7465 pairs to compute │ │ │ -0005fa50: 2061 6e20 696e 6974 6961 6c20 686f 6d6f an initial homo │ │ │ -0005fa60: 6772 6170 6879 2065 7374 696d 6174 6520 graphy estimate │ │ │ -0005fa70: 7769 7468 2061 2073 696d 706c 6520 6c65 with a simple le │ │ │ -0005fa80: 6173 742d 7371 7561 7265 7320 7363 6865 ast-squares sche │ │ │ -0005fa90: 6d65 2e0a 0a48 6f77 6576 6572 2c20 6966 me...However, if │ │ │ -0005faa0: 206e 6f74 2061 6c6c 206f 6620 7468 6520 not all of the │ │ │ -0005fab0: 706f 696e 7420 7061 6972 7320 2820 5c28 point pairs ( \( │ │ │ -0005fac0: 7372 6350 6f69 6e74 735f 695c 292c 205c srcPoints_i\), \ │ │ │ -0005fad0: 2864 7374 506f 696e 7473 5f69 5c29 2029 (dstPoints_i\) ) │ │ │ -0005fae0: 2066 6974 2074 6865 2072 6967 6964 2070 fit the rigid p │ │ │ -0005faf0: 6572 7370 6563 7469 7665 0a74 7261 6e73 erspective.trans │ │ │ -0005fb00: 666f 726d 6174 696f 6e20 2874 6861 7420 formation (that │ │ │ -0005fb10: 6973 2c20 7468 6572 6520 6172 6520 736f is, there are so │ │ │ -0005fb20: 6d65 206f 7574 6c69 6572 7329 2c20 7468 me outliers), th │ │ │ -0005fb30: 6973 2069 6e69 7469 616c 2065 7374 696d is initial estim │ │ │ -0005fb40: 6174 6520 7769 6c6c 2062 6520 706f 6f72 ate will be poor │ │ │ -0005fb50: 2e20 496e 2074 6869 7320 6361 7365 2c0a . In this case,. │ │ │ -0005fb60: 796f 7520 6361 6e20 7573 6520 6f6e 6520 you can use one │ │ │ -0005fb70: 6f66 2074 6865 2074 6872 6565 2072 6f62 of the three rob │ │ │ -0005fb80: 7573 7420 6d65 7468 6f64 732e 2054 6865 ust methods. The │ │ │ -0005fb90: 206d 6574 686f 6473 2052 414e 5341 432c methods RANSAC, │ │ │ -0005fba0: 204c 4d65 4453 2061 6e64 2052 484f 2074 LMeDS and RHO t │ │ │ -0005fbb0: 7279 206d 616e 7920 6469 6666 6572 656e ry many differen │ │ │ -0005fbc0: 740a 7261 6e64 6f6d 2073 7562 7365 7473 t.random subsets │ │ │ -0005fbd0: 206f 6620 7468 6520 636f 7272 6573 706f of the correspo │ │ │ -0005fbe0: 6e64 696e 6720 706f 696e 7420 7061 6972 nding point pair │ │ │ -0005fbf0: 7320 286f 6620 666f 7572 2070 6169 7273 s (of four pairs │ │ │ -0005fc00: 2065 6163 682c 2063 6f6c 6c69 6e65 6172 each, collinear │ │ │ -0005fc10: 2070 6169 7273 2061 7265 2064 6973 6361 pairs are disca │ │ │ -0005fc20: 7264 6564 292c 2065 7374 696d 6174 6520 rded), estimate │ │ │ -0005fc30: 7468 6520 686f 6d6f 6772 6170 6879 206d the homography m │ │ │ -0005fc40: 6174 7269 780a 7573 696e 6720 7468 6973 atrix.using this │ │ │ -0005fc50: 2073 7562 7365 7420 616e 6420 6120 7369 subset and a si │ │ │ -0005fc60: 6d70 6c65 206c 6561 7374 2d73 7175 6172 mple least-squar │ │ │ -0005fc70: 6573 2061 6c67 6f72 6974 686d 2c20 616e es algorithm, an │ │ │ -0005fc80: 6420 7468 656e 2063 6f6d 7075 7465 2074 d then compute t │ │ │ -0005fc90: 6865 2071 7561 6c69 7479 2f67 6f6f 646e he quality/goodn │ │ │ -0005fca0: 6573 7320 6f66 2074 6865 0a63 6f6d 7075 ess of the.compu │ │ │ -0005fcb0: 7465 6420 686f 6d6f 6772 6170 6879 2028 ted homography ( │ │ │ -0005fcc0: 7768 6963 6820 6973 2074 6865 206e 756d which is the num │ │ │ -0005fcd0: 6265 7220 6f66 2069 6e6c 6965 7273 2066 ber of inliers f │ │ │ -0005fce0: 6f72 2052 414e 5341 4320 6f72 2074 6865 or RANSAC or the │ │ │ -0005fcf0: 206c 6561 7374 206d 6564 6961 6e20 7265 least median re │ │ │ -0005fd00: 2d70 726f 6a65 6374 696f 6e20 6572 726f -projection erro │ │ │ -0005fd10: 7220 666f 720a 4c4d 6544 5329 2e20 5468 r for.LMeDS). Th │ │ │ -0005fd20: 6520 6265 7374 2073 7562 7365 7420 6973 e best subset is │ │ │ -0005fd30: 2074 6865 6e20 7573 6564 2074 6f20 7072 then used to pr │ │ │ -0005fd40: 6f64 7563 6520 7468 6520 696e 6974 6961 oduce the initia │ │ │ -0005fd50: 6c20 6573 7469 6d61 7465 206f 6620 7468 l estimate of th │ │ │ -0005fd60: 6520 686f 6d6f 6772 6170 6879 206d 6174 e homography mat │ │ │ -0005fd70: 7269 7820 616e 640a 7468 6520 6d61 736b rix and.the mask │ │ │ -0005fd80: 206f 6620 696e 6c69 6572 732f 6f75 746c of inliers/outl │ │ │ -0005fd90: 6965 7273 2e0a 0a52 6567 6172 646c 6573 iers...Regardles │ │ │ -0005fda0: 7320 6f66 2074 6865 206d 6574 686f 642c s of the method, │ │ │ -0005fdb0: 2072 6f62 7573 7420 6f72 206e 6f74 2c20 robust or not, │ │ │ -0005fdc0: 7468 6520 636f 6d70 7574 6564 2068 6f6d the computed hom │ │ │ -0005fdd0: 6f67 7261 7068 7920 6d61 7472 6978 2069 ography matrix i │ │ │ -0005fde0: 7320 7265 6669 6e65 6420 6675 7274 6865 s refined furthe │ │ │ -0005fdf0: 7220 2875 7369 6e67 0a69 6e6c 6965 7273 r (using.inliers │ │ │ -0005fe00: 206f 6e6c 7920 696e 2063 6173 6520 6f66 only in case of │ │ │ -0005fe10: 2061 2072 6f62 7573 7420 6d65 7468 6f64 a robust method │ │ │ -0005fe20: 2920 7769 7468 2074 6865 204c 6576 656e ) with the Leven │ │ │ -0005fe30: 6265 7267 2d4d 6172 7175 6172 6474 206d berg-Marquardt m │ │ │ -0005fe40: 6574 686f 6420 746f 2072 6564 7563 6520 ethod to reduce │ │ │ -0005fe50: 7468 650a 7265 2d70 726f 6a65 6374 696f the.re-projectio │ │ │ -0005fe60: 6e20 6572 726f 7220 6576 656e 206d 6f72 n error even mor │ │ │ -0005fe70: 652e 0a0a 5468 6520 6d65 7468 6f64 7320 e...The methods │ │ │ -0005fe80: 5241 4e53 4143 2061 6e64 2052 484f 2063 RANSAC and RHO c │ │ │ -0005fe90: 616e 2068 616e 646c 6520 7072 6163 7469 an handle practi │ │ │ -0005fea0: 6361 6c6c 7920 616e 7920 7261 7469 6f20 cally any ratio │ │ │ -0005feb0: 6f66 206f 7574 6c69 6572 7320 6275 7420 of outliers but │ │ │ -0005fec0: 6e65 6564 2061 2074 6872 6573 686f 6c64 need a threshold │ │ │ -0005fed0: 2074 6f0a 6469 7374 696e 6775 6973 6820 to.distinguish │ │ │ -0005fee0: 696e 6c69 6572 7320 6672 6f6d 206f 7574 inliers from out │ │ │ -0005fef0: 6c69 6572 732e 2054 6865 206d 6574 686f liers. The metho │ │ │ -0005ff00: 6420 4c4d 6544 5320 646f 6573 206e 6f74 d LMeDS does not │ │ │ -0005ff10: 206e 6565 6420 616e 7920 7468 7265 7368 need any thresh │ │ │ -0005ff20: 6f6c 6420 6275 7420 6974 2077 6f72 6b73 old but it works │ │ │ -0005ff30: 0a63 6f72 7265 6374 6c79 206f 6e6c 7920 .correctly only │ │ │ -0005ff40: 7768 656e 2074 6865 7265 2061 7265 206d when there are m │ │ │ -0005ff50: 6f72 6520 7468 616e 2035 3025 206f 6620 ore than 50% of │ │ │ -0005ff60: 696e 6c69 6572 732e 2046 696e 616c 6c79 inliers. Finally │ │ │ -0005ff70: 2c20 6966 2074 6865 7265 2061 7265 206e , if there are n │ │ │ -0005ff80: 6f20 6f75 746c 6965 7273 2061 6e64 2074 o outliers and t │ │ │ -0005ff90: 6865 0a6e 6f69 7365 2069 7320 7261 7468 he.noise is rath │ │ │ -0005ffa0: 6572 2073 6d61 6c6c 2c20 7573 6520 7468 er small, use th │ │ │ -0005ffb0: 6520 6465 6661 756c 7420 6d65 7468 6f64 e default method │ │ │ -0005ffc0: 2028 6d65 7468 6f64 3d30 292e 0a0a 5468 (method=0)...Th │ │ │ -0005ffd0: 6520 6675 6e63 7469 6f6e 2069 7320 7573 e function is us │ │ │ -0005ffe0: 6564 2074 6f20 6669 6e64 2069 6e69 7469 ed to find initi │ │ │ -0005fff0: 616c 2069 6e74 7269 6e73 6963 2061 6e64 al intrinsic and │ │ │ -00060000: 2065 7874 7269 6e73 6963 206d 6174 7269 extrinsic matri │ │ │ -00060010: 6365 732e 2048 6f6d 6f67 7261 7068 7920 ces. Homography │ │ │ -00060020: 6d61 7472 6978 2069 730a 6465 7465 726d matrix is.determ │ │ │ -00060030: 696e 6564 2075 7020 746f 2061 2073 6361 ined up to a sca │ │ │ -00060040: 6c65 2e20 4966 205c 2868 5f7b 3333 7d5c le. If \(h_{33}\ │ │ │ -00060050: 2920 6973 206e 6f6e 2d7a 6572 6f2c 2074 ) is non-zero, t │ │ │ -00060060: 6865 206d 6174 7269 7820 6973 206e 6f72 he matrix is nor │ │ │ -00060070: 6d61 6c69 7a65 6420 736f 2074 6861 7420 malized so that │ │ │ -00060080: 5c28 685f 7b33 337d 3d31 5c29 2e0a 3c62 \(h_{33}=1\)..Note: Whene │ │ │ -000600a0: 7665 7220 616e 205c 2848 5c29 206d 6174 ver an \(H\) mat │ │ │ -000600b0: 7269 7820 6361 6e6e 6f74 2062 6520 6573 rix cannot be es │ │ │ -000600c0: 7469 6d61 7465 642c 2061 6e20 656d 7074 timated, an empt │ │ │ -000600d0: 7920 6f6e 6520 7769 6c6c 2062 6520 7265 y one will be re │ │ │ -000600e0: 7475 726e 6564 2e0a 0a53 4545 3a0a 6765 turned...SEE:.ge │ │ │ -000600f0: 7441 6666 696e 6554 7261 6e73 666f 726d tAffineTransform │ │ │ -00060100: 2c20 6573 7469 6d61 7465 4166 6669 6e65 , estimateAffine │ │ │ -00060110: 3244 2c20 6573 7469 6d61 7465 4166 6669 2D, estimateAffi │ │ │ -00060120: 6e65 5061 7274 6961 6c32 442c 2067 6574 nePartial2D, get │ │ │ -00060130: 5065 7273 7065 6374 6976 6554 7261 6e73 PerspectiveTrans │ │ │ -00060140: 666f 726d 2c20 7761 7270 5065 7273 7065 form, warpPerspe │ │ │ -00060150: 6374 6976 652c 0a70 6572 7370 6563 7469 ctive,.perspecti │ │ │ -00060160: 7665 5472 616e 7366 6f72 6d3c 2f64 643e veTransform │ │ │ -00060170: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    automatic │ │ │ -00060190: 616c 6c79 2067 656e 6572 6174 6564 3c2f ally generated.
    .
    │ │ │ -000601b0: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
    .
  • .
  • .
    .

    findHomogr │ │ │ -00060270: 6170 6879 3c2f 6833 3e0a 3c64 6976 2063 aphy

    .
    .
    │ │ │ -000602d0: 7075 626c 6963 2073 7461 7469 633c 2f73 public static  │ │ │ -00060340: 4d61 743c 2f61 3e3c 2f73 7061 6e3e 266e Mat&n │ │ │ -00060350: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;f │ │ │ -00060370: 696e 6448 6f6d 6f67 7261 7068 793c 2f73 indHomography(MatOfPoi │ │ │ -000603f0: 6e74 3266 3c2f 613e 266e 6273 703b 7372 nt2f sr │ │ │ -00060400: 6350 6f69 6e74 732c 0a20 3c61 2068 7265 cPoints,. M │ │ │ -00060450: 6174 4f66 506f 696e 7432 663c 2f61 3e26 atOfPoint2f& │ │ │ -00060460: 6e62 7370 3b64 7374 506f 696e 7473 2c0a nbsp;dstPoints,. │ │ │ -00060470: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000604b0: 3c2f 613e 266e 6273 703b 6d61 736b 2c0a  mask,. │ │ │ -000604c0: 203c 6120 6872 6566 3d22 5573 6163 5061 │ │ │ -00060500: 5573 6163 5061 7261 6d73 3c2f 613e 266e UsacParams&n │ │ │ -00060510: 6273 703b 7061 7261 6d73 293c 2f73 7061 bsp;params)
    .
    . │ │ │ -00060530: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e
    .
  • │ │ │ -00060540: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    RQD │ │ │ -000605f0: 6563 6f6d 7033 7833 3c2f 6833 3e0a 3c64 ecomp3x3

    ..public stati │ │ │ -00060660: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c double[] │ │ │ -00060690: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  RQDecomp │ │ │ -000606c0: 3378 333c 2f73 7061 6e3e 3c77 6272 3e3c 3x3< │ │ │ -000606d0: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ -000606e0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ -00060730: 703b 7372 632c 0a20 3c61 2068 7265 663d p;src,. Mat  │ │ │ -00060780: 3b6d 7478 522c 0a20 3c61 2068 7265 663d ;mtxR,. Mat  │ │ │ -000607d0: 3b6d 7478 512c 0a20 3c61 2068 7265 663d ;mtxQ,. Mat  │ │ │ -00060820: 3b51 782c 0a20 3c61 2068 7265 663d 222e ;Qx,. Mat Q │ │ │ -00060870: 792c 0a20 3c61 2068 7265 663d 222e 2e2f y,. │ │ │ -000608b0: 4d61 743c 2f61 3e26 6e62 7370 3b51 7a29 Mat Qz) │ │ │ -000608c0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64 .Computes an RQ │ │ │ -000608f0: 6465 636f 6d70 6f73 6974 696f 6e20 6f66 decomposition of │ │ │ -00060900: 2033 7833 206d 6174 7269 6365 732e 3c2f 3x3 matrices..
    .
    Para │ │ │ -00060930: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    src - 3x3 input ma │ │ │ -00060960: 7472 6978 2e3c 2f64 643e 0a3c 6464 3e3c trix.
    .
    < │ │ │ -00060970: 636f 6465 3e6d 7478 523c 2f63 6f64 653e code>mtxR │ │ │ -00060980: 202d 204f 7574 7075 7420 3378 3320 7570 - Output 3x3 up │ │ │ -00060990: 7065 722d 7472 6961 6e67 756c 6172 206d per-triangular m │ │ │ -000609a0: 6174 7269 782e 3c2f 6464 3e0a 3c64 643e atrix.
    .
    │ │ │ -000609b0: 3c63 6f64 653e 6d74 7851 3c2f 636f 6465 mtxQ - Output 3x3 o │ │ │ -000609d0: 7274 686f 676f 6e61 6c20 6d61 7472 6978 rthogonal matrix │ │ │ -000609e0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    Qx - Opt │ │ │ -00060a00: 696f 6e61 6c20 6f75 7470 7574 2033 7833 ional output 3x3 │ │ │ -00060a10: 2072 6f74 6174 696f 6e20 6d61 7472 6978 rotation matrix │ │ │ -00060a20: 2061 726f 756e 6420 782d 6178 6973 2e3c around x-axis.< │ │ │ -00060a30: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e51 /dd>.
    Q │ │ │ -00060a40: 793c 2f63 6f64 653e 202d 204f 7074 696f y - Optio │ │ │ -00060a50: 6e61 6c20 6f75 7470 7574 2033 7833 2072 nal output 3x3 r │ │ │ -00060a60: 6f74 6174 696f 6e20 6d61 7472 6978 2061 otation matrix a │ │ │ -00060a70: 726f 756e 6420 792d 6178 6973 2e3c 2f64 round y-axis..
    Qz< │ │ │ -00060a90: 2f63 6f64 653e 202d 204f 7074 696f 6e61 /code> - Optiona │ │ │ -00060aa0: 6c20 6f75 7470 7574 2033 7833 2072 6f74 l output 3x3 rot │ │ │ -00060ab0: 6174 696f 6e20 6d61 7472 6978 2061 726f ation matrix aro │ │ │ -00060ac0: 756e 6420 7a2d 6178 6973 2e0a 0a54 6865 und z-axis...The │ │ │ -00060ad0: 2066 756e 6374 696f 6e20 636f 6d70 7574 function comput │ │ │ -00060ae0: 6573 2061 2052 5120 6465 636f 6d70 6f73 es a RQ decompos │ │ │ -00060af0: 6974 696f 6e20 7573 696e 6720 7468 6520 ition using the │ │ │ -00060b00: 6769 7665 6e20 726f 7461 7469 6f6e 732e given rotations. │ │ │ -00060b10: 2054 6869 7320 6675 6e63 7469 6f6e 2069 This function i │ │ │ -00060b20: 7320 7573 6564 2069 6e0a 2364 6563 6f6d s used in.#decom │ │ │ -00060b30: 706f 7365 5072 6f6a 6563 7469 6f6e 4d61 poseProjectionMa │ │ │ -00060b40: 7472 6978 2074 6f20 6465 636f 6d70 6f73 trix to decompos │ │ │ -00060b50: 6520 7468 6520 6c65 6674 2033 7833 2073 e the left 3x3 s │ │ │ -00060b60: 7562 6d61 7472 6978 206f 6620 6120 7072 ubmatrix of a pr │ │ │ -00060b70: 6f6a 6563 7469 6f6e 206d 6174 7269 7820 ojection matrix │ │ │ -00060b80: 696e 746f 2061 2063 616d 6572 610a 616e into a camera.an │ │ │ -00060b90: 6420 6120 726f 7461 7469 6f6e 206d 6174 d a rotation mat │ │ │ -00060ba0: 7269 782e 0a0a 4974 206f 7074 696f 6e61 rix...It optiona │ │ │ -00060bb0: 6c6c 7920 7265 7475 726e 7320 7468 7265 lly returns thre │ │ │ -00060bc0: 6520 726f 7461 7469 6f6e 206d 6174 7269 e rotation matri │ │ │ -00060bd0: 6365 732c 206f 6e65 2066 6f72 2065 6163 ces, one for eac │ │ │ -00060be0: 6820 6178 6973 2c20 616e 6420 7468 6520 h axis, and the │ │ │ -00060bf0: 7468 7265 6520 4575 6c65 7220 616e 676c three Euler angl │ │ │ -00060c00: 6573 2069 6e0a 6465 6772 6565 7320 2861 es in.degrees (a │ │ │ -00060c10: 7320 7468 6520 7265 7475 726e 2076 616c s the return val │ │ │ -00060c20: 7565 2920 7468 6174 2063 6f75 6c64 2062 ue) that could b │ │ │ -00060c30: 6520 7573 6564 2069 6e20 4f70 656e 474c e used in OpenGL │ │ │ -00060c40: 2e20 4e6f 7465 2c20 7468 6572 6520 6973 . Note, there is │ │ │ -00060c50: 2061 6c77 6179 7320 6d6f 7265 2074 6861 always more tha │ │ │ -00060c60: 6e20 6f6e 650a 7365 7175 656e 6365 206f n one.sequence o │ │ │ -00060c70: 6620 726f 7461 7469 6f6e 7320 6162 6f75 f rotations abou │ │ │ -00060c80: 7420 7468 6520 7468 7265 6520 7072 696e t the three prin │ │ │ -00060c90: 6369 7061 6c20 6178 6573 2074 6861 7420 cipal axes that │ │ │ -00060ca0: 7265 7375 6c74 7320 696e 2074 6865 2073 results in the s │ │ │ -00060cb0: 616d 6520 6f72 6965 6e74 6174 696f 6e20 ame orientation │ │ │ -00060cc0: 6f66 2061 6e0a 6f62 6a65 6374 2c20 652e of an.object, e. │ │ │ -00060cd0: 672e 2073 6565 2043 4954 453a 2053 6c61 g. see CITE: Sla │ │ │ -00060ce0: 6261 7567 6820 2e20 5265 7475 726e 6564 baugh . Returned │ │ │ -00060cf0: 2074 6872 6565 2072 6f74 6174 696f 6e20 three rotation │ │ │ -00060d00: 6d61 7472 6963 6573 2061 6e64 2063 6f72 matrices and cor │ │ │ -00060d10: 7265 7370 6f6e 6469 6e67 2074 6872 6565 responding three │ │ │ -00060d20: 2045 756c 6572 2061 6e67 6c65 730a 6172 Euler angles.ar │ │ │ -00060d30: 6520 6f6e 6c79 206f 6e65 206f 6620 7468 e only one of th │ │ │ -00060d40: 6520 706f 7373 6962 6c65 2073 6f6c 7574 e possible solut │ │ │ -00060d50: 696f 6e73 2e3c 2f64 643e 0a3c 6474 3e52 ions.
    .
    R │ │ │ -00060d60: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    automatically g │ │ │ -00060d80: 656e 6572 6174 6564 3c2f 6464 3e0a 3c2f enerated
    ....
  • .
  • │ │ │ -00060db0: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    . │ │ │ -00060e40: 3c68 333e 5251 4465 636f 6d70 3378 333c

    RQDecomp3x3< │ │ │ -00060e50: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -00060eb0: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -00060ec0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;d │ │ │ -00060ee0: 6f75 626c 655b 5d3c 2f73 7061 6e3e 266e ouble[]&n │ │ │ -00060ef0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;R │ │ │ -00060f10: 5144 6563 6f6d 7033 7833 3c2f 7370 616e QDecomp3x3( │ │ │ -00060f40: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -00060f80: 2f61 3e26 6e62 7370 3b73 7263 2c0a 203c /a> src,. < │ │ │ -00060f90: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00060fa0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00060fb0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00060fc0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat mtxR,. < │ │ │ -00060fe0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00060ff0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00061000: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00061010: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat mtxQ,. < │ │ │ -00061030: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00061040: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00061050: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00061060: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat Qx,. Mat │ │ │ -000610c0: 266e 6273 703b 5179 293c 2f73 7061 6e3e  Qy) │ │ │ -000610d0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Comput │ │ │ -000610f0: 6573 2061 6e20 5251 2064 6563 6f6d 706f es an RQ decompo │ │ │ -00061100: 7369 7469 6f6e 206f 6620 3378 3320 6d61 sition of 3x3 ma │ │ │ -00061110: 7472 6963 6573 2e3c 2f64 6976 3e0a 3c64 trices.
    . │ │ │ -00061130: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ -00061140: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -00061150: 7372 633c 2f63 6f64 653e 202d 2033 7833 src - 3x3 │ │ │ -00061160: 2069 6e70 7574 206d 6174 7269 782e 3c2f input matrix..
    mt │ │ │ -00061180: 7852 3c2f 636f 6465 3e20 2d20 4f75 7470 xR - Outp │ │ │ -00061190: 7574 2033 7833 2075 7070 6572 2d74 7269 ut 3x3 upper-tri │ │ │ -000611a0: 616e 6775 6c61 7220 6d61 7472 6978 2e3c angular matrix.< │ │ │ -000611b0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e6d /dd>.
    m │ │ │ -000611c0: 7478 513c 2f63 6f64 653e 202d 204f 7574 txQ - Out │ │ │ -000611d0: 7075 7420 3378 3320 6f72 7468 6f67 6f6e put 3x3 orthogon │ │ │ -000611e0: 616c 206d 6174 7269 782e 3c2f 6464 3e0a al matrix.
    . │ │ │ -000611f0: 3c64 643e 3c63 6f64 653e 5178 3c2f 636f
    Qx - Optional o │ │ │ -00061210: 7574 7075 7420 3378 3320 726f 7461 7469 utput 3x3 rotati │ │ │ -00061220: 6f6e 206d 6174 7269 7820 6172 6f75 6e64 on matrix around │ │ │ -00061230: 2078 2d61 7869 732e 3c2f 6464 3e0a 3c64 x-axis.
    .Qy - Optional out │ │ │ -00061260: 7075 7420 3378 3320 726f 7461 7469 6f6e put 3x3 rotation │ │ │ -00061270: 206d 6174 7269 7820 6172 6f75 6e64 2079 matrix around y │ │ │ -00061280: 2d61 7869 732e 0a0a 5468 6520 6675 6e63 -axis...The func │ │ │ -00061290: 7469 6f6e 2063 6f6d 7075 7465 7320 6120 tion computes a │ │ │ -000612a0: 5251 2064 6563 6f6d 706f 7369 7469 6f6e RQ decomposition │ │ │ -000612b0: 2075 7369 6e67 2074 6865 2067 6976 656e using the given │ │ │ -000612c0: 2072 6f74 6174 696f 6e73 2e20 5468 6973 rotations. This │ │ │ -000612d0: 2066 756e 6374 696f 6e20 6973 2075 7365 function is use │ │ │ -000612e0: 6420 696e 0a23 6465 636f 6d70 6f73 6550 d in.#decomposeP │ │ │ -000612f0: 726f 6a65 6374 696f 6e4d 6174 7269 7820 rojectionMatrix │ │ │ -00061300: 746f 2064 6563 6f6d 706f 7365 2074 6865 to decompose the │ │ │ -00061310: 206c 6566 7420 3378 3320 7375 626d 6174 left 3x3 submat │ │ │ -00061320: 7269 7820 6f66 2061 2070 726f 6a65 6374 rix of a project │ │ │ -00061330: 696f 6e20 6d61 7472 6978 2069 6e74 6f20 ion matrix into │ │ │ -00061340: 6120 6361 6d65 7261 0a61 6e64 2061 2072 a camera.and a r │ │ │ -00061350: 6f74 6174 696f 6e20 6d61 7472 6978 2e0a otation matrix.. │ │ │ -00061360: 0a49 7420 6f70 7469 6f6e 616c 6c79 2072 .It optionally r │ │ │ -00061370: 6574 7572 6e73 2074 6872 6565 2072 6f74 eturns three rot │ │ │ -00061380: 6174 696f 6e20 6d61 7472 6963 6573 2c20 ation matrices, │ │ │ -00061390: 6f6e 6520 666f 7220 6561 6368 2061 7869 one for each axi │ │ │ -000613a0: 732c 2061 6e64 2074 6865 2074 6872 6565 s, and the three │ │ │ -000613b0: 2045 756c 6572 2061 6e67 6c65 7320 696e Euler angles in │ │ │ -000613c0: 0a64 6567 7265 6573 2028 6173 2074 6865 .degrees (as the │ │ │ -000613d0: 2072 6574 7572 6e20 7661 6c75 6529 2074 return value) t │ │ │ -000613e0: 6861 7420 636f 756c 6420 6265 2075 7365 hat could be use │ │ │ -000613f0: 6420 696e 204f 7065 6e47 4c2e 204e 6f74 d in OpenGL. Not │ │ │ -00061400: 652c 2074 6865 7265 2069 7320 616c 7761 e, there is alwa │ │ │ -00061410: 7973 206d 6f72 6520 7468 616e 206f 6e65 ys more than one │ │ │ -00061420: 0a73 6571 7565 6e63 6520 6f66 2072 6f74 .sequence of rot │ │ │ -00061430: 6174 696f 6e73 2061 626f 7574 2074 6865 ations about the │ │ │ -00061440: 2074 6872 6565 2070 7269 6e63 6970 616c three principal │ │ │ -00061450: 2061 7865 7320 7468 6174 2072 6573 756c axes that resul │ │ │ -00061460: 7473 2069 6e20 7468 6520 7361 6d65 206f ts in the same o │ │ │ -00061470: 7269 656e 7461 7469 6f6e 206f 6620 616e rientation of an │ │ │ -00061480: 0a6f 626a 6563 742c 2065 2e67 2e20 7365 .object, e.g. se │ │ │ -00061490: 6520 4349 5445 3a20 536c 6162 6175 6768 e CITE: Slabaugh │ │ │ -000614a0: 202e 2052 6574 7572 6e65 6420 7468 7265 . Returned thre │ │ │ -000614b0: 6520 726f 7461 7469 6f6e 206d 6174 7269 e rotation matri │ │ │ -000614c0: 6365 7320 616e 6420 636f 7272 6573 706f ces and correspo │ │ │ -000614d0: 6e64 696e 6720 7468 7265 6520 4575 6c65 nding three Eule │ │ │ -000614e0: 7220 616e 676c 6573 0a61 7265 206f 6e6c r angles.are onl │ │ │ -000614f0: 7920 6f6e 6520 6f66 2074 6865 2070 6f73 y one of the pos │ │ │ -00061500: 7369 626c 6520 736f 6c75 7469 6f6e 732e sible solutions. │ │ │ -00061510: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e .
    Return │ │ │ -00061520: 733a 3c2f 6474 3e0a 3c64 643e 6175 746f s:
    .
    auto │ │ │ -00061530: 6d61 7469 6361 6c6c 7920 6765 6e65 7261 matically genera │ │ │ -00061540: 7465 643c 2f64 643e 0a3c 2f64 6c3e 0a3c ted
    ..< │ │ │ -00061550: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.

    │ │ │ -00061560: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    RQDec │ │ │ -000615f0: 6f6d 7033 7833 3c2f 6833 3e0a 3c64 6976 omp3x3

    .
    .
    public static< │ │ │ -00061660: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> double[] RQDecomp3x │ │ │ -000616c0: 333c 2f73 7061 6e3e 3c77 6272 3e3c 7370 3(Mat  │ │ │ -00061730: 7372 632c 0a20 3c61 2068 7265 663d 222e src,. Mat m │ │ │ -00061780: 7478 522c 0a20 3c61 2068 7265 663d 222e txR,. Mat m │ │ │ -000617d0: 7478 512c 0a20 3c61 2068 7265 663d 222e txQ,. Mat Q │ │ │ -00061820: 7829 3c2f 7370 616e 3e3c 2f64 6976 3e0a x)
    . │ │ │ -00061830: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Computes an R │ │ │ -00061850: 5120 6465 636f 6d70 6f73 6974 696f 6e20 Q decomposition │ │ │ -00061860: 6f66 2033 7833 206d 6174 7269 6365 732e of 3x3 matrices. │ │ │ -00061870: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -00061890: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000618a0: 6464 3e3c 636f 6465 3e73 7263 3c2f 636f dd>src - 3x3 input │ │ │ -000618c0: 6d61 7472 6978 2e3c 2f64 643e 0a3c 6464 matrix..
    mtxR - Output 3x3 │ │ │ -000618f0: 7570 7065 722d 7472 6961 6e67 756c 6172 upper-triangular │ │ │ -00061900: 206d 6174 7269 782e 3c2f 6464 3e0a 3c64 matrix.
    .mtxQ - Output 3x3 │ │ │ -00061930: 206f 7274 686f 676f 6e61 6c20 6d61 7472 orthogonal matr │ │ │ -00061940: 6978 2e3c 2f64 643e 0a3c 6464 3e3c 636f ix..
    Qx - O │ │ │ -00061960: 7074 696f 6e61 6c20 6f75 7470 7574 2033 ptional output 3 │ │ │ -00061970: 7833 2072 6f74 6174 696f 6e20 6d61 7472 x3 rotation matr │ │ │ -00061980: 6978 2061 726f 756e 6420 782d 6178 6973 ix around x-axis │ │ │ -00061990: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ -000619a0: 636f 6d70 7574 6573 2061 2052 5120 6465 computes a RQ de │ │ │ -000619b0: 636f 6d70 6f73 6974 696f 6e20 7573 696e composition usin │ │ │ -000619c0: 6720 7468 6520 6769 7665 6e20 726f 7461 g the given rota │ │ │ -000619d0: 7469 6f6e 732e 2054 6869 7320 6675 6e63 tions. This func │ │ │ -000619e0: 7469 6f6e 2069 7320 7573 6564 2069 6e0a tion is used in. │ │ │ -000619f0: 2364 6563 6f6d 706f 7365 5072 6f6a 6563 #decomposeProjec │ │ │ -00061a00: 7469 6f6e 4d61 7472 6978 2074 6f20 6465 tionMatrix to de │ │ │ -00061a10: 636f 6d70 6f73 6520 7468 6520 6c65 6674 compose the left │ │ │ -00061a20: 2033 7833 2073 7562 6d61 7472 6978 206f 3x3 submatrix o │ │ │ -00061a30: 6620 6120 7072 6f6a 6563 7469 6f6e 206d f a projection m │ │ │ -00061a40: 6174 7269 7820 696e 746f 2061 2063 616d atrix into a cam │ │ │ -00061a50: 6572 610a 616e 6420 6120 726f 7461 7469 era.and a rotati │ │ │ -00061a60: 6f6e 206d 6174 7269 782e 0a0a 4974 206f on matrix...It o │ │ │ -00061a70: 7074 696f 6e61 6c6c 7920 7265 7475 726e ptionally return │ │ │ -00061a80: 7320 7468 7265 6520 726f 7461 7469 6f6e s three rotation │ │ │ -00061a90: 206d 6174 7269 6365 732c 206f 6e65 2066 matrices, one f │ │ │ -00061aa0: 6f72 2065 6163 6820 6178 6973 2c20 616e or each axis, an │ │ │ -00061ab0: 6420 7468 6520 7468 7265 6520 4575 6c65 d the three Eule │ │ │ -00061ac0: 7220 616e 676c 6573 2069 6e0a 6465 6772 r angles in.degr │ │ │ -00061ad0: 6565 7320 2861 7320 7468 6520 7265 7475 ees (as the retu │ │ │ -00061ae0: 726e 2076 616c 7565 2920 7468 6174 2063 rn value) that c │ │ │ -00061af0: 6f75 6c64 2062 6520 7573 6564 2069 6e20 ould be used in │ │ │ -00061b00: 4f70 656e 474c 2e20 4e6f 7465 2c20 7468 OpenGL. Note, th │ │ │ -00061b10: 6572 6520 6973 2061 6c77 6179 7320 6d6f ere is always mo │ │ │ -00061b20: 7265 2074 6861 6e20 6f6e 650a 7365 7175 re than one.sequ │ │ │ -00061b30: 656e 6365 206f 6620 726f 7461 7469 6f6e ence of rotation │ │ │ -00061b40: 7320 6162 6f75 7420 7468 6520 7468 7265 s about the thre │ │ │ -00061b50: 6520 7072 696e 6369 7061 6c20 6178 6573 e principal axes │ │ │ -00061b60: 2074 6861 7420 7265 7375 6c74 7320 696e that results in │ │ │ -00061b70: 2074 6865 2073 616d 6520 6f72 6965 6e74 the same orient │ │ │ -00061b80: 6174 696f 6e20 6f66 2061 6e0a 6f62 6a65 ation of an.obje │ │ │ -00061b90: 6374 2c20 652e 672e 2073 6565 2043 4954 ct, e.g. see CIT │ │ │ -00061ba0: 453a 2053 6c61 6261 7567 6820 2e20 5265 E: Slabaugh . Re │ │ │ -00061bb0: 7475 726e 6564 2074 6872 6565 2072 6f74 turned three rot │ │ │ -00061bc0: 6174 696f 6e20 6d61 7472 6963 6573 2061 ation matrices a │ │ │ -00061bd0: 6e64 2063 6f72 7265 7370 6f6e 6469 6e67 nd corresponding │ │ │ -00061be0: 2074 6872 6565 2045 756c 6572 2061 6e67 three Euler ang │ │ │ -00061bf0: 6c65 730a 6172 6520 6f6e 6c79 206f 6e65 les.are only one │ │ │ -00061c00: 206f 6620 7468 6520 706f 7373 6962 6c65 of the possible │ │ │ -00061c10: 2073 6f6c 7574 696f 6e73 2e3c 2f64 643e solutions.
    │ │ │ -00061c20: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    automatic │ │ │ -00061c40: 616c 6c79 2067 656e 6572 6174 6564 3c2f ally generated.
    .
    │ │ │ -00061c60: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 ..
  • .
  • .
    .RQDecomp3x3.
    .
    public │ │ │ -00061d50: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ -00061d60: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;dou │ │ │ -00061d80: 626c 655b 5d3c 2f73 7061 6e3e 266e 6273 ble[]&nbs │ │ │ -00061d90: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;RQD │ │ │ -00061db0: 6563 6f6d 7033 7833 3c2f 7370 616e 3e3c ecomp3x3< │ │ │ -00061dc0: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat src,. Mat │ │ │ -00061e70: 266e 6273 703b 6d74 7852 2c0a 203c 6120  mtxR,. Mat │ │ │ -00061ec0: 266e 6273 703b 6d74 7851 293c 2f73 7061  mtxQ)
    .
    Comp │ │ │ -00061ef0: 7574 6573 2061 6e20 5251 2064 6563 6f6d utes an RQ decom │ │ │ -00061f00: 706f 7369 7469 6f6e 206f 6620 3378 3320 position of 3x3 │ │ │ -00061f10: 6d61 7472 6963 6573 2e3c 2f64 6976 3e0a matrices.
    . │ │ │ -00061f20: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ -00061f40: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    src - 3 │ │ │ -00061f60: 7833 2069 6e70 7574 206d 6174 7269 782e x3 input matrix. │ │ │ -00061f70: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -00061f80: 6d74 7852 3c2f 636f 6465 3e20 2d20 4f75 mtxR - Ou │ │ │ -00061f90: 7470 7574 2033 7833 2075 7070 6572 2d74 tput 3x3 upper-t │ │ │ -00061fa0: 7269 616e 6775 6c61 7220 6d61 7472 6978 riangular matrix │ │ │ -00061fb0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    mtxQ - O │ │ │ -00061fd0: 7574 7075 7420 3378 3320 6f72 7468 6f67 utput 3x3 orthog │ │ │ -00061fe0: 6f6e 616c 206d 6174 7269 782e 0a0a 5468 onal matrix...Th │ │ │ -00061ff0: 6520 6675 6e63 7469 6f6e 2063 6f6d 7075 e function compu │ │ │ -00062000: 7465 7320 6120 5251 2064 6563 6f6d 706f tes a RQ decompo │ │ │ -00062010: 7369 7469 6f6e 2075 7369 6e67 2074 6865 sition using the │ │ │ -00062020: 2067 6976 656e 2072 6f74 6174 696f 6e73 given rotations │ │ │ -00062030: 2e20 5468 6973 2066 756e 6374 696f 6e20 . This function │ │ │ -00062040: 6973 2075 7365 6420 696e 0a23 6465 636f is used in.#deco │ │ │ -00062050: 6d70 6f73 6550 726f 6a65 6374 696f 6e4d mposeProjectionM │ │ │ -00062060: 6174 7269 7820 746f 2064 6563 6f6d 706f atrix to decompo │ │ │ -00062070: 7365 2074 6865 206c 6566 7420 3378 3320 se the left 3x3 │ │ │ -00062080: 7375 626d 6174 7269 7820 6f66 2061 2070 submatrix of a p │ │ │ -00062090: 726f 6a65 6374 696f 6e20 6d61 7472 6978 rojection matrix │ │ │ -000620a0: 2069 6e74 6f20 6120 6361 6d65 7261 0a61 into a camera.a │ │ │ -000620b0: 6e64 2061 2072 6f74 6174 696f 6e20 6d61 nd a rotation ma │ │ │ -000620c0: 7472 6978 2e0a 0a49 7420 6f70 7469 6f6e trix...It option │ │ │ -000620d0: 616c 6c79 2072 6574 7572 6e73 2074 6872 ally returns thr │ │ │ -000620e0: 6565 2072 6f74 6174 696f 6e20 6d61 7472 ee rotation matr │ │ │ -000620f0: 6963 6573 2c20 6f6e 6520 666f 7220 6561 ices, one for ea │ │ │ -00062100: 6368 2061 7869 732c 2061 6e64 2074 6865 ch axis, and the │ │ │ -00062110: 2074 6872 6565 2045 756c 6572 2061 6e67 three Euler ang │ │ │ -00062120: 6c65 7320 696e 0a64 6567 7265 6573 2028 les in.degrees ( │ │ │ -00062130: 6173 2074 6865 2072 6574 7572 6e20 7661 as the return va │ │ │ -00062140: 6c75 6529 2074 6861 7420 636f 756c 6420 lue) that could │ │ │ -00062150: 6265 2075 7365 6420 696e 204f 7065 6e47 be used in OpenG │ │ │ -00062160: 4c2e 204e 6f74 652c 2074 6865 7265 2069 L. Note, there i │ │ │ -00062170: 7320 616c 7761 7973 206d 6f72 6520 7468 s always more th │ │ │ -00062180: 616e 206f 6e65 0a73 6571 7565 6e63 6520 an one.sequence │ │ │ -00062190: 6f66 2072 6f74 6174 696f 6e73 2061 626f of rotations abo │ │ │ -000621a0: 7574 2074 6865 2074 6872 6565 2070 7269 ut the three pri │ │ │ -000621b0: 6e63 6970 616c 2061 7865 7320 7468 6174 ncipal axes that │ │ │ -000621c0: 2072 6573 756c 7473 2069 6e20 7468 6520 results in the │ │ │ -000621d0: 7361 6d65 206f 7269 656e 7461 7469 6f6e same orientation │ │ │ -000621e0: 206f 6620 616e 0a6f 626a 6563 742c 2065 of an.object, e │ │ │ -000621f0: 2e67 2e20 7365 6520 4349 5445 3a20 536c .g. see CITE: Sl │ │ │ -00062200: 6162 6175 6768 202e 2052 6574 7572 6e65 abaugh . Returne │ │ │ -00062210: 6420 7468 7265 6520 726f 7461 7469 6f6e d three rotation │ │ │ -00062220: 206d 6174 7269 6365 7320 616e 6420 636f matrices and co │ │ │ -00062230: 7272 6573 706f 6e64 696e 6720 7468 7265 rresponding thre │ │ │ -00062240: 6520 4575 6c65 7220 616e 676c 6573 0a61 e Euler angles.a │ │ │ -00062250: 7265 206f 6e6c 7920 6f6e 6520 6f66 2074 re only one of t │ │ │ -00062260: 6865 2070 6f73 7369 626c 6520 736f 6c75 he possible solu │ │ │ -00062270: 7469 6f6e 732e 3c2f 6464 3e0a 3c64 743e tions.
    .
    │ │ │ -00062280: 5265 7475 726e 733a 3c2f 6474 3e0a 3c64 Returns:
    .automatically │ │ │ -000622a0: 6765 6e65 7261 7465 643c 2f64 643e 0a3c generated.< │ │ │ -000622b0: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ..
  • .
  • .
    .

    d │ │ │ -000623b0: 6563 6f6d 706f 7365 5072 6f6a 6563 7469 ecomposeProjecti │ │ │ -000623c0: 6f6e 4d61 7472 6978 3c2f 6833 3e0a 3c64 onMatrix

    ..public stati │ │ │ -00062430: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void decomposePro │ │ │ -00062490: 6a65 6374 696f 6e4d 6174 7269 783c 2f73 jectionMatrix(M │ │ │ -00062500: 6174 3c2f 613e 266e 6273 703b 7072 6f6a at proj │ │ │ -00062510: 4d61 7472 6978 2c0a 203c 6120 6872 6566 Matrix,. Mat&nbs │ │ │ -00062560: 703b 6361 6d65 7261 4d61 7472 6978 2c0a p;cameraMatrix,. │ │ │ -00062570: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000625b0: 3c2f 613e 266e 6273 703b 726f 744d 6174  rotMat │ │ │ -000625c0: 7269 782c 0a20 3c61 2068 7265 663d 222e rix,. Mat t │ │ │ -00062610: 7261 6e73 5665 6374 2c0a 203c 6120 6872 ransVect,. Mat&n │ │ │ -00062660: 6273 703b 726f 744d 6174 7269 7858 2c0a bsp;rotMatrixX,. │ │ │ -00062670: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000626b0: 3c2f 613e 266e 6273 703b 726f 744d 6174  rotMat │ │ │ -000626c0: 7269 7859 2c0a 203c 6120 6872 6566 3d22 rixY,. Mat  │ │ │ -00062710: 726f 744d 6174 7269 785a 2c0a 203c 6120 rotMatrixZ,. Mat │ │ │ -00062760: 266e 6273 703b 6575 6c65 7241 6e67 6c65  eulerAngle │ │ │ -00062770: 7329 3c2f 7370 616e 3e3c 2f64 6976 3e0a s). │ │ │ -00062780: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Decomposes a │ │ │ -000627a0: 7072 6f6a 6563 7469 6f6e 206d 6174 7269 projection matri │ │ │ -000627b0: 7820 696e 746f 2061 2072 6f74 6174 696f x into a rotatio │ │ │ -000627c0: 6e20 6d61 7472 6978 2061 6e64 2061 2063 n matrix and a c │ │ │ -000627d0: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ -000627e0: 6d61 7472 6978 2e3c 2f64 6976 3e0a 3c64 matrix.
    . │ │ │ -00062800: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ -00062810: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -00062820: 7072 6f6a 4d61 7472 6978 3c2f 636f 6465 projMatrix - 3x4 input pr │ │ │ -00062840: 6f6a 6563 7469 6f6e 206d 6174 7269 7820 ojection matrix │ │ │ -00062850: 502e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 P.
    .
    cameraMatrix - Output 3 │ │ │ -00062880: 7833 2063 616d 6572 6120 696e 7472 696e x3 camera intrin │ │ │ -00062890: 7369 6320 6d61 7472 6978 205c 285c 6361 sic matrix \(\ca │ │ │ -000628a0: 6d65 7261 6d61 7472 6978 7b41 7d5c 292e meramatrix{A}\). │ │ │ -000628b0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000628c0: 726f 744d 6174 7269 783c 2f63 6f64 653e rotMatrix │ │ │ -000628d0: 202d 204f 7574 7075 7420 3378 3320 6578 - Output 3x3 ex │ │ │ -000628e0: 7465 726e 616c 2072 6f74 6174 696f 6e20 ternal rotation │ │ │ -000628f0: 6d61 7472 6978 2052 2e3c 2f64 643e 0a3c matrix R.
    .< │ │ │ -00062900: 6464 3e3c 636f 6465 3e74 7261 6e73 5665 dd>transVe │ │ │ -00062910: 6374 3c2f 636f 6465 3e20 2d20 4f75 7470 ct - Outp │ │ │ -00062920: 7574 2034 7831 2074 7261 6e73 6c61 7469 ut 4x1 translati │ │ │ -00062930: 6f6e 2076 6563 746f 7220 542e 3c2f 6464 on vector T..
    rotM │ │ │ -00062950: 6174 7269 7858 3c2f 636f 6465 3e20 2d20 atrixX - │ │ │ -00062960: 4f70 7469 6f6e 616c 2033 7833 2072 6f74 Optional 3x3 rot │ │ │ -00062970: 6174 696f 6e20 6d61 7472 6978 2061 726f ation matrix aro │ │ │ -00062980: 756e 6420 782d 6178 6973 2e3c 2f64 643e und x-axis.
    │ │ │ -00062990: 0a3c 6464 3e3c 636f 6465 3e72 6f74 4d61 .
    rotMa │ │ │ -000629a0: 7472 6978 593c 2f63 6f64 653e 202d 204f trixY - O │ │ │ -000629b0: 7074 696f 6e61 6c20 3378 3320 726f 7461 ptional 3x3 rota │ │ │ -000629c0: 7469 6f6e 206d 6174 7269 7820 6172 6f75 tion matrix arou │ │ │ -000629d0: 6e64 2079 2d61 7869 732e 3c2f 6464 3e0a nd y-axis.
    . │ │ │ -000629e0: 3c64 643e 3c63 6f64 653e 726f 744d 6174
    rotMat │ │ │ -000629f0: 7269 785a 3c2f 636f 6465 3e20 2d20 4f70 rixZ - Op │ │ │ -00062a00: 7469 6f6e 616c 2033 7833 2072 6f74 6174 tional 3x3 rotat │ │ │ -00062a10: 696f 6e20 6d61 7472 6978 2061 726f 756e ion matrix aroun │ │ │ -00062a20: 6420 7a2d 6178 6973 2e3c 2f64 643e 0a3c d z-axis.
    .< │ │ │ -00062a30: 6464 3e3c 636f 6465 3e65 756c 6572 416e dd>eulerAn │ │ │ -00062a40: 676c 6573 3c2f 636f 6465 3e20 2d20 4f70 gles - Op │ │ │ -00062a50: 7469 6f6e 616c 2074 6872 6565 2d65 6c65 tional three-ele │ │ │ -00062a60: 6d65 6e74 2076 6563 746f 7220 636f 6e74 ment vector cont │ │ │ -00062a70: 6169 6e69 6e67 2074 6872 6565 2045 756c aining three Eul │ │ │ -00062a80: 6572 2061 6e67 6c65 7320 6f66 2072 6f74 er angles of rot │ │ │ -00062a90: 6174 696f 6e20 696e 0a64 6567 7265 6573 ation in.degrees │ │ │ -00062aa0: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ -00062ab0: 636f 6d70 7574 6573 2061 2064 6563 6f6d computes a decom │ │ │ -00062ac0: 706f 7369 7469 6f6e 206f 6620 6120 7072 position of a pr │ │ │ -00062ad0: 6f6a 6563 7469 6f6e 206d 6174 7269 7820 ojection matrix │ │ │ -00062ae0: 696e 746f 2061 2063 616c 6962 7261 7469 into a calibrati │ │ │ -00062af0: 6f6e 2061 6e64 2061 2072 6f74 6174 696f on and a rotatio │ │ │ -00062b00: 6e0a 6d61 7472 6978 2061 6e64 2074 6865 n.matrix and the │ │ │ -00062b10: 2070 6f73 6974 696f 6e20 6f66 2061 2063 position of a c │ │ │ -00062b20: 616d 6572 612e 0a0a 4974 206f 7074 696f amera...It optio │ │ │ -00062b30: 6e61 6c6c 7920 7265 7475 726e 7320 7468 nally returns th │ │ │ -00062b40: 7265 6520 726f 7461 7469 6f6e 206d 6174 ree rotation mat │ │ │ -00062b50: 7269 6365 732c 206f 6e65 2066 6f72 2065 rices, one for e │ │ │ -00062b60: 6163 6820 6178 6973 2c20 616e 6420 7468 ach axis, and th │ │ │ -00062b70: 7265 6520 4575 6c65 7220 616e 676c 6573 ree Euler angles │ │ │ -00062b80: 2074 6861 7420 636f 756c 640a 6265 2075 that could.be u │ │ │ -00062b90: 7365 6420 696e 204f 7065 6e47 4c2e 204e sed in OpenGL. N │ │ │ -00062ba0: 6f74 652c 2074 6865 7265 2069 7320 616c ote, there is al │ │ │ -00062bb0: 7761 7973 206d 6f72 6520 7468 616e 206f ways more than o │ │ │ -00062bc0: 6e65 2073 6571 7565 6e63 6520 6f66 2072 ne sequence of r │ │ │ -00062bd0: 6f74 6174 696f 6e73 2061 626f 7574 2074 otations about t │ │ │ -00062be0: 6865 2074 6872 6565 0a70 7269 6e63 6970 he three.princip │ │ │ -00062bf0: 616c 2061 7865 7320 7468 6174 2072 6573 al axes that res │ │ │ -00062c00: 756c 7473 2069 6e20 7468 6520 7361 6d65 ults in the same │ │ │ -00062c10: 206f 7269 656e 7461 7469 6f6e 206f 6620 orientation of │ │ │ -00062c20: 616e 206f 626a 6563 742c 2065 2e67 2e20 an object, e.g. │ │ │ -00062c30: 7365 6520 4349 5445 3a20 536c 6162 6175 see CITE: Slabau │ │ │ -00062c40: 6768 202e 2052 6574 7572 6e65 640a 7468 gh . Returned.th │ │ │ -00062c50: 7265 6520 726f 7461 7469 6f6e 206d 6174 ree rotation mat │ │ │ -00062c60: 7269 6365 7320 616e 6420 636f 7272 6573 rices and corres │ │ │ -00062c70: 706f 6e64 696e 6720 7468 7265 6520 4575 ponding three Eu │ │ │ -00062c80: 6c65 7220 616e 676c 6573 2061 7265 206f ler angles are o │ │ │ -00062c90: 6e6c 7920 6f6e 6520 6f66 2074 6865 2070 nly one of the p │ │ │ -00062ca0: 6f73 7369 626c 6520 736f 6c75 7469 6f6e ossible solution │ │ │ -00062cb0: 732e 0a0a 5468 6520 6675 6e63 7469 6f6e s...The function │ │ │ -00062cc0: 2069 7320 6261 7365 6420 6f6e 2023 5251 is based on #RQ │ │ │ -00062cd0: 4465 636f 6d70 3378 3320 2e3c 2f64 643e Decomp3x3 . │ │ │ -00062ce0: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f ....
  • .< │ │ │ -00062d00: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .

    dec │ │ │ -00062dd0: 6f6d 706f 7365 5072 6f6a 6563 7469 6f6e omposeProjection │ │ │ -00062de0: 4d61 7472 6978 3c2f 6833 3e0a 3c64 6976 Matrix

    .
    .
    public static< │ │ │ -00062e50: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> void decomposeProje │ │ │ -00062eb0: 6374 696f 6e4d 6174 7269 783c 2f73 7061 ctionMatrix │ │ │ -00062ee0: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ -00062f20: 3c2f 613e 266e 6273 703b 7072 6f6a 4d61  projMa │ │ │ -00062f30: 7472 6978 2c0a 203c 6120 6872 6566 3d22 trix,. Mat  │ │ │ -00062f80: 6361 6d65 7261 4d61 7472 6978 2c0a 203c cameraMatrix,. < │ │ │ -00062f90: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00062fa0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00062fb0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00062fc0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat rotMatri │ │ │ -00062fe0: 782c 0a20 3c61 2068 7265 663d 222e 2e2f x,. │ │ │ -00063020: 4d61 743c 2f61 3e26 6e62 7370 3b74 7261 Mat tra │ │ │ -00063030: 6e73 5665 6374 2c0a 203c 6120 6872 6566 nsVect,. Mat&nbs │ │ │ -00063080: 703b 726f 744d 6174 7269 7858 2c0a 203c p;rotMatrixX,. < │ │ │ -00063090: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000630a0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000630b0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000630c0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat rotMatri │ │ │ -000630e0: 7859 2c0a 203c 6120 6872 6566 3d22 2e2e xY,. Mat ro │ │ │ -00063130: 744d 6174 7269 785a 293c 2f73 7061 6e3e tMatrixZ) │ │ │ -00063140: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Decomp │ │ │ -00063160: 6f73 6573 2061 2070 726f 6a65 6374 696f oses a projectio │ │ │ -00063170: 6e20 6d61 7472 6978 2069 6e74 6f20 6120 n matrix into a │ │ │ -00063180: 726f 7461 7469 6f6e 206d 6174 7269 7820 rotation matrix │ │ │ -00063190: 616e 6420 6120 6361 6d65 7261 2069 6e74 and a camera int │ │ │ -000631a0: 7269 6e73 6963 206d 6174 7269 782e 3c2f rinsic matrix..
    .
    Para │ │ │ -000631d0: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    projMatri │ │ │ -000631f0: 783c 2f63 6f64 653e 202d 2033 7834 2069 x - 3x4 i │ │ │ -00063200: 6e70 7574 2070 726f 6a65 6374 696f 6e20 nput projection │ │ │ -00063210: 6d61 7472 6978 2050 2e3c 2f64 643e 0a3c matrix P.
    .< │ │ │ -00063220: 6464 3e3c 636f 6465 3e63 616d 6572 614d dd>cameraM │ │ │ -00063230: 6174 7269 783c 2f63 6f64 653e 202d 204f atrix - O │ │ │ -00063240: 7574 7075 7420 3378 3320 6361 6d65 7261 utput 3x3 camera │ │ │ -00063250: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ -00063260: 7820 5c28 5c63 616d 6572 616d 6174 7269 x \(\cameramatri │ │ │ -00063270: 787b 417d 5c29 2e3c 2f64 643e 0a3c 6464 x{A}\)..
    rotMatrix │ │ │ -00063290: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ -000632a0: 2033 7833 2065 7874 6572 6e61 6c20 726f 3x3 external ro │ │ │ -000632b0: 7461 7469 6f6e 206d 6174 7269 7820 522e tation matrix R. │ │ │ -000632c0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000632d0: 7472 616e 7356 6563 743c 2f63 6f64 653e transVect │ │ │ -000632e0: 202d 204f 7574 7075 7420 3478 3120 7472 - Output 4x1 tr │ │ │ -000632f0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ -00063300: 2054 2e3c 2f64 643e 0a3c 6464 3e3c 636f T.
    .
    rotMatrixX - Optional │ │ │ -00063330: 3378 3320 726f 7461 7469 6f6e 206d 6174 3x3 rotation mat │ │ │ -00063340: 7269 7820 6172 6f75 6e64 2078 2d61 7869 rix around x-axi │ │ │ -00063350: 732e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 s.
    .
    rotMatrixY - Optional 3 │ │ │ -00063380: 7833 2072 6f74 6174 696f 6e20 6d61 7472 x3 rotation matr │ │ │ -00063390: 6978 2061 726f 756e 6420 792d 6178 6973 ix around y-axis │ │ │ -000633a0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    rotMatrixZ - Optional 3x │ │ │ -000633d0: 3320 726f 7461 7469 6f6e 206d 6174 7269 3 rotation matri │ │ │ -000633e0: 7820 6172 6f75 6e64 207a 2d61 7869 732e x around z-axis. │ │ │ -000633f0: 0a64 6567 7265 6573 2e0a 0a54 6865 2066 .degrees...The f │ │ │ -00063400: 756e 6374 696f 6e20 636f 6d70 7574 6573 unction computes │ │ │ -00063410: 2061 2064 6563 6f6d 706f 7369 7469 6f6e a decomposition │ │ │ -00063420: 206f 6620 6120 7072 6f6a 6563 7469 6f6e of a projection │ │ │ -00063430: 206d 6174 7269 7820 696e 746f 2061 2063 matrix into a c │ │ │ -00063440: 616c 6962 7261 7469 6f6e 2061 6e64 2061 alibration and a │ │ │ -00063450: 2072 6f74 6174 696f 6e0a 6d61 7472 6978 rotation.matrix │ │ │ -00063460: 2061 6e64 2074 6865 2070 6f73 6974 696f and the positio │ │ │ -00063470: 6e20 6f66 2061 2063 616d 6572 612e 0a0a n of a camera... │ │ │ -00063480: 4974 206f 7074 696f 6e61 6c6c 7920 7265 It optionally re │ │ │ -00063490: 7475 726e 7320 7468 7265 6520 726f 7461 turns three rota │ │ │ -000634a0: 7469 6f6e 206d 6174 7269 6365 732c 206f tion matrices, o │ │ │ -000634b0: 6e65 2066 6f72 2065 6163 6820 6178 6973 ne for each axis │ │ │ -000634c0: 2c20 616e 6420 7468 7265 6520 4575 6c65 , and three Eule │ │ │ -000634d0: 7220 616e 676c 6573 2074 6861 7420 636f r angles that co │ │ │ -000634e0: 756c 640a 6265 2075 7365 6420 696e 204f uld.be used in O │ │ │ -000634f0: 7065 6e47 4c2e 204e 6f74 652c 2074 6865 penGL. Note, the │ │ │ -00063500: 7265 2069 7320 616c 7761 7973 206d 6f72 re is always mor │ │ │ -00063510: 6520 7468 616e 206f 6e65 2073 6571 7565 e than one seque │ │ │ -00063520: 6e63 6520 6f66 2072 6f74 6174 696f 6e73 nce of rotations │ │ │ -00063530: 2061 626f 7574 2074 6865 2074 6872 6565 about the three │ │ │ -00063540: 0a70 7269 6e63 6970 616c 2061 7865 7320 .principal axes │ │ │ -00063550: 7468 6174 2072 6573 756c 7473 2069 6e20 that results in │ │ │ -00063560: 7468 6520 7361 6d65 206f 7269 656e 7461 the same orienta │ │ │ -00063570: 7469 6f6e 206f 6620 616e 206f 626a 6563 tion of an objec │ │ │ -00063580: 742c 2065 2e67 2e20 7365 6520 4349 5445 t, e.g. see CITE │ │ │ -00063590: 3a20 536c 6162 6175 6768 202e 2052 6574 : Slabaugh . Ret │ │ │ -000635a0: 7572 6e65 640a 7468 7265 6520 726f 7461 urned.three rota │ │ │ -000635b0: 7469 6f6e 206d 6174 7269 6365 7320 616e tion matrices an │ │ │ -000635c0: 6420 636f 7272 6573 706f 6e64 696e 6720 d corresponding │ │ │ -000635d0: 7468 7265 6520 4575 6c65 7220 616e 676c three Euler angl │ │ │ -000635e0: 6573 2061 7265 206f 6e6c 7920 6f6e 6520 es are only one │ │ │ -000635f0: 6f66 2074 6865 2070 6f73 7369 626c 6520 of the possible │ │ │ -00063600: 736f 6c75 7469 6f6e 732e 0a0a 5468 6520 solutions...The │ │ │ -00063610: 6675 6e63 7469 6f6e 2069 7320 6261 7365 function is base │ │ │ -00063620: 6420 6f6e 2023 5251 4465 636f 6d70 3378 d on #RQDecomp3x │ │ │ -00063630: 3320 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c 3 .
    .
    .< │ │ │ -00063640: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ -00063650: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 ..
  • ..

    decomposeProjec │ │ │ -00063720: 7469 6f6e 4d61 7472 6978 3c2f 6833 3e0a tionMatrix

    . │ │ │ -00063730: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ -00063750: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ -00063790: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ -000637a0: 3c73 7061 6e20 636c 6173 733d 2272 6574 void.

    approxPoly │ │ │ +000583f0: 4450 3c2f 6833 3e0a 3c64 6976 2063 6c61 DP

    .
    .
    pu │ │ │ +00058450: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static void&nb │ │ │ +00058490: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;ap │ │ │ +000584b0: 7072 6f78 506f 6c79 4450 3c2f 7370 616e proxPolyDP( │ │ │ +000584e0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfPoint2 │ │ │ +00058530: 663c 2f61 3e26 6e62 7370 3b63 7572 7665 f curve │ │ │ +00058540: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. MatOfPoi │ │ │ +00058590: 6e74 3266 3c2f 613e 266e 6273 703b 6170 nt2f ap │ │ │ +000585a0: 7072 6f78 4375 7276 652c 0a20 646f 7562 proxCurve,. doub │ │ │ +000585b0: 6c65 266e 6273 703b 6570 7369 6c6f 6e2c le epsilon, │ │ │ +000585c0: 0a20 626f 6f6c 6561 6e26 6e62 7370 3b63 . boolean c │ │ │ +000585d0: 6c6f 7365 6429 3c2f 7370 616e 3e3c 2f64 losed).
    Approxima │ │ │ +00058600: 7465 7320 6120 706f 6c79 676f 6e61 6c20 tes a polygonal │ │ │ +00058610: 6375 7276 6528 7329 2077 6974 6820 7468 curve(s) with th │ │ │ +00058620: 6520 7370 6563 6966 6965 6420 7072 6563 e specified prec │ │ │ +00058630: 6973 696f 6e2e 0a0a 2054 2068 6520 6675 ision... T he fu │ │ │ +00058640: 6e63 7469 6f6e 2063 763a 3a61 7070 726f nction cv::appro │ │ │ +00058650: 7850 6f6c 7944 5020 6170 7072 6f78 696d xPolyDP approxim │ │ │ +00058660: 6174 6573 2061 2063 7572 7665 206f 7220 ates a curve or │ │ │ +00058670: 6120 702a 6f6c 7967 6f6e 2077 6974 6820 a p*olygon with │ │ │ +00058680: 616e 6f74 6865 7220 6375 7276 652f 706f another curve/po │ │ │ +00058690: 6c79 676f 6e20 7769 7468 206c 6573 730a lygon with less. │ │ │ +000586a0: 2076 6572 7469 6365 7320 736f 2074 6861 vertices so tha │ │ │ +000586b0: 7420 7468 6520 6469 7374 616e 6365 2062 t the distance b │ │ │ +000586c0: 6574 7765 656e 2074 6865 6d20 6973 206c etween them is l │ │ │ +000586d0: 6573 7320 6f72 2065 7175 616c 2074 6f20 ess or equal to │ │ │ +000586e0: 7468 6520 7370 6563 6966 6965 6420 7072 the specified pr │ │ │ +000586f0: 6563 6973 696f 6e2e 2049 7420 7573 6573 ecision. It uses │ │ │ +00058700: 2074 6865 0a20 446f 7567 6c61 732d 5065 the. Douglas-Pe │ │ │ +00058710: 7563 6b65 7220 616c 676f 7269 7468 6d20 ucker algorithm │ │ │ +00058720: 266c 743b 6874 7470 733a 2f2f 656e 2e77 <https://en.w │ │ │ +00058730: 696b 6970 6564 6961 2e6f 7267 2f77 696b ikipedia.org/wik │ │ │ +00058740: 692f 5261 6d65 722d 446f 7567 6c61 732d i/Ramer-Douglas- │ │ │ +00058750: 5065 7563 6b65 725f 616c 676f 7269 7468 Peucker_algorith │ │ │ +00058760: 6d26 6774 3b3c 2f64 6976 3e0a 3c64 6c20 m>
    .
    .< │ │ │ +00058780: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    cu │ │ │ +000587a0: 7276 653c 2f63 6f64 653e 202d 2049 6e70 rve - Inp │ │ │ +000587b0: 7574 2076 6563 746f 7220 6f66 2061 2032 ut vector of a 2 │ │ │ +000587c0: 4420 706f 696e 7420 7374 6f72 6564 2069 D point stored i │ │ │ +000587d0: 6e20 7374 643a 3a76 6563 746f 7220 6f72 n std::vector or │ │ │ +000587e0: 204d 6174 3c2f 6464 3e0a 3c64 643e 3c63 Mat
    .
    approxCurve< │ │ │ +00058800: 2f63 6f64 653e 202d 2052 6573 756c 7420 /code> - Result │ │ │ +00058810: 6f66 2074 6865 2061 7070 726f 7869 6d61 of the approxima │ │ │ +00058820: 7469 6f6e 2e20 5468 6520 7479 7065 2073 tion. The type s │ │ │ +00058830: 686f 756c 6420 6d61 7463 6820 7468 6520 hould match the │ │ │ +00058840: 7479 7065 206f 6620 7468 6520 696e 7075 type of the inpu │ │ │ +00058850: 7420 6375 7276 652e 3c2f 6464 3e0a 3c64 t curve.
    .epsilon< │ │ │ +00058870: 2f63 6f64 653e 202d 2050 6172 616d 6574 /code> - Paramet │ │ │ +00058880: 6572 2073 7065 6369 6679 696e 6720 7468 er specifying th │ │ │ +00058890: 6520 6170 7072 6f78 696d 6174 696f 6e20 e approximation │ │ │ +000588a0: 6163 6375 7261 6379 2e20 5468 6973 2069 accuracy. This i │ │ │ +000588b0: 7320 7468 6520 6d61 7869 6d75 6d20 6469 s the maximum di │ │ │ +000588c0: 7374 616e 6365 0a20 6265 7477 6565 6e20 stance. between │ │ │ +000588d0: 7468 6520 6f72 6967 696e 616c 2063 7572 the original cur │ │ │ +000588e0: 7665 2061 6e64 2069 7473 2061 7070 726f ve and its appro │ │ │ +000588f0: 7869 6d61 7469 6f6e 2e3c 2f64 643e 0a3c ximation..< │ │ │ +00058900: 6464 3e3c 636f 6465 3e63 6c6f 7365 643c dd>closed< │ │ │ +00058910: 2f63 6f64 653e 202d 2049 6620 7472 7565 /code> - If true │ │ │ +00058920: 2c20 7468 6520 6170 7072 6f78 696d 6174 , the approximat │ │ │ +00058930: 6564 2063 7572 7665 2069 7320 636c 6f73 ed curve is clos │ │ │ +00058940: 6564 2028 6974 7320 6669 7273 7420 616e ed (its first an │ │ │ +00058950: 6420 6c61 7374 2076 6572 7469 6365 7320 d last vertices │ │ │ +00058960: 6172 650a 2063 6f6e 6e65 6374 6564 292e are. connected). │ │ │ +00058970: 204f 7468 6572 7769 7365 2c20 6974 2069 Otherwise, it i │ │ │ +00058980: 7320 6e6f 7420 636c 6f73 6564 2e3c 2f64 s not closed..
    .
    . │ │ │ +000589a0: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e .
  • │ │ │ +000589b0: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    a │ │ │ +00058a20: 7070 726f 7850 6f6c 794e 3c2f 6833 3e0a pproxPolyN

    . │ │ │ +00058a30: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ +00058a50: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ +00058a90: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ +00058aa0: 3c73 7061 6e20 636c 6173 733d 2272 6574 void approxPoly │ │ │ +00058af0: 4e3c 2f73 7061 6e3e 3c77 6272 3e3c 7370 N(Mat  │ │ │ +00058b60: 6375 7276 652c 0a20 3c61 2068 7265 663d curve,. Mat  │ │ │ +00058bb0: 3b61 7070 726f 7843 7572 7665 2c0a 2069 ;approxCurve,. i │ │ │ +00058bc0: 6e74 266e 6273 703b 6e73 6964 6573 2c0a nt nsides,. │ │ │ +00058bd0: 2066 6c6f 6174 266e 6273 703b 6570 7369 float epsi │ │ │ +00058be0: 6c6f 6e5f 7065 7263 656e 7461 6765 2c0a lon_percentage,. │ │ │ +00058bf0: 2062 6f6f 6c65 616e 266e 6273 703b 656e boolean en │ │ │ +00058c00: 7375 7265 5f63 6f6e 7665 7829 3c2f 7370 sure_convex)
    .
    App │ │ │ +00058c30: 726f 7869 6d61 7465 7320 6120 706f 6c79 roximates a poly │ │ │ +00058c40: 676f 6e20 7769 7468 2061 2063 6f6e 7665 gon with a conve │ │ │ +00058c50: 7820 6875 6c6c 2077 6974 6820 6120 7370 x hull with a sp │ │ │ +00058c60: 6563 6966 6965 6420 6163 6375 7261 6379 ecified accuracy │ │ │ +00058c70: 2061 6e64 206e 756d 6265 7220 6f66 2073 and number of s │ │ │ +00058c80: 6964 6573 2e0a 0a20 5420 6865 2063 763a ides... T he cv: │ │ │ +00058c90: 3a61 7070 726f 7850 6f6c 794e 2066 756e :approxPolyN fun │ │ │ +00058ca0: 6374 696f 6e20 6170 7072 6f78 696d 6174 ction approximat │ │ │ +00058cb0: 6573 2061 2070 6f6c 7967 6f6e 2077 6974 es a polygon wit │ │ │ +00058cc0: 6820 2a61 2063 6f6e 7665 7820 6875 6c6c h *a convex hull │ │ │ +00058cd0: 0a20 736f 2074 6861 7420 7468 6520 6469 . so that the di │ │ │ +00058ce0: 6666 6572 656e 6365 2062 6574 7765 656e fference between │ │ │ +00058cf0: 2074 6865 2063 6f6e 746f 7572 2061 7265 the contour are │ │ │ +00058d00: 6120 6f66 2074 6865 206f 7269 6769 6e61 a of the origina │ │ │ +00058d10: 6c20 636f 6e74 6f75 7220 616e 6420 7468 l contour and th │ │ │ +00058d20: 6520 6e65 7720 706f 6c79 676f 6e20 6973 e new polygon is │ │ │ +00058d30: 206d 696e 696d 616c 2e0a 2049 7420 7573 minimal.. It us │ │ │ +00058d40: 6573 2061 2067 7265 6564 7920 616c 676f es a greedy algo │ │ │ +00058d50: 7269 7468 6d20 666f 7220 636f 6e74 7261 rithm for contra │ │ │ +00058d60: 6374 696e 6720 7477 6f20 7665 7274 6963 cting two vertic │ │ │ +00058d70: 6573 2069 6e74 6f20 6f6e 6520 696e 2073 es into one in s │ │ │ +00058d80: 7563 6820 6120 7761 7920 7468 6174 2074 uch a way that t │ │ │ +00058d90: 6865 2061 6464 6974 696f 6e61 6c20 6172 he additional ar │ │ │ +00058da0: 6561 2069 7320 6d69 6e69 6d61 6c2e 0a20 ea is minimal.. │ │ │ +00058db0: 5374 7261 6967 6874 206c 696e 6573 2066 Straight lines f │ │ │ +00058dc0: 6f72 6d65 6420 6279 2065 6163 6820 6564 ormed by each ed │ │ │ +00058dd0: 6765 206f 6620 7468 6520 636f 6e76 6578 ge of the convex │ │ │ +00058de0: 2063 6f6e 746f 7572 2061 7265 2064 7261 contour are dra │ │ │ +00058df0: 776e 2061 6e64 2074 6865 2061 7265 6173 wn and the areas │ │ │ +00058e00: 206f 6620 7468 6520 7265 7375 6c74 696e of the resultin │ │ │ +00058e10: 6720 7472 6961 6e67 6c65 7320 6172 6520 g triangles are │ │ │ +00058e20: 636f 6e73 6964 6572 6564 2e0a 2045 6163 considered.. Eac │ │ │ +00058e30: 6820 7665 7274 6578 2077 696c 6c20 6c69 h vertex will li │ │ │ +00058e40: 6520 6569 7468 6572 206f 6e20 7468 6520 e either on the │ │ │ +00058e50: 6f72 6967 696e 616c 2063 6f6e 746f 7572 original contour │ │ │ +00058e60: 206f 7220 6f75 7473 6964 6520 6974 2e0a or outside it.. │ │ │ +00058e70: 0a20 5468 6520 616c 676f 7269 7468 6d20 . The algorithm │ │ │ +00058e80: 6261 7365 6420 6f6e 2074 6865 2070 6170 based on the pap │ │ │ +00058e90: 6572 2043 4954 453a 204c 6f77 496c 6965 er CITE: LowIlie │ │ │ +00058ea0: 3230 3033 202e 3c2f 6469 763e 0a3c 646c 2003 .
    .
    . │ │ │ +00058ec0: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ +00058ed0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e63 /dt>.
    c │ │ │ +00058ee0: 7572 7665 3c2f 636f 6465 3e20 2d20 496e urve - In │ │ │ +00058ef0: 7075 7420 7665 6374 6f72 206f 6620 6120 put vector of a │ │ │ +00058f00: 3244 2070 6f69 6e74 7320 7374 6f72 6564 2D points stored │ │ │ +00058f10: 2069 6e20 7374 643a 3a76 6563 746f 7220 in std::vector │ │ │ +00058f20: 6f72 204d 6174 2c20 706f 696e 7473 206d or Mat, points m │ │ │ +00058f30: 7573 7420 6265 2066 6c6f 6174 206f 7220 ust be float or │ │ │ +00058f40: 696e 7465 6765 722e 3c2f 6464 3e0a 3c64 integer.
    .approxCu │ │ │ +00058f60: 7276 653c 2f63 6f64 653e 202d 2052 6573 rve - Res │ │ │ +00058f70: 756c 7420 6f66 2074 6865 2061 7070 726f ult of the appro │ │ │ +00058f80: 7869 6d61 7469 6f6e 2e20 5468 6520 7479 ximation. The ty │ │ │ +00058f90: 7065 2069 7320 7665 6374 6f72 206f 6620 pe is vector of │ │ │ +00058fa0: 6120 3244 2070 6f69 6e74 2028 506f 696e a 2D point (Poin │ │ │ +00058fb0: 7432 6620 6f72 2050 6f69 6e74 2920 696e t2f or Point) in │ │ │ +00058fc0: 2073 7464 3a3a 7665 6374 6f72 206f 7220 std::vector or │ │ │ +00058fd0: 4d61 742e 3c2f 6464 3e0a 3c64 643e 3c63 Mat..
    nsides - The paramete │ │ │ +00059000: 7220 6465 6669 6e65 7320 7468 6520 6e75 r defines the nu │ │ │ +00059010: 6d62 6572 206f 6620 7369 6465 7320 6f66 mber of sides of │ │ │ +00059020: 2074 6865 2072 6573 756c 7420 706f 6c79 the result poly │ │ │ +00059030: 676f 6e2e 3c2f 6464 3e0a 3c64 643e 3c63 gon.
    .
    epsilon_perc │ │ │ +00059050: 656e 7461 6765 3c2f 636f 6465 3e20 2d20 entage - │ │ │ +00059060: 6465 6669 6e65 7320 7468 6520 7065 7263 defines the perc │ │ │ +00059070: 656e 7461 6765 206f 6620 7468 6520 6d61 entage of the ma │ │ │ +00059080: 7869 6d75 6d20 6f66 2061 6464 6974 696f ximum of additio │ │ │ +00059090: 6e61 6c20 6172 6561 2e0a 2049 6620 6974 nal area.. If it │ │ │ +000590a0: 2065 7175 616c 7320 2d31 2c20 6974 2069 equals -1, it i │ │ │ +000590b0: 7320 6e6f 7420 7573 6564 2e20 4f74 6865 s not used. Othe │ │ │ +000590c0: 7277 6973 6520 616c 676f 7269 7468 6d20 rwise algorithm │ │ │ +000590d0: 7374 6f70 7320 6966 2061 6464 6974 696f stops if additio │ │ │ +000590e0: 6e61 6c20 6172 6561 2069 7320 6772 6561 nal area is grea │ │ │ +000590f0: 7465 7220 7468 616e 2063 6f6e 746f 7572 ter than contour │ │ │ +00059100: 4172 6561 285f 6375 7276 6529 202a 2070 Area(_curve) * p │ │ │ +00059110: 6572 6365 6e74 6167 652e 0a20 4966 2061 ercentage.. If a │ │ │ +00059120: 6464 6974 696f 6e61 6c20 6172 6561 2065 dditional area e │ │ │ +00059130: 7863 6565 6473 2074 6865 206c 696d 6974 xceeds the limit │ │ │ +00059140: 2c20 616c 676f 7269 7468 6d20 7265 7475 , algorithm retu │ │ │ +00059150: 726e 7320 6173 206d 616e 7920 7665 7274 rns as many vert │ │ │ +00059160: 6963 6573 2061 7320 7468 6572 6520 7765 ices as there we │ │ │ +00059170: 7265 2061 7420 7468 6520 6d6f 6d65 6e74 re at the moment │ │ │ +00059180: 2074 6865 206c 696d 6974 2077 6173 2065 the limit was e │ │ │ +00059190: 7863 6565 6465 642e 3c2f 6464 3e0a 3c64 xceeded.
    .ensure_c │ │ │ +000591b0: 6f6e 7665 783c 2f63 6f64 653e 202d 2049 onvex - I │ │ │ +000591c0: 6620 6974 2069 7320 7472 7565 2c20 616c f it is true, al │ │ │ +000591d0: 676f 7269 7468 6d20 6372 6561 7465 7320 gorithm creates │ │ │ +000591e0: 6120 636f 6e76 6578 2068 756c 6c20 6f66 a convex hull of │ │ │ +000591f0: 2069 6e70 7574 2063 6f6e 746f 7572 2e20 input contour. │ │ │ +00059200: 4f74 6865 7277 6973 6520 696e 7075 7420 Otherwise input │ │ │ +00059210: 7665 6374 6f72 2073 686f 756c 6420 6265 vector should be │ │ │ +00059220: 2063 6f6e 7665 782e 3c2f 6464 3e0a 3c2f convex...
    ..
  • .
  • │ │ │ +00059250: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .approxPolyN.
    .
    public │ │ │ +00059320: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +00059330: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;voi │ │ │ +00059350: 643c 2f73 7061 6e3e 266e 6273 703b 3c73 d approxP │ │ │ +00059380: 6f6c 794e 3c2f 7370 616e 3e3c 7762 723e olyN │ │ │ +00059390: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +000593f0: 7370 3b63 7572 7665 2c0a 203c 6120 6872 sp;curve,. Mat&n │ │ │ +00059440: 6273 703b 6170 7072 6f78 4375 7276 652c bsp;approxCurve, │ │ │ +00059450: 0a20 696e 7426 6e62 7370 3b6e 7369 6465 . int nside │ │ │ +00059460: 732c 0a20 666c 6f61 7426 6e62 7370 3b65 s,. float e │ │ │ +00059470: 7073 696c 6f6e 5f70 6572 6365 6e74 6167 psilon_percentag │ │ │ +00059480: 6529 3c2f 7370 616e 3e3c 2f64 6976 3e0a e)
    . │ │ │ +00059490: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Approximates │ │ │ +000594b0: 6120 706f 6c79 676f 6e20 7769 7468 2061 a polygon with a │ │ │ +000594c0: 2063 6f6e 7665 7820 6875 6c6c 2077 6974 convex hull wit │ │ │ +000594d0: 6820 6120 7370 6563 6966 6965 6420 6163 h a specified ac │ │ │ +000594e0: 6375 7261 6379 2061 6e64 206e 756d 6265 curacy and numbe │ │ │ +000594f0: 7220 6f66 2073 6964 6573 2e0a 0a20 5420 r of sides... T │ │ │ +00059500: 6865 2063 763a 3a61 7070 726f 7850 6f6c he cv::approxPol │ │ │ +00059510: 794e 2066 756e 6374 696f 6e20 6170 7072 yN function appr │ │ │ +00059520: 6f78 696d 6174 6573 2061 2070 6f6c 7967 oximates a polyg │ │ │ +00059530: 6f6e 2077 6974 6820 2a61 2063 6f6e 7665 on with *a conve │ │ │ +00059540: 7820 6875 6c6c 0a20 736f 2074 6861 7420 x hull. so that │ │ │ +00059550: 7468 6520 6469 6666 6572 656e 6365 2062 the difference b │ │ │ +00059560: 6574 7765 656e 2074 6865 2063 6f6e 746f etween the conto │ │ │ +00059570: 7572 2061 7265 6120 6f66 2074 6865 206f ur area of the o │ │ │ +00059580: 7269 6769 6e61 6c20 636f 6e74 6f75 7220 riginal contour │ │ │ +00059590: 616e 6420 7468 6520 6e65 7720 706f 6c79 and the new poly │ │ │ +000595a0: 676f 6e20 6973 206d 696e 696d 616c 2e0a gon is minimal.. │ │ │ +000595b0: 2049 7420 7573 6573 2061 2067 7265 6564 It uses a greed │ │ │ +000595c0: 7920 616c 676f 7269 7468 6d20 666f 7220 y algorithm for │ │ │ +000595d0: 636f 6e74 7261 6374 696e 6720 7477 6f20 contracting two │ │ │ +000595e0: 7665 7274 6963 6573 2069 6e74 6f20 6f6e vertices into on │ │ │ +000595f0: 6520 696e 2073 7563 6820 6120 7761 7920 e in such a way │ │ │ +00059600: 7468 6174 2074 6865 2061 6464 6974 696f that the additio │ │ │ +00059610: 6e61 6c20 6172 6561 2069 7320 6d69 6e69 nal area is mini │ │ │ +00059620: 6d61 6c2e 0a20 5374 7261 6967 6874 206c mal.. Straight l │ │ │ +00059630: 696e 6573 2066 6f72 6d65 6420 6279 2065 ines formed by e │ │ │ +00059640: 6163 6820 6564 6765 206f 6620 7468 6520 ach edge of the │ │ │ +00059650: 636f 6e76 6578 2063 6f6e 746f 7572 2061 convex contour a │ │ │ +00059660: 7265 2064 7261 776e 2061 6e64 2074 6865 re drawn and the │ │ │ +00059670: 2061 7265 6173 206f 6620 7468 6520 7265 areas of the re │ │ │ +00059680: 7375 6c74 696e 6720 7472 6961 6e67 6c65 sulting triangle │ │ │ +00059690: 7320 6172 6520 636f 6e73 6964 6572 6564 s are considered │ │ │ +000596a0: 2e0a 2045 6163 6820 7665 7274 6578 2077 .. Each vertex w │ │ │ +000596b0: 696c 6c20 6c69 6520 6569 7468 6572 206f ill lie either o │ │ │ +000596c0: 6e20 7468 6520 6f72 6967 696e 616c 2063 n the original c │ │ │ +000596d0: 6f6e 746f 7572 206f 7220 6f75 7473 6964 ontour or outsid │ │ │ +000596e0: 6520 6974 2e0a 0a20 5468 6520 616c 676f e it... The algo │ │ │ +000596f0: 7269 7468 6d20 6261 7365 6420 6f6e 2074 rithm based on t │ │ │ +00059700: 6865 2070 6170 6572 2043 4954 453a 204c he paper CITE: L │ │ │ +00059710: 6f77 496c 6965 3230 3033 202e 3c2f 6469 owIlie2003 ..
    .
    Parame │ │ │ +00059740: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ +00059750: 636f 6465 3e63 7572 7665 3c2f 636f 6465 code>curve - Input vector │ │ │ +00059770: 206f 6620 6120 3244 2070 6f69 6e74 7320 of a 2D points │ │ │ +00059780: 7374 6f72 6564 2069 6e20 7374 643a 3a76 stored in std::v │ │ │ +00059790: 6563 746f 7220 6f72 204d 6174 2c20 706f ector or Mat, po │ │ │ +000597a0: 696e 7473 206d 7573 7420 6265 2066 6c6f ints must be flo │ │ │ +000597b0: 6174 206f 7220 696e 7465 6765 722e 3c2f at or integer..
    ap │ │ │ +000597d0: 7072 6f78 4375 7276 653c 2f63 6f64 653e proxCurve │ │ │ +000597e0: 202d 2052 6573 756c 7420 6f66 2074 6865 - Result of the │ │ │ +000597f0: 2061 7070 726f 7869 6d61 7469 6f6e 2e20 approximation. │ │ │ +00059800: 5468 6520 7479 7065 2069 7320 7665 6374 The type is vect │ │ │ +00059810: 6f72 206f 6620 6120 3244 2070 6f69 6e74 or of a 2D point │ │ │ +00059820: 2028 506f 696e 7432 6620 6f72 2050 6f69 (Point2f or Poi │ │ │ +00059830: 6e74 2920 696e 2073 7464 3a3a 7665 6374 nt) in std::vect │ │ │ +00059840: 6f72 206f 7220 4d61 742e 3c2f 6464 3e0a or or Mat.
    . │ │ │ +00059850: 3c64 643e 3c63 6f64 653e 6e73 6964 6573
    nsides │ │ │ +00059860: 3c2f 636f 6465 3e20 2d20 5468 6520 7061 - The pa │ │ │ +00059870: 7261 6d65 7465 7220 6465 6669 6e65 7320 rameter defines │ │ │ +00059880: 7468 6520 6e75 6d62 6572 206f 6620 7369 the number of si │ │ │ +00059890: 6465 7320 6f66 2074 6865 2072 6573 756c des of the resul │ │ │ +000598a0: 7420 706f 6c79 676f 6e2e 3c2f 6464 3e0a t polygon.
    . │ │ │ +000598b0: 3c64 643e 3c63 6f64 653e 6570 7369 6c6f
    epsilo │ │ │ +000598c0: 6e5f 7065 7263 656e 7461 6765 3c2f 636f n_percentage - defines th │ │ │ +000598e0: 6520 7065 7263 656e 7461 6765 206f 6620 e percentage of │ │ │ +000598f0: 7468 6520 6d61 7869 6d75 6d20 6f66 2061 the maximum of a │ │ │ +00059900: 6464 6974 696f 6e61 6c20 6172 6561 2e0a dditional area.. │ │ │ +00059910: 2049 6620 6974 2065 7175 616c 7320 2d31 If it equals -1 │ │ │ +00059920: 2c20 6974 2069 7320 6e6f 7420 7573 6564 , it is not used │ │ │ +00059930: 2e20 4f74 6865 7277 6973 6520 616c 676f . Otherwise algo │ │ │ +00059940: 7269 7468 6d20 7374 6f70 7320 6966 2061 rithm stops if a │ │ │ +00059950: 6464 6974 696f 6e61 6c20 6172 6561 2069 dditional area i │ │ │ +00059960: 7320 6772 6561 7465 7220 7468 616e 2063 s greater than c │ │ │ +00059970: 6f6e 746f 7572 4172 6561 285f 6375 7276 ontourArea(_curv │ │ │ +00059980: 6529 202a 2070 6572 6365 6e74 6167 652e e) * percentage. │ │ │ +00059990: 0a20 4966 2061 6464 6974 696f 6e61 6c20 . If additional │ │ │ +000599a0: 6172 6561 2065 7863 6565 6473 2074 6865 area exceeds the │ │ │ +000599b0: 206c 696d 6974 2c20 616c 676f 7269 7468 limit, algorith │ │ │ +000599c0: 6d20 7265 7475 726e 7320 6173 206d 616e m returns as man │ │ │ +000599d0: 7920 7665 7274 6963 6573 2061 7320 7468 y vertices as th │ │ │ +000599e0: 6572 6520 7765 7265 2061 7420 7468 6520 ere were at the │ │ │ +000599f0: 6d6f 6d65 6e74 2074 6865 206c 696d 6974 moment the limit │ │ │ +00059a00: 2077 6173 2065 7863 6565 6465 642e 3c2f was exceeded..
    .
    │ │ │ +00059a20: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
    .
  • .
  • .
    .approxPolyN.
    .
    public │ │ │ +00059b00: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +00059b10: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;voi │ │ │ +00059b30: 643c 2f73 7061 6e3e 266e 6273 703b 3c73 d approxP │ │ │ +00059b60: 6f6c 794e 3c2f 7370 616e 3e3c 7762 723e olyN │ │ │ +00059b70: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +00059bd0: 7370 3b63 7572 7665 2c0a 203c 6120 6872 sp;curve,. Mat&n │ │ │ +00059c20: 6273 703b 6170 7072 6f78 4375 7276 652c bsp;approxCurve, │ │ │ +00059c30: 0a20 696e 7426 6e62 7370 3b6e 7369 6465 . int nside │ │ │ +00059c40: 7329 3c2f 7370 616e 3e3c 2f64 6976 3e0a s)
    . │ │ │ +00059c50: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Approximates │ │ │ +00059c70: 6120 706f 6c79 676f 6e20 7769 7468 2061 a polygon with a │ │ │ +00059c80: 2063 6f6e 7665 7820 6875 6c6c 2077 6974 convex hull wit │ │ │ +00059c90: 6820 6120 7370 6563 6966 6965 6420 6163 h a specified ac │ │ │ +00059ca0: 6375 7261 6379 2061 6e64 206e 756d 6265 curacy and numbe │ │ │ +00059cb0: 7220 6f66 2073 6964 6573 2e0a 0a20 5420 r of sides... T │ │ │ +00059cc0: 6865 2063 763a 3a61 7070 726f 7850 6f6c he cv::approxPol │ │ │ +00059cd0: 794e 2066 756e 6374 696f 6e20 6170 7072 yN function appr │ │ │ +00059ce0: 6f78 696d 6174 6573 2061 2070 6f6c 7967 oximates a polyg │ │ │ +00059cf0: 6f6e 2077 6974 6820 2a61 2063 6f6e 7665 on with *a conve │ │ │ +00059d00: 7820 6875 6c6c 0a20 736f 2074 6861 7420 x hull. so that │ │ │ +00059d10: 7468 6520 6469 6666 6572 656e 6365 2062 the difference b │ │ │ +00059d20: 6574 7765 656e 2074 6865 2063 6f6e 746f etween the conto │ │ │ +00059d30: 7572 2061 7265 6120 6f66 2074 6865 206f ur area of the o │ │ │ +00059d40: 7269 6769 6e61 6c20 636f 6e74 6f75 7220 riginal contour │ │ │ +00059d50: 616e 6420 7468 6520 6e65 7720 706f 6c79 and the new poly │ │ │ +00059d60: 676f 6e20 6973 206d 696e 696d 616c 2e0a gon is minimal.. │ │ │ +00059d70: 2049 7420 7573 6573 2061 2067 7265 6564 It uses a greed │ │ │ +00059d80: 7920 616c 676f 7269 7468 6d20 666f 7220 y algorithm for │ │ │ +00059d90: 636f 6e74 7261 6374 696e 6720 7477 6f20 contracting two │ │ │ +00059da0: 7665 7274 6963 6573 2069 6e74 6f20 6f6e vertices into on │ │ │ +00059db0: 6520 696e 2073 7563 6820 6120 7761 7920 e in such a way │ │ │ +00059dc0: 7468 6174 2074 6865 2061 6464 6974 696f that the additio │ │ │ +00059dd0: 6e61 6c20 6172 6561 2069 7320 6d69 6e69 nal area is mini │ │ │ +00059de0: 6d61 6c2e 0a20 5374 7261 6967 6874 206c mal.. Straight l │ │ │ +00059df0: 696e 6573 2066 6f72 6d65 6420 6279 2065 ines formed by e │ │ │ +00059e00: 6163 6820 6564 6765 206f 6620 7468 6520 ach edge of the │ │ │ +00059e10: 636f 6e76 6578 2063 6f6e 746f 7572 2061 convex contour a │ │ │ +00059e20: 7265 2064 7261 776e 2061 6e64 2074 6865 re drawn and the │ │ │ +00059e30: 2061 7265 6173 206f 6620 7468 6520 7265 areas of the re │ │ │ +00059e40: 7375 6c74 696e 6720 7472 6961 6e67 6c65 sulting triangle │ │ │ +00059e50: 7320 6172 6520 636f 6e73 6964 6572 6564 s are considered │ │ │ +00059e60: 2e0a 2045 6163 6820 7665 7274 6578 2077 .. Each vertex w │ │ │ +00059e70: 696c 6c20 6c69 6520 6569 7468 6572 206f ill lie either o │ │ │ +00059e80: 6e20 7468 6520 6f72 6967 696e 616c 2063 n the original c │ │ │ +00059e90: 6f6e 746f 7572 206f 7220 6f75 7473 6964 ontour or outsid │ │ │ +00059ea0: 6520 6974 2e0a 0a20 5468 6520 616c 676f e it... The algo │ │ │ +00059eb0: 7269 7468 6d20 6261 7365 6420 6f6e 2074 rithm based on t │ │ │ +00059ec0: 6865 2070 6170 6572 2043 4954 453a 204c he paper CITE: L │ │ │ +00059ed0: 6f77 496c 6965 3230 3033 202e 3c2f 6469 owIlie2003 ..
    .
    Parame │ │ │ +00059f00: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ +00059f10: 636f 6465 3e63 7572 7665 3c2f 636f 6465 code>curve - Input vector │ │ │ +00059f30: 206f 6620 6120 3244 2070 6f69 6e74 7320 of a 2D points │ │ │ +00059f40: 7374 6f72 6564 2069 6e20 7374 643a 3a76 stored in std::v │ │ │ +00059f50: 6563 746f 7220 6f72 204d 6174 2c20 706f ector or Mat, po │ │ │ +00059f60: 696e 7473 206d 7573 7420 6265 2066 6c6f ints must be flo │ │ │ +00059f70: 6174 206f 7220 696e 7465 6765 722e 3c2f at or integer..
    ap │ │ │ +00059f90: 7072 6f78 4375 7276 653c 2f63 6f64 653e proxCurve │ │ │ +00059fa0: 202d 2052 6573 756c 7420 6f66 2074 6865 - Result of the │ │ │ +00059fb0: 2061 7070 726f 7869 6d61 7469 6f6e 2e20 approximation. │ │ │ +00059fc0: 5468 6520 7479 7065 2069 7320 7665 6374 The type is vect │ │ │ +00059fd0: 6f72 206f 6620 6120 3244 2070 6f69 6e74 or of a 2D point │ │ │ +00059fe0: 2028 506f 696e 7432 6620 6f72 2050 6f69 (Point2f or Poi │ │ │ +00059ff0: 6e74 2920 696e 2073 7464 3a3a 7665 6374 nt) in std::vect │ │ │ +0005a000: 6f72 206f 7220 4d61 742e 3c2f 6464 3e0a or or Mat.
    . │ │ │ +0005a010: 3c64 643e 3c63 6f64 653e 6e73 6964 6573
    nsides │ │ │ +0005a020: 3c2f 636f 6465 3e20 2d20 5468 6520 7061 - The pa │ │ │ +0005a030: 7261 6d65 7465 7220 6465 6669 6e65 7320 rameter defines │ │ │ +0005a040: 7468 6520 6e75 6d62 6572 206f 6620 7369 the number of si │ │ │ +0005a050: 6465 7320 6f66 2074 6865 2072 6573 756c des of the resul │ │ │ +0005a060: 7420 706f 6c79 676f 6e2e 0a20 4966 2069 t polygon.. If i │ │ │ +0005a070: 7420 6571 7561 6c73 202d 312c 2069 7420 t equals -1, it │ │ │ +0005a080: 6973 206e 6f74 2075 7365 642e 204f 7468 is not used. Oth │ │ │ +0005a090: 6572 7769 7365 2061 6c67 6f72 6974 686d erwise algorithm │ │ │ +0005a0a0: 2073 746f 7073 2069 6620 6164 6469 7469 stops if additi │ │ │ +0005a0b0: 6f6e 616c 2061 7265 6120 6973 2067 7265 onal area is gre │ │ │ +0005a0c0: 6174 6572 2074 6861 6e20 636f 6e74 6f75 ater than contou │ │ │ +0005a0d0: 7241 7265 6128 5f63 7572 7665 2920 2a20 rArea(_curve) * │ │ │ +0005a0e0: 7065 7263 656e 7461 6765 2e0a 2049 6620 percentage.. If │ │ │ +0005a0f0: 6164 6469 7469 6f6e 616c 2061 7265 6120 additional area │ │ │ +0005a100: 6578 6365 6564 7320 7468 6520 6c69 6d69 exceeds the limi │ │ │ +0005a110: 742c 2061 6c67 6f72 6974 686d 2072 6574 t, algorithm ret │ │ │ +0005a120: 7572 6e73 2061 7320 6d61 6e79 2076 6572 urns as many ver │ │ │ +0005a130: 7469 6365 7320 6173 2074 6865 7265 2077 tices as there w │ │ │ +0005a140: 6572 6520 6174 2074 6865 206d 6f6d 656e ere at the momen │ │ │ +0005a150: 7420 7468 6520 6c69 6d69 7420 7761 7320 t the limit was │ │ │ +0005a160: 6578 6365 6564 6564 2e3c 2f64 643e 0a3c exceeded.
    .< │ │ │ +0005a170: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ..
  • .
  • .
    .

    mi │ │ │ +0005a1e0: 6e41 7265 6152 6563 743c 2f68 333e 0a3c nAreaRect

    .< │ │ │ +0005a1f0: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +0005a200: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +0005a210: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +0005a220: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +0005a250: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +0005a260: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +0005a270: 726e 2d74 7970 6522 3e3c 6120 6872 6566 rn-type">Rot │ │ │ +0005a2c0: 6174 6564 5265 6374 3c2f 613e 3c2f 7370 atedRect minAreaRect< │ │ │ +0005a300: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(MatOfP │ │ │ +0005a370: 6f69 6e74 3266 3c2f 613e 266e 6273 703b oint2f  │ │ │ +0005a380: 706f 696e 7473 293c 2f73 7061 6e3e 3c2f points).
    Finds a │ │ │ +0005a3b0: 726f 7461 7465 6420 7265 6374 616e 676c rotated rectangl │ │ │ +0005a3c0: 6520 6f66 2074 6865 206d 696e 696d 756d e of the minimum │ │ │ +0005a3d0: 2061 7265 6120 656e 636c 6f73 696e 6720 area enclosing │ │ │ +0005a3e0: 7468 6520 696e 7075 7420 3244 2070 6f69 the input 2D poi │ │ │ +0005a3f0: 6e74 2073 6574 2e0a 0a54 6865 2066 756e nt set...The fun │ │ │ +0005a400: 6374 696f 6e20 6361 6c63 756c 6174 6573 ction calculates │ │ │ +0005a410: 2061 6e64 2072 6574 7572 6e73 2074 6865 and returns the │ │ │ +0005a420: 206d 696e 696d 756d 2d61 7265 6120 626f minimum-area bo │ │ │ +0005a430: 756e 6469 6e67 2072 6563 7461 6e67 6c65 unding rectangle │ │ │ +0005a440: 2028 706f 7373 6962 6c79 2072 6f74 6174 (possibly rotat │ │ │ +0005a450: 6564 2920 666f 7220 610a 7370 6563 6966 ed) for a.specif │ │ │ +0005a460: 6965 6420 706f 696e 7420 7365 742e 2054 ied point set. T │ │ │ +0005a470: 6865 2061 6e67 6c65 206f 6620 726f 7461 he angle of rota │ │ │ +0005a480: 7469 6f6e 2072 6570 7265 7365 6e74 7320 tion represents │ │ │ +0005a490: 7468 6520 616e 676c 6520 6265 7477 6565 the angle betwee │ │ │ +0005a4a0: 6e20 7468 6520 6c69 6e65 2063 6f6e 6e65 n the line conne │ │ │ +0005a4b0: 6374 696e 6720 7468 6520 7374 6172 7469 cting the starti │ │ │ +0005a4c0: 6e67 0a61 6e64 2065 6e64 696e 6720 706f ng.and ending po │ │ │ +0005a4d0: 696e 7473 2028 6261 7365 6420 6f6e 2074 ints (based on t │ │ │ +0005a4e0: 6865 2063 6c6f 636b 7769 7365 206f 7264 he clockwise ord │ │ │ +0005a4f0: 6572 2077 6974 6820 6772 6561 7465 7374 er with greatest │ │ │ +0005a500: 2069 6e64 6578 2066 6f72 2074 6865 2063 index for the c │ │ │ +0005a510: 6f72 6e65 7220 7769 7468 2067 7265 6174 orner with great │ │ │ +0005a520: 6573 7420 5c28 795c 2929 0a61 6e64 2074 est \(y\)).and t │ │ │ +0005a530: 6865 2068 6f72 697a 6f6e 7461 6c20 6178 he horizontal ax │ │ │ +0005a540: 6973 2e20 5468 6973 2061 6e67 6c65 2061 is. This angle a │ │ │ +0005a550: 6c77 6179 7320 6661 6c6c 7320 6265 7477 lways falls betw │ │ │ +0005a560: 6565 6e20 5c28 5b2d 3930 2c20 3029 5c29 een \([-90, 0)\) │ │ │ +0005a570: 2062 6563 6175 7365 2c20 6966 2074 6865 because, if the │ │ │ +0005a580: 206f 626a 6563 740a 726f 7461 7465 7320 object.rotates │ │ │ +0005a590: 6d6f 7265 2074 6861 6e20 6120 7265 6374 more than a rect │ │ │ +0005a5a0: 2061 6e67 6c65 2c20 7468 6520 6e65 7874 angle, the next │ │ │ +0005a5b0: 2065 6467 6520 6973 2075 7365 6420 746f edge is used to │ │ │ +0005a5c0: 206d 6561 7375 7265 2074 6865 2061 6e67 measure the ang │ │ │ +0005a5d0: 6c65 2e20 5468 6520 7374 6172 7469 6e67 le. The starting │ │ │ +0005a5e0: 2061 6e64 2065 6e64 696e 6720 706f 696e and ending poin │ │ │ +0005a5f0: 7473 2063 6861 6e67 650a 6173 2074 6865 ts change.as the │ │ │ +0005a600: 206f 626a 6563 7420 726f 7461 7465 732e object rotates. │ │ │ +0005a610: 4465 7665 6c6f 7065 7220 7368 6f75 6c64 Developer should │ │ │ +0005a620: 206b 6565 7020 696e 206d 696e 6420 7468 keep in mind th │ │ │ +0005a630: 6174 2074 6865 2072 6574 7572 6e65 6420 at the returned │ │ │ +0005a640: 526f 7461 7465 6452 6563 7420 6361 6e20 RotatedRect can │ │ │ +0005a650: 636f 6e74 6169 6e20 6e65 6761 7469 7665 contain negative │ │ │ +0005a660: 0a69 6e64 6963 6573 2077 6865 6e20 6461 .indices when da │ │ │ +0005a670: 7461 2069 7320 636c 6f73 6520 746f 2074 ta is close to t │ │ │ +0005a680: 6865 2063 6f6e 7461 696e 696e 6720 4d61 he containing Ma │ │ │ +0005a690: 7420 656c 656d 656e 7420 626f 756e 6461 t element bounda │ │ │ +0005a6a0: 7279 2e3c 2f64 6976 3e0a 3c64 6c20 636c ry.
    .
    .
    Parameters:
    .
    poin │ │ │ +0005a6e0: 7473 3c2f 636f 6465 3e20 2d20 496e 7075 ts - Inpu │ │ │ +0005a6f0: 7420 7665 6374 6f72 206f 6620 3244 2070 t vector of 2D p │ │ │ +0005a700: 6f69 6e74 732c 2073 746f 7265 6420 696e oints, stored in │ │ │ +0005a710: 2073 7464 3a3a 7665 6374 6f72 266c 743b std::vector< │ │ │ +0005a720: 2667 743b 206f 7220 4d61 743c 2f64 643e > or Mat
    │ │ │ +0005a730: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    automatic │ │ │ +0005a750: 616c 6c79 2067 656e 6572 6174 6564 3c2f ally generated.
    . │ │ │ +0005a770: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
    .
  • .
  • .
    . │ │ │ +0005a7e0: 3c68 333e 626f 7850 6f69 6e74 733c 2f68

    boxPoints.
    .
    public │ │ │ +0005a850: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +0005a860: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;voi │ │ │ +0005a880: 643c 2f73 7061 6e3e 266e 6273 703b 3c73 d boxPoin │ │ │ +0005a8b0: 7473 3c2f 7370 616e 3e3c 7762 723e 3c73 ts(Rota │ │ │ +0005a920: 7465 6452 6563 743c 2f61 3e26 6e62 7370 tedRect  │ │ │ +0005a930: 3b62 6f78 2c0a 203c 6120 6872 6566 3d22 ;box,. Mat  │ │ │ +0005a980: 706f 696e 7473 293c 2f73 7061 6e3e 3c2f points).
    Finds th │ │ │ +0005a9b0: 6520 666f 7572 2076 6572 7469 6365 7320 e four vertices │ │ │ +0005a9c0: 6f66 2061 2072 6f74 6174 6564 2072 6563 of a rotated rec │ │ │ +0005a9d0: 742e 2055 7365 6675 6c20 746f 2064 7261 t. Useful to dra │ │ │ +0005a9e0: 7720 7468 6520 726f 7461 7465 6420 7265 w the rotated re │ │ │ +0005a9f0: 6374 616e 676c 652e 0a0a 5468 6520 6675 ctangle...The fu │ │ │ +0005aa00: 6e63 7469 6f6e 2066 696e 6473 2074 6865 nction finds the │ │ │ +0005aa10: 2066 6f75 7220 7665 7274 6963 6573 206f four vertices o │ │ │ +0005aa20: 6620 6120 726f 7461 7465 6420 7265 6374 f a rotated rect │ │ │ +0005aa30: 616e 676c 652e 2054 6865 2066 6f75 7220 angle. The four │ │ │ +0005aa40: 7665 7274 6963 6573 2061 7265 2072 6574 vertices are ret │ │ │ +0005aa50: 7572 6e65 640a 696e 2063 6c6f 636b 7769 urned.in clockwi │ │ │ +0005aa60: 7365 206f 7264 6572 2073 7461 7274 696e se order startin │ │ │ +0005aa70: 6720 6672 6f6d 2074 6865 2070 6f69 6e74 g from the point │ │ │ +0005aa80: 2077 6974 6820 6772 6561 7465 7374 205c with greatest \ │ │ │ +0005aa90: 2879 5c29 2e20 4966 2074 776f 2070 6f69 (y\). If two poi │ │ │ +0005aaa0: 6e74 7320 6861 7665 2074 6865 0a73 616d nts have the.sam │ │ │ +0005aab0: 6520 5c28 795c 2920 636f 6f72 6469 6e61 e \(y\) coordina │ │ │ +0005aac0: 7465 2074 6865 2072 6967 6874 6d6f 7374 te the rightmost │ │ │ +0005aad0: 2069 7320 7468 6520 7374 6172 7469 6e67 is the starting │ │ │ +0005aae0: 2070 6f69 6e74 2e20 5468 6973 2066 756e point. This fun │ │ │ +0005aaf0: 6374 696f 6e20 6973 2075 7365 6675 6c20 ction is useful │ │ │ +0005ab00: 746f 2064 7261 7720 7468 650a 7265 6374 to draw the.rect │ │ │ +0005ab10: 616e 676c 652e 2049 6e20 432b 2b2c 2069 angle. In C++, i │ │ │ +0005ab20: 6e73 7465 6164 206f 6620 7573 696e 6720 nstead of using │ │ │ +0005ab30: 7468 6973 2066 756e 6374 696f 6e2c 2079 this function, y │ │ │ +0005ab40: 6f75 2063 616e 2064 6972 6563 746c 7920 ou can directly │ │ │ +0005ab50: 7573 6520 526f 7461 7465 6452 6563 743a use RotatedRect: │ │ │ +0005ab60: 3a70 6f69 6e74 7320 6d65 7468 6f64 2e20 :points method. │ │ │ +0005ab70: 506c 6561 7365 0a76 6973 6974 2074 6865 Please.visit the │ │ │ +0005ab80: 2052 4546 3a20 7475 746f 7269 616c 5f62 REF: tutorial_b │ │ │ +0005ab90: 6f75 6e64 696e 675f 726f 7461 7465 645f ounding_rotated_ │ │ │ +0005aba0: 656c 6c69 7073 6573 2022 7475 746f 7269 ellipses "tutori │ │ │ +0005abb0: 616c 206f 6e20 4372 6561 7469 6e67 2042 al on Creating B │ │ │ +0005abc0: 6f75 6e64 696e 6720 726f 7461 7465 6420 ounding rotated │ │ │ +0005abd0: 626f 7865 7320 616e 6420 656c 6c69 7073 boxes and ellips │ │ │ +0005abe0: 6573 0a66 6f72 2063 6f6e 746f 7572 7322 es.for contours" │ │ │ +0005abf0: 2066 6f72 206d 6f72 6520 696e 666f 726d for more inform │ │ │ +0005ac00: 6174 696f 6e2e 3c2f 6469 763e 0a3c 646c ation.
    .
    . │ │ │ +0005ac20: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ +0005ac30: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e62 /dt>.
    b │ │ │ +0005ac40: 6f78 3c2f 636f 6465 3e20 2d20 5468 6520 ox - The │ │ │ +0005ac50: 696e 7075 7420 726f 7461 7465 6420 7265 input rotated re │ │ │ +0005ac60: 6374 616e 676c 652e 2049 7420 6d61 7920 ctangle. It may │ │ │ +0005ac70: 6265 2074 6865 206f 7574 7075 7420 6f66 be the output of │ │ │ +0005ac80: 2052 4546 3a20 6d69 6e41 7265 6152 6563 REF: minAreaRec │ │ │ +0005ac90: 742e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 t.
    .
    points │ │ │ +0005acb0: 2d20 5468 6520 6f75 7470 7574 2061 7272 - The output arr │ │ │ +0005acc0: 6179 206f 6620 666f 7572 2076 6572 7469 ay of four verti │ │ │ +0005acd0: 6365 7320 6f66 2072 6563 7461 6e67 6c65 ces of rectangle │ │ │ +0005ace0: 732e 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f s.
    .
    ..

    . │ │ │ +0005ad00: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..

    minE │ │ │ +0005ad80: 6e63 6c6f 7369 6e67 4369 7263 6c65 3c2f nclosingCircle.
    .
    public │ │ │ +0005adf0: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +0005ae00: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;vo │ │ │ +0005ae20: 6964 3c2f 7370 616e 3e26 6e62 7370 3b3c id < │ │ │ +0005ae30: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +0005ae40: 656e 742d 6e61 6d65 223e 6d69 6e45 6e63 ent-name">minEnc │ │ │ +0005ae50: 6c6f 7369 6e67 4369 7263 6c65 3c2f 7370 losingCircle(MatOfPoin │ │ │ +0005aed0: 7432 663c 2f61 3e26 6e62 7370 3b70 6f69 t2f poi │ │ │ +0005aee0: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. Point&nb │ │ │ +0005af30: 7370 3b63 656e 7465 722c 0a20 666c 6f61 sp;center,. floa │ │ │ +0005af40: 745b 5d26 6e62 7370 3b72 6164 6975 7329 t[] radius) │ │ │ +0005af50: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Finds a circle │ │ │ +0005af80: 6f66 2074 6865 206d 696e 696d 756d 2061 of the minimum a │ │ │ +0005af90: 7265 6120 656e 636c 6f73 696e 6720 6120 rea enclosing a │ │ │ +0005afa0: 3244 2070 6f69 6e74 2073 6574 2e0a 0a54 2D point set...T │ │ │ +0005afb0: 6865 2066 756e 6374 696f 6e20 6669 6e64 he function find │ │ │ +0005afc0: 7320 7468 6520 6d69 6e69 6d61 6c20 656e s the minimal en │ │ │ +0005afd0: 636c 6f73 696e 6720 6369 7263 6c65 206f closing circle o │ │ │ +0005afe0: 6620 6120 3244 2070 6f69 6e74 2073 6574 f a 2D point set │ │ │ +0005aff0: 2075 7369 6e67 2061 6e20 6974 6572 6174 using an iterat │ │ │ +0005b000: 6976 6520 616c 676f 7269 7468 6d2e 3c2f ive algorithm..
    .
    Para │ │ │ +0005b030: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    points - Input vec │ │ │ +0005b060: 746f 7220 6f66 2032 4420 706f 696e 7473 tor of 2D points │ │ │ +0005b070: 2c20 7374 6f72 6564 2069 6e20 7374 643a , stored in std: │ │ │ +0005b080: 3a76 6563 746f 7226 6c74 3b26 6774 3b20 :vector<> │ │ │ +0005b090: 6f72 204d 6174 3c2f 6464 3e0a 3c64 643e or Mat
    .
    │ │ │ +0005b0a0: 3c63 6f64 653e 6365 6e74 6572 3c2f 636f center - Output cen │ │ │ +0005b0c0: 7465 7220 6f66 2074 6865 2063 6972 636c ter of the circl │ │ │ +0005b0d0: 652e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 e.
    .
    radius │ │ │ +0005b0f0: 2d20 4f75 7470 7574 2072 6164 6975 7320 - Output radius │ │ │ +0005b100: 6f66 2074 6865 2063 6972 636c 652e 3c2f of the circle..
    .
    │ │ │ +0005b120: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 ..

  • .
  • .
    .

    minEnclos │ │ │ +0005b1a0: 696e 6754 7269 616e 676c 653c 2f68 333e ingTriangle

    │ │ │ +0005b1b0: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ +0005b1d0: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ +0005b1f0: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ +0005b200: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ +0005b210: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ +0005b220: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;doubl │ │ │ +0005b240: 653c 2f73 7061 6e3e 266e 6273 703b 3c73 e minEncl │ │ │ +0005b270: 6f73 696e 6754 7269 616e 676c 653c 2f73 osingTriangle(M │ │ │ +0005b2e0: 6174 3c2f 613e 266e 6273 703b 706f 696e at poin │ │ │ +0005b2f0: 7473 2c0a 203c 6120 6872 6566 3d22 2e2e ts,. Mat tr │ │ │ +0005b340: 6961 6e67 6c65 293c 2f73 7061 6e3e 3c2f iangle).
    Finds a │ │ │ +0005b370: 7472 6961 6e67 6c65 206f 6620 6d69 6e69 triangle of mini │ │ │ +0005b380: 6d75 6d20 6172 6561 2065 6e63 6c6f 7369 mum area enclosi │ │ │ +0005b390: 6e67 2061 2032 4420 706f 696e 7420 7365 ng a 2D point se │ │ │ +0005b3a0: 7420 616e 6420 7265 7475 726e 7320 6974 t and returns it │ │ │ +0005b3b0: 7320 6172 6561 2e0a 0a54 6865 2066 756e s area...The fun │ │ │ +0005b3c0: 6374 696f 6e20 6669 6e64 7320 6120 7472 ction finds a tr │ │ │ +0005b3d0: 6961 6e67 6c65 206f 6620 6d69 6e69 6d75 iangle of minimu │ │ │ +0005b3e0: 6d20 6172 6561 2065 6e63 6c6f 7369 6e67 m area enclosing │ │ │ +0005b3f0: 2074 6865 2067 6976 656e 2073 6574 206f the given set o │ │ │ +0005b400: 6620 3244 2070 6f69 6e74 7320 616e 6420 f 2D points and │ │ │ +0005b410: 7265 7475 726e 7320 6974 730a 6172 6561 returns its.area │ │ │ +0005b420: 2e20 5468 6520 6f75 7470 7574 2066 6f72 . The output for │ │ │ +0005b430: 2061 2067 6976 656e 2032 4420 706f 696e a given 2D poin │ │ │ +0005b440: 7420 7365 7420 6973 2073 686f 776e 2069 t set is shown i │ │ │ +0005b450: 6e20 7468 6520 696d 6167 6520 6265 6c6f n the image belo │ │ │ +0005b460: 772e 2032 4420 706f 696e 7473 2061 7265 w. 2D points are │ │ │ +0005b470: 2064 6570 6963 7465 6420 696e 0a72 6564 depicted in.red │ │ │ +0005b480: 2a20 616e 6420 7468 6520 656e 636c 6f73 * and the enclos │ │ │ +0005b490: 696e 6720 7472 6961 6e67 6c65 2069 6e20 ing triangle in │ │ │ +0005b4a0: 2a79 656c 6c6f 772a 2e0a 0a21 5b53 616d *yellow*...![Sam │ │ │ +0005b4b0: 706c 6520 6f75 7470 7574 206f 6620 7468 ple output of th │ │ │ +0005b4c0: 6520 6d69 6e69 6d75 6d20 656e 636c 6f73 e minimum enclos │ │ │ +0005b4d0: 696e 6720 7472 6961 6e67 6c65 2066 756e ing triangle fun │ │ │ +0005b4e0: 6374 696f 6e5d 2870 6963 732f 6d69 6e65 ction](pics/mine │ │ │ +0005b4f0: 6e63 6c6f 7369 6e67 7472 6961 6e67 6c65 nclosingtriangle │ │ │ +0005b500: 2e70 6e67 290a 0a54 6865 2069 6d70 6c65 .png)..The imple │ │ │ +0005b510: 6d65 6e74 6174 696f 6e20 6f66 2074 6865 mentation of the │ │ │ +0005b520: 2061 6c67 6f72 6974 686d 2069 7320 6261 algorithm is ba │ │ │ +0005b530: 7365 6420 6f6e 204f 2752 6f75 726b 6527 sed on O'Rourke' │ │ │ +0005b540: 7320 4349 5445 3a20 4f52 6f75 726b 6538 s CITE: ORourke8 │ │ │ +0005b550: 3620 616e 6420 4b6c 6565 2061 6e64 204c 6 and Klee and L │ │ │ +0005b560: 6173 6b6f 7773 6b69 2773 0a43 4954 453a askowski's.CITE: │ │ │ +0005b570: 204b 6c65 654c 6173 6b6f 7773 6b69 3835 KleeLaskowski85 │ │ │ +0005b580: 2070 6170 6572 732e 204f 2752 6f75 726b papers. O'Rourk │ │ │ +0005b590: 6520 7072 6f76 6964 6573 2061 205c 285c e provides a \(\ │ │ │ +0005b5a0: 7468 6574 6128 6e29 5c29 2061 6c67 6f72 theta(n)\) algor │ │ │ +0005b5b0: 6974 686d 2066 6f72 2066 696e 6469 6e67 ithm for finding │ │ │ +0005b5c0: 2074 6865 206d 696e 696d 616c 0a65 6e63 the minimal.enc │ │ │ +0005b5d0: 6c6f 7369 6e67 2074 7269 616e 676c 6520 losing triangle │ │ │ +0005b5e0: 6f66 2061 2032 4420 636f 6e76 6578 2070 of a 2D convex p │ │ │ +0005b5f0: 6f6c 7967 6f6e 2077 6974 6820 6e20 7665 olygon with n ve │ │ │ +0005b600: 7274 6963 6573 2e20 5369 6e63 6520 7468 rtices. Since th │ │ │ +0005b610: 6520 236d 696e 456e 636c 6f73 696e 6754 e #minEnclosingT │ │ │ +0005b620: 7269 616e 676c 6520 6675 6e63 7469 6f6e riangle function │ │ │ +0005b630: 0a74 616b 6573 2061 2032 4420 706f 696e .takes a 2D poin │ │ │ +0005b640: 7420 7365 7420 6173 2069 6e70 7574 2061 t set as input a │ │ │ +0005b650: 6e20 6164 6469 7469 6f6e 616c 2070 7265 n additional pre │ │ │ +0005b660: 7072 6f63 6573 7369 6e67 2073 7465 7020 processing step │ │ │ +0005b670: 6f66 2063 6f6d 7075 7469 6e67 2074 6865 of computing the │ │ │ +0005b680: 2063 6f6e 7665 7820 6875 6c6c 206f 6620 convex hull of │ │ │ +0005b690: 7468 650a 3244 2070 6f69 6e74 2073 6574 the.2D point set │ │ │ +0005b6a0: 2069 7320 7265 7175 6972 6564 2e20 5468 is required. Th │ │ │ +0005b6b0: 6520 636f 6d70 6c65 7869 7479 206f 6620 e complexity of │ │ │ +0005b6c0: 7468 6520 2363 6f6e 7665 7848 756c 6c20 the #convexHull │ │ │ +0005b6d0: 6675 6e63 7469 6f6e 2069 7320 5c28 4f28 function is \(O( │ │ │ +0005b6e0: 6e20 6c6f 6728 6e29 295c 2920 7768 6963 n log(n))\) whic │ │ │ +0005b6f0: 6820 6973 2068 6967 6865 720a 7468 616e h is higher.than │ │ │ +0005b700: 205c 285c 7468 6574 6128 6e29 5c29 2e20 \(\theta(n)\). │ │ │ +0005b710: 5468 7573 2074 6865 206f 7665 7261 6c6c Thus the overall │ │ │ +0005b720: 2063 6f6d 706c 6578 6974 7920 6f66 2074 complexity of t │ │ │ +0005b730: 6865 2066 756e 6374 696f 6e20 6973 205c he function is \ │ │ │ +0005b740: 284f 286e 206c 6f67 286e 2929 5c29 2e3c (O(n log(n))\).< │ │ │ +0005b750: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ +0005b770: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .points - Input ve │ │ │ +0005b7a0: 6374 6f72 206f 6620 3244 2070 6f69 6e74 ctor of 2D point │ │ │ +0005b7b0: 7320 7769 7468 2064 6570 7468 2043 565f s with depth CV_ │ │ │ +0005b7c0: 3332 5320 6f72 2043 565f 3332 462c 2073 32S or CV_32F, s │ │ │ +0005b7d0: 746f 7265 6420 696e 2073 7464 3a3a 7665 tored in std::ve │ │ │ +0005b7e0: 6374 6f72 266c 743b 2667 743b 206f 7220 ctor<> or │ │ │ +0005b7f0: 4d61 743c 2f64 643e 0a3c 6464 3e3c 636f Mat.
    triangle - Output vect │ │ │ +0005b820: 6f72 206f 6620 7468 7265 6520 3244 2070 or of three 2D p │ │ │ +0005b830: 6f69 6e74 7320 6465 6669 6e69 6e67 2074 oints defining t │ │ │ +0005b840: 6865 2076 6572 7469 6365 7320 6f66 2074 he vertices of t │ │ │ +0005b850: 6865 2074 7269 616e 676c 652e 2054 6865 he triangle. The │ │ │ +0005b860: 2064 6570 7468 0a6f 6620 7468 6520 4f75 depth.of the Ou │ │ │ +0005b870: 7470 7574 4172 7261 7920 6d75 7374 2062 tputArray must b │ │ │ +0005b880: 6520 4356 5f33 3246 2e3c 2f64 643e 0a3c e CV_32F.
    .< │ │ │ +0005b890: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ +0005b8a0: 0a3c 6464 3e61 7574 6f6d 6174 6963 616c .
    automatical │ │ │ +0005b8b0: 6c79 2067 656e 6572 6174 6564 3c2f 6464 ly generated
    .
    .
    .< │ │ │ +0005b8d0: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ +0005b8e0: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    mi │ │ │ +0005b950: 6e45 6e63 6c6f 7369 6e67 436f 6e76 6578 nEnclosingConvex │ │ │ +0005b960: 506f 6c79 676f 6e3c 2f68 333e 0a3c 6469 Polygon

    ..public static │ │ │ +0005b9d0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  double
     minEnclosin │ │ │ +0005ba30: 6743 6f6e 7665 7850 6f6c 7967 6f6e 3c2f gConvexPolygon( │ │ │ +0005baa0: 4d61 743c 2f61 3e26 6e62 7370 3b70 6f69 Mat poi │ │ │ +0005bab0: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. Mat p │ │ │ +0005bb00: 6f6c 7967 6f6e 2c0a 2069 6e74 266e 6273 olygon,. int&nbs │ │ │ +0005bb10: 703b 6b29 3c2f 7370 616e 3e3c 2f64 6976 p;k).
    Finds a con │ │ │ +0005bb40: 7665 7820 706f 6c79 676f 6e20 6f66 206d vex polygon of m │ │ │ +0005bb50: 696e 696d 756d 2061 7265 6120 656e 636c inimum area encl │ │ │ +0005bb60: 6f73 696e 6720 6120 3244 2070 6f69 6e74 osing a 2D point │ │ │ +0005bb70: 2073 6574 2061 6e64 2072 6574 7572 6e73 set and returns │ │ │ +0005bb80: 2069 7473 2061 7265 612e 0a0a 5468 6973 its area...This │ │ │ +0005bb90: 2066 756e 6374 696f 6e20 7461 6b65 7320 function takes │ │ │ +0005bba0: 6120 6769 7665 6e20 7365 7420 6f66 2032 a given set of 2 │ │ │ +0005bbb0: 4420 706f 696e 7473 2061 6e64 2066 696e D points and fin │ │ │ +0005bbc0: 6473 2074 6865 2065 6e63 6c6f 7369 6e67 ds the enclosing │ │ │ +0005bbd0: 2070 6f6c 7967 6f6e 2077 6974 6820 6b20 polygon with k │ │ │ +0005bbe0: 7665 7274 6963 6573 2061 6e64 206d 696e vertices and min │ │ │ +0005bbf0: 696d 616c 0a61 7265 612e 2049 7420 7461 imal.area. It ta │ │ │ +0005bc00: 6b65 7320 7468 6520 7365 7420 6f66 2070 kes the set of p │ │ │ +0005bc10: 6f69 6e74 7320 616e 6420 7468 6520 7061 oints and the pa │ │ │ +0005bc20: 7261 6d65 7465 7220 6b20 6173 2069 6e70 rameter k as inp │ │ │ +0005bc30: 7574 2061 6e64 2072 6574 7572 6e73 2074 ut and returns t │ │ │ +0005bc40: 6865 2061 7265 6120 6f66 2074 6865 206d he area of the m │ │ │ +0005bc50: 696e 696d 616c 0a65 6e63 6c6f 7369 6e67 inimal.enclosing │ │ │ +0005bc60: 2070 6f6c 7967 6f6e 2e0a 0a54 6865 2049 polygon...The I │ │ │ +0005bc70: 6d70 6c65 6d65 6e74 6174 696f 6e20 6973 mplementation is │ │ │ +0005bc80: 2062 6173 6564 206f 6e20 6120 7061 7065 based on a pape │ │ │ +0005bc90: 7220 6279 2041 6767 6172 7761 6c2c 2043 r by Aggarwal, C │ │ │ +0005bca0: 6861 6e67 2061 6e64 2059 6170 2043 4954 hang and Yap CIT │ │ │ +0005bcb0: 453a 2041 6767 6172 7761 6c31 3938 352e E: Aggarwal1985. │ │ │ +0005bcc0: 2054 6865 790a 7072 6f76 6964 6520 6120 They.provide a │ │ │ +0005bcd0: 5c28 5c74 6865 7461 286e c2b2 6c6f 6728 \(\theta(n..log( │ │ │ +0005bce0: 6e29 6c6f 6728 6b29 295c 2920 616c 676f n)log(k))\) algo │ │ │ +0005bcf0: 7269 7468 6d20 666f 7220 6669 6e64 696e rithm for findin │ │ │ +0005bd00: 6720 7468 6520 6d69 6e69 6d61 6c20 636f g the minimal co │ │ │ +0005bd10: 6e76 6578 2070 6f6c 7967 6f6e 2077 6974 nvex polygon wit │ │ │ +0005bd20: 6820 6b0a 7665 7274 6963 6573 2065 6e63 h k.vertices enc │ │ │ +0005bd30: 6c6f 7369 6e67 2061 2032 4420 636f 6e76 losing a 2D conv │ │ │ +0005bd40: 6578 2070 6f6c 7967 6f6e 2077 6974 6820 ex polygon with │ │ │ +0005bd50: 6e20 7665 7274 6963 6573 2028 6b20 266c n vertices (k &l │ │ │ +0005bd60: 743b 206e 292e 2053 696e 6365 2074 6865 t; n). Since the │ │ │ +0005bd70: 2023 6d69 6e45 6e63 6c6f 7369 6e67 436f #minEnclosingCo │ │ │ +0005bd80: 6e76 6578 506f 6c79 676f 6e0a 6675 6e63 nvexPolygon.func │ │ │ +0005bd90: 7469 6f6e 2074 616b 6573 2061 2032 4420 tion takes a 2D │ │ │ +0005bda0: 706f 696e 7420 7365 7420 6173 2069 6e70 point set as inp │ │ │ +0005bdb0: 7574 2c20 616e 2061 6464 6974 696f 6e61 ut, an additiona │ │ │ +0005bdc0: 6c20 7072 6570 726f 6365 7373 696e 6720 l preprocessing │ │ │ +0005bdd0: 7374 6570 206f 6620 636f 6d70 7574 696e step of computin │ │ │ +0005bde0: 6720 7468 6520 636f 6e76 6578 2068 756c g the convex hul │ │ │ +0005bdf0: 6c0a 6f66 2074 6865 2032 4420 706f 696e l.of the 2D poin │ │ │ +0005be00: 7420 7365 7420 6973 2072 6571 7569 7265 t set is require │ │ │ +0005be10: 642e 2054 6865 2063 6f6d 706c 6578 6974 d. The complexit │ │ │ +0005be20: 7920 6f66 2074 6865 2023 636f 6e76 6578 y of the #convex │ │ │ +0005be30: 4875 6c6c 2066 756e 6374 696f 6e20 6973 Hull function is │ │ │ +0005be40: 205c 284f 286e 206c 6f67 286e 2929 5c29 \(O(n log(n))\) │ │ │ +0005be50: 2077 6869 6368 0a69 7320 6c6f 7765 7220 which.is lower │ │ │ +0005be60: 7468 616e 205c 285c 7468 6574 6128 6ec2 than \(\theta(n. │ │ │ +0005be70: b26c 6f67 286e 296c 6f67 286b 2929 5c29 .log(n)log(k))\) │ │ │ +0005be80: 2e20 5468 7573 2074 6865 206f 7665 7261 . Thus the overa │ │ │ +0005be90: 6c6c 2063 6f6d 706c 6578 6974 7920 6f66 ll complexity of │ │ │ +0005bea0: 2074 6865 2066 756e 6374 696f 6e20 6973 the function is │ │ │ +0005beb0: 0a5c 284f 286e c2b2 6c6f 6728 6e29 6c6f .\(O(n..log(n)lo │ │ │ +0005bec0: 6728 6b29 295c 292e 3c2f 6469 763e 0a3c g(k))\).
    .< │ │ │ +0005bed0: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ +0005bee0: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ +0005bef0: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    points - │ │ │ +0005bf10: 2049 6e70 7574 2076 6563 746f 7220 6f66 Input vector of │ │ │ +0005bf20: 2032 4420 706f 696e 7473 2c20 7374 6f72 2D points, stor │ │ │ +0005bf30: 6564 2069 6e20 7374 643a 3a76 6563 746f ed in std::vecto │ │ │ +0005bf40: 7226 6c74 3b26 6774 3b20 6f72 204d 6174 r<> or Mat │ │ │ +0005bf50: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +0005bf60: 706f 6c79 676f 6e3c 2f63 6f64 653e 202d polygon - │ │ │ +0005bf70: 204f 7574 7075 7420 7665 6374 6f72 206f Output vector o │ │ │ +0005bf80: 6620 3244 2070 6f69 6e74 7320 6465 6669 f 2D points defi │ │ │ +0005bf90: 6e69 6e67 2074 6865 2076 6572 7469 6365 ning the vertice │ │ │ +0005bfa0: 7320 6f66 2074 6865 2065 6e63 6c6f 7369 s of the enclosi │ │ │ +0005bfb0: 6e67 2070 6f6c 7967 6f6e 3c2f 6464 3e0a ng polygon
    . │ │ │ +0005bfc0: 3c64 643e 3c63 6f64 653e 6b3c 2f63 6f64
    k - Number of v │ │ │ +0005bfe0: 6572 7469 6365 7320 6f66 2074 6865 206f ertices of the o │ │ │ +0005bff0: 7574 7075 7420 706f 6c79 676f 6e3c 2f64 utput polygon.
    Returns:< │ │ │ +0005c010: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
    automat │ │ │ +0005c020: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ +0005c030: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    ...
    ..
  • ..

    │ │ │ +0005c0a0: 6d6f 6d65 6e74 733c 2f68 333e 0a3c 6469 moments

    ..public static │ │ │ +0005c110: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  Moments moments
    (M │ │ │ +0005c210: 6174 3c2f 613e 266e 6273 703b 6172 7261 at arra │ │ │ +0005c220: 792c 0a20 626f 6f6c 6561 6e26 6e62 7370 y,. boolean  │ │ │ +0005c230: 3b62 696e 6172 7949 6d61 6765 293c 2f73 ;binaryImage)
    .
    Ca │ │ │ +0005c260: 6c63 756c 6174 6573 2061 6c6c 206f 6620 lculates all of │ │ │ +0005c270: 7468 6520 6d6f 6d65 6e74 7320 7570 2074 the moments up t │ │ │ +0005c280: 6f20 7468 6520 7468 6972 6420 6f72 6465 o the third orde │ │ │ +0005c290: 7220 6f66 2061 2070 6f6c 7967 6f6e 206f r of a polygon o │ │ │ +0005c2a0: 7220 7261 7374 6572 697a 6564 2073 6861 r rasterized sha │ │ │ +0005c2b0: 7065 2e0a 0a54 6865 2066 756e 6374 696f pe...The functio │ │ │ +0005c2c0: 6e20 636f 6d70 7574 6573 206d 6f6d 656e n computes momen │ │ │ +0005c2d0: 7473 2c20 7570 2074 6f20 7468 6520 3372 ts, up to the 3r │ │ │ +0005c2e0: 6420 6f72 6465 722c 206f 6620 6120 7665 d order, of a ve │ │ │ +0005c2f0: 6374 6f72 2073 6861 7065 206f 7220 6120 ctor shape or a │ │ │ +0005c300: 7261 7374 6572 697a 6564 2073 6861 7065 rasterized shape │ │ │ +0005c310: 2e20 5468 650a 7265 7375 6c74 7320 6172 . The.results ar │ │ │ +0005c320: 6520 7265 7475 726e 6564 2069 6e20 7468 e returned in th │ │ │ +0005c330: 6520 7374 7275 6374 7572 6520 6376 3a3a e structure cv:: │ │ │ +0005c340: 4d6f 6d65 6e74 732e 3c2f 6469 763e 0a3c Moments.
    .< │ │ │ +0005c350: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ +0005c360: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ +0005c370: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    array - │ │ │ +0005c390: 5369 6e67 6c65 2063 6861 6e6e 656c 2072 Single channel r │ │ │ +0005c3a0: 6173 7465 7220 696d 6167 6520 2843 565f aster image (CV_ │ │ │ +0005c3b0: 3855 2c20 4356 5f31 3655 2c20 4356 5f31 8U, CV_16U, CV_1 │ │ │ +0005c3c0: 3653 2c20 4356 5f33 3246 2c20 4356 5f36 6S, CV_32F, CV_6 │ │ │ +0005c3d0: 3446 2920 6f72 2061 6e20 6172 7261 7920 4F) or an array │ │ │ +0005c3e0: 280a 5c28 3120 5c74 696d 6573 204e 5c29 (.\(1 \times N\) │ │ │ +0005c3f0: 206f 7220 5c28 4e20 5c74 696d 6573 2031 or \(N \times 1 │ │ │ +0005c400: 5c29 2029 206f 6620 3244 2070 6f69 6e74 \) ) of 2D point │ │ │ +0005c410: 7320 2850 6f69 6e74 206f 7220 506f 696e s (Point or Poin │ │ │ +0005c420: 7432 6629 2e3c 2f64 643e 0a3c 6464 3e3c t2f).
    .
    < │ │ │ +0005c430: 636f 6465 3e62 696e 6172 7949 6d61 6765 code>binaryImage │ │ │ +0005c440: 3c2f 636f 6465 3e20 2d20 4966 2069 7420 - If it │ │ │ +0005c450: 6973 2074 7275 652c 2061 6c6c 206e 6f6e is true, all non │ │ │ +0005c460: 2d7a 6572 6f20 696d 6167 6520 7069 7865 -zero image pixe │ │ │ +0005c470: 6c73 2061 7265 2074 7265 6174 6564 2061 ls are treated a │ │ │ +0005c480: 7320 3127 732e 2054 6865 2070 6172 616d s 1's. The param │ │ │ +0005c490: 6574 6572 2069 730a 7573 6564 2066 6f72 eter is.used for │ │ │ +0005c4a0: 2069 6d61 6765 7320 6f6e 6c79 2e3c 2f64 images only..
    Returns:< │ │ │ +0005c4c0: 2f64 743e 0a3c 6464 3e6d 6f6d 656e 7473 /dt>.
    moments │ │ │ +0005c4d0: 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 3e20 ...Note: │ │ │ +0005c4e0: 4f6e 6c79 2061 7070 6c69 6361 626c 6520 Only applicable │ │ │ +0005c4f0: 746f 2063 6f6e 746f 7572 206d 6f6d 656e to contour momen │ │ │ +0005c500: 7473 2063 616c 6375 6c61 7469 6f6e 7320 ts calculations │ │ │ +0005c510: 6672 6f6d 2050 7974 686f 6e20 6269 6e64 from Python bind │ │ │ +0005c520: 696e 6773 3a20 4e6f 7465 2074 6861 7420 ings: Note that │ │ │ +0005c530: 7468 6520 6e75 6d70 790a 7479 7065 2066 the numpy.type f │ │ │ +0005c540: 6f72 2074 6865 2069 6e70 7574 2061 7272 or the input arr │ │ │ +0005c550: 6179 2073 686f 756c 6420 6265 2065 6974 ay should be eit │ │ │ +0005c560: 6865 7220 6e70 2e69 6e74 3332 206f 7220 her np.int32 or │ │ │ +0005c570: 6e70 2e66 6c6f 6174 3332 2e0a 0a3c 623e np.float32... │ │ │ +0005c580: 4e6f 7465 3a3c 2f62 3e20 466f 7220 636f Note: For co │ │ │ +0005c590: 6e74 6f75 722d 6261 7365 6420 6d6f 6d65 ntour-based mome │ │ │ +0005c5a0: 6e74 732c 2074 6865 207a 6572 6f74 682d nts, the zeroth- │ │ │ +0005c5b0: 6f72 6465 7220 6d6f 6d65 6e74 205c 6320 order moment \c │ │ │ +0005c5c0: 6d30 3020 7265 7072 6573 656e 7473 0a74 m00 represents.t │ │ │ +0005c5d0: 6865 2063 6f6e 746f 7572 2061 7265 612e he contour area. │ │ │ +0005c5e0: 0a0a 4966 2074 6865 2069 6e70 7574 2063 ..If the input c │ │ │ +0005c5f0: 6f6e 746f 7572 2069 7320 6465 6765 6e65 ontour is degene │ │ │ +0005c600: 7261 7465 2028 666f 7220 6578 616d 706c rate (for exampl │ │ │ +0005c610: 652c 2061 2073 696e 676c 6520 706f 696e e, a single poin │ │ │ +0005c620: 7420 6f72 2061 6c6c 2070 6f69 6e74 730a t or all points. │ │ │ +0005c630: 6172 6520 636f 6c6c 696e 6561 7229 2c20 are collinear), │ │ │ +0005c640: 7468 6520 6172 6561 2069 7320 7a65 726f the area is zero │ │ │ +0005c650: 2061 6e64 2074 6865 7265 666f 7265 205c and therefore \ │ │ │ +0005c660: 6320 6d30 3020 3d3d 2030 2e0a 0a49 6e20 c m00 == 0...In │ │ │ +0005c670: 7468 6973 2063 6173 652c 2074 6865 2063 this case, the c │ │ │ +0005c680: 656e 7472 6f69 6420 636f 6f72 6469 6e61 entroid coordina │ │ │ +0005c690: 7465 7320 285c 6320 6d31 302f 6d30 302c tes (\c m10/m00, │ │ │ +0005c6a0: 205c 6320 6d30 312f 6d30 3029 2061 7265 \c m01/m00) are │ │ │ +0005c6b0: 2075 6e64 6566 696e 6564 0a61 6e64 206d undefined.and m │ │ │ +0005c6c0: 7573 7420 6265 2068 616e 646c 6564 2065 ust be handled e │ │ │ +0005c6d0: 7870 6c69 6369 746c 7920 6279 2074 6865 xplicitly by the │ │ │ +0005c6e0: 2063 616c 6c65 722e 0a0a 4120 636f 6d6d caller...A comm │ │ │ +0005c6f0: 6f6e 2077 6f72 6b61 726f 756e 6420 6973 on workaround is │ │ │ +0005c700: 2074 6f20 636f 6d70 7574 6520 7468 6520 to compute the │ │ │ +0005c710: 6365 6e74 6572 2075 7369 6e67 2063 763a center using cv: │ │ │ +0005c720: 3a62 6f75 6e64 696e 6752 6563 7428 2920 :boundingRect() │ │ │ +0005c730: 6f72 2062 790a 6176 6572 6167 696e 6720 or by.averaging │ │ │ +0005c740: 7468 6520 696e 7075 7420 706f 696e 7473 the input points │ │ │ +0005c750: 2e0a 0a53 4545 3a20 2063 6f6e 746f 7572 ...SEE: contour │ │ │ +0005c760: 4172 6561 2c20 6172 634c 656e 6774 683c Area, arcLength< │ │ │ +0005c770: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.....
  • .
    .

    moments.
    .
    public │ │ │ +0005c840: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +0005c850: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;Moment │ │ │ +0005c8b0: 733c 2f61 3e3c 2f73 7061 6e3e 266e 6273 s&nbs │ │ │ +0005c8c0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;mom │ │ │ +0005c8e0: 656e 7473 3c2f 7370 616e 3e3c 7762 723e ents │ │ │ +0005c8f0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +0005c950: 7370 3b61 7272 6179 293c 2f73 7061 6e3e sp;array) │ │ │ +0005c960: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Calcul │ │ │ +0005c980: 6174 6573 2061 6c6c 206f 6620 7468 6520 ates all of the │ │ │ +0005c990: 6d6f 6d65 6e74 7320 7570 2074 6f20 7468 moments up to th │ │ │ +0005c9a0: 6520 7468 6972 6420 6f72 6465 7220 6f66 e third order of │ │ │ +0005c9b0: 2061 2070 6f6c 7967 6f6e 206f 7220 7261 a polygon or ra │ │ │ +0005c9c0: 7374 6572 697a 6564 2073 6861 7065 2e0a sterized shape.. │ │ │ +0005c9d0: 0a54 6865 2066 756e 6374 696f 6e20 636f .The function co │ │ │ +0005c9e0: 6d70 7574 6573 206d 6f6d 656e 7473 2c20 mputes moments, │ │ │ +0005c9f0: 7570 2074 6f20 7468 6520 3372 6420 6f72 up to the 3rd or │ │ │ +0005ca00: 6465 722c 206f 6620 6120 7665 6374 6f72 der, of a vector │ │ │ +0005ca10: 2073 6861 7065 206f 7220 6120 7261 7374 shape or a rast │ │ │ +0005ca20: 6572 697a 6564 2073 6861 7065 2e20 5468 erized shape. Th │ │ │ +0005ca30: 650a 7265 7375 6c74 7320 6172 6520 7265 e.results are re │ │ │ +0005ca40: 7475 726e 6564 2069 6e20 7468 6520 7374 turned in the st │ │ │ +0005ca50: 7275 6374 7572 6520 6376 3a3a 4d6f 6d65 ructure cv::Mome │ │ │ +0005ca60: 6e74 732e 3c2f 6469 763e 0a3c 646c 2063 nts.
    .
    .Parameters:.
    arr │ │ │ +0005caa0: 6179 3c2f 636f 6465 3e20 2d20 5369 6e67 ay - Sing │ │ │ +0005cab0: 6c65 2063 6861 6e6e 656c 2072 6173 7465 le channel raste │ │ │ +0005cac0: 7220 696d 6167 6520 2843 565f 3855 2c20 r image (CV_8U, │ │ │ +0005cad0: 4356 5f31 3655 2c20 4356 5f31 3653 2c20 CV_16U, CV_16S, │ │ │ +0005cae0: 4356 5f33 3246 2c20 4356 5f36 3446 2920 CV_32F, CV_64F) │ │ │ +0005caf0: 6f72 2061 6e20 6172 7261 7920 280a 5c28 or an array (.\( │ │ │ +0005cb00: 3120 5c74 696d 6573 204e 5c29 206f 7220 1 \times N\) or │ │ │ +0005cb10: 5c28 4e20 5c74 696d 6573 2031 5c29 2029 \(N \times 1\) ) │ │ │ +0005cb20: 206f 6620 3244 2070 6f69 6e74 7320 2850 of 2D points (P │ │ │ +0005cb30: 6f69 6e74 206f 7220 506f 696e 7432 6629 oint or Point2f) │ │ │ +0005cb40: 2e0a 7573 6564 2066 6f72 2069 6d61 6765 ..used for image │ │ │ +0005cb50: 7320 6f6e 6c79 2e3c 2f64 643e 0a3c 6474 s only.
    .
    Returns:
    .< │ │ │ +0005cb70: 6464 3e6d 6f6d 656e 7473 2e0a 0a3c 623e dd>moments... │ │ │ +0005cb80: 4e6f 7465 3a3c 2f62 3e20 4f6e 6c79 2061 Note: Only a │ │ │ +0005cb90: 7070 6c69 6361 626c 6520 746f 2063 6f6e pplicable to con │ │ │ +0005cba0: 746f 7572 206d 6f6d 656e 7473 2063 616c tour moments cal │ │ │ +0005cbb0: 6375 6c61 7469 6f6e 7320 6672 6f6d 2050 culations from P │ │ │ +0005cbc0: 7974 686f 6e20 6269 6e64 696e 6773 3a20 ython bindings: │ │ │ +0005cbd0: 4e6f 7465 2074 6861 7420 7468 6520 6e75 Note that the nu │ │ │ +0005cbe0: 6d70 790a 7479 7065 2066 6f72 2074 6865 mpy.type for the │ │ │ +0005cbf0: 2069 6e70 7574 2061 7272 6179 2073 686f input array sho │ │ │ +0005cc00: 756c 6420 6265 2065 6974 6865 7220 6e70 uld be either np │ │ │ +0005cc10: 2e69 6e74 3332 206f 7220 6e70 2e66 6c6f .int32 or np.flo │ │ │ +0005cc20: 6174 3332 2e0a 0a3c 623e 4e6f 7465 3a3c at32...Note:< │ │ │ +0005cc30: 2f62 3e20 466f 7220 636f 6e74 6f75 722d /b> For contour- │ │ │ +0005cc40: 6261 7365 6420 6d6f 6d65 6e74 732c 2074 based moments, t │ │ │ +0005cc50: 6865 207a 6572 6f74 682d 6f72 6465 7220 he zeroth-order │ │ │ +0005cc60: 6d6f 6d65 6e74 205c 6320 6d30 3020 7265 moment \c m00 re │ │ │ +0005cc70: 7072 6573 656e 7473 0a74 6865 2063 6f6e presents.the con │ │ │ +0005cc80: 746f 7572 2061 7265 612e 0a0a 4966 2074 tour area...If t │ │ │ +0005cc90: 6865 2069 6e70 7574 2063 6f6e 746f 7572 he input contour │ │ │ +0005cca0: 2069 7320 6465 6765 6e65 7261 7465 2028 is degenerate ( │ │ │ +0005ccb0: 666f 7220 6578 616d 706c 652c 2061 2073 for example, a s │ │ │ +0005ccc0: 696e 676c 6520 706f 696e 7420 6f72 2061 ingle point or a │ │ │ +0005ccd0: 6c6c 2070 6f69 6e74 730a 6172 6520 636f ll points.are co │ │ │ +0005cce0: 6c6c 696e 6561 7229 2c20 7468 6520 6172 llinear), the ar │ │ │ +0005ccf0: 6561 2069 7320 7a65 726f 2061 6e64 2074 ea is zero and t │ │ │ +0005cd00: 6865 7265 666f 7265 205c 6320 6d30 3020 herefore \c m00 │ │ │ +0005cd10: 3d3d 2030 2e0a 0a49 6e20 7468 6973 2063 == 0...In this c │ │ │ +0005cd20: 6173 652c 2074 6865 2063 656e 7472 6f69 ase, the centroi │ │ │ +0005cd30: 6420 636f 6f72 6469 6e61 7465 7320 285c d coordinates (\ │ │ │ +0005cd40: 6320 6d31 302f 6d30 302c 205c 6320 6d30 c m10/m00, \c m0 │ │ │ +0005cd50: 312f 6d30 3029 2061 7265 2075 6e64 6566 1/m00) are undef │ │ │ +0005cd60: 696e 6564 0a61 6e64 206d 7573 7420 6265 ined.and must be │ │ │ +0005cd70: 2068 616e 646c 6564 2065 7870 6c69 6369 handled explici │ │ │ +0005cd80: 746c 7920 6279 2074 6865 2063 616c 6c65 tly by the calle │ │ │ +0005cd90: 722e 0a0a 4120 636f 6d6d 6f6e 2077 6f72 r...A common wor │ │ │ +0005cda0: 6b61 726f 756e 6420 6973 2074 6f20 636f karound is to co │ │ │ +0005cdb0: 6d70 7574 6520 7468 6520 6365 6e74 6572 mpute the center │ │ │ +0005cdc0: 2075 7369 6e67 2063 763a 3a62 6f75 6e64 using cv::bound │ │ │ +0005cdd0: 696e 6752 6563 7428 2920 6f72 2062 790a ingRect() or by. │ │ │ +0005cde0: 6176 6572 6167 696e 6720 7468 6520 696e averaging the in │ │ │ +0005cdf0: 7075 7420 706f 696e 7473 2e0a 0a53 4545 put points...SEE │ │ │ +0005ce00: 3a20 2063 6f6e 746f 7572 4172 6561 2c20 : contourArea, │ │ │ +0005ce10: 6172 634c 656e 6774 683c 2f64 643e 0a3c arcLength

  • .< │ │ │ +0005ce20: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>...
  • .
  • .
    .

    H │ │ │ +0005cea0: 754d 6f6d 656e 7473 3c2f 6833 3e0a 3c64 uMoments

    ..public stati │ │ │ +0005cf10: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void HuMoments(M │ │ │ +0005cfd0: 6f6d 656e 7473 3c2f 613e 266e 6273 703b oments  │ │ │ +0005cfe0: 6d2c 0a20 3c61 2068 7265 663d 222e 2e2f m,. │ │ │ +0005d020: 4d61 743c 2f61 3e26 6e62 7370 3b68 7529 Mat hu) │ │ │ +0005d030: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c2f ..
    . │ │ │ +0005d050: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..

    mat │ │ │ +0005d0c0: 6368 5368 6170 6573 3c2f 6833 3e0a 3c64 chShapes

    ..public stati │ │ │ +0005d130: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c double matchShape │ │ │ +0005d190: 733c 2f73 7061 6e3e 3c77 6272 3e3c 7370 s(Mat  │ │ │ +0005d200: 636f 6e74 6f75 7231 2c0a 203c 6120 6872 contour1,. Mat&n │ │ │ +0005d250: 6273 703b 636f 6e74 6f75 7232 2c0a 2069 bsp;contour2,. i │ │ │ +0005d260: 6e74 266e 6273 703b 6d65 7468 6f64 2c0a nt method,. │ │ │ +0005d270: 2064 6f75 626c 6526 6e62 7370 3b70 6172 double par │ │ │ +0005d280: 616d 6574 6572 293c 2f73 7061 6e3e 3c2f ameter).
    Compares │ │ │ +0005d2b0: 2074 776f 2073 6861 7065 732e 0a0a 5468 two shapes...Th │ │ │ +0005d2c0: 6520 6675 6e63 7469 6f6e 2063 6f6d 7061 e function compa │ │ │ +0005d2d0: 7265 7320 7477 6f20 7368 6170 6573 2e20 res two shapes. │ │ │ +0005d2e0: 416c 6c20 7468 7265 6520 696d 706c 656d All three implem │ │ │ +0005d2f0: 656e 7465 6420 6d65 7468 6f64 7320 7573 ented methods us │ │ │ +0005d300: 6520 7468 6520 4875 2069 6e76 6172 6961 e the Hu invaria │ │ │ +0005d310: 6e74 7320 2873 6565 2023 4875 4d6f 6d65 nts (see #HuMome │ │ │ +0005d320: 6e74 7329 3c2f 6469 763e 0a3c 646c 2063 nts)
    .
    .Parameters:.
    con │ │ │ +0005d360: 746f 7572 313c 2f63 6f64 653e 202d 2046 tour1 - F │ │ │ +0005d370: 6972 7374 2063 6f6e 746f 7572 206f 7220 irst contour or │ │ │ +0005d380: 6772 6179 7363 616c 6520 696d 6167 652e grayscale image. │ │ │ +0005d390: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +0005d3a0: 636f 6e74 6f75 7232 3c2f 636f 6465 3e20 contour2 │ │ │ +0005d3b0: 2d20 5365 636f 6e64 2063 6f6e 746f 7572 - Second contour │ │ │ +0005d3c0: 206f 7220 6772 6179 7363 616c 6520 696d or grayscale im │ │ │ +0005d3d0: 6167 652e 3c2f 6464 3e0a 3c64 643e 3c63 age.
    .
    method - Comparison m │ │ │ +0005d400: 6574 686f 642c 2073 6565 2023 5368 6170 ethod, see #Shap │ │ │ +0005d410: 654d 6174 6368 4d6f 6465 733c 2f64 643e eMatchModes
    │ │ │ +0005d420: 0a3c 6464 3e3c 636f 6465 3e70 6172 616d .
    param │ │ │ +0005d430: 6574 6572 3c2f 636f 6465 3e20 2d20 4d65 eter - Me │ │ │ +0005d440: 7468 6f64 2d73 7065 6369 6669 6320 7061 thod-specific pa │ │ │ +0005d450: 7261 6d65 7465 7220 286e 6f74 2073 7570 rameter (not sup │ │ │ +0005d460: 706f 7274 6564 206e 6f77 292e 3c2f 6464 ported now).
    .
    Returns:.
    automati │ │ │ +0005d490: 6361 6c6c 7920 6765 6e65 7261 7465 643c cally generated< │ │ │ +0005d4a0: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    ....
  • .
    .convexHull.
    .
    │ │ │ +0005d580: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +0005d5a0: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +0005d5b0: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;void │ │ │ +0005d5d0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  convexHu │ │ │ +0005d600: 6c6c 3c2f 7370 616e 3e3c 7762 723e 3c73 ll(MatOf │ │ │ +0005d670: 506f 696e 743c 2f61 3e26 6e62 7370 3b70 Point p │ │ │ +0005d680: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. MatOfIn │ │ │ +0005d6d0: 743c 2f61 3e26 6e62 7370 3b68 756c 6c2c t hull, │ │ │ +0005d6e0: 0a20 626f 6f6c 6561 6e26 6e62 7370 3b63 . boolean c │ │ │ +0005d6f0: 6c6f 636b 7769 7365 293c 2f73 7061 6e3e lockwise) │ │ │ +0005d700: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Finds │ │ │ +0005d720: 7468 6520 636f 6e76 6578 2068 756c 6c20 the convex hull │ │ │ +0005d730: 6f66 2061 2070 6f69 6e74 2073 6574 2e0a of a point set.. │ │ │ +0005d740: 0a54 6865 2066 756e 6374 696f 6e20 6376 .The function cv │ │ │ +0005d750: 3a3a 636f 6e76 6578 4875 6c6c 2066 696e ::convexHull fin │ │ │ +0005d760: 6473 2074 6865 2063 6f6e 7665 7820 6875 ds the convex hu │ │ │ +0005d770: 6c6c 206f 6620 6120 3244 2070 6f69 6e74 ll of a 2D point │ │ │ +0005d780: 2073 6574 2075 7369 6e67 2074 6865 2053 set using the S │ │ │ +0005d790: 6b6c 616e 736b 7927 7320 616c 676f 7269 klansky's algori │ │ │ +0005d7a0: 7468 6d20 4349 5445 3a20 536b 6c61 6e73 thm CITE: Sklans │ │ │ +0005d7b0: 6b79 3832 0a74 6861 7420 6861 7320 2a4f ky82.that has *O │ │ │ +0005d7c0: 284e 206c 6f67 4e29 2a20 636f 6d70 6c65 (N logN)* comple │ │ │ +0005d7d0: 7869 7479 2069 6e20 7468 6520 6375 7272 xity in the curr │ │ │ +0005d7e0: 656e 7420 696d 706c 656d 656e 7461 7469 ent implementati │ │ │ +0005d7f0: 6f6e 2e3c 2f64 6976 3e0a 3c64 6c20 636c on.
    .
    .
    Parameters:
    .
    poin │ │ │ +0005d830: 7473 3c2f 636f 6465 3e20 2d20 496e 7075 ts - Inpu │ │ │ +0005d840: 7420 3244 2070 6f69 6e74 2073 6574 2c20 t 2D point set, │ │ │ +0005d850: 7374 6f72 6564 2069 6e20 7374 643a 3a76 stored in std::v │ │ │ +0005d860: 6563 746f 7220 6f72 204d 6174 2e3c 2f64 ector or Mat..
    hul │ │ │ +0005d880: 6c3c 2f63 6f64 653e 202d 204f 7574 7075 l - Outpu │ │ │ +0005d890: 7420 636f 6e76 6578 2068 756c 6c2e 2049 t convex hull. I │ │ │ +0005d8a0: 7420 6973 2065 6974 6865 7220 616e 2069 t is either an i │ │ │ +0005d8b0: 6e74 6567 6572 2076 6563 746f 7220 6f66 nteger vector of │ │ │ +0005d8c0: 2069 6e64 6963 6573 206f 7220 7665 6374 indices or vect │ │ │ +0005d8d0: 6f72 206f 6620 706f 696e 7473 2e20 496e or of points. In │ │ │ +0005d8e0: 0a74 6865 2066 6972 7374 2063 6173 652c .the first case, │ │ │ +0005d8f0: 2074 6865 2068 756c 6c20 656c 656d 656e the hull elemen │ │ │ +0005d900: 7473 2061 7265 2030 2d62 6173 6564 2069 ts are 0-based i │ │ │ +0005d910: 6e64 6963 6573 206f 6620 7468 6520 636f ndices of the co │ │ │ +0005d920: 6e76 6578 2068 756c 6c20 706f 696e 7473 nvex hull points │ │ │ +0005d930: 2069 6e20 7468 6520 6f72 6967 696e 616c in the original │ │ │ +0005d940: 0a61 7272 6179 2028 7369 6e63 6520 7468 .array (since th │ │ │ +0005d950: 6520 7365 7420 6f66 2063 6f6e 7665 7820 e set of convex │ │ │ +0005d960: 6875 6c6c 2070 6f69 6e74 7320 6973 2061 hull points is a │ │ │ +0005d970: 2073 7562 7365 7420 6f66 2074 6865 206f subset of the o │ │ │ +0005d980: 7269 6769 6e61 6c20 706f 696e 7420 7365 riginal point se │ │ │ +0005d990: 7429 2e20 496e 2074 6865 2073 6563 6f6e t). In the secon │ │ │ +0005d9a0: 640a 6361 7365 2c20 6875 6c6c 2065 6c65 d.case, hull ele │ │ │ +0005d9b0: 6d65 6e74 7320 6172 6520 7468 6520 636f ments are the co │ │ │ +0005d9c0: 6e76 6578 2068 756c 6c20 706f 696e 7473 nvex hull points │ │ │ +0005d9d0: 2074 6865 6d73 656c 7665 732e 3c2f 6464 themselves.
    .
    cloc │ │ │ +0005d9f0: 6b77 6973 653c 2f63 6f64 653e 202d 204f kwise - O │ │ │ +0005da00: 7269 656e 7461 7469 6f6e 2066 6c61 672e rientation flag. │ │ │ +0005da10: 2049 6620 6974 2069 7320 7472 7565 2c20 If it is true, │ │ │ +0005da20: 7468 6520 6f75 7470 7574 2063 6f6e 7665 the output conve │ │ │ +0005da30: 7820 6875 6c6c 2069 7320 6f72 6965 6e74 x hull is orient │ │ │ +0005da40: 6564 2063 6c6f 636b 7769 7365 2e0a 4f74 ed clockwise..Ot │ │ │ +0005da50: 6865 7277 6973 652c 2069 7420 6973 206f herwise, it is o │ │ │ +0005da60: 7269 656e 7465 6420 636f 756e 7465 722d riented counter- │ │ │ +0005da70: 636c 6f63 6b77 6973 652e 2054 6865 2061 clockwise. The a │ │ │ +0005da80: 7373 756d 6564 2063 6f6f 7264 696e 6174 ssumed coordinat │ │ │ +0005da90: 6520 7379 7374 656d 2068 6173 2069 7473 e system has its │ │ │ +0005daa0: 2058 2061 7869 7320 706f 696e 7469 6e67 X axis pointing │ │ │ +0005dab0: 0a74 6f20 7468 6520 7269 6768 742c 2061 .to the right, a │ │ │ +0005dac0: 6e64 2069 7473 2059 2061 7869 7320 706f nd its Y axis po │ │ │ +0005dad0: 696e 7469 6e67 2075 7077 6172 6473 2e0a inting upwards.. │ │ │ +0005dae0: 7265 7475 726e 7320 636f 6e76 6578 2068 returns convex h │ │ │ +0005daf0: 756c 6c20 706f 696e 7473 2e20 4f74 6865 ull points. Othe │ │ │ +0005db00: 7277 6973 652c 2069 7420 7265 7475 726e rwise, it return │ │ │ +0005db10: 7320 696e 6469 6365 7320 6f66 2074 6865 s indices of the │ │ │ +0005db20: 2063 6f6e 7665 7820 6875 6c6c 2070 6f69 convex hull poi │ │ │ +0005db30: 6e74 732e 2057 6865 6e20 7468 650a 6f75 nts. When the.ou │ │ │ +0005db40: 7470 7574 2061 7272 6179 2069 7320 7374 tput array is st │ │ │ +0005db50: 643a 3a76 6563 746f 722c 2074 6865 2066 d::vector, the f │ │ │ +0005db60: 6c61 6720 6973 2069 676e 6f72 6564 2c20 lag is ignored, │ │ │ +0005db70: 616e 6420 7468 6520 6f75 7470 7574 2064 and the output d │ │ │ +0005db80: 6570 656e 6473 206f 6e20 7468 6520 7479 epends on the ty │ │ │ +0005db90: 7065 206f 6620 7468 650a 7665 6374 6f72 pe of the.vector │ │ │ +0005dba0: 3a20 7374 643a 3a76 6563 746f 7226 6c74 : std::vector< │ │ │ +0005dbb0: 3b69 6e74 2667 743b 2069 6d70 6c69 6573 ;int> implies │ │ │ +0005dbc0: 2072 6574 7572 6e50 6f69 6e74 733d 6661 returnPoints=fa │ │ │ +0005dbd0: 6c73 652c 2073 7464 3a3a 7665 6374 6f72 lse, std::vector │ │ │ +0005dbe0: 266c 743b 506f 696e 7426 6774 3b20 696d <Point> im │ │ │ +0005dbf0: 706c 6965 730a 7265 7475 726e 506f 696e plies.returnPoin │ │ │ +0005dc00: 7473 3d74 7275 652e 0a0a 3c62 3e4e 6f74 ts=true...Not │ │ │ +0005dc10: 653a 3c2f 623e 203c 636f 6465 3e70 6f69 e: poi │ │ │ +0005dc20: 6e74 733c 2f63 6f64 653e 2061 6e64 203c nts and < │ │ │ +0005dc30: 636f 6465 3e68 756c 6c3c 2f63 6f64 653e code>hull │ │ │ +0005dc40: 2073 686f 756c 6420 6265 2064 6966 6665 should be diffe │ │ │ +0005dc50: 7265 6e74 2061 7272 6179 732c 2069 6e70 rent arrays, inp │ │ │ +0005dc60: 6c61 6365 2070 726f 6365 7373 696e 6720 lace processing │ │ │ +0005dc70: 6973 6e27 7420 7375 7070 6f72 7465 642e isn't supported. │ │ │ +0005dc80: 0a0a 4368 6563 6b20 5245 463a 2074 7574 ..Check REF: tut │ │ │ +0005dc90: 6f72 6961 6c5f 6875 6c6c 2022 7468 6520 orial_hull "the │ │ │ +0005dca0: 636f 7272 6573 706f 6e64 696e 6720 7475 corresponding tu │ │ │ +0005dcb0: 746f 7269 616c 2220 666f 7220 6d6f 7265 torial" for more │ │ │ +0005dcc0: 2064 6574 6169 6c73 2e0a 0a75 7365 6675 details...usefu │ │ │ +0005dcd0: 6c20 6c69 6e6b 733a 0a0a 6874 7470 733a l links:..https: │ │ │ +0005dce0: 2f2f 7777 772e 6c65 6172 6e6f 7065 6e63 //www.learnopenc │ │ │ +0005dcf0: 762e 636f 6d2f 636f 6e76 6578 2d68 756c v.com/convex-hul │ │ │ +0005dd00: 6c2d 7573 696e 672d 6f70 656e 6376 2d69 l-using-opencv-i │ │ │ +0005dd10: 6e2d 7079 7468 6f6e 2d61 6e64 2d63 2f3c n-python-and-c/< │ │ │ +0005dd20: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .
    ..
  • .
    .

    convex │ │ │ +0005ddb0: 4875 6c6c 3c2f 6833 3e0a 3c64 6976 2063 Hull

    .
    .
    │ │ │ +0005de10: 7075 626c 6963 2073 7461 7469 633c 2f73 public static void& │ │ │ +0005de50: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ +0005de70: 636f 6e76 6578 4875 6c6c 3c2f 7370 616e convexHull( │ │ │ +0005dea0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfPoint points,. │ │ │ +0005df00: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfInt&nb │ │ │ +0005df50: 7370 3b68 756c 6c29 3c2f 7370 616e 3e3c sp;hull)< │ │ │ +0005df60: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Finds t │ │ │ +0005df80: 6865 2063 6f6e 7665 7820 6875 6c6c 206f he convex hull o │ │ │ +0005df90: 6620 6120 706f 696e 7420 7365 742e 0a0a f a point set... │ │ │ +0005dfa0: 5468 6520 6675 6e63 7469 6f6e 2063 763a The function cv: │ │ │ +0005dfb0: 3a63 6f6e 7665 7848 756c 6c20 6669 6e64 :convexHull find │ │ │ +0005dfc0: 7320 7468 6520 636f 6e76 6578 2068 756c s the convex hul │ │ │ +0005dfd0: 6c20 6f66 2061 2032 4420 706f 696e 7420 l of a 2D point │ │ │ +0005dfe0: 7365 7420 7573 696e 6720 7468 6520 536b set using the Sk │ │ │ +0005dff0: 6c61 6e73 6b79 2773 2061 6c67 6f72 6974 lansky's algorit │ │ │ +0005e000: 686d 2043 4954 453a 2053 6b6c 616e 736b hm CITE: Sklansk │ │ │ +0005e010: 7938 320a 7468 6174 2068 6173 202a 4f28 y82.that has *O( │ │ │ +0005e020: 4e20 6c6f 674e 292a 2063 6f6d 706c 6578 N logN)* complex │ │ │ +0005e030: 6974 7920 696e 2074 6865 2063 7572 7265 ity in the curre │ │ │ +0005e040: 6e74 2069 6d70 6c65 6d65 6e74 6174 696f nt implementatio │ │ │ +0005e050: 6e2e 3c2f 6469 763e 0a3c 646c 2063 6c61 n.
    .
    .
    │ │ │ +0005e070: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ +0005e080: 0a3c 6464 3e3c 636f 6465 3e70 6f69 6e74 .
    point │ │ │ +0005e090: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ +0005e0a0: 2032 4420 706f 696e 7420 7365 742c 2073 2D point set, s │ │ │ +0005e0b0: 746f 7265 6420 696e 2073 7464 3a3a 7665 tored in std::ve │ │ │ +0005e0c0: 6374 6f72 206f 7220 4d61 742e 3c2f 6464 ctor or Mat.
    .
    hull │ │ │ +0005e0e0: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +0005e0f0: 2063 6f6e 7665 7820 6875 6c6c 2e20 4974 convex hull. It │ │ │ +0005e100: 2069 7320 6569 7468 6572 2061 6e20 696e is either an in │ │ │ +0005e110: 7465 6765 7220 7665 6374 6f72 206f 6620 teger vector of │ │ │ +0005e120: 696e 6469 6365 7320 6f72 2076 6563 746f indices or vecto │ │ │ +0005e130: 7220 6f66 2070 6f69 6e74 732e 2049 6e0a r of points. In. │ │ │ +0005e140: 7468 6520 6669 7273 7420 6361 7365 2c20 the first case, │ │ │ +0005e150: 7468 6520 6875 6c6c 2065 6c65 6d65 6e74 the hull element │ │ │ +0005e160: 7320 6172 6520 302d 6261 7365 6420 696e s are 0-based in │ │ │ +0005e170: 6469 6365 7320 6f66 2074 6865 2063 6f6e dices of the con │ │ │ +0005e180: 7665 7820 6875 6c6c 2070 6f69 6e74 7320 vex hull points │ │ │ +0005e190: 696e 2074 6865 206f 7269 6769 6e61 6c0a in the original. │ │ │ +0005e1a0: 6172 7261 7920 2873 696e 6365 2074 6865 array (since the │ │ │ +0005e1b0: 2073 6574 206f 6620 636f 6e76 6578 2068 set of convex h │ │ │ +0005e1c0: 756c 6c20 706f 696e 7473 2069 7320 6120 ull points is a │ │ │ +0005e1d0: 7375 6273 6574 206f 6620 7468 6520 6f72 subset of the or │ │ │ +0005e1e0: 6967 696e 616c 2070 6f69 6e74 2073 6574 iginal point set │ │ │ +0005e1f0: 292e 2049 6e20 7468 6520 7365 636f 6e64 ). In the second │ │ │ +0005e200: 0a63 6173 652c 2068 756c 6c20 656c 656d .case, hull elem │ │ │ +0005e210: 656e 7473 2061 7265 2074 6865 2063 6f6e ents are the con │ │ │ +0005e220: 7665 7820 6875 6c6c 2070 6f69 6e74 7320 vex hull points │ │ │ +0005e230: 7468 656d 7365 6c76 6573 2e0a 4f74 6865 themselves..Othe │ │ │ +0005e240: 7277 6973 652c 2069 7420 6973 206f 7269 rwise, it is ori │ │ │ +0005e250: 656e 7465 6420 636f 756e 7465 722d 636c ented counter-cl │ │ │ +0005e260: 6f63 6b77 6973 652e 2054 6865 2061 7373 ockwise. The ass │ │ │ +0005e270: 756d 6564 2063 6f6f 7264 696e 6174 6520 umed coordinate │ │ │ +0005e280: 7379 7374 656d 2068 6173 2069 7473 2058 system has its X │ │ │ +0005e290: 2061 7869 7320 706f 696e 7469 6e67 0a74 axis pointing.t │ │ │ +0005e2a0: 6f20 7468 6520 7269 6768 742c 2061 6e64 o the right, and │ │ │ +0005e2b0: 2069 7473 2059 2061 7869 7320 706f 696e its Y axis poin │ │ │ +0005e2c0: 7469 6e67 2075 7077 6172 6473 2e0a 7265 ting upwards..re │ │ │ +0005e2d0: 7475 726e 7320 636f 6e76 6578 2068 756c turns convex hul │ │ │ +0005e2e0: 6c20 706f 696e 7473 2e20 4f74 6865 7277 l points. Otherw │ │ │ +0005e2f0: 6973 652c 2069 7420 7265 7475 726e 7320 ise, it returns │ │ │ +0005e300: 696e 6469 6365 7320 6f66 2074 6865 2063 indices of the c │ │ │ +0005e310: 6f6e 7665 7820 6875 6c6c 2070 6f69 6e74 onvex hull point │ │ │ +0005e320: 732e 2057 6865 6e20 7468 650a 6f75 7470 s. When the.outp │ │ │ +0005e330: 7574 2061 7272 6179 2069 7320 7374 643a ut array is std: │ │ │ +0005e340: 3a76 6563 746f 722c 2074 6865 2066 6c61 :vector, the fla │ │ │ +0005e350: 6720 6973 2069 676e 6f72 6564 2c20 616e g is ignored, an │ │ │ +0005e360: 6420 7468 6520 6f75 7470 7574 2064 6570 d the output dep │ │ │ +0005e370: 656e 6473 206f 6e20 7468 6520 7479 7065 ends on the type │ │ │ +0005e380: 206f 6620 7468 650a 7665 6374 6f72 3a20 of the.vector: │ │ │ +0005e390: 7374 643a 3a76 6563 746f 7226 6c74 3b69 std::vector<i │ │ │ +0005e3a0: 6e74 2667 743b 2069 6d70 6c69 6573 2072 nt> implies r │ │ │ +0005e3b0: 6574 7572 6e50 6f69 6e74 733d 6661 6c73 eturnPoints=fals │ │ │ +0005e3c0: 652c 2073 7464 3a3a 7665 6374 6f72 266c e, std::vector&l │ │ │ +0005e3d0: 743b 506f 696e 7426 6774 3b20 696d 706c t;Point> impl │ │ │ +0005e3e0: 6965 730a 7265 7475 726e 506f 696e 7473 ies.returnPoints │ │ │ +0005e3f0: 3d74 7275 652e 0a0a 3c62 3e4e 6f74 653a =true...Note: │ │ │ +0005e400: 3c2f 623e 203c 636f 6465 3e70 6f69 6e74 point │ │ │ +0005e410: 733c 2f63 6f64 653e 2061 6e64 203c 636f s and hull s │ │ │ +0005e430: 686f 756c 6420 6265 2064 6966 6665 7265 hould be differe │ │ │ +0005e440: 6e74 2061 7272 6179 732c 2069 6e70 6c61 nt arrays, inpla │ │ │ +0005e450: 6365 2070 726f 6365 7373 696e 6720 6973 ce processing is │ │ │ +0005e460: 6e27 7420 7375 7070 6f72 7465 642e 0a0a n't supported... │ │ │ +0005e470: 4368 6563 6b20 5245 463a 2074 7574 6f72 Check REF: tutor │ │ │ +0005e480: 6961 6c5f 6875 6c6c 2022 7468 6520 636f ial_hull "the co │ │ │ +0005e490: 7272 6573 706f 6e64 696e 6720 7475 746f rresponding tuto │ │ │ +0005e4a0: 7269 616c 2220 666f 7220 6d6f 7265 2064 rial" for more d │ │ │ +0005e4b0: 6574 6169 6c73 2e0a 0a75 7365 6675 6c20 etails...useful │ │ │ +0005e4c0: 6c69 6e6b 733a 0a0a 6874 7470 733a 2f2f links:..https:// │ │ │ +0005e4d0: 7777 772e 6c65 6172 6e6f 7065 6e63 762e www.learnopencv. │ │ │ +0005e4e0: 636f 6d2f 636f 6e76 6578 2d68 756c 6c2d com/convex-hull- │ │ │ +0005e4f0: 7573 696e 672d 6f70 656e 6376 2d69 6e2d using-opencv-in- │ │ │ +0005e500: 7079 7468 6f6e 2d61 6e64 2d63 2f3c 2f64 python-and-c/.
    .
    . │ │ │ +0005e520: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e
    .
  • │ │ │ +0005e530: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    convexit │ │ │ +0005e5c0: 7944 6566 6563 7473 3c2f 6833 3e0a 3c64 yDefects

    ..public stati │ │ │ +0005e630: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void convexityDef │ │ │ +0005e690: 6563 7473 3c2f 7370 616e 3e3c 7762 723e ects │ │ │ +0005e6a0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat │ │ │ +0005e700: 4f66 506f 696e 743c 2f61 3e26 6e62 7370 OfPoint  │ │ │ +0005e710: 3b63 6f6e 746f 7572 2c0a 203c 6120 6872 ;contour,. MatO │ │ │ +0005e760: 6649 6e74 3c2f 613e 266e 6273 703b 636f fInt co │ │ │ +0005e770: 6e76 6578 6875 6c6c 2c0a 203c 6120 6872 nvexhull,. Mat │ │ │ +0005e7c0: 4f66 496e 7434 3c2f 613e 266e 6273 703b OfInt4  │ │ │ +0005e7d0: 636f 6e76 6578 6974 7944 6566 6563 7473 convexityDefects │ │ │ +0005e7e0: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c ).< │ │ │ +0005e7f0: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ +0005e800: 223e 4669 6e64 7320 7468 6520 636f 6e76 ">Finds the conv │ │ │ +0005e810: 6578 6974 7920 6465 6665 6374 7320 6f66 exity defects of │ │ │ +0005e820: 2061 2063 6f6e 746f 7572 2e0a 0a54 6865 a contour...The │ │ │ +0005e830: 2066 6967 7572 6520 6265 6c6f 7720 6469 figure below di │ │ │ +0005e840: 7370 6c61 7973 2063 6f6e 7665 7869 7479 splays convexity │ │ │ +0005e850: 2064 6566 6563 7473 206f 6620 6120 6861 defects of a ha │ │ │ +0005e860: 6e64 2063 6f6e 746f 7572 3a0a 0a21 5b69 nd contour:..![i │ │ │ +0005e870: 6d61 6765 5d28 7069 6373 2f64 6566 6563 mage](pics/defec │ │ │ +0005e880: 7473 2e70 6e67 293c 2f64 6976 3e0a 3c64 ts.png). │ │ │ +0005e8a0: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +0005e8b0: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +0005e8c0: 636f 6e74 6f75 723c 2f63 6f64 653e 202d contour - │ │ │ +0005e8d0: 2049 6e70 7574 2063 6f6e 746f 7572 2e3c Input contour.< │ │ │ +0005e8e0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ +0005e8f0: 6f6e 7665 7868 756c 6c3c 2f63 6f64 653e onvexhull │ │ │ +0005e900: 202d 2043 6f6e 7665 7820 6875 6c6c 206f - Convex hull o │ │ │ +0005e910: 6274 6169 6e65 6420 7573 696e 6720 636f btained using co │ │ │ +0005e920: 6e76 6578 4875 6c6c 2074 6861 7420 7368 nvexHull that sh │ │ │ +0005e930: 6f75 6c64 2063 6f6e 7461 696e 2069 6e64 ould contain ind │ │ │ +0005e940: 6963 6573 206f 6620 7468 6520 636f 6e74 ices of the cont │ │ │ +0005e950: 6f75 720a 706f 696e 7473 2074 6861 7420 our.points that │ │ │ +0005e960: 6d61 6b65 2074 6865 2068 756c 6c2e 3c2f make the hull..
    co │ │ │ +0005e980: 6e76 6578 6974 7944 6566 6563 7473 3c2f nvexityDefects - The outp │ │ │ +0005e9a0: 7574 2076 6563 746f 7220 6f66 2063 6f6e ut vector of con │ │ │ +0005e9b0: 7665 7869 7479 2064 6566 6563 7473 2e20 vexity defects. │ │ │ +0005e9c0: 496e 2043 2b2b 2061 6e64 2074 6865 206e In C++ and the n │ │ │ +0005e9d0: 6577 2050 7974 686f 6e2f 4a61 7661 0a69 ew Python/Java.i │ │ │ +0005e9e0: 6e74 6572 6661 6365 2065 6163 6820 636f nterface each co │ │ │ +0005e9f0: 6e76 6578 6974 7920 6465 6665 6374 2069 nvexity defect i │ │ │ +0005ea00: 7320 7265 7072 6573 656e 7465 6420 6173 s represented as │ │ │ +0005ea10: 2034 2d65 6c65 6d65 6e74 2069 6e74 6567 4-element integ │ │ │ +0005ea20: 6572 2076 6563 746f 7220 2861 2e6b 2e61 er vector (a.k.a │ │ │ +0005ea30: 2e20 2356 6563 3469 293a 0a28 7374 6172 . #Vec4i):.(star │ │ │ +0005ea40: 745f 696e 6465 782c 2065 6e64 5f69 6e64 t_index, end_ind │ │ │ +0005ea50: 6578 2c20 6661 7274 6865 7374 5f70 745f ex, farthest_pt_ │ │ │ +0005ea60: 696e 6465 782c 2066 6978 7074 5f64 6570 index, fixpt_dep │ │ │ +0005ea70: 7468 292c 2077 6865 7265 2069 6e64 6963 th), where indic │ │ │ +0005ea80: 6573 2061 7265 2030 2d62 6173 6564 2069 es are 0-based i │ │ │ +0005ea90: 6e64 6963 6573 0a69 6e20 7468 6520 6f72 ndices.in the or │ │ │ +0005eaa0: 6967 696e 616c 2063 6f6e 746f 7572 206f iginal contour o │ │ │ +0005eab0: 6620 7468 6520 636f 6e76 6578 6974 7920 f the convexity │ │ │ +0005eac0: 6465 6665 6374 2062 6567 696e 6e69 6e67 defect beginning │ │ │ +0005ead0: 2c20 656e 6420 616e 6420 7468 6520 6661 , end and the fa │ │ │ +0005eae0: 7274 6865 7374 2070 6f69 6e74 2c20 616e rthest point, an │ │ │ +0005eaf0: 640a 6669 7870 745f 6465 7074 6820 6973 d.fixpt_depth is │ │ │ +0005eb00: 2066 6978 6564 2d70 6f69 6e74 2061 7070 fixed-point app │ │ │ +0005eb10: 726f 7869 6d61 7469 6f6e 2028 7769 7468 roximation (with │ │ │ +0005eb20: 2038 2066 7261 6374 696f 6e61 6c20 6269 8 fractional bi │ │ │ +0005eb30: 7473 2920 6f66 2074 6865 2064 6973 7461 ts) of the dista │ │ │ +0005eb40: 6e63 6520 6265 7477 6565 6e20 7468 650a nce between the. │ │ │ +0005eb50: 6661 7274 6865 7374 2063 6f6e 746f 7572 farthest contour │ │ │ +0005eb60: 2070 6f69 6e74 2061 6e64 2074 6865 2068 point and the h │ │ │ +0005eb70: 756c 6c2e 2054 6861 7420 6973 2c20 746f ull. That is, to │ │ │ +0005eb80: 2067 6574 2074 6865 2066 6c6f 6174 696e get the floatin │ │ │ +0005eb90: 672d 706f 696e 7420 7661 6c75 6520 6f66 g-point value of │ │ │ +0005eba0: 2074 6865 2064 6570 7468 2077 696c 6c20 the depth will │ │ │ +0005ebb0: 6265 0a66 6978 7074 5f64 6570 7468 2f32 be.fixpt_depth/2 │ │ │ +0005ebc0: 3536 2e30 2e3c 2f64 643e 0a3c 2f64 6c3e 56.0.
    . │ │ │ +0005ebd0: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f ...
  • .
  • ..

    isCo │ │ │ +0005ec40: 6e74 6f75 7243 6f6e 7665 783c 2f68 333e ntourConvex

    │ │ │ +0005ec50: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ +0005ec70: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ +0005ec90: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ +0005eca0: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ +0005ecb0: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ +0005ecc0: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;boole │ │ │ +0005ece0: 616e 3c2f 7370 616e 3e26 6e62 7370 3b3c an < │ │ │ +0005ecf0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +0005ed00: 656e 742d 6e61 6d65 223e 6973 436f 6e74 ent-name">isCont │ │ │ +0005ed10: 6f75 7243 6f6e 7665 783c 2f73 7061 6e3e ourConvex │ │ │ +0005ed20: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ +0005ed40: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0005ed50: 4d61 744f 6650 6f69 6e74 2e68 746d 6c22 MatOfPoint.html" │ │ │ +0005ed60: 2074 6974 6c65 3d22 636c 6173 7320 696e title="class in │ │ │ +0005ed70: 206f 7267 2e6f 7065 6e63 762e 636f 7265 org.opencv.core │ │ │ +0005ed80: 223e 4d61 744f 6650 6f69 6e74 3c2f 613e ">MatOfPoint │ │ │ +0005ed90: 266e 6273 703b 636f 6e74 6f75 7229 3c2f  contour)
    .
    T │ │ │ +0005edc0: 6573 7473 2061 2063 6f6e 746f 7572 2063 ests a contour c │ │ │ +0005edd0: 6f6e 7665 7869 7479 2e0a 0a54 6865 2066 onvexity...The f │ │ │ +0005ede0: 756e 6374 696f 6e20 7465 7374 7320 7768 unction tests wh │ │ │ +0005edf0: 6574 6865 7220 7468 6520 696e 7075 7420 ether the input │ │ │ +0005ee00: 636f 6e74 6f75 7220 6973 2063 6f6e 7665 contour is conve │ │ │ +0005ee10: 7820 6f72 206e 6f74 2e20 5468 6520 636f x or not. The co │ │ │ +0005ee20: 6e74 6f75 7220 6d75 7374 2062 6520 7369 ntour must be si │ │ │ +0005ee30: 6d70 6c65 2c20 7468 6174 2069 732c 0a77 mple, that is,.w │ │ │ +0005ee40: 6974 686f 7574 2073 656c 662d 696e 7465 ithout self-inte │ │ │ +0005ee50: 7273 6563 7469 6f6e 732e 204f 7468 6572 rsections. Other │ │ │ +0005ee60: 7769 7365 2c20 7468 6520 6675 6e63 7469 wise, the functi │ │ │ +0005ee70: 6f6e 206f 7574 7075 7420 6973 2075 6e64 on output is und │ │ │ +0005ee80: 6566 696e 6564 2e3c 2f64 6976 3e0a 3c64 efined.
    . │ │ │ +0005eea0: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +0005eeb0: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +0005eec0: 636f 6e74 6f75 723c 2f63 6f64 653e 202d contour - │ │ │ +0005eed0: 2049 6e70 7574 2076 6563 746f 7220 6f66 Input vector of │ │ │ +0005eee0: 2032 4420 706f 696e 7473 2c20 7374 6f72 2D points, stor │ │ │ +0005eef0: 6564 2069 6e20 7374 643a 3a76 6563 746f ed in std::vecto │ │ │ +0005ef00: 7226 6c74 3b26 6774 3b20 6f72 204d 6174 r<> or Mat │ │ │ +0005ef10: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ +0005ef20: 733a 3c2f 6474 3e0a 3c64 643e 6175 746f s:
    .
    auto │ │ │ +0005ef30: 6d61 7469 6361 6c6c 7920 6765 6e65 7261 matically genera │ │ │ +0005ef40: 7465 643c 2f64 643e 0a3c 2f64 6c3e 0a3c ted
    ..< │ │ │ +0005ef50: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>. │ │ │ +0005ef60: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    interse │ │ │ +0005eff0: 6374 436f 6e76 6578 436f 6e76 6578 3c2f ctConvexConvex.
    .
    public │ │ │ +0005f060: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +0005f070: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;fl │ │ │ +0005f090: 6f61 743c 2f73 7061 6e3e 266e 6273 703b oat  │ │ │ +0005f0a0: 3c73 7061 6e20 636c 6173 733d 2265 6c65 inter │ │ │ +0005f0c0: 7365 6374 436f 6e76 6578 436f 6e76 6578 sectConvexConvex │ │ │ +0005f0d0: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat p │ │ │ +0005f140: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ +0005f180: 4d61 743c 2f61 3e26 6e62 7370 3b70 322c Mat p2, │ │ │ +0005f190: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +0005f1d0: 743c 2f61 3e26 6e62 7370 3b70 3132 2c0a t p12,. │ │ │ +0005f1e0: 2062 6f6f 6c65 616e 266e 6273 703b 6861 boolean ha │ │ │ +0005f1f0: 6e64 6c65 4e65 7374 6564 293c 2f73 7061 ndleNested)
    .
    Find │ │ │ +0005f220: 7320 696e 7465 7273 6563 7469 6f6e 206f s intersection o │ │ │ +0005f230: 6620 7477 6f20 636f 6e76 6578 2070 6f6c f two convex pol │ │ │ +0005f240: 7967 6f6e 733c 2f64 6976 3e0a 3c64 6c20 ygons
    .
    .< │ │ │ +0005f260: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    p1 │ │ │ +0005f280: 3c2f 636f 6465 3e20 2d20 4669 7273 7420 - First │ │ │ +0005f290: 706f 6c79 676f 6e3c 2f64 643e 0a3c 6464 polygon
    .
    p2 │ │ │ +0005f2b0: 202d 2053 6563 6f6e 6420 706f 6c79 676f - Second polygo │ │ │ +0005f2c0: 6e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 n
    .
    p12 - Ou │ │ │ +0005f2e0: 7470 7574 2070 6f6c 7967 6f6e 2064 6573 tput polygon des │ │ │ +0005f2f0: 6372 6962 696e 6720 7468 6520 696e 7465 cribing the inte │ │ │ +0005f300: 7273 6563 7469 6e67 2061 7265 613c 2f64 rsecting area.
    han │ │ │ +0005f320: 646c 654e 6573 7465 643c 2f63 6f64 653e dleNested │ │ │ +0005f330: 202d 2057 6865 6e20 7472 7565 2c20 616e - When true, an │ │ │ +0005f340: 2069 6e74 6572 7365 6374 696f 6e20 6973 intersection is │ │ │ +0005f350: 2066 6f75 6e64 2069 6620 6f6e 6520 6f66 found if one of │ │ │ +0005f360: 2074 6865 2070 6f6c 7967 6f6e 7320 6973 the polygons is │ │ │ +0005f370: 2066 756c 6c79 2065 6e63 6c6f 7365 6420 fully enclosed │ │ │ +0005f380: 696e 2074 6865 206f 7468 6572 2e0a 5768 in the other..Wh │ │ │ +0005f390: 656e 2066 616c 7365 2c20 6e6f 2069 6e74 en false, no int │ │ │ +0005f3a0: 6572 7365 6374 696f 6e20 6973 2066 6f75 ersection is fou │ │ │ +0005f3b0: 6e64 2e20 4966 2074 6865 2070 6f6c 7967 nd. If the polyg │ │ │ +0005f3c0: 6f6e 7320 7368 6172 6520 6120 7369 6465 ons share a side │ │ │ +0005f3d0: 206f 7220 7468 6520 7665 7274 6578 206f or the vertex o │ │ │ +0005f3e0: 6620 6f6e 6520 706f 6c79 676f 6e20 6c69 f one polygon li │ │ │ +0005f3f0: 6573 206f 6e20 616e 2065 6467 650a 6f66 es on an edge.of │ │ │ +0005f400: 2074 6865 206f 7468 6572 2c20 7468 6579 the other, they │ │ │ +0005f410: 2061 7265 206e 6f74 2063 6f6e 7369 6465 are not conside │ │ │ +0005f420: 7265 6420 6e65 7374 6564 2061 6e64 2061 red nested and a │ │ │ +0005f430: 6e20 696e 7465 7273 6563 7469 6f6e 2077 n intersection w │ │ │ +0005f440: 696c 6c20 6265 2066 6f75 6e64 2072 6567 ill be found reg │ │ │ +0005f450: 6172 646c 6573 7320 6f66 2074 6865 2076 ardless of the v │ │ │ +0005f460: 616c 7565 206f 6620 6861 6e64 6c65 4e65 alue of handleNe │ │ │ +0005f470: 7374 6564 2e3c 2f64 643e 0a3c 6474 3e52 sted.
    .
    R │ │ │ +0005f480: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    Area of interse │ │ │ +0005f4a0: 6374 696e 6720 706f 6c79 676f 6e2e 204d cting polygon. M │ │ │ +0005f4b0: 6179 2062 6520 6e65 6761 7469 7665 2c20 ay be negative, │ │ │ +0005f4c0: 6966 2061 6c67 6f72 6974 686d 2068 6173 if algorithm has │ │ │ +0005f4d0: 206e 6f74 2063 6f6e 7665 7267 6564 2c20 not converged, │ │ │ +0005f4e0: 652e 672e 206e 6f6e 2d63 6f6e 7665 7820 e.g. non-convex │ │ │ +0005f4f0: 696e 7075 742e 0a0a 3c62 3e4e 6f74 653a input...Note: │ │ │ +0005f500: 3c2f 623e 2069 6e74 6572 7365 6374 436f intersectCo │ │ │ +0005f510: 6e76 6578 436f 6e76 6578 2064 6f65 736e nvexConvex doesn │ │ │ +0005f520: 2774 2063 6f6e 6669 726d 2074 6861 7420 't confirm that │ │ │ +0005f530: 626f 7468 2070 6f6c 7967 6f6e 7320 6172 both polygons ar │ │ │ +0005f540: 6520 636f 6e76 6578 2061 6e64 2077 696c e convex and wil │ │ │ +0005f550: 6c20 7265 7475 726e 2069 6e76 616c 6964 l return invalid │ │ │ +0005f560: 2072 6573 756c 7473 2069 6620 7468 6579 results if they │ │ │ +0005f570: 2061 7265 6e27 742e 3c2f 6464 3e0a 3c2f aren't.
    ..
    ..

  • .
  • │ │ │ +0005f5a0: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    intersectC │ │ │ +0005f620: 6f6e 7665 7843 6f6e 7665 783c 2f68 333e onvexConvex

    │ │ │ +0005f630: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ +0005f650: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ +0005f670: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ +0005f680: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ +0005f690: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ +0005f6a0: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;float │ │ │ +0005f6c0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  intersec │ │ │ +0005f6f0: 7443 6f6e 7665 7843 6f6e 7665 783c 2f73 tConvexConvex(M │ │ │ +0005f760: 6174 3c2f 613e 266e 6273 703b 7031 2c0a at p1,. │ │ │ +0005f770: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +0005f7b0: 3c2f 613e 266e 6273 703b 7032 2c0a 203c  p2,. < │ │ │ +0005f7c0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0005f7d0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0005f7e0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0005f7f0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat p12)
    .
    Fin │ │ │ +0005f830: 6473 2069 6e74 6572 7365 6374 696f 6e20 ds intersection │ │ │ +0005f840: 6f66 2074 776f 2063 6f6e 7665 7820 706f of two convex po │ │ │ +0005f850: 6c79 676f 6e73 3c2f 6469 763e 0a3c 646c lygons
    .
    . │ │ │ +0005f870: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ +0005f880: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e70 /dt>.
    p │ │ │ +0005f890: 313c 2f63 6f64 653e 202d 2046 6972 7374 1 - First │ │ │ +0005f8a0: 2070 6f6c 7967 6f6e 3c2f 6464 3e0a 3c64 polygon
    .p2 - Second polyg │ │ │ +0005f8d0: 6f6e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 on.
    p12 - O │ │ │ +0005f8f0: 7574 7075 7420 706f 6c79 676f 6e20 6465 utput polygon de │ │ │ +0005f900: 7363 7269 6269 6e67 2074 6865 2069 6e74 scribing the int │ │ │ +0005f910: 6572 7365 6374 696e 6720 6172 6561 0a57 ersecting area.W │ │ │ +0005f920: 6865 6e20 6661 6c73 652c 206e 6f20 696e hen false, no in │ │ │ +0005f930: 7465 7273 6563 7469 6f6e 2069 7320 666f tersection is fo │ │ │ +0005f940: 756e 642e 2049 6620 7468 6520 706f 6c79 und. If the poly │ │ │ +0005f950: 676f 6e73 2073 6861 7265 2061 2073 6964 gons share a sid │ │ │ +0005f960: 6520 6f72 2074 6865 2076 6572 7465 7820 e or the vertex │ │ │ +0005f970: 6f66 206f 6e65 2070 6f6c 7967 6f6e 206c of one polygon l │ │ │ +0005f980: 6965 7320 6f6e 2061 6e20 6564 6765 0a6f ies on an edge.o │ │ │ +0005f990: 6620 7468 6520 6f74 6865 722c 2074 6865 f the other, the │ │ │ +0005f9a0: 7920 6172 6520 6e6f 7420 636f 6e73 6964 y are not consid │ │ │ +0005f9b0: 6572 6564 206e 6573 7465 6420 616e 6420 ered nested and │ │ │ +0005f9c0: 616e 2069 6e74 6572 7365 6374 696f 6e20 an intersection │ │ │ +0005f9d0: 7769 6c6c 2062 6520 666f 756e 6420 7265 will be found re │ │ │ +0005f9e0: 6761 7264 6c65 7373 206f 6620 7468 6520 gardless of the │ │ │ +0005f9f0: 7661 6c75 6520 6f66 2068 616e 646c 654e value of handleN │ │ │ +0005fa00: 6573 7465 642e 3c2f 6464 3e0a 3c64 743e ested.
    .
    │ │ │ +0005fa10: 5265 7475 726e 733a 3c2f 6474 3e0a 3c64 Returns:
    .Area of inters │ │ │ +0005fa30: 6563 7469 6e67 2070 6f6c 7967 6f6e 2e20 ecting polygon. │ │ │ +0005fa40: 4d61 7920 6265 206e 6567 6174 6976 652c May be negative, │ │ │ +0005fa50: 2069 6620 616c 676f 7269 7468 6d20 6861 if algorithm ha │ │ │ +0005fa60: 7320 6e6f 7420 636f 6e76 6572 6765 642c s not converged, │ │ │ +0005fa70: 2065 2e67 2e20 6e6f 6e2d 636f 6e76 6578 e.g. non-convex │ │ │ +0005fa80: 2069 6e70 7574 2e0a 0a3c 623e 4e6f 7465 input...Note │ │ │ +0005fa90: 3a3c 2f62 3e20 696e 7465 7273 6563 7443 : intersectC │ │ │ +0005faa0: 6f6e 7665 7843 6f6e 7665 7820 646f 6573 onvexConvex does │ │ │ +0005fab0: 6e27 7420 636f 6e66 6972 6d20 7468 6174 n't confirm that │ │ │ +0005fac0: 2062 6f74 6820 706f 6c79 676f 6e73 2061 both polygons a │ │ │ +0005fad0: 7265 2063 6f6e 7665 7820 616e 6420 7769 re convex and wi │ │ │ +0005fae0: 6c6c 2072 6574 7572 6e20 696e 7661 6c69 ll return invali │ │ │ +0005faf0: 6420 7265 7375 6c74 7320 6966 2074 6865 d results if the │ │ │ +0005fb00: 7920 6172 656e 2774 2e3c 2f64 643e 0a3c y aren't..< │ │ │ +0005fb10: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ..
  • .
  • .
    .

    fit │ │ │ +0005fb80: 456c 6c69 7073 653c 2f68 333e 0a3c 6469 Ellipse

    ..public static │ │ │ +0005fbf0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  Rotat │ │ │ +0005fc60: 6564 5265 6374 3c2f 613e 3c2f 7370 616e edRect fitEllipse(MatOfPoin │ │ │ +0005fd10: 7432 663c 2f61 3e26 6e62 7370 3b70 6f69 t2f poi │ │ │ +0005fd20: 6e74 7329 3c2f 7370 616e 3e3c 2f64 6976 nts).
    Fits an ell │ │ │ +0005fd50: 6970 7365 2061 726f 756e 6420 6120 7365 ipse around a se │ │ │ +0005fd60: 7420 6f66 2032 4420 706f 696e 7473 2e0a t of 2D points.. │ │ │ +0005fd70: 0a54 6865 2066 756e 6374 696f 6e20 6361 .The function ca │ │ │ +0005fd80: 6c63 756c 6174 6573 2074 6865 2065 6c6c lculates the ell │ │ │ +0005fd90: 6970 7365 2074 6861 7420 6669 7473 2028 ipse that fits ( │ │ │ +0005fda0: 696e 2061 206c 6561 7374 2d73 7175 6172 in a least-squar │ │ │ +0005fdb0: 6573 2073 656e 7365 2920 6120 7365 7420 es sense) a set │ │ │ +0005fdc0: 6f66 2032 4420 706f 696e 7473 2062 6573 of 2D points bes │ │ │ +0005fdd0: 7420 6f66 0a61 6c6c 2e20 4974 2072 6574 t of.all. It ret │ │ │ +0005fde0: 7572 6e73 2074 6865 2072 6f74 6174 6564 urns the rotated │ │ │ +0005fdf0: 2072 6563 7461 6e67 6c65 2069 6e20 7768 rectangle in wh │ │ │ +0005fe00: 6963 6820 7468 6520 656c 6c69 7073 6520 ich the ellipse │ │ │ +0005fe10: 6973 2069 6e73 6372 6962 6564 2e20 5468 is inscribed. Th │ │ │ +0005fe20: 6520 6669 7273 7420 616c 676f 7269 7468 e first algorith │ │ │ +0005fe30: 6d20 6465 7363 7269 6265 6420 6279 2043 m described by C │ │ │ +0005fe40: 4954 453a 2046 6974 7a67 6962 626f 6e39 ITE: Fitzgibbon9 │ │ │ +0005fe50: 350a 6973 2075 7365 642e 2044 6576 656c 5.is used. Devel │ │ │ +0005fe60: 6f70 6572 2073 686f 756c 6420 6b65 6570 oper should keep │ │ │ +0005fe70: 2069 6e20 6d69 6e64 2074 6861 7420 6974 in mind that it │ │ │ +0005fe80: 2069 7320 706f 7373 6962 6c65 2074 6861 is possible tha │ │ │ +0005fe90: 7420 7468 6520 7265 7475 726e 6564 0a65 t the returned.e │ │ │ +0005fea0: 6c6c 6970 7365 2f72 6f74 6174 6564 5265 llipse/rotatedRe │ │ │ +0005feb0: 6374 2064 6174 6120 636f 6e74 6169 6e73 ct data contains │ │ │ +0005fec0: 206e 6567 6174 6976 6520 696e 6469 6365 negative indice │ │ │ +0005fed0: 732c 2064 7565 2074 6f20 7468 6520 6461 s, due to the da │ │ │ +0005fee0: 7461 2070 6f69 6e74 7320 6265 696e 6720 ta points being │ │ │ +0005fef0: 636c 6f73 6520 746f 2074 6865 0a62 6f72 close to the.bor │ │ │ +0005ff00: 6465 7220 6f66 2074 6865 2063 6f6e 7461 der of the conta │ │ │ +0005ff10: 696e 696e 6720 4d61 7420 656c 656d 656e ining Mat elemen │ │ │ +0005ff20: 742e 3c2f 6469 763e 0a3c 646c 2063 6c61 t.
    .
    .
    │ │ │ +0005ff40: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ +0005ff50: 0a3c 6464 3e3c 636f 6465 3e70 6f69 6e74 .
    point │ │ │ +0005ff60: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ +0005ff70: 2032 4420 706f 696e 7420 7365 742c 2073 2D point set, s │ │ │ +0005ff80: 746f 7265 6420 696e 2073 7464 3a3a 7665 tored in std::ve │ │ │ +0005ff90: 6374 6f72 266c 743b 2667 743b 206f 7220 ctor<> or │ │ │ +0005ffa0: 4d61 740a 0a3c 623e 4e6f 7465 3a3c 2f62 Mat..Note: Input point ty │ │ │ +0005ffc0: 7065 7320 6172 6520 5245 463a 2050 6f69 pes are REF: Poi │ │ │ +0005ffd0: 6e74 3269 206f 7220 5245 463a 2050 6f69 nt2i or REF: Poi │ │ │ +0005ffe0: 6e74 3266 2061 6e64 2061 7420 6c65 6173 nt2f and at leas │ │ │ +0005fff0: 7420 3520 706f 696e 7473 2061 7265 2072 t 5 points are r │ │ │ +00060000: 6571 7569 7265 642e 0a3c 623e 4e6f 7465 equired..Note │ │ │ +00060010: 3a3c 2f62 3e20 5245 463a 2067 6574 436c : REF: getCl │ │ │ +00060020: 6f73 6573 7445 6c6c 6970 7365 506f 696e osestEllipsePoin │ │ │ +00060030: 7473 2066 756e 6374 696f 6e20 6361 6e20 ts function can │ │ │ +00060040: 6265 2075 7365 6420 746f 2063 6f6d 7075 be used to compu │ │ │ +00060050: 7465 2074 6865 2065 6c6c 6970 7365 2066 te the ellipse f │ │ │ +00060060: 6974 7469 6e67 2065 7272 6f72 2e3c 2f64 itting error..
    Returns:< │ │ │ +00060080: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
    automat │ │ │ +00060090: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ +000600a0: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    .
    .
    ..
  • ..

    fi │ │ │ +00060110: 7445 6c6c 6970 7365 414d 533c 2f68 333e tEllipseAMS

    │ │ │ +00060120: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ +00060140: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ +00060160: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ +00060170: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ +00060180: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ +00060190: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;R │ │ │ +000601f0: 6f74 6174 6564 5265 6374 3c2f 613e 3c2f otatedRect fitEllipse │ │ │ +00060230: 414d 533c 2f73 7061 6e3e 3c77 6272 3e3c AMS< │ │ │ +00060240: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +00060250: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ +000602a0: 703b 706f 696e 7473 293c 2f73 7061 6e3e p;points) │ │ │ +000602b0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Fits a │ │ │ +000602d0: 6e20 656c 6c69 7073 6520 6172 6f75 6e64 n ellipse around │ │ │ +000602e0: 2061 2073 6574 206f 6620 3244 2070 6f69 a set of 2D poi │ │ │ +000602f0: 6e74 732e 0a0a 5468 6520 6675 6e63 7469 nts...The functi │ │ │ +00060300: 6f6e 2063 616c 6375 6c61 7465 7320 7468 on calculates th │ │ │ +00060310: 6520 656c 6c69 7073 6520 7468 6174 2066 e ellipse that f │ │ │ +00060320: 6974 7320 6120 7365 7420 6f66 2032 4420 its a set of 2D │ │ │ +00060330: 706f 696e 7473 2e0a 4974 2072 6574 7572 points..It retur │ │ │ +00060340: 6e73 2074 6865 2072 6f74 6174 6564 2072 ns the rotated r │ │ │ +00060350: 6563 7461 6e67 6c65 2069 6e20 7768 6963 ectangle in whic │ │ │ +00060360: 6820 7468 6520 656c 6c69 7073 6520 6973 h the ellipse is │ │ │ +00060370: 2069 6e73 6372 6962 6564 2e0a 5468 6520 inscribed..The │ │ │ +00060380: 4170 7072 6f78 696d 6174 6520 4d65 616e Approximate Mean │ │ │ +00060390: 2053 7175 6172 6520 2841 4d53 2920 7072 Square (AMS) pr │ │ │ +000603a0: 6f70 6f73 6564 2062 7920 4349 5445 3a20 oposed by CITE: │ │ │ +000603b0: 5461 7562 696e 3139 3931 2069 7320 7573 Taubin1991 is us │ │ │ +000603c0: 6564 2e0a 0a46 6f72 2061 6e20 656c 6c69 ed...For an elli │ │ │ +000603d0: 7073 652c 2074 6869 7320 6261 7369 7320 pse, this basis │ │ │ +000603e0: 7365 7420 6973 205c 2820 5c63 6869 3d20 set is \( \chi= │ │ │ +000603f0: 5c6c 6566 7428 785e 322c 2078 2079 2c20 \left(x^2, x y, │ │ │ +00060400: 795e 322c 2078 2c20 792c 2031 5c72 6967 y^2, x, y, 1\rig │ │ │ +00060410: 6874 2920 5c29 2c0a 7768 6963 6820 6973 ht) \),.which is │ │ │ +00060420: 2061 2073 6574 206f 6620 7369 7820 6672 a set of six fr │ │ │ +00060430: 6565 2063 6f65 6666 6963 6965 6e74 7320 ee coefficients │ │ │ +00060440: 5c28 2041 5e54 3d5c 6c65 6674 5c7b 415f \( A^T=\left\{A_ │ │ │ +00060450: 7b5c 7465 7874 7b78 787d 7d2c 415f 7b5c {\text{xx}},A_{\ │ │ │ +00060460: 7465 7874 7b78 797d 7d2c 415f 7b5c 7465 text{xy}},A_{\te │ │ │ +00060470: 7874 7b79 797d 7d2c 415f 782c 415f 792c xt{yy}},A_x,A_y, │ │ │ +00060480: 415f 305c 7269 6768 745c 7d20 5c29 2e0a A_0\right\} \).. │ │ │ +00060490: 486f 7765 7665 722c 2074 6f20 7370 6563 However, to spec │ │ │ +000604a0: 6966 7920 616e 2065 6c6c 6970 7365 2c20 ify an ellipse, │ │ │ +000604b0: 616c 6c20 7468 6174 2069 7320 6e65 6564 all that is need │ │ │ +000604c0: 6564 2069 7320 6669 7665 206e 756d 6265 ed is five numbe │ │ │ +000604d0: 7273 3b20 7468 6520 6d61 6a6f 7220 616e rs; the major an │ │ │ +000604e0: 6420 6d69 6e6f 7220 6178 6573 206c 656e d minor axes len │ │ │ +000604f0: 6774 6873 205c 2820 2861 2c62 2920 5c29 gths \( (a,b) \) │ │ │ +00060500: 2c0a 7468 6520 706f 7369 7469 6f6e 205c ,.the position \ │ │ │ +00060510: 2820 2878 5f30 2c79 5f30 2920 5c29 2c20 ( (x_0,y_0) \), │ │ │ +00060520: 616e 6420 7468 6520 6f72 6965 6e74 6174 and the orientat │ │ │ +00060530: 696f 6e20 5c28 205c 7468 6574 6120 5c29 ion \( \theta \) │ │ │ +00060540: 2e20 5468 6973 2069 7320 6265 6361 7573 . This is becaus │ │ │ +00060550: 6520 7468 6520 6261 7369 7320 7365 7420 e the basis set │ │ │ +00060560: 696e 636c 7564 6573 206c 696e 6573 2c0a includes lines,. │ │ │ +00060570: 7175 6164 7261 7469 6373 2c20 7061 7261 quadratics, para │ │ │ +00060580: 626f 6c69 6320 616e 6420 6879 7065 7262 bolic and hyperb │ │ │ +00060590: 6f6c 6963 2066 756e 6374 696f 6e73 2061 olic functions a │ │ │ +000605a0: 7320 7765 6c6c 2061 7320 656c 6c69 7074 s well as ellipt │ │ │ +000605b0: 6963 616c 2066 756e 6374 696f 6e73 2061 ical functions a │ │ │ +000605c0: 7320 706f 7373 6962 6c65 2066 6974 732e s possible fits. │ │ │ +000605d0: 0a49 6620 7468 6520 6669 7420 6973 2066 .If the fit is f │ │ │ +000605e0: 6f75 6e64 2074 6f20 6265 2061 2070 6172 ound to be a par │ │ │ +000605f0: 6162 6f6c 6963 206f 7220 6879 7065 7262 abolic or hyperb │ │ │ +00060600: 6f6c 6963 2066 756e 6374 696f 6e20 7468 olic function th │ │ │ +00060610: 656e 2074 6865 2073 7461 6e64 6172 6420 en the standard │ │ │ +00060620: 2366 6974 456c 6c69 7073 6520 6d65 7468 #fitEllipse meth │ │ │ +00060630: 6f64 2069 7320 7573 6564 2e0a 5468 6520 od is used..The │ │ │ +00060640: 414d 5320 6d65 7468 6f64 2072 6573 7472 AMS method restr │ │ │ +00060650: 6963 7473 2074 6865 2066 6974 2074 6f20 icts the fit to │ │ │ +00060660: 7061 7261 626f 6c69 632c 2068 7970 6572 parabolic, hyper │ │ │ +00060670: 626f 6c69 6320 616e 6420 656c 6c69 7074 bolic and ellipt │ │ │ +00060680: 6963 616c 2063 7572 7665 730a 6279 2069 ical curves.by i │ │ │ +00060690: 6d70 6f73 696e 6720 7468 6520 636f 6e64 mposing the cond │ │ │ +000606a0: 6974 696f 6e20 7468 6174 205c 2820 415e ition that \( A^ │ │ │ +000606b0: 5420 2820 445f 785e 5420 445f 7820 202b T ( D_x^T D_x + │ │ │ +000606c0: 2020 2044 5f79 5e54 2044 5f79 2920 4120 D_y^T D_y) A │ │ │ +000606d0: 3d20 3120 5c29 2077 6865 7265 0a74 6865 = 1 \) where.the │ │ │ +000606e0: 206d 6174 7269 6365 7320 5c28 2044 7820 matrices \( Dx │ │ │ +000606f0: 5c29 2061 6e64 205c 2820 4479 205c 2920 \) and \( Dy \) │ │ │ +00060700: 6172 6520 7468 6520 7061 7274 6961 6c20 are the partial │ │ │ +00060710: 6465 7269 7661 7469 7665 7320 6f66 2074 derivatives of t │ │ │ +00060720: 6865 2064 6573 6967 6e20 6d61 7472 6978 he design matrix │ │ │ +00060730: 205c 2820 4420 5c29 2077 6974 680a 7265 \( D \) with.re │ │ │ +00060740: 7370 6563 7420 746f 2078 2061 6e64 2079 spect to x and y │ │ │ +00060750: 2e20 5468 6520 6d61 7472 6963 6573 2061 . The matrices a │ │ │ +00060760: 7265 2066 6f72 6d65 6420 726f 7720 6279 re formed row by │ │ │ +00060770: 2072 6f77 2061 7070 6c79 696e 6720 7468 row applying th │ │ │ +00060780: 6520 666f 6c6c 6f77 696e 6720 746f 0a65 e following to.e │ │ │ +00060790: 6163 6820 6f66 2074 6865 2070 6f69 6e74 ach of the point │ │ │ +000607a0: 7320 696e 2074 6865 2073 6574 3a0a 5c28 s in the set:.\( │ │ │ +000607b0: 616c 6967 6e2a 7d7b 0a44 2869 2c3a 2926 align*}{.D(i,:)& │ │ │ +000607c0: 616d 703b 3d5c 6c65 6674 5c7b 785f 695e amp;=\left\{x_i^ │ │ │ +000607d0: 322c 2078 5f69 2079 5f69 2c20 795f 695e 2, x_i y_i, y_i^ │ │ │ +000607e0: 322c 2078 5f69 2c20 795f 692c 2031 5c72 2, x_i, y_i, 1\r │ │ │ +000607f0: 6967 6874 5c7d 2026 616d 703b 0a44 5f78 ight\} &.D_x │ │ │ +00060800: 2869 2c3a 2926 616d 703b 3d5c 6c65 6674 (i,:)&=\left │ │ │ +00060810: 5c7b 3220 785f 692c 795f 692c 302c 312c \{2 x_i,y_i,0,1, │ │ │ +00060820: 302c 305c 7269 6768 745c 7d20 2661 6d70 0,0\right\} & │ │ │ +00060830: 3b0a 445f 7928 692c 3a29 2661 6d70 3b3d ;.D_y(i,:)&= │ │ │ +00060840: 5c6c 6566 745c 7b30 2c78 5f69 2c32 2079 \left\{0,x_i,2 y │ │ │ +00060850: 5f69 2c30 2c31 2c30 5c72 6967 6874 5c7d _i,0,1,0\right\} │ │ │ +00060860: 0a5c 290a 5468 6520 414d 5320 6d65 7468 .\).The AMS meth │ │ │ +00060870: 6f64 206d 696e 696d 697a 6573 2074 6865 od minimizes the │ │ │ +00060880: 2063 6f73 7420 6675 6e63 7469 6f6e 0a5c cost function.\ │ │ │ +00060890: 2865 7175 6174 696f 6e2a 7d7b 0a5c 6570 (equation*}{.\ep │ │ │ +000608a0: 7369 6c6f 6e20 5e32 3d5c 6672 6163 7b20 silon ^2=\frac{ │ │ │ +000608b0: 415e 5420 445e 5420 4420 4120 7d7b 2041 A^T D^T D A }{ A │ │ │ +000608c0: 5e54 2028 445f 785e 5420 445f 7820 2b20 ^T (D_x^T D_x + │ │ │ +000608d0: 2044 5f79 5e54 2044 5f79 2920 415e 5420 D_y^T D_y) A^T │ │ │ +000608e0: 7d0a 5c29 0a0a 5468 6520 6d69 6e69 6d75 }.\)..The minimu │ │ │ +000608f0: 6d20 636f 7374 2069 7320 666f 756e 6420 m cost is found │ │ │ +00060900: 6279 2073 6f6c 7669 6e67 2074 6865 2067 by solving the g │ │ │ +00060910: 656e 6572 616c 697a 6564 2065 6967 656e eneralized eigen │ │ │ +00060920: 7661 6c75 6520 7072 6f62 6c65 6d2e 0a0a value problem... │ │ │ +00060930: 5c28 6571 7561 7469 6f6e 2a7d 7b0a 445e \(equation*}{.D^ │ │ │ +00060940: 5420 4420 4120 3d20 5c6c 616d 6264 6120 T D A = \lambda │ │ │ +00060950: 205c 6c65 6674 2820 445f 785e 5420 445f \left( D_x^T D_ │ │ │ +00060960: 7820 2b20 2044 5f79 5e54 2044 5f79 5c72 x + D_y^T D_y\r │ │ │ +00060970: 6967 6874 2920 410a 5c29 3c2f 6469 763e ight) A.\)
    │ │ │ +00060980: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ +000609a0: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    points │ │ │ +000609c0: 202d 2049 6e70 7574 2032 4420 706f 696e - Input 2D poin │ │ │ +000609d0: 7420 7365 742c 2073 746f 7265 6420 696e t set, stored in │ │ │ +000609e0: 2073 7464 3a3a 7665 6374 6f72 266c 743b std::vector< │ │ │ +000609f0: 2667 743b 206f 7220 4d61 740a 0a3c 623e > or Mat.. │ │ │ +00060a00: 4e6f 7465 3a3c 2f62 3e20 496e 7075 7420 Note: Input │ │ │ +00060a10: 706f 696e 7420 7479 7065 7320 6172 6520 point types are │ │ │ +00060a20: 5245 463a 2050 6f69 6e74 3269 206f 7220 REF: Point2i or │ │ │ +00060a30: 5245 463a 2050 6f69 6e74 3266 2061 6e64 REF: Point2f and │ │ │ +00060a40: 2061 7420 6c65 6173 7420 3520 706f 696e at least 5 poin │ │ │ +00060a50: 7473 2061 7265 2072 6571 7569 7265 642e ts are required. │ │ │ +00060a60: 0a3c 623e 4e6f 7465 3a3c 2f62 3e20 5245 .Note: RE │ │ │ +00060a70: 463a 2067 6574 436c 6f73 6573 7445 6c6c F: getClosestEll │ │ │ +00060a80: 6970 7365 506f 696e 7473 2066 756e 6374 ipsePoints funct │ │ │ +00060a90: 696f 6e20 6361 6e20 6265 2075 7365 6420 ion can be used │ │ │ +00060aa0: 746f 2063 6f6d 7075 7465 2074 6865 2065 to compute the e │ │ │ +00060ab0: 6c6c 6970 7365 2066 6974 7469 6e67 2065 llipse fitting e │ │ │ +00060ac0: 7272 6f72 2e3c 2f64 643e 0a3c 6474 3e52 rror.
    .
    R │ │ │ +00060ad0: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    automatically g │ │ │ +00060af0: 656e 6572 6174 6564 3c2f 6464 3e0a 3c2f enerated
    ..
    ..
  • .
  • │ │ │ +00060b20: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    fitElli │ │ │ +00060b70: 7073 6544 6972 6563 743c 2f68 333e 0a3c pseDirect

    .< │ │ │ +00060b80: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +00060b90: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +00060ba0: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +00060bb0: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +00060be0: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +00060bf0: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +00060c00: 726e 2d74 7970 6522 3e3c 6120 6872 6566 rn-type">Rot │ │ │ +00060c50: 6174 6564 5265 6374 3c2f 613e 3c2f 7370 atedRect fitEllipseDi │ │ │ +00060c90: 7265 6374 3c2f 7370 616e 3e3c 7762 723e rect │ │ │ +00060ca0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +00060d00: 7370 3b70 6f69 6e74 7329 3c2f 7370 616e sp;points).
    Fits │ │ │ +00060d30: 616e 2065 6c6c 6970 7365 2061 726f 756e an ellipse aroun │ │ │ +00060d40: 6420 6120 7365 7420 6f66 2032 4420 706f d a set of 2D po │ │ │ +00060d50: 696e 7473 2e0a 0a54 6865 2066 756e 6374 ints...The funct │ │ │ +00060d60: 696f 6e20 6361 6c63 756c 6174 6573 2074 ion calculates t │ │ │ +00060d70: 6865 2065 6c6c 6970 7365 2074 6861 7420 he ellipse that │ │ │ +00060d80: 6669 7473 2061 2073 6574 206f 6620 3244 fits a set of 2D │ │ │ +00060d90: 2070 6f69 6e74 732e 0a49 7420 7265 7475 points..It retu │ │ │ +00060da0: 726e 7320 7468 6520 726f 7461 7465 6420 rns the rotated │ │ │ +00060db0: 7265 6374 616e 676c 6520 696e 2077 6869 rectangle in whi │ │ │ +00060dc0: 6368 2074 6865 2065 6c6c 6970 7365 2069 ch the ellipse i │ │ │ +00060dd0: 7320 696e 7363 7269 6265 642e 0a54 6865 s inscribed..The │ │ │ +00060de0: 2044 6972 6563 7420 6c65 6173 7420 7371 Direct least sq │ │ │ +00060df0: 7561 7265 2028 4469 7265 6374 2920 6d65 uare (Direct) me │ │ │ +00060e00: 7468 6f64 2062 7920 4349 5445 3a20 6f79 thod by CITE: oy │ │ │ +00060e10: 3139 3938 4e75 6d65 7269 6361 6c6c 7953 1998NumericallyS │ │ │ +00060e20: 4420 6973 2075 7365 642e 0a0a 466f 7220 D is used...For │ │ │ +00060e30: 616e 2065 6c6c 6970 7365 2c20 7468 6973 an ellipse, this │ │ │ +00060e40: 2062 6173 6973 2073 6574 2069 7320 5c28 basis set is \( │ │ │ +00060e50: 205c 6368 693d 205c 6c65 6674 2878 5e32 \chi= \left(x^2 │ │ │ +00060e60: 2c20 7820 792c 2079 5e32 2c20 782c 2079 , x y, y^2, x, y │ │ │ +00060e70: 2c20 315c 7269 6768 7429 205c 292c 0a77 , 1\right) \),.w │ │ │ +00060e80: 6869 6368 2069 7320 6120 7365 7420 6f66 hich is a set of │ │ │ +00060e90: 2073 6978 2066 7265 6520 636f 6566 6669 six free coeffi │ │ │ +00060ea0: 6369 656e 7473 205c 2820 415e 543d 5c6c cients \( A^T=\l │ │ │ +00060eb0: 6566 745c 7b41 5f7b 5c74 6578 747b 7878 eft\{A_{\text{xx │ │ │ +00060ec0: 7d7d 2c41 5f7b 5c74 6578 747b 7879 7d7d }},A_{\text{xy}} │ │ │ +00060ed0: 2c41 5f7b 5c74 6578 747b 7979 7d7d 2c41 ,A_{\text{yy}},A │ │ │ +00060ee0: 5f78 2c41 5f79 2c41 5f30 5c72 6967 6874 _x,A_y,A_0\right │ │ │ +00060ef0: 5c7d 205c 292e 0a48 6f77 6576 6572 2c20 \} \)..However, │ │ │ +00060f00: 746f 2073 7065 6369 6679 2061 6e20 656c to specify an el │ │ │ +00060f10: 6c69 7073 652c 2061 6c6c 2074 6861 7420 lipse, all that │ │ │ +00060f20: 6973 206e 6565 6465 6420 6973 2066 6976 is needed is fiv │ │ │ +00060f30: 6520 6e75 6d62 6572 733b 2074 6865 206d e numbers; the m │ │ │ +00060f40: 616a 6f72 2061 6e64 206d 696e 6f72 2061 ajor and minor a │ │ │ +00060f50: 7865 7320 6c65 6e67 7468 7320 5c28 2028 xes lengths \( ( │ │ │ +00060f60: 612c 6229 205c 292c 0a74 6865 2070 6f73 a,b) \),.the pos │ │ │ +00060f70: 6974 696f 6e20 5c28 2028 785f 302c 795f ition \( (x_0,y_ │ │ │ +00060f80: 3029 205c 292c 2061 6e64 2074 6865 206f 0) \), and the o │ │ │ +00060f90: 7269 656e 7461 7469 6f6e 205c 2820 5c74 rientation \( \t │ │ │ +00060fa0: 6865 7461 205c 292e 2054 6869 7320 6973 heta \). This is │ │ │ +00060fb0: 2062 6563 6175 7365 2074 6865 2062 6173 because the bas │ │ │ +00060fc0: 6973 2073 6574 2069 6e63 6c75 6465 7320 is set includes │ │ │ +00060fd0: 6c69 6e65 732c 0a71 7561 6472 6174 6963 lines,.quadratic │ │ │ +00060fe0: 732c 2070 6172 6162 6f6c 6963 2061 6e64 s, parabolic and │ │ │ +00060ff0: 2068 7970 6572 626f 6c69 6320 6675 6e63 hyperbolic func │ │ │ +00061000: 7469 6f6e 7320 6173 2077 656c 6c20 6173 tions as well as │ │ │ +00061010: 2065 6c6c 6970 7469 6361 6c20 6675 6e63 elliptical func │ │ │ +00061020: 7469 6f6e 7320 6173 2070 6f73 7369 626c tions as possibl │ │ │ +00061030: 6520 6669 7473 2e0a 5468 6520 4469 7265 e fits..The Dire │ │ │ +00061040: 6374 206d 6574 686f 6420 636f 6e66 696e ct method confin │ │ │ +00061050: 6573 2074 6865 2066 6974 2074 6f20 656c es the fit to el │ │ │ +00061060: 6c69 7073 6573 2062 7920 656e 7375 7269 lipses by ensuri │ │ │ +00061070: 6e67 2074 6861 7420 5c28 2034 2041 5f7b ng that \( 4 A_{ │ │ │ +00061080: 7878 7d20 415f 7b79 797d 2d20 415f 7b78 xx} A_{yy}- A_{x │ │ │ +00061090: 797d 5e32 2026 6774 3b20 3020 5c29 2e0a y}^2 > 0 \).. │ │ │ +000610a0: 5468 6520 636f 6e64 6974 696f 6e20 696d The condition im │ │ │ +000610b0: 706f 7365 6420 6973 2074 6861 7420 5c28 posed is that \( │ │ │ +000610c0: 2034 2041 5f7b 7878 7d20 415f 7b79 797d 4 A_{xx} A_{yy} │ │ │ +000610d0: 2d20 415f 7b78 797d 5e32 3d31 205c 2920 - A_{xy}^2=1 \) │ │ │ +000610e0: 7768 6963 6820 7361 7469 7366 6965 7320 which satisfies │ │ │ +000610f0: 7468 6520 696e 6571 7561 6c69 7479 0a61 the inequality.a │ │ │ +00061100: 6e64 2061 7320 7468 6520 636f 6566 6669 nd as the coeffi │ │ │ +00061110: 6369 656e 7473 2063 616e 2062 6520 6172 cients can be ar │ │ │ +00061120: 6269 7472 6172 696c 7920 7363 616c 6564 bitrarily scaled │ │ │ +00061130: 2069 7320 6e6f 7420 6f76 6572 6c79 2072 is not overly r │ │ │ +00061140: 6573 7472 6963 7469 7665 2e0a 0a5c 2865 estrictive...\(e │ │ │ +00061150: 7175 6174 696f 6e2a 7d7b 0a5c 6570 7369 quation*}{.\epsi │ │ │ +00061160: 6c6f 6e20 5e32 3d20 415e 5420 445e 5420 lon ^2= A^T D^T │ │ │ +00061170: 4420 4120 5c71 7561 6420 5c74 6578 747b D A \quad \text{ │ │ │ +00061180: 7769 7468 7d20 5c71 7561 6420 415e 5420 with} \quad A^T │ │ │ +00061190: 4320 4120 3d31 205c 7175 6164 205c 7465 C A =1 \quad \te │ │ │ +000611a0: 7874 7b61 6e64 7d20 5c71 7561 6420 433d xt{and} \quad C= │ │ │ +000611b0: 5c6c 6566 7428 5c62 6567 696e 7b6d 6174 \left(\begin{mat │ │ │ +000611c0: 7269 787d 0a30 2026 616d 703b 2030 2020 rix}.0 & 0 │ │ │ +000611d0: 2661 6d70 3b20 3220 2026 616d 703b 2030 & 2 & 0 │ │ │ +000611e0: 2020 2661 6d70 3b20 3020 2026 616d 703b & 0 & │ │ │ +000611f0: 2020 3020 205c 5c0a 3020 2661 6d70 3b20 0 \\.0 & │ │ │ +00061200: 2d31 2020 2661 6d70 3b20 3020 2026 616d -1 & 0 &am │ │ │ +00061210: 703b 2030 2020 2661 6d70 3b20 3020 2026 p; 0 & 0 & │ │ │ +00061220: 616d 703b 2020 3020 5c5c 0a32 2026 616d amp; 0 \\.2 &am │ │ │ +00061230: 703b 2030 2020 2661 6d70 3b20 3020 2026 p; 0 & 0 & │ │ │ +00061240: 616d 703b 2030 2020 2661 6d70 3b20 3020 amp; 0 & 0 │ │ │ +00061250: 2026 616d 703b 2020 3020 5c5c 0a30 2026 & 0 \\.0 & │ │ │ +00061260: 616d 703b 2030 2020 2661 6d70 3b20 3020 amp; 0 & 0 │ │ │ +00061270: 2026 616d 703b 2030 2020 2661 6d70 3b20 & 0 & │ │ │ +00061280: 3020 2026 616d 703b 2020 3020 5c5c 0a30 0 & 0 \\.0 │ │ │ +00061290: 2026 616d 703b 2030 2020 2661 6d70 3b20 & 0 & │ │ │ +000612a0: 3020 2026 616d 703b 2030 2020 2661 6d70 0 & 0 & │ │ │ +000612b0: 3b20 3020 2026 616d 703b 2020 3020 5c5c ; 0 & 0 \\ │ │ │ +000612c0: 0a30 2026 616d 703b 2030 2020 2661 6d70 .0 & 0 & │ │ │ +000612d0: 3b20 3020 2026 616d 703b 2030 2020 2661 ; 0 & 0 &a │ │ │ +000612e0: 6d70 3b20 3020 2026 616d 703b 2020 300a mp; 0 & 0. │ │ │ +000612f0: 5c65 6e64 7b6d 6174 7269 787d 205c 7269 \end{matrix} \ri │ │ │ +00061300: 6768 7429 0a5c 290a 0a54 6865 206d 696e ght).\)..The min │ │ │ +00061310: 696d 756d 2063 6f73 7420 6973 2066 6f75 imum cost is fou │ │ │ +00061320: 6e64 2062 7920 736f 6c76 696e 6720 7468 nd by solving th │ │ │ +00061330: 6520 6765 6e65 7261 6c69 7a65 6420 6569 e generalized ei │ │ │ +00061340: 6765 6e76 616c 7565 2070 726f 626c 656d genvalue problem │ │ │ +00061350: 2e0a 0a5c 2865 7175 6174 696f 6e2a 7d7b ...\(equation*}{ │ │ │ +00061360: 0a44 5e54 2044 2041 203d 205c 6c61 6d62 .D^T D A = \lamb │ │ │ +00061370: 6461 2020 5c6c 6566 7428 2043 5c72 6967 da \left( C\rig │ │ │ +00061380: 6874 2920 410a 5c29 0a0a 5468 6520 7379 ht) A.\)..The sy │ │ │ +00061390: 7374 656d 2070 726f 6475 6365 7320 6f6e stem produces on │ │ │ +000613a0: 6c79 206f 6e65 2070 6f73 6974 6976 6520 ly one positive │ │ │ +000613b0: 6569 6765 6e76 616c 7565 205c 2820 5c6c eigenvalue \( \l │ │ │ +000613c0: 616d 6264 615c 2920 7768 6963 6820 6973 ambda\) which is │ │ │ +000613d0: 2063 686f 7365 6e20 6173 2074 6865 2073 chosen as the s │ │ │ +000613e0: 6f6c 7574 696f 6e0a 7769 7468 2069 7473 olution.with its │ │ │ +000613f0: 2065 6967 656e 7665 6374 6f72 205c 285c eigenvector \(\ │ │ │ +00061400: 6d61 7468 6266 7b75 7d5c 292e 2054 6865 mathbf{u}\). The │ │ │ +00061410: 7365 2061 7265 2075 7365 6420 746f 2066 se are used to f │ │ │ +00061420: 696e 6420 7468 6520 636f 6566 6669 6369 ind the coeffici │ │ │ +00061430: 656e 7473 0a0a 5c28 6571 7561 7469 6f6e ents..\(equation │ │ │ +00061440: 2a7d 7b0a 4120 3d20 5c73 7172 747b 5c66 *}{.A = \sqrt{\f │ │ │ +00061450: 7261 637b 317d 7b5c 6d61 7468 6266 7b75 rac{1}{\mathbf{u │ │ │ +00061460: 7d5e 5420 4320 5c6d 6174 6862 667b 757d }^T C \mathbf{u} │ │ │ +00061470: 7d7d 2020 5c6d 6174 6862 667b 757d 0a5c }} \mathbf{u}.\ │ │ │ +00061480: 290a 5468 6520 7363 616c 696e 6720 6661 ).The scaling fa │ │ │ +00061490: 6374 6f72 2067 7561 7261 6e74 6565 7320 ctor guarantees │ │ │ +000614a0: 7468 6174 2020 5c28 415e 5420 4320 4120 that \(A^T C A │ │ │ +000614b0: 3d31 5c29 2e3c 2f64 6976 3e0a 3c64 6c20 =1\).
    .
    .< │ │ │ +000614d0: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    po │ │ │ +000614f0: 696e 7473 3c2f 636f 6465 3e20 2d20 496e ints - In │ │ │ +00061500: 7075 7420 3244 2070 6f69 6e74 2073 6574 put 2D point set │ │ │ +00061510: 2c20 7374 6f72 6564 2069 6e20 7374 643a , stored in std: │ │ │ +00061520: 3a76 6563 746f 7226 6c74 3b26 6774 3b20 :vector<> │ │ │ +00061530: 6f72 204d 6174 0a0a 3c62 3e4e 6f74 653a or Mat..Note: │ │ │ +00061540: 3c2f 623e 2049 6e70 7574 2070 6f69 6e74 Input point │ │ │ +00061550: 2074 7970 6573 2061 7265 2052 4546 3a20 types are REF: │ │ │ +00061560: 506f 696e 7432 6920 6f72 2052 4546 3a20 Point2i or REF: │ │ │ +00061570: 506f 696e 7432 6620 616e 6420 6174 206c Point2f and at l │ │ │ +00061580: 6561 7374 2035 2070 6f69 6e74 7320 6172 east 5 points ar │ │ │ +00061590: 6520 7265 7175 6972 6564 2e0a 3c62 3e4e e required..N │ │ │ +000615a0: 6f74 653a 3c2f 623e 2052 4546 3a20 6765 ote: REF: ge │ │ │ +000615b0: 7443 6c6f 7365 7374 456c 6c69 7073 6550 tClosestEllipseP │ │ │ +000615c0: 6f69 6e74 7320 6675 6e63 7469 6f6e 2063 oints function c │ │ │ +000615d0: 616e 2062 6520 7573 6564 2074 6f20 636f an be used to co │ │ │ +000615e0: 6d70 7574 6520 7468 6520 656c 6c69 7073 mpute the ellips │ │ │ +000615f0: 6520 6669 7474 696e 6720 6572 726f 722e e fitting error. │ │ │ +00061600: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ +00061610: 733a 3c2f 6474 3e0a 3c64 643e 6175 746f s:
    .
    auto │ │ │ +00061620: 6d61 7469 6361 6c6c 7920 6765 6e65 7261 matically genera │ │ │ +00061630: 7465 643c 2f64 643e 0a3c 2f64 6c3e 0a3c ted
    .
    .< │ │ │ +00061640: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ +00061650: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    getCl │ │ │ +000616e0: 6f73 6573 7445 6c6c 6970 7365 506f 696e osestEllipsePoin │ │ │ +000616f0: 7473 3c2f 6833 3e0a 3c64 6976 2063 6c61 ts

    .
    .
    pu │ │ │ +00061750: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static void&nb │ │ │ +00061790: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;ge │ │ │ +000617b0: 7443 6c6f 7365 7374 456c 6c69 7073 6550 tClosestEllipseP │ │ │ +000617c0: 6f69 6e74 733c 2f73 7061 6e3e 3c77 6272 oints(R │ │ │ +00061830: 6f74 6174 6564 5265 6374 3c2f 613e 266e otatedRect&n │ │ │ +00061840: 6273 703b 656c 6c69 7073 655f 7061 7261 bsp;ellipse_para │ │ │ +00061850: 6d73 2c0a 203c 6120 6872 6566 3d22 2e2e ms,. Mat po │ │ │ +000618a0: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. Mat  │ │ │ +000618f0: 636c 6f73 6573 745f 7074 7329 3c2f 7370 closest_pts)
    .
    Com │ │ │ +00061920: 7075 7465 2066 6f72 2065 6163 6820 3264 pute for each 2d │ │ │ +00061930: 2070 6f69 6e74 2074 6865 206e 6561 7265 point the neare │ │ │ +00061940: 7374 2032 6420 706f 696e 7420 6c6f 6361 st 2d point loca │ │ │ +00061950: 7465 6420 6f6e 2061 2067 6976 656e 2065 ted on a given e │ │ │ +00061960: 6c6c 6970 7365 2e0a 0a54 6865 2066 756e llipse...The fun │ │ │ +00061970: 6374 696f 6e20 636f 6d70 7574 6573 2074 ction computes t │ │ │ +00061980: 6865 206e 6561 7265 7374 2032 6420 6c6f he nearest 2d lo │ │ │ +00061990: 6361 7469 6f6e 206f 6e20 6120 6769 7665 cation on a give │ │ │ +000619a0: 6e20 656c 6c69 7073 6520 666f 7220 6120 n ellipse for a │ │ │ +000619b0: 7665 6374 6f72 206f 6620 3264 2070 6f69 vector of 2d poi │ │ │ +000619c0: 6e74 7320 616e 6420 6973 2062 6173 6564 nts and is based │ │ │ +000619d0: 206f 6e20 4349 5445 3a20 4368 6174 6669 on CITE: Chatfi │ │ │ +000619e0: 656c 6432 3031 3720 636f 6465 2e0a 5468 eld2017 code..Th │ │ │ +000619f0: 6973 2066 756e 6374 696f 6e20 6361 6e20 is function can │ │ │ +00061a00: 6265 2075 7365 6420 746f 2063 6f6d 7075 be used to compu │ │ │ +00061a10: 7465 2066 6f72 2069 6e73 7461 6e63 6520 te for instance │ │ │ +00061a20: 7468 6520 656c 6c69 7073 6520 6669 7474 the ellipse fitt │ │ │ +00061a30: 696e 6720 6572 726f 722e 3c2f 6469 763e ing error.
    │ │ │ +00061a40: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ +00061a60: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    ellipse_param │ │ │ +00061a80: 733c 2f63 6f64 653e 202d 2045 6c6c 6970 s - Ellip │ │ │ +00061a90: 7365 2070 6172 616d 6574 6572 733c 2f64 se parameters.
    poi │ │ │ +00061ab0: 6e74 733c 2f63 6f64 653e 202d 2049 6e70 nts - Inp │ │ │ +00061ac0: 7574 2032 6420 706f 696e 7473 3c2f 6464 ut 2d points
    .
    clos │ │ │ +00061ae0: 6573 745f 7074 733c 2f63 6f64 653e 202d est_pts - │ │ │ +00061af0: 2046 6f72 2065 6163 6820 3264 2070 6f69 For each 2d poi │ │ │ +00061b00: 6e74 2c20 7468 6569 7220 636f 7272 6573 nt, their corres │ │ │ +00061b10: 706f 6e64 696e 6720 636c 6f73 6573 7420 ponding closest │ │ │ +00061b20: 3264 2070 6f69 6e74 206c 6f63 6174 6564 2d point located │ │ │ +00061b30: 206f 6e20 6120 6769 7665 6e20 656c 6c69 on a given elli │ │ │ +00061b40: 7073 650a 0a3c 623e 4e6f 7465 3a3c 2f62 pse..Note: Input point ty │ │ │ +00061b60: 7065 7320 6172 6520 5245 463a 2050 6f69 pes are REF: Poi │ │ │ +00061b70: 6e74 3269 206f 7220 5245 463a 2050 6f69 nt2i or REF: Poi │ │ │ +00061b80: 6e74 3266 0a53 4545 3a20 6669 7445 6c6c nt2f.SEE: fitEll │ │ │ +00061b90: 6970 7365 2c20 6669 7445 6c6c 6970 7365 ipse, fitEllipse │ │ │ +00061ba0: 414d 532c 2066 6974 456c 6c69 7073 6544 AMS, fitEllipseD │ │ │ +00061bb0: 6972 6563 743c 2f64 643e 0a3c 2f64 6c3e irect
    .
    │ │ │ +00061bc0: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • ..

    fitLin │ │ │ +00061c50: 653c 2f68 333e 0a3c 6469 7620 636c 6173 e

    .
    .
    pub │ │ │ +00061cb0: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static void&nbs │ │ │ +00061cf0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;fit │ │ │ +00061d10: 4c69 6e65 3c2f 7370 616e 3e3c 7762 723e Line │ │ │ +00061d20: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +00061d80: 7370 3b70 6f69 6e74 732c 0a20 3c61 2068 sp;points,. Mat& │ │ │ +00061dd0: 6e62 7370 3b6c 696e 652c 0a20 696e 7426 nbsp;line,. int& │ │ │ +00061de0: 6e62 7370 3b64 6973 7454 7970 652c 0a20 nbsp;distType,. │ │ │ +00061df0: 646f 7562 6c65 266e 6273 703b 7061 7261 double para │ │ │ +00061e00: 6d2c 0a20 646f 7562 6c65 266e 6273 703b m,. double  │ │ │ +00061e10: 7265 7073 2c0a 2064 6f75 626c 6526 6e62 reps,. double&nb │ │ │ +00061e20: 7370 3b61 6570 7329 3c2f 7370 616e 3e3c sp;aeps)< │ │ │ +00061e30: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Fits a │ │ │ +00061e50: 6c69 6e65 2074 6f20 6120 3244 206f 7220 line to a 2D or │ │ │ +00061e60: 3344 2070 6f69 6e74 2073 6574 2e0a 0a54 3D point set...T │ │ │ +00061e70: 6865 2066 756e 6374 696f 6e20 6669 744c he function fitL │ │ │ +00061e80: 696e 6520 6669 7473 2061 206c 696e 6520 ine fits a line │ │ │ +00061e90: 746f 2061 2032 4420 6f72 2033 4420 706f to a 2D or 3D po │ │ │ +00061ea0: 696e 7420 7365 7420 6279 206d 696e 696d int set by minim │ │ │ +00061eb0: 697a 696e 6720 5c28 5c73 756d 5f69 205c izing \(\sum_i \ │ │ │ +00061ec0: 7268 6f28 725f 6929 5c29 2077 6865 7265 rho(r_i)\) where │ │ │ +00061ed0: 0a5c 2872 5f69 5c29 2069 7320 6120 6469 .\(r_i\) is a di │ │ │ +00061ee0: 7374 616e 6365 2062 6574 7765 656e 2074 stance between t │ │ │ +00061ef0: 6865 205c 2869 5e7b 7468 7d5c 2920 706f he \(i^{th}\) po │ │ │ +00061f00: 696e 742c 2074 6865 206c 696e 6520 616e int, the line an │ │ │ +00061f10: 6420 5c28 5c72 686f 2872 295c 2920 6973 d \(\rho(r)\) is │ │ │ +00061f20: 2061 2064 6973 7461 6e63 6520 6675 6e63 a distance func │ │ │ +00061f30: 7469 6f6e 2c20 6f6e 650a 6f66 2074 6865 tion, one.of the │ │ │ +00061f40: 2066 6f6c 6c6f 7769 6e67 3a0a 2d20 2044 following:.- D │ │ │ +00061f50: 4953 545f 4c32 0a5c 285c 7268 6f20 2872 IST_L2.\(\rho (r │ │ │ +00061f60: 2920 3d20 725e 322f 3220 205c 7175 6164 ) = r^2/2 \quad │ │ │ +00061f70: 205c 7465 7874 7b28 7468 6520 7369 6d70 \text{(the simp │ │ │ +00061f80: 6c65 7374 2061 6e64 2074 6865 2066 6173 lest and the fas │ │ │ +00061f90: 7465 7374 206c 6561 7374 2d73 7175 6172 test least-squar │ │ │ +00061fa0: 6573 206d 6574 686f 6429 7d5c 290a 2d20 es method)}\).- │ │ │ +00061fb0: 4449 5354 5f4c 310a 5c28 5c72 686f 2028 DIST_L1.\(\rho ( │ │ │ +00061fc0: 7229 203d 2072 5c29 0a2d 2044 4953 545f r) = r\).- DIST_ │ │ │ +00061fd0: 4c31 320a 5c28 5c72 686f 2028 7229 203d L12.\(\rho (r) = │ │ │ +00061fe0: 2032 2020 5c63 646f 7420 2820 5c73 7172 2 \cdot ( \sqr │ │ │ +00061ff0: 747b 3120 2b20 5c66 7261 637b 725e 327d t{1 + \frac{r^2} │ │ │ +00062000: 7b32 7d7d 202d 2031 295c 290a 2d20 4449 {2}} - 1)\).- DI │ │ │ +00062010: 5354 5f46 4149 520a 5c28 5c72 686f 205c ST_FAIR.\(\rho \ │ │ │ +00062020: 6c65 6674 2028 7220 5c72 6967 6874 2029 left (r \right ) │ │ │ +00062030: 203d 2043 5e32 2020 5c63 646f 7420 5c6c = C^2 \cdot \l │ │ │ +00062040: 6566 7420 2820 205c 6672 6163 7b72 7d7b eft ( \frac{r}{ │ │ │ +00062050: 437d 202d 2020 5c6c 6f67 7b5c 6c65 6674 C} - \log{\left │ │ │ +00062060: 2831 202b 205c 6672 6163 7b72 7d7b 437d (1 + \frac{r}{C} │ │ │ +00062070: 5c72 6967 6874 297d 205c 7269 6768 7420 \right)} \right │ │ │ +00062080: 2920 205c 7175 6164 205c 7465 7874 7b77 ) \quad \text{w │ │ │ +00062090: 6865 7265 7d20 5c71 7561 6420 433d 312e here} \quad C=1. │ │ │ +000620a0: 3339 3938 5c29 0a2d 2044 4953 545f 5745 3998\).- DIST_WE │ │ │ +000620b0: 4c53 4348 0a5c 285c 7268 6f20 5c6c 6566 LSCH.\(\rho \lef │ │ │ +000620c0: 7420 2872 205c 7269 6768 7420 2920 3d20 t (r \right ) = │ │ │ +000620d0: 205c 6672 6163 7b43 5e32 7d7b 327d 205c \frac{C^2}{2} \ │ │ │ +000620e0: 6364 6f74 205c 6c65 6674 2028 2031 202d cdot \left ( 1 - │ │ │ +000620f0: 2020 5c65 7870 7b5c 6c65 6674 282d 5c6c \exp{\left(-\l │ │ │ +00062100: 6566 7428 5c66 7261 637b 727d 7b43 7d5c eft(\frac{r}{C}\ │ │ │ +00062110: 7269 6768 7429 5e32 5c72 6967 6874 297d right)^2\right)} │ │ │ +00062120: 205c 7269 6768 7420 2920 205c 7175 6164 \right ) \quad │ │ │ +00062130: 205c 7465 7874 7b77 6865 7265 7d20 5c71 \text{where} \q │ │ │ +00062140: 7561 6420 433d 322e 3938 3436 5c29 0a2d uad C=2.9846\).- │ │ │ +00062150: 2044 4953 545f 4855 4245 520a 5c28 5c72 DIST_HUBER.\(\r │ │ │ +00062160: 686f 2028 7229 203d 2020 5c66 6f72 6b7b ho (r) = \fork{ │ │ │ +00062170: 725e 322f 327d 7b69 6620 5c28 7220 266c r^2/2}{if \(r &l │ │ │ +00062180: 743b 2043 5c29 7d7b 4320 5c63 646f 7420 t; C\)}{C \cdot │ │ │ +00062190: 2872 2d43 2f32 297d 7b6f 7468 6572 7769 (r-C/2)}{otherwi │ │ │ +000621a0: 7365 7d20 5c71 7561 6420 5c74 6578 747b se} \quad \text{ │ │ │ +000621b0: 7768 6572 657d 205c 7175 6164 2043 3d31 where} \quad C=1 │ │ │ +000621c0: 2e33 3435 5c29 0a0a 5468 6520 616c 676f .345\)..The algo │ │ │ +000621d0: 7269 7468 6d20 6973 2062 6173 6564 206f rithm is based o │ │ │ +000621e0: 6e20 7468 6520 4d2d 6573 7469 6d61 746f n the M-estimato │ │ │ +000621f0: 7220 2820 266c 743b 6874 7470 733a 2f2f r ( <https:// │ │ │ +00062200: 656e 2e77 696b 6970 6564 6961 2e6f 7267 en.wikipedia.org │ │ │ +00062210: 2f77 696b 692f 4d2d 6573 7469 6d61 746f /wiki/M-estimato │ │ │ +00062220: 7226 6774 3b20 2920 7465 6368 6e69 7175 r> ) techniqu │ │ │ +00062230: 650a 7468 6174 2069 7465 7261 7469 7665 e.that iterative │ │ │ +00062240: 6c79 2066 6974 7320 7468 6520 6c69 6e65 ly fits the line │ │ │ +00062250: 2075 7369 6e67 2074 6865 2077 6569 6768 using the weigh │ │ │ +00062260: 7465 6420 6c65 6173 742d 7371 7561 7265 ted least-square │ │ │ +00062270: 7320 616c 676f 7269 7468 6d2e 2041 6674 s algorithm. Aft │ │ │ +00062280: 6572 2065 6163 6820 6974 6572 6174 696f er each iteratio │ │ │ +00062290: 6e20 7468 650a 7765 6967 6874 7320 5c28 n the.weights \( │ │ │ +000622a0: 775f 695c 2920 6172 6520 6164 6a75 7374 w_i\) are adjust │ │ │ +000622b0: 6564 2074 6f20 6265 2069 6e76 6572 7365 ed to be inverse │ │ │ +000622c0: 6c79 2070 726f 706f 7274 696f 6e61 6c20 ly proportional │ │ │ +000622d0: 746f 205c 285c 7268 6f28 725f 6929 5c29 to \(\rho(r_i)\) │ │ │ +000622e0: 202e 3c2f 6469 763e 0a3c 646c 2063 6c61 .
    .
    .
    │ │ │ +00062300: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ +00062310: 0a3c 6464 3e3c 636f 6465 3e70 6f69 6e74 .
    point │ │ │ +00062320: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ +00062330: 2076 6563 746f 7220 6f66 2032 4420 6f72 vector of 2D or │ │ │ +00062340: 2033 4420 706f 696e 7473 2c20 7374 6f72 3D points, stor │ │ │ +00062350: 6564 2069 6e20 7374 643a 3a76 6563 746f ed in std::vecto │ │ │ +00062360: 7226 6c74 3b26 6774 3b20 6f72 204d 6174 r<> or Mat │ │ │ +00062370: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    line - O │ │ │ +00062390: 7574 7075 7420 6c69 6e65 2070 6172 616d utput line param │ │ │ +000623a0: 6574 6572 732e 2049 6e20 6361 7365 206f eters. In case o │ │ │ +000623b0: 6620 3244 2066 6974 7469 6e67 2c20 6974 f 2D fitting, it │ │ │ +000623c0: 2073 686f 756c 6420 6265 2061 2076 6563 should be a vec │ │ │ +000623d0: 746f 7220 6f66 2034 2065 6c65 6d65 6e74 tor of 4 element │ │ │ +000623e0: 730a 286c 696b 6520 5665 6334 6629 202d s.(like Vec4f) - │ │ │ +000623f0: 2028 7678 2c20 7679 2c20 7830 2c20 7930 (vx, vy, x0, y0 │ │ │ +00062400: 292c 2077 6865 7265 2028 7678 2c20 7679 ), where (vx, vy │ │ │ +00062410: 2920 6973 2061 206e 6f72 6d61 6c69 7a65 ) is a normalize │ │ │ +00062420: 6420 7665 6374 6f72 2063 6f6c 6c69 6e65 d vector colline │ │ │ +00062430: 6172 2074 6f20 7468 6520 6c69 6e65 2061 ar to the line a │ │ │ +00062440: 6e64 0a28 7830 2c20 7930 2920 6973 2061 nd.(x0, y0) is a │ │ │ +00062450: 2070 6f69 6e74 206f 6e20 7468 6520 6c69 point on the li │ │ │ +00062460: 6e65 2e20 496e 2063 6173 6520 6f66 2033 ne. In case of 3 │ │ │ +00062470: 4420 6669 7474 696e 672c 2069 7420 7368 D fitting, it sh │ │ │ +00062480: 6f75 6c64 2062 6520 6120 7665 6374 6f72 ould be a vector │ │ │ +00062490: 206f 6620 3620 656c 656d 656e 7473 2028 of 6 elements ( │ │ │ +000624a0: 6c69 6b65 0a56 6563 3666 2920 2d20 2876 like.Vec6f) - (v │ │ │ +000624b0: 782c 2076 792c 2076 7a2c 2078 302c 2079 x, vy, vz, x0, y │ │ │ +000624c0: 302c 207a 3029 2c20 7768 6572 6520 2876 0, z0), where (v │ │ │ +000624d0: 782c 2076 792c 2076 7a29 2069 7320 6120 x, vy, vz) is a │ │ │ +000624e0: 6e6f 726d 616c 697a 6564 2076 6563 746f normalized vecto │ │ │ +000624f0: 7220 636f 6c6c 696e 6561 7220 746f 2074 r collinear to t │ │ │ +00062500: 6865 206c 696e 650a 616e 6420 2878 302c he line.and (x0, │ │ │ +00062510: 2079 302c 207a 3029 2069 7320 6120 706f y0, z0) is a po │ │ │ +00062520: 696e 7420 6f6e 2074 6865 206c 696e 652e int on the line. │ │ │ +00062530: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +00062540: 6469 7374 5479 7065 3c2f 636f 6465 3e20 distType │ │ │ +00062550: 2d20 4469 7374 616e 6365 2075 7365 6420 - Distance used │ │ │ +00062560: 6279 2074 6865 204d 2d65 7374 696d 6174 by the M-estimat │ │ │ +00062570: 6f72 2c20 7365 6520 2344 6973 7461 6e63 or, see #Distanc │ │ │ +00062580: 6554 7970 6573 3c2f 6464 3e0a 3c64 643e eTypes
    .
    │ │ │ +00062590: 3c63 6f64 653e 7061 7261 6d3c 2f63 6f64 param - Numerical p │ │ │ +000625b0: 6172 616d 6574 6572 2028 2043 2029 2066 arameter ( C ) f │ │ │ +000625c0: 6f72 2073 6f6d 6520 7479 7065 7320 6f66 or some types of │ │ │ +000625d0: 2064 6973 7461 6e63 6573 2e20 4966 2069 distances. If i │ │ │ +000625e0: 7420 6973 2030 2c20 616e 206f 7074 696d t is 0, an optim │ │ │ +000625f0: 616c 2076 616c 7565 0a69 7320 6368 6f73 al value.is chos │ │ │ +00062600: 656e 2e3c 2f64 643e 0a3c 6464 3e3c 636f en.
    .
    reps - │ │ │ +00062620: 2053 7566 6669 6369 656e 7420 6163 6375 Sufficient accu │ │ │ +00062630: 7261 6379 2066 6f72 2074 6865 2072 6164 racy for the rad │ │ │ +00062640: 6975 7320 2864 6973 7461 6e63 6520 6265 ius (distance be │ │ │ +00062650: 7477 6565 6e20 7468 6520 636f 6f72 6469 tween the coordi │ │ │ +00062660: 6e61 7465 206f 7269 6769 6e20 616e 6420 nate origin and │ │ │ +00062670: 7468 6520 6c69 6e65 292e 3c2f 6464 3e0a the line).
    . │ │ │ +00062680: 3c64 643e 3c63 6f64 653e 6165 7073 3c2f
    aeps - Sufficie │ │ │ +000626a0: 6e74 2061 6363 7572 6163 7920 666f 7220 nt accuracy for │ │ │ +000626b0: 7468 6520 616e 676c 652e 2030 2e30 3120 the angle. 0.01 │ │ │ +000626c0: 776f 756c 6420 6265 2061 2067 6f6f 6420 would be a good │ │ │ +000626d0: 6465 6661 756c 7420 7661 6c75 6520 666f default value fo │ │ │ +000626e0: 7220 7265 7073 2061 6e64 2061 6570 732e r reps and aeps. │ │ │ +000626f0: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ....
  • ..

    pointPol │ │ │ +00062790: 7967 6f6e 5465 7374 3c2f 6833 3e0a 3c64 ygonTest

    ..public stati │ │ │ +00062800: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c double pointPolyg │ │ │ +00062860: 6f6e 5465 7374 3c2f 7370 616e 3e3c 7762 onTest(MatOfPoint2f contour,. │ │ │ +000628f0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 P │ │ │ +00062930: 6f69 6e74 3c2f 613e 266e 6273 703b 7074 oint pt │ │ │ +00062940: 2c0a 2062 6f6f 6c65 616e 266e 6273 703b ,. boolean  │ │ │ +00062950: 6d65 6173 7572 6544 6973 7429 3c2f 7370 measureDist).
    Per │ │ │ +00062980: 666f 726d 7320 6120 706f 696e 742d 696e forms a point-in │ │ │ +00062990: 2d63 6f6e 746f 7572 2074 6573 742e 0a0a -contour test... │ │ │ +000629a0: 5468 6520 6675 6e63 7469 6f6e 2064 6574 The function det │ │ │ +000629b0: 6572 6d69 6e65 7320 7768 6574 6865 7220 ermines whether │ │ │ +000629c0: 7468 6520 706f 696e 7420 6973 2069 6e73 the point is ins │ │ │ +000629d0: 6964 6520 6120 636f 6e74 6f75 722c 206f ide a contour, o │ │ │ +000629e0: 7574 7369 6465 2c20 6f72 206c 6965 7320 utside, or lies │ │ │ +000629f0: 6f6e 2061 6e20 6564 6765 2028 6f72 0a63 on an edge (or.c │ │ │ +00062a00: 6f69 6e63 6964 6573 2077 6974 6820 6120 oincides with a │ │ │ +00062a10: 7665 7274 6578 292e 2049 7420 7265 7475 vertex). It retu │ │ │ +00062a20: 726e 7320 706f 7369 7469 7665 2028 696e rns positive (in │ │ │ +00062a30: 7369 6465 292c 206e 6567 6174 6976 6520 side), negative │ │ │ +00062a40: 286f 7574 7369 6465 292c 206f 7220 7a65 (outside), or ze │ │ │ +00062a50: 726f 2028 6f6e 2061 6e20 6564 6765 290a ro (on an edge). │ │ │ +00062a60: 7661 6c75 652c 2063 6f72 7265 7370 6f6e value, correspon │ │ │ +00062a70: 6469 6e67 6c79 2e20 5768 656e 206d 6561 dingly. When mea │ │ │ +00062a80: 7375 7265 4469 7374 3d66 616c 7365 202c sureDist=false , │ │ │ +00062a90: 2074 6865 2072 6574 7572 6e20 7661 6c75 the return valu │ │ │ +00062aa0: 6520 6973 202b 312c 202d 312c 2061 6e64 e is +1, -1, and │ │ │ +00062ab0: 2030 2c20 7265 7370 6563 7469 7665 6c79 0, respectively │ │ │ +00062ac0: 2e0a 4f74 6865 7277 6973 652c 2074 6865 ..Otherwise, the │ │ │ +00062ad0: 2072 6574 7572 6e20 7661 6c75 6520 6973 return value is │ │ │ +00062ae0: 2061 2073 6967 6e65 6420 6469 7374 616e a signed distan │ │ │ +00062af0: 6365 2062 6574 7765 656e 2074 6865 2070 ce between the p │ │ │ +00062b00: 6f69 6e74 2061 6e64 2074 6865 206e 6561 oint and the nea │ │ │ +00062b10: 7265 7374 2063 6f6e 746f 7572 2065 6467 rest contour edg │ │ │ +00062b20: 652e 0a0a 5365 6520 6265 6c6f 7720 6120 e...See below a │ │ │ +00062b30: 7361 6d70 6c65 206f 7574 7075 7420 6f66 sample output of │ │ │ +00062b40: 2074 6865 2066 756e 6374 696f 6e20 7768 the function wh │ │ │ +00062b50: 6572 6520 6561 6368 2069 6d61 6765 2070 ere each image p │ │ │ +00062b60: 6978 656c 2069 7320 7465 7374 6564 2061 ixel is tested a │ │ │ +00062b70: 6761 696e 7374 2074 6865 2063 6f6e 746f gainst the conto │ │ │ +00062b80: 7572 3a0a 0a21 5b73 616d 706c 6520 6f75 ur:..![sample ou │ │ │ +00062b90: 7470 7574 5d28 7069 6373 2f70 6f69 6e74 tput](pics/point │ │ │ +00062ba0: 706f 6c79 676f 6e2e 706e 6729 3c2f 6469 polygon.png).
    .
    Parame │ │ │ +00062bd0: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ +00062be0: 636f 6465 3e63 6f6e 746f 7572 3c2f 636f code>contour - Input cont │ │ │ +00062c00: 6f75 722e 3c2f 6464 3e0a 3c64 643e 3c63 our.
    .
    pt - │ │ │ +00062c20: 506f 696e 7420 7465 7374 6564 2061 6761 Point tested aga │ │ │ +00062c30: 696e 7374 2074 6865 2063 6f6e 746f 7572 inst the contour │ │ │ +00062c40: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    measureDist - If true, t │ │ │ +00062c70: 6865 2066 756e 6374 696f 6e20 6573 7469 he function esti │ │ │ +00062c80: 6d61 7465 7320 7468 6520 7369 676e 6564 mates the signed │ │ │ +00062c90: 2064 6973 7461 6e63 6520 6672 6f6d 2074 distance from t │ │ │ +00062ca0: 6865 2070 6f69 6e74 2074 6f20 7468 650a he point to the. │ │ │ +00062cb0: 6e65 6172 6573 7420 636f 6e74 6f75 7220 nearest contour │ │ │ +00062cc0: 6564 6765 2e20 4f74 6865 7277 6973 652c edge. Otherwise, │ │ │ +00062cd0: 2074 6865 2066 756e 6374 696f 6e20 6f6e the function on │ │ │ +00062ce0: 6c79 2063 6865 636b 7320 6966 2074 6865 ly checks if the │ │ │ +00062cf0: 2070 6f69 6e74 2069 7320 696e 7369 6465 point is inside │ │ │ +00062d00: 2061 2063 6f6e 746f 7572 206f 7220 6e6f a contour or no │ │ │ +00062d10: 742e 3c2f 6464 3e0a 3c64 743e 5265 7475 t.
    .
    Retu │ │ │ +00062d20: 726e 733a 3c2f 6474 3e0a 3c64 643e 6175 rns:
    .
    au │ │ │ +00062d30: 746f 6d61 7469 6361 6c6c 7920 6765 6e65 tomatically gene │ │ │ +00062d40: 7261 7465 643c 2f64 643e 0a3c 2f64 6c3e rated
    .
    │ │ │ +00062d50: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • ..

    rotate │ │ │ +00062e00: 6452 6563 7461 6e67 6c65 496e 7465 7273 dRectangleInters │ │ │ +00062e10: 6563 7469 6f6e 3c2f 6833 3e0a 3c64 6976 ection

    .
    .
    public static< │ │ │ +00062e80: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> int │ │ │ +00062eb0: 266e 6273 703b 3c73 7061 6e20 636c 6173  rotatedRectangl │ │ │ +00062ee0: 6549 6e74 6572 7365 6374 696f 6e3c 2f73 eIntersection(RotatedRe │ │ │ +00062f60: 6374 3c2f 613e 266e 6273 703b 7265 6374 ct rect │ │ │ +00062f70: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. RotatedR │ │ │ +00062fc0: 6563 743c 2f61 3e26 6e62 7370 3b72 6563 ect rec │ │ │ +00062fd0: 7432 2c0a 203c 6120 6872 6566 3d22 2e2e t2,. Mat in │ │ │ +00063020: 7465 7273 6563 7469 6e67 5265 6769 6f6e tersectingRegion │ │ │ +00063030: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ +00063040: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ +00063050: 223e 4669 6e64 7320 6f75 7420 6966 2074 ">Finds out if t │ │ │ +00063060: 6865 7265 2069 7320 616e 7920 696e 7465 here is any inte │ │ │ +00063070: 7273 6563 7469 6f6e 2062 6574 7765 656e rsection between │ │ │ +00063080: 2074 776f 2072 6f74 6174 6564 2072 6563 two rotated rec │ │ │ +00063090: 7461 6e67 6c65 732e 0a0a 4966 2074 6865 tangles...If the │ │ │ +000630a0: 7265 2069 7320 7468 656e 2074 6865 2076 re is then the v │ │ │ +000630b0: 6572 7469 6365 7320 6f66 2074 6865 2069 ertices of the i │ │ │ +000630c0: 6e74 6572 7365 6374 696e 6720 7265 6769 ntersecting regi │ │ │ +000630d0: 6f6e 2061 7265 2072 6574 7572 6e65 6420 on are returned │ │ │ +000630e0: 6173 2077 656c 6c2e 0a0a 4265 6c6f 7720 as well...Below │ │ │ +000630f0: 6172 6520 736f 6d65 2065 7861 6d70 6c65 are some example │ │ │ +00063100: 7320 6f66 2069 6e74 6572 7365 6374 696f s of intersectio │ │ │ +00063110: 6e20 636f 6e66 6967 7572 6174 696f 6e73 n configurations │ │ │ +00063120: 2e20 5468 6520 6861 7463 6865 6420 7061 . The hatched pa │ │ │ +00063130: 7474 6572 6e20 696e 6469 6361 7465 7320 ttern indicates │ │ │ +00063140: 7468 650a 696e 7465 7273 6563 7469 6e67 the.intersecting │ │ │ +00063150: 2072 6567 696f 6e20 616e 6420 7468 6520 region and the │ │ │ +00063160: 7265 6420 7665 7274 6963 6573 2061 7265 red vertices are │ │ │ +00063170: 2072 6574 7572 6e65 6420 6279 2074 6865 returned by the │ │ │ +00063180: 2066 756e 6374 696f 6e2e 0a0a 215b 696e function...![in │ │ │ +00063190: 7465 7273 6563 7469 6f6e 2065 7861 6d70 tersection examp │ │ │ +000631a0: 6c65 735d 2870 6963 732f 696e 7465 7273 les](pics/inters │ │ │ +000631b0: 6563 7469 6f6e 2e70 6e67 293c 2f64 6976 ection.png)
    .
    .
    Paramet │ │ │ +000631e0: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    rect1 │ │ │ +00063200: 202d 2046 6972 7374 2072 6563 7461 6e67 - First rectang │ │ │ +00063210: 6c65 3c2f 6464 3e0a 3c64 643e 3c63 6f64 le
    .
    rect2 - │ │ │ +00063230: 2053 6563 6f6e 6420 7265 6374 616e 676c Second rectangl │ │ │ +00063240: 653c 2f64 643e 0a3c 6464 3e3c 636f 6465 e
    .
    intersectingReg │ │ │ +00063260: 696f 6e3c 2f63 6f64 653e 202d 2054 6865 ion - The │ │ │ +00063270: 206f 7574 7075 7420 6172 7261 7920 6f66 output array of │ │ │ +00063280: 2074 6865 2076 6572 7469 6365 7320 6f66 the vertices of │ │ │ +00063290: 2074 6865 2069 6e74 6572 7365 6374 696e the intersectin │ │ │ +000632a0: 6720 7265 6769 6f6e 2e20 4974 2072 6574 g region. It ret │ │ │ +000632b0: 7572 6e73 0a61 7420 6d6f 7374 2038 2076 urns.at most 8 v │ │ │ +000632c0: 6572 7469 6365 732e 2053 746f 7265 6420 ertices. Stored │ │ │ +000632d0: 6173 2073 7464 3a3a 7665 6374 6f72 266c as std::vector&l │ │ │ +000632e0: 743b 6376 3a3a 506f 696e 7432 6626 6774 t;cv::Point2f> │ │ │ +000632f0: 3b20 6f72 2063 763a 3a4d 6174 2061 7320 ; or cv::Mat as │ │ │ +00063300: 4d78 3120 6f66 2074 7970 6520 4356 5f33 Mx1 of type CV_3 │ │ │ +00063310: 3246 4332 2e3c 2f64 643e 0a3c 6474 3e52 2FC2.
    .
    R │ │ │ +00063320: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    One of #Rectang │ │ │ +00063340: 6c65 7349 6e74 6572 7365 6374 5479 7065 lesIntersectType │ │ │ +00063350: 733c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 s
    .
    ...< │ │ │ +00063370: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    arcL │ │ │ +000633d0: 656e 6774 683c 2f68 333e 0a3c 6469 7620 ength

    .
    .
    public static double arcLength(MatOfPoin │ │ │ +00063510: 7432 663c 2f61 3e26 6e62 7370 3b63 7572 t2f cur │ │ │ +00063520: 7665 2c0a 2062 6f6f 6c65 616e 266e 6273 ve,. boolean&nbs │ │ │ +00063530: 703b 636c 6f73 6564 293c 2f73 7061 6e3e p;closed) │ │ │ +00063540: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Calcul │ │ │ +00063560: 6174 6573 2061 2063 6f6e 746f 7572 2070 ates a contour p │ │ │ +00063570: 6572 696d 6574 6572 206f 7220 6120 6375 erimeter or a cu │ │ │ +00063580: 7276 6520 6c65 6e67 7468 2e0a 0a54 6865 rve length...The │ │ │ +00063590: 2066 756e 6374 696f 6e20 636f 6d70 7574 function comput │ │ │ +000635a0: 6573 2061 2063 7572 7665 206c 656e 6774 es a curve lengt │ │ │ +000635b0: 6820 6f72 2061 2063 6c6f 7365 6420 636f h or a closed co │ │ │ +000635c0: 6e74 6f75 7220 7065 7269 6d65 7465 722e ntour perimeter. │ │ │ +000635d0: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ +000635f0: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ +00063600: 6464 3e3c 636f 6465 3e63 7572 7665 3c2f dd>curve - Input ve │ │ │ +00063620: 6374 6f72 206f 6620 3244 2070 6f69 6e74 ctor of 2D point │ │ │ +00063630: 732c 2073 746f 7265 6420 696e 2073 7464 s, stored in std │ │ │ +00063640: 3a3a 7665 6374 6f72 206f 7220 4d61 742e ::vector or Mat. │ │ │ +00063650: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e .
    │ │ │ +00063660: 636c 6f73 6564 3c2f 636f 6465 3e20 2d20 closed - │ │ │ +00063670: 466c 6167 2069 6e64 6963 6174 696e 6720 Flag indicating │ │ │ +00063680: 7768 6574 6865 7220 7468 6520 6375 7276 whether the curv │ │ │ +00063690: 6520 6973 2063 6c6f 7365 6420 6f72 206e e is closed or n │ │ │ +000636a0: 6f74 2e3c 2f64 643e 0a3c 6474 3e52 6574 ot.
    .
    Ret │ │ │ +000636b0: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e61 urns:
    .
    a │ │ │ +000636c0: 7574 6f6d 6174 6963 616c 6c79 2067 656e utomatically gen │ │ │ +000636d0: 6572 6174 6564 3c2f 6464 3e0a 3c2f 646c erated
    .
    .
    .
    .
  • .
  • .< │ │ │ +00063700: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +00063710: 6574 6169 6c22 2069 643d 2263 6f6e 746f etail" id="conto │ │ │ +00063720: 7572 4172 6561 286f 7267 2e6f 7065 6e63 urArea(org.openc │ │ │ +00063730: 762e 636f 7265 2e4d 6174 2c62 6f6f 6c65 v.core.Mat,boole │ │ │ +00063740: 616e 2922 3e0a 3c68 333e 636f 6e74 6f75 an)">.

    contou │ │ │ +00063750: 7241 7265 613c 2f68 333e 0a3c 6469 7620 rArea

    .
    .
    public static decomposeP │ │ │ -000637f0: 726f 6a65 6374 696f 6e4d 6174 7269 783c rojectionMatrix< │ │ │ -00063800: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat pr │ │ │ -00063870: 6f6a 4d61 7472 6978 2c0a 203c 6120 6872 ojMatrix,. Mat&n │ │ │ -000638c0: 6273 703b 6361 6d65 7261 4d61 7472 6978 bsp;cameraMatrix │ │ │ -000638d0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -00063910: 6174 3c2f 613e 266e 6273 703b 726f 744d at rotM │ │ │ -00063920: 6174 7269 782c 0a20 3c61 2068 7265 663d atrix,. Mat  │ │ │ -00063970: 3b74 7261 6e73 5665 6374 2c0a 203c 6120 ;transVect,. Mat │ │ │ -000639c0: 266e 6273 703b 726f 744d 6174 7269 7858  rotMatrixX │ │ │ -000639d0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -00063a10: 6174 3c2f 613e 266e 6273 703b 726f 744d at rotM │ │ │ -00063a20: 6174 7269 7859 293c 2f73 7061 6e3e 3c2f atrixY).
    Decompos │ │ │ -00063a50: 6573 2061 2070 726f 6a65 6374 696f 6e20 es a projection │ │ │ -00063a60: 6d61 7472 6978 2069 6e74 6f20 6120 726f matrix into a ro │ │ │ -00063a70: 7461 7469 6f6e 206d 6174 7269 7820 616e tation matrix an │ │ │ -00063a80: 6420 6120 6361 6d65 7261 2069 6e74 7269 d a camera intri │ │ │ -00063a90: 6e73 6963 206d 6174 7269 782e 3c2f 6469 nsic matrix..
    .
    Parame │ │ │ -00063ac0: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ -00063ad0: 636f 6465 3e70 726f 6a4d 6174 7269 783c code>projMatrix< │ │ │ -00063ae0: 2f63 6f64 653e 202d 2033 7834 2069 6e70 /code> - 3x4 inp │ │ │ -00063af0: 7574 2070 726f 6a65 6374 696f 6e20 6d61 ut projection ma │ │ │ -00063b00: 7472 6978 2050 2e3c 2f64 643e 0a3c 6464 trix P.
    .
    cameraMat │ │ │ -00063b20: 7269 783c 2f63 6f64 653e 202d 204f 7574 rix - Out │ │ │ -00063b30: 7075 7420 3378 3320 6361 6d65 7261 2069 put 3x3 camera i │ │ │ -00063b40: 6e74 7269 6e73 6963 206d 6174 7269 7820 ntrinsic matrix │ │ │ -00063b50: 5c28 5c63 616d 6572 616d 6174 7269 787b \(\cameramatrix{ │ │ │ -00063b60: 417d 5c29 2e3c 2f64 643e 0a3c 6464 3e3c A}\).
    .
    < │ │ │ -00063b70: 636f 6465 3e72 6f74 4d61 7472 6978 3c2f code>rotMatrix - Output 3 │ │ │ -00063b90: 7833 2065 7874 6572 6e61 6c20 726f 7461 x3 external rota │ │ │ -00063ba0: 7469 6f6e 206d 6174 7269 7820 522e 3c2f tion matrix R..
    tr │ │ │ -00063bc0: 616e 7356 6563 743c 2f63 6f64 653e 202d ansVect - │ │ │ -00063bd0: 204f 7574 7075 7420 3478 3120 7472 616e Output 4x1 tran │ │ │ -00063be0: 736c 6174 696f 6e20 7665 6374 6f72 2054 slation vector T │ │ │ -00063bf0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    rotMatrixX - Optional 3x │ │ │ -00063c20: 3320 726f 7461 7469 6f6e 206d 6174 7269 3 rotation matri │ │ │ -00063c30: 7820 6172 6f75 6e64 2078 2d61 7869 732e x around x-axis. │ │ │ -00063c40: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -00063c50: 726f 744d 6174 7269 7859 3c2f 636f 6465 rotMatrixY - Optional 3x3 │ │ │ -00063c70: 2072 6f74 6174 696f 6e20 6d61 7472 6978 rotation matrix │ │ │ -00063c80: 2061 726f 756e 6420 792d 6178 6973 2e0a around y-axis.. │ │ │ -00063c90: 6465 6772 6565 732e 0a0a 5468 6520 6675 degrees...The fu │ │ │ -00063ca0: 6e63 7469 6f6e 2063 6f6d 7075 7465 7320 nction computes │ │ │ -00063cb0: 6120 6465 636f 6d70 6f73 6974 696f 6e20 a decomposition │ │ │ -00063cc0: 6f66 2061 2070 726f 6a65 6374 696f 6e20 of a projection │ │ │ -00063cd0: 6d61 7472 6978 2069 6e74 6f20 6120 6361 matrix into a ca │ │ │ -00063ce0: 6c69 6272 6174 696f 6e20 616e 6420 6120 libration and a │ │ │ -00063cf0: 726f 7461 7469 6f6e 0a6d 6174 7269 7820 rotation.matrix │ │ │ -00063d00: 616e 6420 7468 6520 706f 7369 7469 6f6e and the position │ │ │ -00063d10: 206f 6620 6120 6361 6d65 7261 2e0a 0a49 of a camera...I │ │ │ -00063d20: 7420 6f70 7469 6f6e 616c 6c79 2072 6574 t optionally ret │ │ │ -00063d30: 7572 6e73 2074 6872 6565 2072 6f74 6174 urns three rotat │ │ │ -00063d40: 696f 6e20 6d61 7472 6963 6573 2c20 6f6e ion matrices, on │ │ │ -00063d50: 6520 666f 7220 6561 6368 2061 7869 732c e for each axis, │ │ │ -00063d60: 2061 6e64 2074 6872 6565 2045 756c 6572 and three Euler │ │ │ -00063d70: 2061 6e67 6c65 7320 7468 6174 2063 6f75 angles that cou │ │ │ -00063d80: 6c64 0a62 6520 7573 6564 2069 6e20 4f70 ld.be used in Op │ │ │ -00063d90: 656e 474c 2e20 4e6f 7465 2c20 7468 6572 enGL. Note, ther │ │ │ -00063da0: 6520 6973 2061 6c77 6179 7320 6d6f 7265 e is always more │ │ │ -00063db0: 2074 6861 6e20 6f6e 6520 7365 7175 656e than one sequen │ │ │ -00063dc0: 6365 206f 6620 726f 7461 7469 6f6e 7320 ce of rotations │ │ │ -00063dd0: 6162 6f75 7420 7468 6520 7468 7265 650a about the three. │ │ │ -00063de0: 7072 696e 6369 7061 6c20 6178 6573 2074 principal axes t │ │ │ -00063df0: 6861 7420 7265 7375 6c74 7320 696e 2074 hat results in t │ │ │ -00063e00: 6865 2073 616d 6520 6f72 6965 6e74 6174 he same orientat │ │ │ -00063e10: 696f 6e20 6f66 2061 6e20 6f62 6a65 6374 ion of an object │ │ │ -00063e20: 2c20 652e 672e 2073 6565 2043 4954 453a , e.g. see CITE: │ │ │ -00063e30: 2053 6c61 6261 7567 6820 2e20 5265 7475 Slabaugh . Retu │ │ │ -00063e40: 726e 6564 0a74 6872 6565 2072 6f74 6174 rned.three rotat │ │ │ -00063e50: 696f 6e20 6d61 7472 6963 6573 2061 6e64 ion matrices and │ │ │ -00063e60: 2063 6f72 7265 7370 6f6e 6469 6e67 2074 corresponding t │ │ │ -00063e70: 6872 6565 2045 756c 6572 2061 6e67 6c65 hree Euler angle │ │ │ -00063e80: 7320 6172 6520 6f6e 6c79 206f 6e65 206f s are only one o │ │ │ -00063e90: 6620 7468 6520 706f 7373 6962 6c65 2073 f the possible s │ │ │ -00063ea0: 6f6c 7574 696f 6e73 2e0a 0a54 6865 2066 olutions...The f │ │ │ -00063eb0: 756e 6374 696f 6e20 6973 2062 6173 6564 unction is based │ │ │ -00063ec0: 206f 6e20 2352 5144 6563 6f6d 7033 7833 on #RQDecomp3x3 │ │ │ -00063ed0: 202e 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f .
    .
    ... │ │ │ -00063ef0: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..

    deco │ │ │ -00063fa0: 6d70 6f73 6550 726f 6a65 6374 696f 6e4d mposeProjectionM │ │ │ -00063fb0: 6174 7269 783c 2f68 333e 0a3c 6469 7620 atrix

    .
    .
    public static void │ │ │ -00064050: 266e 6273 703b 3c73 7061 6e20 636c 6173  decomposeProjec │ │ │ -00064080: 7469 6f6e 4d61 7472 6978 3c2f 7370 616e tionMatrix( │ │ │ -000640b0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000640f0: 2f61 3e26 6e62 7370 3b70 726f 6a4d 6174 /a> projMat │ │ │ -00064100: 7269 782c 0a20 3c61 2068 7265 663d 222e rix,. Mat c │ │ │ -00064150: 616d 6572 614d 6174 7269 782c 0a20 3c61 ameraMatrix,. Mat rotMatrix │ │ │ -000641b0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000641f0: 6174 3c2f 613e 266e 6273 703b 7472 616e at tran │ │ │ -00064200: 7356 6563 742c 0a20 3c61 2068 7265 663d sVect,. Mat  │ │ │ -00064250: 3b72 6f74 4d61 7472 6978 5829 3c2f 7370 ;rotMatrixX)
    .
    Dec │ │ │ -00064280: 6f6d 706f 7365 7320 6120 7072 6f6a 6563 omposes a projec │ │ │ -00064290: 7469 6f6e 206d 6174 7269 7820 696e 746f tion matrix into │ │ │ -000642a0: 2061 2072 6f74 6174 696f 6e20 6d61 7472 a rotation matr │ │ │ -000642b0: 6978 2061 6e64 2061 2063 616d 6572 6120 ix and a camera │ │ │ -000642c0: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ -000642d0: 2e3c 2f64 6976 3e0a 3c64 6c20 636c 6173 .
    .
    .
    P │ │ │ -000642f0: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ -00064300: 3c64 643e 3c63 6f64 653e 7072 6f6a 4d61
    projMa │ │ │ -00064310: 7472 6978 3c2f 636f 6465 3e20 2d20 3378 trix - 3x │ │ │ -00064320: 3420 696e 7075 7420 7072 6f6a 6563 7469 4 input projecti │ │ │ -00064330: 6f6e 206d 6174 7269 7820 502e 3c2f 6464 on matrix P.
    .
    came │ │ │ -00064350: 7261 4d61 7472 6978 3c2f 636f 6465 3e20 raMatrix │ │ │ -00064360: 2d20 4f75 7470 7574 2033 7833 2063 616d - Output 3x3 cam │ │ │ -00064370: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ -00064380: 7472 6978 205c 285c 6361 6d65 7261 6d61 trix \(\camerama │ │ │ -00064390: 7472 6978 7b41 7d5c 292e 3c2f 6464 3e0a trix{A}\).
    . │ │ │ -000643a0: 3c64 643e 3c63 6f64 653e 726f 744d 6174
    rotMat │ │ │ -000643b0: 7269 783c 2f63 6f64 653e 202d 204f 7574 rix - Out │ │ │ -000643c0: 7075 7420 3378 3320 6578 7465 726e 616c put 3x3 external │ │ │ -000643d0: 2072 6f74 6174 696f 6e20 6d61 7472 6978 rotation matrix │ │ │ -000643e0: 2052 2e3c 2f64 643e 0a3c 6464 3e3c 636f R.
    .
    transVect - Output 4x1 │ │ │ -00064410: 2074 7261 6e73 6c61 7469 6f6e 2076 6563 translation vec │ │ │ -00064420: 746f 7220 542e 3c2f 6464 3e0a 3c64 643e tor T.
    .
    │ │ │ -00064430: 3c63 6f64 653e 726f 744d 6174 7269 7858 rotMatrixX │ │ │ -00064440: 3c2f 636f 6465 3e20 2d20 4f70 7469 6f6e - Option │ │ │ -00064450: 616c 2033 7833 2072 6f74 6174 696f 6e20 al 3x3 rotation │ │ │ -00064460: 6d61 7472 6978 2061 726f 756e 6420 782d matrix around x- │ │ │ -00064470: 6178 6973 2e0a 6465 6772 6565 732e 0a0a axis..degrees... │ │ │ -00064480: 5468 6520 6675 6e63 7469 6f6e 2063 6f6d The function com │ │ │ -00064490: 7075 7465 7320 6120 6465 636f 6d70 6f73 putes a decompos │ │ │ -000644a0: 6974 696f 6e20 6f66 2061 2070 726f 6a65 ition of a proje │ │ │ -000644b0: 6374 696f 6e20 6d61 7472 6978 2069 6e74 ction matrix int │ │ │ -000644c0: 6f20 6120 6361 6c69 6272 6174 696f 6e20 o a calibration │ │ │ -000644d0: 616e 6420 6120 726f 7461 7469 6f6e 0a6d and a rotation.m │ │ │ -000644e0: 6174 7269 7820 616e 6420 7468 6520 706f atrix and the po │ │ │ -000644f0: 7369 7469 6f6e 206f 6620 6120 6361 6d65 sition of a came │ │ │ -00064500: 7261 2e0a 0a49 7420 6f70 7469 6f6e 616c ra...It optional │ │ │ -00064510: 6c79 2072 6574 7572 6e73 2074 6872 6565 ly returns three │ │ │ -00064520: 2072 6f74 6174 696f 6e20 6d61 7472 6963 rotation matric │ │ │ -00064530: 6573 2c20 6f6e 6520 666f 7220 6561 6368 es, one for each │ │ │ -00064540: 2061 7869 732c 2061 6e64 2074 6872 6565 axis, and three │ │ │ -00064550: 2045 756c 6572 2061 6e67 6c65 7320 7468 Euler angles th │ │ │ -00064560: 6174 2063 6f75 6c64 0a62 6520 7573 6564 at could.be used │ │ │ -00064570: 2069 6e20 4f70 656e 474c 2e20 4e6f 7465 in OpenGL. Note │ │ │ -00064580: 2c20 7468 6572 6520 6973 2061 6c77 6179 , there is alway │ │ │ -00064590: 7320 6d6f 7265 2074 6861 6e20 6f6e 6520 s more than one │ │ │ -000645a0: 7365 7175 656e 6365 206f 6620 726f 7461 sequence of rota │ │ │ -000645b0: 7469 6f6e 7320 6162 6f75 7420 7468 6520 tions about the │ │ │ -000645c0: 7468 7265 650a 7072 696e 6369 7061 6c20 three.principal │ │ │ -000645d0: 6178 6573 2074 6861 7420 7265 7375 6c74 axes that result │ │ │ -000645e0: 7320 696e 2074 6865 2073 616d 6520 6f72 s in the same or │ │ │ -000645f0: 6965 6e74 6174 696f 6e20 6f66 2061 6e20 ientation of an │ │ │ -00064600: 6f62 6a65 6374 2c20 652e 672e 2073 6565 object, e.g. see │ │ │ -00064610: 2043 4954 453a 2053 6c61 6261 7567 6820 CITE: Slabaugh │ │ │ -00064620: 2e20 5265 7475 726e 6564 0a74 6872 6565 . Returned.three │ │ │ -00064630: 2072 6f74 6174 696f 6e20 6d61 7472 6963 rotation matric │ │ │ -00064640: 6573 2061 6e64 2063 6f72 7265 7370 6f6e es and correspon │ │ │ -00064650: 6469 6e67 2074 6872 6565 2045 756c 6572 ding three Euler │ │ │ -00064660: 2061 6e67 6c65 7320 6172 6520 6f6e 6c79 angles are only │ │ │ -00064670: 206f 6e65 206f 6620 7468 6520 706f 7373 one of the poss │ │ │ -00064680: 6962 6c65 2073 6f6c 7574 696f 6e73 2e0a ible solutions.. │ │ │ -00064690: 0a54 6865 2066 756e 6374 696f 6e20 6973 .The function is │ │ │ -000646a0: 2062 6173 6564 206f 6e20 2352 5144 6563 based on #RQDec │ │ │ -000646b0: 6f6d 7033 7833 202e 3c2f 6464 3e0a 3c2f omp3x3 .
    ..
    ..
  • .
  • │ │ │ -000646e0: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    de │ │ │ -00064770: 636f 6d70 6f73 6550 726f 6a65 6374 696f composeProjectio │ │ │ -00064780: 6e4d 6174 7269 783c 2f68 333e 0a3c 6469 nMatrix

    ..public static │ │ │ -000647f0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  void decomposeProj │ │ │ -00064850: 6563 7469 6f6e 4d61 7472 6978 3c2f 7370 ectionMatrix(Ma │ │ │ -000648c0: 743c 2f61 3e26 6e62 7370 3b70 726f 6a4d t projM │ │ │ -000648d0: 6174 7269 782c 0a20 3c61 2068 7265 663d atrix,. Mat  │ │ │ -00064920: 3b63 616d 6572 614d 6174 7269 782c 0a20 ;cameraMatrix,. │ │ │ -00064930: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -00064970: 2f61 3e26 6e62 7370 3b72 6f74 4d61 7472 /a> rotMatr │ │ │ -00064980: 6978 2c0a 203c 6120 6872 6566 3d22 2e2e ix,. Mat tr │ │ │ -000649d0: 616e 7356 6563 7429 3c2f 7370 616e 3e3c ansVect)< │ │ │ -000649e0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Decompo │ │ │ -00064a00: 7365 7320 6120 7072 6f6a 6563 7469 6f6e ses a projection │ │ │ -00064a10: 206d 6174 7269 7820 696e 746f 2061 2072 matrix into a r │ │ │ -00064a20: 6f74 6174 696f 6e20 6d61 7472 6978 2061 otation matrix a │ │ │ -00064a30: 6e64 2061 2063 616d 6572 6120 696e 7472 nd a camera intr │ │ │ -00064a40: 696e 7369 6320 6d61 7472 6978 2e3c 2f64 insic matrix..
    .
    Param │ │ │ -00064a70: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ -00064a80: 3c63 6f64 653e 7072 6f6a 4d61 7472 6978 projMatrix │ │ │ -00064a90: 3c2f 636f 6465 3e20 2d20 3378 3420 696e - 3x4 in │ │ │ -00064aa0: 7075 7420 7072 6f6a 6563 7469 6f6e 206d put projection m │ │ │ -00064ab0: 6174 7269 7820 502e 3c2f 6464 3e0a 3c64 atrix P.
    .cameraMa │ │ │ -00064ad0: 7472 6978 3c2f 636f 6465 3e20 2d20 4f75 trix - Ou │ │ │ -00064ae0: 7470 7574 2033 7833 2063 616d 6572 6120 tput 3x3 camera │ │ │ -00064af0: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ -00064b00: 205c 285c 6361 6d65 7261 6d61 7472 6978 \(\cameramatrix │ │ │ -00064b10: 7b41 7d5c 292e 3c2f 6464 3e0a 3c64 643e {A}\)..
    │ │ │ -00064b20: 3c63 6f64 653e 726f 744d 6174 7269 783c rotMatrix< │ │ │ -00064b30: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ -00064b40: 3378 3320 6578 7465 726e 616c 2072 6f74 3x3 external rot │ │ │ -00064b50: 6174 696f 6e20 6d61 7472 6978 2052 2e3c ation matrix R.< │ │ │ -00064b60: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ -00064b70: 7261 6e73 5665 6374 3c2f 636f 6465 3e20 ransVect │ │ │ -00064b80: 2d20 4f75 7470 7574 2034 7831 2074 7261 - Output 4x1 tra │ │ │ -00064b90: 6e73 6c61 7469 6f6e 2076 6563 746f 7220 nslation vector │ │ │ -00064ba0: 542e 0a64 6567 7265 6573 2e0a 0a54 6865 T..degrees...The │ │ │ -00064bb0: 2066 756e 6374 696f 6e20 636f 6d70 7574 function comput │ │ │ -00064bc0: 6573 2061 2064 6563 6f6d 706f 7369 7469 es a decompositi │ │ │ -00064bd0: 6f6e 206f 6620 6120 7072 6f6a 6563 7469 on of a projecti │ │ │ -00064be0: 6f6e 206d 6174 7269 7820 696e 746f 2061 on matrix into a │ │ │ -00064bf0: 2063 616c 6962 7261 7469 6f6e 2061 6e64 calibration and │ │ │ -00064c00: 2061 2072 6f74 6174 696f 6e0a 6d61 7472 a rotation.matr │ │ │ -00064c10: 6978 2061 6e64 2074 6865 2070 6f73 6974 ix and the posit │ │ │ -00064c20: 696f 6e20 6f66 2061 2063 616d 6572 612e ion of a camera. │ │ │ -00064c30: 0a0a 4974 206f 7074 696f 6e61 6c6c 7920 ..It optionally │ │ │ -00064c40: 7265 7475 726e 7320 7468 7265 6520 726f returns three ro │ │ │ -00064c50: 7461 7469 6f6e 206d 6174 7269 6365 732c tation matrices, │ │ │ -00064c60: 206f 6e65 2066 6f72 2065 6163 6820 6178 one for each ax │ │ │ -00064c70: 6973 2c20 616e 6420 7468 7265 6520 4575 is, and three Eu │ │ │ -00064c80: 6c65 7220 616e 676c 6573 2074 6861 7420 ler angles that │ │ │ -00064c90: 636f 756c 640a 6265 2075 7365 6420 696e could.be used in │ │ │ -00064ca0: 204f 7065 6e47 4c2e 204e 6f74 652c 2074 OpenGL. Note, t │ │ │ -00064cb0: 6865 7265 2069 7320 616c 7761 7973 206d here is always m │ │ │ -00064cc0: 6f72 6520 7468 616e 206f 6e65 2073 6571 ore than one seq │ │ │ -00064cd0: 7565 6e63 6520 6f66 2072 6f74 6174 696f uence of rotatio │ │ │ -00064ce0: 6e73 2061 626f 7574 2074 6865 2074 6872 ns about the thr │ │ │ -00064cf0: 6565 0a70 7269 6e63 6970 616c 2061 7865 ee.principal axe │ │ │ -00064d00: 7320 7468 6174 2072 6573 756c 7473 2069 s that results i │ │ │ -00064d10: 6e20 7468 6520 7361 6d65 206f 7269 656e n the same orien │ │ │ -00064d20: 7461 7469 6f6e 206f 6620 616e 206f 626a tation of an obj │ │ │ -00064d30: 6563 742c 2065 2e67 2e20 7365 6520 4349 ect, e.g. see CI │ │ │ -00064d40: 5445 3a20 536c 6162 6175 6768 202e 2052 TE: Slabaugh . R │ │ │ -00064d50: 6574 7572 6e65 640a 7468 7265 6520 726f eturned.three ro │ │ │ -00064d60: 7461 7469 6f6e 206d 6174 7269 6365 7320 tation matrices │ │ │ -00064d70: 616e 6420 636f 7272 6573 706f 6e64 696e and correspondin │ │ │ -00064d80: 6720 7468 7265 6520 4575 6c65 7220 616e g three Euler an │ │ │ -00064d90: 676c 6573 2061 7265 206f 6e6c 7920 6f6e gles are only on │ │ │ -00064da0: 6520 6f66 2074 6865 2070 6f73 7369 626c e of the possibl │ │ │ -00064db0: 6520 736f 6c75 7469 6f6e 732e 0a0a 5468 e solutions...Th │ │ │ -00064dc0: 6520 6675 6e63 7469 6f6e 2069 7320 6261 e function is ba │ │ │ -00064dd0: 7365 6420 6f6e 2023 5251 4465 636f 6d70 sed on #RQDecomp │ │ │ -00064de0: 3378 3320 2e3c 2f64 643e 0a3c 2f64 6c3e 3x3 .
    .
    │ │ │ -00064df0: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • ..

    mat │ │ │ -00064e90: 4d75 6c44 6572 6976 3c2f 6833 3e0a 3c64 MulDeriv

    ..public stati │ │ │ -00064f00: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void matMulDeriv< │ │ │ -00064f60: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat A, │ │ │ -00064fd0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -00065010: 743c 2f61 3e26 6e62 7370 3b42 2c0a 203c t B,. < │ │ │ -00065020: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00065030: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00065040: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00065050: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dABdA,. │ │ │ -00065070: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000650b0: 2f61 3e26 6e62 7370 3b64 4142 6442 293c /a> dABdB)< │ │ │ -000650c0: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>. │ │ │ -000650e0: 436f 6d70 7574 6573 2070 6172 7469 616c Computes partial │ │ │ -000650f0: 2064 6572 6976 6174 6976 6573 206f 6620 derivatives of │ │ │ -00065100: 7468 6520 6d61 7472 6978 2070 726f 6475 the matrix produ │ │ │ -00065110: 6374 2066 6f72 2065 6163 6820 6d75 6c74 ct for each mult │ │ │ -00065120: 6970 6c69 6564 206d 6174 7269 782e 3c2f iplied matrix..
    .
    Para │ │ │ -00065150: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    A │ │ │ -00065170: 2d20 4669 7273 7420 6d75 6c74 6970 6c69 - First multipli │ │ │ -00065180: 6564 206d 6174 7269 782e 3c2f 6464 3e0a ed matrix.
    . │ │ │ -00065190: 3c64 643e 3c63 6f64 653e 423c 2f63 6f64
    B - Second mult │ │ │ -000651b0: 6970 6c69 6564 206d 6174 7269 782e 3c2f iplied matrix..
    dA │ │ │ -000651d0: 4264 413c 2f63 6f64 653e 202d 2046 6972 BdA - Fir │ │ │ -000651e0: 7374 206f 7574 7075 7420 6465 7269 7661 st output deriva │ │ │ -000651f0: 7469 7665 206d 6174 7269 7820 6428 415c tive matrix d(A\ │ │ │ -00065200: 2a42 292f 6441 206f 6620 7369 7a65 0a5c *B)/dA of size.\ │ │ │ -00065210: 285c 7465 7874 7474 7b41 2e72 6f77 732a (\texttt{A.rows* │ │ │ -00065220: 422e 636f 6c73 7d20 5c74 696d 6573 207b B.cols} \times { │ │ │ -00065230: 412e 726f 7773 2a41 2e63 6f6c 737d 5c29 A.rows*A.cols}\) │ │ │ -00065240: 202e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 .
    .
    dABdB - │ │ │ -00065260: 2053 6563 6f6e 6420 6f75 7470 7574 2064 Second output d │ │ │ -00065270: 6572 6976 6174 6976 6520 6d61 7472 6978 erivative matrix │ │ │ -00065280: 2064 2841 5c2a 4229 2f64 4220 6f66 2073 d(A\*B)/dB of s │ │ │ -00065290: 697a 650a 5c28 5c74 6578 7474 747b 412e ize.\(\texttt{A. │ │ │ -000652a0: 726f 7773 2a42 2e63 6f6c 737d 205c 7469 rows*B.cols} \ti │ │ │ -000652b0: 6d65 7320 7b42 2e72 6f77 732a 422e 636f mes {B.rows*B.co │ │ │ -000652c0: 6c73 7d5c 2920 2e0a 0a54 6865 2066 756e ls}\) ...The fun │ │ │ -000652d0: 6374 696f 6e20 636f 6d70 7574 6573 2070 ction computes p │ │ │ -000652e0: 6172 7469 616c 2064 6572 6976 6174 6976 artial derivativ │ │ │ -000652f0: 6573 206f 6620 7468 6520 656c 656d 656e es of the elemen │ │ │ -00065300: 7473 206f 6620 7468 6520 6d61 7472 6978 ts of the matrix │ │ │ -00065310: 2070 726f 6475 6374 205c 2841 2a42 5c29 product \(A*B\) │ │ │ -00065320: 2077 6974 6820 7265 6761 7264 2074 6f0a with regard to. │ │ │ -00065330: 7468 6520 656c 656d 656e 7473 206f 6620 the elements of │ │ │ -00065340: 6561 6368 206f 6620 7468 6520 7477 6f20 each of the two │ │ │ -00065350: 696e 7075 7420 6d61 7472 6963 6573 2e20 input matrices. │ │ │ -00065360: 5468 6520 6675 6e63 7469 6f6e 2069 7320 The function is │ │ │ -00065370: 7573 6564 2074 6f20 636f 6d70 7574 6520 used to compute │ │ │ -00065380: 7468 6520 4a61 636f 6269 616e 0a6d 6174 the Jacobian.mat │ │ │ -00065390: 7269 6365 7320 696e 2023 7374 6572 656f rices in #stereo │ │ │ -000653a0: 4361 6c69 6272 6174 6520 6275 7420 6361 Calibrate but ca │ │ │ -000653b0: 6e20 616c 736f 2062 6520 7573 6564 2069 n also be used i │ │ │ -000653c0: 6e20 616e 7920 6f74 6865 7220 7369 6d69 n any other simi │ │ │ -000653d0: 6c61 7220 6f70 7469 6d69 7a61 7469 6f6e lar optimization │ │ │ -000653e0: 2066 756e 6374 696f 6e2e 3c2f 6464 3e0a function.
    . │ │ │ -000653f0: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    ..
    .
  • ..
    .

    composeR │ │ │ -00065560: 543c 2f68 333e 0a3c 6469 7620 636c 6173 T

    .
    .
    pub │ │ │ -000655c0: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static void&nbs │ │ │ -00065600: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;com │ │ │ -00065620: 706f 7365 5254 3c2f 7370 616e 3e3c 7762 poseRT(Mat& │ │ │ -00065690: 6e62 7370 3b72 7665 6331 2c0a 203c 6120 nbsp;rvec1,. Mat │ │ │ -000656e0: 266e 6273 703b 7476 6563 312c 0a20 3c61  tvec1,. Mat rvec2,. < │ │ │ -00065740: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00065750: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00065760: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00065770: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat tvec2,. │ │ │ -00065790: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000657d0: 2f61 3e26 6e62 7370 3b72 7665 6333 2c0a /a> rvec3,. │ │ │ -000657e0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -00065820: 3c2f 613e 266e 6273 703b 7476 6563 332c  tvec3, │ │ │ -00065830: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -00065870: 743c 2f61 3e26 6e62 7370 3b64 7233 6472 t dr3dr │ │ │ -00065880: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ -000658c0: 4d61 743c 2f61 3e26 6e62 7370 3b64 7233 Mat dr3 │ │ │ -000658d0: 6474 312c 0a20 3c61 2068 7265 663d 222e dt1,. Mat d │ │ │ -00065920: 7233 6472 322c 0a20 3c61 2068 7265 663d r3dr2,. Mat  │ │ │ -00065970: 3b64 7233 6474 322c 0a20 3c61 2068 7265 ;dr3dt2,. Mat&nb │ │ │ -000659c0: 7370 3b64 7433 6472 312c 0a20 3c61 2068 sp;dt3dr1,. Mat& │ │ │ -00065a10: 6e62 7370 3b64 7433 6474 312c 0a20 3c61 nbsp;dt3dt1,. Mat dt3dr2,. │ │ │ -00065a70: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -00065ab0: 2f61 3e26 6e62 7370 3b64 7433 6474 3229 /a> dt3dt2) │ │ │ -00065ac0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Combines two ro │ │ │ -00065af0: 7461 7469 6f6e 2d61 6e64 2d73 6869 6674 tation-and-shift │ │ │ -00065b00: 2074 7261 6e73 666f 726d 6174 696f 6e73 transformations │ │ │ -00065b10: 2e3c 2f64 6976 3e0a 3c64 6c20 636c 6173 .
    .
    .
    P │ │ │ -00065b30: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ -00065b40: 3c64 643e 3c63 6f64 653e 7276 6563 313c
    rvec1< │ │ │ -00065b50: 2f63 6f64 653e 202d 2046 6972 7374 2072 /code> - First r │ │ │ -00065b60: 6f74 6174 696f 6e20 7665 6374 6f72 2e3c otation vector.< │ │ │ -00065b70: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ -00065b80: 7665 6331 3c2f 636f 6465 3e20 2d20 4669 vec1 - Fi │ │ │ -00065b90: 7273 7420 7472 616e 736c 6174 696f 6e20 rst translation │ │ │ -00065ba0: 7665 6374 6f72 2e3c 2f64 643e 0a3c 6464 vector.
    .
    rvec2 - Second rot │ │ │ -00065bd0: 6174 696f 6e20 7665 6374 6f72 2e3c 2f64 ation vector..
    tve │ │ │ -00065bf0: 6332 3c2f 636f 6465 3e20 2d20 5365 636f c2 - Seco │ │ │ -00065c00: 6e64 2074 7261 6e73 6c61 7469 6f6e 2076 nd translation v │ │ │ -00065c10: 6563 746f 722e 3c2f 6464 3e0a 3c64 643e ector.
    .
    │ │ │ -00065c20: 3c63 6f64 653e 7276 6563 333c 2f63 6f64 rvec3 - Output rota │ │ │ -00065c40: 7469 6f6e 2076 6563 746f 7220 6f66 2074 tion vector of t │ │ │ -00065c50: 6865 2073 7570 6572 706f 7369 7469 6f6e he superposition │ │ │ -00065c60: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    tvec3 - │ │ │ -00065c80: 4f75 7470 7574 2074 7261 6e73 6c61 7469 Output translati │ │ │ -00065c90: 6f6e 2076 6563 746f 7220 6f66 2074 6865 on vector of the │ │ │ -00065ca0: 2073 7570 6572 706f 7369 7469 6f6e 2e3c superposition.< │ │ │ -00065cb0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -00065cc0: 7233 6472 313c 2f63 6f64 653e 202d 204f r3dr1 - O │ │ │ -00065cd0: 7074 696f 6e61 6c20 6f75 7470 7574 2064 ptional output d │ │ │ -00065ce0: 6572 6976 6174 6976 6520 6f66 2072 7665 erivative of rve │ │ │ -00065cf0: 6333 2077 6974 6820 7265 6761 7264 2074 c3 with regard t │ │ │ -00065d00: 6f20 7276 6563 313c 2f64 643e 0a3c 6464 o rvec1
    .
    dr3dt1 - Optional │ │ │ -00065d30: 6f75 7470 7574 2064 6572 6976 6174 6976 output derivativ │ │ │ -00065d40: 6520 6f66 2072 7665 6333 2077 6974 6820 e of rvec3 with │ │ │ -00065d50: 7265 6761 7264 2074 6f20 7476 6563 313c regard to tvec1< │ │ │ -00065d60: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -00065d70: 7233 6472 323c 2f63 6f64 653e 202d 204f r3dr2 - O │ │ │ -00065d80: 7074 696f 6e61 6c20 6f75 7470 7574 2064 ptional output d │ │ │ -00065d90: 6572 6976 6174 6976 6520 6f66 2072 7665 erivative of rve │ │ │ -00065da0: 6333 2077 6974 6820 7265 6761 7264 2074 c3 with regard t │ │ │ -00065db0: 6f20 7276 6563 323c 2f64 643e 0a3c 6464 o rvec2
    .
    dr3dt2 - Optional │ │ │ -00065de0: 6f75 7470 7574 2064 6572 6976 6174 6976 output derivativ │ │ │ -00065df0: 6520 6f66 2072 7665 6333 2077 6974 6820 e of rvec3 with │ │ │ -00065e00: 7265 6761 7264 2074 6f20 7476 6563 323c regard to tvec2< │ │ │ -00065e10: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -00065e20: 7433 6472 313c 2f63 6f64 653e 202d 204f t3dr1 - O │ │ │ -00065e30: 7074 696f 6e61 6c20 6f75 7470 7574 2064 ptional output d │ │ │ -00065e40: 6572 6976 6174 6976 6520 6f66 2074 7665 erivative of tve │ │ │ -00065e50: 6333 2077 6974 6820 7265 6761 7264 2074 c3 with regard t │ │ │ -00065e60: 6f20 7276 6563 313c 2f64 643e 0a3c 6464 o rvec1
    .
    dt3dt1 - Optional │ │ │ -00065e90: 6f75 7470 7574 2064 6572 6976 6174 6976 output derivativ │ │ │ -00065ea0: 6520 6f66 2074 7665 6333 2077 6974 6820 e of tvec3 with │ │ │ -00065eb0: 7265 6761 7264 2074 6f20 7476 6563 313c regard to tvec1< │ │ │ -00065ec0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -00065ed0: 7433 6472 323c 2f63 6f64 653e 202d 204f t3dr2 - O │ │ │ -00065ee0: 7074 696f 6e61 6c20 6f75 7470 7574 2064 ptional output d │ │ │ -00065ef0: 6572 6976 6174 6976 6520 6f66 2074 7665 erivative of tve │ │ │ -00065f00: 6333 2077 6974 6820 7265 6761 7264 2074 c3 with regard t │ │ │ -00065f10: 6f20 7276 6563 323c 2f64 643e 0a3c 6464 o rvec2
    .
    dt3dt2 - Optional │ │ │ -00065f40: 6f75 7470 7574 2064 6572 6976 6174 6976 output derivativ │ │ │ -00065f50: 6520 6f66 2074 7665 6333 2077 6974 6820 e of tvec3 with │ │ │ -00065f60: 7265 6761 7264 2074 6f20 7476 6563 320a regard to tvec2. │ │ │ -00065f70: 0a54 6865 2066 756e 6374 696f 6e73 2063 .The functions c │ │ │ -00065f80: 6f6d 7075 7465 3a0a 0a5c 285c 6265 6769 ompute:..\(\begi │ │ │ -00065f90: 6e7b 6172 7261 797d 7b6c 7d20 5c74 6578 n{array}{l} \tex │ │ │ -00065fa0: 7474 747b 7276 6563 337d 203d 2020 5c6d ttt{rvec3} = \m │ │ │ -00065fb0: 6174 6872 6d7b 726f 6472 6967 7565 737d athrm{rodrigues} │ │ │ -00065fc0: 205e 7b2d 317d 205c 6c65 6674 2028 205c ^{-1} \left ( \ │ │ │ -00065fd0: 6d61 7468 726d 7b72 6f64 7269 6775 6573 mathrm{rodrigues │ │ │ -00065fe0: 7d20 2820 5c74 6578 7474 747b 7276 6563 } ( \texttt{rvec │ │ │ -00065ff0: 327d 2029 2020 5c63 646f 7420 5c6d 6174 2} ) \cdot \mat │ │ │ -00066000: 6872 6d7b 726f 6472 6967 7565 737d 2028 hrm{rodrigues} ( │ │ │ -00066010: 205c 7465 7874 7474 7b72 7665 6331 7d20 \texttt{rvec1} │ │ │ -00066020: 2920 5c72 6967 6874 2029 2020 5c5c 205c ) \right ) \\ \ │ │ │ -00066030: 7465 7874 7474 7b74 7665 6333 7d20 3d20 texttt{tvec3} = │ │ │ -00066040: 205c 6d61 7468 726d 7b72 6f64 7269 6775 \mathrm{rodrigu │ │ │ -00066050: 6573 7d20 2820 5c74 6578 7474 747b 7276 es} ( \texttt{rv │ │ │ -00066060: 6563 327d 2029 2020 5c63 646f 7420 5c74 ec2} ) \cdot \t │ │ │ -00066070: 6578 7474 747b 7476 6563 317d 202b 2020 exttt{tvec1} + │ │ │ -00066080: 5c74 6578 7474 747b 7476 6563 327d 205c \texttt{tvec2} \ │ │ │ -00066090: 656e 647b 6172 7261 797d 202c 5c29 0a0a end{array} ,\).. │ │ │ -000660a0: 7768 6572 6520 5c28 5c6d 6174 6872 6d7b where \(\mathrm{ │ │ │ -000660b0: 726f 6472 6967 7565 737d 5c29 2064 656e rodrigues}\) den │ │ │ -000660c0: 6f74 6573 2061 2072 6f74 6174 696f 6e20 otes a rotation │ │ │ -000660d0: 7665 6374 6f72 2074 6f20 6120 726f 7461 vector to a rota │ │ │ -000660e0: 7469 6f6e 206d 6174 7269 7820 7472 616e tion matrix tran │ │ │ -000660f0: 7366 6f72 6d61 7469 6f6e 2c20 616e 640a sformation, and. │ │ │ -00066100: 5c28 5c6d 6174 6872 6d7b 726f 6472 6967 \(\mathrm{rodrig │ │ │ -00066110: 7565 737d 5e7b 2d31 7d5c 2920 6465 6e6f ues}^{-1}\) deno │ │ │ -00066120: 7465 7320 7468 6520 696e 7665 7273 6520 tes the inverse │ │ │ -00066130: 7472 616e 7366 6f72 6d61 7469 6f6e 2e20 transformation. │ │ │ -00066140: 5365 6520 2352 6f64 7269 6775 6573 2066 See #Rodrigues f │ │ │ -00066150: 6f72 2064 6574 6169 6c73 2e0a 0a41 6c73 or details...Als │ │ │ -00066160: 6f2c 2074 6865 2066 756e 6374 696f 6e73 o, the functions │ │ │ -00066170: 2063 616e 2063 6f6d 7075 7465 2074 6865 can compute the │ │ │ -00066180: 2064 6572 6976 6174 6976 6573 206f 6620 derivatives of │ │ │ -00066190: 7468 6520 6f75 7470 7574 2076 6563 746f the output vecto │ │ │ -000661a0: 7273 2077 6974 6820 7265 6761 7264 7320 rs with regards │ │ │ -000661b0: 746f 2074 6865 2069 6e70 7574 0a76 6563 to the input.vec │ │ │ -000661c0: 746f 7273 2028 7365 6520 236d 6174 4d75 tors (see #matMu │ │ │ -000661d0: 6c44 6572 6976 2029 2e20 5468 6520 6675 lDeriv ). The fu │ │ │ -000661e0: 6e63 7469 6f6e 7320 6172 6520 7573 6564 nctions are used │ │ │ -000661f0: 2069 6e73 6964 6520 2373 7465 7265 6f43 inside #stereoC │ │ │ -00066200: 616c 6962 7261 7465 2062 7574 2063 616e alibrate but can │ │ │ -00066210: 2061 6c73 6f20 6265 2075 7365 6420 696e also be used in │ │ │ -00066220: 0a79 6f75 7220 6f77 6e20 636f 6465 2077 .your own code w │ │ │ -00066230: 6865 7265 204c 6576 656e 6265 7267 2d4d here Levenberg-M │ │ │ -00066240: 6172 7175 6172 6474 206f 7220 616e 6f74 arquardt or anot │ │ │ -00066250: 6865 7220 6772 6164 6965 6e74 2d62 6173 her gradient-bas │ │ │ -00066260: 6564 2073 6f6c 7665 7220 6973 2075 7365 ed solver is use │ │ │ -00066270: 6420 746f 206f 7074 696d 697a 6520 610a d to optimize a. │ │ │ -00066280: 6675 6e63 7469 6f6e 2074 6861 7420 636f function that co │ │ │ -00066290: 6e74 6169 6e73 2061 206d 6174 7269 7820 ntains a matrix │ │ │ -000662a0: 6d75 6c74 6970 6c69 6361 7469 6f6e 2e3c multiplication.< │ │ │ -000662b0: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    ..
    ..
  • .
    .

    compose │ │ │ -00066410: 5254 3c2f 6833 3e0a 3c64 6976 2063 6c61 RT

    .
    .
    pu │ │ │ -00066470: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static void&nb │ │ │ -000664b0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;co │ │ │ -000664d0: 6d70 6f73 6552 543c 2f73 7061 6e3e 3c77 mposeRT(Mat │ │ │ -00066540: 266e 6273 703b 7276 6563 312c 0a20 3c61  rvec1,. Mat tvec1,. < │ │ │ -000665a0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000665b0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000665c0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000665d0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat rvec2,. │ │ │ -000665f0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -00066630: 2f61 3e26 6e62 7370 3b74 7665 6332 2c0a /a> tvec2,. │ │ │ -00066640: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -00066680: 3c2f 613e 266e 6273 703b 7276 6563 332c  rvec3, │ │ │ -00066690: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000666d0: 743c 2f61 3e26 6e62 7370 3b74 7665 6333 t tvec3 │ │ │ -000666e0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -00066720: 6174 3c2f 613e 266e 6273 703b 6472 3364 at dr3d │ │ │ -00066730: 7231 2c0a 203c 6120 6872 6566 3d22 2e2e r1,. Mat dr │ │ │ -00066780: 3364 7431 2c0a 203c 6120 6872 6566 3d22 3dt1,. Mat  │ │ │ -000667d0: 6472 3364 7232 2c0a 203c 6120 6872 6566 dr3dr2,. Mat&nbs │ │ │ -00066820: 703b 6472 3364 7432 2c0a 203c 6120 6872 p;dr3dt2,. Mat&n │ │ │ -00066870: 6273 703b 6474 3364 7231 2c0a 203c 6120 bsp;dt3dr1,. Mat │ │ │ -000668c0: 266e 6273 703b 6474 3364 7431 2c0a 203c  dt3dt1,. < │ │ │ -000668d0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000668e0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000668f0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00066900: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dt3dr2)< │ │ │ -00066920: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ -00066940: 436f 6d62 696e 6573 2074 776f 2072 6f74 Combines two rot │ │ │ -00066950: 6174 696f 6e2d 616e 642d 7368 6966 7420 ation-and-shift │ │ │ -00066960: 7472 616e 7366 6f72 6d61 7469 6f6e 732e transformations. │ │ │ -00066970: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -00066990: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000669a0: 6464 3e3c 636f 6465 3e72 7665 6331 3c2f dd>rvec1 - First ro │ │ │ -000669c0: 7461 7469 6f6e 2076 6563 746f 722e 3c2f tation vector..
    tv │ │ │ -000669e0: 6563 313c 2f63 6f64 653e 202d 2046 6972 ec1 - Fir │ │ │ -000669f0: 7374 2074 7261 6e73 6c61 7469 6f6e 2076 st translation v │ │ │ -00066a00: 6563 746f 722e 3c2f 6464 3e0a 3c64 643e ector.
    .
    │ │ │ -00066a10: 3c63 6f64 653e 7276 6563 323c 2f63 6f64 rvec2 - Second rota │ │ │ -00066a30: 7469 6f6e 2076 6563 746f 722e 3c2f 6464 tion vector.
    .
    tvec │ │ │ -00066a50: 323c 2f63 6f64 653e 202d 2053 6563 6f6e 2 - Secon │ │ │ -00066a60: 6420 7472 616e 736c 6174 696f 6e20 7665 d translation ve │ │ │ -00066a70: 6374 6f72 2e3c 2f64 643e 0a3c 6464 3e3c ctor.
    .
    < │ │ │ -00066a80: 636f 6465 3e72 7665 6333 3c2f 636f 6465 code>rvec3 - Output rotat │ │ │ -00066aa0: 696f 6e20 7665 6374 6f72 206f 6620 7468 ion vector of th │ │ │ -00066ab0: 6520 7375 7065 7270 6f73 6974 696f 6e2e e superposition. │ │ │ -00066ac0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -00066ad0: 7476 6563 333c 2f63 6f64 653e 202d 204f tvec3 - O │ │ │ -00066ae0: 7574 7075 7420 7472 616e 736c 6174 696f utput translatio │ │ │ -00066af0: 6e20 7665 6374 6f72 206f 6620 7468 6520 n vector of the │ │ │ -00066b00: 7375 7065 7270 6f73 6974 696f 6e2e 3c2f superposition..
    dr │ │ │ -00066b20: 3364 7231 3c2f 636f 6465 3e20 2d20 4f70 3dr1 - Op │ │ │ -00066b30: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ -00066b40: 7269 7661 7469 7665 206f 6620 7276 6563 rivative of rvec │ │ │ -00066b50: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ -00066b60: 2072 7665 6331 3c2f 6464 3e0a 3c64 643e rvec1
    .
    │ │ │ -00066b70: 3c63 6f64 653e 6472 3364 7431 3c2f 636f dr3dt1 - Optional o │ │ │ -00066b90: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ -00066ba0: 206f 6620 7276 6563 3320 7769 7468 2072 of rvec3 with r │ │ │ -00066bb0: 6567 6172 6420 746f 2074 7665 6331 3c2f egard to tvec1.
    dr │ │ │ -00066bd0: 3364 7232 3c2f 636f 6465 3e20 2d20 4f70 3dr2 - Op │ │ │ -00066be0: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ -00066bf0: 7269 7661 7469 7665 206f 6620 7276 6563 rivative of rvec │ │ │ -00066c00: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ -00066c10: 2072 7665 6332 3c2f 6464 3e0a 3c64 643e rvec2
    .
    │ │ │ -00066c20: 3c63 6f64 653e 6472 3364 7432 3c2f 636f dr3dt2 - Optional o │ │ │ -00066c40: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ -00066c50: 206f 6620 7276 6563 3320 7769 7468 2072 of rvec3 with r │ │ │ -00066c60: 6567 6172 6420 746f 2074 7665 6332 3c2f egard to tvec2.
    dt │ │ │ -00066c80: 3364 7231 3c2f 636f 6465 3e20 2d20 4f70 3dr1 - Op │ │ │ -00066c90: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ -00066ca0: 7269 7661 7469 7665 206f 6620 7476 6563 rivative of tvec │ │ │ -00066cb0: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ -00066cc0: 2072 7665 6331 3c2f 6464 3e0a 3c64 643e rvec1
    .
    │ │ │ -00066cd0: 3c63 6f64 653e 6474 3364 7431 3c2f 636f dt3dt1 - Optional o │ │ │ -00066cf0: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ -00066d00: 206f 6620 7476 6563 3320 7769 7468 2072 of tvec3 with r │ │ │ -00066d10: 6567 6172 6420 746f 2074 7665 6331 3c2f egard to tvec1.
    dt │ │ │ -00066d30: 3364 7232 3c2f 636f 6465 3e20 2d20 4f70 3dr2 - Op │ │ │ -00066d40: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ -00066d50: 7269 7661 7469 7665 206f 6620 7476 6563 rivative of tvec │ │ │ -00066d60: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ -00066d70: 2072 7665 6332 0a0a 5468 6520 6675 6e63 rvec2..The func │ │ │ -00066d80: 7469 6f6e 7320 636f 6d70 7574 653a 0a0a tions compute:.. │ │ │ -00066d90: 5c28 5c62 6567 696e 7b61 7272 6179 7d7b \(\begin{array}{ │ │ │ -00066da0: 6c7d 205c 7465 7874 7474 7b72 7665 6333 l} \texttt{rvec3 │ │ │ -00066db0: 7d20 3d20 205c 6d61 7468 726d 7b72 6f64 } = \mathrm{rod │ │ │ -00066dc0: 7269 6775 6573 7d20 5e7b 2d31 7d20 5c6c rigues} ^{-1} \l │ │ │ -00066dd0: 6566 7420 2820 5c6d 6174 6872 6d7b 726f eft ( \mathrm{ro │ │ │ -00066de0: 6472 6967 7565 737d 2028 205c 7465 7874 drigues} ( \text │ │ │ -00066df0: 7474 7b72 7665 6332 7d20 2920 205c 6364 tt{rvec2} ) \cd │ │ │ -00066e00: 6f74 205c 6d61 7468 726d 7b72 6f64 7269 ot \mathrm{rodri │ │ │ -00066e10: 6775 6573 7d20 2820 5c74 6578 7474 747b gues} ( \texttt{ │ │ │ -00066e20: 7276 6563 317d 2029 205c 7269 6768 7420 rvec1} ) \right │ │ │ -00066e30: 2920 205c 5c20 5c74 6578 7474 747b 7476 ) \\ \texttt{tv │ │ │ -00066e40: 6563 337d 203d 2020 5c6d 6174 6872 6d7b ec3} = \mathrm{ │ │ │ -00066e50: 726f 6472 6967 7565 737d 2028 205c 7465 rodrigues} ( \te │ │ │ -00066e60: 7874 7474 7b72 7665 6332 7d20 2920 205c xttt{rvec2} ) \ │ │ │ -00066e70: 6364 6f74 205c 7465 7874 7474 7b74 7665 cdot \texttt{tve │ │ │ -00066e80: 6331 7d20 2b20 205c 7465 7874 7474 7b74 c1} + \texttt{t │ │ │ -00066e90: 7665 6332 7d20 5c65 6e64 7b61 7272 6179 vec2} \end{array │ │ │ -00066ea0: 7d20 2c5c 290a 0a77 6865 7265 205c 285c } ,\)..where \(\ │ │ │ -00066eb0: 6d61 7468 726d 7b72 6f64 7269 6775 6573 mathrm{rodrigues │ │ │ -00066ec0: 7d5c 2920 6465 6e6f 7465 7320 6120 726f }\) denotes a ro │ │ │ -00066ed0: 7461 7469 6f6e 2076 6563 746f 7220 746f tation vector to │ │ │ -00066ee0: 2061 2072 6f74 6174 696f 6e20 6d61 7472 a rotation matr │ │ │ -00066ef0: 6978 2074 7261 6e73 666f 726d 6174 696f ix transformatio │ │ │ -00066f00: 6e2c 2061 6e64 0a5c 285c 6d61 7468 726d n, and.\(\mathrm │ │ │ -00066f10: 7b72 6f64 7269 6775 6573 7d5e 7b2d 317d {rodrigues}^{-1} │ │ │ -00066f20: 5c29 2064 656e 6f74 6573 2074 6865 2069 \) denotes the i │ │ │ -00066f30: 6e76 6572 7365 2074 7261 6e73 666f 726d nverse transform │ │ │ -00066f40: 6174 696f 6e2e 2053 6565 2023 526f 6472 ation. See #Rodr │ │ │ -00066f50: 6967 7565 7320 666f 7220 6465 7461 696c igues for detail │ │ │ -00066f60: 732e 0a0a 416c 736f 2c20 7468 6520 6675 s...Also, the fu │ │ │ -00066f70: 6e63 7469 6f6e 7320 6361 6e20 636f 6d70 nctions can comp │ │ │ -00066f80: 7574 6520 7468 6520 6465 7269 7661 7469 ute the derivati │ │ │ -00066f90: 7665 7320 6f66 2074 6865 206f 7574 7075 ves of the outpu │ │ │ -00066fa0: 7420 7665 6374 6f72 7320 7769 7468 2072 t vectors with r │ │ │ -00066fb0: 6567 6172 6473 2074 6f20 7468 6520 696e egards to the in │ │ │ -00066fc0: 7075 740a 7665 6374 6f72 7320 2873 6565 put.vectors (see │ │ │ -00066fd0: 2023 6d61 744d 756c 4465 7269 7620 292e #matMulDeriv ). │ │ │ -00066fe0: 2054 6865 2066 756e 6374 696f 6e73 2061 The functions a │ │ │ -00066ff0: 7265 2075 7365 6420 696e 7369 6465 2023 re used inside # │ │ │ -00067000: 7374 6572 656f 4361 6c69 6272 6174 6520 stereoCalibrate │ │ │ -00067010: 6275 7420 6361 6e20 616c 736f 2062 6520 but can also be │ │ │ -00067020: 7573 6564 2069 6e0a 796f 7572 206f 776e used in.your own │ │ │ -00067030: 2063 6f64 6520 7768 6572 6520 4c65 7665 code where Leve │ │ │ -00067040: 6e62 6572 672d 4d61 7271 7561 7264 7420 nberg-Marquardt │ │ │ -00067050: 6f72 2061 6e6f 7468 6572 2067 7261 6469 or another gradi │ │ │ -00067060: 656e 742d 6261 7365 6420 736f 6c76 6572 ent-based solver │ │ │ -00067070: 2069 7320 7573 6564 2074 6f20 6f70 7469 is used to opti │ │ │ -00067080: 6d69 7a65 2061 0a66 756e 6374 696f 6e20 mize a.function │ │ │ -00067090: 7468 6174 2063 6f6e 7461 696e 7320 6120 that contains a │ │ │ -000670a0: 6d61 7472 6978 206d 756c 7469 706c 6963 matrix multiplic │ │ │ -000670b0: 6174 696f 6e2e 3c2f 6464 3e0a 3c2f 646c ation.
    .
    ...
  • .
  • .< │ │ │ -000670e0: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ -000670f0: 6574 6169 6c22 2069 643d 2263 6f6d 706f etail" id="compo │ │ │ -00067100: 7365 5254 286f 7267 2e6f 7065 6e63 762e seRT(org.opencv. │ │ │ -00067110: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ -00067120: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ -00067130: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ -00067140: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ -00067150: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ -00067160: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ -00067170: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ -00067180: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ -00067190: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ -000671a0: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ -000671b0: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ -000671c0: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ -000671d0: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ -000671e0: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ -000671f0: 2e4d 6174 2922 3e0a 3c68 333e 636f 6d70 .Mat)">.

    comp │ │ │ -00067200: 6f73 6552 543c 2f68 333e 0a3c 6469 7620 oseRT

    .
    .
    public static void │ │ │ -000672a0: 266e 6273 703b 3c73 7061 6e20 636c 6173  composeRT( │ │ │ -000672f0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -00067330: 2f61 3e26 6e62 7370 3b72 7665 6331 2c0a /a> rvec1,. │ │ │ -00067340: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -00067380: 3c2f 613e 266e 6273 703b 7476 6563 312c  tvec1, │ │ │ -00067390: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000673d0: 743c 2f61 3e26 6e62 7370 3b72 7665 6332 t rvec2 │ │ │ -000673e0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -00067420: 6174 3c2f 613e 266e 6273 703b 7476 6563 at tvec │ │ │ -00067430: 322c 0a20 3c61 2068 7265 663d 222e 2e2f 2,. │ │ │ -00067470: 4d61 743c 2f61 3e26 6e62 7370 3b72 7665 Mat rve │ │ │ -00067480: 6333 2c0a 203c 6120 6872 6566 3d22 2e2e c3,. Mat tv │ │ │ -000674d0: 6563 332c 0a20 3c61 2068 7265 663d 222e ec3,. Mat d │ │ │ -00067520: 7233 6472 312c 0a20 3c61 2068 7265 663d r3dr1,. Mat  │ │ │ -00067570: 3b64 7233 6474 312c 0a20 3c61 2068 7265 ;dr3dt1,. Mat&nb │ │ │ -000675c0: 7370 3b64 7233 6472 322c 0a20 3c61 2068 sp;dr3dr2,. Mat& │ │ │ -00067610: 6e62 7370 3b64 7233 6474 322c 0a20 3c61 nbsp;dr3dt2,. Mat dt3dr1,. │ │ │ -00067670: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000676b0: 2f61 3e26 6e62 7370 3b64 7433 6474 3129 /a> dt3dt1) │ │ │ -000676c0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Combines two ro │ │ │ -000676f0: 7461 7469 6f6e 2d61 6e64 2d73 6869 6674 tation-and-shift │ │ │ -00067700: 2074 7261 6e73 666f 726d 6174 696f 6e73 transformations │ │ │ -00067710: 2e3c 2f64 6976 3e0a 3c64 6c20 636c 6173 .
    .
    .
    P │ │ │ -00067730: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ -00067740: 3c64 643e 3c63 6f64 653e 7276 6563 313c
    rvec1< │ │ │ -00067750: 2f63 6f64 653e 202d 2046 6972 7374 2072 /code> - First r │ │ │ -00067760: 6f74 6174 696f 6e20 7665 6374 6f72 2e3c otation vector.< │ │ │ -00067770: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ -00067780: 7665 6331 3c2f 636f 6465 3e20 2d20 4669 vec1 - Fi │ │ │ -00067790: 7273 7420 7472 616e 736c 6174 696f 6e20 rst translation │ │ │ -000677a0: 7665 6374 6f72 2e3c 2f64 643e 0a3c 6464 vector.
    .
    rvec2 - Second rot │ │ │ -000677d0: 6174 696f 6e20 7665 6374 6f72 2e3c 2f64 ation vector..
    tve │ │ │ -000677f0: 6332 3c2f 636f 6465 3e20 2d20 5365 636f c2 - Seco │ │ │ -00067800: 6e64 2074 7261 6e73 6c61 7469 6f6e 2076 nd translation v │ │ │ -00067810: 6563 746f 722e 3c2f 6464 3e0a 3c64 643e ector.
    .
    │ │ │ -00067820: 3c63 6f64 653e 7276 6563 333c 2f63 6f64 rvec3 - Output rota │ │ │ -00067840: 7469 6f6e 2076 6563 746f 7220 6f66 2074 tion vector of t │ │ │ -00067850: 6865 2073 7570 6572 706f 7369 7469 6f6e he superposition │ │ │ -00067860: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    tvec3 - │ │ │ -00067880: 4f75 7470 7574 2074 7261 6e73 6c61 7469 Output translati │ │ │ -00067890: 6f6e 2076 6563 746f 7220 6f66 2074 6865 on vector of the │ │ │ -000678a0: 2073 7570 6572 706f 7369 7469 6f6e 2e3c superposition.< │ │ │ -000678b0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -000678c0: 7233 6472 313c 2f63 6f64 653e 202d 204f r3dr1 - O │ │ │ -000678d0: 7074 696f 6e61 6c20 6f75 7470 7574 2064 ptional output d │ │ │ -000678e0: 6572 6976 6174 6976 6520 6f66 2072 7665 erivative of rve │ │ │ -000678f0: 6333 2077 6974 6820 7265 6761 7264 2074 c3 with regard t │ │ │ -00067900: 6f20 7276 6563 313c 2f64 643e 0a3c 6464 o rvec1
    .
    dr3dt1 - Optional │ │ │ -00067930: 6f75 7470 7574 2064 6572 6976 6174 6976 output derivativ │ │ │ -00067940: 6520 6f66 2072 7665 6333 2077 6974 6820 e of rvec3 with │ │ │ -00067950: 7265 6761 7264 2074 6f20 7476 6563 313c regard to tvec1< │ │ │ -00067960: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -00067970: 7233 6472 323c 2f63 6f64 653e 202d 204f r3dr2 - O │ │ │ -00067980: 7074 696f 6e61 6c20 6f75 7470 7574 2064 ptional output d │ │ │ -00067990: 6572 6976 6174 6976 6520 6f66 2072 7665 erivative of rve │ │ │ -000679a0: 6333 2077 6974 6820 7265 6761 7264 2074 c3 with regard t │ │ │ -000679b0: 6f20 7276 6563 323c 2f64 643e 0a3c 6464 o rvec2
    .
    dr3dt2 - Optional │ │ │ -000679e0: 6f75 7470 7574 2064 6572 6976 6174 6976 output derivativ │ │ │ -000679f0: 6520 6f66 2072 7665 6333 2077 6974 6820 e of rvec3 with │ │ │ -00067a00: 7265 6761 7264 2074 6f20 7476 6563 323c regard to tvec2< │ │ │ -00067a10: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -00067a20: 7433 6472 313c 2f63 6f64 653e 202d 204f t3dr1 - O │ │ │ -00067a30: 7074 696f 6e61 6c20 6f75 7470 7574 2064 ptional output d │ │ │ -00067a40: 6572 6976 6174 6976 6520 6f66 2074 7665 erivative of tve │ │ │ -00067a50: 6333 2077 6974 6820 7265 6761 7264 2074 c3 with regard t │ │ │ -00067a60: 6f20 7276 6563 313c 2f64 643e 0a3c 6464 o rvec1
    .
    dt3dt1 - Optional │ │ │ -00067a90: 6f75 7470 7574 2064 6572 6976 6174 6976 output derivativ │ │ │ -00067aa0: 6520 6f66 2074 7665 6333 2077 6974 6820 e of tvec3 with │ │ │ -00067ab0: 7265 6761 7264 2074 6f20 7476 6563 310a regard to tvec1. │ │ │ -00067ac0: 0a54 6865 2066 756e 6374 696f 6e73 2063 .The functions c │ │ │ -00067ad0: 6f6d 7075 7465 3a0a 0a5c 285c 6265 6769 ompute:..\(\begi │ │ │ -00067ae0: 6e7b 6172 7261 797d 7b6c 7d20 5c74 6578 n{array}{l} \tex │ │ │ -00067af0: 7474 747b 7276 6563 337d 203d 2020 5c6d ttt{rvec3} = \m │ │ │ -00067b00: 6174 6872 6d7b 726f 6472 6967 7565 737d athrm{rodrigues} │ │ │ -00067b10: 205e 7b2d 317d 205c 6c65 6674 2028 205c ^{-1} \left ( \ │ │ │ -00067b20: 6d61 7468 726d 7b72 6f64 7269 6775 6573 mathrm{rodrigues │ │ │ -00067b30: 7d20 2820 5c74 6578 7474 747b 7276 6563 } ( \texttt{rvec │ │ │ -00067b40: 327d 2029 2020 5c63 646f 7420 5c6d 6174 2} ) \cdot \mat │ │ │ -00067b50: 6872 6d7b 726f 6472 6967 7565 737d 2028 hrm{rodrigues} ( │ │ │ -00067b60: 205c 7465 7874 7474 7b72 7665 6331 7d20 \texttt{rvec1} │ │ │ -00067b70: 2920 5c72 6967 6874 2029 2020 5c5c 205c ) \right ) \\ \ │ │ │ -00067b80: 7465 7874 7474 7b74 7665 6333 7d20 3d20 texttt{tvec3} = │ │ │ -00067b90: 205c 6d61 7468 726d 7b72 6f64 7269 6775 \mathrm{rodrigu │ │ │ -00067ba0: 6573 7d20 2820 5c74 6578 7474 747b 7276 es} ( \texttt{rv │ │ │ -00067bb0: 6563 327d 2029 2020 5c63 646f 7420 5c74 ec2} ) \cdot \t │ │ │ -00067bc0: 6578 7474 747b 7476 6563 317d 202b 2020 exttt{tvec1} + │ │ │ -00067bd0: 5c74 6578 7474 747b 7476 6563 327d 205c \texttt{tvec2} \ │ │ │ -00067be0: 656e 647b 6172 7261 797d 202c 5c29 0a0a end{array} ,\).. │ │ │ -00067bf0: 7768 6572 6520 5c28 5c6d 6174 6872 6d7b where \(\mathrm{ │ │ │ -00067c00: 726f 6472 6967 7565 737d 5c29 2064 656e rodrigues}\) den │ │ │ -00067c10: 6f74 6573 2061 2072 6f74 6174 696f 6e20 otes a rotation │ │ │ -00067c20: 7665 6374 6f72 2074 6f20 6120 726f 7461 vector to a rota │ │ │ -00067c30: 7469 6f6e 206d 6174 7269 7820 7472 616e tion matrix tran │ │ │ -00067c40: 7366 6f72 6d61 7469 6f6e 2c20 616e 640a sformation, and. │ │ │ -00067c50: 5c28 5c6d 6174 6872 6d7b 726f 6472 6967 \(\mathrm{rodrig │ │ │ -00067c60: 7565 737d 5e7b 2d31 7d5c 2920 6465 6e6f ues}^{-1}\) deno │ │ │ -00067c70: 7465 7320 7468 6520 696e 7665 7273 6520 tes the inverse │ │ │ -00067c80: 7472 616e 7366 6f72 6d61 7469 6f6e 2e20 transformation. │ │ │ -00067c90: 5365 6520 2352 6f64 7269 6775 6573 2066 See #Rodrigues f │ │ │ -00067ca0: 6f72 2064 6574 6169 6c73 2e0a 0a41 6c73 or details...Als │ │ │ -00067cb0: 6f2c 2074 6865 2066 756e 6374 696f 6e73 o, the functions │ │ │ -00067cc0: 2063 616e 2063 6f6d 7075 7465 2074 6865 can compute the │ │ │ -00067cd0: 2064 6572 6976 6174 6976 6573 206f 6620 derivatives of │ │ │ -00067ce0: 7468 6520 6f75 7470 7574 2076 6563 746f the output vecto │ │ │ -00067cf0: 7273 2077 6974 6820 7265 6761 7264 7320 rs with regards │ │ │ -00067d00: 746f 2074 6865 2069 6e70 7574 0a76 6563 to the input.vec │ │ │ -00067d10: 746f 7273 2028 7365 6520 236d 6174 4d75 tors (see #matMu │ │ │ -00067d20: 6c44 6572 6976 2029 2e20 5468 6520 6675 lDeriv ). The fu │ │ │ -00067d30: 6e63 7469 6f6e 7320 6172 6520 7573 6564 nctions are used │ │ │ -00067d40: 2069 6e73 6964 6520 2373 7465 7265 6f43 inside #stereoC │ │ │ -00067d50: 616c 6962 7261 7465 2062 7574 2063 616e alibrate but can │ │ │ -00067d60: 2061 6c73 6f20 6265 2075 7365 6420 696e also be used in │ │ │ -00067d70: 0a79 6f75 7220 6f77 6e20 636f 6465 2077 .your own code w │ │ │ -00067d80: 6865 7265 204c 6576 656e 6265 7267 2d4d here Levenberg-M │ │ │ -00067d90: 6172 7175 6172 6474 206f 7220 616e 6f74 arquardt or anot │ │ │ -00067da0: 6865 7220 6772 6164 6965 6e74 2d62 6173 her gradient-bas │ │ │ -00067db0: 6564 2073 6f6c 7665 7220 6973 2075 7365 ed solver is use │ │ │ -00067dc0: 6420 746f 206f 7074 696d 697a 6520 610a d to optimize a. │ │ │ -00067dd0: 6675 6e63 7469 6f6e 2074 6861 7420 636f function that co │ │ │ -00067de0: 6e74 6169 6e73 2061 206d 6174 7269 7820 ntains a matrix │ │ │ -00067df0: 6d75 6c74 6970 6c69 6361 7469 6f6e 2e3c multiplication.< │ │ │ -00067e00: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    ....
  • ..
  • .
    .

    composeRT

    . │ │ │ -00067f40: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ -00067f60: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ -00067fa0: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ -00067fb0: 3c73 7061 6e20 636c 6173 733d 2272 6574 void composeRT< │ │ │ -00068000: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat rv │ │ │ -00068070: 6563 312c 0a20 3c61 2068 7265 663d 222e ec1,. Mat t │ │ │ -000680c0: 7665 6331 2c0a 203c 6120 6872 6566 3d22 vec1,. Mat  │ │ │ -00068110: 7276 6563 322c 0a20 3c61 2068 7265 663d rvec2,. Mat  │ │ │ -00068160: 3b74 7665 6332 2c0a 203c 6120 6872 6566 ;tvec2,. Mat&nbs │ │ │ -000681b0: 703b 7276 6563 332c 0a20 3c61 2068 7265 p;rvec3,. Mat&nb │ │ │ -00068200: 7370 3b74 7665 6333 2c0a 203c 6120 6872 sp;tvec3,. Mat&n │ │ │ -00068250: 6273 703b 6472 3364 7231 2c0a 203c 6120 bsp;dr3dr1,. Mat │ │ │ -000682a0: 266e 6273 703b 6472 3364 7431 2c0a 203c  dr3dt1,. < │ │ │ -000682b0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000682c0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000682d0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000682e0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dr3dr2,. │ │ │ -00068300: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -00068340: 3c2f 613e 266e 6273 703b 6472 3364 7432  dr3dt2 │ │ │ -00068350: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -00068390: 6174 3c2f 613e 266e 6273 703b 6474 3364 at dt3d │ │ │ -000683a0: 7231 293c 2f73 7061 6e3e 3c2f 6469 763e r1)
    │ │ │ -000683b0: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Combines two │ │ │ -000683d0: 2072 6f74 6174 696f 6e2d 616e 642d 7368 rotation-and-sh │ │ │ -000683e0: 6966 7420 7472 616e 7366 6f72 6d61 7469 ift transformati │ │ │ -000683f0: 6f6e 732e 3c2f 6469 763e 0a3c 646c 2063 ons.
    .
    .Parameters:.
    rve │ │ │ -00068430: 6331 3c2f 636f 6465 3e20 2d20 4669 7273 c1 - Firs │ │ │ -00068440: 7420 726f 7461 7469 6f6e 2076 6563 746f t rotation vecto │ │ │ -00068450: 722e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 r.
    .
    tvec1 - │ │ │ -00068470: 2046 6972 7374 2074 7261 6e73 6c61 7469 First translati │ │ │ -00068480: 6f6e 2076 6563 746f 722e 3c2f 6464 3e0a on vector.
    . │ │ │ -00068490: 3c64 643e 3c63 6f64 653e 7276 6563 323c
    rvec2< │ │ │ -000684a0: 2f63 6f64 653e 202d 2053 6563 6f6e 6420 /code> - Second │ │ │ -000684b0: 726f 7461 7469 6f6e 2076 6563 746f 722e rotation vector. │ │ │ -000684c0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000684d0: 7476 6563 323c 2f63 6f64 653e 202d 2053 tvec2 - S │ │ │ -000684e0: 6563 6f6e 6420 7472 616e 736c 6174 696f econd translatio │ │ │ -000684f0: 6e20 7665 6374 6f72 2e3c 2f64 643e 0a3c n vector.
    .< │ │ │ -00068500: 6464 3e3c 636f 6465 3e72 7665 6333 3c2f dd>rvec3 - Output r │ │ │ -00068520: 6f74 6174 696f 6e20 7665 6374 6f72 206f otation vector o │ │ │ -00068530: 6620 7468 6520 7375 7065 7270 6f73 6974 f the superposit │ │ │ -00068540: 696f 6e2e 3c2f 6464 3e0a 3c64 643e 3c63 ion..
    tvec3 │ │ │ -00068560: 202d 204f 7574 7075 7420 7472 616e 736c - Output transl │ │ │ -00068570: 6174 696f 6e20 7665 6374 6f72 206f 6620 ation vector of │ │ │ -00068580: 7468 6520 7375 7065 7270 6f73 6974 696f the superpositio │ │ │ -00068590: 6e2e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 n.
    .
    dr3dr1 │ │ │ -000685b0: 2d20 4f70 7469 6f6e 616c 206f 7574 7075 - Optional outpu │ │ │ -000685c0: 7420 6465 7269 7661 7469 7665 206f 6620 t derivative of │ │ │ -000685d0: 7276 6563 3320 7769 7468 2072 6567 6172 rvec3 with regar │ │ │ -000685e0: 6420 746f 2072 7665 6331 3c2f 6464 3e0a d to rvec1
    . │ │ │ -000685f0: 3c64 643e 3c63 6f64 653e 6472 3364 7431
    dr3dt1 │ │ │ -00068600: 3c2f 636f 6465 3e20 2d20 4f70 7469 6f6e - Option │ │ │ -00068610: 616c 206f 7574 7075 7420 6465 7269 7661 al output deriva │ │ │ -00068620: 7469 7665 206f 6620 7276 6563 3320 7769 tive of rvec3 wi │ │ │ -00068630: 7468 2072 6567 6172 6420 746f 2074 7665 th regard to tve │ │ │ -00068640: 6331 3c2f 6464 3e0a 3c64 643e 3c63 6f64 c1
    .
    dr3dr2 │ │ │ -00068660: 2d20 4f70 7469 6f6e 616c 206f 7574 7075 - Optional outpu │ │ │ -00068670: 7420 6465 7269 7661 7469 7665 206f 6620 t derivative of │ │ │ -00068680: 7276 6563 3320 7769 7468 2072 6567 6172 rvec3 with regar │ │ │ -00068690: 6420 746f 2072 7665 6332 3c2f 6464 3e0a d to rvec2
    . │ │ │ -000686a0: 3c64 643e 3c63 6f64 653e 6472 3364 7432
    dr3dt2 │ │ │ -000686b0: 3c2f 636f 6465 3e20 2d20 4f70 7469 6f6e - Option │ │ │ -000686c0: 616c 206f 7574 7075 7420 6465 7269 7661 al output deriva │ │ │ -000686d0: 7469 7665 206f 6620 7276 6563 3320 7769 tive of rvec3 wi │ │ │ -000686e0: 7468 2072 6567 6172 6420 746f 2074 7665 th regard to tve │ │ │ -000686f0: 6332 3c2f 6464 3e0a 3c64 643e 3c63 6f64 c2
    .
    dt3dr1 │ │ │ -00068710: 2d20 4f70 7469 6f6e 616c 206f 7574 7075 - Optional outpu │ │ │ -00068720: 7420 6465 7269 7661 7469 7665 206f 6620 t derivative of │ │ │ -00068730: 7476 6563 3320 7769 7468 2072 6567 6172 tvec3 with regar │ │ │ -00068740: 6420 746f 2072 7665 6331 0a0a 5468 6520 d to rvec1..The │ │ │ -00068750: 6675 6e63 7469 6f6e 7320 636f 6d70 7574 functions comput │ │ │ -00068760: 653a 0a0a 5c28 5c62 6567 696e 7b61 7272 e:..\(\begin{arr │ │ │ -00068770: 6179 7d7b 6c7d 205c 7465 7874 7474 7b72 ay}{l} \texttt{r │ │ │ -00068780: 7665 6333 7d20 3d20 205c 6d61 7468 726d vec3} = \mathrm │ │ │ -00068790: 7b72 6f64 7269 6775 6573 7d20 5e7b 2d31 {rodrigues} ^{-1 │ │ │ -000687a0: 7d20 5c6c 6566 7420 2820 5c6d 6174 6872 } \left ( \mathr │ │ │ -000687b0: 6d7b 726f 6472 6967 7565 737d 2028 205c m{rodrigues} ( \ │ │ │ -000687c0: 7465 7874 7474 7b72 7665 6332 7d20 2920 texttt{rvec2} ) │ │ │ -000687d0: 205c 6364 6f74 205c 6d61 7468 726d 7b72 \cdot \mathrm{r │ │ │ -000687e0: 6f64 7269 6775 6573 7d20 2820 5c74 6578 odrigues} ( \tex │ │ │ -000687f0: 7474 747b 7276 6563 317d 2029 205c 7269 ttt{rvec1} ) \ri │ │ │ -00068800: 6768 7420 2920 205c 5c20 5c74 6578 7474 ght ) \\ \textt │ │ │ -00068810: 747b 7476 6563 337d 203d 2020 5c6d 6174 t{tvec3} = \mat │ │ │ -00068820: 6872 6d7b 726f 6472 6967 7565 737d 2028 hrm{rodrigues} ( │ │ │ -00068830: 205c 7465 7874 7474 7b72 7665 6332 7d20 \texttt{rvec2} │ │ │ -00068840: 2920 205c 6364 6f74 205c 7465 7874 7474 ) \cdot \texttt │ │ │ -00068850: 7b74 7665 6331 7d20 2b20 205c 7465 7874 {tvec1} + \text │ │ │ -00068860: 7474 7b74 7665 6332 7d20 5c65 6e64 7b61 tt{tvec2} \end{a │ │ │ -00068870: 7272 6179 7d20 2c5c 290a 0a77 6865 7265 rray} ,\)..where │ │ │ -00068880: 205c 285c 6d61 7468 726d 7b72 6f64 7269 \(\mathrm{rodri │ │ │ -00068890: 6775 6573 7d5c 2920 6465 6e6f 7465 7320 gues}\) denotes │ │ │ -000688a0: 6120 726f 7461 7469 6f6e 2076 6563 746f a rotation vecto │ │ │ -000688b0: 7220 746f 2061 2072 6f74 6174 696f 6e20 r to a rotation │ │ │ -000688c0: 6d61 7472 6978 2074 7261 6e73 666f 726d matrix transform │ │ │ -000688d0: 6174 696f 6e2c 2061 6e64 0a5c 285c 6d61 ation, and.\(\ma │ │ │ -000688e0: 7468 726d 7b72 6f64 7269 6775 6573 7d5e thrm{rodrigues}^ │ │ │ -000688f0: 7b2d 317d 5c29 2064 656e 6f74 6573 2074 {-1}\) denotes t │ │ │ -00068900: 6865 2069 6e76 6572 7365 2074 7261 6e73 he inverse trans │ │ │ -00068910: 666f 726d 6174 696f 6e2e 2053 6565 2023 formation. See # │ │ │ -00068920: 526f 6472 6967 7565 7320 666f 7220 6465 Rodrigues for de │ │ │ -00068930: 7461 696c 732e 0a0a 416c 736f 2c20 7468 tails...Also, th │ │ │ -00068940: 6520 6675 6e63 7469 6f6e 7320 6361 6e20 e functions can │ │ │ -00068950: 636f 6d70 7574 6520 7468 6520 6465 7269 compute the deri │ │ │ -00068960: 7661 7469 7665 7320 6f66 2074 6865 206f vatives of the o │ │ │ -00068970: 7574 7075 7420 7665 6374 6f72 7320 7769 utput vectors wi │ │ │ -00068980: 7468 2072 6567 6172 6473 2074 6f20 7468 th regards to th │ │ │ -00068990: 6520 696e 7075 740a 7665 6374 6f72 7320 e input.vectors │ │ │ -000689a0: 2873 6565 2023 6d61 744d 756c 4465 7269 (see #matMulDeri │ │ │ -000689b0: 7620 292e 2054 6865 2066 756e 6374 696f v ). The functio │ │ │ -000689c0: 6e73 2061 7265 2075 7365 6420 696e 7369 ns are used insi │ │ │ -000689d0: 6465 2023 7374 6572 656f 4361 6c69 6272 de #stereoCalibr │ │ │ -000689e0: 6174 6520 6275 7420 6361 6e20 616c 736f ate but can also │ │ │ -000689f0: 2062 6520 7573 6564 2069 6e0a 796f 7572 be used in.your │ │ │ -00068a00: 206f 776e 2063 6f64 6520 7768 6572 6520 own code where │ │ │ -00068a10: 4c65 7665 6e62 6572 672d 4d61 7271 7561 Levenberg-Marqua │ │ │ -00068a20: 7264 7420 6f72 2061 6e6f 7468 6572 2067 rdt or another g │ │ │ -00068a30: 7261 6469 656e 742d 6261 7365 6420 736f radient-based so │ │ │ -00068a40: 6c76 6572 2069 7320 7573 6564 2074 6f20 lver is used to │ │ │ -00068a50: 6f70 7469 6d69 7a65 2061 0a66 756e 6374 optimize a.funct │ │ │ -00068a60: 696f 6e20 7468 6174 2063 6f6e 7461 696e ion that contain │ │ │ -00068a70: 7320 6120 6d61 7472 6978 206d 756c 7469 s a matrix multi │ │ │ -00068a80: 706c 6963 6174 696f 6e2e 3c2f 6464 3e0a plication.
    . │ │ │ -00068a90: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    ..
  • .

    composeR │ │ │ -00068bb0: 543c 2f68 333e 0a3c 6469 7620 636c 6173 T

    .
    .
    pub │ │ │ -00068c10: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static void&nbs │ │ │ -00068c50: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;com │ │ │ -00068c70: 706f 7365 5254 3c2f 7370 616e 3e3c 7762 poseRT(Mat& │ │ │ -00068ce0: 6e62 7370 3b72 7665 6331 2c0a 203c 6120 nbsp;rvec1,. Mat │ │ │ -00068d30: 266e 6273 703b 7476 6563 312c 0a20 3c61  tvec1,. Mat rvec2,. < │ │ │ -00068d90: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00068da0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00068db0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00068dc0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat tvec2,. │ │ │ -00068de0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -00068e20: 2f61 3e26 6e62 7370 3b72 7665 6333 2c0a /a> rvec3,. │ │ │ -00068e30: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -00068e70: 3c2f 613e 266e 6273 703b 7476 6563 332c  tvec3, │ │ │ -00068e80: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -00068ec0: 743c 2f61 3e26 6e62 7370 3b64 7233 6472 t dr3dr │ │ │ -00068ed0: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ -00068f10: 4d61 743c 2f61 3e26 6e62 7370 3b64 7233 Mat dr3 │ │ │ -00068f20: 6474 312c 0a20 3c61 2068 7265 663d 222e dt1,. Mat d │ │ │ -00068f70: 7233 6472 322c 0a20 3c61 2068 7265 663d r3dr2,. Mat  │ │ │ -00068fc0: 3b64 7233 6474 3229 3c2f 7370 616e 3e3c ;dr3dt2)< │ │ │ -00068fd0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Combine │ │ │ -00068ff0: 7320 7477 6f20 726f 7461 7469 6f6e 2d61 s two rotation-a │ │ │ -00069000: 6e64 2d73 6869 6674 2074 7261 6e73 666f nd-shift transfo │ │ │ -00069010: 726d 6174 696f 6e73 2e3c 2f64 6976 3e0a rmations.
    . │ │ │ -00069020: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ -00069040: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    rvec1 - │ │ │ -00069060: 2046 6972 7374 2072 6f74 6174 696f 6e20 First rotation │ │ │ -00069070: 7665 6374 6f72 2e3c 2f64 643e 0a3c 6464 vector.
    .
    tvec1 - First tran │ │ │ -000690a0: 736c 6174 696f 6e20 7665 6374 6f72 2e3c slation vector.< │ │ │ -000690b0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e72 /dd>.
    r │ │ │ -000690c0: 7665 6332 3c2f 636f 6465 3e20 2d20 5365 vec2 - Se │ │ │ -000690d0: 636f 6e64 2072 6f74 6174 696f 6e20 7665 cond rotation ve │ │ │ -000690e0: 6374 6f72 2e3c 2f64 643e 0a3c 6464 3e3c ctor.
    .
    < │ │ │ -000690f0: 636f 6465 3e74 7665 6332 3c2f 636f 6465 code>tvec2 - Second trans │ │ │ -00069110: 6c61 7469 6f6e 2076 6563 746f 722e 3c2f lation vector..
    rv │ │ │ -00069130: 6563 333c 2f63 6f64 653e 202d 204f 7574 ec3 - Out │ │ │ -00069140: 7075 7420 726f 7461 7469 6f6e 2076 6563 put rotation vec │ │ │ -00069150: 746f 7220 6f66 2074 6865 2073 7570 6572 tor of the super │ │ │ -00069160: 706f 7369 7469 6f6e 2e3c 2f64 643e 0a3c position.
    .< │ │ │ -00069170: 6464 3e3c 636f 6465 3e74 7665 6333 3c2f dd>tvec3 - Output t │ │ │ -00069190: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ -000691a0: 7220 6f66 2074 6865 2073 7570 6572 706f r of the superpo │ │ │ -000691b0: 7369 7469 6f6e 2e3c 2f64 643e 0a3c 6464 sition..
    dr3dr1 - Optional │ │ │ -000691e0: 6f75 7470 7574 2064 6572 6976 6174 6976 output derivativ │ │ │ -000691f0: 6520 6f66 2072 7665 6333 2077 6974 6820 e of rvec3 with │ │ │ -00069200: 7265 6761 7264 2074 6f20 7276 6563 313c regard to rvec1< │ │ │ -00069210: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -00069220: 7233 6474 313c 2f63 6f64 653e 202d 204f r3dt1 - O │ │ │ -00069230: 7074 696f 6e61 6c20 6f75 7470 7574 2064 ptional output d │ │ │ -00069240: 6572 6976 6174 6976 6520 6f66 2072 7665 erivative of rve │ │ │ -00069250: 6333 2077 6974 6820 7265 6761 7264 2074 c3 with regard t │ │ │ -00069260: 6f20 7476 6563 313c 2f64 643e 0a3c 6464 o tvec1
    .
    dr3dr2 - Optional │ │ │ -00069290: 6f75 7470 7574 2064 6572 6976 6174 6976 output derivativ │ │ │ -000692a0: 6520 6f66 2072 7665 6333 2077 6974 6820 e of rvec3 with │ │ │ -000692b0: 7265 6761 7264 2074 6f20 7276 6563 323c regard to rvec2< │ │ │ -000692c0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -000692d0: 7233 6474 323c 2f63 6f64 653e 202d 204f r3dt2 - O │ │ │ -000692e0: 7074 696f 6e61 6c20 6f75 7470 7574 2064 ptional output d │ │ │ -000692f0: 6572 6976 6174 6976 6520 6f66 2072 7665 erivative of rve │ │ │ -00069300: 6333 2077 6974 6820 7265 6761 7264 2074 c3 with regard t │ │ │ -00069310: 6f20 7476 6563 320a 0a54 6865 2066 756e o tvec2..The fun │ │ │ -00069320: 6374 696f 6e73 2063 6f6d 7075 7465 3a0a ctions compute:. │ │ │ -00069330: 0a5c 285c 6265 6769 6e7b 6172 7261 797d .\(\begin{array} │ │ │ -00069340: 7b6c 7d20 5c74 6578 7474 747b 7276 6563 {l} \texttt{rvec │ │ │ -00069350: 337d 203d 2020 5c6d 6174 6872 6d7b 726f 3} = \mathrm{ro │ │ │ -00069360: 6472 6967 7565 737d 205e 7b2d 317d 205c drigues} ^{-1} \ │ │ │ -00069370: 6c65 6674 2028 205c 6d61 7468 726d 7b72 left ( \mathrm{r │ │ │ -00069380: 6f64 7269 6775 6573 7d20 2820 5c74 6578 odrigues} ( \tex │ │ │ -00069390: 7474 747b 7276 6563 327d 2029 2020 5c63 ttt{rvec2} ) \c │ │ │ -000693a0: 646f 7420 5c6d 6174 6872 6d7b 726f 6472 dot \mathrm{rodr │ │ │ -000693b0: 6967 7565 737d 2028 205c 7465 7874 7474 igues} ( \texttt │ │ │ -000693c0: 7b72 7665 6331 7d20 2920 5c72 6967 6874 {rvec1} ) \right │ │ │ -000693d0: 2029 2020 5c5c 205c 7465 7874 7474 7b74 ) \\ \texttt{t │ │ │ -000693e0: 7665 6333 7d20 3d20 205c 6d61 7468 726d vec3} = \mathrm │ │ │ -000693f0: 7b72 6f64 7269 6775 6573 7d20 2820 5c74 {rodrigues} ( \t │ │ │ -00069400: 6578 7474 747b 7276 6563 327d 2029 2020 exttt{rvec2} ) │ │ │ -00069410: 5c63 646f 7420 5c74 6578 7474 747b 7476 \cdot \texttt{tv │ │ │ -00069420: 6563 317d 202b 2020 5c74 6578 7474 747b ec1} + \texttt{ │ │ │ -00069430: 7476 6563 327d 205c 656e 647b 6172 7261 tvec2} \end{arra │ │ │ -00069440: 797d 202c 5c29 0a0a 7768 6572 6520 5c28 y} ,\)..where \( │ │ │ -00069450: 5c6d 6174 6872 6d7b 726f 6472 6967 7565 \mathrm{rodrigue │ │ │ -00069460: 737d 5c29 2064 656e 6f74 6573 2061 2072 s}\) denotes a r │ │ │ -00069470: 6f74 6174 696f 6e20 7665 6374 6f72 2074 otation vector t │ │ │ -00069480: 6f20 6120 726f 7461 7469 6f6e 206d 6174 o a rotation mat │ │ │ -00069490: 7269 7820 7472 616e 7366 6f72 6d61 7469 rix transformati │ │ │ -000694a0: 6f6e 2c20 616e 640a 5c28 5c6d 6174 6872 on, and.\(\mathr │ │ │ -000694b0: 6d7b 726f 6472 6967 7565 737d 5e7b 2d31 m{rodrigues}^{-1 │ │ │ -000694c0: 7d5c 2920 6465 6e6f 7465 7320 7468 6520 }\) denotes the │ │ │ -000694d0: 696e 7665 7273 6520 7472 616e 7366 6f72 inverse transfor │ │ │ -000694e0: 6d61 7469 6f6e 2e20 5365 6520 2352 6f64 mation. See #Rod │ │ │ -000694f0: 7269 6775 6573 2066 6f72 2064 6574 6169 rigues for detai │ │ │ -00069500: 6c73 2e0a 0a41 6c73 6f2c 2074 6865 2066 ls...Also, the f │ │ │ -00069510: 756e 6374 696f 6e73 2063 616e 2063 6f6d unctions can com │ │ │ -00069520: 7075 7465 2074 6865 2064 6572 6976 6174 pute the derivat │ │ │ -00069530: 6976 6573 206f 6620 7468 6520 6f75 7470 ives of the outp │ │ │ -00069540: 7574 2076 6563 746f 7273 2077 6974 6820 ut vectors with │ │ │ -00069550: 7265 6761 7264 7320 746f 2074 6865 2069 regards to the i │ │ │ -00069560: 6e70 7574 0a76 6563 746f 7273 2028 7365 nput.vectors (se │ │ │ -00069570: 6520 236d 6174 4d75 6c44 6572 6976 2029 e #matMulDeriv ) │ │ │ -00069580: 2e20 5468 6520 6675 6e63 7469 6f6e 7320 . The functions │ │ │ -00069590: 6172 6520 7573 6564 2069 6e73 6964 6520 are used inside │ │ │ -000695a0: 2373 7465 7265 6f43 616c 6962 7261 7465 #stereoCalibrate │ │ │ -000695b0: 2062 7574 2063 616e 2061 6c73 6f20 6265 but can also be │ │ │ -000695c0: 2075 7365 6420 696e 0a79 6f75 7220 6f77 used in.your ow │ │ │ -000695d0: 6e20 636f 6465 2077 6865 7265 204c 6576 n code where Lev │ │ │ -000695e0: 656e 6265 7267 2d4d 6172 7175 6172 6474 enberg-Marquardt │ │ │ -000695f0: 206f 7220 616e 6f74 6865 7220 6772 6164 or another grad │ │ │ -00069600: 6965 6e74 2d62 6173 6564 2073 6f6c 7665 ient-based solve │ │ │ -00069610: 7220 6973 2075 7365 6420 746f 206f 7074 r is used to opt │ │ │ -00069620: 696d 697a 6520 610a 6675 6e63 7469 6f6e imize a.function │ │ │ -00069630: 2074 6861 7420 636f 6e74 6169 6e73 2061 that contains a │ │ │ -00069640: 206d 6174 7269 7820 6d75 6c74 6970 6c69 matrix multipli │ │ │ -00069650: 6361 7469 6f6e 2e3c 2f64 643e 0a3c 2f64 cation.
    ..
    ...
  • . │ │ │ -00069680: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    composeRT

    . │ │ │ -00069770: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ -00069790: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ -000697d0: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ -000697e0: 3c73 7061 6e20 636c 6173 733d 2272 6574 void composeRT< │ │ │ -00069830: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat rv │ │ │ -000698a0: 6563 312c 0a20 3c61 2068 7265 663d 222e ec1,. Mat t │ │ │ -000698f0: 7665 6331 2c0a 203c 6120 6872 6566 3d22 vec1,. Mat  │ │ │ -00069940: 7276 6563 322c 0a20 3c61 2068 7265 663d rvec2,. Mat  │ │ │ -00069990: 3b74 7665 6332 2c0a 203c 6120 6872 6566 ;tvec2,. Mat&nbs │ │ │ -000699e0: 703b 7276 6563 332c 0a20 3c61 2068 7265 p;rvec3,. Mat&nb │ │ │ -00069a30: 7370 3b74 7665 6333 2c0a 203c 6120 6872 sp;tvec3,. Mat&n │ │ │ -00069a80: 6273 703b 6472 3364 7231 2c0a 203c 6120 bsp;dr3dr1,. Mat │ │ │ -00069ad0: 266e 6273 703b 6472 3364 7431 2c0a 203c  dr3dt1,. < │ │ │ -00069ae0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00069af0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00069b00: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00069b10: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dr3dr2)< │ │ │ -00069b30: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ -00069b50: 436f 6d62 696e 6573 2074 776f 2072 6f74 Combines two rot │ │ │ -00069b60: 6174 696f 6e2d 616e 642d 7368 6966 7420 ation-and-shift │ │ │ -00069b70: 7472 616e 7366 6f72 6d61 7469 6f6e 732e transformations. │ │ │ -00069b80: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -00069ba0: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -00069bb0: 6464 3e3c 636f 6465 3e72 7665 6331 3c2f dd>rvec1 - First ro │ │ │ -00069bd0: 7461 7469 6f6e 2076 6563 746f 722e 3c2f tation vector..
    tv │ │ │ -00069bf0: 6563 313c 2f63 6f64 653e 202d 2046 6972 ec1 - Fir │ │ │ -00069c00: 7374 2074 7261 6e73 6c61 7469 6f6e 2076 st translation v │ │ │ -00069c10: 6563 746f 722e 3c2f 6464 3e0a 3c64 643e ector.
    .
    │ │ │ -00069c20: 3c63 6f64 653e 7276 6563 323c 2f63 6f64 rvec2 - Second rota │ │ │ -00069c40: 7469 6f6e 2076 6563 746f 722e 3c2f 6464 tion vector.
    .
    tvec │ │ │ -00069c60: 323c 2f63 6f64 653e 202d 2053 6563 6f6e 2 - Secon │ │ │ -00069c70: 6420 7472 616e 736c 6174 696f 6e20 7665 d translation ve │ │ │ -00069c80: 6374 6f72 2e3c 2f64 643e 0a3c 6464 3e3c ctor.
    .
    < │ │ │ -00069c90: 636f 6465 3e72 7665 6333 3c2f 636f 6465 code>rvec3 - Output rotat │ │ │ -00069cb0: 696f 6e20 7665 6374 6f72 206f 6620 7468 ion vector of th │ │ │ -00069cc0: 6520 7375 7065 7270 6f73 6974 696f 6e2e e superposition. │ │ │ -00069cd0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -00069ce0: 7476 6563 333c 2f63 6f64 653e 202d 204f tvec3 - O │ │ │ -00069cf0: 7574 7075 7420 7472 616e 736c 6174 696f utput translatio │ │ │ -00069d00: 6e20 7665 6374 6f72 206f 6620 7468 6520 n vector of the │ │ │ -00069d10: 7375 7065 7270 6f73 6974 696f 6e2e 3c2f superposition..
    dr │ │ │ -00069d30: 3364 7231 3c2f 636f 6465 3e20 2d20 4f70 3dr1 - Op │ │ │ -00069d40: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ -00069d50: 7269 7661 7469 7665 206f 6620 7276 6563 rivative of rvec │ │ │ -00069d60: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ -00069d70: 2072 7665 6331 3c2f 6464 3e0a 3c64 643e rvec1
    .
    │ │ │ -00069d80: 3c63 6f64 653e 6472 3364 7431 3c2f 636f dr3dt1 - Optional o │ │ │ -00069da0: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ -00069db0: 206f 6620 7276 6563 3320 7769 7468 2072 of rvec3 with r │ │ │ -00069dc0: 6567 6172 6420 746f 2074 7665 6331 3c2f egard to tvec1.
    dr │ │ │ -00069de0: 3364 7232 3c2f 636f 6465 3e20 2d20 4f70 3dr2 - Op │ │ │ -00069df0: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ -00069e00: 7269 7661 7469 7665 206f 6620 7276 6563 rivative of rvec │ │ │ -00069e10: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ -00069e20: 2072 7665 6332 0a0a 5468 6520 6675 6e63 rvec2..The func │ │ │ -00069e30: 7469 6f6e 7320 636f 6d70 7574 653a 0a0a tions compute:.. │ │ │ -00069e40: 5c28 5c62 6567 696e 7b61 7272 6179 7d7b \(\begin{array}{ │ │ │ -00069e50: 6c7d 205c 7465 7874 7474 7b72 7665 6333 l} \texttt{rvec3 │ │ │ -00069e60: 7d20 3d20 205c 6d61 7468 726d 7b72 6f64 } = \mathrm{rod │ │ │ -00069e70: 7269 6775 6573 7d20 5e7b 2d31 7d20 5c6c rigues} ^{-1} \l │ │ │ -00069e80: 6566 7420 2820 5c6d 6174 6872 6d7b 726f eft ( \mathrm{ro │ │ │ -00069e90: 6472 6967 7565 737d 2028 205c 7465 7874 drigues} ( \text │ │ │ -00069ea0: 7474 7b72 7665 6332 7d20 2920 205c 6364 tt{rvec2} ) \cd │ │ │ -00069eb0: 6f74 205c 6d61 7468 726d 7b72 6f64 7269 ot \mathrm{rodri │ │ │ -00069ec0: 6775 6573 7d20 2820 5c74 6578 7474 747b gues} ( \texttt{ │ │ │ -00069ed0: 7276 6563 317d 2029 205c 7269 6768 7420 rvec1} ) \right │ │ │ -00069ee0: 2920 205c 5c20 5c74 6578 7474 747b 7476 ) \\ \texttt{tv │ │ │ -00069ef0: 6563 337d 203d 2020 5c6d 6174 6872 6d7b ec3} = \mathrm{ │ │ │ -00069f00: 726f 6472 6967 7565 737d 2028 205c 7465 rodrigues} ( \te │ │ │ -00069f10: 7874 7474 7b72 7665 6332 7d20 2920 205c xttt{rvec2} ) \ │ │ │ -00069f20: 6364 6f74 205c 7465 7874 7474 7b74 7665 cdot \texttt{tve │ │ │ -00069f30: 6331 7d20 2b20 205c 7465 7874 7474 7b74 c1} + \texttt{t │ │ │ -00069f40: 7665 6332 7d20 5c65 6e64 7b61 7272 6179 vec2} \end{array │ │ │ -00069f50: 7d20 2c5c 290a 0a77 6865 7265 205c 285c } ,\)..where \(\ │ │ │ -00069f60: 6d61 7468 726d 7b72 6f64 7269 6775 6573 mathrm{rodrigues │ │ │ -00069f70: 7d5c 2920 6465 6e6f 7465 7320 6120 726f }\) denotes a ro │ │ │ -00069f80: 7461 7469 6f6e 2076 6563 746f 7220 746f tation vector to │ │ │ -00069f90: 2061 2072 6f74 6174 696f 6e20 6d61 7472 a rotation matr │ │ │ -00069fa0: 6978 2074 7261 6e73 666f 726d 6174 696f ix transformatio │ │ │ -00069fb0: 6e2c 2061 6e64 0a5c 285c 6d61 7468 726d n, and.\(\mathrm │ │ │ -00069fc0: 7b72 6f64 7269 6775 6573 7d5e 7b2d 317d {rodrigues}^{-1} │ │ │ -00069fd0: 5c29 2064 656e 6f74 6573 2074 6865 2069 \) denotes the i │ │ │ -00069fe0: 6e76 6572 7365 2074 7261 6e73 666f 726d nverse transform │ │ │ -00069ff0: 6174 696f 6e2e 2053 6565 2023 526f 6472 ation. See #Rodr │ │ │ -0006a000: 6967 7565 7320 666f 7220 6465 7461 696c igues for detail │ │ │ -0006a010: 732e 0a0a 416c 736f 2c20 7468 6520 6675 s...Also, the fu │ │ │ -0006a020: 6e63 7469 6f6e 7320 6361 6e20 636f 6d70 nctions can comp │ │ │ -0006a030: 7574 6520 7468 6520 6465 7269 7661 7469 ute the derivati │ │ │ -0006a040: 7665 7320 6f66 2074 6865 206f 7574 7075 ves of the outpu │ │ │ -0006a050: 7420 7665 6374 6f72 7320 7769 7468 2072 t vectors with r │ │ │ -0006a060: 6567 6172 6473 2074 6f20 7468 6520 696e egards to the in │ │ │ -0006a070: 7075 740a 7665 6374 6f72 7320 2873 6565 put.vectors (see │ │ │ -0006a080: 2023 6d61 744d 756c 4465 7269 7620 292e #matMulDeriv ). │ │ │ -0006a090: 2054 6865 2066 756e 6374 696f 6e73 2061 The functions a │ │ │ -0006a0a0: 7265 2075 7365 6420 696e 7369 6465 2023 re used inside # │ │ │ -0006a0b0: 7374 6572 656f 4361 6c69 6272 6174 6520 stereoCalibrate │ │ │ -0006a0c0: 6275 7420 6361 6e20 616c 736f 2062 6520 but can also be │ │ │ -0006a0d0: 7573 6564 2069 6e0a 796f 7572 206f 776e used in.your own │ │ │ -0006a0e0: 2063 6f64 6520 7768 6572 6520 4c65 7665 code where Leve │ │ │ -0006a0f0: 6e62 6572 672d 4d61 7271 7561 7264 7420 nberg-Marquardt │ │ │ -0006a100: 6f72 2061 6e6f 7468 6572 2067 7261 6469 or another gradi │ │ │ -0006a110: 656e 742d 6261 7365 6420 736f 6c76 6572 ent-based solver │ │ │ -0006a120: 2069 7320 7573 6564 2074 6f20 6f70 7469 is used to opti │ │ │ -0006a130: 6d69 7a65 2061 0a66 756e 6374 696f 6e20 mize a.function │ │ │ -0006a140: 7468 6174 2063 6f6e 7461 696e 7320 6120 that contains a │ │ │ -0006a150: 6d61 7472 6978 206d 756c 7469 706c 6963 matrix multiplic │ │ │ -0006a160: 6174 696f 6e2e 3c2f 6464 3e0a 3c2f 646c ation.
    .
    .
  • ...
  • .< │ │ │ -0006a190: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ -0006a1a0: 6574 6169 6c22 2069 643d 2263 6f6d 706f etail" id="compo │ │ │ -0006a1b0: 7365 5254 286f 7267 2e6f 7065 6e63 762e seRT(org.opencv. │ │ │ -0006a1c0: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ -0006a1d0: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ -0006a1e0: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ -0006a1f0: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ -0006a200: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ -0006a210: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ -0006a220: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ -0006a230: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ -0006a240: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ -0006a250: 2e4d 6174 2922 3e0a 3c68 333e 636f 6d70 .Mat)">.

    comp │ │ │ -0006a260: 6f73 6552 543c 2f68 333e 0a3c 6469 7620 oseRT

    .
    .
    public static void │ │ │ -0006a300: 266e 6273 703b 3c73 7061 6e20 636c 6173  composeRT( │ │ │ -0006a350: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0006a390: 2f61 3e26 6e62 7370 3b72 7665 6331 2c0a /a> rvec1,. │ │ │ -0006a3a0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0006a3e0: 3c2f 613e 266e 6273 703b 7476 6563 312c  tvec1, │ │ │ -0006a3f0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -0006a430: 743c 2f61 3e26 6e62 7370 3b72 7665 6332 t rvec2 │ │ │ -0006a440: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -0006a480: 6174 3c2f 613e 266e 6273 703b 7476 6563 at tvec │ │ │ -0006a490: 322c 0a20 3c61 2068 7265 663d 222e 2e2f 2,. │ │ │ -0006a4d0: 4d61 743c 2f61 3e26 6e62 7370 3b72 7665 Mat rve │ │ │ -0006a4e0: 6333 2c0a 203c 6120 6872 6566 3d22 2e2e c3,. Mat tv │ │ │ -0006a530: 6563 332c 0a20 3c61 2068 7265 663d 222e ec3,. Mat d │ │ │ -0006a580: 7233 6472 312c 0a20 3c61 2068 7265 663d r3dr1,. Mat  │ │ │ -0006a5d0: 3b64 7233 6474 3129 3c2f 7370 616e 3e3c ;dr3dt1)< │ │ │ -0006a5e0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Combine │ │ │ -0006a600: 7320 7477 6f20 726f 7461 7469 6f6e 2d61 s two rotation-a │ │ │ -0006a610: 6e64 2d73 6869 6674 2074 7261 6e73 666f nd-shift transfo │ │ │ -0006a620: 726d 6174 696f 6e73 2e3c 2f64 6976 3e0a rmations.
    . │ │ │ -0006a630: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ -0006a650: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    rvec1 - │ │ │ -0006a670: 2046 6972 7374 2072 6f74 6174 696f 6e20 First rotation │ │ │ -0006a680: 7665 6374 6f72 2e3c 2f64 643e 0a3c 6464 vector.
    .
    tvec1 - First tran │ │ │ -0006a6b0: 736c 6174 696f 6e20 7665 6374 6f72 2e3c slation vector.< │ │ │ -0006a6c0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e72 /dd>.
    r │ │ │ -0006a6d0: 7665 6332 3c2f 636f 6465 3e20 2d20 5365 vec2 - Se │ │ │ -0006a6e0: 636f 6e64 2072 6f74 6174 696f 6e20 7665 cond rotation ve │ │ │ -0006a6f0: 6374 6f72 2e3c 2f64 643e 0a3c 6464 3e3c ctor.
    .
    < │ │ │ -0006a700: 636f 6465 3e74 7665 6332 3c2f 636f 6465 code>tvec2 - Second trans │ │ │ -0006a720: 6c61 7469 6f6e 2076 6563 746f 722e 3c2f lation vector..
    rv │ │ │ -0006a740: 6563 333c 2f63 6f64 653e 202d 204f 7574 ec3 - Out │ │ │ -0006a750: 7075 7420 726f 7461 7469 6f6e 2076 6563 put rotation vec │ │ │ -0006a760: 746f 7220 6f66 2074 6865 2073 7570 6572 tor of the super │ │ │ -0006a770: 706f 7369 7469 6f6e 2e3c 2f64 643e 0a3c position.
    .< │ │ │ -0006a780: 6464 3e3c 636f 6465 3e74 7665 6333 3c2f dd>tvec3 - Output t │ │ │ -0006a7a0: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ -0006a7b0: 7220 6f66 2074 6865 2073 7570 6572 706f r of the superpo │ │ │ -0006a7c0: 7369 7469 6f6e 2e3c 2f64 643e 0a3c 6464 sition..
    dr3dr1 - Optional │ │ │ -0006a7f0: 6f75 7470 7574 2064 6572 6976 6174 6976 output derivativ │ │ │ -0006a800: 6520 6f66 2072 7665 6333 2077 6974 6820 e of rvec3 with │ │ │ -0006a810: 7265 6761 7264 2074 6f20 7276 6563 313c regard to rvec1< │ │ │ -0006a820: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -0006a830: 7233 6474 313c 2f63 6f64 653e 202d 204f r3dt1 - O │ │ │ -0006a840: 7074 696f 6e61 6c20 6f75 7470 7574 2064 ptional output d │ │ │ -0006a850: 6572 6976 6174 6976 6520 6f66 2072 7665 erivative of rve │ │ │ -0006a860: 6333 2077 6974 6820 7265 6761 7264 2074 c3 with regard t │ │ │ -0006a870: 6f20 7476 6563 310a 0a54 6865 2066 756e o tvec1..The fun │ │ │ -0006a880: 6374 696f 6e73 2063 6f6d 7075 7465 3a0a ctions compute:. │ │ │ -0006a890: 0a5c 285c 6265 6769 6e7b 6172 7261 797d .\(\begin{array} │ │ │ -0006a8a0: 7b6c 7d20 5c74 6578 7474 747b 7276 6563 {l} \texttt{rvec │ │ │ -0006a8b0: 337d 203d 2020 5c6d 6174 6872 6d7b 726f 3} = \mathrm{ro │ │ │ -0006a8c0: 6472 6967 7565 737d 205e 7b2d 317d 205c drigues} ^{-1} \ │ │ │ -0006a8d0: 6c65 6674 2028 205c 6d61 7468 726d 7b72 left ( \mathrm{r │ │ │ -0006a8e0: 6f64 7269 6775 6573 7d20 2820 5c74 6578 odrigues} ( \tex │ │ │ -0006a8f0: 7474 747b 7276 6563 327d 2029 2020 5c63 ttt{rvec2} ) \c │ │ │ -0006a900: 646f 7420 5c6d 6174 6872 6d7b 726f 6472 dot \mathrm{rodr │ │ │ -0006a910: 6967 7565 737d 2028 205c 7465 7874 7474 igues} ( \texttt │ │ │ -0006a920: 7b72 7665 6331 7d20 2920 5c72 6967 6874 {rvec1} ) \right │ │ │ -0006a930: 2029 2020 5c5c 205c 7465 7874 7474 7b74 ) \\ \texttt{t │ │ │ -0006a940: 7665 6333 7d20 3d20 205c 6d61 7468 726d vec3} = \mathrm │ │ │ -0006a950: 7b72 6f64 7269 6775 6573 7d20 2820 5c74 {rodrigues} ( \t │ │ │ -0006a960: 6578 7474 747b 7276 6563 327d 2029 2020 exttt{rvec2} ) │ │ │ -0006a970: 5c63 646f 7420 5c74 6578 7474 747b 7476 \cdot \texttt{tv │ │ │ -0006a980: 6563 317d 202b 2020 5c74 6578 7474 747b ec1} + \texttt{ │ │ │ -0006a990: 7476 6563 327d 205c 656e 647b 6172 7261 tvec2} \end{arra │ │ │ -0006a9a0: 797d 202c 5c29 0a0a 7768 6572 6520 5c28 y} ,\)..where \( │ │ │ -0006a9b0: 5c6d 6174 6872 6d7b 726f 6472 6967 7565 \mathrm{rodrigue │ │ │ -0006a9c0: 737d 5c29 2064 656e 6f74 6573 2061 2072 s}\) denotes a r │ │ │ -0006a9d0: 6f74 6174 696f 6e20 7665 6374 6f72 2074 otation vector t │ │ │ -0006a9e0: 6f20 6120 726f 7461 7469 6f6e 206d 6174 o a rotation mat │ │ │ -0006a9f0: 7269 7820 7472 616e 7366 6f72 6d61 7469 rix transformati │ │ │ -0006aa00: 6f6e 2c20 616e 640a 5c28 5c6d 6174 6872 on, and.\(\mathr │ │ │ -0006aa10: 6d7b 726f 6472 6967 7565 737d 5e7b 2d31 m{rodrigues}^{-1 │ │ │ -0006aa20: 7d5c 2920 6465 6e6f 7465 7320 7468 6520 }\) denotes the │ │ │ -0006aa30: 696e 7665 7273 6520 7472 616e 7366 6f72 inverse transfor │ │ │ -0006aa40: 6d61 7469 6f6e 2e20 5365 6520 2352 6f64 mation. See #Rod │ │ │ -0006aa50: 7269 6775 6573 2066 6f72 2064 6574 6169 rigues for detai │ │ │ -0006aa60: 6c73 2e0a 0a41 6c73 6f2c 2074 6865 2066 ls...Also, the f │ │ │ -0006aa70: 756e 6374 696f 6e73 2063 616e 2063 6f6d unctions can com │ │ │ -0006aa80: 7075 7465 2074 6865 2064 6572 6976 6174 pute the derivat │ │ │ -0006aa90: 6976 6573 206f 6620 7468 6520 6f75 7470 ives of the outp │ │ │ -0006aaa0: 7574 2076 6563 746f 7273 2077 6974 6820 ut vectors with │ │ │ -0006aab0: 7265 6761 7264 7320 746f 2074 6865 2069 regards to the i │ │ │ -0006aac0: 6e70 7574 0a76 6563 746f 7273 2028 7365 nput.vectors (se │ │ │ -0006aad0: 6520 236d 6174 4d75 6c44 6572 6976 2029 e #matMulDeriv ) │ │ │ -0006aae0: 2e20 5468 6520 6675 6e63 7469 6f6e 7320 . The functions │ │ │ -0006aaf0: 6172 6520 7573 6564 2069 6e73 6964 6520 are used inside │ │ │ -0006ab00: 2373 7465 7265 6f43 616c 6962 7261 7465 #stereoCalibrate │ │ │ -0006ab10: 2062 7574 2063 616e 2061 6c73 6f20 6265 but can also be │ │ │ -0006ab20: 2075 7365 6420 696e 0a79 6f75 7220 6f77 used in.your ow │ │ │ -0006ab30: 6e20 636f 6465 2077 6865 7265 204c 6576 n code where Lev │ │ │ -0006ab40: 656e 6265 7267 2d4d 6172 7175 6172 6474 enberg-Marquardt │ │ │ -0006ab50: 206f 7220 616e 6f74 6865 7220 6772 6164 or another grad │ │ │ -0006ab60: 6965 6e74 2d62 6173 6564 2073 6f6c 7665 ient-based solve │ │ │ -0006ab70: 7220 6973 2075 7365 6420 746f 206f 7074 r is used to opt │ │ │ -0006ab80: 696d 697a 6520 610a 6675 6e63 7469 6f6e imize a.function │ │ │ -0006ab90: 2074 6861 7420 636f 6e74 6169 6e73 2061 that contains a │ │ │ -0006aba0: 206d 6174 7269 7820 6d75 6c74 6970 6c69 matrix multipli │ │ │ -0006abb0: 6361 7469 6f6e 2e3c 2f64 643e 0a3c 2f64 cation.
    ..
    ..
  • .
  • . │ │ │ -0006abe0: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    compose │ │ │ -0006aca0: 5254 3c2f 6833 3e0a 3c64 6976 2063 6c61 RT

    .
    .
    pu │ │ │ -0006ad00: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static void&nb │ │ │ -0006ad40: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;co │ │ │ -0006ad60: 6d70 6f73 6552 543c 2f73 7061 6e3e 3c77 mposeRT(Mat │ │ │ -0006add0: 266e 6273 703b 7276 6563 312c 0a20 3c61  rvec1,. Mat tvec1,. < │ │ │ -0006ae30: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0006ae40: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0006ae50: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0006ae60: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat rvec2,. │ │ │ -0006ae80: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0006aec0: 2f61 3e26 6e62 7370 3b74 7665 6332 2c0a /a> tvec2,. │ │ │ -0006aed0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0006af10: 3c2f 613e 266e 6273 703b 7276 6563 332c  rvec3, │ │ │ -0006af20: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -0006af60: 743c 2f61 3e26 6e62 7370 3b74 7665 6333 t tvec3 │ │ │ -0006af70: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -0006afb0: 6174 3c2f 613e 266e 6273 703b 6472 3364 at dr3d │ │ │ -0006afc0: 7231 293c 2f73 7061 6e3e 3c2f 6469 763e r1)
    │ │ │ -0006afd0: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Combines two │ │ │ -0006aff0: 2072 6f74 6174 696f 6e2d 616e 642d 7368 rotation-and-sh │ │ │ -0006b000: 6966 7420 7472 616e 7366 6f72 6d61 7469 ift transformati │ │ │ -0006b010: 6f6e 732e 3c2f 6469 763e 0a3c 646c 2063 ons.
    .
    .Parameters:.
    rve │ │ │ -0006b050: 6331 3c2f 636f 6465 3e20 2d20 4669 7273 c1 - Firs │ │ │ -0006b060: 7420 726f 7461 7469 6f6e 2076 6563 746f t rotation vecto │ │ │ -0006b070: 722e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 r.
    .
    tvec1 - │ │ │ -0006b090: 2046 6972 7374 2074 7261 6e73 6c61 7469 First translati │ │ │ -0006b0a0: 6f6e 2076 6563 746f 722e 3c2f 6464 3e0a on vector.
    . │ │ │ -0006b0b0: 3c64 643e 3c63 6f64 653e 7276 6563 323c
    rvec2< │ │ │ -0006b0c0: 2f63 6f64 653e 202d 2053 6563 6f6e 6420 /code> - Second │ │ │ -0006b0d0: 726f 7461 7469 6f6e 2076 6563 746f 722e rotation vector. │ │ │ -0006b0e0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -0006b0f0: 7476 6563 323c 2f63 6f64 653e 202d 2053 tvec2 - S │ │ │ -0006b100: 6563 6f6e 6420 7472 616e 736c 6174 696f econd translatio │ │ │ -0006b110: 6e20 7665 6374 6f72 2e3c 2f64 643e 0a3c n vector.
    .< │ │ │ -0006b120: 6464 3e3c 636f 6465 3e72 7665 6333 3c2f dd>rvec3 - Output r │ │ │ -0006b140: 6f74 6174 696f 6e20 7665 6374 6f72 206f otation vector o │ │ │ -0006b150: 6620 7468 6520 7375 7065 7270 6f73 6974 f the superposit │ │ │ -0006b160: 696f 6e2e 3c2f 6464 3e0a 3c64 643e 3c63 ion..
    tvec3 │ │ │ -0006b180: 202d 204f 7574 7075 7420 7472 616e 736c - Output transl │ │ │ -0006b190: 6174 696f 6e20 7665 6374 6f72 206f 6620 ation vector of │ │ │ -0006b1a0: 7468 6520 7375 7065 7270 6f73 6974 696f the superpositio │ │ │ -0006b1b0: 6e2e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 n.
    .
    dr3dr1 │ │ │ -0006b1d0: 2d20 4f70 7469 6f6e 616c 206f 7574 7075 - Optional outpu │ │ │ -0006b1e0: 7420 6465 7269 7661 7469 7665 206f 6620 t derivative of │ │ │ -0006b1f0: 7276 6563 3320 7769 7468 2072 6567 6172 rvec3 with regar │ │ │ -0006b200: 6420 746f 2072 7665 6331 0a0a 5468 6520 d to rvec1..The │ │ │ -0006b210: 6675 6e63 7469 6f6e 7320 636f 6d70 7574 functions comput │ │ │ -0006b220: 653a 0a0a 5c28 5c62 6567 696e 7b61 7272 e:..\(\begin{arr │ │ │ -0006b230: 6179 7d7b 6c7d 205c 7465 7874 7474 7b72 ay}{l} \texttt{r │ │ │ -0006b240: 7665 6333 7d20 3d20 205c 6d61 7468 726d vec3} = \mathrm │ │ │ -0006b250: 7b72 6f64 7269 6775 6573 7d20 5e7b 2d31 {rodrigues} ^{-1 │ │ │ -0006b260: 7d20 5c6c 6566 7420 2820 5c6d 6174 6872 } \left ( \mathr │ │ │ -0006b270: 6d7b 726f 6472 6967 7565 737d 2028 205c m{rodrigues} ( \ │ │ │ -0006b280: 7465 7874 7474 7b72 7665 6332 7d20 2920 texttt{rvec2} ) │ │ │ -0006b290: 205c 6364 6f74 205c 6d61 7468 726d 7b72 \cdot \mathrm{r │ │ │ -0006b2a0: 6f64 7269 6775 6573 7d20 2820 5c74 6578 odrigues} ( \tex │ │ │ -0006b2b0: 7474 747b 7276 6563 317d 2029 205c 7269 ttt{rvec1} ) \ri │ │ │ -0006b2c0: 6768 7420 2920 205c 5c20 5c74 6578 7474 ght ) \\ \textt │ │ │ -0006b2d0: 747b 7476 6563 337d 203d 2020 5c6d 6174 t{tvec3} = \mat │ │ │ -0006b2e0: 6872 6d7b 726f 6472 6967 7565 737d 2028 hrm{rodrigues} ( │ │ │ -0006b2f0: 205c 7465 7874 7474 7b72 7665 6332 7d20 \texttt{rvec2} │ │ │ -0006b300: 2920 205c 6364 6f74 205c 7465 7874 7474 ) \cdot \texttt │ │ │ -0006b310: 7b74 7665 6331 7d20 2b20 205c 7465 7874 {tvec1} + \text │ │ │ -0006b320: 7474 7b74 7665 6332 7d20 5c65 6e64 7b61 tt{tvec2} \end{a │ │ │ -0006b330: 7272 6179 7d20 2c5c 290a 0a77 6865 7265 rray} ,\)..where │ │ │ -0006b340: 205c 285c 6d61 7468 726d 7b72 6f64 7269 \(\mathrm{rodri │ │ │ -0006b350: 6775 6573 7d5c 2920 6465 6e6f 7465 7320 gues}\) denotes │ │ │ -0006b360: 6120 726f 7461 7469 6f6e 2076 6563 746f a rotation vecto │ │ │ -0006b370: 7220 746f 2061 2072 6f74 6174 696f 6e20 r to a rotation │ │ │ -0006b380: 6d61 7472 6978 2074 7261 6e73 666f 726d matrix transform │ │ │ -0006b390: 6174 696f 6e2c 2061 6e64 0a5c 285c 6d61 ation, and.\(\ma │ │ │ -0006b3a0: 7468 726d 7b72 6f64 7269 6775 6573 7d5e thrm{rodrigues}^ │ │ │ -0006b3b0: 7b2d 317d 5c29 2064 656e 6f74 6573 2074 {-1}\) denotes t │ │ │ -0006b3c0: 6865 2069 6e76 6572 7365 2074 7261 6e73 he inverse trans │ │ │ -0006b3d0: 666f 726d 6174 696f 6e2e 2053 6565 2023 formation. See # │ │ │ -0006b3e0: 526f 6472 6967 7565 7320 666f 7220 6465 Rodrigues for de │ │ │ -0006b3f0: 7461 696c 732e 0a0a 416c 736f 2c20 7468 tails...Also, th │ │ │ -0006b400: 6520 6675 6e63 7469 6f6e 7320 6361 6e20 e functions can │ │ │ -0006b410: 636f 6d70 7574 6520 7468 6520 6465 7269 compute the deri │ │ │ -0006b420: 7661 7469 7665 7320 6f66 2074 6865 206f vatives of the o │ │ │ -0006b430: 7574 7075 7420 7665 6374 6f72 7320 7769 utput vectors wi │ │ │ -0006b440: 7468 2072 6567 6172 6473 2074 6f20 7468 th regards to th │ │ │ -0006b450: 6520 696e 7075 740a 7665 6374 6f72 7320 e input.vectors │ │ │ -0006b460: 2873 6565 2023 6d61 744d 756c 4465 7269 (see #matMulDeri │ │ │ -0006b470: 7620 292e 2054 6865 2066 756e 6374 696f v ). The functio │ │ │ -0006b480: 6e73 2061 7265 2075 7365 6420 696e 7369 ns are used insi │ │ │ -0006b490: 6465 2023 7374 6572 656f 4361 6c69 6272 de #stereoCalibr │ │ │ -0006b4a0: 6174 6520 6275 7420 6361 6e20 616c 736f ate but can also │ │ │ -0006b4b0: 2062 6520 7573 6564 2069 6e0a 796f 7572 be used in.your │ │ │ -0006b4c0: 206f 776e 2063 6f64 6520 7768 6572 6520 own code where │ │ │ -0006b4d0: 4c65 7665 6e62 6572 672d 4d61 7271 7561 Levenberg-Marqua │ │ │ -0006b4e0: 7264 7420 6f72 2061 6e6f 7468 6572 2067 rdt or another g │ │ │ -0006b4f0: 7261 6469 656e 742d 6261 7365 6420 736f radient-based so │ │ │ -0006b500: 6c76 6572 2069 7320 7573 6564 2074 6f20 lver is used to │ │ │ -0006b510: 6f70 7469 6d69 7a65 2061 0a66 756e 6374 optimize a.funct │ │ │ -0006b520: 696f 6e20 7468 6174 2063 6f6e 7461 696e ion that contain │ │ │ -0006b530: 7320 6120 6d61 7472 6978 206d 756c 7469 s a matrix multi │ │ │ -0006b540: 706c 6963 6174 696f 6e2e 3c2f 6464 3e0a plication.
    . │ │ │ -0006b550: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    .
    .
  • ..
    .

    composeR │ │ │ -0006b620: 543c 2f68 333e 0a3c 6469 7620 636c 6173 T

    .
    .
    pub │ │ │ -0006b680: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static void&nbs │ │ │ -0006b6c0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;com │ │ │ -0006b6e0: 706f 7365 5254 3c2f 7370 616e 3e3c 7762 poseRT(Mat& │ │ │ -0006b750: 6e62 7370 3b72 7665 6331 2c0a 203c 6120 nbsp;rvec1,. Mat │ │ │ -0006b7a0: 266e 6273 703b 7476 6563 312c 0a20 3c61  tvec1,. Mat rvec2,. < │ │ │ -0006b800: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0006b810: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0006b820: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0006b830: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat tvec2,. │ │ │ -0006b850: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0006b890: 2f61 3e26 6e62 7370 3b72 7665 6333 2c0a /a> rvec3,. │ │ │ -0006b8a0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0006b8e0: 3c2f 613e 266e 6273 703b 7476 6563 3329  tvec3) │ │ │ -0006b8f0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Combines two ro │ │ │ -0006b920: 7461 7469 6f6e 2d61 6e64 2d73 6869 6674 tation-and-shift │ │ │ -0006b930: 2074 7261 6e73 666f 726d 6174 696f 6e73 transformations │ │ │ -0006b940: 2e3c 2f64 6976 3e0a 3c64 6c20 636c 6173 .
    .
    .
    P │ │ │ -0006b960: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ -0006b970: 3c64 643e 3c63 6f64 653e 7276 6563 313c
    rvec1< │ │ │ -0006b980: 2f63 6f64 653e 202d 2046 6972 7374 2072 /code> - First r │ │ │ -0006b990: 6f74 6174 696f 6e20 7665 6374 6f72 2e3c otation vector.< │ │ │ -0006b9a0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ -0006b9b0: 7665 6331 3c2f 636f 6465 3e20 2d20 4669 vec1 - Fi │ │ │ -0006b9c0: 7273 7420 7472 616e 736c 6174 696f 6e20 rst translation │ │ │ -0006b9d0: 7665 6374 6f72 2e3c 2f64 643e 0a3c 6464 vector.
    .
    rvec2 - Second rot │ │ │ -0006ba00: 6174 696f 6e20 7665 6374 6f72 2e3c 2f64 ation vector..
    tve │ │ │ -0006ba20: 6332 3c2f 636f 6465 3e20 2d20 5365 636f c2 - Seco │ │ │ -0006ba30: 6e64 2074 7261 6e73 6c61 7469 6f6e 2076 nd translation v │ │ │ -0006ba40: 6563 746f 722e 3c2f 6464 3e0a 3c64 643e ector.
    .
    │ │ │ -0006ba50: 3c63 6f64 653e 7276 6563 333c 2f63 6f64 rvec3 - Output rota │ │ │ -0006ba70: 7469 6f6e 2076 6563 746f 7220 6f66 2074 tion vector of t │ │ │ -0006ba80: 6865 2073 7570 6572 706f 7369 7469 6f6e he superposition │ │ │ -0006ba90: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    tvec3 - │ │ │ -0006bab0: 4f75 7470 7574 2074 7261 6e73 6c61 7469 Output translati │ │ │ -0006bac0: 6f6e 2076 6563 746f 7220 6f66 2074 6865 on vector of the │ │ │ -0006bad0: 2073 7570 6572 706f 7369 7469 6f6e 2e0a superposition.. │ │ │ -0006bae0: 0a54 6865 2066 756e 6374 696f 6e73 2063 .The functions c │ │ │ -0006baf0: 6f6d 7075 7465 3a0a 0a5c 285c 6265 6769 ompute:..\(\begi │ │ │ -0006bb00: 6e7b 6172 7261 797d 7b6c 7d20 5c74 6578 n{array}{l} \tex │ │ │ -0006bb10: 7474 747b 7276 6563 337d 203d 2020 5c6d ttt{rvec3} = \m │ │ │ -0006bb20: 6174 6872 6d7b 726f 6472 6967 7565 737d athrm{rodrigues} │ │ │ -0006bb30: 205e 7b2d 317d 205c 6c65 6674 2028 205c ^{-1} \left ( \ │ │ │ -0006bb40: 6d61 7468 726d 7b72 6f64 7269 6775 6573 mathrm{rodrigues │ │ │ -0006bb50: 7d20 2820 5c74 6578 7474 747b 7276 6563 } ( \texttt{rvec │ │ │ -0006bb60: 327d 2029 2020 5c63 646f 7420 5c6d 6174 2} ) \cdot \mat │ │ │ -0006bb70: 6872 6d7b 726f 6472 6967 7565 737d 2028 hrm{rodrigues} ( │ │ │ -0006bb80: 205c 7465 7874 7474 7b72 7665 6331 7d20 \texttt{rvec1} │ │ │ -0006bb90: 2920 5c72 6967 6874 2029 2020 5c5c 205c ) \right ) \\ \ │ │ │ -0006bba0: 7465 7874 7474 7b74 7665 6333 7d20 3d20 texttt{tvec3} = │ │ │ -0006bbb0: 205c 6d61 7468 726d 7b72 6f64 7269 6775 \mathrm{rodrigu │ │ │ -0006bbc0: 6573 7d20 2820 5c74 6578 7474 747b 7276 es} ( \texttt{rv │ │ │ -0006bbd0: 6563 327d 2029 2020 5c63 646f 7420 5c74 ec2} ) \cdot \t │ │ │ -0006bbe0: 6578 7474 747b 7476 6563 317d 202b 2020 exttt{tvec1} + │ │ │ -0006bbf0: 5c74 6578 7474 747b 7476 6563 327d 205c \texttt{tvec2} \ │ │ │ -0006bc00: 656e 647b 6172 7261 797d 202c 5c29 0a0a end{array} ,\).. │ │ │ -0006bc10: 7768 6572 6520 5c28 5c6d 6174 6872 6d7b where \(\mathrm{ │ │ │ -0006bc20: 726f 6472 6967 7565 737d 5c29 2064 656e rodrigues}\) den │ │ │ -0006bc30: 6f74 6573 2061 2072 6f74 6174 696f 6e20 otes a rotation │ │ │ -0006bc40: 7665 6374 6f72 2074 6f20 6120 726f 7461 vector to a rota │ │ │ -0006bc50: 7469 6f6e 206d 6174 7269 7820 7472 616e tion matrix tran │ │ │ -0006bc60: 7366 6f72 6d61 7469 6f6e 2c20 616e 640a sformation, and. │ │ │ -0006bc70: 5c28 5c6d 6174 6872 6d7b 726f 6472 6967 \(\mathrm{rodrig │ │ │ -0006bc80: 7565 737d 5e7b 2d31 7d5c 2920 6465 6e6f ues}^{-1}\) deno │ │ │ -0006bc90: 7465 7320 7468 6520 696e 7665 7273 6520 tes the inverse │ │ │ -0006bca0: 7472 616e 7366 6f72 6d61 7469 6f6e 2e20 transformation. │ │ │ -0006bcb0: 5365 6520 2352 6f64 7269 6775 6573 2066 See #Rodrigues f │ │ │ -0006bcc0: 6f72 2064 6574 6169 6c73 2e0a 0a41 6c73 or details...Als │ │ │ -0006bcd0: 6f2c 2074 6865 2066 756e 6374 696f 6e73 o, the functions │ │ │ -0006bce0: 2063 616e 2063 6f6d 7075 7465 2074 6865 can compute the │ │ │ -0006bcf0: 2064 6572 6976 6174 6976 6573 206f 6620 derivatives of │ │ │ -0006bd00: 7468 6520 6f75 7470 7574 2076 6563 746f the output vecto │ │ │ -0006bd10: 7273 2077 6974 6820 7265 6761 7264 7320 rs with regards │ │ │ -0006bd20: 746f 2074 6865 2069 6e70 7574 0a76 6563 to the input.vec │ │ │ -0006bd30: 746f 7273 2028 7365 6520 236d 6174 4d75 tors (see #matMu │ │ │ -0006bd40: 6c44 6572 6976 2029 2e20 5468 6520 6675 lDeriv ). The fu │ │ │ -0006bd50: 6e63 7469 6f6e 7320 6172 6520 7573 6564 nctions are used │ │ │ -0006bd60: 2069 6e73 6964 6520 2373 7465 7265 6f43 inside #stereoC │ │ │ -0006bd70: 616c 6962 7261 7465 2062 7574 2063 616e alibrate but can │ │ │ -0006bd80: 2061 6c73 6f20 6265 2075 7365 6420 696e also be used in │ │ │ -0006bd90: 0a79 6f75 7220 6f77 6e20 636f 6465 2077 .your own code w │ │ │ -0006bda0: 6865 7265 204c 6576 656e 6265 7267 2d4d here Levenberg-M │ │ │ -0006bdb0: 6172 7175 6172 6474 206f 7220 616e 6f74 arquardt or anot │ │ │ -0006bdc0: 6865 7220 6772 6164 6965 6e74 2d62 6173 her gradient-bas │ │ │ -0006bdd0: 6564 2073 6f6c 7665 7220 6973 2075 7365 ed solver is use │ │ │ -0006bde0: 6420 746f 206f 7074 696d 697a 6520 610a d to optimize a. │ │ │ -0006bdf0: 6675 6e63 7469 6f6e 2074 6861 7420 636f function that co │ │ │ -0006be00: 6e74 6169 6e73 2061 206d 6174 7269 7820 ntains a matrix │ │ │ -0006be10: 6d75 6c74 6970 6c69 6361 7469 6f6e 2e3c multiplication.< │ │ │ -0006be20: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    ..
    .
    .
  • .
    .

    projectPoi │ │ │ -0006bf30: 6e74 733c 2f68 333e 0a3c 6469 7620 636c nts

    .
    .
    p │ │ │ -0006bf90: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static void&n │ │ │ -0006bfd0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;p │ │ │ -0006bff0: 726f 6a65 6374 506f 696e 7473 3c2f 7370 rojectPoints(MatOfPoin │ │ │ -0006c070: 7433 663c 2f61 3e26 6e62 7370 3b6f 626a t3f obj │ │ │ -0006c080: 6563 7450 6f69 6e74 732c 0a20 3c61 2068 ectPoints,. Mat& │ │ │ -0006c0d0: 6e62 7370 3b72 7665 632c 0a20 3c61 2068 nbsp;rvec,. Mat& │ │ │ -0006c120: 6e62 7370 3b74 7665 632c 0a20 3c61 2068 nbsp;tvec,. Mat& │ │ │ -0006c170: 6e62 7370 3b63 616d 6572 614d 6174 7269 nbsp;cameraMatri │ │ │ -0006c180: 782c 0a20 3c61 2068 7265 663d 222e 2e2f x,. MatOfDou │ │ │ -0006c1d0: 626c 653c 2f61 3e26 6e62 7370 3b64 6973 ble dis │ │ │ -0006c1e0: 7443 6f65 6666 732c 0a20 3c61 2068 7265 tCoeffs,. M │ │ │ -0006c230: 6174 4f66 506f 696e 7432 663c 2f61 3e26 atOfPoint2f& │ │ │ -0006c240: 6e62 7370 3b69 6d61 6765 506f 696e 7473 nbsp;imagePoints │ │ │ -0006c250: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -0006c290: 6174 3c2f 613e 266e 6273 703b 6a61 636f at jaco │ │ │ -0006c2a0: 6269 616e 2c0a 2064 6f75 626c 6526 6e62 bian,. double&nb │ │ │ -0006c2b0: 7370 3b61 7370 6563 7452 6174 696f 293c sp;aspectRatio)< │ │ │ -0006c2c0: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ -0006c2e0: 5072 6f6a 6563 7473 2033 4420 706f 696e Projects 3D poin │ │ │ -0006c2f0: 7473 2074 6f20 616e 2069 6d61 6765 2070 ts to an image p │ │ │ -0006c300: 6c61 6e65 2e0a 0a54 6865 2066 756e 6374 lane...The funct │ │ │ -0006c310: 696f 6e20 636f 6d70 7574 6573 2074 6865 ion computes the │ │ │ -0006c320: 2032 4420 7072 6f6a 6563 7469 6f6e 7320 2D projections │ │ │ -0006c330: 6f66 2033 4420 706f 696e 7473 2074 6f20 of 3D points to │ │ │ -0006c340: 7468 6520 696d 6167 6520 706c 616e 652c the image plane, │ │ │ -0006c350: 2067 6976 656e 2069 6e74 7269 6e73 6963 given intrinsic │ │ │ -0006c360: 2061 6e64 0a65 7874 7269 6e73 6963 2063 and.extrinsic c │ │ │ -0006c370: 616d 6572 6120 7061 7261 6d65 7465 7273 amera parameters │ │ │ -0006c380: 2e20 4f70 7469 6f6e 616c 6c79 2c20 7468 . Optionally, th │ │ │ -0006c390: 6520 6675 6e63 7469 6f6e 2063 6f6d 7075 e function compu │ │ │ -0006c3a0: 7465 7320 4a61 636f 6269 616e 7320 2d6d tes Jacobians -m │ │ │ -0006c3b0: 6174 7269 6365 7320 6f66 2070 6172 7469 atrices of parti │ │ │ -0006c3c0: 616c 0a64 6572 6976 6174 6976 6573 206f al.derivatives o │ │ │ -0006c3d0: 6620 696d 6167 6520 706f 696e 7473 2063 f image points c │ │ │ -0006c3e0: 6f6f 7264 696e 6174 6573 2028 6173 2066 oordinates (as f │ │ │ -0006c3f0: 756e 6374 696f 6e73 206f 6620 616c 6c20 unctions of all │ │ │ -0006c400: 7468 6520 696e 7075 7420 7061 7261 6d65 the input parame │ │ │ -0006c410: 7465 7273 2920 7769 7468 2072 6573 7065 ters) with respe │ │ │ -0006c420: 6374 2074 6f0a 7468 6520 7061 7274 6963 ct to.the partic │ │ │ -0006c430: 756c 6172 2070 6172 616d 6574 6572 732c ular parameters, │ │ │ -0006c440: 2069 6e74 7269 6e73 6963 2061 6e64 2f6f intrinsic and/o │ │ │ -0006c450: 7220 6578 7472 696e 7369 632e 2054 6865 r extrinsic. The │ │ │ -0006c460: 204a 6163 6f62 6961 6e73 2061 7265 2075 Jacobians are u │ │ │ -0006c470: 7365 6420 6475 7269 6e67 2074 6865 2067 sed during the g │ │ │ -0006c480: 6c6f 6261 6c0a 6f70 7469 6d69 7a61 7469 lobal.optimizati │ │ │ -0006c490: 6f6e 2069 6e20 5245 463a 2063 616c 6962 on in REF: calib │ │ │ -0006c4a0: 7261 7465 4361 6d65 7261 2c20 5245 463a rateCamera, REF: │ │ │ -0006c4b0: 2073 6f6c 7665 506e 502c 2061 6e64 2052 solvePnP, and R │ │ │ -0006c4c0: 4546 3a20 7374 6572 656f 4361 6c69 6272 EF: stereoCalibr │ │ │ -0006c4d0: 6174 652e 2054 6865 2066 756e 6374 696f ate. The functio │ │ │ -0006c4e0: 6e20 6974 7365 6c66 0a63 616e 2061 6c73 n itself.can als │ │ │ -0006c4f0: 6f20 6265 2075 7365 6420 746f 2063 6f6d o be used to com │ │ │ -0006c500: 7075 7465 2061 2072 652d 7072 6f6a 6563 pute a re-projec │ │ │ -0006c510: 7469 6f6e 2065 7272 6f72 2c20 6769 7665 tion error, give │ │ │ -0006c520: 6e20 7468 6520 6375 7272 656e 7420 696e n the current in │ │ │ -0006c530: 7472 696e 7369 6320 616e 6420 6578 7472 trinsic and extr │ │ │ -0006c540: 696e 7369 630a 7061 7261 6d65 7465 7273 insic.parameters │ │ │ -0006c550: 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 3e20 ...Note: │ │ │ -0006c560: 3c62 3e43 6f6f 7264 696e 6174 6520 5379 Coordinate Sy │ │ │ -0006c570: 7374 656d 733a 3c2f 623e 0a3c 756c 3e0a stems:.
      . │ │ │ -0006c580: 2020 3c6c 693e 0a20 3c62 3e49 6e70 7574
    • . Input │ │ │ -0006c590: 2028 3c63 6f64 653e 6f62 6a65 6374 506f (objectPo │ │ │ -0006c5a0: 696e 7473 3c2f 636f 6465 3e29 3c2f 623e ints) │ │ │ -0006c5b0: 3a20 3344 2070 6f69 6e74 7320 696e 2074 : 3D points in t │ │ │ -0006c5c0: 6865 203c 623e 776f 726c 6420 636f 6f72 he world coor │ │ │ -0006c5d0: 6469 6e61 7465 2066 7261 6d65 3c2f 623e dinate frame │ │ │ -0006c5e0: 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c 693e ..
    • .
    • │ │ │ -0006c5f0: 0a20 3c62 3e4f 7574 7075 7420 283c 636f . Output (imagePoints): 2D p │ │ │ -0006c620: 726f 6a65 6374 696f 6e73 2069 6e20 3c62 rojections in pixel coordinat │ │ │ -0006c640: 6573 3c2f 623e 206f 6620 7468 6520 696d es of the im │ │ │ -0006c650: 6167 6520 706c 616e 652c 2077 6974 6820 age plane, with │ │ │ -0006c660: 6469 7374 6f72 7469 6f6e 2061 7070 6c69 distortion appli │ │ │ -0006c670: 6564 2e0a 2020 5468 6520 636f 6f72 6469 ed.. The coordi │ │ │ -0006c680: 6e61 7465 7320 5c28 2875 2c20 7629 5c29 nates \((u, v)\) │ │ │ -0006c690: 2061 7265 206d 6561 7375 7265 6420 696e are measured in │ │ │ -0006c6a0: 2070 6978 656c 7320 6672 6f6d 2074 6865 pixels from the │ │ │ -0006c6b0: 2074 6f70 2d6c 6566 7420 636f 726e 6572 top-left corner │ │ │ -0006c6c0: 206f 6620 7468 6520 696d 6167 652e 0a20 of the image.. │ │ │ -0006c6d0: 203c 2f6c 693e 0a3c 2f75 6c3e 0a0a 5468
    • .
    ..Th │ │ │ -0006c6e0: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ -0006c6f0: 2063 6861 696e 2069 733a 2057 6f72 6c64 chain is: World │ │ │ -0006c700: 2063 6f6f 7264 696e 6174 6573 20e2 8692 coordinates ... │ │ │ -0006c710: 2043 616d 6572 6120 636f 6f72 6469 6e61 Camera coordina │ │ │ -0006c720: 7465 7320 2876 6961 2072 7665 632f 7476 tes (via rvec/tv │ │ │ -0006c730: 6563 2920 e286 9220 4e6f 726d 616c 697a ec) ... Normaliz │ │ │ -0006c740: 6564 2063 616d 6572 6120 636f 6f72 6469 ed camera coordi │ │ │ -0006c750: 6e61 7465 730a e286 9220 4469 7374 6f72 nates.... Distor │ │ │ -0006c760: 7469 6f6e 2061 7070 6c69 6564 20e2 8692 tion applied ... │ │ │ -0006c770: 2050 6978 656c 2063 6f6f 7264 696e 6174 Pixel coordinat │ │ │ -0006c780: 6573 2028 7669 6120 6361 6d65 7261 4d61 es (via cameraMa │ │ │ -0006c790: 7472 6978 292e 3c2f 6469 763e 0a3c 646c trix).
    .
    . │ │ │ -0006c7b0: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -0006c7c0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e6f /dt>.
    o │ │ │ -0006c7d0: 626a 6563 7450 6f69 6e74 733c 2f63 6f64 bjectPoints - Array of ob │ │ │ -0006c7f0: 6a65 6374 2070 6f69 6e74 7320 6578 7072 ject points expr │ │ │ -0006c800: 6573 7365 6420 7772 742e 2074 6865 2077 essed wrt. the w │ │ │ -0006c810: 6f72 6c64 2063 6f6f 7264 696e 6174 6520 orld coordinate │ │ │ -0006c820: 6672 616d 652e 2041 2033 784e 2f4e 7833 frame. A 3xN/Nx3 │ │ │ -0006c830: 0a31 2d63 6861 6e6e 656c 206f 7220 3178 .1-channel or 1x │ │ │ -0006c840: 4e2f 4e78 3120 332d 6368 616e 6e65 6c20 N/Nx1 3-channel │ │ │ -0006c850: 286f 7220 7665 6374 6f72 266c 743b 506f (or vector<Po │ │ │ -0006c860: 696e 7433 6626 6774 3b20 292c 2077 6865 int3f> ), whe │ │ │ -0006c870: 7265 204e 2069 7320 7468 6520 6e75 6d62 re N is the numb │ │ │ -0006c880: 6572 206f 6620 706f 696e 7473 2069 6e20 er of points in │ │ │ -0006c890: 7468 6520 7669 6577 2e3c 2f64 643e 0a3c the view.
    .< │ │ │ -0006c8a0: 6464 3e3c 636f 6465 3e72 7665 633c 2f63 dd>rvec - The rotat │ │ │ -0006c8c0: 696f 6e20 7665 6374 6f72 2028 5245 463a ion vector (REF: │ │ │ -0006c8d0: 2052 6f64 7269 6775 6573 2920 7468 6174 Rodrigues) that │ │ │ -0006c8e0: 2c20 746f 6765 7468 6572 2077 6974 6820 , together with │ │ │ -0006c8f0: 7476 6563 2c20 7065 7266 6f72 6d73 2061 tvec, performs a │ │ │ -0006c900: 2063 6861 6e67 6520 6f66 0a62 6173 6973 change of.basis │ │ │ -0006c910: 2066 726f 6d20 776f 726c 6420 746f 2063 from world to c │ │ │ -0006c920: 616d 6572 6120 636f 6f72 6469 6e61 7465 amera coordinate │ │ │ -0006c930: 2073 7973 7465 6d2c 2073 6565 2052 4546 system, see REF │ │ │ -0006c940: 3a20 6361 6c69 6272 6174 6543 616d 6572 : calibrateCamer │ │ │ -0006c950: 6120 666f 7220 6465 7461 696c 732e 3c2f a for details..
    tv │ │ │ -0006c970: 6563 3c2f 636f 6465 3e20 2d20 5468 6520 ec - The │ │ │ -0006c980: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ -0006c990: 6f72 2c20 7365 6520 7061 7261 6d65 7465 or, see paramete │ │ │ -0006c9a0: 7220 6465 7363 7269 7074 696f 6e20 6162 r description ab │ │ │ -0006c9b0: 6f76 652e 3c2f 6464 3e0a 3c64 643e 3c63 ove.
    .
    cameraMatrix │ │ │ -0006c9d0: 3c2f 636f 6465 3e20 2d20 4361 6d65 7261 - Camera │ │ │ -0006c9e0: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ -0006c9f0: 7820 5c28 5c63 616d 6572 616d 6174 7269 x \(\cameramatri │ │ │ -0006ca00: 787b 417d 5c29 202e 3c2f 6464 3e0a 3c64 x{A}\) .
    .distCoef │ │ │ -0006ca20: 6673 3c2f 636f 6465 3e20 2d20 496e 7075 fs - Inpu │ │ │ -0006ca30: 7420 7665 6374 6f72 206f 6620 6469 7374 t vector of dist │ │ │ -0006ca40: 6f72 7469 6f6e 2063 6f65 6666 6963 6965 ortion coefficie │ │ │ -0006ca50: 6e74 730a 5c28 5c64 6973 7463 6f65 6666 nts.\(\distcoeff │ │ │ -0006ca60: 735c 2920 2e20 4966 2074 6865 2076 6563 s\) . If the vec │ │ │ -0006ca70: 746f 7220 6973 2065 6d70 7479 2c20 7468 tor is empty, th │ │ │ -0006ca80: 6520 7a65 726f 2064 6973 746f 7274 696f e zero distortio │ │ │ -0006ca90: 6e20 636f 6566 6669 6369 656e 7473 2061 n coefficients a │ │ │ -0006caa0: 7265 2061 7373 756d 6564 2e3c 2f64 643e re assumed. │ │ │ -0006cab0: 0a3c 6464 3e3c 636f 6465 3e69 6d61 6765 .
    image │ │ │ -0006cac0: 506f 696e 7473 3c2f 636f 6465 3e20 2d20 Points - │ │ │ -0006cad0: 4f75 7470 7574 2061 7272 6179 206f 6620 Output array of │ │ │ -0006cae0: 696d 6167 6520 706f 696e 7473 2069 6e20 image points in │ │ │ -0006caf0: 3c62 3e70 6978 656c 2063 6f6f 7264 696e pixel coordin │ │ │ -0006cb00: 6174 6573 3c2f 623e 2c20 3178 4e2f 4e78 ates, 1xN/Nx │ │ │ -0006cb10: 3120 322d 6368 616e 6e65 6c2c 206f 720a 1 2-channel, or. │ │ │ -0006cb20: 7665 6374 6f72 266c 743b 506f 696e 7432 vector<Point2 │ │ │ -0006cb30: 6626 6774 3b20 2e3c 2f64 643e 0a3c 6464 f> .
    .
    jacobian< │ │ │ -0006cb50: 2f63 6f64 653e 202d 204f 7074 696f 6e61 /code> - Optiona │ │ │ -0006cb60: 6c20 6f75 7470 7574 2032 4e78 2831 302b l output 2Nx(10+ │ │ │ -0006cb70: 266c 743b 6e75 6d44 6973 7443 6f65 6666 <numDistCoeff │ │ │ -0006cb80: 7326 6774 3b29 206a 6163 6f62 6961 6e20 s>) jacobian │ │ │ -0006cb90: 6d61 7472 6978 206f 6620 6465 7269 7661 matrix of deriva │ │ │ -0006cba0: 7469 7665 7320 6f66 2069 6d61 6765 0a70 tives of image.p │ │ │ -0006cbb0: 6f69 6e74 7320 7769 7468 2072 6573 7065 oints with respe │ │ │ -0006cbc0: 6374 2074 6f20 636f 6d70 6f6e 656e 7473 ct to components │ │ │ -0006cbd0: 206f 6620 7468 6520 726f 7461 7469 6f6e of the rotation │ │ │ -0006cbe0: 2076 6563 746f 722c 2074 7261 6e73 6c61 vector, transla │ │ │ -0006cbf0: 7469 6f6e 2076 6563 746f 722c 2066 6f63 tion vector, foc │ │ │ -0006cc00: 616c 206c 656e 6774 6873 2c0a 636f 6f72 al lengths,.coor │ │ │ -0006cc10: 6469 6e61 7465 7320 6f66 2074 6865 2070 dinates of the p │ │ │ -0006cc20: 7269 6e63 6970 616c 2070 6f69 6e74 2061 rincipal point a │ │ │ -0006cc30: 6e64 2074 6865 2064 6973 746f 7274 696f nd the distortio │ │ │ -0006cc40: 6e20 636f 6566 6669 6369 656e 7473 2e20 n coefficients. │ │ │ -0006cc50: 496e 2074 6865 206f 6c64 2069 6e74 6572 In the old inter │ │ │ -0006cc60: 6661 6365 2064 6966 6665 7265 6e74 0a63 face different.c │ │ │ -0006cc70: 6f6d 706f 6e65 6e74 7320 6f66 2074 6865 omponents of the │ │ │ -0006cc80: 206a 6163 6f62 6961 6e20 6172 6520 7265 jacobian are re │ │ │ -0006cc90: 7475 726e 6564 2076 6961 2064 6966 6665 turned via diffe │ │ │ -0006cca0: 7265 6e74 206f 7574 7075 7420 7061 7261 rent output para │ │ │ -0006ccb0: 6d65 7465 7273 2e3c 2f64 643e 0a3c 6464 meters.
    .
    aspectRat │ │ │ -0006ccd0: 696f 3c2f 636f 6465 3e20 2d20 4f70 7469 io - Opti │ │ │ -0006cce0: 6f6e 616c 2022 6669 7865 6420 6173 7065 onal "fixed aspe │ │ │ -0006ccf0: 6374 2072 6174 696f 2220 7061 7261 6d65 ct ratio" parame │ │ │ -0006cd00: 7465 722e 2049 6620 7468 6520 7061 7261 ter. If the para │ │ │ -0006cd10: 6d65 7465 7220 6973 206e 6f74 2030 2c20 meter is not 0, │ │ │ -0006cd20: 7468 650a 6675 6e63 7469 6f6e 2061 7373 the.function ass │ │ │ -0006cd30: 756d 6573 2074 6861 7420 7468 6520 6173 umes that the as │ │ │ -0006cd40: 7065 6374 2072 6174 696f 2028 5c28 665f pect ratio (\(f_ │ │ │ -0006cd50: 7820 2f20 665f 795c 2929 2069 7320 6669 x / f_y\)) is fi │ │ │ -0006cd60: 7865 6420 616e 6420 636f 7272 6573 706f xed and correspo │ │ │ -0006cd70: 6e64 696e 676c 7920 6164 6a75 7374 7320 ndingly adjusts │ │ │ -0006cd80: 7468 650a 6a61 636f 6269 616e 206d 6174 the.jacobian mat │ │ │ -0006cd90: 7269 782e 0a0a 3c62 3e4e 6f74 653a 3c2f rix...Note: By setting rv │ │ │ -0006cdb0: 6563 203d 2074 7665 6320 3d20 5c28 5b30 ec = tvec = \([0 │ │ │ -0006cdc0: 2c20 302c 2030 5d5c 292c 206f 7220 6279 , 0, 0]\), or by │ │ │ -0006cdd0: 2073 6574 7469 6e67 2063 616d 6572 614d setting cameraM │ │ │ -0006cde0: 6174 7269 7820 746f 2061 2033 7833 2069 atrix to a 3x3 i │ │ │ -0006cdf0: 6465 6e74 6974 7920 6d61 7472 6978 2c0a dentity matrix,. │ │ │ -0006ce00: 6f72 2062 7920 7061 7373 696e 6720 7a65 or by passing ze │ │ │ -0006ce10: 726f 2064 6973 746f 7274 696f 6e20 636f ro distortion co │ │ │ -0006ce20: 6566 6669 6369 656e 7473 2c20 6f6e 6520 efficients, one │ │ │ -0006ce30: 6361 6e20 6765 7420 7661 7269 6f75 7320 can get various │ │ │ -0006ce40: 7573 6566 756c 2070 6172 7469 616c 2063 useful partial c │ │ │ -0006ce50: 6173 6573 206f 6620 7468 650a 6675 6e63 ases of the.func │ │ │ -0006ce60: 7469 6f6e 2e20 5468 6973 206d 6561 6e73 tion. This means │ │ │ -0006ce70: 2c20 6f6e 6520 6361 6e20 636f 6d70 7574 , one can comput │ │ │ -0006ce80: 6520 7468 6520 6469 7374 6f72 7465 6420 e the distorted │ │ │ -0006ce90: 636f 6f72 6469 6e61 7465 7320 666f 7220 coordinates for │ │ │ -0006cea0: 6120 7370 6172 7365 2073 6574 206f 6620 a sparse set of │ │ │ -0006ceb0: 706f 696e 7473 206f 7220 6170 706c 790a points or apply. │ │ │ -0006cec0: 6120 7065 7273 7065 6374 6976 6520 7472 a perspective tr │ │ │ -0006ced0: 616e 7366 6f72 6d61 7469 6f6e 2028 616e ansformation (an │ │ │ -0006cee0: 6420 616c 736f 2063 6f6d 7075 7465 2074 d also compute t │ │ │ -0006cef0: 6865 2064 6572 6976 6174 6976 6573 2920 he derivatives) │ │ │ -0006cf00: 696e 2074 6865 2069 6465 616c 207a 6572 in the ideal zer │ │ │ -0006cf10: 6f2d 6469 7374 6f72 7469 6f6e 2073 6574 o-distortion set │ │ │ -0006cf20: 7570 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c up.
    .
    .< │ │ │ -0006cf30: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ -0006cf40: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..< │ │ │ -0006d020: 6833 3e70 726f 6a65 6374 506f 696e 7473 h3>projectPoints │ │ │ -0006d030: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373 .
    .
    publ │ │ │ -0006d090: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -0006d0a0: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -0006d0c0: 766f 6964 3c2f 7370 616e 3e26 6e62 7370 void  │ │ │ -0006d0d0: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;proj │ │ │ -0006d0f0: 6563 7450 6f69 6e74 733c 2f73 7061 6e3e ectPoints │ │ │ -0006d100: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ -0006d120: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0006d130: 4d61 744f 6650 6f69 6e74 3366 2e68 746d MatOfPoint3f.htm │ │ │ -0006d140: 6c22 2074 6974 6c65 3d22 636c 6173 7320 l" title="class │ │ │ -0006d150: 696e 206f 7267 2e6f 7065 6e63 762e 636f in org.opencv.co │ │ │ -0006d160: 7265 223e 4d61 744f 6650 6f69 6e74 3366 re">MatOfPoint3f │ │ │ -0006d170: 3c2f 613e 266e 6273 703b 6f62 6a65 6374  object │ │ │ -0006d180: 506f 696e 7473 2c0a 203c 6120 6872 6566 Points,. Mat&nbs │ │ │ -0006d1d0: 703b 7276 6563 2c0a 203c 6120 6872 6566 p;rvec,. Mat&nbs │ │ │ -0006d220: 703b 7476 6563 2c0a 203c 6120 6872 6566 p;tvec,. Mat&nbs │ │ │ -0006d270: 703b 6361 6d65 7261 4d61 7472 6978 2c0a p;cameraMatrix,. │ │ │ -0006d280: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 MatOfDouble │ │ │ -0006d2d0: 3c2f 613e 266e 6273 703b 6469 7374 436f  distCo │ │ │ -0006d2e0: 6566 6673 2c0a 203c 6120 6872 6566 3d22 effs,. MatO │ │ │ -0006d330: 6650 6f69 6e74 3266 3c2f 613e 266e 6273 fPoint2f&nbs │ │ │ -0006d340: 703b 696d 6167 6550 6f69 6e74 732c 0a20 p;imagePoints,. │ │ │ -0006d350: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0006d390: 2f61 3e26 6e62 7370 3b6a 6163 6f62 6961 /a> jacobia │ │ │ -0006d3a0: 6e29 3c2f 7370 616e 3e3c 2f64 6976 3e0a n)
    . │ │ │ -0006d3b0: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Projects 3D p │ │ │ -0006d3d0: 6f69 6e74 7320 746f 2061 6e20 696d 6167 oints to an imag │ │ │ -0006d3e0: 6520 706c 616e 652e 0a0a 5468 6520 6675 e plane...The fu │ │ │ -0006d3f0: 6e63 7469 6f6e 2063 6f6d 7075 7465 7320 nction computes │ │ │ -0006d400: 7468 6520 3244 2070 726f 6a65 6374 696f the 2D projectio │ │ │ -0006d410: 6e73 206f 6620 3344 2070 6f69 6e74 7320 ns of 3D points │ │ │ -0006d420: 746f 2074 6865 2069 6d61 6765 2070 6c61 to the image pla │ │ │ -0006d430: 6e65 2c20 6769 7665 6e20 696e 7472 696e ne, given intrin │ │ │ -0006d440: 7369 6320 616e 640a 6578 7472 696e 7369 sic and.extrinsi │ │ │ -0006d450: 6320 6361 6d65 7261 2070 6172 616d 6574 c camera paramet │ │ │ -0006d460: 6572 732e 204f 7074 696f 6e61 6c6c 792c ers. Optionally, │ │ │ -0006d470: 2074 6865 2066 756e 6374 696f 6e20 636f the function co │ │ │ -0006d480: 6d70 7574 6573 204a 6163 6f62 6961 6e73 mputes Jacobians │ │ │ -0006d490: 202d 6d61 7472 6963 6573 206f 6620 7061 -matrices of pa │ │ │ -0006d4a0: 7274 6961 6c0a 6465 7269 7661 7469 7665 rtial.derivative │ │ │ -0006d4b0: 7320 6f66 2069 6d61 6765 2070 6f69 6e74 s of image point │ │ │ -0006d4c0: 7320 636f 6f72 6469 6e61 7465 7320 2861 s coordinates (a │ │ │ -0006d4d0: 7320 6675 6e63 7469 6f6e 7320 6f66 2061 s functions of a │ │ │ -0006d4e0: 6c6c 2074 6865 2069 6e70 7574 2070 6172 ll the input par │ │ │ -0006d4f0: 616d 6574 6572 7329 2077 6974 6820 7265 ameters) with re │ │ │ -0006d500: 7370 6563 7420 746f 0a74 6865 2070 6172 spect to.the par │ │ │ -0006d510: 7469 6375 6c61 7220 7061 7261 6d65 7465 ticular paramete │ │ │ -0006d520: 7273 2c20 696e 7472 696e 7369 6320 616e rs, intrinsic an │ │ │ -0006d530: 642f 6f72 2065 7874 7269 6e73 6963 2e20 d/or extrinsic. │ │ │ -0006d540: 5468 6520 4a61 636f 6269 616e 7320 6172 The Jacobians ar │ │ │ -0006d550: 6520 7573 6564 2064 7572 696e 6720 7468 e used during th │ │ │ -0006d560: 6520 676c 6f62 616c 0a6f 7074 696d 697a e global.optimiz │ │ │ -0006d570: 6174 696f 6e20 696e 2052 4546 3a20 6361 ation in REF: ca │ │ │ -0006d580: 6c69 6272 6174 6543 616d 6572 612c 2052 librateCamera, R │ │ │ -0006d590: 4546 3a20 736f 6c76 6550 6e50 2c20 616e EF: solvePnP, an │ │ │ -0006d5a0: 6420 5245 463a 2073 7465 7265 6f43 616c d REF: stereoCal │ │ │ -0006d5b0: 6962 7261 7465 2e20 5468 6520 6675 6e63 ibrate. The func │ │ │ -0006d5c0: 7469 6f6e 2069 7473 656c 660a 6361 6e20 tion itself.can │ │ │ -0006d5d0: 616c 736f 2062 6520 7573 6564 2074 6f20 also be used to │ │ │ -0006d5e0: 636f 6d70 7574 6520 6120 7265 2d70 726f compute a re-pro │ │ │ -0006d5f0: 6a65 6374 696f 6e20 6572 726f 722c 2067 jection error, g │ │ │ -0006d600: 6976 656e 2074 6865 2063 7572 7265 6e74 iven the current │ │ │ -0006d610: 2069 6e74 7269 6e73 6963 2061 6e64 2065 intrinsic and e │ │ │ -0006d620: 7874 7269 6e73 6963 0a70 6172 616d 6574 xtrinsic.paramet │ │ │ -0006d630: 6572 732e 0a0a 3c62 3e4e 6f74 653a 3c2f ers...Note: Coordinate │ │ │ -0006d650: 2053 7973 7465 6d73 3a3c 2f62 3e0a 3c75 Systems:..
  • . In │ │ │ -0006d670: 7075 7420 283c 636f 6465 3e6f 626a 6563 put (objec │ │ │ -0006d680: 7450 6f69 6e74 733c 2f63 6f64 653e 293c tPoints)< │ │ │ -0006d690: 2f62 3e3a 2033 4420 706f 696e 7473 2069 /b>: 3D points i │ │ │ -0006d6a0: 6e20 7468 6520 3c62 3e77 6f72 6c64 2063 n the world c │ │ │ -0006d6b0: 6f6f 7264 696e 6174 6520 6672 616d 653c oordinate frame< │ │ │ -0006d6c0: 2f62 3e2e 0a20 203c 2f6c 693e 0a20 203c /b>..
  • . < │ │ │ -0006d6d0: 6c69 3e0a 203c 623e 4f75 7470 7574 2028 li>. Output ( │ │ │ -0006d6e0: 3c63 6f64 653e 696d 6167 6550 6f69 6e74 imagePoint │ │ │ -0006d6f0: 733c 2f63 6f64 653e 293c 2f62 3e3a 2032 s): 2 │ │ │ -0006d700: 4420 7072 6f6a 6563 7469 6f6e 7320 696e D projections in │ │ │ -0006d710: 203c 623e 7069 7865 6c20 636f 6f72 6469 pixel coordi │ │ │ -0006d720: 6e61 7465 733c 2f62 3e20 6f66 2074 6865 nates of the │ │ │ -0006d730: 2069 6d61 6765 2070 6c61 6e65 2c20 7769 image plane, wi │ │ │ -0006d740: 7468 2064 6973 746f 7274 696f 6e20 6170 th distortion ap │ │ │ -0006d750: 706c 6965 642e 0a20 2054 6865 2063 6f6f plied.. The coo │ │ │ -0006d760: 7264 696e 6174 6573 205c 2828 752c 2076 rdinates \((u, v │ │ │ -0006d770: 295c 2920 6172 6520 6d65 6173 7572 6564 )\) are measured │ │ │ -0006d780: 2069 6e20 7069 7865 6c73 2066 726f 6d20 in pixels from │ │ │ -0006d790: 7468 6520 746f 702d 6c65 6674 2063 6f72 the top-left cor │ │ │ -0006d7a0: 6e65 7220 6f66 2074 6865 2069 6d61 6765 ner of the image │ │ │ -0006d7b0: 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c 3e0a .. .. │ │ │ -0006d7c0: 0a54 6865 2074 7261 6e73 666f 726d 6174 .The transformat │ │ │ -0006d7d0: 696f 6e20 6368 6169 6e20 6973 3a20 576f ion chain is: Wo │ │ │ -0006d7e0: 726c 6420 636f 6f72 6469 6e61 7465 7320 rld coordinates │ │ │ -0006d7f0: e286 9220 4361 6d65 7261 2063 6f6f 7264 ... Camera coord │ │ │ -0006d800: 696e 6174 6573 2028 7669 6120 7276 6563 inates (via rvec │ │ │ -0006d810: 2f74 7665 6329 20e2 8692 204e 6f72 6d61 /tvec) ... Norma │ │ │ -0006d820: 6c69 7a65 6420 6361 6d65 7261 2063 6f6f lized camera coo │ │ │ -0006d830: 7264 696e 6174 6573 0ae2 8692 2044 6973 rdinates.... Dis │ │ │ -0006d840: 746f 7274 696f 6e20 6170 706c 6965 6420 tortion applied │ │ │ -0006d850: e286 9220 5069 7865 6c20 636f 6f72 6469 ... Pixel coordi │ │ │ -0006d860: 6e61 7465 7320 2876 6961 2063 616d 6572 nates (via camer │ │ │ -0006d870: 614d 6174 7269 7829 2e3c 2f64 6976 3e0a aMatrix).. │ │ │ -0006d880: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ -0006d8a0: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    objectPoints - Array of │ │ │ -0006d8d0: 206f 626a 6563 7420 706f 696e 7473 2065 object points e │ │ │ -0006d8e0: 7870 7265 7373 6564 2077 7274 2e20 7468 xpressed wrt. th │ │ │ -0006d8f0: 6520 776f 726c 6420 636f 6f72 6469 6e61 e world coordina │ │ │ -0006d900: 7465 2066 7261 6d65 2e20 4120 3378 4e2f te frame. A 3xN/ │ │ │ -0006d910: 4e78 330a 312d 6368 616e 6e65 6c20 6f72 Nx3.1-channel or │ │ │ -0006d920: 2031 784e 2f4e 7831 2033 2d63 6861 6e6e 1xN/Nx1 3-chann │ │ │ -0006d930: 656c 2028 6f72 2076 6563 746f 7226 6c74 el (or vector< │ │ │ -0006d940: 3b50 6f69 6e74 3366 2667 743b 2029 2c20 ;Point3f> ), │ │ │ -0006d950: 7768 6572 6520 4e20 6973 2074 6865 206e where N is the n │ │ │ -0006d960: 756d 6265 7220 6f66 2070 6f69 6e74 7320 umber of points │ │ │ -0006d970: 696e 2074 6865 2076 6965 772e 3c2f 6464 in the view.
    .
    rvec │ │ │ -0006d990: 3c2f 636f 6465 3e20 2d20 5468 6520 726f - The ro │ │ │ -0006d9a0: 7461 7469 6f6e 2076 6563 746f 7220 2852 tation vector (R │ │ │ -0006d9b0: 4546 3a20 526f 6472 6967 7565 7329 2074 EF: Rodrigues) t │ │ │ -0006d9c0: 6861 742c 2074 6f67 6574 6865 7220 7769 hat, together wi │ │ │ -0006d9d0: 7468 2074 7665 632c 2070 6572 666f 726d th tvec, perform │ │ │ -0006d9e0: 7320 6120 6368 616e 6765 206f 660a 6261 s a change of.ba │ │ │ -0006d9f0: 7369 7320 6672 6f6d 2077 6f72 6c64 2074 sis from world t │ │ │ -0006da00: 6f20 6361 6d65 7261 2063 6f6f 7264 696e o camera coordin │ │ │ -0006da10: 6174 6520 7379 7374 656d 2c20 7365 6520 ate system, see │ │ │ -0006da20: 5245 463a 2063 616c 6962 7261 7465 4361 REF: calibrateCa │ │ │ -0006da30: 6d65 7261 2066 6f72 2064 6574 6169 6c73 mera for details │ │ │ -0006da40: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    tvec - T │ │ │ -0006da60: 6865 2074 7261 6e73 6c61 7469 6f6e 2076 he translation v │ │ │ -0006da70: 6563 746f 722c 2073 6565 2070 6172 616d ector, see param │ │ │ -0006da80: 6574 6572 2064 6573 6372 6970 7469 6f6e eter description │ │ │ -0006da90: 2061 626f 7665 2e3c 2f64 643e 0a3c 6464 above.
    .
    cameraMat │ │ │ -0006dab0: 7269 783c 2f63 6f64 653e 202d 2043 616d rix - Cam │ │ │ -0006dac0: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ -0006dad0: 7472 6978 205c 285c 6361 6d65 7261 6d61 trix \(\camerama │ │ │ -0006dae0: 7472 6978 7b41 7d5c 2920 2e3c 2f64 643e trix{A}\) .
    │ │ │ -0006daf0: 0a3c 6464 3e3c 636f 6465 3e64 6973 7443 .
    distC │ │ │ -0006db00: 6f65 6666 733c 2f63 6f64 653e 202d 2049 oeffs - I │ │ │ -0006db10: 6e70 7574 2076 6563 746f 7220 6f66 2064 nput vector of d │ │ │ -0006db20: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ -0006db30: 6369 656e 7473 0a5c 285c 6469 7374 636f cients.\(\distco │ │ │ -0006db40: 6566 6673 5c29 202e 2049 6620 7468 6520 effs\) . If the │ │ │ -0006db50: 7665 6374 6f72 2069 7320 656d 7074 792c vector is empty, │ │ │ -0006db60: 2074 6865 207a 6572 6f20 6469 7374 6f72 the zero distor │ │ │ -0006db70: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ -0006db80: 7320 6172 6520 6173 7375 6d65 642e 3c2f s are assumed..
    im │ │ │ -0006dba0: 6167 6550 6f69 6e74 733c 2f63 6f64 653e agePoints │ │ │ -0006dbb0: 202d 204f 7574 7075 7420 6172 7261 7920 - Output array │ │ │ -0006dbc0: 6f66 2069 6d61 6765 2070 6f69 6e74 7320 of image points │ │ │ -0006dbd0: 696e 203c 623e 7069 7865 6c20 636f 6f72 in pixel coor │ │ │ -0006dbe0: 6469 6e61 7465 733c 2f62 3e2c 2031 784e dinates, 1xN │ │ │ -0006dbf0: 2f4e 7831 2032 2d63 6861 6e6e 656c 2c20 /Nx1 2-channel, │ │ │ -0006dc00: 6f72 0a76 6563 746f 7226 6c74 3b50 6f69 or.vector<Poi │ │ │ -0006dc10: 6e74 3266 2667 743b 202e 3c2f 6464 3e0a nt2f> .
    . │ │ │ -0006dc20: 3c64 643e 3c63 6f64 653e 6a61 636f 6269
    jacobi │ │ │ -0006dc30: 616e 3c2f 636f 6465 3e20 2d20 4f70 7469 an - Opti │ │ │ -0006dc40: 6f6e 616c 206f 7574 7075 7420 324e 7828 onal output 2Nx( │ │ │ -0006dc50: 3130 2b26 6c74 3b6e 756d 4469 7374 436f 10+<numDistCo │ │ │ -0006dc60: 6566 6673 2667 743b 2920 6a61 636f 6269 effs>) jacobi │ │ │ -0006dc70: 616e 206d 6174 7269 7820 6f66 2064 6572 an matrix of der │ │ │ -0006dc80: 6976 6174 6976 6573 206f 6620 696d 6167 ivatives of imag │ │ │ -0006dc90: 650a 706f 696e 7473 2077 6974 6820 7265 e.points with re │ │ │ -0006dca0: 7370 6563 7420 746f 2063 6f6d 706f 6e65 spect to compone │ │ │ -0006dcb0: 6e74 7320 6f66 2074 6865 2072 6f74 6174 nts of the rotat │ │ │ -0006dcc0: 696f 6e20 7665 6374 6f72 2c20 7472 616e ion vector, tran │ │ │ -0006dcd0: 736c 6174 696f 6e20 7665 6374 6f72 2c20 slation vector, │ │ │ -0006dce0: 666f 6361 6c20 6c65 6e67 7468 732c 0a63 focal lengths,.c │ │ │ -0006dcf0: 6f6f 7264 696e 6174 6573 206f 6620 7468 oordinates of th │ │ │ -0006dd00: 6520 7072 696e 6369 7061 6c20 706f 696e e principal poin │ │ │ -0006dd10: 7420 616e 6420 7468 6520 6469 7374 6f72 t and the distor │ │ │ -0006dd20: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ -0006dd30: 732e 2049 6e20 7468 6520 6f6c 6420 696e s. In the old in │ │ │ -0006dd40: 7465 7266 6163 6520 6469 6666 6572 656e terface differen │ │ │ -0006dd50: 740a 636f 6d70 6f6e 656e 7473 206f 6620 t.components of │ │ │ -0006dd60: 7468 6520 6a61 636f 6269 616e 2061 7265 the jacobian are │ │ │ -0006dd70: 2072 6574 7572 6e65 6420 7669 6120 6469 returned via di │ │ │ -0006dd80: 6666 6572 656e 7420 6f75 7470 7574 2070 fferent output p │ │ │ -0006dd90: 6172 616d 6574 6572 732e 0a66 756e 6374 arameters..funct │ │ │ -0006dda0: 696f 6e20 6173 7375 6d65 7320 7468 6174 ion assumes that │ │ │ -0006ddb0: 2074 6865 2061 7370 6563 7420 7261 7469 the aspect rati │ │ │ -0006ddc0: 6f20 285c 2866 5f78 202f 2066 5f79 5c29 o (\(f_x / f_y\) │ │ │ -0006ddd0: 2920 6973 2066 6978 6564 2061 6e64 2063 ) is fixed and c │ │ │ -0006dde0: 6f72 7265 7370 6f6e 6469 6e67 6c79 2061 orrespondingly a │ │ │ -0006ddf0: 646a 7573 7473 2074 6865 0a6a 6163 6f62 djusts the.jacob │ │ │ -0006de00: 6961 6e20 6d61 7472 6978 2e0a 0a3c 623e ian matrix... │ │ │ -0006de10: 4e6f 7465 3a3c 2f62 3e20 4279 2073 6574 Note: By set │ │ │ -0006de20: 7469 6e67 2072 7665 6320 3d20 7476 6563 ting rvec = tvec │ │ │ -0006de30: 203d 205c 285b 302c 2030 2c20 305d 5c29 = \([0, 0, 0]\) │ │ │ -0006de40: 2c20 6f72 2062 7920 7365 7474 696e 6720 , or by setting │ │ │ -0006de50: 6361 6d65 7261 4d61 7472 6978 2074 6f20 cameraMatrix to │ │ │ -0006de60: 6120 3378 3320 6964 656e 7469 7479 206d a 3x3 identity m │ │ │ -0006de70: 6174 7269 782c 0a6f 7220 6279 2070 6173 atrix,.or by pas │ │ │ -0006de80: 7369 6e67 207a 6572 6f20 6469 7374 6f72 sing zero distor │ │ │ -0006de90: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ -0006dea0: 732c 206f 6e65 2063 616e 2067 6574 2076 s, one can get v │ │ │ -0006deb0: 6172 696f 7573 2075 7365 6675 6c20 7061 arious useful pa │ │ │ -0006dec0: 7274 6961 6c20 6361 7365 7320 6f66 2074 rtial cases of t │ │ │ -0006ded0: 6865 0a66 756e 6374 696f 6e2e 2054 6869 he.function. Thi │ │ │ -0006dee0: 7320 6d65 616e 732c 206f 6e65 2063 616e s means, one can │ │ │ -0006def0: 2063 6f6d 7075 7465 2074 6865 2064 6973 compute the dis │ │ │ -0006df00: 746f 7274 6564 2063 6f6f 7264 696e 6174 torted coordinat │ │ │ -0006df10: 6573 2066 6f72 2061 2073 7061 7273 6520 es for a sparse │ │ │ -0006df20: 7365 7420 6f66 2070 6f69 6e74 7320 6f72 set of points or │ │ │ -0006df30: 2061 7070 6c79 0a61 2070 6572 7370 6563 apply.a perspec │ │ │ -0006df40: 7469 7665 2074 7261 6e73 666f 726d 6174 tive transformat │ │ │ -0006df50: 696f 6e20 2861 6e64 2061 6c73 6f20 636f ion (and also co │ │ │ -0006df60: 6d70 7574 6520 7468 6520 6465 7269 7661 mpute the deriva │ │ │ -0006df70: 7469 7665 7329 2069 6e20 7468 6520 6964 tives) in the id │ │ │ -0006df80: 6561 6c20 7a65 726f 2d64 6973 746f 7274 eal zero-distort │ │ │ -0006df90: 696f 6e20 7365 7475 702e 3c2f 6464 3e0a ion setup.
    . │ │ │ -0006dfa0: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    ..
    ...
    .

    projectPoi │ │ │ -0006e090: 6e74 733c 2f68 333e 0a3c 6469 7620 636c nts

    .
    .
    p │ │ │ -0006e0f0: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static void&n │ │ │ -0006e130: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;p │ │ │ -0006e150: 726f 6a65 6374 506f 696e 7473 3c2f 7370 rojectPoints(MatOfPoin │ │ │ -0006e1d0: 7433 663c 2f61 3e26 6e62 7370 3b6f 626a t3f obj │ │ │ -0006e1e0: 6563 7450 6f69 6e74 732c 0a20 3c61 2068 ectPoints,. Mat& │ │ │ -0006e230: 6e62 7370 3b72 7665 632c 0a20 3c61 2068 nbsp;rvec,. Mat& │ │ │ -0006e280: 6e62 7370 3b74 7665 632c 0a20 3c61 2068 nbsp;tvec,. Mat& │ │ │ -0006e2d0: 6e62 7370 3b63 616d 6572 614d 6174 7269 nbsp;cameraMatri │ │ │ -0006e2e0: 782c 0a20 3c61 2068 7265 663d 222e 2e2f x,. MatOfDou │ │ │ -0006e330: 626c 653c 2f61 3e26 6e62 7370 3b64 6973 ble dis │ │ │ -0006e340: 7443 6f65 6666 732c 0a20 3c61 2068 7265 tCoeffs,. M │ │ │ -0006e390: 6174 4f66 506f 696e 7432 663c 2f61 3e26 atOfPoint2f& │ │ │ -0006e3a0: 6e62 7370 3b69 6d61 6765 506f 696e 7473 nbsp;imagePoints │ │ │ -0006e3b0: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ -0006e3c0: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -0006e3d0: 223e 5072 6f6a 6563 7473 2033 4420 706f ">Projects 3D po │ │ │ -0006e3e0: 696e 7473 2074 6f20 616e 2069 6d61 6765 ints to an image │ │ │ -0006e3f0: 2070 6c61 6e65 2e0a 0a54 6865 2066 756e plane...The fun │ │ │ -0006e400: 6374 696f 6e20 636f 6d70 7574 6573 2074 ction computes t │ │ │ -0006e410: 6865 2032 4420 7072 6f6a 6563 7469 6f6e he 2D projection │ │ │ -0006e420: 7320 6f66 2033 4420 706f 696e 7473 2074 s of 3D points t │ │ │ -0006e430: 6f20 7468 6520 696d 6167 6520 706c 616e o the image plan │ │ │ -0006e440: 652c 2067 6976 656e 2069 6e74 7269 6e73 e, given intrins │ │ │ -0006e450: 6963 2061 6e64 0a65 7874 7269 6e73 6963 ic and.extrinsic │ │ │ -0006e460: 2063 616d 6572 6120 7061 7261 6d65 7465 camera paramete │ │ │ -0006e470: 7273 2e20 4f70 7469 6f6e 616c 6c79 2c20 rs. Optionally, │ │ │ -0006e480: 7468 6520 6675 6e63 7469 6f6e 2063 6f6d the function com │ │ │ -0006e490: 7075 7465 7320 4a61 636f 6269 616e 7320 putes Jacobians │ │ │ -0006e4a0: 2d6d 6174 7269 6365 7320 6f66 2070 6172 -matrices of par │ │ │ -0006e4b0: 7469 616c 0a64 6572 6976 6174 6976 6573 tial.derivatives │ │ │ -0006e4c0: 206f 6620 696d 6167 6520 706f 696e 7473 of image points │ │ │ -0006e4d0: 2063 6f6f 7264 696e 6174 6573 2028 6173 coordinates (as │ │ │ -0006e4e0: 2066 756e 6374 696f 6e73 206f 6620 616c functions of al │ │ │ -0006e4f0: 6c20 7468 6520 696e 7075 7420 7061 7261 l the input para │ │ │ -0006e500: 6d65 7465 7273 2920 7769 7468 2072 6573 meters) with res │ │ │ -0006e510: 7065 6374 2074 6f0a 7468 6520 7061 7274 pect to.the part │ │ │ -0006e520: 6963 756c 6172 2070 6172 616d 6574 6572 icular parameter │ │ │ -0006e530: 732c 2069 6e74 7269 6e73 6963 2061 6e64 s, intrinsic and │ │ │ -0006e540: 2f6f 7220 6578 7472 696e 7369 632e 2054 /or extrinsic. T │ │ │ -0006e550: 6865 204a 6163 6f62 6961 6e73 2061 7265 he Jacobians are │ │ │ -0006e560: 2075 7365 6420 6475 7269 6e67 2074 6865 used during the │ │ │ -0006e570: 2067 6c6f 6261 6c0a 6f70 7469 6d69 7a61 global.optimiza │ │ │ -0006e580: 7469 6f6e 2069 6e20 5245 463a 2063 616c tion in REF: cal │ │ │ -0006e590: 6962 7261 7465 4361 6d65 7261 2c20 5245 ibrateCamera, RE │ │ │ -0006e5a0: 463a 2073 6f6c 7665 506e 502c 2061 6e64 F: solvePnP, and │ │ │ -0006e5b0: 2052 4546 3a20 7374 6572 656f 4361 6c69 REF: stereoCali │ │ │ -0006e5c0: 6272 6174 652e 2054 6865 2066 756e 6374 brate. The funct │ │ │ -0006e5d0: 696f 6e20 6974 7365 6c66 0a63 616e 2061 ion itself.can a │ │ │ -0006e5e0: 6c73 6f20 6265 2075 7365 6420 746f 2063 lso be used to c │ │ │ -0006e5f0: 6f6d 7075 7465 2061 2072 652d 7072 6f6a ompute a re-proj │ │ │ -0006e600: 6563 7469 6f6e 2065 7272 6f72 2c20 6769 ection error, gi │ │ │ -0006e610: 7665 6e20 7468 6520 6375 7272 656e 7420 ven the current │ │ │ -0006e620: 696e 7472 696e 7369 6320 616e 6420 6578 intrinsic and ex │ │ │ -0006e630: 7472 696e 7369 630a 7061 7261 6d65 7465 trinsic.paramete │ │ │ -0006e640: 7273 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 rs...Note: Coordinate │ │ │ -0006e660: 5379 7374 656d 733a 3c2f 623e 0a3c 756c Systems:.
      .
    • . Inp │ │ │ -0006e680: 7574 2028 3c63 6f64 653e 6f62 6a65 6374 ut (object │ │ │ -0006e690: 506f 696e 7473 3c2f 636f 6465 3e29 3c2f Points): 3D points in │ │ │ -0006e6b0: 2074 6865 203c 623e 776f 726c 6420 636f the world co │ │ │ -0006e6c0: 6f72 6469 6e61 7465 2066 7261 6d65 3c2f ordinate frame..
    • . . Output (< │ │ │ -0006e6f0: 636f 6465 3e69 6d61 6765 506f 696e 7473 code>imagePoints │ │ │ -0006e700: 3c2f 636f 6465 3e29 3c2f 623e 3a20 3244
      ): 2D │ │ │ -0006e710: 2070 726f 6a65 6374 696f 6e73 2069 6e20 projections in │ │ │ -0006e720: 3c62 3e70 6978 656c 2063 6f6f 7264 696e pixel coordin │ │ │ -0006e730: 6174 6573 3c2f 623e 206f 6620 7468 6520 ates of the │ │ │ -0006e740: 696d 6167 6520 706c 616e 652c 2077 6974 image plane, wit │ │ │ -0006e750: 6820 6469 7374 6f72 7469 6f6e 2061 7070 h distortion app │ │ │ -0006e760: 6c69 6564 2e0a 2020 5468 6520 636f 6f72 lied.. The coor │ │ │ -0006e770: 6469 6e61 7465 7320 5c28 2875 2c20 7629 dinates \((u, v) │ │ │ -0006e780: 5c29 2061 7265 206d 6561 7375 7265 6420 \) are measured │ │ │ -0006e790: 696e 2070 6978 656c 7320 6672 6f6d 2074 in pixels from t │ │ │ -0006e7a0: 6865 2074 6f70 2d6c 6566 7420 636f 726e he top-left corn │ │ │ -0006e7b0: 6572 206f 6620 7468 6520 696d 6167 652e er of the image. │ │ │ -0006e7c0: 0a20 203c 2f6c 693e 0a3c 2f75 6c3e 0a0a . .
    .. │ │ │ -0006e7d0: 5468 6520 7472 616e 7366 6f72 6d61 7469 The transformati │ │ │ -0006e7e0: 6f6e 2063 6861 696e 2069 733a 2057 6f72 on chain is: Wor │ │ │ -0006e7f0: 6c64 2063 6f6f 7264 696e 6174 6573 20e2 ld coordinates . │ │ │ -0006e800: 8692 2043 616d 6572 6120 636f 6f72 6469 .. Camera coordi │ │ │ -0006e810: 6e61 7465 7320 2876 6961 2072 7665 632f nates (via rvec/ │ │ │ -0006e820: 7476 6563 2920 e286 9220 4e6f 726d 616c tvec) ... Normal │ │ │ -0006e830: 697a 6564 2063 616d 6572 6120 636f 6f72 ized camera coor │ │ │ -0006e840: 6469 6e61 7465 730a e286 9220 4469 7374 dinates.... Dist │ │ │ -0006e850: 6f72 7469 6f6e 2061 7070 6c69 6564 20e2 ortion applied . │ │ │ -0006e860: 8692 2050 6978 656c 2063 6f6f 7264 696e .. Pixel coordin │ │ │ -0006e870: 6174 6573 2028 7669 6120 6361 6d65 7261 ates (via camera │ │ │ -0006e880: 4d61 7472 6978 292e 3c2f 6469 763e 0a3c Matrix).
    .< │ │ │ -0006e890: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ -0006e8a0: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ -0006e8b0: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    objectPoints - Array of │ │ │ -0006e8e0: 6f62 6a65 6374 2070 6f69 6e74 7320 6578 object points ex │ │ │ -0006e8f0: 7072 6573 7365 6420 7772 742e 2074 6865 pressed wrt. the │ │ │ -0006e900: 2077 6f72 6c64 2063 6f6f 7264 696e 6174 world coordinat │ │ │ -0006e910: 6520 6672 616d 652e 2041 2033 784e 2f4e e frame. A 3xN/N │ │ │ -0006e920: 7833 0a31 2d63 6861 6e6e 656c 206f 7220 x3.1-channel or │ │ │ -0006e930: 3178 4e2f 4e78 3120 332d 6368 616e 6e65 1xN/Nx1 3-channe │ │ │ -0006e940: 6c20 286f 7220 7665 6374 6f72 266c 743b l (or vector< │ │ │ -0006e950: 506f 696e 7433 6626 6774 3b20 292c 2077 Point3f> ), w │ │ │ -0006e960: 6865 7265 204e 2069 7320 7468 6520 6e75 here N is the nu │ │ │ -0006e970: 6d62 6572 206f 6620 706f 696e 7473 2069 mber of points i │ │ │ -0006e980: 6e20 7468 6520 7669 6577 2e3c 2f64 643e n the view.
    │ │ │ -0006e990: 0a3c 6464 3e3c 636f 6465 3e72 7665 633c .
    rvec< │ │ │ -0006e9a0: 2f63 6f64 653e 202d 2054 6865 2072 6f74 /code> - The rot │ │ │ -0006e9b0: 6174 696f 6e20 7665 6374 6f72 2028 5245 ation vector (RE │ │ │ -0006e9c0: 463a 2052 6f64 7269 6775 6573 2920 7468 F: Rodrigues) th │ │ │ -0006e9d0: 6174 2c20 746f 6765 7468 6572 2077 6974 at, together wit │ │ │ -0006e9e0: 6820 7476 6563 2c20 7065 7266 6f72 6d73 h tvec, performs │ │ │ -0006e9f0: 2061 2063 6861 6e67 6520 6f66 0a62 6173 a change of.bas │ │ │ -0006ea00: 6973 2066 726f 6d20 776f 726c 6420 746f is from world to │ │ │ -0006ea10: 2063 616d 6572 6120 636f 6f72 6469 6e61 camera coordina │ │ │ -0006ea20: 7465 2073 7973 7465 6d2c 2073 6565 2052 te system, see R │ │ │ -0006ea30: 4546 3a20 6361 6c69 6272 6174 6543 616d EF: calibrateCam │ │ │ -0006ea40: 6572 6120 666f 7220 6465 7461 696c 732e era for details. │ │ │ -0006ea50: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -0006ea60: 7476 6563 3c2f 636f 6465 3e20 2d20 5468 tvec - Th │ │ │ -0006ea70: 6520 7472 616e 736c 6174 696f 6e20 7665 e translation ve │ │ │ -0006ea80: 6374 6f72 2c20 7365 6520 7061 7261 6d65 ctor, see parame │ │ │ -0006ea90: 7465 7220 6465 7363 7269 7074 696f 6e20 ter description │ │ │ -0006eaa0: 6162 6f76 652e 3c2f 6464 3e0a 3c64 643e above.
    .
    │ │ │ -0006eab0: 3c63 6f64 653e 6361 6d65 7261 4d61 7472 cameraMatr │ │ │ -0006eac0: 6978 3c2f 636f 6465 3e20 2d20 4361 6d65 ix - Came │ │ │ -0006ead0: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ -0006eae0: 7269 7820 5c28 5c63 616d 6572 616d 6174 rix \(\cameramat │ │ │ -0006eaf0: 7269 787b 417d 5c29 202e 3c2f 6464 3e0a rix{A}\) .
    . │ │ │ -0006eb00: 3c64 643e 3c63 6f64 653e 6469 7374 436f
    distCo │ │ │ -0006eb10: 6566 6673 3c2f 636f 6465 3e20 2d20 496e effs - In │ │ │ -0006eb20: 7075 7420 7665 6374 6f72 206f 6620 6469 put vector of di │ │ │ -0006eb30: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ -0006eb40: 6965 6e74 730a 5c28 5c64 6973 7463 6f65 ients.\(\distcoe │ │ │ -0006eb50: 6666 735c 2920 2e20 4966 2074 6865 2076 ffs\) . If the v │ │ │ -0006eb60: 6563 746f 7220 6973 2065 6d70 7479 2c20 ector is empty, │ │ │ -0006eb70: 7468 6520 7a65 726f 2064 6973 746f 7274 the zero distort │ │ │ -0006eb80: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ -0006eb90: 2061 7265 2061 7373 756d 6564 2e3c 2f64 are assumed..
    ima │ │ │ -0006ebb0: 6765 506f 696e 7473 3c2f 636f 6465 3e20 gePoints │ │ │ -0006ebc0: 2d20 4f75 7470 7574 2061 7272 6179 206f - Output array o │ │ │ -0006ebd0: 6620 696d 6167 6520 706f 696e 7473 2069 f image points i │ │ │ -0006ebe0: 6e20 3c62 3e70 6978 656c 2063 6f6f 7264 n pixel coord │ │ │ -0006ebf0: 696e 6174 6573 3c2f 623e 2c20 3178 4e2f inates, 1xN/ │ │ │ -0006ec00: 4e78 3120 322d 6368 616e 6e65 6c2c 206f Nx1 2-channel, o │ │ │ -0006ec10: 720a 7665 6374 6f72 266c 743b 506f 696e r.vector<Poin │ │ │ -0006ec20: 7432 6626 6774 3b20 2e0a 706f 696e 7473 t2f> ..points │ │ │ -0006ec30: 2077 6974 6820 7265 7370 6563 7420 746f with respect to │ │ │ -0006ec40: 2063 6f6d 706f 6e65 6e74 7320 6f66 2074 components of t │ │ │ -0006ec50: 6865 2072 6f74 6174 696f 6e20 7665 6374 he rotation vect │ │ │ -0006ec60: 6f72 2c20 7472 616e 736c 6174 696f 6e20 or, translation │ │ │ -0006ec70: 7665 6374 6f72 2c20 666f 6361 6c20 6c65 vector, focal le │ │ │ -0006ec80: 6e67 7468 732c 0a63 6f6f 7264 696e 6174 ngths,.coordinat │ │ │ -0006ec90: 6573 206f 6620 7468 6520 7072 696e 6369 es of the princi │ │ │ -0006eca0: 7061 6c20 706f 696e 7420 616e 6420 7468 pal point and th │ │ │ -0006ecb0: 6520 6469 7374 6f72 7469 6f6e 2063 6f65 e distortion coe │ │ │ -0006ecc0: 6666 6963 6965 6e74 732e 2049 6e20 7468 fficients. In th │ │ │ -0006ecd0: 6520 6f6c 6420 696e 7465 7266 6163 6520 e old interface │ │ │ -0006ece0: 6469 6666 6572 656e 740a 636f 6d70 6f6e different.compon │ │ │ -0006ecf0: 656e 7473 206f 6620 7468 6520 6a61 636f ents of the jaco │ │ │ -0006ed00: 6269 616e 2061 7265 2072 6574 7572 6e65 bian are returne │ │ │ -0006ed10: 6420 7669 6120 6469 6666 6572 656e 7420 d via different │ │ │ -0006ed20: 6f75 7470 7574 2070 6172 616d 6574 6572 output parameter │ │ │ -0006ed30: 732e 0a66 756e 6374 696f 6e20 6173 7375 s..function assu │ │ │ -0006ed40: 6d65 7320 7468 6174 2074 6865 2061 7370 mes that the asp │ │ │ -0006ed50: 6563 7420 7261 7469 6f20 285c 2866 5f78 ect ratio (\(f_x │ │ │ -0006ed60: 202f 2066 5f79 5c29 2920 6973 2066 6978 / f_y\)) is fix │ │ │ -0006ed70: 6564 2061 6e64 2063 6f72 7265 7370 6f6e ed and correspon │ │ │ -0006ed80: 6469 6e67 6c79 2061 646a 7573 7473 2074 dingly adjusts t │ │ │ -0006ed90: 6865 0a6a 6163 6f62 6961 6e20 6d61 7472 he.jacobian matr │ │ │ -0006eda0: 6978 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 ix...Note: By setting rve │ │ │ -0006edc0: 6320 3d20 7476 6563 203d 205c 285b 302c c = tvec = \([0, │ │ │ -0006edd0: 2030 2c20 305d 5c29 2c20 6f72 2062 7920 0, 0]\), or by │ │ │ -0006ede0: 7365 7474 696e 6720 6361 6d65 7261 4d61 setting cameraMa │ │ │ -0006edf0: 7472 6978 2074 6f20 6120 3378 3320 6964 trix to a 3x3 id │ │ │ -0006ee00: 656e 7469 7479 206d 6174 7269 782c 0a6f entity matrix,.o │ │ │ -0006ee10: 7220 6279 2070 6173 7369 6e67 207a 6572 r by passing zer │ │ │ -0006ee20: 6f20 6469 7374 6f72 7469 6f6e 2063 6f65 o distortion coe │ │ │ -0006ee30: 6666 6963 6965 6e74 732c 206f 6e65 2063 fficients, one c │ │ │ -0006ee40: 616e 2067 6574 2076 6172 696f 7573 2075 an get various u │ │ │ -0006ee50: 7365 6675 6c20 7061 7274 6961 6c20 6361 seful partial ca │ │ │ -0006ee60: 7365 7320 6f66 2074 6865 0a66 756e 6374 ses of the.funct │ │ │ -0006ee70: 696f 6e2e 2054 6869 7320 6d65 616e 732c ion. This means, │ │ │ -0006ee80: 206f 6e65 2063 616e 2063 6f6d 7075 7465 one can compute │ │ │ -0006ee90: 2074 6865 2064 6973 746f 7274 6564 2063 the distorted c │ │ │ -0006eea0: 6f6f 7264 696e 6174 6573 2066 6f72 2061 oordinates for a │ │ │ -0006eeb0: 2073 7061 7273 6520 7365 7420 6f66 2070 sparse set of p │ │ │ -0006eec0: 6f69 6e74 7320 6f72 2061 7070 6c79 0a61 oints or apply.a │ │ │ -0006eed0: 2070 6572 7370 6563 7469 7665 2074 7261 perspective tra │ │ │ -0006eee0: 6e73 666f 726d 6174 696f 6e20 2861 6e64 nsformation (and │ │ │ -0006eef0: 2061 6c73 6f20 636f 6d70 7574 6520 7468 also compute th │ │ │ -0006ef00: 6520 6465 7269 7661 7469 7665 7329 2069 e derivatives) i │ │ │ -0006ef10: 6e20 7468 6520 6964 6561 6c20 7a65 726f n the ideal zero │ │ │ -0006ef20: 2d64 6973 746f 7274 696f 6e20 7365 7475 -distortion setu │ │ │ -0006ef30: 702e 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f p.
    ...
    . │ │ │ -0006ef50: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374 .
  • ..

    projectPo │ │ │ -0006f090: 696e 7473 5365 704a 3c2f 6833 3e0a 3c64 intsSepJ

    ..public stati │ │ │ -0006f100: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void projectPoint │ │ │ -0006f160: 7353 6570 4a3c 2f73 7061 6e3e 3c77 6272 sSepJ(Mat&n │ │ │ -0006f1d0: 6273 703b 6f62 6a65 6374 506f 696e 7473 bsp;objectPoints │ │ │ -0006f1e0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -0006f220: 6174 3c2f 613e 266e 6273 703b 7276 6563 at rvec │ │ │ -0006f230: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -0006f270: 6174 3c2f 613e 266e 6273 703b 7476 6563 at tvec │ │ │ -0006f280: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -0006f2c0: 6174 3c2f 613e 266e 6273 703b 6361 6d65 at came │ │ │ -0006f2d0: 7261 4d61 7472 6978 2c0a 203c 6120 6872 raMatrix,. Mat&n │ │ │ -0006f320: 6273 703b 6469 7374 436f 6566 6673 2c0a bsp;distCoeffs,. │ │ │ -0006f330: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0006f370: 3c2f 613e 266e 6273 703b 696d 6167 6550  imageP │ │ │ -0006f380: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ -0006f3d0: 3b64 7064 722c 0a20 3c61 2068 7265 663d ;dpdr,. Mat  │ │ │ -0006f420: 3b64 7064 742c 0a20 3c61 2068 7265 663d ;dpdt,. Mat  │ │ │ -0006f470: 3b64 7064 662c 0a20 3c61 2068 7265 663d ;dpdf,. Mat  │ │ │ -0006f4c0: 3b64 7064 632c 0a20 3c61 2068 7265 663d ;dpdc,. Mat  │ │ │ -0006f510: 3b64 7064 6b2c 0a20 3c61 2068 7265 663d ;dpdk,. Mat  │ │ │ -0006f560: 3b64 7064 6f2c 0a20 646f 7562 6c65 266e ;dpdo,. double&n │ │ │ -0006f570: 6273 703b 6173 7065 6374 5261 7469 6f29 bsp;aspectRatio) │ │ │ -0006f580: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c2f ..
  • . │ │ │ -0006f5a0: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374 .
  • ..

    │ │ │ -0006f6d0: 7072 6f6a 6563 7450 6f69 6e74 7353 6570 projectPointsSep │ │ │ -0006f6e0: 4a3c 2f68 333e 0a3c 6469 7620 636c 6173 J

    .
    .
    pub │ │ │ -0006f740: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static void&nbs │ │ │ -0006f780: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;pro │ │ │ -0006f7a0: 6a65 6374 506f 696e 7473 5365 704a 3c2f jectPointsSepJ( │ │ │ -0006f810: 4d61 743c 2f61 3e26 6e62 7370 3b6f 626a Mat obj │ │ │ -0006f820: 6563 7450 6f69 6e74 732c 0a20 3c61 2068 ectPoints,. Mat& │ │ │ -0006f870: 6e62 7370 3b72 7665 632c 0a20 3c61 2068 nbsp;rvec,. Mat& │ │ │ -0006f8c0: 6e62 7370 3b74 7665 632c 0a20 3c61 2068 nbsp;tvec,. Mat& │ │ │ -0006f910: 6e62 7370 3b63 616d 6572 614d 6174 7269 nbsp;cameraMatri │ │ │ -0006f920: 782c 0a20 3c61 2068 7265 663d 222e 2e2f x,. │ │ │ -0006f960: 4d61 743c 2f61 3e26 6e62 7370 3b64 6973 Mat dis │ │ │ -0006f970: 7443 6f65 6666 732c 0a20 3c61 2068 7265 tCoeffs,. Mat&nb │ │ │ -0006f9c0: 7370 3b69 6d61 6765 506f 696e 7473 2c0a sp;imagePoints,. │ │ │ -0006f9d0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0006fa10: 3c2f 613e 266e 6273 703b 6470 6472 2c0a  dpdr,. │ │ │ -0006fa20: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0006fa60: 3c2f 613e 266e 6273 703b 6470 6474 2c0a  dpdt,. │ │ │ -0006fa70: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0006fab0: 3c2f 613e 266e 6273 703b 6470 6466 2c0a  dpdf,. │ │ │ -0006fac0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0006fb00: 3c2f 613e 266e 6273 703b 6470 6463 2c0a  dpdc,. │ │ │ -0006fb10: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0006fb50: 3c2f 613e 266e 6273 703b 6470 646b 2c0a  dpdk,. │ │ │ -0006fb60: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0006fba0: 3c2f 613e 266e 6273 703b 6470 646f 293c  dpdo)< │ │ │ -0006fbb0: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 2f64 /span>
    ...< │ │ │ -0006fbd0: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    proje │ │ │ -0006fcf0: 6374 506f 696e 7473 5365 704a 3c2f 6833 ctPointsSepJ

    .
    .
    │ │ │ -0006fd40: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -0006fd60: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -0006fd70: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;void │ │ │ -0006fd90: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  projectP │ │ │ -0006fdc0: 6f69 6e74 7353 6570 4a3c 2f73 7061 6e3e ointsSepJ │ │ │ -0006fdd0: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ -0006fdf0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0006fe00: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0006fe10: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0006fe20: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat objectPo │ │ │ -0006fe40: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. Mat  │ │ │ -0006fe90: 7276 6563 2c0a 203c 6120 6872 6566 3d22 rvec,. Mat  │ │ │ -0006fee0: 7476 6563 2c0a 203c 6120 6872 6566 3d22 tvec,. Mat  │ │ │ -0006ff30: 6361 6d65 7261 4d61 7472 6978 2c0a 203c cameraMatrix,. < │ │ │ -0006ff40: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0006ff50: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0006ff60: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0006ff70: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat distCoef │ │ │ -0006ff90: 6673 2c0a 203c 6120 6872 6566 3d22 2e2e fs,. Mat im │ │ │ -0006ffe0: 6167 6550 6f69 6e74 732c 0a20 3c61 2068 agePoints,. Mat& │ │ │ -00070030: 6e62 7370 3b64 7064 722c 0a20 3c61 2068 nbsp;dpdr,. Mat& │ │ │ -00070080: 6e62 7370 3b64 7064 742c 0a20 3c61 2068 nbsp;dpdt,. Mat& │ │ │ -000700d0: 6e62 7370 3b64 7064 662c 0a20 3c61 2068 nbsp;dpdf,. Mat& │ │ │ -00070120: 6e62 7370 3b64 7064 632c 0a20 3c61 2068 nbsp;dpdc,. Mat& │ │ │ -00070170: 6e62 7370 3b64 7064 6b29 3c2f 7370 616e nbsp;dpdk)
    .
    .< │ │ │ -00070190: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ -000701a0: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .projectPointsS │ │ │ -000702b0: 6570 4a3c 2f68 333e 0a3c 6469 7620 636c epJ.
    .
    p │ │ │ -00070310: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static void&n │ │ │ -00070350: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;p │ │ │ -00070370: 726f 6a65 6374 506f 696e 7473 5365 704a rojectPointsSepJ │ │ │ -00070380: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat o │ │ │ -000703f0: 626a 6563 7450 6f69 6e74 732c 0a20 3c61 bjectPoints,. Mat rvec,. Mat tvec,. Mat cameraMat │ │ │ -000704f0: 7269 782c 0a20 3c61 2068 7265 663d 222e rix,. Mat d │ │ │ -00070540: 6973 7443 6f65 6666 732c 0a20 3c61 2068 istCoeffs,. Mat& │ │ │ -00070590: 6e62 7370 3b69 6d61 6765 506f 696e 7473 nbsp;imagePoints │ │ │ -000705a0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000705e0: 6174 3c2f 613e 266e 6273 703b 6470 6472 at dpdr │ │ │ -000705f0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -00070630: 6174 3c2f 613e 266e 6273 703b 6470 6474 at dpdt │ │ │ -00070640: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -00070680: 6174 3c2f 613e 266e 6273 703b 6470 6466 at dpdf │ │ │ -00070690: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000706d0: 6174 3c2f 613e 266e 6273 703b 6470 6463 at dpdc │ │ │ -000706e0: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ -000706f0: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ -00070700: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • . │ │ │ -000707f0: 0a3c 6833 3e70 726f 6a65 6374 506f 696e .

    projectPoin │ │ │ -00070800: 7473 5365 704a 3c2f 6833 3e0a 3c64 6976 tsSepJ

    .
    .
    public static< │ │ │ -00070870: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> void projectPointsS │ │ │ -000708d0: 6570 4a3c 2f73 7061 6e3e 3c77 6272 3e3c epJ< │ │ │ -000708e0: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ -000708f0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ -00070940: 703b 6f62 6a65 6374 506f 696e 7473 2c0a p;objectPoints,. │ │ │ -00070950: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -00070990: 3c2f 613e 266e 6273 703b 7276 6563 2c0a  rvec,. │ │ │ -000709a0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000709e0: 3c2f 613e 266e 6273 703b 7476 6563 2c0a  tvec,. │ │ │ -000709f0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -00070a30: 3c2f 613e 266e 6273 703b 6361 6d65 7261  camera │ │ │ -00070a40: 4d61 7472 6978 2c0a 203c 6120 6872 6566 Matrix,. Mat&nbs │ │ │ -00070a90: 703b 6469 7374 436f 6566 6673 2c0a 203c p;distCoeffs,. < │ │ │ -00070aa0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00070ab0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00070ac0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00070ad0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat imagePoi │ │ │ -00070af0: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. Mat d │ │ │ -00070b40: 7064 722c 0a20 3c61 2068 7265 663d 222e pdr,. Mat d │ │ │ -00070b90: 7064 742c 0a20 3c61 2068 7265 663d 222e pdt,. Mat d │ │ │ -00070be0: 7064 6629 3c2f 7370 616e 3e3c 2f64 6976 pdf)
    .
    ..
  • .
  • .< │ │ │ -00070c10: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ -00070c20: 6574 6169 6c22 2069 643d 2270 726f 6a65 etail" id="proje │ │ │ -00070c30: 6374 506f 696e 7473 5365 704a 286f 7267 ctPointsSepJ(org │ │ │ -00070c40: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ -00070c50: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ -00070c60: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ -00070c70: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ -00070c80: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ -00070c90: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ -00070ca0: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ -00070cb0: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ -00070cc0: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ -00070cd0: 6e63 762e 636f 7265 2e4d 6174 2922 3e0a ncv.core.Mat)">. │ │ │ -00070ce0: 3c68 333e 7072 6f6a 6563 7450 6f69 6e74

    projectPoint │ │ │ -00070cf0: 7353 6570 4a3c 2f68 333e 0a3c 6469 7620 sSepJ

    .
    .
    public static void │ │ │ -00070d90: 266e 6273 703b 3c73 7061 6e20 636c 6173  projectPointsSe │ │ │ -00070dc0: 704a 3c2f 7370 616e 3e3c 7762 723e 3c73 pJ(Mat  │ │ │ -00070e30: 3b6f 626a 6563 7450 6f69 6e74 732c 0a20 ;objectPoints,. │ │ │ -00070e40: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -00070e80: 2f61 3e26 6e62 7370 3b72 7665 632c 0a20 /a> rvec,. │ │ │ -00070e90: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -00070ed0: 2f61 3e26 6e62 7370 3b74 7665 632c 0a20 /a> tvec,. │ │ │ -00070ee0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -00070f20: 2f61 3e26 6e62 7370 3b63 616d 6572 614d /a> cameraM │ │ │ -00070f30: 6174 7269 782c 0a20 3c61 2068 7265 663d atrix,. Mat  │ │ │ -00070f80: 3b64 6973 7443 6f65 6666 732c 0a20 3c61 ;distCoeffs,. Mat imagePoin │ │ │ -00070fe0: 7473 2c0a 203c 6120 6872 6566 3d22 2e2e ts,. Mat dp │ │ │ -00071030: 6472 2c0a 203c 6120 6872 6566 3d22 2e2e dr,. Mat dp │ │ │ -00071080: 6474 293c 2f73 7061 6e3e 3c2f 6469 763e dt)
    │ │ │ -00071090: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • ..

    solvePnP │ │ │ -00071180: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ -000711e0: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -000711f0: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -00071210: 626f 6f6c 6561 6e3c 2f73 7061 6e3e 266e boolean&n │ │ │ -00071220: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;s │ │ │ -00071240: 6f6c 7665 506e 503c 2f73 7061 6e3e 3c77 olvePnP(MatOfPoint3f objectPo │ │ │ -000712d0: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. MatO │ │ │ -00071320: 6650 6f69 6e74 3266 3c2f 613e 266e 6273 fPoint2f&nbs │ │ │ -00071330: 703b 696d 6167 6550 6f69 6e74 732c 0a20 p;imagePoints,. │ │ │ -00071340: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -00071380: 2f61 3e26 6e62 7370 3b63 616d 6572 614d /a> cameraM │ │ │ -00071390: 6174 7269 782c 0a20 3c61 2068 7265 663d atrix,. MatO │ │ │ -000713e0: 6644 6f75 626c 653c 2f61 3e26 6e62 7370 fDouble  │ │ │ -000713f0: 3b64 6973 7443 6f65 6666 732c 0a20 3c61 ;distCoeffs,. Mat rvec,. Mat tvec,. bo │ │ │ -000714a0: 6f6c 6561 6e26 6e62 7370 3b75 7365 4578 olean useEx │ │ │ -000714b0: 7472 696e 7369 6347 7565 7373 2c0a 2069 trinsicGuess,. i │ │ │ -000714c0: 6e74 266e 6273 703b 666c 6167 7329 3c2f nt flags)
    .
    F │ │ │ -000714f0: 696e 6473 2061 6e20 6f62 6a65 6374 2070 inds an object p │ │ │ -00071500: 6f73 6520 5c28 207b 7d5e 7b63 7d5c 6d61 ose \( {}^{c}\ma │ │ │ -00071510: 7468 6266 7b54 7d5f 6f20 5c29 2066 726f thbf{T}_o \) fro │ │ │ -00071520: 6d20 3344 2d32 4420 706f 696e 7420 636f m 3D-2D point co │ │ │ -00071530: 7272 6573 706f 6e64 656e 6365 733a 0a0a rrespondences:.. │ │ │ -00071540: 215b 5065 7273 7065 6374 6976 6520 7072 ![Perspective pr │ │ │ -00071550: 6f6a 6563 7469 6f6e 2c20 6672 6f6d 206f ojection, from o │ │ │ -00071560: 626a 6563 7420 746f 2063 616d 6572 6120 bject to camera │ │ │ -00071570: 6672 616d 655d 2870 6963 732f 7069 6e68 frame](pics/pinh │ │ │ -00071580: 6f6c 655f 686f 6d6f 6765 6e65 6f75 735f ole_homogeneous_ │ │ │ -00071590: 7472 616e 7366 6f72 6d61 7469 6f6e 2e6a transformation.j │ │ │ -000715a0: 7067 297b 2077 6964 7468 3d35 3025 207d pg){ width=50% } │ │ │ -000715b0: 0a0a 5345 453a 2052 4546 3a20 6361 6c69 ..SEE: REF: cali │ │ │ -000715c0: 6233 645f 736f 6c76 6550 6e50 0a0a 5468 b3d_solvePnP..Th │ │ │ -000715d0: 6973 2066 756e 6374 696f 6e20 7265 7475 is function retu │ │ │ -000715e0: 726e 7320 7468 6520 726f 7461 7469 6f6e rns the rotation │ │ │ -000715f0: 2061 6e64 2074 6865 2074 7261 6e73 6c61 and the transla │ │ │ -00071600: 7469 6f6e 2076 6563 746f 7273 2074 6861 tion vectors tha │ │ │ -00071610: 7420 7472 616e 7366 6f72 6d20 6120 3344 t transform a 3D │ │ │ -00071620: 2070 6f69 6e74 2065 7870 7265 7373 6564 point expressed │ │ │ -00071630: 2069 6e20 7468 6520 6f62 6a65 6374 0a63 in the object.c │ │ │ -00071640: 6f6f 7264 696e 6174 6520 6672 616d 6520 oordinate frame │ │ │ -00071650: 746f 2074 6865 2063 616d 6572 6120 636f to the camera co │ │ │ -00071660: 6f72 6469 6e61 7465 2066 7261 6d65 2c20 ordinate frame, │ │ │ -00071670: 7573 696e 6720 6469 6666 6572 656e 7420 using different │ │ │ -00071680: 6d65 7468 6f64 733a 0a3c 756c 3e0a 2020 methods:.
      . │ │ │ -00071690: 3c6c 693e 0a20 5033 5020 6d65 7468 6f64
    • . P3P method │ │ │ -000716a0: 7320 2852 4546 3a20 534f 4c56 4550 4e50 s (REF: SOLVEPNP │ │ │ -000716b0: 5f50 3350 2c20 5245 463a 2053 4f4c 5645 _P3P, REF: SOLVE │ │ │ -000716c0: 504e 505f 4150 3350 293a 206e 6565 6420 PNP_AP3P): need │ │ │ -000716d0: 3420 696e 7075 7420 706f 696e 7473 2074 4 input points t │ │ │ -000716e0: 6f20 7265 7475 726e 2061 2075 6e69 7175 o return a uniqu │ │ │ -000716f0: 6520 736f 6c75 7469 6f6e 2e0a 2020 3c2f e solution.. .
    • . REF: │ │ │ -00071710: 2053 4f4c 5645 504e 505f 4950 5045 2049 SOLVEPNP_IPPE I │ │ │ -00071720: 6e70 7574 2070 6f69 6e74 7320 6d75 7374 nput points must │ │ │ -00071730: 2062 6520 2667 743b 3d20 3420 616e 6420 be >= 4 and │ │ │ -00071740: 6f62 6a65 6374 2070 6f69 6e74 7320 6d75 object points mu │ │ │ -00071750: 7374 2062 6520 636f 706c 616e 6172 2e0a st be coplanar.. │ │ │ -00071760: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ -00071770: 5245 463a 2053 4f4c 5645 504e 505f 4950 REF: SOLVEPNP_IP │ │ │ -00071780: 5045 5f53 5155 4152 4520 5370 6563 6961 PE_SQUARE Specia │ │ │ -00071790: 6c20 6361 7365 2073 7569 7461 626c 6520 l case suitable │ │ │ -000717a0: 666f 7220 6d61 726b 6572 2070 6f73 6520 for marker pose │ │ │ -000717b0: 6573 7469 6d61 7469 6f6e 2e0a 4e75 6d62 estimation..Numb │ │ │ -000717c0: 6572 206f 6620 696e 7075 7420 706f 696e er of input poin │ │ │ -000717d0: 7473 206d 7573 7420 6265 2034 2e20 4f62 ts must be 4. Ob │ │ │ -000717e0: 6a65 6374 2070 6f69 6e74 7320 6d75 7374 ject points must │ │ │ -000717f0: 2062 6520 6465 6669 6e65 6420 696e 2074 be defined in t │ │ │ -00071800: 6865 2066 6f6c 6c6f 7769 6e67 206f 7264 he following ord │ │ │ -00071810: 6572 3a0a 2020 3c75 6c3e 0a20 2020 203c er:.
        . < │ │ │ -00071820: 6c69 3e0a 2020 2070 6f69 6e74 2030 3a20 li>. point 0: │ │ │ -00071830: 5b2d 7371 7561 7265 4c65 6e67 7468 202f [-squareLength / │ │ │ -00071840: 2032 2c20 2073 7175 6172 654c 656e 6774 2, squareLengt │ │ │ -00071850: 6820 2f20 322c 2030 5d0a 2020 2020 3c2f h / 2, 0]. .
      • . │ │ │ -00071870: 706f 696e 7420 313a 205b 2073 7175 6172 point 1: [ squar │ │ │ -00071880: 654c 656e 6774 6820 2f20 322c 2020 7371 eLength / 2, sq │ │ │ -00071890: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ -000718a0: 305d 0a20 2020 203c 2f6c 693e 0a20 2020 0].
      • . │ │ │ -000718b0: 203c 6c69 3e0a 2020 2070 6f69 6e74 2032
      • . point 2 │ │ │ -000718c0: 3a20 5b20 7371 7561 7265 4c65 6e67 7468 : [ squareLength │ │ │ -000718d0: 202f 2032 2c20 2d73 7175 6172 654c 656e / 2, -squareLen │ │ │ -000718e0: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ -000718f0: 3c2f 6c69 3e0a 2020 2020 3c6c 693e 0a20
      • .
      • . │ │ │ -00071900: 2020 706f 696e 7420 333a 205b 2d73 7175 point 3: [-squ │ │ │ -00071910: 6172 654c 656e 6774 6820 2f20 322c 202d areLength / 2, - │ │ │ -00071920: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ -00071930: 2c20 305d 0a20 2020 203c 2f6c 693e 0a20 , 0].
      • . │ │ │ -00071940: 203c 2f75 6c3e 0a20 203c 6c69 3e0a 2066
      .
    • . f │ │ │ -00071950: 6f72 2061 6c6c 2074 6865 206f 7468 6572 or all the other │ │ │ -00071960: 2066 6c61 6773 2c20 6e75 6d62 6572 206f flags, number o │ │ │ -00071970: 6620 696e 7075 7420 706f 696e 7473 206d f input points m │ │ │ -00071980: 7573 7420 6265 2026 6774 3b3d 2034 2061 ust be >= 4 a │ │ │ -00071990: 6e64 206f 626a 6563 7420 706f 696e 7473 nd object points │ │ │ -000719a0: 2063 616e 2062 6520 696e 2061 6e79 2063 can be in any c │ │ │ -000719b0: 6f6e 6669 6775 7261 7469 6f6e 2e0a 2020 onfiguration.. │ │ │ -000719c0: 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64 6976
    • .
    .
    .
    Paramet │ │ │ -000719f0: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    objectPoints │ │ │ -00071a10: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ -00071a20: 6f66 206f 626a 6563 7420 706f 696e 7473 of object points │ │ │ -00071a30: 2069 6e20 7468 6520 6f62 6a65 6374 2063 in the object c │ │ │ -00071a40: 6f6f 7264 696e 6174 6520 7370 6163 652c oordinate space, │ │ │ -00071a50: 204e 7833 2031 2d63 6861 6e6e 656c 206f Nx3 1-channel o │ │ │ -00071a60: 720a 3178 4e2f 4e78 3120 332d 6368 616e r.1xN/Nx1 3-chan │ │ │ -00071a70: 6e65 6c2c 2077 6865 7265 204e 2069 7320 nel, where N is │ │ │ -00071a80: 7468 6520 6e75 6d62 6572 206f 6620 706f the number of po │ │ │ -00071a90: 696e 7473 2e20 7665 6374 6f72 266c 743b ints. vector< │ │ │ -00071aa0: 506f 696e 7433 6426 6774 3b20 6361 6e20 Point3d> can │ │ │ -00071ab0: 6265 2061 6c73 6f20 7061 7373 6564 2068 be also passed h │ │ │ -00071ac0: 6572 652e 3c2f 6464 3e0a 3c64 643e 3c63 ere.
    .
    imagePoints< │ │ │ -00071ae0: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ -00071af0: 6620 636f 7272 6573 706f 6e64 696e 6720 f corresponding │ │ │ -00071b00: 696d 6167 6520 706f 696e 7473 2c20 4e78 image points, Nx │ │ │ -00071b10: 3220 312d 6368 616e 6e65 6c20 6f72 2031 2 1-channel or 1 │ │ │ -00071b20: 784e 2f4e 7831 2032 2d63 6861 6e6e 656c xN/Nx1 2-channel │ │ │ -00071b30: 2c0a 7768 6572 6520 4e20 6973 2074 6865 ,.where N is the │ │ │ -00071b40: 206e 756d 6265 7220 6f66 2070 6f69 6e74 number of point │ │ │ -00071b50: 732e 2076 6563 746f 7226 6c74 3b50 6f69 s. vector<Poi │ │ │ -00071b60: 6e74 3264 2667 743b 2063 616e 2062 6520 nt2d> can be │ │ │ -00071b70: 616c 736f 2070 6173 7365 6420 6865 7265 also passed here │ │ │ -00071b80: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    cameraMatrix - Input cam │ │ │ -00071bb0: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ -00071bc0: 7472 6978 205c 285c 6361 6d65 7261 6d61 trix \(\camerama │ │ │ -00071bd0: 7472 6978 7b41 7d5c 2920 2e3c 2f64 643e trix{A}\) .
    │ │ │ -00071be0: 0a3c 6464 3e3c 636f 6465 3e64 6973 7443 .
    distC │ │ │ -00071bf0: 6f65 6666 733c 2f63 6f64 653e 202d 2049 oeffs - I │ │ │ -00071c00: 6e70 7574 2076 6563 746f 7220 6f66 2064 nput vector of d │ │ │ -00071c10: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ -00071c20: 6369 656e 7473 0a5c 285c 6469 7374 636f cients.\(\distco │ │ │ -00071c30: 6566 6673 5c29 2e20 4966 2074 6865 2076 effs\). If the v │ │ │ -00071c40: 6563 746f 7220 6973 204e 554c 4c2f 656d ector is NULL/em │ │ │ -00071c50: 7074 792c 2074 6865 207a 6572 6f20 6469 pty, the zero di │ │ │ -00071c60: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ -00071c70: 6965 6e74 7320 6172 650a 6173 7375 6d65 ients are.assume │ │ │ -00071c80: 642e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 d.
    .
    rvec - │ │ │ -00071ca0: 4f75 7470 7574 2072 6f74 6174 696f 6e20 Output rotation │ │ │ -00071cb0: 7665 6374 6f72 2028 7365 6520 5245 463a vector (see REF: │ │ │ -00071cc0: 2052 6f64 7269 6775 6573 2029 2074 6861 Rodrigues ) tha │ │ │ -00071cd0: 742c 2074 6f67 6574 6865 7220 7769 7468 t, together with │ │ │ -00071ce0: 2074 7665 632c 2062 7269 6e67 7320 706f tvec, brings po │ │ │ -00071cf0: 696e 7473 2066 726f 6d0a 7468 6520 6d6f ints from.the mo │ │ │ -00071d00: 6465 6c20 636f 6f72 6469 6e61 7465 2073 del coordinate s │ │ │ -00071d10: 7973 7465 6d20 746f 2074 6865 2063 616d ystem to the cam │ │ │ -00071d20: 6572 6120 636f 6f72 6469 6e61 7465 2073 era coordinate s │ │ │ -00071d30: 7973 7465 6d2e 3c2f 6464 3e0a 3c64 643e ystem.
    .
    │ │ │ -00071d40: 3c63 6f64 653e 7476 6563 3c2f 636f 6465 tvec - Output trans │ │ │ -00071d60: 6c61 7469 6f6e 2076 6563 746f 722e 3c2f lation vector..
    us │ │ │ -00071d80: 6545 7874 7269 6e73 6963 4775 6573 733c eExtrinsicGuess< │ │ │ -00071d90: 2f63 6f64 653e 202d 2050 6172 616d 6574 /code> - Paramet │ │ │ -00071da0: 6572 2075 7365 6420 666f 7220 2353 4f4c er used for #SOL │ │ │ -00071db0: 5645 504e 505f 4954 4552 4154 4956 452e VEPNP_ITERATIVE. │ │ │ -00071dc0: 2049 6620 7472 7565 2028 3129 2c20 7468 If true (1), th │ │ │ -00071dd0: 6520 6675 6e63 7469 6f6e 2075 7365 730a e function uses. │ │ │ -00071de0: 7468 6520 7072 6f76 6964 6564 2072 7665 the provided rve │ │ │ -00071df0: 6320 616e 6420 7476 6563 2076 616c 7565 c and tvec value │ │ │ -00071e00: 7320 6173 2069 6e69 7469 616c 2061 7070 s as initial app │ │ │ -00071e10: 726f 7869 6d61 7469 6f6e 7320 6f66 2074 roximations of t │ │ │ -00071e20: 6865 2072 6f74 6174 696f 6e20 616e 6420 he rotation and │ │ │ -00071e30: 7472 616e 736c 6174 696f 6e0a 7665 6374 translation.vect │ │ │ -00071e40: 6f72 732c 2072 6573 7065 6374 6976 656c ors, respectivel │ │ │ -00071e50: 792c 2061 6e64 2066 7572 7468 6572 206f y, and further o │ │ │ -00071e60: 7074 696d 697a 6573 2074 6865 6d2e 3c2f ptimizes them..
    fl │ │ │ -00071e80: 6167 733c 2f63 6f64 653e 202d 204d 6574 ags - Met │ │ │ -00071e90: 686f 6420 666f 7220 736f 6c76 696e 6720 hod for solving │ │ │ -00071ea0: 6120 506e 5020 7072 6f62 6c65 6d3a 2073 a PnP problem: s │ │ │ -00071eb0: 6565 2052 4546 3a20 6361 6c69 6233 645f ee REF: calib3d_ │ │ │ -00071ec0: 736f 6c76 6550 6e50 5f66 6c61 6773 0a0a solvePnP_flags.. │ │ │ -00071ed0: 4d6f 7265 2069 6e66 6f72 6d61 7469 6f6e More information │ │ │ -00071ee0: 2061 626f 7574 2050 6572 7370 6563 7469 about Perspecti │ │ │ -00071ef0: 7665 2d6e 2d50 6f69 6e74 7320 6973 2064 ve-n-Points is d │ │ │ -00071f00: 6573 6372 6962 6564 2069 6e20 5245 463a escribed in REF: │ │ │ -00071f10: 2063 616c 6962 3364 5f73 6f6c 7665 506e calib3d_solvePn │ │ │ -00071f20: 500a 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a P..Note:. │ │ │ -00071f30: 3c75 6c3e 0a20 203c 6c69 3e0a 2020 2020
      .
    • . │ │ │ -00071f40: 2020 416e 2065 7861 6d70 6c65 206f 6620 An example of │ │ │ -00071f50: 686f 7720 746f 2075 7365 2073 6f6c 7665 how to use solve │ │ │ -00071f60: 506e 5020 666f 7220 706c 616e 6172 2061 PnP for planar a │ │ │ -00071f70: 7567 6d65 6e74 6564 2072 6561 6c69 7479 ugmented reality │ │ │ -00071f80: 2063 616e 2062 6520 666f 756e 6420 6174 can be found at │ │ │ -00071f90: 0a20 2020 2020 2020 206f 7065 6e63 765f . opencv_ │ │ │ -00071fa0: 736f 7572 6365 5f63 6f64 652f 7361 6d70 source_code/samp │ │ │ -00071fb0: 6c65 732f 7079 7468 6f6e 2f70 6c61 6e65 les/python/plane │ │ │ -00071fc0: 5f61 722e 7079 0a20 203c 2f6c 693e 0a20 _ar.py.
    • . │ │ │ -00071fd0: 203c 6c69 3e0a 2020 2020 2020 4966 2079
    • . If y │ │ │ -00071fe0: 6f75 2061 7265 2075 7369 6e67 2050 7974 ou are using Pyt │ │ │ -00071ff0: 686f 6e3a 0a20 203c 756c 3e0a 2020 2020 hon:.
        . │ │ │ -00072000: 3c6c 693e 0a20 2020 2020 2020 2020 4e75
      • . Nu │ │ │ -00072010: 6d70 7920 6172 7261 7920 736c 6963 6573 mpy array slices │ │ │ -00072020: 2077 6f6e 2774 2077 6f72 6b20 6173 2069 won't work as i │ │ │ -00072030: 6e70 7574 2062 6563 6175 7365 2073 6f6c nput because sol │ │ │ -00072040: 7665 506e 5020 7265 7175 6972 6573 2063 vePnP requires c │ │ │ -00072050: 6f6e 7469 6775 6f75 730a 2020 2020 2020 ontiguous. │ │ │ -00072060: 2020 6172 7261 7973 2028 656e 666f 7263 arrays (enforc │ │ │ -00072070: 6564 2062 7920 7468 6520 6173 7365 7274 ed by the assert │ │ │ -00072080: 696f 6e20 7573 696e 6720 6376 3a3a 4d61 ion using cv::Ma │ │ │ -00072090: 743a 3a63 6865 636b 5665 6374 6f72 2829 t::checkVector() │ │ │ -000720a0: 2061 726f 756e 6420 6c69 6e65 2035 3520 around line 55 │ │ │ -000720b0: 6f66 0a20 2020 2020 2020 206d 6f64 756c of. modul │ │ │ -000720c0: 6573 2f33 642f 7372 632f 736f 6c76 6570 es/3d/src/solvep │ │ │ -000720d0: 6e70 2e63 7070 2076 6572 7369 6f6e 2032 np.cpp version 2 │ │ │ -000720e0: 2e34 2e39 290a 2020 2020 3c2f 6c69 3e0a .4.9).
      • . │ │ │ -000720f0: 2020 2020 3c6c 693e 0a20 2020 2020 2020
      • . │ │ │ -00072100: 2020 5468 6520 5033 5020 616c 676f 7269 The P3P algori │ │ │ -00072110: 7468 6d20 7265 7175 6972 6573 2069 6d61 thm requires ima │ │ │ -00072120: 6765 2070 6f69 6e74 7320 746f 2062 6520 ge points to be │ │ │ -00072130: 696e 2061 6e20 6172 7261 7920 6f66 2073 in an array of s │ │ │ -00072140: 6861 7065 2028 4e2c 312c 3229 2064 7565 hape (N,1,2) due │ │ │ -00072150: 0a20 2020 2020 2020 2074 6f20 6974 7320 . to its │ │ │ -00072160: 6361 6c6c 696e 6720 6f66 2023 756e 6469 calling of #undi │ │ │ -00072170: 7374 6f72 7450 6f69 6e74 7320 2861 726f stortPoints (aro │ │ │ -00072180: 756e 6420 6c69 6e65 2037 3520 6f66 206d und line 75 of m │ │ │ -00072190: 6f64 756c 6573 2f33 642f 7372 632f 736f odules/3d/src/so │ │ │ -000721a0: 6c76 6570 6e70 2e63 7070 2076 6572 7369 lvepnp.cpp versi │ │ │ -000721b0: 6f6e 2032 2e34 2e39 290a 2020 2020 2020 on 2.4.9). │ │ │ -000721c0: 2020 7768 6963 6820 7265 7175 6972 6573 which requires │ │ │ -000721d0: 2032 2d63 6861 6e6e 656c 2069 6e66 6f72 2-channel infor │ │ │ -000721e0: 6d61 7469 6f6e 2e0a 2020 2020 3c2f 6c69 mation..
      • .
      • . │ │ │ -00072200: 2020 2020 5468 7573 2c20 6769 7665 6e20 Thus, given │ │ │ -00072210: 736f 6d65 2064 6174 6120 4420 3d20 6e70 some data D = np │ │ │ -00072220: 2e61 7272 6179 282e 2e2e 2920 7768 6572 .array(...) wher │ │ │ -00072230: 6520 442e 7368 6170 6520 3d20 284e 2c4d e D.shape = (N,M │ │ │ -00072240: 292c 2069 6e20 6f72 6465 7220 746f 2075 ), in order to u │ │ │ -00072250: 7365 2061 2073 7562 7365 7420 6f66 0a20 se a subset of. │ │ │ -00072260: 2020 2020 2020 2069 7420 6173 2c20 652e it as, e. │ │ │ -00072270: 672e 2c20 696d 6167 6550 6f69 6e74 732c g., imagePoints, │ │ │ -00072280: 206f 6e65 206d 7573 7420 6566 6665 6374 one must effect │ │ │ -00072290: 6976 656c 7920 636f 7079 2069 7420 696e ively copy it in │ │ │ -000722a0: 746f 2061 206e 6577 2061 7272 6179 3a20 to a new array: │ │ │ -000722b0: 696d 6167 6550 6f69 6e74 7320 3d0a 2020 imagePoints =. │ │ │ -000722c0: 2020 2020 2020 6e70 2e61 7363 6f6e 7469 np.asconti │ │ │ -000722d0: 6775 6f75 7361 7272 6179 2844 5b3a 2c3a guousarray(D[:,: │ │ │ -000722e0: 325d 292e 7265 7368 6170 6528 284e 2c31 2]).reshape((N,1 │ │ │ -000722f0: 2c32 2929 0a20 2020 203c 2f6c 693e 0a20 ,2)).
      • . │ │ │ -00072300: 203c 2f75 6c3e 0a20 203c 6c69 3e0a 2020
      .
    • . │ │ │ -00072310: 2020 2020 5468 6520 6d69 6e69 6d75 6d20 The minimum │ │ │ -00072320: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ -00072330: 2069 7320 3420 696e 2074 6865 2067 656e is 4 in the gen │ │ │ -00072340: 6572 616c 2063 6173 652e 2049 6e20 7468 eral case. In th │ │ │ -00072350: 6520 6361 7365 206f 6620 5245 463a 2053 e case of REF: S │ │ │ -00072360: 4f4c 5645 504e 505f 5033 5020 616e 6420 OLVEPNP_P3P and │ │ │ -00072370: 5245 463a 2053 4f4c 5645 504e 505f 4150 REF: SOLVEPNP_AP │ │ │ -00072380: 3350 0a20 2020 2020 2020 6d65 7468 6f64 3P. method │ │ │ -00072390: 732c 2069 7420 6973 2072 6571 7569 7265 s, it is require │ │ │ -000723a0: 6420 746f 2075 7365 2065 7861 6374 6c79 d to use exactly │ │ │ -000723b0: 2034 2070 6f69 6e74 7320 2874 6865 2066 4 points (the f │ │ │ -000723c0: 6972 7374 2033 2070 6f69 6e74 7320 6172 irst 3 points ar │ │ │ -000723d0: 6520 7573 6564 2074 6f20 6573 7469 6d61 e used to estima │ │ │ -000723e0: 7465 2061 6c6c 2074 6865 2073 6f6c 7574 te all the solut │ │ │ -000723f0: 696f 6e73 0a20 2020 2020 2020 6f66 2074 ions. of t │ │ │ -00072400: 6865 2050 3350 2070 726f 626c 656d 2c20 he P3P problem, │ │ │ -00072410: 7468 6520 6c61 7374 206f 6e65 2069 7320 the last one is │ │ │ -00072420: 7573 6564 2074 6f20 7265 7461 696e 2074 used to retain t │ │ │ -00072430: 6865 2062 6573 7420 736f 6c75 7469 6f6e he best solution │ │ │ -00072440: 2074 6861 7420 6d69 6e69 6d69 7a65 7320 that minimizes │ │ │ -00072450: 7468 6520 7265 7072 6f6a 6563 7469 6f6e the reprojection │ │ │ -00072460: 2065 7272 6f72 292e 0a20 203c 2f6c 693e error)..
    • │ │ │ -00072470: 0a20 203c 6c69 3e0a 2020 2020 2020 5769 .
    • . Wi │ │ │ -00072480: 7468 2052 4546 3a20 534f 4c56 4550 4e50 th REF: SOLVEPNP │ │ │ -00072490: 5f49 5445 5241 5449 5645 206d 6574 686f _ITERATIVE metho │ │ │ -000724a0: 6420 616e 6420 3c63 6f64 653e 7573 6545 d and useE │ │ │ -000724b0: 7874 7269 6e73 6963 4775 6573 733d 7472 xtrinsicGuess=tr │ │ │ -000724c0: 7565 3c2f 636f 6465 3e2c 2074 6865 206d ue, the m │ │ │ -000724d0: 696e 696d 756d 206e 756d 6265 7220 6f66 inimum number of │ │ │ -000724e0: 2070 6f69 6e74 7320 6973 2033 2028 3320 points is 3 (3 │ │ │ -000724f0: 706f 696e 7473 0a20 2020 2020 2020 6172 points. ar │ │ │ -00072500: 6520 7375 6666 6963 6965 6e74 2074 6f20 e sufficient to │ │ │ -00072510: 636f 6d70 7574 6520 6120 706f 7365 2062 compute a pose b │ │ │ -00072520: 7574 2074 6865 7265 2061 7265 2075 7020 ut there are up │ │ │ -00072530: 746f 2034 2073 6f6c 7574 696f 6e73 292e to 4 solutions). │ │ │ -00072540: 2054 6865 2069 6e69 7469 616c 2073 6f6c The initial sol │ │ │ -00072550: 7574 696f 6e20 7368 6f75 6c64 2062 6520 ution should be │ │ │ -00072560: 636c 6f73 6520 746f 2074 6865 0a20 2020 close to the. │ │ │ -00072570: 2020 2020 676c 6f62 616c 2073 6f6c 7574 global solut │ │ │ -00072580: 696f 6e20 746f 2063 6f6e 7665 7267 652e ion to converge. │ │ │ -00072590: 2054 6865 2066 756e 6374 696f 6e20 7265 The function re │ │ │ -000725a0: 7475 726e 7320 7472 7565 2069 6620 736f turns true if so │ │ │ -000725b0: 6d65 2073 6f6c 7574 696f 6e20 6973 2066 me solution is f │ │ │ -000725c0: 6f75 6e64 2e20 5573 6572 2063 6f64 6520 ound. User code │ │ │ -000725d0: 6973 2072 6573 706f 6e73 6962 6c65 2066 is responsible f │ │ │ -000725e0: 6f72 0a20 2020 2020 2020 736f 6c75 7469 or. soluti │ │ │ -000725f0: 6f6e 2071 7561 6c69 7479 2061 7373 6573 on quality asses │ │ │ -00072600: 736d 656e 742e 0a20 203c 2f6c 693e 0a20 sment..
    • . │ │ │ -00072610: 203c 6c69 3e0a 2020 2020 2020 5769 7468
    • . With │ │ │ -00072620: 2052 4546 3a20 534f 4c56 4550 4e50 5f49 REF: SOLVEPNP_I │ │ │ -00072630: 5050 4520 696e 7075 7420 706f 696e 7473 PPE input points │ │ │ -00072640: 206d 7573 7420 6265 2026 6774 3b3d 2034 must be >= 4 │ │ │ -00072650: 2061 6e64 206f 626a 6563 7420 706f 696e and object poin │ │ │ -00072660: 7473 206d 7573 7420 6265 2063 6f70 6c61 ts must be copla │ │ │ -00072670: 6e61 722e 0a20 203c 2f6c 693e 0a20 203c nar..
    • . < │ │ │ -00072680: 6c69 3e0a 2020 2020 2020 5769 7468 2052 li>. With R │ │ │ -00072690: 4546 3a20 534f 4c56 4550 4e50 5f49 5050 EF: SOLVEPNP_IPP │ │ │ -000726a0: 455f 5351 5541 5245 2074 6869 7320 6973 E_SQUARE this is │ │ │ -000726b0: 2061 2073 7065 6369 616c 2063 6173 6520 a special case │ │ │ -000726c0: 7375 6974 6162 6c65 2066 6f72 206d 6172 suitable for mar │ │ │ -000726d0: 6b65 7220 706f 7365 2065 7374 696d 6174 ker pose estimat │ │ │ -000726e0: 696f 6e2e 0a20 2020 2020 2020 4e75 6d62 ion.. Numb │ │ │ -000726f0: 6572 206f 6620 696e 7075 7420 706f 696e er of input poin │ │ │ -00072700: 7473 206d 7573 7420 6265 2034 2e20 4f62 ts must be 4. Ob │ │ │ -00072710: 6a65 6374 2070 6f69 6e74 7320 6d75 7374 ject points must │ │ │ -00072720: 2062 6520 6465 6669 6e65 6420 696e 2074 be defined in t │ │ │ -00072730: 6865 2066 6f6c 6c6f 7769 6e67 206f 7264 he following ord │ │ │ -00072740: 6572 3a0a 2020 3c75 6c3e 0a20 2020 203c er:.
        . < │ │ │ -00072750: 6c69 3e0a 2020 2020 2020 2020 2020 706f li>. po │ │ │ -00072760: 696e 7420 303a 205b 2d73 7175 6172 654c int 0: [-squareL │ │ │ -00072770: 656e 6774 6820 2f20 322c 2020 7371 7561 ength / 2, squa │ │ │ -00072780: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ -00072790: 0a20 2020 203c 2f6c 693e 0a20 2020 203c . . < │ │ │ -000727a0: 6c69 3e0a 2020 2020 2020 2020 2020 706f li>. po │ │ │ -000727b0: 696e 7420 313a 205b 2073 7175 6172 654c int 1: [ squareL │ │ │ -000727c0: 656e 6774 6820 2f20 322c 2020 7371 7561 ength / 2, squa │ │ │ -000727d0: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ -000727e0: 0a20 2020 203c 2f6c 693e 0a20 2020 203c . . < │ │ │ -000727f0: 6c69 3e0a 2020 2020 2020 2020 2020 706f li>. po │ │ │ -00072800: 696e 7420 323a 205b 2073 7175 6172 654c int 2: [ squareL │ │ │ -00072810: 656e 6774 6820 2f20 322c 202d 7371 7561 ength / 2, -squa │ │ │ -00072820: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ -00072830: 0a20 2020 203c 2f6c 693e 0a20 2020 203c . . < │ │ │ -00072840: 6c69 3e0a 2020 2020 2020 2020 2020 706f li>. po │ │ │ -00072850: 696e 7420 333a 205b 2d73 7175 6172 654c int 3: [-squareL │ │ │ -00072860: 656e 6774 6820 2f20 322c 202d 7371 7561 ength / 2, -squa │ │ │ -00072870: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ -00072880: 0a20 2020 203c 2f6c 693e 0a20 203c 2f75 . . .
          . . With RE │ │ │ -000728b0: 463a 2053 4f4c 5645 504e 505f 5351 504e F: SOLVEPNP_SQPN │ │ │ -000728c0: 5020 696e 7075 7420 706f 696e 7473 206d P input points m │ │ │ -000728d0: 7573 7420 6265 2026 6774 3b3d 2033 0a20 ust be >= 3. │ │ │ -000728e0: 2020 203c 2f6c 693e 0a20 203c 2f75 6c3e .
        │ │ │ -000728f0: 0a20 203c 2f6c 693e 0a3c 2f75 6c3e 3c2f . .
      .
      Returns: │ │ │ -00072910: 3c2f 6474 3e0a 3c64 643e 6175 746f 6d61
      .
      automa │ │ │ -00072920: 7469 6361 6c6c 7920 6765 6e65 7261 7465 tically generate │ │ │ -00072930: 643c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 d
      .
    ...< │ │ │ -00072950: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    │ │ │ -00072a20: 736f 6c76 6550 6e50 3c2f 6833 3e0a 3c64 solvePnP

    ..public stati │ │ │ -00072a90: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c boolean< │ │ │ -00072ac0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> solvePnP< │ │ │ -00072af0: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(MatOfP │ │ │ -00072b60: 6f69 6e74 3366 3c2f 613e 266e 6273 703b oint3f  │ │ │ -00072b70: 6f62 6a65 6374 506f 696e 7473 2c0a 203c objectPoints,. < │ │ │ -00072b80: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00072b90: 4d61 744f 6650 6f69 6e74 3266 2e68 746d MatOfPoint2f.htm │ │ │ -00072ba0: 6c22 2074 6974 6c65 3d22 636c 6173 7320 l" title="class │ │ │ -00072bb0: 696e 206f 7267 2e6f 7065 6e63 762e 636f in org.opencv.co │ │ │ -00072bc0: 7265 223e 4d61 744f 6650 6f69 6e74 3266 re">MatOfPoint2f │ │ │ -00072bd0: 3c2f 613e 266e 6273 703b 696d 6167 6550  imageP │ │ │ -00072be0: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ -00072c30: 3b63 616d 6572 614d 6174 7269 782c 0a20 ;cameraMatrix,. │ │ │ -00072c40: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfDouble< │ │ │ -00072c90: 2f61 3e26 6e62 7370 3b64 6973 7443 6f65 /a> distCoe │ │ │ -00072ca0: 6666 732c 0a20 3c61 2068 7265 663d 222e ffs,. Mat r │ │ │ -00072cf0: 7665 632c 0a20 3c61 2068 7265 663d 222e vec,. Mat t │ │ │ -00072d40: 7665 632c 0a20 626f 6f6c 6561 6e26 6e62 vec,. boolean&nb │ │ │ -00072d50: 7370 3b75 7365 4578 7472 696e 7369 6347 sp;useExtrinsicG │ │ │ -00072d60: 7565 7373 293c 2f73 7061 6e3e 3c2f 6469 uess).
    Finds an o │ │ │ -00072d90: 626a 6563 7420 706f 7365 205c 2820 7b7d bject pose \( {} │ │ │ -00072da0: 5e7b 637d 5c6d 6174 6862 667b 547d 5f6f ^{c}\mathbf{T}_o │ │ │ -00072db0: 205c 2920 6672 6f6d 2033 442d 3244 2070 \) from 3D-2D p │ │ │ -00072dc0: 6f69 6e74 2063 6f72 7265 7370 6f6e 6465 oint corresponde │ │ │ -00072dd0: 6e63 6573 3a0a 0a21 5b50 6572 7370 6563 nces:..![Perspec │ │ │ -00072de0: 7469 7665 2070 726f 6a65 6374 696f 6e2c tive projection, │ │ │ -00072df0: 2066 726f 6d20 6f62 6a65 6374 2074 6f20 from object to │ │ │ -00072e00: 6361 6d65 7261 2066 7261 6d65 5d28 7069 camera frame](pi │ │ │ -00072e10: 6373 2f70 696e 686f 6c65 5f68 6f6d 6f67 cs/pinhole_homog │ │ │ -00072e20: 656e 656f 7573 5f74 7261 6e73 666f 726d eneous_transform │ │ │ -00072e30: 6174 696f 6e2e 6a70 6729 7b20 7769 6474 ation.jpg){ widt │ │ │ -00072e40: 683d 3530 2520 7d0a 0a53 4545 3a20 5245 h=50% }..SEE: RE │ │ │ -00072e50: 463a 2063 616c 6962 3364 5f73 6f6c 7665 F: calib3d_solve │ │ │ -00072e60: 506e 500a 0a54 6869 7320 6675 6e63 7469 PnP..This functi │ │ │ -00072e70: 6f6e 2072 6574 7572 6e73 2074 6865 2072 on returns the r │ │ │ -00072e80: 6f74 6174 696f 6e20 616e 6420 7468 6520 otation and the │ │ │ -00072e90: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ -00072ea0: 6f72 7320 7468 6174 2074 7261 6e73 666f ors that transfo │ │ │ -00072eb0: 726d 2061 2033 4420 706f 696e 7420 6578 rm a 3D point ex │ │ │ -00072ec0: 7072 6573 7365 6420 696e 2074 6865 206f pressed in the o │ │ │ -00072ed0: 626a 6563 740a 636f 6f72 6469 6e61 7465 bject.coordinate │ │ │ -00072ee0: 2066 7261 6d65 2074 6f20 7468 6520 6361 frame to the ca │ │ │ -00072ef0: 6d65 7261 2063 6f6f 7264 696e 6174 6520 mera coordinate │ │ │ -00072f00: 6672 616d 652c 2075 7369 6e67 2064 6966 frame, using dif │ │ │ -00072f10: 6665 7265 6e74 206d 6574 686f 6473 3a0a ferent methods:. │ │ │ -00072f20: 3c75 6c3e 0a20 203c 6c69 3e0a 2050 3350
      .
    • . P3P │ │ │ -00072f30: 206d 6574 686f 6473 2028 5245 463a 2053 methods (REF: S │ │ │ -00072f40: 4f4c 5645 504e 505f 5033 502c 2052 4546 OLVEPNP_P3P, REF │ │ │ -00072f50: 3a20 534f 4c56 4550 4e50 5f41 5033 5029 : SOLVEPNP_AP3P) │ │ │ -00072f60: 3a20 6e65 6564 2034 2069 6e70 7574 2070 : need 4 input p │ │ │ -00072f70: 6f69 6e74 7320 746f 2072 6574 7572 6e20 oints to return │ │ │ -00072f80: 6120 756e 6971 7565 2073 6f6c 7574 696f a unique solutio │ │ │ -00072f90: 6e2e 0a20 203c 2f6c 693e 0a20 203c 6c69 n..
    • .
    • . REF: SOLVEPNP │ │ │ -00072fb0: 5f49 5050 4520 496e 7075 7420 706f 696e _IPPE Input poin │ │ │ -00072fc0: 7473 206d 7573 7420 6265 2026 6774 3b3d ts must be >= │ │ │ -00072fd0: 2034 2061 6e64 206f 626a 6563 7420 706f 4 and object po │ │ │ -00072fe0: 696e 7473 206d 7573 7420 6265 2063 6f70 ints must be cop │ │ │ -00072ff0: 6c61 6e61 722e 0a20 203c 2f6c 693e 0a20 lanar..
    • . │ │ │ -00073000: 203c 6c69 3e0a 2052 4546 3a20 534f 4c56
    • . REF: SOLV │ │ │ -00073010: 4550 4e50 5f49 5050 455f 5351 5541 5245 EPNP_IPPE_SQUARE │ │ │ -00073020: 2053 7065 6369 616c 2063 6173 6520 7375 Special case su │ │ │ -00073030: 6974 6162 6c65 2066 6f72 206d 6172 6b65 itable for marke │ │ │ -00073040: 7220 706f 7365 2065 7374 696d 6174 696f r pose estimatio │ │ │ -00073050: 6e2e 0a4e 756d 6265 7220 6f66 2069 6e70 n..Number of inp │ │ │ -00073060: 7574 2070 6f69 6e74 7320 6d75 7374 2062 ut points must b │ │ │ -00073070: 6520 342e 204f 626a 6563 7420 706f 696e e 4. Object poin │ │ │ -00073080: 7473 206d 7573 7420 6265 2064 6566 696e ts must be defin │ │ │ -00073090: 6564 2069 6e20 7468 6520 666f 6c6c 6f77 ed in the follow │ │ │ -000730a0: 696e 6720 6f72 6465 723a 0a20 203c 756c ing order:.
        .
      • . po │ │ │ -000730c0: 696e 7420 303a 205b 2d73 7175 6172 654c int 0: [-squareL │ │ │ -000730d0: 656e 6774 6820 2f20 322c 2020 7371 7561 ength / 2, squa │ │ │ -000730e0: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ -000730f0: 0a20 2020 203c 2f6c 693e 0a20 2020 203c .
      • . < │ │ │ -00073100: 6c69 3e0a 2020 2070 6f69 6e74 2031 3a20 li>. point 1: │ │ │ -00073110: 5b20 7371 7561 7265 4c65 6e67 7468 202f [ squareLength / │ │ │ -00073120: 2032 2c20 2073 7175 6172 654c 656e 6774 2, squareLengt │ │ │ -00073130: 6820 2f20 322c 2030 5d0a 2020 2020 3c2f h / 2, 0]. .
      • . │ │ │ -00073150: 706f 696e 7420 323a 205b 2073 7175 6172 point 2: [ squar │ │ │ -00073160: 654c 656e 6774 6820 2f20 322c 202d 7371 eLength / 2, -sq │ │ │ -00073170: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ -00073180: 305d 0a20 2020 203c 2f6c 693e 0a20 2020 0].
      • . │ │ │ -00073190: 203c 6c69 3e0a 2020 2070 6f69 6e74 2033
      • . point 3 │ │ │ -000731a0: 3a20 5b2d 7371 7561 7265 4c65 6e67 7468 : [-squareLength │ │ │ -000731b0: 202f 2032 2c20 2d73 7175 6172 654c 656e / 2, -squareLen │ │ │ -000731c0: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ -000731d0: 3c2f 6c69 3e0a 2020 3c2f 756c 3e0a 2020
      • .
      . │ │ │ -000731e0: 3c6c 693e 0a20 666f 7220 616c 6c20 7468
    • . for all th │ │ │ -000731f0: 6520 6f74 6865 7220 666c 6167 732c 206e e other flags, n │ │ │ -00073200: 756d 6265 7220 6f66 2069 6e70 7574 2070 umber of input p │ │ │ -00073210: 6f69 6e74 7320 6d75 7374 2062 6520 2667 oints must be &g │ │ │ -00073220: 743b 3d20 3420 616e 6420 6f62 6a65 6374 t;= 4 and object │ │ │ -00073230: 2070 6f69 6e74 7320 6361 6e20 6265 2069 points can be i │ │ │ -00073240: 6e20 616e 7920 636f 6e66 6967 7572 6174 n any configurat │ │ │ -00073250: 696f 6e2e 0a20 203c 2f6c 693e 0a3c 2f75 ion..
    • .
    .
    .
    │ │ │ -00073280: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ -00073290: 0a3c 6464 3e3c 636f 6465 3e6f 626a 6563 .
    objec │ │ │ -000732a0: 7450 6f69 6e74 733c 2f63 6f64 653e 202d tPoints - │ │ │ -000732b0: 2041 7272 6179 206f 6620 6f62 6a65 6374 Array of object │ │ │ -000732c0: 2070 6f69 6e74 7320 696e 2074 6865 206f points in the o │ │ │ -000732d0: 626a 6563 7420 636f 6f72 6469 6e61 7465 bject coordinate │ │ │ -000732e0: 2073 7061 6365 2c20 4e78 3320 312d 6368 space, Nx3 1-ch │ │ │ -000732f0: 616e 6e65 6c20 6f72 0a31 784e 2f4e 7831 annel or.1xN/Nx1 │ │ │ -00073300: 2033 2d63 6861 6e6e 656c 2c20 7768 6572 3-channel, wher │ │ │ -00073310: 6520 4e20 6973 2074 6865 206e 756d 6265 e N is the numbe │ │ │ -00073320: 7220 6f66 2070 6f69 6e74 732e 2076 6563 r of points. vec │ │ │ -00073330: 746f 7226 6c74 3b50 6f69 6e74 3364 2667 tor<Point3d&g │ │ │ -00073340: 743b 2063 616e 2062 6520 616c 736f 2070 t; can be also p │ │ │ -00073350: 6173 7365 6420 6865 7265 2e3c 2f64 643e assed here.
    │ │ │ -00073360: 0a3c 6464 3e3c 636f 6465 3e69 6d61 6765 .
    image │ │ │ -00073370: 506f 696e 7473 3c2f 636f 6465 3e20 2d20 Points - │ │ │ -00073380: 4172 7261 7920 6f66 2063 6f72 7265 7370 Array of corresp │ │ │ -00073390: 6f6e 6469 6e67 2069 6d61 6765 2070 6f69 onding image poi │ │ │ -000733a0: 6e74 732c 204e 7832 2031 2d63 6861 6e6e nts, Nx2 1-chann │ │ │ -000733b0: 656c 206f 7220 3178 4e2f 4e78 3120 322d el or 1xN/Nx1 2- │ │ │ -000733c0: 6368 616e 6e65 6c2c 0a77 6865 7265 204e channel,.where N │ │ │ -000733d0: 2069 7320 7468 6520 6e75 6d62 6572 206f is the number o │ │ │ -000733e0: 6620 706f 696e 7473 2e20 7665 6374 6f72 f points. vector │ │ │ -000733f0: 266c 743b 506f 696e 7432 6426 6774 3b20 <Point2d> │ │ │ -00073400: 6361 6e20 6265 2061 6c73 6f20 7061 7373 can be also pass │ │ │ -00073410: 6564 2068 6572 652e 3c2f 6464 3e0a 3c64 ed here.
    .cameraMa │ │ │ -00073430: 7472 6978 3c2f 636f 6465 3e20 2d20 496e trix - In │ │ │ -00073440: 7075 7420 6361 6d65 7261 2069 6e74 7269 put camera intri │ │ │ -00073450: 6e73 6963 206d 6174 7269 7820 5c28 5c63 nsic matrix \(\c │ │ │ -00073460: 616d 6572 616d 6174 7269 787b 417d 5c29 ameramatrix{A}\) │ │ │ -00073470: 202e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 ..
    distCoeffs - Input vect │ │ │ -000734a0: 6f72 206f 6620 6469 7374 6f72 7469 6f6e or of distortion │ │ │ -000734b0: 2063 6f65 6666 6963 6965 6e74 730a 5c28 coefficients.\( │ │ │ -000734c0: 5c64 6973 7463 6f65 6666 735c 292e 2049 \distcoeffs\). I │ │ │ -000734d0: 6620 7468 6520 7665 6374 6f72 2069 7320 f the vector is │ │ │ -000734e0: 4e55 4c4c 2f65 6d70 7479 2c20 7468 6520 NULL/empty, the │ │ │ -000734f0: 7a65 726f 2064 6973 746f 7274 696f 6e20 zero distortion │ │ │ -00073500: 636f 6566 6669 6369 656e 7473 2061 7265 coefficients are │ │ │ -00073510: 0a61 7373 756d 6564 2e3c 2f64 643e 0a3c .assumed.
    .< │ │ │ -00073520: 6464 3e3c 636f 6465 3e72 7665 633c 2f63 dd>rvec - Output ro │ │ │ -00073540: 7461 7469 6f6e 2076 6563 746f 7220 2873 tation vector (s │ │ │ -00073550: 6565 2052 4546 3a20 526f 6472 6967 7565 ee REF: Rodrigue │ │ │ -00073560: 7320 2920 7468 6174 2c20 746f 6765 7468 s ) that, togeth │ │ │ -00073570: 6572 2077 6974 6820 7476 6563 2c20 6272 er with tvec, br │ │ │ -00073580: 696e 6773 2070 6f69 6e74 7320 6672 6f6d ings points from │ │ │ -00073590: 0a74 6865 206d 6f64 656c 2063 6f6f 7264 .the model coord │ │ │ -000735a0: 696e 6174 6520 7379 7374 656d 2074 6f20 inate system to │ │ │ -000735b0: 7468 6520 6361 6d65 7261 2063 6f6f 7264 the camera coord │ │ │ -000735c0: 696e 6174 6520 7379 7374 656d 2e3c 2f64 inate system.
    .
    tve │ │ │ -000735e0: 633c 2f63 6f64 653e 202d 204f 7574 7075 c - Outpu │ │ │ -000735f0: 7420 7472 616e 736c 6174 696f 6e20 7665 t translation ve │ │ │ -00073600: 6374 6f72 2e3c 2f64 643e 0a3c 6464 3e3c ctor.
    .
    < │ │ │ -00073610: 636f 6465 3e75 7365 4578 7472 696e 7369 code>useExtrinsi │ │ │ -00073620: 6347 7565 7373 3c2f 636f 6465 3e20 2d20 cGuess - │ │ │ -00073630: 5061 7261 6d65 7465 7220 7573 6564 2066 Parameter used f │ │ │ -00073640: 6f72 2023 534f 4c56 4550 4e50 5f49 5445 or #SOLVEPNP_ITE │ │ │ -00073650: 5241 5449 5645 2e20 4966 2074 7275 6520 RATIVE. If true │ │ │ -00073660: 2831 292c 2074 6865 2066 756e 6374 696f (1), the functio │ │ │ -00073670: 6e20 7573 6573 0a74 6865 2070 726f 7669 n uses.the provi │ │ │ -00073680: 6465 6420 7276 6563 2061 6e64 2074 7665 ded rvec and tve │ │ │ -00073690: 6320 7661 6c75 6573 2061 7320 696e 6974 c values as init │ │ │ -000736a0: 6961 6c20 6170 7072 6f78 696d 6174 696f ial approximatio │ │ │ -000736b0: 6e73 206f 6620 7468 6520 726f 7461 7469 ns of the rotati │ │ │ -000736c0: 6f6e 2061 6e64 2074 7261 6e73 6c61 7469 on and translati │ │ │ -000736d0: 6f6e 0a76 6563 746f 7273 2c20 7265 7370 on.vectors, resp │ │ │ -000736e0: 6563 7469 7665 6c79 2c20 616e 6420 6675 ectively, and fu │ │ │ -000736f0: 7274 6865 7220 6f70 7469 6d69 7a65 7320 rther optimizes │ │ │ -00073700: 7468 656d 2e0a 0a4d 6f72 6520 696e 666f them...More info │ │ │ -00073710: 726d 6174 696f 6e20 6162 6f75 7420 5065 rmation about Pe │ │ │ -00073720: 7273 7065 6374 6976 652d 6e2d 506f 696e rspective-n-Poin │ │ │ -00073730: 7473 2069 7320 6465 7363 7269 6265 6420 ts is described │ │ │ -00073740: 696e 2052 4546 3a20 6361 6c69 6233 645f in REF: calib3d_ │ │ │ -00073750: 736f 6c76 6550 6e50 0a0a 3c62 3e4e 6f74 solvePnP..Not │ │ │ -00073760: 653a 3c2f 623e 0a3c 756c 3e0a 2020 3c6c e:.
      . . An exam │ │ │ -00073780: 706c 6520 6f66 2068 6f77 2074 6f20 7573 ple of how to us │ │ │ -00073790: 6520 736f 6c76 6550 6e50 2066 6f72 2070 e solvePnP for p │ │ │ -000737a0: 6c61 6e61 7220 6175 676d 656e 7465 6420 lanar augmented │ │ │ -000737b0: 7265 616c 6974 7920 6361 6e20 6265 2066 reality can be f │ │ │ -000737c0: 6f75 6e64 2061 740a 2020 2020 2020 2020 ound at. │ │ │ -000737d0: 6f70 656e 6376 5f73 6f75 7263 655f 636f opencv_source_co │ │ │ -000737e0: 6465 2f73 616d 706c 6573 2f70 7974 686f de/samples/pytho │ │ │ -000737f0: 6e2f 706c 616e 655f 6172 2e70 790a 2020 n/plane_ar.py. │ │ │ -00073800: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020 .
    • . │ │ │ -00073810: 2020 2049 6620 796f 7520 6172 6520 7573 If you are us │ │ │ -00073820: 696e 6720 5079 7468 6f6e 3a0a 2020 3c75 ing Python:. .
    • . │ │ │ -00073840: 2020 2020 204e 756d 7079 2061 7272 6179 Numpy array │ │ │ -00073850: 2073 6c69 6365 7320 776f 6e27 7420 776f slices won't wo │ │ │ -00073860: 726b 2061 7320 696e 7075 7420 6265 6361 rk as input beca │ │ │ -00073870: 7573 6520 736f 6c76 6550 6e50 2072 6571 use solvePnP req │ │ │ -00073880: 7569 7265 7320 636f 6e74 6967 756f 7573 uires contiguous │ │ │ -00073890: 0a20 2020 2020 2020 2061 7272 6179 7320 . arrays │ │ │ -000738a0: 2865 6e66 6f72 6365 6420 6279 2074 6865 (enforced by the │ │ │ -000738b0: 2061 7373 6572 7469 6f6e 2075 7369 6e67 assertion using │ │ │ -000738c0: 2063 763a 3a4d 6174 3a3a 6368 6563 6b56 cv::Mat::checkV │ │ │ -000738d0: 6563 746f 7228 2920 6172 6f75 6e64 206c ector() around l │ │ │ -000738e0: 696e 6520 3535 206f 660a 2020 2020 2020 ine 55 of. │ │ │ -000738f0: 2020 6d6f 6475 6c65 732f 3364 2f73 7263 modules/3d/src │ │ │ -00073900: 2f73 6f6c 7665 706e 702e 6370 7020 7665 /solvepnp.cpp ve │ │ │ -00073910: 7273 696f 6e20 322e 342e 3929 0a20 2020 rsion 2.4.9). │ │ │ -00073920: 203c 2f6c 693e 0a20 2020 203c 6c69 3e0a
    • .
    • . │ │ │ -00073930: 2020 2020 2020 2020 2054 6865 2050 3350 The P3P │ │ │ -00073940: 2061 6c67 6f72 6974 686d 2072 6571 7569 algorithm requi │ │ │ -00073950: 7265 7320 696d 6167 6520 706f 696e 7473 res image points │ │ │ -00073960: 2074 6f20 6265 2069 6e20 616e 2061 7272 to be in an arr │ │ │ -00073970: 6179 206f 6620 7368 6170 6520 284e 2c31 ay of shape (N,1 │ │ │ -00073980: 2c32 2920 6475 650a 2020 2020 2020 2020 ,2) due. │ │ │ -00073990: 746f 2069 7473 2063 616c 6c69 6e67 206f to its calling o │ │ │ -000739a0: 6620 2375 6e64 6973 746f 7274 506f 696e f #undistortPoin │ │ │ -000739b0: 7473 2028 6172 6f75 6e64 206c 696e 6520 ts (around line │ │ │ -000739c0: 3735 206f 6620 6d6f 6475 6c65 732f 3364 75 of modules/3d │ │ │ -000739d0: 2f73 7263 2f73 6f6c 7665 706e 702e 6370 /src/solvepnp.cp │ │ │ -000739e0: 7020 7665 7273 696f 6e20 322e 342e 3929 p version 2.4.9) │ │ │ -000739f0: 0a20 2020 2020 2020 2077 6869 6368 2072 . which r │ │ │ -00073a00: 6571 7569 7265 7320 322d 6368 616e 6e65 equires 2-channe │ │ │ -00073a10: 6c20 696e 666f 726d 6174 696f 6e2e 0a20 l information.. │ │ │ -00073a20: 2020 203c 2f6c 693e 0a20 2020 203c 6c69
    • .
    • . Thus, │ │ │ -00073a40: 2067 6976 656e 2073 6f6d 6520 6461 7461 given some data │ │ │ -00073a50: 2044 203d 206e 702e 6172 7261 7928 2e2e D = np.array(.. │ │ │ -00073a60: 2e29 2077 6865 7265 2044 2e73 6861 7065 .) where D.shape │ │ │ -00073a70: 203d 2028 4e2c 4d29 2c20 696e 206f 7264 = (N,M), in ord │ │ │ -00073a80: 6572 2074 6f20 7573 6520 6120 7375 6273 er to use a subs │ │ │ -00073a90: 6574 206f 660a 2020 2020 2020 2020 6974 et of. it │ │ │ -00073aa0: 2061 732c 2065 2e67 2e2c 2069 6d61 6765 as, e.g., image │ │ │ -00073ab0: 506f 696e 7473 2c20 6f6e 6520 6d75 7374 Points, one must │ │ │ -00073ac0: 2065 6666 6563 7469 7665 6c79 2063 6f70 effectively cop │ │ │ -00073ad0: 7920 6974 2069 6e74 6f20 6120 6e65 7720 y it into a new │ │ │ -00073ae0: 6172 7261 793a 2069 6d61 6765 506f 696e array: imagePoin │ │ │ -00073af0: 7473 203d 0a20 2020 2020 2020 206e 702e ts =. np. │ │ │ -00073b00: 6173 636f 6e74 6967 756f 7573 6172 7261 ascontiguousarra │ │ │ -00073b10: 7928 445b 3a2c 3a32 5d29 2e72 6573 6861 y(D[:,:2]).resha │ │ │ -00073b20: 7065 2828 4e2c 312c 3229 290a 2020 2020 pe((N,1,2)). │ │ │ -00073b30: 3c2f 6c69 3e0a 2020 3c2f 756c 3e0a 2020
    • .
    . │ │ │ -00073b40: 3c6c 693e 0a20 2020 2020 2054 6865 206d
  • . The m │ │ │ -00073b50: 696e 696d 756d 206e 756d 6265 7220 6f66 inimum number of │ │ │ -00073b60: 2070 6f69 6e74 7320 6973 2034 2069 6e20 points is 4 in │ │ │ -00073b70: 7468 6520 6765 6e65 7261 6c20 6361 7365 the general case │ │ │ -00073b80: 2e20 496e 2074 6865 2063 6173 6520 6f66 . In the case of │ │ │ -00073b90: 2052 4546 3a20 534f 4c56 4550 4e50 5f50 REF: SOLVEPNP_P │ │ │ -00073ba0: 3350 2061 6e64 2052 4546 3a20 534f 4c56 3P and REF: SOLV │ │ │ -00073bb0: 4550 4e50 5f41 5033 500a 2020 2020 2020 EPNP_AP3P. │ │ │ -00073bc0: 206d 6574 686f 6473 2c20 6974 2069 7320 methods, it is │ │ │ -00073bd0: 7265 7175 6972 6564 2074 6f20 7573 6520 required to use │ │ │ -00073be0: 6578 6163 746c 7920 3420 706f 696e 7473 exactly 4 points │ │ │ -00073bf0: 2028 7468 6520 6669 7273 7420 3320 706f (the first 3 po │ │ │ -00073c00: 696e 7473 2061 7265 2075 7365 6420 746f ints are used to │ │ │ -00073c10: 2065 7374 696d 6174 6520 616c 6c20 7468 estimate all th │ │ │ -00073c20: 6520 736f 6c75 7469 6f6e 730a 2020 2020 e solutions. │ │ │ -00073c30: 2020 206f 6620 7468 6520 5033 5020 7072 of the P3P pr │ │ │ -00073c40: 6f62 6c65 6d2c 2074 6865 206c 6173 7420 oblem, the last │ │ │ -00073c50: 6f6e 6520 6973 2075 7365 6420 746f 2072 one is used to r │ │ │ -00073c60: 6574 6169 6e20 7468 6520 6265 7374 2073 etain the best s │ │ │ -00073c70: 6f6c 7574 696f 6e20 7468 6174 206d 696e olution that min │ │ │ -00073c80: 696d 697a 6573 2074 6865 2072 6570 726f imizes the repro │ │ │ -00073c90: 6a65 6374 696f 6e20 6572 726f 7229 2e0a jection error).. │ │ │ -00073ca0: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
  • .
  • . │ │ │ -00073cb0: 2020 2020 2057 6974 6820 5245 463a 2053 With REF: S │ │ │ -00073cc0: 4f4c 5645 504e 505f 4954 4552 4154 4956 OLVEPNP_ITERATIV │ │ │ -00073cd0: 4520 6d65 7468 6f64 2061 6e64 203c 636f E method and useExtrinsicG │ │ │ -00073cf0: 7565 7373 3d74 7275 653c 2f63 6f64 653e uess=true │ │ │ -00073d00: 2c20 7468 6520 6d69 6e69 6d75 6d20 6e75 , the minimum nu │ │ │ -00073d10: 6d62 6572 206f 6620 706f 696e 7473 2069 mber of points i │ │ │ -00073d20: 7320 3320 2833 2070 6f69 6e74 730a 2020 s 3 (3 points. │ │ │ -00073d30: 2020 2020 2061 7265 2073 7566 6669 6369 are suffici │ │ │ -00073d40: 656e 7420 746f 2063 6f6d 7075 7465 2061 ent to compute a │ │ │ -00073d50: 2070 6f73 6520 6275 7420 7468 6572 6520 pose but there │ │ │ -00073d60: 6172 6520 7570 2074 6f20 3420 736f 6c75 are up to 4 solu │ │ │ -00073d70: 7469 6f6e 7329 2e20 5468 6520 696e 6974 tions). The init │ │ │ -00073d80: 6961 6c20 736f 6c75 7469 6f6e 2073 686f ial solution sho │ │ │ -00073d90: 756c 6420 6265 2063 6c6f 7365 2074 6f20 uld be close to │ │ │ -00073da0: 7468 650a 2020 2020 2020 2067 6c6f 6261 the. globa │ │ │ -00073db0: 6c20 736f 6c75 7469 6f6e 2074 6f20 636f l solution to co │ │ │ -00073dc0: 6e76 6572 6765 2e20 5468 6520 6675 6e63 nverge. The func │ │ │ -00073dd0: 7469 6f6e 2072 6574 7572 6e73 2074 7275 tion returns tru │ │ │ -00073de0: 6520 6966 2073 6f6d 6520 736f 6c75 7469 e if some soluti │ │ │ -00073df0: 6f6e 2069 7320 666f 756e 642e 2055 7365 on is found. Use │ │ │ -00073e00: 7220 636f 6465 2069 7320 7265 7370 6f6e r code is respon │ │ │ -00073e10: 7369 626c 6520 666f 720a 2020 2020 2020 sible for. │ │ │ -00073e20: 2073 6f6c 7574 696f 6e20 7175 616c 6974 solution qualit │ │ │ -00073e30: 7920 6173 7365 7373 6d65 6e74 2e0a 2020 y assessment.. │ │ │ -00073e40: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020
  • .
  • . │ │ │ -00073e50: 2020 2057 6974 6820 5245 463a 2053 4f4c With REF: SOL │ │ │ -00073e60: 5645 504e 505f 4950 5045 2069 6e70 7574 VEPNP_IPPE input │ │ │ -00073e70: 2070 6f69 6e74 7320 6d75 7374 2062 6520 points must be │ │ │ -00073e80: 2667 743b 3d20 3420 616e 6420 6f62 6a65 >= 4 and obje │ │ │ -00073e90: 6374 2070 6f69 6e74 7320 6d75 7374 2062 ct points must b │ │ │ -00073ea0: 6520 636f 706c 616e 6172 2e0a 2020 3c2f e coplanar.. .
  • . │ │ │ -00073ec0: 2057 6974 6820 5245 463a 2053 4f4c 5645 With REF: SOLVE │ │ │ -00073ed0: 504e 505f 4950 5045 5f53 5155 4152 4520 PNP_IPPE_SQUARE │ │ │ -00073ee0: 7468 6973 2069 7320 6120 7370 6563 6961 this is a specia │ │ │ -00073ef0: 6c20 6361 7365 2073 7569 7461 626c 6520 l case suitable │ │ │ -00073f00: 666f 7220 6d61 726b 6572 2070 6f73 6520 for marker pose │ │ │ -00073f10: 6573 7469 6d61 7469 6f6e 2e0a 2020 2020 estimation.. │ │ │ -00073f20: 2020 204e 756d 6265 7220 6f66 2069 6e70 Number of inp │ │ │ -00073f30: 7574 2070 6f69 6e74 7320 6d75 7374 2062 ut points must b │ │ │ -00073f40: 6520 342e 204f 626a 6563 7420 706f 696e e 4. Object poin │ │ │ -00073f50: 7473 206d 7573 7420 6265 2064 6566 696e ts must be defin │ │ │ -00073f60: 6564 2069 6e20 7468 6520 666f 6c6c 6f77 ed in the follow │ │ │ -00073f70: 696e 6720 6f72 6465 723a 0a20 203c 756c ing order:.
      .
    • . │ │ │ -00073f90: 2020 2020 2070 6f69 6e74 2030 3a20 5b2d point 0: [- │ │ │ -00073fa0: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ -00073fb0: 2c20 2073 7175 6172 654c 656e 6774 6820 , squareLength │ │ │ -00073fc0: 2f20 322c 2030 5d0a 2020 2020 3c2f 6c69 / 2, 0].
    • .
    • . │ │ │ -00073fe0: 2020 2020 2070 6f69 6e74 2031 3a20 5b20 point 1: [ │ │ │ -00073ff0: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ -00074000: 2c20 2073 7175 6172 654c 656e 6774 6820 , squareLength │ │ │ -00074010: 2f20 322c 2030 5d0a 2020 2020 3c2f 6c69 / 2, 0].
    • .
    • . │ │ │ -00074030: 2020 2020 2070 6f69 6e74 2032 3a20 5b20 point 2: [ │ │ │ -00074040: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ -00074050: 2c20 2d73 7175 6172 654c 656e 6774 6820 , -squareLength │ │ │ -00074060: 2f20 322c 2030 5d0a 2020 2020 3c2f 6c69 / 2, 0].
    • .
    • . │ │ │ -00074080: 2020 2020 2070 6f69 6e74 2033 3a20 5b2d point 3: [- │ │ │ -00074090: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ -000740a0: 2c20 2d73 7175 6172 654c 656e 6774 6820 , -squareLength │ │ │ -000740b0: 2f20 322c 2030 5d0a 2020 2020 3c2f 6c69 / 2, 0].
    • .
    .
      │ │ │ -000740d0: 0a20 2020 203c 6c69 3e0a 2020 2020 2020 .
    • . │ │ │ -000740e0: 5769 7468 2052 4546 3a20 534f 4c56 4550 With REF: SOLVEP │ │ │ -000740f0: 4e50 5f53 5150 4e50 2069 6e70 7574 2070 NP_SQPNP input p │ │ │ -00074100: 6f69 6e74 7320 6d75 7374 2062 6520 2667 oints must be &g │ │ │ -00074110: 743b 3d20 330a 2020 2020 3c2f 6c69 3e0a t;= 3.
    • . │ │ │ -00074120: 2020 3c2f 756c 3e0a 2020 3c2f 6c69 3e0a
    .
  • . │ │ │ -00074130: 3c2f 756c 3e3c 2f64 643e 0a3c 6474 3e52
    .
    R │ │ │ -00074140: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    automatically g │ │ │ -00074160: 656e 6572 6174 6564 3c2f 6464 3e0a 3c2f enerated
    ....
  • .
  • .< │ │ │ +00064960: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +00064970: 6574 6169 6c22 2069 643d 2267 6574 526f etail" id="getRo │ │ │ +00064980: 7461 7469 6f6e 4d61 7472 6978 3244 286f tationMatrix2D(o │ │ │ +00064990: 7267 2e6f 7065 6e63 762e 636f 7265 2e50 rg.opencv.core.P │ │ │ +000649a0: 6f69 6e74 2c64 6f75 626c 652c 646f 7562 oint,double,doub │ │ │ +000649b0: 6c65 2922 3e0a 3c68 333e 6765 7452 6f74 le)">.

    getRot │ │ │ +000649c0: 6174 696f 6e4d 6174 7269 7832 443c 2f68 ationMatrix2D.
    .
    public │ │ │ +00064a30: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +00064a40: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;Mat │ │ │ +00064aa0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  getRotat │ │ │ +00064ad0: 696f 6e4d 6174 7269 7832 443c 2f73 7061 ionMatrix2D │ │ │ +00064b00: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (P │ │ │ +00064b40: 6f69 6e74 3c2f 613e 266e 6273 703b 6365 oint ce │ │ │ +00064b50: 6e74 6572 2c0a 2064 6f75 626c 6526 6e62 nter,. double&nb │ │ │ +00064b60: 7370 3b61 6e67 6c65 2c0a 2064 6f75 626c sp;angle,. doubl │ │ │ +00064b70: 6526 6e62 7370 3b73 6361 6c65 293c 2f73 e scale)
    .
    Ca │ │ │ +00064ba0: 6c63 756c 6174 6573 2061 6e20 6166 6669 lculates an affi │ │ │ +00064bb0: 6e65 206d 6174 7269 7820 6f66 2032 4420 ne matrix of 2D │ │ │ +00064bc0: 726f 7461 7469 6f6e 2e0a 0a54 6865 2066 rotation...The f │ │ │ +00064bd0: 756e 6374 696f 6e20 6361 6c63 756c 6174 unction calculat │ │ │ +00064be0: 6573 2074 6865 2066 6f6c 6c6f 7769 6e67 es the following │ │ │ +00064bf0: 206d 6174 7269 783a 0a0a 5c28 5c62 6567 matrix:..\(\beg │ │ │ +00064c00: 696e 7b62 6d61 7472 6978 7d20 5c61 6c70 in{bmatrix} \alp │ │ │ +00064c10: 6861 2026 616d 703b 2020 5c62 6574 6120 ha & \beta │ │ │ +00064c20: 2661 6d70 3b20 2831 2d20 5c61 6c70 6861 & (1- \alpha │ │ │ +00064c30: 2029 2020 5c63 646f 7420 5c74 6578 7474 ) \cdot \textt │ │ │ +00064c40: 747b 6365 6e74 6572 2e78 7d20 2d20 205c t{center.x} - \ │ │ │ +00064c50: 6265 7461 205c 6364 6f74 205c 7465 7874 beta \cdot \text │ │ │ +00064c60: 7474 7b63 656e 7465 722e 797d 205c 5c20 tt{center.y} \\ │ │ │ +00064c70: 2d20 5c62 6574 6120 2661 6d70 3b20 205c - \beta & \ │ │ │ +00064c80: 616c 7068 6120 2661 6d70 3b20 205c 6265 alpha & \be │ │ │ +00064c90: 7461 205c 6364 6f74 205c 7465 7874 7474 ta \cdot \texttt │ │ │ +00064ca0: 7b63 656e 7465 722e 787d 202b 2028 312d {center.x} + (1- │ │ │ +00064cb0: 205c 616c 7068 6120 2920 205c 6364 6f74 \alpha ) \cdot │ │ │ +00064cc0: 205c 7465 7874 7474 7b63 656e 7465 722e \texttt{center. │ │ │ +00064cd0: 797d 205c 656e 647b 626d 6174 7269 787d y} \end{bmatrix} │ │ │ +00064ce0: 5c29 0a0a 7768 6572 650a 0a5c 285c 6265 \)..where..\(\be │ │ │ +00064cf0: 6769 6e7b 6172 7261 797d 7b6c 7d20 5c61 gin{array}{l} \a │ │ │ +00064d00: 6c70 6861 203d 2020 5c74 6578 7474 747b lpha = \texttt{ │ │ │ +00064d10: 7363 616c 657d 205c 6364 6f74 205c 636f scale} \cdot \co │ │ │ +00064d20: 7320 5c74 6578 7474 747b 616e 676c 657d s \texttt{angle} │ │ │ +00064d30: 202c 205c 5c20 5c62 6574 6120 3d20 205c , \\ \beta = \ │ │ │ +00064d40: 7465 7874 7474 7b73 6361 6c65 7d20 5c63 texttt{scale} \c │ │ │ +00064d50: 646f 7420 5c73 696e 205c 7465 7874 7474 dot \sin \texttt │ │ │ +00064d60: 7b61 6e67 6c65 7d20 5c65 6e64 7b61 7272 {angle} \end{arr │ │ │ +00064d70: 6179 7d5c 290a 0a54 6865 2074 7261 6e73 ay}\)..The trans │ │ │ +00064d80: 666f 726d 6174 696f 6e20 6d61 7073 2074 formation maps t │ │ │ +00064d90: 6865 2072 6f74 6174 696f 6e20 6365 6e74 he rotation cent │ │ │ +00064da0: 6572 2074 6f20 6974 7365 6c66 2e20 4966 er to itself. If │ │ │ +00064db0: 2074 6869 7320 6973 206e 6f74 2074 6865 this is not the │ │ │ +00064dc0: 2074 6172 6765 742c 2061 646a 7573 7420 target, adjust │ │ │ +00064dd0: 7468 6520 7368 6966 742e 3c2f 6469 763e the shift.
    │ │ │ +00064de0: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ +00064e00: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    center │ │ │ +00064e20: 202d 2043 656e 7465 7220 6f66 2074 6865 - Center of the │ │ │ +00064e30: 2072 6f74 6174 696f 6e20 696e 2074 6865 rotation in the │ │ │ +00064e40: 2073 6f75 7263 6520 696d 6167 652e 3c2f source image..
    an │ │ │ +00064e60: 676c 653c 2f63 6f64 653e 202d 2052 6f74 gle - Rot │ │ │ +00064e70: 6174 696f 6e20 616e 676c 6520 696e 2064 ation angle in d │ │ │ +00064e80: 6567 7265 6573 2e20 506f 7369 7469 7665 egrees. Positive │ │ │ +00064e90: 2076 616c 7565 7320 6d65 616e 2063 6f75 values mean cou │ │ │ +00064ea0: 6e74 6572 2d63 6c6f 636b 7769 7365 2072 nter-clockwise r │ │ │ +00064eb0: 6f74 6174 696f 6e20 2874 6865 0a63 6f6f otation (the.coo │ │ │ +00064ec0: 7264 696e 6174 6520 6f72 6967 696e 2069 rdinate origin i │ │ │ +00064ed0: 7320 6173 7375 6d65 6420 746f 2062 6520 s assumed to be │ │ │ +00064ee0: 7468 6520 746f 702d 6c65 6674 2063 6f72 the top-left cor │ │ │ +00064ef0: 6e65 7229 2e3c 2f64 643e 0a3c 6464 3e3c ner).
    .
    < │ │ │ +00064f00: 636f 6465 3e73 6361 6c65 3c2f 636f 6465 code>scale - Isotropic sc │ │ │ +00064f20: 616c 6520 6661 6374 6f72 2e0a 0a53 4545 ale factor...SEE │ │ │ +00064f30: 3a20 2067 6574 4166 6669 6e65 5472 616e : getAffineTran │ │ │ +00064f40: 7366 6f72 6d2c 2077 6172 7041 6666 696e sform, warpAffin │ │ │ +00064f50: 652c 2074 7261 6e73 666f 726d 3c2f 6464 e, transform
    .
    Returns:.
    automati │ │ │ +00064f80: 6361 6c6c 7920 6765 6e65 7261 7465 643c cally generated< │ │ │ +00064f90: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    ...
  • .
    .

    invertA │ │ │ +00065020: 6666 696e 6554 7261 6e73 666f 726d 3c2f ffineTransform.
    .
    public │ │ │ +00065090: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +000650a0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;vo │ │ │ +000650c0: 6964 3c2f 7370 616e 3e26 6e62 7370 3b3c id < │ │ │ +000650d0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +000650e0: 656e 742d 6e61 6d65 223e 696e 7665 7274 ent-name">invert │ │ │ +000650f0: 4166 6669 6e65 5472 616e 7366 6f72 6d3c AffineTransform< │ │ │ +00065100: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat M, │ │ │ +00065170: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000651b0: 743c 2f61 3e26 6e62 7370 3b69 4d29 3c2f t iM)
    .
    I │ │ │ +000651e0: 6e76 6572 7473 2061 6e20 6166 6669 6e65 nverts an affine │ │ │ +000651f0: 2074 7261 6e73 666f 726d 6174 696f 6e2e transformation. │ │ │ +00065200: 0a0a 5468 6520 6675 6e63 7469 6f6e 2063 ..The function c │ │ │ +00065210: 6f6d 7075 7465 7320 616e 2069 6e76 6572 omputes an inver │ │ │ +00065220: 7365 2061 6666 696e 6520 7472 616e 7366 se affine transf │ │ │ +00065230: 6f72 6d61 7469 6f6e 2072 6570 7265 7365 ormation represe │ │ │ +00065240: 6e74 6564 2062 7920 5c28 3220 5c74 696d nted by \(2 \tim │ │ │ +00065250: 6573 2033 5c29 206d 6174 7269 7820 4d3a es 3\) matrix M: │ │ │ +00065260: 0a0a 5c28 5c62 6567 696e 7b62 6d61 7472 ..\(\begin{bmatr │ │ │ +00065270: 6978 7d20 615f 7b31 317d 2026 616d 703b ix} a_{11} & │ │ │ +00065280: 2061 5f7b 3132 7d20 2661 6d70 3b20 625f a_{12} & b_ │ │ │ +00065290: 3120 205c 5c20 615f 7b32 317d 2026 616d 1 \\ a_{21} &am │ │ │ +000652a0: 703b 2061 5f7b 3232 7d20 2661 6d70 3b20 p; a_{22} & │ │ │ +000652b0: 625f 3220 5c65 6e64 7b62 6d61 7472 6978 b_2 \end{bmatrix │ │ │ +000652c0: 7d5c 290a 0a54 6865 2072 6573 756c 7420 }\)..The result │ │ │ +000652d0: 6973 2061 6c73 6f20 6120 5c28 3220 5c74 is also a \(2 \t │ │ │ +000652e0: 696d 6573 2033 5c29 206d 6174 7269 7820 imes 3\) matrix │ │ │ +000652f0: 6f66 2074 6865 2073 616d 6520 7479 7065 of the same type │ │ │ +00065300: 2061 7320 4d2e 3c2f 6469 763e 0a3c 646c as M.
    .
    . │ │ │ +00065320: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ +00065330: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e4d /dt>.
    M │ │ │ +00065340: 3c2f 636f 6465 3e20 2d20 4f72 6967 696e - Origin │ │ │ +00065350: 616c 2061 6666 696e 6520 7472 616e 7366 al affine transf │ │ │ +00065360: 6f72 6d61 7469 6f6e 2e3c 2f64 643e 0a3c ormation.
    .< │ │ │ +00065370: 6464 3e3c 636f 6465 3e69 4d3c 2f63 6f64 dd>iM - Output reve │ │ │ +00065390: 7273 6520 6166 6669 6e65 2074 7261 6e73 rse affine trans │ │ │ +000653a0: 666f 726d 6174 696f 6e2e 3c2f 6464 3e0a formation.. │ │ │ +000653b0: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    .
    .

  • ..
    .

    getPer │ │ │ +00065440: 7370 6563 7469 7665 5472 616e 7366 6f72 spectiveTransfor │ │ │ +00065450: 6d3c 2f68 333e 0a3c 6469 7620 636c 6173 m

    .
    .
    pub │ │ │ +000654b0: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static Mat │ │ │ +00065520: 3c2f 613e 3c2f 7370 616e 3e26 6e62 7370   │ │ │ +00065530: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;getP │ │ │ +00065550: 6572 7370 6563 7469 7665 5472 616e 7366 erspectiveTransf │ │ │ +00065560: 6f72 6d3c 2f73 7061 6e3e 3c77 6272 3e3c orm< │ │ │ +00065570: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +00065580: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ +000655d0: 703b 7372 632c 0a20 3c61 2068 7265 663d p;src,. Mat  │ │ │ +00065620: 3b64 7374 2c0a 2069 6e74 266e 6273 703b ;dst,. int  │ │ │ +00065630: 736f 6c76 654d 6574 686f 6429 3c2f 7370 solveMethod)
    .
    Cal │ │ │ +00065660: 6375 6c61 7465 7320 6120 7065 7273 7065 culates a perspe │ │ │ +00065670: 6374 6976 6520 7472 616e 7366 6f72 6d20 ctive transform │ │ │ +00065680: 6672 6f6d 2066 6f75 7220 7061 6972 7320 from four pairs │ │ │ +00065690: 6f66 2074 6865 2063 6f72 7265 7370 6f6e of the correspon │ │ │ +000656a0: 6469 6e67 2070 6f69 6e74 732e 0a0a 5468 ding points...Th │ │ │ +000656b0: 6520 6675 6e63 7469 6f6e 2063 616c 6375 e function calcu │ │ │ +000656c0: 6c61 7465 7320 7468 6520 5c28 3320 5c74 lates the \(3 \t │ │ │ +000656d0: 696d 6573 2033 5c29 206d 6174 7269 7820 imes 3\) matrix │ │ │ +000656e0: 6f66 2061 2070 6572 7370 6563 7469 7665 of a perspective │ │ │ +000656f0: 2074 7261 6e73 666f 726d 2073 6f20 7468 transform so th │ │ │ +00065700: 6174 3a0a 0a5c 285c 6265 6769 6e7b 626d at:..\(\begin{bm │ │ │ +00065710: 6174 7269 787d 2074 5f69 2078 275f 6920 atrix} t_i x'_i │ │ │ +00065720: 5c5c 2074 5f69 2079 275f 6920 5c5c 2074 \\ t_i y'_i \\ t │ │ │ +00065730: 5f69 205c 656e 647b 626d 6174 7269 787d _i \end{bmatrix} │ │ │ +00065740: 203d 205c 7465 7874 7474 7b6d 6170 5f6d = \texttt{map_m │ │ │ +00065750: 6174 7269 787d 205c 6364 6f74 205c 6265 atrix} \cdot \be │ │ │ +00065760: 6769 6e7b 626d 6174 7269 787d 2078 5f69 gin{bmatrix} x_i │ │ │ +00065770: 205c 5c20 795f 6920 5c5c 2031 205c 656e \\ y_i \\ 1 \en │ │ │ +00065780: 647b 626d 6174 7269 787d 5c29 0a0a 7768 d{bmatrix}\)..wh │ │ │ +00065790: 6572 650a 0a5c 2864 7374 2869 293d 2878 ere..\(dst(i)=(x │ │ │ +000657a0: 275f 692c 7927 5f69 292c 2073 7263 2869 '_i,y'_i), src(i │ │ │ +000657b0: 293d 2878 5f69 2c20 795f 6929 2c20 693d )=(x_i, y_i), i= │ │ │ +000657c0: 302c 312c 322c 335c 293c 2f64 6976 3e0a 0,1,2,3\)
    . │ │ │ +000657d0: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ +000657f0: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    src - C │ │ │ +00065810: 6f6f 7264 696e 6174 6573 206f 6620 7175 oordinates of qu │ │ │ +00065820: 6164 7261 6e67 6c65 2076 6572 7469 6365 adrangle vertice │ │ │ +00065830: 7320 696e 2074 6865 2073 6f75 7263 6520 s in the source │ │ │ +00065840: 696d 6167 652e 3c2f 6464 3e0a 3c64 643e image.
    .
    │ │ │ +00065850: 3c63 6f64 653e 6473 743c 2f63 6f64 653e dst │ │ │ +00065860: 202d 2043 6f6f 7264 696e 6174 6573 206f - Coordinates o │ │ │ +00065870: 6620 7468 6520 636f 7272 6573 706f 6e64 f the correspond │ │ │ +00065880: 696e 6720 7175 6164 7261 6e67 6c65 2076 ing quadrangle v │ │ │ +00065890: 6572 7469 6365 7320 696e 2074 6865 2064 ertices in the d │ │ │ +000658a0: 6573 7469 6e61 7469 6f6e 2069 6d61 6765 estination image │ │ │ +000658b0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    solveMethod - method pas │ │ │ +000658e0: 7365 6420 746f 2063 763a 3a73 6f6c 7665 sed to cv::solve │ │ │ +000658f0: 2028 2344 6563 6f6d 7054 7970 6573 290a (#DecompTypes). │ │ │ +00065900: 0a53 4545 3a20 2066 696e 6448 6f6d 6f67 .SEE: findHomog │ │ │ +00065910: 7261 7068 792c 2077 6172 7050 6572 7370 raphy, warpPersp │ │ │ +00065920: 6563 7469 7665 2c20 7065 7273 7065 6374 ective, perspect │ │ │ +00065930: 6976 6554 7261 6e73 666f 726d 3c2f 6464 iveTransform
    .
    Returns:.
    automati │ │ │ +00065960: 6361 6c6c 7920 6765 6e65 7261 7465 643c cally generated< │ │ │ +00065970: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .
    ..
  • .
    .

    getPe │ │ │ +00065a00: 7273 7065 6374 6976 6554 7261 6e73 666f rspectiveTransfo │ │ │ +00065a10: 726d 3c2f 6833 3e0a 3c64 6976 2063 6c61 rm

    .
    .
    pu │ │ │ +00065a70: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static Ma │ │ │ +00065ae0: 743c 2f61 3e3c 2f73 7061 6e3e 266e 6273 t&nbs │ │ │ +00065af0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;get │ │ │ +00065b10: 5065 7273 7065 6374 6976 6554 7261 6e73 PerspectiveTrans │ │ │ +00065b20: 666f 726d 3c2f 7370 616e 3e3c 7762 723e form │ │ │ +00065b30: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +00065b90: 7370 3b73 7263 2c0a 203c 6120 6872 6566 sp;src,. Mat&nbs │ │ │ +00065be0: 703b 6473 7429 3c2f 7370 616e 3e3c 2f64 p;dst).
    Calculate │ │ │ +00065c10: 7320 6120 7065 7273 7065 6374 6976 6520 s a perspective │ │ │ +00065c20: 7472 616e 7366 6f72 6d20 6672 6f6d 2066 transform from f │ │ │ +00065c30: 6f75 7220 7061 6972 7320 6f66 2074 6865 our pairs of the │ │ │ +00065c40: 2063 6f72 7265 7370 6f6e 6469 6e67 2070 corresponding p │ │ │ +00065c50: 6f69 6e74 732e 0a0a 5468 6520 6675 6e63 oints...The func │ │ │ +00065c60: 7469 6f6e 2063 616c 6375 6c61 7465 7320 tion calculates │ │ │ +00065c70: 7468 6520 5c28 3320 5c74 696d 6573 2033 the \(3 \times 3 │ │ │ +00065c80: 5c29 206d 6174 7269 7820 6f66 2061 2070 \) matrix of a p │ │ │ +00065c90: 6572 7370 6563 7469 7665 2074 7261 6e73 erspective trans │ │ │ +00065ca0: 666f 726d 2073 6f20 7468 6174 3a0a 0a5c form so that:..\ │ │ │ +00065cb0: 285c 6265 6769 6e7b 626d 6174 7269 787d (\begin{bmatrix} │ │ │ +00065cc0: 2074 5f69 2078 275f 6920 5c5c 2074 5f69 t_i x'_i \\ t_i │ │ │ +00065cd0: 2079 275f 6920 5c5c 2074 5f69 205c 656e y'_i \\ t_i \en │ │ │ +00065ce0: 647b 626d 6174 7269 787d 203d 205c 7465 d{bmatrix} = \te │ │ │ +00065cf0: 7874 7474 7b6d 6170 5f6d 6174 7269 787d xttt{map_matrix} │ │ │ +00065d00: 205c 6364 6f74 205c 6265 6769 6e7b 626d \cdot \begin{bm │ │ │ +00065d10: 6174 7269 787d 2078 5f69 205c 5c20 795f atrix} x_i \\ y_ │ │ │ +00065d20: 6920 5c5c 2031 205c 656e 647b 626d 6174 i \\ 1 \end{bmat │ │ │ +00065d30: 7269 787d 5c29 0a0a 7768 6572 650a 0a5c rix}\)..where..\ │ │ │ +00065d40: 2864 7374 2869 293d 2878 275f 692c 7927 (dst(i)=(x'_i,y' │ │ │ +00065d50: 5f69 292c 2073 7263 2869 293d 2878 5f69 _i), src(i)=(x_i │ │ │ +00065d60: 2c20 795f 6929 2c20 693d 302c 312c 322c , y_i), i=0,1,2, │ │ │ +00065d70: 335c 293c 2f64 6976 3e0a 3c64 6c20 636c 3\)
    .
    .
    Parameters:
    .
    src< │ │ │ +00065db0: 2f63 6f64 653e 202d 2043 6f6f 7264 696e /code> - Coordin │ │ │ +00065dc0: 6174 6573 206f 6620 7175 6164 7261 6e67 ates of quadrang │ │ │ +00065dd0: 6c65 2076 6572 7469 6365 7320 696e 2074 le vertices in t │ │ │ +00065de0: 6865 2073 6f75 7263 6520 696d 6167 652e he source image. │ │ │ +00065df0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +00065e00: 6473 743c 2f63 6f64 653e 202d 2043 6f6f dst - Coo │ │ │ +00065e10: 7264 696e 6174 6573 206f 6620 7468 6520 rdinates of the │ │ │ +00065e20: 636f 7272 6573 706f 6e64 696e 6720 7175 corresponding qu │ │ │ +00065e30: 6164 7261 6e67 6c65 2076 6572 7469 6365 adrangle vertice │ │ │ +00065e40: 7320 696e 2074 6865 2064 6573 7469 6e61 s in the destina │ │ │ +00065e50: 7469 6f6e 2069 6d61 6765 2e0a 0a53 4545 tion image...SEE │ │ │ +00065e60: 3a20 2066 696e 6448 6f6d 6f67 7261 7068 : findHomograph │ │ │ +00065e70: 792c 2077 6172 7050 6572 7370 6563 7469 y, warpPerspecti │ │ │ +00065e80: 7665 2c20 7065 7273 7065 6374 6976 6554 ve, perspectiveT │ │ │ +00065e90: 7261 6e73 666f 726d 3c2f 6464 3e0a 3c64 ransform
    .Returns:. │ │ │ +00065eb0: 3c64 643e 6175 746f 6d61 7469 6361 6c6c
    automaticall │ │ │ +00065ec0: 7920 6765 6e65 7261 7465 643c 2f64 643e y generated
    │ │ │ +00065ed0: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    .
    ..
  • .< │ │ │ +00065ef0: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    . │ │ │ +00065f60: 3c68 333e 6765 7441 6666 696e 6554 7261

    getAffineTra │ │ │ +00065f70: 6e73 666f 726d 3c2f 6833 3e0a 3c64 6976 nsform

    .
    .
    public static< │ │ │ +00065fe0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> Mat │ │ │ +00066050: 266e 6273 703b 3c73 7061 6e20 636c 6173  getAffineTransf │ │ │ +00066080: 6f72 6d3c 2f73 7061 6e3e 3c77 6272 3e3c orm< │ │ │ +00066090: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +000660a0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Ma │ │ │ +000660f0: 744f 6650 6f69 6e74 3266 3c2f 613e 266e tOfPoint2f&n │ │ │ +00066100: 6273 703b 7372 632c 0a20 3c61 2068 7265 bsp;src,. M │ │ │ +00066150: 6174 4f66 506f 696e 7432 663c 2f61 3e26 atOfPoint2f& │ │ │ +00066160: 6e62 7370 3b64 7374 293c 2f73 7061 6e3e nbsp;dst) │ │ │ +00066170: 3c2f 6469 763e 0a3c 2f64 6976 3e0a 3c2f
    .
    ..

  • .< │ │ │ +00066190: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .

    Rod │ │ │ +00066200: 7269 6775 6573 3c2f 6833 3e0a 3c64 6976 rigues

    ..
    .
    Pa │ │ │ +00066460: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ +00066470: 6464 3e3c 636f 6465 3e73 7263 3c2f 636f dd>src - Input rota │ │ │ +00066490: 7469 6f6e 2076 6563 746f 7220 2833 7831 tion vector (3x1 │ │ │ +000664a0: 206f 7220 3178 3329 206f 7220 726f 7461 or 1x3) or rota │ │ │ +000664b0: 7469 6f6e 206d 6174 7269 7820 2833 7833 tion matrix (3x3 │ │ │ +000664c0: 292e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 )..
    dst - O │ │ │ +000664e0: 7574 7075 7420 726f 7461 7469 6f6e 206d utput rotation m │ │ │ +000664f0: 6174 7269 7820 2833 7833 2920 6f72 2072 atrix (3x3) or r │ │ │ +00066500: 6f74 6174 696f 6e20 7665 6374 6f72 2028 otation vector ( │ │ │ +00066510: 3378 3120 6f72 2031 7833 292c 2072 6573 3x1 or 1x3), res │ │ │ +00066520: 7065 6374 6976 656c 792e 3c2f 6464 3e0a pectively.
    . │ │ │ +00066530: 3c64 643e 3c63 6f64 653e 6a61 636f 6269
    jacobi │ │ │ +00066540: 616e 3c2f 636f 6465 3e20 2d20 4f70 7469 an - Opti │ │ │ +00066550: 6f6e 616c 206f 7574 7075 7420 4a61 636f onal output Jaco │ │ │ +00066560: 6269 616e 206d 6174 7269 782c 2033 7839 bian matrix, 3x9 │ │ │ +00066570: 206f 7220 3978 332c 2077 6869 6368 2069 or 9x3, which i │ │ │ +00066580: 7320 6120 6d61 7472 6978 206f 6620 7061 s a matrix of pa │ │ │ +00066590: 7274 6961 6c0a 6465 7269 7661 7469 7665 rtial.derivative │ │ │ +000665a0: 7320 6f66 2074 6865 206f 7574 7075 7420 s of the output │ │ │ +000665b0: 6172 7261 7920 636f 6d70 6f6e 656e 7473 array components │ │ │ +000665c0: 2077 6974 6820 7265 7370 6563 7420 746f with respect to │ │ │ +000665d0: 2074 6865 2069 6e70 7574 2061 7272 6179 the input array │ │ │ +000665e0: 2063 6f6d 706f 6e65 6e74 732e 0a0a 5c28 components...\( │ │ │ +000665f0: 5c62 6567 696e 7b61 7272 6179 7d7b 6c7d \begin{array}{l} │ │ │ +00066600: 205c 7468 6574 6120 5c6c 6566 7461 7272 \theta \leftarr │ │ │ +00066610: 6f77 206e 6f72 6d28 7229 205c 5c20 7220 ow norm(r) \\ r │ │ │ +00066620: 205c 6c65 6674 6172 726f 7720 722f 205c \leftarrow r/ \ │ │ │ +00066630: 7468 6574 6120 5c5c 2052 203d 2020 5c63 theta \\ R = \c │ │ │ +00066640: 6f73 285c 7468 6574 6129 2049 202b 2028 os(\theta) I + ( │ │ │ +00066650: 312d 205c 636f 737b 5c74 6865 7461 7d20 1- \cos{\theta} │ │ │ +00066660: 2920 7220 725e 5420 2b20 205c 7369 6e28 ) r r^T + \sin( │ │ │ +00066670: 5c74 6865 7461 2920 5c76 6563 7468 7265 \theta) \vecthre │ │ │ +00066680: 6574 6872 6565 7b30 7d7b 2d72 5f7a 7d7b ethree{0}{-r_z}{ │ │ │ +00066690: 725f 797d 7b72 5f7a 7d7b 307d 7b2d 725f r_y}{r_z}{0}{-r_ │ │ │ +000666a0: 787d 7b2d 725f 797d 7b72 5f78 7d7b 307d x}{-r_y}{r_x}{0} │ │ │ +000666b0: 205c 656e 647b 6172 7261 797d 5c29 0a0a \end{array}\).. │ │ │ +000666c0: 496e 7665 7273 6520 7472 616e 7366 6f72 Inverse transfor │ │ │ +000666d0: 6d61 7469 6f6e 2063 616e 2062 6520 616c mation can be al │ │ │ +000666e0: 736f 2064 6f6e 6520 6561 7369 6c79 2c20 so done easily, │ │ │ +000666f0: 7369 6e63 650a 0a5c 285c 7369 6e20 2820 since..\(\sin ( │ │ │ +00066700: 5c74 6865 7461 2029 205c 7665 6374 6872 \theta ) \vecthr │ │ │ +00066710: 6565 7468 7265 657b 307d 7b2d 725f 7a7d eethree{0}{-r_z} │ │ │ +00066720: 7b72 5f79 7d7b 725f 7a7d 7b30 7d7b 2d72 {r_y}{r_z}{0}{-r │ │ │ +00066730: 5f78 7d7b 2d72 5f79 7d7b 725f 787d 7b30 _x}{-r_y}{r_x}{0 │ │ │ +00066740: 7d20 3d20 5c66 7261 637b 5220 2d20 525e } = \frac{R - R^ │ │ │ +00066750: 547d 7b32 7d5c 290a 0a41 2072 6f74 6174 T}{2}\)..A rotat │ │ │ +00066760: 696f 6e20 7665 6374 6f72 2069 7320 6120 ion vector is a │ │ │ +00066770: 636f 6e76 656e 6965 6e74 2061 6e64 206d convenient and m │ │ │ +00066780: 6f73 7420 636f 6d70 6163 7420 7265 7072 ost compact repr │ │ │ +00066790: 6573 656e 7461 7469 6f6e 206f 6620 6120 esentation of a │ │ │ +000667a0: 726f 7461 7469 6f6e 206d 6174 7269 7820 rotation matrix │ │ │ +000667b0: 2873 696e 6365 2061 6e79 0a72 6f74 6174 (since any.rotat │ │ │ +000667c0: 696f 6e20 6d61 7472 6978 2068 6173 206a ion matrix has j │ │ │ +000667d0: 7573 7420 3320 6465 6772 6565 7320 6f66 ust 3 degrees of │ │ │ +000667e0: 2066 7265 6564 6f6d 292e 2054 6865 2072 freedom). The r │ │ │ +000667f0: 6570 7265 7365 6e74 6174 696f 6e20 6973 epresentation is │ │ │ +00066800: 2075 7365 6420 696e 2074 6865 2067 6c6f used in the glo │ │ │ +00066810: 6261 6c20 3344 2067 656f 6d65 7472 790a bal 3D geometry. │ │ │ +00066820: 6f70 7469 6d69 7a61 7469 6f6e 2070 726f optimization pro │ │ │ +00066830: 6365 6475 7265 7320 6c69 6b65 2052 4546 cedures like REF │ │ │ +00066840: 3a20 6361 6c69 6272 6174 6543 616d 6572 : calibrateCamer │ │ │ +00066850: 612c 2052 4546 3a20 7374 6572 656f 4361 a, REF: stereoCa │ │ │ +00066860: 6c69 6272 6174 652c 206f 7220 5245 463a librate, or REF: │ │ │ +00066870: 2073 6f6c 7665 506e 5020 2e0a 0a3c 623e solvePnP ... │ │ │ +00066880: 4e6f 7465 3a3c 2f62 3e20 4d6f 7265 2069 Note: More i │ │ │ +00066890: 6e66 6f72 6d61 7469 6f6e 2061 626f 7574 nformation about │ │ │ +000668a0: 2074 6865 2063 6f6d 7075 7461 7469 6f6e the computation │ │ │ +000668b0: 206f 6620 7468 6520 6465 7269 7661 7469 of the derivati │ │ │ +000668c0: 7665 206f 6620 6120 3344 2072 6f74 6174 ve of a 3D rotat │ │ │ +000668d0: 696f 6e20 6d61 7472 6978 2077 6974 6820 ion matrix with │ │ │ +000668e0: 7265 7370 6563 7420 746f 2069 7473 2065 respect to its e │ │ │ +000668f0: 7870 6f6e 656e 7469 616c 2063 6f6f 7264 xponential coord │ │ │ +00066900: 696e 6174 650a 6361 6e20 6265 2066 6f75 inate.can be fou │ │ │ +00066910: 6e64 2069 6e3a 0a3c 756c 3e0a 2020 3c6c nd in:.
      . . A Compac │ │ │ +00066930: 7420 466f 726d 756c 6120 666f 7220 7468 t Formula for th │ │ │ +00066940: 6520 4465 7269 7661 7469 7665 206f 6620 e Derivative of │ │ │ +00066950: 6120 332d 4420 526f 7461 7469 6f6e 2069 a 3-D Rotation i │ │ │ +00066960: 6e20 4578 706f 6e65 6e74 6961 6c20 436f n Exponential Co │ │ │ +00066970: 6f72 6469 6e61 7465 732c 2047 7569 6c6c ordinates, Guill │ │ │ +00066980: 6572 6d6f 2047 616c 6c65 676f 2c20 416e ermo Gallego, An │ │ │ +00066990: 7468 6f6e 7920 4a2e 2059 657a 7a69 2043 thony J. Yezzi C │ │ │ +000669a0: 4954 453a 2047 616c 6c65 676f 3230 3134 ITE: Gallego2014 │ │ │ +000669b0: 4143 460a 2020 3c2f 6c69 3e0a 3c2f 756c ACF. .
    ..Note: │ │ │ +000669d0: 5573 6566 756c 2069 6e66 6f72 6d61 7469 Useful informati │ │ │ +000669e0: 6f6e 206f 6e20 5345 2833 2920 616e 6420 on on SE(3) and │ │ │ +000669f0: 4c69 6520 4772 6f75 7073 2063 616e 2062 Lie Groups can b │ │ │ +00066a00: 6520 666f 756e 6420 696e 3a0a 3c75 6c3e e found in:.
      │ │ │ +00066a10: 0a20 203c 6c69 3e0a 2020 2020 2041 2074 .
    • . A t │ │ │ +00066a20: 7574 6f72 6961 6c20 6f6e 2053 4528 3329 utorial on SE(3) │ │ │ +00066a30: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ +00066a40: 7061 7261 6d65 7465 7269 7a61 7469 6f6e parameterization │ │ │ +00066a50: 7320 616e 6420 6f6e 2d6d 616e 6966 6f6c s and on-manifol │ │ │ +00066a60: 6420 6f70 7469 6d69 7a61 7469 6f6e 2c20 d optimization, │ │ │ +00066a70: 4a6f 7365 2d4c 7569 7320 426c 616e 636f Jose-Luis Blanco │ │ │ +00066a80: 2043 4954 453a 2062 6c61 6e63 6f32 3031 CITE: blanco201 │ │ │ +00066a90: 3074 7574 6f72 6961 6c0a 2020 3c2f 6c69 0tutorial.
    • .
    • . Li │ │ │ +00066ab0: 6520 4772 6f75 7073 2066 6f72 2032 4420 e Groups for 2D │ │ │ +00066ac0: 616e 6420 3344 2054 7261 6e73 666f 726d and 3D Transform │ │ │ +00066ad0: 6174 696f 6e2c 2045 7468 616e 2045 6164 ation, Ethan Ead │ │ │ +00066ae0: 6520 4349 5445 3a20 4561 6465 3137 0a20 e CITE: Eade17. │ │ │ +00066af0: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020
    • .
    • . │ │ │ +00066b00: 2020 2041 206d 6963 726f 204c 6965 2074 A micro Lie t │ │ │ +00066b10: 6865 6f72 7920 666f 7220 7374 6174 6520 heory for state │ │ │ +00066b20: 6573 7469 6d61 7469 6f6e 2069 6e20 726f estimation in ro │ │ │ +00066b30: 626f 7469 6373 2c20 4a6f 616e 2053 6f6c botics, Joan Sol │ │ │ +00066b40: c3a0 2c20 4ac3 a972 c3a9 6d69 6520 4465 .., J..r..mie De │ │ │ +00066b50: 7261 792c 2044 696e 6573 6820 4174 6368 ray, Dinesh Atch │ │ │ +00066b60: 7574 6861 6e20 4349 5445 3a20 536f 6c32 uthan CITE: Sol2 │ │ │ +00066b70: 3031 3841 4d4c 0a20 203c 2f6c 693e 0a3c 018AML.
    • .< │ │ │ +00066b80: 2f75 6c3e 3c2f 6464 3e0a 3c2f 646c 3e0a /ul>
    .
    . │ │ │ +00066b90: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e .
    ..
  • │ │ │ -00074190: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    s │ │ │ -00074250: 6f6c 7665 506e 503c 2f68 333e 0a3c 6469 olvePnP

    ..public static │ │ │ -000742c0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  boolean solvePnP(MatOfPo │ │ │ -00074390: 696e 7433 663c 2f61 3e26 6e62 7370 3b6f int3f o │ │ │ -000743a0: 626a 6563 7450 6f69 6e74 732c 0a20 3c61 bjectPoints,. MatOfPoint2f< │ │ │ -00074400: 2f61 3e26 6e62 7370 3b69 6d61 6765 506f /a> imagePo │ │ │ -00074410: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. double contourArea( │ │ │ +00063880: 4d61 743c 2f61 3e26 6e62 7370 3b63 6f6e Mat con │ │ │ +00063890: 746f 7572 2c0a 2062 6f6f 6c65 616e 266e tour,. boolean&n │ │ │ +000638a0: 6273 703b 6f72 6965 6e74 6564 293c 2f73 bsp;oriented)
    .
    Ca │ │ │ +000638d0: 6c63 756c 6174 6573 2061 2063 6f6e 746f lculates a conto │ │ │ +000638e0: 7572 2061 7265 612e 0a0a 5468 6520 6675 ur area...The fu │ │ │ +000638f0: 6e63 7469 6f6e 2063 6f6d 7075 7465 7320 nction computes │ │ │ +00063900: 6120 636f 6e74 6f75 7220 6172 6561 2e20 a contour area. │ │ │ +00063910: 5369 6d69 6c61 726c 7920 746f 206d 6f6d Similarly to mom │ │ │ +00063920: 656e 7473 202c 2074 6865 2061 7265 6120 ents , the area │ │ │ +00063930: 6973 2063 6f6d 7075 7465 6420 7573 696e is computed usin │ │ │ +00063940: 6720 7468 6520 4772 6565 6e0a 666f 726d g the Green.form │ │ │ +00063950: 756c 612e 2054 6875 732c 2074 6865 2072 ula. Thus, the r │ │ │ +00063960: 6574 7572 6e65 6420 6172 6561 2061 6e64 eturned area and │ │ │ +00063970: 2074 6865 206e 756d 6265 7220 6f66 206e the number of n │ │ │ +00063980: 6f6e 2d7a 6572 6f20 7069 7865 6c73 2c20 on-zero pixels, │ │ │ +00063990: 6966 2079 6f75 2064 7261 7720 7468 6520 if you draw the │ │ │ +000639a0: 636f 6e74 6f75 7220 7573 696e 670a 2364 contour using.#d │ │ │ +000639b0: 7261 7743 6f6e 746f 7572 7320 6f72 2023 rawContours or # │ │ │ +000639c0: 6669 6c6c 506f 6c79 202c 2063 616e 2062 fillPoly , can b │ │ │ +000639d0: 6520 6469 6666 6572 656e 742e 2041 6c73 e different. Als │ │ │ +000639e0: 6f2c 2074 6865 2066 756e 6374 696f 6e20 o, the function │ │ │ +000639f0: 7769 6c6c 206d 6f73 7420 6365 7274 6169 will most certai │ │ │ +00063a00: 6e6c 7920 6769 7665 2061 2077 726f 6e67 nly give a wrong │ │ │ +00063a10: 0a72 6573 756c 7473 2066 6f72 2063 6f6e .results for con │ │ │ +00063a20: 746f 7572 7320 7769 7468 2073 656c 662d tours with self- │ │ │ +00063a30: 696e 7465 7273 6563 7469 6f6e 732e 0a0a intersections... │ │ │ +00063a40: 4578 616d 706c 653a 0a3c 636f 6465 3e0a Example:.. │ │ │ +00063a50: 7665 6374 6f72 266c 743b 506f 696e 7426 vector<Point& │ │ │ +00063a60: 6774 3b20 636f 6e74 6f75 723b 0a63 6f6e gt; contour;.con │ │ │ +00063a70: 746f 7572 2e70 7573 685f 6261 636b 2850 tour.push_back(P │ │ │ +00063a80: 6f69 6e74 3266 2830 2c20 3029 293b 0a63 oint2f(0, 0));.c │ │ │ +00063a90: 6f6e 746f 7572 2e70 7573 685f 6261 636b ontour.push_back │ │ │ +00063aa0: 2850 6f69 6e74 3266 2831 302c 2030 2929 (Point2f(10, 0)) │ │ │ +00063ab0: 3b0a 636f 6e74 6f75 722e 7075 7368 5f62 ;.contour.push_b │ │ │ +00063ac0: 6163 6b28 506f 696e 7432 6628 3130 2c20 ack(Point2f(10, │ │ │ +00063ad0: 3130 2929 3b0a 636f 6e74 6f75 722e 7075 10));.contour.pu │ │ │ +00063ae0: 7368 5f62 6163 6b28 506f 696e 7432 6628 sh_back(Point2f( │ │ │ +00063af0: 352c 2034 2929 3b0a 0a64 6f75 626c 6520 5, 4));..double │ │ │ +00063b00: 6172 6561 3020 3d20 636f 6e74 6f75 7241 area0 = contourA │ │ │ +00063b10: 7265 6128 636f 6e74 6f75 7229 3b0a 7665 rea(contour);.ve │ │ │ +00063b20: 6374 6f72 266c 743b 506f 696e 7426 6774 ctor<Point> │ │ │ +00063b30: 3b20 6170 7072 6f78 3b0a 6170 7072 6f78 ; approx;.approx │ │ │ +00063b40: 506f 6c79 4450 2863 6f6e 746f 7572 2c20 PolyDP(contour, │ │ │ +00063b50: 6170 7072 6f78 2c20 352c 2074 7275 6529 approx, 5, true) │ │ │ +00063b60: 3b0a 646f 7562 6c65 2061 7265 6131 203d ;.double area1 = │ │ │ +00063b70: 2063 6f6e 746f 7572 4172 6561 2861 7070 contourArea(app │ │ │ +00063b80: 726f 7829 3b0a 0a63 6f75 7420 266c 743b rox);..cout < │ │ │ +00063b90: 266c 743b 2022 6172 6561 3020 3d22 2026 < "area0 =" & │ │ │ +00063ba0: 6c74 3b26 6c74 3b20 6172 6561 3020 266c lt;< area0 &l │ │ │ +00063bb0: 743b 266c 743b 2065 6e64 6c20 266c 743b t;< endl < │ │ │ +00063bc0: 266c 743b 0a22 6172 6561 3120 3d22 2026 <."area1 =" & │ │ │ +00063bd0: 6c74 3b26 6c74 3b20 6172 6561 3120 266c lt;< area1 &l │ │ │ +00063be0: 743b 266c 743b 2065 6e64 6c20 266c 743b t;< endl < │ │ │ +00063bf0: 266c 743b 0a22 6170 7072 6f78 2070 6f6c <."approx pol │ │ │ +00063c00: 7920 7665 7274 6963 6573 2220 266c 743b y vertices" < │ │ │ +00063c10: 266c 743b 2061 7070 726f 782e 7369 7a65 < approx.size │ │ │ +00063c20: 2829 2026 6c74 3b26 6c74 3b20 656e 646c () << endl │ │ │ +00063c30: 3b0a 3c2f 636f 6465 3e3c 2f64 6976 3e0a ;.
    . │ │ │ +00063c40: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ +00063c60: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    contour │ │ │ +00063c80: 202d 2049 6e70 7574 2076 6563 746f 7220 - Input vector │ │ │ +00063c90: 6f66 2032 4420 706f 696e 7473 2028 636f of 2D points (co │ │ │ +00063ca0: 6e74 6f75 7220 7665 7274 6963 6573 292c ntour vertices), │ │ │ +00063cb0: 2073 746f 7265 6420 696e 2073 7464 3a3a stored in std:: │ │ │ +00063cc0: 7665 6374 6f72 206f 7220 4d61 742e 3c2f vector or Mat..
    or │ │ │ +00063ce0: 6965 6e74 6564 3c2f 636f 6465 3e20 2d20 iented - │ │ │ +00063cf0: 4f72 6965 6e74 6564 2061 7265 6120 666c Oriented area fl │ │ │ +00063d00: 6167 2e20 4966 2069 7420 6973 2074 7275 ag. If it is tru │ │ │ +00063d10: 652c 2074 6865 2066 756e 6374 696f 6e20 e, the function │ │ │ +00063d20: 7265 7475 726e 7320 6120 7369 676e 6564 returns a signed │ │ │ +00063d30: 2061 7265 6120 7661 6c75 652c 0a64 6570 area value,.dep │ │ │ +00063d40: 656e 6469 6e67 206f 6e20 7468 6520 636f ending on the co │ │ │ +00063d50: 6e74 6f75 7220 6f72 6965 6e74 6174 696f ntour orientatio │ │ │ +00063d60: 6e20 2863 6c6f 636b 7769 7365 206f 7220 n (clockwise or │ │ │ +00063d70: 636f 756e 7465 722d 636c 6f63 6b77 6973 counter-clockwis │ │ │ +00063d80: 6529 2e20 5573 696e 6720 7468 6973 2066 e). Using this f │ │ │ +00063d90: 6561 7475 7265 2079 6f75 2063 616e 0a64 eature you can.d │ │ │ +00063da0: 6574 6572 6d69 6e65 206f 7269 656e 7461 etermine orienta │ │ │ +00063db0: 7469 6f6e 206f 6620 6120 636f 6e74 6f75 tion of a contou │ │ │ +00063dc0: 7220 6279 2074 616b 696e 6720 7468 6520 r by taking the │ │ │ +00063dd0: 7369 676e 206f 6620 616e 2061 7265 612e sign of an area. │ │ │ +00063de0: 2042 7920 6465 6661 756c 742c 2074 6865 By default, the │ │ │ +00063df0: 2070 6172 616d 6574 6572 2069 730a 6661 parameter is.fa │ │ │ +00063e00: 6c73 652c 2077 6869 6368 206d 6561 6e73 lse, which means │ │ │ +00063e10: 2074 6861 7420 7468 6520 6162 736f 6c75 that the absolu │ │ │ +00063e20: 7465 2076 616c 7565 2069 7320 7265 7475 te value is retu │ │ │ +00063e30: 726e 6564 2e3c 2f64 643e 0a3c 6474 3e52 rned.
    .
    R │ │ │ +00063e40: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    automatically g │ │ │ +00063e60: 656e 6572 6174 6564 3c2f 6464 3e0a 3c2f enerated
    ....
  • .
  • │ │ │ +00063e90: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    . │ │ │ +00063ed0: 3c68 333e 636f 6e74 6f75 7241 7265 613c

    contourArea< │ │ │ +00063ee0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +00063f40: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +00063f50: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;d │ │ │ +00063f70: 6f75 626c 653c 2f73 7061 6e3e 266e 6273 ouble&nbs │ │ │ +00063f80: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;con │ │ │ +00063fa0: 746f 7572 4172 6561 3c2f 7370 616e 3e3c tourArea< │ │ │ +00063fb0: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat contour)< │ │ │ +00064020: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ +00064040: 4361 6c63 756c 6174 6573 2061 2063 6f6e Calculates a con │ │ │ +00064050: 746f 7572 2061 7265 612e 0a0a 5468 6520 tour area...The │ │ │ +00064060: 6675 6e63 7469 6f6e 2063 6f6d 7075 7465 function compute │ │ │ +00064070: 7320 6120 636f 6e74 6f75 7220 6172 6561 s a contour area │ │ │ +00064080: 2e20 5369 6d69 6c61 726c 7920 746f 206d . Similarly to m │ │ │ +00064090: 6f6d 656e 7473 202c 2074 6865 2061 7265 oments , the are │ │ │ +000640a0: 6120 6973 2063 6f6d 7075 7465 6420 7573 a is computed us │ │ │ +000640b0: 696e 6720 7468 6520 4772 6565 6e0a 666f ing the Green.fo │ │ │ +000640c0: 726d 756c 612e 2054 6875 732c 2074 6865 rmula. Thus, the │ │ │ +000640d0: 2072 6574 7572 6e65 6420 6172 6561 2061 returned area a │ │ │ +000640e0: 6e64 2074 6865 206e 756d 6265 7220 6f66 nd the number of │ │ │ +000640f0: 206e 6f6e 2d7a 6572 6f20 7069 7865 6c73 non-zero pixels │ │ │ +00064100: 2c20 6966 2079 6f75 2064 7261 7720 7468 , if you draw th │ │ │ +00064110: 6520 636f 6e74 6f75 7220 7573 696e 670a e contour using. │ │ │ +00064120: 2364 7261 7743 6f6e 746f 7572 7320 6f72 #drawContours or │ │ │ +00064130: 2023 6669 6c6c 506f 6c79 202c 2063 616e #fillPoly , can │ │ │ +00064140: 2062 6520 6469 6666 6572 656e 742e 2041 be different. A │ │ │ +00064150: 6c73 6f2c 2074 6865 2066 756e 6374 696f lso, the functio │ │ │ +00064160: 6e20 7769 6c6c 206d 6f73 7420 6365 7274 n will most cert │ │ │ +00064170: 6169 6e6c 7920 6769 7665 2061 2077 726f ainly give a wro │ │ │ +00064180: 6e67 0a72 6573 756c 7473 2066 6f72 2063 ng.results for c │ │ │ +00064190: 6f6e 746f 7572 7320 7769 7468 2073 656c ontours with sel │ │ │ +000641a0: 662d 696e 7465 7273 6563 7469 6f6e 732e f-intersections. │ │ │ +000641b0: 0a0a 4578 616d 706c 653a 0a3c 636f 6465 ..Example:..vector<Poin │ │ │ +000641d0: 7426 6774 3b20 636f 6e74 6f75 723b 0a63 t> contour;.c │ │ │ +000641e0: 6f6e 746f 7572 2e70 7573 685f 6261 636b ontour.push_back │ │ │ +000641f0: 2850 6f69 6e74 3266 2830 2c20 3029 293b (Point2f(0, 0)); │ │ │ +00064200: 0a63 6f6e 746f 7572 2e70 7573 685f 6261 .contour.push_ba │ │ │ +00064210: 636b 2850 6f69 6e74 3266 2831 302c 2030 ck(Point2f(10, 0 │ │ │ +00064220: 2929 3b0a 636f 6e74 6f75 722e 7075 7368 ));.contour.push │ │ │ +00064230: 5f62 6163 6b28 506f 696e 7432 6628 3130 _back(Point2f(10 │ │ │ +00064240: 2c20 3130 2929 3b0a 636f 6e74 6f75 722e , 10));.contour. │ │ │ +00064250: 7075 7368 5f62 6163 6b28 506f 696e 7432 push_back(Point2 │ │ │ +00064260: 6628 352c 2034 2929 3b0a 0a64 6f75 626c f(5, 4));..doubl │ │ │ +00064270: 6520 6172 6561 3020 3d20 636f 6e74 6f75 e area0 = contou │ │ │ +00064280: 7241 7265 6128 636f 6e74 6f75 7229 3b0a rArea(contour);. │ │ │ +00064290: 7665 6374 6f72 266c 743b 506f 696e 7426 vector<Point& │ │ │ +000642a0: 6774 3b20 6170 7072 6f78 3b0a 6170 7072 gt; approx;.appr │ │ │ +000642b0: 6f78 506f 6c79 4450 2863 6f6e 746f 7572 oxPolyDP(contour │ │ │ +000642c0: 2c20 6170 7072 6f78 2c20 352c 2074 7275 , approx, 5, tru │ │ │ +000642d0: 6529 3b0a 646f 7562 6c65 2061 7265 6131 e);.double area1 │ │ │ +000642e0: 203d 2063 6f6e 746f 7572 4172 6561 2861 = contourArea(a │ │ │ +000642f0: 7070 726f 7829 3b0a 0a63 6f75 7420 266c pprox);..cout &l │ │ │ +00064300: 743b 266c 743b 2022 6172 6561 3020 3d22 t;< "area0 =" │ │ │ +00064310: 2026 6c74 3b26 6c74 3b20 6172 6561 3020 << area0 │ │ │ +00064320: 266c 743b 266c 743b 2065 6e64 6c20 266c << endl &l │ │ │ +00064330: 743b 266c 743b 0a22 6172 6561 3120 3d22 t;<."area1 =" │ │ │ +00064340: 2026 6c74 3b26 6c74 3b20 6172 6561 3120 << area1 │ │ │ +00064350: 266c 743b 266c 743b 2065 6e64 6c20 266c << endl &l │ │ │ +00064360: 743b 266c 743b 0a22 6170 7072 6f78 2070 t;<."approx p │ │ │ +00064370: 6f6c 7920 7665 7274 6963 6573 2220 266c oly vertices" &l │ │ │ +00064380: 743b 266c 743b 2061 7070 726f 782e 7369 t;< approx.si │ │ │ +00064390: 7a65 2829 2026 6c74 3b26 6c74 3b20 656e ze() << en │ │ │ +000643a0: 646c 3b0a 3c2f 636f 6465 3e3c 2f64 6976 dl;.
    .
    .
    Paramet │ │ │ +000643d0: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    contour - Input vecto │ │ │ +00064400: 7220 6f66 2032 4420 706f 696e 7473 2028 r of 2D points ( │ │ │ +00064410: 636f 6e74 6f75 7220 7665 7274 6963 6573 contour vertices │ │ │ +00064420: 292c 2073 746f 7265 6420 696e 2073 7464 ), stored in std │ │ │ +00064430: 3a3a 7665 6374 6f72 206f 7220 4d61 742e ::vector or Mat. │ │ │ +00064440: 0a64 6570 656e 6469 6e67 206f 6e20 7468 .depending on th │ │ │ +00064450: 6520 636f 6e74 6f75 7220 6f72 6965 6e74 e contour orient │ │ │ +00064460: 6174 696f 6e20 2863 6c6f 636b 7769 7365 ation (clockwise │ │ │ +00064470: 206f 7220 636f 756e 7465 722d 636c 6f63 or counter-cloc │ │ │ +00064480: 6b77 6973 6529 2e20 5573 696e 6720 7468 kwise). Using th │ │ │ +00064490: 6973 2066 6561 7475 7265 2079 6f75 2063 is feature you c │ │ │ +000644a0: 616e 0a64 6574 6572 6d69 6e65 206f 7269 an.determine ori │ │ │ +000644b0: 656e 7461 7469 6f6e 206f 6620 6120 636f entation of a co │ │ │ +000644c0: 6e74 6f75 7220 6279 2074 616b 696e 6720 ntour by taking │ │ │ +000644d0: 7468 6520 7369 676e 206f 6620 616e 2061 the sign of an a │ │ │ +000644e0: 7265 612e 2042 7920 6465 6661 756c 742c rea. By default, │ │ │ +000644f0: 2074 6865 2070 6172 616d 6574 6572 2069 the parameter i │ │ │ +00064500: 730a 6661 6c73 652c 2077 6869 6368 206d s.false, which m │ │ │ +00064510: 6561 6e73 2074 6861 7420 7468 6520 6162 eans that the ab │ │ │ +00064520: 736f 6c75 7465 2076 616c 7565 2069 7320 solute value is │ │ │ +00064530: 7265 7475 726e 6564 2e3c 2f64 643e 0a3c returned.
    .< │ │ │ +00064540: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ +00064550: 0a3c 6464 3e61 7574 6f6d 6174 6963 616c .
    automatical │ │ │ +00064560: 6c79 2067 656e 6572 6174 6564 3c2f 6464 ly generated
    .
    ..< │ │ │ +00064580: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.

  • . │ │ │ +00064590: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    boundin │ │ │ +000645e0: 6752 6563 743c 2f68 333e 0a3c 6469 7620 gRect

    .
    .
    public static Rect boundingRect( │ │ │ +00064750: 4d61 743c 2f61 3e26 6e62 7370 3b61 7272 Mat arr │ │ │ +00064760: 6179 293c 2f73 7061 6e3e 3c2f 6469 763e ay)
    │ │ │ +00064770: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Calculates t │ │ │ +00064790: 6865 2075 702d 7269 6768 7420 626f 756e he up-right boun │ │ │ +000647a0: 6469 6e67 2072 6563 7461 6e67 6c65 206f ding rectangle o │ │ │ +000647b0: 6620 6120 706f 696e 7420 7365 7420 6f72 f a point set or │ │ │ +000647c0: 206e 6f6e 2d7a 6572 6f20 7069 7865 6c73 non-zero pixels │ │ │ +000647d0: 206f 6620 6772 6179 2d73 6361 6c65 2069 of gray-scale i │ │ │ +000647e0: 6d61 6765 2e0a 0a54 6865 2066 756e 6374 mage...The funct │ │ │ +000647f0: 696f 6e20 6361 6c63 756c 6174 6573 2061 ion calculates a │ │ │ +00064800: 6e64 2072 6574 7572 6e73 2074 6865 206d nd returns the m │ │ │ +00064810: 696e 696d 616c 2075 702d 7269 6768 7420 inimal up-right │ │ │ +00064820: 626f 756e 6469 6e67 2072 6563 7461 6e67 bounding rectang │ │ │ +00064830: 6c65 2066 6f72 2074 6865 2073 7065 6369 le for the speci │ │ │ +00064840: 6669 6564 2070 6f69 6e74 2073 6574 206f fied point set o │ │ │ +00064850: 720a 6e6f 6e2d 7a65 726f 2070 6978 656c r.non-zero pixel │ │ │ +00064860: 7320 6f66 2067 7261 792d 7363 616c 6520 s of gray-scale │ │ │ +00064870: 696d 6167 652e 3c2f 6469 763e 0a3c 646c image.
    .
    . │ │ │ +00064890: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ +000648a0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e61 /dt>.
    a │ │ │ +000648b0: 7272 6179 3c2f 636f 6465 3e20 2d20 496e rray - In │ │ │ +000648c0: 7075 7420 6772 6179 2d73 6361 6c65 2069 put gray-scale i │ │ │ +000648d0: 6d61 6765 206f 7220 3244 2070 6f69 6e74 mage or 2D point │ │ │ +000648e0: 2073 6574 2c20 7374 6f72 6564 2069 6e20 set, stored in │ │ │ +000648f0: 7374 643a 3a76 6563 746f 7220 6f72 204d std::vector or M │ │ │ +00064900: 6174 2e3c 2f64 643e 0a3c 6474 3e52 6574 at.
    .
    Ret │ │ │ +00064910: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e61 urns:
    .
    a │ │ │ +00064920: 7574 6f6d 6174 6963 616c 6c79 2067 656e utomatically gen │ │ │ +00064930: 6572 6174 6564 3c2f 6464 3e0a 3c2f 646c erated
    .
    .
    ..
  • .
  • ..Rodrigues │ │ │ +00066c10: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ +00066c30: 0a3c 6469 7620 636c 6173 733d 226d 656d .. │ │ │ +00066da0: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Converts a ro │ │ │ +00066dc0: 7461 7469 6f6e 206d 6174 7269 7820 746f tation matrix to │ │ │ +00066dd0: 2061 2072 6f74 6174 696f 6e20 7665 6374 a rotation vect │ │ │ +00066de0: 6f72 206f 7220 7669 6365 2076 6572 7361 or or vice versa │ │ │ +00066df0: 2e3c 2f64 6976 3e0a 3c64 6c20 636c 6173 .
    .
    .
    P │ │ │ +00066e10: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ +00066e20: 3c64 643e 3c63 6f64 653e 7372 633c 2f63
    src - Input rot │ │ │ +00066e40: 6174 696f 6e20 7665 6374 6f72 2028 3378 ation vector (3x │ │ │ +00066e50: 3120 6f72 2031 7833 2920 6f72 2072 6f74 1 or 1x3) or rot │ │ │ +00066e60: 6174 696f 6e20 6d61 7472 6978 2028 3378 ation matrix (3x │ │ │ +00066e70: 3329 2e3c 2f64 643e 0a3c 6464 3e3c 636f 3).
    .
    dst - │ │ │ +00066e90: 4f75 7470 7574 2072 6f74 6174 696f 6e20 Output rotation │ │ │ +00066ea0: 6d61 7472 6978 2028 3378 3329 206f 7220 matrix (3x3) or │ │ │ +00066eb0: 726f 7461 7469 6f6e 2076 6563 746f 7220 rotation vector │ │ │ +00066ec0: 2833 7831 206f 7220 3178 3329 2c20 7265 (3x1 or 1x3), re │ │ │ +00066ed0: 7370 6563 7469 7665 6c79 2e0a 6465 7269 spectively..deri │ │ │ +00066ee0: 7661 7469 7665 7320 6f66 2074 6865 206f vatives of the o │ │ │ +00066ef0: 7574 7075 7420 6172 7261 7920 636f 6d70 utput array comp │ │ │ +00066f00: 6f6e 656e 7473 2077 6974 6820 7265 7370 onents with resp │ │ │ +00066f10: 6563 7420 746f 2074 6865 2069 6e70 7574 ect to the input │ │ │ +00066f20: 2061 7272 6179 2063 6f6d 706f 6e65 6e74 array component │ │ │ +00066f30: 732e 0a0a 5c28 5c62 6567 696e 7b61 7272 s...\(\begin{arr │ │ │ +00066f40: 6179 7d7b 6c7d 205c 7468 6574 6120 5c6c ay}{l} \theta \l │ │ │ +00066f50: 6566 7461 7272 6f77 206e 6f72 6d28 7229 eftarrow norm(r) │ │ │ +00066f60: 205c 5c20 7220 205c 6c65 6674 6172 726f \\ r \leftarro │ │ │ +00066f70: 7720 722f 205c 7468 6574 6120 5c5c 2052 w r/ \theta \\ R │ │ │ +00066f80: 203d 2020 5c63 6f73 285c 7468 6574 6129 = \cos(\theta) │ │ │ +00066f90: 2049 202b 2028 312d 205c 636f 737b 5c74 I + (1- \cos{\t │ │ │ +00066fa0: 6865 7461 7d20 2920 7220 725e 5420 2b20 heta} ) r r^T + │ │ │ +00066fb0: 205c 7369 6e28 5c74 6865 7461 2920 5c76 \sin(\theta) \v │ │ │ +00066fc0: 6563 7468 7265 6574 6872 6565 7b30 7d7b ecthreethree{0}{ │ │ │ +00066fd0: 2d72 5f7a 7d7b 725f 797d 7b72 5f7a 7d7b -r_z}{r_y}{r_z}{ │ │ │ +00066fe0: 307d 7b2d 725f 787d 7b2d 725f 797d 7b72 0}{-r_x}{-r_y}{r │ │ │ +00066ff0: 5f78 7d7b 307d 205c 656e 647b 6172 7261 _x}{0} \end{arra │ │ │ +00067000: 797d 5c29 0a0a 496e 7665 7273 6520 7472 y}\)..Inverse tr │ │ │ +00067010: 616e 7366 6f72 6d61 7469 6f6e 2063 616e ansformation can │ │ │ +00067020: 2062 6520 616c 736f 2064 6f6e 6520 6561 be also done ea │ │ │ +00067030: 7369 6c79 2c20 7369 6e63 650a 0a5c 285c sily, since..\(\ │ │ │ +00067040: 7369 6e20 2820 5c74 6865 7461 2029 205c sin ( \theta ) \ │ │ │ +00067050: 7665 6374 6872 6565 7468 7265 657b 307d vecthreethree{0} │ │ │ +00067060: 7b2d 725f 7a7d 7b72 5f79 7d7b 725f 7a7d {-r_z}{r_y}{r_z} │ │ │ +00067070: 7b30 7d7b 2d72 5f78 7d7b 2d72 5f79 7d7b {0}{-r_x}{-r_y}{ │ │ │ +00067080: 725f 787d 7b30 7d20 3d20 5c66 7261 637b r_x}{0} = \frac{ │ │ │ +00067090: 5220 2d20 525e 547d 7b32 7d5c 290a 0a41 R - R^T}{2}\)..A │ │ │ +000670a0: 2072 6f74 6174 696f 6e20 7665 6374 6f72 rotation vector │ │ │ +000670b0: 2069 7320 6120 636f 6e76 656e 6965 6e74 is a convenient │ │ │ +000670c0: 2061 6e64 206d 6f73 7420 636f 6d70 6163 and most compac │ │ │ +000670d0: 7420 7265 7072 6573 656e 7461 7469 6f6e t representation │ │ │ +000670e0: 206f 6620 6120 726f 7461 7469 6f6e 206d of a rotation m │ │ │ +000670f0: 6174 7269 7820 2873 696e 6365 2061 6e79 atrix (since any │ │ │ +00067100: 0a72 6f74 6174 696f 6e20 6d61 7472 6978 .rotation matrix │ │ │ +00067110: 2068 6173 206a 7573 7420 3320 6465 6772 has just 3 degr │ │ │ +00067120: 6565 7320 6f66 2066 7265 6564 6f6d 292e ees of freedom). │ │ │ +00067130: 2054 6865 2072 6570 7265 7365 6e74 6174 The representat │ │ │ +00067140: 696f 6e20 6973 2075 7365 6420 696e 2074 ion is used in t │ │ │ +00067150: 6865 2067 6c6f 6261 6c20 3344 2067 656f he global 3D geo │ │ │ +00067160: 6d65 7472 790a 6f70 7469 6d69 7a61 7469 metry.optimizati │ │ │ +00067170: 6f6e 2070 726f 6365 6475 7265 7320 6c69 on procedures li │ │ │ +00067180: 6b65 2052 4546 3a20 6361 6c69 6272 6174 ke REF: calibrat │ │ │ +00067190: 6543 616d 6572 612c 2052 4546 3a20 7374 eCamera, REF: st │ │ │ +000671a0: 6572 656f 4361 6c69 6272 6174 652c 206f ereoCalibrate, o │ │ │ +000671b0: 7220 5245 463a 2073 6f6c 7665 506e 5020 r REF: solvePnP │ │ │ +000671c0: 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 3e20 ...Note: │ │ │ +000671d0: 4d6f 7265 2069 6e66 6f72 6d61 7469 6f6e More information │ │ │ +000671e0: 2061 626f 7574 2074 6865 2063 6f6d 7075 about the compu │ │ │ +000671f0: 7461 7469 6f6e 206f 6620 7468 6520 6465 tation of the de │ │ │ +00067200: 7269 7661 7469 7665 206f 6620 6120 3344 rivative of a 3D │ │ │ +00067210: 2072 6f74 6174 696f 6e20 6d61 7472 6978 rotation matrix │ │ │ +00067220: 2077 6974 6820 7265 7370 6563 7420 746f with respect to │ │ │ +00067230: 2069 7473 2065 7870 6f6e 656e 7469 616c its exponential │ │ │ +00067240: 2063 6f6f 7264 696e 6174 650a 6361 6e20 coordinate.can │ │ │ +00067250: 6265 2066 6f75 6e64 2069 6e3a 0a3c 756c be found in:.
      .
    • . A │ │ │ +00067270: 436f 6d70 6163 7420 466f 726d 756c 6120 Compact Formula │ │ │ +00067280: 666f 7220 7468 6520 4465 7269 7661 7469 for the Derivati │ │ │ +00067290: 7665 206f 6620 6120 332d 4420 526f 7461 ve of a 3-D Rota │ │ │ +000672a0: 7469 6f6e 2069 6e20 4578 706f 6e65 6e74 tion in Exponent │ │ │ +000672b0: 6961 6c20 436f 6f72 6469 6e61 7465 732c ial Coordinates, │ │ │ +000672c0: 2047 7569 6c6c 6572 6d6f 2047 616c 6c65 Guillermo Galle │ │ │ +000672d0: 676f 2c20 416e 7468 6f6e 7920 4a2e 2059 go, Anthony J. Y │ │ │ +000672e0: 657a 7a69 2043 4954 453a 2047 616c 6c65 ezzi CITE: Galle │ │ │ +000672f0: 676f 3230 3134 4143 460a 2020 3c2f 6c69 go2014ACF.
    • .
    ..Note │ │ │ +00067310: 3a3c 2f62 3e20 5573 6566 756c 2069 6e66 : Useful inf │ │ │ +00067320: 6f72 6d61 7469 6f6e 206f 6e20 5345 2833 ormation on SE(3 │ │ │ +00067330: 2920 616e 6420 4c69 6520 4772 6f75 7073 ) and Lie Groups │ │ │ +00067340: 2063 616e 2062 6520 666f 756e 6420 696e can be found in │ │ │ +00067350: 3a0a 3c75 6c3e 0a20 203c 6c69 3e0a 2020 :.
      .
    • . │ │ │ +00067360: 2020 2041 2074 7574 6f72 6961 6c20 6f6e A tutorial on │ │ │ +00067370: 2053 4528 3329 2074 7261 6e73 666f 726d SE(3) transform │ │ │ +00067380: 6174 696f 6e20 7061 7261 6d65 7465 7269 ation parameteri │ │ │ +00067390: 7a61 7469 6f6e 7320 616e 6420 6f6e 2d6d zations and on-m │ │ │ +000673a0: 616e 6966 6f6c 6420 6f70 7469 6d69 7a61 anifold optimiza │ │ │ +000673b0: 7469 6f6e 2c20 4a6f 7365 2d4c 7569 7320 tion, Jose-Luis │ │ │ +000673c0: 426c 616e 636f 2043 4954 453a 2062 6c61 Blanco CITE: bla │ │ │ +000673d0: 6e63 6f32 3031 3074 7574 6f72 6961 6c0a nco2010tutorial. │ │ │ +000673e0: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ +000673f0: 2020 2020 4c69 6520 4772 6f75 7073 2066 Lie Groups f │ │ │ +00067400: 6f72 2032 4420 616e 6420 3344 2054 7261 or 2D and 3D Tra │ │ │ +00067410: 6e73 666f 726d 6174 696f 6e2c 2045 7468 nsformation, Eth │ │ │ +00067420: 616e 2045 6164 6520 4349 5445 3a20 4561 an Eade CITE: Ea │ │ │ +00067430: 6465 3137 0a20 203c 2f6c 693e 0a20 203c de17.
    • . < │ │ │ +00067440: 6c69 3e0a 2020 2020 2041 206d 6963 726f li>. A micro │ │ │ +00067450: 204c 6965 2074 6865 6f72 7920 666f 7220 Lie theory for │ │ │ +00067460: 7374 6174 6520 6573 7469 6d61 7469 6f6e state estimation │ │ │ +00067470: 2069 6e20 726f 626f 7469 6373 2c20 4a6f in robotics, Jo │ │ │ +00067480: 616e 2053 6f6c c3a0 2c20 4ac3 a972 c3a9 an Sol.., J..r.. │ │ │ +00067490: 6d69 6520 4465 7261 792c 2044 696e 6573 mie Deray, Dines │ │ │ +000674a0: 6820 4174 6368 7574 6861 6e20 4349 5445 h Atchuthan CITE │ │ │ +000674b0: 3a20 536f 6c32 3031 3841 4d4c 0a20 203c : Sol2018AML. < │ │ │ +000674c0: 2f6c 693e 0a3c 2f75 6c3e 3c2f 6464 3e0a /li>.
    . │ │ │ +000674d0: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    .
    .
  • ..
    .

    findHom │ │ │ +00067590: 6f67 7261 7068 793c 2f68 333e 0a3c 6469 ography

    ..public static │ │ │ +00067600: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  Mat findHomography │ │ │ +000676a0: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (MatOf │ │ │ +00067710: 506f 696e 7432 663c 2f61 3e26 6e62 7370 Point2f  │ │ │ +00067720: 3b73 7263 506f 696e 7473 2c0a 203c 6120 ;srcPoints,. MatOfPoint2f dstPoint │ │ │ +00067790: 732c 0a20 696e 7426 6e62 7370 3b6d 6574 s,. int met │ │ │ +000677a0: 686f 642c 0a20 646f 7562 6c65 266e 6273 hod,. double&nbs │ │ │ +000677b0: 703b 7261 6e73 6163 5265 7072 6f6a 5468 p;ransacReprojTh │ │ │ +000677c0: 7265 7368 6f6c 642c 0a20 3c61 2068 7265 reshold,. Mat&nb │ │ │ +00067810: 7370 3b6d 6173 6b2c 0a20 696e 7426 6e62 sp;mask,. int&nb │ │ │ +00067820: 7370 3b6d 6178 4974 6572 732c 0a20 646f sp;maxIters,. do │ │ │ +00067830: 7562 6c65 266e 6273 703b 636f 6e66 6964 uble confid │ │ │ +00067840: 656e 6365 293c 2f73 7061 6e3e 3c2f 6469 ence).
    Finds a pe │ │ │ +00067870: 7273 7065 6374 6976 6520 7472 616e 7366 rspective transf │ │ │ +00067880: 6f72 6d61 7469 6f6e 2062 6574 7765 656e ormation between │ │ │ +00067890: 2074 776f 2070 6c61 6e65 732e 3c2f 6469 two planes..
    .
    Parame │ │ │ +000678c0: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ +000678d0: 636f 6465 3e73 7263 506f 696e 7473 3c2f code>srcPoints - Coordina │ │ │ +000678f0: 7465 7320 6f66 2074 6865 2070 6f69 6e74 tes of the point │ │ │ +00067900: 7320 696e 2074 6865 206f 7269 6769 6e61 s in the origina │ │ │ +00067910: 6c20 706c 616e 652c 2061 206d 6174 7269 l plane, a matri │ │ │ +00067920: 7820 6f66 2074 6865 2074 7970 6520 4356 x of the type CV │ │ │ +00067930: 5f33 3246 4332 0a6f 7220 7665 6374 6f72 _32FC2.or vector │ │ │ +00067940: 266c 743b 506f 696e 7432 6626 6774 3b20 <Point2f> │ │ │ +00067950: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    dstPoints - Coordinates │ │ │ +00067980: 6f66 2074 6865 2070 6f69 6e74 7320 696e of the points in │ │ │ +00067990: 2074 6865 2074 6172 6765 7420 706c 616e the target plan │ │ │ +000679a0: 652c 2061 206d 6174 7269 7820 6f66 2074 e, a matrix of t │ │ │ +000679b0: 6865 2074 7970 6520 4356 5f33 3246 4332 he type CV_32FC2 │ │ │ +000679c0: 206f 720a 6120 7665 6374 6f72 266c 743b or.a vector< │ │ │ +000679d0: 506f 696e 7432 6626 6774 3b20 2e3c 2f64 Point2f> ..
    met │ │ │ +000679f0: 686f 643c 2f63 6f64 653e 202d 204d 6574 hod - Met │ │ │ +00067a00: 686f 6420 7573 6564 2074 6f20 636f 6d70 hod used to comp │ │ │ +00067a10: 7574 6520 6120 686f 6d6f 6772 6170 6879 ute a homography │ │ │ +00067a20: 206d 6174 7269 782e 2054 6865 2066 6f6c matrix. The fol │ │ │ +00067a30: 6c6f 7769 6e67 206d 6574 686f 6473 2061 lowing methods a │ │ │ +00067a40: 7265 2070 6f73 7369 626c 653a 0a3c 756c re possible:.
      .
    • . 0 │ │ │ +00067a60: 3c2f 623e 202d 2061 2072 6567 756c 6172 - a regular │ │ │ +00067a70: 206d 6574 686f 6420 7573 696e 6720 616c method using al │ │ │ +00067a80: 6c20 7468 6520 706f 696e 7473 2c20 692e l the points, i. │ │ │ +00067a90: 652e 2c20 7468 6520 6c65 6173 7420 7371 e., the least sq │ │ │ +00067aa0: 7561 7265 7320 6d65 7468 6f64 0a20 203c uares method. < │ │ │ +00067ab0: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2052 /li>.
    • . R │ │ │ +00067ac0: 4546 3a20 5241 4e53 4143 202d 2052 414e EF: RANSAC - RAN │ │ │ +00067ad0: 5341 432d 6261 7365 6420 726f 6275 7374 SAC-based robust │ │ │ +00067ae0: 206d 6574 686f 640a 2020 3c2f 6c69 3e0a method.
    • . │ │ │ +00067af0: 2020 3c6c 693e 0a20 2020 5245 463a 204c
    • . REF: L │ │ │ +00067b00: 4d45 4453 202d 204c 6561 7374 2d4d 6564 MEDS - Least-Med │ │ │ +00067b10: 6961 6e20 726f 6275 7374 206d 6574 686f ian robust metho │ │ │ +00067b20: 640a 2020 3c2f 6c69 3e0a 2020 3c6c 693e d.
    • .
    • │ │ │ +00067b30: 0a20 2020 5245 463a 2052 484f 202d 2050 . REF: RHO - P │ │ │ +00067b40: 524f 5341 432d 6261 7365 6420 726f 6275 ROSAC-based robu │ │ │ +00067b50: 7374 206d 6574 686f 640a 2020 3c2f 6c69 st method.
    • .
    .
    ransacRep │ │ │ +00067b80: 726f 6a54 6872 6573 686f 6c64 3c2f 636f rojThreshold - Maximum al │ │ │ +00067ba0: 6c6f 7765 6420 7265 7072 6f6a 6563 7469 lowed reprojecti │ │ │ +00067bb0: 6f6e 2065 7272 6f72 2074 6f20 7472 6561 on error to trea │ │ │ +00067bc0: 7420 6120 706f 696e 7420 7061 6972 2061 t a point pair a │ │ │ +00067bd0: 7320 616e 2069 6e6c 6965 720a 2875 7365 s an inlier.(use │ │ │ +00067be0: 6420 696e 2074 6865 2052 414e 5341 4320 d in the RANSAC │ │ │ +00067bf0: 616e 6420 5248 4f20 6d65 7468 6f64 7320 and RHO methods │ │ │ +00067c00: 6f6e 6c79 292e 2054 6861 7420 6973 2c20 only). That is, │ │ │ +00067c10: 6966 0a5c 285c 7c20 5c74 6578 7474 747b if.\(\| \texttt{ │ │ │ +00067c20: 6473 7450 6f69 6e74 737d 205f 6920 2d20 dstPoints} _i - │ │ │ +00067c30: 205c 7465 7874 7474 7b63 6f6e 7665 7274 \texttt{convert │ │ │ +00067c40: 506f 696e 7473 486f 6d6f 6765 6e65 6f75 PointsHomogeneou │ │ │ +00067c50: 737d 2028 205c 7465 7874 7474 7b48 7d20 s} ( \texttt{H} │ │ │ +00067c60: 5c63 646f 7420 5c74 6578 7474 747b 7372 \cdot \texttt{sr │ │ │ +00067c70: 6350 6f69 6e74 737d 205f 6929 205c 7c5f cPoints} _i) \|_ │ │ │ +00067c80: 3220 2026 6774 3b20 205c 7465 7874 7474 2 > \texttt │ │ │ +00067c90: 7b72 616e 7361 6352 6570 726f 6a54 6872 {ransacReprojThr │ │ │ +00067ca0: 6573 686f 6c64 7d5c 290a 7468 656e 2074 eshold}\).then t │ │ │ +00067cb0: 6865 2070 6f69 6e74 205c 2869 5c29 2069 he point \(i\) i │ │ │ +00067cc0: 7320 636f 6e73 6964 6572 6564 2061 7320 s considered as │ │ │ +00067cd0: 616e 206f 7574 6c69 6572 2e20 4966 2073 an outlier. If s │ │ │ +00067ce0: 7263 506f 696e 7473 2061 6e64 2064 7374 rcPoints and dst │ │ │ +00067cf0: 506f 696e 7473 2061 7265 206d 6561 7375 Points are measu │ │ │ +00067d00: 7265 6420 696e 2070 6978 656c 732c 0a69 red in pixels,.i │ │ │ +00067d10: 7420 7573 7561 6c6c 7920 6d61 6b65 7320 t usually makes │ │ │ +00067d20: 7365 6e73 6520 746f 2073 6574 2074 6869 sense to set thi │ │ │ +00067d30: 7320 7061 7261 6d65 7465 7220 736f 6d65 s parameter some │ │ │ +00067d40: 7768 6572 6520 696e 2074 6865 2072 616e where in the ran │ │ │ +00067d50: 6765 206f 6620 3120 746f 2031 302e 3c2f ge of 1 to 10..
    ma │ │ │ +00067d70: 736b 3c2f 636f 6465 3e20 2d20 4f70 7469 sk - Opti │ │ │ +00067d80: 6f6e 616c 206f 7574 7075 7420 6d61 736b onal output mask │ │ │ +00067d90: 2073 6574 2062 7920 6120 726f 6275 7374 set by a robust │ │ │ +00067da0: 206d 6574 686f 6420 2820 5241 4e53 4143 method ( RANSAC │ │ │ +00067db0: 206f 7220 4c4d 6544 5320 292e 204e 6f74 or LMeDS ). Not │ │ │ +00067dc0: 6520 7468 6174 2074 6865 2069 6e70 7574 e that the input │ │ │ +00067dd0: 0a6d 6173 6b20 7661 6c75 6573 2061 7265 .mask values are │ │ │ +00067de0: 2069 676e 6f72 6564 2e3c 2f64 643e 0a3c ignored.
    .< │ │ │ +00067df0: 6464 3e3c 636f 6465 3e6d 6178 4974 6572 dd>maxIter │ │ │ +00067e00: 733c 2f63 6f64 653e 202d 2054 6865 206d s - The m │ │ │ +00067e10: 6178 696d 756d 206e 756d 6265 7220 6f66 aximum number of │ │ │ +00067e20: 2052 414e 5341 4320 6974 6572 6174 696f RANSAC iteratio │ │ │ +00067e30: 6e73 2e3c 2f64 643e 0a3c 6464 3e3c 636f ns..
    confidence - Confidenc │ │ │ +00067e60: 6520 6c65 7665 6c2c 2062 6574 7765 656e e level, between │ │ │ +00067e70: 2030 2061 6e64 2031 2e0a 0a54 6865 2066 0 and 1...The f │ │ │ +00067e80: 756e 6374 696f 6e20 6669 6e64 7320 616e unction finds an │ │ │ +00067e90: 6420 7265 7475 726e 7320 7468 6520 7065 d returns the pe │ │ │ +00067ea0: 7273 7065 6374 6976 6520 7472 616e 7366 rspective transf │ │ │ +00067eb0: 6f72 6d61 7469 6f6e 205c 2848 5c29 2062 ormation \(H\) b │ │ │ +00067ec0: 6574 7765 656e 2074 6865 2073 6f75 7263 etween the sourc │ │ │ +00067ed0: 6520 616e 6420 7468 650a 6465 7374 696e e and the.destin │ │ │ +00067ee0: 6174 696f 6e20 706c 616e 6573 3a0a 0a5c ation planes:..\ │ │ │ +00067ef0: 2873 5f69 2020 5c76 6563 7468 7265 657b (s_i \vecthree{ │ │ │ +00067f00: 7827 5f69 7d7b 7927 5f69 7d7b 317d 205c x'_i}{y'_i}{1} \ │ │ │ +00067f10: 7369 6d20 4820 205c 7665 6374 6872 6565 sim H \vecthree │ │ │ +00067f20: 7b78 5f69 7d7b 795f 697d 7b31 7d5c 290a {x_i}{y_i}{1}\). │ │ │ +00067f30: 0a73 6f20 7468 6174 2074 6865 2062 6163 .so that the bac │ │ │ +00067f40: 6b2d 7072 6f6a 6563 7469 6f6e 2065 7272 k-projection err │ │ │ +00067f50: 6f72 0a0a 5c28 5c73 756d 205f 6920 5c6c or..\(\sum _i \l │ │ │ +00067f60: 6566 7420 2820 7827 5f69 2d20 5c66 7261 eft ( x'_i- \fra │ │ │ +00067f70: 637b 685f 7b31 317d 2078 5f69 202b 2068 c{h_{11} x_i + h │ │ │ +00067f80: 5f7b 3132 7d20 795f 6920 2b20 685f 7b31 _{12} y_i + h_{1 │ │ │ +00067f90: 337d 7d7b 685f 7b33 317d 2078 5f69 202b 3}}{h_{31} x_i + │ │ │ +00067fa0: 2068 5f7b 3332 7d20 795f 6920 2b20 685f h_{32} y_i + h_ │ │ │ +00067fb0: 7b33 337d 7d20 5c72 6967 6874 2029 5e32 {33}} \right )^2 │ │ │ +00067fc0: 2b20 5c6c 6566 7420 2820 7927 5f69 2d20 + \left ( y'_i- │ │ │ +00067fd0: 5c66 7261 637b 685f 7b32 317d 2078 5f69 \frac{h_{21} x_i │ │ │ +00067fe0: 202b 2068 5f7b 3232 7d20 795f 6920 2b20 + h_{22} y_i + │ │ │ +00067ff0: 685f 7b32 337d 7d7b 685f 7b33 317d 2078 h_{23}}{h_{31} x │ │ │ +00068000: 5f69 202b 2068 5f7b 3332 7d20 795f 6920 _i + h_{32} y_i │ │ │ +00068010: 2b20 685f 7b33 337d 7d20 5c72 6967 6874 + h_{33}} \right │ │ │ +00068020: 2029 5e32 5c29 0a0a 6973 206d 696e 696d )^2\)..is minim │ │ │ +00068030: 697a 6564 2e20 4966 2074 6865 2070 6172 ized. If the par │ │ │ +00068040: 616d 6574 6572 206d 6574 686f 6420 6973 ameter method is │ │ │ +00068050: 2073 6574 2074 6f20 7468 6520 6465 6661 set to the defa │ │ │ +00068060: 756c 7420 7661 6c75 6520 302c 2074 6865 ult value 0, the │ │ │ +00068070: 2066 756e 6374 696f 6e20 7573 6573 2061 function uses a │ │ │ +00068080: 6c6c 2074 6865 2070 6f69 6e74 0a70 6169 ll the point.pai │ │ │ +00068090: 7273 2074 6f20 636f 6d70 7574 6520 616e rs to compute an │ │ │ +000680a0: 2069 6e69 7469 616c 2068 6f6d 6f67 7261 initial homogra │ │ │ +000680b0: 7068 7920 6573 7469 6d61 7465 2077 6974 phy estimate wit │ │ │ +000680c0: 6820 6120 7369 6d70 6c65 206c 6561 7374 h a simple least │ │ │ +000680d0: 2d73 7175 6172 6573 2073 6368 656d 652e -squares scheme. │ │ │ +000680e0: 0a0a 486f 7765 7665 722c 2069 6620 6e6f ..However, if no │ │ │ +000680f0: 7420 616c 6c20 6f66 2074 6865 2070 6f69 t all of the poi │ │ │ +00068100: 6e74 2070 6169 7273 2028 205c 2873 7263 nt pairs ( \(src │ │ │ +00068110: 506f 696e 7473 5f69 5c29 2c20 5c28 6473 Points_i\), \(ds │ │ │ +00068120: 7450 6f69 6e74 735f 695c 2920 2920 6669 tPoints_i\) ) fi │ │ │ +00068130: 7420 7468 6520 7269 6769 6420 7065 7273 t the rigid pers │ │ │ +00068140: 7065 6374 6976 650a 7472 616e 7366 6f72 pective.transfor │ │ │ +00068150: 6d61 7469 6f6e 2028 7468 6174 2069 732c mation (that is, │ │ │ +00068160: 2074 6865 7265 2061 7265 2073 6f6d 6520 there are some │ │ │ +00068170: 6f75 746c 6965 7273 292c 2074 6869 7320 outliers), this │ │ │ +00068180: 696e 6974 6961 6c20 6573 7469 6d61 7465 initial estimate │ │ │ +00068190: 2077 696c 6c20 6265 2070 6f6f 722e 2049 will be poor. I │ │ │ +000681a0: 6e20 7468 6973 2063 6173 652c 0a79 6f75 n this case,.you │ │ │ +000681b0: 2063 616e 2075 7365 206f 6e65 206f 6620 can use one of │ │ │ +000681c0: 7468 6520 7468 7265 6520 726f 6275 7374 the three robust │ │ │ +000681d0: 206d 6574 686f 6473 2e20 5468 6520 6d65 methods. The me │ │ │ +000681e0: 7468 6f64 7320 5241 4e53 4143 2c20 4c4d thods RANSAC, LM │ │ │ +000681f0: 6544 5320 616e 6420 5248 4f20 7472 7920 eDS and RHO try │ │ │ +00068200: 6d61 6e79 2064 6966 6665 7265 6e74 0a72 many different.r │ │ │ +00068210: 616e 646f 6d20 7375 6273 6574 7320 6f66 andom subsets of │ │ │ +00068220: 2074 6865 2063 6f72 7265 7370 6f6e 6469 the correspondi │ │ │ +00068230: 6e67 2070 6f69 6e74 2070 6169 7273 2028 ng point pairs ( │ │ │ +00068240: 6f66 2066 6f75 7220 7061 6972 7320 6561 of four pairs ea │ │ │ +00068250: 6368 2c20 636f 6c6c 696e 6561 7220 7061 ch, collinear pa │ │ │ +00068260: 6972 7320 6172 6520 6469 7363 6172 6465 irs are discarde │ │ │ +00068270: 6429 2c20 6573 7469 6d61 7465 2074 6865 d), estimate the │ │ │ +00068280: 2068 6f6d 6f67 7261 7068 7920 6d61 7472 homography matr │ │ │ +00068290: 6978 0a75 7369 6e67 2074 6869 7320 7375 ix.using this su │ │ │ +000682a0: 6273 6574 2061 6e64 2061 2073 696d 706c bset and a simpl │ │ │ +000682b0: 6520 6c65 6173 742d 7371 7561 7265 7320 e least-squares │ │ │ +000682c0: 616c 676f 7269 7468 6d2c 2061 6e64 2074 algorithm, and t │ │ │ +000682d0: 6865 6e20 636f 6d70 7574 6520 7468 6520 hen compute the │ │ │ +000682e0: 7175 616c 6974 792f 676f 6f64 6e65 7373 quality/goodness │ │ │ +000682f0: 206f 6620 7468 650a 636f 6d70 7574 6564 of the.computed │ │ │ +00068300: 2068 6f6d 6f67 7261 7068 7920 2877 6869 homography (whi │ │ │ +00068310: 6368 2069 7320 7468 6520 6e75 6d62 6572 ch is the number │ │ │ +00068320: 206f 6620 696e 6c69 6572 7320 666f 7220 of inliers for │ │ │ +00068330: 5241 4e53 4143 206f 7220 7468 6520 6c65 RANSAC or the le │ │ │ +00068340: 6173 7420 6d65 6469 616e 2072 652d 7072 ast median re-pr │ │ │ +00068350: 6f6a 6563 7469 6f6e 2065 7272 6f72 2066 ojection error f │ │ │ +00068360: 6f72 0a4c 4d65 4453 292e 2054 6865 2062 or.LMeDS). The b │ │ │ +00068370: 6573 7420 7375 6273 6574 2069 7320 7468 est subset is th │ │ │ +00068380: 656e 2075 7365 6420 746f 2070 726f 6475 en used to produ │ │ │ +00068390: 6365 2074 6865 2069 6e69 7469 616c 2065 ce the initial e │ │ │ +000683a0: 7374 696d 6174 6520 6f66 2074 6865 2068 stimate of the h │ │ │ +000683b0: 6f6d 6f67 7261 7068 7920 6d61 7472 6978 omography matrix │ │ │ +000683c0: 2061 6e64 0a74 6865 206d 6173 6b20 6f66 and.the mask of │ │ │ +000683d0: 2069 6e6c 6965 7273 2f6f 7574 6c69 6572 inliers/outlier │ │ │ +000683e0: 732e 0a0a 5265 6761 7264 6c65 7373 206f s...Regardless o │ │ │ +000683f0: 6620 7468 6520 6d65 7468 6f64 2c20 726f f the method, ro │ │ │ +00068400: 6275 7374 206f 7220 6e6f 742c 2074 6865 bust or not, the │ │ │ +00068410: 2063 6f6d 7075 7465 6420 686f 6d6f 6772 computed homogr │ │ │ +00068420: 6170 6879 206d 6174 7269 7820 6973 2072 aphy matrix is r │ │ │ +00068430: 6566 696e 6564 2066 7572 7468 6572 2028 efined further ( │ │ │ +00068440: 7573 696e 670a 696e 6c69 6572 7320 6f6e using.inliers on │ │ │ +00068450: 6c79 2069 6e20 6361 7365 206f 6620 6120 ly in case of a │ │ │ +00068460: 726f 6275 7374 206d 6574 686f 6429 2077 robust method) w │ │ │ +00068470: 6974 6820 7468 6520 4c65 7665 6e62 6572 ith the Levenber │ │ │ +00068480: 672d 4d61 7271 7561 7264 7420 6d65 7468 g-Marquardt meth │ │ │ +00068490: 6f64 2074 6f20 7265 6475 6365 2074 6865 od to reduce the │ │ │ +000684a0: 0a72 652d 7072 6f6a 6563 7469 6f6e 2065 .re-projection e │ │ │ +000684b0: 7272 6f72 2065 7665 6e20 6d6f 7265 2e0a rror even more.. │ │ │ +000684c0: 0a54 6865 206d 6574 686f 6473 2052 414e .The methods RAN │ │ │ +000684d0: 5341 4320 616e 6420 5248 4f20 6361 6e20 SAC and RHO can │ │ │ +000684e0: 6861 6e64 6c65 2070 7261 6374 6963 616c handle practical │ │ │ +000684f0: 6c79 2061 6e79 2072 6174 696f 206f 6620 ly any ratio of │ │ │ +00068500: 6f75 746c 6965 7273 2062 7574 206e 6565 outliers but nee │ │ │ +00068510: 6420 6120 7468 7265 7368 6f6c 6420 746f d a threshold to │ │ │ +00068520: 0a64 6973 7469 6e67 7569 7368 2069 6e6c .distinguish inl │ │ │ +00068530: 6965 7273 2066 726f 6d20 6f75 746c 6965 iers from outlie │ │ │ +00068540: 7273 2e20 5468 6520 6d65 7468 6f64 204c rs. The method L │ │ │ +00068550: 4d65 4453 2064 6f65 7320 6e6f 7420 6e65 MeDS does not ne │ │ │ +00068560: 6564 2061 6e79 2074 6872 6573 686f 6c64 ed any threshold │ │ │ +00068570: 2062 7574 2069 7420 776f 726b 730a 636f but it works.co │ │ │ +00068580: 7272 6563 746c 7920 6f6e 6c79 2077 6865 rrectly only whe │ │ │ +00068590: 6e20 7468 6572 6520 6172 6520 6d6f 7265 n there are more │ │ │ +000685a0: 2074 6861 6e20 3530 2520 6f66 2069 6e6c than 50% of inl │ │ │ +000685b0: 6965 7273 2e20 4669 6e61 6c6c 792c 2069 iers. Finally, i │ │ │ +000685c0: 6620 7468 6572 6520 6172 6520 6e6f 206f f there are no o │ │ │ +000685d0: 7574 6c69 6572 7320 616e 6420 7468 650a utliers and the. │ │ │ +000685e0: 6e6f 6973 6520 6973 2072 6174 6865 7220 noise is rather │ │ │ +000685f0: 736d 616c 6c2c 2075 7365 2074 6865 2064 small, use the d │ │ │ +00068600: 6566 6175 6c74 206d 6574 686f 6420 286d efault method (m │ │ │ +00068610: 6574 686f 643d 3029 2e0a 0a54 6865 2066 ethod=0)...The f │ │ │ +00068620: 756e 6374 696f 6e20 6973 2075 7365 6420 unction is used │ │ │ +00068630: 746f 2066 696e 6420 696e 6974 6961 6c20 to find initial │ │ │ +00068640: 696e 7472 696e 7369 6320 616e 6420 6578 intrinsic and ex │ │ │ +00068650: 7472 696e 7369 6320 6d61 7472 6963 6573 trinsic matrices │ │ │ +00068660: 2e20 486f 6d6f 6772 6170 6879 206d 6174 . Homography mat │ │ │ +00068670: 7269 7820 6973 0a64 6574 6572 6d69 6e65 rix is.determine │ │ │ +00068680: 6420 7570 2074 6f20 6120 7363 616c 652e d up to a scale. │ │ │ +00068690: 2049 6620 5c28 685f 7b33 337d 5c29 2069 If \(h_{33}\) i │ │ │ +000686a0: 7320 6e6f 6e2d 7a65 726f 2c20 7468 6520 s non-zero, the │ │ │ +000686b0: 6d61 7472 6978 2069 7320 6e6f 726d 616c matrix is normal │ │ │ +000686c0: 697a 6564 2073 6f20 7468 6174 205c 2868 ized so that \(h │ │ │ +000686d0: 5f7b 3333 7d3d 315c 292e 0a3c 623e 4e6f _{33}=1\)..No │ │ │ +000686e0: 7465 3a3c 2f62 3e20 5768 656e 6576 6572 te: Whenever │ │ │ +000686f0: 2061 6e20 5c28 485c 2920 6d61 7472 6978 an \(H\) matrix │ │ │ +00068700: 2063 616e 6e6f 7420 6265 2065 7374 696d cannot be estim │ │ │ +00068710: 6174 6564 2c20 616e 2065 6d70 7479 206f ated, an empty o │ │ │ +00068720: 6e65 2077 696c 6c20 6265 2072 6574 7572 ne will be retur │ │ │ +00068730: 6e65 642e 0a0a 5345 453a 0a67 6574 4166 ned...SEE:.getAf │ │ │ +00068740: 6669 6e65 5472 616e 7366 6f72 6d2c 2065 fineTransform, e │ │ │ +00068750: 7374 696d 6174 6541 6666 696e 6532 442c stimateAffine2D, │ │ │ +00068760: 2065 7374 696d 6174 6541 6666 696e 6550 estimateAffineP │ │ │ +00068770: 6172 7469 616c 3244 2c20 6765 7450 6572 artial2D, getPer │ │ │ +00068780: 7370 6563 7469 7665 5472 616e 7366 6f72 spectiveTransfor │ │ │ +00068790: 6d2c 2077 6172 7050 6572 7370 6563 7469 m, warpPerspecti │ │ │ +000687a0: 7665 2c0a 7065 7273 7065 6374 6976 6554 ve,.perspectiveT │ │ │ +000687b0: 7261 6e73 666f 726d 3c2f 6464 3e0a 3c64 ransform
    .Returns:. │ │ │ +000687d0: 3c64 643e 6175 746f 6d61 7469 6361 6c6c
    automaticall │ │ │ +000687e0: 7920 6765 6e65 7261 7465 643c 2f64 643e y generated
    │ │ │ +000687f0: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    .
    ...< │ │ │ +00068810: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .< │ │ │ +000688a0: 6833 3e66 696e 6448 6f6d 6f67 7261 7068 h3>findHomograph │ │ │ +000688b0: 793c 2f68 333e 0a3c 6469 7620 636c 6173 y.
    .
    pub │ │ │ +00068910: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static Mat │ │ │ +00068980: 3c2f 613e 3c2f 7370 616e 3e26 6e62 7370   │ │ │ +00068990: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;find │ │ │ +000689b0: 486f 6d6f 6772 6170 6879 3c2f 7370 616e Homography( │ │ │ +000689e0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfPoint2 │ │ │ +00068a30: 663c 2f61 3e26 6e62 7370 3b73 7263 506f f srcPo │ │ │ +00068a40: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. MatO │ │ │ +00068a90: 6650 6f69 6e74 3266 3c2f 613e 266e 6273 fPoint2f&nbs │ │ │ +00068aa0: 703b 6473 7450 6f69 6e74 732c 0a20 696e p;dstPoints,. in │ │ │ +00068ab0: 7426 6e62 7370 3b6d 6574 686f 642c 0a20 t method,. │ │ │ +00068ac0: 646f 7562 6c65 266e 6273 703b 7261 6e73 double rans │ │ │ +00068ad0: 6163 5265 7072 6f6a 5468 7265 7368 6f6c acReprojThreshol │ │ │ +00068ae0: 642c 0a20 3c61 2068 7265 663d 222e 2e2f d,. │ │ │ +00068b20: 4d61 743c 2f61 3e26 6e62 7370 3b6d 6173 Mat mas │ │ │ +00068b30: 6b2c 0a20 696e 7426 6e62 7370 3b6d 6178 k,. int max │ │ │ +00068b40: 4974 6572 7329 3c2f 7370 616e 3e3c 2f64 Iters).
    Finds a p │ │ │ +00068b70: 6572 7370 6563 7469 7665 2074 7261 6e73 erspective trans │ │ │ +00068b80: 666f 726d 6174 696f 6e20 6265 7477 6565 formation betwee │ │ │ +00068b90: 6e20 7477 6f20 706c 616e 6573 2e3c 2f64 n two planes..
    .
    Param │ │ │ +00068bc0: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ +00068bd0: 3c63 6f64 653e 7372 6350 6f69 6e74 733c srcPoints< │ │ │ +00068be0: 2f63 6f64 653e 202d 2043 6f6f 7264 696e /code> - Coordin │ │ │ +00068bf0: 6174 6573 206f 6620 7468 6520 706f 696e ates of the poin │ │ │ +00068c00: 7473 2069 6e20 7468 6520 6f72 6967 696e ts in the origin │ │ │ +00068c10: 616c 2070 6c61 6e65 2c20 6120 6d61 7472 al plane, a matr │ │ │ +00068c20: 6978 206f 6620 7468 6520 7479 7065 2043 ix of the type C │ │ │ +00068c30: 565f 3332 4643 320a 6f72 2076 6563 746f V_32FC2.or vecto │ │ │ +00068c40: 7226 6c74 3b50 6f69 6e74 3266 2667 743b r<Point2f> │ │ │ +00068c50: 202e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 .
    .
    dstPoints - Coordinates │ │ │ +00068c80: 206f 6620 7468 6520 706f 696e 7473 2069 of the points i │ │ │ +00068c90: 6e20 7468 6520 7461 7267 6574 2070 6c61 n the target pla │ │ │ +00068ca0: 6e65 2c20 6120 6d61 7472 6978 206f 6620 ne, a matrix of │ │ │ +00068cb0: 7468 6520 7479 7065 2043 565f 3332 4643 the type CV_32FC │ │ │ +00068cc0: 3220 6f72 0a61 2076 6563 746f 7226 6c74 2 or.a vector< │ │ │ +00068cd0: 3b50 6f69 6e74 3266 2667 743b 202e 3c2f ;Point2f> ..
    me │ │ │ +00068cf0: 7468 6f64 3c2f 636f 6465 3e20 2d20 4d65 thod - Me │ │ │ +00068d00: 7468 6f64 2075 7365 6420 746f 2063 6f6d thod used to com │ │ │ +00068d10: 7075 7465 2061 2068 6f6d 6f67 7261 7068 pute a homograph │ │ │ +00068d20: 7920 6d61 7472 6978 2e20 5468 6520 666f y matrix. The fo │ │ │ +00068d30: 6c6c 6f77 696e 6720 6d65 7468 6f64 7320 llowing methods │ │ │ +00068d40: 6172 6520 706f 7373 6962 6c65 3a0a 3c75 are possible:..
  • . │ │ │ +00068d60: 303c 2f62 3e20 2d20 6120 7265 6775 6c61 0 - a regula │ │ │ +00068d70: 7220 6d65 7468 6f64 2075 7369 6e67 2061 r method using a │ │ │ +00068d80: 6c6c 2074 6865 2070 6f69 6e74 732c 2069 ll the points, i │ │ │ +00068d90: 2e65 2e2c 2074 6865 206c 6561 7374 2073 .e., the least s │ │ │ +00068da0: 7175 6172 6573 206d 6574 686f 640a 2020 quares method. │ │ │ +00068db0: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020
  • .
  • . │ │ │ +00068dc0: 5245 463a 2052 414e 5341 4320 2d20 5241 REF: RANSAC - RA │ │ │ +00068dd0: 4e53 4143 2d62 6173 6564 2072 6f62 7573 NSAC-based robus │ │ │ +00068de0: 7420 6d65 7468 6f64 0a20 203c 2f6c 693e t method.
  • │ │ │ +00068df0: 0a20 203c 6c69 3e0a 2020 2052 4546 3a20 .
  • . REF: │ │ │ +00068e00: 4c4d 4544 5320 2d20 4c65 6173 742d 4d65 LMEDS - Least-Me │ │ │ +00068e10: 6469 616e 2072 6f62 7573 7420 6d65 7468 dian robust meth │ │ │ +00068e20: 6f64 0a20 203c 2f6c 693e 0a20 203c 6c69 od.
  • .
  • . REF: RHO - │ │ │ +00068e40: 5052 4f53 4143 2d62 6173 6564 2072 6f62 PROSAC-based rob │ │ │ +00068e50: 7573 7420 6d65 7468 6f64 0a20 203c 2f6c ust method. .
  • .ransacRe │ │ │ +00068e80: 7072 6f6a 5468 7265 7368 6f6c 643c 2f63 projThreshold - Maximum a │ │ │ +00068ea0: 6c6c 6f77 6564 2072 6570 726f 6a65 6374 llowed reproject │ │ │ +00068eb0: 696f 6e20 6572 726f 7220 746f 2074 7265 ion error to tre │ │ │ +00068ec0: 6174 2061 2070 6f69 6e74 2070 6169 7220 at a point pair │ │ │ +00068ed0: 6173 2061 6e20 696e 6c69 6572 0a28 7573 as an inlier.(us │ │ │ +00068ee0: 6564 2069 6e20 7468 6520 5241 4e53 4143 ed in the RANSAC │ │ │ +00068ef0: 2061 6e64 2052 484f 206d 6574 686f 6473 and RHO methods │ │ │ +00068f00: 206f 6e6c 7929 2e20 5468 6174 2069 732c only). That is, │ │ │ +00068f10: 2069 660a 5c28 5c7c 205c 7465 7874 7474 if.\(\| \texttt │ │ │ +00068f20: 7b64 7374 506f 696e 7473 7d20 5f69 202d {dstPoints} _i - │ │ │ +00068f30: 2020 5c74 6578 7474 747b 636f 6e76 6572 \texttt{conver │ │ │ +00068f40: 7450 6f69 6e74 7348 6f6d 6f67 656e 656f tPointsHomogeneo │ │ │ +00068f50: 7573 7d20 2820 5c74 6578 7474 747b 487d us} ( \texttt{H} │ │ │ +00068f60: 205c 6364 6f74 205c 7465 7874 7474 7b73 \cdot \texttt{s │ │ │ +00068f70: 7263 506f 696e 7473 7d20 5f69 2920 5c7c rcPoints} _i) \| │ │ │ +00068f80: 5f32 2020 2667 743b 2020 5c74 6578 7474 _2 > \textt │ │ │ +00068f90: 747b 7261 6e73 6163 5265 7072 6f6a 5468 t{ransacReprojTh │ │ │ +00068fa0: 7265 7368 6f6c 647d 5c29 0a74 6865 6e20 reshold}\).then │ │ │ +00068fb0: 7468 6520 706f 696e 7420 5c28 695c 2920 the point \(i\) │ │ │ +00068fc0: 6973 2063 6f6e 7369 6465 7265 6420 6173 is considered as │ │ │ +00068fd0: 2061 6e20 6f75 746c 6965 722e 2049 6620 an outlier. If │ │ │ +00068fe0: 7372 6350 6f69 6e74 7320 616e 6420 6473 srcPoints and ds │ │ │ +00068ff0: 7450 6f69 6e74 7320 6172 6520 6d65 6173 tPoints are meas │ │ │ +00069000: 7572 6564 2069 6e20 7069 7865 6c73 2c0a ured in pixels,. │ │ │ +00069010: 6974 2075 7375 616c 6c79 206d 616b 6573 it usually makes │ │ │ +00069020: 2073 656e 7365 2074 6f20 7365 7420 7468 sense to set th │ │ │ +00069030: 6973 2070 6172 616d 6574 6572 2073 6f6d is parameter som │ │ │ +00069040: 6577 6865 7265 2069 6e20 7468 6520 7261 ewhere in the ra │ │ │ +00069050: 6e67 6520 6f66 2031 2074 6f20 3130 2e3c nge of 1 to 10.< │ │ │ +00069060: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e6d /dd>.
    m │ │ │ +00069070: 6173 6b3c 2f63 6f64 653e 202d 204f 7074 ask - Opt │ │ │ +00069080: 696f 6e61 6c20 6f75 7470 7574 206d 6173 ional output mas │ │ │ +00069090: 6b20 7365 7420 6279 2061 2072 6f62 7573 k set by a robus │ │ │ +000690a0: 7420 6d65 7468 6f64 2028 2052 414e 5341 t method ( RANSA │ │ │ +000690b0: 4320 6f72 204c 4d65 4453 2029 2e20 4e6f C or LMeDS ). No │ │ │ +000690c0: 7465 2074 6861 7420 7468 6520 696e 7075 te that the inpu │ │ │ +000690d0: 740a 6d61 736b 2076 616c 7565 7320 6172 t.mask values ar │ │ │ +000690e0: 6520 6967 6e6f 7265 642e 3c2f 6464 3e0a e ignored.
    . │ │ │ +000690f0: 3c64 643e 3c63 6f64 653e 6d61 7849 7465
    maxIte │ │ │ +00069100: 7273 3c2f 636f 6465 3e20 2d20 5468 6520 rs - The │ │ │ +00069110: 6d61 7869 6d75 6d20 6e75 6d62 6572 206f maximum number o │ │ │ +00069120: 6620 5241 4e53 4143 2069 7465 7261 7469 f RANSAC iterati │ │ │ +00069130: 6f6e 732e 0a0a 5468 6520 6675 6e63 7469 ons...The functi │ │ │ +00069140: 6f6e 2066 696e 6473 2061 6e64 2072 6574 on finds and ret │ │ │ +00069150: 7572 6e73 2074 6865 2070 6572 7370 6563 urns the perspec │ │ │ +00069160: 7469 7665 2074 7261 6e73 666f 726d 6174 tive transformat │ │ │ +00069170: 696f 6e20 5c28 485c 2920 6265 7477 6565 ion \(H\) betwee │ │ │ +00069180: 6e20 7468 6520 736f 7572 6365 2061 6e64 n the source and │ │ │ +00069190: 2074 6865 0a64 6573 7469 6e61 7469 6f6e the.destination │ │ │ +000691a0: 2070 6c61 6e65 733a 0a0a 5c28 735f 6920 planes:..\(s_i │ │ │ +000691b0: 205c 7665 6374 6872 6565 7b78 275f 697d \vecthree{x'_i} │ │ │ +000691c0: 7b79 275f 697d 7b31 7d20 5c73 696d 2048 {y'_i}{1} \sim H │ │ │ +000691d0: 2020 5c76 6563 7468 7265 657b 785f 697d \vecthree{x_i} │ │ │ +000691e0: 7b79 5f69 7d7b 317d 5c29 0a0a 736f 2074 {y_i}{1}\)..so t │ │ │ +000691f0: 6861 7420 7468 6520 6261 636b 2d70 726f hat the back-pro │ │ │ +00069200: 6a65 6374 696f 6e20 6572 726f 720a 0a5c jection error..\ │ │ │ +00069210: 285c 7375 6d20 5f69 205c 6c65 6674 2028 (\sum _i \left ( │ │ │ +00069220: 2078 275f 692d 205c 6672 6163 7b68 5f7b x'_i- \frac{h_{ │ │ │ +00069230: 3131 7d20 785f 6920 2b20 685f 7b31 327d 11} x_i + h_{12} │ │ │ +00069240: 2079 5f69 202b 2068 5f7b 3133 7d7d 7b68 y_i + h_{13}}{h │ │ │ +00069250: 5f7b 3331 7d20 785f 6920 2b20 685f 7b33 _{31} x_i + h_{3 │ │ │ +00069260: 327d 2079 5f69 202b 2068 5f7b 3333 7d7d 2} y_i + h_{33}} │ │ │ +00069270: 205c 7269 6768 7420 295e 322b 205c 6c65 \right )^2+ \le │ │ │ +00069280: 6674 2028 2079 275f 692d 205c 6672 6163 ft ( y'_i- \frac │ │ │ +00069290: 7b68 5f7b 3231 7d20 785f 6920 2b20 685f {h_{21} x_i + h_ │ │ │ +000692a0: 7b32 327d 2079 5f69 202b 2068 5f7b 3233 {22} y_i + h_{23 │ │ │ +000692b0: 7d7d 7b68 5f7b 3331 7d20 785f 6920 2b20 }}{h_{31} x_i + │ │ │ +000692c0: 685f 7b33 327d 2079 5f69 202b 2068 5f7b h_{32} y_i + h_{ │ │ │ +000692d0: 3333 7d7d 205c 7269 6768 7420 295e 325c 33}} \right )^2\ │ │ │ +000692e0: 290a 0a69 7320 6d69 6e69 6d69 7a65 642e )..is minimized. │ │ │ +000692f0: 2049 6620 7468 6520 7061 7261 6d65 7465 If the paramete │ │ │ +00069300: 7220 6d65 7468 6f64 2069 7320 7365 7420 r method is set │ │ │ +00069310: 746f 2074 6865 2064 6566 6175 6c74 2076 to the default v │ │ │ +00069320: 616c 7565 2030 2c20 7468 6520 6675 6e63 alue 0, the func │ │ │ +00069330: 7469 6f6e 2075 7365 7320 616c 6c20 7468 tion uses all th │ │ │ +00069340: 6520 706f 696e 740a 7061 6972 7320 746f e point.pairs to │ │ │ +00069350: 2063 6f6d 7075 7465 2061 6e20 696e 6974 compute an init │ │ │ +00069360: 6961 6c20 686f 6d6f 6772 6170 6879 2065 ial homography e │ │ │ +00069370: 7374 696d 6174 6520 7769 7468 2061 2073 stimate with a s │ │ │ +00069380: 696d 706c 6520 6c65 6173 742d 7371 7561 imple least-squa │ │ │ +00069390: 7265 7320 7363 6865 6d65 2e0a 0a48 6f77 res scheme...How │ │ │ +000693a0: 6576 6572 2c20 6966 206e 6f74 2061 6c6c ever, if not all │ │ │ +000693b0: 206f 6620 7468 6520 706f 696e 7420 7061 of the point pa │ │ │ +000693c0: 6972 7320 2820 5c28 7372 6350 6f69 6e74 irs ( \(srcPoint │ │ │ +000693d0: 735f 695c 292c 205c 2864 7374 506f 696e s_i\), \(dstPoin │ │ │ +000693e0: 7473 5f69 5c29 2029 2066 6974 2074 6865 ts_i\) ) fit the │ │ │ +000693f0: 2072 6967 6964 2070 6572 7370 6563 7469 rigid perspecti │ │ │ +00069400: 7665 0a74 7261 6e73 666f 726d 6174 696f ve.transformatio │ │ │ +00069410: 6e20 2874 6861 7420 6973 2c20 7468 6572 n (that is, ther │ │ │ +00069420: 6520 6172 6520 736f 6d65 206f 7574 6c69 e are some outli │ │ │ +00069430: 6572 7329 2c20 7468 6973 2069 6e69 7469 ers), this initi │ │ │ +00069440: 616c 2065 7374 696d 6174 6520 7769 6c6c al estimate will │ │ │ +00069450: 2062 6520 706f 6f72 2e20 496e 2074 6869 be poor. In thi │ │ │ +00069460: 7320 6361 7365 2c0a 796f 7520 6361 6e20 s case,.you can │ │ │ +00069470: 7573 6520 6f6e 6520 6f66 2074 6865 2074 use one of the t │ │ │ +00069480: 6872 6565 2072 6f62 7573 7420 6d65 7468 hree robust meth │ │ │ +00069490: 6f64 732e 2054 6865 206d 6574 686f 6473 ods. The methods │ │ │ +000694a0: 2052 414e 5341 432c 204c 4d65 4453 2061 RANSAC, LMeDS a │ │ │ +000694b0: 6e64 2052 484f 2074 7279 206d 616e 7920 nd RHO try many │ │ │ +000694c0: 6469 6666 6572 656e 740a 7261 6e64 6f6d different.random │ │ │ +000694d0: 2073 7562 7365 7473 206f 6620 7468 6520 subsets of the │ │ │ +000694e0: 636f 7272 6573 706f 6e64 696e 6720 706f corresponding po │ │ │ +000694f0: 696e 7420 7061 6972 7320 286f 6620 666f int pairs (of fo │ │ │ +00069500: 7572 2070 6169 7273 2065 6163 682c 2063 ur pairs each, c │ │ │ +00069510: 6f6c 6c69 6e65 6172 2070 6169 7273 2061 ollinear pairs a │ │ │ +00069520: 7265 2064 6973 6361 7264 6564 292c 2065 re discarded), e │ │ │ +00069530: 7374 696d 6174 6520 7468 6520 686f 6d6f stimate the homo │ │ │ +00069540: 6772 6170 6879 206d 6174 7269 780a 7573 graphy matrix.us │ │ │ +00069550: 696e 6720 7468 6973 2073 7562 7365 7420 ing this subset │ │ │ +00069560: 616e 6420 6120 7369 6d70 6c65 206c 6561 and a simple lea │ │ │ +00069570: 7374 2d73 7175 6172 6573 2061 6c67 6f72 st-squares algor │ │ │ +00069580: 6974 686d 2c20 616e 6420 7468 656e 2063 ithm, and then c │ │ │ +00069590: 6f6d 7075 7465 2074 6865 2071 7561 6c69 ompute the quali │ │ │ +000695a0: 7479 2f67 6f6f 646e 6573 7320 6f66 2074 ty/goodness of t │ │ │ +000695b0: 6865 0a63 6f6d 7075 7465 6420 686f 6d6f he.computed homo │ │ │ +000695c0: 6772 6170 6879 2028 7768 6963 6820 6973 graphy (which is │ │ │ +000695d0: 2074 6865 206e 756d 6265 7220 6f66 2069 the number of i │ │ │ +000695e0: 6e6c 6965 7273 2066 6f72 2052 414e 5341 nliers for RANSA │ │ │ +000695f0: 4320 6f72 2074 6865 206c 6561 7374 206d C or the least m │ │ │ +00069600: 6564 6961 6e20 7265 2d70 726f 6a65 6374 edian re-project │ │ │ +00069610: 696f 6e20 6572 726f 7220 666f 720a 4c4d ion error for.LM │ │ │ +00069620: 6544 5329 2e20 5468 6520 6265 7374 2073 eDS). The best s │ │ │ +00069630: 7562 7365 7420 6973 2074 6865 6e20 7573 ubset is then us │ │ │ +00069640: 6564 2074 6f20 7072 6f64 7563 6520 7468 ed to produce th │ │ │ +00069650: 6520 696e 6974 6961 6c20 6573 7469 6d61 e initial estima │ │ │ +00069660: 7465 206f 6620 7468 6520 686f 6d6f 6772 te of the homogr │ │ │ +00069670: 6170 6879 206d 6174 7269 7820 616e 640a aphy matrix and. │ │ │ +00069680: 7468 6520 6d61 736b 206f 6620 696e 6c69 the mask of inli │ │ │ +00069690: 6572 732f 6f75 746c 6965 7273 2e0a 0a52 ers/outliers...R │ │ │ +000696a0: 6567 6172 646c 6573 7320 6f66 2074 6865 egardless of the │ │ │ +000696b0: 206d 6574 686f 642c 2072 6f62 7573 7420 method, robust │ │ │ +000696c0: 6f72 206e 6f74 2c20 7468 6520 636f 6d70 or not, the comp │ │ │ +000696d0: 7574 6564 2068 6f6d 6f67 7261 7068 7920 uted homography │ │ │ +000696e0: 6d61 7472 6978 2069 7320 7265 6669 6e65 matrix is refine │ │ │ +000696f0: 6420 6675 7274 6865 7220 2875 7369 6e67 d further (using │ │ │ +00069700: 0a69 6e6c 6965 7273 206f 6e6c 7920 696e .inliers only in │ │ │ +00069710: 2063 6173 6520 6f66 2061 2072 6f62 7573 case of a robus │ │ │ +00069720: 7420 6d65 7468 6f64 2920 7769 7468 2074 t method) with t │ │ │ +00069730: 6865 204c 6576 656e 6265 7267 2d4d 6172 he Levenberg-Mar │ │ │ +00069740: 7175 6172 6474 206d 6574 686f 6420 746f quardt method to │ │ │ +00069750: 2072 6564 7563 6520 7468 650a 7265 2d70 reduce the.re-p │ │ │ +00069760: 726f 6a65 6374 696f 6e20 6572 726f 7220 rojection error │ │ │ +00069770: 6576 656e 206d 6f72 652e 0a0a 5468 6520 even more...The │ │ │ +00069780: 6d65 7468 6f64 7320 5241 4e53 4143 2061 methods RANSAC a │ │ │ +00069790: 6e64 2052 484f 2063 616e 2068 616e 646c nd RHO can handl │ │ │ +000697a0: 6520 7072 6163 7469 6361 6c6c 7920 616e e practically an │ │ │ +000697b0: 7920 7261 7469 6f20 6f66 206f 7574 6c69 y ratio of outli │ │ │ +000697c0: 6572 7320 6275 7420 6e65 6564 2061 2074 ers but need a t │ │ │ +000697d0: 6872 6573 686f 6c64 2074 6f0a 6469 7374 hreshold to.dist │ │ │ +000697e0: 696e 6775 6973 6820 696e 6c69 6572 7320 inguish inliers │ │ │ +000697f0: 6672 6f6d 206f 7574 6c69 6572 732e 2054 from outliers. T │ │ │ +00069800: 6865 206d 6574 686f 6420 4c4d 6544 5320 he method LMeDS │ │ │ +00069810: 646f 6573 206e 6f74 206e 6565 6420 616e does not need an │ │ │ +00069820: 7920 7468 7265 7368 6f6c 6420 6275 7420 y threshold but │ │ │ +00069830: 6974 2077 6f72 6b73 0a63 6f72 7265 6374 it works.correct │ │ │ +00069840: 6c79 206f 6e6c 7920 7768 656e 2074 6865 ly only when the │ │ │ +00069850: 7265 2061 7265 206d 6f72 6520 7468 616e re are more than │ │ │ +00069860: 2035 3025 206f 6620 696e 6c69 6572 732e 50% of inliers. │ │ │ +00069870: 2046 696e 616c 6c79 2c20 6966 2074 6865 Finally, if the │ │ │ +00069880: 7265 2061 7265 206e 6f20 6f75 746c 6965 re are no outlie │ │ │ +00069890: 7273 2061 6e64 2074 6865 0a6e 6f69 7365 rs and the.noise │ │ │ +000698a0: 2069 7320 7261 7468 6572 2073 6d61 6c6c is rather small │ │ │ +000698b0: 2c20 7573 6520 7468 6520 6465 6661 756c , use the defaul │ │ │ +000698c0: 7420 6d65 7468 6f64 2028 6d65 7468 6f64 t method (method │ │ │ +000698d0: 3d30 292e 0a0a 5468 6520 6675 6e63 7469 =0)...The functi │ │ │ +000698e0: 6f6e 2069 7320 7573 6564 2074 6f20 6669 on is used to fi │ │ │ +000698f0: 6e64 2069 6e69 7469 616c 2069 6e74 7269 nd initial intri │ │ │ +00069900: 6e73 6963 2061 6e64 2065 7874 7269 6e73 nsic and extrins │ │ │ +00069910: 6963 206d 6174 7269 6365 732e 2048 6f6d ic matrices. Hom │ │ │ +00069920: 6f67 7261 7068 7920 6d61 7472 6978 2069 ography matrix i │ │ │ +00069930: 730a 6465 7465 726d 696e 6564 2075 7020 s.determined up │ │ │ +00069940: 746f 2061 2073 6361 6c65 2e20 4966 205c to a scale. If \ │ │ │ +00069950: 2868 5f7b 3333 7d5c 2920 6973 206e 6f6e (h_{33}\) is non │ │ │ +00069960: 2d7a 6572 6f2c 2074 6865 206d 6174 7269 -zero, the matri │ │ │ +00069970: 7820 6973 206e 6f72 6d61 6c69 7a65 6420 x is normalized │ │ │ +00069980: 736f 2074 6861 7420 5c28 685f 7b33 337d so that \(h_{33} │ │ │ +00069990: 3d31 5c29 2e0a 3c62 3e4e 6f74 653a 3c2f =1\)..Note: Whenever an \ │ │ │ +000699b0: 2848 5c29 206d 6174 7269 7820 6361 6e6e (H\) matrix cann │ │ │ +000699c0: 6f74 2062 6520 6573 7469 6d61 7465 642c ot be estimated, │ │ │ +000699d0: 2061 6e20 656d 7074 7920 6f6e 6520 7769 an empty one wi │ │ │ +000699e0: 6c6c 2062 6520 7265 7475 726e 6564 2e0a ll be returned.. │ │ │ +000699f0: 0a53 4545 3a0a 6765 7441 6666 696e 6554 .SEE:.getAffineT │ │ │ +00069a00: 7261 6e73 666f 726d 2c20 6573 7469 6d61 ransform, estima │ │ │ +00069a10: 7465 4166 6669 6e65 3244 2c20 6573 7469 teAffine2D, esti │ │ │ +00069a20: 6d61 7465 4166 6669 6e65 5061 7274 6961 mateAffinePartia │ │ │ +00069a30: 6c32 442c 2067 6574 5065 7273 7065 6374 l2D, getPerspect │ │ │ +00069a40: 6976 6554 7261 6e73 666f 726d 2c20 7761 iveTransform, wa │ │ │ +00069a50: 7270 5065 7273 7065 6374 6976 652c 0a70 rpPerspective,.p │ │ │ +00069a60: 6572 7370 6563 7469 7665 5472 616e 7366 erspectiveTransf │ │ │ +00069a70: 6f72 6d3c 2f64 643e 0a3c 6474 3e52 6574 orm
    .
    Ret │ │ │ +00069a80: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e61 urns:
    .
    a │ │ │ +00069a90: 7574 6f6d 6174 6963 616c 6c79 2067 656e utomatically gen │ │ │ +00069aa0: 6572 6174 6564 3c2f 6464 3e0a 3c2f 646c erated
    .
    .
    ...
  • .< │ │ │ +00069ad0: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +00069ae0: 6574 6169 6c22 2069 643d 2266 696e 6448 etail" id="findH │ │ │ +00069af0: 6f6d 6f67 7261 7068 7928 6f72 672e 6f70 omography(org.op │ │ │ +00069b00: 656e 6376 2e63 6f72 652e 4d61 744f 6650 encv.core.MatOfP │ │ │ +00069b10: 6f69 6e74 3266 2c6f 7267 2e6f 7065 6e63 oint2f,org.openc │ │ │ +00069b20: 762e 636f 7265 2e4d 6174 4f66 506f 696e v.core.MatOfPoin │ │ │ +00069b30: 7432 662c 696e 742c 646f 7562 6c65 2c6f t2f,int,double,o │ │ │ +00069b40: 7267 2e6f 7065 6e63 762e 636f 7265 2e4d rg.opencv.core.M │ │ │ +00069b50: 6174 2922 3e0a 3c68 333e 6669 6e64 486f at)">.

    findHo │ │ │ +00069b60: 6d6f 6772 6170 6879 3c2f 6833 3e0a 3c64 mography

    ..public stati │ │ │ +00069bd0: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c Mat findHomograph │ │ │ +00069c70: 793c 2f73 7061 6e3e 3c77 6272 3e3c 7370 y(MatO │ │ │ +00069ce0: 6650 6f69 6e74 3266 3c2f 613e 266e 6273 fPoint2f&nbs │ │ │ +00069cf0: 703b 7372 6350 6f69 6e74 732c 0a20 3c61 p;srcPoints,. MatOfPoint2f< │ │ │ +00069d50: 2f61 3e26 6e62 7370 3b64 7374 506f 696e /a> dstPoin │ │ │ +00069d60: 7473 2c0a 2069 6e74 266e 6273 703b 6d65 ts,. int me │ │ │ +00069d70: 7468 6f64 2c0a 2064 6f75 626c 6526 6e62 thod,. double&nb │ │ │ +00069d80: 7370 3b72 616e 7361 6352 6570 726f 6a54 sp;ransacReprojT │ │ │ +00069d90: 6872 6573 686f 6c64 2c0a 203c 6120 6872 hreshold,. Mat&n │ │ │ +00069de0: 6273 703b 6d61 736b 293c 2f73 7061 6e3e bsp;mask) │ │ │ +00069df0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
  • .
    Finds │ │ │ +00069e10: 6120 7065 7273 7065 6374 6976 6520 7472 a perspective tr │ │ │ +00069e20: 616e 7366 6f72 6d61 7469 6f6e 2062 6574 ansformation bet │ │ │ +00069e30: 7765 656e 2074 776f 2070 6c61 6e65 732e ween two planes. │ │ │ +00069e40: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ +00069e60: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ +00069e70: 6464 3e3c 636f 6465 3e73 7263 506f 696e dd>srcPoin │ │ │ +00069e80: 7473 3c2f 636f 6465 3e20 2d20 436f 6f72 ts - Coor │ │ │ +00069e90: 6469 6e61 7465 7320 6f66 2074 6865 2070 dinates of the p │ │ │ +00069ea0: 6f69 6e74 7320 696e 2074 6865 206f 7269 oints in the ori │ │ │ +00069eb0: 6769 6e61 6c20 706c 616e 652c 2061 206d ginal plane, a m │ │ │ +00069ec0: 6174 7269 7820 6f66 2074 6865 2074 7970 atrix of the typ │ │ │ +00069ed0: 6520 4356 5f33 3246 4332 0a6f 7220 7665 e CV_32FC2.or ve │ │ │ +00069ee0: 6374 6f72 266c 743b 506f 696e 7432 6626 ctor<Point2f& │ │ │ +00069ef0: 6774 3b20 2e3c 2f64 643e 0a3c 6464 3e3c gt; ..
    < │ │ │ +00069f00: 636f 6465 3e64 7374 506f 696e 7473 3c2f code>dstPoints - Coordina │ │ │ +00069f20: 7465 7320 6f66 2074 6865 2070 6f69 6e74 tes of the point │ │ │ +00069f30: 7320 696e 2074 6865 2074 6172 6765 7420 s in the target │ │ │ +00069f40: 706c 616e 652c 2061 206d 6174 7269 7820 plane, a matrix │ │ │ +00069f50: 6f66 2074 6865 2074 7970 6520 4356 5f33 of the type CV_3 │ │ │ +00069f60: 3246 4332 206f 720a 6120 7665 6374 6f72 2FC2 or.a vector │ │ │ +00069f70: 266c 743b 506f 696e 7432 6626 6774 3b20 <Point2f> │ │ │ +00069f80: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    method - │ │ │ +00069fa0: 204d 6574 686f 6420 7573 6564 2074 6f20 Method used to │ │ │ +00069fb0: 636f 6d70 7574 6520 6120 686f 6d6f 6772 compute a homogr │ │ │ +00069fc0: 6170 6879 206d 6174 7269 782e 2054 6865 aphy matrix. The │ │ │ +00069fd0: 2066 6f6c 6c6f 7769 6e67 206d 6574 686f following metho │ │ │ +00069fe0: 6473 2061 7265 2070 6f73 7369 626c 653a ds are possible: │ │ │ +00069ff0: 0a3c 756c 3e0a 2020 3c6c 693e 0a20 2020 .
      .
    • . │ │ │ +0006a000: 3c62 3e30 3c2f 623e 202d 2061 2072 6567 0 - a reg │ │ │ +0006a010: 756c 6172 206d 6574 686f 6420 7573 696e ular method usin │ │ │ +0006a020: 6720 616c 6c20 7468 6520 706f 696e 7473 g all the points │ │ │ +0006a030: 2c20 692e 652e 2c20 7468 6520 6c65 6173 , i.e., the leas │ │ │ +0006a040: 7420 7371 7561 7265 7320 6d65 7468 6f64 t squares method │ │ │ +0006a050: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ +0006a060: 2020 2052 4546 3a20 5241 4e53 4143 202d REF: RANSAC - │ │ │ +0006a070: 2052 414e 5341 432d 6261 7365 6420 726f RANSAC-based ro │ │ │ +0006a080: 6275 7374 206d 6574 686f 640a 2020 3c2f bust method. .
    • . RE │ │ │ +0006a0a0: 463a 204c 4d45 4453 202d 204c 6561 7374 F: LMEDS - Least │ │ │ +0006a0b0: 2d4d 6564 6961 6e20 726f 6275 7374 206d -Median robust m │ │ │ +0006a0c0: 6574 686f 640a 2020 3c2f 6c69 3e0a 2020 ethod.
    • . │ │ │ +0006a0d0: 3c6c 693e 0a20 2020 5245 463a 2052 484f
    • . REF: RHO │ │ │ +0006a0e0: 202d 2050 524f 5341 432d 6261 7365 6420 - PROSAC-based │ │ │ +0006a0f0: 726f 6275 7374 206d 6574 686f 640a 2020 robust method. │ │ │ +0006a100: 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64 643e
    • .
    │ │ │ +0006a110: 0a3c 6464 3e3c 636f 6465 3e72 616e 7361 .
    ransa │ │ │ +0006a120: 6352 6570 726f 6a54 6872 6573 686f 6c64 cReprojThreshold │ │ │ +0006a130: 3c2f 636f 6465 3e20 2d20 4d61 7869 6d75 - Maximu │ │ │ +0006a140: 6d20 616c 6c6f 7765 6420 7265 7072 6f6a m allowed reproj │ │ │ +0006a150: 6563 7469 6f6e 2065 7272 6f72 2074 6f20 ection error to │ │ │ +0006a160: 7472 6561 7420 6120 706f 696e 7420 7061 treat a point pa │ │ │ +0006a170: 6972 2061 7320 616e 2069 6e6c 6965 720a ir as an inlier. │ │ │ +0006a180: 2875 7365 6420 696e 2074 6865 2052 414e (used in the RAN │ │ │ +0006a190: 5341 4320 616e 6420 5248 4f20 6d65 7468 SAC and RHO meth │ │ │ +0006a1a0: 6f64 7320 6f6e 6c79 292e 2054 6861 7420 ods only). That │ │ │ +0006a1b0: 6973 2c20 6966 0a5c 285c 7c20 5c74 6578 is, if.\(\| \tex │ │ │ +0006a1c0: 7474 747b 6473 7450 6f69 6e74 737d 205f ttt{dstPoints} _ │ │ │ +0006a1d0: 6920 2d20 205c 7465 7874 7474 7b63 6f6e i - \texttt{con │ │ │ +0006a1e0: 7665 7274 506f 696e 7473 486f 6d6f 6765 vertPointsHomoge │ │ │ +0006a1f0: 6e65 6f75 737d 2028 205c 7465 7874 7474 neous} ( \texttt │ │ │ +0006a200: 7b48 7d20 5c63 646f 7420 5c74 6578 7474 {H} \cdot \textt │ │ │ +0006a210: 747b 7372 6350 6f69 6e74 737d 205f 6929 t{srcPoints} _i) │ │ │ +0006a220: 205c 7c5f 3220 2026 6774 3b20 205c 7465 \|_2 > \te │ │ │ +0006a230: 7874 7474 7b72 616e 7361 6352 6570 726f xttt{ransacRepro │ │ │ +0006a240: 6a54 6872 6573 686f 6c64 7d5c 290a 7468 jThreshold}\).th │ │ │ +0006a250: 656e 2074 6865 2070 6f69 6e74 205c 2869 en the point \(i │ │ │ +0006a260: 5c29 2069 7320 636f 6e73 6964 6572 6564 \) is considered │ │ │ +0006a270: 2061 7320 616e 206f 7574 6c69 6572 2e20 as an outlier. │ │ │ +0006a280: 4966 2073 7263 506f 696e 7473 2061 6e64 If srcPoints and │ │ │ +0006a290: 2064 7374 506f 696e 7473 2061 7265 206d dstPoints are m │ │ │ +0006a2a0: 6561 7375 7265 6420 696e 2070 6978 656c easured in pixel │ │ │ +0006a2b0: 732c 0a69 7420 7573 7561 6c6c 7920 6d61 s,.it usually ma │ │ │ +0006a2c0: 6b65 7320 7365 6e73 6520 746f 2073 6574 kes sense to set │ │ │ +0006a2d0: 2074 6869 7320 7061 7261 6d65 7465 7220 this parameter │ │ │ +0006a2e0: 736f 6d65 7768 6572 6520 696e 2074 6865 somewhere in the │ │ │ +0006a2f0: 2072 616e 6765 206f 6620 3120 746f 2031 range of 1 to 1 │ │ │ +0006a300: 302e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 0.
    .
    mask - │ │ │ +0006a320: 4f70 7469 6f6e 616c 206f 7574 7075 7420 Optional output │ │ │ +0006a330: 6d61 736b 2073 6574 2062 7920 6120 726f mask set by a ro │ │ │ +0006a340: 6275 7374 206d 6574 686f 6420 2820 5241 bust method ( RA │ │ │ +0006a350: 4e53 4143 206f 7220 4c4d 6544 5320 292e NSAC or LMeDS ). │ │ │ +0006a360: 204e 6f74 6520 7468 6174 2074 6865 2069 Note that the i │ │ │ +0006a370: 6e70 7574 0a6d 6173 6b20 7661 6c75 6573 nput.mask values │ │ │ +0006a380: 2061 7265 2069 676e 6f72 6564 2e0a 0a54 are ignored...T │ │ │ +0006a390: 6865 2066 756e 6374 696f 6e20 6669 6e64 he function find │ │ │ +0006a3a0: 7320 616e 6420 7265 7475 726e 7320 7468 s and returns th │ │ │ +0006a3b0: 6520 7065 7273 7065 6374 6976 6520 7472 e perspective tr │ │ │ +0006a3c0: 616e 7366 6f72 6d61 7469 6f6e 205c 2848 ansformation \(H │ │ │ +0006a3d0: 5c29 2062 6574 7765 656e 2074 6865 2073 \) between the s │ │ │ +0006a3e0: 6f75 7263 6520 616e 6420 7468 650a 6465 ource and the.de │ │ │ +0006a3f0: 7374 696e 6174 696f 6e20 706c 616e 6573 stination planes │ │ │ +0006a400: 3a0a 0a5c 2873 5f69 2020 5c76 6563 7468 :..\(s_i \vecth │ │ │ +0006a410: 7265 657b 7827 5f69 7d7b 7927 5f69 7d7b ree{x'_i}{y'_i}{ │ │ │ +0006a420: 317d 205c 7369 6d20 4820 205c 7665 6374 1} \sim H \vect │ │ │ +0006a430: 6872 6565 7b78 5f69 7d7b 795f 697d 7b31 hree{x_i}{y_i}{1 │ │ │ +0006a440: 7d5c 290a 0a73 6f20 7468 6174 2074 6865 }\)..so that the │ │ │ +0006a450: 2062 6163 6b2d 7072 6f6a 6563 7469 6f6e back-projection │ │ │ +0006a460: 2065 7272 6f72 0a0a 5c28 5c73 756d 205f error..\(\sum _ │ │ │ +0006a470: 6920 5c6c 6566 7420 2820 7827 5f69 2d20 i \left ( x'_i- │ │ │ +0006a480: 5c66 7261 637b 685f 7b31 317d 2078 5f69 \frac{h_{11} x_i │ │ │ +0006a490: 202b 2068 5f7b 3132 7d20 795f 6920 2b20 + h_{12} y_i + │ │ │ +0006a4a0: 685f 7b31 337d 7d7b 685f 7b33 317d 2078 h_{13}}{h_{31} x │ │ │ +0006a4b0: 5f69 202b 2068 5f7b 3332 7d20 795f 6920 _i + h_{32} y_i │ │ │ +0006a4c0: 2b20 685f 7b33 337d 7d20 5c72 6967 6874 + h_{33}} \right │ │ │ +0006a4d0: 2029 5e32 2b20 5c6c 6566 7420 2820 7927 )^2+ \left ( y' │ │ │ +0006a4e0: 5f69 2d20 5c66 7261 637b 685f 7b32 317d _i- \frac{h_{21} │ │ │ +0006a4f0: 2078 5f69 202b 2068 5f7b 3232 7d20 795f x_i + h_{22} y_ │ │ │ +0006a500: 6920 2b20 685f 7b32 337d 7d7b 685f 7b33 i + h_{23}}{h_{3 │ │ │ +0006a510: 317d 2078 5f69 202b 2068 5f7b 3332 7d20 1} x_i + h_{32} │ │ │ +0006a520: 795f 6920 2b20 685f 7b33 337d 7d20 5c72 y_i + h_{33}} \r │ │ │ +0006a530: 6967 6874 2029 5e32 5c29 0a0a 6973 206d ight )^2\)..is m │ │ │ +0006a540: 696e 696d 697a 6564 2e20 4966 2074 6865 inimized. If the │ │ │ +0006a550: 2070 6172 616d 6574 6572 206d 6574 686f parameter metho │ │ │ +0006a560: 6420 6973 2073 6574 2074 6f20 7468 6520 d is set to the │ │ │ +0006a570: 6465 6661 756c 7420 7661 6c75 6520 302c default value 0, │ │ │ +0006a580: 2074 6865 2066 756e 6374 696f 6e20 7573 the function us │ │ │ +0006a590: 6573 2061 6c6c 2074 6865 2070 6f69 6e74 es all the point │ │ │ +0006a5a0: 0a70 6169 7273 2074 6f20 636f 6d70 7574 .pairs to comput │ │ │ +0006a5b0: 6520 616e 2069 6e69 7469 616c 2068 6f6d e an initial hom │ │ │ +0006a5c0: 6f67 7261 7068 7920 6573 7469 6d61 7465 ography estimate │ │ │ +0006a5d0: 2077 6974 6820 6120 7369 6d70 6c65 206c with a simple l │ │ │ +0006a5e0: 6561 7374 2d73 7175 6172 6573 2073 6368 east-squares sch │ │ │ +0006a5f0: 656d 652e 0a0a 486f 7765 7665 722c 2069 eme...However, i │ │ │ +0006a600: 6620 6e6f 7420 616c 6c20 6f66 2074 6865 f not all of the │ │ │ +0006a610: 2070 6f69 6e74 2070 6169 7273 2028 205c point pairs ( \ │ │ │ +0006a620: 2873 7263 506f 696e 7473 5f69 5c29 2c20 (srcPoints_i\), │ │ │ +0006a630: 5c28 6473 7450 6f69 6e74 735f 695c 2920 \(dstPoints_i\) │ │ │ +0006a640: 2920 6669 7420 7468 6520 7269 6769 6420 ) fit the rigid │ │ │ +0006a650: 7065 7273 7065 6374 6976 650a 7472 616e perspective.tran │ │ │ +0006a660: 7366 6f72 6d61 7469 6f6e 2028 7468 6174 sformation (that │ │ │ +0006a670: 2069 732c 2074 6865 7265 2061 7265 2073 is, there are s │ │ │ +0006a680: 6f6d 6520 6f75 746c 6965 7273 292c 2074 ome outliers), t │ │ │ +0006a690: 6869 7320 696e 6974 6961 6c20 6573 7469 his initial esti │ │ │ +0006a6a0: 6d61 7465 2077 696c 6c20 6265 2070 6f6f mate will be poo │ │ │ +0006a6b0: 722e 2049 6e20 7468 6973 2063 6173 652c r. In this case, │ │ │ +0006a6c0: 0a79 6f75 2063 616e 2075 7365 206f 6e65 .you can use one │ │ │ +0006a6d0: 206f 6620 7468 6520 7468 7265 6520 726f of the three ro │ │ │ +0006a6e0: 6275 7374 206d 6574 686f 6473 2e20 5468 bust methods. Th │ │ │ +0006a6f0: 6520 6d65 7468 6f64 7320 5241 4e53 4143 e methods RANSAC │ │ │ +0006a700: 2c20 4c4d 6544 5320 616e 6420 5248 4f20 , LMeDS and RHO │ │ │ +0006a710: 7472 7920 6d61 6e79 2064 6966 6665 7265 try many differe │ │ │ +0006a720: 6e74 0a72 616e 646f 6d20 7375 6273 6574 nt.random subset │ │ │ +0006a730: 7320 6f66 2074 6865 2063 6f72 7265 7370 s of the corresp │ │ │ +0006a740: 6f6e 6469 6e67 2070 6f69 6e74 2070 6169 onding point pai │ │ │ +0006a750: 7273 2028 6f66 2066 6f75 7220 7061 6972 rs (of four pair │ │ │ +0006a760: 7320 6561 6368 2c20 636f 6c6c 696e 6561 s each, collinea │ │ │ +0006a770: 7220 7061 6972 7320 6172 6520 6469 7363 r pairs are disc │ │ │ +0006a780: 6172 6465 6429 2c20 6573 7469 6d61 7465 arded), estimate │ │ │ +0006a790: 2074 6865 2068 6f6d 6f67 7261 7068 7920 the homography │ │ │ +0006a7a0: 6d61 7472 6978 0a75 7369 6e67 2074 6869 matrix.using thi │ │ │ +0006a7b0: 7320 7375 6273 6574 2061 6e64 2061 2073 s subset and a s │ │ │ +0006a7c0: 696d 706c 6520 6c65 6173 742d 7371 7561 imple least-squa │ │ │ +0006a7d0: 7265 7320 616c 676f 7269 7468 6d2c 2061 res algorithm, a │ │ │ +0006a7e0: 6e64 2074 6865 6e20 636f 6d70 7574 6520 nd then compute │ │ │ +0006a7f0: 7468 6520 7175 616c 6974 792f 676f 6f64 the quality/good │ │ │ +0006a800: 6e65 7373 206f 6620 7468 650a 636f 6d70 ness of the.comp │ │ │ +0006a810: 7574 6564 2068 6f6d 6f67 7261 7068 7920 uted homography │ │ │ +0006a820: 2877 6869 6368 2069 7320 7468 6520 6e75 (which is the nu │ │ │ +0006a830: 6d62 6572 206f 6620 696e 6c69 6572 7320 mber of inliers │ │ │ +0006a840: 666f 7220 5241 4e53 4143 206f 7220 7468 for RANSAC or th │ │ │ +0006a850: 6520 6c65 6173 7420 6d65 6469 616e 2072 e least median r │ │ │ +0006a860: 652d 7072 6f6a 6563 7469 6f6e 2065 7272 e-projection err │ │ │ +0006a870: 6f72 2066 6f72 0a4c 4d65 4453 292e 2054 or for.LMeDS). T │ │ │ +0006a880: 6865 2062 6573 7420 7375 6273 6574 2069 he best subset i │ │ │ +0006a890: 7320 7468 656e 2075 7365 6420 746f 2070 s then used to p │ │ │ +0006a8a0: 726f 6475 6365 2074 6865 2069 6e69 7469 roduce the initi │ │ │ +0006a8b0: 616c 2065 7374 696d 6174 6520 6f66 2074 al estimate of t │ │ │ +0006a8c0: 6865 2068 6f6d 6f67 7261 7068 7920 6d61 he homography ma │ │ │ +0006a8d0: 7472 6978 2061 6e64 0a74 6865 206d 6173 trix and.the mas │ │ │ +0006a8e0: 6b20 6f66 2069 6e6c 6965 7273 2f6f 7574 k of inliers/out │ │ │ +0006a8f0: 6c69 6572 732e 0a0a 5265 6761 7264 6c65 liers...Regardle │ │ │ +0006a900: 7373 206f 6620 7468 6520 6d65 7468 6f64 ss of the method │ │ │ +0006a910: 2c20 726f 6275 7374 206f 7220 6e6f 742c , robust or not, │ │ │ +0006a920: 2074 6865 2063 6f6d 7075 7465 6420 686f the computed ho │ │ │ +0006a930: 6d6f 6772 6170 6879 206d 6174 7269 7820 mography matrix │ │ │ +0006a940: 6973 2072 6566 696e 6564 2066 7572 7468 is refined furth │ │ │ +0006a950: 6572 2028 7573 696e 670a 696e 6c69 6572 er (using.inlier │ │ │ +0006a960: 7320 6f6e 6c79 2069 6e20 6361 7365 206f s only in case o │ │ │ +0006a970: 6620 6120 726f 6275 7374 206d 6574 686f f a robust metho │ │ │ +0006a980: 6429 2077 6974 6820 7468 6520 4c65 7665 d) with the Leve │ │ │ +0006a990: 6e62 6572 672d 4d61 7271 7561 7264 7420 nberg-Marquardt │ │ │ +0006a9a0: 6d65 7468 6f64 2074 6f20 7265 6475 6365 method to reduce │ │ │ +0006a9b0: 2074 6865 0a72 652d 7072 6f6a 6563 7469 the.re-projecti │ │ │ +0006a9c0: 6f6e 2065 7272 6f72 2065 7665 6e20 6d6f on error even mo │ │ │ +0006a9d0: 7265 2e0a 0a54 6865 206d 6574 686f 6473 re...The methods │ │ │ +0006a9e0: 2052 414e 5341 4320 616e 6420 5248 4f20 RANSAC and RHO │ │ │ +0006a9f0: 6361 6e20 6861 6e64 6c65 2070 7261 6374 can handle pract │ │ │ +0006aa00: 6963 616c 6c79 2061 6e79 2072 6174 696f ically any ratio │ │ │ +0006aa10: 206f 6620 6f75 746c 6965 7273 2062 7574 of outliers but │ │ │ +0006aa20: 206e 6565 6420 6120 7468 7265 7368 6f6c need a threshol │ │ │ +0006aa30: 6420 746f 0a64 6973 7469 6e67 7569 7368 d to.distinguish │ │ │ +0006aa40: 2069 6e6c 6965 7273 2066 726f 6d20 6f75 inliers from ou │ │ │ +0006aa50: 746c 6965 7273 2e20 5468 6520 6d65 7468 tliers. The meth │ │ │ +0006aa60: 6f64 204c 4d65 4453 2064 6f65 7320 6e6f od LMeDS does no │ │ │ +0006aa70: 7420 6e65 6564 2061 6e79 2074 6872 6573 t need any thres │ │ │ +0006aa80: 686f 6c64 2062 7574 2069 7420 776f 726b hold but it work │ │ │ +0006aa90: 730a 636f 7272 6563 746c 7920 6f6e 6c79 s.correctly only │ │ │ +0006aaa0: 2077 6865 6e20 7468 6572 6520 6172 6520 when there are │ │ │ +0006aab0: 6d6f 7265 2074 6861 6e20 3530 2520 6f66 more than 50% of │ │ │ +0006aac0: 2069 6e6c 6965 7273 2e20 4669 6e61 6c6c inliers. Finall │ │ │ +0006aad0: 792c 2069 6620 7468 6572 6520 6172 6520 y, if there are │ │ │ +0006aae0: 6e6f 206f 7574 6c69 6572 7320 616e 6420 no outliers and │ │ │ +0006aaf0: 7468 650a 6e6f 6973 6520 6973 2072 6174 the.noise is rat │ │ │ +0006ab00: 6865 7220 736d 616c 6c2c 2075 7365 2074 her small, use t │ │ │ +0006ab10: 6865 2064 6566 6175 6c74 206d 6574 686f he default metho │ │ │ +0006ab20: 6420 286d 6574 686f 643d 3029 2e0a 0a54 d (method=0)...T │ │ │ +0006ab30: 6865 2066 756e 6374 696f 6e20 6973 2075 he function is u │ │ │ +0006ab40: 7365 6420 746f 2066 696e 6420 696e 6974 sed to find init │ │ │ +0006ab50: 6961 6c20 696e 7472 696e 7369 6320 616e ial intrinsic an │ │ │ +0006ab60: 6420 6578 7472 696e 7369 6320 6d61 7472 d extrinsic matr │ │ │ +0006ab70: 6963 6573 2e20 486f 6d6f 6772 6170 6879 ices. Homography │ │ │ +0006ab80: 206d 6174 7269 7820 6973 0a64 6574 6572 matrix is.deter │ │ │ +0006ab90: 6d69 6e65 6420 7570 2074 6f20 6120 7363 mined up to a sc │ │ │ +0006aba0: 616c 652e 2049 6620 5c28 685f 7b33 337d ale. If \(h_{33} │ │ │ +0006abb0: 5c29 2069 7320 6e6f 6e2d 7a65 726f 2c20 \) is non-zero, │ │ │ +0006abc0: 7468 6520 6d61 7472 6978 2069 7320 6e6f the matrix is no │ │ │ +0006abd0: 726d 616c 697a 6564 2073 6f20 7468 6174 rmalized so that │ │ │ +0006abe0: 205c 2868 5f7b 3333 7d3d 315c 292e 0a3c \(h_{33}=1\)..< │ │ │ +0006abf0: 623e 4e6f 7465 3a3c 2f62 3e20 5768 656e b>Note: When │ │ │ +0006ac00: 6576 6572 2061 6e20 5c28 485c 2920 6d61 ever an \(H\) ma │ │ │ +0006ac10: 7472 6978 2063 616e 6e6f 7420 6265 2065 trix cannot be e │ │ │ +0006ac20: 7374 696d 6174 6564 2c20 616e 2065 6d70 stimated, an emp │ │ │ +0006ac30: 7479 206f 6e65 2077 696c 6c20 6265 2072 ty one will be r │ │ │ +0006ac40: 6574 7572 6e65 642e 0a0a 5345 453a 0a67 eturned...SEE:.g │ │ │ +0006ac50: 6574 4166 6669 6e65 5472 616e 7366 6f72 etAffineTransfor │ │ │ +0006ac60: 6d2c 2065 7374 696d 6174 6541 6666 696e m, estimateAffin │ │ │ +0006ac70: 6532 442c 2065 7374 696d 6174 6541 6666 e2D, estimateAff │ │ │ +0006ac80: 696e 6550 6172 7469 616c 3244 2c20 6765 inePartial2D, ge │ │ │ +0006ac90: 7450 6572 7370 6563 7469 7665 5472 616e tPerspectiveTran │ │ │ +0006aca0: 7366 6f72 6d2c 2077 6172 7050 6572 7370 sform, warpPersp │ │ │ +0006acb0: 6563 7469 7665 2c0a 7065 7273 7065 6374 ective,.perspect │ │ │ +0006acc0: 6976 6554 7261 6e73 666f 726d 3c2f 6464 iveTransform
    .
    Returns:.
    automati │ │ │ +0006acf0: 6361 6c6c 7920 6765 6e65 7261 7465 643c cally generated< │ │ │ +0006ad00: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .
    ..
  • .
    .

    f │ │ │ +0006ada0: 696e 6448 6f6d 6f67 7261 7068 793c 2f68 indHomography.
    .
    public │ │ │ +0006ae10: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +0006ae20: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;Mat │ │ │ +0006ae80: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  findHomo │ │ │ +0006aeb0: 6772 6170 6879 3c2f 7370 616e 3e3c 7762 graphy(MatOfPoint2f srcPoints │ │ │ +0006af40: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. MatOfPoi │ │ │ +0006af90: 6e74 3266 3c2f 613e 266e 6273 703b 6473 nt2f ds │ │ │ +0006afa0: 7450 6f69 6e74 732c 0a20 696e 7426 6e62 tPoints,. int&nb │ │ │ +0006afb0: 7370 3b6d 6574 686f 642c 0a20 646f 7562 sp;method,. doub │ │ │ +0006afc0: 6c65 266e 6273 703b 7261 6e73 6163 5265 le ransacRe │ │ │ +0006afd0: 7072 6f6a 5468 7265 7368 6f6c 6429 3c2f projThreshold)
    .
    F │ │ │ +0006b000: 696e 6473 2061 2070 6572 7370 6563 7469 inds a perspecti │ │ │ +0006b010: 7665 2074 7261 6e73 666f 726d 6174 696f ve transformatio │ │ │ +0006b020: 6e20 6265 7477 6565 6e20 7477 6f20 706c n between two pl │ │ │ +0006b030: 616e 6573 2e3c 2f64 6976 3e0a 3c64 6c20 anes.
    .
    .< │ │ │ +0006b050: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    sr │ │ │ +0006b070: 6350 6f69 6e74 733c 2f63 6f64 653e 202d cPoints - │ │ │ +0006b080: 2043 6f6f 7264 696e 6174 6573 206f 6620 Coordinates of │ │ │ +0006b090: 7468 6520 706f 696e 7473 2069 6e20 7468 the points in th │ │ │ +0006b0a0: 6520 6f72 6967 696e 616c 2070 6c61 6e65 e original plane │ │ │ +0006b0b0: 2c20 6120 6d61 7472 6978 206f 6620 7468 , a matrix of th │ │ │ +0006b0c0: 6520 7479 7065 2043 565f 3332 4643 320a e type CV_32FC2. │ │ │ +0006b0d0: 6f72 2076 6563 746f 7226 6c74 3b50 6f69 or vector<Poi │ │ │ +0006b0e0: 6e74 3266 2667 743b 202e 3c2f 6464 3e0a nt2f> .
    . │ │ │ +0006b0f0: 3c64 643e 3c63 6f64 653e 6473 7450 6f69
    dstPoi │ │ │ +0006b100: 6e74 733c 2f63 6f64 653e 202d 2043 6f6f nts - Coo │ │ │ +0006b110: 7264 696e 6174 6573 206f 6620 7468 6520 rdinates of the │ │ │ +0006b120: 706f 696e 7473 2069 6e20 7468 6520 7461 points in the ta │ │ │ +0006b130: 7267 6574 2070 6c61 6e65 2c20 6120 6d61 rget plane, a ma │ │ │ +0006b140: 7472 6978 206f 6620 7468 6520 7479 7065 trix of the type │ │ │ +0006b150: 2043 565f 3332 4643 3220 6f72 0a61 2076 CV_32FC2 or.a v │ │ │ +0006b160: 6563 746f 7226 6c74 3b50 6f69 6e74 3266 ector<Point2f │ │ │ +0006b170: 2667 743b 202e 3c2f 6464 3e0a 3c64 643e > .
    .
    │ │ │ +0006b180: 3c63 6f64 653e 6d65 7468 6f64 3c2f 636f method - Method use │ │ │ +0006b1a0: 6420 746f 2063 6f6d 7075 7465 2061 2068 d to compute a h │ │ │ +0006b1b0: 6f6d 6f67 7261 7068 7920 6d61 7472 6978 omography matrix │ │ │ +0006b1c0: 2e20 5468 6520 666f 6c6c 6f77 696e 6720 . The following │ │ │ +0006b1d0: 6d65 7468 6f64 7320 6172 6520 706f 7373 methods are poss │ │ │ +0006b1e0: 6962 6c65 3a0a 3c75 6c3e 0a20 203c 6c69 ible:.
      .
    • . 0 - │ │ │ +0006b200: 6120 7265 6775 6c61 7220 6d65 7468 6f64 a regular method │ │ │ +0006b210: 2075 7369 6e67 2061 6c6c 2074 6865 2070 using all the p │ │ │ +0006b220: 6f69 6e74 732c 2069 2e65 2e2c 2074 6865 oints, i.e., the │ │ │ +0006b230: 206c 6561 7374 2073 7175 6172 6573 206d least squares m │ │ │ +0006b240: 6574 686f 640a 2020 3c2f 6c69 3e0a 2020 ethod.
    • . │ │ │ +0006b250: 3c6c 693e 0a20 2020 5245 463a 2052 414e
    • . REF: RAN │ │ │ +0006b260: 5341 4320 2d20 5241 4e53 4143 2d62 6173 SAC - RANSAC-bas │ │ │ +0006b270: 6564 2072 6f62 7573 7420 6d65 7468 6f64 ed robust method │ │ │ +0006b280: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ +0006b290: 2020 2052 4546 3a20 4c4d 4544 5320 2d20 REF: LMEDS - │ │ │ +0006b2a0: 4c65 6173 742d 4d65 6469 616e 2072 6f62 Least-Median rob │ │ │ +0006b2b0: 7573 7420 6d65 7468 6f64 0a20 203c 2f6c ust method. .
    • . REF │ │ │ +0006b2d0: 3a20 5248 4f20 2d20 5052 4f53 4143 2d62 : RHO - PROSAC-b │ │ │ +0006b2e0: 6173 6564 2072 6f62 7573 7420 6d65 7468 ased robust meth │ │ │ +0006b2f0: 6f64 0a20 203c 2f6c 693e 0a3c 2f75 6c3e od.
    • .
    │ │ │ +0006b300: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +0006b310: 7261 6e73 6163 5265 7072 6f6a 5468 7265 ransacReprojThre │ │ │ +0006b320: 7368 6f6c 643c 2f63 6f64 653e 202d 204d shold - M │ │ │ +0006b330: 6178 696d 756d 2061 6c6c 6f77 6564 2072 aximum allowed r │ │ │ +0006b340: 6570 726f 6a65 6374 696f 6e20 6572 726f eprojection erro │ │ │ +0006b350: 7220 746f 2074 7265 6174 2061 2070 6f69 r to treat a poi │ │ │ +0006b360: 6e74 2070 6169 7220 6173 2061 6e20 696e nt pair as an in │ │ │ +0006b370: 6c69 6572 0a28 7573 6564 2069 6e20 7468 lier.(used in th │ │ │ +0006b380: 6520 5241 4e53 4143 2061 6e64 2052 484f e RANSAC and RHO │ │ │ +0006b390: 206d 6574 686f 6473 206f 6e6c 7929 2e20 methods only). │ │ │ +0006b3a0: 5468 6174 2069 732c 2069 660a 5c28 5c7c That is, if.\(\| │ │ │ +0006b3b0: 205c 7465 7874 7474 7b64 7374 506f 696e \texttt{dstPoin │ │ │ +0006b3c0: 7473 7d20 5f69 202d 2020 5c74 6578 7474 ts} _i - \textt │ │ │ +0006b3d0: 747b 636f 6e76 6572 7450 6f69 6e74 7348 t{convertPointsH │ │ │ +0006b3e0: 6f6d 6f67 656e 656f 7573 7d20 2820 5c74 omogeneous} ( \t │ │ │ +0006b3f0: 6578 7474 747b 487d 205c 6364 6f74 205c exttt{H} \cdot \ │ │ │ +0006b400: 7465 7874 7474 7b73 7263 506f 696e 7473 texttt{srcPoints │ │ │ +0006b410: 7d20 5f69 2920 5c7c 5f32 2020 2667 743b } _i) \|_2 > │ │ │ +0006b420: 2020 5c74 6578 7474 747b 7261 6e73 6163 \texttt{ransac │ │ │ +0006b430: 5265 7072 6f6a 5468 7265 7368 6f6c 647d ReprojThreshold} │ │ │ +0006b440: 5c29 0a74 6865 6e20 7468 6520 706f 696e \).then the poin │ │ │ +0006b450: 7420 5c28 695c 2920 6973 2063 6f6e 7369 t \(i\) is consi │ │ │ +0006b460: 6465 7265 6420 6173 2061 6e20 6f75 746c dered as an outl │ │ │ +0006b470: 6965 722e 2049 6620 7372 6350 6f69 6e74 ier. If srcPoint │ │ │ +0006b480: 7320 616e 6420 6473 7450 6f69 6e74 7320 s and dstPoints │ │ │ +0006b490: 6172 6520 6d65 6173 7572 6564 2069 6e20 are measured in │ │ │ +0006b4a0: 7069 7865 6c73 2c0a 6974 2075 7375 616c pixels,.it usual │ │ │ +0006b4b0: 6c79 206d 616b 6573 2073 656e 7365 2074 ly makes sense t │ │ │ +0006b4c0: 6f20 7365 7420 7468 6973 2070 6172 616d o set this param │ │ │ +0006b4d0: 6574 6572 2073 6f6d 6577 6865 7265 2069 eter somewhere i │ │ │ +0006b4e0: 6e20 7468 6520 7261 6e67 6520 6f66 2031 n the range of 1 │ │ │ +0006b4f0: 2074 6f20 3130 2e0a 6d61 736b 2076 616c to 10..mask val │ │ │ +0006b500: 7565 7320 6172 6520 6967 6e6f 7265 642e ues are ignored. │ │ │ +0006b510: 0a0a 5468 6520 6675 6e63 7469 6f6e 2066 ..The function f │ │ │ +0006b520: 696e 6473 2061 6e64 2072 6574 7572 6e73 inds and returns │ │ │ +0006b530: 2074 6865 2070 6572 7370 6563 7469 7665 the perspective │ │ │ +0006b540: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ +0006b550: 5c28 485c 2920 6265 7477 6565 6e20 7468 \(H\) between th │ │ │ +0006b560: 6520 736f 7572 6365 2061 6e64 2074 6865 e source and the │ │ │ +0006b570: 0a64 6573 7469 6e61 7469 6f6e 2070 6c61 .destination pla │ │ │ +0006b580: 6e65 733a 0a0a 5c28 735f 6920 205c 7665 nes:..\(s_i \ve │ │ │ +0006b590: 6374 6872 6565 7b78 275f 697d 7b79 275f cthree{x'_i}{y'_ │ │ │ +0006b5a0: 697d 7b31 7d20 5c73 696d 2048 2020 5c76 i}{1} \sim H \v │ │ │ +0006b5b0: 6563 7468 7265 657b 785f 697d 7b79 5f69 ecthree{x_i}{y_i │ │ │ +0006b5c0: 7d7b 317d 5c29 0a0a 736f 2074 6861 7420 }{1}\)..so that │ │ │ +0006b5d0: 7468 6520 6261 636b 2d70 726f 6a65 6374 the back-project │ │ │ +0006b5e0: 696f 6e20 6572 726f 720a 0a5c 285c 7375 ion error..\(\su │ │ │ +0006b5f0: 6d20 5f69 205c 6c65 6674 2028 2078 275f m _i \left ( x'_ │ │ │ +0006b600: 692d 205c 6672 6163 7b68 5f7b 3131 7d20 i- \frac{h_{11} │ │ │ +0006b610: 785f 6920 2b20 685f 7b31 327d 2079 5f69 x_i + h_{12} y_i │ │ │ +0006b620: 202b 2068 5f7b 3133 7d7d 7b68 5f7b 3331 + h_{13}}{h_{31 │ │ │ +0006b630: 7d20 785f 6920 2b20 685f 7b33 327d 2079 } x_i + h_{32} y │ │ │ +0006b640: 5f69 202b 2068 5f7b 3333 7d7d 205c 7269 _i + h_{33}} \ri │ │ │ +0006b650: 6768 7420 295e 322b 205c 6c65 6674 2028 ght )^2+ \left ( │ │ │ +0006b660: 2079 275f 692d 205c 6672 6163 7b68 5f7b y'_i- \frac{h_{ │ │ │ +0006b670: 3231 7d20 785f 6920 2b20 685f 7b32 327d 21} x_i + h_{22} │ │ │ +0006b680: 2079 5f69 202b 2068 5f7b 3233 7d7d 7b68 y_i + h_{23}}{h │ │ │ +0006b690: 5f7b 3331 7d20 785f 6920 2b20 685f 7b33 _{31} x_i + h_{3 │ │ │ +0006b6a0: 327d 2079 5f69 202b 2068 5f7b 3333 7d7d 2} y_i + h_{33}} │ │ │ +0006b6b0: 205c 7269 6768 7420 295e 325c 290a 0a69 \right )^2\)..i │ │ │ +0006b6c0: 7320 6d69 6e69 6d69 7a65 642e 2049 6620 s minimized. If │ │ │ +0006b6d0: 7468 6520 7061 7261 6d65 7465 7220 6d65 the parameter me │ │ │ +0006b6e0: 7468 6f64 2069 7320 7365 7420 746f 2074 thod is set to t │ │ │ +0006b6f0: 6865 2064 6566 6175 6c74 2076 616c 7565 he default value │ │ │ +0006b700: 2030 2c20 7468 6520 6675 6e63 7469 6f6e 0, the function │ │ │ +0006b710: 2075 7365 7320 616c 6c20 7468 6520 706f uses all the po │ │ │ +0006b720: 696e 740a 7061 6972 7320 746f 2063 6f6d int.pairs to com │ │ │ +0006b730: 7075 7465 2061 6e20 696e 6974 6961 6c20 pute an initial │ │ │ +0006b740: 686f 6d6f 6772 6170 6879 2065 7374 696d homography estim │ │ │ +0006b750: 6174 6520 7769 7468 2061 2073 696d 706c ate with a simpl │ │ │ +0006b760: 6520 6c65 6173 742d 7371 7561 7265 7320 e least-squares │ │ │ +0006b770: 7363 6865 6d65 2e0a 0a48 6f77 6576 6572 scheme...However │ │ │ +0006b780: 2c20 6966 206e 6f74 2061 6c6c 206f 6620 , if not all of │ │ │ +0006b790: 7468 6520 706f 696e 7420 7061 6972 7320 the point pairs │ │ │ +0006b7a0: 2820 5c28 7372 6350 6f69 6e74 735f 695c ( \(srcPoints_i\ │ │ │ +0006b7b0: 292c 205c 2864 7374 506f 696e 7473 5f69 ), \(dstPoints_i │ │ │ +0006b7c0: 5c29 2029 2066 6974 2074 6865 2072 6967 \) ) fit the rig │ │ │ +0006b7d0: 6964 2070 6572 7370 6563 7469 7665 0a74 id perspective.t │ │ │ +0006b7e0: 7261 6e73 666f 726d 6174 696f 6e20 2874 ransformation (t │ │ │ +0006b7f0: 6861 7420 6973 2c20 7468 6572 6520 6172 hat is, there ar │ │ │ +0006b800: 6520 736f 6d65 206f 7574 6c69 6572 7329 e some outliers) │ │ │ +0006b810: 2c20 7468 6973 2069 6e69 7469 616c 2065 , this initial e │ │ │ +0006b820: 7374 696d 6174 6520 7769 6c6c 2062 6520 stimate will be │ │ │ +0006b830: 706f 6f72 2e20 496e 2074 6869 7320 6361 poor. In this ca │ │ │ +0006b840: 7365 2c0a 796f 7520 6361 6e20 7573 6520 se,.you can use │ │ │ +0006b850: 6f6e 6520 6f66 2074 6865 2074 6872 6565 one of the three │ │ │ +0006b860: 2072 6f62 7573 7420 6d65 7468 6f64 732e robust methods. │ │ │ +0006b870: 2054 6865 206d 6574 686f 6473 2052 414e The methods RAN │ │ │ +0006b880: 5341 432c 204c 4d65 4453 2061 6e64 2052 SAC, LMeDS and R │ │ │ +0006b890: 484f 2074 7279 206d 616e 7920 6469 6666 HO try many diff │ │ │ +0006b8a0: 6572 656e 740a 7261 6e64 6f6d 2073 7562 erent.random sub │ │ │ +0006b8b0: 7365 7473 206f 6620 7468 6520 636f 7272 sets of the corr │ │ │ +0006b8c0: 6573 706f 6e64 696e 6720 706f 696e 7420 esponding point │ │ │ +0006b8d0: 7061 6972 7320 286f 6620 666f 7572 2070 pairs (of four p │ │ │ +0006b8e0: 6169 7273 2065 6163 682c 2063 6f6c 6c69 airs each, colli │ │ │ +0006b8f0: 6e65 6172 2070 6169 7273 2061 7265 2064 near pairs are d │ │ │ +0006b900: 6973 6361 7264 6564 292c 2065 7374 696d iscarded), estim │ │ │ +0006b910: 6174 6520 7468 6520 686f 6d6f 6772 6170 ate the homograp │ │ │ +0006b920: 6879 206d 6174 7269 780a 7573 696e 6720 hy matrix.using │ │ │ +0006b930: 7468 6973 2073 7562 7365 7420 616e 6420 this subset and │ │ │ +0006b940: 6120 7369 6d70 6c65 206c 6561 7374 2d73 a simple least-s │ │ │ +0006b950: 7175 6172 6573 2061 6c67 6f72 6974 686d quares algorithm │ │ │ +0006b960: 2c20 616e 6420 7468 656e 2063 6f6d 7075 , and then compu │ │ │ +0006b970: 7465 2074 6865 2071 7561 6c69 7479 2f67 te the quality/g │ │ │ +0006b980: 6f6f 646e 6573 7320 6f66 2074 6865 0a63 oodness of the.c │ │ │ +0006b990: 6f6d 7075 7465 6420 686f 6d6f 6772 6170 omputed homograp │ │ │ +0006b9a0: 6879 2028 7768 6963 6820 6973 2074 6865 hy (which is the │ │ │ +0006b9b0: 206e 756d 6265 7220 6f66 2069 6e6c 6965 number of inlie │ │ │ +0006b9c0: 7273 2066 6f72 2052 414e 5341 4320 6f72 rs for RANSAC or │ │ │ +0006b9d0: 2074 6865 206c 6561 7374 206d 6564 6961 the least media │ │ │ +0006b9e0: 6e20 7265 2d70 726f 6a65 6374 696f 6e20 n re-projection │ │ │ +0006b9f0: 6572 726f 7220 666f 720a 4c4d 6544 5329 error for.LMeDS) │ │ │ +0006ba00: 2e20 5468 6520 6265 7374 2073 7562 7365 . The best subse │ │ │ +0006ba10: 7420 6973 2074 6865 6e20 7573 6564 2074 t is then used t │ │ │ +0006ba20: 6f20 7072 6f64 7563 6520 7468 6520 696e o produce the in │ │ │ +0006ba30: 6974 6961 6c20 6573 7469 6d61 7465 206f itial estimate o │ │ │ +0006ba40: 6620 7468 6520 686f 6d6f 6772 6170 6879 f the homography │ │ │ +0006ba50: 206d 6174 7269 7820 616e 640a 7468 6520 matrix and.the │ │ │ +0006ba60: 6d61 736b 206f 6620 696e 6c69 6572 732f mask of inliers/ │ │ │ +0006ba70: 6f75 746c 6965 7273 2e0a 0a52 6567 6172 outliers...Regar │ │ │ +0006ba80: 646c 6573 7320 6f66 2074 6865 206d 6574 dless of the met │ │ │ +0006ba90: 686f 642c 2072 6f62 7573 7420 6f72 206e hod, robust or n │ │ │ +0006baa0: 6f74 2c20 7468 6520 636f 6d70 7574 6564 ot, the computed │ │ │ +0006bab0: 2068 6f6d 6f67 7261 7068 7920 6d61 7472 homography matr │ │ │ +0006bac0: 6978 2069 7320 7265 6669 6e65 6420 6675 ix is refined fu │ │ │ +0006bad0: 7274 6865 7220 2875 7369 6e67 0a69 6e6c rther (using.inl │ │ │ +0006bae0: 6965 7273 206f 6e6c 7920 696e 2063 6173 iers only in cas │ │ │ +0006baf0: 6520 6f66 2061 2072 6f62 7573 7420 6d65 e of a robust me │ │ │ +0006bb00: 7468 6f64 2920 7769 7468 2074 6865 204c thod) with the L │ │ │ +0006bb10: 6576 656e 6265 7267 2d4d 6172 7175 6172 evenberg-Marquar │ │ │ +0006bb20: 6474 206d 6574 686f 6420 746f 2072 6564 dt method to red │ │ │ +0006bb30: 7563 6520 7468 650a 7265 2d70 726f 6a65 uce the.re-proje │ │ │ +0006bb40: 6374 696f 6e20 6572 726f 7220 6576 656e ction error even │ │ │ +0006bb50: 206d 6f72 652e 0a0a 5468 6520 6d65 7468 more...The meth │ │ │ +0006bb60: 6f64 7320 5241 4e53 4143 2061 6e64 2052 ods RANSAC and R │ │ │ +0006bb70: 484f 2063 616e 2068 616e 646c 6520 7072 HO can handle pr │ │ │ +0006bb80: 6163 7469 6361 6c6c 7920 616e 7920 7261 actically any ra │ │ │ +0006bb90: 7469 6f20 6f66 206f 7574 6c69 6572 7320 tio of outliers │ │ │ +0006bba0: 6275 7420 6e65 6564 2061 2074 6872 6573 but need a thres │ │ │ +0006bbb0: 686f 6c64 2074 6f0a 6469 7374 696e 6775 hold to.distingu │ │ │ +0006bbc0: 6973 6820 696e 6c69 6572 7320 6672 6f6d ish inliers from │ │ │ +0006bbd0: 206f 7574 6c69 6572 732e 2054 6865 206d outliers. The m │ │ │ +0006bbe0: 6574 686f 6420 4c4d 6544 5320 646f 6573 ethod LMeDS does │ │ │ +0006bbf0: 206e 6f74 206e 6565 6420 616e 7920 7468 not need any th │ │ │ +0006bc00: 7265 7368 6f6c 6420 6275 7420 6974 2077 reshold but it w │ │ │ +0006bc10: 6f72 6b73 0a63 6f72 7265 6374 6c79 206f orks.correctly o │ │ │ +0006bc20: 6e6c 7920 7768 656e 2074 6865 7265 2061 nly when there a │ │ │ +0006bc30: 7265 206d 6f72 6520 7468 616e 2035 3025 re more than 50% │ │ │ +0006bc40: 206f 6620 696e 6c69 6572 732e 2046 696e of inliers. Fin │ │ │ +0006bc50: 616c 6c79 2c20 6966 2074 6865 7265 2061 ally, if there a │ │ │ +0006bc60: 7265 206e 6f20 6f75 746c 6965 7273 2061 re no outliers a │ │ │ +0006bc70: 6e64 2074 6865 0a6e 6f69 7365 2069 7320 nd the.noise is │ │ │ +0006bc80: 7261 7468 6572 2073 6d61 6c6c 2c20 7573 rather small, us │ │ │ +0006bc90: 6520 7468 6520 6465 6661 756c 7420 6d65 e the default me │ │ │ +0006bca0: 7468 6f64 2028 6d65 7468 6f64 3d30 292e thod (method=0). │ │ │ +0006bcb0: 0a0a 5468 6520 6675 6e63 7469 6f6e 2069 ..The function i │ │ │ +0006bcc0: 7320 7573 6564 2074 6f20 6669 6e64 2069 s used to find i │ │ │ +0006bcd0: 6e69 7469 616c 2069 6e74 7269 6e73 6963 nitial intrinsic │ │ │ +0006bce0: 2061 6e64 2065 7874 7269 6e73 6963 206d and extrinsic m │ │ │ +0006bcf0: 6174 7269 6365 732e 2048 6f6d 6f67 7261 atrices. Homogra │ │ │ +0006bd00: 7068 7920 6d61 7472 6978 2069 730a 6465 phy matrix is.de │ │ │ +0006bd10: 7465 726d 696e 6564 2075 7020 746f 2061 termined up to a │ │ │ +0006bd20: 2073 6361 6c65 2e20 4966 205c 2868 5f7b scale. If \(h_{ │ │ │ +0006bd30: 3333 7d5c 2920 6973 206e 6f6e 2d7a 6572 33}\) is non-zer │ │ │ +0006bd40: 6f2c 2074 6865 206d 6174 7269 7820 6973 o, the matrix is │ │ │ +0006bd50: 206e 6f72 6d61 6c69 7a65 6420 736f 2074 normalized so t │ │ │ +0006bd60: 6861 7420 5c28 685f 7b33 337d 3d31 5c29 hat \(h_{33}=1\) │ │ │ +0006bd70: 2e0a 3c62 3e4e 6f74 653a 3c2f 623e 2057 ..Note: W │ │ │ +0006bd80: 6865 6e65 7665 7220 616e 205c 2848 5c29 henever an \(H\) │ │ │ +0006bd90: 206d 6174 7269 7820 6361 6e6e 6f74 2062 matrix cannot b │ │ │ +0006bda0: 6520 6573 7469 6d61 7465 642c 2061 6e20 e estimated, an │ │ │ +0006bdb0: 656d 7074 7920 6f6e 6520 7769 6c6c 2062 empty one will b │ │ │ +0006bdc0: 6520 7265 7475 726e 6564 2e0a 0a53 4545 e returned...SEE │ │ │ +0006bdd0: 3a0a 6765 7441 6666 696e 6554 7261 6e73 :.getAffineTrans │ │ │ +0006bde0: 666f 726d 2c20 6573 7469 6d61 7465 4166 form, estimateAf │ │ │ +0006bdf0: 6669 6e65 3244 2c20 6573 7469 6d61 7465 fine2D, estimate │ │ │ +0006be00: 4166 6669 6e65 5061 7274 6961 6c32 442c AffinePartial2D, │ │ │ +0006be10: 2067 6574 5065 7273 7065 6374 6976 6554 getPerspectiveT │ │ │ +0006be20: 7261 6e73 666f 726d 2c20 7761 7270 5065 ransform, warpPe │ │ │ +0006be30: 7273 7065 6374 6976 652c 0a70 6572 7370 rspective,.persp │ │ │ +0006be40: 6563 7469 7665 5472 616e 7366 6f72 6d3c ectiveTransform< │ │ │ +0006be50: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ +0006be60: 3a3c 2f64 743e 0a3c 6464 3e61 7574 6f6d :
    .
    autom │ │ │ +0006be70: 6174 6963 616c 6c79 2067 656e 6572 6174 atically generat │ │ │ +0006be80: 6564 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f ed
    .
    ..

    . │ │ │ +0006bea0: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..

    findH │ │ │ +0006bf20: 6f6d 6f67 7261 7068 793c 2f68 333e 0a3c omography

    .< │ │ │ +0006bf30: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +0006bf40: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +0006bf50: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +0006bf60: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +0006bf90: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +0006bfa0: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +0006bfb0: 726e 2d74 7970 6522 3e3c 6120 6872 6566 rn-type">Mat findHomograp │ │ │ +0006c030: 6879 3c2f 7370 616e 3e3c 7762 723e 3c73 hy(Mat │ │ │ +0006c0a0: 4f66 506f 696e 7432 663c 2f61 3e26 6e62 OfPoint2f&nb │ │ │ +0006c0b0: 7370 3b73 7263 506f 696e 7473 2c0a 203c sp;srcPoints,. < │ │ │ +0006c0c0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0006c0d0: 4d61 744f 6650 6f69 6e74 3266 2e68 746d MatOfPoint2f.htm │ │ │ +0006c0e0: 6c22 2074 6974 6c65 3d22 636c 6173 7320 l" title="class │ │ │ +0006c0f0: 696e 206f 7267 2e6f 7065 6e63 762e 636f in org.opencv.co │ │ │ +0006c100: 7265 223e 4d61 744f 6650 6f69 6e74 3266 re">MatOfPoint2f │ │ │ +0006c110: 3c2f 613e 266e 6273 703b 6473 7450 6f69  dstPoi │ │ │ +0006c120: 6e74 732c 0a20 696e 7426 6e62 7370 3b6d nts,. int m │ │ │ +0006c130: 6574 686f 6429 3c2f 7370 616e 3e3c 2f64 ethod).
    Finds a p │ │ │ +0006c160: 6572 7370 6563 7469 7665 2074 7261 6e73 erspective trans │ │ │ +0006c170: 666f 726d 6174 696f 6e20 6265 7477 6565 formation betwee │ │ │ +0006c180: 6e20 7477 6f20 706c 616e 6573 2e3c 2f64 n two planes..
    .
    Param │ │ │ +0006c1b0: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ +0006c1c0: 3c63 6f64 653e 7372 6350 6f69 6e74 733c srcPoints< │ │ │ +0006c1d0: 2f63 6f64 653e 202d 2043 6f6f 7264 696e /code> - Coordin │ │ │ +0006c1e0: 6174 6573 206f 6620 7468 6520 706f 696e ates of the poin │ │ │ +0006c1f0: 7473 2069 6e20 7468 6520 6f72 6967 696e ts in the origin │ │ │ +0006c200: 616c 2070 6c61 6e65 2c20 6120 6d61 7472 al plane, a matr │ │ │ +0006c210: 6978 206f 6620 7468 6520 7479 7065 2043 ix of the type C │ │ │ +0006c220: 565f 3332 4643 320a 6f72 2076 6563 746f V_32FC2.or vecto │ │ │ +0006c230: 7226 6c74 3b50 6f69 6e74 3266 2667 743b r<Point2f> │ │ │ +0006c240: 202e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 .
    .
    dstPoints - Coordinates │ │ │ +0006c270: 206f 6620 7468 6520 706f 696e 7473 2069 of the points i │ │ │ +0006c280: 6e20 7468 6520 7461 7267 6574 2070 6c61 n the target pla │ │ │ +0006c290: 6e65 2c20 6120 6d61 7472 6978 206f 6620 ne, a matrix of │ │ │ +0006c2a0: 7468 6520 7479 7065 2043 565f 3332 4643 the type CV_32FC │ │ │ +0006c2b0: 3220 6f72 0a61 2076 6563 746f 7226 6c74 2 or.a vector< │ │ │ +0006c2c0: 3b50 6f69 6e74 3266 2667 743b 202e 3c2f ;Point2f> ..
    me │ │ │ +0006c2e0: 7468 6f64 3c2f 636f 6465 3e20 2d20 4d65 thod - Me │ │ │ +0006c2f0: 7468 6f64 2075 7365 6420 746f 2063 6f6d thod used to com │ │ │ +0006c300: 7075 7465 2061 2068 6f6d 6f67 7261 7068 pute a homograph │ │ │ +0006c310: 7920 6d61 7472 6978 2e20 5468 6520 666f y matrix. The fo │ │ │ +0006c320: 6c6c 6f77 696e 6720 6d65 7468 6f64 7320 llowing methods │ │ │ +0006c330: 6172 6520 706f 7373 6962 6c65 3a0a 3c75 are possible:..
  • . │ │ │ +0006c350: 303c 2f62 3e20 2d20 6120 7265 6775 6c61 0 - a regula │ │ │ +0006c360: 7220 6d65 7468 6f64 2075 7369 6e67 2061 r method using a │ │ │ +0006c370: 6c6c 2074 6865 2070 6f69 6e74 732c 2069 ll the points, i │ │ │ +0006c380: 2e65 2e2c 2074 6865 206c 6561 7374 2073 .e., the least s │ │ │ +0006c390: 7175 6172 6573 206d 6574 686f 640a 2020 quares method. │ │ │ +0006c3a0: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020
  • .
  • . │ │ │ +0006c3b0: 5245 463a 2052 414e 5341 4320 2d20 5241 REF: RANSAC - RA │ │ │ +0006c3c0: 4e53 4143 2d62 6173 6564 2072 6f62 7573 NSAC-based robus │ │ │ +0006c3d0: 7420 6d65 7468 6f64 0a20 203c 2f6c 693e t method.
  • │ │ │ +0006c3e0: 0a20 203c 6c69 3e0a 2020 2052 4546 3a20 .
  • . REF: │ │ │ +0006c3f0: 4c4d 4544 5320 2d20 4c65 6173 742d 4d65 LMEDS - Least-Me │ │ │ +0006c400: 6469 616e 2072 6f62 7573 7420 6d65 7468 dian robust meth │ │ │ +0006c410: 6f64 0a20 203c 2f6c 693e 0a20 203c 6c69 od.
  • .
  • . REF: RHO - │ │ │ +0006c430: 5052 4f53 4143 2d62 6173 6564 2072 6f62 PROSAC-based rob │ │ │ +0006c440: 7573 7420 6d65 7468 6f64 0a20 203c 2f6c ust method. ..(used i │ │ │ +0006c460: 6e20 7468 6520 5241 4e53 4143 2061 6e64 n the RANSAC and │ │ │ +0006c470: 2052 484f 206d 6574 686f 6473 206f 6e6c RHO methods onl │ │ │ +0006c480: 7929 2e20 5468 6174 2069 732c 2069 660a y). That is, if. │ │ │ +0006c490: 5c28 5c7c 205c 7465 7874 7474 7b64 7374 \(\| \texttt{dst │ │ │ +0006c4a0: 506f 696e 7473 7d20 5f69 202d 2020 5c74 Points} _i - \t │ │ │ +0006c4b0: 6578 7474 747b 636f 6e76 6572 7450 6f69 exttt{convertPoi │ │ │ +0006c4c0: 6e74 7348 6f6d 6f67 656e 656f 7573 7d20 ntsHomogeneous} │ │ │ +0006c4d0: 2820 5c74 6578 7474 747b 487d 205c 6364 ( \texttt{H} \cd │ │ │ +0006c4e0: 6f74 205c 7465 7874 7474 7b73 7263 506f ot \texttt{srcPo │ │ │ +0006c4f0: 696e 7473 7d20 5f69 2920 5c7c 5f32 2020 ints} _i) \|_2 │ │ │ +0006c500: 2667 743b 2020 5c74 6578 7474 747b 7261 > \texttt{ra │ │ │ +0006c510: 6e73 6163 5265 7072 6f6a 5468 7265 7368 nsacReprojThresh │ │ │ +0006c520: 6f6c 647d 5c29 0a74 6865 6e20 7468 6520 old}\).then the │ │ │ +0006c530: 706f 696e 7420 5c28 695c 2920 6973 2063 point \(i\) is c │ │ │ +0006c540: 6f6e 7369 6465 7265 6420 6173 2061 6e20 onsidered as an │ │ │ +0006c550: 6f75 746c 6965 722e 2049 6620 7372 6350 outlier. If srcP │ │ │ +0006c560: 6f69 6e74 7320 616e 6420 6473 7450 6f69 oints and dstPoi │ │ │ +0006c570: 6e74 7320 6172 6520 6d65 6173 7572 6564 nts are measured │ │ │ +0006c580: 2069 6e20 7069 7865 6c73 2c0a 6974 2075 in pixels,.it u │ │ │ +0006c590: 7375 616c 6c79 206d 616b 6573 2073 656e sually makes sen │ │ │ +0006c5a0: 7365 2074 6f20 7365 7420 7468 6973 2070 se to set this p │ │ │ +0006c5b0: 6172 616d 6574 6572 2073 6f6d 6577 6865 arameter somewhe │ │ │ +0006c5c0: 7265 2069 6e20 7468 6520 7261 6e67 6520 re in the range │ │ │ +0006c5d0: 6f66 2031 2074 6f20 3130 2e0a 6d61 736b of 1 to 10..mask │ │ │ +0006c5e0: 2076 616c 7565 7320 6172 6520 6967 6e6f values are igno │ │ │ +0006c5f0: 7265 642e 0a0a 5468 6520 6675 6e63 7469 red...The functi │ │ │ +0006c600: 6f6e 2066 696e 6473 2061 6e64 2072 6574 on finds and ret │ │ │ +0006c610: 7572 6e73 2074 6865 2070 6572 7370 6563 urns the perspec │ │ │ +0006c620: 7469 7665 2074 7261 6e73 666f 726d 6174 tive transformat │ │ │ +0006c630: 696f 6e20 5c28 485c 2920 6265 7477 6565 ion \(H\) betwee │ │ │ +0006c640: 6e20 7468 6520 736f 7572 6365 2061 6e64 n the source and │ │ │ +0006c650: 2074 6865 0a64 6573 7469 6e61 7469 6f6e the.destination │ │ │ +0006c660: 2070 6c61 6e65 733a 0a0a 5c28 735f 6920 planes:..\(s_i │ │ │ +0006c670: 205c 7665 6374 6872 6565 7b78 275f 697d \vecthree{x'_i} │ │ │ +0006c680: 7b79 275f 697d 7b31 7d20 5c73 696d 2048 {y'_i}{1} \sim H │ │ │ +0006c690: 2020 5c76 6563 7468 7265 657b 785f 697d \vecthree{x_i} │ │ │ +0006c6a0: 7b79 5f69 7d7b 317d 5c29 0a0a 736f 2074 {y_i}{1}\)..so t │ │ │ +0006c6b0: 6861 7420 7468 6520 6261 636b 2d70 726f hat the back-pro │ │ │ +0006c6c0: 6a65 6374 696f 6e20 6572 726f 720a 0a5c jection error..\ │ │ │ +0006c6d0: 285c 7375 6d20 5f69 205c 6c65 6674 2028 (\sum _i \left ( │ │ │ +0006c6e0: 2078 275f 692d 205c 6672 6163 7b68 5f7b x'_i- \frac{h_{ │ │ │ +0006c6f0: 3131 7d20 785f 6920 2b20 685f 7b31 327d 11} x_i + h_{12} │ │ │ +0006c700: 2079 5f69 202b 2068 5f7b 3133 7d7d 7b68 y_i + h_{13}}{h │ │ │ +0006c710: 5f7b 3331 7d20 785f 6920 2b20 685f 7b33 _{31} x_i + h_{3 │ │ │ +0006c720: 327d 2079 5f69 202b 2068 5f7b 3333 7d7d 2} y_i + h_{33}} │ │ │ +0006c730: 205c 7269 6768 7420 295e 322b 205c 6c65 \right )^2+ \le │ │ │ +0006c740: 6674 2028 2079 275f 692d 205c 6672 6163 ft ( y'_i- \frac │ │ │ +0006c750: 7b68 5f7b 3231 7d20 785f 6920 2b20 685f {h_{21} x_i + h_ │ │ │ +0006c760: 7b32 327d 2079 5f69 202b 2068 5f7b 3233 {22} y_i + h_{23 │ │ │ +0006c770: 7d7d 7b68 5f7b 3331 7d20 785f 6920 2b20 }}{h_{31} x_i + │ │ │ +0006c780: 685f 7b33 327d 2079 5f69 202b 2068 5f7b h_{32} y_i + h_{ │ │ │ +0006c790: 3333 7d7d 205c 7269 6768 7420 295e 325c 33}} \right )^2\ │ │ │ +0006c7a0: 290a 0a69 7320 6d69 6e69 6d69 7a65 642e )..is minimized. │ │ │ +0006c7b0: 2049 6620 7468 6520 7061 7261 6d65 7465 If the paramete │ │ │ +0006c7c0: 7220 6d65 7468 6f64 2069 7320 7365 7420 r method is set │ │ │ +0006c7d0: 746f 2074 6865 2064 6566 6175 6c74 2076 to the default v │ │ │ +0006c7e0: 616c 7565 2030 2c20 7468 6520 6675 6e63 alue 0, the func │ │ │ +0006c7f0: 7469 6f6e 2075 7365 7320 616c 6c20 7468 tion uses all th │ │ │ +0006c800: 6520 706f 696e 740a 7061 6972 7320 746f e point.pairs to │ │ │ +0006c810: 2063 6f6d 7075 7465 2061 6e20 696e 6974 compute an init │ │ │ +0006c820: 6961 6c20 686f 6d6f 6772 6170 6879 2065 ial homography e │ │ │ +0006c830: 7374 696d 6174 6520 7769 7468 2061 2073 stimate with a s │ │ │ +0006c840: 696d 706c 6520 6c65 6173 742d 7371 7561 imple least-squa │ │ │ +0006c850: 7265 7320 7363 6865 6d65 2e0a 0a48 6f77 res scheme...How │ │ │ +0006c860: 6576 6572 2c20 6966 206e 6f74 2061 6c6c ever, if not all │ │ │ +0006c870: 206f 6620 7468 6520 706f 696e 7420 7061 of the point pa │ │ │ +0006c880: 6972 7320 2820 5c28 7372 6350 6f69 6e74 irs ( \(srcPoint │ │ │ +0006c890: 735f 695c 292c 205c 2864 7374 506f 696e s_i\), \(dstPoin │ │ │ +0006c8a0: 7473 5f69 5c29 2029 2066 6974 2074 6865 ts_i\) ) fit the │ │ │ +0006c8b0: 2072 6967 6964 2070 6572 7370 6563 7469 rigid perspecti │ │ │ +0006c8c0: 7665 0a74 7261 6e73 666f 726d 6174 696f ve.transformatio │ │ │ +0006c8d0: 6e20 2874 6861 7420 6973 2c20 7468 6572 n (that is, ther │ │ │ +0006c8e0: 6520 6172 6520 736f 6d65 206f 7574 6c69 e are some outli │ │ │ +0006c8f0: 6572 7329 2c20 7468 6973 2069 6e69 7469 ers), this initi │ │ │ +0006c900: 616c 2065 7374 696d 6174 6520 7769 6c6c al estimate will │ │ │ +0006c910: 2062 6520 706f 6f72 2e20 496e 2074 6869 be poor. In thi │ │ │ +0006c920: 7320 6361 7365 2c0a 796f 7520 6361 6e20 s case,.you can │ │ │ +0006c930: 7573 6520 6f6e 6520 6f66 2074 6865 2074 use one of the t │ │ │ +0006c940: 6872 6565 2072 6f62 7573 7420 6d65 7468 hree robust meth │ │ │ +0006c950: 6f64 732e 2054 6865 206d 6574 686f 6473 ods. The methods │ │ │ +0006c960: 2052 414e 5341 432c 204c 4d65 4453 2061 RANSAC, LMeDS a │ │ │ +0006c970: 6e64 2052 484f 2074 7279 206d 616e 7920 nd RHO try many │ │ │ +0006c980: 6469 6666 6572 656e 740a 7261 6e64 6f6d different.random │ │ │ +0006c990: 2073 7562 7365 7473 206f 6620 7468 6520 subsets of the │ │ │ +0006c9a0: 636f 7272 6573 706f 6e64 696e 6720 706f corresponding po │ │ │ +0006c9b0: 696e 7420 7061 6972 7320 286f 6620 666f int pairs (of fo │ │ │ +0006c9c0: 7572 2070 6169 7273 2065 6163 682c 2063 ur pairs each, c │ │ │ +0006c9d0: 6f6c 6c69 6e65 6172 2070 6169 7273 2061 ollinear pairs a │ │ │ +0006c9e0: 7265 2064 6973 6361 7264 6564 292c 2065 re discarded), e │ │ │ +0006c9f0: 7374 696d 6174 6520 7468 6520 686f 6d6f stimate the homo │ │ │ +0006ca00: 6772 6170 6879 206d 6174 7269 780a 7573 graphy matrix.us │ │ │ +0006ca10: 696e 6720 7468 6973 2073 7562 7365 7420 ing this subset │ │ │ +0006ca20: 616e 6420 6120 7369 6d70 6c65 206c 6561 and a simple lea │ │ │ +0006ca30: 7374 2d73 7175 6172 6573 2061 6c67 6f72 st-squares algor │ │ │ +0006ca40: 6974 686d 2c20 616e 6420 7468 656e 2063 ithm, and then c │ │ │ +0006ca50: 6f6d 7075 7465 2074 6865 2071 7561 6c69 ompute the quali │ │ │ +0006ca60: 7479 2f67 6f6f 646e 6573 7320 6f66 2074 ty/goodness of t │ │ │ +0006ca70: 6865 0a63 6f6d 7075 7465 6420 686f 6d6f he.computed homo │ │ │ +0006ca80: 6772 6170 6879 2028 7768 6963 6820 6973 graphy (which is │ │ │ +0006ca90: 2074 6865 206e 756d 6265 7220 6f66 2069 the number of i │ │ │ +0006caa0: 6e6c 6965 7273 2066 6f72 2052 414e 5341 nliers for RANSA │ │ │ +0006cab0: 4320 6f72 2074 6865 206c 6561 7374 206d C or the least m │ │ │ +0006cac0: 6564 6961 6e20 7265 2d70 726f 6a65 6374 edian re-project │ │ │ +0006cad0: 696f 6e20 6572 726f 7220 666f 720a 4c4d ion error for.LM │ │ │ +0006cae0: 6544 5329 2e20 5468 6520 6265 7374 2073 eDS). The best s │ │ │ +0006caf0: 7562 7365 7420 6973 2074 6865 6e20 7573 ubset is then us │ │ │ +0006cb00: 6564 2074 6f20 7072 6f64 7563 6520 7468 ed to produce th │ │ │ +0006cb10: 6520 696e 6974 6961 6c20 6573 7469 6d61 e initial estima │ │ │ +0006cb20: 7465 206f 6620 7468 6520 686f 6d6f 6772 te of the homogr │ │ │ +0006cb30: 6170 6879 206d 6174 7269 7820 616e 640a aphy matrix and. │ │ │ +0006cb40: 7468 6520 6d61 736b 206f 6620 696e 6c69 the mask of inli │ │ │ +0006cb50: 6572 732f 6f75 746c 6965 7273 2e0a 0a52 ers/outliers...R │ │ │ +0006cb60: 6567 6172 646c 6573 7320 6f66 2074 6865 egardless of the │ │ │ +0006cb70: 206d 6574 686f 642c 2072 6f62 7573 7420 method, robust │ │ │ +0006cb80: 6f72 206e 6f74 2c20 7468 6520 636f 6d70 or not, the comp │ │ │ +0006cb90: 7574 6564 2068 6f6d 6f67 7261 7068 7920 uted homography │ │ │ +0006cba0: 6d61 7472 6978 2069 7320 7265 6669 6e65 matrix is refine │ │ │ +0006cbb0: 6420 6675 7274 6865 7220 2875 7369 6e67 d further (using │ │ │ +0006cbc0: 0a69 6e6c 6965 7273 206f 6e6c 7920 696e .inliers only in │ │ │ +0006cbd0: 2063 6173 6520 6f66 2061 2072 6f62 7573 case of a robus │ │ │ +0006cbe0: 7420 6d65 7468 6f64 2920 7769 7468 2074 t method) with t │ │ │ +0006cbf0: 6865 204c 6576 656e 6265 7267 2d4d 6172 he Levenberg-Mar │ │ │ +0006cc00: 7175 6172 6474 206d 6574 686f 6420 746f quardt method to │ │ │ +0006cc10: 2072 6564 7563 6520 7468 650a 7265 2d70 reduce the.re-p │ │ │ +0006cc20: 726f 6a65 6374 696f 6e20 6572 726f 7220 rojection error │ │ │ +0006cc30: 6576 656e 206d 6f72 652e 0a0a 5468 6520 even more...The │ │ │ +0006cc40: 6d65 7468 6f64 7320 5241 4e53 4143 2061 methods RANSAC a │ │ │ +0006cc50: 6e64 2052 484f 2063 616e 2068 616e 646c nd RHO can handl │ │ │ +0006cc60: 6520 7072 6163 7469 6361 6c6c 7920 616e e practically an │ │ │ +0006cc70: 7920 7261 7469 6f20 6f66 206f 7574 6c69 y ratio of outli │ │ │ +0006cc80: 6572 7320 6275 7420 6e65 6564 2061 2074 ers but need a t │ │ │ +0006cc90: 6872 6573 686f 6c64 2074 6f0a 6469 7374 hreshold to.dist │ │ │ +0006cca0: 696e 6775 6973 6820 696e 6c69 6572 7320 inguish inliers │ │ │ +0006ccb0: 6672 6f6d 206f 7574 6c69 6572 732e 2054 from outliers. T │ │ │ +0006ccc0: 6865 206d 6574 686f 6420 4c4d 6544 5320 he method LMeDS │ │ │ +0006ccd0: 646f 6573 206e 6f74 206e 6565 6420 616e does not need an │ │ │ +0006cce0: 7920 7468 7265 7368 6f6c 6420 6275 7420 y threshold but │ │ │ +0006ccf0: 6974 2077 6f72 6b73 0a63 6f72 7265 6374 it works.correct │ │ │ +0006cd00: 6c79 206f 6e6c 7920 7768 656e 2074 6865 ly only when the │ │ │ +0006cd10: 7265 2061 7265 206d 6f72 6520 7468 616e re are more than │ │ │ +0006cd20: 2035 3025 206f 6620 696e 6c69 6572 732e 50% of inliers. │ │ │ +0006cd30: 2046 696e 616c 6c79 2c20 6966 2074 6865 Finally, if the │ │ │ +0006cd40: 7265 2061 7265 206e 6f20 6f75 746c 6965 re are no outlie │ │ │ +0006cd50: 7273 2061 6e64 2074 6865 0a6e 6f69 7365 rs and the.noise │ │ │ +0006cd60: 2069 7320 7261 7468 6572 2073 6d61 6c6c is rather small │ │ │ +0006cd70: 2c20 7573 6520 7468 6520 6465 6661 756c , use the defaul │ │ │ +0006cd80: 7420 6d65 7468 6f64 2028 6d65 7468 6f64 t method (method │ │ │ +0006cd90: 3d30 292e 0a0a 5468 6520 6675 6e63 7469 =0)...The functi │ │ │ +0006cda0: 6f6e 2069 7320 7573 6564 2074 6f20 6669 on is used to fi │ │ │ +0006cdb0: 6e64 2069 6e69 7469 616c 2069 6e74 7269 nd initial intri │ │ │ +0006cdc0: 6e73 6963 2061 6e64 2065 7874 7269 6e73 nsic and extrins │ │ │ +0006cdd0: 6963 206d 6174 7269 6365 732e 2048 6f6d ic matrices. Hom │ │ │ +0006cde0: 6f67 7261 7068 7920 6d61 7472 6978 2069 ography matrix i │ │ │ +0006cdf0: 730a 6465 7465 726d 696e 6564 2075 7020 s.determined up │ │ │ +0006ce00: 746f 2061 2073 6361 6c65 2e20 4966 205c to a scale. If \ │ │ │ +0006ce10: 2868 5f7b 3333 7d5c 2920 6973 206e 6f6e (h_{33}\) is non │ │ │ +0006ce20: 2d7a 6572 6f2c 2074 6865 206d 6174 7269 -zero, the matri │ │ │ +0006ce30: 7820 6973 206e 6f72 6d61 6c69 7a65 6420 x is normalized │ │ │ +0006ce40: 736f 2074 6861 7420 5c28 685f 7b33 337d so that \(h_{33} │ │ │ +0006ce50: 3d31 5c29 2e0a 3c62 3e4e 6f74 653a 3c2f =1\)..Note: Whenever an \ │ │ │ +0006ce70: 2848 5c29 206d 6174 7269 7820 6361 6e6e (H\) matrix cann │ │ │ +0006ce80: 6f74 2062 6520 6573 7469 6d61 7465 642c ot be estimated, │ │ │ +0006ce90: 2061 6e20 656d 7074 7920 6f6e 6520 7769 an empty one wi │ │ │ +0006cea0: 6c6c 2062 6520 7265 7475 726e 6564 2e0a ll be returned.. │ │ │ +0006ceb0: 0a53 4545 3a0a 6765 7441 6666 696e 6554 .SEE:.getAffineT │ │ │ +0006cec0: 7261 6e73 666f 726d 2c20 6573 7469 6d61 ransform, estima │ │ │ +0006ced0: 7465 4166 6669 6e65 3244 2c20 6573 7469 teAffine2D, esti │ │ │ +0006cee0: 6d61 7465 4166 6669 6e65 5061 7274 6961 mateAffinePartia │ │ │ +0006cef0: 6c32 442c 2067 6574 5065 7273 7065 6374 l2D, getPerspect │ │ │ +0006cf00: 6976 6554 7261 6e73 666f 726d 2c20 7761 iveTransform, wa │ │ │ +0006cf10: 7270 5065 7273 7065 6374 6976 652c 0a70 rpPerspective,.p │ │ │ +0006cf20: 6572 7370 6563 7469 7665 5472 616e 7366 erspectiveTransf │ │ │ +0006cf30: 6f72 6d3c 2f64 643e 0a3c 6474 3e52 6574 orm
  • .
    Ret │ │ │ +0006cf40: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e61 urns:
    .
    a │ │ │ +0006cf50: 7574 6f6d 6174 6963 616c 6c79 2067 656e utomatically gen │ │ │ +0006cf60: 6572 6174 6564 3c2f 6464 3e0a 3c2f 646c erated
    .
    .
    ..
  • .
  • .< │ │ │ +0006cf90: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +0006cfa0: 6574 6169 6c22 2069 643d 2266 696e 6448 etail" id="findH │ │ │ +0006cfb0: 6f6d 6f67 7261 7068 7928 6f72 672e 6f70 omography(org.op │ │ │ +0006cfc0: 656e 6376 2e63 6f72 652e 4d61 744f 6650 encv.core.MatOfP │ │ │ +0006cfd0: 6f69 6e74 3266 2c6f 7267 2e6f 7065 6e63 oint2f,org.openc │ │ │ +0006cfe0: 762e 636f 7265 2e4d 6174 4f66 506f 696e v.core.MatOfPoin │ │ │ +0006cff0: 7432 6629 223e 0a3c 6833 3e66 696e 6448 t2f)">.

    findH │ │ │ +0006d000: 6f6d 6f67 7261 7068 793c 2f68 333e 0a3c omography

    .< │ │ │ +0006d010: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +0006d020: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +0006d030: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +0006d040: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +0006d070: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +0006d080: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +0006d090: 726e 2d74 7970 6522 3e3c 6120 6872 6566 rn-type">Mat findHomograp │ │ │ +0006d110: 6879 3c2f 7370 616e 3e3c 7762 723e 3c73 hy(Mat │ │ │ +0006d180: 4f66 506f 696e 7432 663c 2f61 3e26 6e62 OfPoint2f&nb │ │ │ +0006d190: 7370 3b73 7263 506f 696e 7473 2c0a 203c sp;srcPoints,. < │ │ │ +0006d1a0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0006d1b0: 4d61 744f 6650 6f69 6e74 3266 2e68 746d MatOfPoint2f.htm │ │ │ +0006d1c0: 6c22 2074 6974 6c65 3d22 636c 6173 7320 l" title="class │ │ │ +0006d1d0: 696e 206f 7267 2e6f 7065 6e63 762e 636f in org.opencv.co │ │ │ +0006d1e0: 7265 223e 4d61 744f 6650 6f69 6e74 3266 re">MatOfPoint2f │ │ │ +0006d1f0: 3c2f 613e 266e 6273 703b 6473 7450 6f69  dstPoi │ │ │ +0006d200: 6e74 7329 3c2f 7370 616e 3e3c 2f64 6976 nts).
    Finds a per │ │ │ +0006d230: 7370 6563 7469 7665 2074 7261 6e73 666f spective transfo │ │ │ +0006d240: 726d 6174 696f 6e20 6265 7477 6565 6e20 rmation between │ │ │ +0006d250: 7477 6f20 706c 616e 6573 2e3c 2f64 6976 two planes.
    .
    .
    Paramet │ │ │ +0006d280: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    srcPoints - Coordinat │ │ │ +0006d2b0: 6573 206f 6620 7468 6520 706f 696e 7473 es of the points │ │ │ +0006d2c0: 2069 6e20 7468 6520 6f72 6967 696e 616c in the original │ │ │ +0006d2d0: 2070 6c61 6e65 2c20 6120 6d61 7472 6978 plane, a matrix │ │ │ +0006d2e0: 206f 6620 7468 6520 7479 7065 2043 565f of the type CV_ │ │ │ +0006d2f0: 3332 4643 320a 6f72 2076 6563 746f 7226 32FC2.or vector& │ │ │ +0006d300: 6c74 3b50 6f69 6e74 3266 2667 743b 202e lt;Point2f> . │ │ │ +0006d310: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +0006d320: 6473 7450 6f69 6e74 733c 2f63 6f64 653e dstPoints │ │ │ +0006d330: 202d 2043 6f6f 7264 696e 6174 6573 206f - Coordinates o │ │ │ +0006d340: 6620 7468 6520 706f 696e 7473 2069 6e20 f the points in │ │ │ +0006d350: 7468 6520 7461 7267 6574 2070 6c61 6e65 the target plane │ │ │ +0006d360: 2c20 6120 6d61 7472 6978 206f 6620 7468 , a matrix of th │ │ │ +0006d370: 6520 7479 7065 2043 565f 3332 4643 3220 e type CV_32FC2 │ │ │ +0006d380: 6f72 0a61 2076 6563 746f 7226 6c74 3b50 or.a vector<P │ │ │ +0006d390: 6f69 6e74 3266 2667 743b 202e 0a3c 756c oint2f> ..
      .
    • . 0 │ │ │ +0006d3b0: 3c2f 623e 202d 2061 2072 6567 756c 6172 - a regular │ │ │ +0006d3c0: 206d 6574 686f 6420 7573 696e 6720 616c method using al │ │ │ +0006d3d0: 6c20 7468 6520 706f 696e 7473 2c20 692e l the points, i. │ │ │ +0006d3e0: 652e 2c20 7468 6520 6c65 6173 7420 7371 e., the least sq │ │ │ +0006d3f0: 7561 7265 7320 6d65 7468 6f64 0a20 203c uares method. < │ │ │ +0006d400: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2052 /li>.
    • . R │ │ │ +0006d410: 4546 3a20 5241 4e53 4143 202d 2052 414e EF: RANSAC - RAN │ │ │ +0006d420: 5341 432d 6261 7365 6420 726f 6275 7374 SAC-based robust │ │ │ +0006d430: 206d 6574 686f 640a 2020 3c2f 6c69 3e0a method.
    • . │ │ │ +0006d440: 2020 3c6c 693e 0a20 2020 5245 463a 204c
    • . REF: L │ │ │ +0006d450: 4d45 4453 202d 204c 6561 7374 2d4d 6564 MEDS - Least-Med │ │ │ +0006d460: 6961 6e20 726f 6275 7374 206d 6574 686f ian robust metho │ │ │ +0006d470: 640a 2020 3c2f 6c69 3e0a 2020 3c6c 693e d.
    • .
    • │ │ │ +0006d480: 0a20 2020 5245 463a 2052 484f 202d 2050 . REF: RHO - P │ │ │ +0006d490: 524f 5341 432d 6261 7365 6420 726f 6275 ROSAC-based robu │ │ │ +0006d4a0: 7374 206d 6574 686f 640a 2020 3c2f 6c69 st method.
    • .
    .(used in │ │ │ +0006d4c0: 2074 6865 2052 414e 5341 4320 616e 6420 the RANSAC and │ │ │ +0006d4d0: 5248 4f20 6d65 7468 6f64 7320 6f6e 6c79 RHO methods only │ │ │ +0006d4e0: 292e 2054 6861 7420 6973 2c20 6966 0a5c ). That is, if.\ │ │ │ +0006d4f0: 285c 7c20 5c74 6578 7474 747b 6473 7450 (\| \texttt{dstP │ │ │ +0006d500: 6f69 6e74 737d 205f 6920 2d20 205c 7465 oints} _i - \te │ │ │ +0006d510: 7874 7474 7b63 6f6e 7665 7274 506f 696e xttt{convertPoin │ │ │ +0006d520: 7473 486f 6d6f 6765 6e65 6f75 737d 2028 tsHomogeneous} ( │ │ │ +0006d530: 205c 7465 7874 7474 7b48 7d20 5c63 646f \texttt{H} \cdo │ │ │ +0006d540: 7420 5c74 6578 7474 747b 7372 6350 6f69 t \texttt{srcPoi │ │ │ +0006d550: 6e74 737d 205f 6929 205c 7c5f 3220 2026 nts} _i) \|_2 & │ │ │ +0006d560: 6774 3b20 205c 7465 7874 7474 7b72 616e gt; \texttt{ran │ │ │ +0006d570: 7361 6352 6570 726f 6a54 6872 6573 686f sacReprojThresho │ │ │ +0006d580: 6c64 7d5c 290a 7468 656e 2074 6865 2070 ld}\).then the p │ │ │ +0006d590: 6f69 6e74 205c 2869 5c29 2069 7320 636f oint \(i\) is co │ │ │ +0006d5a0: 6e73 6964 6572 6564 2061 7320 616e 206f nsidered as an o │ │ │ +0006d5b0: 7574 6c69 6572 2e20 4966 2073 7263 506f utlier. If srcPo │ │ │ +0006d5c0: 696e 7473 2061 6e64 2064 7374 506f 696e ints and dstPoin │ │ │ +0006d5d0: 7473 2061 7265 206d 6561 7375 7265 6420 ts are measured │ │ │ +0006d5e0: 696e 2070 6978 656c 732c 0a69 7420 7573 in pixels,.it us │ │ │ +0006d5f0: 7561 6c6c 7920 6d61 6b65 7320 7365 6e73 ually makes sens │ │ │ +0006d600: 6520 746f 2073 6574 2074 6869 7320 7061 e to set this pa │ │ │ +0006d610: 7261 6d65 7465 7220 736f 6d65 7768 6572 rameter somewher │ │ │ +0006d620: 6520 696e 2074 6865 2072 616e 6765 206f e in the range o │ │ │ +0006d630: 6620 3120 746f 2031 302e 0a6d 6173 6b20 f 1 to 10..mask │ │ │ +0006d640: 7661 6c75 6573 2061 7265 2069 676e 6f72 values are ignor │ │ │ +0006d650: 6564 2e0a 0a54 6865 2066 756e 6374 696f ed...The functio │ │ │ +0006d660: 6e20 6669 6e64 7320 616e 6420 7265 7475 n finds and retu │ │ │ +0006d670: 726e 7320 7468 6520 7065 7273 7065 6374 rns the perspect │ │ │ +0006d680: 6976 6520 7472 616e 7366 6f72 6d61 7469 ive transformati │ │ │ +0006d690: 6f6e 205c 2848 5c29 2062 6574 7765 656e on \(H\) between │ │ │ +0006d6a0: 2074 6865 2073 6f75 7263 6520 616e 6420 the source and │ │ │ +0006d6b0: 7468 650a 6465 7374 696e 6174 696f 6e20 the.destination │ │ │ +0006d6c0: 706c 616e 6573 3a0a 0a5c 2873 5f69 2020 planes:..\(s_i │ │ │ +0006d6d0: 5c76 6563 7468 7265 657b 7827 5f69 7d7b \vecthree{x'_i}{ │ │ │ +0006d6e0: 7927 5f69 7d7b 317d 205c 7369 6d20 4820 y'_i}{1} \sim H │ │ │ +0006d6f0: 205c 7665 6374 6872 6565 7b78 5f69 7d7b \vecthree{x_i}{ │ │ │ +0006d700: 795f 697d 7b31 7d5c 290a 0a73 6f20 7468 y_i}{1}\)..so th │ │ │ +0006d710: 6174 2074 6865 2062 6163 6b2d 7072 6f6a at the back-proj │ │ │ +0006d720: 6563 7469 6f6e 2065 7272 6f72 0a0a 5c28 ection error..\( │ │ │ +0006d730: 5c73 756d 205f 6920 5c6c 6566 7420 2820 \sum _i \left ( │ │ │ +0006d740: 7827 5f69 2d20 5c66 7261 637b 685f 7b31 x'_i- \frac{h_{1 │ │ │ +0006d750: 317d 2078 5f69 202b 2068 5f7b 3132 7d20 1} x_i + h_{12} │ │ │ +0006d760: 795f 6920 2b20 685f 7b31 337d 7d7b 685f y_i + h_{13}}{h_ │ │ │ +0006d770: 7b33 317d 2078 5f69 202b 2068 5f7b 3332 {31} x_i + h_{32 │ │ │ +0006d780: 7d20 795f 6920 2b20 685f 7b33 337d 7d20 } y_i + h_{33}} │ │ │ +0006d790: 5c72 6967 6874 2029 5e32 2b20 5c6c 6566 \right )^2+ \lef │ │ │ +0006d7a0: 7420 2820 7927 5f69 2d20 5c66 7261 637b t ( y'_i- \frac{ │ │ │ +0006d7b0: 685f 7b32 317d 2078 5f69 202b 2068 5f7b h_{21} x_i + h_{ │ │ │ +0006d7c0: 3232 7d20 795f 6920 2b20 685f 7b32 337d 22} y_i + h_{23} │ │ │ +0006d7d0: 7d7b 685f 7b33 317d 2078 5f69 202b 2068 }{h_{31} x_i + h │ │ │ +0006d7e0: 5f7b 3332 7d20 795f 6920 2b20 685f 7b33 _{32} y_i + h_{3 │ │ │ +0006d7f0: 337d 7d20 5c72 6967 6874 2029 5e32 5c29 3}} \right )^2\) │ │ │ +0006d800: 0a0a 6973 206d 696e 696d 697a 6564 2e20 ..is minimized. │ │ │ +0006d810: 4966 2074 6865 2070 6172 616d 6574 6572 If the parameter │ │ │ +0006d820: 206d 6574 686f 6420 6973 2073 6574 2074 method is set t │ │ │ +0006d830: 6f20 7468 6520 6465 6661 756c 7420 7661 o the default va │ │ │ +0006d840: 6c75 6520 302c 2074 6865 2066 756e 6374 lue 0, the funct │ │ │ +0006d850: 696f 6e20 7573 6573 2061 6c6c 2074 6865 ion uses all the │ │ │ +0006d860: 2070 6f69 6e74 0a70 6169 7273 2074 6f20 point.pairs to │ │ │ +0006d870: 636f 6d70 7574 6520 616e 2069 6e69 7469 compute an initi │ │ │ +0006d880: 616c 2068 6f6d 6f67 7261 7068 7920 6573 al homography es │ │ │ +0006d890: 7469 6d61 7465 2077 6974 6820 6120 7369 timate with a si │ │ │ +0006d8a0: 6d70 6c65 206c 6561 7374 2d73 7175 6172 mple least-squar │ │ │ +0006d8b0: 6573 2073 6368 656d 652e 0a0a 486f 7765 es scheme...Howe │ │ │ +0006d8c0: 7665 722c 2069 6620 6e6f 7420 616c 6c20 ver, if not all │ │ │ +0006d8d0: 6f66 2074 6865 2070 6f69 6e74 2070 6169 of the point pai │ │ │ +0006d8e0: 7273 2028 205c 2873 7263 506f 696e 7473 rs ( \(srcPoints │ │ │ +0006d8f0: 5f69 5c29 2c20 5c28 6473 7450 6f69 6e74 _i\), \(dstPoint │ │ │ +0006d900: 735f 695c 2920 2920 6669 7420 7468 6520 s_i\) ) fit the │ │ │ +0006d910: 7269 6769 6420 7065 7273 7065 6374 6976 rigid perspectiv │ │ │ +0006d920: 650a 7472 616e 7366 6f72 6d61 7469 6f6e e.transformation │ │ │ +0006d930: 2028 7468 6174 2069 732c 2074 6865 7265 (that is, there │ │ │ +0006d940: 2061 7265 2073 6f6d 6520 6f75 746c 6965 are some outlie │ │ │ +0006d950: 7273 292c 2074 6869 7320 696e 6974 6961 rs), this initia │ │ │ +0006d960: 6c20 6573 7469 6d61 7465 2077 696c 6c20 l estimate will │ │ │ +0006d970: 6265 2070 6f6f 722e 2049 6e20 7468 6973 be poor. In this │ │ │ +0006d980: 2063 6173 652c 0a79 6f75 2063 616e 2075 case,.you can u │ │ │ +0006d990: 7365 206f 6e65 206f 6620 7468 6520 7468 se one of the th │ │ │ +0006d9a0: 7265 6520 726f 6275 7374 206d 6574 686f ree robust metho │ │ │ +0006d9b0: 6473 2e20 5468 6520 6d65 7468 6f64 7320 ds. The methods │ │ │ +0006d9c0: 5241 4e53 4143 2c20 4c4d 6544 5320 616e RANSAC, LMeDS an │ │ │ +0006d9d0: 6420 5248 4f20 7472 7920 6d61 6e79 2064 d RHO try many d │ │ │ +0006d9e0: 6966 6665 7265 6e74 0a72 616e 646f 6d20 ifferent.random │ │ │ +0006d9f0: 7375 6273 6574 7320 6f66 2074 6865 2063 subsets of the c │ │ │ +0006da00: 6f72 7265 7370 6f6e 6469 6e67 2070 6f69 orresponding poi │ │ │ +0006da10: 6e74 2070 6169 7273 2028 6f66 2066 6f75 nt pairs (of fou │ │ │ +0006da20: 7220 7061 6972 7320 6561 6368 2c20 636f r pairs each, co │ │ │ +0006da30: 6c6c 696e 6561 7220 7061 6972 7320 6172 llinear pairs ar │ │ │ +0006da40: 6520 6469 7363 6172 6465 6429 2c20 6573 e discarded), es │ │ │ +0006da50: 7469 6d61 7465 2074 6865 2068 6f6d 6f67 timate the homog │ │ │ +0006da60: 7261 7068 7920 6d61 7472 6978 0a75 7369 raphy matrix.usi │ │ │ +0006da70: 6e67 2074 6869 7320 7375 6273 6574 2061 ng this subset a │ │ │ +0006da80: 6e64 2061 2073 696d 706c 6520 6c65 6173 nd a simple leas │ │ │ +0006da90: 742d 7371 7561 7265 7320 616c 676f 7269 t-squares algori │ │ │ +0006daa0: 7468 6d2c 2061 6e64 2074 6865 6e20 636f thm, and then co │ │ │ +0006dab0: 6d70 7574 6520 7468 6520 7175 616c 6974 mpute the qualit │ │ │ +0006dac0: 792f 676f 6f64 6e65 7373 206f 6620 7468 y/goodness of th │ │ │ +0006dad0: 650a 636f 6d70 7574 6564 2068 6f6d 6f67 e.computed homog │ │ │ +0006dae0: 7261 7068 7920 2877 6869 6368 2069 7320 raphy (which is │ │ │ +0006daf0: 7468 6520 6e75 6d62 6572 206f 6620 696e the number of in │ │ │ +0006db00: 6c69 6572 7320 666f 7220 5241 4e53 4143 liers for RANSAC │ │ │ +0006db10: 206f 7220 7468 6520 6c65 6173 7420 6d65 or the least me │ │ │ +0006db20: 6469 616e 2072 652d 7072 6f6a 6563 7469 dian re-projecti │ │ │ +0006db30: 6f6e 2065 7272 6f72 2066 6f72 0a4c 4d65 on error for.LMe │ │ │ +0006db40: 4453 292e 2054 6865 2062 6573 7420 7375 DS). The best su │ │ │ +0006db50: 6273 6574 2069 7320 7468 656e 2075 7365 bset is then use │ │ │ +0006db60: 6420 746f 2070 726f 6475 6365 2074 6865 d to produce the │ │ │ +0006db70: 2069 6e69 7469 616c 2065 7374 696d 6174 initial estimat │ │ │ +0006db80: 6520 6f66 2074 6865 2068 6f6d 6f67 7261 e of the homogra │ │ │ +0006db90: 7068 7920 6d61 7472 6978 2061 6e64 0a74 phy matrix and.t │ │ │ +0006dba0: 6865 206d 6173 6b20 6f66 2069 6e6c 6965 he mask of inlie │ │ │ +0006dbb0: 7273 2f6f 7574 6c69 6572 732e 0a0a 5265 rs/outliers...Re │ │ │ +0006dbc0: 6761 7264 6c65 7373 206f 6620 7468 6520 gardless of the │ │ │ +0006dbd0: 6d65 7468 6f64 2c20 726f 6275 7374 206f method, robust o │ │ │ +0006dbe0: 7220 6e6f 742c 2074 6865 2063 6f6d 7075 r not, the compu │ │ │ +0006dbf0: 7465 6420 686f 6d6f 6772 6170 6879 206d ted homography m │ │ │ +0006dc00: 6174 7269 7820 6973 2072 6566 696e 6564 atrix is refined │ │ │ +0006dc10: 2066 7572 7468 6572 2028 7573 696e 670a further (using. │ │ │ +0006dc20: 696e 6c69 6572 7320 6f6e 6c79 2069 6e20 inliers only in │ │ │ +0006dc30: 6361 7365 206f 6620 6120 726f 6275 7374 case of a robust │ │ │ +0006dc40: 206d 6574 686f 6429 2077 6974 6820 7468 method) with th │ │ │ +0006dc50: 6520 4c65 7665 6e62 6572 672d 4d61 7271 e Levenberg-Marq │ │ │ +0006dc60: 7561 7264 7420 6d65 7468 6f64 2074 6f20 uardt method to │ │ │ +0006dc70: 7265 6475 6365 2074 6865 0a72 652d 7072 reduce the.re-pr │ │ │ +0006dc80: 6f6a 6563 7469 6f6e 2065 7272 6f72 2065 ojection error e │ │ │ +0006dc90: 7665 6e20 6d6f 7265 2e0a 0a54 6865 206d ven more...The m │ │ │ +0006dca0: 6574 686f 6473 2052 414e 5341 4320 616e ethods RANSAC an │ │ │ +0006dcb0: 6420 5248 4f20 6361 6e20 6861 6e64 6c65 d RHO can handle │ │ │ +0006dcc0: 2070 7261 6374 6963 616c 6c79 2061 6e79 practically any │ │ │ +0006dcd0: 2072 6174 696f 206f 6620 6f75 746c 6965 ratio of outlie │ │ │ +0006dce0: 7273 2062 7574 206e 6565 6420 6120 7468 rs but need a th │ │ │ +0006dcf0: 7265 7368 6f6c 6420 746f 0a64 6973 7469 reshold to.disti │ │ │ +0006dd00: 6e67 7569 7368 2069 6e6c 6965 7273 2066 nguish inliers f │ │ │ +0006dd10: 726f 6d20 6f75 746c 6965 7273 2e20 5468 rom outliers. Th │ │ │ +0006dd20: 6520 6d65 7468 6f64 204c 4d65 4453 2064 e method LMeDS d │ │ │ +0006dd30: 6f65 7320 6e6f 7420 6e65 6564 2061 6e79 oes not need any │ │ │ +0006dd40: 2074 6872 6573 686f 6c64 2062 7574 2069 threshold but i │ │ │ +0006dd50: 7420 776f 726b 730a 636f 7272 6563 746c t works.correctl │ │ │ +0006dd60: 7920 6f6e 6c79 2077 6865 6e20 7468 6572 y only when ther │ │ │ +0006dd70: 6520 6172 6520 6d6f 7265 2074 6861 6e20 e are more than │ │ │ +0006dd80: 3530 2520 6f66 2069 6e6c 6965 7273 2e20 50% of inliers. │ │ │ +0006dd90: 4669 6e61 6c6c 792c 2069 6620 7468 6572 Finally, if ther │ │ │ +0006dda0: 6520 6172 6520 6e6f 206f 7574 6c69 6572 e are no outlier │ │ │ +0006ddb0: 7320 616e 6420 7468 650a 6e6f 6973 6520 s and the.noise │ │ │ +0006ddc0: 6973 2072 6174 6865 7220 736d 616c 6c2c is rather small, │ │ │ +0006ddd0: 2075 7365 2074 6865 2064 6566 6175 6c74 use the default │ │ │ +0006dde0: 206d 6574 686f 6420 286d 6574 686f 643d method (method= │ │ │ +0006ddf0: 3029 2e0a 0a54 6865 2066 756e 6374 696f 0)...The functio │ │ │ +0006de00: 6e20 6973 2075 7365 6420 746f 2066 696e n is used to fin │ │ │ +0006de10: 6420 696e 6974 6961 6c20 696e 7472 696e d initial intrin │ │ │ +0006de20: 7369 6320 616e 6420 6578 7472 696e 7369 sic and extrinsi │ │ │ +0006de30: 6320 6d61 7472 6963 6573 2e20 486f 6d6f c matrices. Homo │ │ │ +0006de40: 6772 6170 6879 206d 6174 7269 7820 6973 graphy matrix is │ │ │ +0006de50: 0a64 6574 6572 6d69 6e65 6420 7570 2074 .determined up t │ │ │ +0006de60: 6f20 6120 7363 616c 652e 2049 6620 5c28 o a scale. If \( │ │ │ +0006de70: 685f 7b33 337d 5c29 2069 7320 6e6f 6e2d h_{33}\) is non- │ │ │ +0006de80: 7a65 726f 2c20 7468 6520 6d61 7472 6978 zero, the matrix │ │ │ +0006de90: 2069 7320 6e6f 726d 616c 697a 6564 2073 is normalized s │ │ │ +0006dea0: 6f20 7468 6174 205c 2868 5f7b 3333 7d3d o that \(h_{33}= │ │ │ +0006deb0: 315c 292e 0a3c 623e 4e6f 7465 3a3c 2f62 1\)..Note: Whenever an \( │ │ │ +0006ded0: 485c 2920 6d61 7472 6978 2063 616e 6e6f H\) matrix canno │ │ │ +0006dee0: 7420 6265 2065 7374 696d 6174 6564 2c20 t be estimated, │ │ │ +0006def0: 616e 2065 6d70 7479 206f 6e65 2077 696c an empty one wil │ │ │ +0006df00: 6c20 6265 2072 6574 7572 6e65 642e 0a0a l be returned... │ │ │ +0006df10: 5345 453a 0a67 6574 4166 6669 6e65 5472 SEE:.getAffineTr │ │ │ +0006df20: 616e 7366 6f72 6d2c 2065 7374 696d 6174 ansform, estimat │ │ │ +0006df30: 6541 6666 696e 6532 442c 2065 7374 696d eAffine2D, estim │ │ │ +0006df40: 6174 6541 6666 696e 6550 6172 7469 616c ateAffinePartial │ │ │ +0006df50: 3244 2c20 6765 7450 6572 7370 6563 7469 2D, getPerspecti │ │ │ +0006df60: 7665 5472 616e 7366 6f72 6d2c 2077 6172 veTransform, war │ │ │ +0006df70: 7050 6572 7370 6563 7469 7665 2c0a 7065 pPerspective,.pe │ │ │ +0006df80: 7273 7065 6374 6976 6554 7261 6e73 666f rspectiveTransfo │ │ │ +0006df90: 726d 3c2f 6464 3e0a 3c64 743e 5265 7475 rm
    .
    Retu │ │ │ +0006dfa0: 726e 733a 3c2f 6474 3e0a 3c64 643e 6175 rns:
    .
    au │ │ │ +0006dfb0: 746f 6d61 7469 6361 6c6c 7920 6765 6e65 tomatically gene │ │ │ +0006dfc0: 7261 7465 643c 2f64 643e 0a3c 2f64 6c3e rated
    .
    │ │ │ +0006dfd0: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f ...
  • .
  • ..

    fin │ │ │ +0006e090: 6448 6f6d 6f67 7261 7068 793c 2f68 333e dHomography

    │ │ │ +0006e0a0: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ +0006e0c0: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ +0006e0e0: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ +0006e0f0: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ +0006e100: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ +0006e110: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;Mat findHomogr │ │ │ +0006e1a0: 6170 6879 3c2f 7370 616e 3e3c 7762 723e aphy │ │ │ +0006e1b0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (M │ │ │ +0006e210: 6174 4f66 506f 696e 7432 663c 2f61 3e26 atOfPoint2f& │ │ │ +0006e220: 6e62 7370 3b73 7263 506f 696e 7473 2c0a nbsp;srcPoints,. │ │ │ +0006e230: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 MatOfPoint │ │ │ +0006e280: 3266 3c2f 613e 266e 6273 703b 6473 7450 2f dstP │ │ │ +0006e290: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ +0006e2e0: 3b6d 6173 6b2c 0a20 3c61 2068 7265 663d ;mask,. UsacParam │ │ │ +0006e330: 733c 2f61 3e26 6e62 7370 3b70 6172 616d s param │ │ │ +0006e340: 7329 3c2f 7370 616e 3e3c 2f64 6976 3e0a s)
    . │ │ │ +0006e350: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e
    .
  • ..
  • .. │ │ │ +0006e410: 3c68 333e 5251 4465 636f 6d70 3378 333c

    RQDecomp3x3< │ │ │ +0006e420: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +0006e480: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +0006e490: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;d │ │ │ +0006e4b0: 6f75 626c 655b 5d3c 2f73 7061 6e3e 266e ouble[]&n │ │ │ +0006e4c0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;R │ │ │ +0006e4e0: 5144 6563 6f6d 7033 7833 3c2f 7370 616e QDecomp3x3( │ │ │ +0006e510: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +0006e550: 2f61 3e26 6e62 7370 3b73 7263 2c0a 203c /a> src,. < │ │ │ +0006e560: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0006e570: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0006e580: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0006e590: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat mtxR,. < │ │ │ +0006e5b0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0006e5c0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0006e5d0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0006e5e0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat mtxQ,. < │ │ │ +0006e600: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0006e610: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0006e620: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0006e630: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat Qx,. Mat │ │ │ +0006e690: 266e 6273 703b 5179 2c0a 203c 6120 6872  Qy,. Mat&n │ │ │ +0006e6e0: 6273 703b 517a 293c 2f73 7061 6e3e 3c2f bsp;Qz).
    Computes │ │ │ +0006e710: 2061 6e20 5251 2064 6563 6f6d 706f 7369 an RQ decomposi │ │ │ +0006e720: 7469 6f6e 206f 6620 3378 3320 6d61 7472 tion of 3x3 matr │ │ │ +0006e730: 6963 6573 2e3c 2f64 6976 3e0a 3c64 6c20 ices.
    .
    .< │ │ │ +0006e750: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    sr │ │ │ +0006e770: 633c 2f63 6f64 653e 202d 2033 7833 2069 c - 3x3 i │ │ │ +0006e780: 6e70 7574 206d 6174 7269 782e 3c2f 6464 nput matrix.
    .
    mtxR │ │ │ +0006e7a0: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +0006e7b0: 2033 7833 2075 7070 6572 2d74 7269 616e 3x3 upper-trian │ │ │ +0006e7c0: 6775 6c61 7220 6d61 7472 6978 2e3c 2f64 gular matrix..
    mtx │ │ │ +0006e7e0: 513c 2f63 6f64 653e 202d 204f 7574 7075 Q - Outpu │ │ │ +0006e7f0: 7420 3378 3320 6f72 7468 6f67 6f6e 616c t 3x3 orthogonal │ │ │ +0006e800: 206d 6174 7269 782e 3c2f 6464 3e0a 3c64 matrix.
    .Qx - Optional out │ │ │ +0006e830: 7075 7420 3378 3320 726f 7461 7469 6f6e put 3x3 rotation │ │ │ +0006e840: 206d 6174 7269 7820 6172 6f75 6e64 2078 matrix around x │ │ │ +0006e850: 2d61 7869 732e 3c2f 6464 3e0a 3c64 643e -axis..
    │ │ │ +0006e860: 3c63 6f64 653e 5179 3c2f 636f 6465 3e20 Qy │ │ │ +0006e870: 2d20 4f70 7469 6f6e 616c 206f 7574 7075 - Optional outpu │ │ │ +0006e880: 7420 3378 3320 726f 7461 7469 6f6e 206d t 3x3 rotation m │ │ │ +0006e890: 6174 7269 7820 6172 6f75 6e64 2079 2d61 atrix around y-a │ │ │ +0006e8a0: 7869 732e 3c2f 6464 3e0a 3c64 643e 3c63 xis.
    .
    Qz - │ │ │ +0006e8c0: 4f70 7469 6f6e 616c 206f 7574 7075 7420 Optional output │ │ │ +0006e8d0: 3378 3320 726f 7461 7469 6f6e 206d 6174 3x3 rotation mat │ │ │ +0006e8e0: 7269 7820 6172 6f75 6e64 207a 2d61 7869 rix around z-axi │ │ │ +0006e8f0: 732e 0a0a 5468 6520 6675 6e63 7469 6f6e s...The function │ │ │ +0006e900: 2063 6f6d 7075 7465 7320 6120 5251 2064 computes a RQ d │ │ │ +0006e910: 6563 6f6d 706f 7369 7469 6f6e 2075 7369 ecomposition usi │ │ │ +0006e920: 6e67 2074 6865 2067 6976 656e 2072 6f74 ng the given rot │ │ │ +0006e930: 6174 696f 6e73 2e20 5468 6973 2066 756e ations. This fun │ │ │ +0006e940: 6374 696f 6e20 6973 2075 7365 6420 696e ction is used in │ │ │ +0006e950: 0a23 6465 636f 6d70 6f73 6550 726f 6a65 .#decomposeProje │ │ │ +0006e960: 6374 696f 6e4d 6174 7269 7820 746f 2064 ctionMatrix to d │ │ │ +0006e970: 6563 6f6d 706f 7365 2074 6865 206c 6566 ecompose the lef │ │ │ +0006e980: 7420 3378 3320 7375 626d 6174 7269 7820 t 3x3 submatrix │ │ │ +0006e990: 6f66 2061 2070 726f 6a65 6374 696f 6e20 of a projection │ │ │ +0006e9a0: 6d61 7472 6978 2069 6e74 6f20 6120 6361 matrix into a ca │ │ │ +0006e9b0: 6d65 7261 0a61 6e64 2061 2072 6f74 6174 mera.and a rotat │ │ │ +0006e9c0: 696f 6e20 6d61 7472 6978 2e0a 0a49 7420 ion matrix...It │ │ │ +0006e9d0: 6f70 7469 6f6e 616c 6c79 2072 6574 7572 optionally retur │ │ │ +0006e9e0: 6e73 2074 6872 6565 2072 6f74 6174 696f ns three rotatio │ │ │ +0006e9f0: 6e20 6d61 7472 6963 6573 2c20 6f6e 6520 n matrices, one │ │ │ +0006ea00: 666f 7220 6561 6368 2061 7869 732c 2061 for each axis, a │ │ │ +0006ea10: 6e64 2074 6865 2074 6872 6565 2045 756c nd the three Eul │ │ │ +0006ea20: 6572 2061 6e67 6c65 7320 696e 0a64 6567 er angles in.deg │ │ │ +0006ea30: 7265 6573 2028 6173 2074 6865 2072 6574 rees (as the ret │ │ │ +0006ea40: 7572 6e20 7661 6c75 6529 2074 6861 7420 urn value) that │ │ │ +0006ea50: 636f 756c 6420 6265 2075 7365 6420 696e could be used in │ │ │ +0006ea60: 204f 7065 6e47 4c2e 204e 6f74 652c 2074 OpenGL. Note, t │ │ │ +0006ea70: 6865 7265 2069 7320 616c 7761 7973 206d here is always m │ │ │ +0006ea80: 6f72 6520 7468 616e 206f 6e65 0a73 6571 ore than one.seq │ │ │ +0006ea90: 7565 6e63 6520 6f66 2072 6f74 6174 696f uence of rotatio │ │ │ +0006eaa0: 6e73 2061 626f 7574 2074 6865 2074 6872 ns about the thr │ │ │ +0006eab0: 6565 2070 7269 6e63 6970 616c 2061 7865 ee principal axe │ │ │ +0006eac0: 7320 7468 6174 2072 6573 756c 7473 2069 s that results i │ │ │ +0006ead0: 6e20 7468 6520 7361 6d65 206f 7269 656e n the same orien │ │ │ +0006eae0: 7461 7469 6f6e 206f 6620 616e 0a6f 626a tation of an.obj │ │ │ +0006eaf0: 6563 742c 2065 2e67 2e20 7365 6520 4349 ect, e.g. see CI │ │ │ +0006eb00: 5445 3a20 536c 6162 6175 6768 202e 2052 TE: Slabaugh . R │ │ │ +0006eb10: 6574 7572 6e65 6420 7468 7265 6520 726f eturned three ro │ │ │ +0006eb20: 7461 7469 6f6e 206d 6174 7269 6365 7320 tation matrices │ │ │ +0006eb30: 616e 6420 636f 7272 6573 706f 6e64 696e and correspondin │ │ │ +0006eb40: 6720 7468 7265 6520 4575 6c65 7220 616e g three Euler an │ │ │ +0006eb50: 676c 6573 0a61 7265 206f 6e6c 7920 6f6e gles.are only on │ │ │ +0006eb60: 6520 6f66 2074 6865 2070 6f73 7369 626c e of the possibl │ │ │ +0006eb70: 6520 736f 6c75 7469 6f6e 732e 3c2f 6464 e solutions.
    .
    Returns:.
    automati │ │ │ +0006eba0: 6361 6c6c 7920 6765 6e65 7261 7465 643c cally generated< │ │ │ +0006ebb0: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    ...
  • .
    .

    RQDec │ │ │ +0006ec70: 6f6d 7033 7833 3c2f 6833 3e0a 3c64 6976 omp3x3

    .
    .
    public static< │ │ │ +0006ece0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> double[] RQDecomp3x │ │ │ +0006ed40: 333c 2f73 7061 6e3e 3c77 6272 3e3c 7370 3(Mat  │ │ │ +0006edb0: 7372 632c 0a20 3c61 2068 7265 663d 222e src,. Mat m │ │ │ +0006ee00: 7478 522c 0a20 3c61 2068 7265 663d 222e txR,. Mat m │ │ │ +0006ee50: 7478 512c 0a20 3c61 2068 7265 663d 222e txQ,. Mat Q │ │ │ +0006eea0: 782c 0a20 3c61 2068 7265 663d 222e 2e2f x,. │ │ │ +0006eee0: 4d61 743c 2f61 3e26 6e62 7370 3b51 7929 Mat Qy) │ │ │ +0006eef0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Computes an RQ │ │ │ +0006ef20: 6465 636f 6d70 6f73 6974 696f 6e20 6f66 decomposition of │ │ │ +0006ef30: 2033 7833 206d 6174 7269 6365 732e 3c2f 3x3 matrices..
    .
    Para │ │ │ +0006ef60: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    src - 3x3 input ma │ │ │ +0006ef90: 7472 6978 2e3c 2f64 643e 0a3c 6464 3e3c trix.
    .
    < │ │ │ +0006efa0: 636f 6465 3e6d 7478 523c 2f63 6f64 653e code>mtxR │ │ │ +0006efb0: 202d 204f 7574 7075 7420 3378 3320 7570 - Output 3x3 up │ │ │ +0006efc0: 7065 722d 7472 6961 6e67 756c 6172 206d per-triangular m │ │ │ +0006efd0: 6174 7269 782e 3c2f 6464 3e0a 3c64 643e atrix.
    .
    │ │ │ +0006efe0: 3c63 6f64 653e 6d74 7851 3c2f 636f 6465 mtxQ - Output 3x3 o │ │ │ +0006f000: 7274 686f 676f 6e61 6c20 6d61 7472 6978 rthogonal matrix │ │ │ +0006f010: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    Qx - Opt │ │ │ +0006f030: 696f 6e61 6c20 6f75 7470 7574 2033 7833 ional output 3x3 │ │ │ +0006f040: 2072 6f74 6174 696f 6e20 6d61 7472 6978 rotation matrix │ │ │ +0006f050: 2061 726f 756e 6420 782d 6178 6973 2e3c around x-axis.< │ │ │ +0006f060: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e51 /dd>.
    Q │ │ │ +0006f070: 793c 2f63 6f64 653e 202d 204f 7074 696f y - Optio │ │ │ +0006f080: 6e61 6c20 6f75 7470 7574 2033 7833 2072 nal output 3x3 r │ │ │ +0006f090: 6f74 6174 696f 6e20 6d61 7472 6978 2061 otation matrix a │ │ │ +0006f0a0: 726f 756e 6420 792d 6178 6973 2e0a 0a54 round y-axis...T │ │ │ +0006f0b0: 6865 2066 756e 6374 696f 6e20 636f 6d70 he function comp │ │ │ +0006f0c0: 7574 6573 2061 2052 5120 6465 636f 6d70 utes a RQ decomp │ │ │ +0006f0d0: 6f73 6974 696f 6e20 7573 696e 6720 7468 osition using th │ │ │ +0006f0e0: 6520 6769 7665 6e20 726f 7461 7469 6f6e e given rotation │ │ │ +0006f0f0: 732e 2054 6869 7320 6675 6e63 7469 6f6e s. This function │ │ │ +0006f100: 2069 7320 7573 6564 2069 6e0a 2364 6563 is used in.#dec │ │ │ +0006f110: 6f6d 706f 7365 5072 6f6a 6563 7469 6f6e omposeProjection │ │ │ +0006f120: 4d61 7472 6978 2074 6f20 6465 636f 6d70 Matrix to decomp │ │ │ +0006f130: 6f73 6520 7468 6520 6c65 6674 2033 7833 ose the left 3x3 │ │ │ +0006f140: 2073 7562 6d61 7472 6978 206f 6620 6120 submatrix of a │ │ │ +0006f150: 7072 6f6a 6563 7469 6f6e 206d 6174 7269 projection matri │ │ │ +0006f160: 7820 696e 746f 2061 2063 616d 6572 610a x into a camera. │ │ │ +0006f170: 616e 6420 6120 726f 7461 7469 6f6e 206d and a rotation m │ │ │ +0006f180: 6174 7269 782e 0a0a 4974 206f 7074 696f atrix...It optio │ │ │ +0006f190: 6e61 6c6c 7920 7265 7475 726e 7320 7468 nally returns th │ │ │ +0006f1a0: 7265 6520 726f 7461 7469 6f6e 206d 6174 ree rotation mat │ │ │ +0006f1b0: 7269 6365 732c 206f 6e65 2066 6f72 2065 rices, one for e │ │ │ +0006f1c0: 6163 6820 6178 6973 2c20 616e 6420 7468 ach axis, and th │ │ │ +0006f1d0: 6520 7468 7265 6520 4575 6c65 7220 616e e three Euler an │ │ │ +0006f1e0: 676c 6573 2069 6e0a 6465 6772 6565 7320 gles in.degrees │ │ │ +0006f1f0: 2861 7320 7468 6520 7265 7475 726e 2076 (as the return v │ │ │ +0006f200: 616c 7565 2920 7468 6174 2063 6f75 6c64 alue) that could │ │ │ +0006f210: 2062 6520 7573 6564 2069 6e20 4f70 656e be used in Open │ │ │ +0006f220: 474c 2e20 4e6f 7465 2c20 7468 6572 6520 GL. Note, there │ │ │ +0006f230: 6973 2061 6c77 6179 7320 6d6f 7265 2074 is always more t │ │ │ +0006f240: 6861 6e20 6f6e 650a 7365 7175 656e 6365 han one.sequence │ │ │ +0006f250: 206f 6620 726f 7461 7469 6f6e 7320 6162 of rotations ab │ │ │ +0006f260: 6f75 7420 7468 6520 7468 7265 6520 7072 out the three pr │ │ │ +0006f270: 696e 6369 7061 6c20 6178 6573 2074 6861 incipal axes tha │ │ │ +0006f280: 7420 7265 7375 6c74 7320 696e 2074 6865 t results in the │ │ │ +0006f290: 2073 616d 6520 6f72 6965 6e74 6174 696f same orientatio │ │ │ +0006f2a0: 6e20 6f66 2061 6e0a 6f62 6a65 6374 2c20 n of an.object, │ │ │ +0006f2b0: 652e 672e 2073 6565 2043 4954 453a 2053 e.g. see CITE: S │ │ │ +0006f2c0: 6c61 6261 7567 6820 2e20 5265 7475 726e labaugh . Return │ │ │ +0006f2d0: 6564 2074 6872 6565 2072 6f74 6174 696f ed three rotatio │ │ │ +0006f2e0: 6e20 6d61 7472 6963 6573 2061 6e64 2063 n matrices and c │ │ │ +0006f2f0: 6f72 7265 7370 6f6e 6469 6e67 2074 6872 orresponding thr │ │ │ +0006f300: 6565 2045 756c 6572 2061 6e67 6c65 730a ee Euler angles. │ │ │ +0006f310: 6172 6520 6f6e 6c79 206f 6e65 206f 6620 are only one of │ │ │ +0006f320: 7468 6520 706f 7373 6962 6c65 2073 6f6c the possible sol │ │ │ +0006f330: 7574 696f 6e73 2e3c 2f64 643e 0a3c 6474 utions.
    .
    Returns:
    .< │ │ │ +0006f350: 6464 3e61 7574 6f6d 6174 6963 616c 6c79 dd>automatically │ │ │ +0006f360: 2067 656e 6572 6174 6564 3c2f 6464 3e0a generated. │ │ │ +0006f370: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    .
    .
  • ..
    .RQDecomp3x3.
    .
    public │ │ │ +0006f480: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +0006f490: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;dou │ │ │ +0006f4b0: 626c 655b 5d3c 2f73 7061 6e3e 266e 6273 ble[]&nbs │ │ │ +0006f4c0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;RQD │ │ │ +0006f4e0: 6563 6f6d 7033 7833 3c2f 7370 616e 3e3c ecomp3x3< │ │ │ +0006f4f0: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat src,. Mat │ │ │ +0006f5a0: 266e 6273 703b 6d74 7852 2c0a 203c 6120  mtxR,. Mat │ │ │ +0006f5f0: 266e 6273 703b 6d74 7851 2c0a 203c 6120  mtxQ,. Mat │ │ │ +0006f640: 266e 6273 703b 5178 293c 2f73 7061 6e3e  Qx) │ │ │ +0006f650: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Comput │ │ │ +0006f670: 6573 2061 6e20 5251 2064 6563 6f6d 706f es an RQ decompo │ │ │ +0006f680: 7369 7469 6f6e 206f 6620 3378 3320 6d61 sition of 3x3 ma │ │ │ +0006f690: 7472 6963 6573 2e3c 2f64 6976 3e0a 3c64 trices.
    . │ │ │ +0006f6b0: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +0006f6c0: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +0006f6d0: 7372 633c 2f63 6f64 653e 202d 2033 7833 src - 3x3 │ │ │ +0006f6e0: 2069 6e70 7574 206d 6174 7269 782e 3c2f input matrix..
    mt │ │ │ +0006f700: 7852 3c2f 636f 6465 3e20 2d20 4f75 7470 xR - Outp │ │ │ +0006f710: 7574 2033 7833 2075 7070 6572 2d74 7269 ut 3x3 upper-tri │ │ │ +0006f720: 616e 6775 6c61 7220 6d61 7472 6978 2e3c angular matrix.< │ │ │ +0006f730: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e6d /dd>.
    m │ │ │ +0006f740: 7478 513c 2f63 6f64 653e 202d 204f 7574 txQ - Out │ │ │ +0006f750: 7075 7420 3378 3320 6f72 7468 6f67 6f6e put 3x3 orthogon │ │ │ +0006f760: 616c 206d 6174 7269 782e 3c2f 6464 3e0a al matrix.
    . │ │ │ +0006f770: 3c64 643e 3c63 6f64 653e 5178 3c2f 636f
    Qx - Optional o │ │ │ +0006f790: 7574 7075 7420 3378 3320 726f 7461 7469 utput 3x3 rotati │ │ │ +0006f7a0: 6f6e 206d 6174 7269 7820 6172 6f75 6e64 on matrix around │ │ │ +0006f7b0: 2078 2d61 7869 732e 0a0a 5468 6520 6675 x-axis...The fu │ │ │ +0006f7c0: 6e63 7469 6f6e 2063 6f6d 7075 7465 7320 nction computes │ │ │ +0006f7d0: 6120 5251 2064 6563 6f6d 706f 7369 7469 a RQ decompositi │ │ │ +0006f7e0: 6f6e 2075 7369 6e67 2074 6865 2067 6976 on using the giv │ │ │ +0006f7f0: 656e 2072 6f74 6174 696f 6e73 2e20 5468 en rotations. Th │ │ │ +0006f800: 6973 2066 756e 6374 696f 6e20 6973 2075 is function is u │ │ │ +0006f810: 7365 6420 696e 0a23 6465 636f 6d70 6f73 sed in.#decompos │ │ │ +0006f820: 6550 726f 6a65 6374 696f 6e4d 6174 7269 eProjectionMatri │ │ │ +0006f830: 7820 746f 2064 6563 6f6d 706f 7365 2074 x to decompose t │ │ │ +0006f840: 6865 206c 6566 7420 3378 3320 7375 626d he left 3x3 subm │ │ │ +0006f850: 6174 7269 7820 6f66 2061 2070 726f 6a65 atrix of a proje │ │ │ +0006f860: 6374 696f 6e20 6d61 7472 6978 2069 6e74 ction matrix int │ │ │ +0006f870: 6f20 6120 6361 6d65 7261 0a61 6e64 2061 o a camera.and a │ │ │ +0006f880: 2072 6f74 6174 696f 6e20 6d61 7472 6978 rotation matrix │ │ │ +0006f890: 2e0a 0a49 7420 6f70 7469 6f6e 616c 6c79 ...It optionally │ │ │ +0006f8a0: 2072 6574 7572 6e73 2074 6872 6565 2072 returns three r │ │ │ +0006f8b0: 6f74 6174 696f 6e20 6d61 7472 6963 6573 otation matrices │ │ │ +0006f8c0: 2c20 6f6e 6520 666f 7220 6561 6368 2061 , one for each a │ │ │ +0006f8d0: 7869 732c 2061 6e64 2074 6865 2074 6872 xis, and the thr │ │ │ +0006f8e0: 6565 2045 756c 6572 2061 6e67 6c65 7320 ee Euler angles │ │ │ +0006f8f0: 696e 0a64 6567 7265 6573 2028 6173 2074 in.degrees (as t │ │ │ +0006f900: 6865 2072 6574 7572 6e20 7661 6c75 6529 he return value) │ │ │ +0006f910: 2074 6861 7420 636f 756c 6420 6265 2075 that could be u │ │ │ +0006f920: 7365 6420 696e 204f 7065 6e47 4c2e 204e sed in OpenGL. N │ │ │ +0006f930: 6f74 652c 2074 6865 7265 2069 7320 616c ote, there is al │ │ │ +0006f940: 7761 7973 206d 6f72 6520 7468 616e 206f ways more than o │ │ │ +0006f950: 6e65 0a73 6571 7565 6e63 6520 6f66 2072 ne.sequence of r │ │ │ +0006f960: 6f74 6174 696f 6e73 2061 626f 7574 2074 otations about t │ │ │ +0006f970: 6865 2074 6872 6565 2070 7269 6e63 6970 he three princip │ │ │ +0006f980: 616c 2061 7865 7320 7468 6174 2072 6573 al axes that res │ │ │ +0006f990: 756c 7473 2069 6e20 7468 6520 7361 6d65 ults in the same │ │ │ +0006f9a0: 206f 7269 656e 7461 7469 6f6e 206f 6620 orientation of │ │ │ +0006f9b0: 616e 0a6f 626a 6563 742c 2065 2e67 2e20 an.object, e.g. │ │ │ +0006f9c0: 7365 6520 4349 5445 3a20 536c 6162 6175 see CITE: Slabau │ │ │ +0006f9d0: 6768 202e 2052 6574 7572 6e65 6420 7468 gh . Returned th │ │ │ +0006f9e0: 7265 6520 726f 7461 7469 6f6e 206d 6174 ree rotation mat │ │ │ +0006f9f0: 7269 6365 7320 616e 6420 636f 7272 6573 rices and corres │ │ │ +0006fa00: 706f 6e64 696e 6720 7468 7265 6520 4575 ponding three Eu │ │ │ +0006fa10: 6c65 7220 616e 676c 6573 0a61 7265 206f ler angles.are o │ │ │ +0006fa20: 6e6c 7920 6f6e 6520 6f66 2074 6865 2070 nly one of the p │ │ │ +0006fa30: 6f73 7369 626c 6520 736f 6c75 7469 6f6e ossible solution │ │ │ +0006fa40: 732e 3c2f 6464 3e0a 3c64 743e 5265 7475 s.
    .
    Retu │ │ │ +0006fa50: 726e 733a 3c2f 6474 3e0a 3c64 643e 6175 rns:
    .
    au │ │ │ +0006fa60: 746f 6d61 7469 6361 6c6c 7920 6765 6e65 tomatically gene │ │ │ +0006fa70: 7261 7465 643c 2f64 643e 0a3c 2f64 6c3e rated
    . │ │ │ +0006fa80: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..

  • .
  • ..

    RQDecom │ │ │ +0006fb10: 7033 7833 3c2f 6833 3e0a 3c64 6976 2063 p3x3

    .
    .
    │ │ │ +0006fb70: 7075 626c 6963 2073 7461 7469 633c 2f73 public static double[] RQDecomp3x3< │ │ │ +0006fbe0: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat sr │ │ │ +0006fc50: 632c 0a20 3c61 2068 7265 663d 222e 2e2f c,. │ │ │ +0006fc90: 4d61 743c 2f61 3e26 6e62 7370 3b6d 7478 Mat mtx │ │ │ +0006fca0: 522c 0a20 3c61 2068 7265 663d 222e 2e2f R,. │ │ │ +0006fce0: 4d61 743c 2f61 3e26 6e62 7370 3b6d 7478 Mat mtx │ │ │ +0006fcf0: 5129 3c2f 7370 616e 3e3c 2f64 6976 3e0a Q)
    . │ │ │ +0006fd00: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Computes an R │ │ │ +0006fd20: 5120 6465 636f 6d70 6f73 6974 696f 6e20 Q decomposition │ │ │ +0006fd30: 6f66 2033 7833 206d 6174 7269 6365 732e of 3x3 matrices. │ │ │ +0006fd40: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ +0006fd60: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ +0006fd70: 6464 3e3c 636f 6465 3e73 7263 3c2f 636f dd>src - 3x3 input │ │ │ +0006fd90: 6d61 7472 6978 2e3c 2f64 643e 0a3c 6464 matrix..
    mtxR - Output 3x3 │ │ │ +0006fdc0: 7570 7065 722d 7472 6961 6e67 756c 6172 upper-triangular │ │ │ +0006fdd0: 206d 6174 7269 782e 3c2f 6464 3e0a 3c64 matrix.
    .mtxQ - Output 3x3 │ │ │ +0006fe00: 206f 7274 686f 676f 6e61 6c20 6d61 7472 orthogonal matr │ │ │ +0006fe10: 6978 2e0a 0a54 6865 2066 756e 6374 696f ix...The functio │ │ │ +0006fe20: 6e20 636f 6d70 7574 6573 2061 2052 5120 n computes a RQ │ │ │ +0006fe30: 6465 636f 6d70 6f73 6974 696f 6e20 7573 decomposition us │ │ │ +0006fe40: 696e 6720 7468 6520 6769 7665 6e20 726f ing the given ro │ │ │ +0006fe50: 7461 7469 6f6e 732e 2054 6869 7320 6675 tations. This fu │ │ │ +0006fe60: 6e63 7469 6f6e 2069 7320 7573 6564 2069 nction is used i │ │ │ +0006fe70: 6e0a 2364 6563 6f6d 706f 7365 5072 6f6a n.#decomposeProj │ │ │ +0006fe80: 6563 7469 6f6e 4d61 7472 6978 2074 6f20 ectionMatrix to │ │ │ +0006fe90: 6465 636f 6d70 6f73 6520 7468 6520 6c65 decompose the le │ │ │ +0006fea0: 6674 2033 7833 2073 7562 6d61 7472 6978 ft 3x3 submatrix │ │ │ +0006feb0: 206f 6620 6120 7072 6f6a 6563 7469 6f6e of a projection │ │ │ +0006fec0: 206d 6174 7269 7820 696e 746f 2061 2063 matrix into a c │ │ │ +0006fed0: 616d 6572 610a 616e 6420 6120 726f 7461 amera.and a rota │ │ │ +0006fee0: 7469 6f6e 206d 6174 7269 782e 0a0a 4974 tion matrix...It │ │ │ +0006fef0: 206f 7074 696f 6e61 6c6c 7920 7265 7475 optionally retu │ │ │ +0006ff00: 726e 7320 7468 7265 6520 726f 7461 7469 rns three rotati │ │ │ +0006ff10: 6f6e 206d 6174 7269 6365 732c 206f 6e65 on matrices, one │ │ │ +0006ff20: 2066 6f72 2065 6163 6820 6178 6973 2c20 for each axis, │ │ │ +0006ff30: 616e 6420 7468 6520 7468 7265 6520 4575 and the three Eu │ │ │ +0006ff40: 6c65 7220 616e 676c 6573 2069 6e0a 6465 ler angles in.de │ │ │ +0006ff50: 6772 6565 7320 2861 7320 7468 6520 7265 grees (as the re │ │ │ +0006ff60: 7475 726e 2076 616c 7565 2920 7468 6174 turn value) that │ │ │ +0006ff70: 2063 6f75 6c64 2062 6520 7573 6564 2069 could be used i │ │ │ +0006ff80: 6e20 4f70 656e 474c 2e20 4e6f 7465 2c20 n OpenGL. Note, │ │ │ +0006ff90: 7468 6572 6520 6973 2061 6c77 6179 7320 there is always │ │ │ +0006ffa0: 6d6f 7265 2074 6861 6e20 6f6e 650a 7365 more than one.se │ │ │ +0006ffb0: 7175 656e 6365 206f 6620 726f 7461 7469 quence of rotati │ │ │ +0006ffc0: 6f6e 7320 6162 6f75 7420 7468 6520 7468 ons about the th │ │ │ +0006ffd0: 7265 6520 7072 696e 6369 7061 6c20 6178 ree principal ax │ │ │ +0006ffe0: 6573 2074 6861 7420 7265 7375 6c74 7320 es that results │ │ │ +0006fff0: 696e 2074 6865 2073 616d 6520 6f72 6965 in the same orie │ │ │ +00070000: 6e74 6174 696f 6e20 6f66 2061 6e0a 6f62 ntation of an.ob │ │ │ +00070010: 6a65 6374 2c20 652e 672e 2073 6565 2043 ject, e.g. see C │ │ │ +00070020: 4954 453a 2053 6c61 6261 7567 6820 2e20 ITE: Slabaugh . │ │ │ +00070030: 5265 7475 726e 6564 2074 6872 6565 2072 Returned three r │ │ │ +00070040: 6f74 6174 696f 6e20 6d61 7472 6963 6573 otation matrices │ │ │ +00070050: 2061 6e64 2063 6f72 7265 7370 6f6e 6469 and correspondi │ │ │ +00070060: 6e67 2074 6872 6565 2045 756c 6572 2061 ng three Euler a │ │ │ +00070070: 6e67 6c65 730a 6172 6520 6f6e 6c79 206f ngles.are only o │ │ │ +00070080: 6e65 206f 6620 7468 6520 706f 7373 6962 ne of the possib │ │ │ +00070090: 6c65 2073 6f6c 7574 696f 6e73 2e3c 2f64 le solutions..
    Returns:< │ │ │ +000700b0: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
    automat │ │ │ +000700c0: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ +000700d0: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ....
  • ..

    decomposeP │ │ │ +000701e0: 726f 6a65 6374 696f 6e4d 6174 7269 783c rojectionMatrix< │ │ │ +000701f0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +00070250: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +00070260: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;v │ │ │ +00070280: 6f69 643c 2f73 7061 6e3e 266e 6273 703b oid  │ │ │ +00070290: 3c73 7061 6e20 636c 6173 733d 2265 6c65 decom │ │ │ +000702b0: 706f 7365 5072 6f6a 6563 7469 6f6e 4d61 poseProjectionMa │ │ │ +000702c0: 7472 6978 3c2f 7370 616e 3e3c 7762 723e trix │ │ │ +000702d0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +00070330: 7370 3b70 726f 6a4d 6174 7269 782c 0a20 sp;projMatrix,. │ │ │ +00070340: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +00070380: 2f61 3e26 6e62 7370 3b63 616d 6572 614d /a> cameraM │ │ │ +00070390: 6174 7269 782c 0a20 3c61 2068 7265 663d atrix,. Mat  │ │ │ +000703e0: 3b72 6f74 4d61 7472 6978 2c0a 203c 6120 ;rotMatrix,. Mat │ │ │ +00070430: 266e 6273 703b 7472 616e 7356 6563 742c  transVect, │ │ │ +00070440: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +00070480: 743c 2f61 3e26 6e62 7370 3b72 6f74 4d61 t rotMa │ │ │ +00070490: 7472 6978 582c 0a20 3c61 2068 7265 663d trixX,. Mat  │ │ │ +000704e0: 3b72 6f74 4d61 7472 6978 592c 0a20 3c61 ;rotMatrixY,. Mat rotMatrix │ │ │ +00070540: 5a2c 0a20 3c61 2068 7265 663d 222e 2e2f Z,. │ │ │ +00070580: 4d61 743c 2f61 3e26 6e62 7370 3b65 756c Mat eul │ │ │ +00070590: 6572 416e 676c 6573 293c 2f73 7061 6e3e erAngles) │ │ │ +000705a0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Decomp │ │ │ +000705c0: 6f73 6573 2061 2070 726f 6a65 6374 696f oses a projectio │ │ │ +000705d0: 6e20 6d61 7472 6978 2069 6e74 6f20 6120 n matrix into a │ │ │ +000705e0: 726f 7461 7469 6f6e 206d 6174 7269 7820 rotation matrix │ │ │ +000705f0: 616e 6420 6120 6361 6d65 7261 2069 6e74 and a camera int │ │ │ +00070600: 7269 6e73 6963 206d 6174 7269 782e 3c2f rinsic matrix..
    .
    Para │ │ │ +00070630: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    projMatri │ │ │ +00070650: 783c 2f63 6f64 653e 202d 2033 7834 2069 x - 3x4 i │ │ │ +00070660: 6e70 7574 2070 726f 6a65 6374 696f 6e20 nput projection │ │ │ +00070670: 6d61 7472 6978 2050 2e3c 2f64 643e 0a3c matrix P.
    .< │ │ │ +00070680: 6464 3e3c 636f 6465 3e63 616d 6572 614d dd>cameraM │ │ │ +00070690: 6174 7269 783c 2f63 6f64 653e 202d 204f atrix - O │ │ │ +000706a0: 7574 7075 7420 3378 3320 6361 6d65 7261 utput 3x3 camera │ │ │ +000706b0: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ +000706c0: 7820 5c28 5c63 616d 6572 616d 6174 7269 x \(\cameramatri │ │ │ +000706d0: 787b 417d 5c29 2e3c 2f64 643e 0a3c 6464 x{A}\)..
    rotMatrix │ │ │ +000706f0: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +00070700: 2033 7833 2065 7874 6572 6e61 6c20 726f 3x3 external ro │ │ │ +00070710: 7461 7469 6f6e 206d 6174 7269 7820 522e tation matrix R. │ │ │ +00070720: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +00070730: 7472 616e 7356 6563 743c 2f63 6f64 653e transVect │ │ │ +00070740: 202d 204f 7574 7075 7420 3478 3120 7472 - Output 4x1 tr │ │ │ +00070750: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ +00070760: 2054 2e3c 2f64 643e 0a3c 6464 3e3c 636f T.
    .
    rotMatrixX - Optional │ │ │ +00070790: 3378 3320 726f 7461 7469 6f6e 206d 6174 3x3 rotation mat │ │ │ +000707a0: 7269 7820 6172 6f75 6e64 2078 2d61 7869 rix around x-axi │ │ │ +000707b0: 732e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 s.
    .
    rotMatrixY - Optional 3 │ │ │ +000707e0: 7833 2072 6f74 6174 696f 6e20 6d61 7472 x3 rotation matr │ │ │ +000707f0: 6978 2061 726f 756e 6420 792d 6178 6973 ix around y-axis │ │ │ +00070800: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    rotMatrixZ - Optional 3x │ │ │ +00070830: 3320 726f 7461 7469 6f6e 206d 6174 7269 3 rotation matri │ │ │ +00070840: 7820 6172 6f75 6e64 207a 2d61 7869 732e x around z-axis. │ │ │ +00070850: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +00070860: 6575 6c65 7241 6e67 6c65 733c 2f63 6f64 eulerAngles - Optional th │ │ │ +00070880: 7265 652d 656c 656d 656e 7420 7665 6374 ree-element vect │ │ │ +00070890: 6f72 2063 6f6e 7461 696e 696e 6720 7468 or containing th │ │ │ +000708a0: 7265 6520 4575 6c65 7220 616e 676c 6573 ree Euler angles │ │ │ +000708b0: 206f 6620 726f 7461 7469 6f6e 2069 6e0a of rotation in. │ │ │ +000708c0: 6465 6772 6565 732e 0a0a 5468 6520 6675 degrees...The fu │ │ │ +000708d0: 6e63 7469 6f6e 2063 6f6d 7075 7465 7320 nction computes │ │ │ +000708e0: 6120 6465 636f 6d70 6f73 6974 696f 6e20 a decomposition │ │ │ +000708f0: 6f66 2061 2070 726f 6a65 6374 696f 6e20 of a projection │ │ │ +00070900: 6d61 7472 6978 2069 6e74 6f20 6120 6361 matrix into a ca │ │ │ +00070910: 6c69 6272 6174 696f 6e20 616e 6420 6120 libration and a │ │ │ +00070920: 726f 7461 7469 6f6e 0a6d 6174 7269 7820 rotation.matrix │ │ │ +00070930: 616e 6420 7468 6520 706f 7369 7469 6f6e and the position │ │ │ +00070940: 206f 6620 6120 6361 6d65 7261 2e0a 0a49 of a camera...I │ │ │ +00070950: 7420 6f70 7469 6f6e 616c 6c79 2072 6574 t optionally ret │ │ │ +00070960: 7572 6e73 2074 6872 6565 2072 6f74 6174 urns three rotat │ │ │ +00070970: 696f 6e20 6d61 7472 6963 6573 2c20 6f6e ion matrices, on │ │ │ +00070980: 6520 666f 7220 6561 6368 2061 7869 732c e for each axis, │ │ │ +00070990: 2061 6e64 2074 6872 6565 2045 756c 6572 and three Euler │ │ │ +000709a0: 2061 6e67 6c65 7320 7468 6174 2063 6f75 angles that cou │ │ │ +000709b0: 6c64 0a62 6520 7573 6564 2069 6e20 4f70 ld.be used in Op │ │ │ +000709c0: 656e 474c 2e20 4e6f 7465 2c20 7468 6572 enGL. Note, ther │ │ │ +000709d0: 6520 6973 2061 6c77 6179 7320 6d6f 7265 e is always more │ │ │ +000709e0: 2074 6861 6e20 6f6e 6520 7365 7175 656e than one sequen │ │ │ +000709f0: 6365 206f 6620 726f 7461 7469 6f6e 7320 ce of rotations │ │ │ +00070a00: 6162 6f75 7420 7468 6520 7468 7265 650a about the three. │ │ │ +00070a10: 7072 696e 6369 7061 6c20 6178 6573 2074 principal axes t │ │ │ +00070a20: 6861 7420 7265 7375 6c74 7320 696e 2074 hat results in t │ │ │ +00070a30: 6865 2073 616d 6520 6f72 6965 6e74 6174 he same orientat │ │ │ +00070a40: 696f 6e20 6f66 2061 6e20 6f62 6a65 6374 ion of an object │ │ │ +00070a50: 2c20 652e 672e 2073 6565 2043 4954 453a , e.g. see CITE: │ │ │ +00070a60: 2053 6c61 6261 7567 6820 2e20 5265 7475 Slabaugh . Retu │ │ │ +00070a70: 726e 6564 0a74 6872 6565 2072 6f74 6174 rned.three rotat │ │ │ +00070a80: 696f 6e20 6d61 7472 6963 6573 2061 6e64 ion matrices and │ │ │ +00070a90: 2063 6f72 7265 7370 6f6e 6469 6e67 2074 corresponding t │ │ │ +00070aa0: 6872 6565 2045 756c 6572 2061 6e67 6c65 hree Euler angle │ │ │ +00070ab0: 7320 6172 6520 6f6e 6c79 206f 6e65 206f s are only one o │ │ │ +00070ac0: 6620 7468 6520 706f 7373 6962 6c65 2073 f the possible s │ │ │ +00070ad0: 6f6c 7574 696f 6e73 2e0a 0a54 6865 2066 olutions...The f │ │ │ +00070ae0: 756e 6374 696f 6e20 6973 2062 6173 6564 unction is based │ │ │ +00070af0: 206f 6e20 2352 5144 6563 6f6d 7033 7833 on #RQDecomp3x3 │ │ │ +00070b00: 202e 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f .
    .
    ... │ │ │ +00070b20: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374

  • .
  • .. │ │ │ +00070bf0: 3c68 333e 6465 636f 6d70 6f73 6550 726f

    decomposePro │ │ │ +00070c00: 6a65 6374 696f 6e4d 6174 7269 783c 2f68 jectionMatrix.
    .
    public │ │ │ +00070c70: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +00070c80: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;voi │ │ │ +00070ca0: 643c 2f73 7061 6e3e 266e 6273 703b 3c73 d decompo │ │ │ +00070cd0: 7365 5072 6f6a 6563 7469 6f6e 4d61 7472 seProjectionMatr │ │ │ +00070ce0: 6978 3c2f 7370 616e 3e3c 7762 723e 3c73 ix(Mat  │ │ │ +00070d50: 3b70 726f 6a4d 6174 7269 782c 0a20 3c61 ;projMatrix,. Mat cameraMat │ │ │ +00070db0: 7269 782c 0a20 3c61 2068 7265 663d 222e rix,. Mat r │ │ │ +00070e00: 6f74 4d61 7472 6978 2c0a 203c 6120 6872 otMatrix,. Mat&n │ │ │ +00070e50: 6273 703b 7472 616e 7356 6563 742c 0a20 bsp;transVect,. │ │ │ +00070e60: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +00070ea0: 2f61 3e26 6e62 7370 3b72 6f74 4d61 7472 /a> rotMatr │ │ │ +00070eb0: 6978 582c 0a20 3c61 2068 7265 663d 222e ixX,. Mat r │ │ │ +00070f00: 6f74 4d61 7472 6978 592c 0a20 3c61 2068 otMatrixY,. Mat& │ │ │ +00070f50: 6e62 7370 3b72 6f74 4d61 7472 6978 5a29 nbsp;rotMatrixZ) │ │ │ +00070f60: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Decomposes a pr │ │ │ +00070f90: 6f6a 6563 7469 6f6e 206d 6174 7269 7820 ojection matrix │ │ │ +00070fa0: 696e 746f 2061 2072 6f74 6174 696f 6e20 into a rotation │ │ │ +00070fb0: 6d61 7472 6978 2061 6e64 2061 2063 616d matrix and a cam │ │ │ +00070fc0: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +00070fd0: 7472 6978 2e3c 2f64 6976 3e0a 3c64 6c20 trix.
    .
    .< │ │ │ +00070ff0: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    pr │ │ │ +00071010: 6f6a 4d61 7472 6978 3c2f 636f 6465 3e20 ojMatrix │ │ │ +00071020: 2d20 3378 3420 696e 7075 7420 7072 6f6a - 3x4 input proj │ │ │ +00071030: 6563 7469 6f6e 206d 6174 7269 7820 502e ection matrix P. │ │ │ +00071040: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +00071050: 6361 6d65 7261 4d61 7472 6978 3c2f 636f cameraMatrix - Output 3x3 │ │ │ +00071070: 2063 616d 6572 6120 696e 7472 696e 7369 camera intrinsi │ │ │ +00071080: 6320 6d61 7472 6978 205c 285c 6361 6d65 c matrix \(\came │ │ │ +00071090: 7261 6d61 7472 6978 7b41 7d5c 292e 3c2f ramatrix{A}\)..
    ro │ │ │ +000710b0: 744d 6174 7269 783c 2f63 6f64 653e 202d tMatrix - │ │ │ +000710c0: 204f 7574 7075 7420 3378 3320 6578 7465 Output 3x3 exte │ │ │ +000710d0: 726e 616c 2072 6f74 6174 696f 6e20 6d61 rnal rotation ma │ │ │ +000710e0: 7472 6978 2052 2e3c 2f64 643e 0a3c 6464 trix R.
    .
    transVect │ │ │ +00071100: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +00071110: 2034 7831 2074 7261 6e73 6c61 7469 6f6e 4x1 translation │ │ │ +00071120: 2076 6563 746f 7220 542e 3c2f 6464 3e0a vector T.
    . │ │ │ +00071130: 3c64 643e 3c63 6f64 653e 726f 744d 6174
    rotMat │ │ │ +00071140: 7269 7858 3c2f 636f 6465 3e20 2d20 4f70 rixX - Op │ │ │ +00071150: 7469 6f6e 616c 2033 7833 2072 6f74 6174 tional 3x3 rotat │ │ │ +00071160: 696f 6e20 6d61 7472 6978 2061 726f 756e ion matrix aroun │ │ │ +00071170: 6420 782d 6178 6973 2e3c 2f64 643e 0a3c d x-axis.
    .< │ │ │ +00071180: 6464 3e3c 636f 6465 3e72 6f74 4d61 7472 dd>rotMatr │ │ │ +00071190: 6978 593c 2f63 6f64 653e 202d 204f 7074 ixY - Opt │ │ │ +000711a0: 696f 6e61 6c20 3378 3320 726f 7461 7469 ional 3x3 rotati │ │ │ +000711b0: 6f6e 206d 6174 7269 7820 6172 6f75 6e64 on matrix around │ │ │ +000711c0: 2079 2d61 7869 732e 3c2f 6464 3e0a 3c64 y-axis..rotMatri │ │ │ +000711e0: 785a 3c2f 636f 6465 3e20 2d20 4f70 7469 xZ - Opti │ │ │ +000711f0: 6f6e 616c 2033 7833 2072 6f74 6174 696f onal 3x3 rotatio │ │ │ +00071200: 6e20 6d61 7472 6978 2061 726f 756e 6420 n matrix around │ │ │ +00071210: 7a2d 6178 6973 2e0a 6465 6772 6565 732e z-axis..degrees. │ │ │ +00071220: 0a0a 5468 6520 6675 6e63 7469 6f6e 2063 ..The function c │ │ │ +00071230: 6f6d 7075 7465 7320 6120 6465 636f 6d70 omputes a decomp │ │ │ +00071240: 6f73 6974 696f 6e20 6f66 2061 2070 726f osition of a pro │ │ │ +00071250: 6a65 6374 696f 6e20 6d61 7472 6978 2069 jection matrix i │ │ │ +00071260: 6e74 6f20 6120 6361 6c69 6272 6174 696f nto a calibratio │ │ │ +00071270: 6e20 616e 6420 6120 726f 7461 7469 6f6e n and a rotation │ │ │ +00071280: 0a6d 6174 7269 7820 616e 6420 7468 6520 .matrix and the │ │ │ +00071290: 706f 7369 7469 6f6e 206f 6620 6120 6361 position of a ca │ │ │ +000712a0: 6d65 7261 2e0a 0a49 7420 6f70 7469 6f6e mera...It option │ │ │ +000712b0: 616c 6c79 2072 6574 7572 6e73 2074 6872 ally returns thr │ │ │ +000712c0: 6565 2072 6f74 6174 696f 6e20 6d61 7472 ee rotation matr │ │ │ +000712d0: 6963 6573 2c20 6f6e 6520 666f 7220 6561 ices, one for ea │ │ │ +000712e0: 6368 2061 7869 732c 2061 6e64 2074 6872 ch axis, and thr │ │ │ +000712f0: 6565 2045 756c 6572 2061 6e67 6c65 7320 ee Euler angles │ │ │ +00071300: 7468 6174 2063 6f75 6c64 0a62 6520 7573 that could.be us │ │ │ +00071310: 6564 2069 6e20 4f70 656e 474c 2e20 4e6f ed in OpenGL. No │ │ │ +00071320: 7465 2c20 7468 6572 6520 6973 2061 6c77 te, there is alw │ │ │ +00071330: 6179 7320 6d6f 7265 2074 6861 6e20 6f6e ays more than on │ │ │ +00071340: 6520 7365 7175 656e 6365 206f 6620 726f e sequence of ro │ │ │ +00071350: 7461 7469 6f6e 7320 6162 6f75 7420 7468 tations about th │ │ │ +00071360: 6520 7468 7265 650a 7072 696e 6369 7061 e three.principa │ │ │ +00071370: 6c20 6178 6573 2074 6861 7420 7265 7375 l axes that resu │ │ │ +00071380: 6c74 7320 696e 2074 6865 2073 616d 6520 lts in the same │ │ │ +00071390: 6f72 6965 6e74 6174 696f 6e20 6f66 2061 orientation of a │ │ │ +000713a0: 6e20 6f62 6a65 6374 2c20 652e 672e 2073 n object, e.g. s │ │ │ +000713b0: 6565 2043 4954 453a 2053 6c61 6261 7567 ee CITE: Slabaug │ │ │ +000713c0: 6820 2e20 5265 7475 726e 6564 0a74 6872 h . Returned.thr │ │ │ +000713d0: 6565 2072 6f74 6174 696f 6e20 6d61 7472 ee rotation matr │ │ │ +000713e0: 6963 6573 2061 6e64 2063 6f72 7265 7370 ices and corresp │ │ │ +000713f0: 6f6e 6469 6e67 2074 6872 6565 2045 756c onding three Eul │ │ │ +00071400: 6572 2061 6e67 6c65 7320 6172 6520 6f6e er angles are on │ │ │ +00071410: 6c79 206f 6e65 206f 6620 7468 6520 706f ly one of the po │ │ │ +00071420: 7373 6962 6c65 2073 6f6c 7574 696f 6e73 ssible solutions │ │ │ +00071430: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ +00071440: 6973 2062 6173 6564 206f 6e20 2352 5144 is based on #RQD │ │ │ +00071450: 6563 6f6d 7033 7833 202e 3c2f 6464 3e0a ecomp3x3 .. │ │ │ +00071460: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    ..
    .

  • ..
  • .
    .

    sol │ │ │ -00083a40: 7665 506e 5047 656e 6572 6963 3c2f 6833 vePnPGeneric

    .
    .
    │ │ │ -00083a90: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -00083ab0: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -00083ac0: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;int< │ │ │ -00083ae0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> solvePnPG │ │ │ -00083b10: 656e 6572 6963 3c2f 7370 616e 3e3c 7762 eneric(Mat& │ │ │ -00083b80: 6e62 7370 3b6f 626a 6563 7450 6f69 6e74 nbsp;objectPoint │ │ │ -00083b90: 732c 0a20 3c61 2068 7265 663d 222e 2e2f s,. │ │ │ -00083bd0: 4d61 743c 2f61 3e26 6e62 7370 3b69 6d61 Mat ima │ │ │ -00083be0: 6765 506f 696e 7473 2c0a 203c 6120 6872 gePoints,. Mat&n │ │ │ -00083c30: 6273 703b 6361 6d65 7261 4d61 7472 6978 bsp;cameraMatrix │ │ │ -00083c40: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -00083c80: 6174 3c2f 613e 266e 6273 703b 6469 7374 at dist │ │ │ -00083c90: 436f 6566 6673 2c0a 203c 6120 6872 6566 Coeffs,. List<Mat> rvecs │ │ │ -00083d90: 2c0a 203c 6120 6872 6566 3d22 6874 7470 ,. List │ │ │ -00083e30: 3c2f 613e 266c 743b 3c61 2068 7265 663d <Mat>& │ │ │ -00083e80: 6e62 7370 3b74 7665 6373 2c0a 2062 6f6f nbsp;tvecs,. boo │ │ │ -00083e90: 6c65 616e 266e 6273 703b 7573 6545 7874 lean useExt │ │ │ -00083ea0: 7269 6e73 6963 4775 6573 732c 0a20 696e rinsicGuess,. in │ │ │ -00083eb0: 7426 6e62 7370 3b66 6c61 6773 2c0a 203c t flags,. < │ │ │ -00083ec0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00083ed0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00083ee0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00083ef0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat rvec,. < │ │ │ -00083f10: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00083f20: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00083f30: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00083f40: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat tvec)
    .
    Fi │ │ │ -00083f80: 6e64 7320 616e 206f 626a 6563 7420 706f nds an object po │ │ │ -00083f90: 7365 205c 2820 7b7d 5e7b 637d 5c6d 6174 se \( {}^{c}\mat │ │ │ -00083fa0: 6862 667b 547d 5f6f 205c 2920 6672 6f6d hbf{T}_o \) from │ │ │ -00083fb0: 2033 442d 3244 2070 6f69 6e74 2063 6f72 3D-2D point cor │ │ │ -00083fc0: 7265 7370 6f6e 6465 6e63 6573 2e0a 0a21 respondences...! │ │ │ -00083fd0: 5b50 6572 7370 6563 7469 7665 2070 726f [Perspective pro │ │ │ -00083fe0: 6a65 6374 696f 6e2c 2066 726f 6d20 6f62 jection, from ob │ │ │ -00083ff0: 6a65 6374 2074 6f20 6361 6d65 7261 2066 ject to camera f │ │ │ -00084000: 7261 6d65 5d28 7069 6373 2f70 696e 686f rame](pics/pinho │ │ │ -00084010: 6c65 5f68 6f6d 6f67 656e 656f 7573 5f74 le_homogeneous_t │ │ │ -00084020: 7261 6e73 666f 726d 6174 696f 6e2e 6a70 ransformation.jp │ │ │ -00084030: 6729 7b20 7769 6474 683d 3530 2520 7d0a g){ width=50% }. │ │ │ -00084040: 0a53 4545 3a20 5245 463a 2063 616c 6962 .SEE: REF: calib │ │ │ -00084050: 3364 5f73 6f6c 7665 506e 500a 0a54 6869 3d_solvePnP..Thi │ │ │ -00084060: 7320 6675 6e63 7469 6f6e 2072 6574 7572 s function retur │ │ │ -00084070: 6e73 2061 206c 6973 7420 6f66 2061 6c6c ns a list of all │ │ │ -00084080: 2074 6865 2070 6f73 7369 626c 6520 736f the possible so │ │ │ -00084090: 6c75 7469 6f6e 7320 2861 2073 6f6c 7574 lutions (a solut │ │ │ -000840a0: 696f 6e20 6973 2061 2026 6c74 3b72 6f74 ion is a <rot │ │ │ -000840b0: 6174 696f 6e20 7665 6374 6f72 2c20 7472 ation vector, tr │ │ │ -000840c0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ -000840d0: 2667 743b 0a63 6f75 706c 6529 2c20 6465 >.couple), de │ │ │ -000840e0: 7065 6e64 696e 6720 6f6e 2074 6865 206e pending on the n │ │ │ -000840f0: 756d 6265 7220 6f66 2069 6e70 7574 2070 umber of input p │ │ │ -00084100: 6f69 6e74 7320 616e 6420 7468 6520 6368 oints and the ch │ │ │ -00084110: 6f73 656e 206d 6574 686f 643a 0a3c 756c osen method:.
      .
    • . P3P me │ │ │ -00084130: 7468 6f64 7320 2852 4546 3a20 534f 4c56 thods (REF: SOLV │ │ │ -00084140: 4550 4e50 5f50 3350 2c20 5245 463a 2053 EPNP_P3P, REF: S │ │ │ -00084150: 4f4c 5645 504e 505f 4150 3350 293a 2033 OLVEPNP_AP3P): 3 │ │ │ -00084160: 206f 7220 3420 696e 7075 7420 706f 696e or 4 input poin │ │ │ -00084170: 7473 2e20 4e75 6d62 6572 206f 6620 7265 ts. Number of re │ │ │ -00084180: 7475 726e 6564 2073 6f6c 7574 696f 6e73 turned solutions │ │ │ -00084190: 2063 616e 2062 6520 6265 7477 6565 6e20 can be between │ │ │ -000841a0: 3020 616e 6420 3420 7769 7468 2033 2069 0 and 4 with 3 i │ │ │ -000841b0: 6e70 7574 2070 6f69 6e74 732e 0a20 203c nput points.. < │ │ │ -000841c0: 2f6c 693e 0a20 203c 6c69 3e0a 2052 4546 /li>.
    • . REF │ │ │ -000841d0: 3a20 534f 4c56 4550 4e50 5f49 5050 4520 : SOLVEPNP_IPPE │ │ │ -000841e0: 496e 7075 7420 706f 696e 7473 206d 7573 Input points mus │ │ │ -000841f0: 7420 6265 2026 6774 3b3d 2034 2061 6e64 t be >= 4 and │ │ │ -00084200: 206f 626a 6563 7420 706f 696e 7473 206d object points m │ │ │ -00084210: 7573 7420 6265 2063 6f70 6c61 6e61 722e ust be coplanar. │ │ │ -00084220: 2052 6574 7572 6e73 2032 2073 6f6c 7574 Returns 2 solut │ │ │ -00084230: 696f 6e73 2e0a 2020 3c2f 6c69 3e0a 2020 ions..
    • . │ │ │ -00084240: 3c6c 693e 0a20 5245 463a 2053 4f4c 5645
    • . REF: SOLVE │ │ │ -00084250: 504e 505f 4950 5045 5f53 5155 4152 4520 PNP_IPPE_SQUARE │ │ │ -00084260: 5370 6563 6961 6c20 6361 7365 2073 7569 Special case sui │ │ │ -00084270: 7461 626c 6520 666f 7220 6d61 726b 6572 table for marker │ │ │ -00084280: 2070 6f73 6520 6573 7469 6d61 7469 6f6e pose estimation │ │ │ -00084290: 2e0a 4e75 6d62 6572 206f 6620 696e 7075 ..Number of inpu │ │ │ -000842a0: 7420 706f 696e 7473 206d 7573 7420 6265 t points must be │ │ │ -000842b0: 2034 2061 6e64 2032 2073 6f6c 7574 696f 4 and 2 solutio │ │ │ -000842c0: 6e73 2061 7265 2072 6574 7572 6e65 642e ns are returned. │ │ │ -000842d0: 204f 626a 6563 7420 706f 696e 7473 206d Object points m │ │ │ -000842e0: 7573 7420 6265 2064 6566 696e 6564 2069 ust be defined i │ │ │ -000842f0: 6e20 7468 6520 666f 6c6c 6f77 696e 6720 n the following │ │ │ -00084300: 6f72 6465 723a 0a20 203c 756c 3e0a 2020 order:.
        . │ │ │ -00084310: 2020 3c6c 693e 0a20 2020 706f 696e 7420
      • . point │ │ │ -00084320: 303a 205b 2d73 7175 6172 654c 656e 6774 0: [-squareLengt │ │ │ -00084330: 6820 2f20 322c 2020 7371 7561 7265 4c65 h / 2, squareLe │ │ │ -00084340: 6e67 7468 202f 2032 2c20 305d 0a20 2020 ngth / 2, 0]. │ │ │ -00084350: 203c 2f6c 693e 0a20 2020 203c 6c69 3e0a
      • .
      • . │ │ │ -00084360: 2020 2070 6f69 6e74 2031 3a20 5b20 7371 point 1: [ sq │ │ │ -00084370: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ -00084380: 2073 7175 6172 654c 656e 6774 6820 2f20 squareLength / │ │ │ -00084390: 322c 2030 5d0a 2020 2020 3c2f 6c69 3e0a 2, 0].
      • . │ │ │ -000843a0: 2020 2020 3c6c 693e 0a20 2020 706f 696e
      • . poin │ │ │ -000843b0: 7420 323a 205b 2073 7175 6172 654c 656e t 2: [ squareLen │ │ │ -000843c0: 6774 6820 2f20 322c 202d 7371 7561 7265 gth / 2, -square │ │ │ -000843d0: 4c65 6e67 7468 202f 2032 2c20 305d 0a20 Length / 2, 0]. │ │ │ -000843e0: 2020 203c 2f6c 693e 0a20 2020 203c 6c69
      • .
      • . point 3: [- │ │ │ -00084400: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ -00084410: 2c20 2d73 7175 6172 654c 656e 6774 6820 , -squareLength │ │ │ -00084420: 2f20 322c 2030 5d0a 2020 2020 3c2f 6c69 / 2, 0].
      • .
      .
    • │ │ │ -00084440: 0a20 666f 7220 616c 6c20 7468 6520 6f74 . for all the ot │ │ │ -00084450: 6865 7220 666c 6167 732c 206e 756d 6265 her flags, numbe │ │ │ -00084460: 7220 6f66 2069 6e70 7574 2070 6f69 6e74 r of input point │ │ │ -00084470: 7320 6d75 7374 2062 6520 2667 743b 3d20 s must be >= │ │ │ -00084480: 3420 616e 6420 6f62 6a65 6374 2070 6f69 4 and object poi │ │ │ -00084490: 6e74 7320 6361 6e20 6265 2069 6e20 616e nts can be in an │ │ │ -000844a0: 7920 636f 6e66 6967 7572 6174 696f 6e2e y configuration. │ │ │ -000844b0: 0a4f 6e6c 7920 3120 736f 6c75 7469 6f6e .Only 1 solution │ │ │ -000844c0: 2069 7320 7265 7475 726e 6564 2e0a 2020 is returned.. │ │ │ -000844d0: 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64 6976
    • .
    .
    .
    Paramet │ │ │ -00084500: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    objectPoints │ │ │ -00084520: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ -00084530: 6f66 206f 626a 6563 7420 706f 696e 7473 of object points │ │ │ -00084540: 2069 6e20 7468 6520 6f62 6a65 6374 2063 in the object c │ │ │ -00084550: 6f6f 7264 696e 6174 6520 7370 6163 652c oordinate space, │ │ │ -00084560: 204e 7833 2031 2d63 6861 6e6e 656c 206f Nx3 1-channel o │ │ │ -00084570: 720a 3178 4e2f 4e78 3120 332d 6368 616e r.1xN/Nx1 3-chan │ │ │ -00084580: 6e65 6c2c 2077 6865 7265 204e 2069 7320 nel, where N is │ │ │ -00084590: 7468 6520 6e75 6d62 6572 206f 6620 706f the number of po │ │ │ -000845a0: 696e 7473 2e20 7665 6374 6f72 266c 743b ints. vector< │ │ │ -000845b0: 506f 696e 7433 6426 6774 3b20 6361 6e20 Point3d> can │ │ │ -000845c0: 6265 2061 6c73 6f20 7061 7373 6564 2068 be also passed h │ │ │ -000845d0: 6572 652e 3c2f 6464 3e0a 3c64 643e 3c63 ere.
    .
    imagePoints< │ │ │ -000845f0: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ -00084600: 6620 636f 7272 6573 706f 6e64 696e 6720 f corresponding │ │ │ -00084610: 696d 6167 6520 706f 696e 7473 2c20 4e78 image points, Nx │ │ │ -00084620: 3220 312d 6368 616e 6e65 6c20 6f72 2031 2 1-channel or 1 │ │ │ -00084630: 784e 2f4e 7831 2032 2d63 6861 6e6e 656c xN/Nx1 2-channel │ │ │ -00084640: 2c0a 7768 6572 6520 4e20 6973 2074 6865 ,.where N is the │ │ │ -00084650: 206e 756d 6265 7220 6f66 2070 6f69 6e74 number of point │ │ │ -00084660: 732e 2076 6563 746f 7226 6c74 3b50 6f69 s. vector<Poi │ │ │ -00084670: 6e74 3264 2667 743b 2063 616e 2062 6520 nt2d> can be │ │ │ -00084680: 616c 736f 2070 6173 7365 6420 6865 7265 also passed here │ │ │ -00084690: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    cameraMatrix - Input cam │ │ │ -000846c0: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ -000846d0: 7472 6978 205c 285c 6361 6d65 7261 6d61 trix \(\camerama │ │ │ -000846e0: 7472 6978 7b41 7d5c 2920 2e3c 2f64 643e trix{A}\) .
    │ │ │ -000846f0: 0a3c 6464 3e3c 636f 6465 3e64 6973 7443 .
    distC │ │ │ -00084700: 6f65 6666 733c 2f63 6f64 653e 202d 2049 oeffs - I │ │ │ -00084710: 6e70 7574 2076 6563 746f 7220 6f66 2064 nput vector of d │ │ │ -00084720: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ -00084730: 6369 656e 7473 0a5c 285c 6469 7374 636f cients.\(\distco │ │ │ -00084740: 6566 6673 5c29 2e20 4966 2074 6865 2076 effs\). If the v │ │ │ -00084750: 6563 746f 7220 6973 204e 554c 4c2f 656d ector is NULL/em │ │ │ -00084760: 7074 792c 2074 6865 207a 6572 6f20 6469 pty, the zero di │ │ │ -00084770: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ -00084780: 6965 6e74 7320 6172 650a 6173 7375 6d65 ients are.assume │ │ │ -00084790: 642e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 d.
    .
    rvecs - │ │ │ -000847b0: 2056 6563 746f 7220 6f66 206f 7574 7075 Vector of outpu │ │ │ -000847c0: 7420 726f 7461 7469 6f6e 2076 6563 746f t rotation vecto │ │ │ -000847d0: 7273 2028 7365 6520 5245 463a 2052 6f64 rs (see REF: Rod │ │ │ -000847e0: 7269 6775 6573 2029 2074 6861 742c 2074 rigues ) that, t │ │ │ -000847f0: 6f67 6574 6865 7220 7769 7468 2074 7665 ogether with tve │ │ │ -00084800: 6373 2c20 6272 696e 6773 2070 6f69 6e74 cs, brings point │ │ │ -00084810: 7320 6672 6f6d 0a74 6865 206d 6f64 656c s from.the model │ │ │ -00084820: 2063 6f6f 7264 696e 6174 6520 7379 7374 coordinate syst │ │ │ -00084830: 656d 2074 6f20 7468 6520 6361 6d65 7261 em to the camera │ │ │ -00084840: 2063 6f6f 7264 696e 6174 6520 7379 7374 coordinate syst │ │ │ -00084850: 656d 2e3c 2f64 643e 0a3c 6464 3e3c 636f em.
    .
    tvecs │ │ │ -00084870: 2d20 5665 6374 6f72 206f 6620 6f75 7470 - Vector of outp │ │ │ -00084880: 7574 2074 7261 6e73 6c61 7469 6f6e 2076 ut translation v │ │ │ -00084890: 6563 746f 7273 2e3c 2f64 643e 0a3c 6464 ectors.
    .
    useExtrin │ │ │ -000848b0: 7369 6347 7565 7373 3c2f 636f 6465 3e20 sicGuess │ │ │ -000848c0: 2d20 5061 7261 6d65 7465 7220 7573 6564 - Parameter used │ │ │ -000848d0: 2066 6f72 2023 534f 4c56 4550 4e50 5f49 for #SOLVEPNP_I │ │ │ -000848e0: 5445 5241 5449 5645 2e20 4966 2074 7275 TERATIVE. If tru │ │ │ -000848f0: 6520 2831 292c 2074 6865 2066 756e 6374 e (1), the funct │ │ │ -00084900: 696f 6e20 7573 6573 0a74 6865 2070 726f ion uses.the pro │ │ │ -00084910: 7669 6465 6420 7276 6563 2061 6e64 2074 vided rvec and t │ │ │ -00084920: 7665 6320 7661 6c75 6573 2061 7320 696e vec values as in │ │ │ -00084930: 6974 6961 6c20 6170 7072 6f78 696d 6174 itial approximat │ │ │ -00084940: 696f 6e73 206f 6620 7468 6520 726f 7461 ions of the rota │ │ │ -00084950: 7469 6f6e 2061 6e64 2074 7261 6e73 6c61 tion and transla │ │ │ -00084960: 7469 6f6e 0a76 6563 746f 7273 2c20 7265 tion.vectors, re │ │ │ -00084970: 7370 6563 7469 7665 6c79 2c20 616e 6420 spectively, and │ │ │ -00084980: 6675 7274 6865 7220 6f70 7469 6d69 7a65 further optimize │ │ │ -00084990: 7320 7468 656d 2e3c 2f64 643e 0a3c 6464 s them.
    .
    flags - Method for │ │ │ -000849c0: 2073 6f6c 7669 6e67 2061 2050 6e50 2070 solving a PnP p │ │ │ -000849d0: 726f 626c 656d 3a20 7365 6520 5245 463a roblem: see REF: │ │ │ -000849e0: 2063 616c 6962 3364 5f73 6f6c 7665 506e calib3d_solvePn │ │ │ -000849f0: 505f 666c 6167 733c 2f64 643e 0a3c 6464 P_flags
    .
    rvec - Rotation ve │ │ │ -00084a20: 6374 6f72 2075 7365 6420 746f 2069 6e69 ctor used to ini │ │ │ -00084a30: 7469 616c 697a 6520 616e 2069 7465 7261 tialize an itera │ │ │ -00084a40: 7469 7665 2050 6e50 2072 6566 696e 656d tive PnP refinem │ │ │ -00084a50: 656e 7420 616c 676f 7269 7468 6d2c 2077 ent algorithm, w │ │ │ -00084a60: 6865 6e20 666c 6167 2069 7320 5245 463a hen flag is REF: │ │ │ -00084a70: 2053 4f4c 5645 504e 505f 4954 4552 4154 SOLVEPNP_ITERAT │ │ │ -00084a80: 4956 450a 616e 6420 7573 6545 7874 7269 IVE.and useExtri │ │ │ -00084a90: 6e73 6963 4775 6573 7320 6973 2073 6574 nsicGuess is set │ │ │ -00084aa0: 2074 6f20 7472 7565 2e3c 2f64 643e 0a3c to true.
    .< │ │ │ -00084ab0: 6464 3e3c 636f 6465 3e74 7665 633c 2f63 dd>tvec - Translati │ │ │ -00084ad0: 6f6e 2076 6563 746f 7220 7573 6564 2074 on vector used t │ │ │ -00084ae0: 6f20 696e 6974 6961 6c69 7a65 2061 6e20 o initialize an │ │ │ -00084af0: 6974 6572 6174 6976 6520 506e 5020 7265 iterative PnP re │ │ │ -00084b00: 6669 6e65 6d65 6e74 2061 6c67 6f72 6974 finement algorit │ │ │ -00084b10: 686d 2c20 7768 656e 2066 6c61 6720 6973 hm, when flag is │ │ │ -00084b20: 2052 4546 3a20 534f 4c56 4550 4e50 5f49 REF: SOLVEPNP_I │ │ │ -00084b30: 5445 5241 5449 5645 0a61 6e64 2075 7365 TERATIVE.and use │ │ │ -00084b40: 4578 7472 696e 7369 6347 7565 7373 2069 ExtrinsicGuess i │ │ │ -00084b50: 7320 7365 7420 746f 2074 7275 652e 0a28 s set to true..( │ │ │ -00084b60: 5c28 205c 7465 7874 7b52 4d53 457d 203d \( \text{RMSE} = │ │ │ -00084b70: 205c 7371 7274 7b5c 6672 6163 7b5c 7375 \sqrt{\frac{\su │ │ │ -00084b80: 6d5f 7b69 7d5e 7b4e 7d20 5c6c 6566 7420 m_{i}^{N} \left │ │ │ -00084b90: 2820 5c68 6174 7b79 5f69 7d20 2d20 795f ( \hat{y_i} - y_ │ │ │ -00084ba0: 6920 5c72 6967 6874 2029 5e32 7d7b 4e7d i \right )^2}{N} │ │ │ -00084bb0: 7d20 5c29 2920 6265 7477 6565 6e20 7468 } \)) between th │ │ │ -00084bc0: 6520 696e 7075 7420 696d 6167 6520 706f e input image po │ │ │ -00084bd0: 696e 7473 0a61 6e64 2074 6865 2033 4420 ints.and the 3D │ │ │ -00084be0: 6f62 6a65 6374 2070 6f69 6e74 7320 7072 object points pr │ │ │ -00084bf0: 6f6a 6563 7465 6420 7769 7468 2074 6865 ojected with the │ │ │ -00084c00: 2065 7374 696d 6174 6564 2070 6f73 652e estimated pose. │ │ │ -00084c10: 0a0a 4d6f 7265 2069 6e66 6f72 6d61 7469 ..More informati │ │ │ -00084c20: 6f6e 2069 7320 6465 7363 7269 6265 6420 on is described │ │ │ -00084c30: 696e 2052 4546 3a20 6361 6c69 6233 645f in REF: calib3d_ │ │ │ -00084c40: 736f 6c76 6550 6e50 0a0a 3c62 3e4e 6f74 solvePnP..Not │ │ │ -00084c50: 653a 3c2f 623e 0a3c 756c 3e0a 2020 3c6c e:.
      . . An exam │ │ │ -00084c70: 706c 6520 6f66 2068 6f77 2074 6f20 7573 ple of how to us │ │ │ -00084c80: 6520 736f 6c76 6550 6e50 2066 6f72 2070 e solvePnP for p │ │ │ -00084c90: 6c61 6e61 7220 6175 676d 656e 7465 6420 lanar augmented │ │ │ -00084ca0: 7265 616c 6974 7920 6361 6e20 6265 2066 reality can be f │ │ │ -00084cb0: 6f75 6e64 2061 740a 2020 2020 2020 2020 ound at. │ │ │ -00084cc0: 6f70 656e 6376 5f73 6f75 7263 655f 636f opencv_source_co │ │ │ -00084cd0: 6465 2f73 616d 706c 6573 2f70 7974 686f de/samples/pytho │ │ │ -00084ce0: 6e2f 706c 616e 655f 6172 2e70 790a 2020 n/plane_ar.py. │ │ │ -00084cf0: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020 .
    • . │ │ │ -00084d00: 2020 2049 6620 796f 7520 6172 6520 7573 If you are us │ │ │ -00084d10: 696e 6720 5079 7468 6f6e 3a0a 2020 3c75 ing Python:. .
    • . │ │ │ -00084d30: 2020 2020 204e 756d 7079 2061 7272 6179 Numpy array │ │ │ -00084d40: 2073 6c69 6365 7320 776f 6e27 7420 776f slices won't wo │ │ │ -00084d50: 726b 2061 7320 696e 7075 7420 6265 6361 rk as input beca │ │ │ -00084d60: 7573 6520 736f 6c76 6550 6e50 2072 6571 use solvePnP req │ │ │ -00084d70: 7569 7265 7320 636f 6e74 6967 756f 7573 uires contiguous │ │ │ -00084d80: 0a20 2020 2020 2020 2061 7272 6179 7320 . arrays │ │ │ -00084d90: 2865 6e66 6f72 6365 6420 6279 2074 6865 (enforced by the │ │ │ -00084da0: 2061 7373 6572 7469 6f6e 2075 7369 6e67 assertion using │ │ │ -00084db0: 2063 763a 3a4d 6174 3a3a 6368 6563 6b56 cv::Mat::checkV │ │ │ -00084dc0: 6563 746f 7228 2920 6172 6f75 6e64 206c ector() around l │ │ │ -00084dd0: 696e 6520 3535 206f 660a 2020 2020 2020 ine 55 of. │ │ │ -00084de0: 2020 6d6f 6475 6c65 732f 3364 2f73 7263 modules/3d/src │ │ │ -00084df0: 2f73 6f6c 7665 706e 702e 6370 7020 7665 /solvepnp.cpp ve │ │ │ -00084e00: 7273 696f 6e20 322e 342e 3929 0a20 2020 rsion 2.4.9). │ │ │ -00084e10: 203c 2f6c 693e 0a20 2020 203c 6c69 3e0a
    • .
    • . │ │ │ -00084e20: 2020 2020 2020 2020 2054 6865 2050 3350 The P3P │ │ │ -00084e30: 2061 6c67 6f72 6974 686d 2072 6571 7569 algorithm requi │ │ │ -00084e40: 7265 7320 696d 6167 6520 706f 696e 7473 res image points │ │ │ -00084e50: 2074 6f20 6265 2069 6e20 616e 2061 7272 to be in an arr │ │ │ -00084e60: 6179 206f 6620 7368 6170 6520 284e 2c31 ay of shape (N,1 │ │ │ -00084e70: 2c32 2920 6475 650a 2020 2020 2020 2020 ,2) due. │ │ │ -00084e80: 746f 2069 7473 2063 616c 6c69 6e67 206f to its calling o │ │ │ -00084e90: 6620 2375 6e64 6973 746f 7274 506f 696e f #undistortPoin │ │ │ -00084ea0: 7473 2028 6172 6f75 6e64 206c 696e 6520 ts (around line │ │ │ -00084eb0: 3735 206f 6620 6d6f 6475 6c65 732f 3364 75 of modules/3d │ │ │ -00084ec0: 2f73 7263 2f73 6f6c 7665 706e 702e 6370 /src/solvepnp.cp │ │ │ -00084ed0: 7020 7665 7273 696f 6e20 322e 342e 3929 p version 2.4.9) │ │ │ -00084ee0: 0a20 2020 2020 2020 2077 6869 6368 2072 . which r │ │ │ -00084ef0: 6571 7569 7265 7320 322d 6368 616e 6e65 equires 2-channe │ │ │ -00084f00: 6c20 696e 666f 726d 6174 696f 6e2e 0a20 l information.. │ │ │ -00084f10: 2020 203c 2f6c 693e 0a20 2020 203c 6c69
    • .
    • . Thus, │ │ │ -00084f30: 2067 6976 656e 2073 6f6d 6520 6461 7461 given some data │ │ │ -00084f40: 2044 203d 206e 702e 6172 7261 7928 2e2e D = np.array(.. │ │ │ -00084f50: 2e29 2077 6865 7265 2044 2e73 6861 7065 .) where D.shape │ │ │ -00084f60: 203d 2028 4e2c 4d29 2c20 696e 206f 7264 = (N,M), in ord │ │ │ -00084f70: 6572 2074 6f20 7573 6520 6120 7375 6273 er to use a subs │ │ │ -00084f80: 6574 206f 660a 2020 2020 2020 2020 6974 et of. it │ │ │ -00084f90: 2061 732c 2065 2e67 2e2c 2069 6d61 6765 as, e.g., image │ │ │ -00084fa0: 506f 696e 7473 2c20 6f6e 6520 6d75 7374 Points, one must │ │ │ -00084fb0: 2065 6666 6563 7469 7665 6c79 2063 6f70 effectively cop │ │ │ -00084fc0: 7920 6974 2069 6e74 6f20 6120 6e65 7720 y it into a new │ │ │ -00084fd0: 6172 7261 793a 2069 6d61 6765 506f 696e array: imagePoin │ │ │ -00084fe0: 7473 203d 0a20 2020 2020 2020 206e 702e ts =. np. │ │ │ -00084ff0: 6173 636f 6e74 6967 756f 7573 6172 7261 ascontiguousarra │ │ │ -00085000: 7928 445b 3a2c 3a32 5d29 2e72 6573 6861 y(D[:,:2]).resha │ │ │ -00085010: 7065 2828 4e2c 312c 3229 290a 2020 2020 pe((N,1,2)). │ │ │ -00085020: 3c2f 6c69 3e0a 2020 3c2f 756c 3e0a 2020
    • .
    . │ │ │ -00085030: 3c6c 693e 0a20 2020 2020 2054 6865 206d
  • . The m │ │ │ -00085040: 696e 696d 756d 206e 756d 6265 7220 6f66 inimum number of │ │ │ -00085050: 2070 6f69 6e74 7320 6973 2034 2069 6e20 points is 4 in │ │ │ -00085060: 7468 6520 6765 6e65 7261 6c20 6361 7365 the general case │ │ │ -00085070: 2e20 496e 2074 6865 2063 6173 6520 6f66 . In the case of │ │ │ -00085080: 2052 4546 3a20 534f 4c56 4550 4e50 5f50 REF: SOLVEPNP_P │ │ │ -00085090: 3350 2061 6e64 2052 4546 3a20 534f 4c56 3P and REF: SOLV │ │ │ -000850a0: 4550 4e50 5f41 5033 500a 2020 2020 2020 EPNP_AP3P. │ │ │ -000850b0: 206d 6574 686f 6473 2c20 6974 2069 7320 methods, it is │ │ │ -000850c0: 7265 7175 6972 6564 2074 6f20 7573 6520 required to use │ │ │ -000850d0: 6578 6163 746c 7920 3420 706f 696e 7473 exactly 4 points │ │ │ -000850e0: 2028 7468 6520 6669 7273 7420 3320 706f (the first 3 po │ │ │ -000850f0: 696e 7473 2061 7265 2075 7365 6420 746f ints are used to │ │ │ -00085100: 2065 7374 696d 6174 6520 616c 6c20 7468 estimate all th │ │ │ -00085110: 6520 736f 6c75 7469 6f6e 730a 2020 2020 e solutions. │ │ │ -00085120: 2020 206f 6620 7468 6520 5033 5020 7072 of the P3P pr │ │ │ -00085130: 6f62 6c65 6d2c 2074 6865 206c 6173 7420 oblem, the last │ │ │ -00085140: 6f6e 6520 6973 2075 7365 6420 746f 2072 one is used to r │ │ │ -00085150: 6574 6169 6e20 7468 6520 6265 7374 2073 etain the best s │ │ │ -00085160: 6f6c 7574 696f 6e20 7468 6174 206d 696e olution that min │ │ │ -00085170: 696d 697a 6573 2074 6865 2072 6570 726f imizes the repro │ │ │ -00085180: 6a65 6374 696f 6e20 6572 726f 7229 2e0a jection error).. │ │ │ -00085190: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
  • .
  • . │ │ │ -000851a0: 2020 2020 2057 6974 6820 5245 463a 2053 With REF: S │ │ │ -000851b0: 4f4c 5645 504e 505f 4954 4552 4154 4956 OLVEPNP_ITERATIV │ │ │ -000851c0: 4520 6d65 7468 6f64 2061 6e64 203c 636f E method and useExtrinsicG │ │ │ -000851e0: 7565 7373 3d74 7275 653c 2f63 6f64 653e uess=true │ │ │ -000851f0: 2c20 7468 6520 6d69 6e69 6d75 6d20 6e75 , the minimum nu │ │ │ -00085200: 6d62 6572 206f 6620 706f 696e 7473 2069 mber of points i │ │ │ -00085210: 7320 3320 2833 2070 6f69 6e74 730a 2020 s 3 (3 points. │ │ │ -00085220: 2020 2020 2061 7265 2073 7566 6669 6369 are suffici │ │ │ -00085230: 656e 7420 746f 2063 6f6d 7075 7465 2061 ent to compute a │ │ │ -00085240: 2070 6f73 6520 6275 7420 7468 6572 6520 pose but there │ │ │ -00085250: 6172 6520 7570 2074 6f20 3420 736f 6c75 are up to 4 solu │ │ │ -00085260: 7469 6f6e 7329 2e20 5468 6520 696e 6974 tions). The init │ │ │ -00085270: 6961 6c20 736f 6c75 7469 6f6e 2073 686f ial solution sho │ │ │ -00085280: 756c 6420 6265 2063 6c6f 7365 2074 6f20 uld be close to │ │ │ -00085290: 7468 650a 2020 2020 2020 2067 6c6f 6261 the. globa │ │ │ -000852a0: 6c20 736f 6c75 7469 6f6e 2074 6f20 636f l solution to co │ │ │ -000852b0: 6e76 6572 6765 2e0a 2020 3c2f 6c69 3e0a nverge..
  • . │ │ │ -000852c0: 2020 3c6c 693e 0a20 2020 2020 2057 6974
  • . Wit │ │ │ -000852d0: 6820 5245 463a 2053 4f4c 5645 504e 505f h REF: SOLVEPNP_ │ │ │ -000852e0: 4950 5045 2069 6e70 7574 2070 6f69 6e74 IPPE input point │ │ │ -000852f0: 7320 6d75 7374 2062 6520 2667 743b 3d20 s must be >= │ │ │ -00085300: 3420 616e 6420 6f62 6a65 6374 2070 6f69 4 and object poi │ │ │ -00085310: 6e74 7320 6d75 7374 2062 6520 636f 706c nts must be copl │ │ │ -00085320: 616e 6172 2e0a 2020 3c2f 6c69 3e0a 2020 anar..
  • . │ │ │ -00085330: 3c6c 693e 0a20 2020 2020 2057 6974 6820
  • . With │ │ │ -00085340: 5245 463a 2053 4f4c 5645 504e 505f 4950 REF: SOLVEPNP_IP │ │ │ -00085350: 5045 5f53 5155 4152 4520 7468 6973 2069 PE_SQUARE this i │ │ │ -00085360: 7320 6120 7370 6563 6961 6c20 6361 7365 s a special case │ │ │ -00085370: 2073 7569 7461 626c 6520 666f 7220 6d61 suitable for ma │ │ │ -00085380: 726b 6572 2070 6f73 6520 6573 7469 6d61 rker pose estima │ │ │ -00085390: 7469 6f6e 2e0a 2020 2020 2020 204e 756d tion.. Num │ │ │ -000853a0: 6265 7220 6f66 2069 6e70 7574 2070 6f69 ber of input poi │ │ │ -000853b0: 6e74 7320 6d75 7374 2062 6520 342e 204f nts must be 4. O │ │ │ -000853c0: 626a 6563 7420 706f 696e 7473 206d 7573 bject points mus │ │ │ -000853d0: 7420 6265 2064 6566 696e 6564 2069 6e20 t be defined in │ │ │ -000853e0: 7468 6520 666f 6c6c 6f77 696e 6720 6f72 the following or │ │ │ -000853f0: 6465 723a 0a20 203c 756c 3e0a 2020 2020 der:.
      . │ │ │ -00085400: 3c6c 693e 0a20 2020 2020 2020 2020 2070
    • . p │ │ │ -00085410: 6f69 6e74 2030 3a20 5b2d 7371 7561 7265 oint 0: [-square │ │ │ -00085420: 4c65 6e67 7468 202f 2032 2c20 2073 7175 Length / 2, squ │ │ │ -00085430: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ -00085440: 5d0a 2020 2020 3c2f 6c69 3e0a 2020 2020 ].
    • . │ │ │ -00085450: 3c6c 693e 0a20 2020 2020 2020 2020 2070
    • . p │ │ │ -00085460: 6f69 6e74 2031 3a20 5b20 7371 7561 7265 oint 1: [ square │ │ │ -00085470: 4c65 6e67 7468 202f 2032 2c20 2073 7175 Length / 2, squ │ │ │ -00085480: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ -00085490: 5d0a 2020 2020 3c2f 6c69 3e0a 2020 2020 ].
    • . │ │ │ -000854a0: 3c6c 693e 0a20 2020 2020 2020 2020 2070
    • . p │ │ │ -000854b0: 6f69 6e74 2032 3a20 5b20 7371 7561 7265 oint 2: [ square │ │ │ -000854c0: 4c65 6e67 7468 202f 2032 2c20 2d73 7175 Length / 2, -squ │ │ │ -000854d0: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ -000854e0: 5d0a 2020 2020 3c2f 6c69 3e0a 2020 2020 ].
    • . │ │ │ -000854f0: 3c6c 693e 0a20 2020 2020 2020 2020 2070
    • . p │ │ │ -00085500: 6f69 6e74 2033 3a20 5b2d 7371 7561 7265 oint 3: [-square │ │ │ -00085510: 4c65 6e67 7468 202f 2032 2c20 2d73 7175 Length / 2, -squ │ │ │ -00085520: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ -00085530: 5d0a 2020 2020 3c2f 6c69 3e0a 2020 3c2f ].
    • . .
    • . │ │ │ -00085550: 2057 6974 6820 5245 463a 2053 4f4c 5645 With REF: SOLVE │ │ │ -00085560: 504e 505f 5351 504e 5020 696e 7075 7420 PNP_SQPNP input │ │ │ -00085570: 706f 696e 7473 206d 7573 7420 6265 2026 points must be & │ │ │ -00085580: 6774 3b3d 2033 0a20 203c 2f6c 693e 0a3c gt;= 3.
    • .< │ │ │ -00085590: 2f75 6c3e 3c2f 6464 3e0a 3c64 743e 5265 /ul>.
      Re │ │ │ -000855a0: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
      .
      │ │ │ -000855b0: 6175 746f 6d61 7469 6361 6c6c 7920 6765 automatically ge │ │ │ -000855c0: 6e65 7261 7465 643c 2f64 643e 0a3c 2f64 nerated
      ..
  • ..
  • .
  • . │ │ │ -000855f0: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    solvePnPGeneric │ │ │ -000856c0: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ -00085720: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -00085730: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -00085750: 696e 743c 2f73 7061 6e3e 266e 6273 703b int  │ │ │ -00085760: 3c73 7061 6e20 636c 6173 733d 2265 6c65 solve │ │ │ -00085780: 506e 5047 656e 6572 6963 3c2f 7370 616e PnPGeneric( │ │ │ -000857b0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000857f0: 2f61 3e26 6e62 7370 3b6f 626a 6563 7450 /a> objectP │ │ │ -00085800: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ -00085850: 3b69 6d61 6765 506f 696e 7473 2c0a 203c ;imagePoints,. < │ │ │ -00085860: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00085870: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00085880: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00085890: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ -000858b0: 7472 6978 2c0a 203c 6120 6872 6566 3d22 trix,. Mat  │ │ │ -00085900: 6469 7374 436f 6566 6673 2c0a 203c 6120 distCoeffs,. List&l │ │ │ -000859b0: 743b 3c61 2068 7265 663d 222e 2e2f 636f t;Ma │ │ │ -000859f0: 743c 2f61 3e26 6774 3b26 6e62 7370 3b72 t> r │ │ │ -00085a00: 7665 6373 2c0a 203c 6120 6872 6566 3d22 vecs,. │ │ │ -00085aa0: 4c69 7374 3c2f 613e 266c 743b 3c61 2068 List<Mat& │ │ │ -00085af0: 6774 3b26 6e62 7370 3b74 7665 6373 2c0a gt; tvecs,. │ │ │ -00085b00: 2062 6f6f 6c65 616e 266e 6273 703b 7573 boolean us │ │ │ -00085b10: 6545 7874 7269 6e73 6963 4775 6573 732c eExtrinsicGuess, │ │ │ -00085b20: 0a20 696e 7426 6e62 7370 3b66 6c61 6773 . int flags │ │ │ -00085b30: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -00085b70: 6174 3c2f 613e 266e 6273 703b 7276 6563 at rvec │ │ │ -00085b80: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ -00085b90: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -00085ba0: 223e 4669 6e64 7320 616e 206f 626a 6563 ">Finds an objec │ │ │ -00085bb0: 7420 706f 7365 205c 2820 7b7d 5e7b 637d t pose \( {}^{c} │ │ │ -00085bc0: 5c6d 6174 6862 667b 547d 5f6f 205c 2920 \mathbf{T}_o \) │ │ │ -00085bd0: 6672 6f6d 2033 442d 3244 2070 6f69 6e74 from 3D-2D point │ │ │ -00085be0: 2063 6f72 7265 7370 6f6e 6465 6e63 6573 correspondences │ │ │ -00085bf0: 2e0a 0a21 5b50 6572 7370 6563 7469 7665 ...![Perspective │ │ │ -00085c00: 2070 726f 6a65 6374 696f 6e2c 2066 726f projection, fro │ │ │ -00085c10: 6d20 6f62 6a65 6374 2074 6f20 6361 6d65 m object to came │ │ │ -00085c20: 7261 2066 7261 6d65 5d28 7069 6373 2f70 ra frame](pics/p │ │ │ -00085c30: 696e 686f 6c65 5f68 6f6d 6f67 656e 656f inhole_homogeneo │ │ │ -00085c40: 7573 5f74 7261 6e73 666f 726d 6174 696f us_transformatio │ │ │ -00085c50: 6e2e 6a70 6729 7b20 7769 6474 683d 3530 n.jpg){ width=50 │ │ │ -00085c60: 2520 7d0a 0a53 4545 3a20 5245 463a 2063 % }..SEE: REF: c │ │ │ -00085c70: 616c 6962 3364 5f73 6f6c 7665 506e 500a alib3d_solvePnP. │ │ │ -00085c80: 0a54 6869 7320 6675 6e63 7469 6f6e 2072 .This function r │ │ │ -00085c90: 6574 7572 6e73 2061 206c 6973 7420 6f66 eturns a list of │ │ │ -00085ca0: 2061 6c6c 2074 6865 2070 6f73 7369 626c all the possibl │ │ │ -00085cb0: 6520 736f 6c75 7469 6f6e 7320 2861 2073 e solutions (a s │ │ │ -00085cc0: 6f6c 7574 696f 6e20 6973 2061 2026 6c74 olution is a < │ │ │ -00085cd0: 3b72 6f74 6174 696f 6e20 7665 6374 6f72 ;rotation vector │ │ │ -00085ce0: 2c20 7472 616e 736c 6174 696f 6e20 7665 , translation ve │ │ │ -00085cf0: 6374 6f72 2667 743b 0a63 6f75 706c 6529 ctor>.couple) │ │ │ -00085d00: 2c20 6465 7065 6e64 696e 6720 6f6e 2074 , depending on t │ │ │ -00085d10: 6865 206e 756d 6265 7220 6f66 2069 6e70 he number of inp │ │ │ -00085d20: 7574 2070 6f69 6e74 7320 616e 6420 7468 ut points and th │ │ │ -00085d30: 6520 6368 6f73 656e 206d 6574 686f 643a e chosen method: │ │ │ -00085d40: 0a3c 756c 3e0a 2020 3c6c 693e 0a20 5033 .
      .
    • . P3 │ │ │ -00085d50: 5020 6d65 7468 6f64 7320 2852 4546 3a20 P methods (REF: │ │ │ -00085d60: 534f 4c56 4550 4e50 5f50 3350 2c20 5245 SOLVEPNP_P3P, RE │ │ │ -00085d70: 463a 2053 4f4c 5645 504e 505f 4150 3350 F: SOLVEPNP_AP3P │ │ │ -00085d80: 293a 2033 206f 7220 3420 696e 7075 7420 ): 3 or 4 input │ │ │ -00085d90: 706f 696e 7473 2e20 4e75 6d62 6572 206f points. Number o │ │ │ -00085da0: 6620 7265 7475 726e 6564 2073 6f6c 7574 f returned solut │ │ │ -00085db0: 696f 6e73 2063 616e 2062 6520 6265 7477 ions can be betw │ │ │ -00085dc0: 6565 6e20 3020 616e 6420 3420 7769 7468 een 0 and 4 with │ │ │ -00085dd0: 2033 2069 6e70 7574 2070 6f69 6e74 732e 3 input points. │ │ │ -00085de0: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ -00085df0: 2052 4546 3a20 534f 4c56 4550 4e50 5f49 REF: SOLVEPNP_I │ │ │ -00085e00: 5050 4520 496e 7075 7420 706f 696e 7473 PPE Input points │ │ │ -00085e10: 206d 7573 7420 6265 2026 6774 3b3d 2034 must be >= 4 │ │ │ -00085e20: 2061 6e64 206f 626a 6563 7420 706f 696e and object poin │ │ │ -00085e30: 7473 206d 7573 7420 6265 2063 6f70 6c61 ts must be copla │ │ │ -00085e40: 6e61 722e 2052 6574 7572 6e73 2032 2073 nar. Returns 2 s │ │ │ -00085e50: 6f6c 7574 696f 6e73 2e0a 2020 3c2f 6c69 olutions..
    • .
    • . REF: S │ │ │ -00085e70: 4f4c 5645 504e 505f 4950 5045 5f53 5155 OLVEPNP_IPPE_SQU │ │ │ -00085e80: 4152 4520 5370 6563 6961 6c20 6361 7365 ARE Special case │ │ │ -00085e90: 2073 7569 7461 626c 6520 666f 7220 6d61 suitable for ma │ │ │ -00085ea0: 726b 6572 2070 6f73 6520 6573 7469 6d61 rker pose estima │ │ │ -00085eb0: 7469 6f6e 2e0a 4e75 6d62 6572 206f 6620 tion..Number of │ │ │ -00085ec0: 696e 7075 7420 706f 696e 7473 206d 7573 input points mus │ │ │ -00085ed0: 7420 6265 2034 2061 6e64 2032 2073 6f6c t be 4 and 2 sol │ │ │ -00085ee0: 7574 696f 6e73 2061 7265 2072 6574 7572 utions are retur │ │ │ -00085ef0: 6e65 642e 204f 626a 6563 7420 706f 696e ned. Object poin │ │ │ -00085f00: 7473 206d 7573 7420 6265 2064 6566 696e ts must be defin │ │ │ -00085f10: 6564 2069 6e20 7468 6520 666f 6c6c 6f77 ed in the follow │ │ │ -00085f20: 696e 6720 6f72 6465 723a 0a20 203c 756c ing order:.
        .
      • . po │ │ │ -00085f40: 696e 7420 303a 205b 2d73 7175 6172 654c int 0: [-squareL │ │ │ -00085f50: 656e 6774 6820 2f20 322c 2020 7371 7561 ength / 2, squa │ │ │ -00085f60: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ -00085f70: 0a20 2020 203c 2f6c 693e 0a20 2020 203c .
      • . < │ │ │ -00085f80: 6c69 3e0a 2020 2070 6f69 6e74 2031 3a20 li>. point 1: │ │ │ -00085f90: 5b20 7371 7561 7265 4c65 6e67 7468 202f [ squareLength / │ │ │ -00085fa0: 2032 2c20 2073 7175 6172 654c 656e 6774 2, squareLengt │ │ │ -00085fb0: 6820 2f20 322c 2030 5d0a 2020 2020 3c2f h / 2, 0]. .
      • . │ │ │ -00085fd0: 706f 696e 7420 323a 205b 2073 7175 6172 point 2: [ squar │ │ │ -00085fe0: 654c 656e 6774 6820 2f20 322c 202d 7371 eLength / 2, -sq │ │ │ -00085ff0: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ -00086000: 305d 0a20 2020 203c 2f6c 693e 0a20 2020 0].
      • . │ │ │ -00086010: 203c 6c69 3e0a 2020 2070 6f69 6e74 2033
      • . point 3 │ │ │ -00086020: 3a20 5b2d 7371 7561 7265 4c65 6e67 7468 : [-squareLength │ │ │ -00086030: 202f 2032 2c20 2d73 7175 6172 654c 656e / 2, -squareLen │ │ │ -00086040: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ -00086050: 3c2f 6c69 3e0a 2020 3c2f 756c 3e0a 2020
      • .
      . │ │ │ -00086060: 3c6c 693e 0a20 666f 7220 616c 6c20 7468
    • . for all th │ │ │ -00086070: 6520 6f74 6865 7220 666c 6167 732c 206e e other flags, n │ │ │ -00086080: 756d 6265 7220 6f66 2069 6e70 7574 2070 umber of input p │ │ │ -00086090: 6f69 6e74 7320 6d75 7374 2062 6520 2667 oints must be &g │ │ │ -000860a0: 743b 3d20 3420 616e 6420 6f62 6a65 6374 t;= 4 and object │ │ │ -000860b0: 2070 6f69 6e74 7320 6361 6e20 6265 2069 points can be i │ │ │ -000860c0: 6e20 616e 7920 636f 6e66 6967 7572 6174 n any configurat │ │ │ -000860d0: 696f 6e2e 0a4f 6e6c 7920 3120 736f 6c75 ion..Only 1 solu │ │ │ -000860e0: 7469 6f6e 2069 7320 7265 7475 726e 6564 tion is returned │ │ │ -000860f0: 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c ..
    • .
    < │ │ │ -00086100: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ -00086120: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .objectPo │ │ │ -00086140: 696e 7473 3c2f 636f 6465 3e20 2d20 4172 ints - Ar │ │ │ -00086150: 7261 7920 6f66 206f 626a 6563 7420 706f ray of object po │ │ │ -00086160: 696e 7473 2069 6e20 7468 6520 6f62 6a65 ints in the obje │ │ │ -00086170: 6374 2063 6f6f 7264 696e 6174 6520 7370 ct coordinate sp │ │ │ -00086180: 6163 652c 204e 7833 2031 2d63 6861 6e6e ace, Nx3 1-chann │ │ │ -00086190: 656c 206f 720a 3178 4e2f 4e78 3120 332d el or.1xN/Nx1 3- │ │ │ -000861a0: 6368 616e 6e65 6c2c 2077 6865 7265 204e channel, where N │ │ │ -000861b0: 2069 7320 7468 6520 6e75 6d62 6572 206f is the number o │ │ │ -000861c0: 6620 706f 696e 7473 2e20 7665 6374 6f72 f points. vector │ │ │ -000861d0: 266c 743b 506f 696e 7433 6426 6774 3b20 <Point3d> │ │ │ -000861e0: 6361 6e20 6265 2061 6c73 6f20 7061 7373 can be also pass │ │ │ -000861f0: 6564 2068 6572 652e 3c2f 6464 3e0a 3c64 ed here..imagePoi │ │ │ -00086210: 6e74 733c 2f63 6f64 653e 202d 2041 7272 nts - Arr │ │ │ -00086220: 6179 206f 6620 636f 7272 6573 706f 6e64 ay of correspond │ │ │ -00086230: 696e 6720 696d 6167 6520 706f 696e 7473 ing image points │ │ │ -00086240: 2c20 4e78 3220 312d 6368 616e 6e65 6c20 , Nx2 1-channel │ │ │ -00086250: 6f72 2031 784e 2f4e 7831 2032 2d63 6861 or 1xN/Nx1 2-cha │ │ │ -00086260: 6e6e 656c 2c0a 7768 6572 6520 4e20 6973 nnel,.where N is │ │ │ -00086270: 2074 6865 206e 756d 6265 7220 6f66 2070 the number of p │ │ │ -00086280: 6f69 6e74 732e 2076 6563 746f 7226 6c74 oints. vector< │ │ │ -00086290: 3b50 6f69 6e74 3264 2667 743b 2063 616e ;Point2d> can │ │ │ -000862a0: 2062 6520 616c 736f 2070 6173 7365 6420 be also passed │ │ │ -000862b0: 6865 7265 2e3c 2f64 643e 0a3c 6464 3e3c here..
    < │ │ │ -000862c0: 636f 6465 3e63 616d 6572 614d 6174 7269 code>cameraMatri │ │ │ -000862d0: 783c 2f63 6f64 653e 202d 2049 6e70 7574 x - Input │ │ │ -000862e0: 2063 616d 6572 6120 696e 7472 696e 7369 camera intrinsi │ │ │ -000862f0: 6320 6d61 7472 6978 205c 285c 6361 6d65 c matrix \(\came │ │ │ -00086300: 7261 6d61 7472 6978 7b41 7d5c 2920 2e3c ramatrix{A}\) .< │ │ │ -00086310: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -00086320: 6973 7443 6f65 6666 733c 2f63 6f64 653e istCoeffs │ │ │ -00086330: 202d 2049 6e70 7574 2076 6563 746f 7220 - Input vector │ │ │ -00086340: 6f66 2064 6973 746f 7274 696f 6e20 636f of distortion co │ │ │ -00086350: 6566 6669 6369 656e 7473 0a5c 285c 6469 efficients.\(\di │ │ │ -00086360: 7374 636f 6566 6673 5c29 2e20 4966 2074 stcoeffs\). If t │ │ │ -00086370: 6865 2076 6563 746f 7220 6973 204e 554c he vector is NUL │ │ │ -00086380: 4c2f 656d 7074 792c 2074 6865 207a 6572 L/empty, the zer │ │ │ -00086390: 6f20 6469 7374 6f72 7469 6f6e 2063 6f65 o distortion coe │ │ │ -000863a0: 6666 6963 6965 6e74 7320 6172 650a 6173 fficients are.as │ │ │ -000863b0: 7375 6d65 642e 3c2f 6464 3e0a 3c64 643e sumed.
    .
    │ │ │ -000863c0: 3c63 6f64 653e 7276 6563 733c 2f63 6f64 rvecs - Vector of o │ │ │ -000863e0: 7574 7075 7420 726f 7461 7469 6f6e 2076 utput rotation v │ │ │ -000863f0: 6563 746f 7273 2028 7365 6520 5245 463a ectors (see REF: │ │ │ -00086400: 2052 6f64 7269 6775 6573 2029 2074 6861 Rodrigues ) tha │ │ │ -00086410: 742c 2074 6f67 6574 6865 7220 7769 7468 t, together with │ │ │ -00086420: 2074 7665 6373 2c20 6272 696e 6773 2070 tvecs, brings p │ │ │ -00086430: 6f69 6e74 7320 6672 6f6d 0a74 6865 206d oints from.the m │ │ │ -00086440: 6f64 656c 2063 6f6f 7264 696e 6174 6520 odel coordinate │ │ │ -00086450: 7379 7374 656d 2074 6f20 7468 6520 6361 system to the ca │ │ │ -00086460: 6d65 7261 2063 6f6f 7264 696e 6174 6520 mera coordinate │ │ │ -00086470: 7379 7374 656d 2e3c 2f64 643e 0a3c 6464 system.
    .
    tvecs - Vector of │ │ │ -000864a0: 6f75 7470 7574 2074 7261 6e73 6c61 7469 output translati │ │ │ -000864b0: 6f6e 2076 6563 746f 7273 2e3c 2f64 643e on vectors.
    │ │ │ -000864c0: 0a3c 6464 3e3c 636f 6465 3e75 7365 4578 .
    useEx │ │ │ -000864d0: 7472 696e 7369 6347 7565 7373 3c2f 636f trinsicGuess - Parameter │ │ │ -000864f0: 7573 6564 2066 6f72 2023 534f 4c56 4550 used for #SOLVEP │ │ │ -00086500: 4e50 5f49 5445 5241 5449 5645 2e20 4966 NP_ITERATIVE. If │ │ │ -00086510: 2074 7275 6520 2831 292c 2074 6865 2066 true (1), the f │ │ │ -00086520: 756e 6374 696f 6e20 7573 6573 0a74 6865 unction uses.the │ │ │ -00086530: 2070 726f 7669 6465 6420 7276 6563 2061 provided rvec a │ │ │ -00086540: 6e64 2074 7665 6320 7661 6c75 6573 2061 nd tvec values a │ │ │ -00086550: 7320 696e 6974 6961 6c20 6170 7072 6f78 s initial approx │ │ │ -00086560: 696d 6174 696f 6e73 206f 6620 7468 6520 imations of the │ │ │ -00086570: 726f 7461 7469 6f6e 2061 6e64 2074 7261 rotation and tra │ │ │ -00086580: 6e73 6c61 7469 6f6e 0a76 6563 746f 7273 nslation.vectors │ │ │ -00086590: 2c20 7265 7370 6563 7469 7665 6c79 2c20 , respectively, │ │ │ -000865a0: 616e 6420 6675 7274 6865 7220 6f70 7469 and further opti │ │ │ -000865b0: 6d69 7a65 7320 7468 656d 2e3c 2f64 643e mizes them.
    │ │ │ -000865c0: 0a3c 6464 3e3c 636f 6465 3e66 6c61 6773 .
    flags │ │ │ -000865d0: 3c2f 636f 6465 3e20 2d20 4d65 7468 6f64 - Method │ │ │ -000865e0: 2066 6f72 2073 6f6c 7669 6e67 2061 2050 for solving a P │ │ │ -000865f0: 6e50 2070 726f 626c 656d 3a20 7365 6520 nP problem: see │ │ │ -00086600: 5245 463a 2063 616c 6962 3364 5f73 6f6c REF: calib3d_sol │ │ │ -00086610: 7665 506e 505f 666c 6167 733c 2f64 643e vePnP_flags
    │ │ │ -00086620: 0a3c 6464 3e3c 636f 6465 3e72 7665 633c .
    rvec< │ │ │ -00086630: 2f63 6f64 653e 202d 2052 6f74 6174 696f /code> - Rotatio │ │ │ -00086640: 6e20 7665 6374 6f72 2075 7365 6420 746f n vector used to │ │ │ -00086650: 2069 6e69 7469 616c 697a 6520 616e 2069 initialize an i │ │ │ -00086660: 7465 7261 7469 7665 2050 6e50 2072 6566 terative PnP ref │ │ │ -00086670: 696e 656d 656e 7420 616c 676f 7269 7468 inement algorith │ │ │ -00086680: 6d2c 2077 6865 6e20 666c 6167 2069 7320 m, when flag is │ │ │ -00086690: 5245 463a 2053 4f4c 5645 504e 505f 4954 REF: SOLVEPNP_IT │ │ │ -000866a0: 4552 4154 4956 450a 616e 6420 7573 6545 ERATIVE.and useE │ │ │ -000866b0: 7874 7269 6e73 6963 4775 6573 7320 6973 xtrinsicGuess is │ │ │ -000866c0: 2073 6574 2074 6f20 7472 7565 2e0a 616e set to true..an │ │ │ -000866d0: 6420 7573 6545 7874 7269 6e73 6963 4775 d useExtrinsicGu │ │ │ -000866e0: 6573 7320 6973 2073 6574 2074 6f20 7472 ess is set to tr │ │ │ -000866f0: 7565 2e0a 285c 2820 5c74 6578 747b 524d ue..(\( \text{RM │ │ │ -00086700: 5345 7d20 3d20 5c73 7172 747b 5c66 7261 SE} = \sqrt{\fra │ │ │ -00086710: 637b 5c73 756d 5f7b 697d 5e7b 4e7d 205c c{\sum_{i}^{N} \ │ │ │ -00086720: 6c65 6674 2028 205c 6861 747b 795f 697d left ( \hat{y_i} │ │ │ -00086730: 202d 2079 5f69 205c 7269 6768 7420 295e - y_i \right )^ │ │ │ -00086740: 327d 7b4e 7d7d 205c 2929 2062 6574 7765 2}{N}} \)) betwe │ │ │ -00086750: 656e 2074 6865 2069 6e70 7574 2069 6d61 en the input ima │ │ │ -00086760: 6765 2070 6f69 6e74 730a 616e 6420 7468 ge points.and th │ │ │ -00086770: 6520 3344 206f 626a 6563 7420 706f 696e e 3D object poin │ │ │ -00086780: 7473 2070 726f 6a65 6374 6564 2077 6974 ts projected wit │ │ │ -00086790: 6820 7468 6520 6573 7469 6d61 7465 6420 h the estimated │ │ │ -000867a0: 706f 7365 2e0a 0a4d 6f72 6520 696e 666f pose...More info │ │ │ -000867b0: 726d 6174 696f 6e20 6973 2064 6573 6372 rmation is descr │ │ │ -000867c0: 6962 6564 2069 6e20 5245 463a 2063 616c ibed in REF: cal │ │ │ -000867d0: 6962 3364 5f73 6f6c 7665 506e 500a 0a3c ib3d_solvePnP..< │ │ │ -000867e0: 623e 4e6f 7465 3a3c 2f62 3e0a 3c75 6c3e b>Note:.
      │ │ │ -000867f0: 0a20 203c 6c69 3e0a 2020 2020 2020 416e .
    • . An │ │ │ -00086800: 2065 7861 6d70 6c65 206f 6620 686f 7720 example of how │ │ │ -00086810: 746f 2075 7365 2073 6f6c 7665 506e 5020 to use solvePnP │ │ │ -00086820: 666f 7220 706c 616e 6172 2061 7567 6d65 for planar augme │ │ │ -00086830: 6e74 6564 2072 6561 6c69 7479 2063 616e nted reality can │ │ │ -00086840: 2062 6520 666f 756e 6420 6174 0a20 2020 be found at. │ │ │ -00086850: 2020 2020 206f 7065 6e63 765f 736f 7572 opencv_sour │ │ │ -00086860: 6365 5f63 6f64 652f 7361 6d70 6c65 732f ce_code/samples/ │ │ │ -00086870: 7079 7468 6f6e 2f70 6c61 6e65 5f61 722e python/plane_ar. │ │ │ -00086880: 7079 0a20 203c 2f6c 693e 0a20 203c 6c69 py.
    • .
    • . If you a │ │ │ -000868a0: 7265 2075 7369 6e67 2050 7974 686f 6e3a re using Python: │ │ │ -000868b0: 0a20 203c 756c 3e0a 2020 2020 3c6c 693e .
        .
      • │ │ │ -000868c0: 0a20 2020 2020 2020 2020 4e75 6d70 7920 . Numpy │ │ │ -000868d0: 6172 7261 7920 736c 6963 6573 2077 6f6e array slices won │ │ │ -000868e0: 2774 2077 6f72 6b20 6173 2069 6e70 7574 't work as input │ │ │ -000868f0: 2062 6563 6175 7365 2073 6f6c 7665 506e because solvePn │ │ │ -00086900: 5020 7265 7175 6972 6573 2063 6f6e 7469 P requires conti │ │ │ -00086910: 6775 6f75 730a 2020 2020 2020 2020 6172 guous. ar │ │ │ -00086920: 7261 7973 2028 656e 666f 7263 6564 2062 rays (enforced b │ │ │ -00086930: 7920 7468 6520 6173 7365 7274 696f 6e20 y the assertion │ │ │ -00086940: 7573 696e 6720 6376 3a3a 4d61 743a 3a63 using cv::Mat::c │ │ │ -00086950: 6865 636b 5665 6374 6f72 2829 2061 726f heckVector() aro │ │ │ -00086960: 756e 6420 6c69 6e65 2035 3520 6f66 0a20 und line 55 of. │ │ │ -00086970: 2020 2020 2020 206d 6f64 756c 6573 2f33 modules/3 │ │ │ -00086980: 642f 7372 632f 736f 6c76 6570 6e70 2e63 d/src/solvepnp.c │ │ │ -00086990: 7070 2076 6572 7369 6f6e 2032 2e34 2e39 pp version 2.4.9 │ │ │ -000869a0: 290a 2020 2020 3c2f 6c69 3e0a 2020 2020 ).
      • . │ │ │ -000869b0: 3c6c 693e 0a20 2020 2020 2020 2020 5468
      • . Th │ │ │ -000869c0: 6520 5033 5020 616c 676f 7269 7468 6d20 e P3P algorithm │ │ │ -000869d0: 7265 7175 6972 6573 2069 6d61 6765 2070 requires image p │ │ │ -000869e0: 6f69 6e74 7320 746f 2062 6520 696e 2061 oints to be in a │ │ │ -000869f0: 6e20 6172 7261 7920 6f66 2073 6861 7065 n array of shape │ │ │ -00086a00: 2028 4e2c 312c 3229 2064 7565 0a20 2020 (N,1,2) due. │ │ │ -00086a10: 2020 2020 2074 6f20 6974 7320 6361 6c6c to its call │ │ │ -00086a20: 696e 6720 6f66 2023 756e 6469 7374 6f72 ing of #undistor │ │ │ -00086a30: 7450 6f69 6e74 7320 2861 726f 756e 6420 tPoints (around │ │ │ -00086a40: 6c69 6e65 2037 3520 6f66 206d 6f64 756c line 75 of modul │ │ │ -00086a50: 6573 2f33 642f 7372 632f 736f 6c76 6570 es/3d/src/solvep │ │ │ -00086a60: 6e70 2e63 7070 2076 6572 7369 6f6e 2032 np.cpp version 2 │ │ │ -00086a70: 2e34 2e39 290a 2020 2020 2020 2020 7768 .4.9). wh │ │ │ -00086a80: 6963 6820 7265 7175 6972 6573 2032 2d63 ich requires 2-c │ │ │ -00086a90: 6861 6e6e 656c 2069 6e66 6f72 6d61 7469 hannel informati │ │ │ -00086aa0: 6f6e 2e0a 2020 2020 3c2f 6c69 3e0a 2020 on..
      • . │ │ │ -00086ab0: 2020 3c6c 693e 0a20 2020 2020 2020 2020
      • . │ │ │ -00086ac0: 5468 7573 2c20 6769 7665 6e20 736f 6d65 Thus, given some │ │ │ -00086ad0: 2064 6174 6120 4420 3d20 6e70 2e61 7272 data D = np.arr │ │ │ -00086ae0: 6179 282e 2e2e 2920 7768 6572 6520 442e ay(...) where D. │ │ │ -00086af0: 7368 6170 6520 3d20 284e 2c4d 292c 2069 shape = (N,M), i │ │ │ -00086b00: 6e20 6f72 6465 7220 746f 2075 7365 2061 n order to use a │ │ │ -00086b10: 2073 7562 7365 7420 6f66 0a20 2020 2020 subset of. │ │ │ -00086b20: 2020 2069 7420 6173 2c20 652e 672e 2c20 it as, e.g., │ │ │ -00086b30: 696d 6167 6550 6f69 6e74 732c 206f 6e65 imagePoints, one │ │ │ -00086b40: 206d 7573 7420 6566 6665 6374 6976 656c must effectivel │ │ │ -00086b50: 7920 636f 7079 2069 7420 696e 746f 2061 y copy it into a │ │ │ -00086b60: 206e 6577 2061 7272 6179 3a20 696d 6167 new array: imag │ │ │ -00086b70: 6550 6f69 6e74 7320 3d0a 2020 2020 2020 ePoints =. │ │ │ -00086b80: 2020 6e70 2e61 7363 6f6e 7469 6775 6f75 np.ascontiguou │ │ │ -00086b90: 7361 7272 6179 2844 5b3a 2c3a 325d 292e sarray(D[:,:2]). │ │ │ -00086ba0: 7265 7368 6170 6528 284e 2c31 2c32 2929 reshape((N,1,2)) │ │ │ -00086bb0: 0a20 2020 203c 2f6c 693e 0a20 203c 2f75 .
      • . .
      • . │ │ │ -00086bd0: 5468 6520 6d69 6e69 6d75 6d20 6e75 6d62 The minimum numb │ │ │ -00086be0: 6572 206f 6620 706f 696e 7473 2069 7320 er of points is │ │ │ -00086bf0: 3420 696e 2074 6865 2067 656e 6572 616c 4 in the general │ │ │ -00086c00: 2063 6173 652e 2049 6e20 7468 6520 6361 case. In the ca │ │ │ -00086c10: 7365 206f 6620 5245 463a 2053 4f4c 5645 se of REF: SOLVE │ │ │ -00086c20: 504e 505f 5033 5020 616e 6420 5245 463a PNP_P3P and REF: │ │ │ -00086c30: 2053 4f4c 5645 504e 505f 4150 3350 0a20 SOLVEPNP_AP3P. │ │ │ -00086c40: 2020 2020 2020 6d65 7468 6f64 732c 2069 methods, i │ │ │ -00086c50: 7420 6973 2072 6571 7569 7265 6420 746f t is required to │ │ │ -00086c60: 2075 7365 2065 7861 6374 6c79 2034 2070 use exactly 4 p │ │ │ -00086c70: 6f69 6e74 7320 2874 6865 2066 6972 7374 oints (the first │ │ │ -00086c80: 2033 2070 6f69 6e74 7320 6172 6520 7573 3 points are us │ │ │ -00086c90: 6564 2074 6f20 6573 7469 6d61 7465 2061 ed to estimate a │ │ │ -00086ca0: 6c6c 2074 6865 2073 6f6c 7574 696f 6e73 ll the solutions │ │ │ -00086cb0: 0a20 2020 2020 2020 6f66 2074 6865 2050 . of the P │ │ │ -00086cc0: 3350 2070 726f 626c 656d 2c20 7468 6520 3P problem, the │ │ │ -00086cd0: 6c61 7374 206f 6e65 2069 7320 7573 6564 last one is used │ │ │ -00086ce0: 2074 6f20 7265 7461 696e 2074 6865 2062 to retain the b │ │ │ -00086cf0: 6573 7420 736f 6c75 7469 6f6e 2074 6861 est solution tha │ │ │ -00086d00: 7420 6d69 6e69 6d69 7a65 7320 7468 6520 t minimizes the │ │ │ -00086d10: 7265 7072 6f6a 6563 7469 6f6e 2065 7272 reprojection err │ │ │ -00086d20: 6f72 292e 0a20 203c 2f6c 693e 0a20 203c or)..
      • . < │ │ │ -00086d30: 6c69 3e0a 2020 2020 2020 5769 7468 2052 li>. With R │ │ │ -00086d40: 4546 3a20 534f 4c56 4550 4e50 5f49 5445 EF: SOLVEPNP_ITE │ │ │ -00086d50: 5241 5449 5645 206d 6574 686f 6420 616e RATIVE method an │ │ │ -00086d60: 6420 3c63 6f64 653e 7573 6545 7874 7269 d useExtri │ │ │ -00086d70: 6e73 6963 4775 6573 733d 7472 7565 3c2f nsicGuess=true, the minim │ │ │ -00086d90: 756d 206e 756d 6265 7220 6f66 2070 6f69 um number of poi │ │ │ -00086da0: 6e74 7320 6973 2033 2028 3320 706f 696e nts is 3 (3 poin │ │ │ -00086db0: 7473 0a20 2020 2020 2020 6172 6520 7375 ts. are su │ │ │ -00086dc0: 6666 6963 6965 6e74 2074 6f20 636f 6d70 fficient to comp │ │ │ -00086dd0: 7574 6520 6120 706f 7365 2062 7574 2074 ute a pose but t │ │ │ -00086de0: 6865 7265 2061 7265 2075 7020 746f 2034 here are up to 4 │ │ │ -00086df0: 2073 6f6c 7574 696f 6e73 292e 2054 6865 solutions). The │ │ │ -00086e00: 2069 6e69 7469 616c 2073 6f6c 7574 696f initial solutio │ │ │ -00086e10: 6e20 7368 6f75 6c64 2062 6520 636c 6f73 n should be clos │ │ │ -00086e20: 6520 746f 2074 6865 0a20 2020 2020 2020 e to the. │ │ │ -00086e30: 676c 6f62 616c 2073 6f6c 7574 696f 6e20 global solution │ │ │ -00086e40: 746f 2063 6f6e 7665 7267 652e 0a20 203c to converge.. < │ │ │ -00086e50: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2020 /li>.
      • . │ │ │ -00086e60: 2020 5769 7468 2052 4546 3a20 534f 4c56 With REF: SOLV │ │ │ -00086e70: 4550 4e50 5f49 5050 4520 696e 7075 7420 EPNP_IPPE input │ │ │ -00086e80: 706f 696e 7473 206d 7573 7420 6265 2026 points must be & │ │ │ -00086e90: 6774 3b3d 2034 2061 6e64 206f 626a 6563 gt;= 4 and objec │ │ │ -00086ea0: 7420 706f 696e 7473 206d 7573 7420 6265 t points must be │ │ │ -00086eb0: 2063 6f70 6c61 6e61 722e 0a20 203c 2f6c coplanar.. .
      • . │ │ │ -00086ed0: 5769 7468 2052 4546 3a20 534f 4c56 4550 With REF: SOLVEP │ │ │ -00086ee0: 4e50 5f49 5050 455f 5351 5541 5245 2074 NP_IPPE_SQUARE t │ │ │ -00086ef0: 6869 7320 6973 2061 2073 7065 6369 616c his is a special │ │ │ -00086f00: 2063 6173 6520 7375 6974 6162 6c65 2066 case suitable f │ │ │ -00086f10: 6f72 206d 6172 6b65 7220 706f 7365 2065 or marker pose e │ │ │ -00086f20: 7374 696d 6174 696f 6e2e 0a20 2020 2020 stimation.. │ │ │ -00086f30: 2020 4e75 6d62 6572 206f 6620 696e 7075 Number of inpu │ │ │ -00086f40: 7420 706f 696e 7473 206d 7573 7420 6265 t points must be │ │ │ -00086f50: 2034 2e20 4f62 6a65 6374 2070 6f69 6e74 4. Object point │ │ │ -00086f60: 7320 6d75 7374 2062 6520 6465 6669 6e65 s must be define │ │ │ -00086f70: 6420 696e 2074 6865 2066 6f6c 6c6f 7769 d in the followi │ │ │ -00086f80: 6e67 206f 7264 6572 3a0a 2020 3c75 6c3e ng order:.
          │ │ │ -00086f90: 0a20 2020 203c 6c69 3e0a 2020 2020 2020 .
        • . │ │ │ -00086fa0: 2020 2020 706f 696e 7420 303a 205b 2d73 point 0: [-s │ │ │ -00086fb0: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ -00086fc0: 2020 7371 7561 7265 4c65 6e67 7468 202f squareLength / │ │ │ -00086fd0: 2032 2c20 305d 0a20 2020 203c 2f6c 693e 2, 0].
        • │ │ │ -00086fe0: 0a20 2020 203c 6c69 3e0a 2020 2020 2020 .
        • . │ │ │ -00086ff0: 2020 2020 706f 696e 7420 313a 205b 2073 point 1: [ s │ │ │ -00087000: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ -00087010: 2020 7371 7561 7265 4c65 6e67 7468 202f squareLength / │ │ │ -00087020: 2032 2c20 305d 0a20 2020 203c 2f6c 693e 2, 0].
        • │ │ │ -00087030: 0a20 2020 203c 6c69 3e0a 2020 2020 2020 .
        • . │ │ │ -00087040: 2020 2020 706f 696e 7420 323a 205b 2073 point 2: [ s │ │ │ -00087050: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ -00087060: 202d 7371 7561 7265 4c65 6e67 7468 202f -squareLength / │ │ │ -00087070: 2032 2c20 305d 0a20 2020 203c 2f6c 693e 2, 0].
        • │ │ │ -00087080: 0a20 2020 203c 6c69 3e0a 2020 2020 2020 .
        • . │ │ │ -00087090: 2020 2020 706f 696e 7420 333a 205b 2d73 point 3: [-s │ │ │ -000870a0: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ -000870b0: 202d 7371 7561 7265 4c65 6e67 7468 202f -squareLength / │ │ │ -000870c0: 2032 2c20 305d 0a20 2020 203c 2f6c 693e 2, 0].
        • │ │ │ -000870d0: 0a20 203c 2f75 6c3e 0a20 203c 6c69 3e0a .
        .
      • . │ │ │ -000870e0: 2020 2020 2020 5769 7468 2052 4546 3a20 With REF: │ │ │ -000870f0: 534f 4c56 4550 4e50 5f53 5150 4e50 2069 SOLVEPNP_SQPNP i │ │ │ -00087100: 6e70 7574 2070 6f69 6e74 7320 6d75 7374 nput points must │ │ │ -00087110: 2062 6520 2667 743b 3d20 330a 2020 3c2f be >= 3. .
    .< │ │ │ -00087130: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ -00087140: 0a3c 6464 3e61 7574 6f6d 6174 6963 616c .
    automatical │ │ │ -00087150: 6c79 2067 656e 6572 6174 6564 3c2f 6464 ly generated
    .
    .
    .< │ │ │ -00087170: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ -00087180: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .solvePnPGeneri │ │ │ -00087240: 633c 2f68 333e 0a3c 6469 7620 636c 6173 c.
    .
    pub │ │ │ -000872a0: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static int  │ │ │ -000872e0: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;solv │ │ │ -00087300: 6550 6e50 4765 6e65 7269 633c 2f73 7061 ePnPGeneric │ │ │ -00087330: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ -00087370: 3c2f 613e 266e 6273 703b 6f62 6a65 6374  object │ │ │ -00087380: 506f 696e 7473 2c0a 203c 6120 6872 6566 Points,. Mat&nbs │ │ │ -000873d0: 703b 696d 6167 6550 6f69 6e74 732c 0a20 p;imagePoints,. │ │ │ -000873e0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -00087420: 2f61 3e26 6e62 7370 3b63 616d 6572 614d /a> cameraM │ │ │ -00087430: 6174 7269 782c 0a20 3c61 2068 7265 663d atrix,. Mat  │ │ │ -00087480: 3b64 6973 7443 6f65 6666 732c 0a20 3c61 ;distCoeffs,. List& │ │ │ -00087530: 6c74 3b3c 6120 6872 6566 3d22 2e2e 2f63 lt;M │ │ │ -00087570: 6174 3c2f 613e 2667 743b 266e 6273 703b at>  │ │ │ -00087580: 7276 6563 732c 0a20 3c61 2068 7265 663d rvecs,. List<Mat │ │ │ -00087670: 2667 743b 266e 6273 703b 7476 6563 732c > tvecs, │ │ │ -00087680: 0a20 626f 6f6c 6561 6e26 6e62 7370 3b75 . boolean u │ │ │ -00087690: 7365 4578 7472 696e 7369 6347 7565 7373 seExtrinsicGuess │ │ │ -000876a0: 2c0a 2069 6e74 266e 6273 703b 666c 6167 ,. int flag │ │ │ -000876b0: 7329 3c2f 7370 616e 3e3c 2f64 6976 3e0a s)
    . │ │ │ -000876c0: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Finds an obje │ │ │ -000876e0: 6374 2070 6f73 6520 5c28 207b 7d5e 7b63 ct pose \( {}^{c │ │ │ -000876f0: 7d5c 6d61 7468 6266 7b54 7d5f 6f20 5c29 }\mathbf{T}_o \) │ │ │ -00087700: 2066 726f 6d20 3344 2d32 4420 706f 696e from 3D-2D poin │ │ │ -00087710: 7420 636f 7272 6573 706f 6e64 656e 6365 t correspondence │ │ │ -00087720: 732e 0a0a 215b 5065 7273 7065 6374 6976 s...![Perspectiv │ │ │ -00087730: 6520 7072 6f6a 6563 7469 6f6e 2c20 6672 e projection, fr │ │ │ -00087740: 6f6d 206f 626a 6563 7420 746f 2063 616d om object to cam │ │ │ -00087750: 6572 6120 6672 616d 655d 2870 6963 732f era frame](pics/ │ │ │ -00087760: 7069 6e68 6f6c 655f 686f 6d6f 6765 6e65 pinhole_homogene │ │ │ -00087770: 6f75 735f 7472 616e 7366 6f72 6d61 7469 ous_transformati │ │ │ -00087780: 6f6e 2e6a 7067 297b 2077 6964 7468 3d35 on.jpg){ width=5 │ │ │ -00087790: 3025 207d 0a0a 5345 453a 2052 4546 3a20 0% }..SEE: REF: │ │ │ -000877a0: 6361 6c69 6233 645f 736f 6c76 6550 6e50 calib3d_solvePnP │ │ │ -000877b0: 0a0a 5468 6973 2066 756e 6374 696f 6e20 ..This function │ │ │ -000877c0: 7265 7475 726e 7320 6120 6c69 7374 206f returns a list o │ │ │ -000877d0: 6620 616c 6c20 7468 6520 706f 7373 6962 f all the possib │ │ │ -000877e0: 6c65 2073 6f6c 7574 696f 6e73 2028 6120 le solutions (a │ │ │ -000877f0: 736f 6c75 7469 6f6e 2069 7320 6120 266c solution is a &l │ │ │ -00087800: 743b 726f 7461 7469 6f6e 2076 6563 746f t;rotation vecto │ │ │ -00087810: 722c 2074 7261 6e73 6c61 7469 6f6e 2076 r, translation v │ │ │ -00087820: 6563 746f 7226 6774 3b0a 636f 7570 6c65 ector>.couple │ │ │ -00087830: 292c 2064 6570 656e 6469 6e67 206f 6e20 ), depending on │ │ │ -00087840: 7468 6520 6e75 6d62 6572 206f 6620 696e the number of in │ │ │ -00087850: 7075 7420 706f 696e 7473 2061 6e64 2074 put points and t │ │ │ -00087860: 6865 2063 686f 7365 6e20 6d65 7468 6f64 he chosen method │ │ │ -00087870: 3a0a 3c75 6c3e 0a20 203c 6c69 3e0a 2050 :.
      .
    • . P │ │ │ -00087880: 3350 206d 6574 686f 6473 2028 5245 463a 3P methods (REF: │ │ │ -00087890: 2053 4f4c 5645 504e 505f 5033 502c 2052 SOLVEPNP_P3P, R │ │ │ -000878a0: 4546 3a20 534f 4c56 4550 4e50 5f41 5033 EF: SOLVEPNP_AP3 │ │ │ -000878b0: 5029 3a20 3320 6f72 2034 2069 6e70 7574 P): 3 or 4 input │ │ │ -000878c0: 2070 6f69 6e74 732e 204e 756d 6265 7220 points. Number │ │ │ -000878d0: 6f66 2072 6574 7572 6e65 6420 736f 6c75 of returned solu │ │ │ -000878e0: 7469 6f6e 7320 6361 6e20 6265 2062 6574 tions can be bet │ │ │ -000878f0: 7765 656e 2030 2061 6e64 2034 2077 6974 ween 0 and 4 wit │ │ │ -00087900: 6820 3320 696e 7075 7420 706f 696e 7473 h 3 input points │ │ │ -00087910: 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c 693e ..
    • .
    • │ │ │ -00087920: 0a20 5245 463a 2053 4f4c 5645 504e 505f . REF: SOLVEPNP_ │ │ │ -00087930: 4950 5045 2049 6e70 7574 2070 6f69 6e74 IPPE Input point │ │ │ -00087940: 7320 6d75 7374 2062 6520 2667 743b 3d20 s must be >= │ │ │ -00087950: 3420 616e 6420 6f62 6a65 6374 2070 6f69 4 and object poi │ │ │ -00087960: 6e74 7320 6d75 7374 2062 6520 636f 706c nts must be copl │ │ │ -00087970: 616e 6172 2e20 5265 7475 726e 7320 3220 anar. Returns 2 │ │ │ -00087980: 736f 6c75 7469 6f6e 732e 0a20 203c 2f6c solutions.. .
    • . REF: │ │ │ -000879a0: 534f 4c56 4550 4e50 5f49 5050 455f 5351 SOLVEPNP_IPPE_SQ │ │ │ -000879b0: 5541 5245 2053 7065 6369 616c 2063 6173 UARE Special cas │ │ │ -000879c0: 6520 7375 6974 6162 6c65 2066 6f72 206d e suitable for m │ │ │ -000879d0: 6172 6b65 7220 706f 7365 2065 7374 696d arker pose estim │ │ │ -000879e0: 6174 696f 6e2e 0a4e 756d 6265 7220 6f66 ation..Number of │ │ │ -000879f0: 2069 6e70 7574 2070 6f69 6e74 7320 6d75 input points mu │ │ │ -00087a00: 7374 2062 6520 3420 616e 6420 3220 736f st be 4 and 2 so │ │ │ -00087a10: 6c75 7469 6f6e 7320 6172 6520 7265 7475 lutions are retu │ │ │ -00087a20: 726e 6564 2e20 4f62 6a65 6374 2070 6f69 rned. Object poi │ │ │ -00087a30: 6e74 7320 6d75 7374 2062 6520 6465 6669 nts must be defi │ │ │ -00087a40: 6e65 6420 696e 2074 6865 2066 6f6c 6c6f ned in the follo │ │ │ -00087a50: 7769 6e67 206f 7264 6572 3a0a 2020 3c75 wing order:. .
    • . p │ │ │ -00087a70: 6f69 6e74 2030 3a20 5b2d 7371 7561 7265 oint 0: [-square │ │ │ -00087a80: 4c65 6e67 7468 202f 2032 2c20 2073 7175 Length / 2, squ │ │ │ -00087a90: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ -00087aa0: 5d0a 2020 2020 3c2f 6c69 3e0a 2020 2020 ].
    • . │ │ │ -00087ab0: 3c6c 693e 0a20 2020 706f 696e 7420 313a
    • . point 1: │ │ │ -00087ac0: 205b 2073 7175 6172 654c 656e 6774 6820 [ squareLength │ │ │ -00087ad0: 2f20 322c 2020 7371 7561 7265 4c65 6e67 / 2, squareLeng │ │ │ -00087ae0: 7468 202f 2032 2c20 305d 0a20 2020 203c th / 2, 0]. < │ │ │ -00087af0: 2f6c 693e 0a20 2020 203c 6c69 3e0a 2020 /li>.
    • . │ │ │ -00087b00: 2070 6f69 6e74 2032 3a20 5b20 7371 7561 point 2: [ squa │ │ │ -00087b10: 7265 4c65 6e67 7468 202f 2032 2c20 2d73 reLength / 2, -s │ │ │ -00087b20: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ -00087b30: 2030 5d0a 2020 2020 3c2f 6c69 3e0a 2020 0].
    • . │ │ │ -00087b40: 2020 3c6c 693e 0a20 2020 706f 696e 7420
    • . point │ │ │ -00087b50: 333a 205b 2d73 7175 6172 654c 656e 6774 3: [-squareLengt │ │ │ -00087b60: 6820 2f20 322c 202d 7371 7561 7265 4c65 h / 2, -squareLe │ │ │ -00087b70: 6e67 7468 202f 2032 2c20 305d 0a20 2020 ngth / 2, 0]. │ │ │ -00087b80: 203c 2f6c 693e 0a20 203c 2f75 6c3e 0a20
    • .
    . │ │ │ -00087b90: 203c 6c69 3e0a 2066 6f72 2061 6c6c 2074
  • . for all t │ │ │ -00087ba0: 6865 206f 7468 6572 2066 6c61 6773 2c20 he other flags, │ │ │ -00087bb0: 6e75 6d62 6572 206f 6620 696e 7075 7420 number of input │ │ │ -00087bc0: 706f 696e 7473 206d 7573 7420 6265 2026 points must be & │ │ │ -00087bd0: 6774 3b3d 2034 2061 6e64 206f 626a 6563 gt;= 4 and objec │ │ │ -00087be0: 7420 706f 696e 7473 2063 616e 2062 6520 t points can be │ │ │ -00087bf0: 696e 2061 6e79 2063 6f6e 6669 6775 7261 in any configura │ │ │ -00087c00: 7469 6f6e 2e0a 4f6e 6c79 2031 2073 6f6c tion..Only 1 sol │ │ │ -00087c10: 7574 696f 6e20 6973 2072 6574 7572 6e65 ution is returne │ │ │ -00087c20: 642e 0a20 203c 2f6c 693e 0a3c 2f75 6c3e d..
  • . │ │ │ -00087c30: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -00087c50: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -00087c60: 6464 3e3c 636f 6465 3e6f 626a 6563 7450 dd>objectP │ │ │ -00087c70: 6f69 6e74 733c 2f63 6f64 653e 202d 2041 oints - A │ │ │ -00087c80: 7272 6179 206f 6620 6f62 6a65 6374 2070 rray of object p │ │ │ -00087c90: 6f69 6e74 7320 696e 2074 6865 206f 626a oints in the obj │ │ │ -00087ca0: 6563 7420 636f 6f72 6469 6e61 7465 2073 ect coordinate s │ │ │ -00087cb0: 7061 6365 2c20 4e78 3320 312d 6368 616e pace, Nx3 1-chan │ │ │ -00087cc0: 6e65 6c20 6f72 0a31 784e 2f4e 7831 2033 nel or.1xN/Nx1 3 │ │ │ -00087cd0: 2d63 6861 6e6e 656c 2c20 7768 6572 6520 -channel, where │ │ │ -00087ce0: 4e20 6973 2074 6865 206e 756d 6265 7220 N is the number │ │ │ -00087cf0: 6f66 2070 6f69 6e74 732e 2076 6563 746f of points. vecto │ │ │ -00087d00: 7226 6c74 3b50 6f69 6e74 3364 2667 743b r<Point3d> │ │ │ -00087d10: 2063 616e 2062 6520 616c 736f 2070 6173 can be also pas │ │ │ -00087d20: 7365 6420 6865 7265 2e3c 2f64 643e 0a3c sed here..< │ │ │ -00087d30: 6464 3e3c 636f 6465 3e69 6d61 6765 506f dd>imagePo │ │ │ -00087d40: 696e 7473 3c2f 636f 6465 3e20 2d20 4172 ints - Ar │ │ │ -00087d50: 7261 7920 6f66 2063 6f72 7265 7370 6f6e ray of correspon │ │ │ -00087d60: 6469 6e67 2069 6d61 6765 2070 6f69 6e74 ding image point │ │ │ -00087d70: 732c 204e 7832 2031 2d63 6861 6e6e 656c s, Nx2 1-channel │ │ │ -00087d80: 206f 7220 3178 4e2f 4e78 3120 322d 6368 or 1xN/Nx1 2-ch │ │ │ -00087d90: 616e 6e65 6c2c 0a77 6865 7265 204e 2069 annel,.where N i │ │ │ -00087da0: 7320 7468 6520 6e75 6d62 6572 206f 6620 s the number of │ │ │ -00087db0: 706f 696e 7473 2e20 7665 6374 6f72 266c points. vector&l │ │ │ -00087dc0: 743b 506f 696e 7432 6426 6774 3b20 6361 t;Point2d> ca │ │ │ -00087dd0: 6e20 6265 2061 6c73 6f20 7061 7373 6564 n be also passed │ │ │ -00087de0: 2068 6572 652e 3c2f 6464 3e0a 3c64 643e here..
    │ │ │ -00087df0: 3c63 6f64 653e 6361 6d65 7261 4d61 7472 cameraMatr │ │ │ -00087e00: 6978 3c2f 636f 6465 3e20 2d20 496e 7075 ix - Inpu │ │ │ -00087e10: 7420 6361 6d65 7261 2069 6e74 7269 6e73 t camera intrins │ │ │ -00087e20: 6963 206d 6174 7269 7820 5c28 5c63 616d ic matrix \(\cam │ │ │ -00087e30: 6572 616d 6174 7269 787b 417d 5c29 202e eramatrix{A}\) . │ │ │ -00087e40: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -00087e50: 6469 7374 436f 6566 6673 3c2f 636f 6465 distCoeffs - Input vector │ │ │ -00087e70: 206f 6620 6469 7374 6f72 7469 6f6e 2063 of distortion c │ │ │ -00087e80: 6f65 6666 6963 6965 6e74 730a 5c28 5c64 oefficients.\(\d │ │ │ -00087e90: 6973 7463 6f65 6666 735c 292e 2049 6620 istcoeffs\). If │ │ │ -00087ea0: 7468 6520 7665 6374 6f72 2069 7320 4e55 the vector is NU │ │ │ -00087eb0: 4c4c 2f65 6d70 7479 2c20 7468 6520 7a65 LL/empty, the ze │ │ │ -00087ec0: 726f 2064 6973 746f 7274 696f 6e20 636f ro distortion co │ │ │ -00087ed0: 6566 6669 6369 656e 7473 2061 7265 0a61 efficients are.a │ │ │ -00087ee0: 7373 756d 6564 2e3c 2f64 643e 0a3c 6464 ssumed.
    .
    rvecs - Vector of │ │ │ -00087f10: 6f75 7470 7574 2072 6f74 6174 696f 6e20 output rotation │ │ │ -00087f20: 7665 6374 6f72 7320 2873 6565 2052 4546 vectors (see REF │ │ │ -00087f30: 3a20 526f 6472 6967 7565 7320 2920 7468 : Rodrigues ) th │ │ │ -00087f40: 6174 2c20 746f 6765 7468 6572 2077 6974 at, together wit │ │ │ -00087f50: 6820 7476 6563 732c 2062 7269 6e67 7320 h tvecs, brings │ │ │ -00087f60: 706f 696e 7473 2066 726f 6d0a 7468 6520 points from.the │ │ │ -00087f70: 6d6f 6465 6c20 636f 6f72 6469 6e61 7465 model coordinate │ │ │ -00087f80: 2073 7973 7465 6d20 746f 2074 6865 2063 system to the c │ │ │ -00087f90: 616d 6572 6120 636f 6f72 6469 6e61 7465 amera coordinate │ │ │ -00087fa0: 2073 7973 7465 6d2e 3c2f 6464 3e0a 3c64 system.
    .tvecs - Vector of │ │ │ -00087fd0: 206f 7574 7075 7420 7472 616e 736c 6174 output translat │ │ │ -00087fe0: 696f 6e20 7665 6374 6f72 732e 3c2f 6464 ion vectors..
    useE │ │ │ -00088000: 7874 7269 6e73 6963 4775 6573 733c 2f63 xtrinsicGuess - Parameter │ │ │ -00088020: 2075 7365 6420 666f 7220 2353 4f4c 5645 used for #SOLVE │ │ │ -00088030: 504e 505f 4954 4552 4154 4956 452e 2049 PNP_ITERATIVE. I │ │ │ -00088040: 6620 7472 7565 2028 3129 2c20 7468 6520 f true (1), the │ │ │ -00088050: 6675 6e63 7469 6f6e 2075 7365 730a 7468 function uses.th │ │ │ -00088060: 6520 7072 6f76 6964 6564 2072 7665 6320 e provided rvec │ │ │ -00088070: 616e 6420 7476 6563 2076 616c 7565 7320 and tvec values │ │ │ -00088080: 6173 2069 6e69 7469 616c 2061 7070 726f as initial appro │ │ │ -00088090: 7869 6d61 7469 6f6e 7320 6f66 2074 6865 ximations of the │ │ │ -000880a0: 2072 6f74 6174 696f 6e20 616e 6420 7472 rotation and tr │ │ │ -000880b0: 616e 736c 6174 696f 6e0a 7665 6374 6f72 anslation.vector │ │ │ -000880c0: 732c 2072 6573 7065 6374 6976 656c 792c s, respectively, │ │ │ -000880d0: 2061 6e64 2066 7572 7468 6572 206f 7074 and further opt │ │ │ -000880e0: 696d 697a 6573 2074 6865 6d2e 3c2f 6464 imizes them.
    .
    flag │ │ │ -00088100: 733c 2f63 6f64 653e 202d 204d 6574 686f s - Metho │ │ │ -00088110: 6420 666f 7220 736f 6c76 696e 6720 6120 d for solving a │ │ │ -00088120: 506e 5020 7072 6f62 6c65 6d3a 2073 6565 PnP problem: see │ │ │ -00088130: 2052 4546 3a20 6361 6c69 6233 645f 736f REF: calib3d_so │ │ │ -00088140: 6c76 6550 6e50 5f66 6c61 6773 0a61 6e64 lvePnP_flags.and │ │ │ -00088150: 2075 7365 4578 7472 696e 7369 6347 7565 useExtrinsicGue │ │ │ -00088160: 7373 2069 7320 7365 7420 746f 2074 7275 ss is set to tru │ │ │ -00088170: 652e 0a61 6e64 2075 7365 4578 7472 696e e..and useExtrin │ │ │ -00088180: 7369 6347 7565 7373 2069 7320 7365 7420 sicGuess is set │ │ │ -00088190: 746f 2074 7275 652e 0a28 5c28 205c 7465 to true..(\( \te │ │ │ -000881a0: 7874 7b52 4d53 457d 203d 205c 7371 7274 xt{RMSE} = \sqrt │ │ │ -000881b0: 7b5c 6672 6163 7b5c 7375 6d5f 7b69 7d5e {\frac{\sum_{i}^ │ │ │ -000881c0: 7b4e 7d20 5c6c 6566 7420 2820 5c68 6174 {N} \left ( \hat │ │ │ -000881d0: 7b79 5f69 7d20 2d20 795f 6920 5c72 6967 {y_i} - y_i \rig │ │ │ -000881e0: 6874 2029 5e32 7d7b 4e7d 7d20 5c29 2920 ht )^2}{N}} \)) │ │ │ -000881f0: 6265 7477 6565 6e20 7468 6520 696e 7075 between the inpu │ │ │ -00088200: 7420 696d 6167 6520 706f 696e 7473 0a61 t image points.a │ │ │ -00088210: 6e64 2074 6865 2033 4420 6f62 6a65 6374 nd the 3D object │ │ │ -00088220: 2070 6f69 6e74 7320 7072 6f6a 6563 7465 points projecte │ │ │ -00088230: 6420 7769 7468 2074 6865 2065 7374 696d d with the estim │ │ │ -00088240: 6174 6564 2070 6f73 652e 0a0a 4d6f 7265 ated pose...More │ │ │ -00088250: 2069 6e66 6f72 6d61 7469 6f6e 2069 7320 information is │ │ │ -00088260: 6465 7363 7269 6265 6420 696e 2052 4546 described in REF │ │ │ -00088270: 3a20 6361 6c69 6233 645f 736f 6c76 6550 : calib3d_solveP │ │ │ -00088280: 6e50 0a0a 3c62 3e4e 6f74 653a 3c2f 623e nP..Note: │ │ │ -00088290: 0a3c 756c 3e0a 2020 3c6c 693e 0a20 2020 .
      .
    • . │ │ │ -000882a0: 2020 2041 6e20 6578 616d 706c 6520 6f66 An example of │ │ │ -000882b0: 2068 6f77 2074 6f20 7573 6520 736f 6c76 how to use solv │ │ │ -000882c0: 6550 6e50 2066 6f72 2070 6c61 6e61 7220 ePnP for planar │ │ │ -000882d0: 6175 676d 656e 7465 6420 7265 616c 6974 augmented realit │ │ │ -000882e0: 7920 6361 6e20 6265 2066 6f75 6e64 2061 y can be found a │ │ │ -000882f0: 740a 2020 2020 2020 2020 6f70 656e 6376 t. opencv │ │ │ -00088300: 5f73 6f75 7263 655f 636f 6465 2f73 616d _source_code/sam │ │ │ -00088310: 706c 6573 2f70 7974 686f 6e2f 706c 616e ples/python/plan │ │ │ -00088320: 655f 6172 2e70 790a 2020 3c2f 6c69 3e0a e_ar.py.
    • . │ │ │ -00088330: 2020 3c6c 693e 0a20 2020 2020 2049 6620
    • . If │ │ │ -00088340: 796f 7520 6172 6520 7573 696e 6720 5079 you are using Py │ │ │ -00088350: 7468 6f6e 3a0a 2020 3c75 6c3e 0a20 2020 thon:.
        . │ │ │ -00088360: 203c 6c69 3e0a 2020 2020 2020 2020 204e
      • . N │ │ │ -00088370: 756d 7079 2061 7272 6179 2073 6c69 6365 umpy array slice │ │ │ -00088380: 7320 776f 6e27 7420 776f 726b 2061 7320 s won't work as │ │ │ -00088390: 696e 7075 7420 6265 6361 7573 6520 736f input because so │ │ │ -000883a0: 6c76 6550 6e50 2072 6571 7569 7265 7320 lvePnP requires │ │ │ -000883b0: 636f 6e74 6967 756f 7573 0a20 2020 2020 contiguous. │ │ │ -000883c0: 2020 2061 7272 6179 7320 2865 6e66 6f72 arrays (enfor │ │ │ -000883d0: 6365 6420 6279 2074 6865 2061 7373 6572 ced by the asser │ │ │ -000883e0: 7469 6f6e 2075 7369 6e67 2063 763a 3a4d tion using cv::M │ │ │ -000883f0: 6174 3a3a 6368 6563 6b56 6563 746f 7228 at::checkVector( │ │ │ -00088400: 2920 6172 6f75 6e64 206c 696e 6520 3535 ) around line 55 │ │ │ -00088410: 206f 660a 2020 2020 2020 2020 6d6f 6475 of. modu │ │ │ -00088420: 6c65 732f 3364 2f73 7263 2f73 6f6c 7665 les/3d/src/solve │ │ │ -00088430: 706e 702e 6370 7020 7665 7273 696f 6e20 pnp.cpp version │ │ │ -00088440: 322e 342e 3929 0a20 2020 203c 2f6c 693e 2.4.9).
      • │ │ │ -00088450: 0a20 2020 203c 6c69 3e0a 2020 2020 2020 .
      • . │ │ │ -00088460: 2020 2054 6865 2050 3350 2061 6c67 6f72 The P3P algor │ │ │ -00088470: 6974 686d 2072 6571 7569 7265 7320 696d ithm requires im │ │ │ -00088480: 6167 6520 706f 696e 7473 2074 6f20 6265 age points to be │ │ │ -00088490: 2069 6e20 616e 2061 7272 6179 206f 6620 in an array of │ │ │ -000884a0: 7368 6170 6520 284e 2c31 2c32 2920 6475 shape (N,1,2) du │ │ │ -000884b0: 650a 2020 2020 2020 2020 746f 2069 7473 e. to its │ │ │ -000884c0: 2063 616c 6c69 6e67 206f 6620 2375 6e64 calling of #und │ │ │ -000884d0: 6973 746f 7274 506f 696e 7473 2028 6172 istortPoints (ar │ │ │ -000884e0: 6f75 6e64 206c 696e 6520 3735 206f 6620 ound line 75 of │ │ │ -000884f0: 6d6f 6475 6c65 732f 3364 2f73 7263 2f73 modules/3d/src/s │ │ │ -00088500: 6f6c 7665 706e 702e 6370 7020 7665 7273 olvepnp.cpp vers │ │ │ -00088510: 696f 6e20 322e 342e 3929 0a20 2020 2020 ion 2.4.9). │ │ │ -00088520: 2020 2077 6869 6368 2072 6571 7569 7265 which require │ │ │ -00088530: 7320 322d 6368 616e 6e65 6c20 696e 666f s 2-channel info │ │ │ -00088540: 726d 6174 696f 6e2e 0a20 2020 203c 2f6c rmation.. .
      • . │ │ │ -00088560: 2020 2020 2054 6875 732c 2067 6976 656e Thus, given │ │ │ -00088570: 2073 6f6d 6520 6461 7461 2044 203d 206e some data D = n │ │ │ -00088580: 702e 6172 7261 7928 2e2e 2e29 2077 6865 p.array(...) whe │ │ │ -00088590: 7265 2044 2e73 6861 7065 203d 2028 4e2c re D.shape = (N, │ │ │ -000885a0: 4d29 2c20 696e 206f 7264 6572 2074 6f20 M), in order to │ │ │ -000885b0: 7573 6520 6120 7375 6273 6574 206f 660a use a subset of. │ │ │ -000885c0: 2020 2020 2020 2020 6974 2061 732c 2065 it as, e │ │ │ -000885d0: 2e67 2e2c 2069 6d61 6765 506f 696e 7473 .g., imagePoints │ │ │ -000885e0: 2c20 6f6e 6520 6d75 7374 2065 6666 6563 , one must effec │ │ │ -000885f0: 7469 7665 6c79 2063 6f70 7920 6974 2069 tively copy it i │ │ │ -00088600: 6e74 6f20 6120 6e65 7720 6172 7261 793a nto a new array: │ │ │ -00088610: 2069 6d61 6765 506f 696e 7473 203d 0a20 imagePoints =. │ │ │ -00088620: 2020 2020 2020 206e 702e 6173 636f 6e74 np.ascont │ │ │ -00088630: 6967 756f 7573 6172 7261 7928 445b 3a2c iguousarray(D[:, │ │ │ -00088640: 3a32 5d29 2e72 6573 6861 7065 2828 4e2c :2]).reshape((N, │ │ │ -00088650: 312c 3229 290a 2020 2020 3c2f 6c69 3e0a 1,2)).
      • . │ │ │ -00088660: 2020 3c2f 756c 3e0a 2020 3c6c 693e 0a20
      .
    • . │ │ │ -00088670: 2020 2020 2054 6865 206d 696e 696d 756d The minimum │ │ │ -00088680: 206e 756d 6265 7220 6f66 2070 6f69 6e74 number of point │ │ │ -00088690: 7320 6973 2034 2069 6e20 7468 6520 6765 s is 4 in the ge │ │ │ -000886a0: 6e65 7261 6c20 6361 7365 2e20 496e 2074 neral case. In t │ │ │ -000886b0: 6865 2063 6173 6520 6f66 2052 4546 3a20 he case of REF: │ │ │ -000886c0: 534f 4c56 4550 4e50 5f50 3350 2061 6e64 SOLVEPNP_P3P and │ │ │ -000886d0: 2052 4546 3a20 534f 4c56 4550 4e50 5f41 REF: SOLVEPNP_A │ │ │ -000886e0: 5033 500a 2020 2020 2020 206d 6574 686f P3P. metho │ │ │ -000886f0: 6473 2c20 6974 2069 7320 7265 7175 6972 ds, it is requir │ │ │ -00088700: 6564 2074 6f20 7573 6520 6578 6163 746c ed to use exactl │ │ │ -00088710: 7920 3420 706f 696e 7473 2028 7468 6520 y 4 points (the │ │ │ -00088720: 6669 7273 7420 3320 706f 696e 7473 2061 first 3 points a │ │ │ -00088730: 7265 2075 7365 6420 746f 2065 7374 696d re used to estim │ │ │ -00088740: 6174 6520 616c 6c20 7468 6520 736f 6c75 ate all the solu │ │ │ -00088750: 7469 6f6e 730a 2020 2020 2020 206f 6620 tions. of │ │ │ -00088760: 7468 6520 5033 5020 7072 6f62 6c65 6d2c the P3P problem, │ │ │ -00088770: 2074 6865 206c 6173 7420 6f6e 6520 6973 the last one is │ │ │ -00088780: 2075 7365 6420 746f 2072 6574 6169 6e20 used to retain │ │ │ -00088790: 7468 6520 6265 7374 2073 6f6c 7574 696f the best solutio │ │ │ -000887a0: 6e20 7468 6174 206d 696e 696d 697a 6573 n that minimizes │ │ │ -000887b0: 2074 6865 2072 6570 726f 6a65 6374 696f the reprojectio │ │ │ -000887c0: 6e20 6572 726f 7229 2e0a 2020 3c2f 6c69 n error)..
    • .
    • . W │ │ │ -000887e0: 6974 6820 5245 463a 2053 4f4c 5645 504e ith REF: SOLVEPN │ │ │ -000887f0: 505f 4954 4552 4154 4956 4520 6d65 7468 P_ITERATIVE meth │ │ │ -00088800: 6f64 2061 6e64 203c 636f 6465 3e75 7365 od and use │ │ │ -00088810: 4578 7472 696e 7369 6347 7565 7373 3d74 ExtrinsicGuess=t │ │ │ -00088820: 7275 653c 2f63 6f64 653e 2c20 7468 6520 rue, the │ │ │ -00088830: 6d69 6e69 6d75 6d20 6e75 6d62 6572 206f minimum number o │ │ │ -00088840: 6620 706f 696e 7473 2069 7320 3320 2833 f points is 3 (3 │ │ │ -00088850: 2070 6f69 6e74 730a 2020 2020 2020 2061 points. a │ │ │ -00088860: 7265 2073 7566 6669 6369 656e 7420 746f re sufficient to │ │ │ -00088870: 2063 6f6d 7075 7465 2061 2070 6f73 6520 compute a pose │ │ │ -00088880: 6275 7420 7468 6572 6520 6172 6520 7570 but there are up │ │ │ -00088890: 2074 6f20 3420 736f 6c75 7469 6f6e 7329 to 4 solutions) │ │ │ -000888a0: 2e20 5468 6520 696e 6974 6961 6c20 736f . The initial so │ │ │ -000888b0: 6c75 7469 6f6e 2073 686f 756c 6420 6265 lution should be │ │ │ -000888c0: 2063 6c6f 7365 2074 6f20 7468 650a 2020 close to the. │ │ │ -000888d0: 2020 2020 2067 6c6f 6261 6c20 736f 6c75 global solu │ │ │ -000888e0: 7469 6f6e 2074 6f20 636f 6e76 6572 6765 tion to converge │ │ │ -000888f0: 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c 693e ..
    • .
    • │ │ │ -00088900: 0a20 2020 2020 2057 6974 6820 5245 463a . With REF: │ │ │ -00088910: 2053 4f4c 5645 504e 505f 4950 5045 2069 SOLVEPNP_IPPE i │ │ │ -00088920: 6e70 7574 2070 6f69 6e74 7320 6d75 7374 nput points must │ │ │ -00088930: 2062 6520 2667 743b 3d20 3420 616e 6420 be >= 4 and │ │ │ -00088940: 6f62 6a65 6374 2070 6f69 6e74 7320 6d75 object points mu │ │ │ -00088950: 7374 2062 6520 636f 706c 616e 6172 2e0a st be coplanar.. │ │ │ -00088960: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ -00088970: 2020 2020 2057 6974 6820 5245 463a 2053 With REF: S │ │ │ -00088980: 4f4c 5645 504e 505f 4950 5045 5f53 5155 OLVEPNP_IPPE_SQU │ │ │ -00088990: 4152 4520 7468 6973 2069 7320 6120 7370 ARE this is a sp │ │ │ -000889a0: 6563 6961 6c20 6361 7365 2073 7569 7461 ecial case suita │ │ │ -000889b0: 626c 6520 666f 7220 6d61 726b 6572 2070 ble for marker p │ │ │ -000889c0: 6f73 6520 6573 7469 6d61 7469 6f6e 2e0a ose estimation.. │ │ │ -000889d0: 2020 2020 2020 204e 756d 6265 7220 6f66 Number of │ │ │ -000889e0: 2069 6e70 7574 2070 6f69 6e74 7320 6d75 input points mu │ │ │ -000889f0: 7374 2062 6520 342e 204f 626a 6563 7420 st be 4. Object │ │ │ -00088a00: 706f 696e 7473 206d 7573 7420 6265 2064 points must be d │ │ │ -00088a10: 6566 696e 6564 2069 6e20 7468 6520 666f efined in the fo │ │ │ -00088a20: 6c6c 6f77 696e 6720 6f72 6465 723a 0a20 llowing order:. │ │ │ -00088a30: 203c 756c 3e0a 2020 2020 3c6c 693e 0a20
        .
      • . │ │ │ -00088a40: 2020 2020 2020 2020 2070 6f69 6e74 2030 point 0 │ │ │ -00088a50: 3a20 5b2d 7371 7561 7265 4c65 6e67 7468 : [-squareLength │ │ │ -00088a60: 202f 2032 2c20 2073 7175 6172 654c 656e / 2, squareLen │ │ │ -00088a70: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ -00088a80: 3c2f 6c69 3e0a 2020 2020 3c6c 693e 0a20
      • .
      • . │ │ │ -00088a90: 2020 2020 2020 2020 2070 6f69 6e74 2031 point 1 │ │ │ -00088aa0: 3a20 5b20 7371 7561 7265 4c65 6e67 7468 : [ squareLength │ │ │ -00088ab0: 202f 2032 2c20 2073 7175 6172 654c 656e / 2, squareLen │ │ │ -00088ac0: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ -00088ad0: 3c2f 6c69 3e0a 2020 2020 3c6c 693e 0a20
      • .
      • . │ │ │ -00088ae0: 2020 2020 2020 2020 2070 6f69 6e74 2032 point 2 │ │ │ -00088af0: 3a20 5b20 7371 7561 7265 4c65 6e67 7468 : [ squareLength │ │ │ -00088b00: 202f 2032 2c20 2d73 7175 6172 654c 656e / 2, -squareLen │ │ │ -00088b10: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ -00088b20: 3c2f 6c69 3e0a 2020 2020 3c6c 693e 0a20
      • .
      • . │ │ │ -00088b30: 2020 2020 2020 2020 2070 6f69 6e74 2033 point 3 │ │ │ -00088b40: 3a20 5b2d 7371 7561 7265 4c65 6e67 7468 : [-squareLength │ │ │ -00088b50: 202f 2032 2c20 2d73 7175 6172 654c 656e / 2, -squareLen │ │ │ -00088b60: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ -00088b70: 3c2f 6c69 3e0a 2020 3c2f 756c 3e0a 2020
      • .
      . │ │ │ -00088b80: 3c6c 693e 0a20 2020 2020 2057 6974 6820
    • . With │ │ │ -00088b90: 5245 463a 2053 4f4c 5645 504e 505f 5351 REF: SOLVEPNP_SQ │ │ │ -00088ba0: 504e 5020 696e 7075 7420 706f 696e 7473 PNP input points │ │ │ -00088bb0: 206d 7573 7420 6265 2026 6774 3b3d 2033 must be >= 3 │ │ │ -00088bc0: 0a20 203c 2f6c 693e 0a3c 2f75 6c3e 3c2f .
    • .
    .
    Returns: │ │ │ -00088be0: 3c2f 6474 3e0a 3c64 643e 6175 746f 6d61
    .
    automa │ │ │ -00088bf0: 7469 6361 6c6c 7920 6765 6e65 7261 7465 tically generate │ │ │ -00088c00: 643c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 d
    .
    ..
    .< │ │ │ -00088c20: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..< │ │ │ -00088cd0: 6833 3e73 6f6c 7665 506e 5047 656e 6572 h3>solvePnPGener │ │ │ -00088ce0: 6963 3c2f 6833 3e0a 3c64 6976 2063 6c61 ic.
    .
    pu │ │ │ -00088d40: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static int&nbs │ │ │ -00088d80: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;sol │ │ │ -00088da0: 7665 506e 5047 656e 6572 6963 3c2f 7370 vePnPGeneric(Ma │ │ │ -00088e10: 743c 2f61 3e26 6e62 7370 3b6f 626a 6563 t objec │ │ │ -00088e20: 7450 6f69 6e74 732c 0a20 3c61 2068 7265 tPoints,. Mat&nb │ │ │ -00088e70: 7370 3b69 6d61 6765 506f 696e 7473 2c0a sp;imagePoints,. │ │ │ -00088e80: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -00088ec0: 3c2f 613e 266e 6273 703b 6361 6d65 7261  camera │ │ │ -00088ed0: 4d61 7472 6978 2c0a 203c 6120 6872 6566 Matrix,. Mat&nbs │ │ │ -00088f20: 703b 6469 7374 436f 6566 6673 2c0a 203c p;distCoeffs,. < │ │ │ -00088f30: 6120 6872 6566 3d22 6874 7470 733a 2f2f a href="https:// │ │ │ -00088f40: 646f 6373 2e6f 7261 636c 652e 636f 6d2f docs.oracle.com/ │ │ │ -00088f50: 656e 2f6a 6176 612f 6a61 7661 7365 2f32 en/java/javase/2 │ │ │ -00088f60: 352f 646f 6373 2f61 7069 2f6a 6176 612e 5/docs/api/java. │ │ │ -00088f70: 6261 7365 2f6a 6176 612f 7574 696c 2f4c base/java/util/L │ │ │ -00088f80: 6973 742e 6874 6d6c 2220 7469 746c 653d ist.html" title= │ │ │ -00088f90: 2263 6c61 7373 206f 7220 696e 7465 7266 "class or interf │ │ │ -00088fa0: 6163 6520 696e 206a 6176 612e 7574 696c ace in java.util │ │ │ -00088fb0: 2220 636c 6173 733d 2265 7874 6572 6e61 " class="externa │ │ │ -00088fc0: 6c2d 6c69 6e6b 223e 4c69 7374 3c2f 613e l-link">List │ │ │ -00088fd0: 266c 743b 3c61 2068 7265 663d 222e 2e2f < │ │ │ -00089010: 4d61 743c 2f61 3e26 6774 3b26 6e62 7370 Mat>  │ │ │ -00089020: 3b72 7665 6373 2c0a 203c 6120 6872 6566 ;rvecs,. List<Mat> tvecs │ │ │ -00089120: 2c0a 2062 6f6f 6c65 616e 266e 6273 703b ,. boolean  │ │ │ -00089130: 7573 6545 7874 7269 6e73 6963 4775 6573 useExtrinsicGues │ │ │ -00089140: 7329 3c2f 7370 616e 3e3c 2f64 6976 3e0a s)
    . │ │ │ -00089150: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Finds an obje │ │ │ -00089170: 6374 2070 6f73 6520 5c28 207b 7d5e 7b63 ct pose \( {}^{c │ │ │ -00089180: 7d5c 6d61 7468 6266 7b54 7d5f 6f20 5c29 }\mathbf{T}_o \) │ │ │ -00089190: 2066 726f 6d20 3344 2d32 4420 706f 696e from 3D-2D poin │ │ │ -000891a0: 7420 636f 7272 6573 706f 6e64 656e 6365 t correspondence │ │ │ -000891b0: 732e 0a0a 215b 5065 7273 7065 6374 6976 s...![Perspectiv │ │ │ -000891c0: 6520 7072 6f6a 6563 7469 6f6e 2c20 6672 e projection, fr │ │ │ -000891d0: 6f6d 206f 626a 6563 7420 746f 2063 616d om object to cam │ │ │ -000891e0: 6572 6120 6672 616d 655d 2870 6963 732f era frame](pics/ │ │ │ -000891f0: 7069 6e68 6f6c 655f 686f 6d6f 6765 6e65 pinhole_homogene │ │ │ -00089200: 6f75 735f 7472 616e 7366 6f72 6d61 7469 ous_transformati │ │ │ -00089210: 6f6e 2e6a 7067 297b 2077 6964 7468 3d35 on.jpg){ width=5 │ │ │ -00089220: 3025 207d 0a0a 5345 453a 2052 4546 3a20 0% }..SEE: REF: │ │ │ -00089230: 6361 6c69 6233 645f 736f 6c76 6550 6e50 calib3d_solvePnP │ │ │ -00089240: 0a0a 5468 6973 2066 756e 6374 696f 6e20 ..This function │ │ │ -00089250: 7265 7475 726e 7320 6120 6c69 7374 206f returns a list o │ │ │ -00089260: 6620 616c 6c20 7468 6520 706f 7373 6962 f all the possib │ │ │ -00089270: 6c65 2073 6f6c 7574 696f 6e73 2028 6120 le solutions (a │ │ │ -00089280: 736f 6c75 7469 6f6e 2069 7320 6120 266c solution is a &l │ │ │ -00089290: 743b 726f 7461 7469 6f6e 2076 6563 746f t;rotation vecto │ │ │ -000892a0: 722c 2074 7261 6e73 6c61 7469 6f6e 2076 r, translation v │ │ │ -000892b0: 6563 746f 7226 6774 3b0a 636f 7570 6c65 ector>.couple │ │ │ -000892c0: 292c 2064 6570 656e 6469 6e67 206f 6e20 ), depending on │ │ │ -000892d0: 7468 6520 6e75 6d62 6572 206f 6620 696e the number of in │ │ │ -000892e0: 7075 7420 706f 696e 7473 2061 6e64 2074 put points and t │ │ │ -000892f0: 6865 2063 686f 7365 6e20 6d65 7468 6f64 he chosen method │ │ │ -00089300: 3a0a 3c75 6c3e 0a20 203c 6c69 3e0a 2050 :.
      .
    • . P │ │ │ -00089310: 3350 206d 6574 686f 6473 2028 5245 463a 3P methods (REF: │ │ │ -00089320: 2053 4f4c 5645 504e 505f 5033 502c 2052 SOLVEPNP_P3P, R │ │ │ -00089330: 4546 3a20 534f 4c56 4550 4e50 5f41 5033 EF: SOLVEPNP_AP3 │ │ │ -00089340: 5029 3a20 3320 6f72 2034 2069 6e70 7574 P): 3 or 4 input │ │ │ -00089350: 2070 6f69 6e74 732e 204e 756d 6265 7220 points. Number │ │ │ -00089360: 6f66 2072 6574 7572 6e65 6420 736f 6c75 of returned solu │ │ │ -00089370: 7469 6f6e 7320 6361 6e20 6265 2062 6574 tions can be bet │ │ │ -00089380: 7765 656e 2030 2061 6e64 2034 2077 6974 ween 0 and 4 wit │ │ │ -00089390: 6820 3320 696e 7075 7420 706f 696e 7473 h 3 input points │ │ │ -000893a0: 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c 693e ..
    • .
    • │ │ │ -000893b0: 0a20 5245 463a 2053 4f4c 5645 504e 505f . REF: SOLVEPNP_ │ │ │ -000893c0: 4950 5045 2049 6e70 7574 2070 6f69 6e74 IPPE Input point │ │ │ -000893d0: 7320 6d75 7374 2062 6520 2667 743b 3d20 s must be >= │ │ │ -000893e0: 3420 616e 6420 6f62 6a65 6374 2070 6f69 4 and object poi │ │ │ -000893f0: 6e74 7320 6d75 7374 2062 6520 636f 706c nts must be copl │ │ │ -00089400: 616e 6172 2e20 5265 7475 726e 7320 3220 anar. Returns 2 │ │ │ -00089410: 736f 6c75 7469 6f6e 732e 0a20 203c 2f6c solutions.. .
    • . REF: │ │ │ -00089430: 534f 4c56 4550 4e50 5f49 5050 455f 5351 SOLVEPNP_IPPE_SQ │ │ │ -00089440: 5541 5245 2053 7065 6369 616c 2063 6173 UARE Special cas │ │ │ -00089450: 6520 7375 6974 6162 6c65 2066 6f72 206d e suitable for m │ │ │ -00089460: 6172 6b65 7220 706f 7365 2065 7374 696d arker pose estim │ │ │ -00089470: 6174 696f 6e2e 0a4e 756d 6265 7220 6f66 ation..Number of │ │ │ -00089480: 2069 6e70 7574 2070 6f69 6e74 7320 6d75 input points mu │ │ │ -00089490: 7374 2062 6520 3420 616e 6420 3220 736f st be 4 and 2 so │ │ │ -000894a0: 6c75 7469 6f6e 7320 6172 6520 7265 7475 lutions are retu │ │ │ -000894b0: 726e 6564 2e20 4f62 6a65 6374 2070 6f69 rned. Object poi │ │ │ -000894c0: 6e74 7320 6d75 7374 2062 6520 6465 6669 nts must be defi │ │ │ -000894d0: 6e65 6420 696e 2074 6865 2066 6f6c 6c6f ned in the follo │ │ │ -000894e0: 7769 6e67 206f 7264 6572 3a0a 2020 3c75 wing order:. .
    • . p │ │ │ -00089500: 6f69 6e74 2030 3a20 5b2d 7371 7561 7265 oint 0: [-square │ │ │ -00089510: 4c65 6e67 7468 202f 2032 2c20 2073 7175 Length / 2, squ │ │ │ -00089520: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ -00089530: 5d0a 2020 2020 3c2f 6c69 3e0a 2020 2020 ].
    • . │ │ │ -00089540: 3c6c 693e 0a20 2020 706f 696e 7420 313a
    • . point 1: │ │ │ -00089550: 205b 2073 7175 6172 654c 656e 6774 6820 [ squareLength │ │ │ -00089560: 2f20 322c 2020 7371 7561 7265 4c65 6e67 / 2, squareLeng │ │ │ -00089570: 7468 202f 2032 2c20 305d 0a20 2020 203c th / 2, 0]. < │ │ │ -00089580: 2f6c 693e 0a20 2020 203c 6c69 3e0a 2020 /li>.
    • . │ │ │ -00089590: 2070 6f69 6e74 2032 3a20 5b20 7371 7561 point 2: [ squa │ │ │ -000895a0: 7265 4c65 6e67 7468 202f 2032 2c20 2d73 reLength / 2, -s │ │ │ -000895b0: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ -000895c0: 2030 5d0a 2020 2020 3c2f 6c69 3e0a 2020 0].
    • . │ │ │ -000895d0: 2020 3c6c 693e 0a20 2020 706f 696e 7420
    • . point │ │ │ -000895e0: 333a 205b 2d73 7175 6172 654c 656e 6774 3: [-squareLengt │ │ │ -000895f0: 6820 2f20 322c 202d 7371 7561 7265 4c65 h / 2, -squareLe │ │ │ -00089600: 6e67 7468 202f 2032 2c20 305d 0a20 2020 ngth / 2, 0]. │ │ │ -00089610: 203c 2f6c 693e 0a20 203c 2f75 6c3e 0a20
    • .
    . │ │ │ -00089620: 203c 6c69 3e0a 2066 6f72 2061 6c6c 2074
  • . for all t │ │ │ -00089630: 6865 206f 7468 6572 2066 6c61 6773 2c20 he other flags, │ │ │ -00089640: 6e75 6d62 6572 206f 6620 696e 7075 7420 number of input │ │ │ -00089650: 706f 696e 7473 206d 7573 7420 6265 2026 points must be & │ │ │ -00089660: 6774 3b3d 2034 2061 6e64 206f 626a 6563 gt;= 4 and objec │ │ │ -00089670: 7420 706f 696e 7473 2063 616e 2062 6520 t points can be │ │ │ -00089680: 696e 2061 6e79 2063 6f6e 6669 6775 7261 in any configura │ │ │ -00089690: 7469 6f6e 2e0a 4f6e 6c79 2031 2073 6f6c tion..Only 1 sol │ │ │ -000896a0: 7574 696f 6e20 6973 2072 6574 7572 6e65 ution is returne │ │ │ -000896b0: 642e 0a20 203c 2f6c 693e 0a3c 2f75 6c3e d..
  • . │ │ │ -000896c0: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373 .
    .
    Pa │ │ │ -000896e0: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000896f0: 6464 3e3c 636f 6465 3e6f 626a 6563 7450 dd>objectP │ │ │ -00089700: 6f69 6e74 733c 2f63 6f64 653e 202d 2041 oints - A │ │ │ -00089710: 7272 6179 206f 6620 6f62 6a65 6374 2070 rray of object p │ │ │ -00089720: 6f69 6e74 7320 696e 2074 6865 206f 626a oints in the obj │ │ │ -00089730: 6563 7420 636f 6f72 6469 6e61 7465 2073 ect coordinate s │ │ │ -00089740: 7061 6365 2c20 4e78 3320 312d 6368 616e pace, Nx3 1-chan │ │ │ -00089750: 6e65 6c20 6f72 0a31 784e 2f4e 7831 2033 nel or.1xN/Nx1 3 │ │ │ -00089760: 2d63 6861 6e6e 656c 2c20 7768 6572 6520 -channel, where │ │ │ -00089770: 4e20 6973 2074 6865 206e 756d 6265 7220 N is the number │ │ │ -00089780: 6f66 2070 6f69 6e74 732e 2076 6563 746f of points. vecto │ │ │ -00089790: 7226 6c74 3b50 6f69 6e74 3364 2667 743b r<Point3d> │ │ │ -000897a0: 2063 616e 2062 6520 616c 736f 2070 6173 can be also pas │ │ │ -000897b0: 7365 6420 6865 7265 2e3c 2f64 643e 0a3c sed here..< │ │ │ -000897c0: 6464 3e3c 636f 6465 3e69 6d61 6765 506f dd>imagePo │ │ │ -000897d0: 696e 7473 3c2f 636f 6465 3e20 2d20 4172 ints - Ar │ │ │ -000897e0: 7261 7920 6f66 2063 6f72 7265 7370 6f6e ray of correspon │ │ │ -000897f0: 6469 6e67 2069 6d61 6765 2070 6f69 6e74 ding image point │ │ │ -00089800: 732c 204e 7832 2031 2d63 6861 6e6e 656c s, Nx2 1-channel │ │ │ -00089810: 206f 7220 3178 4e2f 4e78 3120 322d 6368 or 1xN/Nx1 2-ch │ │ │ -00089820: 616e 6e65 6c2c 0a77 6865 7265 204e 2069 annel,.where N i │ │ │ -00089830: 7320 7468 6520 6e75 6d62 6572 206f 6620 s the number of │ │ │ -00089840: 706f 696e 7473 2e20 7665 6374 6f72 266c points. vector&l │ │ │ -00089850: 743b 506f 696e 7432 6426 6774 3b20 6361 t;Point2d> ca │ │ │ -00089860: 6e20 6265 2061 6c73 6f20 7061 7373 6564 n be also passed │ │ │ -00089870: 2068 6572 652e 3c2f 6464 3e0a 3c64 643e here..
    │ │ │ -00089880: 3c63 6f64 653e 6361 6d65 7261 4d61 7472 cameraMatr │ │ │ -00089890: 6978 3c2f 636f 6465 3e20 2d20 496e 7075 ix - Inpu │ │ │ -000898a0: 7420 6361 6d65 7261 2069 6e74 7269 6e73 t camera intrins │ │ │ -000898b0: 6963 206d 6174 7269 7820 5c28 5c63 616d ic matrix \(\cam │ │ │ -000898c0: 6572 616d 6174 7269 787b 417d 5c29 202e eramatrix{A}\) . │ │ │ -000898d0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000898e0: 6469 7374 436f 6566 6673 3c2f 636f 6465 distCoeffs - Input vector │ │ │ -00089900: 206f 6620 6469 7374 6f72 7469 6f6e 2063 of distortion c │ │ │ -00089910: 6f65 6666 6963 6965 6e74 730a 5c28 5c64 oefficients.\(\d │ │ │ -00089920: 6973 7463 6f65 6666 735c 292e 2049 6620 istcoeffs\). If │ │ │ -00089930: 7468 6520 7665 6374 6f72 2069 7320 4e55 the vector is NU │ │ │ -00089940: 4c4c 2f65 6d70 7479 2c20 7468 6520 7a65 LL/empty, the ze │ │ │ -00089950: 726f 2064 6973 746f 7274 696f 6e20 636f ro distortion co │ │ │ -00089960: 6566 6669 6369 656e 7473 2061 7265 0a61 efficients are.a │ │ │ -00089970: 7373 756d 6564 2e3c 2f64 643e 0a3c 6464 ssumed.
    .
    rvecs - Vector of │ │ │ -000899a0: 6f75 7470 7574 2072 6f74 6174 696f 6e20 output rotation │ │ │ -000899b0: 7665 6374 6f72 7320 2873 6565 2052 4546 vectors (see REF │ │ │ -000899c0: 3a20 526f 6472 6967 7565 7320 2920 7468 : Rodrigues ) th │ │ │ -000899d0: 6174 2c20 746f 6765 7468 6572 2077 6974 at, together wit │ │ │ -000899e0: 6820 7476 6563 732c 2062 7269 6e67 7320 h tvecs, brings │ │ │ -000899f0: 706f 696e 7473 2066 726f 6d0a 7468 6520 points from.the │ │ │ -00089a00: 6d6f 6465 6c20 636f 6f72 6469 6e61 7465 model coordinate │ │ │ -00089a10: 2073 7973 7465 6d20 746f 2074 6865 2063 system to the c │ │ │ -00089a20: 616d 6572 6120 636f 6f72 6469 6e61 7465 amera coordinate │ │ │ -00089a30: 2073 7973 7465 6d2e 3c2f 6464 3e0a 3c64 system.
    .tvecs - Vector of │ │ │ -00089a60: 206f 7574 7075 7420 7472 616e 736c 6174 output translat │ │ │ -00089a70: 696f 6e20 7665 6374 6f72 732e 3c2f 6464 ion vectors..
    useE │ │ │ -00089a90: 7874 7269 6e73 6963 4775 6573 733c 2f63 xtrinsicGuess - Parameter │ │ │ -00089ab0: 2075 7365 6420 666f 7220 2353 4f4c 5645 used for #SOLVE │ │ │ -00089ac0: 504e 505f 4954 4552 4154 4956 452e 2049 PNP_ITERATIVE. I │ │ │ -00089ad0: 6620 7472 7565 2028 3129 2c20 7468 6520 f true (1), the │ │ │ -00089ae0: 6675 6e63 7469 6f6e 2075 7365 730a 7468 function uses.th │ │ │ -00089af0: 6520 7072 6f76 6964 6564 2072 7665 6320 e provided rvec │ │ │ -00089b00: 616e 6420 7476 6563 2076 616c 7565 7320 and tvec values │ │ │ -00089b10: 6173 2069 6e69 7469 616c 2061 7070 726f as initial appro │ │ │ -00089b20: 7869 6d61 7469 6f6e 7320 6f66 2074 6865 ximations of the │ │ │ -00089b30: 2072 6f74 6174 696f 6e20 616e 6420 7472 rotation and tr │ │ │ -00089b40: 616e 736c 6174 696f 6e0a 7665 6374 6f72 anslation.vector │ │ │ -00089b50: 732c 2072 6573 7065 6374 6976 656c 792c s, respectively, │ │ │ -00089b60: 2061 6e64 2066 7572 7468 6572 206f 7074 and further opt │ │ │ -00089b70: 696d 697a 6573 2074 6865 6d2e 0a61 6e64 imizes them..and │ │ │ -00089b80: 2075 7365 4578 7472 696e 7369 6347 7565 useExtrinsicGue │ │ │ -00089b90: 7373 2069 7320 7365 7420 746f 2074 7275 ss is set to tru │ │ │ -00089ba0: 652e 0a61 6e64 2075 7365 4578 7472 696e e..and useExtrin │ │ │ -00089bb0: 7369 6347 7565 7373 2069 7320 7365 7420 sicGuess is set │ │ │ -00089bc0: 746f 2074 7275 652e 0a28 5c28 205c 7465 to true..(\( \te │ │ │ -00089bd0: 7874 7b52 4d53 457d 203d 205c 7371 7274 xt{RMSE} = \sqrt │ │ │ -00089be0: 7b5c 6672 6163 7b5c 7375 6d5f 7b69 7d5e {\frac{\sum_{i}^ │ │ │ -00089bf0: 7b4e 7d20 5c6c 6566 7420 2820 5c68 6174 {N} \left ( \hat │ │ │ -00089c00: 7b79 5f69 7d20 2d20 795f 6920 5c72 6967 {y_i} - y_i \rig │ │ │ -00089c10: 6874 2029 5e32 7d7b 4e7d 7d20 5c29 2920 ht )^2}{N}} \)) │ │ │ -00089c20: 6265 7477 6565 6e20 7468 6520 696e 7075 between the inpu │ │ │ -00089c30: 7420 696d 6167 6520 706f 696e 7473 0a61 t image points.a │ │ │ -00089c40: 6e64 2074 6865 2033 4420 6f62 6a65 6374 nd the 3D object │ │ │ -00089c50: 2070 6f69 6e74 7320 7072 6f6a 6563 7465 points projecte │ │ │ -00089c60: 6420 7769 7468 2074 6865 2065 7374 696d d with the estim │ │ │ -00089c70: 6174 6564 2070 6f73 652e 0a0a 4d6f 7265 ated pose...More │ │ │ -00089c80: 2069 6e66 6f72 6d61 7469 6f6e 2069 7320 information is │ │ │ -00089c90: 6465 7363 7269 6265 6420 696e 2052 4546 described in REF │ │ │ -00089ca0: 3a20 6361 6c69 6233 645f 736f 6c76 6550 : calib3d_solveP │ │ │ -00089cb0: 6e50 0a0a 3c62 3e4e 6f74 653a 3c2f 623e nP..Note: │ │ │ -00089cc0: 0a3c 756c 3e0a 2020 3c6c 693e 0a20 2020 .
      .
    • . │ │ │ -00089cd0: 2020 2041 6e20 6578 616d 706c 6520 6f66 An example of │ │ │ -00089ce0: 2068 6f77 2074 6f20 7573 6520 736f 6c76 how to use solv │ │ │ -00089cf0: 6550 6e50 2066 6f72 2070 6c61 6e61 7220 ePnP for planar │ │ │ -00089d00: 6175 676d 656e 7465 6420 7265 616c 6974 augmented realit │ │ │ -00089d10: 7920 6361 6e20 6265 2066 6f75 6e64 2061 y can be found a │ │ │ -00089d20: 740a 2020 2020 2020 2020 6f70 656e 6376 t. opencv │ │ │ -00089d30: 5f73 6f75 7263 655f 636f 6465 2f73 616d _source_code/sam │ │ │ -00089d40: 706c 6573 2f70 7974 686f 6e2f 706c 616e ples/python/plan │ │ │ -00089d50: 655f 6172 2e70 790a 2020 3c2f 6c69 3e0a e_ar.py.
    • . │ │ │ -00089d60: 2020 3c6c 693e 0a20 2020 2020 2049 6620
    • . If │ │ │ -00089d70: 796f 7520 6172 6520 7573 696e 6720 5079 you are using Py │ │ │ -00089d80: 7468 6f6e 3a0a 2020 3c75 6c3e 0a20 2020 thon:.
        . │ │ │ -00089d90: 203c 6c69 3e0a 2020 2020 2020 2020 204e
      • . N │ │ │ -00089da0: 756d 7079 2061 7272 6179 2073 6c69 6365 umpy array slice │ │ │ -00089db0: 7320 776f 6e27 7420 776f 726b 2061 7320 s won't work as │ │ │ -00089dc0: 696e 7075 7420 6265 6361 7573 6520 736f input because so │ │ │ -00089dd0: 6c76 6550 6e50 2072 6571 7569 7265 7320 lvePnP requires │ │ │ -00089de0: 636f 6e74 6967 756f 7573 0a20 2020 2020 contiguous. │ │ │ -00089df0: 2020 2061 7272 6179 7320 2865 6e66 6f72 arrays (enfor │ │ │ -00089e00: 6365 6420 6279 2074 6865 2061 7373 6572 ced by the asser │ │ │ -00089e10: 7469 6f6e 2075 7369 6e67 2063 763a 3a4d tion using cv::M │ │ │ -00089e20: 6174 3a3a 6368 6563 6b56 6563 746f 7228 at::checkVector( │ │ │ -00089e30: 2920 6172 6f75 6e64 206c 696e 6520 3535 ) around line 55 │ │ │ -00089e40: 206f 660a 2020 2020 2020 2020 6d6f 6475 of. modu │ │ │ -00089e50: 6c65 732f 3364 2f73 7263 2f73 6f6c 7665 les/3d/src/solve │ │ │ -00089e60: 706e 702e 6370 7020 7665 7273 696f 6e20 pnp.cpp version │ │ │ -00089e70: 322e 342e 3929 0a20 2020 203c 2f6c 693e 2.4.9).
      • │ │ │ -00089e80: 0a20 2020 203c 6c69 3e0a 2020 2020 2020 .
      • . │ │ │ -00089e90: 2020 2054 6865 2050 3350 2061 6c67 6f72 The P3P algor │ │ │ -00089ea0: 6974 686d 2072 6571 7569 7265 7320 696d ithm requires im │ │ │ -00089eb0: 6167 6520 706f 696e 7473 2074 6f20 6265 age points to be │ │ │ -00089ec0: 2069 6e20 616e 2061 7272 6179 206f 6620 in an array of │ │ │ -00089ed0: 7368 6170 6520 284e 2c31 2c32 2920 6475 shape (N,1,2) du │ │ │ -00089ee0: 650a 2020 2020 2020 2020 746f 2069 7473 e. to its │ │ │ -00089ef0: 2063 616c 6c69 6e67 206f 6620 2375 6e64 calling of #und │ │ │ -00089f00: 6973 746f 7274 506f 696e 7473 2028 6172 istortPoints (ar │ │ │ -00089f10: 6f75 6e64 206c 696e 6520 3735 206f 6620 ound line 75 of │ │ │ -00089f20: 6d6f 6475 6c65 732f 3364 2f73 7263 2f73 modules/3d/src/s │ │ │ -00089f30: 6f6c 7665 706e 702e 6370 7020 7665 7273 olvepnp.cpp vers │ │ │ -00089f40: 696f 6e20 322e 342e 3929 0a20 2020 2020 ion 2.4.9). │ │ │ -00089f50: 2020 2077 6869 6368 2072 6571 7569 7265 which require │ │ │ -00089f60: 7320 322d 6368 616e 6e65 6c20 696e 666f s 2-channel info │ │ │ -00089f70: 726d 6174 696f 6e2e 0a20 2020 203c 2f6c rmation.. .
      • . │ │ │ -00089f90: 2020 2020 2054 6875 732c 2067 6976 656e Thus, given │ │ │ -00089fa0: 2073 6f6d 6520 6461 7461 2044 203d 206e some data D = n │ │ │ -00089fb0: 702e 6172 7261 7928 2e2e 2e29 2077 6865 p.array(...) whe │ │ │ -00089fc0: 7265 2044 2e73 6861 7065 203d 2028 4e2c re D.shape = (N, │ │ │ -00089fd0: 4d29 2c20 696e 206f 7264 6572 2074 6f20 M), in order to │ │ │ -00089fe0: 7573 6520 6120 7375 6273 6574 206f 660a use a subset of. │ │ │ -00089ff0: 2020 2020 2020 2020 6974 2061 732c 2065 it as, e │ │ │ -0008a000: 2e67 2e2c 2069 6d61 6765 506f 696e 7473 .g., imagePoints │ │ │ -0008a010: 2c20 6f6e 6520 6d75 7374 2065 6666 6563 , one must effec │ │ │ -0008a020: 7469 7665 6c79 2063 6f70 7920 6974 2069 tively copy it i │ │ │ -0008a030: 6e74 6f20 6120 6e65 7720 6172 7261 793a nto a new array: │ │ │ -0008a040: 2069 6d61 6765 506f 696e 7473 203d 0a20 imagePoints =. │ │ │ -0008a050: 2020 2020 2020 206e 702e 6173 636f 6e74 np.ascont │ │ │ -0008a060: 6967 756f 7573 6172 7261 7928 445b 3a2c iguousarray(D[:, │ │ │ -0008a070: 3a32 5d29 2e72 6573 6861 7065 2828 4e2c :2]).reshape((N, │ │ │ -0008a080: 312c 3229 290a 2020 2020 3c2f 6c69 3e0a 1,2)).
      • . │ │ │ -0008a090: 2020 3c2f 756c 3e0a 2020 3c6c 693e 0a20
      .
    • . │ │ │ -0008a0a0: 2020 2020 2054 6865 206d 696e 696d 756d The minimum │ │ │ -0008a0b0: 206e 756d 6265 7220 6f66 2070 6f69 6e74 number of point │ │ │ -0008a0c0: 7320 6973 2034 2069 6e20 7468 6520 6765 s is 4 in the ge │ │ │ -0008a0d0: 6e65 7261 6c20 6361 7365 2e20 496e 2074 neral case. In t │ │ │ -0008a0e0: 6865 2063 6173 6520 6f66 2052 4546 3a20 he case of REF: │ │ │ -0008a0f0: 534f 4c56 4550 4e50 5f50 3350 2061 6e64 SOLVEPNP_P3P and │ │ │ -0008a100: 2052 4546 3a20 534f 4c56 4550 4e50 5f41 REF: SOLVEPNP_A │ │ │ -0008a110: 5033 500a 2020 2020 2020 206d 6574 686f P3P. metho │ │ │ -0008a120: 6473 2c20 6974 2069 7320 7265 7175 6972 ds, it is requir │ │ │ -0008a130: 6564 2074 6f20 7573 6520 6578 6163 746c ed to use exactl │ │ │ -0008a140: 7920 3420 706f 696e 7473 2028 7468 6520 y 4 points (the │ │ │ -0008a150: 6669 7273 7420 3320 706f 696e 7473 2061 first 3 points a │ │ │ -0008a160: 7265 2075 7365 6420 746f 2065 7374 696d re used to estim │ │ │ -0008a170: 6174 6520 616c 6c20 7468 6520 736f 6c75 ate all the solu │ │ │ -0008a180: 7469 6f6e 730a 2020 2020 2020 206f 6620 tions. of │ │ │ -0008a190: 7468 6520 5033 5020 7072 6f62 6c65 6d2c the P3P problem, │ │ │ -0008a1a0: 2074 6865 206c 6173 7420 6f6e 6520 6973 the last one is │ │ │ -0008a1b0: 2075 7365 6420 746f 2072 6574 6169 6e20 used to retain │ │ │ -0008a1c0: 7468 6520 6265 7374 2073 6f6c 7574 696f the best solutio │ │ │ -0008a1d0: 6e20 7468 6174 206d 696e 696d 697a 6573 n that minimizes │ │ │ -0008a1e0: 2074 6865 2072 6570 726f 6a65 6374 696f the reprojectio │ │ │ -0008a1f0: 6e20 6572 726f 7229 2e0a 2020 3c2f 6c69 n error)..
    • .
    • . W │ │ │ -0008a210: 6974 6820 5245 463a 2053 4f4c 5645 504e ith REF: SOLVEPN │ │ │ -0008a220: 505f 4954 4552 4154 4956 4520 6d65 7468 P_ITERATIVE meth │ │ │ -0008a230: 6f64 2061 6e64 203c 636f 6465 3e75 7365 od and use │ │ │ -0008a240: 4578 7472 696e 7369 6347 7565 7373 3d74 ExtrinsicGuess=t │ │ │ -0008a250: 7275 653c 2f63 6f64 653e 2c20 7468 6520 rue, the │ │ │ -0008a260: 6d69 6e69 6d75 6d20 6e75 6d62 6572 206f minimum number o │ │ │ -0008a270: 6620 706f 696e 7473 2069 7320 3320 2833 f points is 3 (3 │ │ │ -0008a280: 2070 6f69 6e74 730a 2020 2020 2020 2061 points. a │ │ │ -0008a290: 7265 2073 7566 6669 6369 656e 7420 746f re sufficient to │ │ │ -0008a2a0: 2063 6f6d 7075 7465 2061 2070 6f73 6520 compute a pose │ │ │ -0008a2b0: 6275 7420 7468 6572 6520 6172 6520 7570 but there are up │ │ │ -0008a2c0: 2074 6f20 3420 736f 6c75 7469 6f6e 7329 to 4 solutions) │ │ │ -0008a2d0: 2e20 5468 6520 696e 6974 6961 6c20 736f . The initial so │ │ │ -0008a2e0: 6c75 7469 6f6e 2073 686f 756c 6420 6265 lution should be │ │ │ -0008a2f0: 2063 6c6f 7365 2074 6f20 7468 650a 2020 close to the. │ │ │ -0008a300: 2020 2020 2067 6c6f 6261 6c20 736f 6c75 global solu │ │ │ -0008a310: 7469 6f6e 2074 6f20 636f 6e76 6572 6765 tion to converge │ │ │ -0008a320: 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c 693e ..
    • .
    • │ │ │ -0008a330: 0a20 2020 2020 2057 6974 6820 5245 463a . With REF: │ │ │ -0008a340: 2053 4f4c 5645 504e 505f 4950 5045 2069 SOLVEPNP_IPPE i │ │ │ -0008a350: 6e70 7574 2070 6f69 6e74 7320 6d75 7374 nput points must │ │ │ -0008a360: 2062 6520 2667 743b 3d20 3420 616e 6420 be >= 4 and │ │ │ -0008a370: 6f62 6a65 6374 2070 6f69 6e74 7320 6d75 object points mu │ │ │ -0008a380: 7374 2062 6520 636f 706c 616e 6172 2e0a st be coplanar.. │ │ │ -0008a390: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ -0008a3a0: 2020 2020 2057 6974 6820 5245 463a 2053 With REF: S │ │ │ -0008a3b0: 4f4c 5645 504e 505f 4950 5045 5f53 5155 OLVEPNP_IPPE_SQU │ │ │ -0008a3c0: 4152 4520 7468 6973 2069 7320 6120 7370 ARE this is a sp │ │ │ -0008a3d0: 6563 6961 6c20 6361 7365 2073 7569 7461 ecial case suita │ │ │ -0008a3e0: 626c 6520 666f 7220 6d61 726b 6572 2070 ble for marker p │ │ │ -0008a3f0: 6f73 6520 6573 7469 6d61 7469 6f6e 2e0a ose estimation.. │ │ │ -0008a400: 2020 2020 2020 204e 756d 6265 7220 6f66 Number of │ │ │ -0008a410: 2069 6e70 7574 2070 6f69 6e74 7320 6d75 input points mu │ │ │ -0008a420: 7374 2062 6520 342e 204f 626a 6563 7420 st be 4. Object │ │ │ -0008a430: 706f 696e 7473 206d 7573 7420 6265 2064 points must be d │ │ │ -0008a440: 6566 696e 6564 2069 6e20 7468 6520 666f efined in the fo │ │ │ -0008a450: 6c6c 6f77 696e 6720 6f72 6465 723a 0a20 llowing order:. │ │ │ -0008a460: 203c 756c 3e0a 2020 2020 3c6c 693e 0a20
        .
      • . │ │ │ -0008a470: 2020 2020 2020 2020 2070 6f69 6e74 2030 point 0 │ │ │ -0008a480: 3a20 5b2d 7371 7561 7265 4c65 6e67 7468 : [-squareLength │ │ │ -0008a490: 202f 2032 2c20 2073 7175 6172 654c 656e / 2, squareLen │ │ │ -0008a4a0: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ -0008a4b0: 3c2f 6c69 3e0a 2020 2020 3c6c 693e 0a20
      • .
      • . │ │ │ -0008a4c0: 2020 2020 2020 2020 2070 6f69 6e74 2031 point 1 │ │ │ -0008a4d0: 3a20 5b20 7371 7561 7265 4c65 6e67 7468 : [ squareLength │ │ │ -0008a4e0: 202f 2032 2c20 2073 7175 6172 654c 656e / 2, squareLen │ │ │ -0008a4f0: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ -0008a500: 3c2f 6c69 3e0a 2020 2020 3c6c 693e 0a20
      • .
      • . │ │ │ -0008a510: 2020 2020 2020 2020 2070 6f69 6e74 2032 point 2 │ │ │ -0008a520: 3a20 5b20 7371 7561 7265 4c65 6e67 7468 : [ squareLength │ │ │ -0008a530: 202f 2032 2c20 2d73 7175 6172 654c 656e / 2, -squareLen │ │ │ -0008a540: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ -0008a550: 3c2f 6c69 3e0a 2020 2020 3c6c 693e 0a20
      • .
      • . │ │ │ -0008a560: 2020 2020 2020 2020 2070 6f69 6e74 2033 point 3 │ │ │ -0008a570: 3a20 5b2d 7371 7561 7265 4c65 6e67 7468 : [-squareLength │ │ │ -0008a580: 202f 2032 2c20 2d73 7175 6172 654c 656e / 2, -squareLen │ │ │ -0008a590: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ -0008a5a0: 3c2f 6c69 3e0a 2020 3c2f 756c 3e0a 2020
      • .
      . │ │ │ -0008a5b0: 3c6c 693e 0a20 2020 2020 2057 6974 6820
    • . With │ │ │ -0008a5c0: 5245 463a 2053 4f4c 5645 504e 505f 5351 REF: SOLVEPNP_SQ │ │ │ -0008a5d0: 504e 5020 696e 7075 7420 706f 696e 7473 PNP input points │ │ │ -0008a5e0: 206d 7573 7420 6265 2026 6774 3b3d 2033 must be >= 3 │ │ │ -0008a5f0: 0a20 203c 2f6c 693e 0a3c 2f75 6c3e 3c2f .
    • .
    .
    Returns: │ │ │ -0008a610: 3c2f 6474 3e0a 3c64 643e 6175 746f 6d61
    .
    automa │ │ │ -0008a620: 7469 6361 6c6c 7920 6765 6e65 7261 7465 tically generate │ │ │ -0008a630: 643c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 d
    .
    ...< │ │ │ -0008a650: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    solve │ │ │ -0008a700: 506e 5047 656e 6572 6963 3c2f 6833 3e0a PnPGeneric

    . │ │ │ -0008a710: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ -0008a730: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ -0008a770: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ -0008a780: 3c73 7061 6e20 636c 6173 733d 2272 6574 int solvePnPGen │ │ │ -0008a7d0: 6572 6963 3c2f 7370 616e 3e3c 7762 723e eric │ │ │ -0008a7e0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ -0008a840: 7370 3b6f 626a 6563 7450 6f69 6e74 732c sp;objectPoints, │ │ │ -0008a850: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -0008a890: 743c 2f61 3e26 6e62 7370 3b69 6d61 6765 t image │ │ │ -0008a8a0: 506f 696e 7473 2c0a 203c 6120 6872 6566 Points,. Mat&nbs │ │ │ -0008a8f0: 703b 6361 6d65 7261 4d61 7472 6978 2c0a p;cameraMatrix,. │ │ │ -0008a900: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0008a940: 3c2f 613e 266e 6273 703b 6469 7374 436f  distCo │ │ │ -0008a950: 6566 6673 2c0a 203c 6120 6872 6566 3d22 effs,. │ │ │ -0008a9f0: 4c69 7374 3c2f 613e 266c 743b 3c61 2068 List<Mat& │ │ │ -0008aa40: 6774 3b26 6e62 7370 3b72 7665 6373 2c0a gt; rvecs,. │ │ │ -0008aa50: 203c 6120 6872 6566 3d22 6874 7470 733a List<Mat>&nb │ │ │ -0008ab40: 7370 3b74 7665 6373 293c 2f73 7061 6e3e sp;tvecs) │ │ │ -0008ab50: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Finds │ │ │ -0008ab70: 616e 206f 626a 6563 7420 706f 7365 205c an object pose \ │ │ │ -0008ab80: 2820 7b7d 5e7b 637d 5c6d 6174 6862 667b ( {}^{c}\mathbf{ │ │ │ -0008ab90: 547d 5f6f 205c 2920 6672 6f6d 2033 442d T}_o \) from 3D- │ │ │ -0008aba0: 3244 2070 6f69 6e74 2063 6f72 7265 7370 2D point corresp │ │ │ -0008abb0: 6f6e 6465 6e63 6573 2e0a 0a21 5b50 6572 ondences...![Per │ │ │ -0008abc0: 7370 6563 7469 7665 2070 726f 6a65 6374 spective project │ │ │ -0008abd0: 696f 6e2c 2066 726f 6d20 6f62 6a65 6374 ion, from object │ │ │ -0008abe0: 2074 6f20 6361 6d65 7261 2066 7261 6d65 to camera frame │ │ │ -0008abf0: 5d28 7069 6373 2f70 696e 686f 6c65 5f68 ](pics/pinhole_h │ │ │ -0008ac00: 6f6d 6f67 656e 656f 7573 5f74 7261 6e73 omogeneous_trans │ │ │ -0008ac10: 666f 726d 6174 696f 6e2e 6a70 6729 7b20 formation.jpg){ │ │ │ -0008ac20: 7769 6474 683d 3530 2520 7d0a 0a53 4545 width=50% }..SEE │ │ │ -0008ac30: 3a20 5245 463a 2063 616c 6962 3364 5f73 : REF: calib3d_s │ │ │ -0008ac40: 6f6c 7665 506e 500a 0a54 6869 7320 6675 olvePnP..This fu │ │ │ -0008ac50: 6e63 7469 6f6e 2072 6574 7572 6e73 2061 nction returns a │ │ │ -0008ac60: 206c 6973 7420 6f66 2061 6c6c 2074 6865 list of all the │ │ │ -0008ac70: 2070 6f73 7369 626c 6520 736f 6c75 7469 possible soluti │ │ │ -0008ac80: 6f6e 7320 2861 2073 6f6c 7574 696f 6e20 ons (a solution │ │ │ -0008ac90: 6973 2061 2026 6c74 3b72 6f74 6174 696f is a <rotatio │ │ │ -0008aca0: 6e20 7665 6374 6f72 2c20 7472 616e 736c n vector, transl │ │ │ -0008acb0: 6174 696f 6e20 7665 6374 6f72 2667 743b ation vector> │ │ │ -0008acc0: 0a63 6f75 706c 6529 2c20 6465 7065 6e64 .couple), depend │ │ │ -0008acd0: 696e 6720 6f6e 2074 6865 206e 756d 6265 ing on the numbe │ │ │ -0008ace0: 7220 6f66 2069 6e70 7574 2070 6f69 6e74 r of input point │ │ │ -0008acf0: 7320 616e 6420 7468 6520 6368 6f73 656e s and the chosen │ │ │ -0008ad00: 206d 6574 686f 643a 0a3c 756c 3e0a 2020 method:.
      . │ │ │ -0008ad10: 3c6c 693e 0a20 5033 5020 6d65 7468 6f64
    • . P3P method │ │ │ -0008ad20: 7320 2852 4546 3a20 534f 4c56 4550 4e50 s (REF: SOLVEPNP │ │ │ -0008ad30: 5f50 3350 2c20 5245 463a 2053 4f4c 5645 _P3P, REF: SOLVE │ │ │ -0008ad40: 504e 505f 4150 3350 293a 2033 206f 7220 PNP_AP3P): 3 or │ │ │ -0008ad50: 3420 696e 7075 7420 706f 696e 7473 2e20 4 input points. │ │ │ -0008ad60: 4e75 6d62 6572 206f 6620 7265 7475 726e Number of return │ │ │ -0008ad70: 6564 2073 6f6c 7574 696f 6e73 2063 616e ed solutions can │ │ │ -0008ad80: 2062 6520 6265 7477 6565 6e20 3020 616e be between 0 an │ │ │ -0008ad90: 6420 3420 7769 7468 2033 2069 6e70 7574 d 4 with 3 input │ │ │ -0008ada0: 2070 6f69 6e74 732e 0a20 203c 2f6c 693e points..
    • │ │ │ -0008adb0: 0a20 203c 6c69 3e0a 2052 4546 3a20 534f .
    • . REF: SO │ │ │ -0008adc0: 4c56 4550 4e50 5f49 5050 4520 496e 7075 LVEPNP_IPPE Inpu │ │ │ -0008add0: 7420 706f 696e 7473 206d 7573 7420 6265 t points must be │ │ │ -0008ade0: 2026 6774 3b3d 2034 2061 6e64 206f 626a >= 4 and obj │ │ │ -0008adf0: 6563 7420 706f 696e 7473 206d 7573 7420 ect points must │ │ │ -0008ae00: 6265 2063 6f70 6c61 6e61 722e 2052 6574 be coplanar. Ret │ │ │ -0008ae10: 7572 6e73 2032 2073 6f6c 7574 696f 6e73 urns 2 solutions │ │ │ -0008ae20: 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c 693e ..
    • .
    • │ │ │ -0008ae30: 0a20 5245 463a 2053 4f4c 5645 504e 505f . REF: SOLVEPNP_ │ │ │ -0008ae40: 4950 5045 5f53 5155 4152 4520 5370 6563 IPPE_SQUARE Spec │ │ │ -0008ae50: 6961 6c20 6361 7365 2073 7569 7461 626c ial case suitabl │ │ │ -0008ae60: 6520 666f 7220 6d61 726b 6572 2070 6f73 e for marker pos │ │ │ -0008ae70: 6520 6573 7469 6d61 7469 6f6e 2e0a 4e75 e estimation..Nu │ │ │ -0008ae80: 6d62 6572 206f 6620 696e 7075 7420 706f mber of input po │ │ │ -0008ae90: 696e 7473 206d 7573 7420 6265 2034 2061 ints must be 4 a │ │ │ -0008aea0: 6e64 2032 2073 6f6c 7574 696f 6e73 2061 nd 2 solutions a │ │ │ -0008aeb0: 7265 2072 6574 7572 6e65 642e 204f 626a re returned. Obj │ │ │ -0008aec0: 6563 7420 706f 696e 7473 206d 7573 7420 ect points must │ │ │ -0008aed0: 6265 2064 6566 696e 6564 2069 6e20 7468 be defined in th │ │ │ -0008aee0: 6520 666f 6c6c 6f77 696e 6720 6f72 6465 e following orde │ │ │ -0008aef0: 723a 0a20 203c 756c 3e0a 2020 2020 3c6c r:.
        . . point 0: [ │ │ │ -0008af10: 2d73 7175 6172 654c 656e 6774 6820 2f20 -squareLength / │ │ │ -0008af20: 322c 2020 7371 7561 7265 4c65 6e67 7468 2, squareLength │ │ │ -0008af30: 202f 2032 2c20 305d 0a20 2020 203c 2f6c / 2, 0]. .
      • . p │ │ │ -0008af50: 6f69 6e74 2031 3a20 5b20 7371 7561 7265 oint 1: [ square │ │ │ -0008af60: 4c65 6e67 7468 202f 2032 2c20 2073 7175 Length / 2, squ │ │ │ -0008af70: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ -0008af80: 5d0a 2020 2020 3c2f 6c69 3e0a 2020 2020 ].
      • . │ │ │ -0008af90: 3c6c 693e 0a20 2020 706f 696e 7420 323a
      • . point 2: │ │ │ -0008afa0: 205b 2073 7175 6172 654c 656e 6774 6820 [ squareLength │ │ │ -0008afb0: 2f20 322c 202d 7371 7561 7265 4c65 6e67 / 2, -squareLeng │ │ │ -0008afc0: 7468 202f 2032 2c20 305d 0a20 2020 203c th / 2, 0]. < │ │ │ -0008afd0: 2f6c 693e 0a20 2020 203c 6c69 3e0a 2020 /li>.
      • . │ │ │ -0008afe0: 2070 6f69 6e74 2033 3a20 5b2d 7371 7561 point 3: [-squa │ │ │ -0008aff0: 7265 4c65 6e67 7468 202f 2032 2c20 2d73 reLength / 2, -s │ │ │ -0008b000: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ -0008b010: 2030 5d0a 2020 2020 3c2f 6c69 3e0a 2020 0].
      • . │ │ │ -0008b020: 3c2f 756c 3e0a 2020 3c6c 693e 0a20 666f
      .
    • . fo │ │ │ -0008b030: 7220 616c 6c20 7468 6520 6f74 6865 7220 r all the other │ │ │ -0008b040: 666c 6167 732c 206e 756d 6265 7220 6f66 flags, number of │ │ │ -0008b050: 2069 6e70 7574 2070 6f69 6e74 7320 6d75 input points mu │ │ │ -0008b060: 7374 2062 6520 2667 743b 3d20 3420 616e st be >= 4 an │ │ │ -0008b070: 6420 6f62 6a65 6374 2070 6f69 6e74 7320 d object points │ │ │ -0008b080: 6361 6e20 6265 2069 6e20 616e 7920 636f can be in any co │ │ │ -0008b090: 6e66 6967 7572 6174 696f 6e2e 0a4f 6e6c nfiguration..Onl │ │ │ -0008b0a0: 7920 3120 736f 6c75 7469 6f6e 2069 7320 y 1 solution is │ │ │ -0008b0b0: 7265 7475 726e 6564 2e0a 2020 3c2f 6c69 returned..
    • .
    . │ │ │ -0008b0e0: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ -0008b0f0: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -0008b100: 6f62 6a65 6374 506f 696e 7473 3c2f 636f objectPoints - Array of o │ │ │ -0008b120: 626a 6563 7420 706f 696e 7473 2069 6e20 bject points in │ │ │ -0008b130: 7468 6520 6f62 6a65 6374 2063 6f6f 7264 the object coord │ │ │ -0008b140: 696e 6174 6520 7370 6163 652c 204e 7833 inate space, Nx3 │ │ │ -0008b150: 2031 2d63 6861 6e6e 656c 206f 720a 3178 1-channel or.1x │ │ │ -0008b160: 4e2f 4e78 3120 332d 6368 616e 6e65 6c2c N/Nx1 3-channel, │ │ │ -0008b170: 2077 6865 7265 204e 2069 7320 7468 6520 where N is the │ │ │ -0008b180: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ -0008b190: 2e20 7665 6374 6f72 266c 743b 506f 696e . vector<Poin │ │ │ -0008b1a0: 7433 6426 6774 3b20 6361 6e20 6265 2061 t3d> can be a │ │ │ -0008b1b0: 6c73 6f20 7061 7373 6564 2068 6572 652e lso passed here. │ │ │ -0008b1c0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -0008b1d0: 696d 6167 6550 6f69 6e74 733c 2f63 6f64 imagePoints - Array of co │ │ │ -0008b1f0: 7272 6573 706f 6e64 696e 6720 696d 6167 rresponding imag │ │ │ -0008b200: 6520 706f 696e 7473 2c20 4e78 3220 312d e points, Nx2 1- │ │ │ -0008b210: 6368 616e 6e65 6c20 6f72 2031 784e 2f4e channel or 1xN/N │ │ │ -0008b220: 7831 2032 2d63 6861 6e6e 656c 2c0a 7768 x1 2-channel,.wh │ │ │ -0008b230: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ -0008b240: 6265 7220 6f66 2070 6f69 6e74 732e 2076 ber of points. v │ │ │ -0008b250: 6563 746f 7226 6c74 3b50 6f69 6e74 3264 ector<Point2d │ │ │ -0008b260: 2667 743b 2063 616e 2062 6520 616c 736f > can be also │ │ │ -0008b270: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    cam │ │ │ -0008b290: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ -0008b2a0: 202d 2049 6e70 7574 2063 616d 6572 6120 - Input camera │ │ │ -0008b2b0: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ -0008b2c0: 205c 285c 6361 6d65 7261 6d61 7472 6978 \(\cameramatrix │ │ │ -0008b2d0: 7b41 7d5c 2920 2e3c 2f64 643e 0a3c 6464 {A}\) .
    .
    distCoeff │ │ │ -0008b2f0: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ -0008b300: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ -0008b310: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ -0008b320: 7473 0a5c 285c 6469 7374 636f 6566 6673 ts.\(\distcoeffs │ │ │ -0008b330: 5c29 2e20 4966 2074 6865 2076 6563 746f \). If the vecto │ │ │ -0008b340: 7220 6973 204e 554c 4c2f 656d 7074 792c r is NULL/empty, │ │ │ -0008b350: 2074 6865 207a 6572 6f20 6469 7374 6f72 the zero distor │ │ │ -0008b360: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ -0008b370: 7320 6172 650a 6173 7375 6d65 642e 3c2f s are.assumed..
    rv │ │ │ -0008b390: 6563 733c 2f63 6f64 653e 202d 2056 6563 ecs - Vec │ │ │ -0008b3a0: 746f 7220 6f66 206f 7574 7075 7420 726f tor of output ro │ │ │ -0008b3b0: 7461 7469 6f6e 2076 6563 746f 7273 2028 tation vectors ( │ │ │ -0008b3c0: 7365 6520 5245 463a 2052 6f64 7269 6775 see REF: Rodrigu │ │ │ -0008b3d0: 6573 2029 2074 6861 742c 2074 6f67 6574 es ) that, toget │ │ │ -0008b3e0: 6865 7220 7769 7468 2074 7665 6373 2c20 her with tvecs, │ │ │ -0008b3f0: 6272 696e 6773 2070 6f69 6e74 7320 6672 brings points fr │ │ │ -0008b400: 6f6d 0a74 6865 206d 6f64 656c 2063 6f6f om.the model coo │ │ │ -0008b410: 7264 696e 6174 6520 7379 7374 656d 2074 rdinate system t │ │ │ -0008b420: 6f20 7468 6520 6361 6d65 7261 2063 6f6f o the camera coo │ │ │ -0008b430: 7264 696e 6174 6520 7379 7374 656d 2e3c rdinate system.< │ │ │ -0008b440: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ -0008b450: 7665 6373 3c2f 636f 6465 3e20 2d20 5665 vecs - Ve │ │ │ -0008b460: 6374 6f72 206f 6620 6f75 7470 7574 2074 ctor of output t │ │ │ -0008b470: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ -0008b480: 7273 2e0a 7468 6520 7072 6f76 6964 6564 rs..the provided │ │ │ -0008b490: 2072 7665 6320 616e 6420 7476 6563 2076 rvec and tvec v │ │ │ -0008b4a0: 616c 7565 7320 6173 2069 6e69 7469 616c alues as initial │ │ │ -0008b4b0: 2061 7070 726f 7869 6d61 7469 6f6e 7320 approximations │ │ │ -0008b4c0: 6f66 2074 6865 2072 6f74 6174 696f 6e20 of the rotation │ │ │ -0008b4d0: 616e 6420 7472 616e 736c 6174 696f 6e0a and translation. │ │ │ -0008b4e0: 7665 6374 6f72 732c 2072 6573 7065 6374 vectors, respect │ │ │ -0008b4f0: 6976 656c 792c 2061 6e64 2066 7572 7468 ively, and furth │ │ │ -0008b500: 6572 206f 7074 696d 697a 6573 2074 6865 er optimizes the │ │ │ -0008b510: 6d2e 0a61 6e64 2075 7365 4578 7472 696e m..and useExtrin │ │ │ -0008b520: 7369 6347 7565 7373 2069 7320 7365 7420 sicGuess is set │ │ │ -0008b530: 746f 2074 7275 652e 0a61 6e64 2075 7365 to true..and use │ │ │ -0008b540: 4578 7472 696e 7369 6347 7565 7373 2069 ExtrinsicGuess i │ │ │ -0008b550: 7320 7365 7420 746f 2074 7275 652e 0a28 s set to true..( │ │ │ -0008b560: 5c28 205c 7465 7874 7b52 4d53 457d 203d \( \text{RMSE} = │ │ │ -0008b570: 205c 7371 7274 7b5c 6672 6163 7b5c 7375 \sqrt{\frac{\su │ │ │ -0008b580: 6d5f 7b69 7d5e 7b4e 7d20 5c6c 6566 7420 m_{i}^{N} \left │ │ │ -0008b590: 2820 5c68 6174 7b79 5f69 7d20 2d20 795f ( \hat{y_i} - y_ │ │ │ -0008b5a0: 6920 5c72 6967 6874 2029 5e32 7d7b 4e7d i \right )^2}{N} │ │ │ -0008b5b0: 7d20 5c29 2920 6265 7477 6565 6e20 7468 } \)) between th │ │ │ -0008b5c0: 6520 696e 7075 7420 696d 6167 6520 706f e input image po │ │ │ -0008b5d0: 696e 7473 0a61 6e64 2074 6865 2033 4420 ints.and the 3D │ │ │ -0008b5e0: 6f62 6a65 6374 2070 6f69 6e74 7320 7072 object points pr │ │ │ -0008b5f0: 6f6a 6563 7465 6420 7769 7468 2074 6865 ojected with the │ │ │ -0008b600: 2065 7374 696d 6174 6564 2070 6f73 652e estimated pose. │ │ │ -0008b610: 0a0a 4d6f 7265 2069 6e66 6f72 6d61 7469 ..More informati │ │ │ -0008b620: 6f6e 2069 7320 6465 7363 7269 6265 6420 on is described │ │ │ -0008b630: 696e 2052 4546 3a20 6361 6c69 6233 645f in REF: calib3d_ │ │ │ -0008b640: 736f 6c76 6550 6e50 0a0a 3c62 3e4e 6f74 solvePnP..Not │ │ │ -0008b650: 653a 3c2f 623e 0a3c 756c 3e0a 2020 3c6c e:.
      . . An exam │ │ │ -0008b670: 706c 6520 6f66 2068 6f77 2074 6f20 7573 ple of how to us │ │ │ -0008b680: 6520 736f 6c76 6550 6e50 2066 6f72 2070 e solvePnP for p │ │ │ -0008b690: 6c61 6e61 7220 6175 676d 656e 7465 6420 lanar augmented │ │ │ -0008b6a0: 7265 616c 6974 7920 6361 6e20 6265 2066 reality can be f │ │ │ -0008b6b0: 6f75 6e64 2061 740a 2020 2020 2020 2020 ound at. │ │ │ -0008b6c0: 6f70 656e 6376 5f73 6f75 7263 655f 636f opencv_source_co │ │ │ -0008b6d0: 6465 2f73 616d 706c 6573 2f70 7974 686f de/samples/pytho │ │ │ -0008b6e0: 6e2f 706c 616e 655f 6172 2e70 790a 2020 n/plane_ar.py. │ │ │ -0008b6f0: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020 .
    • . │ │ │ -0008b700: 2020 2049 6620 796f 7520 6172 6520 7573 If you are us │ │ │ -0008b710: 696e 6720 5079 7468 6f6e 3a0a 2020 3c75 ing Python:. .
    • . │ │ │ -0008b730: 2020 2020 204e 756d 7079 2061 7272 6179 Numpy array │ │ │ -0008b740: 2073 6c69 6365 7320 776f 6e27 7420 776f slices won't wo │ │ │ -0008b750: 726b 2061 7320 696e 7075 7420 6265 6361 rk as input beca │ │ │ -0008b760: 7573 6520 736f 6c76 6550 6e50 2072 6571 use solvePnP req │ │ │ -0008b770: 7569 7265 7320 636f 6e74 6967 756f 7573 uires contiguous │ │ │ -0008b780: 0a20 2020 2020 2020 2061 7272 6179 7320 . arrays │ │ │ -0008b790: 2865 6e66 6f72 6365 6420 6279 2074 6865 (enforced by the │ │ │ -0008b7a0: 2061 7373 6572 7469 6f6e 2075 7369 6e67 assertion using │ │ │ -0008b7b0: 2063 763a 3a4d 6174 3a3a 6368 6563 6b56 cv::Mat::checkV │ │ │ -0008b7c0: 6563 746f 7228 2920 6172 6f75 6e64 206c ector() around l │ │ │ -0008b7d0: 696e 6520 3535 206f 660a 2020 2020 2020 ine 55 of. │ │ │ -0008b7e0: 2020 6d6f 6475 6c65 732f 3364 2f73 7263 modules/3d/src │ │ │ -0008b7f0: 2f73 6f6c 7665 706e 702e 6370 7020 7665 /solvepnp.cpp ve │ │ │ -0008b800: 7273 696f 6e20 322e 342e 3929 0a20 2020 rsion 2.4.9). │ │ │ -0008b810: 203c 2f6c 693e 0a20 2020 203c 6c69 3e0a
    • .
    • . │ │ │ -0008b820: 2020 2020 2020 2020 2054 6865 2050 3350 The P3P │ │ │ -0008b830: 2061 6c67 6f72 6974 686d 2072 6571 7569 algorithm requi │ │ │ -0008b840: 7265 7320 696d 6167 6520 706f 696e 7473 res image points │ │ │ -0008b850: 2074 6f20 6265 2069 6e20 616e 2061 7272 to be in an arr │ │ │ -0008b860: 6179 206f 6620 7368 6170 6520 284e 2c31 ay of shape (N,1 │ │ │ -0008b870: 2c32 2920 6475 650a 2020 2020 2020 2020 ,2) due. │ │ │ -0008b880: 746f 2069 7473 2063 616c 6c69 6e67 206f to its calling o │ │ │ -0008b890: 6620 2375 6e64 6973 746f 7274 506f 696e f #undistortPoin │ │ │ -0008b8a0: 7473 2028 6172 6f75 6e64 206c 696e 6520 ts (around line │ │ │ -0008b8b0: 3735 206f 6620 6d6f 6475 6c65 732f 3364 75 of modules/3d │ │ │ -0008b8c0: 2f73 7263 2f73 6f6c 7665 706e 702e 6370 /src/solvepnp.cp │ │ │ -0008b8d0: 7020 7665 7273 696f 6e20 322e 342e 3929 p version 2.4.9) │ │ │ -0008b8e0: 0a20 2020 2020 2020 2077 6869 6368 2072 . which r │ │ │ -0008b8f0: 6571 7569 7265 7320 322d 6368 616e 6e65 equires 2-channe │ │ │ -0008b900: 6c20 696e 666f 726d 6174 696f 6e2e 0a20 l information.. │ │ │ -0008b910: 2020 203c 2f6c 693e 0a20 2020 203c 6c69
    • .
    • . Thus, │ │ │ -0008b930: 2067 6976 656e 2073 6f6d 6520 6461 7461 given some data │ │ │ -0008b940: 2044 203d 206e 702e 6172 7261 7928 2e2e D = np.array(.. │ │ │ -0008b950: 2e29 2077 6865 7265 2044 2e73 6861 7065 .) where D.shape │ │ │ -0008b960: 203d 2028 4e2c 4d29 2c20 696e 206f 7264 = (N,M), in ord │ │ │ -0008b970: 6572 2074 6f20 7573 6520 6120 7375 6273 er to use a subs │ │ │ -0008b980: 6574 206f 660a 2020 2020 2020 2020 6974 et of. it │ │ │ -0008b990: 2061 732c 2065 2e67 2e2c 2069 6d61 6765 as, e.g., image │ │ │ -0008b9a0: 506f 696e 7473 2c20 6f6e 6520 6d75 7374 Points, one must │ │ │ -0008b9b0: 2065 6666 6563 7469 7665 6c79 2063 6f70 effectively cop │ │ │ -0008b9c0: 7920 6974 2069 6e74 6f20 6120 6e65 7720 y it into a new │ │ │ -0008b9d0: 6172 7261 793a 2069 6d61 6765 506f 696e array: imagePoin │ │ │ -0008b9e0: 7473 203d 0a20 2020 2020 2020 206e 702e ts =. np. │ │ │ -0008b9f0: 6173 636f 6e74 6967 756f 7573 6172 7261 ascontiguousarra │ │ │ -0008ba00: 7928 445b 3a2c 3a32 5d29 2e72 6573 6861 y(D[:,:2]).resha │ │ │ -0008ba10: 7065 2828 4e2c 312c 3229 290a 2020 2020 pe((N,1,2)). │ │ │ -0008ba20: 3c2f 6c69 3e0a 2020 3c2f 756c 3e0a 2020
    • .
    . │ │ │ -0008ba30: 3c6c 693e 0a20 2020 2020 2054 6865 206d
  • . The m │ │ │ -0008ba40: 696e 696d 756d 206e 756d 6265 7220 6f66 inimum number of │ │ │ -0008ba50: 2070 6f69 6e74 7320 6973 2034 2069 6e20 points is 4 in │ │ │ -0008ba60: 7468 6520 6765 6e65 7261 6c20 6361 7365 the general case │ │ │ -0008ba70: 2e20 496e 2074 6865 2063 6173 6520 6f66 . In the case of │ │ │ -0008ba80: 2052 4546 3a20 534f 4c56 4550 4e50 5f50 REF: SOLVEPNP_P │ │ │ -0008ba90: 3350 2061 6e64 2052 4546 3a20 534f 4c56 3P and REF: SOLV │ │ │ -0008baa0: 4550 4e50 5f41 5033 500a 2020 2020 2020 EPNP_AP3P. │ │ │ -0008bab0: 206d 6574 686f 6473 2c20 6974 2069 7320 methods, it is │ │ │ -0008bac0: 7265 7175 6972 6564 2074 6f20 7573 6520 required to use │ │ │ -0008bad0: 6578 6163 746c 7920 3420 706f 696e 7473 exactly 4 points │ │ │ -0008bae0: 2028 7468 6520 6669 7273 7420 3320 706f (the first 3 po │ │ │ -0008baf0: 696e 7473 2061 7265 2075 7365 6420 746f ints are used to │ │ │ -0008bb00: 2065 7374 696d 6174 6520 616c 6c20 7468 estimate all th │ │ │ -0008bb10: 6520 736f 6c75 7469 6f6e 730a 2020 2020 e solutions. │ │ │ -0008bb20: 2020 206f 6620 7468 6520 5033 5020 7072 of the P3P pr │ │ │ -0008bb30: 6f62 6c65 6d2c 2074 6865 206c 6173 7420 oblem, the last │ │ │ -0008bb40: 6f6e 6520 6973 2075 7365 6420 746f 2072 one is used to r │ │ │ -0008bb50: 6574 6169 6e20 7468 6520 6265 7374 2073 etain the best s │ │ │ -0008bb60: 6f6c 7574 696f 6e20 7468 6174 206d 696e olution that min │ │ │ -0008bb70: 696d 697a 6573 2074 6865 2072 6570 726f imizes the repro │ │ │ -0008bb80: 6a65 6374 696f 6e20 6572 726f 7229 2e0a jection error).. │ │ │ -0008bb90: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
  • .
  • . │ │ │ -0008bba0: 2020 2020 2057 6974 6820 5245 463a 2053 With REF: S │ │ │ -0008bbb0: 4f4c 5645 504e 505f 4954 4552 4154 4956 OLVEPNP_ITERATIV │ │ │ -0008bbc0: 4520 6d65 7468 6f64 2061 6e64 203c 636f E method and useExtrinsicG │ │ │ -0008bbe0: 7565 7373 3d74 7275 653c 2f63 6f64 653e uess=true │ │ │ -0008bbf0: 2c20 7468 6520 6d69 6e69 6d75 6d20 6e75 , the minimum nu │ │ │ -0008bc00: 6d62 6572 206f 6620 706f 696e 7473 2069 mber of points i │ │ │ -0008bc10: 7320 3320 2833 2070 6f69 6e74 730a 2020 s 3 (3 points. │ │ │ -0008bc20: 2020 2020 2061 7265 2073 7566 6669 6369 are suffici │ │ │ -0008bc30: 656e 7420 746f 2063 6f6d 7075 7465 2061 ent to compute a │ │ │ -0008bc40: 2070 6f73 6520 6275 7420 7468 6572 6520 pose but there │ │ │ -0008bc50: 6172 6520 7570 2074 6f20 3420 736f 6c75 are up to 4 solu │ │ │ -0008bc60: 7469 6f6e 7329 2e20 5468 6520 696e 6974 tions). The init │ │ │ -0008bc70: 6961 6c20 736f 6c75 7469 6f6e 2073 686f ial solution sho │ │ │ -0008bc80: 756c 6420 6265 2063 6c6f 7365 2074 6f20 uld be close to │ │ │ -0008bc90: 7468 650a 2020 2020 2020 2067 6c6f 6261 the. globa │ │ │ -0008bca0: 6c20 736f 6c75 7469 6f6e 2074 6f20 636f l solution to co │ │ │ -0008bcb0: 6e76 6572 6765 2e0a 2020 3c2f 6c69 3e0a nverge..
  • . │ │ │ -0008bcc0: 2020 3c6c 693e 0a20 2020 2020 2057 6974
  • . Wit │ │ │ -0008bcd0: 6820 5245 463a 2053 4f4c 5645 504e 505f h REF: SOLVEPNP_ │ │ │ -0008bce0: 4950 5045 2069 6e70 7574 2070 6f69 6e74 IPPE input point │ │ │ -0008bcf0: 7320 6d75 7374 2062 6520 2667 743b 3d20 s must be >= │ │ │ -0008bd00: 3420 616e 6420 6f62 6a65 6374 2070 6f69 4 and object poi │ │ │ -0008bd10: 6e74 7320 6d75 7374 2062 6520 636f 706c nts must be copl │ │ │ -0008bd20: 616e 6172 2e0a 2020 3c2f 6c69 3e0a 2020 anar..
  • . │ │ │ -0008bd30: 3c6c 693e 0a20 2020 2020 2057 6974 6820
  • . With │ │ │ -0008bd40: 5245 463a 2053 4f4c 5645 504e 505f 4950 REF: SOLVEPNP_IP │ │ │ -0008bd50: 5045 5f53 5155 4152 4520 7468 6973 2069 PE_SQUARE this i │ │ │ -0008bd60: 7320 6120 7370 6563 6961 6c20 6361 7365 s a special case │ │ │ -0008bd70: 2073 7569 7461 626c 6520 666f 7220 6d61 suitable for ma │ │ │ -0008bd80: 726b 6572 2070 6f73 6520 6573 7469 6d61 rker pose estima │ │ │ -0008bd90: 7469 6f6e 2e0a 2020 2020 2020 204e 756d tion.. Num │ │ │ -0008bda0: 6265 7220 6f66 2069 6e70 7574 2070 6f69 ber of input poi │ │ │ -0008bdb0: 6e74 7320 6d75 7374 2062 6520 342e 204f nts must be 4. O │ │ │ -0008bdc0: 626a 6563 7420 706f 696e 7473 206d 7573 bject points mus │ │ │ -0008bdd0: 7420 6265 2064 6566 696e 6564 2069 6e20 t be defined in │ │ │ -0008bde0: 7468 6520 666f 6c6c 6f77 696e 6720 6f72 the following or │ │ │ -0008bdf0: 6465 723a 0a20 203c 756c 3e0a 2020 2020 der:.
      . │ │ │ -0008be00: 3c6c 693e 0a20 2020 2020 2020 2020 2070
    • . p │ │ │ -0008be10: 6f69 6e74 2030 3a20 5b2d 7371 7561 7265 oint 0: [-square │ │ │ -0008be20: 4c65 6e67 7468 202f 2032 2c20 2073 7175 Length / 2, squ │ │ │ -0008be30: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ -0008be40: 5d0a 2020 2020 3c2f 6c69 3e0a 2020 2020 ].
    • . │ │ │ -0008be50: 3c6c 693e 0a20 2020 2020 2020 2020 2070
    • . p │ │ │ -0008be60: 6f69 6e74 2031 3a20 5b20 7371 7561 7265 oint 1: [ square │ │ │ -0008be70: 4c65 6e67 7468 202f 2032 2c20 2073 7175 Length / 2, squ │ │ │ -0008be80: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ -0008be90: 5d0a 2020 2020 3c2f 6c69 3e0a 2020 2020 ].
    • . │ │ │ -0008bea0: 3c6c 693e 0a20 2020 2020 2020 2020 2070
    • . p │ │ │ -0008beb0: 6f69 6e74 2032 3a20 5b20 7371 7561 7265 oint 2: [ square │ │ │ -0008bec0: 4c65 6e67 7468 202f 2032 2c20 2d73 7175 Length / 2, -squ │ │ │ -0008bed0: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ -0008bee0: 5d0a 2020 2020 3c2f 6c69 3e0a 2020 2020 ].
    • . │ │ │ -0008bef0: 3c6c 693e 0a20 2020 2020 2020 2020 2070
    • . p │ │ │ -0008bf00: 6f69 6e74 2033 3a20 5b2d 7371 7561 7265 oint 3: [-square │ │ │ -0008bf10: 4c65 6e67 7468 202f 2032 2c20 2d73 7175 Length / 2, -squ │ │ │ -0008bf20: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ -0008bf30: 5d0a 2020 2020 3c2f 6c69 3e0a 2020 3c2f ].
    • . .
    • . │ │ │ -0008bf50: 2057 6974 6820 5245 463a 2053 4f4c 5645 With REF: SOLVE │ │ │ -0008bf60: 504e 505f 5351 504e 5020 696e 7075 7420 PNP_SQPNP input │ │ │ -0008bf70: 706f 696e 7473 206d 7573 7420 6265 2026 points must be & │ │ │ -0008bf80: 6774 3b3d 2033 0a20 203c 2f6c 693e 0a3c gt;= 3.
    • .< │ │ │ -0008bf90: 2f75 6c3e 3c2f 6464 3e0a 3c64 743e 5265 /ul>
  • .
    Re │ │ │ -0008bfa0: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ -0008bfb0: 6175 746f 6d61 7469 6361 6c6c 7920 6765 automatically ge │ │ │ -0008bfc0: 6e65 7261 7465 643c 2f64 643e 0a3c 2f64 nerated
    .
    .
    ..
  • .
    .

    decompos │ │ │ +00071540: 6550 726f 6a65 6374 696f 6e4d 6174 7269 eProjectionMatri │ │ │ +00071550: 783c 2f68 333e 0a3c 6469 7620 636c 6173 x

    .
    .
    pub │ │ │ +000715b0: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static void&nbs │ │ │ +000715f0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;dec │ │ │ +00071610: 6f6d 706f 7365 5072 6f6a 6563 7469 6f6e omposeProjection │ │ │ +00071620: 4d61 7472 6978 3c2f 7370 616e 3e3c 7762 Matrix(Mat& │ │ │ +00071690: 6e62 7370 3b70 726f 6a4d 6174 7269 782c nbsp;projMatrix, │ │ │ +000716a0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000716e0: 743c 2f61 3e26 6e62 7370 3b63 616d 6572 t camer │ │ │ +000716f0: 614d 6174 7269 782c 0a20 3c61 2068 7265 aMatrix,. Mat&nb │ │ │ +00071740: 7370 3b72 6f74 4d61 7472 6978 2c0a 203c sp;rotMatrix,. < │ │ │ +00071750: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00071760: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +00071770: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +00071780: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat transVec │ │ │ +000717a0: 742c 0a20 3c61 2068 7265 663d 222e 2e2f t,. │ │ │ +000717e0: 4d61 743c 2f61 3e26 6e62 7370 3b72 6f74 Mat rot │ │ │ +000717f0: 4d61 7472 6978 582c 0a20 3c61 2068 7265 MatrixX,. Mat&nb │ │ │ +00071840: 7370 3b72 6f74 4d61 7472 6978 5929 3c2f sp;rotMatrixY)
    .
    D │ │ │ +00071870: 6563 6f6d 706f 7365 7320 6120 7072 6f6a ecomposes a proj │ │ │ +00071880: 6563 7469 6f6e 206d 6174 7269 7820 696e ection matrix in │ │ │ +00071890: 746f 2061 2072 6f74 6174 696f 6e20 6d61 to a rotation ma │ │ │ +000718a0: 7472 6978 2061 6e64 2061 2063 616d 6572 trix and a camer │ │ │ +000718b0: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ +000718c0: 6978 2e3c 2f64 6976 3e0a 3c64 6c20 636c ix.
    .
    .
    Parameters:
    .
    proj │ │ │ +00071900: 4d61 7472 6978 3c2f 636f 6465 3e20 2d20 Matrix - │ │ │ +00071910: 3378 3420 696e 7075 7420 7072 6f6a 6563 3x4 input projec │ │ │ +00071920: 7469 6f6e 206d 6174 7269 7820 502e 3c2f tion matrix P..
    ca │ │ │ +00071940: 6d65 7261 4d61 7472 6978 3c2f 636f 6465 meraMatrix - Output 3x3 c │ │ │ +00071960: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ +00071970: 6d61 7472 6978 205c 285c 6361 6d65 7261 matrix \(\camera │ │ │ +00071980: 6d61 7472 6978 7b41 7d5c 292e 3c2f 6464 matrix{A}\).
    .
    rotM │ │ │ +000719a0: 6174 7269 783c 2f63 6f64 653e 202d 204f atrix - O │ │ │ +000719b0: 7574 7075 7420 3378 3320 6578 7465 726e utput 3x3 extern │ │ │ +000719c0: 616c 2072 6f74 6174 696f 6e20 6d61 7472 al rotation matr │ │ │ +000719d0: 6978 2052 2e3c 2f64 643e 0a3c 6464 3e3c ix R.
    .
    < │ │ │ +000719e0: 636f 6465 3e74 7261 6e73 5665 6374 3c2f code>transVect - Output 4 │ │ │ +00071a00: 7831 2074 7261 6e73 6c61 7469 6f6e 2076 x1 translation v │ │ │ +00071a10: 6563 746f 7220 542e 3c2f 6464 3e0a 3c64 ector T.
    .rotMatri │ │ │ +00071a30: 7858 3c2f 636f 6465 3e20 2d20 4f70 7469 xX - Opti │ │ │ +00071a40: 6f6e 616c 2033 7833 2072 6f74 6174 696f onal 3x3 rotatio │ │ │ +00071a50: 6e20 6d61 7472 6978 2061 726f 756e 6420 n matrix around │ │ │ +00071a60: 782d 6178 6973 2e3c 2f64 643e 0a3c 6464 x-axis..
    rotMatrix │ │ │ +00071a80: 593c 2f63 6f64 653e 202d 204f 7074 696f Y - Optio │ │ │ +00071a90: 6e61 6c20 3378 3320 726f 7461 7469 6f6e nal 3x3 rotation │ │ │ +00071aa0: 206d 6174 7269 7820 6172 6f75 6e64 2079 matrix around y │ │ │ +00071ab0: 2d61 7869 732e 0a64 6567 7265 6573 2e0a -axis..degrees.. │ │ │ +00071ac0: 0a54 6865 2066 756e 6374 696f 6e20 636f .The function co │ │ │ +00071ad0: 6d70 7574 6573 2061 2064 6563 6f6d 706f mputes a decompo │ │ │ +00071ae0: 7369 7469 6f6e 206f 6620 6120 7072 6f6a sition of a proj │ │ │ +00071af0: 6563 7469 6f6e 206d 6174 7269 7820 696e ection matrix in │ │ │ +00071b00: 746f 2061 2063 616c 6962 7261 7469 6f6e to a calibration │ │ │ +00071b10: 2061 6e64 2061 2072 6f74 6174 696f 6e0a and a rotation. │ │ │ +00071b20: 6d61 7472 6978 2061 6e64 2074 6865 2070 matrix and the p │ │ │ +00071b30: 6f73 6974 696f 6e20 6f66 2061 2063 616d osition of a cam │ │ │ +00071b40: 6572 612e 0a0a 4974 206f 7074 696f 6e61 era...It optiona │ │ │ +00071b50: 6c6c 7920 7265 7475 726e 7320 7468 7265 lly returns thre │ │ │ +00071b60: 6520 726f 7461 7469 6f6e 206d 6174 7269 e rotation matri │ │ │ +00071b70: 6365 732c 206f 6e65 2066 6f72 2065 6163 ces, one for eac │ │ │ +00071b80: 6820 6178 6973 2c20 616e 6420 7468 7265 h axis, and thre │ │ │ +00071b90: 6520 4575 6c65 7220 616e 676c 6573 2074 e Euler angles t │ │ │ +00071ba0: 6861 7420 636f 756c 640a 6265 2075 7365 hat could.be use │ │ │ +00071bb0: 6420 696e 204f 7065 6e47 4c2e 204e 6f74 d in OpenGL. Not │ │ │ +00071bc0: 652c 2074 6865 7265 2069 7320 616c 7761 e, there is alwa │ │ │ +00071bd0: 7973 206d 6f72 6520 7468 616e 206f 6e65 ys more than one │ │ │ +00071be0: 2073 6571 7565 6e63 6520 6f66 2072 6f74 sequence of rot │ │ │ +00071bf0: 6174 696f 6e73 2061 626f 7574 2074 6865 ations about the │ │ │ +00071c00: 2074 6872 6565 0a70 7269 6e63 6970 616c three.principal │ │ │ +00071c10: 2061 7865 7320 7468 6174 2072 6573 756c axes that resul │ │ │ +00071c20: 7473 2069 6e20 7468 6520 7361 6d65 206f ts in the same o │ │ │ +00071c30: 7269 656e 7461 7469 6f6e 206f 6620 616e rientation of an │ │ │ +00071c40: 206f 626a 6563 742c 2065 2e67 2e20 7365 object, e.g. se │ │ │ +00071c50: 6520 4349 5445 3a20 536c 6162 6175 6768 e CITE: Slabaugh │ │ │ +00071c60: 202e 2052 6574 7572 6e65 640a 7468 7265 . Returned.thre │ │ │ +00071c70: 6520 726f 7461 7469 6f6e 206d 6174 7269 e rotation matri │ │ │ +00071c80: 6365 7320 616e 6420 636f 7272 6573 706f ces and correspo │ │ │ +00071c90: 6e64 696e 6720 7468 7265 6520 4575 6c65 nding three Eule │ │ │ +00071ca0: 7220 616e 676c 6573 2061 7265 206f 6e6c r angles are onl │ │ │ +00071cb0: 7920 6f6e 6520 6f66 2074 6865 2070 6f73 y one of the pos │ │ │ +00071cc0: 7369 626c 6520 736f 6c75 7469 6f6e 732e sible solutions. │ │ │ +00071cd0: 0a0a 5468 6520 6675 6e63 7469 6f6e 2069 ..The function i │ │ │ +00071ce0: 7320 6261 7365 6420 6f6e 2023 5251 4465 s based on #RQDe │ │ │ +00071cf0: 636f 6d70 3378 3320 2e3c 2f64 643e 0a3c comp3x3 .
    .< │ │ │ +00071d00: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ...
  • .
    .< │ │ │ +00071dc0: 6833 3e64 6563 6f6d 706f 7365 5072 6f6a h3>decomposeProj │ │ │ +00071dd0: 6563 7469 6f6e 4d61 7472 6978 3c2f 6833 ectionMatrix.
    .
    │ │ │ +00071e20: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +00071e40: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +00071e50: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;void │ │ │ +00071e70: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  decompos │ │ │ +00071ea0: 6550 726f 6a65 6374 696f 6e4d 6174 7269 eProjectionMatri │ │ │ +00071eb0: 783c 2f73 7061 6e3e 3c77 6272 3e3c 7370 x(Mat  │ │ │ +00071f20: 7072 6f6a 4d61 7472 6978 2c0a 203c 6120 projMatrix,. Mat │ │ │ +00071f70: 266e 6273 703b 6361 6d65 7261 4d61 7472  cameraMatr │ │ │ +00071f80: 6978 2c0a 203c 6120 6872 6566 3d22 2e2e ix,. Mat ro │ │ │ +00071fd0: 744d 6174 7269 782c 0a20 3c61 2068 7265 tMatrix,. Mat&nb │ │ │ +00072020: 7370 3b74 7261 6e73 5665 6374 2c0a 203c sp;transVect,. < │ │ │ +00072030: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00072040: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +00072050: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +00072060: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat rotMatri │ │ │ +00072080: 7858 293c 2f73 7061 6e3e 3c2f 6469 763e xX)
    │ │ │ +00072090: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Decomposes a │ │ │ +000720b0: 2070 726f 6a65 6374 696f 6e20 6d61 7472 projection matr │ │ │ +000720c0: 6978 2069 6e74 6f20 6120 726f 7461 7469 ix into a rotati │ │ │ +000720d0: 6f6e 206d 6174 7269 7820 616e 6420 6120 on matrix and a │ │ │ +000720e0: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ +000720f0: 206d 6174 7269 782e 3c2f 6469 763e 0a3c matrix.
    .< │ │ │ +00072100: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ +00072110: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ +00072120: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    projMatrix - 3x4 input p │ │ │ +00072150: 726f 6a65 6374 696f 6e20 6d61 7472 6978 rojection matrix │ │ │ +00072160: 2050 2e3c 2f64 643e 0a3c 6464 3e3c 636f P.
    .
    cameraMatrix< │ │ │ +00072180: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ +00072190: 3378 3320 6361 6d65 7261 2069 6e74 7269 3x3 camera intri │ │ │ +000721a0: 6e73 6963 206d 6174 7269 7820 5c28 5c63 nsic matrix \(\c │ │ │ +000721b0: 616d 6572 616d 6174 7269 787b 417d 5c29 ameramatrix{A}\) │ │ │ +000721c0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    rotMatrix - Output 3x3 e │ │ │ +000721f0: 7874 6572 6e61 6c20 726f 7461 7469 6f6e xternal rotation │ │ │ +00072200: 206d 6174 7269 7820 522e 3c2f 6464 3e0a matrix R.
    . │ │ │ +00072210: 3c64 643e 3c63 6f64 653e 7472 616e 7356
    transV │ │ │ +00072220: 6563 743c 2f63 6f64 653e 202d 204f 7574 ect - Out │ │ │ +00072230: 7075 7420 3478 3120 7472 616e 736c 6174 put 4x1 translat │ │ │ +00072240: 696f 6e20 7665 6374 6f72 2054 2e3c 2f64 ion vector T..
    rot │ │ │ +00072260: 4d61 7472 6978 583c 2f63 6f64 653e 202d MatrixX - │ │ │ +00072270: 204f 7074 696f 6e61 6c20 3378 3320 726f Optional 3x3 ro │ │ │ +00072280: 7461 7469 6f6e 206d 6174 7269 7820 6172 tation matrix ar │ │ │ +00072290: 6f75 6e64 2078 2d61 7869 732e 0a64 6567 ound x-axis..deg │ │ │ +000722a0: 7265 6573 2e0a 0a54 6865 2066 756e 6374 rees...The funct │ │ │ +000722b0: 696f 6e20 636f 6d70 7574 6573 2061 2064 ion computes a d │ │ │ +000722c0: 6563 6f6d 706f 7369 7469 6f6e 206f 6620 ecomposition of │ │ │ +000722d0: 6120 7072 6f6a 6563 7469 6f6e 206d 6174 a projection mat │ │ │ +000722e0: 7269 7820 696e 746f 2061 2063 616c 6962 rix into a calib │ │ │ +000722f0: 7261 7469 6f6e 2061 6e64 2061 2072 6f74 ration and a rot │ │ │ +00072300: 6174 696f 6e0a 6d61 7472 6978 2061 6e64 ation.matrix and │ │ │ +00072310: 2074 6865 2070 6f73 6974 696f 6e20 6f66 the position of │ │ │ +00072320: 2061 2063 616d 6572 612e 0a0a 4974 206f a camera...It o │ │ │ +00072330: 7074 696f 6e61 6c6c 7920 7265 7475 726e ptionally return │ │ │ +00072340: 7320 7468 7265 6520 726f 7461 7469 6f6e s three rotation │ │ │ +00072350: 206d 6174 7269 6365 732c 206f 6e65 2066 matrices, one f │ │ │ +00072360: 6f72 2065 6163 6820 6178 6973 2c20 616e or each axis, an │ │ │ +00072370: 6420 7468 7265 6520 4575 6c65 7220 616e d three Euler an │ │ │ +00072380: 676c 6573 2074 6861 7420 636f 756c 640a gles that could. │ │ │ +00072390: 6265 2075 7365 6420 696e 204f 7065 6e47 be used in OpenG │ │ │ +000723a0: 4c2e 204e 6f74 652c 2074 6865 7265 2069 L. Note, there i │ │ │ +000723b0: 7320 616c 7761 7973 206d 6f72 6520 7468 s always more th │ │ │ +000723c0: 616e 206f 6e65 2073 6571 7565 6e63 6520 an one sequence │ │ │ +000723d0: 6f66 2072 6f74 6174 696f 6e73 2061 626f of rotations abo │ │ │ +000723e0: 7574 2074 6865 2074 6872 6565 0a70 7269 ut the three.pri │ │ │ +000723f0: 6e63 6970 616c 2061 7865 7320 7468 6174 ncipal axes that │ │ │ +00072400: 2072 6573 756c 7473 2069 6e20 7468 6520 results in the │ │ │ +00072410: 7361 6d65 206f 7269 656e 7461 7469 6f6e same orientation │ │ │ +00072420: 206f 6620 616e 206f 626a 6563 742c 2065 of an object, e │ │ │ +00072430: 2e67 2e20 7365 6520 4349 5445 3a20 536c .g. see CITE: Sl │ │ │ +00072440: 6162 6175 6768 202e 2052 6574 7572 6e65 abaugh . Returne │ │ │ +00072450: 640a 7468 7265 6520 726f 7461 7469 6f6e d.three rotation │ │ │ +00072460: 206d 6174 7269 6365 7320 616e 6420 636f matrices and co │ │ │ +00072470: 7272 6573 706f 6e64 696e 6720 7468 7265 rresponding thre │ │ │ +00072480: 6520 4575 6c65 7220 616e 676c 6573 2061 e Euler angles a │ │ │ +00072490: 7265 206f 6e6c 7920 6f6e 6520 6f66 2074 re only one of t │ │ │ +000724a0: 6865 2070 6f73 7369 626c 6520 736f 6c75 he possible solu │ │ │ +000724b0: 7469 6f6e 732e 0a0a 5468 6520 6675 6e63 tions...The func │ │ │ +000724c0: 7469 6f6e 2069 7320 6261 7365 6420 6f6e tion is based on │ │ │ +000724d0: 2023 5251 4465 636f 6d70 3378 3320 2e3c #RQDecomp3x3 .< │ │ │ +000724e0: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>..
    .
    ..
  • .
    │ │ │ +00072590: 0a3c 6833 3e64 6563 6f6d 706f 7365 5072 .

    decomposePr │ │ │ +000725a0: 6f6a 6563 7469 6f6e 4d61 7472 6978 3c2f ojectionMatrix.
    .
    public │ │ │ +00072610: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +00072620: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;vo │ │ │ +00072640: 6964 3c2f 7370 616e 3e26 6e62 7370 3b3c id < │ │ │ +00072650: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +00072660: 656e 742d 6e61 6d65 223e 6465 636f 6d70 ent-name">decomp │ │ │ +00072670: 6f73 6550 726f 6a65 6374 696f 6e4d 6174 oseProjectionMat │ │ │ +00072680: 7269 783c 2f73 7061 6e3e 3c77 6272 3e3c rix< │ │ │ +00072690: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +000726a0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ +000726f0: 703b 7072 6f6a 4d61 7472 6978 2c0a 203c p;projMatrix,. < │ │ │ +00072700: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00072710: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +00072720: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +00072730: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ +00072750: 7472 6978 2c0a 203c 6120 6872 6566 3d22 trix,. Mat  │ │ │ +000727a0: 726f 744d 6174 7269 782c 0a20 3c61 2068 rotMatrix,. Mat& │ │ │ +000727f0: 6e62 7370 3b74 7261 6e73 5665 6374 293c nbsp;transVect)< │ │ │ +00072800: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ +00072820: 4465 636f 6d70 6f73 6573 2061 2070 726f Decomposes a pro │ │ │ +00072830: 6a65 6374 696f 6e20 6d61 7472 6978 2069 jection matrix i │ │ │ +00072840: 6e74 6f20 6120 726f 7461 7469 6f6e 206d nto a rotation m │ │ │ +00072850: 6174 7269 7820 616e 6420 6120 6361 6d65 atrix and a came │ │ │ +00072860: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ +00072870: 7269 782e 3c2f 6469 763e 0a3c 646c 2063 rix.
    .
    .Parameters:.
    pro │ │ │ +000728b0: 6a4d 6174 7269 783c 2f63 6f64 653e 202d jMatrix - │ │ │ +000728c0: 2033 7834 2069 6e70 7574 2070 726f 6a65 3x4 input proje │ │ │ +000728d0: 6374 696f 6e20 6d61 7472 6978 2050 2e3c ction matrix P.< │ │ │ +000728e0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ +000728f0: 616d 6572 614d 6174 7269 783c 2f63 6f64 ameraMatrix - Output 3x3 │ │ │ +00072910: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ +00072920: 206d 6174 7269 7820 5c28 5c63 616d 6572 matrix \(\camer │ │ │ +00072930: 616d 6174 7269 787b 417d 5c29 2e3c 2f64 amatrix{A}\)..
    rot │ │ │ +00072950: 4d61 7472 6978 3c2f 636f 6465 3e20 2d20 Matrix - │ │ │ +00072960: 4f75 7470 7574 2033 7833 2065 7874 6572 Output 3x3 exter │ │ │ +00072970: 6e61 6c20 726f 7461 7469 6f6e 206d 6174 nal rotation mat │ │ │ +00072980: 7269 7820 522e 3c2f 6464 3e0a 3c64 643e rix R.
    .
    │ │ │ +00072990: 3c63 6f64 653e 7472 616e 7356 6563 743c transVect< │ │ │ +000729a0: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ +000729b0: 3478 3120 7472 616e 736c 6174 696f 6e20 4x1 translation │ │ │ +000729c0: 7665 6374 6f72 2054 2e0a 6465 6772 6565 vector T..degree │ │ │ +000729d0: 732e 0a0a 5468 6520 6675 6e63 7469 6f6e s...The function │ │ │ +000729e0: 2063 6f6d 7075 7465 7320 6120 6465 636f computes a deco │ │ │ +000729f0: 6d70 6f73 6974 696f 6e20 6f66 2061 2070 mposition of a p │ │ │ +00072a00: 726f 6a65 6374 696f 6e20 6d61 7472 6978 rojection matrix │ │ │ +00072a10: 2069 6e74 6f20 6120 6361 6c69 6272 6174 into a calibrat │ │ │ +00072a20: 696f 6e20 616e 6420 6120 726f 7461 7469 ion and a rotati │ │ │ +00072a30: 6f6e 0a6d 6174 7269 7820 616e 6420 7468 on.matrix and th │ │ │ +00072a40: 6520 706f 7369 7469 6f6e 206f 6620 6120 e position of a │ │ │ +00072a50: 6361 6d65 7261 2e0a 0a49 7420 6f70 7469 camera...It opti │ │ │ +00072a60: 6f6e 616c 6c79 2072 6574 7572 6e73 2074 onally returns t │ │ │ +00072a70: 6872 6565 2072 6f74 6174 696f 6e20 6d61 hree rotation ma │ │ │ +00072a80: 7472 6963 6573 2c20 6f6e 6520 666f 7220 trices, one for │ │ │ +00072a90: 6561 6368 2061 7869 732c 2061 6e64 2074 each axis, and t │ │ │ +00072aa0: 6872 6565 2045 756c 6572 2061 6e67 6c65 hree Euler angle │ │ │ +00072ab0: 7320 7468 6174 2063 6f75 6c64 0a62 6520 s that could.be │ │ │ +00072ac0: 7573 6564 2069 6e20 4f70 656e 474c 2e20 used in OpenGL. │ │ │ +00072ad0: 4e6f 7465 2c20 7468 6572 6520 6973 2061 Note, there is a │ │ │ +00072ae0: 6c77 6179 7320 6d6f 7265 2074 6861 6e20 lways more than │ │ │ +00072af0: 6f6e 6520 7365 7175 656e 6365 206f 6620 one sequence of │ │ │ +00072b00: 726f 7461 7469 6f6e 7320 6162 6f75 7420 rotations about │ │ │ +00072b10: 7468 6520 7468 7265 650a 7072 696e 6369 the three.princi │ │ │ +00072b20: 7061 6c20 6178 6573 2074 6861 7420 7265 pal axes that re │ │ │ +00072b30: 7375 6c74 7320 696e 2074 6865 2073 616d sults in the sam │ │ │ +00072b40: 6520 6f72 6965 6e74 6174 696f 6e20 6f66 e orientation of │ │ │ +00072b50: 2061 6e20 6f62 6a65 6374 2c20 652e 672e an object, e.g. │ │ │ +00072b60: 2073 6565 2043 4954 453a 2053 6c61 6261 see CITE: Slaba │ │ │ +00072b70: 7567 6820 2e20 5265 7475 726e 6564 0a74 ugh . Returned.t │ │ │ +00072b80: 6872 6565 2072 6f74 6174 696f 6e20 6d61 hree rotation ma │ │ │ +00072b90: 7472 6963 6573 2061 6e64 2063 6f72 7265 trices and corre │ │ │ +00072ba0: 7370 6f6e 6469 6e67 2074 6872 6565 2045 sponding three E │ │ │ +00072bb0: 756c 6572 2061 6e67 6c65 7320 6172 6520 uler angles are │ │ │ +00072bc0: 6f6e 6c79 206f 6e65 206f 6620 7468 6520 only one of the │ │ │ +00072bd0: 706f 7373 6962 6c65 2073 6f6c 7574 696f possible solutio │ │ │ +00072be0: 6e73 2e0a 0a54 6865 2066 756e 6374 696f ns...The functio │ │ │ +00072bf0: 6e20 6973 2062 6173 6564 206f 6e20 2352 n is based on #R │ │ │ +00072c00: 5144 6563 6f6d 7033 7833 202e 3c2f 6464 QDecomp3x3 .
    .
    ..< │ │ │ +00072c20: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.

  • . │ │ │ +00072c30: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    . │ │ │ +00072cb0: 3c68 333e 6d61 744d 756c 4465 7269 763c

    matMulDeriv< │ │ │ +00072cc0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +00072d20: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +00072d30: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;v │ │ │ +00072d50: 6f69 643c 2f73 7061 6e3e 266e 6273 703b oid  │ │ │ +00072d60: 3c73 7061 6e20 636c 6173 733d 2265 6c65 matMu │ │ │ +00072d80: 6c44 6572 6976 3c2f 7370 616e 3e3c 7762 lDeriv(Mat& │ │ │ +00072df0: 6e62 7370 3b41 2c0a 203c 6120 6872 6566 nbsp;A,. Mat&nbs │ │ │ +00072e40: 703b 422c 0a20 3c61 2068 7265 663d 222e p;B,. Mat d │ │ │ +00072e90: 4142 6441 2c0a 203c 6120 6872 6566 3d22 ABdA,. Mat  │ │ │ +00072ee0: 6441 4264 4229 3c2f 7370 616e 3e3c 2f64 dABdB).
    Computes │ │ │ +00072f10: 7061 7274 6961 6c20 6465 7269 7661 7469 partial derivati │ │ │ +00072f20: 7665 7320 6f66 2074 6865 206d 6174 7269 ves of the matri │ │ │ +00072f30: 7820 7072 6f64 7563 7420 666f 7220 6561 x product for ea │ │ │ +00072f40: 6368 206d 756c 7469 706c 6965 6420 6d61 ch multiplied ma │ │ │ +00072f50: 7472 6978 2e3c 2f64 6976 3e0a 3c64 6c20 trix.
    .
    .< │ │ │ +00072f70: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    A< │ │ │ +00072f90: 2f63 6f64 653e 202d 2046 6972 7374 206d /code> - First m │ │ │ +00072fa0: 756c 7469 706c 6965 6420 6d61 7472 6978 ultiplied matrix │ │ │ +00072fb0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    B - Seco │ │ │ +00072fd0: 6e64 206d 756c 7469 706c 6965 6420 6d61 nd multiplied ma │ │ │ +00072fe0: 7472 6978 2e3c 2f64 643e 0a3c 6464 3e3c trix.
    .
    < │ │ │ +00072ff0: 636f 6465 3e64 4142 6441 3c2f 636f 6465 code>dABdA - First output │ │ │ +00073010: 2064 6572 6976 6174 6976 6520 6d61 7472 derivative matr │ │ │ +00073020: 6978 2064 2841 5c2a 4229 2f64 4120 6f66 ix d(A\*B)/dA of │ │ │ +00073030: 2073 697a 650a 5c28 5c74 6578 7474 747b size.\(\texttt{ │ │ │ +00073040: 412e 726f 7773 2a42 2e63 6f6c 737d 205c A.rows*B.cols} \ │ │ │ +00073050: 7469 6d65 7320 7b41 2e72 6f77 732a 412e times {A.rows*A. │ │ │ +00073060: 636f 6c73 7d5c 2920 2e3c 2f64 643e 0a3c cols}\) .
    .< │ │ │ +00073070: 6464 3e3c 636f 6465 3e64 4142 6442 3c2f dd>dABdB - Second o │ │ │ +00073090: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ +000730a0: 206d 6174 7269 7820 6428 415c 2a42 292f matrix d(A\*B)/ │ │ │ +000730b0: 6442 206f 6620 7369 7a65 0a5c 285c 7465 dB of size.\(\te │ │ │ +000730c0: 7874 7474 7b41 2e72 6f77 732a 422e 636f xttt{A.rows*B.co │ │ │ +000730d0: 6c73 7d20 5c74 696d 6573 207b 422e 726f ls} \times {B.ro │ │ │ +000730e0: 7773 2a42 2e63 6f6c 737d 5c29 202e 0a0a ws*B.cols}\) ... │ │ │ +000730f0: 5468 6520 6675 6e63 7469 6f6e 2063 6f6d The function com │ │ │ +00073100: 7075 7465 7320 7061 7274 6961 6c20 6465 putes partial de │ │ │ +00073110: 7269 7661 7469 7665 7320 6f66 2074 6865 rivatives of the │ │ │ +00073120: 2065 6c65 6d65 6e74 7320 6f66 2074 6865 elements of the │ │ │ +00073130: 206d 6174 7269 7820 7072 6f64 7563 7420 matrix product │ │ │ +00073140: 5c28 412a 425c 2920 7769 7468 2072 6567 \(A*B\) with reg │ │ │ +00073150: 6172 6420 746f 0a74 6865 2065 6c65 6d65 ard to.the eleme │ │ │ +00073160: 6e74 7320 6f66 2065 6163 6820 6f66 2074 nts of each of t │ │ │ +00073170: 6865 2074 776f 2069 6e70 7574 206d 6174 he two input mat │ │ │ +00073180: 7269 6365 732e 2054 6865 2066 756e 6374 rices. The funct │ │ │ +00073190: 696f 6e20 6973 2075 7365 6420 746f 2063 ion is used to c │ │ │ +000731a0: 6f6d 7075 7465 2074 6865 204a 6163 6f62 ompute the Jacob │ │ │ +000731b0: 6961 6e0a 6d61 7472 6963 6573 2069 6e20 ian.matrices in │ │ │ +000731c0: 2373 7465 7265 6f43 616c 6962 7261 7465 #stereoCalibrate │ │ │ +000731d0: 2062 7574 2063 616e 2061 6c73 6f20 6265 but can also be │ │ │ +000731e0: 2075 7365 6420 696e 2061 6e79 206f 7468 used in any oth │ │ │ +000731f0: 6572 2073 696d 696c 6172 206f 7074 696d er similar optim │ │ │ +00073200: 697a 6174 696f 6e20 6675 6e63 7469 6f6e ization function │ │ │ +00073210: 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 ..
    ..

    .< │ │ │ +00073230: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    c │ │ │ +00073380: 6f6d 706f 7365 5254 3c2f 6833 3e0a 3c64 omposeRT

    ..public stati │ │ │ +000733f0: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void composeRT(M │ │ │ +000734b0: 6174 3c2f 613e 266e 6273 703b 7276 6563 at rvec │ │ │ +000734c0: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ +00073500: 4d61 743c 2f61 3e26 6e62 7370 3b74 7665 Mat tve │ │ │ +00073510: 6331 2c0a 203c 6120 6872 6566 3d22 2e2e c1,. Mat rv │ │ │ +00073560: 6563 322c 0a20 3c61 2068 7265 663d 222e ec2,. Mat t │ │ │ +000735b0: 7665 6332 2c0a 203c 6120 6872 6566 3d22 vec2,. Mat  │ │ │ +00073600: 7276 6563 332c 0a20 3c61 2068 7265 663d rvec3,. Mat  │ │ │ +00073650: 3b74 7665 6333 2c0a 203c 6120 6872 6566 ;tvec3,. Mat&nbs │ │ │ +000736a0: 703b 6472 3364 7231 2c0a 203c 6120 6872 p;dr3dr1,. Mat&n │ │ │ +000736f0: 6273 703b 6472 3364 7431 2c0a 203c 6120 bsp;dr3dt1,. Mat │ │ │ +00073740: 266e 6273 703b 6472 3364 7232 2c0a 203c  dr3dr2,. < │ │ │ +00073750: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00073760: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +00073770: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +00073780: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dr3dt2,. │ │ │ +000737a0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000737e0: 3c2f 613e 266e 6273 703b 6474 3364 7231  dt3dr1 │ │ │ +000737f0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +00073830: 6174 3c2f 613e 266e 6273 703b 6474 3364 at dt3d │ │ │ +00073840: 7431 2c0a 203c 6120 6872 6566 3d22 2e2e t1,. Mat dt │ │ │ +00073890: 3364 7232 2c0a 203c 6120 6872 6566 3d22 3dr2,. Mat  │ │ │ +000738e0: 6474 3364 7432 293c 2f73 7061 6e3e 3c2f dt3dt2).
    Combines │ │ │ +00073910: 2074 776f 2072 6f74 6174 696f 6e2d 616e two rotation-an │ │ │ +00073920: 642d 7368 6966 7420 7472 616e 7366 6f72 d-shift transfor │ │ │ +00073930: 6d61 7469 6f6e 732e 3c2f 6469 763e 0a3c mations.
    .< │ │ │ +00073940: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ +00073950: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ +00073960: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    rvec1 - │ │ │ +00073980: 4669 7273 7420 726f 7461 7469 6f6e 2076 First rotation v │ │ │ +00073990: 6563 746f 722e 3c2f 6464 3e0a 3c64 643e ector.
    .
    │ │ │ +000739a0: 3c63 6f64 653e 7476 6563 313c 2f63 6f64 tvec1 - First trans │ │ │ +000739c0: 6c61 7469 6f6e 2076 6563 746f 722e 3c2f lation vector..
    rv │ │ │ +000739e0: 6563 323c 2f63 6f64 653e 202d 2053 6563 ec2 - Sec │ │ │ +000739f0: 6f6e 6420 726f 7461 7469 6f6e 2076 6563 ond rotation vec │ │ │ +00073a00: 746f 722e 3c2f 6464 3e0a 3c64 643e 3c63 tor.
    .
    tvec2 │ │ │ +00073a20: 202d 2053 6563 6f6e 6420 7472 616e 736c - Second transl │ │ │ +00073a30: 6174 696f 6e20 7665 6374 6f72 2e3c 2f64 ation vector..
    rve │ │ │ +00073a50: 6333 3c2f 636f 6465 3e20 2d20 4f75 7470 c3 - Outp │ │ │ +00073a60: 7574 2072 6f74 6174 696f 6e20 7665 6374 ut rotation vect │ │ │ +00073a70: 6f72 206f 6620 7468 6520 7375 7065 7270 or of the superp │ │ │ +00073a80: 6f73 6974 696f 6e2e 3c2f 6464 3e0a 3c64 osition.
    .tvec3 - Output tr │ │ │ +00073ab0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ +00073ac0: 206f 6620 7468 6520 7375 7065 7270 6f73 of the superpos │ │ │ +00073ad0: 6974 696f 6e2e 3c2f 6464 3e0a 3c64 643e ition..
    │ │ │ +00073ae0: 3c63 6f64 653e 6472 3364 7231 3c2f 636f dr3dr1 - Optional o │ │ │ +00073b00: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ +00073b10: 206f 6620 7276 6563 3320 7769 7468 2072 of rvec3 with r │ │ │ +00073b20: 6567 6172 6420 746f 2072 7665 6331 3c2f egard to rvec1.
    dr │ │ │ +00073b40: 3364 7431 3c2f 636f 6465 3e20 2d20 4f70 3dt1 - Op │ │ │ +00073b50: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ +00073b60: 7269 7661 7469 7665 206f 6620 7276 6563 rivative of rvec │ │ │ +00073b70: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ +00073b80: 2074 7665 6331 3c2f 6464 3e0a 3c64 643e tvec1
    .
    │ │ │ +00073b90: 3c63 6f64 653e 6472 3364 7232 3c2f 636f dr3dr2 - Optional o │ │ │ +00073bb0: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ +00073bc0: 206f 6620 7276 6563 3320 7769 7468 2072 of rvec3 with r │ │ │ +00073bd0: 6567 6172 6420 746f 2072 7665 6332 3c2f egard to rvec2.
    dr │ │ │ +00073bf0: 3364 7432 3c2f 636f 6465 3e20 2d20 4f70 3dt2 - Op │ │ │ +00073c00: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ +00073c10: 7269 7661 7469 7665 206f 6620 7276 6563 rivative of rvec │ │ │ +00073c20: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ +00073c30: 2074 7665 6332 3c2f 6464 3e0a 3c64 643e tvec2
    .
    │ │ │ +00073c40: 3c63 6f64 653e 6474 3364 7231 3c2f 636f dt3dr1 - Optional o │ │ │ +00073c60: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ +00073c70: 206f 6620 7476 6563 3320 7769 7468 2072 of tvec3 with r │ │ │ +00073c80: 6567 6172 6420 746f 2072 7665 6331 3c2f egard to rvec1.
    dt │ │ │ +00073ca0: 3364 7431 3c2f 636f 6465 3e20 2d20 4f70 3dt1 - Op │ │ │ +00073cb0: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ +00073cc0: 7269 7661 7469 7665 206f 6620 7476 6563 rivative of tvec │ │ │ +00073cd0: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ +00073ce0: 2074 7665 6331 3c2f 6464 3e0a 3c64 643e tvec1
    .
    │ │ │ +00073cf0: 3c63 6f64 653e 6474 3364 7232 3c2f 636f dt3dr2 - Optional o │ │ │ +00073d10: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ +00073d20: 206f 6620 7476 6563 3320 7769 7468 2072 of tvec3 with r │ │ │ +00073d30: 6567 6172 6420 746f 2072 7665 6332 3c2f egard to rvec2.
    dt │ │ │ +00073d50: 3364 7432 3c2f 636f 6465 3e20 2d20 4f70 3dt2 - Op │ │ │ +00073d60: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ +00073d70: 7269 7661 7469 7665 206f 6620 7476 6563 rivative of tvec │ │ │ +00073d80: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ +00073d90: 2074 7665 6332 0a0a 5468 6520 6675 6e63 tvec2..The func │ │ │ +00073da0: 7469 6f6e 7320 636f 6d70 7574 653a 0a0a tions compute:.. │ │ │ +00073db0: 5c28 5c62 6567 696e 7b61 7272 6179 7d7b \(\begin{array}{ │ │ │ +00073dc0: 6c7d 205c 7465 7874 7474 7b72 7665 6333 l} \texttt{rvec3 │ │ │ +00073dd0: 7d20 3d20 205c 6d61 7468 726d 7b72 6f64 } = \mathrm{rod │ │ │ +00073de0: 7269 6775 6573 7d20 5e7b 2d31 7d20 5c6c rigues} ^{-1} \l │ │ │ +00073df0: 6566 7420 2820 5c6d 6174 6872 6d7b 726f eft ( \mathrm{ro │ │ │ +00073e00: 6472 6967 7565 737d 2028 205c 7465 7874 drigues} ( \text │ │ │ +00073e10: 7474 7b72 7665 6332 7d20 2920 205c 6364 tt{rvec2} ) \cd │ │ │ +00073e20: 6f74 205c 6d61 7468 726d 7b72 6f64 7269 ot \mathrm{rodri │ │ │ +00073e30: 6775 6573 7d20 2820 5c74 6578 7474 747b gues} ( \texttt{ │ │ │ +00073e40: 7276 6563 317d 2029 205c 7269 6768 7420 rvec1} ) \right │ │ │ +00073e50: 2920 205c 5c20 5c74 6578 7474 747b 7476 ) \\ \texttt{tv │ │ │ +00073e60: 6563 337d 203d 2020 5c6d 6174 6872 6d7b ec3} = \mathrm{ │ │ │ +00073e70: 726f 6472 6967 7565 737d 2028 205c 7465 rodrigues} ( \te │ │ │ +00073e80: 7874 7474 7b72 7665 6332 7d20 2920 205c xttt{rvec2} ) \ │ │ │ +00073e90: 6364 6f74 205c 7465 7874 7474 7b74 7665 cdot \texttt{tve │ │ │ +00073ea0: 6331 7d20 2b20 205c 7465 7874 7474 7b74 c1} + \texttt{t │ │ │ +00073eb0: 7665 6332 7d20 5c65 6e64 7b61 7272 6179 vec2} \end{array │ │ │ +00073ec0: 7d20 2c5c 290a 0a77 6865 7265 205c 285c } ,\)..where \(\ │ │ │ +00073ed0: 6d61 7468 726d 7b72 6f64 7269 6775 6573 mathrm{rodrigues │ │ │ +00073ee0: 7d5c 2920 6465 6e6f 7465 7320 6120 726f }\) denotes a ro │ │ │ +00073ef0: 7461 7469 6f6e 2076 6563 746f 7220 746f tation vector to │ │ │ +00073f00: 2061 2072 6f74 6174 696f 6e20 6d61 7472 a rotation matr │ │ │ +00073f10: 6978 2074 7261 6e73 666f 726d 6174 696f ix transformatio │ │ │ +00073f20: 6e2c 2061 6e64 0a5c 285c 6d61 7468 726d n, and.\(\mathrm │ │ │ +00073f30: 7b72 6f64 7269 6775 6573 7d5e 7b2d 317d {rodrigues}^{-1} │ │ │ +00073f40: 5c29 2064 656e 6f74 6573 2074 6865 2069 \) denotes the i │ │ │ +00073f50: 6e76 6572 7365 2074 7261 6e73 666f 726d nverse transform │ │ │ +00073f60: 6174 696f 6e2e 2053 6565 2023 526f 6472 ation. See #Rodr │ │ │ +00073f70: 6967 7565 7320 666f 7220 6465 7461 696c igues for detail │ │ │ +00073f80: 732e 0a0a 416c 736f 2c20 7468 6520 6675 s...Also, the fu │ │ │ +00073f90: 6e63 7469 6f6e 7320 6361 6e20 636f 6d70 nctions can comp │ │ │ +00073fa0: 7574 6520 7468 6520 6465 7269 7661 7469 ute the derivati │ │ │ +00073fb0: 7665 7320 6f66 2074 6865 206f 7574 7075 ves of the outpu │ │ │ +00073fc0: 7420 7665 6374 6f72 7320 7769 7468 2072 t vectors with r │ │ │ +00073fd0: 6567 6172 6473 2074 6f20 7468 6520 696e egards to the in │ │ │ +00073fe0: 7075 740a 7665 6374 6f72 7320 2873 6565 put.vectors (see │ │ │ +00073ff0: 2023 6d61 744d 756c 4465 7269 7620 292e #matMulDeriv ). │ │ │ +00074000: 2054 6865 2066 756e 6374 696f 6e73 2061 The functions a │ │ │ +00074010: 7265 2075 7365 6420 696e 7369 6465 2023 re used inside # │ │ │ +00074020: 7374 6572 656f 4361 6c69 6272 6174 6520 stereoCalibrate │ │ │ +00074030: 6275 7420 6361 6e20 616c 736f 2062 6520 but can also be │ │ │ +00074040: 7573 6564 2069 6e0a 796f 7572 206f 776e used in.your own │ │ │ +00074050: 2063 6f64 6520 7768 6572 6520 4c65 7665 code where Leve │ │ │ +00074060: 6e62 6572 672d 4d61 7271 7561 7264 7420 nberg-Marquardt │ │ │ +00074070: 6f72 2061 6e6f 7468 6572 2067 7261 6469 or another gradi │ │ │ +00074080: 656e 742d 6261 7365 6420 736f 6c76 6572 ent-based solver │ │ │ +00074090: 2069 7320 7573 6564 2074 6f20 6f70 7469 is used to opti │ │ │ +000740a0: 6d69 7a65 2061 0a66 756e 6374 696f 6e20 mize a.function │ │ │ +000740b0: 7468 6174 2063 6f6e 7461 696e 7320 6120 that contains a │ │ │ +000740c0: 6d61 7472 6978 206d 756c 7469 706c 6963 matrix multiplic │ │ │ +000740d0: 6174 696f 6e2e 3c2f 6464 3e0a 3c2f 646c ation.
    ...
    .
  • .
  • .< │ │ │ +00074100: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +00074110: 6574 6169 6c22 2069 643d 2263 6f6d 706f etail" id="compo │ │ │ +00074120: 7365 5254 286f 7267 2e6f 7065 6e63 762e seRT(org.opencv. │ │ │ +00074130: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ +00074140: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ +00074150: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ +00074160: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ +00074170: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ +00074180: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ +00074190: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ +000741a0: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ +000741b0: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ +000741c0: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ +000741d0: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ +000741e0: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ +000741f0: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ +00074200: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ +00074210: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ +00074220: 636f 7265 2e4d 6174 2922 3e0a 3c68 333e core.Mat)">.

    │ │ │ +00074230: 636f 6d70 6f73 6552 543c 2f68 333e 0a3c composeRT

    .< │ │ │ +00074240: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +00074250: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +00074260: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +00074270: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +000742a0: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +000742b0: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +000742c0: 726e 2d74 7970 6522 3e76 6f69 643c 2f73 rn-type">void
     composeRT( │ │ │ +00074360: 4d61 743c 2f61 3e26 6e62 7370 3b72 7665 Mat rve │ │ │ +00074370: 6331 2c0a 203c 6120 6872 6566 3d22 2e2e c1,. Mat tv │ │ │ +000743c0: 6563 312c 0a20 3c61 2068 7265 663d 222e ec1,. Mat r │ │ │ +00074410: 7665 6332 2c0a 203c 6120 6872 6566 3d22 vec2,. Mat  │ │ │ -00074460: 6361 6d65 7261 4d61 7472 6978 2c0a 203c cameraMatrix,. < │ │ │ -00074470: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00074480: 4d61 744f 6644 6f75 626c 652e 6874 6d6c MatOfDouble.html │ │ │ -00074490: 2220 7469 746c 653d 2263 6c61 7373 2069 " title="class i │ │ │ -000744a0: 6e20 6f72 672e 6f70 656e 6376 2e63 6f72 n org.opencv.cor │ │ │ -000744b0: 6522 3e4d 6174 4f66 446f 7562 6c65 3c2f e">MatOfDouble distCoef │ │ │ -000744d0: 6673 2c0a 203c 6120 6872 6566 3d22 2e2e fs,. Mat rv │ │ │ -00074520: 6563 2c0a 203c 6120 6872 6566 3d22 2e2e ec,. Mat tv │ │ │ -00074570: 6563 293c 2f73 7061 6e3e 3c2f 6469 763e ec) │ │ │ -00074580: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Finds an obj │ │ │ -000745a0: 6563 7420 706f 7365 205c 2820 7b7d 5e7b ect pose \( {}^{ │ │ │ -000745b0: 637d 5c6d 6174 6862 667b 547d 5f6f 205c c}\mathbf{T}_o \ │ │ │ -000745c0: 2920 6672 6f6d 2033 442d 3244 2070 6f69 ) from 3D-2D poi │ │ │ -000745d0: 6e74 2063 6f72 7265 7370 6f6e 6465 6e63 nt correspondenc │ │ │ -000745e0: 6573 3a0a 0a21 5b50 6572 7370 6563 7469 es:..![Perspecti │ │ │ -000745f0: 7665 2070 726f 6a65 6374 696f 6e2c 2066 ve projection, f │ │ │ -00074600: 726f 6d20 6f62 6a65 6374 2074 6f20 6361 rom object to ca │ │ │ -00074610: 6d65 7261 2066 7261 6d65 5d28 7069 6373 mera frame](pics │ │ │ -00074620: 2f70 696e 686f 6c65 5f68 6f6d 6f67 656e /pinhole_homogen │ │ │ -00074630: 656f 7573 5f74 7261 6e73 666f 726d 6174 eous_transformat │ │ │ -00074640: 696f 6e2e 6a70 6729 7b20 7769 6474 683d ion.jpg){ width= │ │ │ -00074650: 3530 2520 7d0a 0a53 4545 3a20 5245 463a 50% }..SEE: REF: │ │ │ -00074660: 2063 616c 6962 3364 5f73 6f6c 7665 506e calib3d_solvePn │ │ │ -00074670: 500a 0a54 6869 7320 6675 6e63 7469 6f6e P..This function │ │ │ -00074680: 2072 6574 7572 6e73 2074 6865 2072 6f74 returns the rot │ │ │ -00074690: 6174 696f 6e20 616e 6420 7468 6520 7472 ation and the tr │ │ │ -000746a0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ -000746b0: 7320 7468 6174 2074 7261 6e73 666f 726d s that transform │ │ │ -000746c0: 2061 2033 4420 706f 696e 7420 6578 7072 a 3D point expr │ │ │ -000746d0: 6573 7365 6420 696e 2074 6865 206f 626a essed in the obj │ │ │ -000746e0: 6563 740a 636f 6f72 6469 6e61 7465 2066 ect.coordinate f │ │ │ -000746f0: 7261 6d65 2074 6f20 7468 6520 6361 6d65 rame to the came │ │ │ -00074700: 7261 2063 6f6f 7264 696e 6174 6520 6672 ra coordinate fr │ │ │ -00074710: 616d 652c 2075 7369 6e67 2064 6966 6665 ame, using diffe │ │ │ -00074720: 7265 6e74 206d 6574 686f 6473 3a0a 3c75 rent methods:..
  • . P3P m │ │ │ -00074740: 6574 686f 6473 2028 5245 463a 2053 4f4c ethods (REF: SOL │ │ │ -00074750: 5645 504e 505f 5033 502c 2052 4546 3a20 VEPNP_P3P, REF: │ │ │ -00074760: 534f 4c56 4550 4e50 5f41 5033 5029 3a20 SOLVEPNP_AP3P): │ │ │ -00074770: 6e65 6564 2034 2069 6e70 7574 2070 6f69 need 4 input poi │ │ │ -00074780: 6e74 7320 746f 2072 6574 7572 6e20 6120 nts to return a │ │ │ -00074790: 756e 6971 7565 2073 6f6c 7574 696f 6e2e unique solution. │ │ │ -000747a0: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
  • .
  • . │ │ │ -000747b0: 2052 4546 3a20 534f 4c56 4550 4e50 5f49 REF: SOLVEPNP_I │ │ │ -000747c0: 5050 4520 496e 7075 7420 706f 696e 7473 PPE Input points │ │ │ -000747d0: 206d 7573 7420 6265 2026 6774 3b3d 2034 must be >= 4 │ │ │ -000747e0: 2061 6e64 206f 626a 6563 7420 706f 696e and object poin │ │ │ -000747f0: 7473 206d 7573 7420 6265 2063 6f70 6c61 ts must be copla │ │ │ -00074800: 6e61 722e 0a20 203c 2f6c 693e 0a20 203c nar..
  • . < │ │ │ -00074810: 6c69 3e0a 2052 4546 3a20 534f 4c56 4550 li>. REF: SOLVEP │ │ │ -00074820: 4e50 5f49 5050 455f 5351 5541 5245 2053 NP_IPPE_SQUARE S │ │ │ -00074830: 7065 6369 616c 2063 6173 6520 7375 6974 pecial case suit │ │ │ -00074840: 6162 6c65 2066 6f72 206d 6172 6b65 7220 able for marker │ │ │ -00074850: 706f 7365 2065 7374 696d 6174 696f 6e2e pose estimation. │ │ │ -00074860: 0a4e 756d 6265 7220 6f66 2069 6e70 7574 .Number of input │ │ │ -00074870: 2070 6f69 6e74 7320 6d75 7374 2062 6520 points must be │ │ │ -00074880: 342e 204f 626a 6563 7420 706f 696e 7473 4. Object points │ │ │ -00074890: 206d 7573 7420 6265 2064 6566 696e 6564 must be defined │ │ │ -000748a0: 2069 6e20 7468 6520 666f 6c6c 6f77 696e in the followin │ │ │ -000748b0: 6720 6f72 6465 723a 0a20 203c 756c 3e0a g order:.
      . │ │ │ -000748c0: 2020 2020 3c6c 693e 0a20 2020 706f 696e
    • . poin │ │ │ -000748d0: 7420 303a 205b 2d73 7175 6172 654c 656e t 0: [-squareLen │ │ │ -000748e0: 6774 6820 2f20 322c 2020 7371 7561 7265 gth / 2, square │ │ │ -000748f0: 4c65 6e67 7468 202f 2032 2c20 305d 0a20 Length / 2, 0]. │ │ │ -00074900: 2020 203c 2f6c 693e 0a20 2020 203c 6c69
    • .
    • . point 1: [ │ │ │ -00074920: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ -00074930: 2c20 2073 7175 6172 654c 656e 6774 6820 , squareLength │ │ │ -00074940: 2f20 322c 2030 5d0a 2020 2020 3c2f 6c69 / 2, 0].
    • .
    • . po │ │ │ -00074960: 696e 7420 323a 205b 2073 7175 6172 654c int 2: [ squareL │ │ │ -00074970: 656e 6774 6820 2f20 322c 202d 7371 7561 ength / 2, -squa │ │ │ -00074980: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ -00074990: 0a20 2020 203c 2f6c 693e 0a20 2020 203c .
    • . < │ │ │ -000749a0: 6c69 3e0a 2020 2070 6f69 6e74 2033 3a20 li>. point 3: │ │ │ -000749b0: 5b2d 7371 7561 7265 4c65 6e67 7468 202f [-squareLength / │ │ │ -000749c0: 2032 2c20 2d73 7175 6172 654c 656e 6774 2, -squareLengt │ │ │ -000749d0: 6820 2f20 322c 2030 5d0a 2020 2020 3c2f h / 2, 0]. .
    . . for all the │ │ │ -00074a00: 6f74 6865 7220 666c 6167 732c 206e 756d other flags, num │ │ │ -00074a10: 6265 7220 6f66 2069 6e70 7574 2070 6f69 ber of input poi │ │ │ -00074a20: 6e74 7320 6d75 7374 2062 6520 2667 743b nts must be > │ │ │ -00074a30: 3d20 3420 616e 6420 6f62 6a65 6374 2070 = 4 and object p │ │ │ -00074a40: 6f69 6e74 7320 6361 6e20 6265 2069 6e20 oints can be in │ │ │ -00074a50: 616e 7920 636f 6e66 6967 7572 6174 696f any configuratio │ │ │ -00074a60: 6e2e 0a20 203c 2f6c 693e 0a3c 2f75 6c3e n.. . │ │ │ -00074a70: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373 .
    .
    Pa │ │ │ -00074a90: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -00074aa0: 6464 3e3c 636f 6465 3e6f 626a 6563 7450 dd>objectP │ │ │ -00074ab0: 6f69 6e74 733c 2f63 6f64 653e 202d 2041 oints - A │ │ │ -00074ac0: 7272 6179 206f 6620 6f62 6a65 6374 2070 rray of object p │ │ │ -00074ad0: 6f69 6e74 7320 696e 2074 6865 206f 626a oints in the obj │ │ │ -00074ae0: 6563 7420 636f 6f72 6469 6e61 7465 2073 ect coordinate s │ │ │ -00074af0: 7061 6365 2c20 4e78 3320 312d 6368 616e pace, Nx3 1-chan │ │ │ -00074b00: 6e65 6c20 6f72 0a31 784e 2f4e 7831 2033 nel or.1xN/Nx1 3 │ │ │ -00074b10: 2d63 6861 6e6e 656c 2c20 7768 6572 6520 -channel, where │ │ │ -00074b20: 4e20 6973 2074 6865 206e 756d 6265 7220 N is the number │ │ │ -00074b30: 6f66 2070 6f69 6e74 732e 2076 6563 746f of points. vecto │ │ │ -00074b40: 7226 6c74 3b50 6f69 6e74 3364 2667 743b r<Point3d> │ │ │ -00074b50: 2063 616e 2062 6520 616c 736f 2070 6173 can be also pas │ │ │ -00074b60: 7365 6420 6865 7265 2e3c 2f64 643e 0a3c sed here..< │ │ │ -00074b70: 6464 3e3c 636f 6465 3e69 6d61 6765 506f dd>imagePo │ │ │ -00074b80: 696e 7473 3c2f 636f 6465 3e20 2d20 4172 ints - Ar │ │ │ -00074b90: 7261 7920 6f66 2063 6f72 7265 7370 6f6e ray of correspon │ │ │ -00074ba0: 6469 6e67 2069 6d61 6765 2070 6f69 6e74 ding image point │ │ │ -00074bb0: 732c 204e 7832 2031 2d63 6861 6e6e 656c s, Nx2 1-channel │ │ │ -00074bc0: 206f 7220 3178 4e2f 4e78 3120 322d 6368 or 1xN/Nx1 2-ch │ │ │ -00074bd0: 616e 6e65 6c2c 0a77 6865 7265 204e 2069 annel,.where N i │ │ │ -00074be0: 7320 7468 6520 6e75 6d62 6572 206f 6620 s the number of │ │ │ -00074bf0: 706f 696e 7473 2e20 7665 6374 6f72 266c points. vector&l │ │ │ -00074c00: 743b 506f 696e 7432 6426 6774 3b20 6361 t;Point2d> ca │ │ │ -00074c10: 6e20 6265 2061 6c73 6f20 7061 7373 6564 n be also passed │ │ │ -00074c20: 2068 6572 652e 3c2f 6464 3e0a 3c64 643e here..
    │ │ │ -00074c30: 3c63 6f64 653e 6361 6d65 7261 4d61 7472 cameraMatr │ │ │ -00074c40: 6978 3c2f 636f 6465 3e20 2d20 496e 7075 ix - Inpu │ │ │ -00074c50: 7420 6361 6d65 7261 2069 6e74 7269 6e73 t camera intrins │ │ │ -00074c60: 6963 206d 6174 7269 7820 5c28 5c63 616d ic matrix \(\cam │ │ │ -00074c70: 6572 616d 6174 7269 787b 417d 5c29 202e eramatrix{A}\) . │ │ │ -00074c80: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -00074c90: 6469 7374 436f 6566 6673 3c2f 636f 6465 distCoeffs - Input vector │ │ │ -00074cb0: 206f 6620 6469 7374 6f72 7469 6f6e 2063 of distortion c │ │ │ -00074cc0: 6f65 6666 6963 6965 6e74 730a 5c28 5c64 oefficients.\(\d │ │ │ -00074cd0: 6973 7463 6f65 6666 735c 292e 2049 6620 istcoeffs\). If │ │ │ -00074ce0: 7468 6520 7665 6374 6f72 2069 7320 4e55 the vector is NU │ │ │ -00074cf0: 4c4c 2f65 6d70 7479 2c20 7468 6520 7a65 LL/empty, the ze │ │ │ -00074d00: 726f 2064 6973 746f 7274 696f 6e20 636f ro distortion co │ │ │ -00074d10: 6566 6669 6369 656e 7473 2061 7265 0a61 efficients are.a │ │ │ -00074d20: 7373 756d 6564 2e3c 2f64 643e 0a3c 6464 ssumed.
    .
    rvec - Output rota │ │ │ -00074d50: 7469 6f6e 2076 6563 746f 7220 2873 6565 tion vector (see │ │ │ -00074d60: 2052 4546 3a20 526f 6472 6967 7565 7320 REF: Rodrigues │ │ │ -00074d70: 2920 7468 6174 2c20 746f 6765 7468 6572 ) that, together │ │ │ -00074d80: 2077 6974 6820 7476 6563 2c20 6272 696e with tvec, brin │ │ │ -00074d90: 6773 2070 6f69 6e74 7320 6672 6f6d 0a74 gs points from.t │ │ │ -00074da0: 6865 206d 6f64 656c 2063 6f6f 7264 696e he model coordin │ │ │ -00074db0: 6174 6520 7379 7374 656d 2074 6f20 7468 ate system to th │ │ │ -00074dc0: 6520 6361 6d65 7261 2063 6f6f 7264 696e e camera coordin │ │ │ -00074dd0: 6174 6520 7379 7374 656d 2e3c 2f64 643e ate system.
    │ │ │ -00074de0: 0a3c 6464 3e3c 636f 6465 3e74 7665 633c .
    tvec< │ │ │ -00074df0: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ -00074e00: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ -00074e10: 6f72 2e0a 7468 6520 7072 6f76 6964 6564 or..the provided │ │ │ -00074e20: 2072 7665 6320 616e 6420 7476 6563 2076 rvec and tvec v │ │ │ -00074e30: 616c 7565 7320 6173 2069 6e69 7469 616c alues as initial │ │ │ -00074e40: 2061 7070 726f 7869 6d61 7469 6f6e 7320 approximations │ │ │ -00074e50: 6f66 2074 6865 2072 6f74 6174 696f 6e20 of the rotation │ │ │ -00074e60: 616e 6420 7472 616e 736c 6174 696f 6e0a and translation. │ │ │ -00074e70: 7665 6374 6f72 732c 2072 6573 7065 6374 vectors, respect │ │ │ -00074e80: 6976 656c 792c 2061 6e64 2066 7572 7468 ively, and furth │ │ │ -00074e90: 6572 206f 7074 696d 697a 6573 2074 6865 er optimizes the │ │ │ -00074ea0: 6d2e 0a0a 4d6f 7265 2069 6e66 6f72 6d61 m...More informa │ │ │ -00074eb0: 7469 6f6e 2061 626f 7574 2050 6572 7370 tion about Persp │ │ │ -00074ec0: 6563 7469 7665 2d6e 2d50 6f69 6e74 7320 ective-n-Points │ │ │ -00074ed0: 6973 2064 6573 6372 6962 6564 2069 6e20 is described in │ │ │ -00074ee0: 5245 463a 2063 616c 6962 3364 5f73 6f6c REF: calib3d_sol │ │ │ -00074ef0: 7665 506e 500a 0a3c 623e 4e6f 7465 3a3c vePnP..Note:< │ │ │ -00074f00: 2f62 3e0a 3c75 6c3e 0a20 203c 6c69 3e0a /b>.
      .
    • . │ │ │ -00074f10: 2020 2020 2020 416e 2065 7861 6d70 6c65 An example │ │ │ -00074f20: 206f 6620 686f 7720 746f 2075 7365 2073 of how to use s │ │ │ -00074f30: 6f6c 7665 506e 5020 666f 7220 706c 616e olvePnP for plan │ │ │ -00074f40: 6172 2061 7567 6d65 6e74 6564 2072 6561 ar augmented rea │ │ │ -00074f50: 6c69 7479 2063 616e 2062 6520 666f 756e lity can be foun │ │ │ -00074f60: 6420 6174 0a20 2020 2020 2020 206f 7065 d at. ope │ │ │ -00074f70: 6e63 765f 736f 7572 6365 5f63 6f64 652f ncv_source_code/ │ │ │ -00074f80: 7361 6d70 6c65 732f 7079 7468 6f6e 2f70 samples/python/p │ │ │ -00074f90: 6c61 6e65 5f61 722e 7079 0a20 203c 2f6c lane_ar.py. .
    • . │ │ │ -00074fb0: 4966 2079 6f75 2061 7265 2075 7369 6e67 If you are using │ │ │ -00074fc0: 2050 7974 686f 6e3a 0a20 203c 756c 3e0a Python:.
        . │ │ │ -00074fd0: 2020 2020 3c6c 693e 0a20 2020 2020 2020
      • . │ │ │ -00074fe0: 2020 4e75 6d70 7920 6172 7261 7920 736c Numpy array sl │ │ │ -00074ff0: 6963 6573 2077 6f6e 2774 2077 6f72 6b20 ices won't work │ │ │ -00075000: 6173 2069 6e70 7574 2062 6563 6175 7365 as input because │ │ │ -00075010: 2073 6f6c 7665 506e 5020 7265 7175 6972 solvePnP requir │ │ │ -00075020: 6573 2063 6f6e 7469 6775 6f75 730a 2020 es contiguous. │ │ │ -00075030: 2020 2020 2020 6172 7261 7973 2028 656e arrays (en │ │ │ -00075040: 666f 7263 6564 2062 7920 7468 6520 6173 forced by the as │ │ │ -00075050: 7365 7274 696f 6e20 7573 696e 6720 6376 sertion using cv │ │ │ -00075060: 3a3a 4d61 743a 3a63 6865 636b 5665 6374 ::Mat::checkVect │ │ │ -00075070: 6f72 2829 2061 726f 756e 6420 6c69 6e65 or() around line │ │ │ -00075080: 2035 3520 6f66 0a20 2020 2020 2020 206d 55 of. m │ │ │ -00075090: 6f64 756c 6573 2f33 642f 7372 632f 736f odules/3d/src/so │ │ │ -000750a0: 6c76 6570 6e70 2e63 7070 2076 6572 7369 lvepnp.cpp versi │ │ │ -000750b0: 6f6e 2032 2e34 2e39 290a 2020 2020 3c2f on 2.4.9). .
      • . │ │ │ -000750d0: 2020 2020 2020 5468 6520 5033 5020 616c The P3P al │ │ │ -000750e0: 676f 7269 7468 6d20 7265 7175 6972 6573 gorithm requires │ │ │ -000750f0: 2069 6d61 6765 2070 6f69 6e74 7320 746f image points to │ │ │ -00075100: 2062 6520 696e 2061 6e20 6172 7261 7920 be in an array │ │ │ -00075110: 6f66 2073 6861 7065 2028 4e2c 312c 3229 of shape (N,1,2) │ │ │ -00075120: 2064 7565 0a20 2020 2020 2020 2074 6f20 due. to │ │ │ -00075130: 6974 7320 6361 6c6c 696e 6720 6f66 2023 its calling of # │ │ │ -00075140: 756e 6469 7374 6f72 7450 6f69 6e74 7320 undistortPoints │ │ │ -00075150: 2861 726f 756e 6420 6c69 6e65 2037 3520 (around line 75 │ │ │ -00075160: 6f66 206d 6f64 756c 6573 2f33 642f 7372 of modules/3d/sr │ │ │ -00075170: 632f 736f 6c76 6570 6e70 2e63 7070 2076 c/solvepnp.cpp v │ │ │ -00075180: 6572 7369 6f6e 2032 2e34 2e39 290a 2020 ersion 2.4.9). │ │ │ -00075190: 2020 2020 2020 7768 6963 6820 7265 7175 which requ │ │ │ -000751a0: 6972 6573 2032 2d63 6861 6e6e 656c 2069 ires 2-channel i │ │ │ -000751b0: 6e66 6f72 6d61 7469 6f6e 2e0a 2020 2020 nformation.. │ │ │ -000751c0: 3c2f 6c69 3e0a 2020 2020 3c6c 693e 0a20
      • .
      • . │ │ │ -000751d0: 2020 2020 2020 2020 5468 7573 2c20 6769 Thus, gi │ │ │ -000751e0: 7665 6e20 736f 6d65 2064 6174 6120 4420 ven some data D │ │ │ -000751f0: 3d20 6e70 2e61 7272 6179 282e 2e2e 2920 = np.array(...) │ │ │ -00075200: 7768 6572 6520 442e 7368 6170 6520 3d20 where D.shape = │ │ │ -00075210: 284e 2c4d 292c 2069 6e20 6f72 6465 7220 (N,M), in order │ │ │ -00075220: 746f 2075 7365 2061 2073 7562 7365 7420 to use a subset │ │ │ -00075230: 6f66 0a20 2020 2020 2020 2069 7420 6173 of. it as │ │ │ -00075240: 2c20 652e 672e 2c20 696d 6167 6550 6f69 , e.g., imagePoi │ │ │ -00075250: 6e74 732c 206f 6e65 206d 7573 7420 6566 nts, one must ef │ │ │ -00075260: 6665 6374 6976 656c 7920 636f 7079 2069 fectively copy i │ │ │ -00075270: 7420 696e 746f 2061 206e 6577 2061 7272 t into a new arr │ │ │ -00075280: 6179 3a20 696d 6167 6550 6f69 6e74 7320 ay: imagePoints │ │ │ -00075290: 3d0a 2020 2020 2020 2020 6e70 2e61 7363 =. np.asc │ │ │ -000752a0: 6f6e 7469 6775 6f75 7361 7272 6179 2844 ontiguousarray(D │ │ │ -000752b0: 5b3a 2c3a 325d 292e 7265 7368 6170 6528 [:,:2]).reshape( │ │ │ -000752c0: 284e 2c31 2c32 2929 0a20 2020 203c 2f6c (N,1,2)). .
      .
    • . The mini │ │ │ -000752f0: 6d75 6d20 6e75 6d62 6572 206f 6620 706f mum number of po │ │ │ -00075300: 696e 7473 2069 7320 3420 696e 2074 6865 ints is 4 in the │ │ │ -00075310: 2067 656e 6572 616c 2063 6173 652e 2049 general case. I │ │ │ -00075320: 6e20 7468 6520 6361 7365 206f 6620 5245 n the case of RE │ │ │ -00075330: 463a 2053 4f4c 5645 504e 505f 5033 5020 F: SOLVEPNP_P3P │ │ │ -00075340: 616e 6420 5245 463a 2053 4f4c 5645 504e and REF: SOLVEPN │ │ │ -00075350: 505f 4150 3350 0a20 2020 2020 2020 6d65 P_AP3P. me │ │ │ -00075360: 7468 6f64 732c 2069 7420 6973 2072 6571 thods, it is req │ │ │ -00075370: 7569 7265 6420 746f 2075 7365 2065 7861 uired to use exa │ │ │ -00075380: 6374 6c79 2034 2070 6f69 6e74 7320 2874 ctly 4 points (t │ │ │ -00075390: 6865 2066 6972 7374 2033 2070 6f69 6e74 he first 3 point │ │ │ -000753a0: 7320 6172 6520 7573 6564 2074 6f20 6573 s are used to es │ │ │ -000753b0: 7469 6d61 7465 2061 6c6c 2074 6865 2073 timate all the s │ │ │ -000753c0: 6f6c 7574 696f 6e73 0a20 2020 2020 2020 olutions. │ │ │ -000753d0: 6f66 2074 6865 2050 3350 2070 726f 626c of the P3P probl │ │ │ -000753e0: 656d 2c20 7468 6520 6c61 7374 206f 6e65 em, the last one │ │ │ -000753f0: 2069 7320 7573 6564 2074 6f20 7265 7461 is used to reta │ │ │ -00075400: 696e 2074 6865 2062 6573 7420 736f 6c75 in the best solu │ │ │ -00075410: 7469 6f6e 2074 6861 7420 6d69 6e69 6d69 tion that minimi │ │ │ -00075420: 7a65 7320 7468 6520 7265 7072 6f6a 6563 zes the reprojec │ │ │ -00075430: 7469 6f6e 2065 7272 6f72 292e 0a20 203c tion error).. < │ │ │ -00075440: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2020 /li>.
    • . │ │ │ -00075450: 2020 5769 7468 2052 4546 3a20 534f 4c56 With REF: SOLV │ │ │ -00075460: 4550 4e50 5f49 5445 5241 5449 5645 206d EPNP_ITERATIVE m │ │ │ -00075470: 6574 686f 6420 616e 6420 3c63 6f64 653e ethod and │ │ │ -00075480: 7573 6545 7874 7269 6e73 6963 4775 6573 useExtrinsicGues │ │ │ -00075490: 733d 7472 7565 3c2f 636f 6465 3e2c 2074 s=true, t │ │ │ -000754a0: 6865 206d 696e 696d 756d 206e 756d 6265 he minimum numbe │ │ │ -000754b0: 7220 6f66 2070 6f69 6e74 7320 6973 2033 r of points is 3 │ │ │ -000754c0: 2028 3320 706f 696e 7473 0a20 2020 2020 (3 points. │ │ │ -000754d0: 2020 6172 6520 7375 6666 6963 6965 6e74 are sufficient │ │ │ -000754e0: 2074 6f20 636f 6d70 7574 6520 6120 706f to compute a po │ │ │ -000754f0: 7365 2062 7574 2074 6865 7265 2061 7265 se but there are │ │ │ -00075500: 2075 7020 746f 2034 2073 6f6c 7574 696f up to 4 solutio │ │ │ -00075510: 6e73 292e 2054 6865 2069 6e69 7469 616c ns). The initial │ │ │ -00075520: 2073 6f6c 7574 696f 6e20 7368 6f75 6c64 solution should │ │ │ -00075530: 2062 6520 636c 6f73 6520 746f 2074 6865 be close to the │ │ │ -00075540: 0a20 2020 2020 2020 676c 6f62 616c 2073 . global s │ │ │ -00075550: 6f6c 7574 696f 6e20 746f 2063 6f6e 7665 olution to conve │ │ │ -00075560: 7267 652e 2054 6865 2066 756e 6374 696f rge. The functio │ │ │ -00075570: 6e20 7265 7475 726e 7320 7472 7565 2069 n returns true i │ │ │ -00075580: 6620 736f 6d65 2073 6f6c 7574 696f 6e20 f some solution │ │ │ -00075590: 6973 2066 6f75 6e64 2e20 5573 6572 2063 is found. User c │ │ │ -000755a0: 6f64 6520 6973 2072 6573 706f 6e73 6962 ode is responsib │ │ │ -000755b0: 6c65 2066 6f72 0a20 2020 2020 2020 736f le for. so │ │ │ -000755c0: 6c75 7469 6f6e 2071 7561 6c69 7479 2061 lution quality a │ │ │ -000755d0: 7373 6573 736d 656e 742e 0a20 203c 2f6c ssessment.. .
    • . │ │ │ -000755f0: 5769 7468 2052 4546 3a20 534f 4c56 4550 With REF: SOLVEP │ │ │ -00075600: 4e50 5f49 5050 4520 696e 7075 7420 706f NP_IPPE input po │ │ │ -00075610: 696e 7473 206d 7573 7420 6265 2026 6774 ints must be > │ │ │ -00075620: 3b3d 2034 2061 6e64 206f 626a 6563 7420 ;= 4 and object │ │ │ -00075630: 706f 696e 7473 206d 7573 7420 6265 2063 points must be c │ │ │ -00075640: 6f70 6c61 6e61 722e 0a20 203c 2f6c 693e oplanar..
    • │ │ │ -00075650: 0a20 203c 6c69 3e0a 2020 2020 2020 5769 .
    • . Wi │ │ │ -00075660: 7468 2052 4546 3a20 534f 4c56 4550 4e50 th REF: SOLVEPNP │ │ │ -00075670: 5f49 5050 455f 5351 5541 5245 2074 6869 _IPPE_SQUARE thi │ │ │ -00075680: 7320 6973 2061 2073 7065 6369 616c 2063 s is a special c │ │ │ -00075690: 6173 6520 7375 6974 6162 6c65 2066 6f72 ase suitable for │ │ │ -000756a0: 206d 6172 6b65 7220 706f 7365 2065 7374 marker pose est │ │ │ -000756b0: 696d 6174 696f 6e2e 0a20 2020 2020 2020 imation.. │ │ │ -000756c0: 4e75 6d62 6572 206f 6620 696e 7075 7420 Number of input │ │ │ -000756d0: 706f 696e 7473 206d 7573 7420 6265 2034 points must be 4 │ │ │ -000756e0: 2e20 4f62 6a65 6374 2070 6f69 6e74 7320 . Object points │ │ │ -000756f0: 6d75 7374 2062 6520 6465 6669 6e65 6420 must be defined │ │ │ -00075700: 696e 2074 6865 2066 6f6c 6c6f 7769 6e67 in the following │ │ │ -00075710: 206f 7264 6572 3a0a 2020 3c75 6c3e 0a20 order:.
        . │ │ │ -00075720: 2020 203c 6c69 3e0a 2020 2020 2020 2020
      • . │ │ │ -00075730: 2020 706f 696e 7420 303a 205b 2d73 7175 point 0: [-squ │ │ │ -00075740: 6172 654c 656e 6774 6820 2f20 322c 2020 areLength / 2, │ │ │ -00075750: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ -00075760: 2c20 305d 0a20 2020 203c 2f6c 693e 0a20 , 0].
      • . │ │ │ -00075770: 2020 203c 6c69 3e0a 2020 2020 2020 2020
      • . │ │ │ -00075780: 2020 706f 696e 7420 313a 205b 2073 7175 point 1: [ squ │ │ │ -00075790: 6172 654c 656e 6774 6820 2f20 322c 2020 areLength / 2, │ │ │ -000757a0: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ -000757b0: 2c20 305d 0a20 2020 203c 2f6c 693e 0a20 , 0].
      • . │ │ │ -000757c0: 2020 203c 6c69 3e0a 2020 2020 2020 2020
      • . │ │ │ -000757d0: 2020 706f 696e 7420 323a 205b 2073 7175 point 2: [ squ │ │ │ -000757e0: 6172 654c 656e 6774 6820 2f20 322c 202d areLength / 2, - │ │ │ -000757f0: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ -00075800: 2c20 305d 0a20 2020 203c 2f6c 693e 0a20 , 0].
      • . │ │ │ -00075810: 2020 203c 6c69 3e0a 2020 2020 2020 2020
      • . │ │ │ -00075820: 2020 706f 696e 7420 333a 205b 2d73 7175 point 3: [-squ │ │ │ -00075830: 6172 654c 656e 6774 6820 2f20 322c 202d areLength / 2, - │ │ │ -00075840: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ -00075850: 2c20 305d 0a20 2020 203c 2f6c 693e 0a20 , 0].
      • . │ │ │ -00075860: 203c 2f75 6c3e 0a20 203c 756c 3e0a 2020
      .
        . │ │ │ -00075870: 2020 3c6c 693e 0a20 2020 2020 2057 6974
      • . Wit │ │ │ -00075880: 6820 5245 463a 2053 4f4c 5645 504e 505f h REF: SOLVEPNP_ │ │ │ -00075890: 5351 504e 5020 696e 7075 7420 706f 696e SQPNP input poin │ │ │ -000758a0: 7473 206d 7573 7420 6265 2026 6774 3b3d ts must be >= │ │ │ -000758b0: 2033 0a20 2020 203c 2f6c 693e 0a20 203c 3.
      • . < │ │ │ -000758c0: 2f75 6c3e 0a20 203c 2f6c 693e 0a3c 2f75 /ul>. .
    .
    Retu │ │ │ -000758e0: 726e 733a 3c2f 6474 3e0a 3c64 643e 6175 rns:
    .
    au │ │ │ -000758f0: 746f 6d61 7469 6361 6c6c 7920 6765 6e65 tomatically gene │ │ │ -00075900: 7261 7465 643c 2f64 643e 0a3c 2f64 6c3e rated
    .
    │ │ │ -00075910: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f ....
  • ..< │ │ │ -00075a20: 6833 3e73 6f6c 7665 506e 5052 616e 7361 h3>solvePnPRansa │ │ │ -00075a30: 633c 2f68 333e 0a3c 6469 7620 636c 6173 c.
    .
    pub │ │ │ -00075a90: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static boolean& │ │ │ -00075ad0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -00075af0: 736f 6c76 6550 6e50 5261 6e73 6163 3c2f solvePnPRansac(MatOfPo │ │ │ -00075b70: 696e 7433 663c 2f61 3e26 6e62 7370 3b6f int3f o │ │ │ -00075b80: 626a 6563 7450 6f69 6e74 732c 0a20 3c61 bjectPoints,. MatOfPoint2f< │ │ │ -00075be0: 2f61 3e26 6e62 7370 3b69 6d61 6765 506f /a> imagePo │ │ │ -00075bf0: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. Mat  │ │ │ -00075c40: 6361 6d65 7261 4d61 7472 6978 2c0a 203c cameraMatrix,. < │ │ │ -00075c50: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00075c60: 4d61 744f 6644 6f75 626c 652e 6874 6d6c MatOfDouble.html │ │ │ -00075c70: 2220 7469 746c 653d 2263 6c61 7373 2069 " title="class i │ │ │ -00075c80: 6e20 6f72 672e 6f70 656e 6376 2e63 6f72 n org.opencv.cor │ │ │ -00075c90: 6522 3e4d 6174 4f66 446f 7562 6c65 3c2f e">MatOfDouble distCoef │ │ │ -00075cb0: 6673 2c0a 203c 6120 6872 6566 3d22 2e2e fs,. Mat rv │ │ │ -00075d00: 6563 2c0a 203c 6120 6872 6566 3d22 2e2e ec,. Mat tv │ │ │ -00075d50: 6563 2c0a 2062 6f6f 6c65 616e 266e 6273 ec,. boolean&nbs │ │ │ -00075d60: 703b 7573 6545 7874 7269 6e73 6963 4775 p;useExtrinsicGu │ │ │ -00075d70: 6573 732c 0a20 696e 7426 6e62 7370 3b69 ess,. int i │ │ │ -00075d80: 7465 7261 7469 6f6e 7343 6f75 6e74 2c0a terationsCount,. │ │ │ -00075d90: 2066 6c6f 6174 266e 6273 703b 7265 7072 float repr │ │ │ -00075da0: 6f6a 6563 7469 6f6e 4572 726f 722c 0a20 ojectionError,. │ │ │ -00075db0: 646f 7562 6c65 266e 6273 703b 636f 6e66 double conf │ │ │ -00075dc0: 6964 656e 6365 2c0a 203c 6120 6872 6566 idence,. Mat&nbs │ │ │ -00075e10: 703b 696e 6c69 6572 732c 0a20 696e 7426 p;inliers,. int& │ │ │ -00075e20: 6e62 7370 3b66 6c61 6773 293c 2f73 7061 nbsp;flags)
    .
    Find │ │ │ -00075e50: 7320 616e 206f 626a 6563 7420 706f 7365 s an object pose │ │ │ -00075e60: 205c 2820 7b7d 5e7b 637d 5c6d 6174 6862 \( {}^{c}\mathb │ │ │ -00075e70: 667b 547d 5f6f 205c 2920 6672 6f6d 2033 f{T}_o \) from 3 │ │ │ -00075e80: 442d 3244 2070 6f69 6e74 2063 6f72 7265 D-2D point corre │ │ │ -00075e90: 7370 6f6e 6465 6e63 6573 2075 7369 6e67 spondences using │ │ │ -00075ea0: 2074 6865 2052 414e 5341 4320 7363 6865 the RANSAC sche │ │ │ -00075eb0: 6d65 2074 6f20 6465 616c 2077 6974 6820 me to deal with │ │ │ -00075ec0: 6261 6420 6d61 7463 6865 732e 0a0a 215b bad matches...![ │ │ │ -00075ed0: 5065 7273 7065 6374 6976 6520 7072 6f6a Perspective proj │ │ │ -00075ee0: 6563 7469 6f6e 2c20 6672 6f6d 206f 626a ection, from obj │ │ │ -00075ef0: 6563 7420 746f 2063 616d 6572 6120 6672 ect to camera fr │ │ │ -00075f00: 616d 655d 2870 6963 732f 7069 6e68 6f6c ame](pics/pinhol │ │ │ -00075f10: 655f 686f 6d6f 6765 6e65 6f75 735f 7472 e_homogeneous_tr │ │ │ -00075f20: 616e 7366 6f72 6d61 7469 6f6e 2e6a 7067 ansformation.jpg │ │ │ -00075f30: 297b 2077 6964 7468 3d35 3025 207d 0a0a ){ width=50% }.. │ │ │ -00075f40: 5345 453a 2052 4546 3a20 6361 6c69 6233 SEE: REF: calib3 │ │ │ -00075f50: 645f 736f 6c76 6550 6e50 3c2f 6469 763e d_solvePnP
    │ │ │ -00075f60: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ -00075f80: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    objectPoints< │ │ │ -00075fa0: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ -00075fb0: 6620 6f62 6a65 6374 2070 6f69 6e74 7320 f object points │ │ │ -00075fc0: 696e 2074 6865 206f 626a 6563 7420 636f in the object co │ │ │ -00075fd0: 6f72 6469 6e61 7465 2073 7061 6365 2c20 ordinate space, │ │ │ -00075fe0: 4e78 3320 312d 6368 616e 6e65 6c20 6f72 Nx3 1-channel or │ │ │ -00075ff0: 0a31 784e 2f4e 7831 2033 2d63 6861 6e6e .1xN/Nx1 3-chann │ │ │ -00076000: 656c 2c20 7768 6572 6520 4e20 6973 2074 el, where N is t │ │ │ -00076010: 6865 206e 756d 6265 7220 6f66 2070 6f69 he number of poi │ │ │ -00076020: 6e74 732e 2076 6563 746f 7226 6c74 3b50 nts. vector<P │ │ │ -00076030: 6f69 6e74 3364 2667 743b 2063 616e 2062 oint3d> can b │ │ │ -00076040: 6520 616c 736f 2070 6173 7365 6420 6865 e also passed he │ │ │ -00076050: 7265 2e3c 2f64 643e 0a3c 6464 3e3c 636f re.
    .
    imagePoints - Array of │ │ │ -00076080: 2063 6f72 7265 7370 6f6e 6469 6e67 2069 corresponding i │ │ │ -00076090: 6d61 6765 2070 6f69 6e74 732c 204e 7832 mage points, Nx2 │ │ │ -000760a0: 2031 2d63 6861 6e6e 656c 206f 7220 3178 1-channel or 1x │ │ │ -000760b0: 4e2f 4e78 3120 322d 6368 616e 6e65 6c2c N/Nx1 2-channel, │ │ │ -000760c0: 0a77 6865 7265 204e 2069 7320 7468 6520 .where N is the │ │ │ -000760d0: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ -000760e0: 2e20 7665 6374 6f72 266c 743b 506f 696e . vector<Poin │ │ │ -000760f0: 7432 6426 6774 3b20 6361 6e20 6265 2061 t2d> can be a │ │ │ -00076100: 6c73 6f20 7061 7373 6564 2068 6572 652e lso passed here. │ │ │ -00076110: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -00076120: 6361 6d65 7261 4d61 7472 6978 3c2f 636f cameraMatrix - Input came │ │ │ -00076140: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ -00076150: 7269 7820 5c28 5c63 616d 6572 616d 6174 rix \(\cameramat │ │ │ -00076160: 7269 787b 417d 5c29 202e 3c2f 6464 3e0a rix{A}\) .
    . │ │ │ -00076170: 3c64 643e 3c63 6f64 653e 6469 7374 436f
    distCo │ │ │ -00076180: 6566 6673 3c2f 636f 6465 3e20 2d20 496e effs - In │ │ │ -00076190: 7075 7420 7665 6374 6f72 206f 6620 6469 put vector of di │ │ │ -000761a0: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ -000761b0: 6965 6e74 730a 5c28 5c64 6973 7463 6f65 ients.\(\distcoe │ │ │ -000761c0: 6666 735c 292e 2049 6620 7468 6520 7665 ffs\). If the ve │ │ │ -000761d0: 6374 6f72 2069 7320 4e55 4c4c 2f65 6d70 ctor is NULL/emp │ │ │ -000761e0: 7479 2c20 7468 6520 7a65 726f 2064 6973 ty, the zero dis │ │ │ -000761f0: 746f 7274 696f 6e20 636f 6566 6669 6369 tortion coeffici │ │ │ -00076200: 656e 7473 2061 7265 0a61 7373 756d 6564 ents are.assumed │ │ │ -00076210: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    rvec - O │ │ │ -00076230: 7574 7075 7420 726f 7461 7469 6f6e 2076 utput rotation v │ │ │ -00076240: 6563 746f 7220 2873 6565 2052 4546 3a20 ector (see REF: │ │ │ -00076250: 526f 6472 6967 7565 7320 2920 7468 6174 Rodrigues ) that │ │ │ -00076260: 2c20 746f 6765 7468 6572 2077 6974 6820 , together with │ │ │ -00076270: 7476 6563 2c20 6272 696e 6773 2070 6f69 tvec, brings poi │ │ │ -00076280: 6e74 7320 6672 6f6d 0a74 6865 206d 6f64 nts from.the mod │ │ │ -00076290: 656c 2063 6f6f 7264 696e 6174 6520 7379 el coordinate sy │ │ │ -000762a0: 7374 656d 2074 6f20 7468 6520 6361 6d65 stem to the came │ │ │ -000762b0: 7261 2063 6f6f 7264 696e 6174 6520 7379 ra coordinate sy │ │ │ -000762c0: 7374 656d 2e3c 2f64 643e 0a3c 6464 3e3c stem.
    .
    < │ │ │ -000762d0: 636f 6465 3e74 7665 633c 2f63 6f64 653e code>tvec │ │ │ -000762e0: 202d 204f 7574 7075 7420 7472 616e 736c - Output transl │ │ │ -000762f0: 6174 696f 6e20 7665 6374 6f72 2e3c 2f64 ation vector..
    use │ │ │ -00076310: 4578 7472 696e 7369 6347 7565 7373 3c2f ExtrinsicGuess - Paramete │ │ │ -00076330: 7220 7573 6564 2066 6f72 2052 4546 3a20 r used for REF: │ │ │ -00076340: 534f 4c56 4550 4e50 5f49 5445 5241 5449 SOLVEPNP_ITERATI │ │ │ -00076350: 5645 2e20 4966 2074 7275 6520 2831 292c VE. If true (1), │ │ │ -00076360: 2074 6865 2066 756e 6374 696f 6e20 7573 the function us │ │ │ -00076370: 6573 0a74 6865 2070 726f 7669 6465 6420 es.the provided │ │ │ -00076380: 7276 6563 2061 6e64 2074 7665 6320 7661 rvec and tvec va │ │ │ -00076390: 6c75 6573 2061 7320 696e 6974 6961 6c20 lues as initial │ │ │ -000763a0: 6170 7072 6f78 696d 6174 696f 6e73 206f approximations o │ │ │ -000763b0: 6620 7468 6520 726f 7461 7469 6f6e 2061 f the rotation a │ │ │ -000763c0: 6e64 2074 7261 6e73 6c61 7469 6f6e 0a76 nd translation.v │ │ │ -000763d0: 6563 746f 7273 2c20 7265 7370 6563 7469 ectors, respecti │ │ │ -000763e0: 7665 6c79 2c20 616e 6420 6675 7274 6865 vely, and furthe │ │ │ -000763f0: 7220 6f70 7469 6d69 7a65 7320 7468 656d r optimizes them │ │ │ -00076400: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    iterationsCount │ │ │ -00076420: 3c2f 636f 6465 3e20 2d20 4e75 6d62 6572 - Number │ │ │ -00076430: 206f 6620 6974 6572 6174 696f 6e73 2e3c of iterations.< │ │ │ -00076440: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e72 /dd>.
    r │ │ │ -00076450: 6570 726f 6a65 6374 696f 6e45 7272 6f72 eprojectionError │ │ │ -00076460: 3c2f 636f 6465 3e20 2d20 496e 6c69 6572 - Inlier │ │ │ -00076470: 2074 6872 6573 686f 6c64 2076 616c 7565 threshold value │ │ │ -00076480: 2075 7365 6420 6279 2074 6865 2052 414e used by the RAN │ │ │ -00076490: 5341 4320 7072 6f63 6564 7572 652e 2054 SAC procedure. T │ │ │ -000764a0: 6865 2070 6172 616d 6574 6572 2076 616c he parameter val │ │ │ -000764b0: 7565 0a69 7320 7468 6520 6d61 7869 6d75 ue.is the maximu │ │ │ -000764c0: 6d20 616c 6c6f 7765 6420 6469 7374 616e m allowed distan │ │ │ -000764d0: 6365 2062 6574 7765 656e 2074 6865 206f ce between the o │ │ │ -000764e0: 6273 6572 7665 6420 616e 6420 636f 6d70 bserved and comp │ │ │ -000764f0: 7574 6564 2070 6f69 6e74 2070 726f 6a65 uted point proje │ │ │ -00076500: 6374 696f 6e73 2074 6f20 636f 6e73 6964 ctions to consid │ │ │ -00076510: 6572 2069 740a 616e 2069 6e6c 6965 722e er it.an inlier. │ │ │ -00076520: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -00076530: 636f 6e66 6964 656e 6365 3c2f 636f 6465 confidence - The probabil │ │ │ -00076550: 6974 7920 7468 6174 2074 6865 2061 6c67 ity that the alg │ │ │ -00076560: 6f72 6974 686d 2070 726f 6475 6365 7320 orithm produces │ │ │ -00076570: 6120 7573 6566 756c 2072 6573 756c 742e a useful result. │ │ │ -00076580: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -00076590: 696e 6c69 6572 733c 2f63 6f64 653e 202d inliers - │ │ │ -000765a0: 204f 7574 7075 7420 7665 6374 6f72 2074 Output vector t │ │ │ -000765b0: 6861 7420 636f 6e74 6169 6e73 2069 6e64 hat contains ind │ │ │ -000765c0: 6963 6573 206f 6620 696e 6c69 6572 7320 ices of inliers │ │ │ -000765d0: 696e 206f 626a 6563 7450 6f69 6e74 7320 in objectPoints │ │ │ -000765e0: 616e 6420 696d 6167 6550 6f69 6e74 7320 and imagePoints │ │ │ -000765f0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    flags - │ │ │ -00076610: 4d65 7468 6f64 2066 6f72 2073 6f6c 7669 Method for solvi │ │ │ -00076620: 6e67 2061 2050 6e50 2070 726f 626c 656d ng a PnP problem │ │ │ -00076630: 2028 7365 6520 5245 463a 2073 6f6c 7665 (see REF: solve │ │ │ -00076640: 506e 5020 292e 0a0a 5468 6520 6675 6e63 PnP )...The func │ │ │ -00076650: 7469 6f6e 2065 7374 696d 6174 6573 2061 tion estimates a │ │ │ -00076660: 6e20 6f62 6a65 6374 2070 6f73 6520 6769 n object pose gi │ │ │ -00076670: 7665 6e20 6120 7365 7420 6f66 206f 626a ven a set of obj │ │ │ -00076680: 6563 7420 706f 696e 7473 2c20 7468 6569 ect points, thei │ │ │ -00076690: 7220 636f 7272 6573 706f 6e64 696e 6720 r corresponding │ │ │ -000766a0: 696d 6167 650a 7072 6f6a 6563 7469 6f6e image.projection │ │ │ -000766b0: 732c 2061 7320 7765 6c6c 2061 7320 7468 s, as well as th │ │ │ -000766c0: 6520 6361 6d65 7261 2069 6e74 7269 6e73 e camera intrins │ │ │ -000766d0: 6963 206d 6174 7269 7820 616e 6420 7468 ic matrix and th │ │ │ -000766e0: 6520 6469 7374 6f72 7469 6f6e 2063 6f65 e distortion coe │ │ │ -000766f0: 6666 6963 6965 6e74 732e 2054 6869 7320 fficients. This │ │ │ -00076700: 6675 6e63 7469 6f6e 2066 696e 6473 2073 function finds s │ │ │ -00076710: 7563 680a 6120 706f 7365 2074 6861 7420 uch.a pose that │ │ │ -00076720: 6d69 6e69 6d69 7a65 7320 7265 7072 6f6a minimizes reproj │ │ │ -00076730: 6563 7469 6f6e 2065 7272 6f72 2c20 7468 ection error, th │ │ │ -00076740: 6174 2069 732c 2074 6865 2073 756d 206f at is, the sum o │ │ │ -00076750: 6620 7371 7561 7265 6420 6469 7374 616e f squared distan │ │ │ -00076760: 6365 7320 6265 7477 6565 6e20 7468 6520 ces between the │ │ │ -00076770: 6f62 7365 7276 6564 0a70 726f 6a65 6374 observed.project │ │ │ -00076780: 696f 6e73 2069 6d61 6765 506f 696e 7473 ions imagePoints │ │ │ -00076790: 2061 6e64 2074 6865 2070 726f 6a65 6374 and the project │ │ │ -000767a0: 6564 2028 7573 696e 6720 5245 463a 2070 ed (using REF: p │ │ │ -000767b0: 726f 6a65 6374 506f 696e 7473 2029 206f rojectPoints ) o │ │ │ -000767c0: 626a 6563 7450 6f69 6e74 732e 2054 6865 bjectPoints. The │ │ │ -000767d0: 2075 7365 206f 6620 5241 4e53 4143 0a6d use of RANSAC.m │ │ │ -000767e0: 616b 6573 2074 6865 2066 756e 6374 696f akes the functio │ │ │ -000767f0: 6e20 7265 7369 7374 616e 7420 746f 206f n resistant to o │ │ │ -00076800: 7574 6c69 6572 732e 0a0a 3c62 3e4e 6f74 utliers...Not │ │ │ -00076810: 653a 3c2f 623e 0a3c 756c 3e0a 2020 3c6c e:.
      . . An exam │ │ │ -00076830: 706c 6520 6f66 2068 6f77 2074 6f20 7573 ple of how to us │ │ │ -00076840: 6520 736f 6c76 6550 6e50 5261 6e73 6163 e solvePnPRansac │ │ │ -00076850: 2066 6f72 206f 626a 6563 7420 6465 7465 for object dete │ │ │ -00076860: 6374 696f 6e20 6361 6e20 6265 2066 6f75 ction can be fou │ │ │ -00076870: 6e64 2061 740a 2020 2020 2020 2020 5245 nd at. RE │ │ │ -00076880: 463a 2074 7574 6f72 6961 6c5f 7265 616c F: tutorial_real │ │ │ -00076890: 5f74 696d 655f 706f 7365 0a20 203c 2f6c _time_pose. .
    • . │ │ │ -000768b0: 5468 6520 6465 6661 756c 7420 6d65 7468 The default meth │ │ │ -000768c0: 6f64 2075 7365 6420 746f 2065 7374 696d od used to estim │ │ │ -000768d0: 6174 6520 7468 6520 6361 6d65 7261 2070 ate the camera p │ │ │ -000768e0: 6f73 6520 666f 7220 7468 6520 4d69 6e69 ose for the Mini │ │ │ -000768f0: 6d61 6c20 5361 6d70 6c65 2053 6574 7320 mal Sample Sets │ │ │ -00076900: 7374 6570 0a20 2020 2020 2020 6973 2023 step. is # │ │ │ -00076910: 534f 4c56 4550 4e50 5f45 504e 502e 2045 SOLVEPNP_EPNP. E │ │ │ -00076920: 7863 6570 7469 6f6e 7320 6172 653a 0a20 xceptions are:. │ │ │ -00076930: 203c 756c 3e0a 2020 2020 3c6c 693e 0a20
        .
      • . │ │ │ -00076940: 2020 2020 2020 2020 2069 6620 796f 7520 if you │ │ │ -00076950: 6368 6f6f 7365 2023 534f 4c56 4550 4e50 choose #SOLVEPNP │ │ │ -00076960: 5f50 3350 206f 7220 2353 4f4c 5645 504e _P3P or #SOLVEPN │ │ │ -00076970: 505f 4150 3350 2c20 7468 6573 6520 6d65 P_AP3P, these me │ │ │ -00076980: 7468 6f64 7320 7769 6c6c 2062 6520 7573 thods will be us │ │ │ -00076990: 6564 2e0a 2020 2020 3c2f 6c69 3e0a 2020 ed..
      • . │ │ │ -000769a0: 2020 3c6c 693e 0a20 2020 2020 2020 2020
      • . │ │ │ -000769b0: 2069 6620 7468 6520 6e75 6d62 6572 206f if the number o │ │ │ -000769c0: 6620 696e 7075 7420 706f 696e 7473 2069 f input points i │ │ │ -000769d0: 7320 6571 7561 6c20 746f 2034 2c20 2353 s equal to 4, #S │ │ │ -000769e0: 4f4c 5645 504e 505f 5033 5020 6973 2075 OLVEPNP_P3P is u │ │ │ -000769f0: 7365 642e 0a20 2020 203c 2f6c 693e 0a20 sed..
      • . │ │ │ -00076a00: 203c 2f75 6c3e 0a20 203c 6c69 3e0a 2020
      .
    • . │ │ │ -00076a10: 2020 2020 5468 6520 6d65 7468 6f64 2075 The method u │ │ │ -00076a20: 7365 6420 746f 2065 7374 696d 6174 6520 sed to estimate │ │ │ -00076a30: 7468 6520 6361 6d65 7261 2070 6f73 6520 the camera pose │ │ │ -00076a40: 7573 696e 6720 616c 6c20 7468 6520 696e using all the in │ │ │ -00076a50: 6c69 6572 7320 6973 2064 6566 696e 6564 liers is defined │ │ │ -00076a60: 2062 7920 7468 650a 2020 2020 2020 2066 by the. f │ │ │ -00076a70: 6c61 6773 2070 6172 616d 6574 6572 7320 lags parameters │ │ │ -00076a80: 756e 6c65 7373 2069 7420 6973 2065 7175 unless it is equ │ │ │ -00076a90: 616c 2074 6f20 2353 4f4c 5645 504e 505f al to #SOLVEPNP_ │ │ │ -00076aa0: 5033 5020 6f72 2023 534f 4c56 4550 4e50 P3P or #SOLVEPNP │ │ │ -00076ab0: 5f41 5033 502e 2049 6e20 7468 6973 2063 _AP3P. In this c │ │ │ -00076ac0: 6173 652c 0a20 2020 2020 2020 7468 6520 ase,. the │ │ │ -00076ad0: 6d65 7468 6f64 2023 534f 4c56 4550 4e50 method #SOLVEPNP │ │ │ -00076ae0: 5f45 504e 5020 7769 6c6c 2062 6520 7573 _EPNP will be us │ │ │ -00076af0: 6564 2069 6e73 7465 6164 2e0a 2020 3c2f ed instead.. .
    .< │ │ │ -00076b10: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ -00076b20: 0a3c 6464 3e61 7574 6f6d 6174 6963 616c .
    automatical │ │ │ -00076b30: 6c79 2067 656e 6572 6174 6564 3c2f 6464 ly generated
    .
    .
    .< │ │ │ -00076b50: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ -00076b60: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    solvePnPRa │ │ │ -00076c60: 6e73 6163 3c2f 6833 3e0a 3c64 6976 2063 nsac

    .
    .
    │ │ │ -00076cc0: 7075 626c 6963 2073 7461 7469 633c 2f73 public static boolean solvePnPRansa │ │ │ -00076d30: 633c 2f73 7061 6e3e 3c77 6272 3e3c 7370 c(MatO │ │ │ -00076da0: 6650 6f69 6e74 3366 3c2f 613e 266e 6273 fPoint3f&nbs │ │ │ -00076db0: 703b 6f62 6a65 6374 506f 696e 7473 2c0a p;objectPoints,. │ │ │ -00076dc0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 MatOfPoint │ │ │ -00076e10: 3266 3c2f 613e 266e 6273 703b 696d 6167 2f imag │ │ │ -00076e20: 6550 6f69 6e74 732c 0a20 3c61 2068 7265 ePoints,. Mat&nb │ │ │ -00076e70: 7370 3b63 616d 6572 614d 6174 7269 782c sp;cameraMatrix, │ │ │ -00076e80: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . MatOfDoubl │ │ │ -00076ed0: 653c 2f61 3e26 6e62 7370 3b64 6973 7443 e distC │ │ │ -00076ee0: 6f65 6666 732c 0a20 3c61 2068 7265 663d oeffs,. Mat  │ │ │ -00076f30: 3b72 7665 632c 0a20 3c61 2068 7265 663d ;rvec,. Mat  │ │ │ -00076f80: 3b74 7665 632c 0a20 626f 6f6c 6561 6e26 ;tvec,. boolean& │ │ │ -00076f90: 6e62 7370 3b75 7365 4578 7472 696e 7369 nbsp;useExtrinsi │ │ │ -00076fa0: 6347 7565 7373 2c0a 2069 6e74 266e 6273 cGuess,. int&nbs │ │ │ -00076fb0: 703b 6974 6572 6174 696f 6e73 436f 756e p;iterationsCoun │ │ │ -00076fc0: 742c 0a20 666c 6f61 7426 6e62 7370 3b72 t,. float r │ │ │ -00076fd0: 6570 726f 6a65 6374 696f 6e45 7272 6f72 eprojectionError │ │ │ -00076fe0: 2c0a 2064 6f75 626c 6526 6e62 7370 3b63 ,. double c │ │ │ -00076ff0: 6f6e 6669 6465 6e63 652c 0a20 3c61 2068 onfidence,. Mat& │ │ │ -00077040: 6e62 7370 3b69 6e6c 6965 7273 293c 2f73 nbsp;inliers)
    .
    Fi │ │ │ -00077070: 6e64 7320 616e 206f 626a 6563 7420 706f nds an object po │ │ │ -00077080: 7365 205c 2820 7b7d 5e7b 637d 5c6d 6174 se \( {}^{c}\mat │ │ │ -00077090: 6862 667b 547d 5f6f 205c 2920 6672 6f6d hbf{T}_o \) from │ │ │ -000770a0: 2033 442d 3244 2070 6f69 6e74 2063 6f72 3D-2D point cor │ │ │ -000770b0: 7265 7370 6f6e 6465 6e63 6573 2075 7369 respondences usi │ │ │ -000770c0: 6e67 2074 6865 2052 414e 5341 4320 7363 ng the RANSAC sc │ │ │ -000770d0: 6865 6d65 2074 6f20 6465 616c 2077 6974 heme to deal wit │ │ │ -000770e0: 6820 6261 6420 6d61 7463 6865 732e 0a0a h bad matches... │ │ │ -000770f0: 215b 5065 7273 7065 6374 6976 6520 7072 ![Perspective pr │ │ │ -00077100: 6f6a 6563 7469 6f6e 2c20 6672 6f6d 206f ojection, from o │ │ │ -00077110: 626a 6563 7420 746f 2063 616d 6572 6120 bject to camera │ │ │ -00077120: 6672 616d 655d 2870 6963 732f 7069 6e68 frame](pics/pinh │ │ │ -00077130: 6f6c 655f 686f 6d6f 6765 6e65 6f75 735f ole_homogeneous_ │ │ │ -00077140: 7472 616e 7366 6f72 6d61 7469 6f6e 2e6a transformation.j │ │ │ -00077150: 7067 297b 2077 6964 7468 3d35 3025 207d pg){ width=50% } │ │ │ -00077160: 0a0a 5345 453a 2052 4546 3a20 6361 6c69 ..SEE: REF: cali │ │ │ -00077170: 6233 645f 736f 6c76 6550 6e50 3c2f 6469 b3d_solvePnP.
    .
    Parame │ │ │ -000771a0: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ -000771b0: 636f 6465 3e6f 626a 6563 7450 6f69 6e74 code>objectPoint │ │ │ -000771c0: 733c 2f63 6f64 653e 202d 2041 7272 6179 s - Array │ │ │ -000771d0: 206f 6620 6f62 6a65 6374 2070 6f69 6e74 of object point │ │ │ -000771e0: 7320 696e 2074 6865 206f 626a 6563 7420 s in the object │ │ │ -000771f0: 636f 6f72 6469 6e61 7465 2073 7061 6365 coordinate space │ │ │ -00077200: 2c20 4e78 3320 312d 6368 616e 6e65 6c20 , Nx3 1-channel │ │ │ -00077210: 6f72 0a31 784e 2f4e 7831 2033 2d63 6861 or.1xN/Nx1 3-cha │ │ │ -00077220: 6e6e 656c 2c20 7768 6572 6520 4e20 6973 nnel, where N is │ │ │ -00077230: 2074 6865 206e 756d 6265 7220 6f66 2070 the number of p │ │ │ -00077240: 6f69 6e74 732e 2076 6563 746f 7226 6c74 oints. vector< │ │ │ -00077250: 3b50 6f69 6e74 3364 2667 743b 2063 616e ;Point3d> can │ │ │ -00077260: 2062 6520 616c 736f 2070 6173 7365 6420 be also passed │ │ │ -00077270: 6865 7265 2e3c 2f64 643e 0a3c 6464 3e3c here.
    .
    < │ │ │ -00077280: 636f 6465 3e69 6d61 6765 506f 696e 7473 code>imagePoints │ │ │ -00077290: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ -000772a0: 6f66 2063 6f72 7265 7370 6f6e 6469 6e67 of corresponding │ │ │ -000772b0: 2069 6d61 6765 2070 6f69 6e74 732c 204e image points, N │ │ │ -000772c0: 7832 2031 2d63 6861 6e6e 656c 206f 7220 x2 1-channel or │ │ │ -000772d0: 3178 4e2f 4e78 3120 322d 6368 616e 6e65 1xN/Nx1 2-channe │ │ │ -000772e0: 6c2c 0a77 6865 7265 204e 2069 7320 7468 l,.where N is th │ │ │ -000772f0: 6520 6e75 6d62 6572 206f 6620 706f 696e e number of poin │ │ │ -00077300: 7473 2e20 7665 6374 6f72 266c 743b 506f ts. vector<Po │ │ │ -00077310: 696e 7432 6426 6774 3b20 6361 6e20 6265 int2d> can be │ │ │ -00077320: 2061 6c73 6f20 7061 7373 6564 2068 6572 also passed her │ │ │ -00077330: 652e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 e.
    .
    cameraMatrix - Input ca │ │ │ -00077360: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -00077370: 6174 7269 7820 5c28 5c63 616d 6572 616d atrix \(\cameram │ │ │ -00077380: 6174 7269 787b 417d 5c29 202e 3c2f 6464 atrix{A}\) .
    .
    dist │ │ │ -000773a0: 436f 6566 6673 3c2f 636f 6465 3e20 2d20 Coeffs - │ │ │ -000773b0: 496e 7075 7420 7665 6374 6f72 206f 6620 Input vector of │ │ │ -000773c0: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ -000773d0: 6963 6965 6e74 730a 5c28 5c64 6973 7463 icients.\(\distc │ │ │ -000773e0: 6f65 6666 735c 292e 2049 6620 7468 6520 oeffs\). If the │ │ │ -000773f0: 7665 6374 6f72 2069 7320 4e55 4c4c 2f65 vector is NULL/e │ │ │ -00077400: 6d70 7479 2c20 7468 6520 7a65 726f 2064 mpty, the zero d │ │ │ -00077410: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ -00077420: 6369 656e 7473 2061 7265 0a61 7373 756d cients are.assum │ │ │ -00077430: 6564 2e3c 2f64 643e 0a3c 6464 3e3c 636f ed.
    .
    rvec - │ │ │ -00077450: 204f 7574 7075 7420 726f 7461 7469 6f6e Output rotation │ │ │ -00077460: 2076 6563 746f 7220 2873 6565 2052 4546 vector (see REF │ │ │ -00077470: 3a20 526f 6472 6967 7565 7320 2920 7468 : Rodrigues ) th │ │ │ -00077480: 6174 2c20 746f 6765 7468 6572 2077 6974 at, together wit │ │ │ -00077490: 6820 7476 6563 2c20 6272 696e 6773 2070 h tvec, brings p │ │ │ -000774a0: 6f69 6e74 7320 6672 6f6d 0a74 6865 206d oints from.the m │ │ │ -000774b0: 6f64 656c 2063 6f6f 7264 696e 6174 6520 odel coordinate │ │ │ -000774c0: 7379 7374 656d 2074 6f20 7468 6520 6361 system to the ca │ │ │ -000774d0: 6d65 7261 2063 6f6f 7264 696e 6174 6520 mera coordinate │ │ │ -000774e0: 7379 7374 656d 2e3c 2f64 643e 0a3c 6464 system.
    .
    tvec - Output tran │ │ │ -00077510: 736c 6174 696f 6e20 7665 6374 6f72 2e3c slation vector.< │ │ │ -00077520: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e75 /dd>.
    u │ │ │ -00077530: 7365 4578 7472 696e 7369 6347 7565 7373 seExtrinsicGuess │ │ │ -00077540: 3c2f 636f 6465 3e20 2d20 5061 7261 6d65 - Parame │ │ │ -00077550: 7465 7220 7573 6564 2066 6f72 2052 4546 ter used for REF │ │ │ -00077560: 3a20 534f 4c56 4550 4e50 5f49 5445 5241 : SOLVEPNP_ITERA │ │ │ -00077570: 5449 5645 2e20 4966 2074 7275 6520 2831 TIVE. If true (1 │ │ │ -00077580: 292c 2074 6865 2066 756e 6374 696f 6e20 ), the function │ │ │ -00077590: 7573 6573 0a74 6865 2070 726f 7669 6465 uses.the provide │ │ │ -000775a0: 6420 7276 6563 2061 6e64 2074 7665 6320 d rvec and tvec │ │ │ -000775b0: 7661 6c75 6573 2061 7320 696e 6974 6961 values as initia │ │ │ -000775c0: 6c20 6170 7072 6f78 696d 6174 696f 6e73 l approximations │ │ │ -000775d0: 206f 6620 7468 6520 726f 7461 7469 6f6e of the rotation │ │ │ -000775e0: 2061 6e64 2074 7261 6e73 6c61 7469 6f6e and translation │ │ │ -000775f0: 0a76 6563 746f 7273 2c20 7265 7370 6563 .vectors, respec │ │ │ -00077600: 7469 7665 6c79 2c20 616e 6420 6675 7274 tively, and furt │ │ │ -00077610: 6865 7220 6f70 7469 6d69 7a65 7320 7468 her optimizes th │ │ │ -00077620: 656d 2e3c 2f64 643e 0a3c 6464 3e3c 636f em.
    .
    iterationsCou │ │ │ -00077640: 6e74 3c2f 636f 6465 3e20 2d20 4e75 6d62 nt - Numb │ │ │ -00077650: 6572 206f 6620 6974 6572 6174 696f 6e73 er of iterations │ │ │ -00077660: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    reprojectionErr │ │ │ -00077680: 6f72 3c2f 636f 6465 3e20 2d20 496e 6c69 or - Inli │ │ │ -00077690: 6572 2074 6872 6573 686f 6c64 2076 616c er threshold val │ │ │ -000776a0: 7565 2075 7365 6420 6279 2074 6865 2052 ue used by the R │ │ │ -000776b0: 414e 5341 4320 7072 6f63 6564 7572 652e ANSAC procedure. │ │ │ -000776c0: 2054 6865 2070 6172 616d 6574 6572 2076 The parameter v │ │ │ -000776d0: 616c 7565 0a69 7320 7468 6520 6d61 7869 alue.is the maxi │ │ │ -000776e0: 6d75 6d20 616c 6c6f 7765 6420 6469 7374 mum allowed dist │ │ │ -000776f0: 616e 6365 2062 6574 7765 656e 2074 6865 ance between the │ │ │ -00077700: 206f 6273 6572 7665 6420 616e 6420 636f observed and co │ │ │ -00077710: 6d70 7574 6564 2070 6f69 6e74 2070 726f mputed point pro │ │ │ -00077720: 6a65 6374 696f 6e73 2074 6f20 636f 6e73 jections to cons │ │ │ -00077730: 6964 6572 2069 740a 616e 2069 6e6c 6965 ider it.an inlie │ │ │ -00077740: 722e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 r.
    .
    confidence - The probab │ │ │ -00077770: 696c 6974 7920 7468 6174 2074 6865 2061 ility that the a │ │ │ -00077780: 6c67 6f72 6974 686d 2070 726f 6475 6365 lgorithm produce │ │ │ -00077790: 7320 6120 7573 6566 756c 2072 6573 756c s a useful resul │ │ │ -000777a0: 742e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 t.
    .
    inliers │ │ │ -000777c0: 202d 204f 7574 7075 7420 7665 6374 6f72 - Output vector │ │ │ -000777d0: 2074 6861 7420 636f 6e74 6169 6e73 2069 that contains i │ │ │ -000777e0: 6e64 6963 6573 206f 6620 696e 6c69 6572 ndices of inlier │ │ │ -000777f0: 7320 696e 206f 626a 6563 7450 6f69 6e74 s in objectPoint │ │ │ -00077800: 7320 616e 6420 696d 6167 6550 6f69 6e74 s and imagePoint │ │ │ -00077810: 7320 2e0a 0a54 6865 2066 756e 6374 696f s ...The functio │ │ │ -00077820: 6e20 6573 7469 6d61 7465 7320 616e 206f n estimates an o │ │ │ -00077830: 626a 6563 7420 706f 7365 2067 6976 656e bject pose given │ │ │ -00077840: 2061 2073 6574 206f 6620 6f62 6a65 6374 a set of object │ │ │ -00077850: 2070 6f69 6e74 732c 2074 6865 6972 2063 points, their c │ │ │ -00077860: 6f72 7265 7370 6f6e 6469 6e67 2069 6d61 orresponding ima │ │ │ -00077870: 6765 0a70 726f 6a65 6374 696f 6e73 2c20 ge.projections, │ │ │ -00077880: 6173 2077 656c 6c20 6173 2074 6865 2063 as well as the c │ │ │ -00077890: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ -000778a0: 6d61 7472 6978 2061 6e64 2074 6865 2064 matrix and the d │ │ │ -000778b0: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ -000778c0: 6369 656e 7473 2e20 5468 6973 2066 756e cients. This fun │ │ │ -000778d0: 6374 696f 6e20 6669 6e64 7320 7375 6368 ction finds such │ │ │ -000778e0: 0a61 2070 6f73 6520 7468 6174 206d 696e .a pose that min │ │ │ -000778f0: 696d 697a 6573 2072 6570 726f 6a65 6374 imizes reproject │ │ │ -00077900: 696f 6e20 6572 726f 722c 2074 6861 7420 ion error, that │ │ │ -00077910: 6973 2c20 7468 6520 7375 6d20 6f66 2073 is, the sum of s │ │ │ -00077920: 7175 6172 6564 2064 6973 7461 6e63 6573 quared distances │ │ │ -00077930: 2062 6574 7765 656e 2074 6865 206f 6273 between the obs │ │ │ -00077940: 6572 7665 640a 7072 6f6a 6563 7469 6f6e erved.projection │ │ │ -00077950: 7320 696d 6167 6550 6f69 6e74 7320 616e s imagePoints an │ │ │ -00077960: 6420 7468 6520 7072 6f6a 6563 7465 6420 d the projected │ │ │ -00077970: 2875 7369 6e67 2052 4546 3a20 7072 6f6a (using REF: proj │ │ │ -00077980: 6563 7450 6f69 6e74 7320 2920 6f62 6a65 ectPoints ) obje │ │ │ -00077990: 6374 506f 696e 7473 2e20 5468 6520 7573 ctPoints. The us │ │ │ -000779a0: 6520 6f66 2052 414e 5341 430a 6d61 6b65 e of RANSAC.make │ │ │ -000779b0: 7320 7468 6520 6675 6e63 7469 6f6e 2072 s the function r │ │ │ -000779c0: 6573 6973 7461 6e74 2074 6f20 6f75 746c esistant to outl │ │ │ -000779d0: 6965 7273 2e0a 0a3c 623e 4e6f 7465 3a3c iers...Note:< │ │ │ -000779e0: 2f62 3e0a 3c75 6c3e 0a20 203c 6c69 3e0a /b>.
      .
    • . │ │ │ -000779f0: 2020 2020 2020 416e 2065 7861 6d70 6c65 An example │ │ │ -00077a00: 206f 6620 686f 7720 746f 2075 7365 2073 of how to use s │ │ │ -00077a10: 6f6c 7665 506e 5052 616e 7361 6320 666f olvePnPRansac fo │ │ │ -00077a20: 7220 6f62 6a65 6374 2064 6574 6563 7469 r object detecti │ │ │ -00077a30: 6f6e 2063 616e 2062 6520 666f 756e 6420 on can be found │ │ │ -00077a40: 6174 0a20 2020 2020 2020 2052 4546 3a20 at. REF: │ │ │ -00077a50: 7475 746f 7269 616c 5f72 6561 6c5f 7469 tutorial_real_ti │ │ │ -00077a60: 6d65 5f70 6f73 650a 2020 3c2f 6c69 3e0a me_pose.
    • . │ │ │ -00077a70: 2020 3c6c 693e 0a20 2020 2020 2054 6865
    • . The │ │ │ -00077a80: 2064 6566 6175 6c74 206d 6574 686f 6420 default method │ │ │ -00077a90: 7573 6564 2074 6f20 6573 7469 6d61 7465 used to estimate │ │ │ -00077aa0: 2074 6865 2063 616d 6572 6120 706f 7365 the camera pose │ │ │ -00077ab0: 2066 6f72 2074 6865 204d 696e 696d 616c for the Minimal │ │ │ -00077ac0: 2053 616d 706c 6520 5365 7473 2073 7465 Sample Sets ste │ │ │ -00077ad0: 700a 2020 2020 2020 2069 7320 2353 4f4c p. is #SOL │ │ │ -00077ae0: 5645 504e 505f 4550 4e50 2e20 4578 6365 VEPNP_EPNP. Exce │ │ │ -00077af0: 7074 696f 6e73 2061 7265 3a0a 2020 3c75 ptions are:. .
    • . │ │ │ -00077b10: 2020 2020 2020 6966 2079 6f75 2063 686f if you cho │ │ │ -00077b20: 6f73 6520 2353 4f4c 5645 504e 505f 5033 ose #SOLVEPNP_P3 │ │ │ -00077b30: 5020 6f72 2023 534f 4c56 4550 4e50 5f41 P or #SOLVEPNP_A │ │ │ -00077b40: 5033 502c 2074 6865 7365 206d 6574 686f P3P, these metho │ │ │ -00077b50: 6473 2077 696c 6c20 6265 2075 7365 642e ds will be used. │ │ │ -00077b60: 0a20 2020 203c 2f6c 693e 0a20 2020 203c .
    • . < │ │ │ -00077b70: 6c69 3e0a 2020 2020 2020 2020 2020 6966 li>. if │ │ │ -00077b80: 2074 6865 206e 756d 6265 7220 6f66 2069 the number of i │ │ │ -00077b90: 6e70 7574 2070 6f69 6e74 7320 6973 2065 nput points is e │ │ │ -00077ba0: 7175 616c 2074 6f20 342c 2023 534f 4c56 qual to 4, #SOLV │ │ │ -00077bb0: 4550 4e50 5f50 3350 2069 7320 7573 6564 EPNP_P3P is used │ │ │ -00077bc0: 2e0a 2020 2020 3c2f 6c69 3e0a 2020 3c2f .. . .
    • . │ │ │ -00077be0: 2054 6865 206d 6574 686f 6420 7573 6564 The method used │ │ │ -00077bf0: 2074 6f20 6573 7469 6d61 7465 2074 6865 to estimate the │ │ │ -00077c00: 2063 616d 6572 6120 706f 7365 2075 7369 camera pose usi │ │ │ -00077c10: 6e67 2061 6c6c 2074 6865 2069 6e6c 6965 ng all the inlie │ │ │ -00077c20: 7273 2069 7320 6465 6669 6e65 6420 6279 rs is defined by │ │ │ -00077c30: 2074 6865 0a20 2020 2020 2020 666c 6167 the. flag │ │ │ -00077c40: 7320 7061 7261 6d65 7465 7273 2075 6e6c s parameters unl │ │ │ -00077c50: 6573 7320 6974 2069 7320 6571 7561 6c20 ess it is equal │ │ │ -00077c60: 746f 2023 534f 4c56 4550 4e50 5f50 3350 to #SOLVEPNP_P3P │ │ │ -00077c70: 206f 7220 2353 4f4c 5645 504e 505f 4150 or #SOLVEPNP_AP │ │ │ -00077c80: 3350 2e20 496e 2074 6869 7320 6361 7365 3P. In this case │ │ │ -00077c90: 2c0a 2020 2020 2020 2074 6865 206d 6574 ,. the met │ │ │ -00077ca0: 686f 6420 2353 4f4c 5645 504e 505f 4550 hod #SOLVEPNP_EP │ │ │ -00077cb0: 4e50 2077 696c 6c20 6265 2075 7365 6420 NP will be used │ │ │ -00077cc0: 696e 7374 6561 642e 0a20 203c 2f6c 693e instead..
    • │ │ │ -00077cd0: 0a3c 2f75 6c3e 3c2f 6464 3e0a 3c64 743e .
    .
    │ │ │ -00077ce0: 5265 7475 726e 733a 3c2f 6474 3e0a 3c64 Returns:
    .automatically │ │ │ -00077d00: 6765 6e65 7261 7465 643c 2f64 643e 0a3c generated.< │ │ │ -00077d10: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ..
  • .
  • .
    .

    s │ │ │ -00077e10: 6f6c 7665 506e 5052 616e 7361 633c 2f68 olvePnPRansac.
    .
    public │ │ │ -00077e80: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ -00077e90: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;boo │ │ │ -00077eb0: 6c65 616e 3c2f 7370 616e 3e26 6e62 7370 lean  │ │ │ -00077ec0: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;solv │ │ │ -00077ee0: 6550 6e50 5261 6e73 6163 3c2f 7370 616e ePnPRansac( │ │ │ -00077f10: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfPoint3 │ │ │ -00077f60: 663c 2f61 3e26 6e62 7370 3b6f 626a 6563 f objec │ │ │ -00077f70: 7450 6f69 6e74 732c 0a20 3c61 2068 7265 tPoints,. M │ │ │ -00077fc0: 6174 4f66 506f 696e 7432 663c 2f61 3e26 atOfPoint2f& │ │ │ -00077fd0: 6e62 7370 3b69 6d61 6765 506f 696e 7473 nbsp;imagePoints │ │ │ -00077fe0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -00078020: 6174 3c2f 613e 266e 6273 703b 6361 6d65 at came │ │ │ -00078030: 7261 4d61 7472 6978 2c0a 203c 6120 6872 raMatrix,. M │ │ │ -00078080: 6174 4f66 446f 7562 6c65 3c2f 613e 266e atOfDouble&n │ │ │ -00078090: 6273 703b 6469 7374 436f 6566 6673 2c0a bsp;distCoeffs,. │ │ │ -000780a0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000780e0: 3c2f 613e 266e 6273 703b 7276 6563 2c0a  rvec,. │ │ │ -000780f0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -00078130: 3c2f 613e 266e 6273 703b 7476 6563 2c0a  tvec,. │ │ │ -00078140: 2062 6f6f 6c65 616e 266e 6273 703b 7573 boolean us │ │ │ -00078150: 6545 7874 7269 6e73 6963 4775 6573 732c eExtrinsicGuess, │ │ │ -00078160: 0a20 696e 7426 6e62 7370 3b69 7465 7261 . int itera │ │ │ -00078170: 7469 6f6e 7343 6f75 6e74 2c0a 2066 6c6f tionsCount,. flo │ │ │ -00078180: 6174 266e 6273 703b 7265 7072 6f6a 6563 at reprojec │ │ │ -00078190: 7469 6f6e 4572 726f 722c 0a20 646f 7562 tionError,. doub │ │ │ -000781a0: 6c65 266e 6273 703b 636f 6e66 6964 656e le confiden │ │ │ -000781b0: 6365 293c 2f73 7061 6e3e 3c2f 6469 763e ce)
    │ │ │ -000781c0: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Finds an obj │ │ │ -000781e0: 6563 7420 706f 7365 205c 2820 7b7d 5e7b ect pose \( {}^{ │ │ │ -000781f0: 637d 5c6d 6174 6862 667b 547d 5f6f 205c c}\mathbf{T}_o \ │ │ │ -00078200: 2920 6672 6f6d 2033 442d 3244 2070 6f69 ) from 3D-2D poi │ │ │ -00078210: 6e74 2063 6f72 7265 7370 6f6e 6465 6e63 nt correspondenc │ │ │ -00078220: 6573 2075 7369 6e67 2074 6865 2052 414e es using the RAN │ │ │ -00078230: 5341 4320 7363 6865 6d65 2074 6f20 6465 SAC scheme to de │ │ │ -00078240: 616c 2077 6974 6820 6261 6420 6d61 7463 al with bad matc │ │ │ -00078250: 6865 732e 0a0a 215b 5065 7273 7065 6374 hes...![Perspect │ │ │ -00078260: 6976 6520 7072 6f6a 6563 7469 6f6e 2c20 ive projection, │ │ │ -00078270: 6672 6f6d 206f 626a 6563 7420 746f 2063 from object to c │ │ │ -00078280: 616d 6572 6120 6672 616d 655d 2870 6963 amera frame](pic │ │ │ -00078290: 732f 7069 6e68 6f6c 655f 686f 6d6f 6765 s/pinhole_homoge │ │ │ -000782a0: 6e65 6f75 735f 7472 616e 7366 6f72 6d61 neous_transforma │ │ │ -000782b0: 7469 6f6e 2e6a 7067 297b 2077 6964 7468 tion.jpg){ width │ │ │ -000782c0: 3d35 3025 207d 0a0a 5345 453a 2052 4546 =50% }..SEE: REF │ │ │ -000782d0: 3a20 6361 6c69 6233 645f 736f 6c76 6550 : calib3d_solveP │ │ │ -000782e0: 6e50 3c2f 6469 763e 0a3c 646c 2063 6c61 nP
    .
    .
    │ │ │ -00078300: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ -00078310: 0a3c 6464 3e3c 636f 6465 3e6f 626a 6563 .
    objec │ │ │ -00078320: 7450 6f69 6e74 733c 2f63 6f64 653e 202d tPoints - │ │ │ -00078330: 2041 7272 6179 206f 6620 6f62 6a65 6374 Array of object │ │ │ -00078340: 2070 6f69 6e74 7320 696e 2074 6865 206f points in the o │ │ │ -00078350: 626a 6563 7420 636f 6f72 6469 6e61 7465 bject coordinate │ │ │ -00078360: 2073 7061 6365 2c20 4e78 3320 312d 6368 space, Nx3 1-ch │ │ │ -00078370: 616e 6e65 6c20 6f72 0a31 784e 2f4e 7831 annel or.1xN/Nx1 │ │ │ -00078380: 2033 2d63 6861 6e6e 656c 2c20 7768 6572 3-channel, wher │ │ │ -00078390: 6520 4e20 6973 2074 6865 206e 756d 6265 e N is the numbe │ │ │ -000783a0: 7220 6f66 2070 6f69 6e74 732e 2076 6563 r of points. vec │ │ │ -000783b0: 746f 7226 6c74 3b50 6f69 6e74 3364 2667 tor<Point3d&g │ │ │ -000783c0: 743b 2063 616e 2062 6520 616c 736f 2070 t; can be also p │ │ │ -000783d0: 6173 7365 6420 6865 7265 2e3c 2f64 643e assed here.
    │ │ │ -000783e0: 0a3c 6464 3e3c 636f 6465 3e69 6d61 6765 .
    image │ │ │ -000783f0: 506f 696e 7473 3c2f 636f 6465 3e20 2d20 Points - │ │ │ -00078400: 4172 7261 7920 6f66 2063 6f72 7265 7370 Array of corresp │ │ │ -00078410: 6f6e 6469 6e67 2069 6d61 6765 2070 6f69 onding image poi │ │ │ -00078420: 6e74 732c 204e 7832 2031 2d63 6861 6e6e nts, Nx2 1-chann │ │ │ -00078430: 656c 206f 7220 3178 4e2f 4e78 3120 322d el or 1xN/Nx1 2- │ │ │ -00078440: 6368 616e 6e65 6c2c 0a77 6865 7265 204e channel,.where N │ │ │ -00078450: 2069 7320 7468 6520 6e75 6d62 6572 206f is the number o │ │ │ -00078460: 6620 706f 696e 7473 2e20 7665 6374 6f72 f points. vector │ │ │ -00078470: 266c 743b 506f 696e 7432 6426 6774 3b20 <Point2d> │ │ │ -00078480: 6361 6e20 6265 2061 6c73 6f20 7061 7373 can be also pass │ │ │ -00078490: 6564 2068 6572 652e 3c2f 6464 3e0a 3c64 ed here.
    .cameraMa │ │ │ -000784b0: 7472 6978 3c2f 636f 6465 3e20 2d20 496e trix - In │ │ │ -000784c0: 7075 7420 6361 6d65 7261 2069 6e74 7269 put camera intri │ │ │ -000784d0: 6e73 6963 206d 6174 7269 7820 5c28 5c63 nsic matrix \(\c │ │ │ -000784e0: 616d 6572 616d 6174 7269 787b 417d 5c29 ameramatrix{A}\) │ │ │ -000784f0: 202e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 ..
    distCoeffs - Input vect │ │ │ -00078520: 6f72 206f 6620 6469 7374 6f72 7469 6f6e or of distortion │ │ │ -00078530: 2063 6f65 6666 6963 6965 6e74 730a 5c28 coefficients.\( │ │ │ -00078540: 5c64 6973 7463 6f65 6666 735c 292e 2049 \distcoeffs\). I │ │ │ -00078550: 6620 7468 6520 7665 6374 6f72 2069 7320 f the vector is │ │ │ -00078560: 4e55 4c4c 2f65 6d70 7479 2c20 7468 6520 NULL/empty, the │ │ │ -00078570: 7a65 726f 2064 6973 746f 7274 696f 6e20 zero distortion │ │ │ -00078580: 636f 6566 6669 6369 656e 7473 2061 7265 coefficients are │ │ │ -00078590: 0a61 7373 756d 6564 2e3c 2f64 643e 0a3c .assumed.
    .< │ │ │ -000785a0: 6464 3e3c 636f 6465 3e72 7665 633c 2f63 dd>rvec - Output ro │ │ │ -000785c0: 7461 7469 6f6e 2076 6563 746f 7220 2873 tation vector (s │ │ │ -000785d0: 6565 2052 4546 3a20 526f 6472 6967 7565 ee REF: Rodrigue │ │ │ -000785e0: 7320 2920 7468 6174 2c20 746f 6765 7468 s ) that, togeth │ │ │ -000785f0: 6572 2077 6974 6820 7476 6563 2c20 6272 er with tvec, br │ │ │ -00078600: 696e 6773 2070 6f69 6e74 7320 6672 6f6d ings points from │ │ │ -00078610: 0a74 6865 206d 6f64 656c 2063 6f6f 7264 .the model coord │ │ │ -00078620: 696e 6174 6520 7379 7374 656d 2074 6f20 inate system to │ │ │ -00078630: 7468 6520 6361 6d65 7261 2063 6f6f 7264 the camera coord │ │ │ -00078640: 696e 6174 6520 7379 7374 656d 2e3c 2f64 inate system.
    .
    tve │ │ │ -00078660: 633c 2f63 6f64 653e 202d 204f 7574 7075 c - Outpu │ │ │ -00078670: 7420 7472 616e 736c 6174 696f 6e20 7665 t translation ve │ │ │ -00078680: 6374 6f72 2e3c 2f64 643e 0a3c 6464 3e3c ctor.
    .
    < │ │ │ -00078690: 636f 6465 3e75 7365 4578 7472 696e 7369 code>useExtrinsi │ │ │ -000786a0: 6347 7565 7373 3c2f 636f 6465 3e20 2d20 cGuess - │ │ │ -000786b0: 5061 7261 6d65 7465 7220 7573 6564 2066 Parameter used f │ │ │ -000786c0: 6f72 2052 4546 3a20 534f 4c56 4550 4e50 or REF: SOLVEPNP │ │ │ -000786d0: 5f49 5445 5241 5449 5645 2e20 4966 2074 _ITERATIVE. If t │ │ │ -000786e0: 7275 6520 2831 292c 2074 6865 2066 756e rue (1), the fun │ │ │ -000786f0: 6374 696f 6e20 7573 6573 0a74 6865 2070 ction uses.the p │ │ │ -00078700: 726f 7669 6465 6420 7276 6563 2061 6e64 rovided rvec and │ │ │ -00078710: 2074 7665 6320 7661 6c75 6573 2061 7320 tvec values as │ │ │ -00078720: 696e 6974 6961 6c20 6170 7072 6f78 696d initial approxim │ │ │ -00078730: 6174 696f 6e73 206f 6620 7468 6520 726f ations of the ro │ │ │ -00078740: 7461 7469 6f6e 2061 6e64 2074 7261 6e73 tation and trans │ │ │ -00078750: 6c61 7469 6f6e 0a76 6563 746f 7273 2c20 lation.vectors, │ │ │ -00078760: 7265 7370 6563 7469 7665 6c79 2c20 616e respectively, an │ │ │ -00078770: 6420 6675 7274 6865 7220 6f70 7469 6d69 d further optimi │ │ │ -00078780: 7a65 7320 7468 656d 2e3c 2f64 643e 0a3c zes them.
    .< │ │ │ -00078790: 6464 3e3c 636f 6465 3e69 7465 7261 7469 dd>iterati │ │ │ -000787a0: 6f6e 7343 6f75 6e74 3c2f 636f 6465 3e20 onsCount │ │ │ -000787b0: 2d20 4e75 6d62 6572 206f 6620 6974 6572 - Number of iter │ │ │ -000787c0: 6174 696f 6e73 2e3c 2f64 643e 0a3c 6464 ations..
    reproject │ │ │ -000787e0: 696f 6e45 7272 6f72 3c2f 636f 6465 3e20 ionError │ │ │ -000787f0: 2d20 496e 6c69 6572 2074 6872 6573 686f - Inlier thresho │ │ │ -00078800: 6c64 2076 616c 7565 2075 7365 6420 6279 ld value used by │ │ │ -00078810: 2074 6865 2052 414e 5341 4320 7072 6f63 the RANSAC proc │ │ │ -00078820: 6564 7572 652e 2054 6865 2070 6172 616d edure. The param │ │ │ -00078830: 6574 6572 2076 616c 7565 0a69 7320 7468 eter value.is th │ │ │ -00078840: 6520 6d61 7869 6d75 6d20 616c 6c6f 7765 e maximum allowe │ │ │ -00078850: 6420 6469 7374 616e 6365 2062 6574 7765 d distance betwe │ │ │ -00078860: 656e 2074 6865 206f 6273 6572 7665 6420 en the observed │ │ │ -00078870: 616e 6420 636f 6d70 7574 6564 2070 6f69 and computed poi │ │ │ -00078880: 6e74 2070 726f 6a65 6374 696f 6e73 2074 nt projections t │ │ │ -00078890: 6f20 636f 6e73 6964 6572 2069 740a 616e o consider it.an │ │ │ -000788a0: 2069 6e6c 6965 722e 3c2f 6464 3e0a 3c64 inlier.
    .confiden │ │ │ -000788c0: 6365 3c2f 636f 6465 3e20 2d20 5468 6520 ce - The │ │ │ -000788d0: 7072 6f62 6162 696c 6974 7920 7468 6174 probability that │ │ │ -000788e0: 2074 6865 2061 6c67 6f72 6974 686d 2070 the algorithm p │ │ │ -000788f0: 726f 6475 6365 7320 6120 7573 6566 756c roduces a useful │ │ │ -00078900: 2072 6573 756c 742e 0a0a 5468 6520 6675 result...The fu │ │ │ -00078910: 6e63 7469 6f6e 2065 7374 696d 6174 6573 nction estimates │ │ │ -00078920: 2061 6e20 6f62 6a65 6374 2070 6f73 6520 an object pose │ │ │ -00078930: 6769 7665 6e20 6120 7365 7420 6f66 206f given a set of o │ │ │ -00078940: 626a 6563 7420 706f 696e 7473 2c20 7468 bject points, th │ │ │ -00078950: 6569 7220 636f 7272 6573 706f 6e64 696e eir correspondin │ │ │ -00078960: 6720 696d 6167 650a 7072 6f6a 6563 7469 g image.projecti │ │ │ -00078970: 6f6e 732c 2061 7320 7765 6c6c 2061 7320 ons, as well as │ │ │ -00078980: 7468 6520 6361 6d65 7261 2069 6e74 7269 the camera intri │ │ │ -00078990: 6e73 6963 206d 6174 7269 7820 616e 6420 nsic matrix and │ │ │ -000789a0: 7468 6520 6469 7374 6f72 7469 6f6e 2063 the distortion c │ │ │ -000789b0: 6f65 6666 6963 6965 6e74 732e 2054 6869 oefficients. Thi │ │ │ -000789c0: 7320 6675 6e63 7469 6f6e 2066 696e 6473 s function finds │ │ │ -000789d0: 2073 7563 680a 6120 706f 7365 2074 6861 such.a pose tha │ │ │ -000789e0: 7420 6d69 6e69 6d69 7a65 7320 7265 7072 t minimizes repr │ │ │ -000789f0: 6f6a 6563 7469 6f6e 2065 7272 6f72 2c20 ojection error, │ │ │ -00078a00: 7468 6174 2069 732c 2074 6865 2073 756d that is, the sum │ │ │ -00078a10: 206f 6620 7371 7561 7265 6420 6469 7374 of squared dist │ │ │ -00078a20: 616e 6365 7320 6265 7477 6565 6e20 7468 ances between th │ │ │ -00078a30: 6520 6f62 7365 7276 6564 0a70 726f 6a65 e observed.proje │ │ │ -00078a40: 6374 696f 6e73 2069 6d61 6765 506f 696e ctions imagePoin │ │ │ -00078a50: 7473 2061 6e64 2074 6865 2070 726f 6a65 ts and the proje │ │ │ -00078a60: 6374 6564 2028 7573 696e 6720 5245 463a cted (using REF: │ │ │ -00078a70: 2070 726f 6a65 6374 506f 696e 7473 2029 projectPoints ) │ │ │ -00078a80: 206f 626a 6563 7450 6f69 6e74 732e 2054 objectPoints. T │ │ │ -00078a90: 6865 2075 7365 206f 6620 5241 4e53 4143 he use of RANSAC │ │ │ -00078aa0: 0a6d 616b 6573 2074 6865 2066 756e 6374 .makes the funct │ │ │ -00078ab0: 696f 6e20 7265 7369 7374 616e 7420 746f ion resistant to │ │ │ -00078ac0: 206f 7574 6c69 6572 732e 0a0a 3c62 3e4e outliers...N │ │ │ -00078ad0: 6f74 653a 3c2f 623e 0a3c 756c 3e0a 2020 ote:.
      . │ │ │ -00078ae0: 3c6c 693e 0a20 2020 2020 2041 6e20 6578
    • . An ex │ │ │ -00078af0: 616d 706c 6520 6f66 2068 6f77 2074 6f20 ample of how to │ │ │ -00078b00: 7573 6520 736f 6c76 6550 6e50 5261 6e73 use solvePnPRans │ │ │ -00078b10: 6163 2066 6f72 206f 626a 6563 7420 6465 ac for object de │ │ │ -00078b20: 7465 6374 696f 6e20 6361 6e20 6265 2066 tection can be f │ │ │ -00078b30: 6f75 6e64 2061 740a 2020 2020 2020 2020 ound at. │ │ │ -00078b40: 5245 463a 2074 7574 6f72 6961 6c5f 7265 REF: tutorial_re │ │ │ -00078b50: 616c 5f74 696d 655f 706f 7365 0a20 203c al_time_pose. < │ │ │ -00078b60: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2020 /li>.
    • . │ │ │ -00078b70: 2020 5468 6520 6465 6661 756c 7420 6d65 The default me │ │ │ -00078b80: 7468 6f64 2075 7365 6420 746f 2065 7374 thod used to est │ │ │ -00078b90: 696d 6174 6520 7468 6520 6361 6d65 7261 imate the camera │ │ │ -00078ba0: 2070 6f73 6520 666f 7220 7468 6520 4d69 pose for the Mi │ │ │ -00078bb0: 6e69 6d61 6c20 5361 6d70 6c65 2053 6574 nimal Sample Set │ │ │ -00078bc0: 7320 7374 6570 0a20 2020 2020 2020 6973 s step. is │ │ │ -00078bd0: 2023 534f 4c56 4550 4e50 5f45 504e 502e #SOLVEPNP_EPNP. │ │ │ -00078be0: 2045 7863 6570 7469 6f6e 7320 6172 653a Exceptions are: │ │ │ -00078bf0: 0a20 203c 756c 3e0a 2020 2020 3c6c 693e .
        .
      • │ │ │ -00078c00: 0a20 2020 2020 2020 2020 2069 6620 796f . if yo │ │ │ -00078c10: 7520 6368 6f6f 7365 2023 534f 4c56 4550 u choose #SOLVEP │ │ │ -00078c20: 4e50 5f50 3350 206f 7220 2353 4f4c 5645 NP_P3P or #SOLVE │ │ │ -00078c30: 504e 505f 4150 3350 2c20 7468 6573 6520 PNP_AP3P, these │ │ │ -00078c40: 6d65 7468 6f64 7320 7769 6c6c 2062 6520 methods will be │ │ │ -00078c50: 7573 6564 2e0a 2020 2020 3c2f 6c69 3e0a used..
      • . │ │ │ -00078c60: 2020 2020 3c6c 693e 0a20 2020 2020 2020
      • . │ │ │ -00078c70: 2020 2069 6620 7468 6520 6e75 6d62 6572 if the number │ │ │ -00078c80: 206f 6620 696e 7075 7420 706f 696e 7473 of input points │ │ │ -00078c90: 2069 7320 6571 7561 6c20 746f 2034 2c20 is equal to 4, │ │ │ -00078ca0: 2353 4f4c 5645 504e 505f 5033 5020 6973 #SOLVEPNP_P3P is │ │ │ -00078cb0: 2075 7365 642e 0a20 2020 203c 2f6c 693e used..
      • │ │ │ -00078cc0: 0a20 203c 2f75 6c3e 0a20 203c 6c69 3e0a .
      .
    • . │ │ │ -00078cd0: 2020 2020 2020 5468 6520 6d65 7468 6f64 The method │ │ │ -00078ce0: 2075 7365 6420 746f 2065 7374 696d 6174 used to estimat │ │ │ -00078cf0: 6520 7468 6520 6361 6d65 7261 2070 6f73 e the camera pos │ │ │ -00078d00: 6520 7573 696e 6720 616c 6c20 7468 6520 e using all the │ │ │ -00078d10: 696e 6c69 6572 7320 6973 2064 6566 696e inliers is defin │ │ │ -00078d20: 6564 2062 7920 7468 650a 2020 2020 2020 ed by the. │ │ │ -00078d30: 2066 6c61 6773 2070 6172 616d 6574 6572 flags parameter │ │ │ -00078d40: 7320 756e 6c65 7373 2069 7420 6973 2065 s unless it is e │ │ │ -00078d50: 7175 616c 2074 6f20 2353 4f4c 5645 504e qual to #SOLVEPN │ │ │ -00078d60: 505f 5033 5020 6f72 2023 534f 4c56 4550 P_P3P or #SOLVEP │ │ │ -00078d70: 4e50 5f41 5033 502e 2049 6e20 7468 6973 NP_AP3P. In this │ │ │ -00078d80: 2063 6173 652c 0a20 2020 2020 2020 7468 case,. th │ │ │ -00078d90: 6520 6d65 7468 6f64 2023 534f 4c56 4550 e method #SOLVEP │ │ │ -00078da0: 4e50 5f45 504e 5020 7769 6c6c 2062 6520 NP_EPNP will be │ │ │ -00078db0: 7573 6564 2069 6e73 7465 6164 2e0a 2020 used instead.. │ │ │ -00078dc0: 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64 643e
    • .
    │ │ │ -00078dd0: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    automatic │ │ │ -00078df0: 616c 6c79 2067 656e 6572 6174 6564 3c2f ally generated.
    .
    │ │ │ -00078e10: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .

    .
  • .
  • .
    .

    sol │ │ │ -00078f00: 7665 506e 5052 616e 7361 633c 2f68 333e vePnPRansac

    │ │ │ -00078f10: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ -00078f30: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ -00078f50: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ -00078f60: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ -00078f70: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ -00078f80: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;boole │ │ │ -00078fa0: 616e 3c2f 7370 616e 3e26 6e62 7370 3b3c an < │ │ │ -00078fb0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ -00078fc0: 656e 742d 6e61 6d65 223e 736f 6c76 6550 ent-name">solveP │ │ │ -00078fd0: 6e50 5261 6e73 6163 3c2f 7370 616e 3e3c nPRansac< │ │ │ -00078fe0: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(MatOfPoint3f< │ │ │ -00079050: 2f61 3e26 6e62 7370 3b6f 626a 6563 7450 /a> objectP │ │ │ -00079060: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat │ │ │ -000790b0: 4f66 506f 696e 7432 663c 2f61 3e26 6e62 OfPoint2f&nb │ │ │ -000790c0: 7370 3b69 6d61 6765 506f 696e 7473 2c0a sp;imagePoints,. │ │ │ -000790d0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -00079110: 3c2f 613e 266e 6273 703b 6361 6d65 7261  camera │ │ │ -00079120: 4d61 7472 6978 2c0a 203c 6120 6872 6566 Matrix,. Mat │ │ │ -00079170: 4f66 446f 7562 6c65 3c2f 613e 266e 6273 OfDouble&nbs │ │ │ -00079180: 703b 6469 7374 436f 6566 6673 2c0a 203c p;distCoeffs,. < │ │ │ -00079190: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000791a0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000791b0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000791c0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat rvec,. < │ │ │ -000791e0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000791f0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00079200: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00079210: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat tvec,. b │ │ │ -00079230: 6f6f 6c65 616e 266e 6273 703b 7573 6545 oolean useE │ │ │ -00079240: 7874 7269 6e73 6963 4775 6573 732c 0a20 xtrinsicGuess,. │ │ │ -00079250: 696e 7426 6e62 7370 3b69 7465 7261 7469 int iterati │ │ │ -00079260: 6f6e 7343 6f75 6e74 2c0a 2066 6c6f 6174 onsCount,. float │ │ │ -00079270: 266e 6273 703b 7265 7072 6f6a 6563 7469  reprojecti │ │ │ -00079280: 6f6e 4572 726f 7229 3c2f 7370 616e 3e3c onError)< │ │ │ -00079290: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Finds a │ │ │ -000792b0: 6e20 6f62 6a65 6374 2070 6f73 6520 5c28 n object pose \( │ │ │ -000792c0: 207b 7d5e 7b63 7d5c 6d61 7468 6266 7b54 {}^{c}\mathbf{T │ │ │ -000792d0: 7d5f 6f20 5c29 2066 726f 6d20 3344 2d32 }_o \) from 3D-2 │ │ │ -000792e0: 4420 706f 696e 7420 636f 7272 6573 706f D point correspo │ │ │ -000792f0: 6e64 656e 6365 7320 7573 696e 6720 7468 ndences using th │ │ │ -00079300: 6520 5241 4e53 4143 2073 6368 656d 6520 e RANSAC scheme │ │ │ -00079310: 746f 2064 6561 6c20 7769 7468 2062 6164 to deal with bad │ │ │ -00079320: 206d 6174 6368 6573 2e0a 0a21 5b50 6572 matches...![Per │ │ │ -00079330: 7370 6563 7469 7665 2070 726f 6a65 6374 spective project │ │ │ -00079340: 696f 6e2c 2066 726f 6d20 6f62 6a65 6374 ion, from object │ │ │ -00079350: 2074 6f20 6361 6d65 7261 2066 7261 6d65 to camera frame │ │ │ -00079360: 5d28 7069 6373 2f70 696e 686f 6c65 5f68 ](pics/pinhole_h │ │ │ -00079370: 6f6d 6f67 656e 656f 7573 5f74 7261 6e73 omogeneous_trans │ │ │ -00079380: 666f 726d 6174 696f 6e2e 6a70 6729 7b20 formation.jpg){ │ │ │ -00079390: 7769 6474 683d 3530 2520 7d0a 0a53 4545 width=50% }..SEE │ │ │ -000793a0: 3a20 5245 463a 2063 616c 6962 3364 5f73 : REF: calib3d_s │ │ │ -000793b0: 6f6c 7665 506e 503c 2f64 6976 3e0a 3c64 olvePnP
    . │ │ │ -000793d0: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ -000793e0: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000793f0: 6f62 6a65 6374 506f 696e 7473 3c2f 636f objectPoints - Array of o │ │ │ -00079410: 626a 6563 7420 706f 696e 7473 2069 6e20 bject points in │ │ │ -00079420: 7468 6520 6f62 6a65 6374 2063 6f6f 7264 the object coord │ │ │ -00079430: 696e 6174 6520 7370 6163 652c 204e 7833 inate space, Nx3 │ │ │ -00079440: 2031 2d63 6861 6e6e 656c 206f 720a 3178 1-channel or.1x │ │ │ -00079450: 4e2f 4e78 3120 332d 6368 616e 6e65 6c2c N/Nx1 3-channel, │ │ │ -00079460: 2077 6865 7265 204e 2069 7320 7468 6520 where N is the │ │ │ -00079470: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ -00079480: 2e20 7665 6374 6f72 266c 743b 506f 696e . vector<Poin │ │ │ -00079490: 7433 6426 6774 3b20 6361 6e20 6265 2061 t3d> can be a │ │ │ -000794a0: 6c73 6f20 7061 7373 6564 2068 6572 652e lso passed here. │ │ │ -000794b0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000794c0: 696d 6167 6550 6f69 6e74 733c 2f63 6f64 imagePoints - Array of co │ │ │ -000794e0: 7272 6573 706f 6e64 696e 6720 696d 6167 rresponding imag │ │ │ -000794f0: 6520 706f 696e 7473 2c20 4e78 3220 312d e points, Nx2 1- │ │ │ -00079500: 6368 616e 6e65 6c20 6f72 2031 784e 2f4e channel or 1xN/N │ │ │ -00079510: 7831 2032 2d63 6861 6e6e 656c 2c0a 7768 x1 2-channel,.wh │ │ │ -00079520: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ -00079530: 6265 7220 6f66 2070 6f69 6e74 732e 2076 ber of points. v │ │ │ -00079540: 6563 746f 7226 6c74 3b50 6f69 6e74 3264 ector<Point2d │ │ │ -00079550: 2667 743b 2063 616e 2062 6520 616c 736f > can be also │ │ │ -00079560: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    cam │ │ │ -00079580: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ -00079590: 202d 2049 6e70 7574 2063 616d 6572 6120 - Input camera │ │ │ -000795a0: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ -000795b0: 205c 285c 6361 6d65 7261 6d61 7472 6978 \(\cameramatrix │ │ │ -000795c0: 7b41 7d5c 2920 2e3c 2f64 643e 0a3c 6464 {A}\) .
    .
    distCoeff │ │ │ -000795e0: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ -000795f0: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ -00079600: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ -00079610: 7473 0a5c 285c 6469 7374 636f 6566 6673 ts.\(\distcoeffs │ │ │ -00079620: 5c29 2e20 4966 2074 6865 2076 6563 746f \). If the vecto │ │ │ -00079630: 7220 6973 204e 554c 4c2f 656d 7074 792c r is NULL/empty, │ │ │ -00079640: 2074 6865 207a 6572 6f20 6469 7374 6f72 the zero distor │ │ │ -00079650: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ -00079660: 7320 6172 650a 6173 7375 6d65 642e 3c2f s are.assumed..
    rv │ │ │ -00079680: 6563 3c2f 636f 6465 3e20 2d20 4f75 7470 ec - Outp │ │ │ -00079690: 7574 2072 6f74 6174 696f 6e20 7665 6374 ut rotation vect │ │ │ -000796a0: 6f72 2028 7365 6520 5245 463a 2052 6f64 or (see REF: Rod │ │ │ -000796b0: 7269 6775 6573 2029 2074 6861 742c 2074 rigues ) that, t │ │ │ -000796c0: 6f67 6574 6865 7220 7769 7468 2074 7665 ogether with tve │ │ │ -000796d0: 632c 2062 7269 6e67 7320 706f 696e 7473 c, brings points │ │ │ -000796e0: 2066 726f 6d0a 7468 6520 6d6f 6465 6c20 from.the model │ │ │ -000796f0: 636f 6f72 6469 6e61 7465 2073 7973 7465 coordinate syste │ │ │ -00079700: 6d20 746f 2074 6865 2063 616d 6572 6120 m to the camera │ │ │ -00079710: 636f 6f72 6469 6e61 7465 2073 7973 7465 coordinate syste │ │ │ -00079720: 6d2e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 m.
    .
    tvec - │ │ │ -00079740: 4f75 7470 7574 2074 7261 6e73 6c61 7469 Output translati │ │ │ -00079750: 6f6e 2076 6563 746f 722e 3c2f 6464 3e0a on vector.
    . │ │ │ -00079760: 3c64 643e 3c63 6f64 653e 7573 6545 7874
    useExt │ │ │ -00079770: 7269 6e73 6963 4775 6573 733c 2f63 6f64 rinsicGuess - Parameter u │ │ │ -00079790: 7365 6420 666f 7220 5245 463a 2053 4f4c sed for REF: SOL │ │ │ -000797a0: 5645 504e 505f 4954 4552 4154 4956 452e VEPNP_ITERATIVE. │ │ │ -000797b0: 2049 6620 7472 7565 2028 3129 2c20 7468 If true (1), th │ │ │ -000797c0: 6520 6675 6e63 7469 6f6e 2075 7365 730a e function uses. │ │ │ -000797d0: 7468 6520 7072 6f76 6964 6564 2072 7665 the provided rve │ │ │ -000797e0: 6320 616e 6420 7476 6563 2076 616c 7565 c and tvec value │ │ │ -000797f0: 7320 6173 2069 6e69 7469 616c 2061 7070 s as initial app │ │ │ -00079800: 726f 7869 6d61 7469 6f6e 7320 6f66 2074 roximations of t │ │ │ -00079810: 6865 2072 6f74 6174 696f 6e20 616e 6420 he rotation and │ │ │ -00079820: 7472 616e 736c 6174 696f 6e0a 7665 6374 translation.vect │ │ │ -00079830: 6f72 732c 2072 6573 7065 6374 6976 656c ors, respectivel │ │ │ -00079840: 792c 2061 6e64 2066 7572 7468 6572 206f y, and further o │ │ │ -00079850: 7074 696d 697a 6573 2074 6865 6d2e 3c2f ptimizes them..
    it │ │ │ -00079870: 6572 6174 696f 6e73 436f 756e 743c 2f63 erationsCount - Number of │ │ │ -00079890: 2069 7465 7261 7469 6f6e 732e 3c2f 6464 iterations.
    .
    repr │ │ │ -000798b0: 6f6a 6563 7469 6f6e 4572 726f 723c 2f63 ojectionError - Inlier th │ │ │ -000798d0: 7265 7368 6f6c 6420 7661 6c75 6520 7573 reshold value us │ │ │ -000798e0: 6564 2062 7920 7468 6520 5241 4e53 4143 ed by the RANSAC │ │ │ -000798f0: 2070 726f 6365 6475 7265 2e20 5468 6520 procedure. The │ │ │ -00079900: 7061 7261 6d65 7465 7220 7661 6c75 650a parameter value. │ │ │ -00079910: 6973 2074 6865 206d 6178 696d 756d 2061 is the maximum a │ │ │ -00079920: 6c6c 6f77 6564 2064 6973 7461 6e63 6520 llowed distance │ │ │ -00079930: 6265 7477 6565 6e20 7468 6520 6f62 7365 between the obse │ │ │ -00079940: 7276 6564 2061 6e64 2063 6f6d 7075 7465 rved and compute │ │ │ -00079950: 6420 706f 696e 7420 7072 6f6a 6563 7469 d point projecti │ │ │ -00079960: 6f6e 7320 746f 2063 6f6e 7369 6465 7220 ons to consider │ │ │ -00079970: 6974 0a61 6e20 696e 6c69 6572 2e0a 0a54 it.an inlier...T │ │ │ -00079980: 6865 2066 756e 6374 696f 6e20 6573 7469 he function esti │ │ │ -00079990: 6d61 7465 7320 616e 206f 626a 6563 7420 mates an object │ │ │ -000799a0: 706f 7365 2067 6976 656e 2061 2073 6574 pose given a set │ │ │ -000799b0: 206f 6620 6f62 6a65 6374 2070 6f69 6e74 of object point │ │ │ -000799c0: 732c 2074 6865 6972 2063 6f72 7265 7370 s, their corresp │ │ │ -000799d0: 6f6e 6469 6e67 2069 6d61 6765 0a70 726f onding image.pro │ │ │ -000799e0: 6a65 6374 696f 6e73 2c20 6173 2077 656c jections, as wel │ │ │ -000799f0: 6c20 6173 2074 6865 2063 616d 6572 6120 l as the camera │ │ │ -00079a00: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ -00079a10: 2061 6e64 2074 6865 2064 6973 746f 7274 and the distort │ │ │ -00079a20: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ -00079a30: 2e20 5468 6973 2066 756e 6374 696f 6e20 . This function │ │ │ -00079a40: 6669 6e64 7320 7375 6368 0a61 2070 6f73 finds such.a pos │ │ │ -00079a50: 6520 7468 6174 206d 696e 696d 697a 6573 e that minimizes │ │ │ -00079a60: 2072 6570 726f 6a65 6374 696f 6e20 6572 reprojection er │ │ │ -00079a70: 726f 722c 2074 6861 7420 6973 2c20 7468 ror, that is, th │ │ │ -00079a80: 6520 7375 6d20 6f66 2073 7175 6172 6564 e sum of squared │ │ │ -00079a90: 2064 6973 7461 6e63 6573 2062 6574 7765 distances betwe │ │ │ -00079aa0: 656e 2074 6865 206f 6273 6572 7665 640a en the observed. │ │ │ -00079ab0: 7072 6f6a 6563 7469 6f6e 7320 696d 6167 projections imag │ │ │ -00079ac0: 6550 6f69 6e74 7320 616e 6420 7468 6520 ePoints and the │ │ │ -00079ad0: 7072 6f6a 6563 7465 6420 2875 7369 6e67 projected (using │ │ │ -00079ae0: 2052 4546 3a20 7072 6f6a 6563 7450 6f69 REF: projectPoi │ │ │ -00079af0: 6e74 7320 2920 6f62 6a65 6374 506f 696e nts ) objectPoin │ │ │ -00079b00: 7473 2e20 5468 6520 7573 6520 6f66 2052 ts. The use of R │ │ │ -00079b10: 414e 5341 430a 6d61 6b65 7320 7468 6520 ANSAC.makes the │ │ │ -00079b20: 6675 6e63 7469 6f6e 2072 6573 6973 7461 function resista │ │ │ -00079b30: 6e74 2074 6f20 6f75 746c 6965 7273 2e0a nt to outliers.. │ │ │ -00079b40: 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a 3c75 .Note:..
  • . │ │ │ -00079b60: 416e 2065 7861 6d70 6c65 206f 6620 686f An example of ho │ │ │ -00079b70: 7720 746f 2075 7365 2073 6f6c 7665 506e w to use solvePn │ │ │ -00079b80: 5052 616e 7361 6320 666f 7220 6f62 6a65 PRansac for obje │ │ │ -00079b90: 6374 2064 6574 6563 7469 6f6e 2063 616e ct detection can │ │ │ -00079ba0: 2062 6520 666f 756e 6420 6174 0a20 2020 be found at. │ │ │ -00079bb0: 2020 2020 2052 4546 3a20 7475 746f 7269 REF: tutori │ │ │ -00079bc0: 616c 5f72 6561 6c5f 7469 6d65 5f70 6f73 al_real_time_pos │ │ │ -00079bd0: 650a 2020 3c2f 6c69 3e0a 2020 3c6c 693e e.
  • .
  • │ │ │ -00079be0: 0a20 2020 2020 2054 6865 2064 6566 6175 . The defau │ │ │ -00079bf0: 6c74 206d 6574 686f 6420 7573 6564 2074 lt method used t │ │ │ -00079c00: 6f20 6573 7469 6d61 7465 2074 6865 2063 o estimate the c │ │ │ -00079c10: 616d 6572 6120 706f 7365 2066 6f72 2074 amera pose for t │ │ │ -00079c20: 6865 204d 696e 696d 616c 2053 616d 706c he Minimal Sampl │ │ │ -00079c30: 6520 5365 7473 2073 7465 700a 2020 2020 e Sets step. │ │ │ -00079c40: 2020 2069 7320 2353 4f4c 5645 504e 505f is #SOLVEPNP_ │ │ │ -00079c50: 4550 4e50 2e20 4578 6365 7074 696f 6e73 EPNP. Exceptions │ │ │ -00079c60: 2061 7265 3a0a 2020 3c75 6c3e 0a20 2020 are:.
      . │ │ │ -00079c70: 203c 6c69 3e0a 2020 2020 2020 2020 2020
    • . │ │ │ -00079c80: 6966 2079 6f75 2063 686f 6f73 6520 2353 if you choose #S │ │ │ -00079c90: 4f4c 5645 504e 505f 5033 5020 6f72 2023 OLVEPNP_P3P or # │ │ │ -00079ca0: 534f 4c56 4550 4e50 5f41 5033 502c 2074 SOLVEPNP_AP3P, t │ │ │ -00079cb0: 6865 7365 206d 6574 686f 6473 2077 696c hese methods wil │ │ │ -00079cc0: 6c20 6265 2075 7365 642e 0a20 2020 203c l be used.. < │ │ │ -00079cd0: 2f6c 693e 0a20 2020 203c 6c69 3e0a 2020 /li>.
    • . │ │ │ -00079ce0: 2020 2020 2020 2020 6966 2074 6865 206e if the n │ │ │ -00079cf0: 756d 6265 7220 6f66 2069 6e70 7574 2070 umber of input p │ │ │ -00079d00: 6f69 6e74 7320 6973 2065 7175 616c 2074 oints is equal t │ │ │ -00079d10: 6f20 342c 2023 534f 4c56 4550 4e50 5f50 o 4, #SOLVEPNP_P │ │ │ -00079d20: 3350 2069 7320 7573 6564 2e0a 2020 2020 3P is used.. │ │ │ -00079d30: 3c2f 6c69 3e0a 2020 3c2f 756c 3e0a 2020
    • .
    . │ │ │ -00079d40: 3c6c 693e 0a20 2020 2020 2054 6865 206d
  • . The m │ │ │ -00079d50: 6574 686f 6420 7573 6564 2074 6f20 6573 ethod used to es │ │ │ -00079d60: 7469 6d61 7465 2074 6865 2063 616d 6572 timate the camer │ │ │ -00079d70: 6120 706f 7365 2075 7369 6e67 2061 6c6c a pose using all │ │ │ -00079d80: 2074 6865 2069 6e6c 6965 7273 2069 7320 the inliers is │ │ │ -00079d90: 6465 6669 6e65 6420 6279 2074 6865 0a20 defined by the. │ │ │ -00079da0: 2020 2020 2020 666c 6167 7320 7061 7261 flags para │ │ │ -00079db0: 6d65 7465 7273 2075 6e6c 6573 7320 6974 meters unless it │ │ │ -00079dc0: 2069 7320 6571 7561 6c20 746f 2023 534f is equal to #SO │ │ │ -00079dd0: 4c56 4550 4e50 5f50 3350 206f 7220 2353 LVEPNP_P3P or #S │ │ │ -00079de0: 4f4c 5645 504e 505f 4150 3350 2e20 496e OLVEPNP_AP3P. In │ │ │ -00079df0: 2074 6869 7320 6361 7365 2c0a 2020 2020 this case,. │ │ │ -00079e00: 2020 2074 6865 206d 6574 686f 6420 2353 the method #S │ │ │ -00079e10: 4f4c 5645 504e 505f 4550 4e50 2077 696c OLVEPNP_EPNP wil │ │ │ -00079e20: 6c20 6265 2075 7365 6420 696e 7374 6561 l be used instea │ │ │ -00079e30: 642e 0a20 203c 2f6c 693e 0a3c 2f75 6c3e d..
  • . │ │ │ -00079e40: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ -00079e50: 733a 3c2f 6474 3e0a 3c64 643e 6175 746f s:
    .
    auto │ │ │ -00079e60: 6d61 7469 6361 6c6c 7920 6765 6e65 7261 matically genera │ │ │ -00079e70: 7465 643c 2f64 643e 0a3c 2f64 6c3e 0a3c ted
    ..< │ │ │ -00079e80: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ -00079e90: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    solv │ │ │ -00079f70: 6550 6e50 5261 6e73 6163 3c2f 6833 3e0a ePnPRansac

    . │ │ │ -00079f80: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ -00079fa0: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ -00079fe0: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ -00079ff0: 3c73 7061 6e20 636c 6173 733d 2272 6574 boolea │ │ │ -0007a010: 6e3c 2f73 7061 6e3e 266e 6273 703b 3c73 n solvePn │ │ │ -0007a040: 5052 616e 7361 633c 2f73 7061 6e3e 3c77 PRansac(MatOfPoint3f objectPo │ │ │ -0007a0d0: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. MatO │ │ │ -0007a120: 6650 6f69 6e74 3266 3c2f 613e 266e 6273 fPoint2f&nbs │ │ │ -0007a130: 703b 696d 6167 6550 6f69 6e74 732c 0a20 p;imagePoints,. │ │ │ -0007a140: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0007a180: 2f61 3e26 6e62 7370 3b63 616d 6572 614d /a> cameraM │ │ │ -0007a190: 6174 7269 782c 0a20 3c61 2068 7265 663d atrix,. MatO │ │ │ -0007a1e0: 6644 6f75 626c 653c 2f61 3e26 6e62 7370 fDouble  │ │ │ -0007a1f0: 3b64 6973 7443 6f65 6666 732c 0a20 3c61 ;distCoeffs,. Mat rvec,. Mat tvec,. bo │ │ │ -0007a2a0: 6f6c 6561 6e26 6e62 7370 3b75 7365 4578 olean useEx │ │ │ -0007a2b0: 7472 696e 7369 6347 7565 7373 2c0a 2069 trinsicGuess,. i │ │ │ -0007a2c0: 6e74 266e 6273 703b 6974 6572 6174 696f nt iteratio │ │ │ -0007a2d0: 6e73 436f 756e 7429 3c2f 7370 616e 3e3c nsCount)< │ │ │ -0007a2e0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Finds a │ │ │ -0007a300: 6e20 6f62 6a65 6374 2070 6f73 6520 5c28 n object pose \( │ │ │ -0007a310: 207b 7d5e 7b63 7d5c 6d61 7468 6266 7b54 {}^{c}\mathbf{T │ │ │ -0007a320: 7d5f 6f20 5c29 2066 726f 6d20 3344 2d32 }_o \) from 3D-2 │ │ │ -0007a330: 4420 706f 696e 7420 636f 7272 6573 706f D point correspo │ │ │ -0007a340: 6e64 656e 6365 7320 7573 696e 6720 7468 ndences using th │ │ │ -0007a350: 6520 5241 4e53 4143 2073 6368 656d 6520 e RANSAC scheme │ │ │ -0007a360: 746f 2064 6561 6c20 7769 7468 2062 6164 to deal with bad │ │ │ -0007a370: 206d 6174 6368 6573 2e0a 0a21 5b50 6572 matches...![Per │ │ │ -0007a380: 7370 6563 7469 7665 2070 726f 6a65 6374 spective project │ │ │ -0007a390: 696f 6e2c 2066 726f 6d20 6f62 6a65 6374 ion, from object │ │ │ -0007a3a0: 2074 6f20 6361 6d65 7261 2066 7261 6d65 to camera frame │ │ │ -0007a3b0: 5d28 7069 6373 2f70 696e 686f 6c65 5f68 ](pics/pinhole_h │ │ │ -0007a3c0: 6f6d 6f67 656e 656f 7573 5f74 7261 6e73 omogeneous_trans │ │ │ -0007a3d0: 666f 726d 6174 696f 6e2e 6a70 6729 7b20 formation.jpg){ │ │ │ -0007a3e0: 7769 6474 683d 3530 2520 7d0a 0a53 4545 width=50% }..SEE │ │ │ -0007a3f0: 3a20 5245 463a 2063 616c 6962 3364 5f73 : REF: calib3d_s │ │ │ -0007a400: 6f6c 7665 506e 503c 2f64 6976 3e0a 3c64 olvePnP
    . │ │ │ -0007a420: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ -0007a430: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -0007a440: 6f62 6a65 6374 506f 696e 7473 3c2f 636f objectPoints - Array of o │ │ │ -0007a460: 626a 6563 7420 706f 696e 7473 2069 6e20 bject points in │ │ │ -0007a470: 7468 6520 6f62 6a65 6374 2063 6f6f 7264 the object coord │ │ │ -0007a480: 696e 6174 6520 7370 6163 652c 204e 7833 inate space, Nx3 │ │ │ -0007a490: 2031 2d63 6861 6e6e 656c 206f 720a 3178 1-channel or.1x │ │ │ -0007a4a0: 4e2f 4e78 3120 332d 6368 616e 6e65 6c2c N/Nx1 3-channel, │ │ │ -0007a4b0: 2077 6865 7265 204e 2069 7320 7468 6520 where N is the │ │ │ -0007a4c0: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ -0007a4d0: 2e20 7665 6374 6f72 266c 743b 506f 696e . vector<Poin │ │ │ -0007a4e0: 7433 6426 6774 3b20 6361 6e20 6265 2061 t3d> can be a │ │ │ -0007a4f0: 6c73 6f20 7061 7373 6564 2068 6572 652e lso passed here. │ │ │ -0007a500: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -0007a510: 696d 6167 6550 6f69 6e74 733c 2f63 6f64 imagePoints - Array of co │ │ │ -0007a530: 7272 6573 706f 6e64 696e 6720 696d 6167 rresponding imag │ │ │ -0007a540: 6520 706f 696e 7473 2c20 4e78 3220 312d e points, Nx2 1- │ │ │ -0007a550: 6368 616e 6e65 6c20 6f72 2031 784e 2f4e channel or 1xN/N │ │ │ -0007a560: 7831 2032 2d63 6861 6e6e 656c 2c0a 7768 x1 2-channel,.wh │ │ │ -0007a570: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ -0007a580: 6265 7220 6f66 2070 6f69 6e74 732e 2076 ber of points. v │ │ │ -0007a590: 6563 746f 7226 6c74 3b50 6f69 6e74 3264 ector<Point2d │ │ │ -0007a5a0: 2667 743b 2063 616e 2062 6520 616c 736f > can be also │ │ │ -0007a5b0: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    cam │ │ │ -0007a5d0: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ -0007a5e0: 202d 2049 6e70 7574 2063 616d 6572 6120 - Input camera │ │ │ -0007a5f0: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ -0007a600: 205c 285c 6361 6d65 7261 6d61 7472 6978 \(\cameramatrix │ │ │ -0007a610: 7b41 7d5c 2920 2e3c 2f64 643e 0a3c 6464 {A}\) .
    .
    distCoeff │ │ │ -0007a630: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ -0007a640: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ -0007a650: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ -0007a660: 7473 0a5c 285c 6469 7374 636f 6566 6673 ts.\(\distcoeffs │ │ │ -0007a670: 5c29 2e20 4966 2074 6865 2076 6563 746f \). If the vecto │ │ │ -0007a680: 7220 6973 204e 554c 4c2f 656d 7074 792c r is NULL/empty, │ │ │ -0007a690: 2074 6865 207a 6572 6f20 6469 7374 6f72 the zero distor │ │ │ -0007a6a0: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ -0007a6b0: 7320 6172 650a 6173 7375 6d65 642e 3c2f s are.assumed..
    rv │ │ │ -0007a6d0: 6563 3c2f 636f 6465 3e20 2d20 4f75 7470 ec - Outp │ │ │ -0007a6e0: 7574 2072 6f74 6174 696f 6e20 7665 6374 ut rotation vect │ │ │ -0007a6f0: 6f72 2028 7365 6520 5245 463a 2052 6f64 or (see REF: Rod │ │ │ -0007a700: 7269 6775 6573 2029 2074 6861 742c 2074 rigues ) that, t │ │ │ -0007a710: 6f67 6574 6865 7220 7769 7468 2074 7665 ogether with tve │ │ │ -0007a720: 632c 2062 7269 6e67 7320 706f 696e 7473 c, brings points │ │ │ -0007a730: 2066 726f 6d0a 7468 6520 6d6f 6465 6c20 from.the model │ │ │ -0007a740: 636f 6f72 6469 6e61 7465 2073 7973 7465 coordinate syste │ │ │ -0007a750: 6d20 746f 2074 6865 2063 616d 6572 6120 m to the camera │ │ │ -0007a760: 636f 6f72 6469 6e61 7465 2073 7973 7465 coordinate syste │ │ │ -0007a770: 6d2e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 m.
    .
    tvec - │ │ │ -0007a790: 4f75 7470 7574 2074 7261 6e73 6c61 7469 Output translati │ │ │ -0007a7a0: 6f6e 2076 6563 746f 722e 3c2f 6464 3e0a on vector.
    . │ │ │ -0007a7b0: 3c64 643e 3c63 6f64 653e 7573 6545 7874
    useExt │ │ │ -0007a7c0: 7269 6e73 6963 4775 6573 733c 2f63 6f64 rinsicGuess - Parameter u │ │ │ -0007a7e0: 7365 6420 666f 7220 5245 463a 2053 4f4c sed for REF: SOL │ │ │ -0007a7f0: 5645 504e 505f 4954 4552 4154 4956 452e VEPNP_ITERATIVE. │ │ │ -0007a800: 2049 6620 7472 7565 2028 3129 2c20 7468 If true (1), th │ │ │ -0007a810: 6520 6675 6e63 7469 6f6e 2075 7365 730a e function uses. │ │ │ -0007a820: 7468 6520 7072 6f76 6964 6564 2072 7665 the provided rve │ │ │ -0007a830: 6320 616e 6420 7476 6563 2076 616c 7565 c and tvec value │ │ │ -0007a840: 7320 6173 2069 6e69 7469 616c 2061 7070 s as initial app │ │ │ -0007a850: 726f 7869 6d61 7469 6f6e 7320 6f66 2074 roximations of t │ │ │ -0007a860: 6865 2072 6f74 6174 696f 6e20 616e 6420 he rotation and │ │ │ -0007a870: 7472 616e 736c 6174 696f 6e0a 7665 6374 translation.vect │ │ │ -0007a880: 6f72 732c 2072 6573 7065 6374 6976 656c ors, respectivel │ │ │ -0007a890: 792c 2061 6e64 2066 7572 7468 6572 206f y, and further o │ │ │ -0007a8a0: 7074 696d 697a 6573 2074 6865 6d2e 3c2f ptimizes them..
    it │ │ │ -0007a8c0: 6572 6174 696f 6e73 436f 756e 743c 2f63 erationsCount - Number of │ │ │ -0007a8e0: 2069 7465 7261 7469 6f6e 732e 0a69 7320 iterations..is │ │ │ -0007a8f0: 7468 6520 6d61 7869 6d75 6d20 616c 6c6f the maximum allo │ │ │ -0007a900: 7765 6420 6469 7374 616e 6365 2062 6574 wed distance bet │ │ │ -0007a910: 7765 656e 2074 6865 206f 6273 6572 7665 ween the observe │ │ │ -0007a920: 6420 616e 6420 636f 6d70 7574 6564 2070 d and computed p │ │ │ -0007a930: 6f69 6e74 2070 726f 6a65 6374 696f 6e73 oint projections │ │ │ -0007a940: 2074 6f20 636f 6e73 6964 6572 2069 740a to consider it. │ │ │ -0007a950: 616e 2069 6e6c 6965 722e 0a0a 5468 6520 an inlier...The │ │ │ -0007a960: 6675 6e63 7469 6f6e 2065 7374 696d 6174 function estimat │ │ │ -0007a970: 6573 2061 6e20 6f62 6a65 6374 2070 6f73 es an object pos │ │ │ -0007a980: 6520 6769 7665 6e20 6120 7365 7420 6f66 e given a set of │ │ │ -0007a990: 206f 626a 6563 7420 706f 696e 7473 2c20 object points, │ │ │ -0007a9a0: 7468 6569 7220 636f 7272 6573 706f 6e64 their correspond │ │ │ -0007a9b0: 696e 6720 696d 6167 650a 7072 6f6a 6563 ing image.projec │ │ │ -0007a9c0: 7469 6f6e 732c 2061 7320 7765 6c6c 2061 tions, as well a │ │ │ -0007a9d0: 7320 7468 6520 6361 6d65 7261 2069 6e74 s the camera int │ │ │ -0007a9e0: 7269 6e73 6963 206d 6174 7269 7820 616e rinsic matrix an │ │ │ -0007a9f0: 6420 7468 6520 6469 7374 6f72 7469 6f6e d the distortion │ │ │ -0007aa00: 2063 6f65 6666 6963 6965 6e74 732e 2054 coefficients. T │ │ │ -0007aa10: 6869 7320 6675 6e63 7469 6f6e 2066 696e his function fin │ │ │ -0007aa20: 6473 2073 7563 680a 6120 706f 7365 2074 ds such.a pose t │ │ │ -0007aa30: 6861 7420 6d69 6e69 6d69 7a65 7320 7265 hat minimizes re │ │ │ -0007aa40: 7072 6f6a 6563 7469 6f6e 2065 7272 6f72 projection error │ │ │ -0007aa50: 2c20 7468 6174 2069 732c 2074 6865 2073 , that is, the s │ │ │ -0007aa60: 756d 206f 6620 7371 7561 7265 6420 6469 um of squared di │ │ │ -0007aa70: 7374 616e 6365 7320 6265 7477 6565 6e20 stances between │ │ │ -0007aa80: 7468 6520 6f62 7365 7276 6564 0a70 726f the observed.pro │ │ │ -0007aa90: 6a65 6374 696f 6e73 2069 6d61 6765 506f jections imagePo │ │ │ -0007aaa0: 696e 7473 2061 6e64 2074 6865 2070 726f ints and the pro │ │ │ -0007aab0: 6a65 6374 6564 2028 7573 696e 6720 5245 jected (using RE │ │ │ -0007aac0: 463a 2070 726f 6a65 6374 506f 696e 7473 F: projectPoints │ │ │ -0007aad0: 2029 206f 626a 6563 7450 6f69 6e74 732e ) objectPoints. │ │ │ -0007aae0: 2054 6865 2075 7365 206f 6620 5241 4e53 The use of RANS │ │ │ -0007aaf0: 4143 0a6d 616b 6573 2074 6865 2066 756e AC.makes the fun │ │ │ -0007ab00: 6374 696f 6e20 7265 7369 7374 616e 7420 ction resistant │ │ │ -0007ab10: 746f 206f 7574 6c69 6572 732e 0a0a 3c62 to outliers...Note:.
      . │ │ │ -0007ab30: 2020 3c6c 693e 0a20 2020 2020 2041 6e20
    • . An │ │ │ -0007ab40: 6578 616d 706c 6520 6f66 2068 6f77 2074 example of how t │ │ │ -0007ab50: 6f20 7573 6520 736f 6c76 6550 6e50 5261 o use solvePnPRa │ │ │ -0007ab60: 6e73 6163 2066 6f72 206f 626a 6563 7420 nsac for object │ │ │ -0007ab70: 6465 7465 6374 696f 6e20 6361 6e20 6265 detection can be │ │ │ -0007ab80: 2066 6f75 6e64 2061 740a 2020 2020 2020 found at. │ │ │ -0007ab90: 2020 5245 463a 2074 7574 6f72 6961 6c5f REF: tutorial_ │ │ │ -0007aba0: 7265 616c 5f74 696d 655f 706f 7365 0a20 real_time_pose. │ │ │ -0007abb0: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020
    • .
    • . │ │ │ -0007abc0: 2020 2020 5468 6520 6465 6661 756c 7420 The default │ │ │ -0007abd0: 6d65 7468 6f64 2075 7365 6420 746f 2065 method used to e │ │ │ -0007abe0: 7374 696d 6174 6520 7468 6520 6361 6d65 stimate the came │ │ │ -0007abf0: 7261 2070 6f73 6520 666f 7220 7468 6520 ra pose for the │ │ │ -0007ac00: 4d69 6e69 6d61 6c20 5361 6d70 6c65 2053 Minimal Sample S │ │ │ -0007ac10: 6574 7320 7374 6570 0a20 2020 2020 2020 ets step. │ │ │ -0007ac20: 6973 2023 534f 4c56 4550 4e50 5f45 504e is #SOLVEPNP_EPN │ │ │ -0007ac30: 502e 2045 7863 6570 7469 6f6e 7320 6172 P. Exceptions ar │ │ │ -0007ac40: 653a 0a20 203c 756c 3e0a 2020 2020 3c6c e:.
        . . if │ │ │ -0007ac60: 796f 7520 6368 6f6f 7365 2023 534f 4c56 you choose #SOLV │ │ │ -0007ac70: 4550 4e50 5f50 3350 206f 7220 2353 4f4c EPNP_P3P or #SOL │ │ │ -0007ac80: 5645 504e 505f 4150 3350 2c20 7468 6573 VEPNP_AP3P, thes │ │ │ -0007ac90: 6520 6d65 7468 6f64 7320 7769 6c6c 2062 e methods will b │ │ │ -0007aca0: 6520 7573 6564 2e0a 2020 2020 3c2f 6c69 e used.. .
      • . │ │ │ -0007acc0: 2020 2020 2069 6620 7468 6520 6e75 6d62 if the numb │ │ │ -0007acd0: 6572 206f 6620 696e 7075 7420 706f 696e er of input poin │ │ │ -0007ace0: 7473 2069 7320 6571 7561 6c20 746f 2034 ts is equal to 4 │ │ │ -0007acf0: 2c20 2353 4f4c 5645 504e 505f 5033 5020 , #SOLVEPNP_P3P │ │ │ -0007ad00: 6973 2075 7365 642e 0a20 2020 203c 2f6c is used.. .
      .
    • . The meth │ │ │ -0007ad30: 6f64 2075 7365 6420 746f 2065 7374 696d od used to estim │ │ │ -0007ad40: 6174 6520 7468 6520 6361 6d65 7261 2070 ate the camera p │ │ │ -0007ad50: 6f73 6520 7573 696e 6720 616c 6c20 7468 ose using all th │ │ │ -0007ad60: 6520 696e 6c69 6572 7320 6973 2064 6566 e inliers is def │ │ │ -0007ad70: 696e 6564 2062 7920 7468 650a 2020 2020 ined by the. │ │ │ -0007ad80: 2020 2066 6c61 6773 2070 6172 616d 6574 flags paramet │ │ │ -0007ad90: 6572 7320 756e 6c65 7373 2069 7420 6973 ers unless it is │ │ │ -0007ada0: 2065 7175 616c 2074 6f20 2353 4f4c 5645 equal to #SOLVE │ │ │ -0007adb0: 504e 505f 5033 5020 6f72 2023 534f 4c56 PNP_P3P or #SOLV │ │ │ -0007adc0: 4550 4e50 5f41 5033 502e 2049 6e20 7468 EPNP_AP3P. In th │ │ │ -0007add0: 6973 2063 6173 652c 0a20 2020 2020 2020 is case,. │ │ │ -0007ade0: 7468 6520 6d65 7468 6f64 2023 534f 4c56 the method #SOLV │ │ │ -0007adf0: 4550 4e50 5f45 504e 5020 7769 6c6c 2062 EPNP_EPNP will b │ │ │ -0007ae00: 6520 7573 6564 2069 6e73 7465 6164 2e0a e used instead.. │ │ │ -0007ae10: 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64
    • .
    .
    Returns:< │ │ │ -0007ae30: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
    automat │ │ │ -0007ae40: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ -0007ae50: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    ...
  • ..
  • . │ │ │ -0007af40: 0a3c 6833 3e73 6f6c 7665 506e 5052 616e .

    solvePnPRan │ │ │ -0007af50: 7361 633c 2f68 333e 0a3c 6469 7620 636c sac

    .
    .
    p │ │ │ -0007afb0: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static boolean solvePnPRansac │ │ │ -0007b020: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (MatOf │ │ │ -0007b090: 506f 696e 7433 663c 2f61 3e26 6e62 7370 Point3f  │ │ │ -0007b0a0: 3b6f 626a 6563 7450 6f69 6e74 732c 0a20 ;objectPoints,. │ │ │ -0007b0b0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfPoint2 │ │ │ -0007b100: 663c 2f61 3e26 6e62 7370 3b69 6d61 6765 f image │ │ │ -0007b110: 506f 696e 7473 2c0a 203c 6120 6872 6566 Points,. Mat&nbs │ │ │ -0007b160: 703b 6361 6d65 7261 4d61 7472 6978 2c0a p;cameraMatrix,. │ │ │ -0007b170: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 MatOfDouble │ │ │ -0007b1c0: 3c2f 613e 266e 6273 703b 6469 7374 436f  distCo │ │ │ -0007b1d0: 6566 6673 2c0a 203c 6120 6872 6566 3d22 effs,. Mat  │ │ │ -0007b220: 7276 6563 2c0a 203c 6120 6872 6566 3d22 rvec,. Mat  │ │ │ -0007b270: 7476 6563 2c0a 2062 6f6f 6c65 616e 266e tvec,. boolean&n │ │ │ -0007b280: 6273 703b 7573 6545 7874 7269 6e73 6963 bsp;useExtrinsic │ │ │ -0007b290: 4775 6573 7329 3c2f 7370 616e 3e3c 2f64 Guess).
    Finds an │ │ │ -0007b2c0: 6f62 6a65 6374 2070 6f73 6520 5c28 207b object pose \( { │ │ │ -0007b2d0: 7d5e 7b63 7d5c 6d61 7468 6266 7b54 7d5f }^{c}\mathbf{T}_ │ │ │ -0007b2e0: 6f20 5c29 2066 726f 6d20 3344 2d32 4420 o \) from 3D-2D │ │ │ -0007b2f0: 706f 696e 7420 636f 7272 6573 706f 6e64 point correspond │ │ │ -0007b300: 656e 6365 7320 7573 696e 6720 7468 6520 ences using the │ │ │ -0007b310: 5241 4e53 4143 2073 6368 656d 6520 746f RANSAC scheme to │ │ │ -0007b320: 2064 6561 6c20 7769 7468 2062 6164 206d deal with bad m │ │ │ -0007b330: 6174 6368 6573 2e0a 0a21 5b50 6572 7370 atches...![Persp │ │ │ -0007b340: 6563 7469 7665 2070 726f 6a65 6374 696f ective projectio │ │ │ -0007b350: 6e2c 2066 726f 6d20 6f62 6a65 6374 2074 n, from object t │ │ │ -0007b360: 6f20 6361 6d65 7261 2066 7261 6d65 5d28 o camera frame]( │ │ │ -0007b370: 7069 6373 2f70 696e 686f 6c65 5f68 6f6d pics/pinhole_hom │ │ │ -0007b380: 6f67 656e 656f 7573 5f74 7261 6e73 666f ogeneous_transfo │ │ │ -0007b390: 726d 6174 696f 6e2e 6a70 6729 7b20 7769 rmation.jpg){ wi │ │ │ -0007b3a0: 6474 683d 3530 2520 7d0a 0a53 4545 3a20 dth=50% }..SEE: │ │ │ -0007b3b0: 5245 463a 2063 616c 6962 3364 5f73 6f6c REF: calib3d_sol │ │ │ -0007b3c0: 7665 506e 503c 2f64 6976 3e0a 3c64 6c20 vePnP
    .
    .< │ │ │ -0007b3e0: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    ob │ │ │ -0007b400: 6a65 6374 506f 696e 7473 3c2f 636f 6465 jectPoints - Array of obj │ │ │ -0007b420: 6563 7420 706f 696e 7473 2069 6e20 7468 ect points in th │ │ │ -0007b430: 6520 6f62 6a65 6374 2063 6f6f 7264 696e e object coordin │ │ │ -0007b440: 6174 6520 7370 6163 652c 204e 7833 2031 ate space, Nx3 1 │ │ │ -0007b450: 2d63 6861 6e6e 656c 206f 720a 3178 4e2f -channel or.1xN/ │ │ │ -0007b460: 4e78 3120 332d 6368 616e 6e65 6c2c 2077 Nx1 3-channel, w │ │ │ -0007b470: 6865 7265 204e 2069 7320 7468 6520 6e75 here N is the nu │ │ │ -0007b480: 6d62 6572 206f 6620 706f 696e 7473 2e20 mber of points. │ │ │ -0007b490: 7665 6374 6f72 266c 743b 506f 696e 7433 vector<Point3 │ │ │ -0007b4a0: 6426 6774 3b20 6361 6e20 6265 2061 6c73 d> can be als │ │ │ -0007b4b0: 6f20 7061 7373 6564 2068 6572 652e 3c2f o passed here..
    im │ │ │ -0007b4d0: 6167 6550 6f69 6e74 733c 2f63 6f64 653e agePoints │ │ │ -0007b4e0: 202d 2041 7272 6179 206f 6620 636f 7272 - Array of corr │ │ │ -0007b4f0: 6573 706f 6e64 696e 6720 696d 6167 6520 esponding image │ │ │ -0007b500: 706f 696e 7473 2c20 4e78 3220 312d 6368 points, Nx2 1-ch │ │ │ -0007b510: 616e 6e65 6c20 6f72 2031 784e 2f4e 7831 annel or 1xN/Nx1 │ │ │ -0007b520: 2032 2d63 6861 6e6e 656c 2c0a 7768 6572 2-channel,.wher │ │ │ -0007b530: 6520 4e20 6973 2074 6865 206e 756d 6265 e N is the numbe │ │ │ -0007b540: 7220 6f66 2070 6f69 6e74 732e 2076 6563 r of points. vec │ │ │ -0007b550: 746f 7226 6c74 3b50 6f69 6e74 3264 2667 tor<Point2d&g │ │ │ -0007b560: 743b 2063 616e 2062 6520 616c 736f 2070 t; can be also p │ │ │ -0007b570: 6173 7365 6420 6865 7265 2e3c 2f64 643e assed here.
    │ │ │ -0007b580: 0a3c 6464 3e3c 636f 6465 3e63 616d 6572 .
    camer │ │ │ -0007b590: 614d 6174 7269 783c 2f63 6f64 653e 202d aMatrix - │ │ │ -0007b5a0: 2049 6e70 7574 2063 616d 6572 6120 696e Input camera in │ │ │ -0007b5b0: 7472 696e 7369 6320 6d61 7472 6978 205c trinsic matrix \ │ │ │ -0007b5c0: 285c 6361 6d65 7261 6d61 7472 6978 7b41 (\cameramatrix{A │ │ │ -0007b5d0: 7d5c 2920 2e3c 2f64 643e 0a3c 6464 3e3c }\) .
    .
    < │ │ │ -0007b5e0: 636f 6465 3e64 6973 7443 6f65 6666 733c code>distCoeffs< │ │ │ -0007b5f0: 2f63 6f64 653e 202d 2049 6e70 7574 2076 /code> - Input v │ │ │ -0007b600: 6563 746f 7220 6f66 2064 6973 746f 7274 ector of distort │ │ │ -0007b610: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ -0007b620: 0a5c 285c 6469 7374 636f 6566 6673 5c29 .\(\distcoeffs\) │ │ │ -0007b630: 2e20 4966 2074 6865 2076 6563 746f 7220 . If the vector │ │ │ -0007b640: 6973 204e 554c 4c2f 656d 7074 792c 2074 is NULL/empty, t │ │ │ -0007b650: 6865 207a 6572 6f20 6469 7374 6f72 7469 he zero distorti │ │ │ -0007b660: 6f6e 2063 6f65 6666 6963 6965 6e74 7320 on coefficients │ │ │ -0007b670: 6172 650a 6173 7375 6d65 642e 3c2f 6464 are.assumed.
    .
    rvec │ │ │ -0007b690: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ -0007b6a0: 2072 6f74 6174 696f 6e20 7665 6374 6f72 rotation vector │ │ │ -0007b6b0: 2028 7365 6520 5245 463a 2052 6f64 7269 (see REF: Rodri │ │ │ -0007b6c0: 6775 6573 2029 2074 6861 742c 2074 6f67 gues ) that, tog │ │ │ -0007b6d0: 6574 6865 7220 7769 7468 2074 7665 632c ether with tvec, │ │ │ -0007b6e0: 2062 7269 6e67 7320 706f 696e 7473 2066 brings points f │ │ │ -0007b6f0: 726f 6d0a 7468 6520 6d6f 6465 6c20 636f rom.the model co │ │ │ -0007b700: 6f72 6469 6e61 7465 2073 7973 7465 6d20 ordinate system │ │ │ -0007b710: 746f 2074 6865 2063 616d 6572 6120 636f to the camera co │ │ │ -0007b720: 6f72 6469 6e61 7465 2073 7973 7465 6d2e ordinate system. │ │ │ -0007b730: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -0007b740: 7476 6563 3c2f 636f 6465 3e20 2d20 4f75 tvec - Ou │ │ │ -0007b750: 7470 7574 2074 7261 6e73 6c61 7469 6f6e tput translation │ │ │ -0007b760: 2076 6563 746f 722e 3c2f 6464 3e0a 3c64 vector.
    .useExtri │ │ │ -0007b780: 6e73 6963 4775 6573 733c 2f63 6f64 653e nsicGuess │ │ │ -0007b790: 202d 2050 6172 616d 6574 6572 2075 7365 - Parameter use │ │ │ -0007b7a0: 6420 666f 7220 5245 463a 2053 4f4c 5645 d for REF: SOLVE │ │ │ -0007b7b0: 504e 505f 4954 4552 4154 4956 452e 2049 PNP_ITERATIVE. I │ │ │ -0007b7c0: 6620 7472 7565 2028 3129 2c20 7468 6520 f true (1), the │ │ │ -0007b7d0: 6675 6e63 7469 6f6e 2075 7365 730a 7468 function uses.th │ │ │ -0007b7e0: 6520 7072 6f76 6964 6564 2072 7665 6320 e provided rvec │ │ │ -0007b7f0: 616e 6420 7476 6563 2076 616c 7565 7320 and tvec values │ │ │ -0007b800: 6173 2069 6e69 7469 616c 2061 7070 726f as initial appro │ │ │ -0007b810: 7869 6d61 7469 6f6e 7320 6f66 2074 6865 ximations of the │ │ │ -0007b820: 2072 6f74 6174 696f 6e20 616e 6420 7472 rotation and tr │ │ │ -0007b830: 616e 736c 6174 696f 6e0a 7665 6374 6f72 anslation.vector │ │ │ -0007b840: 732c 2072 6573 7065 6374 6976 656c 792c s, respectively, │ │ │ -0007b850: 2061 6e64 2066 7572 7468 6572 206f 7074 and further opt │ │ │ -0007b860: 696d 697a 6573 2074 6865 6d2e 0a69 7320 imizes them..is │ │ │ -0007b870: 7468 6520 6d61 7869 6d75 6d20 616c 6c6f the maximum allo │ │ │ -0007b880: 7765 6420 6469 7374 616e 6365 2062 6574 wed distance bet │ │ │ -0007b890: 7765 656e 2074 6865 206f 6273 6572 7665 ween the observe │ │ │ -0007b8a0: 6420 616e 6420 636f 6d70 7574 6564 2070 d and computed p │ │ │ -0007b8b0: 6f69 6e74 2070 726f 6a65 6374 696f 6e73 oint projections │ │ │ -0007b8c0: 2074 6f20 636f 6e73 6964 6572 2069 740a to consider it. │ │ │ -0007b8d0: 616e 2069 6e6c 6965 722e 0a0a 5468 6520 an inlier...The │ │ │ -0007b8e0: 6675 6e63 7469 6f6e 2065 7374 696d 6174 function estimat │ │ │ -0007b8f0: 6573 2061 6e20 6f62 6a65 6374 2070 6f73 es an object pos │ │ │ -0007b900: 6520 6769 7665 6e20 6120 7365 7420 6f66 e given a set of │ │ │ -0007b910: 206f 626a 6563 7420 706f 696e 7473 2c20 object points, │ │ │ -0007b920: 7468 6569 7220 636f 7272 6573 706f 6e64 their correspond │ │ │ -0007b930: 696e 6720 696d 6167 650a 7072 6f6a 6563 ing image.projec │ │ │ -0007b940: 7469 6f6e 732c 2061 7320 7765 6c6c 2061 tions, as well a │ │ │ -0007b950: 7320 7468 6520 6361 6d65 7261 2069 6e74 s the camera int │ │ │ -0007b960: 7269 6e73 6963 206d 6174 7269 7820 616e rinsic matrix an │ │ │ -0007b970: 6420 7468 6520 6469 7374 6f72 7469 6f6e d the distortion │ │ │ -0007b980: 2063 6f65 6666 6963 6965 6e74 732e 2054 coefficients. T │ │ │ -0007b990: 6869 7320 6675 6e63 7469 6f6e 2066 696e his function fin │ │ │ -0007b9a0: 6473 2073 7563 680a 6120 706f 7365 2074 ds such.a pose t │ │ │ -0007b9b0: 6861 7420 6d69 6e69 6d69 7a65 7320 7265 hat minimizes re │ │ │ -0007b9c0: 7072 6f6a 6563 7469 6f6e 2065 7272 6f72 projection error │ │ │ -0007b9d0: 2c20 7468 6174 2069 732c 2074 6865 2073 , that is, the s │ │ │ -0007b9e0: 756d 206f 6620 7371 7561 7265 6420 6469 um of squared di │ │ │ -0007b9f0: 7374 616e 6365 7320 6265 7477 6565 6e20 stances between │ │ │ -0007ba00: 7468 6520 6f62 7365 7276 6564 0a70 726f the observed.pro │ │ │ -0007ba10: 6a65 6374 696f 6e73 2069 6d61 6765 506f jections imagePo │ │ │ -0007ba20: 696e 7473 2061 6e64 2074 6865 2070 726f ints and the pro │ │ │ -0007ba30: 6a65 6374 6564 2028 7573 696e 6720 5245 jected (using RE │ │ │ -0007ba40: 463a 2070 726f 6a65 6374 506f 696e 7473 F: projectPoints │ │ │ -0007ba50: 2029 206f 626a 6563 7450 6f69 6e74 732e ) objectPoints. │ │ │ -0007ba60: 2054 6865 2075 7365 206f 6620 5241 4e53 The use of RANS │ │ │ -0007ba70: 4143 0a6d 616b 6573 2074 6865 2066 756e AC.makes the fun │ │ │ -0007ba80: 6374 696f 6e20 7265 7369 7374 616e 7420 ction resistant │ │ │ -0007ba90: 746f 206f 7574 6c69 6572 732e 0a0a 3c62 to outliers...Note:.
      . │ │ │ -0007bab0: 2020 3c6c 693e 0a20 2020 2020 2041 6e20
    • . An │ │ │ -0007bac0: 6578 616d 706c 6520 6f66 2068 6f77 2074 example of how t │ │ │ -0007bad0: 6f20 7573 6520 736f 6c76 6550 6e50 5261 o use solvePnPRa │ │ │ -0007bae0: 6e73 6163 2066 6f72 206f 626a 6563 7420 nsac for object │ │ │ -0007baf0: 6465 7465 6374 696f 6e20 6361 6e20 6265 detection can be │ │ │ -0007bb00: 2066 6f75 6e64 2061 740a 2020 2020 2020 found at. │ │ │ -0007bb10: 2020 5245 463a 2074 7574 6f72 6961 6c5f REF: tutorial_ │ │ │ -0007bb20: 7265 616c 5f74 696d 655f 706f 7365 0a20 real_time_pose. │ │ │ -0007bb30: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020
    • .
    • . │ │ │ -0007bb40: 2020 2020 5468 6520 6465 6661 756c 7420 The default │ │ │ -0007bb50: 6d65 7468 6f64 2075 7365 6420 746f 2065 method used to e │ │ │ -0007bb60: 7374 696d 6174 6520 7468 6520 6361 6d65 stimate the came │ │ │ -0007bb70: 7261 2070 6f73 6520 666f 7220 7468 6520 ra pose for the │ │ │ -0007bb80: 4d69 6e69 6d61 6c20 5361 6d70 6c65 2053 Minimal Sample S │ │ │ -0007bb90: 6574 7320 7374 6570 0a20 2020 2020 2020 ets step. │ │ │ -0007bba0: 6973 2023 534f 4c56 4550 4e50 5f45 504e is #SOLVEPNP_EPN │ │ │ -0007bbb0: 502e 2045 7863 6570 7469 6f6e 7320 6172 P. Exceptions ar │ │ │ -0007bbc0: 653a 0a20 203c 756c 3e0a 2020 2020 3c6c e:.
        . . if │ │ │ -0007bbe0: 796f 7520 6368 6f6f 7365 2023 534f 4c56 you choose #SOLV │ │ │ -0007bbf0: 4550 4e50 5f50 3350 206f 7220 2353 4f4c EPNP_P3P or #SOL │ │ │ -0007bc00: 5645 504e 505f 4150 3350 2c20 7468 6573 VEPNP_AP3P, thes │ │ │ -0007bc10: 6520 6d65 7468 6f64 7320 7769 6c6c 2062 e methods will b │ │ │ -0007bc20: 6520 7573 6564 2e0a 2020 2020 3c2f 6c69 e used.. .
      • . │ │ │ -0007bc40: 2020 2020 2069 6620 7468 6520 6e75 6d62 if the numb │ │ │ -0007bc50: 6572 206f 6620 696e 7075 7420 706f 696e er of input poin │ │ │ -0007bc60: 7473 2069 7320 6571 7561 6c20 746f 2034 ts is equal to 4 │ │ │ -0007bc70: 2c20 2353 4f4c 5645 504e 505f 5033 5020 , #SOLVEPNP_P3P │ │ │ -0007bc80: 6973 2075 7365 642e 0a20 2020 203c 2f6c is used.. .
      .
    • . The meth │ │ │ -0007bcb0: 6f64 2075 7365 6420 746f 2065 7374 696d od used to estim │ │ │ -0007bcc0: 6174 6520 7468 6520 6361 6d65 7261 2070 ate the camera p │ │ │ -0007bcd0: 6f73 6520 7573 696e 6720 616c 6c20 7468 ose using all th │ │ │ -0007bce0: 6520 696e 6c69 6572 7320 6973 2064 6566 e inliers is def │ │ │ -0007bcf0: 696e 6564 2062 7920 7468 650a 2020 2020 ined by the. │ │ │ -0007bd00: 2020 2066 6c61 6773 2070 6172 616d 6574 flags paramet │ │ │ -0007bd10: 6572 7320 756e 6c65 7373 2069 7420 6973 ers unless it is │ │ │ -0007bd20: 2065 7175 616c 2074 6f20 2353 4f4c 5645 equal to #SOLVE │ │ │ -0007bd30: 504e 505f 5033 5020 6f72 2023 534f 4c56 PNP_P3P or #SOLV │ │ │ -0007bd40: 4550 4e50 5f41 5033 502e 2049 6e20 7468 EPNP_AP3P. In th │ │ │ -0007bd50: 6973 2063 6173 652c 0a20 2020 2020 2020 is case,. │ │ │ -0007bd60: 7468 6520 6d65 7468 6f64 2023 534f 4c56 the method #SOLV │ │ │ -0007bd70: 4550 4e50 5f45 504e 5020 7769 6c6c 2062 EPNP_EPNP will b │ │ │ -0007bd80: 6520 7573 6564 2069 6e73 7465 6164 2e0a e used instead.. │ │ │ -0007bd90: 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64
    • .
    .
    Returns:< │ │ │ -0007bdb0: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
    automat │ │ │ -0007bdc0: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ -0007bdd0: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ....
  • ..

    sol │ │ │ -0007bec0: 7665 506e 5052 616e 7361 633c 2f68 333e vePnPRansac

    │ │ │ -0007bed0: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ -0007bef0: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ -0007bf10: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ -0007bf20: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ -0007bf30: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ -0007bf40: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;boole │ │ │ -0007bf60: 616e 3c2f 7370 616e 3e26 6e62 7370 3b3c an < │ │ │ -0007bf70: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ -0007bf80: 656e 742d 6e61 6d65 223e 736f 6c76 6550 ent-name">solveP │ │ │ -0007bf90: 6e50 5261 6e73 6163 3c2f 7370 616e 3e3c nPRansac< │ │ │ -0007bfa0: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(MatOfPoint3f< │ │ │ -0007c010: 2f61 3e26 6e62 7370 3b6f 626a 6563 7450 /a> objectP │ │ │ -0007c020: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat │ │ │ -0007c070: 4f66 506f 696e 7432 663c 2f61 3e26 6e62 OfPoint2f&nb │ │ │ -0007c080: 7370 3b69 6d61 6765 506f 696e 7473 2c0a sp;imagePoints,. │ │ │ -0007c090: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0007c0d0: 3c2f 613e 266e 6273 703b 6361 6d65 7261  camera │ │ │ -0007c0e0: 4d61 7472 6978 2c0a 203c 6120 6872 6566 Matrix,. Mat │ │ │ -0007c130: 4f66 446f 7562 6c65 3c2f 613e 266e 6273 OfDouble&nbs │ │ │ -0007c140: 703b 6469 7374 436f 6566 6673 2c0a 203c p;distCoeffs,. < │ │ │ -0007c150: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0007c160: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0007c170: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0007c180: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat rvec,. < │ │ │ -0007c1a0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0007c1b0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0007c1c0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0007c1d0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat tvec)
    .
    Fi │ │ │ -0007c210: 6e64 7320 616e 206f 626a 6563 7420 706f nds an object po │ │ │ -0007c220: 7365 205c 2820 7b7d 5e7b 637d 5c6d 6174 se \( {}^{c}\mat │ │ │ -0007c230: 6862 667b 547d 5f6f 205c 2920 6672 6f6d hbf{T}_o \) from │ │ │ -0007c240: 2033 442d 3244 2070 6f69 6e74 2063 6f72 3D-2D point cor │ │ │ -0007c250: 7265 7370 6f6e 6465 6e63 6573 2075 7369 respondences usi │ │ │ -0007c260: 6e67 2074 6865 2052 414e 5341 4320 7363 ng the RANSAC sc │ │ │ -0007c270: 6865 6d65 2074 6f20 6465 616c 2077 6974 heme to deal wit │ │ │ -0007c280: 6820 6261 6420 6d61 7463 6865 732e 0a0a h bad matches... │ │ │ -0007c290: 215b 5065 7273 7065 6374 6976 6520 7072 ![Perspective pr │ │ │ -0007c2a0: 6f6a 6563 7469 6f6e 2c20 6672 6f6d 206f ojection, from o │ │ │ -0007c2b0: 626a 6563 7420 746f 2063 616d 6572 6120 bject to camera │ │ │ -0007c2c0: 6672 616d 655d 2870 6963 732f 7069 6e68 frame](pics/pinh │ │ │ -0007c2d0: 6f6c 655f 686f 6d6f 6765 6e65 6f75 735f ole_homogeneous_ │ │ │ -0007c2e0: 7472 616e 7366 6f72 6d61 7469 6f6e 2e6a transformation.j │ │ │ -0007c2f0: 7067 297b 2077 6964 7468 3d35 3025 207d pg){ width=50% } │ │ │ -0007c300: 0a0a 5345 453a 2052 4546 3a20 6361 6c69 ..SEE: REF: cali │ │ │ -0007c310: 6233 645f 736f 6c76 6550 6e50 3c2f 6469 b3d_solvePnP.
    .
    Parame │ │ │ -0007c340: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ -0007c350: 636f 6465 3e6f 626a 6563 7450 6f69 6e74 code>objectPoint │ │ │ -0007c360: 733c 2f63 6f64 653e 202d 2041 7272 6179 s - Array │ │ │ -0007c370: 206f 6620 6f62 6a65 6374 2070 6f69 6e74 of object point │ │ │ -0007c380: 7320 696e 2074 6865 206f 626a 6563 7420 s in the object │ │ │ -0007c390: 636f 6f72 6469 6e61 7465 2073 7061 6365 coordinate space │ │ │ -0007c3a0: 2c20 4e78 3320 312d 6368 616e 6e65 6c20 , Nx3 1-channel │ │ │ -0007c3b0: 6f72 0a31 784e 2f4e 7831 2033 2d63 6861 or.1xN/Nx1 3-cha │ │ │ -0007c3c0: 6e6e 656c 2c20 7768 6572 6520 4e20 6973 nnel, where N is │ │ │ -0007c3d0: 2074 6865 206e 756d 6265 7220 6f66 2070 the number of p │ │ │ -0007c3e0: 6f69 6e74 732e 2076 6563 746f 7226 6c74 oints. vector< │ │ │ -0007c3f0: 3b50 6f69 6e74 3364 2667 743b 2063 616e ;Point3d> can │ │ │ -0007c400: 2062 6520 616c 736f 2070 6173 7365 6420 be also passed │ │ │ -0007c410: 6865 7265 2e3c 2f64 643e 0a3c 6464 3e3c here.
    .
    < │ │ │ -0007c420: 636f 6465 3e69 6d61 6765 506f 696e 7473 code>imagePoints │ │ │ -0007c430: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ -0007c440: 6f66 2063 6f72 7265 7370 6f6e 6469 6e67 of corresponding │ │ │ -0007c450: 2069 6d61 6765 2070 6f69 6e74 732c 204e image points, N │ │ │ -0007c460: 7832 2031 2d63 6861 6e6e 656c 206f 7220 x2 1-channel or │ │ │ -0007c470: 3178 4e2f 4e78 3120 322d 6368 616e 6e65 1xN/Nx1 2-channe │ │ │ -0007c480: 6c2c 0a77 6865 7265 204e 2069 7320 7468 l,.where N is th │ │ │ -0007c490: 6520 6e75 6d62 6572 206f 6620 706f 696e e number of poin │ │ │ -0007c4a0: 7473 2e20 7665 6374 6f72 266c 743b 506f ts. vector<Po │ │ │ -0007c4b0: 696e 7432 6426 6774 3b20 6361 6e20 6265 int2d> can be │ │ │ -0007c4c0: 2061 6c73 6f20 7061 7373 6564 2068 6572 also passed her │ │ │ -0007c4d0: 652e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 e.
    .
    cameraMatrix - Input ca │ │ │ -0007c500: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -0007c510: 6174 7269 7820 5c28 5c63 616d 6572 616d atrix \(\cameram │ │ │ -0007c520: 6174 7269 787b 417d 5c29 202e 3c2f 6464 atrix{A}\) .
    .
    dist │ │ │ -0007c540: 436f 6566 6673 3c2f 636f 6465 3e20 2d20 Coeffs - │ │ │ -0007c550: 496e 7075 7420 7665 6374 6f72 206f 6620 Input vector of │ │ │ -0007c560: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ -0007c570: 6963 6965 6e74 730a 5c28 5c64 6973 7463 icients.\(\distc │ │ │ -0007c580: 6f65 6666 735c 292e 2049 6620 7468 6520 oeffs\). If the │ │ │ -0007c590: 7665 6374 6f72 2069 7320 4e55 4c4c 2f65 vector is NULL/e │ │ │ -0007c5a0: 6d70 7479 2c20 7468 6520 7a65 726f 2064 mpty, the zero d │ │ │ -0007c5b0: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ -0007c5c0: 6369 656e 7473 2061 7265 0a61 7373 756d cients are.assum │ │ │ -0007c5d0: 6564 2e3c 2f64 643e 0a3c 6464 3e3c 636f ed.
    .
    rvec - │ │ │ -0007c5f0: 204f 7574 7075 7420 726f 7461 7469 6f6e Output rotation │ │ │ -0007c600: 2076 6563 746f 7220 2873 6565 2052 4546 vector (see REF │ │ │ -0007c610: 3a20 526f 6472 6967 7565 7320 2920 7468 : Rodrigues ) th │ │ │ -0007c620: 6174 2c20 746f 6765 7468 6572 2077 6974 at, together wit │ │ │ -0007c630: 6820 7476 6563 2c20 6272 696e 6773 2070 h tvec, brings p │ │ │ -0007c640: 6f69 6e74 7320 6672 6f6d 0a74 6865 206d oints from.the m │ │ │ -0007c650: 6f64 656c 2063 6f6f 7264 696e 6174 6520 odel coordinate │ │ │ -0007c660: 7379 7374 656d 2074 6f20 7468 6520 6361 system to the ca │ │ │ -0007c670: 6d65 7261 2063 6f6f 7264 696e 6174 6520 mera coordinate │ │ │ -0007c680: 7379 7374 656d 2e3c 2f64 643e 0a3c 6464 system.
    .
    tvec - Output tran │ │ │ -0007c6b0: 736c 6174 696f 6e20 7665 6374 6f72 2e0a slation vector.. │ │ │ -0007c6c0: 7468 6520 7072 6f76 6964 6564 2072 7665 the provided rve │ │ │ -0007c6d0: 6320 616e 6420 7476 6563 2076 616c 7565 c and tvec value │ │ │ -0007c6e0: 7320 6173 2069 6e69 7469 616c 2061 7070 s as initial app │ │ │ -0007c6f0: 726f 7869 6d61 7469 6f6e 7320 6f66 2074 roximations of t │ │ │ -0007c700: 6865 2072 6f74 6174 696f 6e20 616e 6420 he rotation and │ │ │ -0007c710: 7472 616e 736c 6174 696f 6e0a 7665 6374 translation.vect │ │ │ -0007c720: 6f72 732c 2072 6573 7065 6374 6976 656c ors, respectivel │ │ │ -0007c730: 792c 2061 6e64 2066 7572 7468 6572 206f y, and further o │ │ │ -0007c740: 7074 696d 697a 6573 2074 6865 6d2e 0a69 ptimizes them..i │ │ │ -0007c750: 7320 7468 6520 6d61 7869 6d75 6d20 616c s the maximum al │ │ │ -0007c760: 6c6f 7765 6420 6469 7374 616e 6365 2062 lowed distance b │ │ │ -0007c770: 6574 7765 656e 2074 6865 206f 6273 6572 etween the obser │ │ │ -0007c780: 7665 6420 616e 6420 636f 6d70 7574 6564 ved and computed │ │ │ -0007c790: 2070 6f69 6e74 2070 726f 6a65 6374 696f point projectio │ │ │ -0007c7a0: 6e73 2074 6f20 636f 6e73 6964 6572 2069 ns to consider i │ │ │ -0007c7b0: 740a 616e 2069 6e6c 6965 722e 0a0a 5468 t.an inlier...Th │ │ │ -0007c7c0: 6520 6675 6e63 7469 6f6e 2065 7374 696d e function estim │ │ │ -0007c7d0: 6174 6573 2061 6e20 6f62 6a65 6374 2070 ates an object p │ │ │ -0007c7e0: 6f73 6520 6769 7665 6e20 6120 7365 7420 ose given a set │ │ │ -0007c7f0: 6f66 206f 626a 6563 7420 706f 696e 7473 of object points │ │ │ -0007c800: 2c20 7468 6569 7220 636f 7272 6573 706f , their correspo │ │ │ -0007c810: 6e64 696e 6720 696d 6167 650a 7072 6f6a nding image.proj │ │ │ -0007c820: 6563 7469 6f6e 732c 2061 7320 7765 6c6c ections, as well │ │ │ -0007c830: 2061 7320 7468 6520 6361 6d65 7261 2069 as the camera i │ │ │ -0007c840: 6e74 7269 6e73 6963 206d 6174 7269 7820 ntrinsic matrix │ │ │ -0007c850: 616e 6420 7468 6520 6469 7374 6f72 7469 and the distorti │ │ │ -0007c860: 6f6e 2063 6f65 6666 6963 6965 6e74 732e on coefficients. │ │ │ -0007c870: 2054 6869 7320 6675 6e63 7469 6f6e 2066 This function f │ │ │ -0007c880: 696e 6473 2073 7563 680a 6120 706f 7365 inds such.a pose │ │ │ -0007c890: 2074 6861 7420 6d69 6e69 6d69 7a65 7320 that minimizes │ │ │ -0007c8a0: 7265 7072 6f6a 6563 7469 6f6e 2065 7272 reprojection err │ │ │ -0007c8b0: 6f72 2c20 7468 6174 2069 732c 2074 6865 or, that is, the │ │ │ -0007c8c0: 2073 756d 206f 6620 7371 7561 7265 6420 sum of squared │ │ │ -0007c8d0: 6469 7374 616e 6365 7320 6265 7477 6565 distances betwee │ │ │ -0007c8e0: 6e20 7468 6520 6f62 7365 7276 6564 0a70 n the observed.p │ │ │ -0007c8f0: 726f 6a65 6374 696f 6e73 2069 6d61 6765 rojections image │ │ │ -0007c900: 506f 696e 7473 2061 6e64 2074 6865 2070 Points and the p │ │ │ -0007c910: 726f 6a65 6374 6564 2028 7573 696e 6720 rojected (using │ │ │ -0007c920: 5245 463a 2070 726f 6a65 6374 506f 696e REF: projectPoin │ │ │ -0007c930: 7473 2029 206f 626a 6563 7450 6f69 6e74 ts ) objectPoint │ │ │ -0007c940: 732e 2054 6865 2075 7365 206f 6620 5241 s. The use of RA │ │ │ -0007c950: 4e53 4143 0a6d 616b 6573 2074 6865 2066 NSAC.makes the f │ │ │ -0007c960: 756e 6374 696f 6e20 7265 7369 7374 616e unction resistan │ │ │ -0007c970: 7420 746f 206f 7574 6c69 6572 732e 0a0a t to outliers... │ │ │ -0007c980: 3c62 3e4e 6f74 653a 3c2f 623e 0a3c 756c Note:.
      .
    • . A │ │ │ -0007c9a0: 6e20 6578 616d 706c 6520 6f66 2068 6f77 n example of how │ │ │ -0007c9b0: 2074 6f20 7573 6520 736f 6c76 6550 6e50 to use solvePnP │ │ │ -0007c9c0: 5261 6e73 6163 2066 6f72 206f 626a 6563 Ransac for objec │ │ │ -0007c9d0: 7420 6465 7465 6374 696f 6e20 6361 6e20 t detection can │ │ │ -0007c9e0: 6265 2066 6f75 6e64 2061 740a 2020 2020 be found at. │ │ │ -0007c9f0: 2020 2020 5245 463a 2074 7574 6f72 6961 REF: tutoria │ │ │ -0007ca00: 6c5f 7265 616c 5f74 696d 655f 706f 7365 l_real_time_pose │ │ │ -0007ca10: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ -0007ca20: 2020 2020 2020 5468 6520 6465 6661 756c The defaul │ │ │ -0007ca30: 7420 6d65 7468 6f64 2075 7365 6420 746f t method used to │ │ │ -0007ca40: 2065 7374 696d 6174 6520 7468 6520 6361 estimate the ca │ │ │ -0007ca50: 6d65 7261 2070 6f73 6520 666f 7220 7468 mera pose for th │ │ │ -0007ca60: 6520 4d69 6e69 6d61 6c20 5361 6d70 6c65 e Minimal Sample │ │ │ -0007ca70: 2053 6574 7320 7374 6570 0a20 2020 2020 Sets step. │ │ │ -0007ca80: 2020 6973 2023 534f 4c56 4550 4e50 5f45 is #SOLVEPNP_E │ │ │ -0007ca90: 504e 502e 2045 7863 6570 7469 6f6e 7320 PNP. Exceptions │ │ │ -0007caa0: 6172 653a 0a20 203c 756c 3e0a 2020 2020 are:.
        . │ │ │ -0007cab0: 3c6c 693e 0a20 2020 2020 2020 2020 2069
      • . i │ │ │ -0007cac0: 6620 796f 7520 6368 6f6f 7365 2023 534f f you choose #SO │ │ │ -0007cad0: 4c56 4550 4e50 5f50 3350 206f 7220 2353 LVEPNP_P3P or #S │ │ │ -0007cae0: 4f4c 5645 504e 505f 4150 3350 2c20 7468 OLVEPNP_AP3P, th │ │ │ -0007caf0: 6573 6520 6d65 7468 6f64 7320 7769 6c6c ese methods will │ │ │ -0007cb00: 2062 6520 7573 6564 2e0a 2020 2020 3c2f be used.. .
      • . │ │ │ -0007cb20: 2020 2020 2020 2069 6620 7468 6520 6e75 if the nu │ │ │ -0007cb30: 6d62 6572 206f 6620 696e 7075 7420 706f mber of input po │ │ │ -0007cb40: 696e 7473 2069 7320 6571 7561 6c20 746f ints is equal to │ │ │ -0007cb50: 2034 2c20 2353 4f4c 5645 504e 505f 5033 4, #SOLVEPNP_P3 │ │ │ -0007cb60: 5020 6973 2075 7365 642e 0a20 2020 203c P is used.. < │ │ │ -0007cb70: 2f6c 693e 0a20 203c 2f75 6c3e 0a20 203c /li>.
      . < │ │ │ -0007cb80: 6c69 3e0a 2020 2020 2020 5468 6520 6d65 li>. The me │ │ │ -0007cb90: 7468 6f64 2075 7365 6420 746f 2065 7374 thod used to est │ │ │ -0007cba0: 696d 6174 6520 7468 6520 6361 6d65 7261 imate the camera │ │ │ -0007cbb0: 2070 6f73 6520 7573 696e 6720 616c 6c20 pose using all │ │ │ -0007cbc0: 7468 6520 696e 6c69 6572 7320 6973 2064 the inliers is d │ │ │ -0007cbd0: 6566 696e 6564 2062 7920 7468 650a 2020 efined by the. │ │ │ -0007cbe0: 2020 2020 2066 6c61 6773 2070 6172 616d flags param │ │ │ -0007cbf0: 6574 6572 7320 756e 6c65 7373 2069 7420 eters unless it │ │ │ -0007cc00: 6973 2065 7175 616c 2074 6f20 2353 4f4c is equal to #SOL │ │ │ -0007cc10: 5645 504e 505f 5033 5020 6f72 2023 534f VEPNP_P3P or #SO │ │ │ -0007cc20: 4c56 4550 4e50 5f41 5033 502e 2049 6e20 LVEPNP_AP3P. In │ │ │ -0007cc30: 7468 6973 2063 6173 652c 0a20 2020 2020 this case,. │ │ │ -0007cc40: 2020 7468 6520 6d65 7468 6f64 2023 534f the method #SO │ │ │ -0007cc50: 4c56 4550 4e50 5f45 504e 5020 7769 6c6c LVEPNP_EPNP will │ │ │ -0007cc60: 2062 6520 7573 6564 2069 6e73 7465 6164 be used instead │ │ │ -0007cc70: 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c ..
    • .
    < │ │ │ -0007cc80: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ -0007cc90: 3a3c 2f64 743e 0a3c 6464 3e61 7574 6f6d :
    .
    autom │ │ │ -0007cca0: 6174 6963 616c 6c79 2067 656e 6572 6174 atically generat │ │ │ -0007ccb0: 6564 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f ed
    .
    ... │ │ │ -0007ccd0: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..solvePnPRansac │ │ │ -0007cde0: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373 .
    .
    publ │ │ │ -0007ce40: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -0007ce50: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -0007ce70: 626f 6f6c 6561 6e3c 2f73 7061 6e3e 266e boolean&n │ │ │ -0007ce80: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;s │ │ │ -0007cea0: 6f6c 7665 506e 5052 616e 7361 633c 2f73 olvePnPRansac(MatOfPoi │ │ │ -0007cf20: 6e74 3366 3c2f 613e 266e 6273 703b 6f62 nt3f ob │ │ │ -0007cf30: 6a65 6374 506f 696e 7473 2c0a 203c 6120 jectPoints,. MatOfPoint2f imagePoi │ │ │ -0007cfa0: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. Mat c │ │ │ -0007cff0: 616d 6572 614d 6174 7269 782c 0a20 3c61 ameraMatrix,. MatOfDouble distCoeff │ │ │ -0007d060: 732c 0a20 3c61 2068 7265 663d 222e 2e2f s,. │ │ │ -0007d0a0: 4d61 743c 2f61 3e26 6e62 7370 3b72 7665 Mat rve │ │ │ -0007d0b0: 632c 0a20 3c61 2068 7265 663d 222e 2e2f c,. │ │ │ -0007d0f0: 4d61 743c 2f61 3e26 6e62 7370 3b74 7665 Mat tve │ │ │ -0007d100: 632c 0a20 3c61 2068 7265 663d 222e 2e2f c,. │ │ │ -0007d140: 4d61 743c 2f61 3e26 6e62 7370 3b69 6e6c Mat inl │ │ │ -0007d150: 6965 7273 2c0a 203c 6120 6872 6566 3d22 iers,. UsacParams │ │ │ -0007d1a0: 3c2f 613e 266e 6273 703b 7061 7261 6d73  params │ │ │ -0007d1b0: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ -0007d1c0: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>. │ │ │ -0007d1d0: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • .. │ │ │ -0007d2b0: 3c68 333e 736f 6c76 6550 6e50 5261 6e73

    solvePnPRans │ │ │ -0007d2c0: 6163 3c2f 6833 3e0a 3c64 6976 2063 6c61 ac

    .
    .
    pu │ │ │ -0007d320: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static boolean │ │ │ -0007d360: 266e 6273 703b 3c73 7061 6e20 636c 6173  solvePnPRansac< │ │ │ -0007d390: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(MatOfP │ │ │ -0007d400: 6f69 6e74 3366 3c2f 613e 266e 6273 703b oint3f  │ │ │ -0007d410: 6f62 6a65 6374 506f 696e 7473 2c0a 203c objectPoints,. < │ │ │ -0007d420: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0007d430: 4d61 744f 6650 6f69 6e74 3266 2e68 746d MatOfPoint2f.htm │ │ │ -0007d440: 6c22 2074 6974 6c65 3d22 636c 6173 7320 l" title="class │ │ │ -0007d450: 696e 206f 7267 2e6f 7065 6e63 762e 636f in org.opencv.co │ │ │ -0007d460: 7265 223e 4d61 744f 6650 6f69 6e74 3266 re">MatOfPoint2f │ │ │ -0007d470: 3c2f 613e 266e 6273 703b 696d 6167 6550  imageP │ │ │ -0007d480: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ -0007d4d0: 3b63 616d 6572 614d 6174 7269 782c 0a20 ;cameraMatrix,. │ │ │ -0007d4e0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfDouble< │ │ │ -0007d530: 2f61 3e26 6e62 7370 3b64 6973 7443 6f65 /a> distCoe │ │ │ -0007d540: 6666 732c 0a20 3c61 2068 7265 663d 222e ffs,. Mat r │ │ │ -0007d590: 7665 632c 0a20 3c61 2068 7265 663d 222e vec,. Mat t │ │ │ -0007d5e0: 7665 632c 0a20 3c61 2068 7265 663d 222e vec,. Mat i │ │ │ -0007d630: 6e6c 6965 7273 293c 2f73 7061 6e3e 3c2f nliers).
    ..
  • .
  • .
    .

    │ │ │ -0007d700: 736f 6c76 6550 3350 3c2f 6833 3e0a 3c64 solveP3P

    ..public stati │ │ │ -0007d770: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c int solveP3P │ │ │ -0007d7f0: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ -0007d830: 3c2f 613e 266e 6273 703b 6f62 6a65 6374  object │ │ │ -0007d840: 506f 696e 7473 2c0a 203c 6120 6872 6566 Points,. Mat&nbs │ │ │ -0007d890: 703b 696d 6167 6550 6f69 6e74 732c 0a20 p;imagePoints,. │ │ │ -0007d8a0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0007d8e0: 2f61 3e26 6e62 7370 3b63 616d 6572 614d /a> cameraM │ │ │ -0007d8f0: 6174 7269 782c 0a20 3c61 2068 7265 663d atrix,. Mat  │ │ │ -0007d940: 3b64 6973 7443 6f65 6666 732c 0a20 3c61 ;distCoeffs,. List& │ │ │ -0007d9f0: 6c74 3b3c 6120 6872 6566 3d22 2e2e 2f63 lt;M │ │ │ -0007da30: 6174 3c2f 613e 2667 743b 266e 6273 703b at>  │ │ │ -0007da40: 7276 6563 732c 0a20 3c61 2068 7265 663d rvecs,. List<Mat │ │ │ -0007db30: 2667 743b 266e 6273 703b 7476 6563 732c > tvecs, │ │ │ -0007db40: 0a20 696e 7426 6e62 7370 3b66 6c61 6773 . int flags │ │ │ -0007db50: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c ).< │ │ │ -0007db60: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -0007db70: 223e 4669 6e64 7320 616e 206f 626a 6563 ">Finds an objec │ │ │ -0007db80: 7420 706f 7365 205c 2820 7b7d 5e7b 637d t pose \( {}^{c} │ │ │ -0007db90: 5c6d 6174 6862 667b 547d 5f6f 205c 2920 \mathbf{T}_o \) │ │ │ -0007dba0: 6672 6f6d 203c 623e 333c 2f62 3e20 3344 from 3 3D │ │ │ -0007dbb0: 2d32 4420 706f 696e 7420 636f 7272 6573 -2D point corres │ │ │ -0007dbc0: 706f 6e64 656e 6365 732e 0a0a 215b 5065 pondences...![Pe │ │ │ -0007dbd0: 7273 7065 6374 6976 6520 7072 6f6a 6563 rspective projec │ │ │ -0007dbe0: 7469 6f6e 2c20 6672 6f6d 206f 626a 6563 tion, from objec │ │ │ -0007dbf0: 7420 746f 2063 616d 6572 6120 6672 616d t to camera fram │ │ │ -0007dc00: 655d 2870 6963 732f 7069 6e68 6f6c 655f e](pics/pinhole_ │ │ │ -0007dc10: 686f 6d6f 6765 6e65 6f75 735f 7472 616e homogeneous_tran │ │ │ -0007dc20: 7366 6f72 6d61 7469 6f6e 2e6a 7067 297b sformation.jpg){ │ │ │ -0007dc30: 2077 6964 7468 3d35 3025 207d 0a0a 5345 width=50% }..SE │ │ │ -0007dc40: 453a 2052 4546 3a20 6361 6c69 6233 645f E: REF: calib3d_ │ │ │ -0007dc50: 736f 6c76 6550 6e50 3c2f 6469 763e 0a3c solvePnP.< │ │ │ -0007dc60: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ -0007dc70: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ -0007dc80: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    objectPoints - Array of │ │ │ -0007dcb0: 6f62 6a65 6374 2070 6f69 6e74 7320 696e object points in │ │ │ -0007dcc0: 2074 6865 206f 626a 6563 7420 636f 6f72 the object coor │ │ │ -0007dcd0: 6469 6e61 7465 2073 7061 6365 2c20 3378 dinate space, 3x │ │ │ -0007dce0: 3320 312d 6368 616e 6e65 6c20 6f72 0a31 3 1-channel or.1 │ │ │ -0007dcf0: 7833 2f33 7831 2033 2d63 6861 6e6e 656c x3/3x1 3-channel │ │ │ -0007dd00: 2e20 7665 6374 6f72 266c 743b 506f 696e . vector<Poin │ │ │ -0007dd10: 7433 6626 6774 3b20 6361 6e20 6265 2061 t3f> can be a │ │ │ -0007dd20: 6c73 6f20 7061 7373 6564 2068 6572 652e lso passed here. │ │ │ -0007dd30: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -0007dd40: 696d 6167 6550 6f69 6e74 733c 2f63 6f64 imagePoints - Array of co │ │ │ -0007dd60: 7272 6573 706f 6e64 696e 6720 696d 6167 rresponding imag │ │ │ -0007dd70: 6520 706f 696e 7473 2c20 3378 3220 312d e points, 3x2 1- │ │ │ -0007dd80: 6368 616e 6e65 6c20 6f72 2031 7833 2f33 channel or 1x3/3 │ │ │ -0007dd90: 7831 2032 2d63 6861 6e6e 656c 2e0a 2076 x1 2-channel.. v │ │ │ -0007dda0: 6563 746f 7226 6c74 3b50 6f69 6e74 3266 ector<Point2f │ │ │ -0007ddb0: 2667 743b 2063 616e 2062 6520 616c 736f > can be also │ │ │ -0007ddc0: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    cam │ │ │ -0007dde0: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ -0007ddf0: 202d 2049 6e70 7574 2063 616d 6572 6120 - Input camera │ │ │ -0007de00: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ -0007de10: 205c 285c 6361 6d65 7261 6d61 7472 6978 \(\cameramatrix │ │ │ -0007de20: 7b41 7d5c 2920 2e3c 2f64 643e 0a3c 6464 {A}\) .
    .
    distCoeff │ │ │ -0007de40: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ -0007de50: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ -0007de60: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ -0007de70: 7473 0a5c 285c 6469 7374 636f 6566 6673 ts.\(\distcoeffs │ │ │ -0007de80: 5c29 2e20 4966 2074 6865 2076 6563 746f \). If the vecto │ │ │ -0007de90: 7220 6973 204e 554c 4c2f 656d 7074 792c r is NULL/empty, │ │ │ -0007dea0: 2074 6865 207a 6572 6f20 6469 7374 6f72 the zero distor │ │ │ -0007deb0: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ -0007dec0: 7320 6172 650a 6173 7375 6d65 642e 3c2f s are.assumed..
    rv │ │ │ -0007dee0: 6563 733c 2f63 6f64 653e 202d 204f 7574 ecs - Out │ │ │ -0007def0: 7075 7420 726f 7461 7469 6f6e 2076 6563 put rotation vec │ │ │ -0007df00: 746f 7273 2028 7365 6520 5245 463a 2052 tors (see REF: R │ │ │ -0007df10: 6f64 7269 6775 6573 2029 2074 6861 742c odrigues ) that, │ │ │ -0007df20: 2074 6f67 6574 6865 7220 7769 7468 2074 together with t │ │ │ -0007df30: 7665 6373 2c20 6272 696e 6773 2070 6f69 vecs, brings poi │ │ │ -0007df40: 6e74 7320 6672 6f6d 0a74 6865 206d 6f64 nts from.the mod │ │ │ -0007df50: 656c 2063 6f6f 7264 696e 6174 6520 7379 el coordinate sy │ │ │ -0007df60: 7374 656d 2074 6f20 7468 6520 6361 6d65 stem to the came │ │ │ -0007df70: 7261 2063 6f6f 7264 696e 6174 6520 7379 ra coordinate sy │ │ │ -0007df80: 7374 656d 2e20 4120 5033 5020 7072 6f62 stem. A P3P prob │ │ │ -0007df90: 6c65 6d20 6861 7320 7570 2074 6f20 3420 lem has up to 4 │ │ │ -0007dfa0: 736f 6c75 7469 6f6e 732e 3c2f 6464 3e0a solutions.
    . │ │ │ -0007dfb0: 3c64 643e 3c63 6f64 653e 7476 6563 733c
    tvecs< │ │ │ -0007dfc0: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ -0007dfd0: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ -0007dfe0: 6f72 732e 3c2f 6464 3e0a 3c64 643e 3c63 ors.
    .
    flags │ │ │ -0007e000: 202d 204d 6574 686f 6420 666f 7220 736f - Method for so │ │ │ -0007e010: 6c76 696e 6720 6120 5033 5020 7072 6f62 lving a P3P prob │ │ │ -0007e020: 6c65 6d3a 0a3c 756c 3e0a 2020 3c6c 693e lem:.
      .
    • │ │ │ -0007e030: 0a20 2020 5245 463a 2053 4f4c 5645 504e . REF: SOLVEPN │ │ │ -0007e040: 505f 5033 5020 4d65 7468 6f64 2069 7320 P_P3P Method is │ │ │ -0007e050: 6261 7365 6420 6f6e 2074 6865 2070 6170 based on the pap │ │ │ -0007e060: 6572 206f 6620 4469 6e67 2c20 592e 2c20 er of Ding, Y., │ │ │ -0007e070: 5961 6e67 2c20 4a2e 2c20 4c61 7273 736f Yang, J., Larsso │ │ │ -0007e080: 6e2c 2056 2e2c 204f 6c73 736f 6e2c 2043 n, V., Olsson, C │ │ │ -0007e090: 2e2c 2026 616d 703b 20e2 84ab 7374 726f ., & ...stro │ │ │ -0007e0a0: 6d2c 204b 2e0a 2252 6576 6973 6974 696e m, K.."Revisitin │ │ │ -0007e0b0: 6720 7468 6520 5033 5020 5072 6f62 6c65 g the P3P Proble │ │ │ -0007e0c0: 6d22 2028 4349 5445 3a20 6469 6e67 3230 m" (CITE: ding20 │ │ │ -0007e0d0: 3233 7265 7669 7369 7469 6e67 292e 0a20 23revisiting).. │ │ │ -0007e0e0: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020
    • .
    • . │ │ │ -0007e0f0: 2052 4546 3a20 534f 4c56 4550 4e50 5f41 REF: SOLVEPNP_A │ │ │ -0007e100: 5033 5020 4d65 7468 6f64 2069 7320 6261 P3P Method is ba │ │ │ -0007e110: 7365 6420 6f6e 2074 6865 2070 6170 6572 sed on the paper │ │ │ -0007e120: 206f 6620 542e 204b 6520 616e 6420 532e of T. Ke and S. │ │ │ -0007e130: 2052 6f75 6d65 6c69 6f74 6973 2e0a 2241 Roumeliotis.."A │ │ │ -0007e140: 6e20 4566 6669 6369 656e 7420 416c 6765 n Efficient Alge │ │ │ -0007e150: 6272 6169 6320 536f 6c75 7469 6f6e 2074 braic Solution t │ │ │ -0007e160: 6f20 7468 6520 5065 7273 7065 6374 6976 o the Perspectiv │ │ │ -0007e170: 652d 5468 7265 652d 506f 696e 7420 5072 e-Three-Point Pr │ │ │ -0007e180: 6f62 6c65 6d22 2028 4349 5445 3a20 4b65 oblem" (CITE: Ke │ │ │ -0007e190: 3137 292e 0a20 203c 2f6c 693e 0a3c 2f75 17)..
    • .
      ..The function │ │ │ -0007e1b0: 2065 7374 696d 6174 6573 2074 6865 206f estimates the o │ │ │ -0007e1c0: 626a 6563 7420 706f 7365 2067 6976 656e bject pose given │ │ │ -0007e1d0: 2033 206f 626a 6563 7420 706f 696e 7473 3 object points │ │ │ -0007e1e0: 2c20 7468 6569 7220 636f 7272 6573 706f , their correspo │ │ │ -0007e1f0: 6e64 696e 6720 696d 6167 650a 7072 6f6a nding image.proj │ │ │ -0007e200: 6563 7469 6f6e 732c 2061 7320 7765 6c6c ections, as well │ │ │ -0007e210: 2061 7320 7468 6520 6361 6d65 7261 2069 as the camera i │ │ │ -0007e220: 6e74 7269 6e73 6963 206d 6174 7269 7820 ntrinsic matrix │ │ │ -0007e230: 616e 6420 7468 6520 6469 7374 6f72 7469 and the distorti │ │ │ -0007e240: 6f6e 2063 6f65 6666 6963 6965 6e74 732e on coefficients. │ │ │ -0007e250: 0a0a 3c62 3e4e 6f74 653a 3c2f 623e 0a54 ..Note:.T │ │ │ -0007e260: 6865 2073 6f6c 7574 696f 6e73 2061 7265 he solutions are │ │ │ -0007e270: 2073 6f72 7465 6420 6279 2072 6570 726f sorted by repro │ │ │ -0007e280: 6a65 6374 696f 6e20 6572 726f 7273 2028 jection errors ( │ │ │ -0007e290: 6c6f 7765 7374 2074 6f20 6869 6768 6573 lowest to highes │ │ │ -0007e2a0: 7429 2e3c 2f64 643e 0a3c 6474 3e52 6574 t).
    .
    Ret │ │ │ -0007e2b0: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e61 urns:
    .
    a │ │ │ -0007e2c0: 7574 6f6d 6174 6963 616c 6c79 2067 656e utomatically gen │ │ │ -0007e2d0: 6572 6174 6564 3c2f 6464 3e0a 3c2f 646c erated
    ....
  • .
  • .< │ │ │ -0007e300: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ -0007e310: 6574 6169 6c22 2069 643d 2273 6f6c 7665 etail" id="solve │ │ │ -0007e320: 506e 5052 6566 696e 654c 4d28 6f72 672e PnPRefineLM(org. │ │ │ -0007e330: 6f70 656e 6376 2e63 6f72 652e 4d61 742c opencv.core.Mat, │ │ │ -0007e340: 6f72 672e 6f70 656e 6376 2e63 6f72 652e org.opencv.core. │ │ │ -0007e350: 4d61 742c 6f72 672e 6f70 656e 6376 2e63 Mat,org.opencv.c │ │ │ -0007e360: 6f72 652e 4d61 742c 6f72 672e 6f70 656e ore.Mat,org.open │ │ │ -0007e370: 6376 2e63 6f72 652e 4d61 742c 6f72 672e cv.core.Mat,org. │ │ │ -0007e380: 6f70 656e 6376 2e63 6f72 652e 4d61 742c opencv.core.Mat, │ │ │ -0007e390: 6f72 672e 6f70 656e 6376 2e63 6f72 652e org.opencv.core. │ │ │ -0007e3a0: 4d61 742c 6f72 672e 6f70 656e 6376 2e63 Mat,org.opencv.c │ │ │ -0007e3b0: 6f72 652e 5465 726d 4372 6974 6572 6961 ore.TermCriteria │ │ │ -0007e3c0: 2922 3e0a 3c68 333e 736f 6c76 6550 6e50 )">.

    solvePnP │ │ │ -0007e3d0: 5265 6669 6e65 4c4d 3c2f 6833 3e0a 3c64 RefineLM

    ..public stati │ │ │ -0007e440: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void solvePnPRefi │ │ │ -0007e4a0: 6e65 4c4d 3c2f 7370 616e 3e3c 7762 723e neLM │ │ │ -0007e4b0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ -0007e510: 7370 3b6f 626a 6563 7450 6f69 6e74 732c sp;objectPoints, │ │ │ -0007e520: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -0007e560: 743c 2f61 3e26 6e62 7370 3b69 6d61 6765 t image │ │ │ -0007e570: 506f 696e 7473 2c0a 203c 6120 6872 6566 Points,. Mat&nbs │ │ │ -0007e5c0: 703b 6361 6d65 7261 4d61 7472 6978 2c0a p;cameraMatrix,. │ │ │ -0007e5d0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0007e610: 3c2f 613e 266e 6273 703b 6469 7374 436f  distCo │ │ │ -0007e620: 6566 6673 2c0a 203c 6120 6872 6566 3d22 effs,. Mat  │ │ │ -0007e670: 7276 6563 2c0a 203c 6120 6872 6566 3d22 rvec,. Mat  │ │ │ -0007e6c0: 7476 6563 2c0a 203c 6120 6872 6566 3d22 tvec,. Term │ │ │ -0007e710: 4372 6974 6572 6961 3c2f 613e 266e 6273 Criteria&nbs │ │ │ -0007e720: 703b 6372 6974 6572 6961 293c 2f73 7061 p;criteria).
    Refi │ │ │ -0007e750: 6e65 2061 2070 6f73 6520 2874 6865 2074 ne a pose (the t │ │ │ -0007e760: 7261 6e73 6c61 7469 6f6e 2061 6e64 2074 ranslation and t │ │ │ -0007e770: 6865 2072 6f74 6174 696f 6e20 7468 6174 he rotation that │ │ │ -0007e780: 2074 7261 6e73 666f 726d 2061 2033 4420 transform a 3D │ │ │ -0007e790: 706f 696e 7420 6578 7072 6573 7365 6420 point expressed │ │ │ -0007e7a0: 696e 2074 6865 206f 626a 6563 7420 636f in the object co │ │ │ -0007e7b0: 6f72 6469 6e61 7465 2066 7261 6d65 0a74 ordinate frame.t │ │ │ -0007e7c0: 6f20 7468 6520 6361 6d65 7261 2063 6f6f o the camera coo │ │ │ -0007e7d0: 7264 696e 6174 6520 6672 616d 6529 2066 rdinate frame) f │ │ │ -0007e7e0: 726f 6d20 6120 3344 2d32 4420 706f 696e rom a 3D-2D poin │ │ │ -0007e7f0: 7420 636f 7272 6573 706f 6e64 656e 6365 t correspondence │ │ │ -0007e800: 7320 616e 6420 7374 6172 7469 6e67 2066 s and starting f │ │ │ -0007e810: 726f 6d20 616e 2069 6e69 7469 616c 2073 rom an initial s │ │ │ -0007e820: 6f6c 7574 696f 6e2e 0a0a 5345 453a 2052 olution...SEE: R │ │ │ -0007e830: 4546 3a20 6361 6c69 6233 645f 736f 6c76 EF: calib3d_solv │ │ │ -0007e840: 6550 6e50 3c2f 6469 763e 0a3c 646c 2063 ePnP
    .
    .Parameters:.
    obj │ │ │ -0007e880: 6563 7450 6f69 6e74 733c 2f63 6f64 653e ectPoints │ │ │ -0007e890: 202d 2041 7272 6179 206f 6620 6f62 6a65 - Array of obje │ │ │ -0007e8a0: 6374 2070 6f69 6e74 7320 696e 2074 6865 ct points in the │ │ │ -0007e8b0: 206f 626a 6563 7420 636f 6f72 6469 6e61 object coordina │ │ │ -0007e8c0: 7465 2073 7061 6365 2c20 4e78 3320 312d te space, Nx3 1- │ │ │ -0007e8d0: 6368 616e 6e65 6c20 6f72 2031 784e 2f4e channel or 1xN/N │ │ │ -0007e8e0: 7831 2033 2d63 6861 6e6e 656c 2c0a 7768 x1 3-channel,.wh │ │ │ -0007e8f0: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ -0007e900: 6265 7220 6f66 2070 6f69 6e74 732e 2076 ber of points. v │ │ │ -0007e910: 6563 746f 7226 6c74 3b50 6f69 6e74 3364 ector<Point3d │ │ │ -0007e920: 2667 743b 2063 616e 2061 6c73 6f20 6265 > can also be │ │ │ -0007e930: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    ima │ │ │ -0007e950: 6765 506f 696e 7473 3c2f 636f 6465 3e20 gePoints │ │ │ -0007e960: 2d20 4172 7261 7920 6f66 2063 6f72 7265 - Array of corre │ │ │ -0007e970: 7370 6f6e 6469 6e67 2069 6d61 6765 2070 sponding image p │ │ │ -0007e980: 6f69 6e74 732c 204e 7832 2031 2d63 6861 oints, Nx2 1-cha │ │ │ -0007e990: 6e6e 656c 206f 7220 3178 4e2f 4e78 3120 nnel or 1xN/Nx1 │ │ │ -0007e9a0: 322d 6368 616e 6e65 6c2c 0a77 6865 7265 2-channel,.where │ │ │ -0007e9b0: 204e 2069 7320 7468 6520 6e75 6d62 6572 N is the number │ │ │ -0007e9c0: 206f 6620 706f 696e 7473 2e20 7665 6374 of points. vect │ │ │ -0007e9d0: 6f72 266c 743b 506f 696e 7432 6426 6774 or<Point2d> │ │ │ -0007e9e0: 3b20 6361 6e20 616c 736f 2062 6520 7061 ; can also be pa │ │ │ -0007e9f0: 7373 6564 2068 6572 652e 3c2f 6464 3e0a ssed here.
    . │ │ │ -0007ea00: 3c64 643e 3c63 6f64 653e 6361 6d65 7261
    camera │ │ │ -0007ea10: 4d61 7472 6978 3c2f 636f 6465 3e20 2d20 Matrix - │ │ │ -0007ea20: 496e 7075 7420 6361 6d65 7261 2069 6e74 Input camera int │ │ │ -0007ea30: 7269 6e73 6963 206d 6174 7269 7820 5c28 rinsic matrix \( │ │ │ -0007ea40: 5c63 616d 6572 616d 6174 7269 787b 417d \cameramatrix{A} │ │ │ -0007ea50: 5c29 202e 3c2f 6464 3e0a 3c64 643e 3c63 \) .
    .
    distCoeffs - Input ve │ │ │ -0007ea80: 6374 6f72 206f 6620 6469 7374 6f72 7469 ctor of distorti │ │ │ -0007ea90: 6f6e 2063 6f65 6666 6963 6965 6e74 730a on coefficients. │ │ │ -0007eaa0: 5c28 5c64 6973 7463 6f65 6666 735c 292e \(\distcoeffs\). │ │ │ -0007eab0: 2049 6620 7468 6520 7665 6374 6f72 2069 If the vector i │ │ │ -0007eac0: 7320 4e55 4c4c 2f65 6d70 7479 2c20 7468 s NULL/empty, th │ │ │ -0007ead0: 6520 7a65 726f 2064 6973 746f 7274 696f e zero distortio │ │ │ -0007eae0: 6e20 636f 6566 6669 6369 656e 7473 2061 n coefficients a │ │ │ -0007eaf0: 7265 0a61 7373 756d 6564 2e3c 2f64 643e re.assumed.
    │ │ │ -0007eb00: 0a3c 6464 3e3c 636f 6465 3e72 7665 633c .
    rvec< │ │ │ -0007eb10: 2f63 6f64 653e 202d 2049 6e70 7574 2f4f /code> - Input/O │ │ │ -0007eb20: 7574 7075 7420 726f 7461 7469 6f6e 2076 utput rotation v │ │ │ -0007eb30: 6563 746f 7220 2873 6565 2052 4546 3a20 ector (see REF: │ │ │ -0007eb40: 526f 6472 6967 7565 7320 2920 7468 6174 Rodrigues ) that │ │ │ -0007eb50: 2c20 746f 6765 7468 6572 2077 6974 6820 , together with │ │ │ -0007eb60: 7476 6563 2c20 6272 696e 6773 2070 6f69 tvec, brings poi │ │ │ -0007eb70: 6e74 7320 6672 6f6d 0a74 6865 206d 6f64 nts from.the mod │ │ │ -0007eb80: 656c 2063 6f6f 7264 696e 6174 6520 7379 el coordinate sy │ │ │ -0007eb90: 7374 656d 2074 6f20 7468 6520 6361 6d65 stem to the came │ │ │ -0007eba0: 7261 2063 6f6f 7264 696e 6174 6520 7379 ra coordinate sy │ │ │ -0007ebb0: 7374 656d 2e20 496e 7075 7420 7661 6c75 stem. Input valu │ │ │ -0007ebc0: 6573 2061 7265 2075 7365 6420 6173 2061 es are used as a │ │ │ -0007ebd0: 6e20 696e 6974 6961 6c20 736f 6c75 7469 n initial soluti │ │ │ -0007ebe0: 6f6e 2e3c 2f64 643e 0a3c 6464 3e3c 636f on.
    .
    tvec - │ │ │ -0007ec00: 2049 6e70 7574 2f4f 7574 7075 7420 7472 Input/Output tr │ │ │ -0007ec10: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ -0007ec20: 2e20 496e 7075 7420 7661 6c75 6573 2061 . Input values a │ │ │ -0007ec30: 7265 2075 7365 6420 6173 2061 6e20 696e re used as an in │ │ │ -0007ec40: 6974 6961 6c20 736f 6c75 7469 6f6e 2e3c itial solution.< │ │ │ -0007ec50: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ -0007ec60: 7269 7465 7269 613c 2f63 6f64 653e 202d riteria - │ │ │ -0007ec70: 2043 7269 7465 7269 6120 7768 656e 2074 Criteria when t │ │ │ -0007ec80: 6f20 7374 6f70 2074 6865 204c 6576 656e o stop the Leven │ │ │ -0007ec90: 6265 7267 2d4d 6172 7175 6172 6420 6974 berg-Marquard it │ │ │ -0007eca0: 6572 6174 6976 6520 616c 676f 7269 7468 erative algorith │ │ │ -0007ecb0: 6d2e 0a0a 5468 6520 6675 6e63 7469 6f6e m...The function │ │ │ -0007ecc0: 2072 6566 696e 6573 2074 6865 206f 626a refines the obj │ │ │ -0007ecd0: 6563 7420 706f 7365 2067 6976 656e 2061 ect pose given a │ │ │ -0007ece0: 7420 6c65 6173 7420 3320 6f62 6a65 6374 t least 3 object │ │ │ -0007ecf0: 2070 6f69 6e74 732c 2074 6865 6972 2063 points, their c │ │ │ -0007ed00: 6f72 7265 7370 6f6e 6469 6e67 2069 6d61 orresponding ima │ │ │ -0007ed10: 6765 0a70 726f 6a65 6374 696f 6e73 2c20 ge.projections, │ │ │ -0007ed20: 616e 2069 6e69 7469 616c 2073 6f6c 7574 an initial solut │ │ │ -0007ed30: 696f 6e20 666f 7220 7468 6520 726f 7461 ion for the rota │ │ │ -0007ed40: 7469 6f6e 2061 6e64 2074 7261 6e73 6c61 tion and transla │ │ │ -0007ed50: 7469 6f6e 2076 6563 746f 722c 0a61 7320 tion vector,.as │ │ │ -0007ed60: 7765 6c6c 2061 7320 7468 6520 6361 6d65 well as the came │ │ │ -0007ed70: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ -0007ed80: 7269 7820 616e 6420 7468 6520 6469 7374 rix and the dist │ │ │ -0007ed90: 6f72 7469 6f6e 2063 6f65 6666 6963 6965 ortion coefficie │ │ │ -0007eda0: 6e74 732e 0a54 6865 2066 756e 6374 696f nts..The functio │ │ │ -0007edb0: 6e20 6d69 6e69 6d69 7a65 7320 7468 6520 n minimizes the │ │ │ -0007edc0: 7072 6f6a 6563 7469 6f6e 2065 7272 6f72 projection error │ │ │ -0007edd0: 2077 6974 6820 7265 7370 6563 7420 746f with respect to │ │ │ -0007ede0: 2074 6865 2072 6f74 6174 696f 6e20 616e the rotation an │ │ │ -0007edf0: 6420 7468 6520 7472 616e 736c 6174 696f d the translatio │ │ │ -0007ee00: 6e20 7665 6374 6f72 732c 2061 6363 6f72 n vectors, accor │ │ │ -0007ee10: 6469 6e67 0a74 6f20 6120 4c65 7665 6e62 ding.to a Levenb │ │ │ -0007ee20: 6572 672d 4d61 7271 7561 7264 7420 6974 erg-Marquardt it │ │ │ -0007ee30: 6572 6174 6976 6520 6d69 6e69 6d69 7a61 erative minimiza │ │ │ -0007ee40: 7469 6f6e 2043 4954 453a 204d 6164 7365 tion CITE: Madse │ │ │ -0007ee50: 6e30 3420 4349 5445 3a20 4561 6465 3133 n04 CITE: Eade13 │ │ │ -0007ee60: 2070 726f 6365 7373 2e3c 2f64 643e 0a3c process.
    .< │ │ │ -0007ee70: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>...
  • .
  • .
    .

    so │ │ │ -0007ef40: 6c76 6550 6e50 5265 6669 6e65 4c4d 3c2f lvePnPRefineLM.
    .
    public │ │ │ -0007efb0: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ -0007efc0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;vo │ │ │ -0007efe0: 6964 3c2f 7370 616e 3e26 6e62 7370 3b3c id < │ │ │ -0007eff0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ -0007f000: 656e 742d 6e61 6d65 223e 736f 6c76 6550 ent-name">solveP │ │ │ -0007f010: 6e50 5265 6669 6e65 4c4d 3c2f 7370 616e nPRefineLM( │ │ │ -0007f040: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0007f080: 2f61 3e26 6e62 7370 3b6f 626a 6563 7450 /a> objectP │ │ │ -0007f090: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ -0007f0e0: 3b69 6d61 6765 506f 696e 7473 2c0a 203c ;imagePoints,. < │ │ │ -0007f0f0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0007f100: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0007f110: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0007f120: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ -0007f140: 7472 6978 2c0a 203c 6120 6872 6566 3d22 trix,. Mat  │ │ │ -0007f190: 6469 7374 436f 6566 6673 2c0a 203c 6120 distCoeffs,. Mat │ │ │ -0007f1e0: 266e 6273 703b 7276 6563 2c0a 203c 6120  rvec,. Mat │ │ │ -0007f230: 266e 6273 703b 7476 6563 293c 2f73 7061  tvec)
    .
    Refi │ │ │ -0007f260: 6e65 2061 2070 6f73 6520 2874 6865 2074 ne a pose (the t │ │ │ -0007f270: 7261 6e73 6c61 7469 6f6e 2061 6e64 2074 ranslation and t │ │ │ -0007f280: 6865 2072 6f74 6174 696f 6e20 7468 6174 he rotation that │ │ │ -0007f290: 2074 7261 6e73 666f 726d 2061 2033 4420 transform a 3D │ │ │ -0007f2a0: 706f 696e 7420 6578 7072 6573 7365 6420 point expressed │ │ │ -0007f2b0: 696e 2074 6865 206f 626a 6563 7420 636f in the object co │ │ │ -0007f2c0: 6f72 6469 6e61 7465 2066 7261 6d65 0a74 ordinate frame.t │ │ │ -0007f2d0: 6f20 7468 6520 6361 6d65 7261 2063 6f6f o the camera coo │ │ │ -0007f2e0: 7264 696e 6174 6520 6672 616d 6529 2066 rdinate frame) f │ │ │ -0007f2f0: 726f 6d20 6120 3344 2d32 4420 706f 696e rom a 3D-2D poin │ │ │ -0007f300: 7420 636f 7272 6573 706f 6e64 656e 6365 t correspondence │ │ │ -0007f310: 7320 616e 6420 7374 6172 7469 6e67 2066 s and starting f │ │ │ -0007f320: 726f 6d20 616e 2069 6e69 7469 616c 2073 rom an initial s │ │ │ -0007f330: 6f6c 7574 696f 6e2e 0a0a 5345 453a 2052 olution...SEE: R │ │ │ -0007f340: 4546 3a20 6361 6c69 6233 645f 736f 6c76 EF: calib3d_solv │ │ │ -0007f350: 6550 6e50 3c2f 6469 763e 0a3c 646c 2063 ePnP
    .
    .Parameters:.
    obj │ │ │ -0007f390: 6563 7450 6f69 6e74 733c 2f63 6f64 653e ectPoints │ │ │ -0007f3a0: 202d 2041 7272 6179 206f 6620 6f62 6a65 - Array of obje │ │ │ -0007f3b0: 6374 2070 6f69 6e74 7320 696e 2074 6865 ct points in the │ │ │ -0007f3c0: 206f 626a 6563 7420 636f 6f72 6469 6e61 object coordina │ │ │ -0007f3d0: 7465 2073 7061 6365 2c20 4e78 3320 312d te space, Nx3 1- │ │ │ -0007f3e0: 6368 616e 6e65 6c20 6f72 2031 784e 2f4e channel or 1xN/N │ │ │ -0007f3f0: 7831 2033 2d63 6861 6e6e 656c 2c0a 7768 x1 3-channel,.wh │ │ │ -0007f400: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ -0007f410: 6265 7220 6f66 2070 6f69 6e74 732e 2076 ber of points. v │ │ │ -0007f420: 6563 746f 7226 6c74 3b50 6f69 6e74 3364 ector<Point3d │ │ │ -0007f430: 2667 743b 2063 616e 2061 6c73 6f20 6265 > can also be │ │ │ -0007f440: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    ima │ │ │ -0007f460: 6765 506f 696e 7473 3c2f 636f 6465 3e20 gePoints │ │ │ -0007f470: 2d20 4172 7261 7920 6f66 2063 6f72 7265 - Array of corre │ │ │ -0007f480: 7370 6f6e 6469 6e67 2069 6d61 6765 2070 sponding image p │ │ │ -0007f490: 6f69 6e74 732c 204e 7832 2031 2d63 6861 oints, Nx2 1-cha │ │ │ -0007f4a0: 6e6e 656c 206f 7220 3178 4e2f 4e78 3120 nnel or 1xN/Nx1 │ │ │ -0007f4b0: 322d 6368 616e 6e65 6c2c 0a77 6865 7265 2-channel,.where │ │ │ -0007f4c0: 204e 2069 7320 7468 6520 6e75 6d62 6572 N is the number │ │ │ -0007f4d0: 206f 6620 706f 696e 7473 2e20 7665 6374 of points. vect │ │ │ -0007f4e0: 6f72 266c 743b 506f 696e 7432 6426 6774 or<Point2d> │ │ │ -0007f4f0: 3b20 6361 6e20 616c 736f 2062 6520 7061 ; can also be pa │ │ │ -0007f500: 7373 6564 2068 6572 652e 3c2f 6464 3e0a ssed here.
    . │ │ │ -0007f510: 3c64 643e 3c63 6f64 653e 6361 6d65 7261
    camera │ │ │ -0007f520: 4d61 7472 6978 3c2f 636f 6465 3e20 2d20 Matrix - │ │ │ -0007f530: 496e 7075 7420 6361 6d65 7261 2069 6e74 Input camera int │ │ │ -0007f540: 7269 6e73 6963 206d 6174 7269 7820 5c28 rinsic matrix \( │ │ │ -0007f550: 5c63 616d 6572 616d 6174 7269 787b 417d \cameramatrix{A} │ │ │ -0007f560: 5c29 202e 3c2f 6464 3e0a 3c64 643e 3c63 \) .
    .
    distCoeffs - Input ve │ │ │ -0007f590: 6374 6f72 206f 6620 6469 7374 6f72 7469 ctor of distorti │ │ │ -0007f5a0: 6f6e 2063 6f65 6666 6963 6965 6e74 730a on coefficients. │ │ │ -0007f5b0: 5c28 5c64 6973 7463 6f65 6666 735c 292e \(\distcoeffs\). │ │ │ -0007f5c0: 2049 6620 7468 6520 7665 6374 6f72 2069 If the vector i │ │ │ -0007f5d0: 7320 4e55 4c4c 2f65 6d70 7479 2c20 7468 s NULL/empty, th │ │ │ -0007f5e0: 6520 7a65 726f 2064 6973 746f 7274 696f e zero distortio │ │ │ -0007f5f0: 6e20 636f 6566 6669 6369 656e 7473 2061 n coefficients a │ │ │ -0007f600: 7265 0a61 7373 756d 6564 2e3c 2f64 643e re.assumed.
    │ │ │ -0007f610: 0a3c 6464 3e3c 636f 6465 3e72 7665 633c .
    rvec< │ │ │ -0007f620: 2f63 6f64 653e 202d 2049 6e70 7574 2f4f /code> - Input/O │ │ │ -0007f630: 7574 7075 7420 726f 7461 7469 6f6e 2076 utput rotation v │ │ │ -0007f640: 6563 746f 7220 2873 6565 2052 4546 3a20 ector (see REF: │ │ │ -0007f650: 526f 6472 6967 7565 7320 2920 7468 6174 Rodrigues ) that │ │ │ -0007f660: 2c20 746f 6765 7468 6572 2077 6974 6820 , together with │ │ │ -0007f670: 7476 6563 2c20 6272 696e 6773 2070 6f69 tvec, brings poi │ │ │ -0007f680: 6e74 7320 6672 6f6d 0a74 6865 206d 6f64 nts from.the mod │ │ │ -0007f690: 656c 2063 6f6f 7264 696e 6174 6520 7379 el coordinate sy │ │ │ -0007f6a0: 7374 656d 2074 6f20 7468 6520 6361 6d65 stem to the came │ │ │ -0007f6b0: 7261 2063 6f6f 7264 696e 6174 6520 7379 ra coordinate sy │ │ │ -0007f6c0: 7374 656d 2e20 496e 7075 7420 7661 6c75 stem. Input valu │ │ │ -0007f6d0: 6573 2061 7265 2075 7365 6420 6173 2061 es are used as a │ │ │ -0007f6e0: 6e20 696e 6974 6961 6c20 736f 6c75 7469 n initial soluti │ │ │ -0007f6f0: 6f6e 2e3c 2f64 643e 0a3c 6464 3e3c 636f on.
    .
    tvec - │ │ │ -0007f710: 2049 6e70 7574 2f4f 7574 7075 7420 7472 Input/Output tr │ │ │ -0007f720: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ -0007f730: 2e20 496e 7075 7420 7661 6c75 6573 2061 . Input values a │ │ │ -0007f740: 7265 2075 7365 6420 6173 2061 6e20 696e re used as an in │ │ │ -0007f750: 6974 6961 6c20 736f 6c75 7469 6f6e 2e0a itial solution.. │ │ │ -0007f760: 0a54 6865 2066 756e 6374 696f 6e20 7265 .The function re │ │ │ -0007f770: 6669 6e65 7320 7468 6520 6f62 6a65 6374 fines the object │ │ │ -0007f780: 2070 6f73 6520 6769 7665 6e20 6174 206c pose given at l │ │ │ -0007f790: 6561 7374 2033 206f 626a 6563 7420 706f east 3 object po │ │ │ -0007f7a0: 696e 7473 2c20 7468 6569 7220 636f 7272 ints, their corr │ │ │ -0007f7b0: 6573 706f 6e64 696e 6720 696d 6167 650a esponding image. │ │ │ -0007f7c0: 7072 6f6a 6563 7469 6f6e 732c 2061 6e20 projections, an │ │ │ -0007f7d0: 696e 6974 6961 6c20 736f 6c75 7469 6f6e initial solution │ │ │ -0007f7e0: 2066 6f72 2074 6865 2072 6f74 6174 696f for the rotatio │ │ │ -0007f7f0: 6e20 616e 6420 7472 616e 736c 6174 696f n and translatio │ │ │ -0007f800: 6e20 7665 6374 6f72 2c0a 6173 2077 656c n vector,.as wel │ │ │ -0007f810: 6c20 6173 2074 6865 2063 616d 6572 6120 l as the camera │ │ │ -0007f820: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ -0007f830: 2061 6e64 2074 6865 2064 6973 746f 7274 and the distort │ │ │ -0007f840: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ -0007f850: 2e0a 5468 6520 6675 6e63 7469 6f6e 206d ..The function m │ │ │ -0007f860: 696e 696d 697a 6573 2074 6865 2070 726f inimizes the pro │ │ │ -0007f870: 6a65 6374 696f 6e20 6572 726f 7220 7769 jection error wi │ │ │ -0007f880: 7468 2072 6573 7065 6374 2074 6f20 7468 th respect to th │ │ │ -0007f890: 6520 726f 7461 7469 6f6e 2061 6e64 2074 e rotation and t │ │ │ -0007f8a0: 6865 2074 7261 6e73 6c61 7469 6f6e 2076 he translation v │ │ │ -0007f8b0: 6563 746f 7273 2c20 6163 636f 7264 696e ectors, accordin │ │ │ -0007f8c0: 670a 746f 2061 204c 6576 656e 6265 7267 g.to a Levenberg │ │ │ -0007f8d0: 2d4d 6172 7175 6172 6474 2069 7465 7261 -Marquardt itera │ │ │ -0007f8e0: 7469 7665 206d 696e 696d 697a 6174 696f tive minimizatio │ │ │ -0007f8f0: 6e20 4349 5445 3a20 4d61 6473 656e 3034 n CITE: Madsen04 │ │ │ -0007f900: 2043 4954 453a 2045 6164 6531 3320 7072 CITE: Eade13 pr │ │ │ -0007f910: 6f63 6573 732e 3c2f 6464 3e0a 3c2f 646c ocess.
    .
    .
    ..

  • .
  • .< │ │ │ -0007f940: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ -0007f950: 6574 6169 6c22 2069 643d 2273 6f6c 7665 etail" id="solve │ │ │ -0007f960: 506e 5052 6566 696e 6556 5653 286f 7267 PnPRefineVVS(org │ │ │ -0007f970: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ -0007f980: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ -0007f990: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ -0007f9a0: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ -0007f9b0: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ -0007f9c0: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ -0007f9d0: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ -0007f9e0: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ -0007f9f0: 636f 7265 2e54 6572 6d43 7269 7465 7269 core.TermCriteri │ │ │ -0007fa00: 612c 646f 7562 6c65 2922 3e0a 3c68 333e a,double)">.

    │ │ │ -0007fa10: 736f 6c76 6550 6e50 5265 6669 6e65 5656 solvePnPRefineVV │ │ │ -0007fa20: 533c 2f68 333e 0a3c 6469 7620 636c 6173 S

    .
    .
    pub │ │ │ -0007fa80: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static void&nbs │ │ │ -0007fac0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;sol │ │ │ -0007fae0: 7665 506e 5052 6566 696e 6556 5653 3c2f vePnPRefineVVS( │ │ │ -0007fb50: 4d61 743c 2f61 3e26 6e62 7370 3b6f 626a Mat obj │ │ │ -0007fb60: 6563 7450 6f69 6e74 732c 0a20 3c61 2068 ectPoints,. Mat& │ │ │ -0007fbb0: 6e62 7370 3b69 6d61 6765 506f 696e 7473 nbsp;imagePoints │ │ │ -0007fbc0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -0007fc00: 6174 3c2f 613e 266e 6273 703b 6361 6d65 at came │ │ │ -0007fc10: 7261 4d61 7472 6978 2c0a 203c 6120 6872 raMatrix,. Mat&n │ │ │ -0007fc60: 6273 703b 6469 7374 436f 6566 6673 2c0a bsp;distCoeffs,. │ │ │ -0007fc70: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0007fcb0: 3c2f 613e 266e 6273 703b 7276 6563 2c0a  rvec,. │ │ │ -0007fcc0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0007fd00: 3c2f 613e 266e 6273 703b 7476 6563 2c0a  tvec,. │ │ │ -0007fd10: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 TermCriter │ │ │ -0007fd60: 6961 3c2f 613e 266e 6273 703b 6372 6974 ia crit │ │ │ -0007fd70: 6572 6961 2c0a 2064 6f75 626c 6526 6e62 eria,. double&nb │ │ │ -0007fd80: 7370 3b56 5653 6c61 6d62 6461 293c 2f73 sp;VVSlambda)
    .
    Re │ │ │ -0007fdb0: 6669 6e65 2061 2070 6f73 6520 2874 6865 fine a pose (the │ │ │ -0007fdc0: 2074 7261 6e73 6c61 7469 6f6e 2061 6e64 translation and │ │ │ -0007fdd0: 2074 6865 2072 6f74 6174 696f 6e20 7468 the rotation th │ │ │ -0007fde0: 6174 2074 7261 6e73 666f 726d 2061 2033 at transform a 3 │ │ │ -0007fdf0: 4420 706f 696e 7420 6578 7072 6573 7365 D point expresse │ │ │ -0007fe00: 6420 696e 2074 6865 206f 626a 6563 7420 d in the object │ │ │ -0007fe10: 636f 6f72 6469 6e61 7465 2066 7261 6d65 coordinate frame │ │ │ -0007fe20: 0a74 6f20 7468 6520 6361 6d65 7261 2063 .to the camera c │ │ │ -0007fe30: 6f6f 7264 696e 6174 6520 6672 616d 6529 oordinate frame) │ │ │ -0007fe40: 2066 726f 6d20 6120 3344 2d32 4420 706f from a 3D-2D po │ │ │ -0007fe50: 696e 7420 636f 7272 6573 706f 6e64 656e int corresponden │ │ │ -0007fe60: 6365 7320 616e 6420 7374 6172 7469 6e67 ces and starting │ │ │ -0007fe70: 2066 726f 6d20 616e 2069 6e69 7469 616c from an initial │ │ │ -0007fe80: 2073 6f6c 7574 696f 6e2e 0a0a 5345 453a solution...SEE: │ │ │ -0007fe90: 2052 4546 3a20 6361 6c69 6233 645f 736f REF: calib3d_so │ │ │ -0007fea0: 6c76 6550 6e50 3c2f 6469 763e 0a3c 646c lvePnP
    .
    . │ │ │ -0007fec0: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -0007fed0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e6f /dt>.
    o │ │ │ -0007fee0: 626a 6563 7450 6f69 6e74 733c 2f63 6f64 bjectPoints - Array of ob │ │ │ -0007ff00: 6a65 6374 2070 6f69 6e74 7320 696e 2074 ject points in t │ │ │ -0007ff10: 6865 206f 626a 6563 7420 636f 6f72 6469 he object coordi │ │ │ -0007ff20: 6e61 7465 2073 7061 6365 2c20 4e78 3320 nate space, Nx3 │ │ │ -0007ff30: 312d 6368 616e 6e65 6c20 6f72 2031 784e 1-channel or 1xN │ │ │ -0007ff40: 2f4e 7831 2033 2d63 6861 6e6e 656c 2c0a /Nx1 3-channel,. │ │ │ -0007ff50: 7768 6572 6520 4e20 6973 2074 6865 206e where N is the n │ │ │ -0007ff60: 756d 6265 7220 6f66 2070 6f69 6e74 732e umber of points. │ │ │ -0007ff70: 2076 6563 746f 7226 6c74 3b50 6f69 6e74 vector<Point │ │ │ -0007ff80: 3364 2667 743b 2063 616e 2061 6c73 6f20 3d> can also │ │ │ -0007ff90: 6265 2070 6173 7365 6420 6865 7265 2e3c be passed here.< │ │ │ -0007ffa0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e69 /dd>.
    i │ │ │ -0007ffb0: 6d61 6765 506f 696e 7473 3c2f 636f 6465 magePoints - Array of cor │ │ │ -0007ffd0: 7265 7370 6f6e 6469 6e67 2069 6d61 6765 responding image │ │ │ -0007ffe0: 2070 6f69 6e74 732c 204e 7832 2031 2d63 points, Nx2 1-c │ │ │ -0007fff0: 6861 6e6e 656c 206f 7220 3178 4e2f 4e78 hannel or 1xN/Nx │ │ │ -00080000: 3120 322d 6368 616e 6e65 6c2c 0a77 6865 1 2-channel,.whe │ │ │ -00080010: 7265 204e 2069 7320 7468 6520 6e75 6d62 re N is the numb │ │ │ -00080020: 6572 206f 6620 706f 696e 7473 2e20 7665 er of points. ve │ │ │ -00080030: 6374 6f72 266c 743b 506f 696e 7432 6426 ctor<Point2d& │ │ │ -00080040: 6774 3b20 6361 6e20 616c 736f 2062 6520 gt; can also be │ │ │ -00080050: 7061 7373 6564 2068 6572 652e 3c2f 6464 passed here.
    .
    came │ │ │ -00080070: 7261 4d61 7472 6978 3c2f 636f 6465 3e20 raMatrix │ │ │ -00080080: 2d20 496e 7075 7420 6361 6d65 7261 2069 - Input camera i │ │ │ -00080090: 6e74 7269 6e73 6963 206d 6174 7269 7820 ntrinsic matrix │ │ │ -000800a0: 5c28 5c63 616d 6572 616d 6174 7269 787b \(\cameramatrix{ │ │ │ -000800b0: 417d 5c29 202e 3c2f 6464 3e0a 3c64 643e A}\) .
    .
    │ │ │ -000800c0: 3c63 6f64 653e 6469 7374 436f 6566 6673 distCoeffs │ │ │ -000800d0: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ -000800e0: 7665 6374 6f72 206f 6620 6469 7374 6f72 vector of distor │ │ │ -000800f0: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ -00080100: 730a 5c28 5c64 6973 7463 6f65 6666 735c s.\(\distcoeffs\ │ │ │ -00080110: 292e 2049 6620 7468 6520 7665 6374 6f72 ). If the vector │ │ │ -00080120: 2069 7320 4e55 4c4c 2f65 6d70 7479 2c20 is NULL/empty, │ │ │ -00080130: 7468 6520 7a65 726f 2064 6973 746f 7274 the zero distort │ │ │ -00080140: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ -00080150: 2061 7265 0a61 7373 756d 6564 2e3c 2f64 are.assumed..
    rve │ │ │ -00080170: 633c 2f63 6f64 653e 202d 2049 6e70 7574 c - Input │ │ │ -00080180: 2f4f 7574 7075 7420 726f 7461 7469 6f6e /Output rotation │ │ │ -00080190: 2076 6563 746f 7220 2873 6565 2052 4546 vector (see REF │ │ │ -000801a0: 3a20 526f 6472 6967 7565 7320 2920 7468 : Rodrigues ) th │ │ │ -000801b0: 6174 2c20 746f 6765 7468 6572 2077 6974 at, together wit │ │ │ -000801c0: 6820 7476 6563 2c20 6272 696e 6773 2070 h tvec, brings p │ │ │ -000801d0: 6f69 6e74 7320 6672 6f6d 0a74 6865 206d oints from.the m │ │ │ -000801e0: 6f64 656c 2063 6f6f 7264 696e 6174 6520 odel coordinate │ │ │ -000801f0: 7379 7374 656d 2074 6f20 7468 6520 6361 system to the ca │ │ │ -00080200: 6d65 7261 2063 6f6f 7264 696e 6174 6520 mera coordinate │ │ │ -00080210: 7379 7374 656d 2e20 496e 7075 7420 7661 system. Input va │ │ │ -00080220: 6c75 6573 2061 7265 2075 7365 6420 6173 lues are used as │ │ │ -00080230: 2061 6e20 696e 6974 6961 6c20 736f 6c75 an initial solu │ │ │ -00080240: 7469 6f6e 2e3c 2f64 643e 0a3c 6464 3e3c tion.
    .
    < │ │ │ -00080250: 636f 6465 3e74 7665 633c 2f63 6f64 653e code>tvec │ │ │ -00080260: 202d 2049 6e70 7574 2f4f 7574 7075 7420 - Input/Output │ │ │ -00080270: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ -00080280: 6f72 2e20 496e 7075 7420 7661 6c75 6573 or. Input values │ │ │ -00080290: 2061 7265 2075 7365 6420 6173 2061 6e20 are used as an │ │ │ -000802a0: 696e 6974 6961 6c20 736f 6c75 7469 6f6e initial solution │ │ │ -000802b0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    criteria │ │ │ -000802d0: 202d 2043 7269 7465 7269 6120 7768 656e - Criteria when │ │ │ -000802e0: 2074 6f20 7374 6f70 2074 6865 204c 6576 to stop the Lev │ │ │ -000802f0: 656e 6265 7267 2d4d 6172 7175 6172 6420 enberg-Marquard │ │ │ -00080300: 6974 6572 6174 6976 6520 616c 676f 7269 iterative algori │ │ │ -00080310: 7468 6d2e 3c2f 6464 3e0a 3c64 643e 3c63 thm.
    .
    VVSlambda - Gain for │ │ │ -00080340: 7468 6520 7669 7274 7561 6c20 7669 7375 the virtual visu │ │ │ -00080350: 616c 2073 6572 766f 696e 6720 636f 6e74 al servoing cont │ │ │ -00080360: 726f 6c20 6c61 772c 2065 7175 6976 616c rol law, equival │ │ │ -00080370: 656e 7420 746f 2074 6865 205c 285c 616c ent to the \(\al │ │ │ -00080380: 7068 615c 290a 6761 696e 2069 6e20 7468 pha\).gain in th │ │ │ -00080390: 6520 4461 6d70 6564 2047 6175 7373 2d4e e Damped Gauss-N │ │ │ -000803a0: 6577 746f 6e20 666f 726d 756c 6174 696f ewton formulatio │ │ │ -000803b0: 6e2e 0a0a 5468 6520 6675 6e63 7469 6f6e n...The function │ │ │ -000803c0: 2072 6566 696e 6573 2074 6865 206f 626a refines the obj │ │ │ -000803d0: 6563 7420 706f 7365 2067 6976 656e 2061 ect pose given a │ │ │ -000803e0: 7420 6c65 6173 7420 3320 6f62 6a65 6374 t least 3 object │ │ │ -000803f0: 2070 6f69 6e74 732c 2074 6865 6972 2063 points, their c │ │ │ -00080400: 6f72 7265 7370 6f6e 6469 6e67 2069 6d61 orresponding ima │ │ │ -00080410: 6765 0a70 726f 6a65 6374 696f 6e73 2c20 ge.projections, │ │ │ -00080420: 616e 2069 6e69 7469 616c 2073 6f6c 7574 an initial solut │ │ │ -00080430: 696f 6e20 666f 7220 7468 6520 726f 7461 ion for the rota │ │ │ -00080440: 7469 6f6e 2061 6e64 2074 7261 6e73 6c61 tion and transla │ │ │ -00080450: 7469 6f6e 2076 6563 746f 722c 0a61 7320 tion vector,.as │ │ │ -00080460: 7765 6c6c 2061 7320 7468 6520 6361 6d65 well as the came │ │ │ -00080470: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ -00080480: 7269 7820 616e 6420 7468 6520 6469 7374 rix and the dist │ │ │ -00080490: 6f72 7469 6f6e 2063 6f65 6666 6963 6965 ortion coefficie │ │ │ -000804a0: 6e74 732e 0a54 6865 2066 756e 6374 696f nts..The functio │ │ │ -000804b0: 6e20 6d69 6e69 6d69 7a65 7320 7468 6520 n minimizes the │ │ │ -000804c0: 7072 6f6a 6563 7469 6f6e 2065 7272 6f72 projection error │ │ │ -000804d0: 2077 6974 6820 7265 7370 6563 7420 746f with respect to │ │ │ -000804e0: 2074 6865 2072 6f74 6174 696f 6e20 616e the rotation an │ │ │ -000804f0: 6420 7468 6520 7472 616e 736c 6174 696f d the translatio │ │ │ -00080500: 6e20 7665 6374 6f72 732c 2075 7369 6e67 n vectors, using │ │ │ -00080510: 2061 0a76 6972 7475 616c 2076 6973 7561 a.virtual visua │ │ │ -00080520: 6c20 7365 7276 6f69 6e67 2028 5656 5329 l servoing (VVS) │ │ │ -00080530: 2043 4954 453a 2043 6861 756d 6574 7465 CITE: Chaumette │ │ │ -00080540: 3036 2043 4954 453a 204d 6172 6368 616e 06 CITE: Marchan │ │ │ -00080550: 6431 3620 7363 6865 6d65 2e3c 2f64 643e d16 scheme.
    │ │ │ -00080560: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    .
    ..
  • .< │ │ │ -00080580: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .

    so │ │ │ -00080650: 6c76 6550 6e50 5265 6669 6e65 5656 533c lvePnPRefineVVS< │ │ │ -00080660: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -000806c0: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -000806d0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;v │ │ │ -000806f0: 6f69 643c 2f73 7061 6e3e 266e 6273 703b oid  │ │ │ -00080700: 3c73 7061 6e20 636c 6173 733d 2265 6c65 solve │ │ │ -00080720: 506e 5052 6566 696e 6556 5653 3c2f 7370 PnPRefineVVS(Ma │ │ │ -00080790: 743c 2f61 3e26 6e62 7370 3b6f 626a 6563 t objec │ │ │ -000807a0: 7450 6f69 6e74 732c 0a20 3c61 2068 7265 tPoints,. Mat&nb │ │ │ -000807f0: 7370 3b69 6d61 6765 506f 696e 7473 2c0a sp;imagePoints,. │ │ │ -00080800: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -00080840: 3c2f 613e 266e 6273 703b 6361 6d65 7261  camera │ │ │ -00080850: 4d61 7472 6978 2c0a 203c 6120 6872 6566 Matrix,. Mat&nbs │ │ │ -000808a0: 703b 6469 7374 436f 6566 6673 2c0a 203c p;distCoeffs,. < │ │ │ -000808b0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000808c0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000808d0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000808e0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat rvec,. < │ │ │ -00080900: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00080910: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00080920: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00080930: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat tvec,. < │ │ │ -00080950: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00080960: 5465 726d 4372 6974 6572 6961 2e68 746d TermCriteria.htm │ │ │ -00080970: 6c22 2074 6974 6c65 3d22 636c 6173 7320 l" title="class │ │ │ -00080980: 696e 206f 7267 2e6f 7065 6e63 762e 636f in org.opencv.co │ │ │ -00080990: 7265 223e 5465 726d 4372 6974 6572 6961 re">TermCriteria │ │ │ -000809a0: 3c2f 613e 266e 6273 703b 6372 6974 6572  criter │ │ │ -000809b0: 6961 293c 2f73 7061 6e3e 3c2f 6469 763e ia)
    │ │ │ -000809c0: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Refine a pos │ │ │ -000809e0: 6520 2874 6865 2074 7261 6e73 6c61 7469 e (the translati │ │ │ -000809f0: 6f6e 2061 6e64 2074 6865 2072 6f74 6174 on and the rotat │ │ │ -00080a00: 696f 6e20 7468 6174 2074 7261 6e73 666f ion that transfo │ │ │ -00080a10: 726d 2061 2033 4420 706f 696e 7420 6578 rm a 3D point ex │ │ │ -00080a20: 7072 6573 7365 6420 696e 2074 6865 206f pressed in the o │ │ │ -00080a30: 626a 6563 7420 636f 6f72 6469 6e61 7465 bject coordinate │ │ │ -00080a40: 2066 7261 6d65 0a74 6f20 7468 6520 6361 frame.to the ca │ │ │ -00080a50: 6d65 7261 2063 6f6f 7264 696e 6174 6520 mera coordinate │ │ │ -00080a60: 6672 616d 6529 2066 726f 6d20 6120 3344 frame) from a 3D │ │ │ -00080a70: 2d32 4420 706f 696e 7420 636f 7272 6573 -2D point corres │ │ │ -00080a80: 706f 6e64 656e 6365 7320 616e 6420 7374 pondences and st │ │ │ -00080a90: 6172 7469 6e67 2066 726f 6d20 616e 2069 arting from an i │ │ │ -00080aa0: 6e69 7469 616c 2073 6f6c 7574 696f 6e2e nitial solution. │ │ │ -00080ab0: 0a0a 5345 453a 2052 4546 3a20 6361 6c69 ..SEE: REF: cali │ │ │ -00080ac0: 6233 645f 736f 6c76 6550 6e50 3c2f 6469 b3d_solvePnP.
    .
    Parame │ │ │ -00080af0: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ -00080b00: 636f 6465 3e6f 626a 6563 7450 6f69 6e74 code>objectPoint │ │ │ -00080b10: 733c 2f63 6f64 653e 202d 2041 7272 6179 s - Array │ │ │ -00080b20: 206f 6620 6f62 6a65 6374 2070 6f69 6e74 of object point │ │ │ -00080b30: 7320 696e 2074 6865 206f 626a 6563 7420 s in the object │ │ │ -00080b40: 636f 6f72 6469 6e61 7465 2073 7061 6365 coordinate space │ │ │ -00080b50: 2c20 4e78 3320 312d 6368 616e 6e65 6c20 , Nx3 1-channel │ │ │ -00080b60: 6f72 2031 784e 2f4e 7831 2033 2d63 6861 or 1xN/Nx1 3-cha │ │ │ -00080b70: 6e6e 656c 2c0a 7768 6572 6520 4e20 6973 nnel,.where N is │ │ │ -00080b80: 2074 6865 206e 756d 6265 7220 6f66 2070 the number of p │ │ │ -00080b90: 6f69 6e74 732e 2076 6563 746f 7226 6c74 oints. vector< │ │ │ -00080ba0: 3b50 6f69 6e74 3364 2667 743b 2063 616e ;Point3d> can │ │ │ -00080bb0: 2061 6c73 6f20 6265 2070 6173 7365 6420 also be passed │ │ │ -00080bc0: 6865 7265 2e3c 2f64 643e 0a3c 6464 3e3c here.
    .
    < │ │ │ -00080bd0: 636f 6465 3e69 6d61 6765 506f 696e 7473 code>imagePoints │ │ │ -00080be0: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ -00080bf0: 6f66 2063 6f72 7265 7370 6f6e 6469 6e67 of corresponding │ │ │ -00080c00: 2069 6d61 6765 2070 6f69 6e74 732c 204e image points, N │ │ │ -00080c10: 7832 2031 2d63 6861 6e6e 656c 206f 7220 x2 1-channel or │ │ │ -00080c20: 3178 4e2f 4e78 3120 322d 6368 616e 6e65 1xN/Nx1 2-channe │ │ │ -00080c30: 6c2c 0a77 6865 7265 204e 2069 7320 7468 l,.where N is th │ │ │ -00080c40: 6520 6e75 6d62 6572 206f 6620 706f 696e e number of poin │ │ │ -00080c50: 7473 2e20 7665 6374 6f72 266c 743b 506f ts. vector<Po │ │ │ -00080c60: 696e 7432 6426 6774 3b20 6361 6e20 616c int2d> can al │ │ │ -00080c70: 736f 2062 6520 7061 7373 6564 2068 6572 so be passed her │ │ │ -00080c80: 652e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 e.
    .
    cameraMatrix - Input ca │ │ │ -00080cb0: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -00080cc0: 6174 7269 7820 5c28 5c63 616d 6572 616d atrix \(\cameram │ │ │ -00080cd0: 6174 7269 787b 417d 5c29 202e 3c2f 6464 atrix{A}\) .
    .
    dist │ │ │ -00080cf0: 436f 6566 6673 3c2f 636f 6465 3e20 2d20 Coeffs - │ │ │ -00080d00: 496e 7075 7420 7665 6374 6f72 206f 6620 Input vector of │ │ │ -00080d10: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ -00080d20: 6963 6965 6e74 730a 5c28 5c64 6973 7463 icients.\(\distc │ │ │ -00080d30: 6f65 6666 735c 292e 2049 6620 7468 6520 oeffs\). If the │ │ │ -00080d40: 7665 6374 6f72 2069 7320 4e55 4c4c 2f65 vector is NULL/e │ │ │ -00080d50: 6d70 7479 2c20 7468 6520 7a65 726f 2064 mpty, the zero d │ │ │ -00080d60: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ -00080d70: 6369 656e 7473 2061 7265 0a61 7373 756d cients are.assum │ │ │ -00080d80: 6564 2e3c 2f64 643e 0a3c 6464 3e3c 636f ed.
    .
    rvec - │ │ │ -00080da0: 2049 6e70 7574 2f4f 7574 7075 7420 726f Input/Output ro │ │ │ -00080db0: 7461 7469 6f6e 2076 6563 746f 7220 2873 tation vector (s │ │ │ -00080dc0: 6565 2052 4546 3a20 526f 6472 6967 7565 ee REF: Rodrigue │ │ │ -00080dd0: 7320 2920 7468 6174 2c20 746f 6765 7468 s ) that, togeth │ │ │ -00080de0: 6572 2077 6974 6820 7476 6563 2c20 6272 er with tvec, br │ │ │ -00080df0: 696e 6773 2070 6f69 6e74 7320 6672 6f6d ings points from │ │ │ -00080e00: 0a74 6865 206d 6f64 656c 2063 6f6f 7264 .the model coord │ │ │ -00080e10: 696e 6174 6520 7379 7374 656d 2074 6f20 inate system to │ │ │ -00080e20: 7468 6520 6361 6d65 7261 2063 6f6f 7264 the camera coord │ │ │ -00080e30: 696e 6174 6520 7379 7374 656d 2e20 496e inate system. In │ │ │ -00080e40: 7075 7420 7661 6c75 6573 2061 7265 2075 put values are u │ │ │ -00080e50: 7365 6420 6173 2061 6e20 696e 6974 6961 sed as an initia │ │ │ -00080e60: 6c20 736f 6c75 7469 6f6e 2e3c 2f64 643e l solution.
    │ │ │ -00080e70: 0a3c 6464 3e3c 636f 6465 3e74 7665 633c .
    tvec< │ │ │ -00080e80: 2f63 6f64 653e 202d 2049 6e70 7574 2f4f /code> - Input/O │ │ │ -00080e90: 7574 7075 7420 7472 616e 736c 6174 696f utput translatio │ │ │ -00080ea0: 6e20 7665 6374 6f72 2e20 496e 7075 7420 n vector. Input │ │ │ -00080eb0: 7661 6c75 6573 2061 7265 2075 7365 6420 values are used │ │ │ -00080ec0: 6173 2061 6e20 696e 6974 6961 6c20 736f as an initial so │ │ │ -00080ed0: 6c75 7469 6f6e 2e3c 2f64 643e 0a3c 6464 lution.
    .
    criteria< │ │ │ -00080ef0: 2f63 6f64 653e 202d 2043 7269 7465 7269 /code> - Criteri │ │ │ -00080f00: 6120 7768 656e 2074 6f20 7374 6f70 2074 a when to stop t │ │ │ -00080f10: 6865 204c 6576 656e 6265 7267 2d4d 6172 he Levenberg-Mar │ │ │ -00080f20: 7175 6172 6420 6974 6572 6174 6976 6520 quard iterative │ │ │ -00080f30: 616c 676f 7269 7468 6d2e 0a67 6169 6e20 algorithm..gain │ │ │ -00080f40: 696e 2074 6865 2044 616d 7065 6420 4761 in the Damped Ga │ │ │ -00080f50: 7573 732d 4e65 7774 6f6e 2066 6f72 6d75 uss-Newton formu │ │ │ -00080f60: 6c61 7469 6f6e 2e0a 0a54 6865 2066 756e lation...The fun │ │ │ -00080f70: 6374 696f 6e20 7265 6669 6e65 7320 7468 ction refines th │ │ │ -00080f80: 6520 6f62 6a65 6374 2070 6f73 6520 6769 e object pose gi │ │ │ -00080f90: 7665 6e20 6174 206c 6561 7374 2033 206f ven at least 3 o │ │ │ -00080fa0: 626a 6563 7420 706f 696e 7473 2c20 7468 bject points, th │ │ │ -00080fb0: 6569 7220 636f 7272 6573 706f 6e64 696e eir correspondin │ │ │ -00080fc0: 6720 696d 6167 650a 7072 6f6a 6563 7469 g image.projecti │ │ │ -00080fd0: 6f6e 732c 2061 6e20 696e 6974 6961 6c20 ons, an initial │ │ │ -00080fe0: 736f 6c75 7469 6f6e 2066 6f72 2074 6865 solution for the │ │ │ -00080ff0: 2072 6f74 6174 696f 6e20 616e 6420 7472 rotation and tr │ │ │ -00081000: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ -00081010: 2c0a 6173 2077 656c 6c20 6173 2074 6865 ,.as well as the │ │ │ -00081020: 2063 616d 6572 6120 696e 7472 696e 7369 camera intrinsi │ │ │ -00081030: 6320 6d61 7472 6978 2061 6e64 2074 6865 c matrix and the │ │ │ -00081040: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ -00081050: 6669 6369 656e 7473 2e0a 5468 6520 6675 ficients..The fu │ │ │ -00081060: 6e63 7469 6f6e 206d 696e 696d 697a 6573 nction minimizes │ │ │ -00081070: 2074 6865 2070 726f 6a65 6374 696f 6e20 the projection │ │ │ -00081080: 6572 726f 7220 7769 7468 2072 6573 7065 error with respe │ │ │ -00081090: 6374 2074 6f20 7468 6520 726f 7461 7469 ct to the rotati │ │ │ -000810a0: 6f6e 2061 6e64 2074 6865 2074 7261 6e73 on and the trans │ │ │ -000810b0: 6c61 7469 6f6e 2076 6563 746f 7273 2c20 lation vectors, │ │ │ -000810c0: 7573 696e 6720 610a 7669 7274 7561 6c20 using a.virtual │ │ │ -000810d0: 7669 7375 616c 2073 6572 766f 696e 6720 visual servoing │ │ │ -000810e0: 2856 5653 2920 4349 5445 3a20 4368 6175 (VVS) CITE: Chau │ │ │ -000810f0: 6d65 7474 6530 3620 4349 5445 3a20 4d61 mette06 CITE: Ma │ │ │ -00081100: 7263 6861 6e64 3136 2073 6368 656d 652e rchand16 scheme. │ │ │ -00081110: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ..

    ..
  • ..

    solvePnPRe │ │ │ -000811f0: 6669 6e65 5656 533c 2f68 333e 0a3c 6469 fineVVS

    ..public static │ │ │ -00081260: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  void solvePnPRefin │ │ │ -000812c0: 6556 5653 3c2f 7370 616e 3e3c 7762 723e eVVS │ │ │ -000812d0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ -00081330: 7370 3b6f 626a 6563 7450 6f69 6e74 732c sp;objectPoints, │ │ │ -00081340: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -00081380: 743c 2f61 3e26 6e62 7370 3b69 6d61 6765 t image │ │ │ -00081390: 506f 696e 7473 2c0a 203c 6120 6872 6566 Points,. Mat&nbs │ │ │ -000813e0: 703b 6361 6d65 7261 4d61 7472 6978 2c0a p;cameraMatrix,. │ │ │ -000813f0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -00081430: 3c2f 613e 266e 6273 703b 6469 7374 436f  distCo │ │ │ -00081440: 6566 6673 2c0a 203c 6120 6872 6566 3d22 effs,. Mat  │ │ │ -00081490: 7276 6563 2c0a 203c 6120 6872 6566 3d22 rvec,. Mat  │ │ │ -000814e0: 7476 6563 293c 2f73 7061 6e3e 3c2f 6469 tvec).
    Refine a p │ │ │ -00081510: 6f73 6520 2874 6865 2074 7261 6e73 6c61 ose (the transla │ │ │ -00081520: 7469 6f6e 2061 6e64 2074 6865 2072 6f74 tion and the rot │ │ │ -00081530: 6174 696f 6e20 7468 6174 2074 7261 6e73 ation that trans │ │ │ -00081540: 666f 726d 2061 2033 4420 706f 696e 7420 form a 3D point │ │ │ -00081550: 6578 7072 6573 7365 6420 696e 2074 6865 expressed in the │ │ │ -00081560: 206f 626a 6563 7420 636f 6f72 6469 6e61 object coordina │ │ │ -00081570: 7465 2066 7261 6d65 0a74 6f20 7468 6520 te frame.to the │ │ │ -00081580: 6361 6d65 7261 2063 6f6f 7264 696e 6174 camera coordinat │ │ │ -00081590: 6520 6672 616d 6529 2066 726f 6d20 6120 e frame) from a │ │ │ -000815a0: 3344 2d32 4420 706f 696e 7420 636f 7272 3D-2D point corr │ │ │ -000815b0: 6573 706f 6e64 656e 6365 7320 616e 6420 espondences and │ │ │ -000815c0: 7374 6172 7469 6e67 2066 726f 6d20 616e starting from an │ │ │ -000815d0: 2069 6e69 7469 616c 2073 6f6c 7574 696f initial solutio │ │ │ -000815e0: 6e2e 0a0a 5345 453a 2052 4546 3a20 6361 n...SEE: REF: ca │ │ │ -000815f0: 6c69 6233 645f 736f 6c76 6550 6e50 3c2f lib3d_solvePnP.
    .
    Para │ │ │ -00081620: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    objectPoi │ │ │ -00081640: 6e74 733c 2f63 6f64 653e 202d 2041 7272 nts - Arr │ │ │ -00081650: 6179 206f 6620 6f62 6a65 6374 2070 6f69 ay of object poi │ │ │ -00081660: 6e74 7320 696e 2074 6865 206f 626a 6563 nts in the objec │ │ │ -00081670: 7420 636f 6f72 6469 6e61 7465 2073 7061 t coordinate spa │ │ │ -00081680: 6365 2c20 4e78 3320 312d 6368 616e 6e65 ce, Nx3 1-channe │ │ │ -00081690: 6c20 6f72 2031 784e 2f4e 7831 2033 2d63 l or 1xN/Nx1 3-c │ │ │ -000816a0: 6861 6e6e 656c 2c0a 7768 6572 6520 4e20 hannel,.where N │ │ │ -000816b0: 6973 2074 6865 206e 756d 6265 7220 6f66 is the number of │ │ │ -000816c0: 2070 6f69 6e74 732e 2076 6563 746f 7226 points. vector& │ │ │ -000816d0: 6c74 3b50 6f69 6e74 3364 2667 743b 2063 lt;Point3d> c │ │ │ -000816e0: 616e 2061 6c73 6f20 6265 2070 6173 7365 an also be passe │ │ │ -000816f0: 6420 6865 7265 2e3c 2f64 643e 0a3c 6464 d here.
    .
    imagePoin │ │ │ -00081710: 7473 3c2f 636f 6465 3e20 2d20 4172 7261 ts - Arra │ │ │ -00081720: 7920 6f66 2063 6f72 7265 7370 6f6e 6469 y of correspondi │ │ │ -00081730: 6e67 2069 6d61 6765 2070 6f69 6e74 732c ng image points, │ │ │ -00081740: 204e 7832 2031 2d63 6861 6e6e 656c 206f Nx2 1-channel o │ │ │ -00081750: 7220 3178 4e2f 4e78 3120 322d 6368 616e r 1xN/Nx1 2-chan │ │ │ -00081760: 6e65 6c2c 0a77 6865 7265 204e 2069 7320 nel,.where N is │ │ │ -00081770: 7468 6520 6e75 6d62 6572 206f 6620 706f the number of po │ │ │ -00081780: 696e 7473 2e20 7665 6374 6f72 266c 743b ints. vector< │ │ │ -00081790: 506f 696e 7432 6426 6774 3b20 6361 6e20 Point2d> can │ │ │ -000817a0: 616c 736f 2062 6520 7061 7373 6564 2068 also be passed h │ │ │ -000817b0: 6572 652e 3c2f 6464 3e0a 3c64 643e 3c63 ere.
    .
    cameraMatrix │ │ │ -000817d0: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ -000817e0: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ -000817f0: 206d 6174 7269 7820 5c28 5c63 616d 6572 matrix \(\camer │ │ │ -00081800: 616d 6174 7269 787b 417d 5c29 202e 3c2f amatrix{A}\) ..
    di │ │ │ -00081820: 7374 436f 6566 6673 3c2f 636f 6465 3e20 stCoeffs │ │ │ -00081830: 2d20 496e 7075 7420 7665 6374 6f72 206f - Input vector o │ │ │ -00081840: 6620 6469 7374 6f72 7469 6f6e 2063 6f65 f distortion coe │ │ │ -00081850: 6666 6963 6965 6e74 730a 5c28 5c64 6973 fficients.\(\dis │ │ │ -00081860: 7463 6f65 6666 735c 292e 2049 6620 7468 tcoeffs\). If th │ │ │ -00081870: 6520 7665 6374 6f72 2069 7320 4e55 4c4c e vector is NULL │ │ │ -00081880: 2f65 6d70 7479 2c20 7468 6520 7a65 726f /empty, the zero │ │ │ -00081890: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ -000818a0: 6669 6369 656e 7473 2061 7265 0a61 7373 ficients are.ass │ │ │ -000818b0: 756d 6564 2e3c 2f64 643e 0a3c 6464 3e3c umed.
    .
    < │ │ │ -000818c0: 636f 6465 3e72 7665 633c 2f63 6f64 653e code>rvec │ │ │ -000818d0: 202d 2049 6e70 7574 2f4f 7574 7075 7420 - Input/Output │ │ │ -000818e0: 726f 7461 7469 6f6e 2076 6563 746f 7220 rotation vector │ │ │ -000818f0: 2873 6565 2052 4546 3a20 526f 6472 6967 (see REF: Rodrig │ │ │ -00081900: 7565 7320 2920 7468 6174 2c20 746f 6765 ues ) that, toge │ │ │ -00081910: 7468 6572 2077 6974 6820 7476 6563 2c20 ther with tvec, │ │ │ -00081920: 6272 696e 6773 2070 6f69 6e74 7320 6672 brings points fr │ │ │ -00081930: 6f6d 0a74 6865 206d 6f64 656c 2063 6f6f om.the model coo │ │ │ -00081940: 7264 696e 6174 6520 7379 7374 656d 2074 rdinate system t │ │ │ -00081950: 6f20 7468 6520 6361 6d65 7261 2063 6f6f o the camera coo │ │ │ -00081960: 7264 696e 6174 6520 7379 7374 656d 2e20 rdinate system. │ │ │ -00081970: 496e 7075 7420 7661 6c75 6573 2061 7265 Input values are │ │ │ -00081980: 2075 7365 6420 6173 2061 6e20 696e 6974 used as an init │ │ │ -00081990: 6961 6c20 736f 6c75 7469 6f6e 2e3c 2f64 ial solution..
    tve │ │ │ -000819b0: 633c 2f63 6f64 653e 202d 2049 6e70 7574 c - Input │ │ │ -000819c0: 2f4f 7574 7075 7420 7472 616e 736c 6174 /Output translat │ │ │ -000819d0: 696f 6e20 7665 6374 6f72 2e20 496e 7075 ion vector. Inpu │ │ │ -000819e0: 7420 7661 6c75 6573 2061 7265 2075 7365 t values are use │ │ │ -000819f0: 6420 6173 2061 6e20 696e 6974 6961 6c20 d as an initial │ │ │ -00081a00: 736f 6c75 7469 6f6e 2e0a 6761 696e 2069 solution..gain i │ │ │ -00081a10: 6e20 7468 6520 4461 6d70 6564 2047 6175 n the Damped Gau │ │ │ -00081a20: 7373 2d4e 6577 746f 6e20 666f 726d 756c ss-Newton formul │ │ │ -00081a30: 6174 696f 6e2e 0a0a 5468 6520 6675 6e63 ation...The func │ │ │ -00081a40: 7469 6f6e 2072 6566 696e 6573 2074 6865 tion refines the │ │ │ -00081a50: 206f 626a 6563 7420 706f 7365 2067 6976 object pose giv │ │ │ -00081a60: 656e 2061 7420 6c65 6173 7420 3320 6f62 en at least 3 ob │ │ │ -00081a70: 6a65 6374 2070 6f69 6e74 732c 2074 6865 ject points, the │ │ │ -00081a80: 6972 2063 6f72 7265 7370 6f6e 6469 6e67 ir corresponding │ │ │ -00081a90: 2069 6d61 6765 0a70 726f 6a65 6374 696f image.projectio │ │ │ -00081aa0: 6e73 2c20 616e 2069 6e69 7469 616c 2073 ns, an initial s │ │ │ -00081ab0: 6f6c 7574 696f 6e20 666f 7220 7468 6520 olution for the │ │ │ -00081ac0: 726f 7461 7469 6f6e 2061 6e64 2074 7261 rotation and tra │ │ │ -00081ad0: 6e73 6c61 7469 6f6e 2076 6563 746f 722c nslation vector, │ │ │ -00081ae0: 0a61 7320 7765 6c6c 2061 7320 7468 6520 .as well as the │ │ │ -00081af0: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ -00081b00: 206d 6174 7269 7820 616e 6420 7468 6520 matrix and the │ │ │ -00081b10: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ -00081b20: 6963 6965 6e74 732e 0a54 6865 2066 756e icients..The fun │ │ │ -00081b30: 6374 696f 6e20 6d69 6e69 6d69 7a65 7320 ction minimizes │ │ │ -00081b40: 7468 6520 7072 6f6a 6563 7469 6f6e 2065 the projection e │ │ │ -00081b50: 7272 6f72 2077 6974 6820 7265 7370 6563 rror with respec │ │ │ -00081b60: 7420 746f 2074 6865 2072 6f74 6174 696f t to the rotatio │ │ │ -00081b70: 6e20 616e 6420 7468 6520 7472 616e 736c n and the transl │ │ │ -00081b80: 6174 696f 6e20 7665 6374 6f72 732c 2075 ation vectors, u │ │ │ -00081b90: 7369 6e67 2061 0a76 6972 7475 616c 2076 sing a.virtual v │ │ │ -00081ba0: 6973 7561 6c20 7365 7276 6f69 6e67 2028 isual servoing ( │ │ │ -00081bb0: 5656 5329 2043 4954 453a 2043 6861 756d VVS) CITE: Chaum │ │ │ -00081bc0: 6574 7465 3036 2043 4954 453a 204d 6172 ette06 CITE: Mar │ │ │ -00081bd0: 6368 616e 6431 3620 7363 6865 6d65 2e3c chand16 scheme.< │ │ │ -00081be0: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    ...
  • .
    .

    solvePnPGeneric │ │ │ -00081d00: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ -00081d60: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -00081d70: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -00081d90: 696e 743c 2f73 7061 6e3e 266e 6273 703b int  │ │ │ -00081da0: 3c73 7061 6e20 636c 6173 733d 2265 6c65 solve │ │ │ -00081dc0: 506e 5047 656e 6572 6963 3c2f 7370 616e PnPGeneric( │ │ │ -00081df0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -00081e30: 2f61 3e26 6e62 7370 3b6f 626a 6563 7450 /a> objectP │ │ │ -00081e40: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ -00081e90: 3b69 6d61 6765 506f 696e 7473 2c0a 203c ;imagePoints,. < │ │ │ -00081ea0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00081eb0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00081ec0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00081ed0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ -00081ef0: 7472 6978 2c0a 203c 6120 6872 6566 3d22 trix,. Mat  │ │ │ -00081f40: 6469 7374 436f 6566 6673 2c0a 203c 6120 distCoeffs,. List&l │ │ │ -00081ff0: 743b 3c61 2068 7265 663d 222e 2e2f 636f t;Ma │ │ │ -00082030: 743c 2f61 3e26 6774 3b26 6e62 7370 3b72 t> r │ │ │ -00082040: 7665 6373 2c0a 203c 6120 6872 6566 3d22 vecs,. │ │ │ -000820e0: 4c69 7374 3c2f 613e 266c 743b 3c61 2068 List<Mat& │ │ │ -00082130: 6774 3b26 6e62 7370 3b74 7665 6373 2c0a gt; tvecs,. │ │ │ -00082140: 2062 6f6f 6c65 616e 266e 6273 703b 7573 boolean us │ │ │ -00082150: 6545 7874 7269 6e73 6963 4775 6573 732c eExtrinsicGuess, │ │ │ -00082160: 0a20 696e 7426 6e62 7370 3b66 6c61 6773 . int flags │ │ │ -00082170: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000821b0: 6174 3c2f 613e 266e 6273 703b 7276 6563 at rvec │ │ │ -000821c0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -00082200: 6174 3c2f 613e 266e 6273 703b 7476 6563 at tvec │ │ │ -00082210: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -00082250: 6174 3c2f 613e 266e 6273 703b 7265 7072 at repr │ │ │ -00082260: 6f6a 6563 7469 6f6e 4572 726f 7229 3c2f ojectionError)
    .
    F │ │ │ -00082290: 696e 6473 2061 6e20 6f62 6a65 6374 2070 inds an object p │ │ │ -000822a0: 6f73 6520 5c28 207b 7d5e 7b63 7d5c 6d61 ose \( {}^{c}\ma │ │ │ -000822b0: 7468 6266 7b54 7d5f 6f20 5c29 2066 726f thbf{T}_o \) fro │ │ │ -000822c0: 6d20 3344 2d32 4420 706f 696e 7420 636f m 3D-2D point co │ │ │ -000822d0: 7272 6573 706f 6e64 656e 6365 732e 0a0a rrespondences... │ │ │ -000822e0: 215b 5065 7273 7065 6374 6976 6520 7072 ![Perspective pr │ │ │ -000822f0: 6f6a 6563 7469 6f6e 2c20 6672 6f6d 206f ojection, from o │ │ │ -00082300: 626a 6563 7420 746f 2063 616d 6572 6120 bject to camera │ │ │ -00082310: 6672 616d 655d 2870 6963 732f 7069 6e68 frame](pics/pinh │ │ │ -00082320: 6f6c 655f 686f 6d6f 6765 6e65 6f75 735f ole_homogeneous_ │ │ │ -00082330: 7472 616e 7366 6f72 6d61 7469 6f6e 2e6a transformation.j │ │ │ -00082340: 7067 297b 2077 6964 7468 3d35 3025 207d pg){ width=50% } │ │ │ -00082350: 0a0a 5345 453a 2052 4546 3a20 6361 6c69 ..SEE: REF: cali │ │ │ -00082360: 6233 645f 736f 6c76 6550 6e50 0a0a 5468 b3d_solvePnP..Th │ │ │ -00082370: 6973 2066 756e 6374 696f 6e20 7265 7475 is function retu │ │ │ -00082380: 726e 7320 6120 6c69 7374 206f 6620 616c rns a list of al │ │ │ -00082390: 6c20 7468 6520 706f 7373 6962 6c65 2073 l the possible s │ │ │ -000823a0: 6f6c 7574 696f 6e73 2028 6120 736f 6c75 olutions (a solu │ │ │ -000823b0: 7469 6f6e 2069 7320 6120 266c 743b 726f tion is a <ro │ │ │ -000823c0: 7461 7469 6f6e 2076 6563 746f 722c 2074 tation vector, t │ │ │ -000823d0: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ -000823e0: 7226 6774 3b0a 636f 7570 6c65 292c 2064 r>.couple), d │ │ │ -000823f0: 6570 656e 6469 6e67 206f 6e20 7468 6520 epending on the │ │ │ -00082400: 6e75 6d62 6572 206f 6620 696e 7075 7420 number of input │ │ │ -00082410: 706f 696e 7473 2061 6e64 2074 6865 2063 points and the c │ │ │ -00082420: 686f 7365 6e20 6d65 7468 6f64 3a0a 3c75 hosen method:..
  • . P3P m │ │ │ -00082440: 6574 686f 6473 2028 5245 463a 2053 4f4c ethods (REF: SOL │ │ │ -00082450: 5645 504e 505f 5033 502c 2052 4546 3a20 VEPNP_P3P, REF: │ │ │ -00082460: 534f 4c56 4550 4e50 5f41 5033 5029 3a20 SOLVEPNP_AP3P): │ │ │ -00082470: 3320 6f72 2034 2069 6e70 7574 2070 6f69 3 or 4 input poi │ │ │ -00082480: 6e74 732e 204e 756d 6265 7220 6f66 2072 nts. Number of r │ │ │ -00082490: 6574 7572 6e65 6420 736f 6c75 7469 6f6e eturned solution │ │ │ -000824a0: 7320 6361 6e20 6265 2062 6574 7765 656e s can be between │ │ │ -000824b0: 2030 2061 6e64 2034 2077 6974 6820 3320 0 and 4 with 3 │ │ │ -000824c0: 696e 7075 7420 706f 696e 7473 2e0a 2020 input points.. │ │ │ -000824d0: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 5245
  • .
  • . RE │ │ │ -000824e0: 463a 2053 4f4c 5645 504e 505f 4950 5045 F: SOLVEPNP_IPPE │ │ │ -000824f0: 2049 6e70 7574 2070 6f69 6e74 7320 6d75 Input points mu │ │ │ -00082500: 7374 2062 6520 2667 743b 3d20 3420 616e st be >= 4 an │ │ │ -00082510: 6420 6f62 6a65 6374 2070 6f69 6e74 7320 d object points │ │ │ -00082520: 6d75 7374 2062 6520 636f 706c 616e 6172 must be coplanar │ │ │ -00082530: 2e20 5265 7475 726e 7320 3220 736f 6c75 . Returns 2 solu │ │ │ -00082540: 7469 6f6e 732e 0a20 203c 2f6c 693e 0a20 tions..
  • . │ │ │ -00082550: 203c 6c69 3e0a 2052 4546 3a20 534f 4c56
  • . REF: SOLV │ │ │ -00082560: 4550 4e50 5f49 5050 455f 5351 5541 5245 EPNP_IPPE_SQUARE │ │ │ -00082570: 2053 7065 6369 616c 2063 6173 6520 7375 Special case su │ │ │ -00082580: 6974 6162 6c65 2066 6f72 206d 6172 6b65 itable for marke │ │ │ -00082590: 7220 706f 7365 2065 7374 696d 6174 696f r pose estimatio │ │ │ -000825a0: 6e2e 0a4e 756d 6265 7220 6f66 2069 6e70 n..Number of inp │ │ │ -000825b0: 7574 2070 6f69 6e74 7320 6d75 7374 2062 ut points must b │ │ │ -000825c0: 6520 3420 616e 6420 3220 736f 6c75 7469 e 4 and 2 soluti │ │ │ -000825d0: 6f6e 7320 6172 6520 7265 7475 726e 6564 ons are returned │ │ │ -000825e0: 2e20 4f62 6a65 6374 2070 6f69 6e74 7320 . Object points │ │ │ -000825f0: 6d75 7374 2062 6520 6465 6669 6e65 6420 must be defined │ │ │ -00082600: 696e 2074 6865 2066 6f6c 6c6f 7769 6e67 in the following │ │ │ -00082610: 206f 7264 6572 3a0a 2020 3c75 6c3e 0a20 order:.
      . │ │ │ -00082620: 2020 203c 6c69 3e0a 2020 2070 6f69 6e74
    • . point │ │ │ -00082630: 2030 3a20 5b2d 7371 7561 7265 4c65 6e67 0: [-squareLeng │ │ │ -00082640: 7468 202f 2032 2c20 2073 7175 6172 654c th / 2, squareL │ │ │ -00082650: 656e 6774 6820 2f20 322c 2030 5d0a 2020 ength / 2, 0]. │ │ │ -00082660: 2020 3c2f 6c69 3e0a 2020 2020 3c6c 693e
    • .
    • │ │ │ -00082670: 0a20 2020 706f 696e 7420 313a 205b 2073 . point 1: [ s │ │ │ -00082680: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ -00082690: 2020 7371 7561 7265 4c65 6e67 7468 202f squareLength / │ │ │ -000826a0: 2032 2c20 305d 0a20 2020 203c 2f6c 693e 2, 0].
    • │ │ │ -000826b0: 0a20 2020 203c 6c69 3e0a 2020 2070 6f69 .
    • . poi │ │ │ -000826c0: 6e74 2032 3a20 5b20 7371 7561 7265 4c65 nt 2: [ squareLe │ │ │ -000826d0: 6e67 7468 202f 2032 2c20 2d73 7175 6172 ngth / 2, -squar │ │ │ -000826e0: 654c 656e 6774 6820 2f20 322c 2030 5d0a eLength / 2, 0]. │ │ │ -000826f0: 2020 2020 3c2f 6c69 3e0a 2020 2020 3c6c
    • . . point 3: [ │ │ │ -00082710: 2d73 7175 6172 654c 656e 6774 6820 2f20 -squareLength / │ │ │ -00082720: 322c 202d 7371 7561 7265 4c65 6e67 7468 2, -squareLength │ │ │ -00082730: 202f 2032 2c20 305d 0a20 2020 203c 2f6c / 2, 0]. .
    .
  • . for all the o │ │ │ -00082760: 7468 6572 2066 6c61 6773 2c20 6e75 6d62 ther flags, numb │ │ │ -00082770: 6572 206f 6620 696e 7075 7420 706f 696e er of input poin │ │ │ -00082780: 7473 206d 7573 7420 6265 2026 6774 3b3d ts must be >= │ │ │ -00082790: 2034 2061 6e64 206f 626a 6563 7420 706f 4 and object po │ │ │ -000827a0: 696e 7473 2063 616e 2062 6520 696e 2061 ints can be in a │ │ │ -000827b0: 6e79 2063 6f6e 6669 6775 7261 7469 6f6e ny configuration │ │ │ -000827c0: 2e0a 4f6e 6c79 2031 2073 6f6c 7574 696f ..Only 1 solutio │ │ │ -000827d0: 6e20 6973 2072 6574 7572 6e65 642e 0a20 n is returned.. │ │ │ -000827e0: 203c 2f6c 693e 0a3c 2f75 6c3e 3c2f 6469
  • ..
    .
    Parame │ │ │ -00082810: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ -00082820: 636f 6465 3e6f 626a 6563 7450 6f69 6e74 code>objectPoint │ │ │ -00082830: 733c 2f63 6f64 653e 202d 2041 7272 6179 s - Array │ │ │ -00082840: 206f 6620 6f62 6a65 6374 2070 6f69 6e74 of object point │ │ │ -00082850: 7320 696e 2074 6865 206f 626a 6563 7420 s in the object │ │ │ -00082860: 636f 6f72 6469 6e61 7465 2073 7061 6365 coordinate space │ │ │ -00082870: 2c20 4e78 3320 312d 6368 616e 6e65 6c20 , Nx3 1-channel │ │ │ -00082880: 6f72 0a31 784e 2f4e 7831 2033 2d63 6861 or.1xN/Nx1 3-cha │ │ │ -00082890: 6e6e 656c 2c20 7768 6572 6520 4e20 6973 nnel, where N is │ │ │ -000828a0: 2074 6865 206e 756d 6265 7220 6f66 2070 the number of p │ │ │ -000828b0: 6f69 6e74 732e 2076 6563 746f 7226 6c74 oints. vector< │ │ │ -000828c0: 3b50 6f69 6e74 3364 2667 743b 2063 616e ;Point3d> can │ │ │ -000828d0: 2062 6520 616c 736f 2070 6173 7365 6420 be also passed │ │ │ -000828e0: 6865 7265 2e3c 2f64 643e 0a3c 6464 3e3c here.
    .
    < │ │ │ -000828f0: 636f 6465 3e69 6d61 6765 506f 696e 7473 code>imagePoints │ │ │ -00082900: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ -00082910: 6f66 2063 6f72 7265 7370 6f6e 6469 6e67 of corresponding │ │ │ -00082920: 2069 6d61 6765 2070 6f69 6e74 732c 204e image points, N │ │ │ -00082930: 7832 2031 2d63 6861 6e6e 656c 206f 7220 x2 1-channel or │ │ │ -00082940: 3178 4e2f 4e78 3120 322d 6368 616e 6e65 1xN/Nx1 2-channe │ │ │ -00082950: 6c2c 0a77 6865 7265 204e 2069 7320 7468 l,.where N is th │ │ │ -00082960: 6520 6e75 6d62 6572 206f 6620 706f 696e e number of poin │ │ │ -00082970: 7473 2e20 7665 6374 6f72 266c 743b 506f ts. vector<Po │ │ │ -00082980: 696e 7432 6426 6774 3b20 6361 6e20 6265 int2d> can be │ │ │ -00082990: 2061 6c73 6f20 7061 7373 6564 2068 6572 also passed her │ │ │ -000829a0: 652e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 e.
    .
    cameraMatrix - Input ca │ │ │ -000829d0: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -000829e0: 6174 7269 7820 5c28 5c63 616d 6572 616d atrix \(\cameram │ │ │ -000829f0: 6174 7269 787b 417d 5c29 202e 3c2f 6464 atrix{A}\) .
    .
    dist │ │ │ -00082a10: 436f 6566 6673 3c2f 636f 6465 3e20 2d20 Coeffs - │ │ │ -00082a20: 496e 7075 7420 7665 6374 6f72 206f 6620 Input vector of │ │ │ -00082a30: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ -00082a40: 6963 6965 6e74 730a 5c28 5c64 6973 7463 icients.\(\distc │ │ │ -00082a50: 6f65 6666 735c 292e 2049 6620 7468 6520 oeffs\). If the │ │ │ -00082a60: 7665 6374 6f72 2069 7320 4e55 4c4c 2f65 vector is NULL/e │ │ │ -00082a70: 6d70 7479 2c20 7468 6520 7a65 726f 2064 mpty, the zero d │ │ │ -00082a80: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ -00082a90: 6369 656e 7473 2061 7265 0a61 7373 756d cients are.assum │ │ │ -00082aa0: 6564 2e3c 2f64 643e 0a3c 6464 3e3c 636f ed.
    .
    rvecs │ │ │ -00082ac0: 2d20 5665 6374 6f72 206f 6620 6f75 7470 - Vector of outp │ │ │ -00082ad0: 7574 2072 6f74 6174 696f 6e20 7665 6374 ut rotation vect │ │ │ -00082ae0: 6f72 7320 2873 6565 2052 4546 3a20 526f ors (see REF: Ro │ │ │ -00082af0: 6472 6967 7565 7320 2920 7468 6174 2c20 drigues ) that, │ │ │ -00082b00: 746f 6765 7468 6572 2077 6974 6820 7476 together with tv │ │ │ -00082b10: 6563 732c 2062 7269 6e67 7320 706f 696e ecs, brings poin │ │ │ -00082b20: 7473 2066 726f 6d0a 7468 6520 6d6f 6465 ts from.the mode │ │ │ -00082b30: 6c20 636f 6f72 6469 6e61 7465 2073 7973 l coordinate sys │ │ │ -00082b40: 7465 6d20 746f 2074 6865 2063 616d 6572 tem to the camer │ │ │ -00082b50: 6120 636f 6f72 6469 6e61 7465 2073 7973 a coordinate sys │ │ │ -00082b60: 7465 6d2e 3c2f 6464 3e0a 3c64 643e 3c63 tem.
    .
    tvecs │ │ │ -00082b80: 202d 2056 6563 746f 7220 6f66 206f 7574 - Vector of out │ │ │ -00082b90: 7075 7420 7472 616e 736c 6174 696f 6e20 put translation │ │ │ -00082ba0: 7665 6374 6f72 732e 3c2f 6464 3e0a 3c64 vectors.
    .useExtri │ │ │ -00082bc0: 6e73 6963 4775 6573 733c 2f63 6f64 653e nsicGuess │ │ │ -00082bd0: 202d 2050 6172 616d 6574 6572 2075 7365 - Parameter use │ │ │ -00082be0: 6420 666f 7220 2353 4f4c 5645 504e 505f d for #SOLVEPNP_ │ │ │ -00082bf0: 4954 4552 4154 4956 452e 2049 6620 7472 ITERATIVE. If tr │ │ │ -00082c00: 7565 2028 3129 2c20 7468 6520 6675 6e63 ue (1), the func │ │ │ -00082c10: 7469 6f6e 2075 7365 730a 7468 6520 7072 tion uses.the pr │ │ │ -00082c20: 6f76 6964 6564 2072 7665 6320 616e 6420 ovided rvec and │ │ │ -00082c30: 7476 6563 2076 616c 7565 7320 6173 2069 tvec values as i │ │ │ -00082c40: 6e69 7469 616c 2061 7070 726f 7869 6d61 nitial approxima │ │ │ -00082c50: 7469 6f6e 7320 6f66 2074 6865 2072 6f74 tions of the rot │ │ │ -00082c60: 6174 696f 6e20 616e 6420 7472 616e 736c ation and transl │ │ │ -00082c70: 6174 696f 6e0a 7665 6374 6f72 732c 2072 ation.vectors, r │ │ │ -00082c80: 6573 7065 6374 6976 656c 792c 2061 6e64 espectively, and │ │ │ -00082c90: 2066 7572 7468 6572 206f 7074 696d 697a further optimiz │ │ │ -00082ca0: 6573 2074 6865 6d2e 3c2f 6464 3e0a 3c64 es them..flags - Method fo │ │ │ -00082cd0: 7220 736f 6c76 696e 6720 6120 506e 5020 r solving a PnP │ │ │ -00082ce0: 7072 6f62 6c65 6d3a 2073 6565 2052 4546 problem: see REF │ │ │ -00082cf0: 3a20 6361 6c69 6233 645f 736f 6c76 6550 : calib3d_solveP │ │ │ -00082d00: 6e50 5f66 6c61 6773 3c2f 6464 3e0a 3c64 nP_flags.rvec - Rotation v │ │ │ -00082d30: 6563 746f 7220 7573 6564 2074 6f20 696e ector used to in │ │ │ -00082d40: 6974 6961 6c69 7a65 2061 6e20 6974 6572 itialize an iter │ │ │ -00082d50: 6174 6976 6520 506e 5020 7265 6669 6e65 ative PnP refine │ │ │ -00082d60: 6d65 6e74 2061 6c67 6f72 6974 686d 2c20 ment algorithm, │ │ │ -00082d70: 7768 656e 2066 6c61 6720 6973 2052 4546 when flag is REF │ │ │ -00082d80: 3a20 534f 4c56 4550 4e50 5f49 5445 5241 : SOLVEPNP_ITERA │ │ │ -00082d90: 5449 5645 0a61 6e64 2075 7365 4578 7472 TIVE.and useExtr │ │ │ -00082da0: 696e 7369 6347 7565 7373 2069 7320 7365 insicGuess is se │ │ │ -00082db0: 7420 746f 2074 7275 652e 3c2f 6464 3e0a t to true.. │ │ │ -00082dc0: 3c64 643e 3c63 6f64 653e 7476 6563 3c2f
    tvec - Translat │ │ │ -00082de0: 696f 6e20 7665 6374 6f72 2075 7365 6420 ion vector used │ │ │ -00082df0: 746f 2069 6e69 7469 616c 697a 6520 616e to initialize an │ │ │ -00082e00: 2069 7465 7261 7469 7665 2050 6e50 2072 iterative PnP r │ │ │ -00082e10: 6566 696e 656d 656e 7420 616c 676f 7269 efinement algori │ │ │ -00082e20: 7468 6d2c 2077 6865 6e20 666c 6167 2069 thm, when flag i │ │ │ -00082e30: 7320 5245 463a 2053 4f4c 5645 504e 505f s REF: SOLVEPNP_ │ │ │ -00082e40: 4954 4552 4154 4956 450a 616e 6420 7573 ITERATIVE.and us │ │ │ -00082e50: 6545 7874 7269 6e73 6963 4775 6573 7320 eExtrinsicGuess │ │ │ -00082e60: 6973 2073 6574 2074 6f20 7472 7565 2e3c is set to true.< │ │ │ -00082e70: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e72 /dd>.
    r │ │ │ -00082e80: 6570 726f 6a65 6374 696f 6e45 7272 6f72 eprojectionError │ │ │ -00082e90: 3c2f 636f 6465 3e20 2d20 4f70 7469 6f6e - Option │ │ │ -00082ea0: 616c 2076 6563 746f 7220 6f66 2072 6570 al vector of rep │ │ │ -00082eb0: 726f 6a65 6374 696f 6e20 6572 726f 722c rojection error, │ │ │ -00082ec0: 2074 6861 7420 6973 2074 6865 2052 4d53 that is the RMS │ │ │ -00082ed0: 2065 7272 6f72 0a28 5c28 205c 7465 7874 error.(\( \text │ │ │ -00082ee0: 7b52 4d53 457d 203d 205c 7371 7274 7b5c {RMSE} = \sqrt{\ │ │ │ -00082ef0: 6672 6163 7b5c 7375 6d5f 7b69 7d5e 7b4e frac{\sum_{i}^{N │ │ │ -00082f00: 7d20 5c6c 6566 7420 2820 5c68 6174 7b79 } \left ( \hat{y │ │ │ -00082f10: 5f69 7d20 2d20 795f 6920 5c72 6967 6874 _i} - y_i \right │ │ │ -00082f20: 2029 5e32 7d7b 4e7d 7d20 5c29 2920 6265 )^2}{N}} \)) be │ │ │ -00082f30: 7477 6565 6e20 7468 6520 696e 7075 7420 tween the input │ │ │ -00082f40: 696d 6167 6520 706f 696e 7473 0a61 6e64 image points.and │ │ │ -00082f50: 2074 6865 2033 4420 6f62 6a65 6374 2070 the 3D object p │ │ │ -00082f60: 6f69 6e74 7320 7072 6f6a 6563 7465 6420 oints projected │ │ │ -00082f70: 7769 7468 2074 6865 2065 7374 696d 6174 with the estimat │ │ │ -00082f80: 6564 2070 6f73 652e 0a0a 4d6f 7265 2069 ed pose...More i │ │ │ -00082f90: 6e66 6f72 6d61 7469 6f6e 2069 7320 6465 nformation is de │ │ │ -00082fa0: 7363 7269 6265 6420 696e 2052 4546 3a20 scribed in REF: │ │ │ -00082fb0: 6361 6c69 6233 645f 736f 6c76 6550 6e50 calib3d_solvePnP │ │ │ -00082fc0: 0a0a 3c62 3e4e 6f74 653a 3c2f 623e 0a3c ..Note:.< │ │ │ -00082fd0: 756c 3e0a 2020 3c6c 693e 0a20 2020 2020 ul>.
  • . │ │ │ -00082fe0: 2041 6e20 6578 616d 706c 6520 6f66 2068 An example of h │ │ │ -00082ff0: 6f77 2074 6f20 7573 6520 736f 6c76 6550 ow to use solveP │ │ │ -00083000: 6e50 2066 6f72 2070 6c61 6e61 7220 6175 nP for planar au │ │ │ -00083010: 676d 656e 7465 6420 7265 616c 6974 7920 gmented reality │ │ │ -00083020: 6361 6e20 6265 2066 6f75 6e64 2061 740a can be found at. │ │ │ -00083030: 2020 2020 2020 2020 6f70 656e 6376 5f73 opencv_s │ │ │ -00083040: 6f75 7263 655f 636f 6465 2f73 616d 706c ource_code/sampl │ │ │ -00083050: 6573 2f70 7974 686f 6e2f 706c 616e 655f es/python/plane_ │ │ │ -00083060: 6172 2e70 790a 2020 3c2f 6c69 3e0a 2020 ar.py.
  • . │ │ │ -00083070: 3c6c 693e 0a20 2020 2020 2049 6620 796f
  • . If yo │ │ │ -00083080: 7520 6172 6520 7573 696e 6720 5079 7468 u are using Pyth │ │ │ -00083090: 6f6e 3a0a 2020 3c75 6c3e 0a20 2020 203c on:.
      . < │ │ │ -000830a0: 6c69 3e0a 2020 2020 2020 2020 204e 756d li>. Num │ │ │ -000830b0: 7079 2061 7272 6179 2073 6c69 6365 7320 py array slices │ │ │ -000830c0: 776f 6e27 7420 776f 726b 2061 7320 696e won't work as in │ │ │ -000830d0: 7075 7420 6265 6361 7573 6520 736f 6c76 put because solv │ │ │ -000830e0: 6550 6e50 2072 6571 7569 7265 7320 636f ePnP requires co │ │ │ -000830f0: 6e74 6967 756f 7573 0a20 2020 2020 2020 ntiguous. │ │ │ -00083100: 2061 7272 6179 7320 2865 6e66 6f72 6365 arrays (enforce │ │ │ -00083110: 6420 6279 2074 6865 2061 7373 6572 7469 d by the asserti │ │ │ -00083120: 6f6e 2075 7369 6e67 2063 763a 3a4d 6174 on using cv::Mat │ │ │ -00083130: 3a3a 6368 6563 6b56 6563 746f 7228 2920 ::checkVector() │ │ │ -00083140: 6172 6f75 6e64 206c 696e 6520 3535 206f around line 55 o │ │ │ -00083150: 660a 2020 2020 2020 2020 6d6f 6475 6c65 f. module │ │ │ -00083160: 732f 3364 2f73 7263 2f73 6f6c 7665 706e s/3d/src/solvepn │ │ │ -00083170: 702e 6370 7020 7665 7273 696f 6e20 322e p.cpp version 2. │ │ │ -00083180: 342e 3929 0a20 2020 203c 2f6c 693e 0a20 4.9). . │ │ │ -00083190: 2020 203c 6c69 3e0a 2020 2020 2020 2020
    • . │ │ │ -000831a0: 2054 6865 2050 3350 2061 6c67 6f72 6974 The P3P algorit │ │ │ -000831b0: 686d 2072 6571 7569 7265 7320 696d 6167 hm requires imag │ │ │ -000831c0: 6520 706f 696e 7473 2074 6f20 6265 2069 e points to be i │ │ │ -000831d0: 6e20 616e 2061 7272 6179 206f 6620 7368 n an array of sh │ │ │ -000831e0: 6170 6520 284e 2c31 2c32 2920 6475 650a ape (N,1,2) due. │ │ │ -000831f0: 2020 2020 2020 2020 746f 2069 7473 2063 to its c │ │ │ -00083200: 616c 6c69 6e67 206f 6620 2375 6e64 6973 alling of #undis │ │ │ -00083210: 746f 7274 506f 696e 7473 2028 6172 6f75 tortPoints (arou │ │ │ -00083220: 6e64 206c 696e 6520 3735 206f 6620 6d6f nd line 75 of mo │ │ │ -00083230: 6475 6c65 732f 3364 2f73 7263 2f73 6f6c dules/3d/src/sol │ │ │ -00083240: 7665 706e 702e 6370 7020 7665 7273 696f vepnp.cpp versio │ │ │ -00083250: 6e20 322e 342e 3929 0a20 2020 2020 2020 n 2.4.9). │ │ │ -00083260: 2077 6869 6368 2072 6571 7569 7265 7320 which requires │ │ │ -00083270: 322d 6368 616e 6e65 6c20 696e 666f 726d 2-channel inform │ │ │ -00083280: 6174 696f 6e2e 0a20 2020 203c 2f6c 693e ation..
    • │ │ │ -00083290: 0a20 2020 203c 6c69 3e0a 2020 2020 2020 .
    • . │ │ │ -000832a0: 2020 2054 6875 732c 2067 6976 656e 2073 Thus, given s │ │ │ -000832b0: 6f6d 6520 6461 7461 2044 203d 206e 702e ome data D = np. │ │ │ -000832c0: 6172 7261 7928 2e2e 2e29 2077 6865 7265 array(...) where │ │ │ -000832d0: 2044 2e73 6861 7065 203d 2028 4e2c 4d29 D.shape = (N,M) │ │ │ -000832e0: 2c20 696e 206f 7264 6572 2074 6f20 7573 , in order to us │ │ │ -000832f0: 6520 6120 7375 6273 6574 206f 660a 2020 e a subset of. │ │ │ -00083300: 2020 2020 2020 6974 2061 732c 2065 2e67 it as, e.g │ │ │ -00083310: 2e2c 2069 6d61 6765 506f 696e 7473 2c20 ., imagePoints, │ │ │ -00083320: 6f6e 6520 6d75 7374 2065 6666 6563 7469 one must effecti │ │ │ -00083330: 7665 6c79 2063 6f70 7920 6974 2069 6e74 vely copy it int │ │ │ -00083340: 6f20 6120 6e65 7720 6172 7261 793a 2069 o a new array: i │ │ │ -00083350: 6d61 6765 506f 696e 7473 203d 0a20 2020 magePoints =. │ │ │ -00083360: 2020 2020 206e 702e 6173 636f 6e74 6967 np.ascontig │ │ │ -00083370: 756f 7573 6172 7261 7928 445b 3a2c 3a32 uousarray(D[:,:2 │ │ │ -00083380: 5d29 2e72 6573 6861 7065 2828 4e2c 312c ]).reshape((N,1, │ │ │ -00083390: 3229 290a 2020 2020 3c2f 6c69 3e0a 2020 2)).
    • . │ │ │ -000833a0: 3c2f 756c 3e0a 2020 3c6c 693e 0a20 2020
    .
  • . │ │ │ -000833b0: 2020 2054 6865 206d 696e 696d 756d 206e The minimum n │ │ │ -000833c0: 756d 6265 7220 6f66 2070 6f69 6e74 7320 umber of points │ │ │ -000833d0: 6973 2034 2069 6e20 7468 6520 6765 6e65 is 4 in the gene │ │ │ -000833e0: 7261 6c20 6361 7365 2e20 496e 2074 6865 ral case. In the │ │ │ -000833f0: 2063 6173 6520 6f66 2052 4546 3a20 534f case of REF: SO │ │ │ -00083400: 4c56 4550 4e50 5f50 3350 2061 6e64 2052 LVEPNP_P3P and R │ │ │ -00083410: 4546 3a20 534f 4c56 4550 4e50 5f41 5033 EF: SOLVEPNP_AP3 │ │ │ -00083420: 500a 2020 2020 2020 206d 6574 686f 6473 P. methods │ │ │ -00083430: 2c20 6974 2069 7320 7265 7175 6972 6564 , it is required │ │ │ -00083440: 2074 6f20 7573 6520 6578 6163 746c 7920 to use exactly │ │ │ -00083450: 3420 706f 696e 7473 2028 7468 6520 6669 4 points (the fi │ │ │ -00083460: 7273 7420 3320 706f 696e 7473 2061 7265 rst 3 points are │ │ │ -00083470: 2075 7365 6420 746f 2065 7374 696d 6174 used to estimat │ │ │ -00083480: 6520 616c 6c20 7468 6520 736f 6c75 7469 e all the soluti │ │ │ -00083490: 6f6e 730a 2020 2020 2020 206f 6620 7468 ons. of th │ │ │ -000834a0: 6520 5033 5020 7072 6f62 6c65 6d2c 2074 e P3P problem, t │ │ │ -000834b0: 6865 206c 6173 7420 6f6e 6520 6973 2075 he last one is u │ │ │ -000834c0: 7365 6420 746f 2072 6574 6169 6e20 7468 sed to retain th │ │ │ -000834d0: 6520 6265 7374 2073 6f6c 7574 696f 6e20 e best solution │ │ │ -000834e0: 7468 6174 206d 696e 696d 697a 6573 2074 that minimizes t │ │ │ -000834f0: 6865 2072 6570 726f 6a65 6374 696f 6e20 he reprojection │ │ │ -00083500: 6572 726f 7229 2e0a 2020 3c2f 6c69 3e0a error)..
  • . │ │ │ -00083510: 2020 3c6c 693e 0a20 2020 2020 2057 6974
  • . Wit │ │ │ -00083520: 6820 5245 463a 2053 4f4c 5645 504e 505f h REF: SOLVEPNP_ │ │ │ -00083530: 4954 4552 4154 4956 4520 6d65 7468 6f64 ITERATIVE method │ │ │ -00083540: 2061 6e64 203c 636f 6465 3e75 7365 4578 and useEx │ │ │ -00083550: 7472 696e 7369 6347 7565 7373 3d74 7275 trinsicGuess=tru │ │ │ -00083560: 653c 2f63 6f64 653e 2c20 7468 6520 6d69 e, the mi │ │ │ -00083570: 6e69 6d75 6d20 6e75 6d62 6572 206f 6620 nimum number of │ │ │ -00083580: 706f 696e 7473 2069 7320 3320 2833 2070 points is 3 (3 p │ │ │ -00083590: 6f69 6e74 730a 2020 2020 2020 2061 7265 oints. are │ │ │ -000835a0: 2073 7566 6669 6369 656e 7420 746f 2063 sufficient to c │ │ │ -000835b0: 6f6d 7075 7465 2061 2070 6f73 6520 6275 ompute a pose bu │ │ │ -000835c0: 7420 7468 6572 6520 6172 6520 7570 2074 t there are up t │ │ │ -000835d0: 6f20 3420 736f 6c75 7469 6f6e 7329 2e20 o 4 solutions). │ │ │ -000835e0: 5468 6520 696e 6974 6961 6c20 736f 6c75 The initial solu │ │ │ -000835f0: 7469 6f6e 2073 686f 756c 6420 6265 2063 tion should be c │ │ │ -00083600: 6c6f 7365 2074 6f20 7468 650a 2020 2020 lose to the. │ │ │ -00083610: 2020 2067 6c6f 6261 6c20 736f 6c75 7469 global soluti │ │ │ -00083620: 6f6e 2074 6f20 636f 6e76 6572 6765 2e0a on to converge.. │ │ │ -00083630: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
  • .
  • . │ │ │ -00083640: 2020 2020 2057 6974 6820 5245 463a 2053 With REF: S │ │ │ -00083650: 4f4c 5645 504e 505f 4950 5045 2069 6e70 OLVEPNP_IPPE inp │ │ │ -00083660: 7574 2070 6f69 6e74 7320 6d75 7374 2062 ut points must b │ │ │ -00083670: 6520 2667 743b 3d20 3420 616e 6420 6f62 e >= 4 and ob │ │ │ -00083680: 6a65 6374 2070 6f69 6e74 7320 6d75 7374 ject points must │ │ │ -00083690: 2062 6520 636f 706c 616e 6172 2e0a 2020 be coplanar.. │ │ │ -000836a0: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020
  • .
  • . │ │ │ -000836b0: 2020 2057 6974 6820 5245 463a 2053 4f4c With REF: SOL │ │ │ -000836c0: 5645 504e 505f 4950 5045 5f53 5155 4152 VEPNP_IPPE_SQUAR │ │ │ -000836d0: 4520 7468 6973 2069 7320 6120 7370 6563 E this is a spec │ │ │ -000836e0: 6961 6c20 6361 7365 2073 7569 7461 626c ial case suitabl │ │ │ -000836f0: 6520 666f 7220 6d61 726b 6572 2070 6f73 e for marker pos │ │ │ -00083700: 6520 6573 7469 6d61 7469 6f6e 2e0a 2020 e estimation.. │ │ │ -00083710: 2020 2020 204e 756d 6265 7220 6f66 2069 Number of i │ │ │ -00083720: 6e70 7574 2070 6f69 6e74 7320 6d75 7374 nput points must │ │ │ -00083730: 2062 6520 342e 204f 626a 6563 7420 706f be 4. Object po │ │ │ -00083740: 696e 7473 206d 7573 7420 6265 2064 6566 ints must be def │ │ │ -00083750: 696e 6564 2069 6e20 7468 6520 666f 6c6c ined in the foll │ │ │ -00083760: 6f77 696e 6720 6f72 6465 723a 0a20 203c owing order:. < │ │ │ -00083770: 756c 3e0a 2020 2020 3c6c 693e 0a20 2020 ul>.
  • . │ │ │ -00083780: 2020 2020 2020 2070 6f69 6e74 2030 3a20 point 0: │ │ │ -00083790: 5b2d 7371 7561 7265 4c65 6e67 7468 202f [-squareLength / │ │ │ -000837a0: 2032 2c20 2073 7175 6172 654c 656e 6774 2, squareLengt │ │ │ -000837b0: 6820 2f20 322c 2030 5d0a 2020 2020 3c2f h / 2, 0]. .
  • . │ │ │ -000837d0: 2020 2020 2020 2070 6f69 6e74 2031 3a20 point 1: │ │ │ -000837e0: 5b20 7371 7561 7265 4c65 6e67 7468 202f [ squareLength / │ │ │ -000837f0: 2032 2c20 2073 7175 6172 654c 656e 6774 2, squareLengt │ │ │ -00083800: 6820 2f20 322c 2030 5d0a 2020 2020 3c2f h / 2, 0]. .
  • . │ │ │ -00083820: 2020 2020 2020 2070 6f69 6e74 2032 3a20 point 2: │ │ │ -00083830: 5b20 7371 7561 7265 4c65 6e67 7468 202f [ squareLength / │ │ │ -00083840: 2032 2c20 2d73 7175 6172 654c 656e 6774 2, -squareLengt │ │ │ -00083850: 6820 2f20 322c 2030 5d0a 2020 2020 3c2f h / 2, 0]. .
  • . │ │ │ -00083870: 2020 2020 2020 2070 6f69 6e74 2033 3a20 point 3: │ │ │ -00083880: 5b2d 7371 7561 7265 4c65 6e67 7468 202f [-squareLength / │ │ │ -00083890: 2032 2c20 2d73 7175 6172 654c 656e 6774 2, -squareLengt │ │ │ -000838a0: 6820 2f20 322c 2030 5d0a 2020 2020 3c2f h / 2, 0]. . . . With RE │ │ │ -000838d0: 463a 2053 4f4c 5645 504e 505f 5351 504e F: SOLVEPNP_SQPN │ │ │ -000838e0: 5020 696e 7075 7420 706f 696e 7473 206d P input points m │ │ │ -000838f0: 7573 7420 6265 2026 6774 3b3d 2033 0a20 ust be >= 3. │ │ │ -00083900: 203c 2f6c 693e 0a3c 2f75 6c3e 3c2f 6464
  • .
    .
    Returns:.
    automati │ │ │ -00083930: 6361 6c6c 7920 6765 6e65 7261 7465 643c cally generated< │ │ │ -00083940: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .
    ..
  • . │ │ │ -0008bff0: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    conver │ │ │ -0008c060: 7450 6f69 6e74 7354 6f48 6f6d 6f67 656e tPointsToHomogen │ │ │ -0008c070: 656f 7573 3c2f 6833 3e0a 3c64 6976 2063 eous

    .
    .
    │ │ │ -0008c0d0: 7075 626c 6963 2073 7461 7469 633c 2f73 public static void& │ │ │ -0008c110: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -0008c130: 636f 6e76 6572 7450 6f69 6e74 7354 6f48 convertPointsToH │ │ │ -0008c140: 6f6d 6f67 656e 656f 7573 3c2f 7370 616e omogeneous( │ │ │ -0008c170: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0008c1b0: 2f61 3e26 6e62 7370 3b73 7263 2c0a 203c /a> src,. < │ │ │ -0008c1c0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0008c1d0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0008c1e0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0008c1f0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dst,. in │ │ │ -0008c210: 7426 6e62 7370 3b64 7479 7065 293c 2f73 t dtype)
    .
    Co │ │ │ -0008c240: 6e76 6572 7473 2070 6f69 6e74 7320 6672 nverts points fr │ │ │ -0008c250: 6f6d 2045 7563 6c69 6465 616e 2074 6f20 om Euclidean to │ │ │ -0008c260: 686f 6d6f 6765 6e65 6f75 7320 7370 6163 homogeneous spac │ │ │ -0008c270: 652e 3c2f 6469 763e 0a3c 646c 2063 6c61 e.
    .
    .
    │ │ │ -0008c290: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ -0008c2a0: 0a3c 6464 3e3c 636f 6465 3e73 7263 3c2f .
    src - Input ve │ │ │ -0008c2c0: 6374 6f72 206f 6620 4e2d 6469 6d65 6e73 ctor of N-dimens │ │ │ -0008c2d0: 696f 6e61 6c20 706f 696e 7473 2e3c 2f64 ional points..
    dst │ │ │ -0008c2f0: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ -0008c300: 2076 6563 746f 7220 6f66 204e 2b31 2d64 vector of N+1-d │ │ │ -0008c310: 696d 656e 7369 6f6e 616c 2070 6f69 6e74 imensional point │ │ │ -0008c320: 732e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 s.
    .
    dtype - │ │ │ -0008c340: 2054 6865 2064 6573 6972 6564 206f 7574 The desired out │ │ │ -0008c350: 7075 7420 6172 7261 7920 6465 7074 6820 put array depth │ │ │ -0008c360: 2865 6974 6865 7220 4356 5f33 3246 206f (either CV_32F o │ │ │ -0008c370: 7220 4356 5f36 3446 2061 7265 2063 7572 r CV_64F are cur │ │ │ -0008c380: 7265 6e74 6c79 2073 7570 706f 7274 6564 rently supported │ │ │ -0008c390: 292e 0a20 2020 2049 6620 6974 2773 202d ).. If it's - │ │ │ -0008c3a0: 312c 2074 6865 6e20 6974 2773 2073 6574 1, then it's set │ │ │ -0008c3b0: 2061 7574 6f6d 6174 6963 616c 6c79 2074 automatically t │ │ │ -0008c3c0: 6f20 4356 5f33 3246 206f 7220 4356 5f36 o CV_32F or CV_6 │ │ │ -0008c3d0: 3446 2c20 6465 7065 6e64 696e 6720 6f6e 4F, depending on │ │ │ -0008c3e0: 2074 6865 2069 6e70 7574 2064 6570 7468 the input depth │ │ │ -0008c3f0: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ -0008c400: 636f 6e76 6572 7473 2070 6f69 6e74 7320 converts points │ │ │ -0008c410: 6672 6f6d 2045 7563 6c69 6465 616e 2074 from Euclidean t │ │ │ -0008c420: 6f20 686f 6d6f 6765 6e65 6f75 7320 7370 o homogeneous sp │ │ │ -0008c430: 6163 6520 6279 2061 7070 656e 6469 6e67 ace by appending │ │ │ -0008c440: 2031 2773 2074 6f20 7468 6520 7475 706c 1's to the tupl │ │ │ -0008c450: 6520 6f66 0a70 6f69 6e74 2063 6f6f 7264 e of.point coord │ │ │ -0008c460: 696e 6174 6573 2e20 5468 6174 2069 732c inates. That is, │ │ │ -0008c470: 2065 6163 6820 706f 696e 7420 2878 312c each point (x1, │ │ │ -0008c480: 2078 322c 202e 2e2e 2c20 786e 2920 6973 x2, ..., xn) is │ │ │ -0008c490: 2063 6f6e 7665 7274 6564 2074 6f20 2878 converted to (x │ │ │ -0008c4a0: 312c 2078 322c 202e 2e2e 2c20 786e 2c20 1, x2, ..., xn, │ │ │ -0008c4b0: 3129 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c 1).
    .
    .< │ │ │ -0008c4c0: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ -0008c4d0: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..convertPointsT │ │ │ -0008c550: 6f48 6f6d 6f67 656e 656f 7573 3c2f 6833 oHomogeneous.
    ..
    Converts po │ │ │ -0008c720: 696e 7473 2066 726f 6d20 4575 636c 6964 ints from Euclid │ │ │ -0008c730: 6561 6e20 746f 2068 6f6d 6f67 656e 656f ean to homogeneo │ │ │ -0008c740: 7573 2073 7061 6365 2e3c 2f64 6976 3e0a us space.
    . │ │ │ -0008c750: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ -0008c770: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    src - I │ │ │ -0008c790: 6e70 7574 2076 6563 746f 7220 6f66 204e nput vector of N │ │ │ -0008c7a0: 2d64 696d 656e 7369 6f6e 616c 2070 6f69 -dimensional poi │ │ │ -0008c7b0: 6e74 732e 3c2f 6464 3e0a 3c64 643e 3c63 nts.
    .
    dst - │ │ │ -0008c7d0: 204f 7574 7075 7420 7665 6374 6f72 206f Output vector o │ │ │ -0008c7e0: 6620 4e2b 312d 6469 6d65 6e73 696f 6e61 f N+1-dimensiona │ │ │ -0008c7f0: 6c20 706f 696e 7473 2e0a 2020 2020 4966 l points.. If │ │ │ -0008c800: 2069 7427 7320 2d31 2c20 7468 656e 2069 it's -1, then i │ │ │ -0008c810: 7427 7320 7365 7420 6175 746f 6d61 7469 t's set automati │ │ │ -0008c820: 6361 6c6c 7920 746f 2043 565f 3332 4620 cally to CV_32F │ │ │ -0008c830: 6f72 2043 565f 3634 462c 2064 6570 656e or CV_64F, depen │ │ │ -0008c840: 6469 6e67 206f 6e20 7468 6520 696e 7075 ding on the inpu │ │ │ -0008c850: 7420 6465 7074 682e 0a0a 5468 6520 6675 t depth...The fu │ │ │ -0008c860: 6e63 7469 6f6e 2063 6f6e 7665 7274 7320 nction converts │ │ │ -0008c870: 706f 696e 7473 2066 726f 6d20 4575 636c points from Eucl │ │ │ -0008c880: 6964 6561 6e20 746f 2068 6f6d 6f67 656e idean to homogen │ │ │ -0008c890: 656f 7573 2073 7061 6365 2062 7920 6170 eous space by ap │ │ │ -0008c8a0: 7065 6e64 696e 6720 3127 7320 746f 2074 pending 1's to t │ │ │ -0008c8b0: 6865 2074 7570 6c65 206f 660a 706f 696e he tuple of.poin │ │ │ -0008c8c0: 7420 636f 6f72 6469 6e61 7465 732e 2054 t coordinates. T │ │ │ -0008c8d0: 6861 7420 6973 2c20 6561 6368 2070 6f69 hat is, each poi │ │ │ -0008c8e0: 6e74 2028 7831 2c20 7832 2c20 2e2e 2e2c nt (x1, x2, ..., │ │ │ -0008c8f0: 2078 6e29 2069 7320 636f 6e76 6572 7465 xn) is converte │ │ │ -0008c900: 6420 746f 2028 7831 2c20 7832 2c20 2e2e d to (x1, x2, .. │ │ │ -0008c910: 2e2c 2078 6e2c 2031 292e 3c2f 6464 3e0a ., xn, 1).
    . │ │ │ -0008c920: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    ..
  • ..
    .

    c │ │ │ -0008c9b0: 6f6e 7665 7274 506f 696e 7473 4672 6f6d onvertPointsFrom │ │ │ -0008c9c0: 486f 6d6f 6765 6e65 6f75 733c 2f68 333e Homogeneous

    │ │ │ -0008c9d0: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ -0008c9f0: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ -0008ca10: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ -0008ca20: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ -0008ca30: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ -0008ca40: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;void< │ │ │ -0008ca60: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> convertPo │ │ │ -0008ca90: 696e 7473 4672 6f6d 486f 6d6f 6765 6e65 intsFromHomogene │ │ │ -0008caa0: 6f75 733c 2f73 7061 6e3e 3c77 6272 3e3c ous< │ │ │ -0008cab0: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ -0008cac0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ -0008cb10: 703b 7372 632c 0a20 3c61 2068 7265 663d p;src,. Mat  │ │ │ -0008cb60: 3b64 7374 2c0a 2069 6e74 266e 6273 703b ;dst,. int  │ │ │ -0008cb70: 6474 7970 6529 3c2f 7370 616e 3e3c 2f64 dtype).
    Converts │ │ │ -0008cba0: 706f 696e 7473 2066 726f 6d20 686f 6d6f points from homo │ │ │ -0008cbb0: 6765 6e65 6f75 7320 746f 2045 7563 6c69 geneous to Eucli │ │ │ -0008cbc0: 6465 616e 2073 7061 6365 2e3c 2f64 6976 dean space.
    .
    .
    Paramet │ │ │ -0008cbf0: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    src - │ │ │ -0008cc10: 2049 6e70 7574 2076 6563 746f 7220 6f66 Input vector of │ │ │ -0008cc20: 204e 2d64 696d 656e 7369 6f6e 616c 2070 N-dimensional p │ │ │ -0008cc30: 6f69 6e74 732e 3c2f 6464 3e0a 3c64 643e oints.
    .
    │ │ │ -0008cc40: 3c63 6f64 653e 6473 743c 2f63 6f64 653e dst │ │ │ -0008cc50: 202d 204f 7574 7075 7420 7665 6374 6f72 - Output vector │ │ │ -0008cc60: 206f 6620 4e2d 312d 6469 6d65 6e73 696f of N-1-dimensio │ │ │ -0008cc70: 6e61 6c20 706f 696e 7473 2e3c 2f64 643e nal points.
    │ │ │ -0008cc80: 0a3c 6464 3e3c 636f 6465 3e64 7479 7065 .
    dtype │ │ │ -0008cc90: 3c2f 636f 6465 3e20 2d20 5468 6520 6465 - The de │ │ │ -0008cca0: 7369 7265 6420 6f75 7470 7574 2061 7272 sired output arr │ │ │ -0008ccb0: 6179 2064 6570 7468 2028 6569 7468 6572 ay depth (either │ │ │ -0008ccc0: 2043 565f 3332 4620 6f72 2043 565f 3634 CV_32F or CV_64 │ │ │ -0008ccd0: 4620 6172 6520 6375 7272 656e 746c 7920 F are currently │ │ │ -0008cce0: 7375 7070 6f72 7465 6429 2e0a 2020 2020 supported).. │ │ │ -0008ccf0: 4966 2069 7427 7320 2d31 2c20 7468 656e If it's -1, then │ │ │ -0008cd00: 2069 7427 7320 7365 7420 6175 746f 6d61 it's set automa │ │ │ -0008cd10: 7469 6361 6c6c 7920 746f 2043 565f 3332 tically to CV_32 │ │ │ -0008cd20: 4620 6f72 2043 565f 3634 462c 2064 6570 F or CV_64F, dep │ │ │ -0008cd30: 656e 6469 6e67 206f 6e20 7468 6520 696e ending on the in │ │ │ -0008cd40: 7075 7420 6465 7074 682e 0a0a 5468 6520 put depth...The │ │ │ -0008cd50: 6675 6e63 7469 6f6e 2063 6f6e 7665 7274 function convert │ │ │ -0008cd60: 7320 706f 696e 7473 2068 6f6d 6f67 656e s points homogen │ │ │ -0008cd70: 656f 7573 2074 6f20 4575 636c 6964 6561 eous to Euclidea │ │ │ -0008cd80: 6e20 7370 6163 6520 7573 696e 6720 7065 n space using pe │ │ │ -0008cd90: 7273 7065 6374 6976 6520 7072 6f6a 6563 rspective projec │ │ │ -0008cda0: 7469 6f6e 2e20 5468 6174 2069 732c 0a65 tion. That is,.e │ │ │ -0008cdb0: 6163 6820 706f 696e 7420 2878 312c 2078 ach point (x1, x │ │ │ -0008cdc0: 322c 202e 2e2e 2078 286e 2d31 292c 2078 2, ... x(n-1), x │ │ │ -0008cdd0: 6e29 2069 7320 636f 6e76 6572 7465 6420 n) is converted │ │ │ -0008cde0: 746f 2028 7831 2f78 6e2c 2078 322f 786e to (x1/xn, x2/xn │ │ │ -0008cdf0: 2c20 2e2e 2e2c 2078 286e 2d31 292f 786e , ..., x(n-1)/xn │ │ │ -0008ce00: 292e 2057 6865 6e20 786e 3d30 2c20 7468 ). When xn=0, th │ │ │ -0008ce10: 650a 6f75 7470 7574 2070 6f69 6e74 2063 e.output point c │ │ │ -0008ce20: 6f6f 7264 696e 6174 6573 2077 696c 6c20 oordinates will │ │ │ -0008ce30: 6265 2028 302c 302c 302c 2e2e 2e29 2e3c be (0,0,0,...).< │ │ │ -0008ce40: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .
    .
    .
  • .
    .

    │ │ │ -0008ced0: 636f 6e76 6572 7450 6f69 6e74 7346 726f convertPointsFro │ │ │ -0008cee0: 6d48 6f6d 6f67 656e 656f 7573 3c2f 6833 mHomogeneous

    .
    .
    │ │ │ -0008cf30: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -0008cf50: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -0008cf60: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;void │ │ │ -0008cf80: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  convertP │ │ │ -0008cfb0: 6f69 6e74 7346 726f 6d48 6f6d 6f67 656e ointsFromHomogen │ │ │ -0008cfc0: 656f 7573 3c2f 7370 616e 3e3c 7762 723e eous │ │ │ -0008cfd0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ -0008d030: 7370 3b73 7263 2c0a 203c 6120 6872 6566 sp;src,. Mat&nbs │ │ │ -0008d080: 703b 6473 7429 3c2f 7370 616e 3e3c 2f64 p;dst).
    Converts │ │ │ -0008d0b0: 706f 696e 7473 2066 726f 6d20 686f 6d6f points from homo │ │ │ -0008d0c0: 6765 6e65 6f75 7320 746f 2045 7563 6c69 geneous to Eucli │ │ │ -0008d0d0: 6465 616e 2073 7061 6365 2e3c 2f64 6976 dean space.
    .
    .
    Paramet │ │ │ -0008d100: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    src - │ │ │ -0008d120: 2049 6e70 7574 2076 6563 746f 7220 6f66 Input vector of │ │ │ -0008d130: 204e 2d64 696d 656e 7369 6f6e 616c 2070 N-dimensional p │ │ │ -0008d140: 6f69 6e74 732e 3c2f 6464 3e0a 3c64 643e oints.
    .
    │ │ │ -0008d150: 3c63 6f64 653e 6473 743c 2f63 6f64 653e dst │ │ │ -0008d160: 202d 204f 7574 7075 7420 7665 6374 6f72 - Output vector │ │ │ -0008d170: 206f 6620 4e2d 312d 6469 6d65 6e73 696f of N-1-dimensio │ │ │ -0008d180: 6e61 6c20 706f 696e 7473 2e0a 2020 2020 nal points.. │ │ │ -0008d190: 4966 2069 7427 7320 2d31 2c20 7468 656e If it's -1, then │ │ │ -0008d1a0: 2069 7427 7320 7365 7420 6175 746f 6d61 it's set automa │ │ │ -0008d1b0: 7469 6361 6c6c 7920 746f 2043 565f 3332 tically to CV_32 │ │ │ -0008d1c0: 4620 6f72 2043 565f 3634 462c 2064 6570 F or CV_64F, dep │ │ │ -0008d1d0: 656e 6469 6e67 206f 6e20 7468 6520 696e ending on the in │ │ │ -0008d1e0: 7075 7420 6465 7074 682e 0a0a 5468 6520 put depth...The │ │ │ -0008d1f0: 6675 6e63 7469 6f6e 2063 6f6e 7665 7274 function convert │ │ │ -0008d200: 7320 706f 696e 7473 2068 6f6d 6f67 656e s points homogen │ │ │ -0008d210: 656f 7573 2074 6f20 4575 636c 6964 6561 eous to Euclidea │ │ │ -0008d220: 6e20 7370 6163 6520 7573 696e 6720 7065 n space using pe │ │ │ -0008d230: 7273 7065 6374 6976 6520 7072 6f6a 6563 rspective projec │ │ │ -0008d240: 7469 6f6e 2e20 5468 6174 2069 732c 0a65 tion. That is,.e │ │ │ -0008d250: 6163 6820 706f 696e 7420 2878 312c 2078 ach point (x1, x │ │ │ -0008d260: 322c 202e 2e2e 2078 286e 2d31 292c 2078 2, ... x(n-1), x │ │ │ -0008d270: 6e29 2069 7320 636f 6e76 6572 7465 6420 n) is converted │ │ │ -0008d280: 746f 2028 7831 2f78 6e2c 2078 322f 786e to (x1/xn, x2/xn │ │ │ -0008d290: 2c20 2e2e 2e2c 2078 286e 2d31 292f 786e , ..., x(n-1)/xn │ │ │ -0008d2a0: 292e 2057 6865 6e20 786e 3d30 2c20 7468 ). When xn=0, th │ │ │ -0008d2b0: 650a 6f75 7470 7574 2070 6f69 6e74 2063 e.output point c │ │ │ -0008d2c0: 6f6f 7264 696e 6174 6573 2077 696c 6c20 oordinates will │ │ │ -0008d2d0: 6265 2028 302c 302c 302c 2e2e 2e29 2e3c be (0,0,0,...).< │ │ │ -0008d2e0: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .
    ..
  • .
    .findFundamenta │ │ │ -0008d3b0: 6c4d 6174 3c2f 6833 3e0a 3c64 6976 2063 lMat.
    .
    │ │ │ -0008d410: 7075 626c 6963 2073 7461 7469 633c 2f73 public static  │ │ │ -0008d480: 4d61 743c 2f61 3e3c 2f73 7061 6e3e 266e Mat&n │ │ │ -0008d490: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;f │ │ │ -0008d4b0: 696e 6446 756e 6461 6d65 6e74 616c 4d61 indFundamentalMa │ │ │ -0008d4c0: 743c 2f73 7061 6e3e 3c77 6272 3e3c 7370 t(MatO │ │ │ -0008d530: 6650 6f69 6e74 3266 3c2f 613e 266e 6273 fPoint2f&nbs │ │ │ -0008d540: 703b 706f 696e 7473 312c 0a20 3c61 2068 p;points1,. MatOfPoint2f points2,. │ │ │ -0008d5b0: 2069 6e74 266e 6273 703b 6d65 7468 6f64 int method │ │ │ -0008d5c0: 2c0a 2064 6f75 626c 6526 6e62 7370 3b72 ,. double r │ │ │ -0008d5d0: 616e 7361 6352 6570 726f 6a54 6872 6573 ansacReprojThres │ │ │ -0008d5e0: 686f 6c64 2c0a 2064 6f75 626c 6526 6e62 hold,. double&nb │ │ │ -0008d5f0: 7370 3b63 6f6e 6669 6465 6e63 652c 0a20 sp;confidence,. │ │ │ -0008d600: 696e 7426 6e62 7370 3b6d 6178 4974 6572 int maxIter │ │ │ -0008d610: 732c 0a20 3c61 2068 7265 663d 222e 2e2f s,. │ │ │ -0008d650: 4d61 743c 2f61 3e26 6e62 7370 3b6d 6173 Mat mas │ │ │ -0008d660: 6b29 3c2f 7370 616e 3e3c 2f64 6976 3e0a k)
    . │ │ │ -0008d670: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Calculates a │ │ │ -0008d690: 6675 6e64 616d 656e 7461 6c20 6d61 7472 fundamental matr │ │ │ -0008d6a0: 6978 2066 726f 6d20 7468 6520 636f 7272 ix from the corr │ │ │ -0008d6b0: 6573 706f 6e64 696e 6720 706f 696e 7473 esponding points │ │ │ -0008d6c0: 2069 6e20 7477 6f20 696d 6167 6573 2e3c in two images.< │ │ │ -0008d6d0: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ -0008d6f0: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .points1< │ │ │ -0008d710: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ -0008d720: 6620 4e20 706f 696e 7473 2066 726f 6d20 f N points from │ │ │ -0008d730: 7468 6520 6669 7273 7420 696d 6167 652e the first image. │ │ │ -0008d740: 2054 6865 2070 6f69 6e74 2063 6f6f 7264 The point coord │ │ │ -0008d750: 696e 6174 6573 2073 686f 756c 6420 6265 inates should be │ │ │ -0008d760: 0a66 6c6f 6174 696e 672d 706f 696e 7420 .floating-point │ │ │ -0008d770: 2873 696e 676c 6520 6f72 2064 6f75 626c (single or doubl │ │ │ -0008d780: 6520 7072 6563 6973 696f 6e29 2e3c 2f64 e precision)..
    poi │ │ │ -0008d7a0: 6e74 7332 3c2f 636f 6465 3e20 2d20 4172 nts2 - Ar │ │ │ -0008d7b0: 7261 7920 6f66 2074 6865 2073 6563 6f6e ray of the secon │ │ │ -0008d7c0: 6420 696d 6167 6520 706f 696e 7473 206f d image points o │ │ │ -0008d7d0: 6620 7468 6520 7361 6d65 2073 697a 6520 f the same size │ │ │ -0008d7e0: 616e 6420 666f 726d 6174 2061 7320 706f and format as po │ │ │ -0008d7f0: 696e 7473 3120 2e3c 2f64 643e 0a3c 6464 ints1 .
    .
    method - Method fo │ │ │ -0008d820: 7220 636f 6d70 7574 696e 6720 6120 6675 r computing a fu │ │ │ -0008d830: 6e64 616d 656e 7461 6c20 6d61 7472 6978 ndamental matrix │ │ │ -0008d840: 2e0a 3c75 6c3e 0a20 203c 6c69 3e0a 2020 ..
      .
    • . │ │ │ -0008d850: 2052 4546 3a20 464d 5f37 504f 494e 5420 REF: FM_7POINT │ │ │ -0008d860: 666f 7220 6120 372d 706f 696e 7420 616c for a 7-point al │ │ │ -0008d870: 676f 7269 7468 6d2e 205c 284e 203d 2037 gorithm. \(N = 7 │ │ │ -0008d880: 5c29 0a20 203c 2f6c 693e 0a20 203c 6c69 \).
    • .
    • . REF: FM_8PO │ │ │ -0008d8a0: 494e 5420 666f 7220 616e 2038 2d70 6f69 INT for an 8-poi │ │ │ -0008d8b0: 6e74 2061 6c67 6f72 6974 686d 2e20 5c28 nt algorithm. \( │ │ │ -0008d8c0: 4e20 5c67 6520 385c 290a 2020 3c2f 6c69 N \ge 8\).
    • .
    • . REF: │ │ │ -0008d8e0: 2046 4d5f 5241 4e53 4143 2066 6f72 2074 FM_RANSAC for t │ │ │ -0008d8f0: 6865 2052 414e 5341 4320 616c 676f 7269 he RANSAC algori │ │ │ -0008d900: 7468 6d2e 205c 284e 205c 6765 2038 5c29 thm. \(N \ge 8\) │ │ │ -0008d910: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ -0008d920: 2020 2052 4546 3a20 464d 5f4c 4d45 4453 REF: FM_LMEDS │ │ │ -0008d930: 2066 6f72 2074 6865 204c 4d65 6453 2061 for the LMedS a │ │ │ -0008d940: 6c67 6f72 6974 686d 2e20 5c28 4e20 5c67 lgorithm. \(N \g │ │ │ -0008d950: 6520 385c 290a 2020 3c2f 6c69 3e0a 3c2f e 8\).
    • .
    .
    ransacReprojT │ │ │ -0008d980: 6872 6573 686f 6c64 3c2f 636f 6465 3e20 hreshold │ │ │ -0008d990: 2d20 5061 7261 6d65 7465 7220 7573 6564 - Parameter used │ │ │ -0008d9a0: 206f 6e6c 7920 666f 7220 5241 4e53 4143 only for RANSAC │ │ │ -0008d9b0: 2e20 4974 2069 7320 7468 6520 6d61 7869 . It is the maxi │ │ │ -0008d9c0: 6d75 6d20 6469 7374 616e 6365 2066 726f mum distance fro │ │ │ -0008d9d0: 6d20 6120 706f 696e 7420 746f 2061 6e20 m a point to an │ │ │ -0008d9e0: 6570 6970 6f6c 6172 0a6c 696e 6520 696e epipolar.line in │ │ │ -0008d9f0: 2070 6978 656c 732c 2062 6579 6f6e 6420 pixels, beyond │ │ │ -0008da00: 7768 6963 6820 7468 6520 706f 696e 7420 which the point │ │ │ -0008da10: 6973 2063 6f6e 7369 6465 7265 6420 616e is considered an │ │ │ -0008da20: 206f 7574 6c69 6572 2061 6e64 2069 7320 outlier and is │ │ │ -0008da30: 6e6f 7420 7573 6564 2066 6f72 2063 6f6d not used for com │ │ │ -0008da40: 7075 7469 6e67 2074 6865 0a66 696e 616c puting the.final │ │ │ -0008da50: 2066 756e 6461 6d65 6e74 616c 206d 6174 fundamental mat │ │ │ -0008da60: 7269 782e 2049 7420 6361 6e20 6265 2073 rix. It can be s │ │ │ -0008da70: 6574 2074 6f20 736f 6d65 7468 696e 6720 et to something │ │ │ -0008da80: 6c69 6b65 2031 2d33 2c20 6465 7065 6e64 like 1-3, depend │ │ │ -0008da90: 696e 6720 6f6e 2074 6865 2061 6363 7572 ing on the accur │ │ │ -0008daa0: 6163 7920 6f66 2074 6865 0a70 6f69 6e74 acy of the.point │ │ │ -0008dab0: 206c 6f63 616c 697a 6174 696f 6e2c 2069 localization, i │ │ │ -0008dac0: 6d61 6765 2072 6573 6f6c 7574 696f 6e2c mage resolution, │ │ │ -0008dad0: 2061 6e64 2074 6865 2069 6d61 6765 206e and the image n │ │ │ -0008dae0: 6f69 7365 2e3c 2f64 643e 0a3c 6464 3e3c oise.
    .
    < │ │ │ -0008daf0: 636f 6465 3e63 6f6e 6669 6465 6e63 653c code>confidence< │ │ │ -0008db00: 2f63 6f64 653e 202d 2050 6172 616d 6574 /code> - Paramet │ │ │ -0008db10: 6572 2075 7365 6420 666f 7220 7468 6520 er used for the │ │ │ -0008db20: 5241 4e53 4143 2061 6e64 204c 4d65 6453 RANSAC and LMedS │ │ │ -0008db30: 206d 6574 686f 6473 206f 6e6c 792e 2049 methods only. I │ │ │ -0008db40: 7420 7370 6563 6966 6965 7320 6120 6465 t specifies a de │ │ │ -0008db50: 7369 7261 626c 6520 6c65 7665 6c0a 6f66 sirable level.of │ │ │ -0008db60: 2063 6f6e 6669 6465 6e63 6520 2870 726f confidence (pro │ │ │ -0008db70: 6261 6269 6c69 7479 2920 7468 6174 2074 bability) that t │ │ │ -0008db80: 6865 2065 7374 696d 6174 6564 206d 6174 he estimated mat │ │ │ -0008db90: 7269 7820 6973 2063 6f72 7265 6374 2e3c rix is correct.< │ │ │ -0008dba0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e6d /dd>.
    m │ │ │ -0008dbb0: 6178 4974 6572 733c 2f63 6f64 653e 202d axIters - │ │ │ -0008dbc0: 2054 6865 206d 6178 696d 756d 206e 756d The maximum num │ │ │ -0008dbd0: 6265 7220 6f66 2072 6f62 7573 7420 6d65 ber of robust me │ │ │ -0008dbe0: 7468 6f64 2069 7465 7261 7469 6f6e 732e thod iterations. │ │ │ -0008dbf0: 0a0a 5468 6520 6570 6970 6f6c 6172 2067 ..The epipolar g │ │ │ -0008dc00: 656f 6d65 7472 7920 6973 2064 6573 6372 eometry is descr │ │ │ -0008dc10: 6962 6564 2062 7920 7468 6520 666f 6c6c ibed by the foll │ │ │ -0008dc20: 6f77 696e 6720 6571 7561 7469 6f6e 3a0a owing equation:. │ │ │ -0008dc30: 0a5c 285b 705f 323b 2031 5d5e 5420 4620 .\([p_2; 1]^T F │ │ │ -0008dc40: 5b70 5f31 3b20 315d 203d 2030 5c29 0a0a [p_1; 1] = 0\).. │ │ │ -0008dc50: 7768 6572 6520 5c28 465c 2920 6973 2061 where \(F\) is a │ │ │ -0008dc60: 2066 756e 6461 6d65 6e74 616c 206d 6174 fundamental mat │ │ │ -0008dc70: 7269 782c 205c 2870 5f31 5c29 2061 6e64 rix, \(p_1\) and │ │ │ -0008dc80: 205c 2870 5f32 5c29 2061 7265 2063 6f72 \(p_2\) are cor │ │ │ -0008dc90: 7265 7370 6f6e 6469 6e67 2070 6f69 6e74 responding point │ │ │ -0008dca0: 7320 696e 2074 6865 2066 6972 7374 2061 s in the first a │ │ │ -0008dcb0: 6e64 2074 6865 0a73 6563 6f6e 6420 696d nd the.second im │ │ │ -0008dcc0: 6167 6573 2c20 7265 7370 6563 7469 7665 ages, respective │ │ │ -0008dcd0: 6c79 2e0a 0a54 6865 2066 756e 6374 696f ly...The functio │ │ │ -0008dce0: 6e20 6361 6c63 756c 6174 6573 2074 6865 n calculates the │ │ │ -0008dcf0: 2066 756e 6461 6d65 6e74 616c 206d 6174 fundamental mat │ │ │ -0008dd00: 7269 7820 7573 696e 6720 6f6e 6520 6f66 rix using one of │ │ │ -0008dd10: 2066 6f75 7220 6d65 7468 6f64 7320 6c69 four methods li │ │ │ -0008dd20: 7374 6564 2061 626f 7665 2061 6e64 2072 sted above and r │ │ │ -0008dd30: 6574 7572 6e73 0a74 6865 2066 6f75 6e64 eturns.the found │ │ │ -0008dd40: 2066 756e 6461 6d65 6e74 616c 206d 6174 fundamental mat │ │ │ -0008dd50: 7269 782e 204e 6f72 6d61 6c6c 7920 6a75 rix. Normally ju │ │ │ -0008dd60: 7374 206f 6e65 206d 6174 7269 7820 6973 st one matrix is │ │ │ -0008dd70: 2066 6f75 6e64 2e20 4275 7420 696e 2063 found. But in c │ │ │ -0008dd80: 6173 6520 6f66 2074 6865 2037 2d70 6f69 ase of the 7-poi │ │ │ -0008dd90: 6e74 0a61 6c67 6f72 6974 686d 2c20 7468 nt.algorithm, th │ │ │ -0008dda0: 6520 6675 6e63 7469 6f6e 206d 6179 2072 e function may r │ │ │ -0008ddb0: 6574 7572 6e20 7570 2074 6f20 3320 736f eturn up to 3 so │ │ │ -0008ddc0: 6c75 7469 6f6e 7320 2820 5c28 3920 5c74 lutions ( \(9 \t │ │ │ -0008ddd0: 696d 6573 2033 5c29 206d 6174 7269 7820 imes 3\) matrix │ │ │ -0008dde0: 7468 6174 2073 746f 7265 7320 616c 6c20 that stores all │ │ │ -0008ddf0: 330a 6d61 7472 6963 6573 2073 6571 7565 3.matrices seque │ │ │ -0008de00: 6e74 6961 6c6c 7929 2e0a 0a54 6865 2063 ntially)...The c │ │ │ -0008de10: 616c 6375 6c61 7465 6420 6675 6e64 616d alculated fundam │ │ │ -0008de20: 656e 7461 6c20 6d61 7472 6978 206d 6179 ental matrix may │ │ │ -0008de30: 2062 6520 7061 7373 6564 2066 7572 7468 be passed furth │ │ │ -0008de40: 6572 2074 6f20 2363 6f6d 7075 7465 436f er to #computeCo │ │ │ -0008de50: 7272 6573 706f 6e64 4570 696c 696e 6573 rrespondEpilines │ │ │ -0008de60: 2074 6861 7420 6669 6e64 7320 7468 650a that finds the. │ │ │ -0008de70: 6570 6970 6f6c 6172 206c 696e 6573 2063 epipolar lines c │ │ │ -0008de80: 6f72 7265 7370 6f6e 6469 6e67 2074 6f20 orresponding to │ │ │ -0008de90: 7468 6520 7370 6563 6966 6965 6420 706f the specified po │ │ │ -0008dea0: 696e 7473 2e20 4974 2063 616e 2061 6c73 ints. It can als │ │ │ -0008deb0: 6f20 6265 2070 6173 7365 6420 746f 0a23 o be passed to.# │ │ │ -0008dec0: 7374 6572 656f 5265 6374 6966 7955 6e63 stereoRectifyUnc │ │ │ -0008ded0: 616c 6962 7261 7465 6420 746f 2063 6f6d alibrated to com │ │ │ -0008dee0: 7075 7465 2074 6865 2072 6563 7469 6669 pute the rectifi │ │ │ -0008def0: 6361 7469 6f6e 2074 7261 6e73 666f 726d cation transform │ │ │ -0008df00: 6174 696f 6e2e 203a 0a3c 636f 6465 3e0a ation. :.. │ │ │ -0008df10: 2020 2020 2f2f 2045 7861 6d70 6c65 2e20 // Example. │ │ │ -0008df20: 4573 7469 6d61 7469 6f6e 206f 6620 6675 Estimation of fu │ │ │ -0008df30: 6e64 616d 656e 7461 6c20 6d61 7472 6978 ndamental matrix │ │ │ -0008df40: 2075 7369 6e67 2074 6865 2052 414e 5341 using the RANSA │ │ │ -0008df50: 4320 616c 676f 7269 7468 6d0a 2020 2020 C algorithm. │ │ │ -0008df60: 696e 7420 706f 696e 745f 636f 756e 7420 int point_count │ │ │ -0008df70: 3d20 3130 303b 0a20 2020 2076 6563 746f = 100;. vecto │ │ │ -0008df80: 7226 6c74 3b50 6f69 6e74 3266 2667 743b r<Point2f> │ │ │ -0008df90: 2070 6f69 6e74 7331 2870 6f69 6e74 5f63 points1(point_c │ │ │ -0008dfa0: 6f75 6e74 293b 0a20 2020 2076 6563 746f ount);. vecto │ │ │ -0008dfb0: 7226 6c74 3b50 6f69 6e74 3266 2667 743b r<Point2f> │ │ │ -0008dfc0: 2070 6f69 6e74 7332 2870 6f69 6e74 5f63 points2(point_c │ │ │ -0008dfd0: 6f75 6e74 293b 0a0a 2020 2020 2f2f 2069 ount);.. // i │ │ │ -0008dfe0: 6e69 7469 616c 697a 6520 7468 6520 706f nitialize the po │ │ │ -0008dff0: 696e 7473 2068 6572 6520 2e2e 2e0a 2020 ints here .... │ │ │ -0008e000: 2020 666f 7228 2069 6e74 2069 203d 2030 for( int i = 0 │ │ │ -0008e010: 3b20 6920 266c 743b 2070 6f69 6e74 5f63 ; i < point_c │ │ │ -0008e020: 6f75 6e74 3b20 692b 2b20 290a 2020 2020 ount; i++ ). │ │ │ -0008e030: 7b0a 2020 2020 2020 2020 706f 696e 7473 {. points │ │ │ -0008e040: 315b 695d 203d 202e 2e2e 3b0a 2020 2020 1[i] = ...;. │ │ │ -0008e050: 2020 2020 706f 696e 7473 325b 695d 203d points2[i] = │ │ │ -0008e060: 202e 2e2e 3b0a 2020 2020 7d0a 0a20 2020 ...;. }.. │ │ │ -0008e070: 204d 6174 2066 756e 6461 6d65 6e74 616c Mat fundamental │ │ │ -0008e080: 5f6d 6174 7269 7820 3d0a 2020 2020 2066 _matrix =. f │ │ │ -0008e090: 696e 6446 756e 6461 6d65 6e74 616c 4d61 indFundamentalMa │ │ │ -0008e0a0: 7428 706f 696e 7473 312c 2070 6f69 6e74 t(points1, point │ │ │ -0008e0b0: 7332 2c20 464d 5f52 414e 5341 432c 2033 s2, FM_RANSAC, 3 │ │ │ -0008e0c0: 2c20 302e 3939 293b 0a3c 2f63 6f64 653e , 0.99);. │ │ │ -0008e0d0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -0008e0e0: 6d61 736b 3c2f 636f 6465 3e20 2d20 6f70 mask - op │ │ │ -0008e0f0: 7469 6f6e 616c 206f 7574 7075 7420 6d61 tional output ma │ │ │ -0008e100: 736b 3c2f 6464 3e0a 3c64 743e 5265 7475 sk
    .
    Retu │ │ │ -0008e110: 726e 733a 3c2f 6474 3e0a 3c64 643e 6175 rns:
    .
    au │ │ │ -0008e120: 746f 6d61 7469 6361 6c6c 7920 6765 6e65 tomatically gene │ │ │ -0008e130: 7261 7465 643c 2f64 643e 0a3c 2f64 6c3e rated
    .
    │ │ │ -0008e140: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • .. │ │ │ -0008e1e0: 3c68 333e 6669 6e64 4675 6e64 616d 656e

    findFundamen │ │ │ -0008e1f0: 7461 6c4d 6174 3c2f 6833 3e0a 3c64 6976 talMat

    .
    ..
    Calculates │ │ │ -0008e480: 6120 6675 6e64 616d 656e 7461 6c20 6d61 a fundamental ma │ │ │ -0008e490: 7472 6978 2066 726f 6d20 7468 6520 636f trix from the co │ │ │ -0008e4a0: 7272 6573 706f 6e64 696e 6720 706f 696e rresponding poin │ │ │ -0008e4b0: 7473 2069 6e20 7477 6f20 696d 6167 6573 ts in two images │ │ │ -0008e4c0: 2e3c 2f64 6976 3e0a 3c64 6c20 636c 6173 .
    .
    .
    P │ │ │ -0008e4e0: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ -0008e4f0: 3c64 643e 3c63 6f64 653e 706f 696e 7473
    points │ │ │ -0008e500: 313c 2f63 6f64 653e 202d 2041 7272 6179 1 - Array │ │ │ -0008e510: 206f 6620 4e20 706f 696e 7473 2066 726f of N points fro │ │ │ -0008e520: 6d20 7468 6520 6669 7273 7420 696d 6167 m the first imag │ │ │ -0008e530: 652e 2054 6865 2070 6f69 6e74 2063 6f6f e. The point coo │ │ │ -0008e540: 7264 696e 6174 6573 2073 686f 756c 6420 rdinates should │ │ │ -0008e550: 6265 0a66 6c6f 6174 696e 672d 706f 696e be.floating-poin │ │ │ -0008e560: 7420 2873 696e 676c 6520 6f72 2064 6f75 t (single or dou │ │ │ -0008e570: 626c 6520 7072 6563 6973 696f 6e29 2e3c ble precision).< │ │ │ -0008e580: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e70 /dd>.
    p │ │ │ -0008e590: 6f69 6e74 7332 3c2f 636f 6465 3e20 2d20 oints2 - │ │ │ -0008e5a0: 4172 7261 7920 6f66 2074 6865 2073 6563 Array of the sec │ │ │ -0008e5b0: 6f6e 6420 696d 6167 6520 706f 696e 7473 ond image points │ │ │ -0008e5c0: 206f 6620 7468 6520 7361 6d65 2073 697a of the same siz │ │ │ -0008e5d0: 6520 616e 6420 666f 726d 6174 2061 7320 e and format as │ │ │ -0008e5e0: 706f 696e 7473 3120 2e3c 2f64 643e 0a3c points1 .
    .< │ │ │ -0008e5f0: 6464 3e3c 636f 6465 3e6d 6574 686f 643c dd>method< │ │ │ -0008e600: 2f63 6f64 653e 202d 204d 6574 686f 6420 /code> - Method │ │ │ -0008e610: 666f 7220 636f 6d70 7574 696e 6720 6120 for computing a │ │ │ -0008e620: 6675 6e64 616d 656e 7461 6c20 6d61 7472 fundamental matr │ │ │ -0008e630: 6978 2e0a 3c75 6c3e 0a20 203c 6c69 3e0a ix..
      .
    • . │ │ │ -0008e640: 2020 2052 4546 3a20 464d 5f37 504f 494e REF: FM_7POIN │ │ │ -0008e650: 5420 666f 7220 6120 372d 706f 696e 7420 T for a 7-point │ │ │ -0008e660: 616c 676f 7269 7468 6d2e 205c 284e 203d algorithm. \(N = │ │ │ -0008e670: 2037 5c29 0a20 203c 2f6c 693e 0a20 203c 7\).
    • . < │ │ │ -0008e680: 6c69 3e0a 2020 2052 4546 3a20 464d 5f38 li>. REF: FM_8 │ │ │ -0008e690: 504f 494e 5420 666f 7220 616e 2038 2d70 POINT for an 8-p │ │ │ -0008e6a0: 6f69 6e74 2061 6c67 6f72 6974 686d 2e20 oint algorithm. │ │ │ -0008e6b0: 5c28 4e20 5c67 6520 385c 290a 2020 3c2f \(N \ge 8\). .
    • . RE │ │ │ -0008e6d0: 463a 2046 4d5f 5241 4e53 4143 2066 6f72 F: FM_RANSAC for │ │ │ -0008e6e0: 2074 6865 2052 414e 5341 4320 616c 676f the RANSAC algo │ │ │ -0008e6f0: 7269 7468 6d2e 205c 284e 205c 6765 2038 rithm. \(N \ge 8 │ │ │ -0008e700: 5c29 0a20 203c 2f6c 693e 0a20 203c 6c69 \).
    • .
    • . REF: FM_LME │ │ │ -0008e720: 4453 2066 6f72 2074 6865 204c 4d65 6453 DS for the LMedS │ │ │ -0008e730: 2061 6c67 6f72 6974 686d 2e20 5c28 4e20 algorithm. \(N │ │ │ -0008e740: 5c67 6520 385c 290a 2020 3c2f 6c69 3e0a \ge 8\).
    • . │ │ │ -0008e750: 3c2f 756c 3e3c 2f64 643e 0a3c 6464 3e3c
    .
    < │ │ │ -0008e760: 636f 6465 3e72 616e 7361 6352 6570 726f code>ransacRepro │ │ │ -0008e770: 6a54 6872 6573 686f 6c64 3c2f 636f 6465 jThreshold - Parameter us │ │ │ -0008e790: 6564 206f 6e6c 7920 666f 7220 5241 4e53 ed only for RANS │ │ │ -0008e7a0: 4143 2e20 4974 2069 7320 7468 6520 6d61 AC. It is the ma │ │ │ -0008e7b0: 7869 6d75 6d20 6469 7374 616e 6365 2066 ximum distance f │ │ │ -0008e7c0: 726f 6d20 6120 706f 696e 7420 746f 2061 rom a point to a │ │ │ -0008e7d0: 6e20 6570 6970 6f6c 6172 0a6c 696e 6520 n epipolar.line │ │ │ -0008e7e0: 696e 2070 6978 656c 732c 2062 6579 6f6e in pixels, beyon │ │ │ -0008e7f0: 6420 7768 6963 6820 7468 6520 706f 696e d which the poin │ │ │ -0008e800: 7420 6973 2063 6f6e 7369 6465 7265 6420 t is considered │ │ │ -0008e810: 616e 206f 7574 6c69 6572 2061 6e64 2069 an outlier and i │ │ │ -0008e820: 7320 6e6f 7420 7573 6564 2066 6f72 2063 s not used for c │ │ │ -0008e830: 6f6d 7075 7469 6e67 2074 6865 0a66 696e omputing the.fin │ │ │ -0008e840: 616c 2066 756e 6461 6d65 6e74 616c 206d al fundamental m │ │ │ -0008e850: 6174 7269 782e 2049 7420 6361 6e20 6265 atrix. It can be │ │ │ -0008e860: 2073 6574 2074 6f20 736f 6d65 7468 696e set to somethin │ │ │ -0008e870: 6720 6c69 6b65 2031 2d33 2c20 6465 7065 g like 1-3, depe │ │ │ -0008e880: 6e64 696e 6720 6f6e 2074 6865 2061 6363 nding on the acc │ │ │ -0008e890: 7572 6163 7920 6f66 2074 6865 0a70 6f69 uracy of the.poi │ │ │ -0008e8a0: 6e74 206c 6f63 616c 697a 6174 696f 6e2c nt localization, │ │ │ -0008e8b0: 2069 6d61 6765 2072 6573 6f6c 7574 696f image resolutio │ │ │ -0008e8c0: 6e2c 2061 6e64 2074 6865 2069 6d61 6765 n, and the image │ │ │ -0008e8d0: 206e 6f69 7365 2e3c 2f64 643e 0a3c 6464 noise.
    .
    confidenc │ │ │ -0008e8f0: 653c 2f63 6f64 653e 202d 2050 6172 616d e - Param │ │ │ -0008e900: 6574 6572 2075 7365 6420 666f 7220 7468 eter used for th │ │ │ -0008e910: 6520 5241 4e53 4143 2061 6e64 204c 4d65 e RANSAC and LMe │ │ │ -0008e920: 6453 206d 6574 686f 6473 206f 6e6c 792e dS methods only. │ │ │ -0008e930: 2049 7420 7370 6563 6966 6965 7320 6120 It specifies a │ │ │ -0008e940: 6465 7369 7261 626c 6520 6c65 7665 6c0a desirable level. │ │ │ -0008e950: 6f66 2063 6f6e 6669 6465 6e63 6520 2870 of confidence (p │ │ │ -0008e960: 726f 6261 6269 6c69 7479 2920 7468 6174 robability) that │ │ │ -0008e970: 2074 6865 2065 7374 696d 6174 6564 206d the estimated m │ │ │ -0008e980: 6174 7269 7820 6973 2063 6f72 7265 6374 atrix is correct │ │ │ -0008e990: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    maxIters │ │ │ -0008e9b0: 202d 2054 6865 206d 6178 696d 756d 206e - The maximum n │ │ │ -0008e9c0: 756d 6265 7220 6f66 2072 6f62 7573 7420 umber of robust │ │ │ -0008e9d0: 6d65 7468 6f64 2069 7465 7261 7469 6f6e method iteration │ │ │ -0008e9e0: 732e 0a0a 5468 6520 6570 6970 6f6c 6172 s...The epipolar │ │ │ -0008e9f0: 2067 656f 6d65 7472 7920 6973 2064 6573 geometry is des │ │ │ -0008ea00: 6372 6962 6564 2062 7920 7468 6520 666f cribed by the fo │ │ │ -0008ea10: 6c6c 6f77 696e 6720 6571 7561 7469 6f6e llowing equation │ │ │ -0008ea20: 3a0a 0a5c 285b 705f 323b 2031 5d5e 5420 :..\([p_2; 1]^T │ │ │ -0008ea30: 4620 5b70 5f31 3b20 315d 203d 2030 5c29 F [p_1; 1] = 0\) │ │ │ -0008ea40: 0a0a 7768 6572 6520 5c28 465c 2920 6973 ..where \(F\) is │ │ │ -0008ea50: 2061 2066 756e 6461 6d65 6e74 616c 206d a fundamental m │ │ │ -0008ea60: 6174 7269 782c 205c 2870 5f31 5c29 2061 atrix, \(p_1\) a │ │ │ -0008ea70: 6e64 205c 2870 5f32 5c29 2061 7265 2063 nd \(p_2\) are c │ │ │ -0008ea80: 6f72 7265 7370 6f6e 6469 6e67 2070 6f69 orresponding poi │ │ │ -0008ea90: 6e74 7320 696e 2074 6865 2066 6972 7374 nts in the first │ │ │ -0008eaa0: 2061 6e64 2074 6865 0a73 6563 6f6e 6420 and the.second │ │ │ -0008eab0: 696d 6167 6573 2c20 7265 7370 6563 7469 images, respecti │ │ │ -0008eac0: 7665 6c79 2e0a 0a54 6865 2066 756e 6374 vely...The funct │ │ │ -0008ead0: 696f 6e20 6361 6c63 756c 6174 6573 2074 ion calculates t │ │ │ -0008eae0: 6865 2066 756e 6461 6d65 6e74 616c 206d he fundamental m │ │ │ -0008eaf0: 6174 7269 7820 7573 696e 6720 6f6e 6520 atrix using one │ │ │ -0008eb00: 6f66 2066 6f75 7220 6d65 7468 6f64 7320 of four methods │ │ │ -0008eb10: 6c69 7374 6564 2061 626f 7665 2061 6e64 listed above and │ │ │ -0008eb20: 2072 6574 7572 6e73 0a74 6865 2066 6f75 returns.the fou │ │ │ -0008eb30: 6e64 2066 756e 6461 6d65 6e74 616c 206d nd fundamental m │ │ │ -0008eb40: 6174 7269 782e 204e 6f72 6d61 6c6c 7920 atrix. Normally │ │ │ -0008eb50: 6a75 7374 206f 6e65 206d 6174 7269 7820 just one matrix │ │ │ -0008eb60: 6973 2066 6f75 6e64 2e20 4275 7420 696e is found. But in │ │ │ -0008eb70: 2063 6173 6520 6f66 2074 6865 2037 2d70 case of the 7-p │ │ │ -0008eb80: 6f69 6e74 0a61 6c67 6f72 6974 686d 2c20 oint.algorithm, │ │ │ -0008eb90: 7468 6520 6675 6e63 7469 6f6e 206d 6179 the function may │ │ │ -0008eba0: 2072 6574 7572 6e20 7570 2074 6f20 3320 return up to 3 │ │ │ -0008ebb0: 736f 6c75 7469 6f6e 7320 2820 5c28 3920 solutions ( \(9 │ │ │ -0008ebc0: 5c74 696d 6573 2033 5c29 206d 6174 7269 \times 3\) matri │ │ │ -0008ebd0: 7820 7468 6174 2073 746f 7265 7320 616c x that stores al │ │ │ -0008ebe0: 6c20 330a 6d61 7472 6963 6573 2073 6571 l 3.matrices seq │ │ │ -0008ebf0: 7565 6e74 6961 6c6c 7929 2e0a 0a54 6865 uentially)...The │ │ │ -0008ec00: 2063 616c 6375 6c61 7465 6420 6675 6e64 calculated fund │ │ │ -0008ec10: 616d 656e 7461 6c20 6d61 7472 6978 206d amental matrix m │ │ │ -0008ec20: 6179 2062 6520 7061 7373 6564 2066 7572 ay be passed fur │ │ │ -0008ec30: 7468 6572 2074 6f20 2363 6f6d 7075 7465 ther to #compute │ │ │ -0008ec40: 436f 7272 6573 706f 6e64 4570 696c 696e CorrespondEpilin │ │ │ -0008ec50: 6573 2074 6861 7420 6669 6e64 7320 7468 es that finds th │ │ │ -0008ec60: 650a 6570 6970 6f6c 6172 206c 696e 6573 e.epipolar lines │ │ │ -0008ec70: 2063 6f72 7265 7370 6f6e 6469 6e67 2074 corresponding t │ │ │ -0008ec80: 6f20 7468 6520 7370 6563 6966 6965 6420 o the specified │ │ │ -0008ec90: 706f 696e 7473 2e20 4974 2063 616e 2061 points. It can a │ │ │ -0008eca0: 6c73 6f20 6265 2070 6173 7365 6420 746f lso be passed to │ │ │ -0008ecb0: 0a23 7374 6572 656f 5265 6374 6966 7955 .#stereoRectifyU │ │ │ -0008ecc0: 6e63 616c 6962 7261 7465 6420 746f 2063 ncalibrated to c │ │ │ -0008ecd0: 6f6d 7075 7465 2074 6865 2072 6563 7469 ompute the recti │ │ │ -0008ece0: 6669 6361 7469 6f6e 2074 7261 6e73 666f fication transfo │ │ │ -0008ecf0: 726d 6174 696f 6e2e 203a 0a3c 636f 6465 rmation. :.. // Example │ │ │ -0008ed10: 2e20 4573 7469 6d61 7469 6f6e 206f 6620 . Estimation of │ │ │ -0008ed20: 6675 6e64 616d 656e 7461 6c20 6d61 7472 fundamental matr │ │ │ -0008ed30: 6978 2075 7369 6e67 2074 6865 2052 414e ix using the RAN │ │ │ -0008ed40: 5341 4320 616c 676f 7269 7468 6d0a 2020 SAC algorithm. │ │ │ -0008ed50: 2020 696e 7420 706f 696e 745f 636f 756e int point_coun │ │ │ -0008ed60: 7420 3d20 3130 303b 0a20 2020 2076 6563 t = 100;. vec │ │ │ -0008ed70: 746f 7226 6c74 3b50 6f69 6e74 3266 2667 tor<Point2f&g │ │ │ -0008ed80: 743b 2070 6f69 6e74 7331 2870 6f69 6e74 t; points1(point │ │ │ -0008ed90: 5f63 6f75 6e74 293b 0a20 2020 2076 6563 _count);. vec │ │ │ -0008eda0: 746f 7226 6c74 3b50 6f69 6e74 3266 2667 tor<Point2f&g │ │ │ -0008edb0: 743b 2070 6f69 6e74 7332 2870 6f69 6e74 t; points2(point │ │ │ -0008edc0: 5f63 6f75 6e74 293b 0a0a 2020 2020 2f2f _count);.. // │ │ │ -0008edd0: 2069 6e69 7469 616c 697a 6520 7468 6520 initialize the │ │ │ -0008ede0: 706f 696e 7473 2068 6572 6520 2e2e 2e0a points here .... │ │ │ -0008edf0: 2020 2020 666f 7228 2069 6e74 2069 203d for( int i = │ │ │ -0008ee00: 2030 3b20 6920 266c 743b 2070 6f69 6e74 0; i < point │ │ │ -0008ee10: 5f63 6f75 6e74 3b20 692b 2b20 290a 2020 _count; i++ ). │ │ │ -0008ee20: 2020 7b0a 2020 2020 2020 2020 706f 696e {. poin │ │ │ -0008ee30: 7473 315b 695d 203d 202e 2e2e 3b0a 2020 ts1[i] = ...;. │ │ │ -0008ee40: 2020 2020 2020 706f 696e 7473 325b 695d points2[i] │ │ │ -0008ee50: 203d 202e 2e2e 3b0a 2020 2020 7d0a 0a20 = ...;. }.. │ │ │ -0008ee60: 2020 204d 6174 2066 756e 6461 6d65 6e74 Mat fundament │ │ │ -0008ee70: 616c 5f6d 6174 7269 7820 3d0a 2020 2020 al_matrix =. │ │ │ -0008ee80: 2066 696e 6446 756e 6461 6d65 6e74 616c findFundamental │ │ │ -0008ee90: 4d61 7428 706f 696e 7473 312c 2070 6f69 Mat(points1, poi │ │ │ -0008eea0: 6e74 7332 2c20 464d 5f52 414e 5341 432c nts2, FM_RANSAC, │ │ │ -0008eeb0: 2033 2c20 302e 3939 293b 0a3c 2f63 6f64 3, 0.99);.
    .
    Retu │ │ │ -0008eed0: 726e 733a 3c2f 6474 3e0a 3c64 643e 6175 rns:
    .
    au │ │ │ -0008eee0: 746f 6d61 7469 6361 6c6c 7920 6765 6e65 tomatically gene │ │ │ -0008eef0: 7261 7465 643c 2f64 643e 0a3c 2f64 6c3e rated
    .
    │ │ │ -0008ef00: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • .. │ │ │ -0008efb0: 3c68 333e 6669 6e64 4675 6e64 616d 656e

    findFundamen │ │ │ -0008efc0: 7461 6c4d 6174 3c2f 6833 3e0a 3c64 6976 talMat

    .
  • .
  • ..

    fin │ │ │ -0008f310: 6446 756e 6461 6d65 6e74 616c 4d61 743c dFundamentalMat< │ │ │ -0008f320: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -0008f380: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -0008f390: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;< │ │ │ -0008f3b0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0008f3c0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0008f3d0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0008f3e0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat < │ │ │ -0008f400: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ -0008f410: 656e 742d 6e61 6d65 223e 6669 6e64 4675 ent-name">findFu │ │ │ -0008f420: 6e64 616d 656e 7461 6c4d 6174 3c2f 7370 ndamentalMat(MatOfPoin │ │ │ -0008f4a0: 7432 663c 2f61 3e26 6e62 7370 3b70 6f69 t2f poi │ │ │ -0008f4b0: 6e74 7331 2c0a 203c 6120 6872 6566 3d22 nts1,. MatO │ │ │ -0008f500: 6650 6f69 6e74 3266 3c2f 613e 266e 6273 fPoint2f&nbs │ │ │ -0008f510: 703b 706f 696e 7473 322c 0a20 696e 7426 p;points2,. int& │ │ │ -0008f520: 6e62 7370 3b6d 6574 686f 642c 0a20 646f nbsp;method,. do │ │ │ -0008f530: 7562 6c65 266e 6273 703b 7261 6e73 6163 uble ransac │ │ │ -0008f540: 5265 7072 6f6a 5468 7265 7368 6f6c 642c ReprojThreshold, │ │ │ -0008f550: 0a20 646f 7562 6c65 266e 6273 703b 636f . double co │ │ │ -0008f560: 6e66 6964 656e 6365 293c 2f73 7061 6e3e nfidence) │ │ │ -0008f570: 3c2f 6469 763e 0a3c 2f64 6976 3e0a 3c2f
    .
    ..

  • .< │ │ │ -0008f590: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .

    f │ │ │ -0008f610: 696e 6446 756e 6461 6d65 6e74 616c 4d61 indFundamentalMa │ │ │ -0008f620: 743c 2f68 333e 0a3c 6469 7620 636c 6173 t

    .
    .
    pub │ │ │ -0008f680: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static Mat │ │ │ -0008f6f0: 3c2f 613e 3c2f 7370 616e 3e26 6e62 7370   │ │ │ -0008f700: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;find │ │ │ -0008f720: 4675 6e64 616d 656e 7461 6c4d 6174 3c2f FundamentalMat(MatOfPo │ │ │ -0008f7a0: 696e 7432 663c 2f61 3e26 6e62 7370 3b70 int2f p │ │ │ -0008f7b0: 6f69 6e74 7331 2c0a 203c 6120 6872 6566 oints1,. Ma │ │ │ -0008f800: 744f 6650 6f69 6e74 3266 3c2f 613e 266e tOfPoint2f&n │ │ │ -0008f810: 6273 703b 706f 696e 7473 322c 0a20 696e bsp;points2,. in │ │ │ -0008f820: 7426 6e62 7370 3b6d 6574 686f 642c 0a20 t method,. │ │ │ -0008f830: 646f 7562 6c65 266e 6273 703b 7261 6e73 double rans │ │ │ -0008f840: 6163 5265 7072 6f6a 5468 7265 7368 6f6c acReprojThreshol │ │ │ -0008f850: 6429 3c2f 7370 616e 3e3c 2f64 6976 3e0a d)
    . │ │ │ -0008f860: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e
    .
    ..
  • ..

    findFundamental │ │ │ -0008f900: 4d61 743c 2f68 333e 0a3c 6469 7620 636c Mat

    .
    .
    p │ │ │ -0008f960: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static M │ │ │ -0008f9d0: 6174 3c2f 613e 3c2f 7370 616e 3e26 6e62 at&nb │ │ │ -0008f9e0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;fi │ │ │ -0008fa00: 6e64 4675 6e64 616d 656e 7461 6c4d 6174 ndFundamentalMat │ │ │ -0008fa10: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (MatOf │ │ │ -0008fa80: 506f 696e 7432 663c 2f61 3e26 6e62 7370 Point2f  │ │ │ -0008fa90: 3b70 6f69 6e74 7331 2c0a 203c 6120 6872 ;points1,. │ │ │ -0008fae0: 4d61 744f 6650 6f69 6e74 3266 3c2f 613e MatOfPoint2f │ │ │ -0008faf0: 266e 6273 703b 706f 696e 7473 322c 0a20  points2,. │ │ │ -0008fb00: 696e 7426 6e62 7370 3b6d 6574 686f 6429 int method) │ │ │ -0008fb10: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c2f
    ... │ │ │ -0008fb30: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..

    findF │ │ │ -0008fbb0: 756e 6461 6d65 6e74 616c 4d61 743c 2f68 undamentalMat.
    .
    public │ │ │ -0008fc20: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ -0008fc30: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;Mat │ │ │ -0008fc90: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  findFund │ │ │ -0008fcc0: 616d 656e 7461 6c4d 6174 3c2f 7370 616e amentalMat( │ │ │ -0008fcf0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfPoint2 │ │ │ -0008fd40: 663c 2f61 3e26 6e62 7370 3b70 6f69 6e74 f point │ │ │ -0008fd50: 7331 2c0a 203c 6120 6872 6566 3d22 2e2e s1,. MatOfP │ │ │ -0008fda0: 6f69 6e74 3266 3c2f 613e 266e 6273 703b oint2f  │ │ │ -0008fdb0: 706f 696e 7473 3229 3c2f 7370 616e 3e3c points2)< │ │ │ -0008fdc0: 2f64 6976 3e0a 3c2f 6469 763e 0a3c 2f73 /div>.
    .
    .

  • ..
    .

    findFundam │ │ │ -0008fe90: 656e 7461 6c4d 6174 3c2f 6833 3e0a 3c64 entalMat

    ..public stati │ │ │ -0008ff00: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c Mat findFundament │ │ │ -0008ffa0: 616c 4d61 743c 2f73 7061 6e3e 3c77 6272 alMat( │ │ │ -00090010: 4d61 744f 6650 6f69 6e74 3266 3c2f 613e MatOfPoint2f │ │ │ -00090020: 266e 6273 703b 706f 696e 7473 312c 0a20  points1,. │ │ │ -00090030: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfPoint2 │ │ │ -00090080: 663c 2f61 3e26 6e62 7370 3b70 6f69 6e74 f point │ │ │ -00090090: 7332 2c0a 203c 6120 6872 6566 3d22 2e2e s2,. Mat ma │ │ │ -000900e0: 736b 2c0a 203c 6120 6872 6566 3d22 5573 sk,. UsacParams params)< │ │ │ -00090140: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 2f64 /span>..
    .< │ │ │ -00090160: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • .. │ │ │ -00090200: 3c68 333e 6669 6e64 4573 7365 6e74 6961

    findEssentia │ │ │ -00090210: 6c4d 6174 3c2f 6833 3e0a 3c64 6976 2063 lMat

    .
    .
    │ │ │ -00090270: 7075 626c 6963 2073 7461 7469 633c 2f73 public static  │ │ │ -000902e0: 4d61 743c 2f61 3e3c 2f73 7061 6e3e 266e Mat&n │ │ │ -000902f0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;f │ │ │ -00090310: 696e 6445 7373 656e 7469 616c 4d61 743c indEssentialMat< │ │ │ -00090320: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat po │ │ │ -00090390: 696e 7473 312c 0a20 3c61 2068 7265 663d ints1,. Mat  │ │ │ -000903e0: 3b70 6f69 6e74 7332 2c0a 203c 6120 6872 ;points2,. Mat&n │ │ │ -00090430: 6273 703b 6361 6d65 7261 4d61 7472 6978 bsp;cameraMatrix │ │ │ -00090440: 2c0a 2069 6e74 266e 6273 703b 6d65 7468 ,. int meth │ │ │ -00090450: 6f64 2c0a 2064 6f75 626c 6526 6e62 7370 od,. double  │ │ │ -00090460: 3b70 726f 622c 0a20 646f 7562 6c65 266e ;prob,. double&n │ │ │ -00090470: 6273 703b 7468 7265 7368 6f6c 642c 0a20 bsp;threshold,. │ │ │ -00090480: 696e 7426 6e62 7370 3b6d 6178 4974 6572 int maxIter │ │ │ -00090490: 732c 0a20 3c61 2068 7265 663d 222e 2e2f s,. │ │ │ -000904d0: 4d61 743c 2f61 3e26 6e62 7370 3b6d 6173 Mat mas │ │ │ -000904e0: 6b29 3c2f 7370 616e 3e3c 2f64 6976 3e0a k)
    . │ │ │ -000904f0: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Calculates an │ │ │ -00090510: 2065 7373 656e 7469 616c 206d 6174 7269 essential matri │ │ │ -00090520: 7820 6672 6f6d 2074 6865 2063 6f72 7265 x from the corre │ │ │ -00090530: 7370 6f6e 6469 6e67 2070 6f69 6e74 7320 sponding points │ │ │ -00090540: 696e 2074 776f 2069 6d61 6765 732e 3c2f in two images..
    .
    Para │ │ │ -00090570: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    points1 - Array of │ │ │ -000905a0: 204e 2028 4e20 2667 743b 3d20 3529 2032 N (N >= 5) 2 │ │ │ -000905b0: 4420 706f 696e 7473 2066 726f 6d20 7468 D points from th │ │ │ -000905c0: 6520 6669 7273 7420 696d 6167 652e 2054 e first image. T │ │ │ -000905d0: 6865 2070 6f69 6e74 2063 6f6f 7264 696e he point coordin │ │ │ -000905e0: 6174 6573 2073 686f 756c 640a 6265 2066 ates should.be f │ │ │ -000905f0: 6c6f 6174 696e 672d 706f 696e 7420 2873 loating-point (s │ │ │ -00090600: 696e 676c 6520 6f72 2064 6f75 626c 6520 ingle or double │ │ │ -00090610: 7072 6563 6973 696f 6e29 2e3c 2f64 643e precision).
    │ │ │ -00090620: 0a3c 6464 3e3c 636f 6465 3e70 6f69 6e74 .
    point │ │ │ -00090630: 7332 3c2f 636f 6465 3e20 2d20 4172 7261 s2 - Arra │ │ │ -00090640: 7920 6f66 2074 6865 2073 6563 6f6e 6420 y of the second │ │ │ -00090650: 696d 6167 6520 706f 696e 7473 206f 6620 image points of │ │ │ -00090660: 7468 6520 7361 6d65 2073 697a 6520 616e the same size an │ │ │ -00090670: 6420 666f 726d 6174 2061 7320 706f 696e d format as poin │ │ │ -00090680: 7473 312e 3c2f 6464 3e0a 3c64 643e 3c63 ts1.
    .
    cameraMatrix │ │ │ -000906a0: 3c2f 636f 6465 3e20 2d20 4361 6d65 7261 - Camera │ │ │ -000906b0: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ -000906c0: 7820 5c28 5c63 616d 6572 616d 6174 7269 x \(\cameramatri │ │ │ -000906d0: 787b 417d 5c29 202e 0a4e 6f74 6520 7468 x{A}\) ..Note th │ │ │ -000906e0: 6174 2074 6869 7320 6675 6e63 7469 6f6e at this function │ │ │ -000906f0: 2061 7373 756d 6573 2074 6861 7420 706f assumes that po │ │ │ -00090700: 696e 7473 3120 616e 6420 706f 696e 7473 ints1 and points │ │ │ -00090710: 3220 6172 6520 6665 6174 7572 6520 706f 2 are feature po │ │ │ -00090720: 696e 7473 2066 726f 6d20 6361 6d65 7261 ints from camera │ │ │ -00090730: 7320 7769 7468 2074 6865 0a73 616d 6520 s with the.same │ │ │ -00090740: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ -00090750: 206d 6174 7269 782e 2049 6620 7468 6973 matrix. If this │ │ │ -00090760: 2061 7373 756d 7074 696f 6e20 646f 6573 assumption does │ │ │ -00090770: 206e 6f74 2068 6f6c 6420 666f 7220 796f not hold for yo │ │ │ -00090780: 7572 2075 7365 2063 6173 652c 2075 7365 ur use case, use │ │ │ -00090790: 2061 6e6f 7468 6572 0a66 756e 6374 696f another.functio │ │ │ -000907a0: 6e20 6f76 6572 6c6f 6164 206f 7220 2375 n overload or #u │ │ │ -000907b0: 6e64 6973 746f 7274 506f 696e 7473 2077 ndistortPoints w │ │ │ -000907c0: 6974 6820 3c63 6f64 653e 5020 3d20 6376 ith P = cv │ │ │ -000907d0: 3a3a 4e6f 4172 7261 7928 293c 2f63 6f64 ::NoArray() for both came │ │ │ -000907f0: 7261 7320 746f 2074 7261 6e73 666f 726d ras to transform │ │ │ -00090800: 2069 6d61 6765 0a70 6f69 6e74 7320 746f image.points to │ │ │ -00090810: 206e 6f72 6d61 6c69 7a65 6420 696d 6167 normalized imag │ │ │ -00090820: 6520 636f 6f72 6469 6e61 7465 732c 2077 e coordinates, w │ │ │ -00090830: 6869 6368 2061 7265 2076 616c 6964 2066 hich are valid f │ │ │ -00090840: 6f72 2074 6865 2069 6465 6e74 6974 7920 or the identity │ │ │ -00090850: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ -00090860: 206d 6174 7269 782e 0a57 6865 6e20 7061 matrix..When pa │ │ │ -00090870: 7373 696e 6720 7468 6573 6520 636f 6f72 ssing these coor │ │ │ -00090880: 6469 6e61 7465 732c 2070 6173 7320 7468 dinates, pass th │ │ │ -00090890: 6520 6964 656e 7469 7479 206d 6174 7269 e identity matri │ │ │ -000908a0: 7820 666f 7220 7468 6973 2070 6172 616d x for this param │ │ │ -000908b0: 6574 6572 2e3c 2f64 643e 0a3c 6464 3e3c eter.
    .
    < │ │ │ -000908c0: 636f 6465 3e6d 6574 686f 643c 2f63 6f64 code>method - Method for │ │ │ -000908e0: 636f 6d70 7574 696e 6720 616e 2065 7373 computing an ess │ │ │ -000908f0: 656e 7469 616c 206d 6174 7269 782e 0a3c ential matrix..< │ │ │ -00090900: 756c 3e0a 2020 3c6c 693e 0a20 2020 5245 ul>.
  • . RE │ │ │ -00090910: 463a 2052 414e 5341 4320 666f 7220 7468 F: RANSAC for th │ │ │ -00090920: 6520 5241 4e53 4143 2061 6c67 6f72 6974 e RANSAC algorit │ │ │ -00090930: 686d 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c hm..
  • . . REF: LMEDS │ │ │ -00090950: 2066 6f72 2074 6865 204c 4d65 6453 2061 for the LMedS a │ │ │ -00090960: 6c67 6f72 6974 686d 2e0a 2020 3c2f 6c69 lgorithm..
  • ..
    prob - Parameter u │ │ │ -000909a0: 7365 6420 666f 7220 7468 6520 5241 4e53 sed for the RANS │ │ │ -000909b0: 4143 206f 7220 4c4d 6564 5320 6d65 7468 AC or LMedS meth │ │ │ -000909c0: 6f64 7320 6f6e 6c79 2e20 4974 2073 7065 ods only. It spe │ │ │ -000909d0: 6369 6669 6573 2061 2064 6573 6972 6162 cifies a desirab │ │ │ -000909e0: 6c65 206c 6576 656c 206f 660a 636f 6e66 le level of.conf │ │ │ -000909f0: 6964 656e 6365 2028 7072 6f62 6162 696c idence (probabil │ │ │ -00090a00: 6974 7929 2074 6861 7420 7468 6520 6573 ity) that the es │ │ │ -00090a10: 7469 6d61 7465 6420 6d61 7472 6978 2069 timated matrix i │ │ │ -00090a20: 7320 636f 7272 6563 742e 3c2f 6464 3e0a s correct.
    . │ │ │ -00090a30: 3c64 643e 3c63 6f64 653e 7468 7265 7368
    thresh │ │ │ -00090a40: 6f6c 643c 2f63 6f64 653e 202d 2050 6172 old - Par │ │ │ -00090a50: 616d 6574 6572 2075 7365 6420 666f 7220 ameter used for │ │ │ -00090a60: 5241 4e53 4143 2e20 4974 2069 7320 7468 RANSAC. It is th │ │ │ -00090a70: 6520 6d61 7869 6d75 6d20 6469 7374 616e e maximum distan │ │ │ -00090a80: 6365 2066 726f 6d20 6120 706f 696e 7420 ce from a point │ │ │ -00090a90: 746f 2061 6e20 6570 6970 6f6c 6172 0a6c to an epipolar.l │ │ │ -00090aa0: 696e 6520 696e 2070 6978 656c 732c 2062 ine in pixels, b │ │ │ -00090ab0: 6579 6f6e 6420 7768 6963 6820 7468 6520 eyond which the │ │ │ -00090ac0: 706f 696e 7420 6973 2063 6f6e 7369 6465 point is conside │ │ │ -00090ad0: 7265 6420 616e 206f 7574 6c69 6572 2061 red an outlier a │ │ │ -00090ae0: 6e64 2069 7320 6e6f 7420 7573 6564 2066 nd is not used f │ │ │ -00090af0: 6f72 2063 6f6d 7075 7469 6e67 2074 6865 or computing the │ │ │ -00090b00: 0a66 696e 616c 2066 756e 6461 6d65 6e74 .final fundament │ │ │ -00090b10: 616c 206d 6174 7269 782e 2049 7420 6361 al matrix. It ca │ │ │ -00090b20: 6e20 6265 2073 6574 2074 6f20 736f 6d65 n be set to some │ │ │ -00090b30: 7468 696e 6720 6c69 6b65 2031 2d33 2c20 thing like 1-3, │ │ │ -00090b40: 6465 7065 6e64 696e 6720 6f6e 2074 6865 depending on the │ │ │ -00090b50: 2061 6363 7572 6163 7920 6f66 2074 6865 accuracy of the │ │ │ -00090b60: 0a70 6f69 6e74 206c 6f63 616c 697a 6174 .point localizat │ │ │ -00090b70: 696f 6e2c 2069 6d61 6765 2072 6573 6f6c ion, image resol │ │ │ -00090b80: 7574 696f 6e2c 2061 6e64 2074 6865 2069 ution, and the i │ │ │ -00090b90: 6d61 6765 206e 6f69 7365 2e3c 2f64 643e mage noise.
    │ │ │ -00090ba0: 0a3c 6464 3e3c 636f 6465 3e6d 6178 4974 .
    maxIt │ │ │ -00090bb0: 6572 733c 2f63 6f64 653e 202d 2054 6865 ers - The │ │ │ -00090bc0: 206d 6178 696d 756d 206e 756d 6265 7220 maximum number │ │ │ -00090bd0: 6f66 2072 6f62 7573 7420 6d65 7468 6f64 of robust method │ │ │ -00090be0: 2069 7465 7261 7469 6f6e 732e 0a0a 5468 iterations...Th │ │ │ -00090bf0: 6973 2066 756e 6374 696f 6e20 6573 7469 is function esti │ │ │ -00090c00: 6d61 7465 7320 6573 7365 6e74 6961 6c20 mates essential │ │ │ -00090c10: 6d61 7472 6978 2062 6173 6564 206f 6e20 matrix based on │ │ │ -00090c20: 7468 6520 6669 7665 2d70 6f69 6e74 2061 the five-point a │ │ │ -00090c30: 6c67 6f72 6974 686d 2073 6f6c 7665 7220 lgorithm solver │ │ │ -00090c40: 696e 2043 4954 453a 204e 6973 7465 7230 in CITE: Nister0 │ │ │ -00090c50: 3320 2e0a 4349 5445 3a20 5374 6577 656e 3 ..CITE: Stewen │ │ │ -00090c60: 6975 7343 4653 2069 7320 616c 736f 2061 iusCFS is also a │ │ │ -00090c70: 2072 656c 6174 6564 2e20 5468 6520 6570 related. The ep │ │ │ -00090c80: 6970 6f6c 6172 2067 656f 6d65 7472 7920 ipolar geometry │ │ │ -00090c90: 6973 2064 6573 6372 6962 6564 2062 7920 is described by │ │ │ -00090ca0: 7468 6520 666f 6c6c 6f77 696e 6720 6571 the following eq │ │ │ -00090cb0: 7561 7469 6f6e 3a0a 0a5c 285b 705f 323b uation:..\([p_2; │ │ │ -00090cc0: 2031 5d5e 5420 4b5e 7b2d 547d 2045 204b 1]^T K^{-T} E K │ │ │ -00090cd0: 5e7b 2d31 7d20 5b70 5f31 3b20 315d 203d ^{-1} [p_1; 1] = │ │ │ -00090ce0: 2030 5c29 0a0a 7768 6572 6520 5c28 455c 0\)..where \(E\ │ │ │ -00090cf0: 2920 6973 2061 6e20 6573 7365 6e74 6961 ) is an essentia │ │ │ -00090d00: 6c20 6d61 7472 6978 2c20 5c28 705f 315c l matrix, \(p_1\ │ │ │ -00090d10: 2920 616e 6420 5c28 705f 325c 2920 6172 ) and \(p_2\) ar │ │ │ -00090d20: 6520 636f 7272 6573 706f 6e64 696e 6720 e corresponding │ │ │ -00090d30: 706f 696e 7473 2069 6e20 7468 6520 6669 points in the fi │ │ │ -00090d40: 7273 7420 616e 6420 7468 650a 7365 636f rst and the.seco │ │ │ -00090d50: 6e64 2069 6d61 6765 732c 2072 6573 7065 nd images, respe │ │ │ -00090d60: 6374 6976 656c 792e 2054 6865 2072 6573 ctively. The res │ │ │ -00090d70: 756c 7420 6f66 2074 6869 7320 6675 6e63 ult of this func │ │ │ -00090d80: 7469 6f6e 206d 6179 2062 6520 7061 7373 tion may be pass │ │ │ -00090d90: 6564 2066 7572 7468 6572 2074 6f0a 2364 ed further to.#d │ │ │ -00090da0: 6563 6f6d 706f 7365 4573 7365 6e74 6961 ecomposeEssentia │ │ │ -00090db0: 6c4d 6174 206f 7220 2372 6563 6f76 6572 lMat or #recover │ │ │ -00090dc0: 506f 7365 2074 6f20 7265 636f 7665 7220 Pose to recover │ │ │ -00090dd0: 7468 6520 7265 6c61 7469 7665 2070 6f73 the relative pos │ │ │ -00090de0: 6520 6265 7477 6565 6e20 6361 6d65 7261 e between camera │ │ │ -00090df0: 732e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 s.
    .
    mask - │ │ │ -00090e10: 4f75 7470 7574 2061 7272 6179 206f 6620 Output array of │ │ │ -00090e20: 4e20 656c 656d 656e 7473 2c20 6576 6572 N elements, ever │ │ │ -00090e30: 7920 656c 656d 656e 7420 6f66 2077 6869 y element of whi │ │ │ -00090e40: 6368 2069 7320 7365 7420 746f 2030 2066 ch is set to 0 f │ │ │ -00090e50: 6f72 206f 7574 6c69 6572 7320 616e 6420 or outliers and │ │ │ -00090e60: 746f 2031 0a66 6f72 2074 6865 206f 7468 to 1.for the oth │ │ │ -00090e70: 6572 2070 6f69 6e74 732e 2054 6865 2061 er points. The a │ │ │ -00090e80: 7272 6179 2069 7320 636f 6d70 7574 6564 rray is computed │ │ │ -00090e90: 206f 6e6c 7920 696e 2074 6865 2052 414e only in the RAN │ │ │ -00090ea0: 5341 4320 616e 6420 4c4d 6564 5320 6d65 SAC and LMedS me │ │ │ -00090eb0: 7468 6f64 732e 3c2f 6464 3e0a 3c64 743e thods.
    .
    │ │ │ -00090ec0: 5265 7475 726e 733a 3c2f 6474 3e0a 3c64 Returns:
    .automatically │ │ │ -00090ee0: 6765 6e65 7261 7465 643c 2f64 643e 0a3c generated.< │ │ │ -00090ef0: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>....
  • .
    .

    findEsse │ │ │ -00090fa0: 6e74 6961 6c4d 6174 3c2f 6833 3e0a 3c64 ntialMat

    ..public stati │ │ │ -00091010: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c Mat findEssential │ │ │ -000910b0: 4d61 743c 2f73 7061 6e3e 3c77 6272 3e3c Mat< │ │ │ -000910c0: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ -000910d0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ -00091120: 703b 706f 696e 7473 312c 0a20 3c61 2068 p;points1,. Mat& │ │ │ -00091170: 6e62 7370 3b70 6f69 6e74 7332 2c0a 203c nbsp;points2,. < │ │ │ -00091180: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00091190: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000911a0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000911b0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ -000911d0: 7472 6978 2c0a 2069 6e74 266e 6273 703b trix,. int  │ │ │ -000911e0: 6d65 7468 6f64 2c0a 2064 6f75 626c 6526 method,. double& │ │ │ -000911f0: 6e62 7370 3b70 726f 622c 0a20 646f 7562 nbsp;prob,. doub │ │ │ -00091200: 6c65 266e 6273 703b 7468 7265 7368 6f6c le threshol │ │ │ -00091210: 642c 0a20 696e 7426 6e62 7370 3b6d 6178 d,. int max │ │ │ -00091220: 4974 6572 7329 3c2f 7370 616e 3e3c 2f64 Iters).
    Calculate │ │ │ -00091250: 7320 616e 2065 7373 656e 7469 616c 206d s an essential m │ │ │ -00091260: 6174 7269 7820 6672 6f6d 2074 6865 2063 atrix from the c │ │ │ -00091270: 6f72 7265 7370 6f6e 6469 6e67 2070 6f69 orresponding poi │ │ │ -00091280: 6e74 7320 696e 2074 776f 2069 6d61 6765 nts in two image │ │ │ -00091290: 732e 3c2f 6469 763e 0a3c 646c 2063 6c61 s.
    .
    .
    │ │ │ -000912b0: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ -000912c0: 0a3c 6464 3e3c 636f 6465 3e70 6f69 6e74 .
    point │ │ │ -000912d0: 7331 3c2f 636f 6465 3e20 2d20 4172 7261 s1 - Arra │ │ │ -000912e0: 7920 6f66 204e 2028 4e20 2667 743b 3d20 y of N (N >= │ │ │ -000912f0: 3529 2032 4420 706f 696e 7473 2066 726f 5) 2D points fro │ │ │ -00091300: 6d20 7468 6520 6669 7273 7420 696d 6167 m the first imag │ │ │ -00091310: 652e 2054 6865 2070 6f69 6e74 2063 6f6f e. The point coo │ │ │ -00091320: 7264 696e 6174 6573 2073 686f 756c 640a rdinates should. │ │ │ -00091330: 6265 2066 6c6f 6174 696e 672d 706f 696e be floating-poin │ │ │ -00091340: 7420 2873 696e 676c 6520 6f72 2064 6f75 t (single or dou │ │ │ -00091350: 626c 6520 7072 6563 6973 696f 6e29 2e3c ble precision).< │ │ │ -00091360: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e70 /dd>.
    p │ │ │ -00091370: 6f69 6e74 7332 3c2f 636f 6465 3e20 2d20 oints2 - │ │ │ -00091380: 4172 7261 7920 6f66 2074 6865 2073 6563 Array of the sec │ │ │ -00091390: 6f6e 6420 696d 6167 6520 706f 696e 7473 ond image points │ │ │ -000913a0: 206f 6620 7468 6520 7361 6d65 2073 697a of the same siz │ │ │ -000913b0: 6520 616e 6420 666f 726d 6174 2061 7320 e and format as │ │ │ -000913c0: 706f 696e 7473 312e 3c2f 6464 3e0a 3c64 points1.
    .cameraMa │ │ │ -000913e0: 7472 6978 3c2f 636f 6465 3e20 2d20 4361 trix - Ca │ │ │ -000913f0: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -00091400: 6174 7269 7820 5c28 5c63 616d 6572 616d atrix \(\cameram │ │ │ -00091410: 6174 7269 787b 417d 5c29 202e 0a4e 6f74 atrix{A}\) ..Not │ │ │ -00091420: 6520 7468 6174 2074 6869 7320 6675 6e63 e that this func │ │ │ -00091430: 7469 6f6e 2061 7373 756d 6573 2074 6861 tion assumes tha │ │ │ -00091440: 7420 706f 696e 7473 3120 616e 6420 706f t points1 and po │ │ │ -00091450: 696e 7473 3220 6172 6520 6665 6174 7572 ints2 are featur │ │ │ -00091460: 6520 706f 696e 7473 2066 726f 6d20 6361 e points from ca │ │ │ -00091470: 6d65 7261 7320 7769 7468 2074 6865 0a73 meras with the.s │ │ │ -00091480: 616d 6520 6361 6d65 7261 2069 6e74 7269 ame camera intri │ │ │ -00091490: 6e73 6963 206d 6174 7269 782e 2049 6620 nsic matrix. If │ │ │ -000914a0: 7468 6973 2061 7373 756d 7074 696f 6e20 this assumption │ │ │ -000914b0: 646f 6573 206e 6f74 2068 6f6c 6420 666f does not hold fo │ │ │ -000914c0: 7220 796f 7572 2075 7365 2063 6173 652c r your use case, │ │ │ -000914d0: 2075 7365 2061 6e6f 7468 6572 0a66 756e use another.fun │ │ │ -000914e0: 6374 696f 6e20 6f76 6572 6c6f 6164 206f ction overload o │ │ │ -000914f0: 7220 2375 6e64 6973 746f 7274 506f 696e r #undistortPoin │ │ │ -00091500: 7473 2077 6974 6820 3c63 6f64 653e 5020 ts with P │ │ │ -00091510: 3d20 6376 3a3a 4e6f 4172 7261 7928 293c = cv::NoArray()< │ │ │ -00091520: 2f63 6f64 653e 2066 6f72 2062 6f74 6820 /code> for both │ │ │ -00091530: 6361 6d65 7261 7320 746f 2074 7261 6e73 cameras to trans │ │ │ -00091540: 666f 726d 2069 6d61 6765 0a70 6f69 6e74 form image.point │ │ │ -00091550: 7320 746f 206e 6f72 6d61 6c69 7a65 6420 s to normalized │ │ │ -00091560: 696d 6167 6520 636f 6f72 6469 6e61 7465 image coordinate │ │ │ -00091570: 732c 2077 6869 6368 2061 7265 2076 616c s, which are val │ │ │ -00091580: 6964 2066 6f72 2074 6865 2069 6465 6e74 id for the ident │ │ │ -00091590: 6974 7920 6361 6d65 7261 2069 6e74 7269 ity camera intri │ │ │ -000915a0: 6e73 6963 206d 6174 7269 782e 0a57 6865 nsic matrix..Whe │ │ │ -000915b0: 6e20 7061 7373 696e 6720 7468 6573 6520 n passing these │ │ │ -000915c0: 636f 6f72 6469 6e61 7465 732c 2070 6173 coordinates, pas │ │ │ -000915d0: 7320 7468 6520 6964 656e 7469 7479 206d s the identity m │ │ │ -000915e0: 6174 7269 7820 666f 7220 7468 6973 2070 atrix for this p │ │ │ -000915f0: 6172 616d 6574 6572 2e3c 2f64 643e 0a3c arameter..< │ │ │ -00091600: 6464 3e3c 636f 6465 3e6d 6574 686f 643c dd>method< │ │ │ -00091610: 2f63 6f64 653e 202d 204d 6574 686f 6420 /code> - Method │ │ │ -00091620: 666f 7220 636f 6d70 7574 696e 6720 616e for computing an │ │ │ -00091630: 2065 7373 656e 7469 616c 206d 6174 7269 essential matri │ │ │ -00091640: 782e 0a3c 756c 3e0a 2020 3c6c 693e 0a20 x..
      .
    • . │ │ │ -00091650: 2020 5245 463a 2052 414e 5341 4320 666f REF: RANSAC fo │ │ │ -00091660: 7220 7468 6520 5241 4e53 4143 2061 6c67 r the RANSAC alg │ │ │ -00091670: 6f72 6974 686d 2e0a 2020 3c2f 6c69 3e0a orithm..
    • . │ │ │ -00091680: 2020 3c6c 693e 0a20 2020 5245 463a 204c
    • . REF: L │ │ │ -00091690: 4d45 4453 2066 6f72 2074 6865 204c 4d65 MEDS for the LMe │ │ │ -000916a0: 6453 2061 6c67 6f72 6974 686d 2e0a 2020 dS algorithm.. │ │ │ -000916b0: 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64 643e
    • .
    │ │ │ -000916c0: 0a3c 6464 3e3c 636f 6465 3e70 726f 623c .
    prob< │ │ │ -000916d0: 2f63 6f64 653e 202d 2050 6172 616d 6574 /code> - Paramet │ │ │ -000916e0: 6572 2075 7365 6420 666f 7220 7468 6520 er used for the │ │ │ -000916f0: 5241 4e53 4143 206f 7220 4c4d 6564 5320 RANSAC or LMedS │ │ │ -00091700: 6d65 7468 6f64 7320 6f6e 6c79 2e20 4974 methods only. It │ │ │ -00091710: 2073 7065 6369 6669 6573 2061 2064 6573 specifies a des │ │ │ -00091720: 6972 6162 6c65 206c 6576 656c 206f 660a irable level of. │ │ │ -00091730: 636f 6e66 6964 656e 6365 2028 7072 6f62 confidence (prob │ │ │ -00091740: 6162 696c 6974 7929 2074 6861 7420 7468 ability) that th │ │ │ -00091750: 6520 6573 7469 6d61 7465 6420 6d61 7472 e estimated matr │ │ │ -00091760: 6978 2069 7320 636f 7272 6563 742e 3c2f ix is correct..
    th │ │ │ -00091780: 7265 7368 6f6c 643c 2f63 6f64 653e 202d reshold - │ │ │ -00091790: 2050 6172 616d 6574 6572 2075 7365 6420 Parameter used │ │ │ -000917a0: 666f 7220 5241 4e53 4143 2e20 4974 2069 for RANSAC. It i │ │ │ -000917b0: 7320 7468 6520 6d61 7869 6d75 6d20 6469 s the maximum di │ │ │ -000917c0: 7374 616e 6365 2066 726f 6d20 6120 706f stance from a po │ │ │ -000917d0: 696e 7420 746f 2061 6e20 6570 6970 6f6c int to an epipol │ │ │ -000917e0: 6172 0a6c 696e 6520 696e 2070 6978 656c ar.line in pixel │ │ │ -000917f0: 732c 2062 6579 6f6e 6420 7768 6963 6820 s, beyond which │ │ │ -00091800: 7468 6520 706f 696e 7420 6973 2063 6f6e the point is con │ │ │ -00091810: 7369 6465 7265 6420 616e 206f 7574 6c69 sidered an outli │ │ │ -00091820: 6572 2061 6e64 2069 7320 6e6f 7420 7573 er and is not us │ │ │ -00091830: 6564 2066 6f72 2063 6f6d 7075 7469 6e67 ed for computing │ │ │ -00091840: 2074 6865 0a66 696e 616c 2066 756e 6461 the.final funda │ │ │ -00091850: 6d65 6e74 616c 206d 6174 7269 782e 2049 mental matrix. I │ │ │ -00091860: 7420 6361 6e20 6265 2073 6574 2074 6f20 t can be set to │ │ │ -00091870: 736f 6d65 7468 696e 6720 6c69 6b65 2031 something like 1 │ │ │ -00091880: 2d33 2c20 6465 7065 6e64 696e 6720 6f6e -3, depending on │ │ │ -00091890: 2074 6865 2061 6363 7572 6163 7920 6f66 the accuracy of │ │ │ -000918a0: 2074 6865 0a70 6f69 6e74 206c 6f63 616c the.point local │ │ │ -000918b0: 697a 6174 696f 6e2c 2069 6d61 6765 2072 ization, image r │ │ │ -000918c0: 6573 6f6c 7574 696f 6e2c 2061 6e64 2074 esolution, and t │ │ │ -000918d0: 6865 2069 6d61 6765 206e 6f69 7365 2e0a he image noise.. │ │ │ -000918e0: 666f 7220 7468 6520 6f74 6865 7220 706f for the other po │ │ │ -000918f0: 696e 7473 2e20 5468 6520 6172 7261 7920 ints. The array │ │ │ -00091900: 6973 2063 6f6d 7075 7465 6420 6f6e 6c79 is computed only │ │ │ -00091910: 2069 6e20 7468 6520 5241 4e53 4143 2061 in the RANSAC a │ │ │ -00091920: 6e64 204c 4d65 6453 206d 6574 686f 6473 nd LMedS methods │ │ │ -00091930: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    maxIters │ │ │ -00091950: 202d 2054 6865 206d 6178 696d 756d 206e - The maximum n │ │ │ -00091960: 756d 6265 7220 6f66 2072 6f62 7573 7420 umber of robust │ │ │ -00091970: 6d65 7468 6f64 2069 7465 7261 7469 6f6e method iteration │ │ │ -00091980: 732e 0a0a 5468 6973 2066 756e 6374 696f s...This functio │ │ │ -00091990: 6e20 6573 7469 6d61 7465 7320 6573 7365 n estimates esse │ │ │ -000919a0: 6e74 6961 6c20 6d61 7472 6978 2062 6173 ntial matrix bas │ │ │ -000919b0: 6564 206f 6e20 7468 6520 6669 7665 2d70 ed on the five-p │ │ │ -000919c0: 6f69 6e74 2061 6c67 6f72 6974 686d 2073 oint algorithm s │ │ │ -000919d0: 6f6c 7665 7220 696e 2043 4954 453a 204e olver in CITE: N │ │ │ -000919e0: 6973 7465 7230 3320 2e0a 4349 5445 3a20 ister03 ..CITE: │ │ │ -000919f0: 5374 6577 656e 6975 7343 4653 2069 7320 SteweniusCFS is │ │ │ -00091a00: 616c 736f 2061 2072 656c 6174 6564 2e20 also a related. │ │ │ -00091a10: 5468 6520 6570 6970 6f6c 6172 2067 656f The epipolar geo │ │ │ -00091a20: 6d65 7472 7920 6973 2064 6573 6372 6962 metry is describ │ │ │ -00091a30: 6564 2062 7920 7468 6520 666f 6c6c 6f77 ed by the follow │ │ │ -00091a40: 696e 6720 6571 7561 7469 6f6e 3a0a 0a5c ing equation:..\ │ │ │ -00091a50: 285b 705f 323b 2031 5d5e 5420 4b5e 7b2d ([p_2; 1]^T K^{- │ │ │ -00091a60: 547d 2045 204b 5e7b 2d31 7d20 5b70 5f31 T} E K^{-1} [p_1 │ │ │ -00091a70: 3b20 315d 203d 2030 5c29 0a0a 7768 6572 ; 1] = 0\)..wher │ │ │ -00091a80: 6520 5c28 455c 2920 6973 2061 6e20 6573 e \(E\) is an es │ │ │ -00091a90: 7365 6e74 6961 6c20 6d61 7472 6978 2c20 sential matrix, │ │ │ -00091aa0: 5c28 705f 315c 2920 616e 6420 5c28 705f \(p_1\) and \(p_ │ │ │ -00091ab0: 325c 2920 6172 6520 636f 7272 6573 706f 2\) are correspo │ │ │ -00091ac0: 6e64 696e 6720 706f 696e 7473 2069 6e20 nding points in │ │ │ -00091ad0: 7468 6520 6669 7273 7420 616e 6420 7468 the first and th │ │ │ -00091ae0: 650a 7365 636f 6e64 2069 6d61 6765 732c e.second images, │ │ │ -00091af0: 2072 6573 7065 6374 6976 656c 792e 2054 respectively. T │ │ │ -00091b00: 6865 2072 6573 756c 7420 6f66 2074 6869 he result of thi │ │ │ -00091b10: 7320 6675 6e63 7469 6f6e 206d 6179 2062 s function may b │ │ │ -00091b20: 6520 7061 7373 6564 2066 7572 7468 6572 e passed further │ │ │ -00091b30: 2074 6f0a 2364 6563 6f6d 706f 7365 4573 to.#decomposeEs │ │ │ -00091b40: 7365 6e74 6961 6c4d 6174 206f 7220 2372 sentialMat or #r │ │ │ -00091b50: 6563 6f76 6572 506f 7365 2074 6f20 7265 ecoverPose to re │ │ │ -00091b60: 636f 7665 7220 7468 6520 7265 6c61 7469 cover the relati │ │ │ -00091b70: 7665 2070 6f73 6520 6265 7477 6565 6e20 ve pose between │ │ │ -00091b80: 6361 6d65 7261 732e 3c2f 6464 3e0a 3c64 cameras.
    .Returns:. │ │ │ -00091ba0: 3c64 643e 6175 746f 6d61 7469 6361 6c6c
    automaticall │ │ │ -00091bb0: 7920 6765 6e65 7261 7465 643c 2f64 643e y generated
    │ │ │ -00091bc0: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    ...
  • .< │ │ │ -00091be0: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .

    findEssent │ │ │ -00091c70: 6961 6c4d 6174 3c2f 6833 3e0a 3c64 6976 ialMat

    .
    .
    public static< │ │ │ -00091ce0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> Mat │ │ │ -00091d50: 266e 6273 703b 3c73 7061 6e20 636c 6173  findEssentialMa │ │ │ -00091d80: 743c 2f73 7061 6e3e 3c77 6272 3e3c 7370 t(Mat  │ │ │ -00091df0: 706f 696e 7473 312c 0a20 3c61 2068 7265 points1,. Mat&nb │ │ │ -00091e40: 7370 3b70 6f69 6e74 7332 2c0a 203c 6120 sp;points2,. Mat │ │ │ -00091e90: 266e 6273 703b 6361 6d65 7261 4d61 7472  cameraMatr │ │ │ -00091ea0: 6978 2c0a 2069 6e74 266e 6273 703b 6d65 ix,. int me │ │ │ -00091eb0: 7468 6f64 2c0a 2064 6f75 626c 6526 6e62 thod,. double&nb │ │ │ -00091ec0: 7370 3b70 726f 622c 0a20 646f 7562 6c65 sp;prob,. double │ │ │ -00091ed0: 266e 6273 703b 7468 7265 7368 6f6c 6429  threshold) │ │ │ -00091ee0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Calculates an e │ │ │ -00091f10: 7373 656e 7469 616c 206d 6174 7269 7820 ssential matrix │ │ │ -00091f20: 6672 6f6d 2074 6865 2063 6f72 7265 7370 from the corresp │ │ │ -00091f30: 6f6e 6469 6e67 2070 6f69 6e74 7320 696e onding points in │ │ │ -00091f40: 2074 776f 2069 6d61 6765 732e 3c2f 6469 two images..
    .
    Parame │ │ │ -00091f70: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ -00091f80: 636f 6465 3e70 6f69 6e74 7331 3c2f 636f code>points1 - Array of N │ │ │ -00091fa0: 2028 4e20 2667 743b 3d20 3529 2032 4420 (N >= 5) 2D │ │ │ -00091fb0: 706f 696e 7473 2066 726f 6d20 7468 6520 points from the │ │ │ -00091fc0: 6669 7273 7420 696d 6167 652e 2054 6865 first image. The │ │ │ -00091fd0: 2070 6f69 6e74 2063 6f6f 7264 696e 6174 point coordinat │ │ │ -00091fe0: 6573 2073 686f 756c 640a 6265 2066 6c6f es should.be flo │ │ │ -00091ff0: 6174 696e 672d 706f 696e 7420 2873 696e ating-point (sin │ │ │ -00092000: 676c 6520 6f72 2064 6f75 626c 6520 7072 gle or double pr │ │ │ -00092010: 6563 6973 696f 6e29 2e3c 2f64 643e 0a3c ecision).
    .< │ │ │ -00092020: 6464 3e3c 636f 6465 3e70 6f69 6e74 7332 dd>points2 │ │ │ -00092030: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ -00092040: 6f66 2074 6865 2073 6563 6f6e 6420 696d of the second im │ │ │ -00092050: 6167 6520 706f 696e 7473 206f 6620 7468 age points of th │ │ │ -00092060: 6520 7361 6d65 2073 697a 6520 616e 6420 e same size and │ │ │ -00092070: 666f 726d 6174 2061 7320 706f 696e 7473 format as points │ │ │ -00092080: 312e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 1..
    cameraMatrix - Camera i │ │ │ -000920b0: 6e74 7269 6e73 6963 206d 6174 7269 7820 ntrinsic matrix │ │ │ -000920c0: 5c28 5c63 616d 6572 616d 6174 7269 787b \(\cameramatrix{ │ │ │ -000920d0: 417d 5c29 202e 0a4e 6f74 6520 7468 6174 A}\) ..Note that │ │ │ -000920e0: 2074 6869 7320 6675 6e63 7469 6f6e 2061 this function a │ │ │ -000920f0: 7373 756d 6573 2074 6861 7420 706f 696e ssumes that poin │ │ │ -00092100: 7473 3120 616e 6420 706f 696e 7473 3220 ts1 and points2 │ │ │ -00092110: 6172 6520 6665 6174 7572 6520 706f 696e are feature poin │ │ │ -00092120: 7473 2066 726f 6d20 6361 6d65 7261 7320 ts from cameras │ │ │ -00092130: 7769 7468 2074 6865 0a73 616d 6520 6361 with the.same ca │ │ │ -00092140: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -00092150: 6174 7269 782e 2049 6620 7468 6973 2061 atrix. If this a │ │ │ -00092160: 7373 756d 7074 696f 6e20 646f 6573 206e ssumption does n │ │ │ -00092170: 6f74 2068 6f6c 6420 666f 7220 796f 7572 ot hold for your │ │ │ -00092180: 2075 7365 2063 6173 652c 2075 7365 2061 use case, use a │ │ │ -00092190: 6e6f 7468 6572 0a66 756e 6374 696f 6e20 nother.function │ │ │ -000921a0: 6f76 6572 6c6f 6164 206f 7220 2375 6e64 overload or #und │ │ │ -000921b0: 6973 746f 7274 506f 696e 7473 2077 6974 istortPoints wit │ │ │ -000921c0: 6820 3c63 6f64 653e 5020 3d20 6376 3a3a h P = cv:: │ │ │ -000921d0: 4e6f 4172 7261 7928 293c 2f63 6f64 653e NoArray() │ │ │ -000921e0: 2066 6f72 2062 6f74 6820 6361 6d65 7261 for both camera │ │ │ -000921f0: 7320 746f 2074 7261 6e73 666f 726d 2069 s to transform i │ │ │ -00092200: 6d61 6765 0a70 6f69 6e74 7320 746f 206e mage.points to n │ │ │ -00092210: 6f72 6d61 6c69 7a65 6420 696d 6167 6520 ormalized image │ │ │ -00092220: 636f 6f72 6469 6e61 7465 732c 2077 6869 coordinates, whi │ │ │ -00092230: 6368 2061 7265 2076 616c 6964 2066 6f72 ch are valid for │ │ │ -00092240: 2074 6865 2069 6465 6e74 6974 7920 6361 the identity ca │ │ │ -00092250: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -00092260: 6174 7269 782e 0a57 6865 6e20 7061 7373 atrix..When pass │ │ │ -00092270: 696e 6720 7468 6573 6520 636f 6f72 6469 ing these coordi │ │ │ -00092280: 6e61 7465 732c 2070 6173 7320 7468 6520 nates, pass the │ │ │ -00092290: 6964 656e 7469 7479 206d 6174 7269 7820 identity matrix │ │ │ -000922a0: 666f 7220 7468 6973 2070 6172 616d 6574 for this paramet │ │ │ -000922b0: 6572 2e3c 2f64 643e 0a3c 6464 3e3c 636f er.
    .
    method │ │ │ -000922d0: 202d 204d 6574 686f 6420 666f 7220 636f - Method for co │ │ │ -000922e0: 6d70 7574 696e 6720 616e 2065 7373 656e mputing an essen │ │ │ -000922f0: 7469 616c 206d 6174 7269 782e 0a3c 756c tial matrix..
      .
    • . REF: │ │ │ -00092310: 2052 414e 5341 4320 666f 7220 7468 6520 RANSAC for the │ │ │ -00092320: 5241 4e53 4143 2061 6c67 6f72 6974 686d RANSAC algorithm │ │ │ -00092330: 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c 693e ..
    • .
    • │ │ │ -00092340: 0a20 2020 5245 463a 204c 4d45 4453 2066 . REF: LMEDS f │ │ │ -00092350: 6f72 2074 6865 204c 4d65 6453 2061 6c67 or the LMedS alg │ │ │ -00092360: 6f72 6974 686d 2e0a 2020 3c2f 6c69 3e0a orithm..
    • . │ │ │ -00092370: 3c2f 756c 3e3c 2f64 643e 0a3c 6464 3e3c
    .
    < │ │ │ -00092380: 636f 6465 3e70 726f 623c 2f63 6f64 653e code>prob │ │ │ -00092390: 202d 2050 6172 616d 6574 6572 2075 7365 - Parameter use │ │ │ -000923a0: 6420 666f 7220 7468 6520 5241 4e53 4143 d for the RANSAC │ │ │ -000923b0: 206f 7220 4c4d 6564 5320 6d65 7468 6f64 or LMedS method │ │ │ -000923c0: 7320 6f6e 6c79 2e20 4974 2073 7065 6369 s only. It speci │ │ │ -000923d0: 6669 6573 2061 2064 6573 6972 6162 6c65 fies a desirable │ │ │ -000923e0: 206c 6576 656c 206f 660a 636f 6e66 6964 level of.confid │ │ │ -000923f0: 656e 6365 2028 7072 6f62 6162 696c 6974 ence (probabilit │ │ │ -00092400: 7929 2074 6861 7420 7468 6520 6573 7469 y) that the esti │ │ │ -00092410: 6d61 7465 6420 6d61 7472 6978 2069 7320 mated matrix is │ │ │ -00092420: 636f 7272 6563 742e 3c2f 6464 3e0a 3c64 correct.
    .threshol │ │ │ -00092440: 643c 2f63 6f64 653e 202d 2050 6172 616d d - Param │ │ │ -00092450: 6574 6572 2075 7365 6420 666f 7220 5241 eter used for RA │ │ │ -00092460: 4e53 4143 2e20 4974 2069 7320 7468 6520 NSAC. It is the │ │ │ -00092470: 6d61 7869 6d75 6d20 6469 7374 616e 6365 maximum distance │ │ │ -00092480: 2066 726f 6d20 6120 706f 696e 7420 746f from a point to │ │ │ -00092490: 2061 6e20 6570 6970 6f6c 6172 0a6c 696e an epipolar.lin │ │ │ -000924a0: 6520 696e 2070 6978 656c 732c 2062 6579 e in pixels, bey │ │ │ -000924b0: 6f6e 6420 7768 6963 6820 7468 6520 706f ond which the po │ │ │ -000924c0: 696e 7420 6973 2063 6f6e 7369 6465 7265 int is considere │ │ │ -000924d0: 6420 616e 206f 7574 6c69 6572 2061 6e64 d an outlier and │ │ │ -000924e0: 2069 7320 6e6f 7420 7573 6564 2066 6f72 is not used for │ │ │ -000924f0: 2063 6f6d 7075 7469 6e67 2074 6865 0a66 computing the.f │ │ │ -00092500: 696e 616c 2066 756e 6461 6d65 6e74 616c inal fundamental │ │ │ -00092510: 206d 6174 7269 782e 2049 7420 6361 6e20 matrix. It can │ │ │ -00092520: 6265 2073 6574 2074 6f20 736f 6d65 7468 be set to someth │ │ │ -00092530: 696e 6720 6c69 6b65 2031 2d33 2c20 6465 ing like 1-3, de │ │ │ -00092540: 7065 6e64 696e 6720 6f6e 2074 6865 2061 pending on the a │ │ │ -00092550: 6363 7572 6163 7920 6f66 2074 6865 0a70 ccuracy of the.p │ │ │ -00092560: 6f69 6e74 206c 6f63 616c 697a 6174 696f oint localizatio │ │ │ -00092570: 6e2c 2069 6d61 6765 2072 6573 6f6c 7574 n, image resolut │ │ │ -00092580: 696f 6e2c 2061 6e64 2074 6865 2069 6d61 ion, and the ima │ │ │ -00092590: 6765 206e 6f69 7365 2e0a 666f 7220 7468 ge noise..for th │ │ │ -000925a0: 6520 6f74 6865 7220 706f 696e 7473 2e20 e other points. │ │ │ -000925b0: 5468 6520 6172 7261 7920 6973 2063 6f6d The array is com │ │ │ -000925c0: 7075 7465 6420 6f6e 6c79 2069 6e20 7468 puted only in th │ │ │ -000925d0: 6520 5241 4e53 4143 2061 6e64 204c 4d65 e RANSAC and LMe │ │ │ -000925e0: 6453 206d 6574 686f 6473 2e0a 0a54 6869 dS methods...Thi │ │ │ -000925f0: 7320 6675 6e63 7469 6f6e 2065 7374 696d s function estim │ │ │ -00092600: 6174 6573 2065 7373 656e 7469 616c 206d ates essential m │ │ │ -00092610: 6174 7269 7820 6261 7365 6420 6f6e 2074 atrix based on t │ │ │ -00092620: 6865 2066 6976 652d 706f 696e 7420 616c he five-point al │ │ │ -00092630: 676f 7269 7468 6d20 736f 6c76 6572 2069 gorithm solver i │ │ │ -00092640: 6e20 4349 5445 3a20 4e69 7374 6572 3033 n CITE: Nister03 │ │ │ -00092650: 202e 0a43 4954 453a 2053 7465 7765 6e69 ..CITE: Steweni │ │ │ -00092660: 7573 4346 5320 6973 2061 6c73 6f20 6120 usCFS is also a │ │ │ -00092670: 7265 6c61 7465 642e 2054 6865 2065 7069 related. The epi │ │ │ -00092680: 706f 6c61 7220 6765 6f6d 6574 7279 2069 polar geometry i │ │ │ -00092690: 7320 6465 7363 7269 6265 6420 6279 2074 s described by t │ │ │ -000926a0: 6865 2066 6f6c 6c6f 7769 6e67 2065 7175 he following equ │ │ │ -000926b0: 6174 696f 6e3a 0a0a 5c28 5b70 5f32 3b20 ation:..\([p_2; │ │ │ -000926c0: 315d 5e54 204b 5e7b 2d54 7d20 4520 4b5e 1]^T K^{-T} E K^ │ │ │ -000926d0: 7b2d 317d 205b 705f 313b 2031 5d20 3d20 {-1} [p_1; 1] = │ │ │ -000926e0: 305c 290a 0a77 6865 7265 205c 2845 5c29 0\)..where \(E\) │ │ │ -000926f0: 2069 7320 616e 2065 7373 656e 7469 616c is an essential │ │ │ -00092700: 206d 6174 7269 782c 205c 2870 5f31 5c29 matrix, \(p_1\) │ │ │ -00092710: 2061 6e64 205c 2870 5f32 5c29 2061 7265 and \(p_2\) are │ │ │ -00092720: 2063 6f72 7265 7370 6f6e 6469 6e67 2070 corresponding p │ │ │ -00092730: 6f69 6e74 7320 696e 2074 6865 2066 6972 oints in the fir │ │ │ -00092740: 7374 2061 6e64 2074 6865 0a73 6563 6f6e st and the.secon │ │ │ -00092750: 6420 696d 6167 6573 2c20 7265 7370 6563 d images, respec │ │ │ -00092760: 7469 7665 6c79 2e20 5468 6520 7265 7375 tively. The resu │ │ │ -00092770: 6c74 206f 6620 7468 6973 2066 756e 6374 lt of this funct │ │ │ -00092780: 696f 6e20 6d61 7920 6265 2070 6173 7365 ion may be passe │ │ │ -00092790: 6420 6675 7274 6865 7220 746f 0a23 6465 d further to.#de │ │ │ -000927a0: 636f 6d70 6f73 6545 7373 656e 7469 616c composeEssential │ │ │ -000927b0: 4d61 7420 6f72 2023 7265 636f 7665 7250 Mat or #recoverP │ │ │ -000927c0: 6f73 6520 746f 2072 6563 6f76 6572 2074 ose to recover t │ │ │ -000927d0: 6865 2072 656c 6174 6976 6520 706f 7365 he relative pose │ │ │ -000927e0: 2062 6574 7765 656e 2063 616d 6572 6173 between cameras │ │ │ -000927f0: 2e3c 2f64 643e 0a3c 6474 3e52 6574 7572 ..
    Retur │ │ │ -00092800: 6e73 3a3c 2f64 743e 0a3c 6464 3e61 7574 ns:
    .
    aut │ │ │ -00092810: 6f6d 6174 6963 616c 6c79 2067 656e 6572 omatically gener │ │ │ -00092820: 6174 6564 3c2f 6464 3e0a 3c2f 646c 3e0a ated
    .
    . │ │ │ -00092830: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e
    .
    ..
  • ..

    findEsse │ │ │ -000928d0: 6e74 6961 6c4d 6174 3c2f 6833 3e0a 3c64 ntialMat

    ..public stati │ │ │ -00092940: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c Mat findEssential │ │ │ -000929e0: 4d61 743c 2f73 7061 6e3e 3c77 6272 3e3c Mat< │ │ │ -000929f0: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ -00092a00: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ -00092a50: 703b 706f 696e 7473 312c 0a20 3c61 2068 p;points1,. Mat& │ │ │ -00092aa0: 6e62 7370 3b70 6f69 6e74 7332 2c0a 203c nbsp;points2,. < │ │ │ -00092ab0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00092ac0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00092ad0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -00092ae0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ -00092b00: 7472 6978 2c0a 2069 6e74 266e 6273 703b trix,. int  │ │ │ -00092b10: 6d65 7468 6f64 2c0a 2064 6f75 626c 6526 method,. double& │ │ │ -00092b20: 6e62 7370 3b70 726f 6229 3c2f 7370 616e nbsp;prob).
    Calcu │ │ │ -00092b50: 6c61 7465 7320 616e 2065 7373 656e 7469 lates an essenti │ │ │ -00092b60: 616c 206d 6174 7269 7820 6672 6f6d 2074 al matrix from t │ │ │ -00092b70: 6865 2063 6f72 7265 7370 6f6e 6469 6e67 he corresponding │ │ │ -00092b80: 2070 6f69 6e74 7320 696e 2074 776f 2069 points in two i │ │ │ -00092b90: 6d61 6765 732e 3c2f 6469 763e 0a3c 646c mages.
    .
    . │ │ │ -00092bb0: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -00092bc0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e70 /dt>.
    p │ │ │ -00092bd0: 6f69 6e74 7331 3c2f 636f 6465 3e20 2d20 oints1 - │ │ │ -00092be0: 4172 7261 7920 6f66 204e 2028 4e20 2667 Array of N (N &g │ │ │ -00092bf0: 743b 3d20 3529 2032 4420 706f 696e 7473 t;= 5) 2D points │ │ │ -00092c00: 2066 726f 6d20 7468 6520 6669 7273 7420 from the first │ │ │ -00092c10: 696d 6167 652e 2054 6865 2070 6f69 6e74 image. The point │ │ │ -00092c20: 2063 6f6f 7264 696e 6174 6573 2073 686f coordinates sho │ │ │ -00092c30: 756c 640a 6265 2066 6c6f 6174 696e 672d uld.be floating- │ │ │ -00092c40: 706f 696e 7420 2873 696e 676c 6520 6f72 point (single or │ │ │ -00092c50: 2064 6f75 626c 6520 7072 6563 6973 696f double precisio │ │ │ -00092c60: 6e29 2e3c 2f64 643e 0a3c 6464 3e3c 636f n).
    .
    points2 - Array of the │ │ │ -00092c90: 2073 6563 6f6e 6420 696d 6167 6520 706f second image po │ │ │ -00092ca0: 696e 7473 206f 6620 7468 6520 7361 6d65 ints of the same │ │ │ -00092cb0: 2073 697a 6520 616e 6420 666f 726d 6174 size and format │ │ │ -00092cc0: 2061 7320 706f 696e 7473 312e 3c2f 6464 as points1.
    .
    came │ │ │ -00092ce0: 7261 4d61 7472 6978 3c2f 636f 6465 3e20 raMatrix │ │ │ -00092cf0: 2d20 4361 6d65 7261 2069 6e74 7269 6e73 - Camera intrins │ │ │ -00092d00: 6963 206d 6174 7269 7820 5c28 5c63 616d ic matrix \(\cam │ │ │ -00092d10: 6572 616d 6174 7269 787b 417d 5c29 202e eramatrix{A}\) . │ │ │ -00092d20: 0a4e 6f74 6520 7468 6174 2074 6869 7320 .Note that this │ │ │ -00092d30: 6675 6e63 7469 6f6e 2061 7373 756d 6573 function assumes │ │ │ -00092d40: 2074 6861 7420 706f 696e 7473 3120 616e that points1 an │ │ │ -00092d50: 6420 706f 696e 7473 3220 6172 6520 6665 d points2 are fe │ │ │ -00092d60: 6174 7572 6520 706f 696e 7473 2066 726f ature points fro │ │ │ -00092d70: 6d20 6361 6d65 7261 7320 7769 7468 2074 m cameras with t │ │ │ -00092d80: 6865 0a73 616d 6520 6361 6d65 7261 2069 he.same camera i │ │ │ -00092d90: 6e74 7269 6e73 6963 206d 6174 7269 782e ntrinsic matrix. │ │ │ -00092da0: 2049 6620 7468 6973 2061 7373 756d 7074 If this assumpt │ │ │ -00092db0: 696f 6e20 646f 6573 206e 6f74 2068 6f6c ion does not hol │ │ │ -00092dc0: 6420 666f 7220 796f 7572 2075 7365 2063 d for your use c │ │ │ -00092dd0: 6173 652c 2075 7365 2061 6e6f 7468 6572 ase, use another │ │ │ -00092de0: 0a66 756e 6374 696f 6e20 6f76 6572 6c6f .function overlo │ │ │ -00092df0: 6164 206f 7220 2375 6e64 6973 746f 7274 ad or #undistort │ │ │ -00092e00: 506f 696e 7473 2077 6974 6820 3c63 6f64 Points with P = cv::NoArra │ │ │ -00092e20: 7928 293c 2f63 6f64 653e 2066 6f72 2062 y() for b │ │ │ -00092e30: 6f74 6820 6361 6d65 7261 7320 746f 2074 oth cameras to t │ │ │ -00092e40: 7261 6e73 666f 726d 2069 6d61 6765 0a70 ransform image.p │ │ │ -00092e50: 6f69 6e74 7320 746f 206e 6f72 6d61 6c69 oints to normali │ │ │ -00092e60: 7a65 6420 696d 6167 6520 636f 6f72 6469 zed image coordi │ │ │ -00092e70: 6e61 7465 732c 2077 6869 6368 2061 7265 nates, which are │ │ │ -00092e80: 2076 616c 6964 2066 6f72 2074 6865 2069 valid for the i │ │ │ -00092e90: 6465 6e74 6974 7920 6361 6d65 7261 2069 dentity camera i │ │ │ -00092ea0: 6e74 7269 6e73 6963 206d 6174 7269 782e ntrinsic matrix. │ │ │ -00092eb0: 0a57 6865 6e20 7061 7373 696e 6720 7468 .When passing th │ │ │ -00092ec0: 6573 6520 636f 6f72 6469 6e61 7465 732c ese coordinates, │ │ │ -00092ed0: 2070 6173 7320 7468 6520 6964 656e 7469 pass the identi │ │ │ -00092ee0: 7479 206d 6174 7269 7820 666f 7220 7468 ty matrix for th │ │ │ -00092ef0: 6973 2070 6172 616d 6574 6572 2e3c 2f64 is parameter..
    met │ │ │ -00092f10: 686f 643c 2f63 6f64 653e 202d 204d 6574 hod - Met │ │ │ -00092f20: 686f 6420 666f 7220 636f 6d70 7574 696e hod for computin │ │ │ -00092f30: 6720 616e 2065 7373 656e 7469 616c 206d g an essential m │ │ │ -00092f40: 6174 7269 782e 0a3c 756c 3e0a 2020 3c6c atrix..
      . . REF: RANSA │ │ │ -00092f60: 4320 666f 7220 7468 6520 5241 4e53 4143 C for the RANSAC │ │ │ -00092f70: 2061 6c67 6f72 6974 686d 2e0a 2020 3c2f algorithm.. .
    • . RE │ │ │ -00092f90: 463a 204c 4d45 4453 2066 6f72 2074 6865 F: LMEDS for the │ │ │ -00092fa0: 204c 4d65 6453 2061 6c67 6f72 6974 686d LMedS algorithm │ │ │ -00092fb0: 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c ..
    • .
    < │ │ │ -00092fc0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e70 /dd>.
    p │ │ │ -00092fd0: 726f 623c 2f63 6f64 653e 202d 2050 6172 rob - Par │ │ │ -00092fe0: 616d 6574 6572 2075 7365 6420 666f 7220 ameter used for │ │ │ -00092ff0: 7468 6520 5241 4e53 4143 206f 7220 4c4d the RANSAC or LM │ │ │ -00093000: 6564 5320 6d65 7468 6f64 7320 6f6e 6c79 edS methods only │ │ │ -00093010: 2e20 4974 2073 7065 6369 6669 6573 2061 . It specifies a │ │ │ -00093020: 2064 6573 6972 6162 6c65 206c 6576 656c desirable level │ │ │ -00093030: 206f 660a 636f 6e66 6964 656e 6365 2028 of.confidence ( │ │ │ -00093040: 7072 6f62 6162 696c 6974 7929 2074 6861 probability) tha │ │ │ -00093050: 7420 7468 6520 6573 7469 6d61 7465 6420 t the estimated │ │ │ -00093060: 6d61 7472 6978 2069 7320 636f 7272 6563 matrix is correc │ │ │ -00093070: 742e 0a6c 696e 6520 696e 2070 6978 656c t..line in pixel │ │ │ -00093080: 732c 2062 6579 6f6e 6420 7768 6963 6820 s, beyond which │ │ │ -00093090: 7468 6520 706f 696e 7420 6973 2063 6f6e the point is con │ │ │ -000930a0: 7369 6465 7265 6420 616e 206f 7574 6c69 sidered an outli │ │ │ -000930b0: 6572 2061 6e64 2069 7320 6e6f 7420 7573 er and is not us │ │ │ -000930c0: 6564 2066 6f72 2063 6f6d 7075 7469 6e67 ed for computing │ │ │ -000930d0: 2074 6865 0a66 696e 616c 2066 756e 6461 the.final funda │ │ │ -000930e0: 6d65 6e74 616c 206d 6174 7269 782e 2049 mental matrix. I │ │ │ -000930f0: 7420 6361 6e20 6265 2073 6574 2074 6f20 t can be set to │ │ │ -00093100: 736f 6d65 7468 696e 6720 6c69 6b65 2031 something like 1 │ │ │ -00093110: 2d33 2c20 6465 7065 6e64 696e 6720 6f6e -3, depending on │ │ │ -00093120: 2074 6865 2061 6363 7572 6163 7920 6f66 the accuracy of │ │ │ -00093130: 2074 6865 0a70 6f69 6e74 206c 6f63 616c the.point local │ │ │ -00093140: 697a 6174 696f 6e2c 2069 6d61 6765 2072 ization, image r │ │ │ -00093150: 6573 6f6c 7574 696f 6e2c 2061 6e64 2074 esolution, and t │ │ │ -00093160: 6865 2069 6d61 6765 206e 6f69 7365 2e0a he image noise.. │ │ │ -00093170: 666f 7220 7468 6520 6f74 6865 7220 706f for the other po │ │ │ -00093180: 696e 7473 2e20 5468 6520 6172 7261 7920 ints. The array │ │ │ -00093190: 6973 2063 6f6d 7075 7465 6420 6f6e 6c79 is computed only │ │ │ -000931a0: 2069 6e20 7468 6520 5241 4e53 4143 2061 in the RANSAC a │ │ │ -000931b0: 6e64 204c 4d65 6453 206d 6574 686f 6473 nd LMedS methods │ │ │ -000931c0: 2e0a 0a54 6869 7320 6675 6e63 7469 6f6e ...This function │ │ │ -000931d0: 2065 7374 696d 6174 6573 2065 7373 656e estimates essen │ │ │ -000931e0: 7469 616c 206d 6174 7269 7820 6261 7365 tial matrix base │ │ │ -000931f0: 6420 6f6e 2074 6865 2066 6976 652d 706f d on the five-po │ │ │ -00093200: 696e 7420 616c 676f 7269 7468 6d20 736f int algorithm so │ │ │ -00093210: 6c76 6572 2069 6e20 4349 5445 3a20 4e69 lver in CITE: Ni │ │ │ -00093220: 7374 6572 3033 202e 0a43 4954 453a 2053 ster03 ..CITE: S │ │ │ -00093230: 7465 7765 6e69 7573 4346 5320 6973 2061 teweniusCFS is a │ │ │ -00093240: 6c73 6f20 6120 7265 6c61 7465 642e 2054 lso a related. T │ │ │ -00093250: 6865 2065 7069 706f 6c61 7220 6765 6f6d he epipolar geom │ │ │ -00093260: 6574 7279 2069 7320 6465 7363 7269 6265 etry is describe │ │ │ -00093270: 6420 6279 2074 6865 2066 6f6c 6c6f 7769 d by the followi │ │ │ -00093280: 6e67 2065 7175 6174 696f 6e3a 0a0a 5c28 ng equation:..\( │ │ │ -00093290: 5b70 5f32 3b20 315d 5e54 204b 5e7b 2d54 [p_2; 1]^T K^{-T │ │ │ -000932a0: 7d20 4520 4b5e 7b2d 317d 205b 705f 313b } E K^{-1} [p_1; │ │ │ -000932b0: 2031 5d20 3d20 305c 290a 0a77 6865 7265 1] = 0\)..where │ │ │ -000932c0: 205c 2845 5c29 2069 7320 616e 2065 7373 \(E\) is an ess │ │ │ -000932d0: 656e 7469 616c 206d 6174 7269 782c 205c ential matrix, \ │ │ │ -000932e0: 2870 5f31 5c29 2061 6e64 205c 2870 5f32 (p_1\) and \(p_2 │ │ │ -000932f0: 5c29 2061 7265 2063 6f72 7265 7370 6f6e \) are correspon │ │ │ -00093300: 6469 6e67 2070 6f69 6e74 7320 696e 2074 ding points in t │ │ │ -00093310: 6865 2066 6972 7374 2061 6e64 2074 6865 he first and the │ │ │ -00093320: 0a73 6563 6f6e 6420 696d 6167 6573 2c20 .second images, │ │ │ -00093330: 7265 7370 6563 7469 7665 6c79 2e20 5468 respectively. Th │ │ │ -00093340: 6520 7265 7375 6c74 206f 6620 7468 6973 e result of this │ │ │ -00093350: 2066 756e 6374 696f 6e20 6d61 7920 6265 function may be │ │ │ -00093360: 2070 6173 7365 6420 6675 7274 6865 7220 passed further │ │ │ -00093370: 746f 0a23 6465 636f 6d70 6f73 6545 7373 to.#decomposeEss │ │ │ -00093380: 656e 7469 616c 4d61 7420 6f72 2023 7265 entialMat or #re │ │ │ -00093390: 636f 7665 7250 6f73 6520 746f 2072 6563 coverPose to rec │ │ │ -000933a0: 6f76 6572 2074 6865 2072 656c 6174 6976 over the relativ │ │ │ -000933b0: 6520 706f 7365 2062 6574 7765 656e 2063 e pose between c │ │ │ -000933c0: 616d 6572 6173 2e3c 2f64 643e 0a3c 6474 ameras.
    .
    Returns:
    .< │ │ │ -000933e0: 6464 3e61 7574 6f6d 6174 6963 616c 6c79 dd>automatically │ │ │ -000933f0: 2067 656e 6572 6174 6564 3c2f 6464 3e0a generated. │ │ │ -00093400: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    ..
    .
  • ..
    .

    findEssen │ │ │ -000934a0: 7469 616c 4d61 743c 2f68 333e 0a3c 6469 tialMat

    ..public static │ │ │ -00093510: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  MatMat  │ │ │ +000744b0: 3b72 7665 6333 2c0a 203c 6120 6872 6566 ;rvec3,. Mat&nbs │ │ │ +00074500: 703b 7476 6563 332c 0a20 3c61 2068 7265 p;tvec3,. Mat&nb │ │ │ +00074550: 7370 3b64 7233 6472 312c 0a20 3c61 2068 sp;dr3dr1,. Mat& │ │ │ +000745a0: 6e62 7370 3b64 7233 6474 312c 0a20 3c61 nbsp;dr3dt1,. Mat dr3dr2,. │ │ │ +00074600: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +00074640: 2f61 3e26 6e62 7370 3b64 7233 6474 322c /a> dr3dt2, │ │ │ +00074650: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +00074690: 743c 2f61 3e26 6e62 7370 3b64 7433 6472 t dt3dr │ │ │ +000746a0: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ +000746e0: 4d61 743c 2f61 3e26 6e62 7370 3b64 7433 Mat dt3 │ │ │ +000746f0: 6474 312c 0a20 3c61 2068 7265 663d 222e dt1,. Mat d │ │ │ +00074740: 7433 6472 3229 3c2f 7370 616e 3e3c 2f64 t3dr2).
    Combines │ │ │ +00074770: 7477 6f20 726f 7461 7469 6f6e 2d61 6e64 two rotation-and │ │ │ +00074780: 2d73 6869 6674 2074 7261 6e73 666f 726d -shift transform │ │ │ +00074790: 6174 696f 6e73 2e3c 2f64 6976 3e0a 3c64 ations.
    . │ │ │ +000747b0: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +000747c0: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000747d0: 7276 6563 313c 2f63 6f64 653e 202d 2046 rvec1 - F │ │ │ +000747e0: 6972 7374 2072 6f74 6174 696f 6e20 7665 irst rotation ve │ │ │ +000747f0: 6374 6f72 2e3c 2f64 643e 0a3c 6464 3e3c ctor.
    .
    < │ │ │ +00074800: 636f 6465 3e74 7665 6331 3c2f 636f 6465 code>tvec1 - First transl │ │ │ +00074820: 6174 696f 6e20 7665 6374 6f72 2e3c 2f64 ation vector..
    rve │ │ │ +00074840: 6332 3c2f 636f 6465 3e20 2d20 5365 636f c2 - Seco │ │ │ +00074850: 6e64 2072 6f74 6174 696f 6e20 7665 6374 nd rotation vect │ │ │ +00074860: 6f72 2e3c 2f64 643e 0a3c 6464 3e3c 636f or.
    .
    tvec2 │ │ │ +00074880: 2d20 5365 636f 6e64 2074 7261 6e73 6c61 - Second transla │ │ │ +00074890: 7469 6f6e 2076 6563 746f 722e 3c2f 6464 tion vector.
    .
    rvec │ │ │ +000748b0: 333c 2f63 6f64 653e 202d 204f 7574 7075 3 - Outpu │ │ │ +000748c0: 7420 726f 7461 7469 6f6e 2076 6563 746f t rotation vecto │ │ │ +000748d0: 7220 6f66 2074 6865 2073 7570 6572 706f r of the superpo │ │ │ +000748e0: 7369 7469 6f6e 2e3c 2f64 643e 0a3c 6464 sition.
    .
    tvec3 - Output tra │ │ │ +00074910: 6e73 6c61 7469 6f6e 2076 6563 746f 7220 nslation vector │ │ │ +00074920: 6f66 2074 6865 2073 7570 6572 706f 7369 of the superposi │ │ │ +00074930: 7469 6f6e 2e3c 2f64 643e 0a3c 6464 3e3c tion.
    .
    < │ │ │ +00074940: 636f 6465 3e64 7233 6472 313c 2f63 6f64 code>dr3dr1 - Optional ou │ │ │ +00074960: 7470 7574 2064 6572 6976 6174 6976 6520 tput derivative │ │ │ +00074970: 6f66 2072 7665 6333 2077 6974 6820 7265 of rvec3 with re │ │ │ +00074980: 6761 7264 2074 6f20 7276 6563 313c 2f64 gard to rvec1.
    dr3 │ │ │ +000749a0: 6474 313c 2f63 6f64 653e 202d 204f 7074 dt1 - Opt │ │ │ +000749b0: 696f 6e61 6c20 6f75 7470 7574 2064 6572 ional output der │ │ │ +000749c0: 6976 6174 6976 6520 6f66 2072 7665 6333 ivative of rvec3 │ │ │ +000749d0: 2077 6974 6820 7265 6761 7264 2074 6f20 with regard to │ │ │ +000749e0: 7476 6563 313c 2f64 643e 0a3c 6464 3e3c tvec1
    .
    < │ │ │ +000749f0: 636f 6465 3e64 7233 6472 323c 2f63 6f64 code>dr3dr2 - Optional ou │ │ │ +00074a10: 7470 7574 2064 6572 6976 6174 6976 6520 tput derivative │ │ │ +00074a20: 6f66 2072 7665 6333 2077 6974 6820 7265 of rvec3 with re │ │ │ +00074a30: 6761 7264 2074 6f20 7276 6563 323c 2f64 gard to rvec2.
    dr3 │ │ │ +00074a50: 6474 323c 2f63 6f64 653e 202d 204f 7074 dt2 - Opt │ │ │ +00074a60: 696f 6e61 6c20 6f75 7470 7574 2064 6572 ional output der │ │ │ +00074a70: 6976 6174 6976 6520 6f66 2072 7665 6333 ivative of rvec3 │ │ │ +00074a80: 2077 6974 6820 7265 6761 7264 2074 6f20 with regard to │ │ │ +00074a90: 7476 6563 323c 2f64 643e 0a3c 6464 3e3c tvec2
    .
    < │ │ │ +00074aa0: 636f 6465 3e64 7433 6472 313c 2f63 6f64 code>dt3dr1 - Optional ou │ │ │ +00074ac0: 7470 7574 2064 6572 6976 6174 6976 6520 tput derivative │ │ │ +00074ad0: 6f66 2074 7665 6333 2077 6974 6820 7265 of tvec3 with re │ │ │ +00074ae0: 6761 7264 2074 6f20 7276 6563 313c 2f64 gard to rvec1.
    dt3 │ │ │ +00074b00: 6474 313c 2f63 6f64 653e 202d 204f 7074 dt1 - Opt │ │ │ +00074b10: 696f 6e61 6c20 6f75 7470 7574 2064 6572 ional output der │ │ │ +00074b20: 6976 6174 6976 6520 6f66 2074 7665 6333 ivative of tvec3 │ │ │ +00074b30: 2077 6974 6820 7265 6761 7264 2074 6f20 with regard to │ │ │ +00074b40: 7476 6563 313c 2f64 643e 0a3c 6464 3e3c tvec1
    .
    < │ │ │ +00074b50: 636f 6465 3e64 7433 6472 323c 2f63 6f64 code>dt3dr2 - Optional ou │ │ │ +00074b70: 7470 7574 2064 6572 6976 6174 6976 6520 tput derivative │ │ │ +00074b80: 6f66 2074 7665 6333 2077 6974 6820 7265 of tvec3 with re │ │ │ +00074b90: 6761 7264 2074 6f20 7276 6563 320a 0a54 gard to rvec2..T │ │ │ +00074ba0: 6865 2066 756e 6374 696f 6e73 2063 6f6d he functions com │ │ │ +00074bb0: 7075 7465 3a0a 0a5c 285c 6265 6769 6e7b pute:..\(\begin{ │ │ │ +00074bc0: 6172 7261 797d 7b6c 7d20 5c74 6578 7474 array}{l} \textt │ │ │ +00074bd0: 747b 7276 6563 337d 203d 2020 5c6d 6174 t{rvec3} = \mat │ │ │ +00074be0: 6872 6d7b 726f 6472 6967 7565 737d 205e hrm{rodrigues} ^ │ │ │ +00074bf0: 7b2d 317d 205c 6c65 6674 2028 205c 6d61 {-1} \left ( \ma │ │ │ +00074c00: 7468 726d 7b72 6f64 7269 6775 6573 7d20 thrm{rodrigues} │ │ │ +00074c10: 2820 5c74 6578 7474 747b 7276 6563 327d ( \texttt{rvec2} │ │ │ +00074c20: 2029 2020 5c63 646f 7420 5c6d 6174 6872 ) \cdot \mathr │ │ │ +00074c30: 6d7b 726f 6472 6967 7565 737d 2028 205c m{rodrigues} ( \ │ │ │ +00074c40: 7465 7874 7474 7b72 7665 6331 7d20 2920 texttt{rvec1} ) │ │ │ +00074c50: 5c72 6967 6874 2029 2020 5c5c 205c 7465 \right ) \\ \te │ │ │ +00074c60: 7874 7474 7b74 7665 6333 7d20 3d20 205c xttt{tvec3} = \ │ │ │ +00074c70: 6d61 7468 726d 7b72 6f64 7269 6775 6573 mathrm{rodrigues │ │ │ +00074c80: 7d20 2820 5c74 6578 7474 747b 7276 6563 } ( \texttt{rvec │ │ │ +00074c90: 327d 2029 2020 5c63 646f 7420 5c74 6578 2} ) \cdot \tex │ │ │ +00074ca0: 7474 747b 7476 6563 317d 202b 2020 5c74 ttt{tvec1} + \t │ │ │ +00074cb0: 6578 7474 747b 7476 6563 327d 205c 656e exttt{tvec2} \en │ │ │ +00074cc0: 647b 6172 7261 797d 202c 5c29 0a0a 7768 d{array} ,\)..wh │ │ │ +00074cd0: 6572 6520 5c28 5c6d 6174 6872 6d7b 726f ere \(\mathrm{ro │ │ │ +00074ce0: 6472 6967 7565 737d 5c29 2064 656e 6f74 drigues}\) denot │ │ │ +00074cf0: 6573 2061 2072 6f74 6174 696f 6e20 7665 es a rotation ve │ │ │ +00074d00: 6374 6f72 2074 6f20 6120 726f 7461 7469 ctor to a rotati │ │ │ +00074d10: 6f6e 206d 6174 7269 7820 7472 616e 7366 on matrix transf │ │ │ +00074d20: 6f72 6d61 7469 6f6e 2c20 616e 640a 5c28 ormation, and.\( │ │ │ +00074d30: 5c6d 6174 6872 6d7b 726f 6472 6967 7565 \mathrm{rodrigue │ │ │ +00074d40: 737d 5e7b 2d31 7d5c 2920 6465 6e6f 7465 s}^{-1}\) denote │ │ │ +00074d50: 7320 7468 6520 696e 7665 7273 6520 7472 s the inverse tr │ │ │ +00074d60: 616e 7366 6f72 6d61 7469 6f6e 2e20 5365 ansformation. Se │ │ │ +00074d70: 6520 2352 6f64 7269 6775 6573 2066 6f72 e #Rodrigues for │ │ │ +00074d80: 2064 6574 6169 6c73 2e0a 0a41 6c73 6f2c details...Also, │ │ │ +00074d90: 2074 6865 2066 756e 6374 696f 6e73 2063 the functions c │ │ │ +00074da0: 616e 2063 6f6d 7075 7465 2074 6865 2064 an compute the d │ │ │ +00074db0: 6572 6976 6174 6976 6573 206f 6620 7468 erivatives of th │ │ │ +00074dc0: 6520 6f75 7470 7574 2076 6563 746f 7273 e output vectors │ │ │ +00074dd0: 2077 6974 6820 7265 6761 7264 7320 746f with regards to │ │ │ +00074de0: 2074 6865 2069 6e70 7574 0a76 6563 746f the input.vecto │ │ │ +00074df0: 7273 2028 7365 6520 236d 6174 4d75 6c44 rs (see #matMulD │ │ │ +00074e00: 6572 6976 2029 2e20 5468 6520 6675 6e63 eriv ). The func │ │ │ +00074e10: 7469 6f6e 7320 6172 6520 7573 6564 2069 tions are used i │ │ │ +00074e20: 6e73 6964 6520 2373 7465 7265 6f43 616c nside #stereoCal │ │ │ +00074e30: 6962 7261 7465 2062 7574 2063 616e 2061 ibrate but can a │ │ │ +00074e40: 6c73 6f20 6265 2075 7365 6420 696e 0a79 lso be used in.y │ │ │ +00074e50: 6f75 7220 6f77 6e20 636f 6465 2077 6865 our own code whe │ │ │ +00074e60: 7265 204c 6576 656e 6265 7267 2d4d 6172 re Levenberg-Mar │ │ │ +00074e70: 7175 6172 6474 206f 7220 616e 6f74 6865 quardt or anothe │ │ │ +00074e80: 7220 6772 6164 6965 6e74 2d62 6173 6564 r gradient-based │ │ │ +00074e90: 2073 6f6c 7665 7220 6973 2075 7365 6420 solver is used │ │ │ +00074ea0: 746f 206f 7074 696d 697a 6520 610a 6675 to optimize a.fu │ │ │ +00074eb0: 6e63 7469 6f6e 2074 6861 7420 636f 6e74 nction that cont │ │ │ +00074ec0: 6169 6e73 2061 206d 6174 7269 7820 6d75 ains a matrix mu │ │ │ +00074ed0: 6c74 6970 6c69 6361 7469 6f6e 2e3c 2f64 ltiplication.... │ │ │ +00074ef0: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e
    . │ │ │ +00074f00: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .< │ │ │ +00075020: 6833 3e63 6f6d 706f 7365 5254 3c2f 6833 h3>composeRT.
    .
    │ │ │ +00075070: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +00075090: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +000750a0: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;void │ │ │ +000750c0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  composeR │ │ │ +000750f0: 543c 2f73 7061 6e3e 3c77 6272 3e3c 7370 T(Mat  │ │ │ +00075160: 7276 6563 312c 0a20 3c61 2068 7265 663d rvec1,. Mat  │ │ │ +000751b0: 3b74 7665 6331 2c0a 203c 6120 6872 6566 ;tvec1,. Mat&nbs │ │ │ +00075200: 703b 7276 6563 322c 0a20 3c61 2068 7265 p;rvec2,. Mat&nb │ │ │ +00075250: 7370 3b74 7665 6332 2c0a 203c 6120 6872 sp;tvec2,. Mat&n │ │ │ +000752a0: 6273 703b 7276 6563 332c 0a20 3c61 2068 bsp;rvec3,. Mat& │ │ │ +000752f0: 6e62 7370 3b74 7665 6333 2c0a 203c 6120 nbsp;tvec3,. Mat │ │ │ +00075340: 266e 6273 703b 6472 3364 7231 2c0a 203c  dr3dr1,. < │ │ │ +00075350: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00075360: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +00075370: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +00075380: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dr3dt1,. │ │ │ +000753a0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000753e0: 3c2f 613e 266e 6273 703b 6472 3364 7232  dr3dr2 │ │ │ +000753f0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +00075430: 6174 3c2f 613e 266e 6273 703b 6472 3364 at dr3d │ │ │ +00075440: 7432 2c0a 203c 6120 6872 6566 3d22 2e2e t2,. Mat dt │ │ │ +00075490: 3364 7231 2c0a 203c 6120 6872 6566 3d22 3dr1,. Mat  │ │ │ +000754e0: 6474 3364 7431 293c 2f73 7061 6e3e 3c2f dt3dt1).
    Combines │ │ │ +00075510: 2074 776f 2072 6f74 6174 696f 6e2d 616e two rotation-an │ │ │ +00075520: 642d 7368 6966 7420 7472 616e 7366 6f72 d-shift transfor │ │ │ +00075530: 6d61 7469 6f6e 732e 3c2f 6469 763e 0a3c mations.
    .< │ │ │ +00075540: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ +00075550: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ +00075560: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    rvec1 - │ │ │ +00075580: 4669 7273 7420 726f 7461 7469 6f6e 2076 First rotation v │ │ │ +00075590: 6563 746f 722e 3c2f 6464 3e0a 3c64 643e ector.
    .
    │ │ │ +000755a0: 3c63 6f64 653e 7476 6563 313c 2f63 6f64 tvec1 - First trans │ │ │ +000755c0: 6c61 7469 6f6e 2076 6563 746f 722e 3c2f lation vector..
    rv │ │ │ +000755e0: 6563 323c 2f63 6f64 653e 202d 2053 6563 ec2 - Sec │ │ │ +000755f0: 6f6e 6420 726f 7461 7469 6f6e 2076 6563 ond rotation vec │ │ │ +00075600: 746f 722e 3c2f 6464 3e0a 3c64 643e 3c63 tor.
    .
    tvec2 │ │ │ +00075620: 202d 2053 6563 6f6e 6420 7472 616e 736c - Second transl │ │ │ +00075630: 6174 696f 6e20 7665 6374 6f72 2e3c 2f64 ation vector..
    rve │ │ │ +00075650: 6333 3c2f 636f 6465 3e20 2d20 4f75 7470 c3 - Outp │ │ │ +00075660: 7574 2072 6f74 6174 696f 6e20 7665 6374 ut rotation vect │ │ │ +00075670: 6f72 206f 6620 7468 6520 7375 7065 7270 or of the superp │ │ │ +00075680: 6f73 6974 696f 6e2e 3c2f 6464 3e0a 3c64 osition.
    .tvec3 - Output tr │ │ │ +000756b0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ +000756c0: 206f 6620 7468 6520 7375 7065 7270 6f73 of the superpos │ │ │ +000756d0: 6974 696f 6e2e 3c2f 6464 3e0a 3c64 643e ition..
    │ │ │ +000756e0: 3c63 6f64 653e 6472 3364 7231 3c2f 636f dr3dr1 - Optional o │ │ │ +00075700: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ +00075710: 206f 6620 7276 6563 3320 7769 7468 2072 of rvec3 with r │ │ │ +00075720: 6567 6172 6420 746f 2072 7665 6331 3c2f egard to rvec1.
    dr │ │ │ +00075740: 3364 7431 3c2f 636f 6465 3e20 2d20 4f70 3dt1 - Op │ │ │ +00075750: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ +00075760: 7269 7661 7469 7665 206f 6620 7276 6563 rivative of rvec │ │ │ +00075770: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ +00075780: 2074 7665 6331 3c2f 6464 3e0a 3c64 643e tvec1
    .
    │ │ │ +00075790: 3c63 6f64 653e 6472 3364 7232 3c2f 636f dr3dr2 - Optional o │ │ │ +000757b0: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ +000757c0: 206f 6620 7276 6563 3320 7769 7468 2072 of rvec3 with r │ │ │ +000757d0: 6567 6172 6420 746f 2072 7665 6332 3c2f egard to rvec2.
    dr │ │ │ +000757f0: 3364 7432 3c2f 636f 6465 3e20 2d20 4f70 3dt2 - Op │ │ │ +00075800: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ +00075810: 7269 7661 7469 7665 206f 6620 7276 6563 rivative of rvec │ │ │ +00075820: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ +00075830: 2074 7665 6332 3c2f 6464 3e0a 3c64 643e tvec2
    .
    │ │ │ +00075840: 3c63 6f64 653e 6474 3364 7231 3c2f 636f dt3dr1 - Optional o │ │ │ +00075860: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ +00075870: 206f 6620 7476 6563 3320 7769 7468 2072 of tvec3 with r │ │ │ +00075880: 6567 6172 6420 746f 2072 7665 6331 3c2f egard to rvec1.
    dt │ │ │ +000758a0: 3364 7431 3c2f 636f 6465 3e20 2d20 4f70 3dt1 - Op │ │ │ +000758b0: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ +000758c0: 7269 7661 7469 7665 206f 6620 7476 6563 rivative of tvec │ │ │ +000758d0: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ +000758e0: 2074 7665 6331 0a0a 5468 6520 6675 6e63 tvec1..The func │ │ │ +000758f0: 7469 6f6e 7320 636f 6d70 7574 653a 0a0a tions compute:.. │ │ │ +00075900: 5c28 5c62 6567 696e 7b61 7272 6179 7d7b \(\begin{array}{ │ │ │ +00075910: 6c7d 205c 7465 7874 7474 7b72 7665 6333 l} \texttt{rvec3 │ │ │ +00075920: 7d20 3d20 205c 6d61 7468 726d 7b72 6f64 } = \mathrm{rod │ │ │ +00075930: 7269 6775 6573 7d20 5e7b 2d31 7d20 5c6c rigues} ^{-1} \l │ │ │ +00075940: 6566 7420 2820 5c6d 6174 6872 6d7b 726f eft ( \mathrm{ro │ │ │ +00075950: 6472 6967 7565 737d 2028 205c 7465 7874 drigues} ( \text │ │ │ +00075960: 7474 7b72 7665 6332 7d20 2920 205c 6364 tt{rvec2} ) \cd │ │ │ +00075970: 6f74 205c 6d61 7468 726d 7b72 6f64 7269 ot \mathrm{rodri │ │ │ +00075980: 6775 6573 7d20 2820 5c74 6578 7474 747b gues} ( \texttt{ │ │ │ +00075990: 7276 6563 317d 2029 205c 7269 6768 7420 rvec1} ) \right │ │ │ +000759a0: 2920 205c 5c20 5c74 6578 7474 747b 7476 ) \\ \texttt{tv │ │ │ +000759b0: 6563 337d 203d 2020 5c6d 6174 6872 6d7b ec3} = \mathrm{ │ │ │ +000759c0: 726f 6472 6967 7565 737d 2028 205c 7465 rodrigues} ( \te │ │ │ +000759d0: 7874 7474 7b72 7665 6332 7d20 2920 205c xttt{rvec2} ) \ │ │ │ +000759e0: 6364 6f74 205c 7465 7874 7474 7b74 7665 cdot \texttt{tve │ │ │ +000759f0: 6331 7d20 2b20 205c 7465 7874 7474 7b74 c1} + \texttt{t │ │ │ +00075a00: 7665 6332 7d20 5c65 6e64 7b61 7272 6179 vec2} \end{array │ │ │ +00075a10: 7d20 2c5c 290a 0a77 6865 7265 205c 285c } ,\)..where \(\ │ │ │ +00075a20: 6d61 7468 726d 7b72 6f64 7269 6775 6573 mathrm{rodrigues │ │ │ +00075a30: 7d5c 2920 6465 6e6f 7465 7320 6120 726f }\) denotes a ro │ │ │ +00075a40: 7461 7469 6f6e 2076 6563 746f 7220 746f tation vector to │ │ │ +00075a50: 2061 2072 6f74 6174 696f 6e20 6d61 7472 a rotation matr │ │ │ +00075a60: 6978 2074 7261 6e73 666f 726d 6174 696f ix transformatio │ │ │ +00075a70: 6e2c 2061 6e64 0a5c 285c 6d61 7468 726d n, and.\(\mathrm │ │ │ +00075a80: 7b72 6f64 7269 6775 6573 7d5e 7b2d 317d {rodrigues}^{-1} │ │ │ +00075a90: 5c29 2064 656e 6f74 6573 2074 6865 2069 \) denotes the i │ │ │ +00075aa0: 6e76 6572 7365 2074 7261 6e73 666f 726d nverse transform │ │ │ +00075ab0: 6174 696f 6e2e 2053 6565 2023 526f 6472 ation. See #Rodr │ │ │ +00075ac0: 6967 7565 7320 666f 7220 6465 7461 696c igues for detail │ │ │ +00075ad0: 732e 0a0a 416c 736f 2c20 7468 6520 6675 s...Also, the fu │ │ │ +00075ae0: 6e63 7469 6f6e 7320 6361 6e20 636f 6d70 nctions can comp │ │ │ +00075af0: 7574 6520 7468 6520 6465 7269 7661 7469 ute the derivati │ │ │ +00075b00: 7665 7320 6f66 2074 6865 206f 7574 7075 ves of the outpu │ │ │ +00075b10: 7420 7665 6374 6f72 7320 7769 7468 2072 t vectors with r │ │ │ +00075b20: 6567 6172 6473 2074 6f20 7468 6520 696e egards to the in │ │ │ +00075b30: 7075 740a 7665 6374 6f72 7320 2873 6565 put.vectors (see │ │ │ +00075b40: 2023 6d61 744d 756c 4465 7269 7620 292e #matMulDeriv ). │ │ │ +00075b50: 2054 6865 2066 756e 6374 696f 6e73 2061 The functions a │ │ │ +00075b60: 7265 2075 7365 6420 696e 7369 6465 2023 re used inside # │ │ │ +00075b70: 7374 6572 656f 4361 6c69 6272 6174 6520 stereoCalibrate │ │ │ +00075b80: 6275 7420 6361 6e20 616c 736f 2062 6520 but can also be │ │ │ +00075b90: 7573 6564 2069 6e0a 796f 7572 206f 776e used in.your own │ │ │ +00075ba0: 2063 6f64 6520 7768 6572 6520 4c65 7665 code where Leve │ │ │ +00075bb0: 6e62 6572 672d 4d61 7271 7561 7264 7420 nberg-Marquardt │ │ │ +00075bc0: 6f72 2061 6e6f 7468 6572 2067 7261 6469 or another gradi │ │ │ +00075bd0: 656e 742d 6261 7365 6420 736f 6c76 6572 ent-based solver │ │ │ +00075be0: 2069 7320 7573 6564 2074 6f20 6f70 7469 is used to opti │ │ │ +00075bf0: 6d69 7a65 2061 0a66 756e 6374 696f 6e20 mize a.function │ │ │ +00075c00: 7468 6174 2063 6f6e 7461 696e 7320 6120 that contains a │ │ │ +00075c10: 6d61 7472 6978 206d 756c 7469 706c 6963 matrix multiplic │ │ │ +00075c20: 6174 696f 6e2e 3c2f 6464 3e0a 3c2f 646c ation.
    ..
    ..
  • .
  • .< │ │ │ +00075c50: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +00075c60: 6574 6169 6c22 2069 643d 2263 6f6d 706f etail" id="compo │ │ │ +00075c70: 7365 5254 286f 7267 2e6f 7065 6e63 762e seRT(org.opencv. │ │ │ +00075c80: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ +00075c90: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ +00075ca0: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ +00075cb0: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ +00075cc0: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ +00075cd0: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ +00075ce0: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ +00075cf0: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ +00075d00: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ +00075d10: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ +00075d20: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ +00075d30: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ +00075d40: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ +00075d50: 2922 3e0a 3c68 333e 636f 6d70 6f73 6552 )">.

    composeR │ │ │ +00075d60: 543c 2f68 333e 0a3c 6469 7620 636c 6173 T

    .
    .
    pub │ │ │ +00075dc0: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static void&nbs │ │ │ +00075e00: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;com │ │ │ +00075e20: 706f 7365 5254 3c2f 7370 616e 3e3c 7762 poseRT(Mat& │ │ │ +00075e90: 6e62 7370 3b72 7665 6331 2c0a 203c 6120 nbsp;rvec1,. Mat │ │ │ +00075ee0: 266e 6273 703b 7476 6563 312c 0a20 3c61  tvec1,. Mat rvec2,. < │ │ │ +00075f40: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00075f50: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +00075f60: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +00075f70: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat tvec2,. │ │ │ +00075f90: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +00075fd0: 2f61 3e26 6e62 7370 3b72 7665 6333 2c0a /a> rvec3,. │ │ │ +00075fe0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +00076020: 3c2f 613e 266e 6273 703b 7476 6563 332c  tvec3, │ │ │ +00076030: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +00076070: 743c 2f61 3e26 6e62 7370 3b64 7233 6472 t dr3dr │ │ │ +00076080: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ +000760c0: 4d61 743c 2f61 3e26 6e62 7370 3b64 7233 Mat dr3 │ │ │ +000760d0: 6474 312c 0a20 3c61 2068 7265 663d 222e dt1,. Mat d │ │ │ +00076120: 7233 6472 322c 0a20 3c61 2068 7265 663d r3dr2,. Mat  │ │ │ +00076170: 3b64 7233 6474 322c 0a20 3c61 2068 7265 ;dr3dt2,. Mat&nb │ │ │ +000761c0: 7370 3b64 7433 6472 3129 3c2f 7370 616e sp;dt3dr1)
    .
    Combi │ │ │ +000761f0: 6e65 7320 7477 6f20 726f 7461 7469 6f6e nes two rotation │ │ │ +00076200: 2d61 6e64 2d73 6869 6674 2074 7261 6e73 -and-shift trans │ │ │ +00076210: 666f 726d 6174 696f 6e73 2e3c 2f64 6976 formations.
    .
    .
    Paramet │ │ │ +00076240: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    rvec1 │ │ │ +00076260: 202d 2046 6972 7374 2072 6f74 6174 696f - First rotatio │ │ │ +00076270: 6e20 7665 6374 6f72 2e3c 2f64 643e 0a3c n vector.
    .< │ │ │ +00076280: 6464 3e3c 636f 6465 3e74 7665 6331 3c2f dd>tvec1 - First tr │ │ │ +000762a0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ +000762b0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 ..
    rvec2 - │ │ │ +000762d0: 5365 636f 6e64 2072 6f74 6174 696f 6e20 Second rotation │ │ │ +000762e0: 7665 6374 6f72 2e3c 2f64 643e 0a3c 6464 vector.
    .
    tvec2 - Second tra │ │ │ +00076310: 6e73 6c61 7469 6f6e 2076 6563 746f 722e nslation vector. │ │ │ +00076320: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +00076330: 7276 6563 333c 2f63 6f64 653e 202d 204f rvec3 - O │ │ │ +00076340: 7574 7075 7420 726f 7461 7469 6f6e 2076 utput rotation v │ │ │ +00076350: 6563 746f 7220 6f66 2074 6865 2073 7570 ector of the sup │ │ │ +00076360: 6572 706f 7369 7469 6f6e 2e3c 2f64 643e erposition.
    │ │ │ +00076370: 0a3c 6464 3e3c 636f 6465 3e74 7665 6333 .
    tvec3 │ │ │ +00076380: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +00076390: 2074 7261 6e73 6c61 7469 6f6e 2076 6563 translation vec │ │ │ +000763a0: 746f 7220 6f66 2074 6865 2073 7570 6572 tor of the super │ │ │ +000763b0: 706f 7369 7469 6f6e 2e3c 2f64 643e 0a3c position.
    .< │ │ │ +000763c0: 6464 3e3c 636f 6465 3e64 7233 6472 313c dd>dr3dr1< │ │ │ +000763d0: 2f63 6f64 653e 202d 204f 7074 696f 6e61 /code> - Optiona │ │ │ +000763e0: 6c20 6f75 7470 7574 2064 6572 6976 6174 l output derivat │ │ │ +000763f0: 6976 6520 6f66 2072 7665 6333 2077 6974 ive of rvec3 wit │ │ │ +00076400: 6820 7265 6761 7264 2074 6f20 7276 6563 h regard to rvec │ │ │ +00076410: 313c 2f64 643e 0a3c 6464 3e3c 636f 6465 1.
    dr3dt1 - │ │ │ +00076430: 204f 7074 696f 6e61 6c20 6f75 7470 7574 Optional output │ │ │ +00076440: 2064 6572 6976 6174 6976 6520 6f66 2072 derivative of r │ │ │ +00076450: 7665 6333 2077 6974 6820 7265 6761 7264 vec3 with regard │ │ │ +00076460: 2074 6f20 7476 6563 313c 2f64 643e 0a3c to tvec1
    .< │ │ │ +00076470: 6464 3e3c 636f 6465 3e64 7233 6472 323c dd>dr3dr2< │ │ │ +00076480: 2f63 6f64 653e 202d 204f 7074 696f 6e61 /code> - Optiona │ │ │ +00076490: 6c20 6f75 7470 7574 2064 6572 6976 6174 l output derivat │ │ │ +000764a0: 6976 6520 6f66 2072 7665 6333 2077 6974 ive of rvec3 wit │ │ │ +000764b0: 6820 7265 6761 7264 2074 6f20 7276 6563 h regard to rvec │ │ │ +000764c0: 323c 2f64 643e 0a3c 6464 3e3c 636f 6465 2.
    dr3dt2 - │ │ │ +000764e0: 204f 7074 696f 6e61 6c20 6f75 7470 7574 Optional output │ │ │ +000764f0: 2064 6572 6976 6174 6976 6520 6f66 2072 derivative of r │ │ │ +00076500: 7665 6333 2077 6974 6820 7265 6761 7264 vec3 with regard │ │ │ +00076510: 2074 6f20 7476 6563 323c 2f64 643e 0a3c to tvec2
    .< │ │ │ +00076520: 6464 3e3c 636f 6465 3e64 7433 6472 313c dd>dt3dr1< │ │ │ +00076530: 2f63 6f64 653e 202d 204f 7074 696f 6e61 /code> - Optiona │ │ │ +00076540: 6c20 6f75 7470 7574 2064 6572 6976 6174 l output derivat │ │ │ +00076550: 6976 6520 6f66 2074 7665 6333 2077 6974 ive of tvec3 wit │ │ │ +00076560: 6820 7265 6761 7264 2074 6f20 7276 6563 h regard to rvec │ │ │ +00076570: 310a 0a54 6865 2066 756e 6374 696f 6e73 1..The functions │ │ │ +00076580: 2063 6f6d 7075 7465 3a0a 0a5c 285c 6265 compute:..\(\be │ │ │ +00076590: 6769 6e7b 6172 7261 797d 7b6c 7d20 5c74 gin{array}{l} \t │ │ │ +000765a0: 6578 7474 747b 7276 6563 337d 203d 2020 exttt{rvec3} = │ │ │ +000765b0: 5c6d 6174 6872 6d7b 726f 6472 6967 7565 \mathrm{rodrigue │ │ │ +000765c0: 737d 205e 7b2d 317d 205c 6c65 6674 2028 s} ^{-1} \left ( │ │ │ +000765d0: 205c 6d61 7468 726d 7b72 6f64 7269 6775 \mathrm{rodrigu │ │ │ +000765e0: 6573 7d20 2820 5c74 6578 7474 747b 7276 es} ( \texttt{rv │ │ │ +000765f0: 6563 327d 2029 2020 5c63 646f 7420 5c6d ec2} ) \cdot \m │ │ │ +00076600: 6174 6872 6d7b 726f 6472 6967 7565 737d athrm{rodrigues} │ │ │ +00076610: 2028 205c 7465 7874 7474 7b72 7665 6331 ( \texttt{rvec1 │ │ │ +00076620: 7d20 2920 5c72 6967 6874 2029 2020 5c5c } ) \right ) \\ │ │ │ +00076630: 205c 7465 7874 7474 7b74 7665 6333 7d20 \texttt{tvec3} │ │ │ +00076640: 3d20 205c 6d61 7468 726d 7b72 6f64 7269 = \mathrm{rodri │ │ │ +00076650: 6775 6573 7d20 2820 5c74 6578 7474 747b gues} ( \texttt{ │ │ │ +00076660: 7276 6563 327d 2029 2020 5c63 646f 7420 rvec2} ) \cdot │ │ │ +00076670: 5c74 6578 7474 747b 7476 6563 317d 202b \texttt{tvec1} + │ │ │ +00076680: 2020 5c74 6578 7474 747b 7476 6563 327d \texttt{tvec2} │ │ │ +00076690: 205c 656e 647b 6172 7261 797d 202c 5c29 \end{array} ,\) │ │ │ +000766a0: 0a0a 7768 6572 6520 5c28 5c6d 6174 6872 ..where \(\mathr │ │ │ +000766b0: 6d7b 726f 6472 6967 7565 737d 5c29 2064 m{rodrigues}\) d │ │ │ +000766c0: 656e 6f74 6573 2061 2072 6f74 6174 696f enotes a rotatio │ │ │ +000766d0: 6e20 7665 6374 6f72 2074 6f20 6120 726f n vector to a ro │ │ │ +000766e0: 7461 7469 6f6e 206d 6174 7269 7820 7472 tation matrix tr │ │ │ +000766f0: 616e 7366 6f72 6d61 7469 6f6e 2c20 616e ansformation, an │ │ │ +00076700: 640a 5c28 5c6d 6174 6872 6d7b 726f 6472 d.\(\mathrm{rodr │ │ │ +00076710: 6967 7565 737d 5e7b 2d31 7d5c 2920 6465 igues}^{-1}\) de │ │ │ +00076720: 6e6f 7465 7320 7468 6520 696e 7665 7273 notes the invers │ │ │ +00076730: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ +00076740: 2e20 5365 6520 2352 6f64 7269 6775 6573 . See #Rodrigues │ │ │ +00076750: 2066 6f72 2064 6574 6169 6c73 2e0a 0a41 for details...A │ │ │ +00076760: 6c73 6f2c 2074 6865 2066 756e 6374 696f lso, the functio │ │ │ +00076770: 6e73 2063 616e 2063 6f6d 7075 7465 2074 ns can compute t │ │ │ +00076780: 6865 2064 6572 6976 6174 6976 6573 206f he derivatives o │ │ │ +00076790: 6620 7468 6520 6f75 7470 7574 2076 6563 f the output vec │ │ │ +000767a0: 746f 7273 2077 6974 6820 7265 6761 7264 tors with regard │ │ │ +000767b0: 7320 746f 2074 6865 2069 6e70 7574 0a76 s to the input.v │ │ │ +000767c0: 6563 746f 7273 2028 7365 6520 236d 6174 ectors (see #mat │ │ │ +000767d0: 4d75 6c44 6572 6976 2029 2e20 5468 6520 MulDeriv ). The │ │ │ +000767e0: 6675 6e63 7469 6f6e 7320 6172 6520 7573 functions are us │ │ │ +000767f0: 6564 2069 6e73 6964 6520 2373 7465 7265 ed inside #stere │ │ │ +00076800: 6f43 616c 6962 7261 7465 2062 7574 2063 oCalibrate but c │ │ │ +00076810: 616e 2061 6c73 6f20 6265 2075 7365 6420 an also be used │ │ │ +00076820: 696e 0a79 6f75 7220 6f77 6e20 636f 6465 in.your own code │ │ │ +00076830: 2077 6865 7265 204c 6576 656e 6265 7267 where Levenberg │ │ │ +00076840: 2d4d 6172 7175 6172 6474 206f 7220 616e -Marquardt or an │ │ │ +00076850: 6f74 6865 7220 6772 6164 6965 6e74 2d62 other gradient-b │ │ │ +00076860: 6173 6564 2073 6f6c 7665 7220 6973 2075 ased solver is u │ │ │ +00076870: 7365 6420 746f 206f 7074 696d 697a 6520 sed to optimize │ │ │ +00076880: 610a 6675 6e63 7469 6f6e 2074 6861 7420 a.function that │ │ │ +00076890: 636f 6e74 6169 6e73 2061 206d 6174 7269 contains a matri │ │ │ +000768a0: 7820 6d75 6c74 6970 6c69 6361 7469 6f6e x multiplication │ │ │ +000768b0: 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 ..
    ...< │ │ │ +000768d0: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    c │ │ │ +000769d0: 6f6d 706f 7365 5254 3c2f 6833 3e0a 3c64 omposeRT

    ..public stati │ │ │ +00076a40: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void composeRT(M │ │ │ +00076b00: 6174 3c2f 613e 266e 6273 703b 7276 6563 at rvec │ │ │ +00076b10: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ +00076b50: 4d61 743c 2f61 3e26 6e62 7370 3b74 7665 Mat tve │ │ │ +00076b60: 6331 2c0a 203c 6120 6872 6566 3d22 2e2e c1,. Mat rv │ │ │ +00076bb0: 6563 322c 0a20 3c61 2068 7265 663d 222e ec2,. Mat t │ │ │ +00076c00: 7665 6332 2c0a 203c 6120 6872 6566 3d22 vec2,. Mat  │ │ │ +00076c50: 7276 6563 332c 0a20 3c61 2068 7265 663d rvec3,. Mat  │ │ │ +00076ca0: 3b74 7665 6333 2c0a 203c 6120 6872 6566 ;tvec3,. Mat&nbs │ │ │ +00076cf0: 703b 6472 3364 7231 2c0a 203c 6120 6872 p;dr3dr1,. Mat&n │ │ │ +00076d40: 6273 703b 6472 3364 7431 2c0a 203c 6120 bsp;dr3dt1,. Mat │ │ │ +00076d90: 266e 6273 703b 6472 3364 7232 2c0a 203c  dr3dr2,. < │ │ │ +00076da0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00076db0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +00076dc0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +00076dd0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dr3dt2)< │ │ │ +00076df0: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>. │ │ │ +00076e10: 436f 6d62 696e 6573 2074 776f 2072 6f74 Combines two rot │ │ │ +00076e20: 6174 696f 6e2d 616e 642d 7368 6966 7420 ation-and-shift │ │ │ +00076e30: 7472 616e 7366 6f72 6d61 7469 6f6e 732e transformations. │ │ │ +00076e40: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373 .
    .
    Pa │ │ │ +00076e60: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ +00076e70: 6464 3e3c 636f 6465 3e72 7665 6331 3c2f dd>rvec1 - First ro │ │ │ +00076e90: 7461 7469 6f6e 2076 6563 746f 722e 3c2f tation vector..
    tv │ │ │ +00076eb0: 6563 313c 2f63 6f64 653e 202d 2046 6972 ec1 - Fir │ │ │ +00076ec0: 7374 2074 7261 6e73 6c61 7469 6f6e 2076 st translation v │ │ │ +00076ed0: 6563 746f 722e 3c2f 6464 3e0a 3c64 643e ector.
    .
    │ │ │ +00076ee0: 3c63 6f64 653e 7276 6563 323c 2f63 6f64 rvec2 - Second rota │ │ │ +00076f00: 7469 6f6e 2076 6563 746f 722e 3c2f 6464 tion vector.
    .
    tvec │ │ │ +00076f20: 323c 2f63 6f64 653e 202d 2053 6563 6f6e 2 - Secon │ │ │ +00076f30: 6420 7472 616e 736c 6174 696f 6e20 7665 d translation ve │ │ │ +00076f40: 6374 6f72 2e3c 2f64 643e 0a3c 6464 3e3c ctor.
    .
    < │ │ │ +00076f50: 636f 6465 3e72 7665 6333 3c2f 636f 6465 code>rvec3 - Output rotat │ │ │ +00076f70: 696f 6e20 7665 6374 6f72 206f 6620 7468 ion vector of th │ │ │ +00076f80: 6520 7375 7065 7270 6f73 6974 696f 6e2e e superposition. │ │ │ +00076f90: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +00076fa0: 7476 6563 333c 2f63 6f64 653e 202d 204f tvec3 - O │ │ │ +00076fb0: 7574 7075 7420 7472 616e 736c 6174 696f utput translatio │ │ │ +00076fc0: 6e20 7665 6374 6f72 206f 6620 7468 6520 n vector of the │ │ │ +00076fd0: 7375 7065 7270 6f73 6974 696f 6e2e 3c2f superposition..
    dr │ │ │ +00076ff0: 3364 7231 3c2f 636f 6465 3e20 2d20 4f70 3dr1 - Op │ │ │ +00077000: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ +00077010: 7269 7661 7469 7665 206f 6620 7276 6563 rivative of rvec │ │ │ +00077020: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ +00077030: 2072 7665 6331 3c2f 6464 3e0a 3c64 643e rvec1
    .
    │ │ │ +00077040: 3c63 6f64 653e 6472 3364 7431 3c2f 636f dr3dt1 - Optional o │ │ │ +00077060: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ +00077070: 206f 6620 7276 6563 3320 7769 7468 2072 of rvec3 with r │ │ │ +00077080: 6567 6172 6420 746f 2074 7665 6331 3c2f egard to tvec1.
    dr │ │ │ +000770a0: 3364 7232 3c2f 636f 6465 3e20 2d20 4f70 3dr2 - Op │ │ │ +000770b0: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ +000770c0: 7269 7661 7469 7665 206f 6620 7276 6563 rivative of rvec │ │ │ +000770d0: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ +000770e0: 2072 7665 6332 3c2f 6464 3e0a 3c64 643e rvec2
    .
    │ │ │ +000770f0: 3c63 6f64 653e 6472 3364 7432 3c2f 636f dr3dt2 - Optional o │ │ │ +00077110: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ +00077120: 206f 6620 7276 6563 3320 7769 7468 2072 of rvec3 with r │ │ │ +00077130: 6567 6172 6420 746f 2074 7665 6332 0a0a egard to tvec2.. │ │ │ +00077140: 5468 6520 6675 6e63 7469 6f6e 7320 636f The functions co │ │ │ +00077150: 6d70 7574 653a 0a0a 5c28 5c62 6567 696e mpute:..\(\begin │ │ │ +00077160: 7b61 7272 6179 7d7b 6c7d 205c 7465 7874 {array}{l} \text │ │ │ +00077170: 7474 7b72 7665 6333 7d20 3d20 205c 6d61 tt{rvec3} = \ma │ │ │ +00077180: 7468 726d 7b72 6f64 7269 6775 6573 7d20 thrm{rodrigues} │ │ │ +00077190: 5e7b 2d31 7d20 5c6c 6566 7420 2820 5c6d ^{-1} \left ( \m │ │ │ +000771a0: 6174 6872 6d7b 726f 6472 6967 7565 737d athrm{rodrigues} │ │ │ +000771b0: 2028 205c 7465 7874 7474 7b72 7665 6332 ( \texttt{rvec2 │ │ │ +000771c0: 7d20 2920 205c 6364 6f74 205c 6d61 7468 } ) \cdot \math │ │ │ +000771d0: 726d 7b72 6f64 7269 6775 6573 7d20 2820 rm{rodrigues} ( │ │ │ +000771e0: 5c74 6578 7474 747b 7276 6563 317d 2029 \texttt{rvec1} ) │ │ │ +000771f0: 205c 7269 6768 7420 2920 205c 5c20 5c74 \right ) \\ \t │ │ │ +00077200: 6578 7474 747b 7476 6563 337d 203d 2020 exttt{tvec3} = │ │ │ +00077210: 5c6d 6174 6872 6d7b 726f 6472 6967 7565 \mathrm{rodrigue │ │ │ +00077220: 737d 2028 205c 7465 7874 7474 7b72 7665 s} ( \texttt{rve │ │ │ +00077230: 6332 7d20 2920 205c 6364 6f74 205c 7465 c2} ) \cdot \te │ │ │ +00077240: 7874 7474 7b74 7665 6331 7d20 2b20 205c xttt{tvec1} + \ │ │ │ +00077250: 7465 7874 7474 7b74 7665 6332 7d20 5c65 texttt{tvec2} \e │ │ │ +00077260: 6e64 7b61 7272 6179 7d20 2c5c 290a 0a77 nd{array} ,\)..w │ │ │ +00077270: 6865 7265 205c 285c 6d61 7468 726d 7b72 here \(\mathrm{r │ │ │ +00077280: 6f64 7269 6775 6573 7d5c 2920 6465 6e6f odrigues}\) deno │ │ │ +00077290: 7465 7320 6120 726f 7461 7469 6f6e 2076 tes a rotation v │ │ │ +000772a0: 6563 746f 7220 746f 2061 2072 6f74 6174 ector to a rotat │ │ │ +000772b0: 696f 6e20 6d61 7472 6978 2074 7261 6e73 ion matrix trans │ │ │ +000772c0: 666f 726d 6174 696f 6e2c 2061 6e64 0a5c formation, and.\ │ │ │ +000772d0: 285c 6d61 7468 726d 7b72 6f64 7269 6775 (\mathrm{rodrigu │ │ │ +000772e0: 6573 7d5e 7b2d 317d 5c29 2064 656e 6f74 es}^{-1}\) denot │ │ │ +000772f0: 6573 2074 6865 2069 6e76 6572 7365 2074 es the inverse t │ │ │ +00077300: 7261 6e73 666f 726d 6174 696f 6e2e 2053 ransformation. S │ │ │ +00077310: 6565 2023 526f 6472 6967 7565 7320 666f ee #Rodrigues fo │ │ │ +00077320: 7220 6465 7461 696c 732e 0a0a 416c 736f r details...Also │ │ │ +00077330: 2c20 7468 6520 6675 6e63 7469 6f6e 7320 , the functions │ │ │ +00077340: 6361 6e20 636f 6d70 7574 6520 7468 6520 can compute the │ │ │ +00077350: 6465 7269 7661 7469 7665 7320 6f66 2074 derivatives of t │ │ │ +00077360: 6865 206f 7574 7075 7420 7665 6374 6f72 he output vector │ │ │ +00077370: 7320 7769 7468 2072 6567 6172 6473 2074 s with regards t │ │ │ +00077380: 6f20 7468 6520 696e 7075 740a 7665 6374 o the input.vect │ │ │ +00077390: 6f72 7320 2873 6565 2023 6d61 744d 756c ors (see #matMul │ │ │ +000773a0: 4465 7269 7620 292e 2054 6865 2066 756e Deriv ). The fun │ │ │ +000773b0: 6374 696f 6e73 2061 7265 2075 7365 6420 ctions are used │ │ │ +000773c0: 696e 7369 6465 2023 7374 6572 656f 4361 inside #stereoCa │ │ │ +000773d0: 6c69 6272 6174 6520 6275 7420 6361 6e20 librate but can │ │ │ +000773e0: 616c 736f 2062 6520 7573 6564 2069 6e0a also be used in. │ │ │ +000773f0: 796f 7572 206f 776e 2063 6f64 6520 7768 your own code wh │ │ │ +00077400: 6572 6520 4c65 7665 6e62 6572 672d 4d61 ere Levenberg-Ma │ │ │ +00077410: 7271 7561 7264 7420 6f72 2061 6e6f 7468 rquardt or anoth │ │ │ +00077420: 6572 2067 7261 6469 656e 742d 6261 7365 er gradient-base │ │ │ +00077430: 6420 736f 6c76 6572 2069 7320 7573 6564 d solver is used │ │ │ +00077440: 2074 6f20 6f70 7469 6d69 7a65 2061 0a66 to optimize a.f │ │ │ +00077450: 756e 6374 696f 6e20 7468 6174 2063 6f6e unction that con │ │ │ +00077460: 7461 696e 7320 6120 6d61 7472 6978 206d tains a matrix m │ │ │ +00077470: 756c 7469 706c 6963 6174 696f 6e2e 3c2f ultiplication..
    . │ │ │ +00077490: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 ..
  • .
  • .
    .

    composeR │ │ │ +00077590: 543c 2f68 333e 0a3c 6469 7620 636c 6173 T

    .
    .
    pub │ │ │ +000775f0: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static void&nbs │ │ │ +00077630: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;com │ │ │ +00077650: 706f 7365 5254 3c2f 7370 616e 3e3c 7762 poseRT(Mat& │ │ │ +000776c0: 6e62 7370 3b72 7665 6331 2c0a 203c 6120 nbsp;rvec1,. Mat │ │ │ +00077710: 266e 6273 703b 7476 6563 312c 0a20 3c61  tvec1,. Mat rvec2,. < │ │ │ +00077770: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00077780: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +00077790: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000777a0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat tvec2,. │ │ │ +000777c0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +00077800: 2f61 3e26 6e62 7370 3b72 7665 6333 2c0a /a> rvec3,. │ │ │ +00077810: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +00077850: 3c2f 613e 266e 6273 703b 7476 6563 332c  tvec3, │ │ │ +00077860: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000778a0: 743c 2f61 3e26 6e62 7370 3b64 7233 6472 t dr3dr │ │ │ +000778b0: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ +000778f0: 4d61 743c 2f61 3e26 6e62 7370 3b64 7233 Mat dr3 │ │ │ +00077900: 6474 312c 0a20 3c61 2068 7265 663d 222e dt1,. Mat d │ │ │ +00077950: 7233 6472 3229 3c2f 7370 616e 3e3c 2f64 r3dr2).
    Combines │ │ │ +00077980: 7477 6f20 726f 7461 7469 6f6e 2d61 6e64 two rotation-and │ │ │ +00077990: 2d73 6869 6674 2074 7261 6e73 666f 726d -shift transform │ │ │ +000779a0: 6174 696f 6e73 2e3c 2f64 6976 3e0a 3c64 ations.
    . │ │ │ +000779c0: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +000779d0: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000779e0: 7276 6563 313c 2f63 6f64 653e 202d 2046 rvec1 - F │ │ │ +000779f0: 6972 7374 2072 6f74 6174 696f 6e20 7665 irst rotation ve │ │ │ +00077a00: 6374 6f72 2e3c 2f64 643e 0a3c 6464 3e3c ctor.
    .
    < │ │ │ +00077a10: 636f 6465 3e74 7665 6331 3c2f 636f 6465 code>tvec1 - First transl │ │ │ +00077a30: 6174 696f 6e20 7665 6374 6f72 2e3c 2f64 ation vector..
    rve │ │ │ +00077a50: 6332 3c2f 636f 6465 3e20 2d20 5365 636f c2 - Seco │ │ │ +00077a60: 6e64 2072 6f74 6174 696f 6e20 7665 6374 nd rotation vect │ │ │ +00077a70: 6f72 2e3c 2f64 643e 0a3c 6464 3e3c 636f or.
    .
    tvec2 │ │ │ +00077a90: 2d20 5365 636f 6e64 2074 7261 6e73 6c61 - Second transla │ │ │ +00077aa0: 7469 6f6e 2076 6563 746f 722e 3c2f 6464 tion vector.
    .
    rvec │ │ │ +00077ac0: 333c 2f63 6f64 653e 202d 204f 7574 7075 3 - Outpu │ │ │ +00077ad0: 7420 726f 7461 7469 6f6e 2076 6563 746f t rotation vecto │ │ │ +00077ae0: 7220 6f66 2074 6865 2073 7570 6572 706f r of the superpo │ │ │ +00077af0: 7369 7469 6f6e 2e3c 2f64 643e 0a3c 6464 sition.
    .
    tvec3 - Output tra │ │ │ +00077b20: 6e73 6c61 7469 6f6e 2076 6563 746f 7220 nslation vector │ │ │ +00077b30: 6f66 2074 6865 2073 7570 6572 706f 7369 of the superposi │ │ │ +00077b40: 7469 6f6e 2e3c 2f64 643e 0a3c 6464 3e3c tion.
    .
    < │ │ │ +00077b50: 636f 6465 3e64 7233 6472 313c 2f63 6f64 code>dr3dr1 - Optional ou │ │ │ +00077b70: 7470 7574 2064 6572 6976 6174 6976 6520 tput derivative │ │ │ +00077b80: 6f66 2072 7665 6333 2077 6974 6820 7265 of rvec3 with re │ │ │ +00077b90: 6761 7264 2074 6f20 7276 6563 313c 2f64 gard to rvec1.
    dr3 │ │ │ +00077bb0: 6474 313c 2f63 6f64 653e 202d 204f 7074 dt1 - Opt │ │ │ +00077bc0: 696f 6e61 6c20 6f75 7470 7574 2064 6572 ional output der │ │ │ +00077bd0: 6976 6174 6976 6520 6f66 2072 7665 6333 ivative of rvec3 │ │ │ +00077be0: 2077 6974 6820 7265 6761 7264 2074 6f20 with regard to │ │ │ +00077bf0: 7476 6563 313c 2f64 643e 0a3c 6464 3e3c tvec1
    .
    < │ │ │ +00077c00: 636f 6465 3e64 7233 6472 323c 2f63 6f64 code>dr3dr2 - Optional ou │ │ │ +00077c20: 7470 7574 2064 6572 6976 6174 6976 6520 tput derivative │ │ │ +00077c30: 6f66 2072 7665 6333 2077 6974 6820 7265 of rvec3 with re │ │ │ +00077c40: 6761 7264 2074 6f20 7276 6563 320a 0a54 gard to rvec2..T │ │ │ +00077c50: 6865 2066 756e 6374 696f 6e73 2063 6f6d he functions com │ │ │ +00077c60: 7075 7465 3a0a 0a5c 285c 6265 6769 6e7b pute:..\(\begin{ │ │ │ +00077c70: 6172 7261 797d 7b6c 7d20 5c74 6578 7474 array}{l} \textt │ │ │ +00077c80: 747b 7276 6563 337d 203d 2020 5c6d 6174 t{rvec3} = \mat │ │ │ +00077c90: 6872 6d7b 726f 6472 6967 7565 737d 205e hrm{rodrigues} ^ │ │ │ +00077ca0: 7b2d 317d 205c 6c65 6674 2028 205c 6d61 {-1} \left ( \ma │ │ │ +00077cb0: 7468 726d 7b72 6f64 7269 6775 6573 7d20 thrm{rodrigues} │ │ │ +00077cc0: 2820 5c74 6578 7474 747b 7276 6563 327d ( \texttt{rvec2} │ │ │ +00077cd0: 2029 2020 5c63 646f 7420 5c6d 6174 6872 ) \cdot \mathr │ │ │ +00077ce0: 6d7b 726f 6472 6967 7565 737d 2028 205c m{rodrigues} ( \ │ │ │ +00077cf0: 7465 7874 7474 7b72 7665 6331 7d20 2920 texttt{rvec1} ) │ │ │ +00077d00: 5c72 6967 6874 2029 2020 5c5c 205c 7465 \right ) \\ \te │ │ │ +00077d10: 7874 7474 7b74 7665 6333 7d20 3d20 205c xttt{tvec3} = \ │ │ │ +00077d20: 6d61 7468 726d 7b72 6f64 7269 6775 6573 mathrm{rodrigues │ │ │ +00077d30: 7d20 2820 5c74 6578 7474 747b 7276 6563 } ( \texttt{rvec │ │ │ +00077d40: 327d 2029 2020 5c63 646f 7420 5c74 6578 2} ) \cdot \tex │ │ │ +00077d50: 7474 747b 7476 6563 317d 202b 2020 5c74 ttt{tvec1} + \t │ │ │ +00077d60: 6578 7474 747b 7476 6563 327d 205c 656e exttt{tvec2} \en │ │ │ +00077d70: 647b 6172 7261 797d 202c 5c29 0a0a 7768 d{array} ,\)..wh │ │ │ +00077d80: 6572 6520 5c28 5c6d 6174 6872 6d7b 726f ere \(\mathrm{ro │ │ │ +00077d90: 6472 6967 7565 737d 5c29 2064 656e 6f74 drigues}\) denot │ │ │ +00077da0: 6573 2061 2072 6f74 6174 696f 6e20 7665 es a rotation ve │ │ │ +00077db0: 6374 6f72 2074 6f20 6120 726f 7461 7469 ctor to a rotati │ │ │ +00077dc0: 6f6e 206d 6174 7269 7820 7472 616e 7366 on matrix transf │ │ │ +00077dd0: 6f72 6d61 7469 6f6e 2c20 616e 640a 5c28 ormation, and.\( │ │ │ +00077de0: 5c6d 6174 6872 6d7b 726f 6472 6967 7565 \mathrm{rodrigue │ │ │ +00077df0: 737d 5e7b 2d31 7d5c 2920 6465 6e6f 7465 s}^{-1}\) denote │ │ │ +00077e00: 7320 7468 6520 696e 7665 7273 6520 7472 s the inverse tr │ │ │ +00077e10: 616e 7366 6f72 6d61 7469 6f6e 2e20 5365 ansformation. Se │ │ │ +00077e20: 6520 2352 6f64 7269 6775 6573 2066 6f72 e #Rodrigues for │ │ │ +00077e30: 2064 6574 6169 6c73 2e0a 0a41 6c73 6f2c details...Also, │ │ │ +00077e40: 2074 6865 2066 756e 6374 696f 6e73 2063 the functions c │ │ │ +00077e50: 616e 2063 6f6d 7075 7465 2074 6865 2064 an compute the d │ │ │ +00077e60: 6572 6976 6174 6976 6573 206f 6620 7468 erivatives of th │ │ │ +00077e70: 6520 6f75 7470 7574 2076 6563 746f 7273 e output vectors │ │ │ +00077e80: 2077 6974 6820 7265 6761 7264 7320 746f with regards to │ │ │ +00077e90: 2074 6865 2069 6e70 7574 0a76 6563 746f the input.vecto │ │ │ +00077ea0: 7273 2028 7365 6520 236d 6174 4d75 6c44 rs (see #matMulD │ │ │ +00077eb0: 6572 6976 2029 2e20 5468 6520 6675 6e63 eriv ). The func │ │ │ +00077ec0: 7469 6f6e 7320 6172 6520 7573 6564 2069 tions are used i │ │ │ +00077ed0: 6e73 6964 6520 2373 7465 7265 6f43 616c nside #stereoCal │ │ │ +00077ee0: 6962 7261 7465 2062 7574 2063 616e 2061 ibrate but can a │ │ │ +00077ef0: 6c73 6f20 6265 2075 7365 6420 696e 0a79 lso be used in.y │ │ │ +00077f00: 6f75 7220 6f77 6e20 636f 6465 2077 6865 our own code whe │ │ │ +00077f10: 7265 204c 6576 656e 6265 7267 2d4d 6172 re Levenberg-Mar │ │ │ +00077f20: 7175 6172 6474 206f 7220 616e 6f74 6865 quardt or anothe │ │ │ +00077f30: 7220 6772 6164 6965 6e74 2d62 6173 6564 r gradient-based │ │ │ +00077f40: 2073 6f6c 7665 7220 6973 2075 7365 6420 solver is used │ │ │ +00077f50: 746f 206f 7074 696d 697a 6520 610a 6675 to optimize a.fu │ │ │ +00077f60: 6e63 7469 6f6e 2074 6861 7420 636f 6e74 nction that cont │ │ │ +00077f70: 6169 6e73 2061 206d 6174 7269 7820 6d75 ains a matrix mu │ │ │ +00077f80: 6c74 6970 6c69 6361 7469 6f6e 2e3c 2f64 ltiplication...
    . │ │ │ +00077fa0: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e
    .
  • │ │ │ +00077fb0: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .< │ │ │ +00078080: 6833 3e63 6f6d 706f 7365 5254 3c2f 6833 h3>composeRT.
    .
    │ │ │ +000780d0: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +000780f0: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +00078100: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;void │ │ │ +00078120: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  composeR │ │ │ +00078150: 543c 2f73 7061 6e3e 3c77 6272 3e3c 7370 T(Mat  │ │ │ +000781c0: 7276 6563 312c 0a20 3c61 2068 7265 663d rvec1,. Mat  │ │ │ +00078210: 3b74 7665 6331 2c0a 203c 6120 6872 6566 ;tvec1,. Mat&nbs │ │ │ +00078260: 703b 7276 6563 322c 0a20 3c61 2068 7265 p;rvec2,. Mat&nb │ │ │ +000782b0: 7370 3b74 7665 6332 2c0a 203c 6120 6872 sp;tvec2,. Mat&n │ │ │ +00078300: 6273 703b 7276 6563 332c 0a20 3c61 2068 bsp;rvec3,. Mat& │ │ │ +00078350: 6e62 7370 3b74 7665 6333 2c0a 203c 6120 nbsp;tvec3,. Mat │ │ │ +000783a0: 266e 6273 703b 6472 3364 7231 2c0a 203c  dr3dr1,. < │ │ │ +000783b0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000783c0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000783d0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000783e0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dr3dt1)< │ │ │ +00078400: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ +00078420: 436f 6d62 696e 6573 2074 776f 2072 6f74 Combines two rot │ │ │ +00078430: 6174 696f 6e2d 616e 642d 7368 6966 7420 ation-and-shift │ │ │ +00078440: 7472 616e 7366 6f72 6d61 7469 6f6e 732e transformations. │ │ │ +00078450: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ +00078470: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ +00078480: 6464 3e3c 636f 6465 3e72 7665 6331 3c2f dd>rvec1 - First ro │ │ │ +000784a0: 7461 7469 6f6e 2076 6563 746f 722e 3c2f tation vector..
    tv │ │ │ +000784c0: 6563 313c 2f63 6f64 653e 202d 2046 6972 ec1 - Fir │ │ │ +000784d0: 7374 2074 7261 6e73 6c61 7469 6f6e 2076 st translation v │ │ │ +000784e0: 6563 746f 722e 3c2f 6464 3e0a 3c64 643e ector.
    .
    │ │ │ +000784f0: 3c63 6f64 653e 7276 6563 323c 2f63 6f64 rvec2 - Second rota │ │ │ +00078510: 7469 6f6e 2076 6563 746f 722e 3c2f 6464 tion vector.
    .
    tvec │ │ │ +00078530: 323c 2f63 6f64 653e 202d 2053 6563 6f6e 2 - Secon │ │ │ +00078540: 6420 7472 616e 736c 6174 696f 6e20 7665 d translation ve │ │ │ +00078550: 6374 6f72 2e3c 2f64 643e 0a3c 6464 3e3c ctor.
    .
    < │ │ │ +00078560: 636f 6465 3e72 7665 6333 3c2f 636f 6465 code>rvec3 - Output rotat │ │ │ +00078580: 696f 6e20 7665 6374 6f72 206f 6620 7468 ion vector of th │ │ │ +00078590: 6520 7375 7065 7270 6f73 6974 696f 6e2e e superposition. │ │ │ +000785a0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000785b0: 7476 6563 333c 2f63 6f64 653e 202d 204f tvec3 - O │ │ │ +000785c0: 7574 7075 7420 7472 616e 736c 6174 696f utput translatio │ │ │ +000785d0: 6e20 7665 6374 6f72 206f 6620 7468 6520 n vector of the │ │ │ +000785e0: 7375 7065 7270 6f73 6974 696f 6e2e 3c2f superposition..
    dr │ │ │ +00078600: 3364 7231 3c2f 636f 6465 3e20 2d20 4f70 3dr1 - Op │ │ │ +00078610: 7469 6f6e 616c 206f 7574 7075 7420 6465 tional output de │ │ │ +00078620: 7269 7661 7469 7665 206f 6620 7276 6563 rivative of rvec │ │ │ +00078630: 3320 7769 7468 2072 6567 6172 6420 746f 3 with regard to │ │ │ +00078640: 2072 7665 6331 3c2f 6464 3e0a 3c64 643e rvec1
    .
    │ │ │ +00078650: 3c63 6f64 653e 6472 3364 7431 3c2f 636f dr3dt1 - Optional o │ │ │ +00078670: 7574 7075 7420 6465 7269 7661 7469 7665 utput derivative │ │ │ +00078680: 206f 6620 7276 6563 3320 7769 7468 2072 of rvec3 with r │ │ │ +00078690: 6567 6172 6420 746f 2074 7665 6331 0a0a egard to tvec1.. │ │ │ +000786a0: 5468 6520 6675 6e63 7469 6f6e 7320 636f The functions co │ │ │ +000786b0: 6d70 7574 653a 0a0a 5c28 5c62 6567 696e mpute:..\(\begin │ │ │ +000786c0: 7b61 7272 6179 7d7b 6c7d 205c 7465 7874 {array}{l} \text │ │ │ +000786d0: 7474 7b72 7665 6333 7d20 3d20 205c 6d61 tt{rvec3} = \ma │ │ │ +000786e0: 7468 726d 7b72 6f64 7269 6775 6573 7d20 thrm{rodrigues} │ │ │ +000786f0: 5e7b 2d31 7d20 5c6c 6566 7420 2820 5c6d ^{-1} \left ( \m │ │ │ +00078700: 6174 6872 6d7b 726f 6472 6967 7565 737d athrm{rodrigues} │ │ │ +00078710: 2028 205c 7465 7874 7474 7b72 7665 6332 ( \texttt{rvec2 │ │ │ +00078720: 7d20 2920 205c 6364 6f74 205c 6d61 7468 } ) \cdot \math │ │ │ +00078730: 726d 7b72 6f64 7269 6775 6573 7d20 2820 rm{rodrigues} ( │ │ │ +00078740: 5c74 6578 7474 747b 7276 6563 317d 2029 \texttt{rvec1} ) │ │ │ +00078750: 205c 7269 6768 7420 2920 205c 5c20 5c74 \right ) \\ \t │ │ │ +00078760: 6578 7474 747b 7476 6563 337d 203d 2020 exttt{tvec3} = │ │ │ +00078770: 5c6d 6174 6872 6d7b 726f 6472 6967 7565 \mathrm{rodrigue │ │ │ +00078780: 737d 2028 205c 7465 7874 7474 7b72 7665 s} ( \texttt{rve │ │ │ +00078790: 6332 7d20 2920 205c 6364 6f74 205c 7465 c2} ) \cdot \te │ │ │ +000787a0: 7874 7474 7b74 7665 6331 7d20 2b20 205c xttt{tvec1} + \ │ │ │ +000787b0: 7465 7874 7474 7b74 7665 6332 7d20 5c65 texttt{tvec2} \e │ │ │ +000787c0: 6e64 7b61 7272 6179 7d20 2c5c 290a 0a77 nd{array} ,\)..w │ │ │ +000787d0: 6865 7265 205c 285c 6d61 7468 726d 7b72 here \(\mathrm{r │ │ │ +000787e0: 6f64 7269 6775 6573 7d5c 2920 6465 6e6f odrigues}\) deno │ │ │ +000787f0: 7465 7320 6120 726f 7461 7469 6f6e 2076 tes a rotation v │ │ │ +00078800: 6563 746f 7220 746f 2061 2072 6f74 6174 ector to a rotat │ │ │ +00078810: 696f 6e20 6d61 7472 6978 2074 7261 6e73 ion matrix trans │ │ │ +00078820: 666f 726d 6174 696f 6e2c 2061 6e64 0a5c formation, and.\ │ │ │ +00078830: 285c 6d61 7468 726d 7b72 6f64 7269 6775 (\mathrm{rodrigu │ │ │ +00078840: 6573 7d5e 7b2d 317d 5c29 2064 656e 6f74 es}^{-1}\) denot │ │ │ +00078850: 6573 2074 6865 2069 6e76 6572 7365 2074 es the inverse t │ │ │ +00078860: 7261 6e73 666f 726d 6174 696f 6e2e 2053 ransformation. S │ │ │ +00078870: 6565 2023 526f 6472 6967 7565 7320 666f ee #Rodrigues fo │ │ │ +00078880: 7220 6465 7461 696c 732e 0a0a 416c 736f r details...Also │ │ │ +00078890: 2c20 7468 6520 6675 6e63 7469 6f6e 7320 , the functions │ │ │ +000788a0: 6361 6e20 636f 6d70 7574 6520 7468 6520 can compute the │ │ │ +000788b0: 6465 7269 7661 7469 7665 7320 6f66 2074 derivatives of t │ │ │ +000788c0: 6865 206f 7574 7075 7420 7665 6374 6f72 he output vector │ │ │ +000788d0: 7320 7769 7468 2072 6567 6172 6473 2074 s with regards t │ │ │ +000788e0: 6f20 7468 6520 696e 7075 740a 7665 6374 o the input.vect │ │ │ +000788f0: 6f72 7320 2873 6565 2023 6d61 744d 756c ors (see #matMul │ │ │ +00078900: 4465 7269 7620 292e 2054 6865 2066 756e Deriv ). The fun │ │ │ +00078910: 6374 696f 6e73 2061 7265 2075 7365 6420 ctions are used │ │ │ +00078920: 696e 7369 6465 2023 7374 6572 656f 4361 inside #stereoCa │ │ │ +00078930: 6c69 6272 6174 6520 6275 7420 6361 6e20 librate but can │ │ │ +00078940: 616c 736f 2062 6520 7573 6564 2069 6e0a also be used in. │ │ │ +00078950: 796f 7572 206f 776e 2063 6f64 6520 7768 your own code wh │ │ │ +00078960: 6572 6520 4c65 7665 6e62 6572 672d 4d61 ere Levenberg-Ma │ │ │ +00078970: 7271 7561 7264 7420 6f72 2061 6e6f 7468 rquardt or anoth │ │ │ +00078980: 6572 2067 7261 6469 656e 742d 6261 7365 er gradient-base │ │ │ +00078990: 6420 736f 6c76 6572 2069 7320 7573 6564 d solver is used │ │ │ +000789a0: 2074 6f20 6f70 7469 6d69 7a65 2061 0a66 to optimize a.f │ │ │ +000789b0: 756e 6374 696f 6e20 7468 6174 2063 6f6e unction that con │ │ │ +000789c0: 7461 696e 7320 6120 6d61 7472 6978 206d tains a matrix m │ │ │ +000789d0: 756c 7469 706c 6963 6174 696f 6e2e 3c2f ultiplication..
    . │ │ │ +000789f0: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
    .
  • .
  • .
    .

    │ │ │ +00078ac0: 636f 6d70 6f73 6552 543c 2f68 333e 0a3c composeRT

    .< │ │ │ +00078ad0: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +00078ae0: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +00078af0: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +00078b00: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +00078b30: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +00078b40: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +00078b50: 726e 2d74 7970 6522 3e76 6f69 643c 2f73 rn-type">void
     composeRT( │ │ │ +00078bf0: 4d61 743c 2f61 3e26 6e62 7370 3b72 7665 Mat rve │ │ │ +00078c00: 6331 2c0a 203c 6120 6872 6566 3d22 2e2e c1,. Mat tv │ │ │ +00078c50: 6563 312c 0a20 3c61 2068 7265 663d 222e ec1,. Mat r │ │ │ +00078ca0: 7665 6332 2c0a 203c 6120 6872 6566 3d22 vec2,. Mat  │ │ │ +00078cf0: 7476 6563 322c 0a20 3c61 2068 7265 663d tvec2,. Mat  │ │ │ +00078d40: 3b72 7665 6333 2c0a 203c 6120 6872 6566 ;rvec3,. Mat&nbs │ │ │ +00078d90: 703b 7476 6563 332c 0a20 3c61 2068 7265 p;tvec3,. Mat&nb │ │ │ +00078de0: 7370 3b64 7233 6472 3129 3c2f 7370 616e sp;dr3dr1).
    Combi │ │ │ +00078e10: 6e65 7320 7477 6f20 726f 7461 7469 6f6e nes two rotation │ │ │ +00078e20: 2d61 6e64 2d73 6869 6674 2074 7261 6e73 -and-shift trans │ │ │ +00078e30: 666f 726d 6174 696f 6e73 2e3c 2f64 6976 formations.
    .
    .
    Paramet │ │ │ +00078e60: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    rvec1 │ │ │ +00078e80: 202d 2046 6972 7374 2072 6f74 6174 696f - First rotatio │ │ │ +00078e90: 6e20 7665 6374 6f72 2e3c 2f64 643e 0a3c n vector.
    .< │ │ │ +00078ea0: 6464 3e3c 636f 6465 3e74 7665 6331 3c2f dd>tvec1 - First tr │ │ │ +00078ec0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ +00078ed0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 ..
    rvec2 - │ │ │ +00078ef0: 5365 636f 6e64 2072 6f74 6174 696f 6e20 Second rotation │ │ │ +00078f00: 7665 6374 6f72 2e3c 2f64 643e 0a3c 6464 vector.
    .
    tvec2 - Second tra │ │ │ +00078f30: 6e73 6c61 7469 6f6e 2076 6563 746f 722e nslation vector. │ │ │ +00078f40: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +00078f50: 7276 6563 333c 2f63 6f64 653e 202d 204f rvec3 - O │ │ │ +00078f60: 7574 7075 7420 726f 7461 7469 6f6e 2076 utput rotation v │ │ │ +00078f70: 6563 746f 7220 6f66 2074 6865 2073 7570 ector of the sup │ │ │ +00078f80: 6572 706f 7369 7469 6f6e 2e3c 2f64 643e erposition.
    │ │ │ +00078f90: 0a3c 6464 3e3c 636f 6465 3e74 7665 6333 .
    tvec3 │ │ │ +00078fa0: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +00078fb0: 2074 7261 6e73 6c61 7469 6f6e 2076 6563 translation vec │ │ │ +00078fc0: 746f 7220 6f66 2074 6865 2073 7570 6572 tor of the super │ │ │ +00078fd0: 706f 7369 7469 6f6e 2e3c 2f64 643e 0a3c position.
    .< │ │ │ +00078fe0: 6464 3e3c 636f 6465 3e64 7233 6472 313c dd>dr3dr1< │ │ │ +00078ff0: 2f63 6f64 653e 202d 204f 7074 696f 6e61 /code> - Optiona │ │ │ +00079000: 6c20 6f75 7470 7574 2064 6572 6976 6174 l output derivat │ │ │ +00079010: 6976 6520 6f66 2072 7665 6333 2077 6974 ive of rvec3 wit │ │ │ +00079020: 6820 7265 6761 7264 2074 6f20 7276 6563 h regard to rvec │ │ │ +00079030: 310a 0a54 6865 2066 756e 6374 696f 6e73 1..The functions │ │ │ +00079040: 2063 6f6d 7075 7465 3a0a 0a5c 285c 6265 compute:..\(\be │ │ │ +00079050: 6769 6e7b 6172 7261 797d 7b6c 7d20 5c74 gin{array}{l} \t │ │ │ +00079060: 6578 7474 747b 7276 6563 337d 203d 2020 exttt{rvec3} = │ │ │ +00079070: 5c6d 6174 6872 6d7b 726f 6472 6967 7565 \mathrm{rodrigue │ │ │ +00079080: 737d 205e 7b2d 317d 205c 6c65 6674 2028 s} ^{-1} \left ( │ │ │ +00079090: 205c 6d61 7468 726d 7b72 6f64 7269 6775 \mathrm{rodrigu │ │ │ +000790a0: 6573 7d20 2820 5c74 6578 7474 747b 7276 es} ( \texttt{rv │ │ │ +000790b0: 6563 327d 2029 2020 5c63 646f 7420 5c6d ec2} ) \cdot \m │ │ │ +000790c0: 6174 6872 6d7b 726f 6472 6967 7565 737d athrm{rodrigues} │ │ │ +000790d0: 2028 205c 7465 7874 7474 7b72 7665 6331 ( \texttt{rvec1 │ │ │ +000790e0: 7d20 2920 5c72 6967 6874 2029 2020 5c5c } ) \right ) \\ │ │ │ +000790f0: 205c 7465 7874 7474 7b74 7665 6333 7d20 \texttt{tvec3} │ │ │ +00079100: 3d20 205c 6d61 7468 726d 7b72 6f64 7269 = \mathrm{rodri │ │ │ +00079110: 6775 6573 7d20 2820 5c74 6578 7474 747b gues} ( \texttt{ │ │ │ +00079120: 7276 6563 327d 2029 2020 5c63 646f 7420 rvec2} ) \cdot │ │ │ +00079130: 5c74 6578 7474 747b 7476 6563 317d 202b \texttt{tvec1} + │ │ │ +00079140: 2020 5c74 6578 7474 747b 7476 6563 327d \texttt{tvec2} │ │ │ +00079150: 205c 656e 647b 6172 7261 797d 202c 5c29 \end{array} ,\) │ │ │ +00079160: 0a0a 7768 6572 6520 5c28 5c6d 6174 6872 ..where \(\mathr │ │ │ +00079170: 6d7b 726f 6472 6967 7565 737d 5c29 2064 m{rodrigues}\) d │ │ │ +00079180: 656e 6f74 6573 2061 2072 6f74 6174 696f enotes a rotatio │ │ │ +00079190: 6e20 7665 6374 6f72 2074 6f20 6120 726f n vector to a ro │ │ │ +000791a0: 7461 7469 6f6e 206d 6174 7269 7820 7472 tation matrix tr │ │ │ +000791b0: 616e 7366 6f72 6d61 7469 6f6e 2c20 616e ansformation, an │ │ │ +000791c0: 640a 5c28 5c6d 6174 6872 6d7b 726f 6472 d.\(\mathrm{rodr │ │ │ +000791d0: 6967 7565 737d 5e7b 2d31 7d5c 2920 6465 igues}^{-1}\) de │ │ │ +000791e0: 6e6f 7465 7320 7468 6520 696e 7665 7273 notes the invers │ │ │ +000791f0: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ +00079200: 2e20 5365 6520 2352 6f64 7269 6775 6573 . See #Rodrigues │ │ │ +00079210: 2066 6f72 2064 6574 6169 6c73 2e0a 0a41 for details...A │ │ │ +00079220: 6c73 6f2c 2074 6865 2066 756e 6374 696f lso, the functio │ │ │ +00079230: 6e73 2063 616e 2063 6f6d 7075 7465 2074 ns can compute t │ │ │ +00079240: 6865 2064 6572 6976 6174 6976 6573 206f he derivatives o │ │ │ +00079250: 6620 7468 6520 6f75 7470 7574 2076 6563 f the output vec │ │ │ +00079260: 746f 7273 2077 6974 6820 7265 6761 7264 tors with regard │ │ │ +00079270: 7320 746f 2074 6865 2069 6e70 7574 0a76 s to the input.v │ │ │ +00079280: 6563 746f 7273 2028 7365 6520 236d 6174 ectors (see #mat │ │ │ +00079290: 4d75 6c44 6572 6976 2029 2e20 5468 6520 MulDeriv ). The │ │ │ +000792a0: 6675 6e63 7469 6f6e 7320 6172 6520 7573 functions are us │ │ │ +000792b0: 6564 2069 6e73 6964 6520 2373 7465 7265 ed inside #stere │ │ │ +000792c0: 6f43 616c 6962 7261 7465 2062 7574 2063 oCalibrate but c │ │ │ +000792d0: 616e 2061 6c73 6f20 6265 2075 7365 6420 an also be used │ │ │ +000792e0: 696e 0a79 6f75 7220 6f77 6e20 636f 6465 in.your own code │ │ │ +000792f0: 2077 6865 7265 204c 6576 656e 6265 7267 where Levenberg │ │ │ +00079300: 2d4d 6172 7175 6172 6474 206f 7220 616e -Marquardt or an │ │ │ +00079310: 6f74 6865 7220 6772 6164 6965 6e74 2d62 other gradient-b │ │ │ +00079320: 6173 6564 2073 6f6c 7665 7220 6973 2075 ased solver is u │ │ │ +00079330: 7365 6420 746f 206f 7074 696d 697a 6520 sed to optimize │ │ │ +00079340: 610a 6675 6e63 7469 6f6e 2074 6861 7420 a.function that │ │ │ +00079350: 636f 6e74 6169 6e73 2061 206d 6174 7269 contains a matri │ │ │ +00079360: 7820 6d75 6c74 6970 6c69 6361 7469 6f6e x multiplication │ │ │ +00079370: 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 ..
    ..
    .< │ │ │ +00079390: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    c │ │ │ +00079440: 6f6d 706f 7365 5254 3c2f 6833 3e0a 3c64 omposeRT

    ..public stati │ │ │ +000794b0: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void composeRT(M │ │ │ +00079570: 6174 3c2f 613e 266e 6273 703b 7276 6563 at rvec │ │ │ +00079580: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ +000795c0: 4d61 743c 2f61 3e26 6e62 7370 3b74 7665 Mat tve │ │ │ +000795d0: 6331 2c0a 203c 6120 6872 6566 3d22 2e2e c1,. Mat rv │ │ │ +00079620: 6563 322c 0a20 3c61 2068 7265 663d 222e ec2,. Mat t │ │ │ +00079670: 7665 6332 2c0a 203c 6120 6872 6566 3d22 vec2,. Mat  │ │ │ +000796c0: 7276 6563 332c 0a20 3c61 2068 7265 663d rvec3,. Mat  │ │ │ +00079710: 3b74 7665 6333 293c 2f73 7061 6e3e 3c2f ;tvec3).
    Combines │ │ │ +00079740: 2074 776f 2072 6f74 6174 696f 6e2d 616e two rotation-an │ │ │ +00079750: 642d 7368 6966 7420 7472 616e 7366 6f72 d-shift transfor │ │ │ +00079760: 6d61 7469 6f6e 732e 3c2f 6469 763e 0a3c mations.
    .< │ │ │ +00079770: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ +00079780: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ +00079790: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    rvec1 - │ │ │ +000797b0: 4669 7273 7420 726f 7461 7469 6f6e 2076 First rotation v │ │ │ +000797c0: 6563 746f 722e 3c2f 6464 3e0a 3c64 643e ector.
    .
    │ │ │ +000797d0: 3c63 6f64 653e 7476 6563 313c 2f63 6f64 tvec1 - First trans │ │ │ +000797f0: 6c61 7469 6f6e 2076 6563 746f 722e 3c2f lation vector..
    rv │ │ │ +00079810: 6563 323c 2f63 6f64 653e 202d 2053 6563 ec2 - Sec │ │ │ +00079820: 6f6e 6420 726f 7461 7469 6f6e 2076 6563 ond rotation vec │ │ │ +00079830: 746f 722e 3c2f 6464 3e0a 3c64 643e 3c63 tor.
    .
    tvec2 │ │ │ +00079850: 202d 2053 6563 6f6e 6420 7472 616e 736c - Second transl │ │ │ +00079860: 6174 696f 6e20 7665 6374 6f72 2e3c 2f64 ation vector..
    rve │ │ │ +00079880: 6333 3c2f 636f 6465 3e20 2d20 4f75 7470 c3 - Outp │ │ │ +00079890: 7574 2072 6f74 6174 696f 6e20 7665 6374 ut rotation vect │ │ │ +000798a0: 6f72 206f 6620 7468 6520 7375 7065 7270 or of the superp │ │ │ +000798b0: 6f73 6974 696f 6e2e 3c2f 6464 3e0a 3c64 osition.
    .tvec3 - Output tr │ │ │ +000798e0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ +000798f0: 206f 6620 7468 6520 7375 7065 7270 6f73 of the superpos │ │ │ +00079900: 6974 696f 6e2e 0a0a 5468 6520 6675 6e63 ition...The func │ │ │ +00079910: 7469 6f6e 7320 636f 6d70 7574 653a 0a0a tions compute:.. │ │ │ +00079920: 5c28 5c62 6567 696e 7b61 7272 6179 7d7b \(\begin{array}{ │ │ │ +00079930: 6c7d 205c 7465 7874 7474 7b72 7665 6333 l} \texttt{rvec3 │ │ │ +00079940: 7d20 3d20 205c 6d61 7468 726d 7b72 6f64 } = \mathrm{rod │ │ │ +00079950: 7269 6775 6573 7d20 5e7b 2d31 7d20 5c6c rigues} ^{-1} \l │ │ │ +00079960: 6566 7420 2820 5c6d 6174 6872 6d7b 726f eft ( \mathrm{ro │ │ │ +00079970: 6472 6967 7565 737d 2028 205c 7465 7874 drigues} ( \text │ │ │ +00079980: 7474 7b72 7665 6332 7d20 2920 205c 6364 tt{rvec2} ) \cd │ │ │ +00079990: 6f74 205c 6d61 7468 726d 7b72 6f64 7269 ot \mathrm{rodri │ │ │ +000799a0: 6775 6573 7d20 2820 5c74 6578 7474 747b gues} ( \texttt{ │ │ │ +000799b0: 7276 6563 317d 2029 205c 7269 6768 7420 rvec1} ) \right │ │ │ +000799c0: 2920 205c 5c20 5c74 6578 7474 747b 7476 ) \\ \texttt{tv │ │ │ +000799d0: 6563 337d 203d 2020 5c6d 6174 6872 6d7b ec3} = \mathrm{ │ │ │ +000799e0: 726f 6472 6967 7565 737d 2028 205c 7465 rodrigues} ( \te │ │ │ +000799f0: 7874 7474 7b72 7665 6332 7d20 2920 205c xttt{rvec2} ) \ │ │ │ +00079a00: 6364 6f74 205c 7465 7874 7474 7b74 7665 cdot \texttt{tve │ │ │ +00079a10: 6331 7d20 2b20 205c 7465 7874 7474 7b74 c1} + \texttt{t │ │ │ +00079a20: 7665 6332 7d20 5c65 6e64 7b61 7272 6179 vec2} \end{array │ │ │ +00079a30: 7d20 2c5c 290a 0a77 6865 7265 205c 285c } ,\)..where \(\ │ │ │ +00079a40: 6d61 7468 726d 7b72 6f64 7269 6775 6573 mathrm{rodrigues │ │ │ +00079a50: 7d5c 2920 6465 6e6f 7465 7320 6120 726f }\) denotes a ro │ │ │ +00079a60: 7461 7469 6f6e 2076 6563 746f 7220 746f tation vector to │ │ │ +00079a70: 2061 2072 6f74 6174 696f 6e20 6d61 7472 a rotation matr │ │ │ +00079a80: 6978 2074 7261 6e73 666f 726d 6174 696f ix transformatio │ │ │ +00079a90: 6e2c 2061 6e64 0a5c 285c 6d61 7468 726d n, and.\(\mathrm │ │ │ +00079aa0: 7b72 6f64 7269 6775 6573 7d5e 7b2d 317d {rodrigues}^{-1} │ │ │ +00079ab0: 5c29 2064 656e 6f74 6573 2074 6865 2069 \) denotes the i │ │ │ +00079ac0: 6e76 6572 7365 2074 7261 6e73 666f 726d nverse transform │ │ │ +00079ad0: 6174 696f 6e2e 2053 6565 2023 526f 6472 ation. See #Rodr │ │ │ +00079ae0: 6967 7565 7320 666f 7220 6465 7461 696c igues for detail │ │ │ +00079af0: 732e 0a0a 416c 736f 2c20 7468 6520 6675 s...Also, the fu │ │ │ +00079b00: 6e63 7469 6f6e 7320 6361 6e20 636f 6d70 nctions can comp │ │ │ +00079b10: 7574 6520 7468 6520 6465 7269 7661 7469 ute the derivati │ │ │ +00079b20: 7665 7320 6f66 2074 6865 206f 7574 7075 ves of the outpu │ │ │ +00079b30: 7420 7665 6374 6f72 7320 7769 7468 2072 t vectors with r │ │ │ +00079b40: 6567 6172 6473 2074 6f20 7468 6520 696e egards to the in │ │ │ +00079b50: 7075 740a 7665 6374 6f72 7320 2873 6565 put.vectors (see │ │ │ +00079b60: 2023 6d61 744d 756c 4465 7269 7620 292e #matMulDeriv ). │ │ │ +00079b70: 2054 6865 2066 756e 6374 696f 6e73 2061 The functions a │ │ │ +00079b80: 7265 2075 7365 6420 696e 7369 6465 2023 re used inside # │ │ │ +00079b90: 7374 6572 656f 4361 6c69 6272 6174 6520 stereoCalibrate │ │ │ +00079ba0: 6275 7420 6361 6e20 616c 736f 2062 6520 but can also be │ │ │ +00079bb0: 7573 6564 2069 6e0a 796f 7572 206f 776e used in.your own │ │ │ +00079bc0: 2063 6f64 6520 7768 6572 6520 4c65 7665 code where Leve │ │ │ +00079bd0: 6e62 6572 672d 4d61 7271 7561 7264 7420 nberg-Marquardt │ │ │ +00079be0: 6f72 2061 6e6f 7468 6572 2067 7261 6469 or another gradi │ │ │ +00079bf0: 656e 742d 6261 7365 6420 736f 6c76 6572 ent-based solver │ │ │ +00079c00: 2069 7320 7573 6564 2074 6f20 6f70 7469 is used to opti │ │ │ +00079c10: 6d69 7a65 2061 0a66 756e 6374 696f 6e20 mize a.function │ │ │ +00079c20: 7468 6174 2063 6f6e 7461 696e 7320 6120 that contains a │ │ │ +00079c30: 6d61 7472 6978 206d 756c 7469 706c 6963 matrix multiplic │ │ │ +00079c40: 6174 696f 6e2e 3c2f 6464 3e0a 3c2f 646c ation....
    .
  • .
  • .< │ │ │ +00079c70: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +00079c80: 6574 6169 6c22 2069 643d 2270 726f 6a65 etail" id="proje │ │ │ +00079c90: 6374 506f 696e 7473 286f 7267 2e6f 7065 ctPoints(org.ope │ │ │ +00079ca0: 6e63 762e 636f 7265 2e4d 6174 4f66 506f ncv.core.MatOfPo │ │ │ +00079cb0: 696e 7433 662c 6f72 672e 6f70 656e 6376 int3f,org.opencv │ │ │ +00079cc0: 2e63 6f72 652e 4d61 742c 6f72 672e 6f70 .core.Mat,org.op │ │ │ +00079cd0: 656e 6376 2e63 6f72 652e 4d61 742c 6f72 encv.core.Mat,or │ │ │ +00079ce0: 672e 6f70 656e 6376 2e63 6f72 652e 4d61 g.opencv.core.Ma │ │ │ +00079cf0: 742c 6f72 672e 6f70 656e 6376 2e63 6f72 t,org.opencv.cor │ │ │ +00079d00: 652e 4d61 744f 6644 6f75 626c 652c 6f72 e.MatOfDouble,or │ │ │ +00079d10: 672e 6f70 656e 6376 2e63 6f72 652e 4d61 g.opencv.core.Ma │ │ │ +00079d20: 744f 6650 6f69 6e74 3266 2c6f 7267 2e6f tOfPoint2f,org.o │ │ │ +00079d30: 7065 6e63 762e 636f 7265 2e4d 6174 2c64 pencv.core.Mat,d │ │ │ +00079d40: 6f75 626c 6529 223e 0a3c 6833 3e70 726f ouble)">.

    pro │ │ │ +00079d50: 6a65 6374 506f 696e 7473 3c2f 6833 3e0a jectPoints

    . │ │ │ +00079d60: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ +00079d80: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ +00079dc0: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ +00079dd0: 3c73 7061 6e20 636c 6173 733d 2272 6574 void projectPoi │ │ │ +00079e20: 6e74 733c 2f73 7061 6e3e 3c77 6272 3e3c nts< │ │ │ +00079e30: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +00079e40: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Ma │ │ │ +00079e90: 744f 6650 6f69 6e74 3366 3c2f 613e 266e tOfPoint3f&n │ │ │ +00079ea0: 6273 703b 6f62 6a65 6374 506f 696e 7473 bsp;objectPoints │ │ │ +00079eb0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +00079ef0: 6174 3c2f 613e 266e 6273 703b 7276 6563 at rvec │ │ │ +00079f00: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +00079f40: 6174 3c2f 613e 266e 6273 703b 7476 6563 at tvec │ │ │ +00079f50: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +00079f90: 6174 3c2f 613e 266e 6273 703b 6361 6d65 at came │ │ │ +00079fa0: 7261 4d61 7472 6978 2c0a 203c 6120 6872 raMatrix,. M │ │ │ +00079ff0: 6174 4f66 446f 7562 6c65 3c2f 613e 266e atOfDouble&n │ │ │ +0007a000: 6273 703b 6469 7374 436f 6566 6673 2c0a bsp;distCoeffs,. │ │ │ +0007a010: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 MatOfPoint │ │ │ +0007a060: 3266 3c2f 613e 266e 6273 703b 696d 6167 2f imag │ │ │ +0007a070: 6550 6f69 6e74 732c 0a20 3c61 2068 7265 ePoints,. Mat&nb │ │ │ +0007a0c0: 7370 3b6a 6163 6f62 6961 6e2c 0a20 646f sp;jacobian,. do │ │ │ +0007a0d0: 7562 6c65 266e 6273 703b 6173 7065 6374 uble aspect │ │ │ +0007a0e0: 5261 7469 6f29 3c2f 7370 616e 3e3c 2f64 Ratio).
    Projects │ │ │ +0007a110: 3344 2070 6f69 6e74 7320 746f 2061 6e20 3D points to an │ │ │ +0007a120: 696d 6167 6520 706c 616e 652e 0a0a 5468 image plane...Th │ │ │ +0007a130: 6520 6675 6e63 7469 6f6e 2063 6f6d 7075 e function compu │ │ │ +0007a140: 7465 7320 7468 6520 3244 2070 726f 6a65 tes the 2D proje │ │ │ +0007a150: 6374 696f 6e73 206f 6620 3344 2070 6f69 ctions of 3D poi │ │ │ +0007a160: 6e74 7320 746f 2074 6865 2069 6d61 6765 nts to the image │ │ │ +0007a170: 2070 6c61 6e65 2c20 6769 7665 6e20 696e plane, given in │ │ │ +0007a180: 7472 696e 7369 6320 616e 640a 6578 7472 trinsic and.extr │ │ │ +0007a190: 696e 7369 6320 6361 6d65 7261 2070 6172 insic camera par │ │ │ +0007a1a0: 616d 6574 6572 732e 204f 7074 696f 6e61 ameters. Optiona │ │ │ +0007a1b0: 6c6c 792c 2074 6865 2066 756e 6374 696f lly, the functio │ │ │ +0007a1c0: 6e20 636f 6d70 7574 6573 204a 6163 6f62 n computes Jacob │ │ │ +0007a1d0: 6961 6e73 202d 6d61 7472 6963 6573 206f ians -matrices o │ │ │ +0007a1e0: 6620 7061 7274 6961 6c0a 6465 7269 7661 f partial.deriva │ │ │ +0007a1f0: 7469 7665 7320 6f66 2069 6d61 6765 2070 tives of image p │ │ │ +0007a200: 6f69 6e74 7320 636f 6f72 6469 6e61 7465 oints coordinate │ │ │ +0007a210: 7320 2861 7320 6675 6e63 7469 6f6e 7320 s (as functions │ │ │ +0007a220: 6f66 2061 6c6c 2074 6865 2069 6e70 7574 of all the input │ │ │ +0007a230: 2070 6172 616d 6574 6572 7329 2077 6974 parameters) wit │ │ │ +0007a240: 6820 7265 7370 6563 7420 746f 0a74 6865 h respect to.the │ │ │ +0007a250: 2070 6172 7469 6375 6c61 7220 7061 7261 particular para │ │ │ +0007a260: 6d65 7465 7273 2c20 696e 7472 696e 7369 meters, intrinsi │ │ │ +0007a270: 6320 616e 642f 6f72 2065 7874 7269 6e73 c and/or extrins │ │ │ +0007a280: 6963 2e20 5468 6520 4a61 636f 6269 616e ic. The Jacobian │ │ │ +0007a290: 7320 6172 6520 7573 6564 2064 7572 696e s are used durin │ │ │ +0007a2a0: 6720 7468 6520 676c 6f62 616c 0a6f 7074 g the global.opt │ │ │ +0007a2b0: 696d 697a 6174 696f 6e20 696e 2052 4546 imization in REF │ │ │ +0007a2c0: 3a20 6361 6c69 6272 6174 6543 616d 6572 : calibrateCamer │ │ │ +0007a2d0: 612c 2052 4546 3a20 736f 6c76 6550 6e50 a, REF: solvePnP │ │ │ +0007a2e0: 2c20 616e 6420 5245 463a 2073 7465 7265 , and REF: stere │ │ │ +0007a2f0: 6f43 616c 6962 7261 7465 2e20 5468 6520 oCalibrate. The │ │ │ +0007a300: 6675 6e63 7469 6f6e 2069 7473 656c 660a function itself. │ │ │ +0007a310: 6361 6e20 616c 736f 2062 6520 7573 6564 can also be used │ │ │ +0007a320: 2074 6f20 636f 6d70 7574 6520 6120 7265 to compute a re │ │ │ +0007a330: 2d70 726f 6a65 6374 696f 6e20 6572 726f -projection erro │ │ │ +0007a340: 722c 2067 6976 656e 2074 6865 2063 7572 r, given the cur │ │ │ +0007a350: 7265 6e74 2069 6e74 7269 6e73 6963 2061 rent intrinsic a │ │ │ +0007a360: 6e64 2065 7874 7269 6e73 6963 0a70 6172 nd extrinsic.par │ │ │ +0007a370: 616d 6574 6572 732e 0a0a 3c62 3e4e 6f74 ameters...Not │ │ │ +0007a380: 653a 3c2f 623e 203c 623e 436f 6f72 6469 e: Coordi │ │ │ +0007a390: 6e61 7465 2053 7973 7465 6d73 3a3c 2f62 nate Systems:.
      .
    • . < │ │ │ +0007a3b0: 623e 496e 7075 7420 283c 636f 6465 3e6f b>Input (o │ │ │ +0007a3c0: 626a 6563 7450 6f69 6e74 733c 2f63 6f64 bjectPoints): 3D poin │ │ │ +0007a3e0: 7473 2069 6e20 7468 6520 3c62 3e77 6f72 ts in the wor │ │ │ +0007a3f0: 6c64 2063 6f6f 7264 696e 6174 6520 6672 ld coordinate fr │ │ │ +0007a400: 616d 653c 2f62 3e2e 0a20 203c 2f6c 693e ame..
    • │ │ │ +0007a410: 0a20 203c 6c69 3e0a 203c 623e 4f75 7470 .
    • . Outp │ │ │ +0007a420: 7574 2028 3c63 6f64 653e 696d 6167 6550 ut (imageP │ │ │ +0007a430: 6f69 6e74 733c 2f63 6f64 653e 293c 2f62 oints): 2D projection │ │ │ +0007a450: 7320 696e 203c 623e 7069 7865 6c20 636f s in pixel co │ │ │ +0007a460: 6f72 6469 6e61 7465 733c 2f62 3e20 6f66 ordinates of │ │ │ +0007a470: 2074 6865 2069 6d61 6765 2070 6c61 6e65 the image plane │ │ │ +0007a480: 2c20 7769 7468 2064 6973 746f 7274 696f , with distortio │ │ │ +0007a490: 6e20 6170 706c 6965 642e 0a20 2054 6865 n applied.. The │ │ │ +0007a4a0: 2063 6f6f 7264 696e 6174 6573 205c 2828 coordinates \(( │ │ │ +0007a4b0: 752c 2076 295c 2920 6172 6520 6d65 6173 u, v)\) are meas │ │ │ +0007a4c0: 7572 6564 2069 6e20 7069 7865 6c73 2066 ured in pixels f │ │ │ +0007a4d0: 726f 6d20 7468 6520 746f 702d 6c65 6674 rom the top-left │ │ │ +0007a4e0: 2063 6f72 6e65 7220 6f66 2074 6865 2069 corner of the i │ │ │ +0007a4f0: 6d61 6765 2e0a 2020 3c2f 6c69 3e0a 3c2f mage..
    • ...The transfo │ │ │ +0007a510: 726d 6174 696f 6e20 6368 6169 6e20 6973 rmation chain is │ │ │ +0007a520: 3a20 576f 726c 6420 636f 6f72 6469 6e61 : World coordina │ │ │ +0007a530: 7465 7320 e286 9220 4361 6d65 7261 2063 tes ... Camera c │ │ │ +0007a540: 6f6f 7264 696e 6174 6573 2028 7669 6120 oordinates (via │ │ │ +0007a550: 7276 6563 2f74 7665 6329 20e2 8692 204e rvec/tvec) ... N │ │ │ +0007a560: 6f72 6d61 6c69 7a65 6420 6361 6d65 7261 ormalized camera │ │ │ +0007a570: 2063 6f6f 7264 696e 6174 6573 0ae2 8692 coordinates.... │ │ │ +0007a580: 2044 6973 746f 7274 696f 6e20 6170 706c Distortion appl │ │ │ +0007a590: 6965 6420 e286 9220 5069 7865 6c20 636f ied ... Pixel co │ │ │ +0007a5a0: 6f72 6469 6e61 7465 7320 2876 6961 2063 ordinates (via c │ │ │ +0007a5b0: 616d 6572 614d 6174 7269 7829 2e3c 2f64 ameraMatrix)..
      .
      Param │ │ │ +0007a5e0: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
      .
      │ │ │ +0007a5f0: 3c63 6f64 653e 6f62 6a65 6374 506f 696e objectPoin │ │ │ +0007a600: 7473 3c2f 636f 6465 3e20 2d20 4172 7261 ts - Arra │ │ │ +0007a610: 7920 6f66 206f 626a 6563 7420 706f 696e y of object poin │ │ │ +0007a620: 7473 2065 7870 7265 7373 6564 2077 7274 ts expressed wrt │ │ │ +0007a630: 2e20 7468 6520 776f 726c 6420 636f 6f72 . the world coor │ │ │ +0007a640: 6469 6e61 7465 2066 7261 6d65 2e20 4120 dinate frame. A │ │ │ +0007a650: 3378 4e2f 4e78 330a 312d 6368 616e 6e65 3xN/Nx3.1-channe │ │ │ +0007a660: 6c20 6f72 2031 784e 2f4e 7831 2033 2d63 l or 1xN/Nx1 3-c │ │ │ +0007a670: 6861 6e6e 656c 2028 6f72 2076 6563 746f hannel (or vecto │ │ │ +0007a680: 7226 6c74 3b50 6f69 6e74 3366 2667 743b r<Point3f> │ │ │ +0007a690: 2029 2c20 7768 6572 6520 4e20 6973 2074 ), where N is t │ │ │ +0007a6a0: 6865 206e 756d 6265 7220 6f66 2070 6f69 he number of poi │ │ │ +0007a6b0: 6e74 7320 696e 2074 6865 2076 6965 772e nts in the view. │ │ │ +0007a6c0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
      .
      │ │ │ +0007a6d0: 7276 6563 3c2f 636f 6465 3e20 2d20 5468 rvec - Th │ │ │ +0007a6e0: 6520 726f 7461 7469 6f6e 2076 6563 746f e rotation vecto │ │ │ +0007a6f0: 7220 2852 4546 3a20 526f 6472 6967 7565 r (REF: Rodrigue │ │ │ +0007a700: 7329 2074 6861 742c 2074 6f67 6574 6865 s) that, togethe │ │ │ +0007a710: 7220 7769 7468 2074 7665 632c 2070 6572 r with tvec, per │ │ │ +0007a720: 666f 726d 7320 6120 6368 616e 6765 206f forms a change o │ │ │ +0007a730: 660a 6261 7369 7320 6672 6f6d 2077 6f72 f.basis from wor │ │ │ +0007a740: 6c64 2074 6f20 6361 6d65 7261 2063 6f6f ld to camera coo │ │ │ +0007a750: 7264 696e 6174 6520 7379 7374 656d 2c20 rdinate system, │ │ │ +0007a760: 7365 6520 5245 463a 2063 616c 6962 7261 see REF: calibra │ │ │ +0007a770: 7465 4361 6d65 7261 2066 6f72 2064 6574 teCamera for det │ │ │ +0007a780: 6169 6c73 2e3c 2f64 643e 0a3c 6464 3e3c ails.
      .
      < │ │ │ +0007a790: 636f 6465 3e74 7665 633c 2f63 6f64 653e code>tvec │ │ │ +0007a7a0: 202d 2054 6865 2074 7261 6e73 6c61 7469 - The translati │ │ │ +0007a7b0: 6f6e 2076 6563 746f 722c 2073 6565 2070 on vector, see p │ │ │ +0007a7c0: 6172 616d 6574 6572 2064 6573 6372 6970 arameter descrip │ │ │ +0007a7d0: 7469 6f6e 2061 626f 7665 2e3c 2f64 643e tion above.
      │ │ │ +0007a7e0: 0a3c 6464 3e3c 636f 6465 3e63 616d 6572 .
      camer │ │ │ +0007a7f0: 614d 6174 7269 783c 2f63 6f64 653e 202d aMatrix - │ │ │ +0007a800: 2043 616d 6572 6120 696e 7472 696e 7369 Camera intrinsi │ │ │ +0007a810: 6320 6d61 7472 6978 205c 285c 6361 6d65 c matrix \(\came │ │ │ +0007a820: 7261 6d61 7472 6978 7b41 7d5c 2920 2e3c ramatrix{A}\) .< │ │ │ +0007a830: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
      d │ │ │ +0007a840: 6973 7443 6f65 6666 733c 2f63 6f64 653e istCoeffs │ │ │ +0007a850: 202d 2049 6e70 7574 2076 6563 746f 7220 - Input vector │ │ │ +0007a860: 6f66 2064 6973 746f 7274 696f 6e20 636f of distortion co │ │ │ +0007a870: 6566 6669 6369 656e 7473 0a5c 285c 6469 efficients.\(\di │ │ │ +0007a880: 7374 636f 6566 6673 5c29 202e 2049 6620 stcoeffs\) . If │ │ │ +0007a890: 7468 6520 7665 6374 6f72 2069 7320 656d the vector is em │ │ │ +0007a8a0: 7074 792c 2074 6865 207a 6572 6f20 6469 pty, the zero di │ │ │ +0007a8b0: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ +0007a8c0: 6965 6e74 7320 6172 6520 6173 7375 6d65 ients are assume │ │ │ +0007a8d0: 642e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 d.
      .
      imagePoints - Output ar │ │ │ +0007a900: 7261 7920 6f66 2069 6d61 6765 2070 6f69 ray of image poi │ │ │ +0007a910: 6e74 7320 696e 203c 623e 7069 7865 6c20 nts in pixel │ │ │ +0007a920: 636f 6f72 6469 6e61 7465 733c 2f62 3e2c coordinates, │ │ │ +0007a930: 2031 784e 2f4e 7831 2032 2d63 6861 6e6e 1xN/Nx1 2-chann │ │ │ +0007a940: 656c 2c20 6f72 0a76 6563 746f 7226 6c74 el, or.vector< │ │ │ +0007a950: 3b50 6f69 6e74 3266 2667 743b 202e 3c2f ;Point2f> ..
      ja │ │ │ +0007a970: 636f 6269 616e 3c2f 636f 6465 3e20 2d20 cobian - │ │ │ +0007a980: 4f70 7469 6f6e 616c 206f 7574 7075 7420 Optional output │ │ │ +0007a990: 324e 7828 3130 2b26 6c74 3b6e 756d 4469 2Nx(10+<numDi │ │ │ +0007a9a0: 7374 436f 6566 6673 2667 743b 2920 6a61 stCoeffs>) ja │ │ │ +0007a9b0: 636f 6269 616e 206d 6174 7269 7820 6f66 cobian matrix of │ │ │ +0007a9c0: 2064 6572 6976 6174 6976 6573 206f 6620 derivatives of │ │ │ +0007a9d0: 696d 6167 650a 706f 696e 7473 2077 6974 image.points wit │ │ │ +0007a9e0: 6820 7265 7370 6563 7420 746f 2063 6f6d h respect to com │ │ │ +0007a9f0: 706f 6e65 6e74 7320 6f66 2074 6865 2072 ponents of the r │ │ │ +0007aa00: 6f74 6174 696f 6e20 7665 6374 6f72 2c20 otation vector, │ │ │ +0007aa10: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ +0007aa20: 6f72 2c20 666f 6361 6c20 6c65 6e67 7468 or, focal length │ │ │ +0007aa30: 732c 0a63 6f6f 7264 696e 6174 6573 206f s,.coordinates o │ │ │ +0007aa40: 6620 7468 6520 7072 696e 6369 7061 6c20 f the principal │ │ │ +0007aa50: 706f 696e 7420 616e 6420 7468 6520 6469 point and the di │ │ │ +0007aa60: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ +0007aa70: 6965 6e74 732e 2049 6e20 7468 6520 6f6c ients. In the ol │ │ │ +0007aa80: 6420 696e 7465 7266 6163 6520 6469 6666 d interface diff │ │ │ +0007aa90: 6572 656e 740a 636f 6d70 6f6e 656e 7473 erent.components │ │ │ +0007aaa0: 206f 6620 7468 6520 6a61 636f 6269 616e of the jacobian │ │ │ +0007aab0: 2061 7265 2072 6574 7572 6e65 6420 7669 are returned vi │ │ │ +0007aac0: 6120 6469 6666 6572 656e 7420 6f75 7470 a different outp │ │ │ +0007aad0: 7574 2070 6172 616d 6574 6572 732e 3c2f ut parameters..
      as │ │ │ +0007aaf0: 7065 6374 5261 7469 6f3c 2f63 6f64 653e pectRatio │ │ │ +0007ab00: 202d 204f 7074 696f 6e61 6c20 2266 6978 - Optional "fix │ │ │ +0007ab10: 6564 2061 7370 6563 7420 7261 7469 6f22 ed aspect ratio" │ │ │ +0007ab20: 2070 6172 616d 6574 6572 2e20 4966 2074 parameter. If t │ │ │ +0007ab30: 6865 2070 6172 616d 6574 6572 2069 7320 he parameter is │ │ │ +0007ab40: 6e6f 7420 302c 2074 6865 0a66 756e 6374 not 0, the.funct │ │ │ +0007ab50: 696f 6e20 6173 7375 6d65 7320 7468 6174 ion assumes that │ │ │ +0007ab60: 2074 6865 2061 7370 6563 7420 7261 7469 the aspect rati │ │ │ +0007ab70: 6f20 285c 2866 5f78 202f 2066 5f79 5c29 o (\(f_x / f_y\) │ │ │ +0007ab80: 2920 6973 2066 6978 6564 2061 6e64 2063 ) is fixed and c │ │ │ +0007ab90: 6f72 7265 7370 6f6e 6469 6e67 6c79 2061 orrespondingly a │ │ │ +0007aba0: 646a 7573 7473 2074 6865 0a6a 6163 6f62 djusts the.jacob │ │ │ +0007abb0: 6961 6e20 6d61 7472 6978 2e0a 0a3c 623e ian matrix... │ │ │ +0007abc0: 4e6f 7465 3a3c 2f62 3e20 4279 2073 6574 Note: By set │ │ │ +0007abd0: 7469 6e67 2072 7665 6320 3d20 7476 6563 ting rvec = tvec │ │ │ +0007abe0: 203d 205c 285b 302c 2030 2c20 305d 5c29 = \([0, 0, 0]\) │ │ │ +0007abf0: 2c20 6f72 2062 7920 7365 7474 696e 6720 , or by setting │ │ │ +0007ac00: 6361 6d65 7261 4d61 7472 6978 2074 6f20 cameraMatrix to │ │ │ +0007ac10: 6120 3378 3320 6964 656e 7469 7479 206d a 3x3 identity m │ │ │ +0007ac20: 6174 7269 782c 0a6f 7220 6279 2070 6173 atrix,.or by pas │ │ │ +0007ac30: 7369 6e67 207a 6572 6f20 6469 7374 6f72 sing zero distor │ │ │ +0007ac40: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ +0007ac50: 732c 206f 6e65 2063 616e 2067 6574 2076 s, one can get v │ │ │ +0007ac60: 6172 696f 7573 2075 7365 6675 6c20 7061 arious useful pa │ │ │ +0007ac70: 7274 6961 6c20 6361 7365 7320 6f66 2074 rtial cases of t │ │ │ +0007ac80: 6865 0a66 756e 6374 696f 6e2e 2054 6869 he.function. Thi │ │ │ +0007ac90: 7320 6d65 616e 732c 206f 6e65 2063 616e s means, one can │ │ │ +0007aca0: 2063 6f6d 7075 7465 2074 6865 2064 6973 compute the dis │ │ │ +0007acb0: 746f 7274 6564 2063 6f6f 7264 696e 6174 torted coordinat │ │ │ +0007acc0: 6573 2066 6f72 2061 2073 7061 7273 6520 es for a sparse │ │ │ +0007acd0: 7365 7420 6f66 2070 6f69 6e74 7320 6f72 set of points or │ │ │ +0007ace0: 2061 7070 6c79 0a61 2070 6572 7370 6563 apply.a perspec │ │ │ +0007acf0: 7469 7665 2074 7261 6e73 666f 726d 6174 tive transformat │ │ │ +0007ad00: 696f 6e20 2861 6e64 2061 6c73 6f20 636f ion (and also co │ │ │ +0007ad10: 6d70 7574 6520 7468 6520 6465 7269 7661 mpute the deriva │ │ │ +0007ad20: 7469 7665 7329 2069 6e20 7468 6520 6964 tives) in the id │ │ │ +0007ad30: 6561 6c20 7a65 726f 2d64 6973 746f 7274 eal zero-distort │ │ │ +0007ad40: 696f 6e20 7365 7475 702e 3c2f 6464 3e0a ion setup.
      . │ │ │ +0007ad50: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
      .
    .
    .
  • ..
    .

    projec │ │ │ +0007ae50: 7450 6f69 6e74 733c 2f68 333e 0a3c 6469 tPoints

    ..public static │ │ │ +0007aec0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  void projectPoints │ │ │ +0007af20: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (MatOf │ │ │ +0007af90: 506f 696e 7433 663c 2f61 3e26 6e62 7370 Point3f  │ │ │ +0007afa0: 3b6f 626a 6563 7450 6f69 6e74 732c 0a20 ;objectPoints,. │ │ │ +0007afb0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +0007aff0: 2f61 3e26 6e62 7370 3b72 7665 632c 0a20 /a> rvec,. │ │ │ +0007b000: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +0007b040: 2f61 3e26 6e62 7370 3b74 7665 632c 0a20 /a> tvec,. │ │ │ +0007b050: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +0007b090: 2f61 3e26 6e62 7370 3b63 616d 6572 614d /a> cameraM │ │ │ +0007b0a0: 6174 7269 782c 0a20 3c61 2068 7265 663d atrix,. MatO │ │ │ +0007b0f0: 6644 6f75 626c 653c 2f61 3e26 6e62 7370 fDouble  │ │ │ +0007b100: 3b64 6973 7443 6f65 6666 732c 0a20 3c61 ;distCoeffs,. MatOfPoint2f< │ │ │ +0007b160: 2f61 3e26 6e62 7370 3b69 6d61 6765 506f /a> imagePo │ │ │ +0007b170: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. Mat  │ │ │ +0007b1c0: 6a61 636f 6269 616e 293c 2f73 7061 6e3e jacobian) │ │ │ +0007b1d0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173 .
    Projec │ │ │ +0007b1f0: 7473 2033 4420 706f 696e 7473 2074 6f20 ts 3D points to │ │ │ +0007b200: 616e 2069 6d61 6765 2070 6c61 6e65 2e0a an image plane.. │ │ │ +0007b210: 0a54 6865 2066 756e 6374 696f 6e20 636f .The function co │ │ │ +0007b220: 6d70 7574 6573 2074 6865 2032 4420 7072 mputes the 2D pr │ │ │ +0007b230: 6f6a 6563 7469 6f6e 7320 6f66 2033 4420 ojections of 3D │ │ │ +0007b240: 706f 696e 7473 2074 6f20 7468 6520 696d points to the im │ │ │ +0007b250: 6167 6520 706c 616e 652c 2067 6976 656e age plane, given │ │ │ +0007b260: 2069 6e74 7269 6e73 6963 2061 6e64 0a65 intrinsic and.e │ │ │ +0007b270: 7874 7269 6e73 6963 2063 616d 6572 6120 xtrinsic camera │ │ │ +0007b280: 7061 7261 6d65 7465 7273 2e20 4f70 7469 parameters. Opti │ │ │ +0007b290: 6f6e 616c 6c79 2c20 7468 6520 6675 6e63 onally, the func │ │ │ +0007b2a0: 7469 6f6e 2063 6f6d 7075 7465 7320 4a61 tion computes Ja │ │ │ +0007b2b0: 636f 6269 616e 7320 2d6d 6174 7269 6365 cobians -matrice │ │ │ +0007b2c0: 7320 6f66 2070 6172 7469 616c 0a64 6572 s of partial.der │ │ │ +0007b2d0: 6976 6174 6976 6573 206f 6620 696d 6167 ivatives of imag │ │ │ +0007b2e0: 6520 706f 696e 7473 2063 6f6f 7264 696e e points coordin │ │ │ +0007b2f0: 6174 6573 2028 6173 2066 756e 6374 696f ates (as functio │ │ │ +0007b300: 6e73 206f 6620 616c 6c20 7468 6520 696e ns of all the in │ │ │ +0007b310: 7075 7420 7061 7261 6d65 7465 7273 2920 put parameters) │ │ │ +0007b320: 7769 7468 2072 6573 7065 6374 2074 6f0a with respect to. │ │ │ +0007b330: 7468 6520 7061 7274 6963 756c 6172 2070 the particular p │ │ │ +0007b340: 6172 616d 6574 6572 732c 2069 6e74 7269 arameters, intri │ │ │ +0007b350: 6e73 6963 2061 6e64 2f6f 7220 6578 7472 nsic and/or extr │ │ │ +0007b360: 696e 7369 632e 2054 6865 204a 6163 6f62 insic. The Jacob │ │ │ +0007b370: 6961 6e73 2061 7265 2075 7365 6420 6475 ians are used du │ │ │ +0007b380: 7269 6e67 2074 6865 2067 6c6f 6261 6c0a ring the global. │ │ │ +0007b390: 6f70 7469 6d69 7a61 7469 6f6e 2069 6e20 optimization in │ │ │ +0007b3a0: 5245 463a 2063 616c 6962 7261 7465 4361 REF: calibrateCa │ │ │ +0007b3b0: 6d65 7261 2c20 5245 463a 2073 6f6c 7665 mera, REF: solve │ │ │ +0007b3c0: 506e 502c 2061 6e64 2052 4546 3a20 7374 PnP, and REF: st │ │ │ +0007b3d0: 6572 656f 4361 6c69 6272 6174 652e 2054 ereoCalibrate. T │ │ │ +0007b3e0: 6865 2066 756e 6374 696f 6e20 6974 7365 he function itse │ │ │ +0007b3f0: 6c66 0a63 616e 2061 6c73 6f20 6265 2075 lf.can also be u │ │ │ +0007b400: 7365 6420 746f 2063 6f6d 7075 7465 2061 sed to compute a │ │ │ +0007b410: 2072 652d 7072 6f6a 6563 7469 6f6e 2065 re-projection e │ │ │ +0007b420: 7272 6f72 2c20 6769 7665 6e20 7468 6520 rror, given the │ │ │ +0007b430: 6375 7272 656e 7420 696e 7472 696e 7369 current intrinsi │ │ │ +0007b440: 6320 616e 6420 6578 7472 696e 7369 630a c and extrinsic. │ │ │ +0007b450: 7061 7261 6d65 7465 7273 2e0a 0a3c 623e parameters... │ │ │ +0007b460: 4e6f 7465 3a3c 2f62 3e20 3c62 3e43 6f6f Note: Coo │ │ │ +0007b470: 7264 696e 6174 6520 5379 7374 656d 733a rdinate Systems: │ │ │ +0007b480: 3c2f 623e 0a3c 756c 3e0a 2020 3c6c 693e .
      .
    • │ │ │ +0007b490: 0a20 3c62 3e49 6e70 7574 2028 3c63 6f64 . Input (objectPoints): 3D p │ │ │ +0007b4c0: 6f69 6e74 7320 696e 2074 6865 203c 623e oints in the │ │ │ +0007b4d0: 776f 726c 6420 636f 6f72 6469 6e61 7465 world coordinate │ │ │ +0007b4e0: 2066 7261 6d65 3c2f 623e 2e0a 2020 3c2f frame.. .
    • . O │ │ │ +0007b500: 7574 7075 7420 283c 636f 6465 3e69 6d61 utput (ima │ │ │ +0007b510: 6765 506f 696e 7473 3c2f 636f 6465 3e29 gePoints) │ │ │ +0007b520: 3c2f 623e 3a20 3244 2070 726f 6a65 6374 : 2D project │ │ │ +0007b530: 696f 6e73 2069 6e20 3c62 3e70 6978 656c ions in pixel │ │ │ +0007b540: 2063 6f6f 7264 696e 6174 6573 3c2f 623e coordinates │ │ │ +0007b550: 206f 6620 7468 6520 696d 6167 6520 706c of the image pl │ │ │ +0007b560: 616e 652c 2077 6974 6820 6469 7374 6f72 ane, with distor │ │ │ +0007b570: 7469 6f6e 2061 7070 6c69 6564 2e0a 2020 tion applied.. │ │ │ +0007b580: 5468 6520 636f 6f72 6469 6e61 7465 7320 The coordinates │ │ │ +0007b590: 5c28 2875 2c20 7629 5c29 2061 7265 206d \((u, v)\) are m │ │ │ +0007b5a0: 6561 7375 7265 6420 696e 2070 6978 656c easured in pixel │ │ │ +0007b5b0: 7320 6672 6f6d 2074 6865 2074 6f70 2d6c s from the top-l │ │ │ +0007b5c0: 6566 7420 636f 726e 6572 206f 6620 7468 eft corner of th │ │ │ +0007b5d0: 6520 696d 6167 652e 0a20 203c 2f6c 693e e image..
    • │ │ │ +0007b5e0: 0a3c 2f75 6c3e 0a0a 5468 6520 7472 616e .
    ..The tran │ │ │ +0007b5f0: 7366 6f72 6d61 7469 6f6e 2063 6861 696e sformation chain │ │ │ +0007b600: 2069 733a 2057 6f72 6c64 2063 6f6f 7264 is: World coord │ │ │ +0007b610: 696e 6174 6573 20e2 8692 2043 616d 6572 inates ... Camer │ │ │ +0007b620: 6120 636f 6f72 6469 6e61 7465 7320 2876 a coordinates (v │ │ │ +0007b630: 6961 2072 7665 632f 7476 6563 2920 e286 ia rvec/tvec) .. │ │ │ +0007b640: 9220 4e6f 726d 616c 697a 6564 2063 616d . Normalized cam │ │ │ +0007b650: 6572 6120 636f 6f72 6469 6e61 7465 730a era coordinates. │ │ │ +0007b660: e286 9220 4469 7374 6f72 7469 6f6e 2061 ... Distortion a │ │ │ +0007b670: 7070 6c69 6564 20e2 8692 2050 6978 656c pplied ... Pixel │ │ │ +0007b680: 2063 6f6f 7264 696e 6174 6573 2028 7669 coordinates (vi │ │ │ +0007b690: 6120 6361 6d65 7261 4d61 7472 6978 292e a cameraMatrix). │ │ │ +0007b6a0: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ +0007b6c0: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ +0007b6d0: 6464 3e3c 636f 6465 3e6f 626a 6563 7450 dd>objectP │ │ │ +0007b6e0: 6f69 6e74 733c 2f63 6f64 653e 202d 2041 oints - A │ │ │ +0007b6f0: 7272 6179 206f 6620 6f62 6a65 6374 2070 rray of object p │ │ │ +0007b700: 6f69 6e74 7320 6578 7072 6573 7365 6420 oints expressed │ │ │ +0007b710: 7772 742e 2074 6865 2077 6f72 6c64 2063 wrt. the world c │ │ │ +0007b720: 6f6f 7264 696e 6174 6520 6672 616d 652e oordinate frame. │ │ │ +0007b730: 2041 2033 784e 2f4e 7833 0a31 2d63 6861 A 3xN/Nx3.1-cha │ │ │ +0007b740: 6e6e 656c 206f 7220 3178 4e2f 4e78 3120 nnel or 1xN/Nx1 │ │ │ +0007b750: 332d 6368 616e 6e65 6c20 286f 7220 7665 3-channel (or ve │ │ │ +0007b760: 6374 6f72 266c 743b 506f 696e 7433 6626 ctor<Point3f& │ │ │ +0007b770: 6774 3b20 292c 2077 6865 7265 204e 2069 gt; ), where N i │ │ │ +0007b780: 7320 7468 6520 6e75 6d62 6572 206f 6620 s the number of │ │ │ +0007b790: 706f 696e 7473 2069 6e20 7468 6520 7669 points in the vi │ │ │ +0007b7a0: 6577 2e3c 2f64 643e 0a3c 6464 3e3c 636f ew..
    rvec - │ │ │ +0007b7c0: 2054 6865 2072 6f74 6174 696f 6e20 7665 The rotation ve │ │ │ +0007b7d0: 6374 6f72 2028 5245 463a 2052 6f64 7269 ctor (REF: Rodri │ │ │ +0007b7e0: 6775 6573 2920 7468 6174 2c20 746f 6765 gues) that, toge │ │ │ +0007b7f0: 7468 6572 2077 6974 6820 7476 6563 2c20 ther with tvec, │ │ │ +0007b800: 7065 7266 6f72 6d73 2061 2063 6861 6e67 performs a chang │ │ │ +0007b810: 6520 6f66 0a62 6173 6973 2066 726f 6d20 e of.basis from │ │ │ +0007b820: 776f 726c 6420 746f 2063 616d 6572 6120 world to camera │ │ │ +0007b830: 636f 6f72 6469 6e61 7465 2073 7973 7465 coordinate syste │ │ │ +0007b840: 6d2c 2073 6565 2052 4546 3a20 6361 6c69 m, see REF: cali │ │ │ +0007b850: 6272 6174 6543 616d 6572 6120 666f 7220 brateCamera for │ │ │ +0007b860: 6465 7461 696c 732e 3c2f 6464 3e0a 3c64 details.
    .tvec - The transl │ │ │ +0007b890: 6174 696f 6e20 7665 6374 6f72 2c20 7365 ation vector, se │ │ │ +0007b8a0: 6520 7061 7261 6d65 7465 7220 6465 7363 e parameter desc │ │ │ +0007b8b0: 7269 7074 696f 6e20 6162 6f76 652e 3c2f ription above..
    ca │ │ │ +0007b8d0: 6d65 7261 4d61 7472 6978 3c2f 636f 6465 meraMatrix - Camera intri │ │ │ +0007b8f0: 6e73 6963 206d 6174 7269 7820 5c28 5c63 nsic matrix \(\c │ │ │ +0007b900: 616d 6572 616d 6174 7269 787b 417d 5c29 ameramatrix{A}\) │ │ │ +0007b910: 202e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 .
    .
    distCoeffs - Input vect │ │ │ +0007b940: 6f72 206f 6620 6469 7374 6f72 7469 6f6e or of distortion │ │ │ +0007b950: 2063 6f65 6666 6963 6965 6e74 730a 5c28 coefficients.\( │ │ │ +0007b960: 5c64 6973 7463 6f65 6666 735c 2920 2e20 \distcoeffs\) . │ │ │ +0007b970: 4966 2074 6865 2076 6563 746f 7220 6973 If the vector is │ │ │ +0007b980: 2065 6d70 7479 2c20 7468 6520 7a65 726f empty, the zero │ │ │ +0007b990: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ +0007b9a0: 6669 6369 656e 7473 2061 7265 2061 7373 ficients are ass │ │ │ +0007b9b0: 756d 6564 2e3c 2f64 643e 0a3c 6464 3e3c umed.
    .
    < │ │ │ +0007b9c0: 636f 6465 3e69 6d61 6765 506f 696e 7473 code>imagePoints │ │ │ +0007b9d0: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +0007b9e0: 2061 7272 6179 206f 6620 696d 6167 6520 array of image │ │ │ +0007b9f0: 706f 696e 7473 2069 6e20 3c62 3e70 6978 points in pix │ │ │ +0007ba00: 656c 2063 6f6f 7264 696e 6174 6573 3c2f el coordinates, 1xN/Nx1 2-ch │ │ │ +0007ba20: 616e 6e65 6c2c 206f 720a 7665 6374 6f72 annel, or.vector │ │ │ +0007ba30: 266c 743b 506f 696e 7432 6626 6774 3b20 <Point2f> │ │ │ +0007ba40: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    jacobian │ │ │ +0007ba60: 202d 204f 7074 696f 6e61 6c20 6f75 7470 - Optional outp │ │ │ +0007ba70: 7574 2032 4e78 2831 302b 266c 743b 6e75 ut 2Nx(10+<nu │ │ │ +0007ba80: 6d44 6973 7443 6f65 6666 7326 6774 3b29 mDistCoeffs>) │ │ │ +0007ba90: 206a 6163 6f62 6961 6e20 6d61 7472 6978 jacobian matrix │ │ │ +0007baa0: 206f 6620 6465 7269 7661 7469 7665 7320 of derivatives │ │ │ +0007bab0: 6f66 2069 6d61 6765 0a70 6f69 6e74 7320 of image.points │ │ │ +0007bac0: 7769 7468 2072 6573 7065 6374 2074 6f20 with respect to │ │ │ +0007bad0: 636f 6d70 6f6e 656e 7473 206f 6620 7468 components of th │ │ │ +0007bae0: 6520 726f 7461 7469 6f6e 2076 6563 746f e rotation vecto │ │ │ +0007baf0: 722c 2074 7261 6e73 6c61 7469 6f6e 2076 r, translation v │ │ │ +0007bb00: 6563 746f 722c 2066 6f63 616c 206c 656e ector, focal len │ │ │ +0007bb10: 6774 6873 2c0a 636f 6f72 6469 6e61 7465 gths,.coordinate │ │ │ +0007bb20: 7320 6f66 2074 6865 2070 7269 6e63 6970 s of the princip │ │ │ +0007bb30: 616c 2070 6f69 6e74 2061 6e64 2074 6865 al point and the │ │ │ +0007bb40: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ +0007bb50: 6669 6369 656e 7473 2e20 496e 2074 6865 ficients. In the │ │ │ +0007bb60: 206f 6c64 2069 6e74 6572 6661 6365 2064 old interface d │ │ │ +0007bb70: 6966 6665 7265 6e74 0a63 6f6d 706f 6e65 ifferent.compone │ │ │ +0007bb80: 6e74 7320 6f66 2074 6865 206a 6163 6f62 nts of the jacob │ │ │ +0007bb90: 6961 6e20 6172 6520 7265 7475 726e 6564 ian are returned │ │ │ +0007bba0: 2076 6961 2064 6966 6665 7265 6e74 206f via different o │ │ │ +0007bbb0: 7574 7075 7420 7061 7261 6d65 7465 7273 utput parameters │ │ │ +0007bbc0: 2e0a 6675 6e63 7469 6f6e 2061 7373 756d ..function assum │ │ │ +0007bbd0: 6573 2074 6861 7420 7468 6520 6173 7065 es that the aspe │ │ │ +0007bbe0: 6374 2072 6174 696f 2028 5c28 665f 7820 ct ratio (\(f_x │ │ │ +0007bbf0: 2f20 665f 795c 2929 2069 7320 6669 7865 / f_y\)) is fixe │ │ │ +0007bc00: 6420 616e 6420 636f 7272 6573 706f 6e64 d and correspond │ │ │ +0007bc10: 696e 676c 7920 6164 6a75 7374 7320 7468 ingly adjusts th │ │ │ +0007bc20: 650a 6a61 636f 6269 616e 206d 6174 7269 e.jacobian matri │ │ │ +0007bc30: 782e 0a0a 3c62 3e4e 6f74 653a 3c2f 623e x...Note: │ │ │ +0007bc40: 2042 7920 7365 7474 696e 6720 7276 6563 By setting rvec │ │ │ +0007bc50: 203d 2074 7665 6320 3d20 5c28 5b30 2c20 = tvec = \([0, │ │ │ +0007bc60: 302c 2030 5d5c 292c 206f 7220 6279 2073 0, 0]\), or by s │ │ │ +0007bc70: 6574 7469 6e67 2063 616d 6572 614d 6174 etting cameraMat │ │ │ +0007bc80: 7269 7820 746f 2061 2033 7833 2069 6465 rix to a 3x3 ide │ │ │ +0007bc90: 6e74 6974 7920 6d61 7472 6978 2c0a 6f72 ntity matrix,.or │ │ │ +0007bca0: 2062 7920 7061 7373 696e 6720 7a65 726f by passing zero │ │ │ +0007bcb0: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ +0007bcc0: 6669 6369 656e 7473 2c20 6f6e 6520 6361 ficients, one ca │ │ │ +0007bcd0: 6e20 6765 7420 7661 7269 6f75 7320 7573 n get various us │ │ │ +0007bce0: 6566 756c 2070 6172 7469 616c 2063 6173 eful partial cas │ │ │ +0007bcf0: 6573 206f 6620 7468 650a 6675 6e63 7469 es of the.functi │ │ │ +0007bd00: 6f6e 2e20 5468 6973 206d 6561 6e73 2c20 on. This means, │ │ │ +0007bd10: 6f6e 6520 6361 6e20 636f 6d70 7574 6520 one can compute │ │ │ +0007bd20: 7468 6520 6469 7374 6f72 7465 6420 636f the distorted co │ │ │ +0007bd30: 6f72 6469 6e61 7465 7320 666f 7220 6120 ordinates for a │ │ │ +0007bd40: 7370 6172 7365 2073 6574 206f 6620 706f sparse set of po │ │ │ +0007bd50: 696e 7473 206f 7220 6170 706c 790a 6120 ints or apply.a │ │ │ +0007bd60: 7065 7273 7065 6374 6976 6520 7472 616e perspective tran │ │ │ +0007bd70: 7366 6f72 6d61 7469 6f6e 2028 616e 6420 sformation (and │ │ │ +0007bd80: 616c 736f 2063 6f6d 7075 7465 2074 6865 also compute the │ │ │ +0007bd90: 2064 6572 6976 6174 6976 6573 2920 696e derivatives) in │ │ │ +0007bda0: 2074 6865 2069 6465 616c 207a 6572 6f2d the ideal zero- │ │ │ +0007bdb0: 6469 7374 6f72 7469 6f6e 2073 6574 7570 distortion setup │ │ │ +0007bdc0: 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 .
    .
    ..
    .< │ │ │ +0007bde0: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    pro │ │ │ +0007beb0: 6a65 6374 506f 696e 7473 3c2f 6833 3e0a jectPoints

    . │ │ │ +0007bec0: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ +0007bee0: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ +0007bf20: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ +0007bf30: 3c73 7061 6e20 636c 6173 733d 2272 6574 void projectPoi │ │ │ +0007bf80: 6e74 733c 2f73 7061 6e3e 3c77 6272 3e3c nts< │ │ │ +0007bf90: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +0007bfa0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Ma │ │ │ +0007bff0: 744f 6650 6f69 6e74 3366 3c2f 613e 266e tOfPoint3f&n │ │ │ +0007c000: 6273 703b 6f62 6a65 6374 506f 696e 7473 bsp;objectPoints │ │ │ +0007c010: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +0007c050: 6174 3c2f 613e 266e 6273 703b 7276 6563 at rvec │ │ │ +0007c060: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +0007c0a0: 6174 3c2f 613e 266e 6273 703b 7476 6563 at tvec │ │ │ +0007c0b0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +0007c0f0: 6174 3c2f 613e 266e 6273 703b 6361 6d65 at came │ │ │ +0007c100: 7261 4d61 7472 6978 2c0a 203c 6120 6872 raMatrix,. M │ │ │ +0007c150: 6174 4f66 446f 7562 6c65 3c2f 613e 266e atOfDouble&n │ │ │ +0007c160: 6273 703b 6469 7374 436f 6566 6673 2c0a bsp;distCoeffs,. │ │ │ +0007c170: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 MatOfPoint │ │ │ +0007c1c0: 3266 3c2f 613e 266e 6273 703b 696d 6167 2f imag │ │ │ +0007c1d0: 6550 6f69 6e74 7329 3c2f 7370 616e 3e3c ePoints)< │ │ │ +0007c1e0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Project │ │ │ +0007c200: 7320 3344 2070 6f69 6e74 7320 746f 2061 s 3D points to a │ │ │ +0007c210: 6e20 696d 6167 6520 706c 616e 652e 0a0a n image plane... │ │ │ +0007c220: 5468 6520 6675 6e63 7469 6f6e 2063 6f6d The function com │ │ │ +0007c230: 7075 7465 7320 7468 6520 3244 2070 726f putes the 2D pro │ │ │ +0007c240: 6a65 6374 696f 6e73 206f 6620 3344 2070 jections of 3D p │ │ │ +0007c250: 6f69 6e74 7320 746f 2074 6865 2069 6d61 oints to the ima │ │ │ +0007c260: 6765 2070 6c61 6e65 2c20 6769 7665 6e20 ge plane, given │ │ │ +0007c270: 696e 7472 696e 7369 6320 616e 640a 6578 intrinsic and.ex │ │ │ +0007c280: 7472 696e 7369 6320 6361 6d65 7261 2070 trinsic camera p │ │ │ +0007c290: 6172 616d 6574 6572 732e 204f 7074 696f arameters. Optio │ │ │ +0007c2a0: 6e61 6c6c 792c 2074 6865 2066 756e 6374 nally, the funct │ │ │ +0007c2b0: 696f 6e20 636f 6d70 7574 6573 204a 6163 ion computes Jac │ │ │ +0007c2c0: 6f62 6961 6e73 202d 6d61 7472 6963 6573 obians -matrices │ │ │ +0007c2d0: 206f 6620 7061 7274 6961 6c0a 6465 7269 of partial.deri │ │ │ +0007c2e0: 7661 7469 7665 7320 6f66 2069 6d61 6765 vatives of image │ │ │ +0007c2f0: 2070 6f69 6e74 7320 636f 6f72 6469 6e61 points coordina │ │ │ +0007c300: 7465 7320 2861 7320 6675 6e63 7469 6f6e tes (as function │ │ │ +0007c310: 7320 6f66 2061 6c6c 2074 6865 2069 6e70 s of all the inp │ │ │ +0007c320: 7574 2070 6172 616d 6574 6572 7329 2077 ut parameters) w │ │ │ +0007c330: 6974 6820 7265 7370 6563 7420 746f 0a74 ith respect to.t │ │ │ +0007c340: 6865 2070 6172 7469 6375 6c61 7220 7061 he particular pa │ │ │ +0007c350: 7261 6d65 7465 7273 2c20 696e 7472 696e rameters, intrin │ │ │ +0007c360: 7369 6320 616e 642f 6f72 2065 7874 7269 sic and/or extri │ │ │ +0007c370: 6e73 6963 2e20 5468 6520 4a61 636f 6269 nsic. The Jacobi │ │ │ +0007c380: 616e 7320 6172 6520 7573 6564 2064 7572 ans are used dur │ │ │ +0007c390: 696e 6720 7468 6520 676c 6f62 616c 0a6f ing the global.o │ │ │ +0007c3a0: 7074 696d 697a 6174 696f 6e20 696e 2052 ptimization in R │ │ │ +0007c3b0: 4546 3a20 6361 6c69 6272 6174 6543 616d EF: calibrateCam │ │ │ +0007c3c0: 6572 612c 2052 4546 3a20 736f 6c76 6550 era, REF: solveP │ │ │ +0007c3d0: 6e50 2c20 616e 6420 5245 463a 2073 7465 nP, and REF: ste │ │ │ +0007c3e0: 7265 6f43 616c 6962 7261 7465 2e20 5468 reoCalibrate. Th │ │ │ +0007c3f0: 6520 6675 6e63 7469 6f6e 2069 7473 656c e function itsel │ │ │ +0007c400: 660a 6361 6e20 616c 736f 2062 6520 7573 f.can also be us │ │ │ +0007c410: 6564 2074 6f20 636f 6d70 7574 6520 6120 ed to compute a │ │ │ +0007c420: 7265 2d70 726f 6a65 6374 696f 6e20 6572 re-projection er │ │ │ +0007c430: 726f 722c 2067 6976 656e 2074 6865 2063 ror, given the c │ │ │ +0007c440: 7572 7265 6e74 2069 6e74 7269 6e73 6963 urrent intrinsic │ │ │ +0007c450: 2061 6e64 2065 7874 7269 6e73 6963 0a70 and extrinsic.p │ │ │ +0007c460: 6172 616d 6574 6572 732e 0a0a 3c62 3e4e arameters...N │ │ │ +0007c470: 6f74 653a 3c2f 623e 203c 623e 436f 6f72 ote: Coor │ │ │ +0007c480: 6469 6e61 7465 2053 7973 7465 6d73 3a3c dinate Systems:< │ │ │ +0007c490: 2f62 3e0a 3c75 6c3e 0a20 203c 6c69 3e0a /b>.
      .
    • . │ │ │ +0007c4a0: 203c 623e 496e 7075 7420 283c 636f 6465 Input (objectPoints): 3D po │ │ │ +0007c4d0: 696e 7473 2069 6e20 7468 6520 3c62 3e77 ints in the w │ │ │ +0007c4e0: 6f72 6c64 2063 6f6f 7264 696e 6174 6520 orld coordinate │ │ │ +0007c4f0: 6672 616d 653c 2f62 3e2e 0a20 203c 2f6c frame.. .
    • . Ou │ │ │ +0007c510: 7470 7574 2028 3c63 6f64 653e 696d 6167 tput (imag │ │ │ +0007c520: 6550 6f69 6e74 733c 2f63 6f64 653e 293c ePoints)< │ │ │ +0007c530: 2f62 3e3a 2032 4420 7072 6f6a 6563 7469 /b>: 2D projecti │ │ │ +0007c540: 6f6e 7320 696e 203c 623e 7069 7865 6c20 ons in pixel │ │ │ +0007c550: 636f 6f72 6469 6e61 7465 733c 2f62 3e20 coordinates │ │ │ +0007c560: 6f66 2074 6865 2069 6d61 6765 2070 6c61 of the image pla │ │ │ +0007c570: 6e65 2c20 7769 7468 2064 6973 746f 7274 ne, with distort │ │ │ +0007c580: 696f 6e20 6170 706c 6965 642e 0a20 2054 ion applied.. T │ │ │ +0007c590: 6865 2063 6f6f 7264 696e 6174 6573 205c he coordinates \ │ │ │ +0007c5a0: 2828 752c 2076 295c 2920 6172 6520 6d65 ((u, v)\) are me │ │ │ +0007c5b0: 6173 7572 6564 2069 6e20 7069 7865 6c73 asured in pixels │ │ │ +0007c5c0: 2066 726f 6d20 7468 6520 746f 702d 6c65 from the top-le │ │ │ +0007c5d0: 6674 2063 6f72 6e65 7220 6f66 2074 6865 ft corner of the │ │ │ +0007c5e0: 2069 6d61 6765 2e0a 2020 3c2f 6c69 3e0a image..
    • . │ │ │ +0007c5f0: 3c2f 756c 3e0a 0a54 6865 2074 7261 6e73
    ..The trans │ │ │ +0007c600: 666f 726d 6174 696f 6e20 6368 6169 6e20 formation chain │ │ │ +0007c610: 6973 3a20 576f 726c 6420 636f 6f72 6469 is: World coordi │ │ │ +0007c620: 6e61 7465 7320 e286 9220 4361 6d65 7261 nates ... Camera │ │ │ +0007c630: 2063 6f6f 7264 696e 6174 6573 2028 7669 coordinates (vi │ │ │ +0007c640: 6120 7276 6563 2f74 7665 6329 20e2 8692 a rvec/tvec) ... │ │ │ +0007c650: 204e 6f72 6d61 6c69 7a65 6420 6361 6d65 Normalized came │ │ │ +0007c660: 7261 2063 6f6f 7264 696e 6174 6573 0ae2 ra coordinates.. │ │ │ +0007c670: 8692 2044 6973 746f 7274 696f 6e20 6170 .. Distortion ap │ │ │ +0007c680: 706c 6965 6420 e286 9220 5069 7865 6c20 plied ... Pixel │ │ │ +0007c690: 636f 6f72 6469 6e61 7465 7320 2876 6961 coordinates (via │ │ │ +0007c6a0: 2063 616d 6572 614d 6174 7269 7829 2e3c cameraMatrix).< │ │ │ +0007c6b0: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ +0007c6d0: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .objectPo │ │ │ +0007c6f0: 696e 7473 3c2f 636f 6465 3e20 2d20 4172 ints - Ar │ │ │ +0007c700: 7261 7920 6f66 206f 626a 6563 7420 706f ray of object po │ │ │ +0007c710: 696e 7473 2065 7870 7265 7373 6564 2077 ints expressed w │ │ │ +0007c720: 7274 2e20 7468 6520 776f 726c 6420 636f rt. the world co │ │ │ +0007c730: 6f72 6469 6e61 7465 2066 7261 6d65 2e20 ordinate frame. │ │ │ +0007c740: 4120 3378 4e2f 4e78 330a 312d 6368 616e A 3xN/Nx3.1-chan │ │ │ +0007c750: 6e65 6c20 6f72 2031 784e 2f4e 7831 2033 nel or 1xN/Nx1 3 │ │ │ +0007c760: 2d63 6861 6e6e 656c 2028 6f72 2076 6563 -channel (or vec │ │ │ +0007c770: 746f 7226 6c74 3b50 6f69 6e74 3366 2667 tor<Point3f&g │ │ │ +0007c780: 743b 2029 2c20 7768 6572 6520 4e20 6973 t; ), where N is │ │ │ +0007c790: 2074 6865 206e 756d 6265 7220 6f66 2070 the number of p │ │ │ +0007c7a0: 6f69 6e74 7320 696e 2074 6865 2076 6965 oints in the vie │ │ │ +0007c7b0: 772e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 w..
    rvec - │ │ │ +0007c7d0: 5468 6520 726f 7461 7469 6f6e 2076 6563 The rotation vec │ │ │ +0007c7e0: 746f 7220 2852 4546 3a20 526f 6472 6967 tor (REF: Rodrig │ │ │ +0007c7f0: 7565 7329 2074 6861 742c 2074 6f67 6574 ues) that, toget │ │ │ +0007c800: 6865 7220 7769 7468 2074 7665 632c 2070 her with tvec, p │ │ │ +0007c810: 6572 666f 726d 7320 6120 6368 616e 6765 erforms a change │ │ │ +0007c820: 206f 660a 6261 7369 7320 6672 6f6d 2077 of.basis from w │ │ │ +0007c830: 6f72 6c64 2074 6f20 6361 6d65 7261 2063 orld to camera c │ │ │ +0007c840: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ +0007c850: 2c20 7365 6520 5245 463a 2063 616c 6962 , see REF: calib │ │ │ +0007c860: 7261 7465 4361 6d65 7261 2066 6f72 2064 rateCamera for d │ │ │ +0007c870: 6574 6169 6c73 2e3c 2f64 643e 0a3c 6464 etails.
    .
    tvec - The transla │ │ │ +0007c8a0: 7469 6f6e 2076 6563 746f 722c 2073 6565 tion vector, see │ │ │ +0007c8b0: 2070 6172 616d 6574 6572 2064 6573 6372 parameter descr │ │ │ +0007c8c0: 6970 7469 6f6e 2061 626f 7665 2e3c 2f64 iption above..
    cam │ │ │ +0007c8e0: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ +0007c8f0: 202d 2043 616d 6572 6120 696e 7472 696e - Camera intrin │ │ │ +0007c900: 7369 6320 6d61 7472 6978 205c 285c 6361 sic matrix \(\ca │ │ │ +0007c910: 6d65 7261 6d61 7472 6978 7b41 7d5c 2920 meramatrix{A}\) │ │ │ +0007c920: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    distCoeffs - Input vecto │ │ │ +0007c950: 7220 6f66 2064 6973 746f 7274 696f 6e20 r of distortion │ │ │ +0007c960: 636f 6566 6669 6369 656e 7473 0a5c 285c coefficients.\(\ │ │ │ +0007c970: 6469 7374 636f 6566 6673 5c29 202e 2049 distcoeffs\) . I │ │ │ +0007c980: 6620 7468 6520 7665 6374 6f72 2069 7320 f the vector is │ │ │ +0007c990: 656d 7074 792c 2074 6865 207a 6572 6f20 empty, the zero │ │ │ +0007c9a0: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ +0007c9b0: 6963 6965 6e74 7320 6172 6520 6173 7375 icients are assu │ │ │ +0007c9c0: 6d65 642e 3c2f 6464 3e0a 3c64 643e 3c63 med.
    .
    imagePoints< │ │ │ +0007c9e0: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ +0007c9f0: 6172 7261 7920 6f66 2069 6d61 6765 2070 array of image p │ │ │ +0007ca00: 6f69 6e74 7320 696e 203c 623e 7069 7865 oints in pixe │ │ │ +0007ca10: 6c20 636f 6f72 6469 6e61 7465 733c 2f62 l coordinates, 1xN/Nx1 2-cha │ │ │ +0007ca30: 6e6e 656c 2c20 6f72 0a76 6563 746f 7226 nnel, or.vector& │ │ │ +0007ca40: 6c74 3b50 6f69 6e74 3266 2667 743b 202e lt;Point2f> . │ │ │ +0007ca50: 0a70 6f69 6e74 7320 7769 7468 2072 6573 .points with res │ │ │ +0007ca60: 7065 6374 2074 6f20 636f 6d70 6f6e 656e pect to componen │ │ │ +0007ca70: 7473 206f 6620 7468 6520 726f 7461 7469 ts of the rotati │ │ │ +0007ca80: 6f6e 2076 6563 746f 722c 2074 7261 6e73 on vector, trans │ │ │ +0007ca90: 6c61 7469 6f6e 2076 6563 746f 722c 2066 lation vector, f │ │ │ +0007caa0: 6f63 616c 206c 656e 6774 6873 2c0a 636f ocal lengths,.co │ │ │ +0007cab0: 6f72 6469 6e61 7465 7320 6f66 2074 6865 ordinates of the │ │ │ +0007cac0: 2070 7269 6e63 6970 616c 2070 6f69 6e74 principal point │ │ │ +0007cad0: 2061 6e64 2074 6865 2064 6973 746f 7274 and the distort │ │ │ +0007cae0: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ +0007caf0: 2e20 496e 2074 6865 206f 6c64 2069 6e74 . In the old int │ │ │ +0007cb00: 6572 6661 6365 2064 6966 6665 7265 6e74 erface different │ │ │ +0007cb10: 0a63 6f6d 706f 6e65 6e74 7320 6f66 2074 .components of t │ │ │ +0007cb20: 6865 206a 6163 6f62 6961 6e20 6172 6520 he jacobian are │ │ │ +0007cb30: 7265 7475 726e 6564 2076 6961 2064 6966 returned via dif │ │ │ +0007cb40: 6665 7265 6e74 206f 7574 7075 7420 7061 ferent output pa │ │ │ +0007cb50: 7261 6d65 7465 7273 2e0a 6675 6e63 7469 rameters..functi │ │ │ +0007cb60: 6f6e 2061 7373 756d 6573 2074 6861 7420 on assumes that │ │ │ +0007cb70: 7468 6520 6173 7065 6374 2072 6174 696f the aspect ratio │ │ │ +0007cb80: 2028 5c28 665f 7820 2f20 665f 795c 2929 (\(f_x / f_y\)) │ │ │ +0007cb90: 2069 7320 6669 7865 6420 616e 6420 636f is fixed and co │ │ │ +0007cba0: 7272 6573 706f 6e64 696e 676c 7920 6164 rrespondingly ad │ │ │ +0007cbb0: 6a75 7374 7320 7468 650a 6a61 636f 6269 justs the.jacobi │ │ │ +0007cbc0: 616e 206d 6174 7269 782e 0a0a 3c62 3e4e an matrix...N │ │ │ +0007cbd0: 6f74 653a 3c2f 623e 2042 7920 7365 7474 ote: By sett │ │ │ +0007cbe0: 696e 6720 7276 6563 203d 2074 7665 6320 ing rvec = tvec │ │ │ +0007cbf0: 3d20 5c28 5b30 2c20 302c 2030 5d5c 292c = \([0, 0, 0]\), │ │ │ +0007cc00: 206f 7220 6279 2073 6574 7469 6e67 2063 or by setting c │ │ │ +0007cc10: 616d 6572 614d 6174 7269 7820 746f 2061 ameraMatrix to a │ │ │ +0007cc20: 2033 7833 2069 6465 6e74 6974 7920 6d61 3x3 identity ma │ │ │ +0007cc30: 7472 6978 2c0a 6f72 2062 7920 7061 7373 trix,.or by pass │ │ │ +0007cc40: 696e 6720 7a65 726f 2064 6973 746f 7274 ing zero distort │ │ │ +0007cc50: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ +0007cc60: 2c20 6f6e 6520 6361 6e20 6765 7420 7661 , one can get va │ │ │ +0007cc70: 7269 6f75 7320 7573 6566 756c 2070 6172 rious useful par │ │ │ +0007cc80: 7469 616c 2063 6173 6573 206f 6620 7468 tial cases of th │ │ │ +0007cc90: 650a 6675 6e63 7469 6f6e 2e20 5468 6973 e.function. This │ │ │ +0007cca0: 206d 6561 6e73 2c20 6f6e 6520 6361 6e20 means, one can │ │ │ +0007ccb0: 636f 6d70 7574 6520 7468 6520 6469 7374 compute the dist │ │ │ +0007ccc0: 6f72 7465 6420 636f 6f72 6469 6e61 7465 orted coordinate │ │ │ +0007ccd0: 7320 666f 7220 6120 7370 6172 7365 2073 s for a sparse s │ │ │ +0007cce0: 6574 206f 6620 706f 696e 7473 206f 7220 et of points or │ │ │ +0007ccf0: 6170 706c 790a 6120 7065 7273 7065 6374 apply.a perspect │ │ │ +0007cd00: 6976 6520 7472 616e 7366 6f72 6d61 7469 ive transformati │ │ │ +0007cd10: 6f6e 2028 616e 6420 616c 736f 2063 6f6d on (and also com │ │ │ +0007cd20: 7075 7465 2074 6865 2064 6572 6976 6174 pute the derivat │ │ │ +0007cd30: 6976 6573 2920 696e 2074 6865 2069 6465 ives) in the ide │ │ │ +0007cd40: 616c 207a 6572 6f2d 6469 7374 6f72 7469 al zero-distorti │ │ │ +0007cd50: 6f6e 2073 6574 7570 2e3c 2f64 643e 0a3c on setup.
    .< │ │ │ +0007cd60: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ..
  • .
  • .
    .

    pr │ │ │ +0007ceb0: 6f6a 6563 7450 6f69 6e74 7353 6570 4a3c ojectPointsSepJ< │ │ │ +0007cec0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +0007cf20: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +0007cf30: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;v │ │ │ +0007cf50: 6f69 643c 2f73 7061 6e3e 266e 6273 703b oid  │ │ │ +0007cf60: 3c73 7061 6e20 636c 6173 733d 2265 6c65 proje │ │ │ +0007cf80: 6374 506f 696e 7473 5365 704a 3c2f 7370 ctPointsSepJ(Ma │ │ │ +0007cff0: 743c 2f61 3e26 6e62 7370 3b6f 626a 6563 t objec │ │ │ +0007d000: 7450 6f69 6e74 732c 0a20 3c61 2068 7265 tPoints,. Mat&nb │ │ │ +0007d050: 7370 3b72 7665 632c 0a20 3c61 2068 7265 sp;rvec,. Mat&nb │ │ │ +0007d0a0: 7370 3b74 7665 632c 0a20 3c61 2068 7265 sp;tvec,. Mat&nb │ │ │ +0007d0f0: 7370 3b63 616d 6572 614d 6174 7269 782c sp;cameraMatrix, │ │ │ +0007d100: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +0007d140: 743c 2f61 3e26 6e62 7370 3b64 6973 7443 t distC │ │ │ +0007d150: 6f65 6666 732c 0a20 3c61 2068 7265 663d oeffs,. Mat  │ │ │ +0007d1a0: 3b69 6d61 6765 506f 696e 7473 2c0a 203c ;imagePoints,. < │ │ │ +0007d1b0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0007d1c0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0007d1d0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0007d1e0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dpdr,. < │ │ │ +0007d200: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0007d210: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0007d220: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0007d230: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dpdt,. < │ │ │ +0007d250: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0007d260: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0007d270: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0007d280: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dpdf,. < │ │ │ +0007d2a0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0007d2b0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0007d2c0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0007d2d0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dpdc,. < │ │ │ +0007d2f0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0007d300: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0007d310: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0007d320: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dpdk,. < │ │ │ +0007d340: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0007d350: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0007d360: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0007d370: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dpdo,. d │ │ │ +0007d390: 6f75 626c 6526 6e62 7370 3b61 7370 6563 ouble aspec │ │ │ +0007d3a0: 7452 6174 696f 293c 2f73 7061 6e3e 3c2f tRatio).
    ..

  • .
  • .
    .

    projectPo │ │ │ +0007d500: 696e 7473 5365 704a 3c2f 6833 3e0a 3c64 intsSepJ

    ..public stati │ │ │ +0007d570: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void projectPoint │ │ │ +0007d5d0: 7353 6570 4a3c 2f73 7061 6e3e 3c77 6272 sSepJ(Mat&n │ │ │ +0007d640: 6273 703b 6f62 6a65 6374 506f 696e 7473 bsp;objectPoints │ │ │ +0007d650: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +0007d690: 6174 3c2f 613e 266e 6273 703b 7276 6563 at rvec │ │ │ +0007d6a0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +0007d6e0: 6174 3c2f 613e 266e 6273 703b 7476 6563 at tvec │ │ │ +0007d6f0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +0007d730: 6174 3c2f 613e 266e 6273 703b 6361 6d65 at came │ │ │ +0007d740: 7261 4d61 7472 6978 2c0a 203c 6120 6872 raMatrix,. Mat&n │ │ │ +0007d790: 6273 703b 6469 7374 436f 6566 6673 2c0a bsp;distCoeffs,. │ │ │ +0007d7a0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +0007d7e0: 3c2f 613e 266e 6273 703b 696d 6167 6550  imageP │ │ │ +0007d7f0: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ +0007d840: 3b64 7064 722c 0a20 3c61 2068 7265 663d ;dpdr,. Mat  │ │ │ +0007d890: 3b64 7064 742c 0a20 3c61 2068 7265 663d ;dpdt,. Mat  │ │ │ +0007d8e0: 3b64 7064 662c 0a20 3c61 2068 7265 663d ;dpdf,. Mat  │ │ │ +0007d930: 3b64 7064 632c 0a20 3c61 2068 7265 663d ;dpdc,. Mat  │ │ │ +0007d980: 3b64 7064 6b2c 0a20 3c61 2068 7265 663d ;dpdk,. Mat  │ │ │ +0007d9d0: 3b64 7064 6f29 3c2f 7370 616e 3e3c 2f64 ;dpdo)...
  • .
  • │ │ │ +0007da00: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .projectPointsS │ │ │ +0007db20: 6570 4a3c 2f68 333e 0a3c 6469 7620 636c epJ.
    .
    p │ │ │ +0007db80: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static void&n │ │ │ +0007dbc0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;p │ │ │ +0007dbe0: 726f 6a65 6374 506f 696e 7473 5365 704a rojectPointsSepJ │ │ │ +0007dbf0: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat o │ │ │ +0007dc60: 626a 6563 7450 6f69 6e74 732c 0a20 3c61 bjectPoints,. Mat rvec,. Mat tvec,. Mat cameraMat │ │ │ +0007dd60: 7269 782c 0a20 3c61 2068 7265 663d 222e rix,. Mat d │ │ │ +0007ddb0: 6973 7443 6f65 6666 732c 0a20 3c61 2068 istCoeffs,. Mat& │ │ │ +0007de00: 6e62 7370 3b69 6d61 6765 506f 696e 7473 nbsp;imagePoints │ │ │ +0007de10: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +0007de50: 6174 3c2f 613e 266e 6273 703b 6470 6472 at dpdr │ │ │ +0007de60: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +0007dea0: 6174 3c2f 613e 266e 6273 703b 6470 6474 at dpdt │ │ │ +0007deb0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +0007def0: 6174 3c2f 613e 266e 6273 703b 6470 6466 at dpdf │ │ │ +0007df00: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +0007df40: 6174 3c2f 613e 266e 6273 703b 6470 6463 at dpdc │ │ │ +0007df50: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +0007df90: 6174 3c2f 613e 266e 6273 703b 6470 646b at dpdk │ │ │ +0007dfa0: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ +0007dfb0: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ +0007dfc0: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    project │ │ │ +0007e0d0: 506f 696e 7473 5365 704a 3c2f 6833 3e0a PointsSepJ

    . │ │ │ +0007e0e0: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ +0007e100: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ +0007e140: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ +0007e150: 3c73 7061 6e20 636c 6173 733d 2272 6574 void projectPoi │ │ │ +0007e1a0: 6e74 7353 6570 4a3c 2f73 7061 6e3e 3c77 ntsSepJ(Mat │ │ │ +0007e210: 266e 6273 703b 6f62 6a65 6374 506f 696e  objectPoin │ │ │ +0007e220: 7473 2c0a 203c 6120 6872 6566 3d22 2e2e ts,. Mat rv │ │ │ +0007e270: 6563 2c0a 203c 6120 6872 6566 3d22 2e2e ec,. Mat tv │ │ │ +0007e2c0: 6563 2c0a 203c 6120 6872 6566 3d22 2e2e ec,. Mat ca │ │ │ +0007e310: 6d65 7261 4d61 7472 6978 2c0a 203c 6120 meraMatrix,. Mat │ │ │ +0007e360: 266e 6273 703b 6469 7374 436f 6566 6673  distCoeffs │ │ │ +0007e370: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +0007e3b0: 6174 3c2f 613e 266e 6273 703b 696d 6167 at imag │ │ │ +0007e3c0: 6550 6f69 6e74 732c 0a20 3c61 2068 7265 ePoints,. Mat&nb │ │ │ +0007e410: 7370 3b64 7064 722c 0a20 3c61 2068 7265 sp;dpdr,. Mat&nb │ │ │ +0007e460: 7370 3b64 7064 742c 0a20 3c61 2068 7265 sp;dpdt,. Mat&nb │ │ │ +0007e4b0: 7370 3b64 7064 662c 0a20 3c61 2068 7265 sp;dpdf,. Mat&nb │ │ │ +0007e500: 7370 3b64 7064 6329 3c2f 7370 616e 3e3c sp;dpdc)< │ │ │ +0007e510: 2f64 6976 3e0a 3c2f 6469 763e 0a3c 2f73 /div>.
    ..
  • ..
    .

    proj │ │ │ +0007e620: 6563 7450 6f69 6e74 7353 6570 4a3c 2f68 ectPointsSepJ.
    .
    public │ │ │ +0007e690: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +0007e6a0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;voi │ │ │ +0007e6c0: 643c 2f73 7061 6e3e 266e 6273 703b 3c73 d project │ │ │ +0007e6f0: 506f 696e 7473 5365 704a 3c2f 7370 616e PointsSepJ( │ │ │ +0007e720: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +0007e760: 2f61 3e26 6e62 7370 3b6f 626a 6563 7450 /a> objectP │ │ │ +0007e770: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ +0007e7c0: 3b72 7665 632c 0a20 3c61 2068 7265 663d ;rvec,. Mat  │ │ │ +0007e810: 3b74 7665 632c 0a20 3c61 2068 7265 663d ;tvec,. Mat  │ │ │ +0007e860: 3b63 616d 6572 614d 6174 7269 782c 0a20 ;cameraMatrix,. │ │ │ +0007e870: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +0007e8b0: 2f61 3e26 6e62 7370 3b64 6973 7443 6f65 /a> distCoe │ │ │ +0007e8c0: 6666 732c 0a20 3c61 2068 7265 663d 222e ffs,. Mat i │ │ │ +0007e910: 6d61 6765 506f 696e 7473 2c0a 203c 6120 magePoints,. Mat │ │ │ +0007e960: 266e 6273 703b 6470 6472 2c0a 203c 6120  dpdr,. Mat │ │ │ +0007e9b0: 266e 6273 703b 6470 6474 2c0a 203c 6120  dpdt,. Mat │ │ │ +0007ea00: 266e 6273 703b 6470 6466 293c 2f73 7061  dpdf)
    .
    . │ │ │ +0007ea20: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e

    . │ │ │ +0007ea30: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    proje │ │ │ +0007eb10: 6374 506f 696e 7473 5365 704a 3c2f 6833 ctPointsSepJ

    .
    .
    │ │ │ +0007eb60: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +0007eb80: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +0007eb90: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;void │ │ │ +0007ebb0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  projectP │ │ │ +0007ebe0: 6f69 6e74 7353 6570 4a3c 2f73 7061 6e3e ointsSepJ │ │ │ +0007ebf0: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ +0007ec10: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0007ec20: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0007ec30: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0007ec40: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat objectPo │ │ │ +0007ec60: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. Mat  │ │ │ +0007ecb0: 7276 6563 2c0a 203c 6120 6872 6566 3d22 rvec,. Mat  │ │ │ +0007ed00: 7476 6563 2c0a 203c 6120 6872 6566 3d22 tvec,. Mat  │ │ │ +0007ed50: 6361 6d65 7261 4d61 7472 6978 2c0a 203c cameraMatrix,. < │ │ │ +0007ed60: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0007ed70: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0007ed80: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0007ed90: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat distCoef │ │ │ +0007edb0: 6673 2c0a 203c 6120 6872 6566 3d22 2e2e fs,. Mat im │ │ │ +0007ee00: 6167 6550 6f69 6e74 732c 0a20 3c61 2068 agePoints,. Mat& │ │ │ +0007ee50: 6e62 7370 3b64 7064 722c 0a20 3c61 2068 nbsp;dpdr,. Mat& │ │ │ +0007eea0: 6e62 7370 3b64 7064 7429 3c2f 7370 616e nbsp;dpdt)
    .
    .< │ │ │ +0007eec0: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ +0007eed0: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
    .

    estim │ │ │ -000ba5b0: 6174 6541 6666 696e 6550 6172 7469 616c ateAffinePartial │ │ │ -000ba5c0: 3244 3c2f 6833 3e0a 3c64 6976 2063 6c61 2D

    .
    .
    pu │ │ │ -000ba620: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static Ma │ │ │ -000ba690: 743c 2f61 3e3c 2f73 7061 6e3e 266e 6273 t&nbs │ │ │ -000ba6a0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;est │ │ │ -000ba6c0: 696d 6174 6541 6666 696e 6550 6172 7469 imateAffineParti │ │ │ -000ba6d0: 616c 3244 3c2f 7370 616e 3e3c 7762 723e al2D │ │ │ -000ba6e0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ -000ba740: 7370 3b66 726f 6d2c 0a20 3c61 2068 7265 sp;from,. Mat&nb │ │ │ -000ba790: 7370 3b74 6f2c 0a20 3c61 2068 7265 663d sp;to,. Mat  │ │ │ -000ba7e0: 3b69 6e6c 6965 7273 293c 2f73 7061 6e3e ;inliers) │ │ │ -000ba7f0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Comput │ │ │ -000ba810: 6573 2061 6e20 6f70 7469 6d61 6c20 6c69 es an optimal li │ │ │ -000ba820: 6d69 7465 6420 6166 6669 6e65 2074 7261 mited affine tra │ │ │ -000ba830: 6e73 666f 726d 6174 696f 6e20 7769 7468 nsformation with │ │ │ -000ba840: 2034 2064 6567 7265 6573 206f 6620 6672 4 degrees of fr │ │ │ -000ba850: 6565 646f 6d20 6265 7477 6565 6e0a 7477 eedom between.tw │ │ │ -000ba860: 6f20 3244 2070 6f69 6e74 2073 6574 732e o 2D point sets. │ │ │ -000ba870: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -000ba890: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000ba8a0: 6464 3e3c 636f 6465 3e66 726f 6d3c 2f63 dd>from - First inp │ │ │ -000ba8c0: 7574 2032 4420 706f 696e 7420 7365 742e ut 2D point set. │ │ │ -000ba8d0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e .
    │ │ │ -000ba8e0: 746f 3c2f 636f 6465 3e20 2d20 5365 636f to - Seco │ │ │ -000ba8f0: 6e64 2069 6e70 7574 2032 4420 706f 696e nd input 2D poin │ │ │ -000ba900: 7420 7365 742e 3c2f 6464 3e0a 3c64 643e t set.
    .
    │ │ │ -000ba910: 3c63 6f64 653e 696e 6c69 6572 733c 2f63 inliers - Output ve │ │ │ -000ba930: 6374 6f72 2069 6e64 6963 6174 696e 6720 ctor indicating │ │ │ -000ba940: 7768 6963 6820 706f 696e 7473 2061 7265 which points are │ │ │ -000ba950: 2069 6e6c 6965 7273 2e0a 3c75 6c3e 0a20 inliers..
      . │ │ │ -000ba960: 203c 6c69 3e0a 2020 2052 4546 3a20 5241
    • . REF: RA │ │ │ -000ba970: 4e53 4143 202d 2052 414e 5341 432d 6261 NSAC - RANSAC-ba │ │ │ -000ba980: 7365 6420 726f 6275 7374 206d 6574 686f sed robust metho │ │ │ -000ba990: 640a 2020 3c2f 6c69 3e0a 2020 3c6c 693e d.
    • .
    • │ │ │ -000ba9a0: 0a20 2020 5245 463a 204c 4d45 4453 202d . REF: LMEDS - │ │ │ -000ba9b0: 204c 6561 7374 2d4d 6564 6961 6e20 726f Least-Median ro │ │ │ -000ba9c0: 6275 7374 206d 6574 686f 640a 5241 4e53 bust method.RANS │ │ │ -000ba9d0: 4143 2069 7320 7468 6520 6465 6661 756c AC is the defaul │ │ │ -000ba9e0: 7420 6d65 7468 6f64 2e0a 2020 3c2f 6c69 t method..
    • .
    .a point │ │ │ -000baa00: 6173 2061 6e20 696e 6c69 6572 2e20 4170 as an inlier. Ap │ │ │ -000baa10: 706c 6965 7320 6f6e 6c79 2074 6f20 5241 plies only to RA │ │ │ -000baa20: 4e53 4143 2e0a 6265 7477 6565 6e20 302e NSAC..between 0. │ │ │ -000baa30: 3935 2061 6e64 2030 2e39 3920 6973 2075 95 and 0.99 is u │ │ │ -000baa40: 7375 616c 6c79 2067 6f6f 6420 656e 6f75 sually good enou │ │ │ -000baa50: 6768 2e20 5661 6c75 6573 2074 6f6f 2063 gh. Values too c │ │ │ -000baa60: 6c6f 7365 2074 6f20 3120 6361 6e20 736c lose to 1 can sl │ │ │ -000baa70: 6f77 2064 6f77 6e20 7468 6520 6573 7469 ow down the esti │ │ │ -000baa80: 6d61 7469 6f6e 0a73 6967 6e69 6669 6361 mation.significa │ │ │ -000baa90: 6e74 6c79 2e20 5661 6c75 6573 206c 6f77 ntly. Values low │ │ │ -000baaa0: 6572 2074 6861 6e20 302e 382d 302e 3920 er than 0.8-0.9 │ │ │ -000baab0: 6361 6e20 7265 7375 6c74 2069 6e20 616e can result in an │ │ │ -000baac0: 2069 6e63 6f72 7265 6374 6c79 2065 7374 incorrectly est │ │ │ -000baad0: 696d 6174 6564 2074 7261 6e73 666f 726d imated transform │ │ │ -000baae0: 6174 696f 6e2e 0a50 6173 7369 6e67 2030 ation..Passing 0 │ │ │ -000baaf0: 2077 696c 6c20 6469 7361 626c 6520 7265 will disable re │ │ │ -000bab00: 6669 6e69 6e67 2c20 736f 2074 6865 206f fining, so the o │ │ │ -000bab10: 7574 7075 7420 6d61 7472 6978 2077 696c utput matrix wil │ │ │ -000bab20: 6c20 6265 206f 7574 7075 7420 6f66 2072 l be output of r │ │ │ -000bab30: 6f62 7573 7420 6d65 7468 6f64 2e3c 2f64 obust method..
    Returns:< │ │ │ -000bab50: 2f64 743e 0a3c 6464 3e4f 7574 7075 7420 /dt>.
    Output │ │ │ -000bab60: 3244 2061 6666 696e 6520 7472 616e 7366 2D affine transf │ │ │ -000bab70: 6f72 6d61 7469 6f6e 2028 3420 6465 6772 ormation (4 degr │ │ │ -000bab80: 6565 7320 6f66 2066 7265 6564 6f6d 2920 ees of freedom) │ │ │ -000bab90: 6d61 7472 6978 205c 2832 205c 7469 6d65 matrix \(2 \time │ │ │ -000baba0: 7320 335c 2920 6f72 0a65 6d70 7479 206d s 3\) or.empty m │ │ │ -000babb0: 6174 7269 7820 6966 2074 7261 6e73 666f atrix if transfo │ │ │ -000babc0: 726d 6174 696f 6e20 636f 756c 6420 6e6f rmation could no │ │ │ -000babd0: 7420 6265 2065 7374 696d 6174 6564 2e0a t be estimated.. │ │ │ -000babe0: 0a54 6865 2066 756e 6374 696f 6e20 6573 .The function es │ │ │ -000babf0: 7469 6d61 7465 7320 616e 206f 7074 696d timates an optim │ │ │ -000bac00: 616c 2032 4420 6166 6669 6e65 2074 7261 al 2D affine tra │ │ │ -000bac10: 6e73 666f 726d 6174 696f 6e20 7769 7468 nsformation with │ │ │ -000bac20: 2034 2064 6567 7265 6573 206f 6620 6672 4 degrees of fr │ │ │ -000bac30: 6565 646f 6d20 6c69 6d69 7465 6420 746f eedom limited to │ │ │ -000bac40: 0a63 6f6d 6269 6e61 7469 6f6e 7320 6f66 .combinations of │ │ │ -000bac50: 2074 7261 6e73 6c61 7469 6f6e 2c20 726f translation, ro │ │ │ -000bac60: 7461 7469 6f6e 2c20 616e 6420 756e 6966 tation, and unif │ │ │ -000bac70: 6f72 6d20 7363 616c 696e 672e 2055 7365 orm scaling. Use │ │ │ -000bac80: 7320 7468 6520 7365 6c65 6374 6564 2061 s the selected a │ │ │ -000bac90: 6c67 6f72 6974 686d 2066 6f72 2072 6f62 lgorithm for rob │ │ │ -000baca0: 7573 740a 6573 7469 6d61 7469 6f6e 2e0a ust.estimation.. │ │ │ -000bacb0: 0a54 6865 2063 6f6d 7075 7465 6420 7472 .The computed tr │ │ │ -000bacc0: 616e 7366 6f72 6d61 7469 6f6e 2069 7320 ansformation is │ │ │ -000bacd0: 7468 656e 2072 6566 696e 6564 2066 7572 then refined fur │ │ │ -000bace0: 7468 6572 2028 7573 696e 6720 6f6e 6c79 ther (using only │ │ │ -000bacf0: 2069 6e6c 6965 7273 2920 7769 7468 2074 inliers) with t │ │ │ -000bad00: 6865 0a4c 6576 656e 6265 7267 2d4d 6172 he.Levenberg-Mar │ │ │ -000bad10: 7175 6172 6474 206d 6574 686f 6420 746f quardt method to │ │ │ -000bad20: 2072 6564 7563 6520 7468 6520 7265 2d70 reduce the re-p │ │ │ -000bad30: 726f 6a65 6374 696f 6e20 6572 726f 7220 rojection error │ │ │ -000bad40: 6576 656e 206d 6f72 652e 0a0a 4573 7469 even more...Esti │ │ │ -000bad50: 6d61 7465 6420 7472 616e 7366 6f72 6d61 mated transforma │ │ │ -000bad60: 7469 6f6e 206d 6174 7269 7820 6973 3a0a tion matrix is:. │ │ │ -000bad70: 5c28 205c 6265 6769 6e7b 626d 6174 7269 \( \begin{bmatri │ │ │ -000bad80: 787d 205c 636f 7328 5c74 6865 7461 2920 x} \cos(\theta) │ │ │ -000bad90: 5c63 646f 7420 7320 2661 6d70 3b20 2d5c \cdot s & -\ │ │ │ -000bada0: 7369 6e28 5c74 6865 7461 2920 5c63 646f sin(\theta) \cdo │ │ │ -000badb0: 7420 7320 2661 6d70 3b20 745f 7820 5c5c t s & t_x \\ │ │ │ -000badc0: 0a20 2020 2020 2020 2020 2020 2020 2020 . │ │ │ -000badd0: 205c 7369 6e28 5c74 6865 7461 2920 5c63 \sin(\theta) \c │ │ │ -000bade0: 646f 7420 7320 2661 6d70 3b20 5c63 6f73 dot s & \cos │ │ │ -000badf0: 285c 7468 6574 6129 205c 6364 6f74 2073 (\theta) \cdot s │ │ │ -000bae00: 2026 616d 703b 2074 5f79 0a5c 656e 647b & t_y.\end{ │ │ │ -000bae10: 626d 6174 7269 787d 205c 290a 5768 6572 bmatrix} \).Wher │ │ │ -000bae20: 6520 5c28 205c 7468 6574 6120 5c29 2069 e \( \theta \) i │ │ │ -000bae30: 7320 7468 6520 726f 7461 7469 6f6e 2061 s the rotation a │ │ │ -000bae40: 6e67 6c65 2c20 5c28 2073 205c 2920 7468 ngle, \( s \) th │ │ │ -000bae50: 6520 7363 616c 696e 6720 6661 6374 6f72 e scaling factor │ │ │ -000bae60: 2061 6e64 205c 2820 745f 782c 2074 5f79 and \( t_x, t_y │ │ │ -000bae70: 205c 2920 6172 650a 7472 616e 736c 6174 \) are.translat │ │ │ -000bae80: 696f 6e73 2069 6e20 5c28 2078 2c20 7920 ions in \( x, y │ │ │ -000bae90: 5c29 2061 7865 7320 7265 7370 6563 7469 \) axes respecti │ │ │ -000baea0: 7665 6c79 2e0a 0a3c 623e 4e6f 7465 3a3c vely...Note:< │ │ │ -000baeb0: 2f62 3e0a 5468 6520 5241 4e53 4143 206d /b>.The RANSAC m │ │ │ -000baec0: 6574 686f 6420 6361 6e20 6861 6e64 6c65 ethod can handle │ │ │ -000baed0: 2070 7261 6374 6963 616c 6c79 2061 6e79 practically any │ │ │ -000baee0: 2072 6174 696f 206f 6620 6f75 746c 6965 ratio of outlie │ │ │ -000baef0: 7273 2062 7574 206e 6565 6420 6120 7468 rs but need a th │ │ │ -000baf00: 7265 7368 6f6c 6420 746f 0a64 6973 7469 reshold to.disti │ │ │ -000baf10: 6e67 7569 7368 2069 6e6c 6965 7273 2066 nguish inliers f │ │ │ -000baf20: 726f 6d20 6f75 746c 6965 7273 2e20 5468 rom outliers. Th │ │ │ -000baf30: 6520 6d65 7468 6f64 204c 4d65 4453 2064 e method LMeDS d │ │ │ -000baf40: 6f65 7320 6e6f 7420 6e65 6564 2061 6e79 oes not need any │ │ │ -000baf50: 2074 6872 6573 686f 6c64 2062 7574 2069 threshold but i │ │ │ -000baf60: 7420 776f 726b 730a 636f 7272 6563 746c t works.correctl │ │ │ -000baf70: 7920 6f6e 6c79 2077 6865 6e20 7468 6572 y only when ther │ │ │ -000baf80: 6520 6172 6520 6d6f 7265 2074 6861 6e20 e are more than │ │ │ -000baf90: 3530 2520 6f66 2069 6e6c 6965 7273 2e0a 50% of inliers.. │ │ │ -000bafa0: 0a53 4545 3a20 6573 7469 6d61 7465 4166 .SEE: estimateAf │ │ │ -000bafb0: 6669 6e65 3244 2c20 6765 7441 6666 696e fine2D, getAffin │ │ │ -000bafc0: 6554 7261 6e73 666f 726d 3c2f 6464 3e0a eTransform
    . │ │ │ -000bafd0: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    .
    ...
    .

    estimateAf │ │ │ -000bb060: 6669 6e65 5061 7274 6961 6c32 443c 2f68 finePartial2D.
    .
    public │ │ │ -000bb0d0: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ -000bb0e0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;Mat │ │ │ -000bb140: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  estimate │ │ │ -000bb170: 4166 6669 6e65 5061 7274 6961 6c32 443c AffinePartial2D< │ │ │ -000bb180: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat fr │ │ │ -000bb1f0: 6f6d 2c0a 203c 6120 6872 6566 3d22 2e2e om,. Mat to │ │ │ -000bb240: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ -000bb250: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -000bb260: 223e 436f 6d70 7574 6573 2061 6e20 6f70 ">Computes an op │ │ │ -000bb270: 7469 6d61 6c20 6c69 6d69 7465 6420 6166 timal limited af │ │ │ -000bb280: 6669 6e65 2074 7261 6e73 666f 726d 6174 fine transformat │ │ │ -000bb290: 696f 6e20 7769 7468 2034 2064 6567 7265 ion with 4 degre │ │ │ -000bb2a0: 6573 206f 6620 6672 6565 646f 6d20 6265 es of freedom be │ │ │ -000bb2b0: 7477 6565 6e0a 7477 6f20 3244 2070 6f69 tween.two 2D poi │ │ │ -000bb2c0: 6e74 2073 6574 732e 3c2f 6469 763e 0a3c nt sets.
    .< │ │ │ -000bb2d0: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ -000bb2e0: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ -000bb2f0: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    from - F │ │ │ -000bb310: 6972 7374 2069 6e70 7574 2032 4420 706f irst input 2D po │ │ │ -000bb320: 696e 7420 7365 742e 3c2f 6464 3e0a 3c64 int set.
    .to - Second input │ │ │ -000bb350: 2032 4420 706f 696e 7420 7365 742e 0a3c 2D point set..< │ │ │ -000bb360: 756c 3e0a 2020 3c6c 693e 0a20 2020 5245 ul>.
  • . RE │ │ │ -000bb370: 463a 2052 414e 5341 4320 2d20 5241 4e53 F: RANSAC - RANS │ │ │ -000bb380: 4143 2d62 6173 6564 2072 6f62 7573 7420 AC-based robust │ │ │ -000bb390: 6d65 7468 6f64 0a20 203c 2f6c 693e 0a20 method.
  • . │ │ │ -000bb3a0: 203c 6c69 3e0a 2020 2052 4546 3a20 4c4d
  • . REF: LM │ │ │ -000bb3b0: 4544 5320 2d20 4c65 6173 742d 4d65 6469 EDS - Least-Medi │ │ │ -000bb3c0: 616e 2072 6f62 7573 7420 6d65 7468 6f64 an robust method │ │ │ -000bb3d0: 0a52 414e 5341 4320 6973 2074 6865 2064 .RANSAC is the d │ │ │ -000bb3e0: 6566 6175 6c74 206d 6574 686f 642e 0a20 efault method.. │ │ │ -000bb3f0: 203c 2f6c 693e 0a3c 2f75 6c3e 0a61 2070
  • ..a p │ │ │ -000bb400: 6f69 6e74 2061 7320 616e 2069 6e6c 6965 oint as an inlie │ │ │ -000bb410: 722e 2041 7070 6c69 6573 206f 6e6c 7920 r. Applies only │ │ │ -000bb420: 746f 2052 414e 5341 432e 0a62 6574 7765 to RANSAC..betwe │ │ │ -000bb430: 656e 2030 2e39 3520 616e 6420 302e 3939 en 0.95 and 0.99 │ │ │ -000bb440: 2069 7320 7573 7561 6c6c 7920 676f 6f64 is usually good │ │ │ -000bb450: 2065 6e6f 7567 682e 2056 616c 7565 7320 enough. Values │ │ │ -000bb460: 746f 6f20 636c 6f73 6520 746f 2031 2063 too close to 1 c │ │ │ -000bb470: 616e 2073 6c6f 7720 646f 776e 2074 6865 an slow down the │ │ │ -000bb480: 2065 7374 696d 6174 696f 6e0a 7369 676e estimation.sign │ │ │ -000bb490: 6966 6963 616e 746c 792e 2056 616c 7565 ificantly. Value │ │ │ -000bb4a0: 7320 6c6f 7765 7220 7468 616e 2030 2e38 s lower than 0.8 │ │ │ -000bb4b0: 2d30 2e39 2063 616e 2072 6573 756c 7420 -0.9 can result │ │ │ -000bb4c0: 696e 2061 6e20 696e 636f 7272 6563 746c in an incorrectl │ │ │ -000bb4d0: 7920 6573 7469 6d61 7465 6420 7472 616e y estimated tran │ │ │ -000bb4e0: 7366 6f72 6d61 7469 6f6e 2e0a 5061 7373 sformation..Pass │ │ │ -000bb4f0: 696e 6720 3020 7769 6c6c 2064 6973 6162 ing 0 will disab │ │ │ -000bb500: 6c65 2072 6566 696e 696e 672c 2073 6f20 le refining, so │ │ │ -000bb510: 7468 6520 6f75 7470 7574 206d 6174 7269 the output matri │ │ │ -000bb520: 7820 7769 6c6c 2062 6520 6f75 7470 7574 x will be output │ │ │ -000bb530: 206f 6620 726f 6275 7374 206d 6574 686f of robust metho │ │ │ -000bb540: 642e 3c2f 6464 3e0a 3c64 743e 5265 7475 d..
    Retu │ │ │ -000bb550: 726e 733a 3c2f 6474 3e0a 3c64 643e 4f75 rns:
    .
    Ou │ │ │ -000bb560: 7470 7574 2032 4420 6166 6669 6e65 2074 tput 2D affine t │ │ │ -000bb570: 7261 6e73 666f 726d 6174 696f 6e20 2834 ransformation (4 │ │ │ -000bb580: 2064 6567 7265 6573 206f 6620 6672 6565 degrees of free │ │ │ -000bb590: 646f 6d29 206d 6174 7269 7820 5c28 3220 dom) matrix \(2 │ │ │ -000bb5a0: 5c74 696d 6573 2033 5c29 206f 720a 656d \times 3\) or.em │ │ │ -000bb5b0: 7074 7920 6d61 7472 6978 2069 6620 7472 pty matrix if tr │ │ │ -000bb5c0: 616e 7366 6f72 6d61 7469 6f6e 2063 6f75 ansformation cou │ │ │ -000bb5d0: 6c64 206e 6f74 2062 6520 6573 7469 6d61 ld not be estima │ │ │ -000bb5e0: 7465 642e 0a0a 5468 6520 6675 6e63 7469 ted...The functi │ │ │ -000bb5f0: 6f6e 2065 7374 696d 6174 6573 2061 6e20 on estimates an │ │ │ -000bb600: 6f70 7469 6d61 6c20 3244 2061 6666 696e optimal 2D affin │ │ │ -000bb610: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ -000bb620: 2077 6974 6820 3420 6465 6772 6565 7320 with 4 degrees │ │ │ -000bb630: 6f66 2066 7265 6564 6f6d 206c 696d 6974 of freedom limit │ │ │ -000bb640: 6564 2074 6f0a 636f 6d62 696e 6174 696f ed to.combinatio │ │ │ -000bb650: 6e73 206f 6620 7472 616e 736c 6174 696f ns of translatio │ │ │ -000bb660: 6e2c 2072 6f74 6174 696f 6e2c 2061 6e64 n, rotation, and │ │ │ -000bb670: 2075 6e69 666f 726d 2073 6361 6c69 6e67 uniform scaling │ │ │ -000bb680: 2e20 5573 6573 2074 6865 2073 656c 6563 . Uses the selec │ │ │ -000bb690: 7465 6420 616c 676f 7269 7468 6d20 666f ted algorithm fo │ │ │ -000bb6a0: 7220 726f 6275 7374 0a65 7374 696d 6174 r robust.estimat │ │ │ -000bb6b0: 696f 6e2e 0a0a 5468 6520 636f 6d70 7574 ion...The comput │ │ │ -000bb6c0: 6564 2074 7261 6e73 666f 726d 6174 696f ed transformatio │ │ │ -000bb6d0: 6e20 6973 2074 6865 6e20 7265 6669 6e65 n is then refine │ │ │ -000bb6e0: 6420 6675 7274 6865 7220 2875 7369 6e67 d further (using │ │ │ -000bb6f0: 206f 6e6c 7920 696e 6c69 6572 7329 2077 only inliers) w │ │ │ -000bb700: 6974 6820 7468 650a 4c65 7665 6e62 6572 ith the.Levenber │ │ │ -000bb710: 672d 4d61 7271 7561 7264 7420 6d65 7468 g-Marquardt meth │ │ │ -000bb720: 6f64 2074 6f20 7265 6475 6365 2074 6865 od to reduce the │ │ │ -000bb730: 2072 652d 7072 6f6a 6563 7469 6f6e 2065 re-projection e │ │ │ -000bb740: 7272 6f72 2065 7665 6e20 6d6f 7265 2e0a rror even more.. │ │ │ -000bb750: 0a45 7374 696d 6174 6564 2074 7261 6e73 .Estimated trans │ │ │ -000bb760: 666f 726d 6174 696f 6e20 6d61 7472 6978 formation matrix │ │ │ -000bb770: 2069 733a 0a5c 2820 5c62 6567 696e 7b62 is:.\( \begin{b │ │ │ -000bb780: 6d61 7472 6978 7d20 5c63 6f73 285c 7468 matrix} \cos(\th │ │ │ -000bb790: 6574 6129 205c 6364 6f74 2073 2026 616d eta) \cdot s &am │ │ │ -000bb7a0: 703b 202d 5c73 696e 285c 7468 6574 6129 p; -\sin(\theta) │ │ │ -000bb7b0: 205c 6364 6f74 2073 2026 616d 703b 2074 \cdot s & t │ │ │ -000bb7c0: 5f78 205c 5c0a 2020 2020 2020 2020 2020 _x \\. │ │ │ -000bb7d0: 2020 2020 2020 5c73 696e 285c 7468 6574 \sin(\thet │ │ │ -000bb7e0: 6129 205c 6364 6f74 2073 2026 616d 703b a) \cdot s & │ │ │ -000bb7f0: 205c 636f 7328 5c74 6865 7461 2920 5c63 \cos(\theta) \c │ │ │ -000bb800: 646f 7420 7320 2661 6d70 3b20 745f 790a dot s & t_y. │ │ │ -000bb810: 5c65 6e64 7b62 6d61 7472 6978 7d20 5c29 \end{bmatrix} \) │ │ │ -000bb820: 0a57 6865 7265 205c 2820 5c74 6865 7461 .Where \( \theta │ │ │ -000bb830: 205c 2920 6973 2074 6865 2072 6f74 6174 \) is the rotat │ │ │ -000bb840: 696f 6e20 616e 676c 652c 205c 2820 7320 ion angle, \( s │ │ │ -000bb850: 5c29 2074 6865 2073 6361 6c69 6e67 2066 \) the scaling f │ │ │ -000bb860: 6163 746f 7220 616e 6420 5c28 2074 5f78 actor and \( t_x │ │ │ -000bb870: 2c20 745f 7920 5c29 2061 7265 0a74 7261 , t_y \) are.tra │ │ │ -000bb880: 6e73 6c61 7469 6f6e 7320 696e 205c 2820 nslations in \( │ │ │ -000bb890: 782c 2079 205c 2920 6178 6573 2072 6573 x, y \) axes res │ │ │ -000bb8a0: 7065 6374 6976 656c 792e 0a0a 3c62 3e4e pectively...N │ │ │ -000bb8b0: 6f74 653a 3c2f 623e 0a54 6865 2052 414e ote:.The RAN │ │ │ -000bb8c0: 5341 4320 6d65 7468 6f64 2063 616e 2068 SAC method can h │ │ │ -000bb8d0: 616e 646c 6520 7072 6163 7469 6361 6c6c andle practicall │ │ │ -000bb8e0: 7920 616e 7920 7261 7469 6f20 6f66 206f y any ratio of o │ │ │ -000bb8f0: 7574 6c69 6572 7320 6275 7420 6e65 6564 utliers but need │ │ │ -000bb900: 2061 2074 6872 6573 686f 6c64 2074 6f0a a threshold to. │ │ │ -000bb910: 6469 7374 696e 6775 6973 6820 696e 6c69 distinguish inli │ │ │ -000bb920: 6572 7320 6672 6f6d 206f 7574 6c69 6572 ers from outlier │ │ │ -000bb930: 732e 2054 6865 206d 6574 686f 6420 4c4d s. The method LM │ │ │ -000bb940: 6544 5320 646f 6573 206e 6f74 206e 6565 eDS does not nee │ │ │ -000bb950: 6420 616e 7920 7468 7265 7368 6f6c 6420 d any threshold │ │ │ -000bb960: 6275 7420 6974 2077 6f72 6b73 0a63 6f72 but it works.cor │ │ │ -000bb970: 7265 6374 6c79 206f 6e6c 7920 7768 656e rectly only when │ │ │ -000bb980: 2074 6865 7265 2061 7265 206d 6f72 6520 there are more │ │ │ -000bb990: 7468 616e 2035 3025 206f 6620 696e 6c69 than 50% of inli │ │ │ -000bb9a0: 6572 732e 0a0a 5345 453a 2065 7374 696d ers...SEE: estim │ │ │ -000bb9b0: 6174 6541 6666 696e 6532 442c 2067 6574 ateAffine2D, get │ │ │ -000bb9c0: 4166 6669 6e65 5472 616e 7366 6f72 6d3c AffineTransform< │ │ │ -000bb9d0: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>...

    .
    .
  • .
    .

    estimat │ │ │ -000bba90: 6554 7261 6e73 6c61 7469 6f6e 3244 3c2f eTranslation2D.
    .
    public │ │ │ -000bbb00: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ -000bbb10: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;do │ │ │ -000bbb30: 7562 6c65 5b5d 3c2f 7370 616e 3e26 6e62 uble[]&nb │ │ │ -000bbb40: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;es │ │ │ -000bbb60: 7469 6d61 7465 5472 616e 736c 6174 696f timateTranslatio │ │ │ -000bbb70: 6e32 443c 2f73 7061 6e3e 3c77 6272 3e3c n2D< │ │ │ -000bbb80: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ -000bbb90: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ -000bbbe0: 703b 6672 6f6d 2c0a 203c 6120 6872 6566 p;from,. Mat&nbs │ │ │ -000bbc30: 703b 746f 2c0a 203c 6120 6872 6566 3d22 p;to,. Mat  │ │ │ -000bbc80: 696e 6c69 6572 732c 0a20 696e 7426 6e62 inliers,. int&nb │ │ │ -000bbc90: 7370 3b6d 6574 686f 642c 0a20 646f 7562 sp;method,. doub │ │ │ -000bbca0: 6c65 266e 6273 703b 7261 6e73 6163 5265 le ransacRe │ │ │ -000bbcb0: 7072 6f6a 5468 7265 7368 6f6c 642c 0a20 projThreshold,. │ │ │ -000bbcc0: 6c6f 6e67 266e 6273 703b 6d61 7849 7465 long maxIte │ │ │ -000bbcd0: 7273 2c0a 2064 6f75 626c 6526 6e62 7370 rs,. double  │ │ │ -000bbce0: 3b63 6f6e 6669 6465 6e63 652c 0a20 6c6f ;confidence,. lo │ │ │ -000bbcf0: 6e67 266e 6273 703b 7265 6669 6e65 4974 ng refineIt │ │ │ -000bbd00: 6572 7329 3c2f 7370 616e 3e3c 2f64 6976 ers)
    .
    Computes a │ │ │ -000bbd30: 7075 7265 2032 4420 7472 616e 736c 6174 pure 2D translat │ │ │ -000bbd40: 696f 6e20 6265 7477 6565 6e20 7477 6f20 ion between two │ │ │ -000bbd50: 3244 2070 6f69 6e74 2073 6574 732e 0a0a 2D point sets... │ │ │ -000bbd60: 4974 2063 6f6d 7075 7465 730a 5c28 0a5c It computes.\(.\ │ │ │ -000bbd70: 6265 6769 6e7b 626d 6174 7269 787d 0a78 begin{bmatrix}.x │ │ │ -000bbd80: 5c5c 0a79 0a5c 656e 647b 626d 6174 7269 \\.y.\end{bmatri │ │ │ -000bbd90: 787d 0a3d 0a5c 6265 6769 6e7b 626d 6174 x}.=.\begin{bmat │ │ │ -000bbda0: 7269 787d 0a31 2026 616d 703b 2030 5c5c rix}.1 & 0\\ │ │ │ -000bbdb0: 0a30 2026 616d 703b 2031 0a5c 656e 647b .0 & 1.\end{ │ │ │ -000bbdc0: 626d 6174 7269 787d 0a5c 6265 6769 6e7b bmatrix}.\begin{ │ │ │ -000bbdd0: 626d 6174 7269 787d 0a58 5c5c 0a59 0a5c bmatrix}.X\\.Y.\ │ │ │ -000bbde0: 656e 647b 626d 6174 7269 787d 0a2b 0a5c end{bmatrix}.+.\ │ │ │ -000bbdf0: 6265 6769 6e7b 626d 6174 7269 787d 0a74 begin{bmatrix}.t │ │ │ -000bbe00: 5f78 5c5c 0a74 5f79 0a5c 656e 647b 626d _x\\.t_y.\end{bm │ │ │ -000bbe10: 6174 7269 787d 2e0a 5c29 3c2f 6469 763e atrix}..\)
    │ │ │ -000bbe20: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ -000bbe40: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    from - │ │ │ -000bbe60: 2046 6972 7374 2069 6e70 7574 2032 4420 First input 2D │ │ │ -000bbe70: 706f 696e 7420 7365 7420 636f 6e74 6169 point set contai │ │ │ -000bbe80: 6e69 6e67 205c 2828 582c 5929 5c29 2e3c ning \((X,Y)\).< │ │ │ -000bbe90: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ -000bbea0: 6f3c 2f63 6f64 653e 202d 2053 6563 6f6e o - Secon │ │ │ -000bbeb0: 6420 696e 7075 7420 3244 2070 6f69 6e74 d input 2D point │ │ │ -000bbec0: 2073 6574 2063 6f6e 7461 696e 696e 6720 set containing │ │ │ -000bbed0: 5c28 2878 2c79 295c 292e 3c2f 6464 3e0a \((x,y)\).
    . │ │ │ -000bbee0: 3c64 643e 3c63 6f64 653e 696e 6c69 6572
    inlier │ │ │ -000bbef0: 733c 2f63 6f64 653e 202d 204f 7574 7075 s - Outpu │ │ │ -000bbf00: 7420 7665 6374 6f72 2069 6e64 6963 6174 t vector indicat │ │ │ -000bbf10: 696e 6720 7768 6963 6820 706f 696e 7473 ing which points │ │ │ -000bbf20: 2061 7265 2069 6e6c 6965 7273 2028 312d are inliers (1- │ │ │ -000bbf30: 696e 6c69 6572 2c20 302d 6f75 746c 6965 inlier, 0-outlie │ │ │ -000bbf40: 7229 2e3c 2f64 643e 0a3c 6464 3e3c 636f r).
    .
    method │ │ │ -000bbf60: 202d 2052 6f62 7573 7420 6d65 7468 6f64 - Robust method │ │ │ -000bbf70: 2075 7365 6420 746f 2063 6f6d 7075 7465 used to compute │ │ │ -000bbf80: 2074 6865 2074 7261 6e73 666f 726d 6174 the transformat │ │ │ -000bbf90: 696f 6e2e 2054 6865 2066 6f6c 6c6f 7769 ion. The followi │ │ │ -000bbfa0: 6e67 206d 6574 686f 6473 2061 7265 2070 ng methods are p │ │ │ -000bbfb0: 6f73 7369 626c 653a 0a3c 756c 3e0a 2020 ossible:.
      . │ │ │ -000bbfc0: 3c6c 693e 0a20 2020 5245 463a 2052 414e
    • . REF: RAN │ │ │ -000bbfd0: 5341 4320 2d20 5241 4e53 4143 2d62 6173 SAC - RANSAC-bas │ │ │ -000bbfe0: 6564 2072 6f62 7573 7420 6d65 7468 6f64 ed robust method │ │ │ -000bbff0: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ -000bc000: 2020 2052 4546 3a20 4c4d 4544 5320 2d20 REF: LMEDS - │ │ │ -000bc010: 4c65 6173 742d 4d65 6469 616e 2072 6f62 Least-Median rob │ │ │ -000bc020: 7573 7420 6d65 7468 6f64 0a52 414e 5341 ust method.RANSA │ │ │ -000bc030: 4320 6973 2074 6865 2064 6566 6175 6c74 C is the default │ │ │ -000bc040: 206d 6574 686f 642e 0a20 203c 2f6c 693e method..
    • │ │ │ -000bc050: 0a3c 2f75 6c3e 3c2f 6464 3e0a 3c64 643e .
    .
    │ │ │ -000bc060: 3c63 6f64 653e 7261 6e73 6163 5265 7072 ransacRepr │ │ │ -000bc070: 6f6a 5468 7265 7368 6f6c 643c 2f63 6f64 ojThreshold - Maximum rep │ │ │ -000bc090: 726f 6a65 6374 696f 6e20 6572 726f 7220 rojection error │ │ │ -000bc0a0: 696e 2074 6865 2052 414e 5341 4320 616c in the RANSAC al │ │ │ -000bc0b0: 676f 7269 7468 6d20 746f 2063 6f6e 7369 gorithm to consi │ │ │ -000bc0c0: 6465 720a 6120 706f 696e 7420 6173 2061 der.a point as a │ │ │ -000bc0d0: 6e20 696e 6c69 6572 2e20 4170 706c 6965 n inlier. Applie │ │ │ -000bc0e0: 7320 6f6e 6c79 2074 6f20 5241 4e53 4143 s only to RANSAC │ │ │ -000bc0f0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    maxIters │ │ │ -000bc110: 202d 2054 6865 206d 6178 696d 756d 206e - The maximum n │ │ │ -000bc120: 756d 6265 7220 6f66 2072 6f62 7573 7420 umber of robust │ │ │ -000bc130: 6d65 7468 6f64 2069 7465 7261 7469 6f6e method iteration │ │ │ -000bc140: 732e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 s.
    .
    confidence - Confidence │ │ │ -000bc170: 206c 6576 656c 2c20 6265 7477 6565 6e20 level, between │ │ │ -000bc180: 3020 616e 6420 312c 2066 6f72 2074 6865 0 and 1, for the │ │ │ -000bc190: 2065 7374 696d 6174 6564 2074 7261 6e73 estimated trans │ │ │ -000bc1a0: 666f 726d 6174 696f 6e2e 2041 6e79 7468 formation. Anyth │ │ │ -000bc1b0: 696e 670a 6265 7477 6565 6e20 302e 3935 ing.between 0.95 │ │ │ -000bc1c0: 2061 6e64 2030 2e39 3920 6973 2075 7375 and 0.99 is usu │ │ │ -000bc1d0: 616c 6c79 2067 6f6f 6420 656e 6f75 6768 ally good enough │ │ │ -000bc1e0: 2e20 5661 6c75 6573 2074 6f6f 2063 6c6f . Values too clo │ │ │ -000bc1f0: 7365 2074 6f20 3120 6361 6e20 736c 6f77 se to 1 can slow │ │ │ -000bc200: 2064 6f77 6e20 7468 6520 6573 7469 6d61 down the estima │ │ │ -000bc210: 7469 6f6e 0a73 6967 6e69 6669 6361 6e74 tion.significant │ │ │ -000bc220: 6c79 2e20 5661 6c75 6573 206c 6f77 6572 ly. Values lower │ │ │ -000bc230: 2074 6861 6e20 302e 38e2 8093 302e 3920 than 0.8...0.9 │ │ │ -000bc240: 6361 6e20 7265 7375 6c74 2069 6e20 616e can result in an │ │ │ -000bc250: 2069 6e63 6f72 7265 6374 6c79 2065 7374 incorrectly est │ │ │ -000bc260: 696d 6174 6564 2074 7261 6e73 666f 726d imated transform │ │ │ -000bc270: 6174 696f 6e2e 3c2f 6464 3e0a 3c64 643e ation.
    .
    │ │ │ -000bc280: 3c63 6f64 653e 7265 6669 6e65 4974 6572 refineIter │ │ │ -000bc290: 733c 2f63 6f64 653e 202d 204d 6178 696d s - Maxim │ │ │ -000bc2a0: 756d 206e 756d 6265 7220 6f66 2069 7465 um number of ite │ │ │ -000bc2b0: 7261 7469 6f6e 7320 6f66 2074 6865 2072 rations of the r │ │ │ -000bc2c0: 6566 696e 696e 6720 616c 676f 7269 7468 efining algorith │ │ │ -000bc2d0: 6d2e 2046 6f72 2070 7572 6520 7472 616e m. For pure tran │ │ │ -000bc2e0: 736c 6174 696f 6e0a 7468 6520 6c65 6173 slation.the leas │ │ │ -000bc2f0: 742d 7371 7561 7265 7320 736f 6c75 7469 t-squares soluti │ │ │ -000bc300: 6f6e 206f 6e20 696e 6c69 6572 7320 6973 on on inliers is │ │ │ -000bc310: 2063 6c6f 7365 642d 666f 726d 2c20 736f closed-form, so │ │ │ -000bc320: 2070 6173 7369 6e67 2030 2069 7320 7265 passing 0 is re │ │ │ -000bc330: 636f 6d6d 656e 6465 6420 286e 6f20 6164 commended (no ad │ │ │ -000bc340: 6469 7469 6f6e 616c 2072 6566 696e 6529 ditional refine) │ │ │ -000bc350: 2e3c 2f64 643e 0a3c 6474 3e52 6574 7572 .
    .
    Retur │ │ │ -000bc360: 6e73 3a3c 2f64 743e 0a3c 6464 3e41 2032 ns:
    .
    A 2 │ │ │ -000bc370: 4420 7472 616e 736c 6174 696f 6e20 7665 D translation ve │ │ │ -000bc380: 6374 6f72 205c 285b 745f 782c 2074 5f79 ctor \([t_x, t_y │ │ │ -000bc390: 5d5e 545c 2920 6173 203c 636f 6465 3e63 ]^T\) as c │ │ │ -000bc3a0: 763a 3a56 6563 3264 3c2f 636f 6465 3e2e v::Vec2d. │ │ │ -000bc3b0: 2049 6620 7468 6520 7472 616e 736c 6174 If the translat │ │ │ -000bc3c0: 696f 6e20 636f 756c 6420 6e6f 7420 6265 ion could not be │ │ │ -000bc3d0: 0a65 7374 696d 6174 6564 2c20 626f 7468 .estimated, both │ │ │ -000bc3e0: 2063 6f6d 706f 6e65 6e74 7320 6172 6520 components are │ │ │ -000bc3f0: 7365 7420 746f 204e 614e 2061 6e64 2c20 set to NaN and, │ │ │ -000bc400: 6966 203c 636f 6465 3e69 6e6c 6965 7273 if inliers │ │ │ -000bc410: 3c2f 636f 6465 3e20 6973 2070 726f 7669 is provi │ │ │ -000bc420: 6465 642c 2074 6865 206d 6173 6b20 6973 ded, the mask is │ │ │ -000bc430: 2066 696c 6c65 6420 7769 7468 207a 6572 filled with zer │ │ │ -000bc440: 6f73 2e0a 0a5c 7061 7220 436f 6e76 6572 os...\par Conver │ │ │ -000bc450: 7469 6e67 2074 6f20 6120 3278 3320 7472 ting to a 2x3 tr │ │ │ -000bc460: 616e 7366 6f72 6d61 7469 6f6e 206d 6174 ansformation mat │ │ │ -000bc470: 7269 783a 0a5c 280a 5c62 6567 696e 7b62 rix:.\(.\begin{b │ │ │ -000bc480: 6d61 7472 6978 7d0a 3120 2661 6d70 3b20 matrix}.1 & │ │ │ -000bc490: 3020 2661 6d70 3b20 745f 785c 5c0a 3020 0 & t_x\\.0 │ │ │ -000bc4a0: 2661 6d70 3b20 3120 2661 6d70 3b20 745f & 1 & t_ │ │ │ -000bc4b0: 790a 5c65 6e64 7b62 6d61 7472 6978 7d0a y.\end{bmatrix}. │ │ │ -000bc4c0: 5c29 0a0a 3c63 6f64 653e 0a63 763a 3a56 \)...cv::V │ │ │ -000bc4d0: 6563 3264 2074 203d 2063 763a 3a65 7374 ec2d t = cv::est │ │ │ -000bc4e0: 696d 6174 6554 7261 6e73 6c61 7469 6f6e imateTranslation │ │ │ -000bc4f0: 3244 2866 726f 6d2c 2074 6f2c 2069 6e6c 2D(from, to, inl │ │ │ -000bc500: 6965 7273 293b 0a63 763a 3a4d 6174 2054 iers);.cv::Mat T │ │ │ -000bc510: 203d 2028 6376 3a3a 4d61 745f 266c 743b = (cv::Mat_< │ │ │ -000bc520: 646f 7562 6c65 2667 743b 2832 2c33 2920 double>(2,3) │ │ │ -000bc530: 266c 743b 266c 743b 2031 2c30 2c74 5b30 << 1,0,t[0 │ │ │ -000bc540: 5d2c 2030 2c31 2c74 5b31 5d29 3b0a 3c2f ], 0,1,t[1]);...The funct │ │ │ -000bc560: 696f 6e20 6573 7469 6d61 7465 7320 6120 ion estimates a │ │ │ -000bc570: 7075 7265 2032 4420 7472 616e 736c 6174 pure 2D translat │ │ │ -000bc580: 696f 6e20 6265 7477 6565 6e20 7477 6f20 ion between two │ │ │ -000bc590: 3244 2070 6f69 6e74 2073 6574 7320 7573 2D point sets us │ │ │ -000bc5a0: 696e 6720 7468 6520 7365 6c65 6374 6564 ing the selected │ │ │ -000bc5b0: 2072 6f62 7573 740a 616c 676f 7269 7468 robust.algorith │ │ │ -000bc5c0: 6d2e 2049 6e6c 6965 7273 2061 7265 2064 m. Inliers are d │ │ │ -000bc5d0: 6574 6572 6d69 6e65 6420 6279 2074 6865 etermined by the │ │ │ -000bc5e0: 2072 6570 726f 6a65 6374 696f 6e20 6572 reprojection er │ │ │ -000bc5f0: 726f 7220 7468 7265 7368 6f6c 642e 0a0a ror threshold... │ │ │ -000bc600: 3c62 3e4e 6f74 653a 3c2f 623e 0a54 6865 Note:.The │ │ │ -000bc610: 2052 414e 5341 4320 6d65 7468 6f64 2063 RANSAC method c │ │ │ -000bc620: 616e 2068 616e 646c 6520 7072 6163 7469 an handle practi │ │ │ -000bc630: 6361 6c6c 7920 616e 7920 7261 7469 6f20 cally any ratio │ │ │ -000bc640: 6f66 206f 7574 6c69 6572 7320 6275 7420 of outliers but │ │ │ -000bc650: 6e65 6564 7320 6120 7468 7265 7368 6f6c needs a threshol │ │ │ -000bc660: 6420 746f 0a64 6973 7469 6e67 7569 7368 d to.distinguish │ │ │ -000bc670: 2069 6e6c 6965 7273 2066 726f 6d20 6f75 inliers from ou │ │ │ -000bc680: 746c 6965 7273 2e20 5468 6520 6d65 7468 tliers. The meth │ │ │ -000bc690: 6f64 204c 4d65 4453 2064 6f65 7320 6e6f od LMeDS does no │ │ │ -000bc6a0: 7420 6e65 6564 2061 6e79 2074 6872 6573 t need any thres │ │ │ -000bc6b0: 686f 6c64 2062 7574 2077 6f72 6b73 0a63 hold but works.c │ │ │ -000bc6c0: 6f72 7265 6374 6c79 206f 6e6c 7920 7768 orrectly only wh │ │ │ -000bc6d0: 656e 2074 6865 7265 2061 7265 206d 6f72 en there are mor │ │ │ -000bc6e0: 6520 7468 616e 2035 3025 2069 6e6c 6965 e than 50% inlie │ │ │ -000bc6f0: 7273 2e0a 0a53 4545 3a20 6573 7469 6d61 rs...SEE: estima │ │ │ -000bc700: 7465 4166 6669 6e65 3244 2c20 6573 7469 teAffine2D, esti │ │ │ -000bc710: 6d61 7465 4166 6669 6e65 5061 7274 6961 mateAffinePartia │ │ │ -000bc720: 6c32 442c 2067 6574 4166 6669 6e65 5472 l2D, getAffineTr │ │ │ -000bc730: 616e 7366 6f72 6d3c 2f64 643e 0a3c 2f64 ansform
    ..
    ..

  • .
  • . │ │ │ -000bc760: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    esti │ │ │ -000bc7f0: 6d61 7465 5472 616e 736c 6174 696f 6e32 mateTranslation2 │ │ │ -000bc800: 443c 2f68 333e 0a3c 6469 7620 636c 6173 D

    .
    .
    pub │ │ │ -000bc860: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static double[] │ │ │ -000bc8a0: 266e 6273 703b 3c73 7061 6e20 636c 6173  estimateTransla │ │ │ -000bc8d0: 7469 6f6e 3244 3c2f 7370 616e 3e3c 7762 tion2D(Mat& │ │ │ -000bc940: 6e62 7370 3b66 726f 6d2c 0a20 3c61 2068 nbsp;from,. Mat& │ │ │ -000bc990: 6e62 7370 3b74 6f2c 0a20 3c61 2068 7265 nbsp;to,. Mat&nb │ │ │ -000bc9e0: 7370 3b69 6e6c 6965 7273 2c0a 2069 6e74 sp;inliers,. int │ │ │ -000bc9f0: 266e 6273 703b 6d65 7468 6f64 2c0a 2064  method,. d │ │ │ -000bca00: 6f75 626c 6526 6e62 7370 3b72 616e 7361 ouble ransa │ │ │ -000bca10: 6352 6570 726f 6a54 6872 6573 686f 6c64 cReprojThreshold │ │ │ -000bca20: 2c0a 206c 6f6e 6726 6e62 7370 3b6d 6178 ,. long max │ │ │ -000bca30: 4974 6572 732c 0a20 646f 7562 6c65 266e Iters,. double&n │ │ │ -000bca40: 6273 703b 636f 6e66 6964 656e 6365 293c bsp;confidence)< │ │ │ -000bca50: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ -000bca70: 436f 6d70 7574 6573 2061 2070 7572 6520 Computes a pure │ │ │ -000bca80: 3244 2074 7261 6e73 6c61 7469 6f6e 2062 2D translation b │ │ │ -000bca90: 6574 7765 656e 2074 776f 2032 4420 706f etween two 2D po │ │ │ -000bcaa0: 696e 7420 7365 7473 2e0a 0a49 7420 636f int sets...It co │ │ │ -000bcab0: 6d70 7574 6573 0a5c 280a 5c62 6567 696e mputes.\(.\begin │ │ │ -000bcac0: 7b62 6d61 7472 6978 7d0a 785c 5c0a 790a {bmatrix}.x\\.y. │ │ │ -000bcad0: 5c65 6e64 7b62 6d61 7472 6978 7d0a 3d0a \end{bmatrix}.=. │ │ │ -000bcae0: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ -000bcaf0: 3120 2661 6d70 3b20 305c 5c0a 3020 2661 1 & 0\\.0 &a │ │ │ -000bcb00: 6d70 3b20 310a 5c65 6e64 7b62 6d61 7472 mp; 1.\end{bmatr │ │ │ -000bcb10: 6978 7d0a 5c62 6567 696e 7b62 6d61 7472 ix}.\begin{bmatr │ │ │ -000bcb20: 6978 7d0a 585c 5c0a 590a 5c65 6e64 7b62 ix}.X\\.Y.\end{b │ │ │ -000bcb30: 6d61 7472 6978 7d0a 2b0a 5c62 6567 696e matrix}.+.\begin │ │ │ -000bcb40: 7b62 6d61 7472 6978 7d0a 745f 785c 5c0a {bmatrix}.t_x\\. │ │ │ -000bcb50: 745f 790a 5c65 6e64 7b62 6d61 7472 6978 t_y.\end{bmatrix │ │ │ -000bcb60: 7d2e 0a5c 293c 2f64 6976 3e0a 3c64 6c20 }..\)
    .
    .< │ │ │ -000bcb80: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    fr │ │ │ -000bcba0: 6f6d 3c2f 636f 6465 3e20 2d20 4669 7273 om - Firs │ │ │ -000bcbb0: 7420 696e 7075 7420 3244 2070 6f69 6e74 t input 2D point │ │ │ -000bcbc0: 2073 6574 2063 6f6e 7461 696e 696e 6720 set containing │ │ │ -000bcbd0: 5c28 2858 2c59 295c 292e 3c2f 6464 3e0a \((X,Y)\).
    . │ │ │ -000bcbe0: 3c64 643e 3c63 6f64 653e 746f 3c2f 636f
    to - Second inp │ │ │ -000bcc00: 7574 2032 4420 706f 696e 7420 7365 7420 ut 2D point set │ │ │ -000bcc10: 636f 6e74 6169 6e69 6e67 205c 2828 782c containing \((x, │ │ │ -000bcc20: 7929 5c29 2e3c 2f64 643e 0a3c 6464 3e3c y)\).
    .
    < │ │ │ -000bcc30: 636f 6465 3e69 6e6c 6965 7273 3c2f 636f code>inliers - Output vec │ │ │ -000bcc50: 746f 7220 696e 6469 6361 7469 6e67 2077 tor indicating w │ │ │ -000bcc60: 6869 6368 2070 6f69 6e74 7320 6172 6520 hich points are │ │ │ -000bcc70: 696e 6c69 6572 7320 2831 2d69 6e6c 6965 inliers (1-inlie │ │ │ -000bcc80: 722c 2030 2d6f 7574 6c69 6572 292e 3c2f r, 0-outlier)..
    me │ │ │ -000bcca0: 7468 6f64 3c2f 636f 6465 3e20 2d20 526f thod - Ro │ │ │ -000bccb0: 6275 7374 206d 6574 686f 6420 7573 6564 bust method used │ │ │ -000bccc0: 2074 6f20 636f 6d70 7574 6520 7468 6520 to compute the │ │ │ -000bccd0: 7472 616e 7366 6f72 6d61 7469 6f6e 2e20 transformation. │ │ │ -000bcce0: 5468 6520 666f 6c6c 6f77 696e 6720 6d65 The following me │ │ │ -000bccf0: 7468 6f64 7320 6172 6520 706f 7373 6962 thods are possib │ │ │ -000bcd00: 6c65 3a0a 3c75 6c3e 0a20 203c 6c69 3e0a le:.
      .
    • . │ │ │ -000bcd10: 2020 2052 4546 3a20 5241 4e53 4143 202d REF: RANSAC - │ │ │ -000bcd20: 2052 414e 5341 432d 6261 7365 6420 726f RANSAC-based ro │ │ │ -000bcd30: 6275 7374 206d 6574 686f 640a 2020 3c2f bust method. .
    • . RE │ │ │ -000bcd50: 463a 204c 4d45 4453 202d 204c 6561 7374 F: LMEDS - Least │ │ │ -000bcd60: 2d4d 6564 6961 6e20 726f 6275 7374 206d -Median robust m │ │ │ -000bcd70: 6574 686f 640a 5241 4e53 4143 2069 7320 ethod.RANSAC is │ │ │ -000bcd80: 7468 6520 6465 6661 756c 7420 6d65 7468 the default meth │ │ │ -000bcd90: 6f64 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c od..
    • .
    .
    ransacReprojThr │ │ │ -000bcdc0: 6573 686f 6c64 3c2f 636f 6465 3e20 2d20 eshold - │ │ │ -000bcdd0: 4d61 7869 6d75 6d20 7265 7072 6f6a 6563 Maximum reprojec │ │ │ -000bcde0: 7469 6f6e 2065 7272 6f72 2069 6e20 7468 tion error in th │ │ │ -000bcdf0: 6520 5241 4e53 4143 2061 6c67 6f72 6974 e RANSAC algorit │ │ │ -000bce00: 686d 2074 6f20 636f 6e73 6964 6572 0a61 hm to consider.a │ │ │ -000bce10: 2070 6f69 6e74 2061 7320 616e 2069 6e6c point as an inl │ │ │ -000bce20: 6965 722e 2041 7070 6c69 6573 206f 6e6c ier. Applies onl │ │ │ -000bce30: 7920 746f 2052 414e 5341 432e 3c2f 6464 y to RANSAC.
    .
    maxI │ │ │ -000bce50: 7465 7273 3c2f 636f 6465 3e20 2d20 5468 ters - Th │ │ │ -000bce60: 6520 6d61 7869 6d75 6d20 6e75 6d62 6572 e maximum number │ │ │ -000bce70: 206f 6620 726f 6275 7374 206d 6574 686f of robust metho │ │ │ -000bce80: 6420 6974 6572 6174 696f 6e73 2e3c 2f64 d iterations..
    con │ │ │ -000bcea0: 6669 6465 6e63 653c 2f63 6f64 653e 202d fidence - │ │ │ -000bceb0: 2043 6f6e 6669 6465 6e63 6520 6c65 7665 Confidence leve │ │ │ -000bcec0: 6c2c 2062 6574 7765 656e 2030 2061 6e64 l, between 0 and │ │ │ -000bced0: 2031 2c20 666f 7220 7468 6520 6573 7469 1, for the esti │ │ │ -000bcee0: 6d61 7465 6420 7472 616e 7366 6f72 6d61 mated transforma │ │ │ -000bcef0: 7469 6f6e 2e20 416e 7974 6869 6e67 0a62 tion. Anything.b │ │ │ -000bcf00: 6574 7765 656e 2030 2e39 3520 616e 6420 etween 0.95 and │ │ │ -000bcf10: 302e 3939 2069 7320 7573 7561 6c6c 7920 0.99 is usually │ │ │ -000bcf20: 676f 6f64 2065 6e6f 7567 682e 2056 616c good enough. Val │ │ │ -000bcf30: 7565 7320 746f 6f20 636c 6f73 6520 746f ues too close to │ │ │ -000bcf40: 2031 2063 616e 2073 6c6f 7720 646f 776e 1 can slow down │ │ │ -000bcf50: 2074 6865 2065 7374 696d 6174 696f 6e0a the estimation. │ │ │ -000bcf60: 7369 676e 6966 6963 616e 746c 792e 2056 significantly. V │ │ │ -000bcf70: 616c 7565 7320 6c6f 7765 7220 7468 616e alues lower than │ │ │ -000bcf80: 2030 2e38 e280 9330 2e39 2063 616e 2072 0.8...0.9 can r │ │ │ -000bcf90: 6573 756c 7420 696e 2061 6e20 696e 636f esult in an inco │ │ │ -000bcfa0: 7272 6563 746c 7920 6573 7469 6d61 7465 rrectly estimate │ │ │ -000bcfb0: 6420 7472 616e 7366 6f72 6d61 7469 6f6e d transformation │ │ │ -000bcfc0: 2e0a 7468 6520 6c65 6173 742d 7371 7561 ..the least-squa │ │ │ -000bcfd0: 7265 7320 736f 6c75 7469 6f6e 206f 6e20 res solution on │ │ │ -000bcfe0: 696e 6c69 6572 7320 6973 2063 6c6f 7365 inliers is close │ │ │ -000bcff0: 642d 666f 726d 2c20 736f 2070 6173 7369 d-form, so passi │ │ │ -000bd000: 6e67 2030 2069 7320 7265 636f 6d6d 656e ng 0 is recommen │ │ │ -000bd010: 6465 6420 286e 6f20 6164 6469 7469 6f6e ded (no addition │ │ │ -000bd020: 616c 2072 6566 696e 6529 2e3c 2f64 643e al refine).
    │ │ │ -000bd030: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    A 2D tran │ │ │ -000bd050: 736c 6174 696f 6e20 7665 6374 6f72 205c slation vector \ │ │ │ -000bd060: 285b 745f 782c 2074 5f79 5d5e 545c 2920 ([t_x, t_y]^T\) │ │ │ -000bd070: 6173 203c 636f 6465 3e63 763a 3a56 6563 as cv::Vec │ │ │ -000bd080: 3264 3c2f 636f 6465 3e2e 2049 6620 7468 2d. If th │ │ │ -000bd090: 6520 7472 616e 736c 6174 696f 6e20 636f e translation co │ │ │ -000bd0a0: 756c 6420 6e6f 7420 6265 0a65 7374 696d uld not be.estim │ │ │ -000bd0b0: 6174 6564 2c20 626f 7468 2063 6f6d 706f ated, both compo │ │ │ -000bd0c0: 6e65 6e74 7320 6172 6520 7365 7420 746f nents are set to │ │ │ -000bd0d0: 204e 614e 2061 6e64 2c20 6966 203c 636f NaN and, if inliers is provided, t │ │ │ -000bd100: 6865 206d 6173 6b20 6973 2066 696c 6c65 he mask is fille │ │ │ -000bd110: 6420 7769 7468 207a 6572 6f73 2e0a 0a5c d with zeros...\ │ │ │ -000bd120: 7061 7220 436f 6e76 6572 7469 6e67 2074 par Converting t │ │ │ -000bd130: 6f20 6120 3278 3320 7472 616e 7366 6f72 o a 2x3 transfor │ │ │ -000bd140: 6d61 7469 6f6e 206d 6174 7269 783a 0a5c mation matrix:.\ │ │ │ -000bd150: 280a 5c62 6567 696e 7b62 6d61 7472 6978 (.\begin{bmatrix │ │ │ -000bd160: 7d0a 3120 2661 6d70 3b20 3020 2661 6d70 }.1 & 0 & │ │ │ -000bd170: 3b20 745f 785c 5c0a 3020 2661 6d70 3b20 ; t_x\\.0 & │ │ │ -000bd180: 3120 2661 6d70 3b20 745f 790a 5c65 6e64 1 & t_y.\end │ │ │ -000bd190: 7b62 6d61 7472 6978 7d0a 5c29 0a0a 3c63 {bmatrix}.\)...cv::Vec2d t │ │ │ -000bd1b0: 203d 2063 763a 3a65 7374 696d 6174 6554 = cv::estimateT │ │ │ -000bd1c0: 7261 6e73 6c61 7469 6f6e 3244 2866 726f ranslation2D(fro │ │ │ -000bd1d0: 6d2c 2074 6f2c 2069 6e6c 6965 7273 293b m, to, inliers); │ │ │ -000bd1e0: 0a63 763a 3a4d 6174 2054 203d 2028 6376 .cv::Mat T = (cv │ │ │ -000bd1f0: 3a3a 4d61 745f 266c 743b 646f 7562 6c65 ::Mat_<double │ │ │ -000bd200: 2667 743b 2832 2c33 2920 266c 743b 266c >(2,3) <&l │ │ │ -000bd210: 743b 2031 2c30 2c74 5b30 5d2c 2030 2c31 t; 1,0,t[0], 0,1 │ │ │ -000bd220: 2c74 5b31 5d29 3b0a 3c2f 636f 6465 3e0a ,t[1]);.. │ │ │ -000bd230: 0a54 6865 2066 756e 6374 696f 6e20 6573 .The function es │ │ │ -000bd240: 7469 6d61 7465 7320 6120 7075 7265 2032 timates a pure 2 │ │ │ -000bd250: 4420 7472 616e 736c 6174 696f 6e20 6265 D translation be │ │ │ -000bd260: 7477 6565 6e20 7477 6f20 3244 2070 6f69 tween two 2D poi │ │ │ -000bd270: 6e74 2073 6574 7320 7573 696e 6720 7468 nt sets using th │ │ │ -000bd280: 6520 7365 6c65 6374 6564 2072 6f62 7573 e selected robus │ │ │ -000bd290: 740a 616c 676f 7269 7468 6d2e 2049 6e6c t.algorithm. Inl │ │ │ -000bd2a0: 6965 7273 2061 7265 2064 6574 6572 6d69 iers are determi │ │ │ -000bd2b0: 6e65 6420 6279 2074 6865 2072 6570 726f ned by the repro │ │ │ -000bd2c0: 6a65 6374 696f 6e20 6572 726f 7220 7468 jection error th │ │ │ -000bd2d0: 7265 7368 6f6c 642e 0a0a 3c62 3e4e 6f74 reshold...Not │ │ │ -000bd2e0: 653a 3c2f 623e 0a54 6865 2052 414e 5341 e:.The RANSA │ │ │ -000bd2f0: 4320 6d65 7468 6f64 2063 616e 2068 616e C method can han │ │ │ -000bd300: 646c 6520 7072 6163 7469 6361 6c6c 7920 dle practically │ │ │ -000bd310: 616e 7920 7261 7469 6f20 6f66 206f 7574 any ratio of out │ │ │ -000bd320: 6c69 6572 7320 6275 7420 6e65 6564 7320 liers but needs │ │ │ -000bd330: 6120 7468 7265 7368 6f6c 6420 746f 0a64 a threshold to.d │ │ │ -000bd340: 6973 7469 6e67 7569 7368 2069 6e6c 6965 istinguish inlie │ │ │ -000bd350: 7273 2066 726f 6d20 6f75 746c 6965 7273 rs from outliers │ │ │ -000bd360: 2e20 5468 6520 6d65 7468 6f64 204c 4d65 . The method LMe │ │ │ -000bd370: 4453 2064 6f65 7320 6e6f 7420 6e65 6564 DS does not need │ │ │ -000bd380: 2061 6e79 2074 6872 6573 686f 6c64 2062 any threshold b │ │ │ -000bd390: 7574 2077 6f72 6b73 0a63 6f72 7265 6374 ut works.correct │ │ │ -000bd3a0: 6c79 206f 6e6c 7920 7768 656e 2074 6865 ly only when the │ │ │ -000bd3b0: 7265 2061 7265 206d 6f72 6520 7468 616e re are more than │ │ │ -000bd3c0: 2035 3025 2069 6e6c 6965 7273 2e0a 0a53 50% inliers...S │ │ │ -000bd3d0: 4545 3a20 6573 7469 6d61 7465 4166 6669 EE: estimateAffi │ │ │ -000bd3e0: 6e65 3244 2c20 6573 7469 6d61 7465 4166 ne2D, estimateAf │ │ │ -000bd3f0: 6669 6e65 5061 7274 6961 6c32 442c 2067 finePartial2D, g │ │ │ -000bd400: 6574 4166 6669 6e65 5472 616e 7366 6f72 etAffineTransfor │ │ │ -000bd410: 6d3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 m
    .
    ..
    .< │ │ │ -000bd430: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    e │ │ │ -000bd4c0: 7374 696d 6174 6554 7261 6e73 6c61 7469 stimateTranslati │ │ │ -000bd4d0: 6f6e 3244 3c2f 6833 3e0a 3c64 6976 2063 on2D

    .
    .
    │ │ │ -000bd530: 7075 626c 6963 2073 7461 7469 633c 2f73 public static double[] estimateTran │ │ │ -000bd5a0: 736c 6174 696f 6e32 443c 2f73 7061 6e3e slation2D │ │ │ -000bd5b0: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ -000bd5d0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000bd5e0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000bd5f0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000bd600: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat from,. < │ │ │ -000bd620: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000bd630: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000bd640: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000bd650: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat to,. Mat │ │ │ -000bd6b0: 266e 6273 703b 696e 6c69 6572 732c 0a20  inliers,. │ │ │ -000bd6c0: 696e 7426 6e62 7370 3b6d 6574 686f 642c int method, │ │ │ -000bd6d0: 0a20 646f 7562 6c65 266e 6273 703b 7261 . double ra │ │ │ -000bd6e0: 6e73 6163 5265 7072 6f6a 5468 7265 7368 nsacReprojThresh │ │ │ -000bd6f0: 6f6c 642c 0a20 6c6f 6e67 266e 6273 703b old,. long  │ │ │ -000bd700: 6d61 7849 7465 7273 293c 2f73 7061 6e3e maxIters) │ │ │ -000bd710: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Comput │ │ │ -000bd730: 6573 2061 2070 7572 6520 3244 2074 7261 es a pure 2D tra │ │ │ -000bd740: 6e73 6c61 7469 6f6e 2062 6574 7765 656e nslation between │ │ │ -000bd750: 2074 776f 2032 4420 706f 696e 7420 7365 two 2D point se │ │ │ -000bd760: 7473 2e0a 0a49 7420 636f 6d70 7574 6573 ts...It computes │ │ │ -000bd770: 0a5c 280a 5c62 6567 696e 7b62 6d61 7472 .\(.\begin{bmatr │ │ │ -000bd780: 6978 7d0a 785c 5c0a 790a 5c65 6e64 7b62 ix}.x\\.y.\end{b │ │ │ -000bd790: 6d61 7472 6978 7d0a 3d0a 5c62 6567 696e matrix}.=.\begin │ │ │ -000bd7a0: 7b62 6d61 7472 6978 7d0a 3120 2661 6d70 {bmatrix}.1 & │ │ │ -000bd7b0: 3b20 305c 5c0a 3020 2661 6d70 3b20 310a ; 0\\.0 & 1. │ │ │ -000bd7c0: 5c65 6e64 7b62 6d61 7472 6978 7d0a 5c62 \end{bmatrix}.\b │ │ │ -000bd7d0: 6567 696e 7b62 6d61 7472 6978 7d0a 585c egin{bmatrix}.X\ │ │ │ -000bd7e0: 5c0a 590a 5c65 6e64 7b62 6d61 7472 6978 \.Y.\end{bmatrix │ │ │ -000bd7f0: 7d0a 2b0a 5c62 6567 696e 7b62 6d61 7472 }.+.\begin{bmatr │ │ │ -000bd800: 6978 7d0a 745f 785c 5c0a 745f 790a 5c65 ix}.t_x\\.t_y.\e │ │ │ -000bd810: 6e64 7b62 6d61 7472 6978 7d2e 0a5c 293c nd{bmatrix}..\)< │ │ │ -000bd820: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ -000bd840: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .from - First inpu │ │ │ -000bd870: 7420 3244 2070 6f69 6e74 2073 6574 2063 t 2D point set c │ │ │ -000bd880: 6f6e 7461 696e 696e 6720 5c28 2858 2c59 ontaining \((X,Y │ │ │ -000bd890: 295c 292e 3c2f 6464 3e0a 3c64 643e 3c63 )\)..
    to - │ │ │ -000bd8b0: 5365 636f 6e64 2069 6e70 7574 2032 4420 Second input 2D │ │ │ -000bd8c0: 706f 696e 7420 7365 7420 636f 6e74 6169 point set contai │ │ │ -000bd8d0: 6e69 6e67 205c 2828 782c 7929 5c29 2e3c ning \((x,y)\).< │ │ │ -000bd8e0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e69 /dd>.
    i │ │ │ -000bd8f0: 6e6c 6965 7273 3c2f 636f 6465 3e20 2d20 nliers - │ │ │ -000bd900: 4f75 7470 7574 2076 6563 746f 7220 696e Output vector in │ │ │ -000bd910: 6469 6361 7469 6e67 2077 6869 6368 2070 dicating which p │ │ │ -000bd920: 6f69 6e74 7320 6172 6520 696e 6c69 6572 oints are inlier │ │ │ -000bd930: 7320 2831 2d69 6e6c 6965 722c 2030 2d6f s (1-inlier, 0-o │ │ │ -000bd940: 7574 6c69 6572 292e 3c2f 6464 3e0a 3c64 utlier).
    .method - Robust m │ │ │ -000bd970: 6574 686f 6420 7573 6564 2074 6f20 636f ethod used to co │ │ │ -000bd980: 6d70 7574 6520 7468 6520 7472 616e 7366 mpute the transf │ │ │ -000bd990: 6f72 6d61 7469 6f6e 2e20 5468 6520 666f ormation. The fo │ │ │ -000bd9a0: 6c6c 6f77 696e 6720 6d65 7468 6f64 7320 llowing methods │ │ │ -000bd9b0: 6172 6520 706f 7373 6962 6c65 3a0a 3c75 are possible:..
  • . REF │ │ │ -000bd9d0: 3a20 5241 4e53 4143 202d 2052 414e 5341 : RANSAC - RANSA │ │ │ -000bd9e0: 432d 6261 7365 6420 726f 6275 7374 206d C-based robust m │ │ │ -000bd9f0: 6574 686f 640a 2020 3c2f 6c69 3e0a 2020 ethod.
  • . │ │ │ -000bda00: 3c6c 693e 0a20 2020 5245 463a 204c 4d45
  • . REF: LME │ │ │ -000bda10: 4453 202d 204c 6561 7374 2d4d 6564 6961 DS - Least-Media │ │ │ -000bda20: 6e20 726f 6275 7374 206d 6574 686f 640a n robust method. │ │ │ -000bda30: 5241 4e53 4143 2069 7320 7468 6520 6465 RANSAC is the de │ │ │ -000bda40: 6661 756c 7420 6d65 7468 6f64 2e0a 2020 fault method.. │ │ │ -000bda50: 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64 643e
  • . │ │ │ -000bda60: 0a3c 6464 3e3c 636f 6465 3e72 616e 7361 .
    ransa │ │ │ -000bda70: 6352 6570 726f 6a54 6872 6573 686f 6c64 cReprojThreshold │ │ │ -000bda80: 3c2f 636f 6465 3e20 2d20 4d61 7869 6d75 - Maximu │ │ │ -000bda90: 6d20 7265 7072 6f6a 6563 7469 6f6e 2065 m reprojection e │ │ │ -000bdaa0: 7272 6f72 2069 6e20 7468 6520 5241 4e53 rror in the RANS │ │ │ -000bdab0: 4143 2061 6c67 6f72 6974 686d 2074 6f20 AC algorithm to │ │ │ -000bdac0: 636f 6e73 6964 6572 0a61 2070 6f69 6e74 consider.a point │ │ │ -000bdad0: 2061 7320 616e 2069 6e6c 6965 722e 2041 as an inlier. A │ │ │ -000bdae0: 7070 6c69 6573 206f 6e6c 7920 746f 2052 pplies only to R │ │ │ -000bdaf0: 414e 5341 432e 3c2f 6464 3e0a 3c64 643e ANSAC.
    .
    │ │ │ -000bdb00: 3c63 6f64 653e 6d61 7849 7465 7273 3c2f maxIters - The maxi │ │ │ -000bdb20: 6d75 6d20 6e75 6d62 6572 206f 6620 726f mum number of ro │ │ │ -000bdb30: 6275 7374 206d 6574 686f 6420 6974 6572 bust method iter │ │ │ -000bdb40: 6174 696f 6e73 2e0a 6265 7477 6565 6e20 ations..between │ │ │ -000bdb50: 302e 3935 2061 6e64 2030 2e39 3920 6973 0.95 and 0.99 is │ │ │ -000bdb60: 2075 7375 616c 6c79 2067 6f6f 6420 656e usually good en │ │ │ -000bdb70: 6f75 6768 2e20 5661 6c75 6573 2074 6f6f ough. Values too │ │ │ -000bdb80: 2063 6c6f 7365 2074 6f20 3120 6361 6e20 close to 1 can │ │ │ -000bdb90: 736c 6f77 2064 6f77 6e20 7468 6520 6573 slow down the es │ │ │ -000bdba0: 7469 6d61 7469 6f6e 0a73 6967 6e69 6669 timation.signifi │ │ │ -000bdbb0: 6361 6e74 6c79 2e20 5661 6c75 6573 206c cantly. Values l │ │ │ -000bdbc0: 6f77 6572 2074 6861 6e20 302e 38e2 8093 ower than 0.8... │ │ │ -000bdbd0: 302e 3920 6361 6e20 7265 7375 6c74 2069 0.9 can result i │ │ │ -000bdbe0: 6e20 616e 2069 6e63 6f72 7265 6374 6c79 n an incorrectly │ │ │ -000bdbf0: 2065 7374 696d 6174 6564 2074 7261 6e73 estimated trans │ │ │ -000bdc00: 666f 726d 6174 696f 6e2e 0a74 6865 206c formation..the l │ │ │ -000bdc10: 6561 7374 2d73 7175 6172 6573 2073 6f6c east-squares sol │ │ │ -000bdc20: 7574 696f 6e20 6f6e 2069 6e6c 6965 7273 ution on inliers │ │ │ -000bdc30: 2069 7320 636c 6f73 6564 2d66 6f72 6d2c is closed-form, │ │ │ -000bdc40: 2073 6f20 7061 7373 696e 6720 3020 6973 so passing 0 is │ │ │ -000bdc50: 2072 6563 6f6d 6d65 6e64 6564 2028 6e6f recommended (no │ │ │ -000bdc60: 2061 6464 6974 696f 6e61 6c20 7265 6669 additional refi │ │ │ -000bdc70: 6e65 292e 3c2f 6464 3e0a 3c64 743e 5265 ne).
    .
    Re │ │ │ -000bdc80: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ -000bdc90: 4120 3244 2074 7261 6e73 6c61 7469 6f6e A 2D translation │ │ │ -000bdca0: 2076 6563 746f 7220 5c28 5b74 5f78 2c20 vector \([t_x, │ │ │ -000bdcb0: 745f 795d 5e54 5c29 2061 7320 3c63 6f64 t_y]^T\) as cv::Vec2d. If the trans │ │ │ -000bdce0: 6c61 7469 6f6e 2063 6f75 6c64 206e 6f74 lation could not │ │ │ -000bdcf0: 2062 650a 6573 7469 6d61 7465 642c 2062 be.estimated, b │ │ │ -000bdd00: 6f74 6820 636f 6d70 6f6e 656e 7473 2061 oth components a │ │ │ -000bdd10: 7265 2073 6574 2074 6f20 4e61 4e20 616e re set to NaN an │ │ │ -000bdd20: 642c 2069 6620 3c63 6f64 653e 696e 6c69 d, if inli │ │ │ -000bdd30: 6572 733c 2f63 6f64 653e 2069 7320 7072 ers is pr │ │ │ -000bdd40: 6f76 6964 6564 2c20 7468 6520 6d61 736b ovided, the mask │ │ │ -000bdd50: 2069 7320 6669 6c6c 6564 2077 6974 6820 is filled with │ │ │ -000bdd60: 7a65 726f 732e 0a0a 5c70 6172 2043 6f6e zeros...\par Con │ │ │ -000bdd70: 7665 7274 696e 6720 746f 2061 2032 7833 verting to a 2x3 │ │ │ -000bdd80: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ -000bdd90: 6d61 7472 6978 3a0a 5c28 0a5c 6265 6769 matrix:.\(.\begi │ │ │ -000bdda0: 6e7b 626d 6174 7269 787d 0a31 2026 616d n{bmatrix}.1 &am │ │ │ -000bddb0: 703b 2030 2026 616d 703b 2074 5f78 5c5c p; 0 & t_x\\ │ │ │ -000bddc0: 0a30 2026 616d 703b 2031 2026 616d 703b .0 & 1 & │ │ │ -000bddd0: 2074 5f79 0a5c 656e 647b 626d 6174 7269 t_y.\end{bmatri │ │ │ -000bdde0: 787d 0a5c 290a 0a3c 636f 6465 3e0a 6376 x}.\)...cv │ │ │ -000bddf0: 3a3a 5665 6332 6420 7420 3d20 6376 3a3a ::Vec2d t = cv:: │ │ │ -000bde00: 6573 7469 6d61 7465 5472 616e 736c 6174 estimateTranslat │ │ │ -000bde10: 696f 6e32 4428 6672 6f6d 2c20 746f 2c20 ion2D(from, to, │ │ │ -000bde20: 696e 6c69 6572 7329 3b0a 6376 3a3a 4d61 inliers);.cv::Ma │ │ │ -000bde30: 7420 5420 3d20 2863 763a 3a4d 6174 5f26 t T = (cv::Mat_& │ │ │ -000bde40: 6c74 3b64 6f75 626c 6526 6774 3b28 322c lt;double>(2, │ │ │ -000bde50: 3329 2026 6c74 3b26 6c74 3b20 312c 302c 3) << 1,0, │ │ │ -000bde60: 745b 305d 2c20 302c 312c 745b 315d 293b t[0], 0,1,t[1]); │ │ │ -000bde70: 0a3c 2f63 6f64 653e 0a0a 5468 6520 6675 ...The fu │ │ │ -000bde80: 6e63 7469 6f6e 2065 7374 696d 6174 6573 nction estimates │ │ │ -000bde90: 2061 2070 7572 6520 3244 2074 7261 6e73 a pure 2D trans │ │ │ -000bdea0: 6c61 7469 6f6e 2062 6574 7765 656e 2074 lation between t │ │ │ -000bdeb0: 776f 2032 4420 706f 696e 7420 7365 7473 wo 2D point sets │ │ │ -000bdec0: 2075 7369 6e67 2074 6865 2073 656c 6563 using the selec │ │ │ -000bded0: 7465 6420 726f 6275 7374 0a61 6c67 6f72 ted robust.algor │ │ │ -000bdee0: 6974 686d 2e20 496e 6c69 6572 7320 6172 ithm. Inliers ar │ │ │ -000bdef0: 6520 6465 7465 726d 696e 6564 2062 7920 e determined by │ │ │ -000bdf00: 7468 6520 7265 7072 6f6a 6563 7469 6f6e the reprojection │ │ │ -000bdf10: 2065 7272 6f72 2074 6872 6573 686f 6c64 error threshold │ │ │ -000bdf20: 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a ...Note:. │ │ │ -000bdf30: 5468 6520 5241 4e53 4143 206d 6574 686f The RANSAC metho │ │ │ -000bdf40: 6420 6361 6e20 6861 6e64 6c65 2070 7261 d can handle pra │ │ │ -000bdf50: 6374 6963 616c 6c79 2061 6e79 2072 6174 ctically any rat │ │ │ -000bdf60: 696f 206f 6620 6f75 746c 6965 7273 2062 io of outliers b │ │ │ -000bdf70: 7574 206e 6565 6473 2061 2074 6872 6573 ut needs a thres │ │ │ -000bdf80: 686f 6c64 2074 6f0a 6469 7374 696e 6775 hold to.distingu │ │ │ -000bdf90: 6973 6820 696e 6c69 6572 7320 6672 6f6d ish inliers from │ │ │ -000bdfa0: 206f 7574 6c69 6572 732e 2054 6865 206d outliers. The m │ │ │ -000bdfb0: 6574 686f 6420 4c4d 6544 5320 646f 6573 ethod LMeDS does │ │ │ -000bdfc0: 206e 6f74 206e 6565 6420 616e 7920 7468 not need any th │ │ │ -000bdfd0: 7265 7368 6f6c 6420 6275 7420 776f 726b reshold but work │ │ │ -000bdfe0: 730a 636f 7272 6563 746c 7920 6f6e 6c79 s.correctly only │ │ │ -000bdff0: 2077 6865 6e20 7468 6572 6520 6172 6520 when there are │ │ │ -000be000: 6d6f 7265 2074 6861 6e20 3530 2520 696e more than 50% in │ │ │ -000be010: 6c69 6572 732e 0a0a 5345 453a 2065 7374 liers...SEE: est │ │ │ -000be020: 696d 6174 6541 6666 696e 6532 442c 2065 imateAffine2D, e │ │ │ -000be030: 7374 696d 6174 6541 6666 696e 6550 6172 stimateAffinePar │ │ │ -000be040: 7469 616c 3244 2c20 6765 7441 6666 696e tial2D, getAffin │ │ │ -000be050: 6554 7261 6e73 666f 726d 3c2f 6464 3e0a eTransform
    . │ │ │ -000be060: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    .
    .
  • ..
    .< │ │ │ -000be100: 6833 3e65 7374 696d 6174 6554 7261 6e73 h3>estimateTrans │ │ │ -000be110: 6c61 7469 6f6e 3244 3c2f 6833 3e0a 3c64 lation2D..public stati │ │ │ -000be180: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c double[] │ │ │ -000be1b0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  estimate │ │ │ -000be1e0: 5472 616e 736c 6174 696f 6e32 443c 2f73 Translation2D(M │ │ │ -000be250: 6174 3c2f 613e 266e 6273 703b 6672 6f6d at from │ │ │ -000be260: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000be2a0: 6174 3c2f 613e 266e 6273 703b 746f 2c0a at to,. │ │ │ -000be2b0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000be2f0: 3c2f 613e 266e 6273 703b 696e 6c69 6572  inlier │ │ │ -000be300: 732c 0a20 696e 7426 6e62 7370 3b6d 6574 s,. int met │ │ │ -000be310: 686f 642c 0a20 646f 7562 6c65 266e 6273 hod,. double&nbs │ │ │ -000be320: 703b 7261 6e73 6163 5265 7072 6f6a 5468 p;ransacReprojTh │ │ │ -000be330: 7265 7368 6f6c 6429 3c2f 7370 616e 3e3c reshold)< │ │ │ -000be340: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Compute │ │ │ -000be360: 7320 6120 7075 7265 2032 4420 7472 616e s a pure 2D tran │ │ │ -000be370: 736c 6174 696f 6e20 6265 7477 6565 6e20 slation between │ │ │ -000be380: 7477 6f20 3244 2070 6f69 6e74 2073 6574 two 2D point set │ │ │ -000be390: 732e 0a0a 4974 2063 6f6d 7075 7465 730a s...It computes. │ │ │ -000be3a0: 5c28 0a5c 6265 6769 6e7b 626d 6174 7269 \(.\begin{bmatri │ │ │ -000be3b0: 787d 0a78 5c5c 0a79 0a5c 656e 647b 626d x}.x\\.y.\end{bm │ │ │ -000be3c0: 6174 7269 787d 0a3d 0a5c 6265 6769 6e7b atrix}.=.\begin{ │ │ │ -000be3d0: 626d 6174 7269 787d 0a31 2026 616d 703b bmatrix}.1 & │ │ │ -000be3e0: 2030 5c5c 0a30 2026 616d 703b 2031 0a5c 0\\.0 & 1.\ │ │ │ -000be3f0: 656e 647b 626d 6174 7269 787d 0a5c 6265 end{bmatrix}.\be │ │ │ -000be400: 6769 6e7b 626d 6174 7269 787d 0a58 5c5c gin{bmatrix}.X\\ │ │ │ -000be410: 0a59 0a5c 656e 647b 626d 6174 7269 787d .Y.\end{bmatrix} │ │ │ -000be420: 0a2b 0a5c 6265 6769 6e7b 626d 6174 7269 .+.\begin{bmatri │ │ │ -000be430: 787d 0a74 5f78 5c5c 0a74 5f79 0a5c 656e x}.t_x\\.t_y.\en │ │ │ -000be440: 647b 626d 6174 7269 787d 2e0a 5c29 3c2f d{bmatrix}..\).
    .
    Para │ │ │ -000be470: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    from - First input │ │ │ -000be4a0: 2032 4420 706f 696e 7420 7365 7420 636f 2D point set co │ │ │ -000be4b0: 6e74 6169 6e69 6e67 205c 2828 582c 5929 ntaining \((X,Y) │ │ │ -000be4c0: 5c29 2e3c 2f64 643e 0a3c 6464 3e3c 636f \).
    .
    to - S │ │ │ -000be4e0: 6563 6f6e 6420 696e 7075 7420 3244 2070 econd input 2D p │ │ │ -000be4f0: 6f69 6e74 2073 6574 2063 6f6e 7461 696e oint set contain │ │ │ -000be500: 696e 6720 5c28 2878 2c79 295c 292e 3c2f ing \((x,y)\)..
    in │ │ │ -000be520: 6c69 6572 733c 2f63 6f64 653e 202d 204f liers - O │ │ │ -000be530: 7574 7075 7420 7665 6374 6f72 2069 6e64 utput vector ind │ │ │ -000be540: 6963 6174 696e 6720 7768 6963 6820 706f icating which po │ │ │ -000be550: 696e 7473 2061 7265 2069 6e6c 6965 7273 ints are inliers │ │ │ -000be560: 2028 312d 696e 6c69 6572 2c20 302d 6f75 (1-inlier, 0-ou │ │ │ -000be570: 746c 6965 7229 2e3c 2f64 643e 0a3c 6464 tlier).
    .
    method - Robust me │ │ │ -000be5a0: 7468 6f64 2075 7365 6420 746f 2063 6f6d thod used to com │ │ │ -000be5b0: 7075 7465 2074 6865 2074 7261 6e73 666f pute the transfo │ │ │ -000be5c0: 726d 6174 696f 6e2e 2054 6865 2066 6f6c rmation. The fol │ │ │ -000be5d0: 6c6f 7769 6e67 206d 6574 686f 6473 2061 lowing methods a │ │ │ -000be5e0: 7265 2070 6f73 7369 626c 653a 0a3c 756c re possible:.
      .
    • . REF: │ │ │ -000be600: 2052 414e 5341 4320 2d20 5241 4e53 4143 RANSAC - RANSAC │ │ │ -000be610: 2d62 6173 6564 2072 6f62 7573 7420 6d65 -based robust me │ │ │ -000be620: 7468 6f64 0a20 203c 2f6c 693e 0a20 203c thod.
    • . < │ │ │ -000be630: 6c69 3e0a 2020 2052 4546 3a20 4c4d 4544 li>. REF: LMED │ │ │ -000be640: 5320 2d20 4c65 6173 742d 4d65 6469 616e S - Least-Median │ │ │ -000be650: 2072 6f62 7573 7420 6d65 7468 6f64 0a52 robust method.R │ │ │ -000be660: 414e 5341 4320 6973 2074 6865 2064 6566 ANSAC is the def │ │ │ -000be670: 6175 6c74 206d 6574 686f 642e 0a20 203c ault method.. < │ │ │ -000be680: 2f6c 693e 0a3c 2f75 6c3e 3c2f 6464 3e0a /li>.
    . │ │ │ -000be690: 3c64 643e 3c63 6f64 653e 7261 6e73 6163
    ransac │ │ │ -000be6a0: 5265 7072 6f6a 5468 7265 7368 6f6c 643c ReprojThreshold< │ │ │ -000be6b0: 2f63 6f64 653e 202d 204d 6178 696d 756d /code> - Maximum │ │ │ -000be6c0: 2072 6570 726f 6a65 6374 696f 6e20 6572 reprojection er │ │ │ -000be6d0: 726f 7220 696e 2074 6865 2052 414e 5341 ror in the RANSA │ │ │ -000be6e0: 4320 616c 676f 7269 7468 6d20 746f 2063 C algorithm to c │ │ │ -000be6f0: 6f6e 7369 6465 720a 6120 706f 696e 7420 onsider.a point │ │ │ -000be700: 6173 2061 6e20 696e 6c69 6572 2e20 4170 as an inlier. Ap │ │ │ -000be710: 706c 6965 7320 6f6e 6c79 2074 6f20 5241 plies only to RA │ │ │ -000be720: 4e53 4143 2e0a 6265 7477 6565 6e20 302e NSAC..between 0. │ │ │ -000be730: 3935 2061 6e64 2030 2e39 3920 6973 2075 95 and 0.99 is u │ │ │ -000be740: 7375 616c 6c79 2067 6f6f 6420 656e 6f75 sually good enou │ │ │ -000be750: 6768 2e20 5661 6c75 6573 2074 6f6f 2063 gh. Values too c │ │ │ -000be760: 6c6f 7365 2074 6f20 3120 6361 6e20 736c lose to 1 can sl │ │ │ -000be770: 6f77 2064 6f77 6e20 7468 6520 6573 7469 ow down the esti │ │ │ -000be780: 6d61 7469 6f6e 0a73 6967 6e69 6669 6361 mation.significa │ │ │ -000be790: 6e74 6c79 2e20 5661 6c75 6573 206c 6f77 ntly. Values low │ │ │ -000be7a0: 6572 2074 6861 6e20 302e 38e2 8093 302e er than 0.8...0. │ │ │ -000be7b0: 3920 6361 6e20 7265 7375 6c74 2069 6e20 9 can result in │ │ │ -000be7c0: 616e 2069 6e63 6f72 7265 6374 6c79 2065 an incorrectly e │ │ │ -000be7d0: 7374 696d 6174 6564 2074 7261 6e73 666f stimated transfo │ │ │ -000be7e0: 726d 6174 696f 6e2e 0a74 6865 206c 6561 rmation..the lea │ │ │ -000be7f0: 7374 2d73 7175 6172 6573 2073 6f6c 7574 st-squares solut │ │ │ -000be800: 696f 6e20 6f6e 2069 6e6c 6965 7273 2069 ion on inliers i │ │ │ -000be810: 7320 636c 6f73 6564 2d66 6f72 6d2c 2073 s closed-form, s │ │ │ -000be820: 6f20 7061 7373 696e 6720 3020 6973 2072 o passing 0 is r │ │ │ -000be830: 6563 6f6d 6d65 6e64 6564 2028 6e6f 2061 ecommended (no a │ │ │ -000be840: 6464 6974 696f 6e61 6c20 7265 6669 6e65 dditional refine │ │ │ -000be850: 292e 3c2f 6464 3e0a 3c64 743e 5265 7475 ).
    .
    Retu │ │ │ -000be860: 726e 733a 3c2f 6474 3e0a 3c64 643e 4120 rns:
    .
    A │ │ │ -000be870: 3244 2074 7261 6e73 6c61 7469 6f6e 2076 2D translation v │ │ │ -000be880: 6563 746f 7220 5c28 5b74 5f78 2c20 745f ector \([t_x, t_ │ │ │ -000be890: 795d 5e54 5c29 2061 7320 3c63 6f64 653e y]^T\) as │ │ │ -000be8a0: 6376 3a3a 5665 6332 643c 2f63 6f64 653e cv::Vec2d │ │ │ -000be8b0: 2e20 4966 2074 6865 2074 7261 6e73 6c61 . If the transla │ │ │ -000be8c0: 7469 6f6e 2063 6f75 6c64 206e 6f74 2062 tion could not b │ │ │ -000be8d0: 650a 6573 7469 6d61 7465 642c 2062 6f74 e.estimated, bot │ │ │ -000be8e0: 6820 636f 6d70 6f6e 656e 7473 2061 7265 h components are │ │ │ -000be8f0: 2073 6574 2074 6f20 4e61 4e20 616e 642c set to NaN and, │ │ │ -000be900: 2069 6620 3c63 6f64 653e 696e 6c69 6572 if inlier │ │ │ -000be910: 733c 2f63 6f64 653e 2069 7320 7072 6f76 s is prov │ │ │ -000be920: 6964 6564 2c20 7468 6520 6d61 736b 2069 ided, the mask i │ │ │ -000be930: 7320 6669 6c6c 6564 2077 6974 6820 7a65 s filled with ze │ │ │ -000be940: 726f 732e 0a0a 5c70 6172 2043 6f6e 7665 ros...\par Conve │ │ │ -000be950: 7274 696e 6720 746f 2061 2032 7833 2074 rting to a 2x3 t │ │ │ -000be960: 7261 6e73 666f 726d 6174 696f 6e20 6d61 ransformation ma │ │ │ -000be970: 7472 6978 3a0a 5c28 0a5c 6265 6769 6e7b trix:.\(.\begin{ │ │ │ -000be980: 626d 6174 7269 787d 0a31 2026 616d 703b bmatrix}.1 & │ │ │ -000be990: 2030 2026 616d 703b 2074 5f78 5c5c 0a30 0 & t_x\\.0 │ │ │ -000be9a0: 2026 616d 703b 2031 2026 616d 703b 2074 & 1 & t │ │ │ -000be9b0: 5f79 0a5c 656e 647b 626d 6174 7269 787d _y.\end{bmatrix} │ │ │ -000be9c0: 0a5c 290a 0a3c 636f 6465 3e0a 6376 3a3a .\)...cv:: │ │ │ -000be9d0: 5665 6332 6420 7420 3d20 6376 3a3a 6573 Vec2d t = cv::es │ │ │ -000be9e0: 7469 6d61 7465 5472 616e 736c 6174 696f timateTranslatio │ │ │ -000be9f0: 6e32 4428 6672 6f6d 2c20 746f 2c20 696e n2D(from, to, in │ │ │ -000bea00: 6c69 6572 7329 3b0a 6376 3a3a 4d61 7420 liers);.cv::Mat │ │ │ -000bea10: 5420 3d20 2863 763a 3a4d 6174 5f26 6c74 T = (cv::Mat_< │ │ │ -000bea20: 3b64 6f75 626c 6526 6774 3b28 322c 3329 ;double>(2,3) │ │ │ -000bea30: 2026 6c74 3b26 6c74 3b20 312c 302c 745b << 1,0,t[ │ │ │ -000bea40: 305d 2c20 302c 312c 745b 315d 293b 0a3c 0], 0,1,t[1]);.< │ │ │ -000bea50: 2f63 6f64 653e 0a0a 5468 6520 6675 6e63 /code>..The func │ │ │ -000bea60: 7469 6f6e 2065 7374 696d 6174 6573 2061 tion estimates a │ │ │ -000bea70: 2070 7572 6520 3244 2074 7261 6e73 6c61 pure 2D transla │ │ │ -000bea80: 7469 6f6e 2062 6574 7765 656e 2074 776f tion between two │ │ │ -000bea90: 2032 4420 706f 696e 7420 7365 7473 2075 2D point sets u │ │ │ -000beaa0: 7369 6e67 2074 6865 2073 656c 6563 7465 sing the selecte │ │ │ -000beab0: 6420 726f 6275 7374 0a61 6c67 6f72 6974 d robust.algorit │ │ │ -000beac0: 686d 2e20 496e 6c69 6572 7320 6172 6520 hm. Inliers are │ │ │ -000bead0: 6465 7465 726d 696e 6564 2062 7920 7468 determined by th │ │ │ -000beae0: 6520 7265 7072 6f6a 6563 7469 6f6e 2065 e reprojection e │ │ │ -000beaf0: 7272 6f72 2074 6872 6573 686f 6c64 2e0a rror threshold.. │ │ │ -000beb00: 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a 5468 .Note:.Th │ │ │ -000beb10: 6520 5241 4e53 4143 206d 6574 686f 6420 e RANSAC method │ │ │ -000beb20: 6361 6e20 6861 6e64 6c65 2070 7261 6374 can handle pract │ │ │ -000beb30: 6963 616c 6c79 2061 6e79 2072 6174 696f ically any ratio │ │ │ -000beb40: 206f 6620 6f75 746c 6965 7273 2062 7574 of outliers but │ │ │ -000beb50: 206e 6565 6473 2061 2074 6872 6573 686f needs a thresho │ │ │ -000beb60: 6c64 2074 6f0a 6469 7374 696e 6775 6973 ld to.distinguis │ │ │ -000beb70: 6820 696e 6c69 6572 7320 6672 6f6d 206f h inliers from o │ │ │ -000beb80: 7574 6c69 6572 732e 2054 6865 206d 6574 utliers. The met │ │ │ -000beb90: 686f 6420 4c4d 6544 5320 646f 6573 206e hod LMeDS does n │ │ │ -000beba0: 6f74 206e 6565 6420 616e 7920 7468 7265 ot need any thre │ │ │ -000bebb0: 7368 6f6c 6420 6275 7420 776f 726b 730a shold but works. │ │ │ -000bebc0: 636f 7272 6563 746c 7920 6f6e 6c79 2077 correctly only w │ │ │ -000bebd0: 6865 6e20 7468 6572 6520 6172 6520 6d6f hen there are mo │ │ │ -000bebe0: 7265 2074 6861 6e20 3530 2520 696e 6c69 re than 50% inli │ │ │ -000bebf0: 6572 732e 0a0a 5345 453a 2065 7374 696d ers...SEE: estim │ │ │ -000bec00: 6174 6541 6666 696e 6532 442c 2065 7374 ateAffine2D, est │ │ │ -000bec10: 696d 6174 6541 6666 696e 6550 6172 7469 imateAffineParti │ │ │ -000bec20: 616c 3244 2c20 6765 7441 6666 696e 6554 al2D, getAffineT │ │ │ -000bec30: 7261 6e73 666f 726d 3c2f 6464 3e0a 3c2f ransform
    ..
    ...
  • │ │ │ -000bec60: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    estima │ │ │ -000bece0: 7465 5472 616e 736c 6174 696f 6e32 443c teTranslation2D< │ │ │ -000becf0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -000bed50: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -000bed60: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;d │ │ │ -000bed80: 6f75 626c 655b 5d3c 2f73 7061 6e3e 266e ouble[]&n │ │ │ -000bed90: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;e │ │ │ -000bedb0: 7374 696d 6174 6554 7261 6e73 6c61 7469 stimateTranslati │ │ │ -000bedc0: 6f6e 3244 3c2f 7370 616e 3e3c 7762 723e on2D │ │ │ -000bedd0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ -000bee30: 7370 3b66 726f 6d2c 0a20 3c61 2068 7265 sp;from,. Mat&nb │ │ │ -000bee80: 7370 3b74 6f2c 0a20 3c61 2068 7265 663d sp;to,. Mat  │ │ │ -000beed0: 3b69 6e6c 6965 7273 2c0a 2069 6e74 266e ;inliers,. int&n │ │ │ -000beee0: 6273 703b 6d65 7468 6f64 293c 2f73 7061 bsp;method)
    .
    Comp │ │ │ -000bef10: 7574 6573 2061 2070 7572 6520 3244 2074 utes a pure 2D t │ │ │ -000bef20: 7261 6e73 6c61 7469 6f6e 2062 6574 7765 ranslation betwe │ │ │ -000bef30: 656e 2074 776f 2032 4420 706f 696e 7420 en two 2D point │ │ │ -000bef40: 7365 7473 2e0a 0a49 7420 636f 6d70 7574 sets...It comput │ │ │ -000bef50: 6573 0a5c 280a 5c62 6567 696e 7b62 6d61 es.\(.\begin{bma │ │ │ -000bef60: 7472 6978 7d0a 785c 5c0a 790a 5c65 6e64 trix}.x\\.y.\end │ │ │ -000bef70: 7b62 6d61 7472 6978 7d0a 3d0a 5c62 6567 {bmatrix}.=.\beg │ │ │ -000bef80: 696e 7b62 6d61 7472 6978 7d0a 3120 2661 in{bmatrix}.1 &a │ │ │ -000bef90: 6d70 3b20 305c 5c0a 3020 2661 6d70 3b20 mp; 0\\.0 & │ │ │ -000befa0: 310a 5c65 6e64 7b62 6d61 7472 6978 7d0a 1.\end{bmatrix}. │ │ │ -000befb0: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ -000befc0: 585c 5c0a 590a 5c65 6e64 7b62 6d61 7472 X\\.Y.\end{bmatr │ │ │ -000befd0: 6978 7d0a 2b0a 5c62 6567 696e 7b62 6d61 ix}.+.\begin{bma │ │ │ -000befe0: 7472 6978 7d0a 745f 785c 5c0a 745f 790a trix}.t_x\\.t_y. │ │ │ -000beff0: 5c65 6e64 7b62 6d61 7472 6978 7d2e 0a5c \end{bmatrix}..\ │ │ │ -000bf000: 293c 2f64 6976 3e0a 3c64 6c20 636c 6173 )
    .
    .
    P │ │ │ -000bf020: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ -000bf030: 3c64 643e 3c63 6f64 653e 6672 6f6d 3c2f
    from - First in │ │ │ -000bf050: 7075 7420 3244 2070 6f69 6e74 2073 6574 put 2D point set │ │ │ -000bf060: 2063 6f6e 7461 696e 696e 6720 5c28 2858 containing \((X │ │ │ -000bf070: 2c59 295c 292e 3c2f 6464 3e0a 3c64 643e ,Y)\).
    .
    │ │ │ -000bf080: 3c63 6f64 653e 746f 3c2f 636f 6465 3e20 to │ │ │ -000bf090: 2d20 5365 636f 6e64 2069 6e70 7574 2032 - Second input 2 │ │ │ -000bf0a0: 4420 706f 696e 7420 7365 7420 636f 6e74 D point set cont │ │ │ -000bf0b0: 6169 6e69 6e67 205c 2828 782c 7929 5c29 aining \((x,y)\) │ │ │ -000bf0c0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    inliers │ │ │ -000bf0e0: 2d20 4f75 7470 7574 2076 6563 746f 7220 - Output vector │ │ │ -000bf0f0: 696e 6469 6361 7469 6e67 2077 6869 6368 indicating which │ │ │ -000bf100: 2070 6f69 6e74 7320 6172 6520 696e 6c69 points are inli │ │ │ -000bf110: 6572 7320 2831 2d69 6e6c 6965 722c 2030 ers (1-inlier, 0 │ │ │ -000bf120: 2d6f 7574 6c69 6572 292e 3c2f 6464 3e0a -outlier).
    . │ │ │ -000bf130: 3c64 643e 3c63 6f64 653e 6d65 7468 6f64
    method │ │ │ -000bf140: 3c2f 636f 6465 3e20 2d20 526f 6275 7374 - Robust │ │ │ -000bf150: 206d 6574 686f 6420 7573 6564 2074 6f20 method used to │ │ │ -000bf160: 636f 6d70 7574 6520 7468 6520 7472 616e compute the tran │ │ │ -000bf170: 7366 6f72 6d61 7469 6f6e 2e20 5468 6520 sformation. The │ │ │ -000bf180: 666f 6c6c 6f77 696e 6720 6d65 7468 6f64 following method │ │ │ -000bf190: 7320 6172 6520 706f 7373 6962 6c65 3a0a s are possible:. │ │ │ -000bf1a0: 3c75 6c3e 0a20 203c 6c69 3e0a 2020 2052
      .
    • . R │ │ │ -000bf1b0: 4546 3a20 5241 4e53 4143 202d 2052 414e EF: RANSAC - RAN │ │ │ -000bf1c0: 5341 432d 6261 7365 6420 726f 6275 7374 SAC-based robust │ │ │ -000bf1d0: 206d 6574 686f 640a 2020 3c2f 6c69 3e0a method.
    • . │ │ │ -000bf1e0: 2020 3c6c 693e 0a20 2020 5245 463a 204c
    • . REF: L │ │ │ -000bf1f0: 4d45 4453 202d 204c 6561 7374 2d4d 6564 MEDS - Least-Med │ │ │ -000bf200: 6961 6e20 726f 6275 7374 206d 6574 686f ian robust metho │ │ │ -000bf210: 640a 5241 4e53 4143 2069 7320 7468 6520 d.RANSAC is the │ │ │ -000bf220: 6465 6661 756c 7420 6d65 7468 6f64 2e0a default method.. │ │ │ -000bf230: 2020 3c2f 6c69 3e0a 3c2f 756c 3e0a 6120
    • .
    .a │ │ │ -000bf240: 706f 696e 7420 6173 2061 6e20 696e 6c69 point as an inli │ │ │ -000bf250: 6572 2e20 4170 706c 6965 7320 6f6e 6c79 er. Applies only │ │ │ -000bf260: 2074 6f20 5241 4e53 4143 2e0a 6265 7477 to RANSAC..betw │ │ │ -000bf270: 6565 6e20 302e 3935 2061 6e64 2030 2e39 een 0.95 and 0.9 │ │ │ -000bf280: 3920 6973 2075 7375 616c 6c79 2067 6f6f 9 is usually goo │ │ │ -000bf290: 6420 656e 6f75 6768 2e20 5661 6c75 6573 d enough. Values │ │ │ -000bf2a0: 2074 6f6f 2063 6c6f 7365 2074 6f20 3120 too close to 1 │ │ │ -000bf2b0: 6361 6e20 736c 6f77 2064 6f77 6e20 7468 can slow down th │ │ │ -000bf2c0: 6520 6573 7469 6d61 7469 6f6e 0a73 6967 e estimation.sig │ │ │ -000bf2d0: 6e69 6669 6361 6e74 6c79 2e20 5661 6c75 nificantly. Valu │ │ │ -000bf2e0: 6573 206c 6f77 6572 2074 6861 6e20 302e es lower than 0. │ │ │ -000bf2f0: 38e2 8093 302e 3920 6361 6e20 7265 7375 8...0.9 can resu │ │ │ -000bf300: 6c74 2069 6e20 616e 2069 6e63 6f72 7265 lt in an incorre │ │ │ -000bf310: 6374 6c79 2065 7374 696d 6174 6564 2074 ctly estimated t │ │ │ -000bf320: 7261 6e73 666f 726d 6174 696f 6e2e 0a74 ransformation..t │ │ │ -000bf330: 6865 206c 6561 7374 2d73 7175 6172 6573 he least-squares │ │ │ -000bf340: 2073 6f6c 7574 696f 6e20 6f6e 2069 6e6c solution on inl │ │ │ -000bf350: 6965 7273 2069 7320 636c 6f73 6564 2d66 iers is closed-f │ │ │ -000bf360: 6f72 6d2c 2073 6f20 7061 7373 696e 6720 orm, so passing │ │ │ -000bf370: 3020 6973 2072 6563 6f6d 6d65 6e64 6564 0 is recommended │ │ │ -000bf380: 2028 6e6f 2061 6464 6974 696f 6e61 6c20 (no additional │ │ │ -000bf390: 7265 6669 6e65 292e 3c2f 6464 3e0a 3c64 refine).
    .Returns:. │ │ │ -000bf3b0: 3c64 643e 4120 3244 2074 7261 6e73 6c61
    A 2D transla │ │ │ -000bf3c0: 7469 6f6e 2076 6563 746f 7220 5c28 5b74 tion vector \([t │ │ │ -000bf3d0: 5f78 2c20 745f 795d 5e54 5c29 2061 7320 _x, t_y]^T\) as │ │ │ -000bf3e0: 3c63 6f64 653e 6376 3a3a 5665 6332 643c cv::Vec2d< │ │ │ -000bf3f0: 2f63 6f64 653e 2e20 4966 2074 6865 2074 /code>. If the t │ │ │ -000bf400: 7261 6e73 6c61 7469 6f6e 2063 6f75 6c64 ranslation could │ │ │ -000bf410: 206e 6f74 2062 650a 6573 7469 6d61 7465 not be.estimate │ │ │ -000bf420: 642c 2062 6f74 6820 636f 6d70 6f6e 656e d, both componen │ │ │ -000bf430: 7473 2061 7265 2073 6574 2074 6f20 4e61 ts are set to Na │ │ │ -000bf440: 4e20 616e 642c 2069 6620 3c63 6f64 653e N and, if │ │ │ -000bf450: 696e 6c69 6572 733c 2f63 6f64 653e 2069 inliers i │ │ │ -000bf460: 7320 7072 6f76 6964 6564 2c20 7468 6520 s provided, the │ │ │ -000bf470: 6d61 736b 2069 7320 6669 6c6c 6564 2077 mask is filled w │ │ │ -000bf480: 6974 6820 7a65 726f 732e 0a0a 5c70 6172 ith zeros...\par │ │ │ -000bf490: 2043 6f6e 7665 7274 696e 6720 746f 2061 Converting to a │ │ │ -000bf4a0: 2032 7833 2074 7261 6e73 666f 726d 6174 2x3 transformat │ │ │ -000bf4b0: 696f 6e20 6d61 7472 6978 3a0a 5c28 0a5c ion matrix:.\(.\ │ │ │ -000bf4c0: 6265 6769 6e7b 626d 6174 7269 787d 0a31 begin{bmatrix}.1 │ │ │ -000bf4d0: 2026 616d 703b 2030 2026 616d 703b 2074 & 0 & t │ │ │ -000bf4e0: 5f78 5c5c 0a30 2026 616d 703b 2031 2026 _x\\.0 & 1 & │ │ │ -000bf4f0: 616d 703b 2074 5f79 0a5c 656e 647b 626d amp; t_y.\end{bm │ │ │ -000bf500: 6174 7269 787d 0a5c 290a 0a3c 636f 6465 atrix}.\)...cv::Vec2d t = │ │ │ -000bf520: 6376 3a3a 6573 7469 6d61 7465 5472 616e cv::estimateTran │ │ │ -000bf530: 736c 6174 696f 6e32 4428 6672 6f6d 2c20 slation2D(from, │ │ │ -000bf540: 746f 2c20 696e 6c69 6572 7329 3b0a 6376 to, inliers);.cv │ │ │ -000bf550: 3a3a 4d61 7420 5420 3d20 2863 763a 3a4d ::Mat T = (cv::M │ │ │ -000bf560: 6174 5f26 6c74 3b64 6f75 626c 6526 6774 at_<double> │ │ │ -000bf570: 3b28 322c 3329 2026 6c74 3b26 6c74 3b20 ;(2,3) << │ │ │ -000bf580: 312c 302c 745b 305d 2c20 302c 312c 745b 1,0,t[0], 0,1,t[ │ │ │ -000bf590: 315d 293b 0a3c 2f63 6f64 653e 0a0a 5468 1]);...Th │ │ │ -000bf5a0: 6520 6675 6e63 7469 6f6e 2065 7374 696d e function estim │ │ │ -000bf5b0: 6174 6573 2061 2070 7572 6520 3244 2074 ates a pure 2D t │ │ │ -000bf5c0: 7261 6e73 6c61 7469 6f6e 2062 6574 7765 ranslation betwe │ │ │ -000bf5d0: 656e 2074 776f 2032 4420 706f 696e 7420 en two 2D point │ │ │ -000bf5e0: 7365 7473 2075 7369 6e67 2074 6865 2073 sets using the s │ │ │ -000bf5f0: 656c 6563 7465 6420 726f 6275 7374 0a61 elected robust.a │ │ │ -000bf600: 6c67 6f72 6974 686d 2e20 496e 6c69 6572 lgorithm. Inlier │ │ │ -000bf610: 7320 6172 6520 6465 7465 726d 696e 6564 s are determined │ │ │ -000bf620: 2062 7920 7468 6520 7265 7072 6f6a 6563 by the reprojec │ │ │ -000bf630: 7469 6f6e 2065 7272 6f72 2074 6872 6573 tion error thres │ │ │ -000bf640: 686f 6c64 2e0a 0a3c 623e 4e6f 7465 3a3c hold...Note:< │ │ │ -000bf650: 2f62 3e0a 5468 6520 5241 4e53 4143 206d /b>.The RANSAC m │ │ │ -000bf660: 6574 686f 6420 6361 6e20 6861 6e64 6c65 ethod can handle │ │ │ -000bf670: 2070 7261 6374 6963 616c 6c79 2061 6e79 practically any │ │ │ -000bf680: 2072 6174 696f 206f 6620 6f75 746c 6965 ratio of outlie │ │ │ -000bf690: 7273 2062 7574 206e 6565 6473 2061 2074 rs but needs a t │ │ │ -000bf6a0: 6872 6573 686f 6c64 2074 6f0a 6469 7374 hreshold to.dist │ │ │ -000bf6b0: 696e 6775 6973 6820 696e 6c69 6572 7320 inguish inliers │ │ │ -000bf6c0: 6672 6f6d 206f 7574 6c69 6572 732e 2054 from outliers. T │ │ │ -000bf6d0: 6865 206d 6574 686f 6420 4c4d 6544 5320 he method LMeDS │ │ │ -000bf6e0: 646f 6573 206e 6f74 206e 6565 6420 616e does not need an │ │ │ -000bf6f0: 7920 7468 7265 7368 6f6c 6420 6275 7420 y threshold but │ │ │ -000bf700: 776f 726b 730a 636f 7272 6563 746c 7920 works.correctly │ │ │ -000bf710: 6f6e 6c79 2077 6865 6e20 7468 6572 6520 only when there │ │ │ -000bf720: 6172 6520 6d6f 7265 2074 6861 6e20 3530 are more than 50 │ │ │ -000bf730: 2520 696e 6c69 6572 732e 0a0a 5345 453a % inliers...SEE: │ │ │ -000bf740: 2065 7374 696d 6174 6541 6666 696e 6532 estimateAffine2 │ │ │ -000bf750: 442c 2065 7374 696d 6174 6541 6666 696e D, estimateAffin │ │ │ -000bf760: 6550 6172 7469 616c 3244 2c20 6765 7441 ePartial2D, getA │ │ │ -000bf770: 6666 696e 6554 7261 6e73 666f 726d 3c2f ffineTransform.
    .
    │ │ │ -000bf790: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .

    .
  • .
  • .
    .

    esti │ │ │ -000bf820: 6d61 7465 5472 616e 736c 6174 696f 6e32 mateTranslation2 │ │ │ -000bf830: 443c 2f68 333e 0a3c 6469 7620 636c 6173 D

    .
    .
    pub │ │ │ -000bf890: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static double[] │ │ │ -000bf8d0: 266e 6273 703b 3c73 7061 6e20 636c 6173  estimateTransla │ │ │ -000bf900: 7469 6f6e 3244 3c2f 7370 616e 3e3c 7762 tion2D(Mat& │ │ │ -000bf970: 6e62 7370 3b66 726f 6d2c 0a20 3c61 2068 nbsp;from,. Mat& │ │ │ -000bf9c0: 6e62 7370 3b74 6f2c 0a20 3c61 2068 7265 nbsp;to,. Mat&nb │ │ │ -000bfa10: 7370 3b69 6e6c 6965 7273 293c 2f73 7061 sp;inliers)
    .
    Comp │ │ │ -000bfa40: 7574 6573 2061 2070 7572 6520 3244 2074 utes a pure 2D t │ │ │ -000bfa50: 7261 6e73 6c61 7469 6f6e 2062 6574 7765 ranslation betwe │ │ │ -000bfa60: 656e 2074 776f 2032 4420 706f 696e 7420 en two 2D point │ │ │ -000bfa70: 7365 7473 2e0a 0a49 7420 636f 6d70 7574 sets...It comput │ │ │ -000bfa80: 6573 0a5c 280a 5c62 6567 696e 7b62 6d61 es.\(.\begin{bma │ │ │ -000bfa90: 7472 6978 7d0a 785c 5c0a 790a 5c65 6e64 trix}.x\\.y.\end │ │ │ -000bfaa0: 7b62 6d61 7472 6978 7d0a 3d0a 5c62 6567 {bmatrix}.=.\beg │ │ │ -000bfab0: 696e 7b62 6d61 7472 6978 7d0a 3120 2661 in{bmatrix}.1 &a │ │ │ -000bfac0: 6d70 3b20 305c 5c0a 3020 2661 6d70 3b20 mp; 0\\.0 & │ │ │ -000bfad0: 310a 5c65 6e64 7b62 6d61 7472 6978 7d0a 1.\end{bmatrix}. │ │ │ -000bfae0: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ -000bfaf0: 585c 5c0a 590a 5c65 6e64 7b62 6d61 7472 X\\.Y.\end{bmatr │ │ │ -000bfb00: 6978 7d0a 2b0a 5c62 6567 696e 7b62 6d61 ix}.+.\begin{bma │ │ │ -000bfb10: 7472 6978 7d0a 745f 785c 5c0a 745f 790a trix}.t_x\\.t_y. │ │ │ -000bfb20: 5c65 6e64 7b62 6d61 7472 6978 7d2e 0a5c \end{bmatrix}..\ │ │ │ -000bfb30: 293c 2f64 6976 3e0a 3c64 6c20 636c 6173 )
    .
    .
    P │ │ │ -000bfb50: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ -000bfb60: 3c64 643e 3c63 6f64 653e 6672 6f6d 3c2f
    from - First in │ │ │ -000bfb80: 7075 7420 3244 2070 6f69 6e74 2073 6574 put 2D point set │ │ │ -000bfb90: 2063 6f6e 7461 696e 696e 6720 5c28 2858 containing \((X │ │ │ -000bfba0: 2c59 295c 292e 3c2f 6464 3e0a 3c64 643e ,Y)\).
    .
    │ │ │ -000bfbb0: 3c63 6f64 653e 746f 3c2f 636f 6465 3e20 to │ │ │ -000bfbc0: 2d20 5365 636f 6e64 2069 6e70 7574 2032 - Second input 2 │ │ │ -000bfbd0: 4420 706f 696e 7420 7365 7420 636f 6e74 D point set cont │ │ │ -000bfbe0: 6169 6e69 6e67 205c 2828 782c 7929 5c29 aining \((x,y)\) │ │ │ -000bfbf0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    inliers │ │ │ -000bfc10: 2d20 4f75 7470 7574 2076 6563 746f 7220 - Output vector │ │ │ -000bfc20: 696e 6469 6361 7469 6e67 2077 6869 6368 indicating which │ │ │ -000bfc30: 2070 6f69 6e74 7320 6172 6520 696e 6c69 points are inli │ │ │ -000bfc40: 6572 7320 2831 2d69 6e6c 6965 722c 2030 ers (1-inlier, 0 │ │ │ -000bfc50: 2d6f 7574 6c69 6572 292e 0a3c 756c 3e0a -outlier)..
      . │ │ │ -000bfc60: 2020 3c6c 693e 0a20 2020 5245 463a 2052
    • . REF: R │ │ │ -000bfc70: 414e 5341 4320 2d20 5241 4e53 4143 2d62 ANSAC - RANSAC-b │ │ │ -000bfc80: 6173 6564 2072 6f62 7573 7420 6d65 7468 ased robust meth │ │ │ -000bfc90: 6f64 0a20 203c 2f6c 693e 0a20 203c 6c69 od.
    • .
    • . REF: LMEDS │ │ │ -000bfcb0: 2d20 4c65 6173 742d 4d65 6469 616e 2072 - Least-Median r │ │ │ -000bfcc0: 6f62 7573 7420 6d65 7468 6f64 0a52 414e obust method.RAN │ │ │ -000bfcd0: 5341 4320 6973 2074 6865 2064 6566 6175 SAC is the defau │ │ │ -000bfce0: 6c74 206d 6574 686f 642e 0a20 203c 2f6c lt method.. .
    .a point │ │ │ -000bfd00: 2061 7320 616e 2069 6e6c 6965 722e 2041 as an inlier. A │ │ │ -000bfd10: 7070 6c69 6573 206f 6e6c 7920 746f 2052 pplies only to R │ │ │ -000bfd20: 414e 5341 432e 0a62 6574 7765 656e 2030 ANSAC..between 0 │ │ │ -000bfd30: 2e39 3520 616e 6420 302e 3939 2069 7320 .95 and 0.99 is │ │ │ -000bfd40: 7573 7561 6c6c 7920 676f 6f64 2065 6e6f usually good eno │ │ │ -000bfd50: 7567 682e 2056 616c 7565 7320 746f 6f20 ugh. Values too │ │ │ -000bfd60: 636c 6f73 6520 746f 2031 2063 616e 2073 close to 1 can s │ │ │ -000bfd70: 6c6f 7720 646f 776e 2074 6865 2065 7374 low down the est │ │ │ -000bfd80: 696d 6174 696f 6e0a 7369 676e 6966 6963 imation.signific │ │ │ -000bfd90: 616e 746c 792e 2056 616c 7565 7320 6c6f antly. Values lo │ │ │ -000bfda0: 7765 7220 7468 616e 2030 2e38 e280 9330 wer than 0.8...0 │ │ │ -000bfdb0: 2e39 2063 616e 2072 6573 756c 7420 696e .9 can result in │ │ │ -000bfdc0: 2061 6e20 696e 636f 7272 6563 746c 7920 an incorrectly │ │ │ -000bfdd0: 6573 7469 6d61 7465 6420 7472 616e 7366 estimated transf │ │ │ -000bfde0: 6f72 6d61 7469 6f6e 2e0a 7468 6520 6c65 ormation..the le │ │ │ -000bfdf0: 6173 742d 7371 7561 7265 7320 736f 6c75 ast-squares solu │ │ │ -000bfe00: 7469 6f6e 206f 6e20 696e 6c69 6572 7320 tion on inliers │ │ │ -000bfe10: 6973 2063 6c6f 7365 642d 666f 726d 2c20 is closed-form, │ │ │ -000bfe20: 736f 2070 6173 7369 6e67 2030 2069 7320 so passing 0 is │ │ │ -000bfe30: 7265 636f 6d6d 656e 6465 6420 286e 6f20 recommended (no │ │ │ -000bfe40: 6164 6469 7469 6f6e 616c 2072 6566 696e additional refin │ │ │ -000bfe50: 6529 2e3c 2f64 643e 0a3c 6474 3e52 6574 e).
    .
    Ret │ │ │ -000bfe60: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e41 urns:
    .
    A │ │ │ -000bfe70: 2032 4420 7472 616e 736c 6174 696f 6e20 2D translation │ │ │ -000bfe80: 7665 6374 6f72 205c 285b 745f 782c 2074 vector \([t_x, t │ │ │ -000bfe90: 5f79 5d5e 545c 2920 6173 203c 636f 6465 _y]^T\) as cv::Vec2d. If the transl │ │ │ -000bfec0: 6174 696f 6e20 636f 756c 6420 6e6f 7420 ation could not │ │ │ -000bfed0: 6265 0a65 7374 696d 6174 6564 2c20 626f be.estimated, bo │ │ │ -000bfee0: 7468 2063 6f6d 706f 6e65 6e74 7320 6172 th components ar │ │ │ -000bfef0: 6520 7365 7420 746f 204e 614e 2061 6e64 e set to NaN and │ │ │ -000bff00: 2c20 6966 203c 636f 6465 3e69 6e6c 6965 , if inlie │ │ │ -000bff10: 7273 3c2f 636f 6465 3e20 6973 2070 726f rs is pro │ │ │ -000bff20: 7669 6465 642c 2074 6865 206d 6173 6b20 vided, the mask │ │ │ -000bff30: 6973 2066 696c 6c65 6420 7769 7468 207a is filled with z │ │ │ -000bff40: 6572 6f73 2e0a 0a5c 7061 7220 436f 6e76 eros...\par Conv │ │ │ -000bff50: 6572 7469 6e67 2074 6f20 6120 3278 3320 erting to a 2x3 │ │ │ -000bff60: 7472 616e 7366 6f72 6d61 7469 6f6e 206d transformation m │ │ │ -000bff70: 6174 7269 783a 0a5c 280a 5c62 6567 696e atrix:.\(.\begin │ │ │ -000bff80: 7b62 6d61 7472 6978 7d0a 3120 2661 6d70 {bmatrix}.1 & │ │ │ -000bff90: 3b20 3020 2661 6d70 3b20 745f 785c 5c0a ; 0 & t_x\\. │ │ │ -000bffa0: 3020 2661 6d70 3b20 3120 2661 6d70 3b20 0 & 1 & │ │ │ -000bffb0: 745f 790a 5c65 6e64 7b62 6d61 7472 6978 t_y.\end{bmatrix │ │ │ -000bffc0: 7d0a 5c29 0a0a 3c63 6f64 653e 0a63 763a }.\)...cv: │ │ │ -000bffd0: 3a56 6563 3264 2074 203d 2063 763a 3a65 :Vec2d t = cv::e │ │ │ -000bffe0: 7374 696d 6174 6554 7261 6e73 6c61 7469 stimateTranslati │ │ │ -000bfff0: 6f6e 3244 2866 726f 6d2c 2074 6f2c 2069 on2D(from, to, i │ │ │ -000c0000: 6e6c 6965 7273 293b 0a63 763a 3a4d 6174 nliers);.cv::Mat │ │ │ -000c0010: 2054 203d 2028 6376 3a3a 4d61 745f 266c T = (cv::Mat_&l │ │ │ -000c0020: 743b 646f 7562 6c65 2667 743b 2832 2c33 t;double>(2,3 │ │ │ -000c0030: 2920 266c 743b 266c 743b 2031 2c30 2c74 ) << 1,0,t │ │ │ -000c0040: 5b30 5d2c 2030 2c31 2c74 5b31 5d29 3b0a [0], 0,1,t[1]);. │ │ │ -000c0050: 3c2f 636f 6465 3e0a 0a54 6865 2066 756e ..The fun │ │ │ -000c0060: 6374 696f 6e20 6573 7469 6d61 7465 7320 ction estimates │ │ │ -000c0070: 6120 7075 7265 2032 4420 7472 616e 736c a pure 2D transl │ │ │ -000c0080: 6174 696f 6e20 6265 7477 6565 6e20 7477 ation between tw │ │ │ -000c0090: 6f20 3244 2070 6f69 6e74 2073 6574 7320 o 2D point sets │ │ │ -000c00a0: 7573 696e 6720 7468 6520 7365 6c65 6374 using the select │ │ │ -000c00b0: 6564 2072 6f62 7573 740a 616c 676f 7269 ed robust.algori │ │ │ -000c00c0: 7468 6d2e 2049 6e6c 6965 7273 2061 7265 thm. Inliers are │ │ │ -000c00d0: 2064 6574 6572 6d69 6e65 6420 6279 2074 determined by t │ │ │ -000c00e0: 6865 2072 6570 726f 6a65 6374 696f 6e20 he reprojection │ │ │ -000c00f0: 6572 726f 7220 7468 7265 7368 6f6c 642e error threshold. │ │ │ -000c0100: 0a0a 3c62 3e4e 6f74 653a 3c2f 623e 0a54 ..Note:.T │ │ │ -000c0110: 6865 2052 414e 5341 4320 6d65 7468 6f64 he RANSAC method │ │ │ -000c0120: 2063 616e 2068 616e 646c 6520 7072 6163 can handle prac │ │ │ -000c0130: 7469 6361 6c6c 7920 616e 7920 7261 7469 tically any rati │ │ │ -000c0140: 6f20 6f66 206f 7574 6c69 6572 7320 6275 o of outliers bu │ │ │ -000c0150: 7420 6e65 6564 7320 6120 7468 7265 7368 t needs a thresh │ │ │ -000c0160: 6f6c 6420 746f 0a64 6973 7469 6e67 7569 old to.distingui │ │ │ -000c0170: 7368 2069 6e6c 6965 7273 2066 726f 6d20 sh inliers from │ │ │ -000c0180: 6f75 746c 6965 7273 2e20 5468 6520 6d65 outliers. The me │ │ │ -000c0190: 7468 6f64 204c 4d65 4453 2064 6f65 7320 thod LMeDS does │ │ │ -000c01a0: 6e6f 7420 6e65 6564 2061 6e79 2074 6872 not need any thr │ │ │ -000c01b0: 6573 686f 6c64 2062 7574 2077 6f72 6b73 eshold but works │ │ │ -000c01c0: 0a63 6f72 7265 6374 6c79 206f 6e6c 7920 .correctly only │ │ │ -000c01d0: 7768 656e 2074 6865 7265 2061 7265 206d when there are m │ │ │ -000c01e0: 6f72 6520 7468 616e 2035 3025 2069 6e6c ore than 50% inl │ │ │ -000c01f0: 6965 7273 2e0a 0a53 4545 3a20 6573 7469 iers...SEE: esti │ │ │ -000c0200: 6d61 7465 4166 6669 6e65 3244 2c20 6573 mateAffine2D, es │ │ │ -000c0210: 7469 6d61 7465 4166 6669 6e65 5061 7274 timateAffinePart │ │ │ -000c0220: 6961 6c32 442c 2067 6574 4166 6669 6e65 ial2D, getAffine │ │ │ -000c0230: 5472 616e 7366 6f72 6d3c 2f64 643e 0a3c Transform
    .< │ │ │ -000c0240: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ..
  • .
  • .
    .< │ │ │ -000c02c0: 6833 3e65 7374 696d 6174 6554 7261 6e73 h3>estimateTrans │ │ │ -000c02d0: 6c61 7469 6f6e 3244 3c2f 6833 3e0a 3c64 lation2D..public stati │ │ │ -000c0340: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c double[] │ │ │ -000c0370: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  estimate │ │ │ -000c03a0: 5472 616e 736c 6174 696f 6e32 443c 2f73 Translation2D(M │ │ │ -000c0410: 6174 3c2f 613e 266e 6273 703b 6672 6f6d at from │ │ │ -000c0420: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000c0460: 6174 3c2f 613e 266e 6273 703b 746f 293c at to)< │ │ │ -000c0470: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>. │ │ │ -000c0490: 436f 6d70 7574 6573 2061 2070 7572 6520 Computes a pure │ │ │ -000c04a0: 3244 2074 7261 6e73 6c61 7469 6f6e 2062 2D translation b │ │ │ -000c04b0: 6574 7765 656e 2074 776f 2032 4420 706f etween two 2D po │ │ │ -000c04c0: 696e 7420 7365 7473 2e0a 0a49 7420 636f int sets...It co │ │ │ -000c04d0: 6d70 7574 6573 0a5c 280a 5c62 6567 696e mputes.\(.\begin │ │ │ -000c04e0: 7b62 6d61 7472 6978 7d0a 785c 5c0a 790a {bmatrix}.x\\.y. │ │ │ -000c04f0: 5c65 6e64 7b62 6d61 7472 6978 7d0a 3d0a \end{bmatrix}.=. │ │ │ -000c0500: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ -000c0510: 3120 2661 6d70 3b20 305c 5c0a 3020 2661 1 & 0\\.0 &a │ │ │ -000c0520: 6d70 3b20 310a 5c65 6e64 7b62 6d61 7472 mp; 1.\end{bmatr │ │ │ -000c0530: 6978 7d0a 5c62 6567 696e 7b62 6d61 7472 ix}.\begin{bmatr │ │ │ -000c0540: 6978 7d0a 585c 5c0a 590a 5c65 6e64 7b62 ix}.X\\.Y.\end{b │ │ │ -000c0550: 6d61 7472 6978 7d0a 2b0a 5c62 6567 696e matrix}.+.\begin │ │ │ -000c0560: 7b62 6d61 7472 6978 7d0a 745f 785c 5c0a {bmatrix}.t_x\\. │ │ │ -000c0570: 745f 790a 5c65 6e64 7b62 6d61 7472 6978 t_y.\end{bmatrix │ │ │ -000c0580: 7d2e 0a5c 293c 2f64 6976 3e0a 3c64 6c20 }..\).
    .< │ │ │ -000c05a0: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    fr │ │ │ -000c05c0: 6f6d 3c2f 636f 6465 3e20 2d20 4669 7273 om - Firs │ │ │ -000c05d0: 7420 696e 7075 7420 3244 2070 6f69 6e74 t input 2D point │ │ │ -000c05e0: 2073 6574 2063 6f6e 7461 696e 696e 6720 set containing │ │ │ -000c05f0: 5c28 2858 2c59 295c 292e 3c2f 6464 3e0a \((X,Y)\).
    . │ │ │ -000c0600: 3c64 643e 3c63 6f64 653e 746f 3c2f 636f
    to - Second inp │ │ │ -000c0620: 7574 2032 4420 706f 696e 7420 7365 7420 ut 2D point set │ │ │ -000c0630: 636f 6e74 6169 6e69 6e67 205c 2828 782c containing \((x, │ │ │ -000c0640: 7929 5c29 2e0a 3c75 6c3e 0a20 203c 6c69 y)\)..
      .
    • . REF: RANSAC │ │ │ -000c0660: 202d 2052 414e 5341 432d 6261 7365 6420 - RANSAC-based │ │ │ -000c0670: 726f 6275 7374 206d 6574 686f 640a 2020 robust method. │ │ │ -000c0680: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020
    • .
    • . │ │ │ -000c0690: 5245 463a 204c 4d45 4453 202d 204c 6561 REF: LMEDS - Lea │ │ │ -000c06a0: 7374 2d4d 6564 6961 6e20 726f 6275 7374 st-Median robust │ │ │ -000c06b0: 206d 6574 686f 640a 5241 4e53 4143 2069 method.RANSAC i │ │ │ -000c06c0: 7320 7468 6520 6465 6661 756c 7420 6d65 s the default me │ │ │ -000c06d0: 7468 6f64 2e0a 2020 3c2f 6c69 3e0a 3c2f thod..
    • ..a point as a │ │ │ -000c06f0: 6e20 696e 6c69 6572 2e20 4170 706c 6965 n inlier. Applie │ │ │ -000c0700: 7320 6f6e 6c79 2074 6f20 5241 4e53 4143 s only to RANSAC │ │ │ -000c0710: 2e0a 6265 7477 6565 6e20 302e 3935 2061 ..between 0.95 a │ │ │ -000c0720: 6e64 2030 2e39 3920 6973 2075 7375 616c nd 0.99 is usual │ │ │ -000c0730: 6c79 2067 6f6f 6420 656e 6f75 6768 2e20 ly good enough. │ │ │ -000c0740: 5661 6c75 6573 2074 6f6f 2063 6c6f 7365 Values too close │ │ │ -000c0750: 2074 6f20 3120 6361 6e20 736c 6f77 2064 to 1 can slow d │ │ │ -000c0760: 6f77 6e20 7468 6520 6573 7469 6d61 7469 own the estimati │ │ │ -000c0770: 6f6e 0a73 6967 6e69 6669 6361 6e74 6c79 on.significantly │ │ │ -000c0780: 2e20 5661 6c75 6573 206c 6f77 6572 2074 . Values lower t │ │ │ -000c0790: 6861 6e20 302e 38e2 8093 302e 3920 6361 han 0.8...0.9 ca │ │ │ -000c07a0: 6e20 7265 7375 6c74 2069 6e20 616e 2069 n result in an i │ │ │ -000c07b0: 6e63 6f72 7265 6374 6c79 2065 7374 696d ncorrectly estim │ │ │ -000c07c0: 6174 6564 2074 7261 6e73 666f 726d 6174 ated transformat │ │ │ -000c07d0: 696f 6e2e 0a74 6865 206c 6561 7374 2d73 ion..the least-s │ │ │ -000c07e0: 7175 6172 6573 2073 6f6c 7574 696f 6e20 quares solution │ │ │ -000c07f0: 6f6e 2069 6e6c 6965 7273 2069 7320 636c on inliers is cl │ │ │ -000c0800: 6f73 6564 2d66 6f72 6d2c 2073 6f20 7061 osed-form, so pa │ │ │ -000c0810: 7373 696e 6720 3020 6973 2072 6563 6f6d ssing 0 is recom │ │ │ -000c0820: 6d65 6e64 6564 2028 6e6f 2061 6464 6974 mended (no addit │ │ │ -000c0830: 696f 6e61 6c20 7265 6669 6e65 292e 3c2f ional refine)..
      Returns: │ │ │ -000c0850: 3c2f 6474 3e0a 3c64 643e 4120 3244 2074
      .
      A 2D t │ │ │ -000c0860: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ -000c0870: 7220 5c28 5b74 5f78 2c20 745f 795d 5e54 r \([t_x, t_y]^T │ │ │ -000c0880: 5c29 2061 7320 3c63 6f64 653e 6376 3a3a \) as cv:: │ │ │ -000c0890: 5665 6332 643c 2f63 6f64 653e 2e20 4966 Vec2d. If │ │ │ -000c08a0: 2074 6865 2074 7261 6e73 6c61 7469 6f6e the translation │ │ │ -000c08b0: 2063 6f75 6c64 206e 6f74 2062 650a 6573 could not be.es │ │ │ -000c08c0: 7469 6d61 7465 642c 2062 6f74 6820 636f timated, both co │ │ │ -000c08d0: 6d70 6f6e 656e 7473 2061 7265 2073 6574 mponents are set │ │ │ -000c08e0: 2074 6f20 4e61 4e20 616e 642c 2069 6620 to NaN and, if │ │ │ -000c08f0: 3c63 6f64 653e 696e 6c69 6572 733c 2f63 inliers is provided │ │ │ -000c0910: 2c20 7468 6520 6d61 736b 2069 7320 6669 , the mask is fi │ │ │ -000c0920: 6c6c 6564 2077 6974 6820 7a65 726f 732e lled with zeros. │ │ │ -000c0930: 0a0a 5c70 6172 2043 6f6e 7665 7274 696e ..\par Convertin │ │ │ -000c0940: 6720 746f 2061 2032 7833 2074 7261 6e73 g to a 2x3 trans │ │ │ -000c0950: 666f 726d 6174 696f 6e20 6d61 7472 6978 formation matrix │ │ │ -000c0960: 3a0a 5c28 0a5c 6265 6769 6e7b 626d 6174 :.\(.\begin{bmat │ │ │ -000c0970: 7269 787d 0a31 2026 616d 703b 2030 2026 rix}.1 & 0 & │ │ │ -000c0980: 616d 703b 2074 5f78 5c5c 0a30 2026 616d amp; t_x\\.0 &am │ │ │ -000c0990: 703b 2031 2026 616d 703b 2074 5f79 0a5c p; 1 & t_y.\ │ │ │ -000c09a0: 656e 647b 626d 6174 7269 787d 0a5c 290a end{bmatrix}.\). │ │ │ -000c09b0: 0a3c 636f 6465 3e0a 6376 3a3a 5665 6332 ..cv::Vec2 │ │ │ -000c09c0: 6420 7420 3d20 6376 3a3a 6573 7469 6d61 d t = cv::estima │ │ │ -000c09d0: 7465 5472 616e 736c 6174 696f 6e32 4428 teTranslation2D( │ │ │ -000c09e0: 6672 6f6d 2c20 746f 2c20 696e 6c69 6572 from, to, inlier │ │ │ -000c09f0: 7329 3b0a 6376 3a3a 4d61 7420 5420 3d20 s);.cv::Mat T = │ │ │ -000c0a00: 2863 763a 3a4d 6174 5f26 6c74 3b64 6f75 (cv::Mat_<dou │ │ │ -000c0a10: 626c 6526 6774 3b28 322c 3329 2026 6c74 ble>(2,3) < │ │ │ -000c0a20: 3b26 6c74 3b20 312c 302c 745b 305d 2c20 ;< 1,0,t[0], │ │ │ -000c0a30: 302c 312c 745b 315d 293b 0a3c 2f63 6f64 0,1,t[1]);...The function │ │ │ -000c0a50: 2065 7374 696d 6174 6573 2061 2070 7572 estimates a pur │ │ │ -000c0a60: 6520 3244 2074 7261 6e73 6c61 7469 6f6e e 2D translation │ │ │ -000c0a70: 2062 6574 7765 656e 2074 776f 2032 4420 between two 2D │ │ │ -000c0a80: 706f 696e 7420 7365 7473 2075 7369 6e67 point sets using │ │ │ -000c0a90: 2074 6865 2073 656c 6563 7465 6420 726f the selected ro │ │ │ -000c0aa0: 6275 7374 0a61 6c67 6f72 6974 686d 2e20 bust.algorithm. │ │ │ -000c0ab0: 496e 6c69 6572 7320 6172 6520 6465 7465 Inliers are dete │ │ │ -000c0ac0: 726d 696e 6564 2062 7920 7468 6520 7265 rmined by the re │ │ │ -000c0ad0: 7072 6f6a 6563 7469 6f6e 2065 7272 6f72 projection error │ │ │ -000c0ae0: 2074 6872 6573 686f 6c64 2e0a 0a3c 623e threshold... │ │ │ -000c0af0: 4e6f 7465 3a3c 2f62 3e0a 5468 6520 5241 Note:.The RA │ │ │ -000c0b00: 4e53 4143 206d 6574 686f 6420 6361 6e20 NSAC method can │ │ │ -000c0b10: 6861 6e64 6c65 2070 7261 6374 6963 616c handle practical │ │ │ -000c0b20: 6c79 2061 6e79 2072 6174 696f 206f 6620 ly any ratio of │ │ │ -000c0b30: 6f75 746c 6965 7273 2062 7574 206e 6565 outliers but nee │ │ │ -000c0b40: 6473 2061 2074 6872 6573 686f 6c64 2074 ds a threshold t │ │ │ -000c0b50: 6f0a 6469 7374 696e 6775 6973 6820 696e o.distinguish in │ │ │ -000c0b60: 6c69 6572 7320 6672 6f6d 206f 7574 6c69 liers from outli │ │ │ -000c0b70: 6572 732e 2054 6865 206d 6574 686f 6420 ers. The method │ │ │ -000c0b80: 4c4d 6544 5320 646f 6573 206e 6f74 206e LMeDS does not n │ │ │ -000c0b90: 6565 6420 616e 7920 7468 7265 7368 6f6c eed any threshol │ │ │ -000c0ba0: 6420 6275 7420 776f 726b 730a 636f 7272 d but works.corr │ │ │ -000c0bb0: 6563 746c 7920 6f6e 6c79 2077 6865 6e20 ectly only when │ │ │ -000c0bc0: 7468 6572 6520 6172 6520 6d6f 7265 2074 there are more t │ │ │ -000c0bd0: 6861 6e20 3530 2520 696e 6c69 6572 732e han 50% inliers. │ │ │ -000c0be0: 0a0a 5345 453a 2065 7374 696d 6174 6541 ..SEE: estimateA │ │ │ -000c0bf0: 6666 696e 6532 442c 2065 7374 696d 6174 ffine2D, estimat │ │ │ -000c0c00: 6541 6666 696e 6550 6172 7469 616c 3244 eAffinePartial2D │ │ │ -000c0c10: 2c20 6765 7441 6666 696e 6554 7261 6e73 , getAffineTrans │ │ │ -000c0c20: 666f 726d 3c2f 6464 3e0a 3c2f 646c 3e0a form
      .
    . │ │ │ -000c0c30: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e .
    .
  • .
  • ..

    deco │ │ │ -000c0ce0: 6d70 6f73 6548 6f6d 6f67 7261 7068 794d mposeHomographyM │ │ │ -000c0cf0: 6174 3c2f 6833 3e0a 3c64 6976 2063 6c61 at

    .
    .
    pu │ │ │ -000c0d50: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static int&nbs │ │ │ -000c0d90: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;dec │ │ │ -000c0db0: 6f6d 706f 7365 486f 6d6f 6772 6170 6879 omposeHomography │ │ │ -000c0dc0: 4d61 743c 2f73 7061 6e3e 3c77 6272 3e3c Mat< │ │ │ -000c0dd0: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ -000c0de0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ -000c0e30: 703b 482c 0a20 3c61 2068 7265 663d 222e p;H,. Mat t, │ │ │ +000b07c0: 0a20 696e 7426 6e62 7370 3b6d 6574 686f . int metho │ │ │ +000b07d0: 6429 3c2f 7370 616e 3e3c 2f64 6976 3e0a d)
    . │ │ │ +000b07e0: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Recovers the │ │ │ +000b0800: 7265 6c61 7469 7665 2063 616d 6572 6120 relative camera │ │ │ +000b0810: 726f 7461 7469 6f6e 2061 6e64 2074 6865 rotation and the │ │ │ +000b0820: 2074 7261 6e73 6c61 7469 6f6e 2066 726f translation fro │ │ │ +000b0830: 6d20 636f 7272 6573 706f 6e64 696e 6720 m corresponding │ │ │ +000b0840: 706f 696e 7473 2069 6e20 7477 6f20 696d points in two im │ │ │ +000b0850: 6167 6573 2066 726f 6d20 7477 6f20 6469 ages from two di │ │ │ +000b0860: 6666 6572 656e 7420 6361 6d65 7261 732c fferent cameras, │ │ │ +000b0870: 2075 7369 6e67 2063 6869 7261 6c69 7479 using chirality │ │ │ +000b0880: 2063 6865 636b 2e20 5265 7475 726e 7320 check. Returns │ │ │ +000b0890: 7468 6520 6e75 6d62 6572 206f 660a 696e the number of.in │ │ │ +000b08a0: 6c69 6572 7320 7468 6174 2070 6173 7320 liers that pass │ │ │ +000b08b0: 7468 6520 6368 6563 6b2e 3c2f 6469 763e the check.
    │ │ │ +000b08c0: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ +000b08e0: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    points1 - Array of N 2 │ │ │ +000b0910: 4420 706f 696e 7473 2066 726f 6d20 7468 D points from th │ │ │ +000b0920: 6520 6669 7273 7420 696d 6167 652e 2054 e first image. T │ │ │ +000b0930: 6865 2070 6f69 6e74 2063 6f6f 7264 696e he point coordin │ │ │ +000b0940: 6174 6573 2073 686f 756c 6420 6265 0a66 ates should be.f │ │ │ +000b0950: 6c6f 6174 696e 672d 706f 696e 7420 2873 loating-point (s │ │ │ +000b0960: 696e 676c 6520 6f72 2064 6f75 626c 6520 ingle or double │ │ │ +000b0970: 7072 6563 6973 696f 6e29 2e3c 2f64 643e precision).
    │ │ │ +000b0980: 0a3c 6464 3e3c 636f 6465 3e70 6f69 6e74 .
    point │ │ │ +000b0990: 7332 3c2f 636f 6465 3e20 2d20 4172 7261 s2 - Arra │ │ │ +000b09a0: 7920 6f66 2074 6865 2073 6563 6f6e 6420 y of the second │ │ │ +000b09b0: 696d 6167 6520 706f 696e 7473 206f 6620 image points of │ │ │ +000b09c0: 7468 6520 7361 6d65 2073 697a 6520 616e the same size an │ │ │ +000b09d0: 6420 666f 726d 6174 2061 7320 706f 696e d format as poin │ │ │ +000b09e0: 7473 3120 2e3c 2f64 643e 0a3c 6464 3e3c ts1 .
    .
    < │ │ │ +000b09f0: 636f 6465 3e63 616d 6572 614d 6174 7269 code>cameraMatri │ │ │ +000b0a00: 7831 3c2f 636f 6465 3e20 2d20 496e 7075 x1 - Inpu │ │ │ +000b0a10: 742f 6f75 7470 7574 2063 616d 6572 6120 t/output camera │ │ │ +000b0a20: 6d61 7472 6978 2066 6f72 2074 6865 2066 matrix for the f │ │ │ +000b0a30: 6972 7374 2063 616d 6572 612c 2074 6865 irst camera, the │ │ │ +000b0a40: 2073 616d 6520 6173 2069 6e0a 5245 463a same as in.REF: │ │ │ +000b0a50: 2063 616c 6962 7261 7465 4361 6d65 7261 calibrateCamera │ │ │ +000b0a60: 2e20 4675 7274 6865 726d 6f72 652c 2066 . Furthermore, f │ │ │ +000b0a70: 6f72 2074 6865 2073 7465 7265 6f20 6361 or the stereo ca │ │ │ +000b0a80: 7365 2c20 6164 6469 7469 6f6e 616c 2066 se, additional f │ │ │ +000b0a90: 6c61 6773 206d 6179 2062 6520 7573 6564 lags may be used │ │ │ +000b0aa0: 2c20 7365 6520 6265 6c6f 772e 3c2f 6464 , see below.
    .
    dist │ │ │ +000b0ac0: 436f 6566 6673 313c 2f63 6f64 653e 202d Coeffs1 - │ │ │ +000b0ad0: 2049 6e70 7574 2f6f 7574 7075 7420 7665 Input/output ve │ │ │ +000b0ae0: 6374 6f72 206f 6620 6469 7374 6f72 7469 ctor of distorti │ │ │ +000b0af0: 6f6e 2063 6f65 6666 6963 6965 6e74 732c on coefficients, │ │ │ +000b0b00: 2074 6865 2073 616d 6520 6173 2069 6e0a the same as in. │ │ │ +000b0b10: 5245 463a 2063 616c 6962 7261 7465 4361 REF: calibrateCa │ │ │ +000b0b20: 6d65 7261 2e3c 2f64 643e 0a3c 6464 3e3c mera.
    .
    < │ │ │ +000b0b30: 636f 6465 3e63 616d 6572 614d 6174 7269 code>cameraMatri │ │ │ +000b0b40: 7832 3c2f 636f 6465 3e20 2d20 496e 7075 x2 - Inpu │ │ │ +000b0b50: 742f 6f75 7470 7574 2063 616d 6572 6120 t/output camera │ │ │ +000b0b60: 6d61 7472 6978 2066 6f72 2074 6865 2066 matrix for the f │ │ │ +000b0b70: 6972 7374 2063 616d 6572 612c 2074 6865 irst camera, the │ │ │ +000b0b80: 2073 616d 6520 6173 2069 6e0a 5245 463a same as in.REF: │ │ │ +000b0b90: 2063 616c 6962 7261 7465 4361 6d65 7261 calibrateCamera │ │ │ +000b0ba0: 2e20 4675 7274 6865 726d 6f72 652c 2066 . Furthermore, f │ │ │ +000b0bb0: 6f72 2074 6865 2073 7465 7265 6f20 6361 or the stereo ca │ │ │ +000b0bc0: 7365 2c20 6164 6469 7469 6f6e 616c 2066 se, additional f │ │ │ +000b0bd0: 6c61 6773 206d 6179 2062 6520 7573 6564 lags may be used │ │ │ +000b0be0: 2c20 7365 6520 6265 6c6f 772e 3c2f 6464 , see below.
    .
    dist │ │ │ +000b0c00: 436f 6566 6673 323c 2f63 6f64 653e 202d Coeffs2 - │ │ │ +000b0c10: 2049 6e70 7574 2f6f 7574 7075 7420 7665 Input/output ve │ │ │ +000b0c20: 6374 6f72 206f 6620 6469 7374 6f72 7469 ctor of distorti │ │ │ +000b0c30: 6f6e 2063 6f65 6666 6963 6965 6e74 732c on coefficients, │ │ │ +000b0c40: 2074 6865 2073 616d 6520 6173 2069 6e0a the same as in. │ │ │ +000b0c50: 5245 463a 2063 616c 6962 7261 7465 4361 REF: calibrateCa │ │ │ +000b0c60: 6d65 7261 2e3c 2f64 643e 0a3c 6464 3e3c mera.
    .
    < │ │ │ +000b0c70: 636f 6465 3e45 3c2f 636f 6465 3e20 2d20 code>E - │ │ │ +000b0c80: 5468 6520 6f75 7470 7574 2065 7373 656e The output essen │ │ │ +000b0c90: 7469 616c 206d 6174 7269 782e 3c2f 6464 tial matrix.
    .
    R - Output ro │ │ │ +000b0cc0: 7461 7469 6f6e 206d 6174 7269 782e 2054 tation matrix. T │ │ │ +000b0cd0: 6f67 6574 6865 7220 7769 7468 2074 6865 ogether with the │ │ │ +000b0ce0: 2074 7261 6e73 6c61 7469 6f6e 2076 6563 translation vec │ │ │ +000b0cf0: 746f 722c 2074 6869 7320 6d61 7472 6978 tor, this matrix │ │ │ +000b0d00: 206d 616b 6573 2075 7020 6120 7475 706c makes up a tupl │ │ │ +000b0d10: 650a 7468 6174 2070 6572 666f 726d 7320 e.that performs │ │ │ +000b0d20: 6120 6368 616e 6765 206f 6620 6261 7369 a change of basi │ │ │ +000b0d30: 7320 6672 6f6d 2074 6865 2066 6972 7374 s from the first │ │ │ +000b0d40: 2063 616d 6572 6127 7320 636f 6f72 6469 camera's coordi │ │ │ +000b0d50: 6e61 7465 2073 7973 7465 6d20 746f 2074 nate system to t │ │ │ +000b0d60: 6865 2073 6563 6f6e 6420 6361 6d65 7261 he second camera │ │ │ +000b0d70: 2773 0a63 6f6f 7264 696e 6174 6520 7379 's.coordinate sy │ │ │ +000b0d80: 7374 656d 2e20 4e6f 7465 2074 6861 742c stem. Note that, │ │ │ +000b0d90: 2069 6e20 6765 6e65 7261 6c2c 2074 2063 in general, t c │ │ │ +000b0da0: 616e 206e 6f74 2062 6520 7573 6564 2066 an not be used f │ │ │ +000b0db0: 6f72 2074 6869 7320 7475 706c 652c 2073 or this tuple, s │ │ │ +000b0dc0: 6565 2074 6865 2070 6172 616d 6574 6572 ee the parameter │ │ │ +000b0dd0: 0a64 6573 6372 6962 6564 2062 656c 6f77 .described below │ │ │ +000b0de0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    t - Outp │ │ │ +000b0e00: 7574 2074 7261 6e73 6c61 7469 6f6e 2076 ut translation v │ │ │ +000b0e10: 6563 746f 722e 2054 6869 7320 7665 6374 ector. This vect │ │ │ +000b0e20: 6f72 2069 7320 6f62 7461 696e 6564 2062 or is obtained b │ │ │ +000b0e30: 7920 5245 463a 2064 6563 6f6d 706f 7365 y REF: decompose │ │ │ +000b0e40: 4573 7365 6e74 6961 6c4d 6174 2061 6e64 EssentialMat and │ │ │ +000b0e50: 0a74 6865 7265 666f 7265 2069 7320 6f6e .therefore is on │ │ │ +000b0e60: 6c79 206b 6e6f 776e 2075 7020 746f 2073 ly known up to s │ │ │ +000b0e70: 6361 6c65 2c20 692e 652e 2074 2069 7320 cale, i.e. t is │ │ │ +000b0e80: 7468 6520 6469 7265 6374 696f 6e20 6f66 the direction of │ │ │ +000b0e90: 2074 6865 2074 7261 6e73 6c61 7469 6f6e the translation │ │ │ +000b0ea0: 2076 6563 746f 7220 616e 6420 6861 7320 vector and has │ │ │ +000b0eb0: 756e 6974 0a6c 656e 6774 682e 3c2f 6464 unit.length.
    .
    meth │ │ │ +000b0ed0: 6f64 3c2f 636f 6465 3e20 2d20 4d65 7468 od - Meth │ │ │ +000b0ee0: 6f64 2066 6f72 2063 6f6d 7075 7469 6e67 od for computing │ │ │ +000b0ef0: 2061 6e20 6573 7365 6e74 6961 6c20 6d61 an essential ma │ │ │ +000b0f00: 7472 6978 2e0a 3c75 6c3e 0a20 203c 6c69 trix..
      .
    • . REF: RANSAC │ │ │ +000b0f20: 2066 6f72 2074 6865 2052 414e 5341 4320 for the RANSAC │ │ │ +000b0f30: 616c 676f 7269 7468 6d2e 0a20 203c 2f6c algorithm.. .
    • . REF │ │ │ +000b0f50: 3a20 4c4d 4544 5320 666f 7220 7468 6520 : LMEDS for the │ │ │ +000b0f60: 4c4d 6564 5320 616c 676f 7269 7468 6d2e LMedS algorithm. │ │ │ +000b0f70: 0a20 203c 2f6c 693e 0a3c 2f75 6c3e 0a63 .
    • .
    .c │ │ │ +000b0f80: 6f6e 6669 6465 6e63 6520 2870 726f 6261 onfidence (proba │ │ │ +000b0f90: 6269 6c69 7479 2920 7468 6174 2074 6865 bility) that the │ │ │ +000b0fa0: 2065 7374 696d 6174 6564 206d 6174 7269 estimated matri │ │ │ +000b0fb0: 7820 6973 2063 6f72 7265 6374 2e0a 6c69 x is correct..li │ │ │ +000b0fc0: 6e65 2069 6e20 7069 7865 6c73 2c20 6265 ne in pixels, be │ │ │ +000b0fd0: 796f 6e64 2077 6869 6368 2074 6865 2070 yond which the p │ │ │ +000b0fe0: 6f69 6e74 2069 7320 636f 6e73 6964 6572 oint is consider │ │ │ +000b0ff0: 6564 2061 6e20 6f75 746c 6965 7220 616e ed an outlier an │ │ │ +000b1000: 6420 6973 206e 6f74 2075 7365 6420 666f d is not used fo │ │ │ +000b1010: 7220 636f 6d70 7574 696e 6720 7468 650a r computing the. │ │ │ +000b1020: 6669 6e61 6c20 6675 6e64 616d 656e 7461 final fundamenta │ │ │ +000b1030: 6c20 6d61 7472 6978 2e20 4974 2063 616e l matrix. It can │ │ │ +000b1040: 2062 6520 7365 7420 746f 2073 6f6d 6574 be set to somet │ │ │ +000b1050: 6869 6e67 206c 696b 6520 312d 332c 2064 hing like 1-3, d │ │ │ +000b1060: 6570 656e 6469 6e67 206f 6e20 7468 6520 epending on the │ │ │ +000b1070: 6163 6375 7261 6379 206f 6620 7468 650a accuracy of the. │ │ │ +000b1080: 706f 696e 7420 6c6f 6361 6c69 7a61 7469 point localizati │ │ │ +000b1090: 6f6e 2c20 696d 6167 6520 7265 736f 6c75 on, image resolu │ │ │ +000b10a0: 7469 6f6e 2c20 616e 6420 7468 6520 696d tion, and the im │ │ │ +000b10b0: 6167 6520 6e6f 6973 652e 0a69 6e6c 6965 age noise..inlie │ │ │ +000b10c0: 7273 2069 6e20 706f 696e 7473 3120 616e rs in points1 an │ │ │ +000b10d0: 6420 706f 696e 7473 3220 666f 7220 7468 d points2 for th │ │ │ +000b10e0: 6520 6769 7665 6e20 6573 7365 6e74 6961 e given essentia │ │ │ +000b10f0: 6c20 6d61 7472 6978 2045 2e20 4f6e 6c79 l matrix E. Only │ │ │ +000b1100: 2074 6865 7365 2069 6e6c 6965 7273 2077 these inliers w │ │ │ +000b1110: 696c 6c20 6265 2075 7365 6420 746f 0a72 ill be used to.r │ │ │ +000b1120: 6563 6f76 6572 2070 6f73 652e 2049 6e20 ecover pose. In │ │ │ +000b1130: 7468 6520 6f75 7470 7574 206d 6173 6b20 the output mask │ │ │ +000b1140: 6f6e 6c79 2069 6e6c 6965 7273 2077 6869 only inliers whi │ │ │ +000b1150: 6368 2070 6173 7320 7468 6520 6368 6972 ch pass the chir │ │ │ +000b1160: 616c 6974 7920 6368 6563 6b2e 0a0a 5468 ality check...Th │ │ │ +000b1170: 6973 2066 756e 6374 696f 6e20 6465 636f is function deco │ │ │ +000b1180: 6d70 6f73 6573 2061 6e20 6573 7365 6e74 mposes an essent │ │ │ +000b1190: 6961 6c20 6d61 7472 6978 2075 7369 6e67 ial matrix using │ │ │ +000b11a0: 2052 4546 3a20 6465 636f 6d70 6f73 6545 REF: decomposeE │ │ │ +000b11b0: 7373 656e 7469 616c 4d61 7420 616e 6420 ssentialMat and │ │ │ +000b11c0: 7468 656e 2076 6572 6966 6965 730a 706f then verifies.po │ │ │ +000b11d0: 7373 6962 6c65 2070 6f73 6520 6879 706f ssible pose hypo │ │ │ +000b11e0: 7468 6573 6573 2062 7920 646f 696e 6720 theses by doing │ │ │ +000b11f0: 6368 6972 616c 6974 7920 6368 6563 6b2e chirality check. │ │ │ +000b1200: 2054 6865 2063 6869 7261 6c69 7479 2063 The chirality c │ │ │ +000b1210: 6865 636b 206d 6561 6e73 2074 6861 7420 heck means that │ │ │ +000b1220: 7468 650a 7472 6961 6e67 756c 6174 6564 the.triangulated │ │ │ +000b1230: 2033 4420 706f 696e 7473 2073 686f 756c 3D points shoul │ │ │ +000b1240: 6420 6861 7665 2070 6f73 6974 6976 6520 d have positive │ │ │ +000b1250: 6465 7074 682e 2053 6f6d 6520 6465 7461 depth. Some deta │ │ │ +000b1260: 696c 7320 6361 6e20 6265 2066 6f75 6e64 ils can be found │ │ │ +000b1270: 2069 6e20 4349 5445 3a20 4e69 7374 6572 in CITE: Nister │ │ │ +000b1280: 3033 2e0a 0a54 6869 7320 6675 6e63 7469 03...This functi │ │ │ +000b1290: 6f6e 2063 616e 2062 6520 7573 6564 2074 on can be used t │ │ │ +000b12a0: 6f20 7072 6f63 6573 7320 7468 6520 6f75 o process the ou │ │ │ +000b12b0: 7470 7574 2045 2061 6e64 206d 6173 6b20 tput E and mask │ │ │ +000b12c0: 6672 6f6d 2052 4546 3a20 6669 6e64 4573 from REF: findEs │ │ │ +000b12d0: 7365 6e74 6961 6c4d 6174 2e20 496e 2074 sentialMat. In t │ │ │ +000b12e0: 6869 730a 7363 656e 6172 696f 2c20 706f his.scenario, po │ │ │ +000b12f0: 696e 7473 3120 616e 6420 706f 696e 7473 ints1 and points │ │ │ +000b1300: 3220 6172 6520 7468 6520 7361 6d65 2069 2 are the same i │ │ │ +000b1310: 6e70 7574 2066 6f72 2066 696e 6445 7373 nput for findEss │ │ │ +000b1320: 656e 7469 616c 4d61 742e 3a0a 3c63 6f64 entialMat.:.. // Exampl │ │ │ +000b1340: 652e 2045 7374 696d 6174 696f 6e20 6f66 e. Estimation of │ │ │ +000b1350: 2066 756e 6461 6d65 6e74 616c 206d 6174 fundamental mat │ │ │ +000b1360: 7269 7820 7573 696e 6720 7468 6520 5241 rix using the RA │ │ │ +000b1370: 4e53 4143 2061 6c67 6f72 6974 686d 0a20 NSAC algorithm. │ │ │ +000b1380: 2020 2069 6e74 2070 6f69 6e74 5f63 6f75 int point_cou │ │ │ +000b1390: 6e74 203d 2031 3030 3b0a 2020 2020 7665 nt = 100;. ve │ │ │ +000b13a0: 6374 6f72 266c 743b 506f 696e 7432 6626 ctor<Point2f& │ │ │ +000b13b0: 6774 3b20 706f 696e 7473 3128 706f 696e gt; points1(poin │ │ │ +000b13c0: 745f 636f 756e 7429 3b0a 2020 2020 7665 t_count);. ve │ │ │ +000b13d0: 6374 6f72 266c 743b 506f 696e 7432 6626 ctor<Point2f& │ │ │ +000b13e0: 6774 3b20 706f 696e 7473 3228 706f 696e gt; points2(poin │ │ │ +000b13f0: 745f 636f 756e 7429 3b0a 0a20 2020 202f t_count);.. / │ │ │ +000b1400: 2f20 696e 6974 6961 6c69 7a65 2074 6865 / initialize the │ │ │ +000b1410: 2070 6f69 6e74 7320 6865 7265 202e 2e2e points here ... │ │ │ +000b1420: 0a20 2020 2066 6f72 2820 696e 7420 6920 . for( int i │ │ │ +000b1430: 3d20 303b 2069 2026 6c74 3b20 706f 696e = 0; i < poin │ │ │ +000b1440: 745f 636f 756e 743b 2069 2b2b 2029 0a20 t_count; i++ ). │ │ │ +000b1450: 2020 207b 0a20 2020 2020 2020 2070 6f69 {. poi │ │ │ +000b1460: 6e74 7331 5b69 5d20 3d20 2e2e 2e3b 0a20 nts1[i] = ...;. │ │ │ +000b1470: 2020 2020 2020 2070 6f69 6e74 7332 5b69 points2[i │ │ │ +000b1480: 5d20 3d20 2e2e 2e3b 0a20 2020 207d 0a0a ] = ...;. }.. │ │ │ +000b1490: 2020 2020 2f2f 2049 6e70 7574 3a20 6361 // Input: ca │ │ │ +000b14a0: 6d65 7261 2063 616c 6962 7261 7469 6f6e mera calibration │ │ │ +000b14b0: 206f 6620 626f 7468 2063 616d 6572 6173 of both cameras │ │ │ +000b14c0: 2c20 666f 7220 6578 616d 706c 6520 7573 , for example us │ │ │ +000b14d0: 696e 6720 696e 7472 696e 7369 6320 6368 ing intrinsic ch │ │ │ +000b14e0: 6573 7362 6f61 7264 2063 616c 6962 7261 essboard calibra │ │ │ +000b14f0: 7469 6f6e 2e0a 2020 2020 4d61 7420 6361 tion.. Mat ca │ │ │ +000b1500: 6d65 7261 4d61 7472 6978 312c 2064 6973 meraMatrix1, dis │ │ │ +000b1510: 7443 6f65 6666 7331 2c20 6361 6d65 7261 tCoeffs1, camera │ │ │ +000b1520: 4d61 7472 6978 322c 2064 6973 7443 6f65 Matrix2, distCoe │ │ │ +000b1530: 6666 7332 3b0a 0a20 2020 202f 2f20 4f75 ffs2;.. // Ou │ │ │ +000b1540: 7470 7574 3a20 4573 7365 6e74 6961 6c20 tput: Essential │ │ │ +000b1550: 6d61 7472 6978 2c20 7265 6c61 7469 7665 matrix, relative │ │ │ +000b1560: 2072 6f74 6174 696f 6e20 616e 6420 7265 rotation and re │ │ │ +000b1570: 6c61 7469 7665 2074 7261 6e73 6c61 7469 lative translati │ │ │ +000b1580: 6f6e 2e0a 2020 2020 4d61 7420 452c 2052 on.. Mat E, R │ │ │ +000b1590: 2c20 742c 206d 6173 6b3b 0a0a 2020 2020 , t, mask;.. │ │ │ +000b15a0: 7265 636f 7665 7250 6f73 6528 706f 696e recoverPose(poin │ │ │ +000b15b0: 7473 312c 2070 6f69 6e74 7332 2c20 6361 ts1, points2, ca │ │ │ +000b15c0: 6d65 7261 4d61 7472 6978 312c 2064 6973 meraMatrix1, dis │ │ │ +000b15d0: 7443 6f65 6666 7331 2c20 6361 6d65 7261 tCoeffs1, camera │ │ │ +000b15e0: 4d61 7472 6978 322c 2064 6973 7443 6f65 Matrix2, distCoe │ │ │ +000b15f0: 6666 7332 2c20 452c 2052 2c20 742c 206d ffs2, E, R, t, m │ │ │ +000b1600: 6173 6b29 3b0a 3c2f 636f 6465 3e3c 2f64 ask);.
    .
    Returns:< │ │ │ +000b1620: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
    automat │ │ │ +000b1630: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ +000b1640: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ..
  • ..
  • ..

    reco │ │ │ +000b1750: 7665 7250 6f73 653c 2f68 333e 0a3c 6469 verPose

    ..public static │ │ │ +000b17c0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  int recoverPose
    (M │ │ │ +000b1880: 6174 3c2f 613e 266e 6273 703b 706f 696e at poin │ │ │ +000b1890: 7473 312c 0a20 3c61 2068 7265 663d 222e ts1,. Mat p │ │ │ +000b18e0: 6f69 6e74 7332 2c0a 203c 6120 6872 6566 oints2,. Mat&nbs │ │ │ +000b1930: 703b 6361 6d65 7261 4d61 7472 6978 312c p;cameraMatrix1, │ │ │ +000b1940: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000b1980: 743c 2f61 3e26 6e62 7370 3b64 6973 7443 t distC │ │ │ +000b1990: 6f65 6666 7331 2c0a 203c 6120 6872 6566 oeffs1,. Mat&nbs │ │ │ +000b19e0: 703b 6361 6d65 7261 4d61 7472 6978 322c p;cameraMatrix2, │ │ │ +000b19f0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000b1a30: 743c 2f61 3e26 6e62 7370 3b64 6973 7443 t distC │ │ │ +000b1a40: 6f65 6666 7332 2c0a 203c 6120 6872 6566 oeffs2,. Mat&nbs │ │ │ +000b1a90: 703b 452c 0a20 3c61 2068 7265 663d 222e p;E,. Mat R │ │ │ +000b1ae0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000b1b20: 6174 3c2f 613e 266e 6273 703b 7429 3c2f at t).
    R │ │ │ +000b1b50: 6563 6f76 6572 7320 7468 6520 7265 6c61 ecovers the rela │ │ │ +000b1b60: 7469 7665 2063 616d 6572 6120 726f 7461 tive camera rota │ │ │ +000b1b70: 7469 6f6e 2061 6e64 2074 6865 2074 7261 tion and the tra │ │ │ +000b1b80: 6e73 6c61 7469 6f6e 2066 726f 6d20 636f nslation from co │ │ │ +000b1b90: 7272 6573 706f 6e64 696e 6720 706f 696e rresponding poin │ │ │ +000b1ba0: 7473 2069 6e20 7477 6f20 696d 6167 6573 ts in two images │ │ │ +000b1bb0: 2066 726f 6d20 7477 6f20 6469 6666 6572 from two differ │ │ │ +000b1bc0: 656e 7420 6361 6d65 7261 732c 2075 7369 ent cameras, usi │ │ │ +000b1bd0: 6e67 2063 6869 7261 6c69 7479 2063 6865 ng chirality che │ │ │ +000b1be0: 636b 2e20 5265 7475 726e 7320 7468 6520 ck. Returns the │ │ │ +000b1bf0: 6e75 6d62 6572 206f 660a 696e 6c69 6572 number of.inlier │ │ │ +000b1c00: 7320 7468 6174 2070 6173 7320 7468 6520 s that pass the │ │ │ +000b1c10: 6368 6563 6b2e 3c2f 6469 763e 0a3c 646c check.
    .
    . │ │ │ +000b1c30: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ +000b1c40: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e70 /dt>.
    p │ │ │ +000b1c50: 6f69 6e74 7331 3c2f 636f 6465 3e20 2d20 oints1 - │ │ │ +000b1c60: 4172 7261 7920 6f66 204e 2032 4420 706f Array of N 2D po │ │ │ +000b1c70: 696e 7473 2066 726f 6d20 7468 6520 6669 ints from the fi │ │ │ +000b1c80: 7273 7420 696d 6167 652e 2054 6865 2070 rst image. The p │ │ │ +000b1c90: 6f69 6e74 2063 6f6f 7264 696e 6174 6573 oint coordinates │ │ │ +000b1ca0: 2073 686f 756c 6420 6265 0a66 6c6f 6174 should be.float │ │ │ +000b1cb0: 696e 672d 706f 696e 7420 2873 696e 676c ing-point (singl │ │ │ +000b1cc0: 6520 6f72 2064 6f75 626c 6520 7072 6563 e or double prec │ │ │ +000b1cd0: 6973 696f 6e29 2e3c 2f64 643e 0a3c 6464 ision).
    .
    points2 - Array of │ │ │ +000b1d00: 2074 6865 2073 6563 6f6e 6420 696d 6167 the second imag │ │ │ +000b1d10: 6520 706f 696e 7473 206f 6620 7468 6520 e points of the │ │ │ +000b1d20: 7361 6d65 2073 697a 6520 616e 6420 666f same size and fo │ │ │ +000b1d30: 726d 6174 2061 7320 706f 696e 7473 3120 rmat as points1 │ │ │ +000b1d40: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    cameraMatrix1 - Input/ou │ │ │ +000b1d70: 7470 7574 2063 616d 6572 6120 6d61 7472 tput camera matr │ │ │ +000b1d80: 6978 2066 6f72 2074 6865 2066 6972 7374 ix for the first │ │ │ +000b1d90: 2063 616d 6572 612c 2074 6865 2073 616d camera, the sam │ │ │ +000b1da0: 6520 6173 2069 6e0a 5245 463a 2063 616c e as in.REF: cal │ │ │ +000b1db0: 6962 7261 7465 4361 6d65 7261 2e20 4675 ibrateCamera. Fu │ │ │ +000b1dc0: 7274 6865 726d 6f72 652c 2066 6f72 2074 rthermore, for t │ │ │ +000b1dd0: 6865 2073 7465 7265 6f20 6361 7365 2c20 he stereo case, │ │ │ +000b1de0: 6164 6469 7469 6f6e 616c 2066 6c61 6773 additional flags │ │ │ +000b1df0: 206d 6179 2062 6520 7573 6564 2c20 7365 may be used, se │ │ │ +000b1e00: 6520 6265 6c6f 772e 3c2f 6464 3e0a 3c64 e below.
    .distCoef │ │ │ +000b1e20: 6673 313c 2f63 6f64 653e 202d 2049 6e70 fs1 - Inp │ │ │ +000b1e30: 7574 2f6f 7574 7075 7420 7665 6374 6f72 ut/output vector │ │ │ +000b1e40: 206f 6620 6469 7374 6f72 7469 6f6e 2063 of distortion c │ │ │ +000b1e50: 6f65 6666 6963 6965 6e74 732c 2074 6865 oefficients, the │ │ │ +000b1e60: 2073 616d 6520 6173 2069 6e0a 5245 463a same as in.REF: │ │ │ +000b1e70: 2063 616c 6962 7261 7465 4361 6d65 7261 calibrateCamera │ │ │ +000b1e80: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 ..
    cameraMatrix2 - Input/ou │ │ │ +000b1eb0: 7470 7574 2063 616d 6572 6120 6d61 7472 tput camera matr │ │ │ +000b1ec0: 6978 2066 6f72 2074 6865 2066 6972 7374 ix for the first │ │ │ +000b1ed0: 2063 616d 6572 612c 2074 6865 2073 616d camera, the sam │ │ │ +000b1ee0: 6520 6173 2069 6e0a 5245 463a 2063 616c e as in.REF: cal │ │ │ +000b1ef0: 6962 7261 7465 4361 6d65 7261 2e20 4675 ibrateCamera. Fu │ │ │ +000b1f00: 7274 6865 726d 6f72 652c 2066 6f72 2074 rthermore, for t │ │ │ +000b1f10: 6865 2073 7465 7265 6f20 6361 7365 2c20 he stereo case, │ │ │ +000b1f20: 6164 6469 7469 6f6e 616c 2066 6c61 6773 additional flags │ │ │ +000b1f30: 206d 6179 2062 6520 7573 6564 2c20 7365 may be used, se │ │ │ +000b1f40: 6520 6265 6c6f 772e 3c2f 6464 3e0a 3c64 e below.
    .distCoef │ │ │ +000b1f60: 6673 323c 2f63 6f64 653e 202d 2049 6e70 fs2 - Inp │ │ │ +000b1f70: 7574 2f6f 7574 7075 7420 7665 6374 6f72 ut/output vector │ │ │ +000b1f80: 206f 6620 6469 7374 6f72 7469 6f6e 2063 of distortion c │ │ │ +000b1f90: 6f65 6666 6963 6965 6e74 732c 2074 6865 oefficients, the │ │ │ +000b1fa0: 2073 616d 6520 6173 2069 6e0a 5245 463a same as in.REF: │ │ │ +000b1fb0: 2063 616c 6962 7261 7465 4361 6d65 7261 calibrateCamera │ │ │ +000b1fc0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 ..
    E - The │ │ │ +000b1fe0: 6f75 7470 7574 2065 7373 656e 7469 616c output essential │ │ │ +000b1ff0: 206d 6174 7269 782e 3c2f 6464 3e0a 3c64 matrix.
    .R │ │ │ +000b2010: 202d 204f 7574 7075 7420 726f 7461 7469 - Output rotati │ │ │ +000b2020: 6f6e 206d 6174 7269 782e 2054 6f67 6574 on matrix. Toget │ │ │ +000b2030: 6865 7220 7769 7468 2074 6865 2074 7261 her with the tra │ │ │ +000b2040: 6e73 6c61 7469 6f6e 2076 6563 746f 722c nslation vector, │ │ │ +000b2050: 2074 6869 7320 6d61 7472 6978 206d 616b this matrix mak │ │ │ +000b2060: 6573 2075 7020 6120 7475 706c 650a 7468 es up a tuple.th │ │ │ +000b2070: 6174 2070 6572 666f 726d 7320 6120 6368 at performs a ch │ │ │ +000b2080: 616e 6765 206f 6620 6261 7369 7320 6672 ange of basis fr │ │ │ +000b2090: 6f6d 2074 6865 2066 6972 7374 2063 616d om the first cam │ │ │ +000b20a0: 6572 6127 7320 636f 6f72 6469 6e61 7465 era's coordinate │ │ │ +000b20b0: 2073 7973 7465 6d20 746f 2074 6865 2073 system to the s │ │ │ +000b20c0: 6563 6f6e 6420 6361 6d65 7261 2773 0a63 econd camera's.c │ │ │ +000b20d0: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ +000b20e0: 2e20 4e6f 7465 2074 6861 742c 2069 6e20 . Note that, in │ │ │ +000b20f0: 6765 6e65 7261 6c2c 2074 2063 616e 206e general, t can n │ │ │ +000b2100: 6f74 2062 6520 7573 6564 2066 6f72 2074 ot be used for t │ │ │ +000b2110: 6869 7320 7475 706c 652c 2073 6565 2074 his tuple, see t │ │ │ +000b2120: 6865 2070 6172 616d 6574 6572 0a64 6573 he parameter.des │ │ │ +000b2130: 6372 6962 6564 2062 656c 6f77 2e3c 2f64 cribed below..
    t - Output t │ │ │ +000b2160: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ +000b2170: 722e 2054 6869 7320 7665 6374 6f72 2069 r. This vector i │ │ │ +000b2180: 7320 6f62 7461 696e 6564 2062 7920 5245 s obtained by RE │ │ │ +000b2190: 463a 2064 6563 6f6d 706f 7365 4573 7365 F: decomposeEsse │ │ │ +000b21a0: 6e74 6961 6c4d 6174 2061 6e64 0a74 6865 ntialMat and.the │ │ │ +000b21b0: 7265 666f 7265 2069 7320 6f6e 6c79 206b refore is only k │ │ │ +000b21c0: 6e6f 776e 2075 7020 746f 2073 6361 6c65 nown up to scale │ │ │ +000b21d0: 2c20 692e 652e 2074 2069 7320 7468 6520 , i.e. t is the │ │ │ +000b21e0: 6469 7265 6374 696f 6e20 6f66 2074 6865 direction of the │ │ │ +000b21f0: 2074 7261 6e73 6c61 7469 6f6e 2076 6563 translation vec │ │ │ +000b2200: 746f 7220 616e 6420 6861 7320 756e 6974 tor and has unit │ │ │ +000b2210: 0a6c 656e 6774 682e 0a3c 756c 3e0a 2020 .length..
      . │ │ │ +000b2220: 3c6c 693e 0a20 2020 5245 463a 2052 414e
    • . REF: RAN │ │ │ +000b2230: 5341 4320 666f 7220 7468 6520 5241 4e53 SAC for the RANS │ │ │ +000b2240: 4143 2061 6c67 6f72 6974 686d 2e0a 2020 AC algorithm.. │ │ │ +000b2250: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020
    • .
    • . │ │ │ +000b2260: 5245 463a 204c 4d45 4453 2066 6f72 2074 REF: LMEDS for t │ │ │ +000b2270: 6865 204c 4d65 6453 2061 6c67 6f72 6974 he LMedS algorit │ │ │ +000b2280: 686d 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c hm..
    • .
    .confidence (pr │ │ │ +000b22a0: 6f62 6162 696c 6974 7929 2074 6861 7420 obability) that │ │ │ +000b22b0: 7468 6520 6573 7469 6d61 7465 6420 6d61 the estimated ma │ │ │ +000b22c0: 7472 6978 2069 7320 636f 7272 6563 742e trix is correct. │ │ │ +000b22d0: 0a6c 696e 6520 696e 2070 6978 656c 732c .line in pixels, │ │ │ +000b22e0: 2062 6579 6f6e 6420 7768 6963 6820 7468 beyond which th │ │ │ +000b22f0: 6520 706f 696e 7420 6973 2063 6f6e 7369 e point is consi │ │ │ +000b2300: 6465 7265 6420 616e 206f 7574 6c69 6572 dered an outlier │ │ │ +000b2310: 2061 6e64 2069 7320 6e6f 7420 7573 6564 and is not used │ │ │ +000b2320: 2066 6f72 2063 6f6d 7075 7469 6e67 2074 for computing t │ │ │ +000b2330: 6865 0a66 696e 616c 2066 756e 6461 6d65 he.final fundame │ │ │ +000b2340: 6e74 616c 206d 6174 7269 782e 2049 7420 ntal matrix. It │ │ │ +000b2350: 6361 6e20 6265 2073 6574 2074 6f20 736f can be set to so │ │ │ +000b2360: 6d65 7468 696e 6720 6c69 6b65 2031 2d33 mething like 1-3 │ │ │ +000b2370: 2c20 6465 7065 6e64 696e 6720 6f6e 2074 , depending on t │ │ │ +000b2380: 6865 2061 6363 7572 6163 7920 6f66 2074 he accuracy of t │ │ │ +000b2390: 6865 0a70 6f69 6e74 206c 6f63 616c 697a he.point localiz │ │ │ +000b23a0: 6174 696f 6e2c 2069 6d61 6765 2072 6573 ation, image res │ │ │ +000b23b0: 6f6c 7574 696f 6e2c 2061 6e64 2074 6865 olution, and the │ │ │ +000b23c0: 2069 6d61 6765 206e 6f69 7365 2e0a 696e image noise..in │ │ │ +000b23d0: 6c69 6572 7320 696e 2070 6f69 6e74 7331 liers in points1 │ │ │ +000b23e0: 2061 6e64 2070 6f69 6e74 7332 2066 6f72 and points2 for │ │ │ +000b23f0: 2074 6865 2067 6976 656e 2065 7373 656e the given essen │ │ │ +000b2400: 7469 616c 206d 6174 7269 7820 452e 204f tial matrix E. O │ │ │ +000b2410: 6e6c 7920 7468 6573 6520 696e 6c69 6572 nly these inlier │ │ │ +000b2420: 7320 7769 6c6c 2062 6520 7573 6564 2074 s will be used t │ │ │ +000b2430: 6f0a 7265 636f 7665 7220 706f 7365 2e20 o.recover pose. │ │ │ +000b2440: 496e 2074 6865 206f 7574 7075 7420 6d61 In the output ma │ │ │ +000b2450: 736b 206f 6e6c 7920 696e 6c69 6572 7320 sk only inliers │ │ │ +000b2460: 7768 6963 6820 7061 7373 2074 6865 2063 which pass the c │ │ │ +000b2470: 6869 7261 6c69 7479 2063 6865 636b 2e0a hirality check.. │ │ │ +000b2480: 0a54 6869 7320 6675 6e63 7469 6f6e 2064 .This function d │ │ │ +000b2490: 6563 6f6d 706f 7365 7320 616e 2065 7373 ecomposes an ess │ │ │ +000b24a0: 656e 7469 616c 206d 6174 7269 7820 7573 ential matrix us │ │ │ +000b24b0: 696e 6720 5245 463a 2064 6563 6f6d 706f ing REF: decompo │ │ │ +000b24c0: 7365 4573 7365 6e74 6961 6c4d 6174 2061 seEssentialMat a │ │ │ +000b24d0: 6e64 2074 6865 6e20 7665 7269 6669 6573 nd then verifies │ │ │ +000b24e0: 0a70 6f73 7369 626c 6520 706f 7365 2068 .possible pose h │ │ │ +000b24f0: 7970 6f74 6865 7365 7320 6279 2064 6f69 ypotheses by doi │ │ │ +000b2500: 6e67 2063 6869 7261 6c69 7479 2063 6865 ng chirality che │ │ │ +000b2510: 636b 2e20 5468 6520 6368 6972 616c 6974 ck. The chiralit │ │ │ +000b2520: 7920 6368 6563 6b20 6d65 616e 7320 7468 y check means th │ │ │ +000b2530: 6174 2074 6865 0a74 7269 616e 6775 6c61 at the.triangula │ │ │ +000b2540: 7465 6420 3344 2070 6f69 6e74 7320 7368 ted 3D points sh │ │ │ +000b2550: 6f75 6c64 2068 6176 6520 706f 7369 7469 ould have positi │ │ │ +000b2560: 7665 2064 6570 7468 2e20 536f 6d65 2064 ve depth. Some d │ │ │ +000b2570: 6574 6169 6c73 2063 616e 2062 6520 666f etails can be fo │ │ │ +000b2580: 756e 6420 696e 2043 4954 453a 204e 6973 und in CITE: Nis │ │ │ +000b2590: 7465 7230 332e 0a0a 5468 6973 2066 756e ter03...This fun │ │ │ +000b25a0: 6374 696f 6e20 6361 6e20 6265 2075 7365 ction can be use │ │ │ +000b25b0: 6420 746f 2070 726f 6365 7373 2074 6865 d to process the │ │ │ +000b25c0: 206f 7574 7075 7420 4520 616e 6420 6d61 output E and ma │ │ │ +000b25d0: 736b 2066 726f 6d20 5245 463a 2066 696e sk from REF: fin │ │ │ +000b25e0: 6445 7373 656e 7469 616c 4d61 742e 2049 dEssentialMat. I │ │ │ +000b25f0: 6e20 7468 6973 0a73 6365 6e61 7269 6f2c n this.scenario, │ │ │ +000b2600: 2070 6f69 6e74 7331 2061 6e64 2070 6f69 points1 and poi │ │ │ +000b2610: 6e74 7332 2061 7265 2074 6865 2073 616d nts2 are the sam │ │ │ +000b2620: 6520 696e 7075 7420 666f 7220 6669 6e64 e input for find │ │ │ +000b2630: 4573 7365 6e74 6961 6c4d 6174 2e3a 0a3c EssentialMat.:.< │ │ │ +000b2640: 636f 6465 3e0a 2020 2020 2f2f 2045 7861 code>. // Exa │ │ │ +000b2650: 6d70 6c65 2e20 4573 7469 6d61 7469 6f6e mple. Estimation │ │ │ +000b2660: 206f 6620 6675 6e64 616d 656e 7461 6c20 of fundamental │ │ │ +000b2670: 6d61 7472 6978 2075 7369 6e67 2074 6865 matrix using the │ │ │ +000b2680: 2052 414e 5341 4320 616c 676f 7269 7468 RANSAC algorith │ │ │ +000b2690: 6d0a 2020 2020 696e 7420 706f 696e 745f m. int point_ │ │ │ +000b26a0: 636f 756e 7420 3d20 3130 303b 0a20 2020 count = 100;. │ │ │ +000b26b0: 2076 6563 746f 7226 6c74 3b50 6f69 6e74 vector<Point │ │ │ +000b26c0: 3266 2667 743b 2070 6f69 6e74 7331 2870 2f> points1(p │ │ │ +000b26d0: 6f69 6e74 5f63 6f75 6e74 293b 0a20 2020 oint_count);. │ │ │ +000b26e0: 2076 6563 746f 7226 6c74 3b50 6f69 6e74 vector<Point │ │ │ +000b26f0: 3266 2667 743b 2070 6f69 6e74 7332 2870 2f> points2(p │ │ │ +000b2700: 6f69 6e74 5f63 6f75 6e74 293b 0a0a 2020 oint_count);.. │ │ │ +000b2710: 2020 2f2f 2069 6e69 7469 616c 697a 6520 // initialize │ │ │ +000b2720: 7468 6520 706f 696e 7473 2068 6572 6520 the points here │ │ │ +000b2730: 2e2e 2e0a 2020 2020 666f 7228 2069 6e74 .... for( int │ │ │ +000b2740: 2069 203d 2030 3b20 6920 266c 743b 2070 i = 0; i < p │ │ │ +000b2750: 6f69 6e74 5f63 6f75 6e74 3b20 692b 2b20 oint_count; i++ │ │ │ +000b2760: 290a 2020 2020 7b0a 2020 2020 2020 2020 ). {. │ │ │ +000b2770: 706f 696e 7473 315b 695d 203d 202e 2e2e points1[i] = ... │ │ │ +000b2780: 3b0a 2020 2020 2020 2020 706f 696e 7473 ;. points │ │ │ +000b2790: 325b 695d 203d 202e 2e2e 3b0a 2020 2020 2[i] = ...;. │ │ │ +000b27a0: 7d0a 0a20 2020 202f 2f20 496e 7075 743a }.. // Input: │ │ │ +000b27b0: 2063 616d 6572 6120 6361 6c69 6272 6174 camera calibrat │ │ │ +000b27c0: 696f 6e20 6f66 2062 6f74 6820 6361 6d65 ion of both came │ │ │ +000b27d0: 7261 732c 2066 6f72 2065 7861 6d70 6c65 ras, for example │ │ │ +000b27e0: 2075 7369 6e67 2069 6e74 7269 6e73 6963 using intrinsic │ │ │ +000b27f0: 2063 6865 7373 626f 6172 6420 6361 6c69 chessboard cali │ │ │ +000b2800: 6272 6174 696f 6e2e 0a20 2020 204d 6174 bration.. Mat │ │ │ +000b2810: 2063 616d 6572 614d 6174 7269 7831 2c20 cameraMatrix1, │ │ │ +000b2820: 6469 7374 436f 6566 6673 312c 2063 616d distCoeffs1, cam │ │ │ +000b2830: 6572 614d 6174 7269 7832 2c20 6469 7374 eraMatrix2, dist │ │ │ +000b2840: 436f 6566 6673 323b 0a0a 2020 2020 2f2f Coeffs2;.. // │ │ │ +000b2850: 204f 7574 7075 743a 2045 7373 656e 7469 Output: Essenti │ │ │ +000b2860: 616c 206d 6174 7269 782c 2072 656c 6174 al matrix, relat │ │ │ +000b2870: 6976 6520 726f 7461 7469 6f6e 2061 6e64 ive rotation and │ │ │ +000b2880: 2072 656c 6174 6976 6520 7472 616e 736c relative transl │ │ │ +000b2890: 6174 696f 6e2e 0a20 2020 204d 6174 2045 ation.. Mat E │ │ │ +000b28a0: 2c20 522c 2074 2c20 6d61 736b 3b0a 0a20 , R, t, mask;.. │ │ │ +000b28b0: 2020 2072 6563 6f76 6572 506f 7365 2870 recoverPose(p │ │ │ +000b28c0: 6f69 6e74 7331 2c20 706f 696e 7473 322c oints1, points2, │ │ │ +000b28d0: 2063 616d 6572 614d 6174 7269 7831 2c20 cameraMatrix1, │ │ │ +000b28e0: 6469 7374 436f 6566 6673 312c 2063 616d distCoeffs1, cam │ │ │ +000b28f0: 6572 614d 6174 7269 7832 2c20 6469 7374 eraMatrix2, dist │ │ │ +000b2900: 436f 6566 6673 322c 2045 2c20 522c 2074 Coeffs2, E, R, t │ │ │ +000b2910: 2c20 6d61 736b 293b 0a3c 2f63 6f64 653e , mask);.
    │ │ │ +000b2920: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ +000b2930: 733a 3c2f 6474 3e0a 3c64 643e 6175 746f s:
    .
    auto │ │ │ +000b2940: 6d61 7469 6361 6c6c 7920 6765 6e65 7261 matically genera │ │ │ +000b2950: 7465 643c 2f64 643e 0a3c 2f64 6c3e 0a3c ted
    .
    .< │ │ │ +000b2960: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
  • │ │ │ +000b2970: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 ..
  • ..

    recoverPo │ │ │ +000b2a40: 7365 3c2f 6833 3e0a 3c64 6976 2063 6c61 se

    .
    .
    pu │ │ │ +000b2aa0: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static int&nbs │ │ │ +000b2ae0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;rec │ │ │ +000b2b00: 6f76 6572 506f 7365 3c2f 7370 616e 3e3c overPose< │ │ │ +000b2b10: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat E,. Mat&n │ │ │ +000b2bc0: 6273 703b 706f 696e 7473 312c 0a20 3c61 bsp;points1,. Mat points2,. │ │ │ +000b2c20: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000b2c60: 3c2f 613e 266e 6273 703b 6361 6d65 7261  camera │ │ │ +000b2c70: 4d61 7472 6978 2c0a 203c 6120 6872 6566 Matrix,. Mat&nbs │ │ │ +000b2cc0: 703b 522c 0a20 3c61 2068 7265 663d 222e p;R,. Mat t │ │ │ +000b2d10: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000b2d50: 6174 3c2f 613e 266e 6273 703b 6d61 736b at mask │ │ │ +000b2d60: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ +000b2d70: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ +000b2d80: 223e 5265 636f 7665 7273 2074 6865 2072 ">Recovers the r │ │ │ +000b2d90: 656c 6174 6976 6520 6361 6d65 7261 2072 elative camera r │ │ │ +000b2da0: 6f74 6174 696f 6e20 616e 6420 7468 6520 otation and the │ │ │ +000b2db0: 7472 616e 736c 6174 696f 6e20 6672 6f6d translation from │ │ │ +000b2dc0: 2061 6e20 6573 7469 6d61 7465 6420 6573 an estimated es │ │ │ +000b2dd0: 7365 6e74 6961 6c0a 6d61 7472 6978 2061 sential.matrix a │ │ │ +000b2de0: 6e64 2074 6865 2063 6f72 7265 7370 6f6e nd the correspon │ │ │ +000b2df0: 6469 6e67 2070 6f69 6e74 7320 696e 2074 ding points in t │ │ │ +000b2e00: 776f 2069 6d61 6765 732c 2075 7369 6e67 wo images, using │ │ │ +000b2e10: 2063 6869 7261 6c69 7479 2063 6865 636b chirality check │ │ │ +000b2e20: 2e20 5265 7475 726e 7320 7468 6520 6e75 . Returns the nu │ │ │ +000b2e30: 6d62 6572 206f 660a 696e 6c69 6572 7320 mber of.inliers │ │ │ +000b2e40: 7468 6174 2070 6173 7320 7468 6520 6368 that pass the ch │ │ │ +000b2e50: 6563 6b2e 3c2f 6469 763e 0a3c 646c 2063 eck.
    .
    .Parameters:.
    E - The inpu │ │ │ +000b2ea0: 7420 6573 7365 6e74 6961 6c20 6d61 7472 t essential matr │ │ │ +000b2eb0: 6978 2e3c 2f64 643e 0a3c 6464 3e3c 636f ix.
    .
    points1 - Array of N 2 │ │ │ +000b2ee0: 4420 706f 696e 7473 2066 726f 6d20 7468 D points from th │ │ │ +000b2ef0: 6520 6669 7273 7420 696d 6167 652e 2054 e first image. T │ │ │ +000b2f00: 6865 2070 6f69 6e74 2063 6f6f 7264 696e he point coordin │ │ │ +000b2f10: 6174 6573 2073 686f 756c 6420 6265 0a66 ates should be.f │ │ │ +000b2f20: 6c6f 6174 696e 672d 706f 696e 7420 2873 loating-point (s │ │ │ +000b2f30: 696e 676c 6520 6f72 2064 6f75 626c 6520 ingle or double │ │ │ +000b2f40: 7072 6563 6973 696f 6e29 2e3c 2f64 643e precision).
    │ │ │ +000b2f50: 0a3c 6464 3e3c 636f 6465 3e70 6f69 6e74 .
    point │ │ │ +000b2f60: 7332 3c2f 636f 6465 3e20 2d20 4172 7261 s2 - Arra │ │ │ +000b2f70: 7920 6f66 2074 6865 2073 6563 6f6e 6420 y of the second │ │ │ +000b2f80: 696d 6167 6520 706f 696e 7473 206f 6620 image points of │ │ │ +000b2f90: 7468 6520 7361 6d65 2073 697a 6520 616e the same size an │ │ │ +000b2fa0: 6420 666f 726d 6174 2061 7320 706f 696e d format as poin │ │ │ +000b2fb0: 7473 3120 2e3c 2f64 643e 0a3c 6464 3e3c ts1 .
    .
    < │ │ │ +000b2fc0: 636f 6465 3e63 616d 6572 614d 6174 7269 code>cameraMatri │ │ │ +000b2fd0: 783c 2f63 6f64 653e 202d 2043 616d 6572 x - Camer │ │ │ +000b2fe0: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ +000b2ff0: 6978 205c 285c 6361 6d65 7261 6d61 7472 ix \(\cameramatr │ │ │ +000b3000: 6978 7b41 7d5c 2920 2e0a 4e6f 7465 2074 ix{A}\) ..Note t │ │ │ +000b3010: 6861 7420 7468 6973 2066 756e 6374 696f hat this functio │ │ │ +000b3020: 6e20 6173 7375 6d65 7320 7468 6174 2070 n assumes that p │ │ │ +000b3030: 6f69 6e74 7331 2061 6e64 2070 6f69 6e74 oints1 and point │ │ │ +000b3040: 7332 2061 7265 2066 6561 7475 7265 2070 s2 are feature p │ │ │ +000b3050: 6f69 6e74 7320 6672 6f6d 2063 616d 6572 oints from camer │ │ │ +000b3060: 6173 2077 6974 6820 7468 650a 7361 6d65 as with the.same │ │ │ +000b3070: 2063 616d 6572 6120 696e 7472 696e 7369 camera intrinsi │ │ │ +000b3080: 6320 6d61 7472 6978 2e3c 2f64 643e 0a3c c matrix.
    .< │ │ │ +000b3090: 6464 3e3c 636f 6465 3e52 3c2f 636f 6465 dd>R - Output rotat │ │ │ +000b30b0: 696f 6e20 6d61 7472 6978 2e20 546f 6765 ion matrix. Toge │ │ │ +000b30c0: 7468 6572 2077 6974 6820 7468 6520 7472 ther with the tr │ │ │ +000b30d0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ +000b30e0: 2c20 7468 6973 206d 6174 7269 7820 6d61 , this matrix ma │ │ │ +000b30f0: 6b65 7320 7570 2061 2074 7570 6c65 0a74 kes up a tuple.t │ │ │ +000b3100: 6861 7420 7065 7266 6f72 6d73 2061 2063 hat performs a c │ │ │ +000b3110: 6861 6e67 6520 6f66 2062 6173 6973 2066 hange of basis f │ │ │ +000b3120: 726f 6d20 7468 6520 6669 7273 7420 6361 rom the first ca │ │ │ +000b3130: 6d65 7261 2773 2063 6f6f 7264 696e 6174 mera's coordinat │ │ │ +000b3140: 6520 7379 7374 656d 2074 6f20 7468 6520 e system to the │ │ │ +000b3150: 7365 636f 6e64 2063 616d 6572 6127 730a second camera's. │ │ │ +000b3160: 636f 6f72 6469 6e61 7465 2073 7973 7465 coordinate syste │ │ │ +000b3170: 6d2e 204e 6f74 6520 7468 6174 2c20 696e m. Note that, in │ │ │ +000b3180: 2067 656e 6572 616c 2c20 7420 6361 6e20 general, t can │ │ │ +000b3190: 6e6f 7420 6265 2075 7365 6420 666f 7220 not be used for │ │ │ +000b31a0: 7468 6973 2074 7570 6c65 2c20 7365 6520 this tuple, see │ │ │ +000b31b0: 7468 6520 7061 7261 6d65 7465 720a 6465 the parameter.de │ │ │ +000b31c0: 7363 7269 6265 6420 6265 6c6f 772e 3c2f scribed below..
    t< │ │ │ +000b31e0: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ +000b31f0: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ +000b3200: 6f72 2e20 5468 6973 2076 6563 746f 7220 or. This vector │ │ │ +000b3210: 6973 206f 6274 6169 6e65 6420 6279 2052 is obtained by R │ │ │ +000b3220: 4546 3a20 6465 636f 6d70 6f73 6545 7373 EF: decomposeEss │ │ │ +000b3230: 656e 7469 616c 4d61 7420 616e 640a 7468 entialMat and.th │ │ │ +000b3240: 6572 6566 6f72 6520 6973 206f 6e6c 7920 erefore is only │ │ │ +000b3250: 6b6e 6f77 6e20 7570 2074 6f20 7363 616c known up to scal │ │ │ +000b3260: 652c 2069 2e65 2e20 7420 6973 2074 6865 e, i.e. t is the │ │ │ +000b3270: 2064 6972 6563 7469 6f6e 206f 6620 7468 direction of th │ │ │ +000b3280: 6520 7472 616e 736c 6174 696f 6e20 7665 e translation ve │ │ │ +000b3290: 6374 6f72 2061 6e64 2068 6173 2075 6e69 ctor and has uni │ │ │ +000b32a0: 740a 6c65 6e67 7468 2e3c 2f64 643e 0a3c t.length.
    .< │ │ │ +000b32b0: 6464 3e3c 636f 6465 3e6d 6173 6b3c 2f63 dd>mask - Input/out │ │ │ +000b32d0: 7075 7420 6d61 736b 2066 6f72 2069 6e6c put mask for inl │ │ │ +000b32e0: 6965 7273 2069 6e20 706f 696e 7473 3120 iers in points1 │ │ │ +000b32f0: 616e 6420 706f 696e 7473 322e 2049 6620 and points2. If │ │ │ +000b3300: 6974 2069 7320 6e6f 7420 656d 7074 792c it is not empty, │ │ │ +000b3310: 2074 6865 6e20 6974 206d 6172 6b73 0a69 then it marks.i │ │ │ +000b3320: 6e6c 6965 7273 2069 6e20 706f 696e 7473 nliers in points │ │ │ +000b3330: 3120 616e 6420 706f 696e 7473 3220 666f 1 and points2 fo │ │ │ +000b3340: 7220 7468 6520 6769 7665 6e20 6573 7365 r the given esse │ │ │ +000b3350: 6e74 6961 6c20 6d61 7472 6978 2045 2e20 ntial matrix E. │ │ │ +000b3360: 4f6e 6c79 2074 6865 7365 2069 6e6c 6965 Only these inlie │ │ │ +000b3370: 7273 2077 696c 6c20 6265 2075 7365 6420 rs will be used │ │ │ +000b3380: 746f 0a72 6563 6f76 6572 2070 6f73 652e to.recover pose. │ │ │ +000b3390: 2049 6e20 7468 6520 6f75 7470 7574 206d In the output m │ │ │ +000b33a0: 6173 6b20 6f6e 6c79 2069 6e6c 6965 7273 ask only inliers │ │ │ +000b33b0: 2077 6869 6368 2070 6173 7320 7468 6520 which pass the │ │ │ +000b33c0: 6368 6972 616c 6974 7920 6368 6563 6b2e chirality check. │ │ │ +000b33d0: 0a0a 5468 6973 2066 756e 6374 696f 6e20 ..This function │ │ │ +000b33e0: 6465 636f 6d70 6f73 6573 2061 6e20 6573 decomposes an es │ │ │ +000b33f0: 7365 6e74 6961 6c20 6d61 7472 6978 2075 sential matrix u │ │ │ +000b3400: 7369 6e67 2052 4546 3a20 6465 636f 6d70 sing REF: decomp │ │ │ +000b3410: 6f73 6545 7373 656e 7469 616c 4d61 7420 oseEssentialMat │ │ │ +000b3420: 616e 6420 7468 656e 2076 6572 6966 6965 and then verifie │ │ │ +000b3430: 730a 706f 7373 6962 6c65 2070 6f73 6520 s.possible pose │ │ │ +000b3440: 6879 706f 7468 6573 6573 2062 7920 646f hypotheses by do │ │ │ +000b3450: 696e 6720 6368 6972 616c 6974 7920 6368 ing chirality ch │ │ │ +000b3460: 6563 6b2e 2054 6865 2063 6869 7261 6c69 eck. The chirali │ │ │ +000b3470: 7479 2063 6865 636b 206d 6561 6e73 2074 ty check means t │ │ │ +000b3480: 6861 7420 7468 650a 7472 6961 6e67 756c hat the.triangul │ │ │ +000b3490: 6174 6564 2033 4420 706f 696e 7473 2073 ated 3D points s │ │ │ +000b34a0: 686f 756c 6420 6861 7665 2070 6f73 6974 hould have posit │ │ │ +000b34b0: 6976 6520 6465 7074 682e 2053 6f6d 6520 ive depth. Some │ │ │ +000b34c0: 6465 7461 696c 7320 6361 6e20 6265 2066 details can be f │ │ │ +000b34d0: 6f75 6e64 2069 6e20 4349 5445 3a20 4e69 ound in CITE: Ni │ │ │ +000b34e0: 7374 6572 3033 2e0a 0a54 6869 7320 6675 ster03...This fu │ │ │ +000b34f0: 6e63 7469 6f6e 2063 616e 2062 6520 7573 nction can be us │ │ │ +000b3500: 6564 2074 6f20 7072 6f63 6573 7320 7468 ed to process th │ │ │ +000b3510: 6520 6f75 7470 7574 2045 2061 6e64 206d e output E and m │ │ │ +000b3520: 6173 6b20 6672 6f6d 2052 4546 3a20 6669 ask from REF: fi │ │ │ +000b3530: 6e64 4573 7365 6e74 6961 6c4d 6174 2e20 ndEssentialMat. │ │ │ +000b3540: 496e 2074 6869 730a 7363 656e 6172 696f In this.scenario │ │ │ +000b3550: 2c20 706f 696e 7473 3120 616e 6420 706f , points1 and po │ │ │ +000b3560: 696e 7473 3220 6172 6520 7468 6520 7361 ints2 are the sa │ │ │ +000b3570: 6d65 2069 6e70 7574 2066 6f72 2023 6669 me input for #fi │ │ │ +000b3580: 6e64 4573 7365 6e74 6961 6c4d 6174 203a ndEssentialMat : │ │ │ +000b3590: 0a3c 636f 6465 3e0a 2020 2020 2f2f 2045 .. // E │ │ │ +000b35a0: 7861 6d70 6c65 2e20 4573 7469 6d61 7469 xample. Estimati │ │ │ +000b35b0: 6f6e 206f 6620 6675 6e64 616d 656e 7461 on of fundamenta │ │ │ +000b35c0: 6c20 6d61 7472 6978 2075 7369 6e67 2074 l matrix using t │ │ │ +000b35d0: 6865 2052 414e 5341 4320 616c 676f 7269 he RANSAC algori │ │ │ +000b35e0: 7468 6d0a 2020 2020 696e 7420 706f 696e thm. int poin │ │ │ +000b35f0: 745f 636f 756e 7420 3d20 3130 303b 0a20 t_count = 100;. │ │ │ +000b3600: 2020 2076 6563 746f 7226 6c74 3b50 6f69 vector<Poi │ │ │ +000b3610: 6e74 3266 2667 743b 2070 6f69 6e74 7331 nt2f> points1 │ │ │ +000b3620: 2870 6f69 6e74 5f63 6f75 6e74 293b 0a20 (point_count);. │ │ │ +000b3630: 2020 2076 6563 746f 7226 6c74 3b50 6f69 vector<Poi │ │ │ +000b3640: 6e74 3266 2667 743b 2070 6f69 6e74 7332 nt2f> points2 │ │ │ +000b3650: 2870 6f69 6e74 5f63 6f75 6e74 293b 0a0a (point_count);.. │ │ │ +000b3660: 2020 2020 2f2f 2069 6e69 7469 616c 697a // initializ │ │ │ +000b3670: 6520 7468 6520 706f 696e 7473 2068 6572 e the points her │ │ │ +000b3680: 6520 2e2e 2e0a 2020 2020 666f 7228 2069 e .... for( i │ │ │ +000b3690: 6e74 2069 203d 2030 3b20 6920 266c 743b nt i = 0; i < │ │ │ +000b36a0: 2070 6f69 6e74 5f63 6f75 6e74 3b20 692b point_count; i+ │ │ │ +000b36b0: 2b20 290a 2020 2020 7b0a 2020 2020 2020 + ). {. │ │ │ +000b36c0: 2020 706f 696e 7473 315b 695d 203d 202e points1[i] = . │ │ │ +000b36d0: 2e2e 3b0a 2020 2020 2020 2020 706f 696e ..;. poin │ │ │ +000b36e0: 7473 325b 695d 203d 202e 2e2e 3b0a 2020 ts2[i] = ...;. │ │ │ +000b36f0: 2020 7d0a 0a20 2020 202f 2f20 6361 6d65 }.. // came │ │ │ +000b3700: 7472 6120 6d61 7472 6978 2077 6974 6820 tra matrix with │ │ │ +000b3710: 626f 7468 2066 6f63 616c 206c 656e 6774 both focal lengt │ │ │ +000b3720: 6873 203d 2031 2c20 616e 6420 7072 696e hs = 1, and prin │ │ │ +000b3730: 6369 7061 6c20 706f 696e 7420 3d20 2830 cipal point = (0 │ │ │ +000b3740: 2c20 3029 0a20 2020 204d 6174 2063 616d , 0). Mat cam │ │ │ +000b3750: 6572 614d 6174 7269 7820 3d20 4d61 743a eraMatrix = Mat: │ │ │ +000b3760: 3a65 7965 2833 2c20 332c 2043 565f 3634 :eye(3, 3, CV_64 │ │ │ +000b3770: 4629 3b0a 0a20 2020 204d 6174 2045 2c20 F);.. Mat E, │ │ │ +000b3780: 522c 2074 2c20 6d61 736b 3b0a 0a20 2020 R, t, mask;.. │ │ │ +000b3790: 2045 203d 2066 696e 6445 7373 656e 7469 E = findEssenti │ │ │ +000b37a0: 616c 4d61 7428 706f 696e 7473 312c 2070 alMat(points1, p │ │ │ +000b37b0: 6f69 6e74 7332 2c20 6361 6d65 7261 4d61 oints2, cameraMa │ │ │ +000b37c0: 7472 6978 2c20 5241 4e53 4143 2c20 302e trix, RANSAC, 0. │ │ │ +000b37d0: 3939 392c 2031 2e30 2c20 6d61 736b 293b 999, 1.0, mask); │ │ │ +000b37e0: 0a20 2020 2072 6563 6f76 6572 506f 7365 . recoverPose │ │ │ +000b37f0: 2845 2c20 706f 696e 7473 312c 2070 6f69 (E, points1, poi │ │ │ +000b3800: 6e74 7332 2c20 6361 6d65 7261 4d61 7472 nts2, cameraMatr │ │ │ +000b3810: 6978 2c20 522c 2074 2c20 6d61 736b 293b ix, R, t, mask); │ │ │ +000b3820: 0a3c 2f63 6f64 653e 3c2f 6464 3e0a 3c64 ..Returns:. │ │ │ +000b3840: 3c64 643e 6175 746f 6d61 7469 6361 6c6c
    automaticall │ │ │ +000b3850: 7920 6765 6e65 7261 7465 643c 2f64 643e y generated
    │ │ │ +000b3860: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    ...
  • .< │ │ │ +000b3880: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
  • .
    .

    s │ │ │ +0007efa0: 6f6c 7665 506e 503c 2f68 333e 0a3c 6469 olvePnP

    ..public static │ │ │ +0007f010: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  boolean solvePnP(MatOfPo │ │ │ +0007f0e0: 696e 7433 663c 2f61 3e26 6e62 7370 3b6f int3f o │ │ │ +0007f0f0: 626a 6563 7450 6f69 6e74 732c 0a20 3c61 bjectPoints,. MatOfPoint2f< │ │ │ +0007f150: 2f61 3e26 6e62 7370 3b69 6d61 6765 506f /a> imagePo │ │ │ +0007f160: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. Mat  │ │ │ +0007f1b0: 6361 6d65 7261 4d61 7472 6978 2c0a 203c cameraMatrix,. < │ │ │ +0007f1c0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0007f1d0: 4d61 744f 6644 6f75 626c 652e 6874 6d6c MatOfDouble.html │ │ │ +0007f1e0: 2220 7469 746c 653d 2263 6c61 7373 2069 " title="class i │ │ │ +0007f1f0: 6e20 6f72 672e 6f70 656e 6376 2e63 6f72 n org.opencv.cor │ │ │ +0007f200: 6522 3e4d 6174 4f66 446f 7562 6c65 3c2f e">MatOfDouble distCoef │ │ │ +0007f220: 6673 2c0a 203c 6120 6872 6566 3d22 2e2e fs,. Mat rv │ │ │ +0007f270: 6563 2c0a 203c 6120 6872 6566 3d22 2e2e ec,. Mat tv │ │ │ +0007f2c0: 6563 2c0a 2062 6f6f 6c65 616e 266e 6273 ec,. boolean&nbs │ │ │ +0007f2d0: 703b 7573 6545 7874 7269 6e73 6963 4775 p;useExtrinsicGu │ │ │ +0007f2e0: 6573 732c 0a20 696e 7426 6e62 7370 3b66 ess,. int f │ │ │ +0007f2f0: 6c61 6773 293c 2f73 7061 6e3e 3c2f 6469 lags).
    Finds an o │ │ │ +0007f320: 626a 6563 7420 706f 7365 205c 2820 7b7d bject pose \( {} │ │ │ +0007f330: 5e7b 637d 5c6d 6174 6862 667b 547d 5f6f ^{c}\mathbf{T}_o │ │ │ +0007f340: 205c 2920 6672 6f6d 2033 442d 3244 2070 \) from 3D-2D p │ │ │ +0007f350: 6f69 6e74 2063 6f72 7265 7370 6f6e 6465 oint corresponde │ │ │ +0007f360: 6e63 6573 3a0a 0a21 5b50 6572 7370 6563 nces:..![Perspec │ │ │ +0007f370: 7469 7665 2070 726f 6a65 6374 696f 6e2c tive projection, │ │ │ +0007f380: 2066 726f 6d20 6f62 6a65 6374 2074 6f20 from object to │ │ │ +0007f390: 6361 6d65 7261 2066 7261 6d65 5d28 7069 camera frame](pi │ │ │ +0007f3a0: 6373 2f70 696e 686f 6c65 5f68 6f6d 6f67 cs/pinhole_homog │ │ │ +0007f3b0: 656e 656f 7573 5f74 7261 6e73 666f 726d eneous_transform │ │ │ +0007f3c0: 6174 696f 6e2e 6a70 6729 7b20 7769 6474 ation.jpg){ widt │ │ │ +0007f3d0: 683d 3530 2520 7d0a 0a53 4545 3a20 5245 h=50% }..SEE: RE │ │ │ +0007f3e0: 463a 2063 616c 6962 3364 5f73 6f6c 7665 F: calib3d_solve │ │ │ +0007f3f0: 506e 500a 0a54 6869 7320 6675 6e63 7469 PnP..This functi │ │ │ +0007f400: 6f6e 2072 6574 7572 6e73 2074 6865 2072 on returns the r │ │ │ +0007f410: 6f74 6174 696f 6e20 616e 6420 7468 6520 otation and the │ │ │ +0007f420: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ +0007f430: 6f72 7320 7468 6174 2074 7261 6e73 666f ors that transfo │ │ │ +0007f440: 726d 2061 2033 4420 706f 696e 7420 6578 rm a 3D point ex │ │ │ +0007f450: 7072 6573 7365 6420 696e 2074 6865 206f pressed in the o │ │ │ +0007f460: 626a 6563 740a 636f 6f72 6469 6e61 7465 bject.coordinate │ │ │ +0007f470: 2066 7261 6d65 2074 6f20 7468 6520 6361 frame to the ca │ │ │ +0007f480: 6d65 7261 2063 6f6f 7264 696e 6174 6520 mera coordinate │ │ │ +0007f490: 6672 616d 652c 2075 7369 6e67 2064 6966 frame, using dif │ │ │ +0007f4a0: 6665 7265 6e74 206d 6574 686f 6473 3a0a ferent methods:. │ │ │ +0007f4b0: 3c75 6c3e 0a20 203c 6c69 3e0a 2050 3350
      .
    • . P3P │ │ │ +0007f4c0: 206d 6574 686f 6473 2028 5245 463a 2053 methods (REF: S │ │ │ +0007f4d0: 4f4c 5645 504e 505f 5033 502c 2052 4546 OLVEPNP_P3P, REF │ │ │ +0007f4e0: 3a20 534f 4c56 4550 4e50 5f41 5033 5029 : SOLVEPNP_AP3P) │ │ │ +0007f4f0: 3a20 6e65 6564 2034 2069 6e70 7574 2070 : need 4 input p │ │ │ +0007f500: 6f69 6e74 7320 746f 2072 6574 7572 6e20 oints to return │ │ │ +0007f510: 6120 756e 6971 7565 2073 6f6c 7574 696f a unique solutio │ │ │ +0007f520: 6e2e 0a20 203c 2f6c 693e 0a20 203c 6c69 n..
    • .
    • . REF: SOLVEPNP │ │ │ +0007f540: 5f49 5050 4520 496e 7075 7420 706f 696e _IPPE Input poin │ │ │ +0007f550: 7473 206d 7573 7420 6265 2026 6774 3b3d ts must be >= │ │ │ +0007f560: 2034 2061 6e64 206f 626a 6563 7420 706f 4 and object po │ │ │ +0007f570: 696e 7473 206d 7573 7420 6265 2063 6f70 ints must be cop │ │ │ +0007f580: 6c61 6e61 722e 0a20 203c 2f6c 693e 0a20 lanar..
    • . │ │ │ +0007f590: 203c 6c69 3e0a 2052 4546 3a20 534f 4c56
    • . REF: SOLV │ │ │ +0007f5a0: 4550 4e50 5f49 5050 455f 5351 5541 5245 EPNP_IPPE_SQUARE │ │ │ +0007f5b0: 2053 7065 6369 616c 2063 6173 6520 7375 Special case su │ │ │ +0007f5c0: 6974 6162 6c65 2066 6f72 206d 6172 6b65 itable for marke │ │ │ +0007f5d0: 7220 706f 7365 2065 7374 696d 6174 696f r pose estimatio │ │ │ +0007f5e0: 6e2e 0a4e 756d 6265 7220 6f66 2069 6e70 n..Number of inp │ │ │ +0007f5f0: 7574 2070 6f69 6e74 7320 6d75 7374 2062 ut points must b │ │ │ +0007f600: 6520 342e 204f 626a 6563 7420 706f 696e e 4. Object poin │ │ │ +0007f610: 7473 206d 7573 7420 6265 2064 6566 696e ts must be defin │ │ │ +0007f620: 6564 2069 6e20 7468 6520 666f 6c6c 6f77 ed in the follow │ │ │ +0007f630: 696e 6720 6f72 6465 723a 0a20 203c 756c ing order:.
        .
      • . po │ │ │ +0007f650: 696e 7420 303a 205b 2d73 7175 6172 654c int 0: [-squareL │ │ │ +0007f660: 656e 6774 6820 2f20 322c 2020 7371 7561 ength / 2, squa │ │ │ +0007f670: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ +0007f680: 0a20 2020 203c 2f6c 693e 0a20 2020 203c .
      • . < │ │ │ +0007f690: 6c69 3e0a 2020 2070 6f69 6e74 2031 3a20 li>. point 1: │ │ │ +0007f6a0: 5b20 7371 7561 7265 4c65 6e67 7468 202f [ squareLength / │ │ │ +0007f6b0: 2032 2c20 2073 7175 6172 654c 656e 6774 2, squareLengt │ │ │ +0007f6c0: 6820 2f20 322c 2030 5d0a 2020 2020 3c2f h / 2, 0]. .
      • . │ │ │ +0007f6e0: 706f 696e 7420 323a 205b 2073 7175 6172 point 2: [ squar │ │ │ +0007f6f0: 654c 656e 6774 6820 2f20 322c 202d 7371 eLength / 2, -sq │ │ │ +0007f700: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +0007f710: 305d 0a20 2020 203c 2f6c 693e 0a20 2020 0].
      • . │ │ │ +0007f720: 203c 6c69 3e0a 2020 2070 6f69 6e74 2033
      • . point 3 │ │ │ +0007f730: 3a20 5b2d 7371 7561 7265 4c65 6e67 7468 : [-squareLength │ │ │ +0007f740: 202f 2032 2c20 2d73 7175 6172 654c 656e / 2, -squareLen │ │ │ +0007f750: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ +0007f760: 3c2f 6c69 3e0a 2020 3c2f 756c 3e0a 2020
      • .
      . │ │ │ +0007f770: 3c6c 693e 0a20 666f 7220 616c 6c20 7468
    • . for all th │ │ │ +0007f780: 6520 6f74 6865 7220 666c 6167 732c 206e e other flags, n │ │ │ +0007f790: 756d 6265 7220 6f66 2069 6e70 7574 2070 umber of input p │ │ │ +0007f7a0: 6f69 6e74 7320 6d75 7374 2062 6520 2667 oints must be &g │ │ │ +0007f7b0: 743b 3d20 3420 616e 6420 6f62 6a65 6374 t;= 4 and object │ │ │ +0007f7c0: 2070 6f69 6e74 7320 6361 6e20 6265 2069 points can be i │ │ │ +0007f7d0: 6e20 616e 7920 636f 6e66 6967 7572 6174 n any configurat │ │ │ +0007f7e0: 696f 6e2e 0a20 203c 2f6c 693e 0a3c 2f75 ion..
    • .
    .
    .
    │ │ │ +0007f810: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ +0007f820: 0a3c 6464 3e3c 636f 6465 3e6f 626a 6563 .
    objec │ │ │ +0007f830: 7450 6f69 6e74 733c 2f63 6f64 653e 202d tPoints - │ │ │ +0007f840: 2041 7272 6179 206f 6620 6f62 6a65 6374 Array of object │ │ │ +0007f850: 2070 6f69 6e74 7320 696e 2074 6865 206f points in the o │ │ │ +0007f860: 626a 6563 7420 636f 6f72 6469 6e61 7465 bject coordinate │ │ │ +0007f870: 2073 7061 6365 2c20 4e78 3320 312d 6368 space, Nx3 1-ch │ │ │ +0007f880: 616e 6e65 6c20 6f72 0a31 784e 2f4e 7831 annel or.1xN/Nx1 │ │ │ +0007f890: 2033 2d63 6861 6e6e 656c 2c20 7768 6572 3-channel, wher │ │ │ +0007f8a0: 6520 4e20 6973 2074 6865 206e 756d 6265 e N is the numbe │ │ │ +0007f8b0: 7220 6f66 2070 6f69 6e74 732e 2076 6563 r of points. vec │ │ │ +0007f8c0: 746f 7226 6c74 3b50 6f69 6e74 3364 2667 tor<Point3d&g │ │ │ +0007f8d0: 743b 2063 616e 2062 6520 616c 736f 2070 t; can be also p │ │ │ +0007f8e0: 6173 7365 6420 6865 7265 2e3c 2f64 643e assed here.
    │ │ │ +0007f8f0: 0a3c 6464 3e3c 636f 6465 3e69 6d61 6765 .
    image │ │ │ +0007f900: 506f 696e 7473 3c2f 636f 6465 3e20 2d20 Points - │ │ │ +0007f910: 4172 7261 7920 6f66 2063 6f72 7265 7370 Array of corresp │ │ │ +0007f920: 6f6e 6469 6e67 2069 6d61 6765 2070 6f69 onding image poi │ │ │ +0007f930: 6e74 732c 204e 7832 2031 2d63 6861 6e6e nts, Nx2 1-chann │ │ │ +0007f940: 656c 206f 7220 3178 4e2f 4e78 3120 322d el or 1xN/Nx1 2- │ │ │ +0007f950: 6368 616e 6e65 6c2c 0a77 6865 7265 204e channel,.where N │ │ │ +0007f960: 2069 7320 7468 6520 6e75 6d62 6572 206f is the number o │ │ │ +0007f970: 6620 706f 696e 7473 2e20 7665 6374 6f72 f points. vector │ │ │ +0007f980: 266c 743b 506f 696e 7432 6426 6774 3b20 <Point2d> │ │ │ +0007f990: 6361 6e20 6265 2061 6c73 6f20 7061 7373 can be also pass │ │ │ +0007f9a0: 6564 2068 6572 652e 3c2f 6464 3e0a 3c64 ed here.
    .cameraMa │ │ │ +0007f9c0: 7472 6978 3c2f 636f 6465 3e20 2d20 496e trix - In │ │ │ +0007f9d0: 7075 7420 6361 6d65 7261 2069 6e74 7269 put camera intri │ │ │ +0007f9e0: 6e73 6963 206d 6174 7269 7820 5c28 5c63 nsic matrix \(\c │ │ │ +0007f9f0: 616d 6572 616d 6174 7269 787b 417d 5c29 ameramatrix{A}\) │ │ │ +0007fa00: 202e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 ..
    distCoeffs - Input vect │ │ │ +0007fa30: 6f72 206f 6620 6469 7374 6f72 7469 6f6e or of distortion │ │ │ +0007fa40: 2063 6f65 6666 6963 6965 6e74 730a 5c28 coefficients.\( │ │ │ +0007fa50: 5c64 6973 7463 6f65 6666 735c 292e 2049 \distcoeffs\). I │ │ │ +0007fa60: 6620 7468 6520 7665 6374 6f72 2069 7320 f the vector is │ │ │ +0007fa70: 4e55 4c4c 2f65 6d70 7479 2c20 7468 6520 NULL/empty, the │ │ │ +0007fa80: 7a65 726f 2064 6973 746f 7274 696f 6e20 zero distortion │ │ │ +0007fa90: 636f 6566 6669 6369 656e 7473 2061 7265 coefficients are │ │ │ +0007faa0: 0a61 7373 756d 6564 2e3c 2f64 643e 0a3c .assumed.
    .< │ │ │ +0007fab0: 6464 3e3c 636f 6465 3e72 7665 633c 2f63 dd>rvec - Output ro │ │ │ +0007fad0: 7461 7469 6f6e 2076 6563 746f 7220 2873 tation vector (s │ │ │ +0007fae0: 6565 2052 4546 3a20 526f 6472 6967 7565 ee REF: Rodrigue │ │ │ +0007faf0: 7320 2920 7468 6174 2c20 746f 6765 7468 s ) that, togeth │ │ │ +0007fb00: 6572 2077 6974 6820 7476 6563 2c20 6272 er with tvec, br │ │ │ +0007fb10: 696e 6773 2070 6f69 6e74 7320 6672 6f6d ings points from │ │ │ +0007fb20: 0a74 6865 206d 6f64 656c 2063 6f6f 7264 .the model coord │ │ │ +0007fb30: 696e 6174 6520 7379 7374 656d 2074 6f20 inate system to │ │ │ +0007fb40: 7468 6520 6361 6d65 7261 2063 6f6f 7264 the camera coord │ │ │ +0007fb50: 696e 6174 6520 7379 7374 656d 2e3c 2f64 inate system.
    .
    tve │ │ │ +0007fb70: 633c 2f63 6f64 653e 202d 204f 7574 7075 c - Outpu │ │ │ +0007fb80: 7420 7472 616e 736c 6174 696f 6e20 7665 t translation ve │ │ │ +0007fb90: 6374 6f72 2e3c 2f64 643e 0a3c 6464 3e3c ctor.
    .
    < │ │ │ +0007fba0: 636f 6465 3e75 7365 4578 7472 696e 7369 code>useExtrinsi │ │ │ +0007fbb0: 6347 7565 7373 3c2f 636f 6465 3e20 2d20 cGuess - │ │ │ +0007fbc0: 5061 7261 6d65 7465 7220 7573 6564 2066 Parameter used f │ │ │ +0007fbd0: 6f72 2023 534f 4c56 4550 4e50 5f49 5445 or #SOLVEPNP_ITE │ │ │ +0007fbe0: 5241 5449 5645 2e20 4966 2074 7275 6520 RATIVE. If true │ │ │ +0007fbf0: 2831 292c 2074 6865 2066 756e 6374 696f (1), the functio │ │ │ +0007fc00: 6e20 7573 6573 0a74 6865 2070 726f 7669 n uses.the provi │ │ │ +0007fc10: 6465 6420 7276 6563 2061 6e64 2074 7665 ded rvec and tve │ │ │ +0007fc20: 6320 7661 6c75 6573 2061 7320 696e 6974 c values as init │ │ │ +0007fc30: 6961 6c20 6170 7072 6f78 696d 6174 696f ial approximatio │ │ │ +0007fc40: 6e73 206f 6620 7468 6520 726f 7461 7469 ns of the rotati │ │ │ +0007fc50: 6f6e 2061 6e64 2074 7261 6e73 6c61 7469 on and translati │ │ │ +0007fc60: 6f6e 0a76 6563 746f 7273 2c20 7265 7370 on.vectors, resp │ │ │ +0007fc70: 6563 7469 7665 6c79 2c20 616e 6420 6675 ectively, and fu │ │ │ +0007fc80: 7274 6865 7220 6f70 7469 6d69 7a65 7320 rther optimizes │ │ │ +0007fc90: 7468 656d 2e3c 2f64 643e 0a3c 6464 3e3c them.
    .
    < │ │ │ +0007fca0: 636f 6465 3e66 6c61 6773 3c2f 636f 6465 code>flags - Method for s │ │ │ +0007fcc0: 6f6c 7669 6e67 2061 2050 6e50 2070 726f olving a PnP pro │ │ │ +0007fcd0: 626c 656d 3a20 7365 6520 5245 463a 2063 blem: see REF: c │ │ │ +0007fce0: 616c 6962 3364 5f73 6f6c 7665 506e 505f alib3d_solvePnP_ │ │ │ +0007fcf0: 666c 6167 730a 0a4d 6f72 6520 696e 666f flags..More info │ │ │ +0007fd00: 726d 6174 696f 6e20 6162 6f75 7420 5065 rmation about Pe │ │ │ +0007fd10: 7273 7065 6374 6976 652d 6e2d 506f 696e rspective-n-Poin │ │ │ +0007fd20: 7473 2069 7320 6465 7363 7269 6265 6420 ts is described │ │ │ +0007fd30: 696e 2052 4546 3a20 6361 6c69 6233 645f in REF: calib3d_ │ │ │ +0007fd40: 736f 6c76 6550 6e50 0a0a 3c62 3e4e 6f74 solvePnP..Not │ │ │ +0007fd50: 653a 3c2f 623e 0a3c 756c 3e0a 2020 3c6c e:.
      . . An exam │ │ │ +0007fd70: 706c 6520 6f66 2068 6f77 2074 6f20 7573 ple of how to us │ │ │ +0007fd80: 6520 736f 6c76 6550 6e50 2066 6f72 2070 e solvePnP for p │ │ │ +0007fd90: 6c61 6e61 7220 6175 676d 656e 7465 6420 lanar augmented │ │ │ +0007fda0: 7265 616c 6974 7920 6361 6e20 6265 2066 reality can be f │ │ │ +0007fdb0: 6f75 6e64 2061 740a 2020 2020 2020 2020 ound at. │ │ │ +0007fdc0: 6f70 656e 6376 5f73 6f75 7263 655f 636f opencv_source_co │ │ │ +0007fdd0: 6465 2f73 616d 706c 6573 2f70 7974 686f de/samples/pytho │ │ │ +0007fde0: 6e2f 706c 616e 655f 6172 2e70 790a 2020 n/plane_ar.py. │ │ │ +0007fdf0: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020 .
    • . │ │ │ +0007fe00: 2020 2049 6620 796f 7520 6172 6520 7573 If you are us │ │ │ +0007fe10: 696e 6720 5079 7468 6f6e 3a0a 2020 3c75 ing Python:. .
    • . │ │ │ +0007fe30: 2020 2020 204e 756d 7079 2061 7272 6179 Numpy array │ │ │ +0007fe40: 2073 6c69 6365 7320 776f 6e27 7420 776f slices won't wo │ │ │ +0007fe50: 726b 2061 7320 696e 7075 7420 6265 6361 rk as input beca │ │ │ +0007fe60: 7573 6520 736f 6c76 6550 6e50 2072 6571 use solvePnP req │ │ │ +0007fe70: 7569 7265 7320 636f 6e74 6967 756f 7573 uires contiguous │ │ │ +0007fe80: 0a20 2020 2020 2020 2061 7272 6179 7320 . arrays │ │ │ +0007fe90: 2865 6e66 6f72 6365 6420 6279 2074 6865 (enforced by the │ │ │ +0007fea0: 2061 7373 6572 7469 6f6e 2075 7369 6e67 assertion using │ │ │ +0007feb0: 2063 763a 3a4d 6174 3a3a 6368 6563 6b56 cv::Mat::checkV │ │ │ +0007fec0: 6563 746f 7228 2920 6172 6f75 6e64 206c ector() around l │ │ │ +0007fed0: 696e 6520 3535 206f 660a 2020 2020 2020 ine 55 of. │ │ │ +0007fee0: 2020 6d6f 6475 6c65 732f 3364 2f73 7263 modules/3d/src │ │ │ +0007fef0: 2f73 6f6c 7665 706e 702e 6370 7020 7665 /solvepnp.cpp ve │ │ │ +0007ff00: 7273 696f 6e20 322e 342e 3929 0a20 2020 rsion 2.4.9). │ │ │ +0007ff10: 203c 2f6c 693e 0a20 2020 203c 6c69 3e0a
    • .
    • . │ │ │ +0007ff20: 2020 2020 2020 2020 2054 6865 2050 3350 The P3P │ │ │ +0007ff30: 2061 6c67 6f72 6974 686d 2072 6571 7569 algorithm requi │ │ │ +0007ff40: 7265 7320 696d 6167 6520 706f 696e 7473 res image points │ │ │ +0007ff50: 2074 6f20 6265 2069 6e20 616e 2061 7272 to be in an arr │ │ │ +0007ff60: 6179 206f 6620 7368 6170 6520 284e 2c31 ay of shape (N,1 │ │ │ +0007ff70: 2c32 2920 6475 650a 2020 2020 2020 2020 ,2) due. │ │ │ +0007ff80: 746f 2069 7473 2063 616c 6c69 6e67 206f to its calling o │ │ │ +0007ff90: 6620 2375 6e64 6973 746f 7274 506f 696e f #undistortPoin │ │ │ +0007ffa0: 7473 2028 6172 6f75 6e64 206c 696e 6520 ts (around line │ │ │ +0007ffb0: 3735 206f 6620 6d6f 6475 6c65 732f 3364 75 of modules/3d │ │ │ +0007ffc0: 2f73 7263 2f73 6f6c 7665 706e 702e 6370 /src/solvepnp.cp │ │ │ +0007ffd0: 7020 7665 7273 696f 6e20 322e 342e 3929 p version 2.4.9) │ │ │ +0007ffe0: 0a20 2020 2020 2020 2077 6869 6368 2072 . which r │ │ │ +0007fff0: 6571 7569 7265 7320 322d 6368 616e 6e65 equires 2-channe │ │ │ +00080000: 6c20 696e 666f 726d 6174 696f 6e2e 0a20 l information.. │ │ │ +00080010: 2020 203c 2f6c 693e 0a20 2020 203c 6c69
    • .
    • . Thus, │ │ │ +00080030: 2067 6976 656e 2073 6f6d 6520 6461 7461 given some data │ │ │ +00080040: 2044 203d 206e 702e 6172 7261 7928 2e2e D = np.array(.. │ │ │ +00080050: 2e29 2077 6865 7265 2044 2e73 6861 7065 .) where D.shape │ │ │ +00080060: 203d 2028 4e2c 4d29 2c20 696e 206f 7264 = (N,M), in ord │ │ │ +00080070: 6572 2074 6f20 7573 6520 6120 7375 6273 er to use a subs │ │ │ +00080080: 6574 206f 660a 2020 2020 2020 2020 6974 et of. it │ │ │ +00080090: 2061 732c 2065 2e67 2e2c 2069 6d61 6765 as, e.g., image │ │ │ +000800a0: 506f 696e 7473 2c20 6f6e 6520 6d75 7374 Points, one must │ │ │ +000800b0: 2065 6666 6563 7469 7665 6c79 2063 6f70 effectively cop │ │ │ +000800c0: 7920 6974 2069 6e74 6f20 6120 6e65 7720 y it into a new │ │ │ +000800d0: 6172 7261 793a 2069 6d61 6765 506f 696e array: imagePoin │ │ │ +000800e0: 7473 203d 0a20 2020 2020 2020 206e 702e ts =. np. │ │ │ +000800f0: 6173 636f 6e74 6967 756f 7573 6172 7261 ascontiguousarra │ │ │ +00080100: 7928 445b 3a2c 3a32 5d29 2e72 6573 6861 y(D[:,:2]).resha │ │ │ +00080110: 7065 2828 4e2c 312c 3229 290a 2020 2020 pe((N,1,2)). │ │ │ +00080120: 3c2f 6c69 3e0a 2020 3c2f 756c 3e0a 2020
    • .
    . │ │ │ +00080130: 3c6c 693e 0a20 2020 2020 2054 6865 206d
  • . The m │ │ │ +00080140: 696e 696d 756d 206e 756d 6265 7220 6f66 inimum number of │ │ │ +00080150: 2070 6f69 6e74 7320 6973 2034 2069 6e20 points is 4 in │ │ │ +00080160: 7468 6520 6765 6e65 7261 6c20 6361 7365 the general case │ │ │ +00080170: 2e20 496e 2074 6865 2063 6173 6520 6f66 . In the case of │ │ │ +00080180: 2052 4546 3a20 534f 4c56 4550 4e50 5f50 REF: SOLVEPNP_P │ │ │ +00080190: 3350 2061 6e64 2052 4546 3a20 534f 4c56 3P and REF: SOLV │ │ │ +000801a0: 4550 4e50 5f41 5033 500a 2020 2020 2020 EPNP_AP3P. │ │ │ +000801b0: 206d 6574 686f 6473 2c20 6974 2069 7320 methods, it is │ │ │ +000801c0: 7265 7175 6972 6564 2074 6f20 7573 6520 required to use │ │ │ +000801d0: 6578 6163 746c 7920 3420 706f 696e 7473 exactly 4 points │ │ │ +000801e0: 2028 7468 6520 6669 7273 7420 3320 706f (the first 3 po │ │ │ +000801f0: 696e 7473 2061 7265 2075 7365 6420 746f ints are used to │ │ │ +00080200: 2065 7374 696d 6174 6520 616c 6c20 7468 estimate all th │ │ │ +00080210: 6520 736f 6c75 7469 6f6e 730a 2020 2020 e solutions. │ │ │ +00080220: 2020 206f 6620 7468 6520 5033 5020 7072 of the P3P pr │ │ │ +00080230: 6f62 6c65 6d2c 2074 6865 206c 6173 7420 oblem, the last │ │ │ +00080240: 6f6e 6520 6973 2075 7365 6420 746f 2072 one is used to r │ │ │ +00080250: 6574 6169 6e20 7468 6520 6265 7374 2073 etain the best s │ │ │ +00080260: 6f6c 7574 696f 6e20 7468 6174 206d 696e olution that min │ │ │ +00080270: 696d 697a 6573 2074 6865 2072 6570 726f imizes the repro │ │ │ +00080280: 6a65 6374 696f 6e20 6572 726f 7229 2e0a jection error).. │ │ │ +00080290: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
  • .
  • . │ │ │ +000802a0: 2020 2020 2057 6974 6820 5245 463a 2053 With REF: S │ │ │ +000802b0: 4f4c 5645 504e 505f 4954 4552 4154 4956 OLVEPNP_ITERATIV │ │ │ +000802c0: 4520 6d65 7468 6f64 2061 6e64 203c 636f E method and useExtrinsicG │ │ │ +000802e0: 7565 7373 3d74 7275 653c 2f63 6f64 653e uess=true │ │ │ +000802f0: 2c20 7468 6520 6d69 6e69 6d75 6d20 6e75 , the minimum nu │ │ │ +00080300: 6d62 6572 206f 6620 706f 696e 7473 2069 mber of points i │ │ │ +00080310: 7320 3320 2833 2070 6f69 6e74 730a 2020 s 3 (3 points. │ │ │ +00080320: 2020 2020 2061 7265 2073 7566 6669 6369 are suffici │ │ │ +00080330: 656e 7420 746f 2063 6f6d 7075 7465 2061 ent to compute a │ │ │ +00080340: 2070 6f73 6520 6275 7420 7468 6572 6520 pose but there │ │ │ +00080350: 6172 6520 7570 2074 6f20 3420 736f 6c75 are up to 4 solu │ │ │ +00080360: 7469 6f6e 7329 2e20 5468 6520 696e 6974 tions). The init │ │ │ +00080370: 6961 6c20 736f 6c75 7469 6f6e 2073 686f ial solution sho │ │ │ +00080380: 756c 6420 6265 2063 6c6f 7365 2074 6f20 uld be close to │ │ │ +00080390: 7468 650a 2020 2020 2020 2067 6c6f 6261 the. globa │ │ │ +000803a0: 6c20 736f 6c75 7469 6f6e 2074 6f20 636f l solution to co │ │ │ +000803b0: 6e76 6572 6765 2e20 5468 6520 6675 6e63 nverge. The func │ │ │ +000803c0: 7469 6f6e 2072 6574 7572 6e73 2074 7275 tion returns tru │ │ │ +000803d0: 6520 6966 2073 6f6d 6520 736f 6c75 7469 e if some soluti │ │ │ +000803e0: 6f6e 2069 7320 666f 756e 642e 2055 7365 on is found. Use │ │ │ +000803f0: 7220 636f 6465 2069 7320 7265 7370 6f6e r code is respon │ │ │ +00080400: 7369 626c 6520 666f 720a 2020 2020 2020 sible for. │ │ │ +00080410: 2073 6f6c 7574 696f 6e20 7175 616c 6974 solution qualit │ │ │ +00080420: 7920 6173 7365 7373 6d65 6e74 2e0a 2020 y assessment.. │ │ │ +00080430: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020
  • .
  • . │ │ │ +00080440: 2020 2057 6974 6820 5245 463a 2053 4f4c With REF: SOL │ │ │ +00080450: 5645 504e 505f 4950 5045 2069 6e70 7574 VEPNP_IPPE input │ │ │ +00080460: 2070 6f69 6e74 7320 6d75 7374 2062 6520 points must be │ │ │ +00080470: 2667 743b 3d20 3420 616e 6420 6f62 6a65 >= 4 and obje │ │ │ +00080480: 6374 2070 6f69 6e74 7320 6d75 7374 2062 ct points must b │ │ │ +00080490: 6520 636f 706c 616e 6172 2e0a 2020 3c2f e coplanar.. .
  • . │ │ │ +000804b0: 2057 6974 6820 5245 463a 2053 4f4c 5645 With REF: SOLVE │ │ │ +000804c0: 504e 505f 4950 5045 5f53 5155 4152 4520 PNP_IPPE_SQUARE │ │ │ +000804d0: 7468 6973 2069 7320 6120 7370 6563 6961 this is a specia │ │ │ +000804e0: 6c20 6361 7365 2073 7569 7461 626c 6520 l case suitable │ │ │ +000804f0: 666f 7220 6d61 726b 6572 2070 6f73 6520 for marker pose │ │ │ +00080500: 6573 7469 6d61 7469 6f6e 2e0a 2020 2020 estimation.. │ │ │ +00080510: 2020 204e 756d 6265 7220 6f66 2069 6e70 Number of inp │ │ │ +00080520: 7574 2070 6f69 6e74 7320 6d75 7374 2062 ut points must b │ │ │ +00080530: 6520 342e 204f 626a 6563 7420 706f 696e e 4. Object poin │ │ │ +00080540: 7473 206d 7573 7420 6265 2064 6566 696e ts must be defin │ │ │ +00080550: 6564 2069 6e20 7468 6520 666f 6c6c 6f77 ed in the follow │ │ │ +00080560: 696e 6720 6f72 6465 723a 0a20 203c 756c ing order:.
      .
    • . │ │ │ +00080580: 2020 2020 2070 6f69 6e74 2030 3a20 5b2d point 0: [- │ │ │ +00080590: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ +000805a0: 2c20 2073 7175 6172 654c 656e 6774 6820 , squareLength │ │ │ +000805b0: 2f20 322c 2030 5d0a 2020 2020 3c2f 6c69 / 2, 0].
    • .
    • . │ │ │ +000805d0: 2020 2020 2070 6f69 6e74 2031 3a20 5b20 point 1: [ │ │ │ +000805e0: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ +000805f0: 2c20 2073 7175 6172 654c 656e 6774 6820 , squareLength │ │ │ +00080600: 2f20 322c 2030 5d0a 2020 2020 3c2f 6c69 / 2, 0].
    • .
    • . │ │ │ +00080620: 2020 2020 2070 6f69 6e74 2032 3a20 5b20 point 2: [ │ │ │ +00080630: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ +00080640: 2c20 2d73 7175 6172 654c 656e 6774 6820 , -squareLength │ │ │ +00080650: 2f20 322c 2030 5d0a 2020 2020 3c2f 6c69 / 2, 0].
    • .
    • . │ │ │ +00080670: 2020 2020 2070 6f69 6e74 2033 3a20 5b2d point 3: [- │ │ │ +00080680: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ +00080690: 2c20 2d73 7175 6172 654c 656e 6774 6820 , -squareLength │ │ │ +000806a0: 2f20 322c 2030 5d0a 2020 2020 3c2f 6c69 / 2, 0].
    • .
    .
      │ │ │ +000806c0: 0a20 2020 203c 6c69 3e0a 2020 2020 2020 .
    • . │ │ │ +000806d0: 5769 7468 2052 4546 3a20 534f 4c56 4550 With REF: SOLVEP │ │ │ +000806e0: 4e50 5f53 5150 4e50 2069 6e70 7574 2070 NP_SQPNP input p │ │ │ +000806f0: 6f69 6e74 7320 6d75 7374 2062 6520 2667 oints must be &g │ │ │ +00080700: 743b 3d20 330a 2020 2020 3c2f 6c69 3e0a t;= 3.
    • . │ │ │ +00080710: 2020 3c2f 756c 3e0a 2020 3c2f 6c69 3e0a
    .
  • . │ │ │ +00080720: 3c2f 756c 3e3c 2f64 643e 0a3c 6474 3e52
    .
    R │ │ │ +00080730: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    automatically g │ │ │ +00080750: 656e 6572 6174 6564 3c2f 6464 3e0a 3c2f enerated
    ....
  • .
  • │ │ │ +00080780: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    solvePnP< │ │ │ +00080850: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +000808b0: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +000808c0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;b │ │ │ +000808e0: 6f6f 6c65 616e 3c2f 7370 616e 3e26 6e62 oolean&nb │ │ │ +000808f0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;so │ │ │ +00080910: 6c76 6550 6e50 3c2f 7370 616e 3e3c 7762 lvePnP(MatOfPoint3f objectPoi │ │ │ +000809a0: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. MatOf │ │ │ +000809f0: 506f 696e 7432 663c 2f61 3e26 6e62 7370 Point2f  │ │ │ +00080a00: 3b69 6d61 6765 506f 696e 7473 2c0a 203c ;imagePoints,. < │ │ │ +00080a10: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00080a20: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +00080a30: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +00080a40: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ +00080a60: 7472 6978 2c0a 203c 6120 6872 6566 3d22 trix,. MatOf │ │ │ +00080ab0: 446f 7562 6c65 3c2f 613e 266e 6273 703b Double  │ │ │ +00080ac0: 6469 7374 436f 6566 6673 2c0a 203c 6120 distCoeffs,. Mat │ │ │ +00080b10: 266e 6273 703b 7276 6563 2c0a 203c 6120  rvec,. Mat │ │ │ +00080b60: 266e 6273 703b 7476 6563 2c0a 2062 6f6f  tvec,. boo │ │ │ +00080b70: 6c65 616e 266e 6273 703b 7573 6545 7874 lean useExt │ │ │ +00080b80: 7269 6e73 6963 4775 6573 7329 3c2f 7370 rinsicGuess)
    .
    Fin │ │ │ +00080bb0: 6473 2061 6e20 6f62 6a65 6374 2070 6f73 ds an object pos │ │ │ +00080bc0: 6520 5c28 207b 7d5e 7b63 7d5c 6d61 7468 e \( {}^{c}\math │ │ │ +00080bd0: 6266 7b54 7d5f 6f20 5c29 2066 726f 6d20 bf{T}_o \) from │ │ │ +00080be0: 3344 2d32 4420 706f 696e 7420 636f 7272 3D-2D point corr │ │ │ +00080bf0: 6573 706f 6e64 656e 6365 733a 0a0a 215b espondences:..![ │ │ │ +00080c00: 5065 7273 7065 6374 6976 6520 7072 6f6a Perspective proj │ │ │ +00080c10: 6563 7469 6f6e 2c20 6672 6f6d 206f 626a ection, from obj │ │ │ +00080c20: 6563 7420 746f 2063 616d 6572 6120 6672 ect to camera fr │ │ │ +00080c30: 616d 655d 2870 6963 732f 7069 6e68 6f6c ame](pics/pinhol │ │ │ +00080c40: 655f 686f 6d6f 6765 6e65 6f75 735f 7472 e_homogeneous_tr │ │ │ +00080c50: 616e 7366 6f72 6d61 7469 6f6e 2e6a 7067 ansformation.jpg │ │ │ +00080c60: 297b 2077 6964 7468 3d35 3025 207d 0a0a ){ width=50% }.. │ │ │ +00080c70: 5345 453a 2052 4546 3a20 6361 6c69 6233 SEE: REF: calib3 │ │ │ +00080c80: 645f 736f 6c76 6550 6e50 0a0a 5468 6973 d_solvePnP..This │ │ │ +00080c90: 2066 756e 6374 696f 6e20 7265 7475 726e function return │ │ │ +00080ca0: 7320 7468 6520 726f 7461 7469 6f6e 2061 s the rotation a │ │ │ +00080cb0: 6e64 2074 6865 2074 7261 6e73 6c61 7469 nd the translati │ │ │ +00080cc0: 6f6e 2076 6563 746f 7273 2074 6861 7420 on vectors that │ │ │ +00080cd0: 7472 616e 7366 6f72 6d20 6120 3344 2070 transform a 3D p │ │ │ +00080ce0: 6f69 6e74 2065 7870 7265 7373 6564 2069 oint expressed i │ │ │ +00080cf0: 6e20 7468 6520 6f62 6a65 6374 0a63 6f6f n the object.coo │ │ │ +00080d00: 7264 696e 6174 6520 6672 616d 6520 746f rdinate frame to │ │ │ +00080d10: 2074 6865 2063 616d 6572 6120 636f 6f72 the camera coor │ │ │ +00080d20: 6469 6e61 7465 2066 7261 6d65 2c20 7573 dinate frame, us │ │ │ +00080d30: 696e 6720 6469 6666 6572 656e 7420 6d65 ing different me │ │ │ +00080d40: 7468 6f64 733a 0a3c 756c 3e0a 2020 3c6c thods:.
      . . P3P methods │ │ │ +00080d60: 2852 4546 3a20 534f 4c56 4550 4e50 5f50 (REF: SOLVEPNP_P │ │ │ +00080d70: 3350 2c20 5245 463a 2053 4f4c 5645 504e 3P, REF: SOLVEPN │ │ │ +00080d80: 505f 4150 3350 293a 206e 6565 6420 3420 P_AP3P): need 4 │ │ │ +00080d90: 696e 7075 7420 706f 696e 7473 2074 6f20 input points to │ │ │ +00080da0: 7265 7475 726e 2061 2075 6e69 7175 6520 return a unique │ │ │ +00080db0: 736f 6c75 7469 6f6e 2e0a 2020 3c2f 6c69 solution.. .
    • . REF: S │ │ │ +00080dd0: 4f4c 5645 504e 505f 4950 5045 2049 6e70 OLVEPNP_IPPE Inp │ │ │ +00080de0: 7574 2070 6f69 6e74 7320 6d75 7374 2062 ut points must b │ │ │ +00080df0: 6520 2667 743b 3d20 3420 616e 6420 6f62 e >= 4 and ob │ │ │ +00080e00: 6a65 6374 2070 6f69 6e74 7320 6d75 7374 ject points must │ │ │ +00080e10: 2062 6520 636f 706c 616e 6172 2e0a 2020 be coplanar.. │ │ │ +00080e20: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 5245
    • .
    • . RE │ │ │ +00080e30: 463a 2053 4f4c 5645 504e 505f 4950 5045 F: SOLVEPNP_IPPE │ │ │ +00080e40: 5f53 5155 4152 4520 5370 6563 6961 6c20 _SQUARE Special │ │ │ +00080e50: 6361 7365 2073 7569 7461 626c 6520 666f case suitable fo │ │ │ +00080e60: 7220 6d61 726b 6572 2070 6f73 6520 6573 r marker pose es │ │ │ +00080e70: 7469 6d61 7469 6f6e 2e0a 4e75 6d62 6572 timation..Number │ │ │ +00080e80: 206f 6620 696e 7075 7420 706f 696e 7473 of input points │ │ │ +00080e90: 206d 7573 7420 6265 2034 2e20 4f62 6a65 must be 4. Obje │ │ │ +00080ea0: 6374 2070 6f69 6e74 7320 6d75 7374 2062 ct points must b │ │ │ +00080eb0: 6520 6465 6669 6e65 6420 696e 2074 6865 e defined in the │ │ │ +00080ec0: 2066 6f6c 6c6f 7769 6e67 206f 7264 6572 following order │ │ │ +00080ed0: 3a0a 2020 3c75 6c3e 0a20 2020 203c 6c69 :.
        .
      • . point 0: [- │ │ │ +00080ef0: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ +00080f00: 2c20 2073 7175 6172 654c 656e 6774 6820 , squareLength │ │ │ +00080f10: 2f20 322c 2030 5d0a 2020 2020 3c2f 6c69 / 2, 0].
      • .
      • . po │ │ │ +00080f30: 696e 7420 313a 205b 2073 7175 6172 654c int 1: [ squareL │ │ │ +00080f40: 656e 6774 6820 2f20 322c 2020 7371 7561 ength / 2, squa │ │ │ +00080f50: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ +00080f60: 0a20 2020 203c 2f6c 693e 0a20 2020 203c .
      • . < │ │ │ +00080f70: 6c69 3e0a 2020 2070 6f69 6e74 2032 3a20 li>. point 2: │ │ │ +00080f80: 5b20 7371 7561 7265 4c65 6e67 7468 202f [ squareLength / │ │ │ +00080f90: 2032 2c20 2d73 7175 6172 654c 656e 6774 2, -squareLengt │ │ │ +00080fa0: 6820 2f20 322c 2030 5d0a 2020 2020 3c2f h / 2, 0]. .
      • . │ │ │ +00080fc0: 706f 696e 7420 333a 205b 2d73 7175 6172 point 3: [-squar │ │ │ +00080fd0: 654c 656e 6774 6820 2f20 322c 202d 7371 eLength / 2, -sq │ │ │ +00080fe0: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +00080ff0: 305d 0a20 2020 203c 2f6c 693e 0a20 203c 0].
      • . < │ │ │ +00081000: 2f75 6c3e 0a20 203c 6c69 3e0a 2066 6f72 /ul>.
      • . for │ │ │ +00081010: 2061 6c6c 2074 6865 206f 7468 6572 2066 all the other f │ │ │ +00081020: 6c61 6773 2c20 6e75 6d62 6572 206f 6620 lags, number of │ │ │ +00081030: 696e 7075 7420 706f 696e 7473 206d 7573 input points mus │ │ │ +00081040: 7420 6265 2026 6774 3b3d 2034 2061 6e64 t be >= 4 and │ │ │ +00081050: 206f 626a 6563 7420 706f 696e 7473 2063 object points c │ │ │ +00081060: 616e 2062 6520 696e 2061 6e79 2063 6f6e an be in any con │ │ │ +00081070: 6669 6775 7261 7469 6f6e 2e0a 2020 3c2f figuration.. .
    . │ │ │ +00081090: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ +000810b0: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    objectPoints - Array of │ │ │ +000810e0: 206f 626a 6563 7420 706f 696e 7473 2069 object points i │ │ │ +000810f0: 6e20 7468 6520 6f62 6a65 6374 2063 6f6f n the object coo │ │ │ +00081100: 7264 696e 6174 6520 7370 6163 652c 204e rdinate space, N │ │ │ +00081110: 7833 2031 2d63 6861 6e6e 656c 206f 720a x3 1-channel or. │ │ │ +00081120: 3178 4e2f 4e78 3120 332d 6368 616e 6e65 1xN/Nx1 3-channe │ │ │ +00081130: 6c2c 2077 6865 7265 204e 2069 7320 7468 l, where N is th │ │ │ +00081140: 6520 6e75 6d62 6572 206f 6620 706f 696e e number of poin │ │ │ +00081150: 7473 2e20 7665 6374 6f72 266c 743b 506f ts. vector<Po │ │ │ +00081160: 696e 7433 6426 6774 3b20 6361 6e20 6265 int3d> can be │ │ │ +00081170: 2061 6c73 6f20 7061 7373 6564 2068 6572 also passed her │ │ │ +00081180: 652e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 e.
    .
    imagePoints - Array of │ │ │ +000811b0: 636f 7272 6573 706f 6e64 696e 6720 696d corresponding im │ │ │ +000811c0: 6167 6520 706f 696e 7473 2c20 4e78 3220 age points, Nx2 │ │ │ +000811d0: 312d 6368 616e 6e65 6c20 6f72 2031 784e 1-channel or 1xN │ │ │ +000811e0: 2f4e 7831 2032 2d63 6861 6e6e 656c 2c0a /Nx1 2-channel,. │ │ │ +000811f0: 7768 6572 6520 4e20 6973 2074 6865 206e where N is the n │ │ │ +00081200: 756d 6265 7220 6f66 2070 6f69 6e74 732e umber of points. │ │ │ +00081210: 2076 6563 746f 7226 6c74 3b50 6f69 6e74 vector<Point │ │ │ +00081220: 3264 2667 743b 2063 616e 2062 6520 616c 2d> can be al │ │ │ +00081230: 736f 2070 6173 7365 6420 6865 7265 2e3c so passed here.< │ │ │ +00081240: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ +00081250: 616d 6572 614d 6174 7269 783c 2f63 6f64 ameraMatrix - Input camer │ │ │ +00081270: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ +00081280: 6978 205c 285c 6361 6d65 7261 6d61 7472 ix \(\cameramatr │ │ │ +00081290: 6978 7b41 7d5c 2920 2e3c 2f64 643e 0a3c ix{A}\) .
    .< │ │ │ +000812a0: 6464 3e3c 636f 6465 3e64 6973 7443 6f65 dd>distCoe │ │ │ +000812b0: 6666 733c 2f63 6f64 653e 202d 2049 6e70 ffs - Inp │ │ │ +000812c0: 7574 2076 6563 746f 7220 6f66 2064 6973 ut vector of dis │ │ │ +000812d0: 746f 7274 696f 6e20 636f 6566 6669 6369 tortion coeffici │ │ │ +000812e0: 656e 7473 0a5c 285c 6469 7374 636f 6566 ents.\(\distcoef │ │ │ +000812f0: 6673 5c29 2e20 4966 2074 6865 2076 6563 fs\). If the vec │ │ │ +00081300: 746f 7220 6973 204e 554c 4c2f 656d 7074 tor is NULL/empt │ │ │ +00081310: 792c 2074 6865 207a 6572 6f20 6469 7374 y, the zero dist │ │ │ +00081320: 6f72 7469 6f6e 2063 6f65 6666 6963 6965 ortion coefficie │ │ │ +00081330: 6e74 7320 6172 650a 6173 7375 6d65 642e nts are.assumed. │ │ │ +00081340: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e .
    │ │ │ +00081350: 7276 6563 3c2f 636f 6465 3e20 2d20 4f75 rvec - Ou │ │ │ +00081360: 7470 7574 2072 6f74 6174 696f 6e20 7665 tput rotation ve │ │ │ +00081370: 6374 6f72 2028 7365 6520 5245 463a 2052 ctor (see REF: R │ │ │ +00081380: 6f64 7269 6775 6573 2029 2074 6861 742c odrigues ) that, │ │ │ +00081390: 2074 6f67 6574 6865 7220 7769 7468 2074 together with t │ │ │ +000813a0: 7665 632c 2062 7269 6e67 7320 706f 696e vec, brings poin │ │ │ +000813b0: 7473 2066 726f 6d0a 7468 6520 6d6f 6465 ts from.the mode │ │ │ +000813c0: 6c20 636f 6f72 6469 6e61 7465 2073 7973 l coordinate sys │ │ │ +000813d0: 7465 6d20 746f 2074 6865 2063 616d 6572 tem to the camer │ │ │ +000813e0: 6120 636f 6f72 6469 6e61 7465 2073 7973 a coordinate sys │ │ │ +000813f0: 7465 6d2e 3c2f 6464 3e0a 3c64 643e 3c63 tem.
    .
    tvec │ │ │ +00081410: 2d20 4f75 7470 7574 2074 7261 6e73 6c61 - Output transla │ │ │ +00081420: 7469 6f6e 2076 6563 746f 722e 3c2f 6464 tion vector.
    .
    useE │ │ │ +00081440: 7874 7269 6e73 6963 4775 6573 733c 2f63 xtrinsicGuess - Parameter │ │ │ +00081460: 2075 7365 6420 666f 7220 2353 4f4c 5645 used for #SOLVE │ │ │ +00081470: 504e 505f 4954 4552 4154 4956 452e 2049 PNP_ITERATIVE. I │ │ │ +00081480: 6620 7472 7565 2028 3129 2c20 7468 6520 f true (1), the │ │ │ +00081490: 6675 6e63 7469 6f6e 2075 7365 730a 7468 function uses.th │ │ │ +000814a0: 6520 7072 6f76 6964 6564 2072 7665 6320 e provided rvec │ │ │ +000814b0: 616e 6420 7476 6563 2076 616c 7565 7320 and tvec values │ │ │ +000814c0: 6173 2069 6e69 7469 616c 2061 7070 726f as initial appro │ │ │ +000814d0: 7869 6d61 7469 6f6e 7320 6f66 2074 6865 ximations of the │ │ │ +000814e0: 2072 6f74 6174 696f 6e20 616e 6420 7472 rotation and tr │ │ │ +000814f0: 616e 736c 6174 696f 6e0a 7665 6374 6f72 anslation.vector │ │ │ +00081500: 732c 2072 6573 7065 6374 6976 656c 792c s, respectively, │ │ │ +00081510: 2061 6e64 2066 7572 7468 6572 206f 7074 and further opt │ │ │ +00081520: 696d 697a 6573 2074 6865 6d2e 0a0a 4d6f imizes them...Mo │ │ │ +00081530: 7265 2069 6e66 6f72 6d61 7469 6f6e 2061 re information a │ │ │ +00081540: 626f 7574 2050 6572 7370 6563 7469 7665 bout Perspective │ │ │ +00081550: 2d6e 2d50 6f69 6e74 7320 6973 2064 6573 -n-Points is des │ │ │ +00081560: 6372 6962 6564 2069 6e20 5245 463a 2063 cribed in REF: c │ │ │ +00081570: 616c 6962 3364 5f73 6f6c 7665 506e 500a alib3d_solvePnP. │ │ │ +00081580: 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a 3c75 .Note:..
  • . │ │ │ +000815a0: 416e 2065 7861 6d70 6c65 206f 6620 686f An example of ho │ │ │ +000815b0: 7720 746f 2075 7365 2073 6f6c 7665 506e w to use solvePn │ │ │ +000815c0: 5020 666f 7220 706c 616e 6172 2061 7567 P for planar aug │ │ │ +000815d0: 6d65 6e74 6564 2072 6561 6c69 7479 2063 mented reality c │ │ │ +000815e0: 616e 2062 6520 666f 756e 6420 6174 0a20 an be found at. │ │ │ +000815f0: 2020 2020 2020 206f 7065 6e63 765f 736f opencv_so │ │ │ +00081600: 7572 6365 5f63 6f64 652f 7361 6d70 6c65 urce_code/sample │ │ │ +00081610: 732f 7079 7468 6f6e 2f70 6c61 6e65 5f61 s/python/plane_a │ │ │ +00081620: 722e 7079 0a20 203c 2f6c 693e 0a20 203c r.py.
  • . < │ │ │ +00081630: 6c69 3e0a 2020 2020 2020 4966 2079 6f75 li>. If you │ │ │ +00081640: 2061 7265 2075 7369 6e67 2050 7974 686f are using Pytho │ │ │ +00081650: 6e3a 0a20 203c 756c 3e0a 2020 2020 3c6c n:.
      . . Nump │ │ │ +00081670: 7920 6172 7261 7920 736c 6963 6573 2077 y array slices w │ │ │ +00081680: 6f6e 2774 2077 6f72 6b20 6173 2069 6e70 on't work as inp │ │ │ +00081690: 7574 2062 6563 6175 7365 2073 6f6c 7665 ut because solve │ │ │ +000816a0: 506e 5020 7265 7175 6972 6573 2063 6f6e PnP requires con │ │ │ +000816b0: 7469 6775 6f75 730a 2020 2020 2020 2020 tiguous. │ │ │ +000816c0: 6172 7261 7973 2028 656e 666f 7263 6564 arrays (enforced │ │ │ +000816d0: 2062 7920 7468 6520 6173 7365 7274 696f by the assertio │ │ │ +000816e0: 6e20 7573 696e 6720 6376 3a3a 4d61 743a n using cv::Mat: │ │ │ +000816f0: 3a63 6865 636b 5665 6374 6f72 2829 2061 :checkVector() a │ │ │ +00081700: 726f 756e 6420 6c69 6e65 2035 3520 6f66 round line 55 of │ │ │ +00081710: 0a20 2020 2020 2020 206d 6f64 756c 6573 . modules │ │ │ +00081720: 2f33 642f 7372 632f 736f 6c76 6570 6e70 /3d/src/solvepnp │ │ │ +00081730: 2e63 7070 2076 6572 7369 6f6e 2032 2e34 .cpp version 2.4 │ │ │ +00081740: 2e39 290a 2020 2020 3c2f 6c69 3e0a 2020 .9). . │ │ │ +00081750: 2020 3c6c 693e 0a20 2020 2020 2020 2020
    • . │ │ │ +00081760: 5468 6520 5033 5020 616c 676f 7269 7468 The P3P algorith │ │ │ +00081770: 6d20 7265 7175 6972 6573 2069 6d61 6765 m requires image │ │ │ +00081780: 2070 6f69 6e74 7320 746f 2062 6520 696e points to be in │ │ │ +00081790: 2061 6e20 6172 7261 7920 6f66 2073 6861 an array of sha │ │ │ +000817a0: 7065 2028 4e2c 312c 3229 2064 7565 0a20 pe (N,1,2) due. │ │ │ +000817b0: 2020 2020 2020 2074 6f20 6974 7320 6361 to its ca │ │ │ +000817c0: 6c6c 696e 6720 6f66 2023 756e 6469 7374 lling of #undist │ │ │ +000817d0: 6f72 7450 6f69 6e74 7320 2861 726f 756e ortPoints (aroun │ │ │ +000817e0: 6420 6c69 6e65 2037 3520 6f66 206d 6f64 d line 75 of mod │ │ │ +000817f0: 756c 6573 2f33 642f 7372 632f 736f 6c76 ules/3d/src/solv │ │ │ +00081800: 6570 6e70 2e63 7070 2076 6572 7369 6f6e epnp.cpp version │ │ │ +00081810: 2032 2e34 2e39 290a 2020 2020 2020 2020 2.4.9). │ │ │ +00081820: 7768 6963 6820 7265 7175 6972 6573 2032 which requires 2 │ │ │ +00081830: 2d63 6861 6e6e 656c 2069 6e66 6f72 6d61 -channel informa │ │ │ +00081840: 7469 6f6e 2e0a 2020 2020 3c2f 6c69 3e0a tion..
    • . │ │ │ +00081850: 2020 2020 3c6c 693e 0a20 2020 2020 2020
    • . │ │ │ +00081860: 2020 5468 7573 2c20 6769 7665 6e20 736f Thus, given so │ │ │ +00081870: 6d65 2064 6174 6120 4420 3d20 6e70 2e61 me data D = np.a │ │ │ +00081880: 7272 6179 282e 2e2e 2920 7768 6572 6520 rray(...) where │ │ │ +00081890: 442e 7368 6170 6520 3d20 284e 2c4d 292c D.shape = (N,M), │ │ │ +000818a0: 2069 6e20 6f72 6465 7220 746f 2075 7365 in order to use │ │ │ +000818b0: 2061 2073 7562 7365 7420 6f66 0a20 2020 a subset of. │ │ │ +000818c0: 2020 2020 2069 7420 6173 2c20 652e 672e it as, e.g. │ │ │ +000818d0: 2c20 696d 6167 6550 6f69 6e74 732c 206f , imagePoints, o │ │ │ +000818e0: 6e65 206d 7573 7420 6566 6665 6374 6976 ne must effectiv │ │ │ +000818f0: 656c 7920 636f 7079 2069 7420 696e 746f ely copy it into │ │ │ +00081900: 2061 206e 6577 2061 7272 6179 3a20 696d a new array: im │ │ │ +00081910: 6167 6550 6f69 6e74 7320 3d0a 2020 2020 agePoints =. │ │ │ +00081920: 2020 2020 6e70 2e61 7363 6f6e 7469 6775 np.ascontigu │ │ │ +00081930: 6f75 7361 7272 6179 2844 5b3a 2c3a 325d ousarray(D[:,:2] │ │ │ +00081940: 292e 7265 7368 6170 6528 284e 2c31 2c32 ).reshape((N,1,2 │ │ │ +00081950: 2929 0a20 2020 203c 2f6c 693e 0a20 203c )).
    • . < │ │ │ +00081960: 2f75 6c3e 0a20 203c 6c69 3e0a 2020 2020 /ul>.
    • . │ │ │ +00081970: 2020 5468 6520 6d69 6e69 6d75 6d20 6e75 The minimum nu │ │ │ +00081980: 6d62 6572 206f 6620 706f 696e 7473 2069 mber of points i │ │ │ +00081990: 7320 3420 696e 2074 6865 2067 656e 6572 s 4 in the gener │ │ │ +000819a0: 616c 2063 6173 652e 2049 6e20 7468 6520 al case. In the │ │ │ +000819b0: 6361 7365 206f 6620 5245 463a 2053 4f4c case of REF: SOL │ │ │ +000819c0: 5645 504e 505f 5033 5020 616e 6420 5245 VEPNP_P3P and RE │ │ │ +000819d0: 463a 2053 4f4c 5645 504e 505f 4150 3350 F: SOLVEPNP_AP3P │ │ │ +000819e0: 0a20 2020 2020 2020 6d65 7468 6f64 732c . methods, │ │ │ +000819f0: 2069 7420 6973 2072 6571 7569 7265 6420 it is required │ │ │ +00081a00: 746f 2075 7365 2065 7861 6374 6c79 2034 to use exactly 4 │ │ │ +00081a10: 2070 6f69 6e74 7320 2874 6865 2066 6972 points (the fir │ │ │ +00081a20: 7374 2033 2070 6f69 6e74 7320 6172 6520 st 3 points are │ │ │ +00081a30: 7573 6564 2074 6f20 6573 7469 6d61 7465 used to estimate │ │ │ +00081a40: 2061 6c6c 2074 6865 2073 6f6c 7574 696f all the solutio │ │ │ +00081a50: 6e73 0a20 2020 2020 2020 6f66 2074 6865 ns. of the │ │ │ +00081a60: 2050 3350 2070 726f 626c 656d 2c20 7468 P3P problem, th │ │ │ +00081a70: 6520 6c61 7374 206f 6e65 2069 7320 7573 e last one is us │ │ │ +00081a80: 6564 2074 6f20 7265 7461 696e 2074 6865 ed to retain the │ │ │ +00081a90: 2062 6573 7420 736f 6c75 7469 6f6e 2074 best solution t │ │ │ +00081aa0: 6861 7420 6d69 6e69 6d69 7a65 7320 7468 hat minimizes th │ │ │ +00081ab0: 6520 7265 7072 6f6a 6563 7469 6f6e 2065 e reprojection e │ │ │ +00081ac0: 7272 6f72 292e 0a20 203c 2f6c 693e 0a20 rror)..
    • . │ │ │ +00081ad0: 203c 6c69 3e0a 2020 2020 2020 5769 7468
    • . With │ │ │ +00081ae0: 2052 4546 3a20 534f 4c56 4550 4e50 5f49 REF: SOLVEPNP_I │ │ │ +00081af0: 5445 5241 5449 5645 206d 6574 686f 6420 TERATIVE method │ │ │ +00081b00: 616e 6420 3c63 6f64 653e 7573 6545 7874 and useExt │ │ │ +00081b10: 7269 6e73 6963 4775 6573 733d 7472 7565 rinsicGuess=true │ │ │ +00081b20: 3c2f 636f 6465 3e2c 2074 6865 206d 696e , the min │ │ │ +00081b30: 696d 756d 206e 756d 6265 7220 6f66 2070 imum number of p │ │ │ +00081b40: 6f69 6e74 7320 6973 2033 2028 3320 706f oints is 3 (3 po │ │ │ +00081b50: 696e 7473 0a20 2020 2020 2020 6172 6520 ints. are │ │ │ +00081b60: 7375 6666 6963 6965 6e74 2074 6f20 636f sufficient to co │ │ │ +00081b70: 6d70 7574 6520 6120 706f 7365 2062 7574 mpute a pose but │ │ │ +00081b80: 2074 6865 7265 2061 7265 2075 7020 746f there are up to │ │ │ +00081b90: 2034 2073 6f6c 7574 696f 6e73 292e 2054 4 solutions). T │ │ │ +00081ba0: 6865 2069 6e69 7469 616c 2073 6f6c 7574 he initial solut │ │ │ +00081bb0: 696f 6e20 7368 6f75 6c64 2062 6520 636c ion should be cl │ │ │ +00081bc0: 6f73 6520 746f 2074 6865 0a20 2020 2020 ose to the. │ │ │ +00081bd0: 2020 676c 6f62 616c 2073 6f6c 7574 696f global solutio │ │ │ +00081be0: 6e20 746f 2063 6f6e 7665 7267 652e 2054 n to converge. T │ │ │ +00081bf0: 6865 2066 756e 6374 696f 6e20 7265 7475 he function retu │ │ │ +00081c00: 726e 7320 7472 7565 2069 6620 736f 6d65 rns true if some │ │ │ +00081c10: 2073 6f6c 7574 696f 6e20 6973 2066 6f75 solution is fou │ │ │ +00081c20: 6e64 2e20 5573 6572 2063 6f64 6520 6973 nd. User code is │ │ │ +00081c30: 2072 6573 706f 6e73 6962 6c65 2066 6f72 responsible for │ │ │ +00081c40: 0a20 2020 2020 2020 736f 6c75 7469 6f6e . solution │ │ │ +00081c50: 2071 7561 6c69 7479 2061 7373 6573 736d quality assessm │ │ │ +00081c60: 656e 742e 0a20 203c 2f6c 693e 0a20 203c ent..
    • . < │ │ │ +00081c70: 6c69 3e0a 2020 2020 2020 5769 7468 2052 li>. With R │ │ │ +00081c80: 4546 3a20 534f 4c56 4550 4e50 5f49 5050 EF: SOLVEPNP_IPP │ │ │ +00081c90: 4520 696e 7075 7420 706f 696e 7473 206d E input points m │ │ │ +00081ca0: 7573 7420 6265 2026 6774 3b3d 2034 2061 ust be >= 4 a │ │ │ +00081cb0: 6e64 206f 626a 6563 7420 706f 696e 7473 nd object points │ │ │ +00081cc0: 206d 7573 7420 6265 2063 6f70 6c61 6e61 must be coplana │ │ │ +00081cd0: 722e 0a20 203c 2f6c 693e 0a20 203c 6c69 r.. .
    • . With REF │ │ │ +00081cf0: 3a20 534f 4c56 4550 4e50 5f49 5050 455f : SOLVEPNP_IPPE_ │ │ │ +00081d00: 5351 5541 5245 2074 6869 7320 6973 2061 SQUARE this is a │ │ │ +00081d10: 2073 7065 6369 616c 2063 6173 6520 7375 special case su │ │ │ +00081d20: 6974 6162 6c65 2066 6f72 206d 6172 6b65 itable for marke │ │ │ +00081d30: 7220 706f 7365 2065 7374 696d 6174 696f r pose estimatio │ │ │ +00081d40: 6e2e 0a20 2020 2020 2020 4e75 6d62 6572 n.. Number │ │ │ +00081d50: 206f 6620 696e 7075 7420 706f 696e 7473 of input points │ │ │ +00081d60: 206d 7573 7420 6265 2034 2e20 4f62 6a65 must be 4. Obje │ │ │ +00081d70: 6374 2070 6f69 6e74 7320 6d75 7374 2062 ct points must b │ │ │ +00081d80: 6520 6465 6669 6e65 6420 696e 2074 6865 e defined in the │ │ │ +00081d90: 2066 6f6c 6c6f 7769 6e67 206f 7264 6572 following order │ │ │ +00081da0: 3a0a 2020 3c75 6c3e 0a20 2020 203c 6c69 :.
        .
      • . poin │ │ │ +00081dc0: 7420 303a 205b 2d73 7175 6172 654c 656e t 0: [-squareLen │ │ │ +00081dd0: 6774 6820 2f20 322c 2020 7371 7561 7265 gth / 2, square │ │ │ +00081de0: 4c65 6e67 7468 202f 2032 2c20 305d 0a20 Length / 2, 0]. │ │ │ +00081df0: 2020 203c 2f6c 693e 0a20 2020 203c 6c69
      • .
      • . poin │ │ │ +00081e10: 7420 313a 205b 2073 7175 6172 654c 656e t 1: [ squareLen │ │ │ +00081e20: 6774 6820 2f20 322c 2020 7371 7561 7265 gth / 2, square │ │ │ +00081e30: 4c65 6e67 7468 202f 2032 2c20 305d 0a20 Length / 2, 0]. │ │ │ +00081e40: 2020 203c 2f6c 693e 0a20 2020 203c 6c69
      • .
      • . poin │ │ │ +00081e60: 7420 323a 205b 2073 7175 6172 654c 656e t 2: [ squareLen │ │ │ +00081e70: 6774 6820 2f20 322c 202d 7371 7561 7265 gth / 2, -square │ │ │ +00081e80: 4c65 6e67 7468 202f 2032 2c20 305d 0a20 Length / 2, 0]. │ │ │ +00081e90: 2020 203c 2f6c 693e 0a20 2020 203c 6c69
      • .
      • . poin │ │ │ +00081eb0: 7420 333a 205b 2d73 7175 6172 654c 656e t 3: [-squareLen │ │ │ +00081ec0: 6774 6820 2f20 322c 202d 7371 7561 7265 gth / 2, -square │ │ │ +00081ed0: 4c65 6e67 7468 202f 2032 2c20 305d 0a20 Length / 2, 0]. │ │ │ +00081ee0: 2020 203c 2f6c 693e 0a20 203c 2f75 6c3e
      • .
      │ │ │ +00081ef0: 0a20 203c 756c 3e0a 2020 2020 3c6c 693e .
        .
      • │ │ │ +00081f00: 0a20 2020 2020 2057 6974 6820 5245 463a . With REF: │ │ │ +00081f10: 2053 4f4c 5645 504e 505f 5351 504e 5020 SOLVEPNP_SQPNP │ │ │ +00081f20: 696e 7075 7420 706f 696e 7473 206d 7573 input points mus │ │ │ +00081f30: 7420 6265 2026 6774 3b3d 2033 0a20 2020 t be >= 3. │ │ │ +00081f40: 203c 2f6c 693e 0a20 203c 2f75 6c3e 0a20
      • .
      . │ │ │ +00081f50: 203c 2f6c 693e 0a3c 2f75 6c3e 3c2f 6464
    • .
    .
    Returns:.
    automati │ │ │ +00081f80: 6361 6c6c 7920 6765 6e65 7261 7465 643c cally generated< │ │ │ +00081f90: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .

    ..
  • .
    .

    solvePnP.
    .
    public │ │ │ +000820e0: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +000820f0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;bo │ │ │ +00082110: 6f6c 6561 6e3c 2f73 7061 6e3e 266e 6273 olean&nbs │ │ │ +00082120: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;sol │ │ │ +00082140: 7665 506e 503c 2f73 7061 6e3e 3c77 6272 vePnP( │ │ │ +000821b0: 4d61 744f 6650 6f69 6e74 3366 3c2f 613e MatOfPoint3f │ │ │ +000821c0: 266e 6273 703b 6f62 6a65 6374 506f 696e  objectPoin │ │ │ +000821d0: 7473 2c0a 203c 6120 6872 6566 3d22 2e2e ts,. MatOfP │ │ │ +00082220: 6f69 6e74 3266 3c2f 613e 266e 6273 703b oint2f  │ │ │ +00082230: 696d 6167 6550 6f69 6e74 732c 0a20 3c61 imagePoints,. Mat cameraMat │ │ │ +00082290: 7269 782c 0a20 3c61 2068 7265 663d 222e rix,. MatOfD │ │ │ +000822e0: 6f75 626c 653c 2f61 3e26 6e62 7370 3b64 ouble d │ │ │ +000822f0: 6973 7443 6f65 6666 732c 0a20 3c61 2068 istCoeffs,. Mat& │ │ │ +00082340: 6e62 7370 3b72 7665 632c 0a20 3c61 2068 nbsp;rvec,. Mat& │ │ │ +00082390: 6e62 7370 3b74 7665 6329 3c2f 7370 616e nbsp;tvec)
    .
    Finds │ │ │ +000823c0: 2061 6e20 6f62 6a65 6374 2070 6f73 6520 an object pose │ │ │ +000823d0: 5c28 207b 7d5e 7b63 7d5c 6d61 7468 6266 \( {}^{c}\mathbf │ │ │ +000823e0: 7b54 7d5f 6f20 5c29 2066 726f 6d20 3344 {T}_o \) from 3D │ │ │ +000823f0: 2d32 4420 706f 696e 7420 636f 7272 6573 -2D point corres │ │ │ +00082400: 706f 6e64 656e 6365 733a 0a0a 215b 5065 pondences:..![Pe │ │ │ +00082410: 7273 7065 6374 6976 6520 7072 6f6a 6563 rspective projec │ │ │ +00082420: 7469 6f6e 2c20 6672 6f6d 206f 626a 6563 tion, from objec │ │ │ +00082430: 7420 746f 2063 616d 6572 6120 6672 616d t to camera fram │ │ │ +00082440: 655d 2870 6963 732f 7069 6e68 6f6c 655f e](pics/pinhole_ │ │ │ +00082450: 686f 6d6f 6765 6e65 6f75 735f 7472 616e homogeneous_tran │ │ │ +00082460: 7366 6f72 6d61 7469 6f6e 2e6a 7067 297b sformation.jpg){ │ │ │ +00082470: 2077 6964 7468 3d35 3025 207d 0a0a 5345 width=50% }..SE │ │ │ +00082480: 453a 2052 4546 3a20 6361 6c69 6233 645f E: REF: calib3d_ │ │ │ +00082490: 736f 6c76 6550 6e50 0a0a 5468 6973 2066 solvePnP..This f │ │ │ +000824a0: 756e 6374 696f 6e20 7265 7475 726e 7320 unction returns │ │ │ +000824b0: 7468 6520 726f 7461 7469 6f6e 2061 6e64 the rotation and │ │ │ +000824c0: 2074 6865 2074 7261 6e73 6c61 7469 6f6e the translation │ │ │ +000824d0: 2076 6563 746f 7273 2074 6861 7420 7472 vectors that tr │ │ │ +000824e0: 616e 7366 6f72 6d20 6120 3344 2070 6f69 ansform a 3D poi │ │ │ +000824f0: 6e74 2065 7870 7265 7373 6564 2069 6e20 nt expressed in │ │ │ +00082500: 7468 6520 6f62 6a65 6374 0a63 6f6f 7264 the object.coord │ │ │ +00082510: 696e 6174 6520 6672 616d 6520 746f 2074 inate frame to t │ │ │ +00082520: 6865 2063 616d 6572 6120 636f 6f72 6469 he camera coordi │ │ │ +00082530: 6e61 7465 2066 7261 6d65 2c20 7573 696e nate frame, usin │ │ │ +00082540: 6720 6469 6666 6572 656e 7420 6d65 7468 g different meth │ │ │ +00082550: 6f64 733a 0a3c 756c 3e0a 2020 3c6c 693e ods:.
      .
    • │ │ │ +00082560: 0a20 5033 5020 6d65 7468 6f64 7320 2852 . P3P methods (R │ │ │ +00082570: 4546 3a20 534f 4c56 4550 4e50 5f50 3350 EF: SOLVEPNP_P3P │ │ │ +00082580: 2c20 5245 463a 2053 4f4c 5645 504e 505f , REF: SOLVEPNP_ │ │ │ +00082590: 4150 3350 293a 206e 6565 6420 3420 696e AP3P): need 4 in │ │ │ +000825a0: 7075 7420 706f 696e 7473 2074 6f20 7265 put points to re │ │ │ +000825b0: 7475 726e 2061 2075 6e69 7175 6520 736f turn a unique so │ │ │ +000825c0: 6c75 7469 6f6e 2e0a 2020 3c2f 6c69 3e0a lution..
    • . │ │ │ +000825d0: 2020 3c6c 693e 0a20 5245 463a 2053 4f4c
    • . REF: SOL │ │ │ +000825e0: 5645 504e 505f 4950 5045 2049 6e70 7574 VEPNP_IPPE Input │ │ │ +000825f0: 2070 6f69 6e74 7320 6d75 7374 2062 6520 points must be │ │ │ +00082600: 2667 743b 3d20 3420 616e 6420 6f62 6a65 >= 4 and obje │ │ │ +00082610: 6374 2070 6f69 6e74 7320 6d75 7374 2062 ct points must b │ │ │ +00082620: 6520 636f 706c 616e 6172 2e0a 2020 3c2f e coplanar.. .
    • . REF: │ │ │ +00082640: 2053 4f4c 5645 504e 505f 4950 5045 5f53 SOLVEPNP_IPPE_S │ │ │ +00082650: 5155 4152 4520 5370 6563 6961 6c20 6361 QUARE Special ca │ │ │ +00082660: 7365 2073 7569 7461 626c 6520 666f 7220 se suitable for │ │ │ +00082670: 6d61 726b 6572 2070 6f73 6520 6573 7469 marker pose esti │ │ │ +00082680: 6d61 7469 6f6e 2e0a 4e75 6d62 6572 206f mation..Number o │ │ │ +00082690: 6620 696e 7075 7420 706f 696e 7473 206d f input points m │ │ │ +000826a0: 7573 7420 6265 2034 2e20 4f62 6a65 6374 ust be 4. Object │ │ │ +000826b0: 2070 6f69 6e74 7320 6d75 7374 2062 6520 points must be │ │ │ +000826c0: 6465 6669 6e65 6420 696e 2074 6865 2066 defined in the f │ │ │ +000826d0: 6f6c 6c6f 7769 6e67 206f 7264 6572 3a0a ollowing order:. │ │ │ +000826e0: 2020 3c75 6c3e 0a20 2020 203c 6c69 3e0a
        .
      • . │ │ │ +000826f0: 2020 2070 6f69 6e74 2030 3a20 5b2d 7371 point 0: [-sq │ │ │ +00082700: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +00082710: 2073 7175 6172 654c 656e 6774 6820 2f20 squareLength / │ │ │ +00082720: 322c 2030 5d0a 2020 2020 3c2f 6c69 3e0a 2, 0].
      • . │ │ │ +00082730: 2020 2020 3c6c 693e 0a20 2020 706f 696e
      • . poin │ │ │ +00082740: 7420 313a 205b 2073 7175 6172 654c 656e t 1: [ squareLen │ │ │ +00082750: 6774 6820 2f20 322c 2020 7371 7561 7265 gth / 2, square │ │ │ +00082760: 4c65 6e67 7468 202f 2032 2c20 305d 0a20 Length / 2, 0]. │ │ │ +00082770: 2020 203c 2f6c 693e 0a20 2020 203c 6c69
      • .
      • . point 2: [ │ │ │ +00082790: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ +000827a0: 2c20 2d73 7175 6172 654c 656e 6774 6820 , -squareLength │ │ │ +000827b0: 2f20 322c 2030 5d0a 2020 2020 3c2f 6c69 / 2, 0].
      • .
      • . po │ │ │ +000827d0: 696e 7420 333a 205b 2d73 7175 6172 654c int 3: [-squareL │ │ │ +000827e0: 656e 6774 6820 2f20 322c 202d 7371 7561 ength / 2, -squa │ │ │ +000827f0: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ +00082800: 0a20 2020 203c 2f6c 693e 0a20 203c 2f75 .
      • .
        .
      • . for a │ │ │ +00082820: 6c6c 2074 6865 206f 7468 6572 2066 6c61 ll the other fla │ │ │ +00082830: 6773 2c20 6e75 6d62 6572 206f 6620 696e gs, number of in │ │ │ +00082840: 7075 7420 706f 696e 7473 206d 7573 7420 put points must │ │ │ +00082850: 6265 2026 6774 3b3d 2034 2061 6e64 206f be >= 4 and o │ │ │ +00082860: 626a 6563 7420 706f 696e 7473 2063 616e bject points can │ │ │ +00082870: 2062 6520 696e 2061 6e79 2063 6f6e 6669 be in any confi │ │ │ +00082880: 6775 7261 7469 6f6e 2e0a 2020 3c2f 6c69 guration..
      • .
    . │ │ │ +000828b0: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +000828c0: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000828d0: 6f62 6a65 6374 506f 696e 7473 3c2f 636f objectPoints - Array of o │ │ │ +000828f0: 626a 6563 7420 706f 696e 7473 2069 6e20 bject points in │ │ │ +00082900: 7468 6520 6f62 6a65 6374 2063 6f6f 7264 the object coord │ │ │ +00082910: 696e 6174 6520 7370 6163 652c 204e 7833 inate space, Nx3 │ │ │ +00082920: 2031 2d63 6861 6e6e 656c 206f 720a 3178 1-channel or.1x │ │ │ +00082930: 4e2f 4e78 3120 332d 6368 616e 6e65 6c2c N/Nx1 3-channel, │ │ │ +00082940: 2077 6865 7265 204e 2069 7320 7468 6520 where N is the │ │ │ +00082950: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ +00082960: 2e20 7665 6374 6f72 266c 743b 506f 696e . vector<Poin │ │ │ +00082970: 7433 6426 6774 3b20 6361 6e20 6265 2061 t3d> can be a │ │ │ +00082980: 6c73 6f20 7061 7373 6564 2068 6572 652e lso passed here. │ │ │ +00082990: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000829a0: 696d 6167 6550 6f69 6e74 733c 2f63 6f64 imagePoints - Array of co │ │ │ +000829c0: 7272 6573 706f 6e64 696e 6720 696d 6167 rresponding imag │ │ │ +000829d0: 6520 706f 696e 7473 2c20 4e78 3220 312d e points, Nx2 1- │ │ │ +000829e0: 6368 616e 6e65 6c20 6f72 2031 784e 2f4e channel or 1xN/N │ │ │ +000829f0: 7831 2032 2d63 6861 6e6e 656c 2c0a 7768 x1 2-channel,.wh │ │ │ +00082a00: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ +00082a10: 6265 7220 6f66 2070 6f69 6e74 732e 2076 ber of points. v │ │ │ +00082a20: 6563 746f 7226 6c74 3b50 6f69 6e74 3264 ector<Point2d │ │ │ +00082a30: 2667 743b 2063 616e 2062 6520 616c 736f > can be also │ │ │ +00082a40: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    cam │ │ │ +00082a60: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ +00082a70: 202d 2049 6e70 7574 2063 616d 6572 6120 - Input camera │ │ │ +00082a80: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ +00082a90: 205c 285c 6361 6d65 7261 6d61 7472 6978 \(\cameramatrix │ │ │ +00082aa0: 7b41 7d5c 2920 2e3c 2f64 643e 0a3c 6464 {A}\) .
    .
    distCoeff │ │ │ +00082ac0: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ +00082ad0: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ +00082ae0: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ +00082af0: 7473 0a5c 285c 6469 7374 636f 6566 6673 ts.\(\distcoeffs │ │ │ +00082b00: 5c29 2e20 4966 2074 6865 2076 6563 746f \). If the vecto │ │ │ +00082b10: 7220 6973 204e 554c 4c2f 656d 7074 792c r is NULL/empty, │ │ │ +00082b20: 2074 6865 207a 6572 6f20 6469 7374 6f72 the zero distor │ │ │ +00082b30: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ +00082b40: 7320 6172 650a 6173 7375 6d65 642e 3c2f s are.assumed..
    rv │ │ │ +00082b60: 6563 3c2f 636f 6465 3e20 2d20 4f75 7470 ec - Outp │ │ │ +00082b70: 7574 2072 6f74 6174 696f 6e20 7665 6374 ut rotation vect │ │ │ +00082b80: 6f72 2028 7365 6520 5245 463a 2052 6f64 or (see REF: Rod │ │ │ +00082b90: 7269 6775 6573 2029 2074 6861 742c 2074 rigues ) that, t │ │ │ +00082ba0: 6f67 6574 6865 7220 7769 7468 2074 7665 ogether with tve │ │ │ +00082bb0: 632c 2062 7269 6e67 7320 706f 696e 7473 c, brings points │ │ │ +00082bc0: 2066 726f 6d0a 7468 6520 6d6f 6465 6c20 from.the model │ │ │ +00082bd0: 636f 6f72 6469 6e61 7465 2073 7973 7465 coordinate syste │ │ │ +00082be0: 6d20 746f 2074 6865 2063 616d 6572 6120 m to the camera │ │ │ +00082bf0: 636f 6f72 6469 6e61 7465 2073 7973 7465 coordinate syste │ │ │ +00082c00: 6d2e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 m.
    .
    tvec - │ │ │ +00082c20: 4f75 7470 7574 2074 7261 6e73 6c61 7469 Output translati │ │ │ +00082c30: 6f6e 2076 6563 746f 722e 0a74 6865 2070 on vector..the p │ │ │ +00082c40: 726f 7669 6465 6420 7276 6563 2061 6e64 rovided rvec and │ │ │ +00082c50: 2074 7665 6320 7661 6c75 6573 2061 7320 tvec values as │ │ │ +00082c60: 696e 6974 6961 6c20 6170 7072 6f78 696d initial approxim │ │ │ +00082c70: 6174 696f 6e73 206f 6620 7468 6520 726f ations of the ro │ │ │ +00082c80: 7461 7469 6f6e 2061 6e64 2074 7261 6e73 tation and trans │ │ │ +00082c90: 6c61 7469 6f6e 0a76 6563 746f 7273 2c20 lation.vectors, │ │ │ +00082ca0: 7265 7370 6563 7469 7665 6c79 2c20 616e respectively, an │ │ │ +00082cb0: 6420 6675 7274 6865 7220 6f70 7469 6d69 d further optimi │ │ │ +00082cc0: 7a65 7320 7468 656d 2e0a 0a4d 6f72 6520 zes them...More │ │ │ +00082cd0: 696e 666f 726d 6174 696f 6e20 6162 6f75 information abou │ │ │ +00082ce0: 7420 5065 7273 7065 6374 6976 652d 6e2d t Perspective-n- │ │ │ +00082cf0: 506f 696e 7473 2069 7320 6465 7363 7269 Points is descri │ │ │ +00082d00: 6265 6420 696e 2052 4546 3a20 6361 6c69 bed in REF: cali │ │ │ +00082d10: 6233 645f 736f 6c76 6550 6e50 0a0a 3c62 b3d_solvePnP..Note:.
      . │ │ │ +00082d30: 2020 3c6c 693e 0a20 2020 2020 2041 6e20
    • . An │ │ │ +00082d40: 6578 616d 706c 6520 6f66 2068 6f77 2074 example of how t │ │ │ +00082d50: 6f20 7573 6520 736f 6c76 6550 6e50 2066 o use solvePnP f │ │ │ +00082d60: 6f72 2070 6c61 6e61 7220 6175 676d 656e or planar augmen │ │ │ +00082d70: 7465 6420 7265 616c 6974 7920 6361 6e20 ted reality can │ │ │ +00082d80: 6265 2066 6f75 6e64 2061 740a 2020 2020 be found at. │ │ │ +00082d90: 2020 2020 6f70 656e 6376 5f73 6f75 7263 opencv_sourc │ │ │ +00082da0: 655f 636f 6465 2f73 616d 706c 6573 2f70 e_code/samples/p │ │ │ +00082db0: 7974 686f 6e2f 706c 616e 655f 6172 2e70 ython/plane_ar.p │ │ │ +00082dc0: 790a 2020 3c2f 6c69 3e0a 2020 3c6c 693e y.
    • .
    • │ │ │ +00082dd0: 0a20 2020 2020 2049 6620 796f 7520 6172 . If you ar │ │ │ +00082de0: 6520 7573 696e 6720 5079 7468 6f6e 3a0a e using Python:. │ │ │ +00082df0: 2020 3c75 6c3e 0a20 2020 203c 6c69 3e0a
        .
      • . │ │ │ +00082e00: 2020 2020 2020 2020 204e 756d 7079 2061 Numpy a │ │ │ +00082e10: 7272 6179 2073 6c69 6365 7320 776f 6e27 rray slices won' │ │ │ +00082e20: 7420 776f 726b 2061 7320 696e 7075 7420 t work as input │ │ │ +00082e30: 6265 6361 7573 6520 736f 6c76 6550 6e50 because solvePnP │ │ │ +00082e40: 2072 6571 7569 7265 7320 636f 6e74 6967 requires contig │ │ │ +00082e50: 756f 7573 0a20 2020 2020 2020 2061 7272 uous. arr │ │ │ +00082e60: 6179 7320 2865 6e66 6f72 6365 6420 6279 ays (enforced by │ │ │ +00082e70: 2074 6865 2061 7373 6572 7469 6f6e 2075 the assertion u │ │ │ +00082e80: 7369 6e67 2063 763a 3a4d 6174 3a3a 6368 sing cv::Mat::ch │ │ │ +00082e90: 6563 6b56 6563 746f 7228 2920 6172 6f75 eckVector() arou │ │ │ +00082ea0: 6e64 206c 696e 6520 3535 206f 660a 2020 nd line 55 of. │ │ │ +00082eb0: 2020 2020 2020 6d6f 6475 6c65 732f 3364 modules/3d │ │ │ +00082ec0: 2f73 7263 2f73 6f6c 7665 706e 702e 6370 /src/solvepnp.cp │ │ │ +00082ed0: 7020 7665 7273 696f 6e20 322e 342e 3929 p version 2.4.9) │ │ │ +00082ee0: 0a20 2020 203c 2f6c 693e 0a20 2020 203c .
      • . < │ │ │ +00082ef0: 6c69 3e0a 2020 2020 2020 2020 2054 6865 li>. The │ │ │ +00082f00: 2050 3350 2061 6c67 6f72 6974 686d 2072 P3P algorithm r │ │ │ +00082f10: 6571 7569 7265 7320 696d 6167 6520 706f equires image po │ │ │ +00082f20: 696e 7473 2074 6f20 6265 2069 6e20 616e ints to be in an │ │ │ +00082f30: 2061 7272 6179 206f 6620 7368 6170 6520 array of shape │ │ │ +00082f40: 284e 2c31 2c32 2920 6475 650a 2020 2020 (N,1,2) due. │ │ │ +00082f50: 2020 2020 746f 2069 7473 2063 616c 6c69 to its calli │ │ │ +00082f60: 6e67 206f 6620 2375 6e64 6973 746f 7274 ng of #undistort │ │ │ +00082f70: 506f 696e 7473 2028 6172 6f75 6e64 206c Points (around l │ │ │ +00082f80: 696e 6520 3735 206f 6620 6d6f 6475 6c65 ine 75 of module │ │ │ +00082f90: 732f 3364 2f73 7263 2f73 6f6c 7665 706e s/3d/src/solvepn │ │ │ +00082fa0: 702e 6370 7020 7665 7273 696f 6e20 322e p.cpp version 2. │ │ │ +00082fb0: 342e 3929 0a20 2020 2020 2020 2077 6869 4.9). whi │ │ │ +00082fc0: 6368 2072 6571 7569 7265 7320 322d 6368 ch requires 2-ch │ │ │ +00082fd0: 616e 6e65 6c20 696e 666f 726d 6174 696f annel informatio │ │ │ +00082fe0: 6e2e 0a20 2020 203c 2f6c 693e 0a20 2020 n.. . │ │ │ +00082ff0: 203c 6c69 3e0a 2020 2020 2020 2020 2054
      • . T │ │ │ +00083000: 6875 732c 2067 6976 656e 2073 6f6d 6520 hus, given some │ │ │ +00083010: 6461 7461 2044 203d 206e 702e 6172 7261 data D = np.arra │ │ │ +00083020: 7928 2e2e 2e29 2077 6865 7265 2044 2e73 y(...) where D.s │ │ │ +00083030: 6861 7065 203d 2028 4e2c 4d29 2c20 696e hape = (N,M), in │ │ │ +00083040: 206f 7264 6572 2074 6f20 7573 6520 6120 order to use a │ │ │ +00083050: 7375 6273 6574 206f 660a 2020 2020 2020 subset of. │ │ │ +00083060: 2020 6974 2061 732c 2065 2e67 2e2c 2069 it as, e.g., i │ │ │ +00083070: 6d61 6765 506f 696e 7473 2c20 6f6e 6520 magePoints, one │ │ │ +00083080: 6d75 7374 2065 6666 6563 7469 7665 6c79 must effectively │ │ │ +00083090: 2063 6f70 7920 6974 2069 6e74 6f20 6120 copy it into a │ │ │ +000830a0: 6e65 7720 6172 7261 793a 2069 6d61 6765 new array: image │ │ │ +000830b0: 506f 696e 7473 203d 0a20 2020 2020 2020 Points =. │ │ │ +000830c0: 206e 702e 6173 636f 6e74 6967 756f 7573 np.ascontiguous │ │ │ +000830d0: 6172 7261 7928 445b 3a2c 3a32 5d29 2e72 array(D[:,:2]).r │ │ │ +000830e0: 6573 6861 7065 2828 4e2c 312c 3229 290a eshape((N,1,2)). │ │ │ +000830f0: 2020 2020 3c2f 6c69 3e0a 2020 3c2f 756c
      • .
      .
    • . T │ │ │ +00083110: 6865 206d 696e 696d 756d 206e 756d 6265 he minimum numbe │ │ │ +00083120: 7220 6f66 2070 6f69 6e74 7320 6973 2034 r of points is 4 │ │ │ +00083130: 2069 6e20 7468 6520 6765 6e65 7261 6c20 in the general │ │ │ +00083140: 6361 7365 2e20 496e 2074 6865 2063 6173 case. In the cas │ │ │ +00083150: 6520 6f66 2052 4546 3a20 534f 4c56 4550 e of REF: SOLVEP │ │ │ +00083160: 4e50 5f50 3350 2061 6e64 2052 4546 3a20 NP_P3P and REF: │ │ │ +00083170: 534f 4c56 4550 4e50 5f41 5033 500a 2020 SOLVEPNP_AP3P. │ │ │ +00083180: 2020 2020 206d 6574 686f 6473 2c20 6974 methods, it │ │ │ +00083190: 2069 7320 7265 7175 6972 6564 2074 6f20 is required to │ │ │ +000831a0: 7573 6520 6578 6163 746c 7920 3420 706f use exactly 4 po │ │ │ +000831b0: 696e 7473 2028 7468 6520 6669 7273 7420 ints (the first │ │ │ +000831c0: 3320 706f 696e 7473 2061 7265 2075 7365 3 points are use │ │ │ +000831d0: 6420 746f 2065 7374 696d 6174 6520 616c d to estimate al │ │ │ +000831e0: 6c20 7468 6520 736f 6c75 7469 6f6e 730a l the solutions. │ │ │ +000831f0: 2020 2020 2020 206f 6620 7468 6520 5033 of the P3 │ │ │ +00083200: 5020 7072 6f62 6c65 6d2c 2074 6865 206c P problem, the l │ │ │ +00083210: 6173 7420 6f6e 6520 6973 2075 7365 6420 ast one is used │ │ │ +00083220: 746f 2072 6574 6169 6e20 7468 6520 6265 to retain the be │ │ │ +00083230: 7374 2073 6f6c 7574 696f 6e20 7468 6174 st solution that │ │ │ +00083240: 206d 696e 696d 697a 6573 2074 6865 2072 minimizes the r │ │ │ +00083250: 6570 726f 6a65 6374 696f 6e20 6572 726f eprojection erro │ │ │ +00083260: 7229 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c r)..
    • . . With RE │ │ │ +00083280: 463a 2053 4f4c 5645 504e 505f 4954 4552 F: SOLVEPNP_ITER │ │ │ +00083290: 4154 4956 4520 6d65 7468 6f64 2061 6e64 ATIVE method and │ │ │ +000832a0: 203c 636f 6465 3e75 7365 4578 7472 696e useExtrin │ │ │ +000832b0: 7369 6347 7565 7373 3d74 7275 653c 2f63 sicGuess=true, the minimu │ │ │ +000832d0: 6d20 6e75 6d62 6572 206f 6620 706f 696e m number of poin │ │ │ +000832e0: 7473 2069 7320 3320 2833 2070 6f69 6e74 ts is 3 (3 point │ │ │ +000832f0: 730a 2020 2020 2020 2061 7265 2073 7566 s. are suf │ │ │ +00083300: 6669 6369 656e 7420 746f 2063 6f6d 7075 ficient to compu │ │ │ +00083310: 7465 2061 2070 6f73 6520 6275 7420 7468 te a pose but th │ │ │ +00083320: 6572 6520 6172 6520 7570 2074 6f20 3420 ere are up to 4 │ │ │ +00083330: 736f 6c75 7469 6f6e 7329 2e20 5468 6520 solutions). The │ │ │ +00083340: 696e 6974 6961 6c20 736f 6c75 7469 6f6e initial solution │ │ │ +00083350: 2073 686f 756c 6420 6265 2063 6c6f 7365 should be close │ │ │ +00083360: 2074 6f20 7468 650a 2020 2020 2020 2067 to the. g │ │ │ +00083370: 6c6f 6261 6c20 736f 6c75 7469 6f6e 2074 lobal solution t │ │ │ +00083380: 6f20 636f 6e76 6572 6765 2e20 5468 6520 o converge. The │ │ │ +00083390: 6675 6e63 7469 6f6e 2072 6574 7572 6e73 function returns │ │ │ +000833a0: 2074 7275 6520 6966 2073 6f6d 6520 736f true if some so │ │ │ +000833b0: 6c75 7469 6f6e 2069 7320 666f 756e 642e lution is found. │ │ │ +000833c0: 2055 7365 7220 636f 6465 2069 7320 7265 User code is re │ │ │ +000833d0: 7370 6f6e 7369 626c 6520 666f 720a 2020 sponsible for. │ │ │ +000833e0: 2020 2020 2073 6f6c 7574 696f 6e20 7175 solution qu │ │ │ +000833f0: 616c 6974 7920 6173 7365 7373 6d65 6e74 ality assessment │ │ │ +00083400: 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c 693e .. .
    • │ │ │ +00083410: 0a20 2020 2020 2057 6974 6820 5245 463a . With REF: │ │ │ +00083420: 2053 4f4c 5645 504e 505f 4950 5045 2069 SOLVEPNP_IPPE i │ │ │ +00083430: 6e70 7574 2070 6f69 6e74 7320 6d75 7374 nput points must │ │ │ +00083440: 2062 6520 2667 743b 3d20 3420 616e 6420 be >= 4 and │ │ │ +00083450: 6f62 6a65 6374 2070 6f69 6e74 7320 6d75 object points mu │ │ │ +00083460: 7374 2062 6520 636f 706c 616e 6172 2e0a st be coplanar.. │ │ │ +00083470: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ +00083480: 2020 2020 2057 6974 6820 5245 463a 2053 With REF: S │ │ │ +00083490: 4f4c 5645 504e 505f 4950 5045 5f53 5155 OLVEPNP_IPPE_SQU │ │ │ +000834a0: 4152 4520 7468 6973 2069 7320 6120 7370 ARE this is a sp │ │ │ +000834b0: 6563 6961 6c20 6361 7365 2073 7569 7461 ecial case suita │ │ │ +000834c0: 626c 6520 666f 7220 6d61 726b 6572 2070 ble for marker p │ │ │ +000834d0: 6f73 6520 6573 7469 6d61 7469 6f6e 2e0a ose estimation.. │ │ │ +000834e0: 2020 2020 2020 204e 756d 6265 7220 6f66 Number of │ │ │ +000834f0: 2069 6e70 7574 2070 6f69 6e74 7320 6d75 input points mu │ │ │ +00083500: 7374 2062 6520 342e 204f 626a 6563 7420 st be 4. Object │ │ │ +00083510: 706f 696e 7473 206d 7573 7420 6265 2064 points must be d │ │ │ +00083520: 6566 696e 6564 2069 6e20 7468 6520 666f efined in the fo │ │ │ +00083530: 6c6c 6f77 696e 6720 6f72 6465 723a 0a20 llowing order:. │ │ │ +00083540: 203c 756c 3e0a 2020 2020 3c6c 693e 0a20
        .
      • . │ │ │ +00083550: 2020 2020 2020 2020 2070 6f69 6e74 2030 point 0 │ │ │ +00083560: 3a20 5b2d 7371 7561 7265 4c65 6e67 7468 : [-squareLength │ │ │ +00083570: 202f 2032 2c20 2073 7175 6172 654c 656e / 2, squareLen │ │ │ +00083580: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ +00083590: 3c2f 6c69 3e0a 2020 2020 3c6c 693e 0a20
      • .
      • . │ │ │ +000835a0: 2020 2020 2020 2020 2070 6f69 6e74 2031 point 1 │ │ │ +000835b0: 3a20 5b20 7371 7561 7265 4c65 6e67 7468 : [ squareLength │ │ │ +000835c0: 202f 2032 2c20 2073 7175 6172 654c 656e / 2, squareLen │ │ │ +000835d0: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ +000835e0: 3c2f 6c69 3e0a 2020 2020 3c6c 693e 0a20
      • .
      • . │ │ │ +000835f0: 2020 2020 2020 2020 2070 6f69 6e74 2032 point 2 │ │ │ +00083600: 3a20 5b20 7371 7561 7265 4c65 6e67 7468 : [ squareLength │ │ │ +00083610: 202f 2032 2c20 2d73 7175 6172 654c 656e / 2, -squareLen │ │ │ +00083620: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ +00083630: 3c2f 6c69 3e0a 2020 2020 3c6c 693e 0a20
      • .
      • . │ │ │ +00083640: 2020 2020 2020 2020 2070 6f69 6e74 2033 point 3 │ │ │ +00083650: 3a20 5b2d 7371 7561 7265 4c65 6e67 7468 : [-squareLength │ │ │ +00083660: 202f 2032 2c20 2d73 7175 6172 654c 656e / 2, -squareLen │ │ │ +00083670: 6774 6820 2f20 322c 2030 5d0a 2020 2020 gth / 2, 0]. │ │ │ +00083680: 3c2f 6c69 3e0a 2020 3c2f 756c 3e0a 2020
      • .
      . │ │ │ +00083690: 3c75 6c3e 0a20 2020 203c 6c69 3e0a 2020
        .
      • . │ │ │ +000836a0: 2020 2020 5769 7468 2052 4546 3a20 534f With REF: SO │ │ │ +000836b0: 4c56 4550 4e50 5f53 5150 4e50 2069 6e70 LVEPNP_SQPNP inp │ │ │ +000836c0: 7574 2070 6f69 6e74 7320 6d75 7374 2062 ut points must b │ │ │ +000836d0: 6520 2667 743b 3d20 330a 2020 2020 3c2f e >= 3. .
      . .
    .< │ │ │ +00083700: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ +00083710: 0a3c 6464 3e61 7574 6f6d 6174 6963 616c .
    automatical │ │ │ +00083720: 6c79 2067 656e 6572 6174 6564 3c2f 6464 ly generated
    ..
    .< │ │ │ +00083740: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.

  • . │ │ │ +00083750: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    solveP │ │ │ +00083850: 6e50 5261 6e73 6163 3c2f 6833 3e0a 3c64 nPRansac

    ..public stati │ │ │ +000838c0: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c boolean< │ │ │ +000838f0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> solvePnPR │ │ │ +00083920: 616e 7361 633c 2f73 7061 6e3e 3c77 6272 ansac( │ │ │ +00083990: 4d61 744f 6650 6f69 6e74 3366 3c2f 613e MatOfPoint3f │ │ │ +000839a0: 266e 6273 703b 6f62 6a65 6374 506f 696e  objectPoin │ │ │ +000839b0: 7473 2c0a 203c 6120 6872 6566 3d22 2e2e ts,. MatOfP │ │ │ +00083a00: 6f69 6e74 3266 3c2f 613e 266e 6273 703b oint2f  │ │ │ +00083a10: 696d 6167 6550 6f69 6e74 732c 0a20 3c61 imagePoints,. Mat cameraMat │ │ │ +00083a70: 7269 782c 0a20 3c61 2068 7265 663d 222e rix,. MatOfD │ │ │ +00083ac0: 6f75 626c 653c 2f61 3e26 6e62 7370 3b64 ouble d │ │ │ +00083ad0: 6973 7443 6f65 6666 732c 0a20 3c61 2068 istCoeffs,. Mat& │ │ │ +00083b20: 6e62 7370 3b72 7665 632c 0a20 3c61 2068 nbsp;rvec,. Mat& │ │ │ +00083b70: 6e62 7370 3b74 7665 632c 0a20 626f 6f6c nbsp;tvec,. bool │ │ │ +00083b80: 6561 6e26 6e62 7370 3b75 7365 4578 7472 ean useExtr │ │ │ +00083b90: 696e 7369 6347 7565 7373 2c0a 2069 6e74 insicGuess,. int │ │ │ +00083ba0: 266e 6273 703b 6974 6572 6174 696f 6e73  iterations │ │ │ +00083bb0: 436f 756e 742c 0a20 666c 6f61 7426 6e62 Count,. float&nb │ │ │ +00083bc0: 7370 3b72 6570 726f 6a65 6374 696f 6e45 sp;reprojectionE │ │ │ +00083bd0: 7272 6f72 2c0a 2064 6f75 626c 6526 6e62 rror,. double&nb │ │ │ +00083be0: 7370 3b63 6f6e 6669 6465 6e63 652c 0a20 sp;confidence,. │ │ │ +00083bf0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +00083c30: 2f61 3e26 6e62 7370 3b69 6e6c 6965 7273 /a> inliers │ │ │ +00083c40: 2c0a 2069 6e74 266e 6273 703b 666c 6167 ,. int flag │ │ │ +00083c50: 7329 3c2f 7370 616e 3e3c 2f64 6976 3e0a s). │ │ │ +00083c60: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Finds an obje │ │ │ +00083c80: 6374 2070 6f73 6520 5c28 207b 7d5e 7b63 ct pose \( {}^{c │ │ │ +00083c90: 7d5c 6d61 7468 6266 7b54 7d5f 6f20 5c29 }\mathbf{T}_o \) │ │ │ +00083ca0: 2066 726f 6d20 3344 2d32 4420 706f 696e from 3D-2D poin │ │ │ +00083cb0: 7420 636f 7272 6573 706f 6e64 656e 6365 t correspondence │ │ │ +00083cc0: 7320 7573 696e 6720 7468 6520 5241 4e53 s using the RANS │ │ │ +00083cd0: 4143 2073 6368 656d 6520 746f 2064 6561 AC scheme to dea │ │ │ +00083ce0: 6c20 7769 7468 2062 6164 206d 6174 6368 l with bad match │ │ │ +00083cf0: 6573 2e0a 0a21 5b50 6572 7370 6563 7469 es...![Perspecti │ │ │ +00083d00: 7665 2070 726f 6a65 6374 696f 6e2c 2066 ve projection, f │ │ │ +00083d10: 726f 6d20 6f62 6a65 6374 2074 6f20 6361 rom object to ca │ │ │ +00083d20: 6d65 7261 2066 7261 6d65 5d28 7069 6373 mera frame](pics │ │ │ +00083d30: 2f70 696e 686f 6c65 5f68 6f6d 6f67 656e /pinhole_homogen │ │ │ +00083d40: 656f 7573 5f74 7261 6e73 666f 726d 6174 eous_transformat │ │ │ +00083d50: 696f 6e2e 6a70 6729 7b20 7769 6474 683d ion.jpg){ width= │ │ │ +00083d60: 3530 2520 7d0a 0a53 4545 3a20 5245 463a 50% }..SEE: REF: │ │ │ +00083d70: 2063 616c 6962 3364 5f73 6f6c 7665 506e calib3d_solvePn │ │ │ +00083d80: 503c 2f64 6976 3e0a 3c64 6c20 636c 6173 P
    .
    .
    P │ │ │ +00083da0: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ +00083db0: 3c64 643e 3c63 6f64 653e 6f62 6a65 6374
    object │ │ │ +00083dc0: 506f 696e 7473 3c2f 636f 6465 3e20 2d20 Points - │ │ │ +00083dd0: 4172 7261 7920 6f66 206f 626a 6563 7420 Array of object │ │ │ +00083de0: 706f 696e 7473 2069 6e20 7468 6520 6f62 points in the ob │ │ │ +00083df0: 6a65 6374 2063 6f6f 7264 696e 6174 6520 ject coordinate │ │ │ +00083e00: 7370 6163 652c 204e 7833 2031 2d63 6861 space, Nx3 1-cha │ │ │ +00083e10: 6e6e 656c 206f 720a 3178 4e2f 4e78 3120 nnel or.1xN/Nx1 │ │ │ +00083e20: 332d 6368 616e 6e65 6c2c 2077 6865 7265 3-channel, where │ │ │ +00083e30: 204e 2069 7320 7468 6520 6e75 6d62 6572 N is the number │ │ │ +00083e40: 206f 6620 706f 696e 7473 2e20 7665 6374 of points. vect │ │ │ +00083e50: 6f72 266c 743b 506f 696e 7433 6426 6774 or<Point3d> │ │ │ +00083e60: 3b20 6361 6e20 6265 2061 6c73 6f20 7061 ; can be also pa │ │ │ +00083e70: 7373 6564 2068 6572 652e 3c2f 6464 3e0a ssed here.
    . │ │ │ +00083e80: 3c64 643e 3c63 6f64 653e 696d 6167 6550
    imageP │ │ │ +00083e90: 6f69 6e74 733c 2f63 6f64 653e 202d 2041 oints - A │ │ │ +00083ea0: 7272 6179 206f 6620 636f 7272 6573 706f rray of correspo │ │ │ +00083eb0: 6e64 696e 6720 696d 6167 6520 706f 696e nding image poin │ │ │ +00083ec0: 7473 2c20 4e78 3220 312d 6368 616e 6e65 ts, Nx2 1-channe │ │ │ +00083ed0: 6c20 6f72 2031 784e 2f4e 7831 2032 2d63 l or 1xN/Nx1 2-c │ │ │ +00083ee0: 6861 6e6e 656c 2c0a 7768 6572 6520 4e20 hannel,.where N │ │ │ +00083ef0: 6973 2074 6865 206e 756d 6265 7220 6f66 is the number of │ │ │ +00083f00: 2070 6f69 6e74 732e 2076 6563 746f 7226 points. vector& │ │ │ +00083f10: 6c74 3b50 6f69 6e74 3264 2667 743b 2063 lt;Point2d> c │ │ │ +00083f20: 616e 2062 6520 616c 736f 2070 6173 7365 an be also passe │ │ │ +00083f30: 6420 6865 7265 2e3c 2f64 643e 0a3c 6464 d here.
    .
    cameraMat │ │ │ +00083f50: 7269 783c 2f63 6f64 653e 202d 2049 6e70 rix - Inp │ │ │ +00083f60: 7574 2063 616d 6572 6120 696e 7472 696e ut camera intrin │ │ │ +00083f70: 7369 6320 6d61 7472 6978 205c 285c 6361 sic matrix \(\ca │ │ │ +00083f80: 6d65 7261 6d61 7472 6978 7b41 7d5c 2920 meramatrix{A}\) │ │ │ +00083f90: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    distCoeffs - Input vecto │ │ │ +00083fc0: 7220 6f66 2064 6973 746f 7274 696f 6e20 r of distortion │ │ │ +00083fd0: 636f 6566 6669 6369 656e 7473 0a5c 285c coefficients.\(\ │ │ │ +00083fe0: 6469 7374 636f 6566 6673 5c29 2e20 4966 distcoeffs\). If │ │ │ +00083ff0: 2074 6865 2076 6563 746f 7220 6973 204e the vector is N │ │ │ +00084000: 554c 4c2f 656d 7074 792c 2074 6865 207a ULL/empty, the z │ │ │ +00084010: 6572 6f20 6469 7374 6f72 7469 6f6e 2063 ero distortion c │ │ │ +00084020: 6f65 6666 6963 6965 6e74 7320 6172 650a oefficients are. │ │ │ +00084030: 6173 7375 6d65 642e 3c2f 6464 3e0a 3c64 assumed.
    .rvec - Output rot │ │ │ +00084060: 6174 696f 6e20 7665 6374 6f72 2028 7365 ation vector (se │ │ │ +00084070: 6520 5245 463a 2052 6f64 7269 6775 6573 e REF: Rodrigues │ │ │ +00084080: 2029 2074 6861 742c 2074 6f67 6574 6865 ) that, togethe │ │ │ +00084090: 7220 7769 7468 2074 7665 632c 2062 7269 r with tvec, bri │ │ │ +000840a0: 6e67 7320 706f 696e 7473 2066 726f 6d0a ngs points from. │ │ │ +000840b0: 7468 6520 6d6f 6465 6c20 636f 6f72 6469 the model coordi │ │ │ +000840c0: 6e61 7465 2073 7973 7465 6d20 746f 2074 nate system to t │ │ │ +000840d0: 6865 2063 616d 6572 6120 636f 6f72 6469 he camera coordi │ │ │ +000840e0: 6e61 7465 2073 7973 7465 6d2e 3c2f 6464 nate system..
    tvec │ │ │ +00084100: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +00084110: 2074 7261 6e73 6c61 7469 6f6e 2076 6563 translation vec │ │ │ +00084120: 746f 722e 3c2f 6464 3e0a 3c64 643e 3c63 tor.
    .
    useExtrinsic │ │ │ +00084140: 4775 6573 733c 2f63 6f64 653e 202d 2050 Guess - P │ │ │ +00084150: 6172 616d 6574 6572 2075 7365 6420 666f arameter used fo │ │ │ +00084160: 7220 5245 463a 2053 4f4c 5645 504e 505f r REF: SOLVEPNP_ │ │ │ +00084170: 4954 4552 4154 4956 452e 2049 6620 7472 ITERATIVE. If tr │ │ │ +00084180: 7565 2028 3129 2c20 7468 6520 6675 6e63 ue (1), the func │ │ │ +00084190: 7469 6f6e 2075 7365 730a 7468 6520 7072 tion uses.the pr │ │ │ +000841a0: 6f76 6964 6564 2072 7665 6320 616e 6420 ovided rvec and │ │ │ +000841b0: 7476 6563 2076 616c 7565 7320 6173 2069 tvec values as i │ │ │ +000841c0: 6e69 7469 616c 2061 7070 726f 7869 6d61 nitial approxima │ │ │ +000841d0: 7469 6f6e 7320 6f66 2074 6865 2072 6f74 tions of the rot │ │ │ +000841e0: 6174 696f 6e20 616e 6420 7472 616e 736c ation and transl │ │ │ +000841f0: 6174 696f 6e0a 7665 6374 6f72 732c 2072 ation.vectors, r │ │ │ +00084200: 6573 7065 6374 6976 656c 792c 2061 6e64 espectively, and │ │ │ +00084210: 2066 7572 7468 6572 206f 7074 696d 697a further optimiz │ │ │ +00084220: 6573 2074 6865 6d2e 3c2f 6464 3e0a 3c64 es them.
    .iteratio │ │ │ +00084240: 6e73 436f 756e 743c 2f63 6f64 653e 202d nsCount - │ │ │ +00084250: 204e 756d 6265 7220 6f66 2069 7465 7261 Number of itera │ │ │ +00084260: 7469 6f6e 732e 3c2f 6464 3e0a 3c64 643e tions..
    │ │ │ +00084270: 3c63 6f64 653e 7265 7072 6f6a 6563 7469 reprojecti │ │ │ +00084280: 6f6e 4572 726f 723c 2f63 6f64 653e 202d onError - │ │ │ +00084290: 2049 6e6c 6965 7220 7468 7265 7368 6f6c Inlier threshol │ │ │ +000842a0: 6420 7661 6c75 6520 7573 6564 2062 7920 d value used by │ │ │ +000842b0: 7468 6520 5241 4e53 4143 2070 726f 6365 the RANSAC proce │ │ │ +000842c0: 6475 7265 2e20 5468 6520 7061 7261 6d65 dure. The parame │ │ │ +000842d0: 7465 7220 7661 6c75 650a 6973 2074 6865 ter value.is the │ │ │ +000842e0: 206d 6178 696d 756d 2061 6c6c 6f77 6564 maximum allowed │ │ │ +000842f0: 2064 6973 7461 6e63 6520 6265 7477 6565 distance betwee │ │ │ +00084300: 6e20 7468 6520 6f62 7365 7276 6564 2061 n the observed a │ │ │ +00084310: 6e64 2063 6f6d 7075 7465 6420 706f 696e nd computed poin │ │ │ +00084320: 7420 7072 6f6a 6563 7469 6f6e 7320 746f t projections to │ │ │ +00084330: 2063 6f6e 7369 6465 7220 6974 0a61 6e20 consider it.an │ │ │ +00084340: 696e 6c69 6572 2e3c 2f64 643e 0a3c 6464 inlier.
    .
    confidenc │ │ │ +00084360: 653c 2f63 6f64 653e 202d 2054 6865 2070 e - The p │ │ │ +00084370: 726f 6261 6269 6c69 7479 2074 6861 7420 robability that │ │ │ +00084380: 7468 6520 616c 676f 7269 7468 6d20 7072 the algorithm pr │ │ │ +00084390: 6f64 7563 6573 2061 2075 7365 6675 6c20 oduces a useful │ │ │ +000843a0: 7265 7375 6c74 2e3c 2f64 643e 0a3c 6464 result.
    .
    inliers - Output v │ │ │ +000843d0: 6563 746f 7220 7468 6174 2063 6f6e 7461 ector that conta │ │ │ +000843e0: 696e 7320 696e 6469 6365 7320 6f66 2069 ins indices of i │ │ │ +000843f0: 6e6c 6965 7273 2069 6e20 6f62 6a65 6374 nliers in object │ │ │ +00084400: 506f 696e 7473 2061 6e64 2069 6d61 6765 Points and image │ │ │ +00084410: 506f 696e 7473 202e 3c2f 6464 3e0a 3c64 Points .
    .flags - Method fo │ │ │ +00084440: 7220 736f 6c76 696e 6720 6120 506e 5020 r solving a PnP │ │ │ +00084450: 7072 6f62 6c65 6d20 2873 6565 2052 4546 problem (see REF │ │ │ +00084460: 3a20 736f 6c76 6550 6e50 2029 2e0a 0a54 : solvePnP )...T │ │ │ +00084470: 6865 2066 756e 6374 696f 6e20 6573 7469 he function esti │ │ │ +00084480: 6d61 7465 7320 616e 206f 626a 6563 7420 mates an object │ │ │ +00084490: 706f 7365 2067 6976 656e 2061 2073 6574 pose given a set │ │ │ +000844a0: 206f 6620 6f62 6a65 6374 2070 6f69 6e74 of object point │ │ │ +000844b0: 732c 2074 6865 6972 2063 6f72 7265 7370 s, their corresp │ │ │ +000844c0: 6f6e 6469 6e67 2069 6d61 6765 0a70 726f onding image.pro │ │ │ +000844d0: 6a65 6374 696f 6e73 2c20 6173 2077 656c jections, as wel │ │ │ +000844e0: 6c20 6173 2074 6865 2063 616d 6572 6120 l as the camera │ │ │ +000844f0: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ +00084500: 2061 6e64 2074 6865 2064 6973 746f 7274 and the distort │ │ │ +00084510: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ +00084520: 2e20 5468 6973 2066 756e 6374 696f 6e20 . This function │ │ │ +00084530: 6669 6e64 7320 7375 6368 0a61 2070 6f73 finds such.a pos │ │ │ +00084540: 6520 7468 6174 206d 696e 696d 697a 6573 e that minimizes │ │ │ +00084550: 2072 6570 726f 6a65 6374 696f 6e20 6572 reprojection er │ │ │ +00084560: 726f 722c 2074 6861 7420 6973 2c20 7468 ror, that is, th │ │ │ +00084570: 6520 7375 6d20 6f66 2073 7175 6172 6564 e sum of squared │ │ │ +00084580: 2064 6973 7461 6e63 6573 2062 6574 7765 distances betwe │ │ │ +00084590: 656e 2074 6865 206f 6273 6572 7665 640a en the observed. │ │ │ +000845a0: 7072 6f6a 6563 7469 6f6e 7320 696d 6167 projections imag │ │ │ +000845b0: 6550 6f69 6e74 7320 616e 6420 7468 6520 ePoints and the │ │ │ +000845c0: 7072 6f6a 6563 7465 6420 2875 7369 6e67 projected (using │ │ │ +000845d0: 2052 4546 3a20 7072 6f6a 6563 7450 6f69 REF: projectPoi │ │ │ +000845e0: 6e74 7320 2920 6f62 6a65 6374 506f 696e nts ) objectPoin │ │ │ +000845f0: 7473 2e20 5468 6520 7573 6520 6f66 2052 ts. The use of R │ │ │ +00084600: 414e 5341 430a 6d61 6b65 7320 7468 6520 ANSAC.makes the │ │ │ +00084610: 6675 6e63 7469 6f6e 2072 6573 6973 7461 function resista │ │ │ +00084620: 6e74 2074 6f20 6f75 746c 6965 7273 2e0a nt to outliers.. │ │ │ +00084630: 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a 3c75 .Note:..
  • . │ │ │ +00084650: 416e 2065 7861 6d70 6c65 206f 6620 686f An example of ho │ │ │ +00084660: 7720 746f 2075 7365 2073 6f6c 7665 506e w to use solvePn │ │ │ +00084670: 5052 616e 7361 6320 666f 7220 6f62 6a65 PRansac for obje │ │ │ +00084680: 6374 2064 6574 6563 7469 6f6e 2063 616e ct detection can │ │ │ +00084690: 2062 6520 666f 756e 6420 6174 0a20 2020 be found at. │ │ │ +000846a0: 2020 2020 2052 4546 3a20 7475 746f 7269 REF: tutori │ │ │ +000846b0: 616c 5f72 6561 6c5f 7469 6d65 5f70 6f73 al_real_time_pos │ │ │ +000846c0: 650a 2020 3c2f 6c69 3e0a 2020 3c6c 693e e.
  • .
  • │ │ │ +000846d0: 0a20 2020 2020 2054 6865 2064 6566 6175 . The defau │ │ │ +000846e0: 6c74 206d 6574 686f 6420 7573 6564 2074 lt method used t │ │ │ +000846f0: 6f20 6573 7469 6d61 7465 2074 6865 2063 o estimate the c │ │ │ +00084700: 616d 6572 6120 706f 7365 2066 6f72 2074 amera pose for t │ │ │ +00084710: 6865 204d 696e 696d 616c 2053 616d 706c he Minimal Sampl │ │ │ +00084720: 6520 5365 7473 2073 7465 700a 2020 2020 e Sets step. │ │ │ +00084730: 2020 2069 7320 2353 4f4c 5645 504e 505f is #SOLVEPNP_ │ │ │ +00084740: 4550 4e50 2e20 4578 6365 7074 696f 6e73 EPNP. Exceptions │ │ │ +00084750: 2061 7265 3a0a 2020 3c75 6c3e 0a20 2020 are:.
      . │ │ │ +00084760: 203c 6c69 3e0a 2020 2020 2020 2020 2020
    • . │ │ │ +00084770: 6966 2079 6f75 2063 686f 6f73 6520 2353 if you choose #S │ │ │ +00084780: 4f4c 5645 504e 505f 5033 5020 6f72 2023 OLVEPNP_P3P or # │ │ │ +00084790: 534f 4c56 4550 4e50 5f41 5033 502c 2074 SOLVEPNP_AP3P, t │ │ │ +000847a0: 6865 7365 206d 6574 686f 6473 2077 696c hese methods wil │ │ │ +000847b0: 6c20 6265 2075 7365 642e 0a20 2020 203c l be used.. < │ │ │ +000847c0: 2f6c 693e 0a20 2020 203c 6c69 3e0a 2020 /li>.
    • . │ │ │ +000847d0: 2020 2020 2020 2020 6966 2074 6865 206e if the n │ │ │ +000847e0: 756d 6265 7220 6f66 2069 6e70 7574 2070 umber of input p │ │ │ +000847f0: 6f69 6e74 7320 6973 2065 7175 616c 2074 oints is equal t │ │ │ +00084800: 6f20 342c 2023 534f 4c56 4550 4e50 5f50 o 4, #SOLVEPNP_P │ │ │ +00084810: 3350 2069 7320 7573 6564 2e0a 2020 2020 3P is used.. │ │ │ +00084820: 3c2f 6c69 3e0a 2020 3c2f 756c 3e0a 2020
    • .
    . │ │ │ +00084830: 3c6c 693e 0a20 2020 2020 2054 6865 206d
  • . The m │ │ │ +00084840: 6574 686f 6420 7573 6564 2074 6f20 6573 ethod used to es │ │ │ +00084850: 7469 6d61 7465 2074 6865 2063 616d 6572 timate the camer │ │ │ +00084860: 6120 706f 7365 2075 7369 6e67 2061 6c6c a pose using all │ │ │ +00084870: 2074 6865 2069 6e6c 6965 7273 2069 7320 the inliers is │ │ │ +00084880: 6465 6669 6e65 6420 6279 2074 6865 0a20 defined by the. │ │ │ +00084890: 2020 2020 2020 666c 6167 7320 7061 7261 flags para │ │ │ +000848a0: 6d65 7465 7273 2075 6e6c 6573 7320 6974 meters unless it │ │ │ +000848b0: 2069 7320 6571 7561 6c20 746f 2023 534f is equal to #SO │ │ │ +000848c0: 4c56 4550 4e50 5f50 3350 206f 7220 2353 LVEPNP_P3P or #S │ │ │ +000848d0: 4f4c 5645 504e 505f 4150 3350 2e20 496e OLVEPNP_AP3P. In │ │ │ +000848e0: 2074 6869 7320 6361 7365 2c0a 2020 2020 this case,. │ │ │ +000848f0: 2020 2074 6865 206d 6574 686f 6420 2353 the method #S │ │ │ +00084900: 4f4c 5645 504e 505f 4550 4e50 2077 696c OLVEPNP_EPNP wil │ │ │ +00084910: 6c20 6265 2075 7365 6420 696e 7374 6561 l be used instea │ │ │ +00084920: 642e 0a20 203c 2f6c 693e 0a3c 2f75 6c3e d..
  • . │ │ │ +00084930: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e .
    Return │ │ │ +00084940: 733a 3c2f 6474 3e0a 3c64 643e 6175 746f s:
    .
    auto │ │ │ +00084950: 6d61 7469 6361 6c6c 7920 6765 6e65 7261 matically genera │ │ │ +00084960: 7465 643c 2f64 643e 0a3c 2f64 6c3e 0a3c ted
    .
    .< │ │ │ +00084970: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ +00084980: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    sol │ │ │ +00084a80: 7665 506e 5052 616e 7361 633c 2f68 333e vePnPRansac

    │ │ │ +00084a90: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ +00084ab0: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ +00084ad0: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ +00084ae0: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ +00084af0: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ +00084b00: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;boole │ │ │ +00084b20: 616e 3c2f 7370 616e 3e26 6e62 7370 3b3c an < │ │ │ +00084b30: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +00084b40: 656e 742d 6e61 6d65 223e 736f 6c76 6550 ent-name">solveP │ │ │ +00084b50: 6e50 5261 6e73 6163 3c2f 7370 616e 3e3c nPRansac< │ │ │ +00084b60: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(MatOfPoint3f< │ │ │ +00084bd0: 2f61 3e26 6e62 7370 3b6f 626a 6563 7450 /a> objectP │ │ │ +00084be0: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat │ │ │ +00084c30: 4f66 506f 696e 7432 663c 2f61 3e26 6e62 OfPoint2f&nb │ │ │ +00084c40: 7370 3b69 6d61 6765 506f 696e 7473 2c0a sp;imagePoints,. │ │ │ +00084c50: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +00084c90: 3c2f 613e 266e 6273 703b 6361 6d65 7261  camera │ │ │ +00084ca0: 4d61 7472 6978 2c0a 203c 6120 6872 6566 Matrix,. Mat │ │ │ +00084cf0: 4f66 446f 7562 6c65 3c2f 613e 266e 6273 OfDouble&nbs │ │ │ +00084d00: 703b 6469 7374 436f 6566 6673 2c0a 203c p;distCoeffs,. < │ │ │ +00084d10: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00084d20: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +00084d30: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +00084d40: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat rvec,. < │ │ │ +00084d60: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00084d70: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +00084d80: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +00084d90: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat tvec,. b │ │ │ +00084db0: 6f6f 6c65 616e 266e 6273 703b 7573 6545 oolean useE │ │ │ +00084dc0: 7874 7269 6e73 6963 4775 6573 732c 0a20 xtrinsicGuess,. │ │ │ +00084dd0: 696e 7426 6e62 7370 3b69 7465 7261 7469 int iterati │ │ │ +00084de0: 6f6e 7343 6f75 6e74 2c0a 2066 6c6f 6174 onsCount,. float │ │ │ +00084df0: 266e 6273 703b 7265 7072 6f6a 6563 7469  reprojecti │ │ │ +00084e00: 6f6e 4572 726f 722c 0a20 646f 7562 6c65 onError,. double │ │ │ +00084e10: 266e 6273 703b 636f 6e66 6964 656e 6365  confidence │ │ │ +00084e20: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +00084e60: 6174 3c2f 613e 266e 6273 703b 696e 6c69 at inli │ │ │ +00084e70: 6572 7329 3c2f 7370 616e 3e3c 2f64 6976 ers)
    .
    Finds an ob │ │ │ +00084ea0: 6a65 6374 2070 6f73 6520 5c28 207b 7d5e ject pose \( {}^ │ │ │ +00084eb0: 7b63 7d5c 6d61 7468 6266 7b54 7d5f 6f20 {c}\mathbf{T}_o │ │ │ +00084ec0: 5c29 2066 726f 6d20 3344 2d32 4420 706f \) from 3D-2D po │ │ │ +00084ed0: 696e 7420 636f 7272 6573 706f 6e64 656e int corresponden │ │ │ +00084ee0: 6365 7320 7573 696e 6720 7468 6520 5241 ces using the RA │ │ │ +00084ef0: 4e53 4143 2073 6368 656d 6520 746f 2064 NSAC scheme to d │ │ │ +00084f00: 6561 6c20 7769 7468 2062 6164 206d 6174 eal with bad mat │ │ │ +00084f10: 6368 6573 2e0a 0a21 5b50 6572 7370 6563 ches...![Perspec │ │ │ +00084f20: 7469 7665 2070 726f 6a65 6374 696f 6e2c tive projection, │ │ │ +00084f30: 2066 726f 6d20 6f62 6a65 6374 2074 6f20 from object to │ │ │ +00084f40: 6361 6d65 7261 2066 7261 6d65 5d28 7069 camera frame](pi │ │ │ +00084f50: 6373 2f70 696e 686f 6c65 5f68 6f6d 6f67 cs/pinhole_homog │ │ │ +00084f60: 656e 656f 7573 5f74 7261 6e73 666f 726d eneous_transform │ │ │ +00084f70: 6174 696f 6e2e 6a70 6729 7b20 7769 6474 ation.jpg){ widt │ │ │ +00084f80: 683d 3530 2520 7d0a 0a53 4545 3a20 5245 h=50% }..SEE: RE │ │ │ +00084f90: 463a 2063 616c 6962 3364 5f73 6f6c 7665 F: calib3d_solve │ │ │ +00084fa0: 506e 503c 2f64 6976 3e0a 3c64 6c20 636c PnP
    .
    .
    Parameters:
    .
    obje │ │ │ +00084fe0: 6374 506f 696e 7473 3c2f 636f 6465 3e20 ctPoints │ │ │ +00084ff0: 2d20 4172 7261 7920 6f66 206f 626a 6563 - Array of objec │ │ │ +00085000: 7420 706f 696e 7473 2069 6e20 7468 6520 t points in the │ │ │ +00085010: 6f62 6a65 6374 2063 6f6f 7264 696e 6174 object coordinat │ │ │ +00085020: 6520 7370 6163 652c 204e 7833 2031 2d63 e space, Nx3 1-c │ │ │ +00085030: 6861 6e6e 656c 206f 720a 3178 4e2f 4e78 hannel or.1xN/Nx │ │ │ +00085040: 3120 332d 6368 616e 6e65 6c2c 2077 6865 1 3-channel, whe │ │ │ +00085050: 7265 204e 2069 7320 7468 6520 6e75 6d62 re N is the numb │ │ │ +00085060: 6572 206f 6620 706f 696e 7473 2e20 7665 er of points. ve │ │ │ +00085070: 6374 6f72 266c 743b 506f 696e 7433 6426 ctor<Point3d& │ │ │ +00085080: 6774 3b20 6361 6e20 6265 2061 6c73 6f20 gt; can be also │ │ │ +00085090: 7061 7373 6564 2068 6572 652e 3c2f 6464 passed here.
    .
    imag │ │ │ +000850b0: 6550 6f69 6e74 733c 2f63 6f64 653e 202d ePoints - │ │ │ +000850c0: 2041 7272 6179 206f 6620 636f 7272 6573 Array of corres │ │ │ +000850d0: 706f 6e64 696e 6720 696d 6167 6520 706f ponding image po │ │ │ +000850e0: 696e 7473 2c20 4e78 3220 312d 6368 616e ints, Nx2 1-chan │ │ │ +000850f0: 6e65 6c20 6f72 2031 784e 2f4e 7831 2032 nel or 1xN/Nx1 2 │ │ │ +00085100: 2d63 6861 6e6e 656c 2c0a 7768 6572 6520 -channel,.where │ │ │ +00085110: 4e20 6973 2074 6865 206e 756d 6265 7220 N is the number │ │ │ +00085120: 6f66 2070 6f69 6e74 732e 2076 6563 746f of points. vecto │ │ │ +00085130: 7226 6c74 3b50 6f69 6e74 3264 2667 743b r<Point2d> │ │ │ +00085140: 2063 616e 2062 6520 616c 736f 2070 6173 can be also pas │ │ │ +00085150: 7365 6420 6865 7265 2e3c 2f64 643e 0a3c sed here.
    .< │ │ │ +00085160: 6464 3e3c 636f 6465 3e63 616d 6572 614d dd>cameraM │ │ │ +00085170: 6174 7269 783c 2f63 6f64 653e 202d 2049 atrix - I │ │ │ +00085180: 6e70 7574 2063 616d 6572 6120 696e 7472 nput camera intr │ │ │ +00085190: 696e 7369 6320 6d61 7472 6978 205c 285c insic matrix \(\ │ │ │ +000851a0: 6361 6d65 7261 6d61 7472 6978 7b41 7d5c cameramatrix{A}\ │ │ │ +000851b0: 2920 2e3c 2f64 643e 0a3c 6464 3e3c 636f ) ..
    distCoeffs - Input vec │ │ │ +000851e0: 746f 7220 6f66 2064 6973 746f 7274 696f tor of distortio │ │ │ +000851f0: 6e20 636f 6566 6669 6369 656e 7473 0a5c n coefficients.\ │ │ │ +00085200: 285c 6469 7374 636f 6566 6673 5c29 2e20 (\distcoeffs\). │ │ │ +00085210: 4966 2074 6865 2076 6563 746f 7220 6973 If the vector is │ │ │ +00085220: 204e 554c 4c2f 656d 7074 792c 2074 6865 NULL/empty, the │ │ │ +00085230: 207a 6572 6f20 6469 7374 6f72 7469 6f6e zero distortion │ │ │ +00085240: 2063 6f65 6666 6963 6965 6e74 7320 6172 coefficients ar │ │ │ +00085250: 650a 6173 7375 6d65 642e 3c2f 6464 3e0a e.assumed.
    . │ │ │ +00085260: 3c64 643e 3c63 6f64 653e 7276 6563 3c2f
    rvec - Output r │ │ │ +00085280: 6f74 6174 696f 6e20 7665 6374 6f72 2028 otation vector ( │ │ │ +00085290: 7365 6520 5245 463a 2052 6f64 7269 6775 see REF: Rodrigu │ │ │ +000852a0: 6573 2029 2074 6861 742c 2074 6f67 6574 es ) that, toget │ │ │ +000852b0: 6865 7220 7769 7468 2074 7665 632c 2062 her with tvec, b │ │ │ +000852c0: 7269 6e67 7320 706f 696e 7473 2066 726f rings points fro │ │ │ +000852d0: 6d0a 7468 6520 6d6f 6465 6c20 636f 6f72 m.the model coor │ │ │ +000852e0: 6469 6e61 7465 2073 7973 7465 6d20 746f dinate system to │ │ │ +000852f0: 2074 6865 2063 616d 6572 6120 636f 6f72 the camera coor │ │ │ +00085300: 6469 6e61 7465 2073 7973 7465 6d2e 3c2f dinate system..
    tv │ │ │ +00085320: 6563 3c2f 636f 6465 3e20 2d20 4f75 7470 ec - Outp │ │ │ +00085330: 7574 2074 7261 6e73 6c61 7469 6f6e 2076 ut translation v │ │ │ +00085340: 6563 746f 722e 3c2f 6464 3e0a 3c64 643e ector.
    .
    │ │ │ +00085350: 3c63 6f64 653e 7573 6545 7874 7269 6e73 useExtrins │ │ │ +00085360: 6963 4775 6573 733c 2f63 6f64 653e 202d icGuess - │ │ │ +00085370: 2050 6172 616d 6574 6572 2075 7365 6420 Parameter used │ │ │ +00085380: 666f 7220 5245 463a 2053 4f4c 5645 504e for REF: SOLVEPN │ │ │ +00085390: 505f 4954 4552 4154 4956 452e 2049 6620 P_ITERATIVE. If │ │ │ +000853a0: 7472 7565 2028 3129 2c20 7468 6520 6675 true (1), the fu │ │ │ +000853b0: 6e63 7469 6f6e 2075 7365 730a 7468 6520 nction uses.the │ │ │ +000853c0: 7072 6f76 6964 6564 2072 7665 6320 616e provided rvec an │ │ │ +000853d0: 6420 7476 6563 2076 616c 7565 7320 6173 d tvec values as │ │ │ +000853e0: 2069 6e69 7469 616c 2061 7070 726f 7869 initial approxi │ │ │ +000853f0: 6d61 7469 6f6e 7320 6f66 2074 6865 2072 mations of the r │ │ │ +00085400: 6f74 6174 696f 6e20 616e 6420 7472 616e otation and tran │ │ │ +00085410: 736c 6174 696f 6e0a 7665 6374 6f72 732c slation.vectors, │ │ │ +00085420: 2072 6573 7065 6374 6976 656c 792c 2061 respectively, a │ │ │ +00085430: 6e64 2066 7572 7468 6572 206f 7074 696d nd further optim │ │ │ +00085440: 697a 6573 2074 6865 6d2e 3c2f 6464 3e0a izes them.
    . │ │ │ +00085450: 3c64 643e 3c63 6f64 653e 6974 6572 6174
    iterat │ │ │ +00085460: 696f 6e73 436f 756e 743c 2f63 6f64 653e ionsCount │ │ │ +00085470: 202d 204e 756d 6265 7220 6f66 2069 7465 - Number of ite │ │ │ +00085480: 7261 7469 6f6e 732e 3c2f 6464 3e0a 3c64 rations.
    .reprojec │ │ │ +000854a0: 7469 6f6e 4572 726f 723c 2f63 6f64 653e tionError │ │ │ +000854b0: 202d 2049 6e6c 6965 7220 7468 7265 7368 - Inlier thresh │ │ │ +000854c0: 6f6c 6420 7661 6c75 6520 7573 6564 2062 old value used b │ │ │ +000854d0: 7920 7468 6520 5241 4e53 4143 2070 726f y the RANSAC pro │ │ │ +000854e0: 6365 6475 7265 2e20 5468 6520 7061 7261 cedure. The para │ │ │ +000854f0: 6d65 7465 7220 7661 6c75 650a 6973 2074 meter value.is t │ │ │ +00085500: 6865 206d 6178 696d 756d 2061 6c6c 6f77 he maximum allow │ │ │ +00085510: 6564 2064 6973 7461 6e63 6520 6265 7477 ed distance betw │ │ │ +00085520: 6565 6e20 7468 6520 6f62 7365 7276 6564 een the observed │ │ │ +00085530: 2061 6e64 2063 6f6d 7075 7465 6420 706f and computed po │ │ │ +00085540: 696e 7420 7072 6f6a 6563 7469 6f6e 7320 int projections │ │ │ +00085550: 746f 2063 6f6e 7369 6465 7220 6974 0a61 to consider it.a │ │ │ +00085560: 6e20 696e 6c69 6572 2e3c 2f64 643e 0a3c n inlier..< │ │ │ +00085570: 6464 3e3c 636f 6465 3e63 6f6e 6669 6465 dd>confide │ │ │ +00085580: 6e63 653c 2f63 6f64 653e 202d 2054 6865 nce - The │ │ │ +00085590: 2070 726f 6261 6269 6c69 7479 2074 6861 probability tha │ │ │ +000855a0: 7420 7468 6520 616c 676f 7269 7468 6d20 t the algorithm │ │ │ +000855b0: 7072 6f64 7563 6573 2061 2075 7365 6675 produces a usefu │ │ │ +000855c0: 6c20 7265 7375 6c74 2e3c 2f64 643e 0a3c l result..< │ │ │ +000855d0: 6464 3e3c 636f 6465 3e69 6e6c 6965 7273 dd>inliers │ │ │ +000855e0: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +000855f0: 2076 6563 746f 7220 7468 6174 2063 6f6e vector that con │ │ │ +00085600: 7461 696e 7320 696e 6469 6365 7320 6f66 tains indices of │ │ │ +00085610: 2069 6e6c 6965 7273 2069 6e20 6f62 6a65 inliers in obje │ │ │ +00085620: 6374 506f 696e 7473 2061 6e64 2069 6d61 ctPoints and ima │ │ │ +00085630: 6765 506f 696e 7473 202e 0a0a 5468 6520 gePoints ...The │ │ │ +00085640: 6675 6e63 7469 6f6e 2065 7374 696d 6174 function estimat │ │ │ +00085650: 6573 2061 6e20 6f62 6a65 6374 2070 6f73 es an object pos │ │ │ +00085660: 6520 6769 7665 6e20 6120 7365 7420 6f66 e given a set of │ │ │ +00085670: 206f 626a 6563 7420 706f 696e 7473 2c20 object points, │ │ │ +00085680: 7468 6569 7220 636f 7272 6573 706f 6e64 their correspond │ │ │ +00085690: 696e 6720 696d 6167 650a 7072 6f6a 6563 ing image.projec │ │ │ +000856a0: 7469 6f6e 732c 2061 7320 7765 6c6c 2061 tions, as well a │ │ │ +000856b0: 7320 7468 6520 6361 6d65 7261 2069 6e74 s the camera int │ │ │ +000856c0: 7269 6e73 6963 206d 6174 7269 7820 616e rinsic matrix an │ │ │ +000856d0: 6420 7468 6520 6469 7374 6f72 7469 6f6e d the distortion │ │ │ +000856e0: 2063 6f65 6666 6963 6965 6e74 732e 2054 coefficients. T │ │ │ +000856f0: 6869 7320 6675 6e63 7469 6f6e 2066 696e his function fin │ │ │ +00085700: 6473 2073 7563 680a 6120 706f 7365 2074 ds such.a pose t │ │ │ +00085710: 6861 7420 6d69 6e69 6d69 7a65 7320 7265 hat minimizes re │ │ │ +00085720: 7072 6f6a 6563 7469 6f6e 2065 7272 6f72 projection error │ │ │ +00085730: 2c20 7468 6174 2069 732c 2074 6865 2073 , that is, the s │ │ │ +00085740: 756d 206f 6620 7371 7561 7265 6420 6469 um of squared di │ │ │ +00085750: 7374 616e 6365 7320 6265 7477 6565 6e20 stances between │ │ │ +00085760: 7468 6520 6f62 7365 7276 6564 0a70 726f the observed.pro │ │ │ +00085770: 6a65 6374 696f 6e73 2069 6d61 6765 506f jections imagePo │ │ │ +00085780: 696e 7473 2061 6e64 2074 6865 2070 726f ints and the pro │ │ │ +00085790: 6a65 6374 6564 2028 7573 696e 6720 5245 jected (using RE │ │ │ +000857a0: 463a 2070 726f 6a65 6374 506f 696e 7473 F: projectPoints │ │ │ +000857b0: 2029 206f 626a 6563 7450 6f69 6e74 732e ) objectPoints. │ │ │ +000857c0: 2054 6865 2075 7365 206f 6620 5241 4e53 The use of RANS │ │ │ +000857d0: 4143 0a6d 616b 6573 2074 6865 2066 756e AC.makes the fun │ │ │ +000857e0: 6374 696f 6e20 7265 7369 7374 616e 7420 ction resistant │ │ │ +000857f0: 746f 206f 7574 6c69 6572 732e 0a0a 3c62 to outliers...Note:.
      . │ │ │ +00085810: 2020 3c6c 693e 0a20 2020 2020 2041 6e20
    • . An │ │ │ +00085820: 6578 616d 706c 6520 6f66 2068 6f77 2074 example of how t │ │ │ +00085830: 6f20 7573 6520 736f 6c76 6550 6e50 5261 o use solvePnPRa │ │ │ +00085840: 6e73 6163 2066 6f72 206f 626a 6563 7420 nsac for object │ │ │ +00085850: 6465 7465 6374 696f 6e20 6361 6e20 6265 detection can be │ │ │ +00085860: 2066 6f75 6e64 2061 740a 2020 2020 2020 found at. │ │ │ +00085870: 2020 5245 463a 2074 7574 6f72 6961 6c5f REF: tutorial_ │ │ │ +00085880: 7265 616c 5f74 696d 655f 706f 7365 0a20 real_time_pose. │ │ │ +00085890: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020
    • .
    • . │ │ │ +000858a0: 2020 2020 5468 6520 6465 6661 756c 7420 The default │ │ │ +000858b0: 6d65 7468 6f64 2075 7365 6420 746f 2065 method used to e │ │ │ +000858c0: 7374 696d 6174 6520 7468 6520 6361 6d65 stimate the came │ │ │ +000858d0: 7261 2070 6f73 6520 666f 7220 7468 6520 ra pose for the │ │ │ +000858e0: 4d69 6e69 6d61 6c20 5361 6d70 6c65 2053 Minimal Sample S │ │ │ +000858f0: 6574 7320 7374 6570 0a20 2020 2020 2020 ets step. │ │ │ +00085900: 6973 2023 534f 4c56 4550 4e50 5f45 504e is #SOLVEPNP_EPN │ │ │ +00085910: 502e 2045 7863 6570 7469 6f6e 7320 6172 P. Exceptions ar │ │ │ +00085920: 653a 0a20 203c 756c 3e0a 2020 2020 3c6c e:.
        . . if │ │ │ +00085940: 796f 7520 6368 6f6f 7365 2023 534f 4c56 you choose #SOLV │ │ │ +00085950: 4550 4e50 5f50 3350 206f 7220 2353 4f4c EPNP_P3P or #SOL │ │ │ +00085960: 5645 504e 505f 4150 3350 2c20 7468 6573 VEPNP_AP3P, thes │ │ │ +00085970: 6520 6d65 7468 6f64 7320 7769 6c6c 2062 e methods will b │ │ │ +00085980: 6520 7573 6564 2e0a 2020 2020 3c2f 6c69 e used.. .
      • . │ │ │ +000859a0: 2020 2020 2069 6620 7468 6520 6e75 6d62 if the numb │ │ │ +000859b0: 6572 206f 6620 696e 7075 7420 706f 696e er of input poin │ │ │ +000859c0: 7473 2069 7320 6571 7561 6c20 746f 2034 ts is equal to 4 │ │ │ +000859d0: 2c20 2353 4f4c 5645 504e 505f 5033 5020 , #SOLVEPNP_P3P │ │ │ +000859e0: 6973 2075 7365 642e 0a20 2020 203c 2f6c is used.. .
      .
    • . The meth │ │ │ +00085a10: 6f64 2075 7365 6420 746f 2065 7374 696d od used to estim │ │ │ +00085a20: 6174 6520 7468 6520 6361 6d65 7261 2070 ate the camera p │ │ │ +00085a30: 6f73 6520 7573 696e 6720 616c 6c20 7468 ose using all th │ │ │ +00085a40: 6520 696e 6c69 6572 7320 6973 2064 6566 e inliers is def │ │ │ +00085a50: 696e 6564 2062 7920 7468 650a 2020 2020 ined by the. │ │ │ +00085a60: 2020 2066 6c61 6773 2070 6172 616d 6574 flags paramet │ │ │ +00085a70: 6572 7320 756e 6c65 7373 2069 7420 6973 ers unless it is │ │ │ +00085a80: 2065 7175 616c 2074 6f20 2353 4f4c 5645 equal to #SOLVE │ │ │ +00085a90: 504e 505f 5033 5020 6f72 2023 534f 4c56 PNP_P3P or #SOLV │ │ │ +00085aa0: 4550 4e50 5f41 5033 502e 2049 6e20 7468 EPNP_AP3P. In th │ │ │ +00085ab0: 6973 2063 6173 652c 0a20 2020 2020 2020 is case,. │ │ │ +00085ac0: 7468 6520 6d65 7468 6f64 2023 534f 4c56 the method #SOLV │ │ │ +00085ad0: 4550 4e50 5f45 504e 5020 7769 6c6c 2062 EPNP_EPNP will b │ │ │ +00085ae0: 6520 7573 6564 2069 6e73 7465 6164 2e0a e used instead.. │ │ │ +00085af0: 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64
    • .
    .
    Returns:< │ │ │ +00085b10: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
    automat │ │ │ +00085b20: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ +00085b30: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ....
  • ..

    solvePnPRa │ │ │ +00085c40: 6e73 6163 3c2f 6833 3e0a 3c64 6976 2063 nsac

    .
    .
    │ │ │ +00085ca0: 7075 626c 6963 2073 7461 7469 633c 2f73 public static boolean solvePnPRansa │ │ │ +00085d10: 633c 2f73 7061 6e3e 3c77 6272 3e3c 7370 c(MatO │ │ │ +00085d80: 6650 6f69 6e74 3366 3c2f 613e 266e 6273 fPoint3f&nbs │ │ │ +00085d90: 703b 6f62 6a65 6374 506f 696e 7473 2c0a p;objectPoints,. │ │ │ +00085da0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 MatOfPoint │ │ │ +00085df0: 3266 3c2f 613e 266e 6273 703b 696d 6167 2f imag │ │ │ +00085e00: 6550 6f69 6e74 732c 0a20 3c61 2068 7265 ePoints,. Mat&nb │ │ │ +00085e50: 7370 3b63 616d 6572 614d 6174 7269 782c sp;cameraMatrix, │ │ │ +00085e60: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . MatOfDoubl │ │ │ +00085eb0: 653c 2f61 3e26 6e62 7370 3b64 6973 7443 e distC │ │ │ +00085ec0: 6f65 6666 732c 0a20 3c61 2068 7265 663d oeffs,. Mat  │ │ │ +00085f10: 3b72 7665 632c 0a20 3c61 2068 7265 663d ;rvec,. Mat  │ │ │ +00085f60: 3b74 7665 632c 0a20 626f 6f6c 6561 6e26 ;tvec,. boolean& │ │ │ +00085f70: 6e62 7370 3b75 7365 4578 7472 696e 7369 nbsp;useExtrinsi │ │ │ +00085f80: 6347 7565 7373 2c0a 2069 6e74 266e 6273 cGuess,. int&nbs │ │ │ +00085f90: 703b 6974 6572 6174 696f 6e73 436f 756e p;iterationsCoun │ │ │ +00085fa0: 742c 0a20 666c 6f61 7426 6e62 7370 3b72 t,. float r │ │ │ +00085fb0: 6570 726f 6a65 6374 696f 6e45 7272 6f72 eprojectionError │ │ │ +00085fc0: 2c0a 2064 6f75 626c 6526 6e62 7370 3b63 ,. double c │ │ │ +00085fd0: 6f6e 6669 6465 6e63 6529 3c2f 7370 616e onfidence)
    .
    Finds │ │ │ +00086000: 2061 6e20 6f62 6a65 6374 2070 6f73 6520 an object pose │ │ │ +00086010: 5c28 207b 7d5e 7b63 7d5c 6d61 7468 6266 \( {}^{c}\mathbf │ │ │ +00086020: 7b54 7d5f 6f20 5c29 2066 726f 6d20 3344 {T}_o \) from 3D │ │ │ +00086030: 2d32 4420 706f 696e 7420 636f 7272 6573 -2D point corres │ │ │ +00086040: 706f 6e64 656e 6365 7320 7573 696e 6720 pondences using │ │ │ +00086050: 7468 6520 5241 4e53 4143 2073 6368 656d the RANSAC schem │ │ │ +00086060: 6520 746f 2064 6561 6c20 7769 7468 2062 e to deal with b │ │ │ +00086070: 6164 206d 6174 6368 6573 2e0a 0a21 5b50 ad matches...![P │ │ │ +00086080: 6572 7370 6563 7469 7665 2070 726f 6a65 erspective proje │ │ │ +00086090: 6374 696f 6e2c 2066 726f 6d20 6f62 6a65 ction, from obje │ │ │ +000860a0: 6374 2074 6f20 6361 6d65 7261 2066 7261 ct to camera fra │ │ │ +000860b0: 6d65 5d28 7069 6373 2f70 696e 686f 6c65 me](pics/pinhole │ │ │ +000860c0: 5f68 6f6d 6f67 656e 656f 7573 5f74 7261 _homogeneous_tra │ │ │ +000860d0: 6e73 666f 726d 6174 696f 6e2e 6a70 6729 nsformation.jpg) │ │ │ +000860e0: 7b20 7769 6474 683d 3530 2520 7d0a 0a53 { width=50% }..S │ │ │ +000860f0: 4545 3a20 5245 463a 2063 616c 6962 3364 EE: REF: calib3d │ │ │ +00086100: 5f73 6f6c 7665 506e 503c 2f64 6976 3e0a _solvePnP
    . │ │ │ +00086110: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ +00086130: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    objectPoints - Array of │ │ │ +00086160: 206f 626a 6563 7420 706f 696e 7473 2069 object points i │ │ │ +00086170: 6e20 7468 6520 6f62 6a65 6374 2063 6f6f n the object coo │ │ │ +00086180: 7264 696e 6174 6520 7370 6163 652c 204e rdinate space, N │ │ │ +00086190: 7833 2031 2d63 6861 6e6e 656c 206f 720a x3 1-channel or. │ │ │ +000861a0: 3178 4e2f 4e78 3120 332d 6368 616e 6e65 1xN/Nx1 3-channe │ │ │ +000861b0: 6c2c 2077 6865 7265 204e 2069 7320 7468 l, where N is th │ │ │ +000861c0: 6520 6e75 6d62 6572 206f 6620 706f 696e e number of poin │ │ │ +000861d0: 7473 2e20 7665 6374 6f72 266c 743b 506f ts. vector<Po │ │ │ +000861e0: 696e 7433 6426 6774 3b20 6361 6e20 6265 int3d> can be │ │ │ +000861f0: 2061 6c73 6f20 7061 7373 6564 2068 6572 also passed her │ │ │ +00086200: 652e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 e.
    .
    imagePoints - Array of │ │ │ +00086230: 636f 7272 6573 706f 6e64 696e 6720 696d corresponding im │ │ │ +00086240: 6167 6520 706f 696e 7473 2c20 4e78 3220 age points, Nx2 │ │ │ +00086250: 312d 6368 616e 6e65 6c20 6f72 2031 784e 1-channel or 1xN │ │ │ +00086260: 2f4e 7831 2032 2d63 6861 6e6e 656c 2c0a /Nx1 2-channel,. │ │ │ +00086270: 7768 6572 6520 4e20 6973 2074 6865 206e where N is the n │ │ │ +00086280: 756d 6265 7220 6f66 2070 6f69 6e74 732e umber of points. │ │ │ +00086290: 2076 6563 746f 7226 6c74 3b50 6f69 6e74 vector<Point │ │ │ +000862a0: 3264 2667 743b 2063 616e 2062 6520 616c 2d> can be al │ │ │ +000862b0: 736f 2070 6173 7365 6420 6865 7265 2e3c so passed here.< │ │ │ +000862c0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ +000862d0: 616d 6572 614d 6174 7269 783c 2f63 6f64 ameraMatrix - Input camer │ │ │ +000862f0: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ +00086300: 6978 205c 285c 6361 6d65 7261 6d61 7472 ix \(\cameramatr │ │ │ +00086310: 6978 7b41 7d5c 2920 2e3c 2f64 643e 0a3c ix{A}\) .
    .< │ │ │ +00086320: 6464 3e3c 636f 6465 3e64 6973 7443 6f65 dd>distCoe │ │ │ +00086330: 6666 733c 2f63 6f64 653e 202d 2049 6e70 ffs - Inp │ │ │ +00086340: 7574 2076 6563 746f 7220 6f66 2064 6973 ut vector of dis │ │ │ +00086350: 746f 7274 696f 6e20 636f 6566 6669 6369 tortion coeffici │ │ │ +00086360: 656e 7473 0a5c 285c 6469 7374 636f 6566 ents.\(\distcoef │ │ │ +00086370: 6673 5c29 2e20 4966 2074 6865 2076 6563 fs\). If the vec │ │ │ +00086380: 746f 7220 6973 204e 554c 4c2f 656d 7074 tor is NULL/empt │ │ │ +00086390: 792c 2074 6865 207a 6572 6f20 6469 7374 y, the zero dist │ │ │ +000863a0: 6f72 7469 6f6e 2063 6f65 6666 6963 6965 ortion coefficie │ │ │ +000863b0: 6e74 7320 6172 650a 6173 7375 6d65 642e nts are.assumed. │ │ │ +000863c0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e .
    │ │ │ +000863d0: 7276 6563 3c2f 636f 6465 3e20 2d20 4f75 rvec - Ou │ │ │ +000863e0: 7470 7574 2072 6f74 6174 696f 6e20 7665 tput rotation ve │ │ │ +000863f0: 6374 6f72 2028 7365 6520 5245 463a 2052 ctor (see REF: R │ │ │ +00086400: 6f64 7269 6775 6573 2029 2074 6861 742c odrigues ) that, │ │ │ +00086410: 2074 6f67 6574 6865 7220 7769 7468 2074 together with t │ │ │ +00086420: 7665 632c 2062 7269 6e67 7320 706f 696e vec, brings poin │ │ │ +00086430: 7473 2066 726f 6d0a 7468 6520 6d6f 6465 ts from.the mode │ │ │ +00086440: 6c20 636f 6f72 6469 6e61 7465 2073 7973 l coordinate sys │ │ │ +00086450: 7465 6d20 746f 2074 6865 2063 616d 6572 tem to the camer │ │ │ +00086460: 6120 636f 6f72 6469 6e61 7465 2073 7973 a coordinate sys │ │ │ +00086470: 7465 6d2e 3c2f 6464 3e0a 3c64 643e 3c63 tem.
    .
    tvec │ │ │ +00086490: 2d20 4f75 7470 7574 2074 7261 6e73 6c61 - Output transla │ │ │ +000864a0: 7469 6f6e 2076 6563 746f 722e 3c2f 6464 tion vector.
    .
    useE │ │ │ +000864c0: 7874 7269 6e73 6963 4775 6573 733c 2f63 xtrinsicGuess - Parameter │ │ │ +000864e0: 2075 7365 6420 666f 7220 5245 463a 2053 used for REF: S │ │ │ +000864f0: 4f4c 5645 504e 505f 4954 4552 4154 4956 OLVEPNP_ITERATIV │ │ │ +00086500: 452e 2049 6620 7472 7565 2028 3129 2c20 E. If true (1), │ │ │ +00086510: 7468 6520 6675 6e63 7469 6f6e 2075 7365 the function use │ │ │ +00086520: 730a 7468 6520 7072 6f76 6964 6564 2072 s.the provided r │ │ │ +00086530: 7665 6320 616e 6420 7476 6563 2076 616c vec and tvec val │ │ │ +00086540: 7565 7320 6173 2069 6e69 7469 616c 2061 ues as initial a │ │ │ +00086550: 7070 726f 7869 6d61 7469 6f6e 7320 6f66 pproximations of │ │ │ +00086560: 2074 6865 2072 6f74 6174 696f 6e20 616e the rotation an │ │ │ +00086570: 6420 7472 616e 736c 6174 696f 6e0a 7665 d translation.ve │ │ │ +00086580: 6374 6f72 732c 2072 6573 7065 6374 6976 ctors, respectiv │ │ │ +00086590: 656c 792c 2061 6e64 2066 7572 7468 6572 ely, and further │ │ │ +000865a0: 206f 7074 696d 697a 6573 2074 6865 6d2e optimizes them. │ │ │ +000865b0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000865c0: 6974 6572 6174 696f 6e73 436f 756e 743c iterationsCount< │ │ │ +000865d0: 2f63 6f64 653e 202d 204e 756d 6265 7220 /code> - Number │ │ │ +000865e0: 6f66 2069 7465 7261 7469 6f6e 732e 3c2f of iterations..
    re │ │ │ +00086600: 7072 6f6a 6563 7469 6f6e 4572 726f 723c projectionError< │ │ │ +00086610: 2f63 6f64 653e 202d 2049 6e6c 6965 7220 /code> - Inlier │ │ │ +00086620: 7468 7265 7368 6f6c 6420 7661 6c75 6520 threshold value │ │ │ +00086630: 7573 6564 2062 7920 7468 6520 5241 4e53 used by the RANS │ │ │ +00086640: 4143 2070 726f 6365 6475 7265 2e20 5468 AC procedure. Th │ │ │ +00086650: 6520 7061 7261 6d65 7465 7220 7661 6c75 e parameter valu │ │ │ +00086660: 650a 6973 2074 6865 206d 6178 696d 756d e.is the maximum │ │ │ +00086670: 2061 6c6c 6f77 6564 2064 6973 7461 6e63 allowed distanc │ │ │ +00086680: 6520 6265 7477 6565 6e20 7468 6520 6f62 e between the ob │ │ │ +00086690: 7365 7276 6564 2061 6e64 2063 6f6d 7075 served and compu │ │ │ +000866a0: 7465 6420 706f 696e 7420 7072 6f6a 6563 ted point projec │ │ │ +000866b0: 7469 6f6e 7320 746f 2063 6f6e 7369 6465 tions to conside │ │ │ +000866c0: 7220 6974 0a61 6e20 696e 6c69 6572 2e3c r it.an inlier.< │ │ │ +000866d0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ +000866e0: 6f6e 6669 6465 6e63 653c 2f63 6f64 653e onfidence │ │ │ +000866f0: 202d 2054 6865 2070 726f 6261 6269 6c69 - The probabili │ │ │ +00086700: 7479 2074 6861 7420 7468 6520 616c 676f ty that the algo │ │ │ +00086710: 7269 7468 6d20 7072 6f64 7563 6573 2061 rithm produces a │ │ │ +00086720: 2075 7365 6675 6c20 7265 7375 6c74 2e0a useful result.. │ │ │ +00086730: 0a54 6865 2066 756e 6374 696f 6e20 6573 .The function es │ │ │ +00086740: 7469 6d61 7465 7320 616e 206f 626a 6563 timates an objec │ │ │ +00086750: 7420 706f 7365 2067 6976 656e 2061 2073 t pose given a s │ │ │ +00086760: 6574 206f 6620 6f62 6a65 6374 2070 6f69 et of object poi │ │ │ +00086770: 6e74 732c 2074 6865 6972 2063 6f72 7265 nts, their corre │ │ │ +00086780: 7370 6f6e 6469 6e67 2069 6d61 6765 0a70 sponding image.p │ │ │ +00086790: 726f 6a65 6374 696f 6e73 2c20 6173 2077 rojections, as w │ │ │ +000867a0: 656c 6c20 6173 2074 6865 2063 616d 6572 ell as the camer │ │ │ +000867b0: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ +000867c0: 6978 2061 6e64 2074 6865 2064 6973 746f ix and the disto │ │ │ +000867d0: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ +000867e0: 7473 2e20 5468 6973 2066 756e 6374 696f ts. This functio │ │ │ +000867f0: 6e20 6669 6e64 7320 7375 6368 0a61 2070 n finds such.a p │ │ │ +00086800: 6f73 6520 7468 6174 206d 696e 696d 697a ose that minimiz │ │ │ +00086810: 6573 2072 6570 726f 6a65 6374 696f 6e20 es reprojection │ │ │ +00086820: 6572 726f 722c 2074 6861 7420 6973 2c20 error, that is, │ │ │ +00086830: 7468 6520 7375 6d20 6f66 2073 7175 6172 the sum of squar │ │ │ +00086840: 6564 2064 6973 7461 6e63 6573 2062 6574 ed distances bet │ │ │ +00086850: 7765 656e 2074 6865 206f 6273 6572 7665 ween the observe │ │ │ +00086860: 640a 7072 6f6a 6563 7469 6f6e 7320 696d d.projections im │ │ │ +00086870: 6167 6550 6f69 6e74 7320 616e 6420 7468 agePoints and th │ │ │ +00086880: 6520 7072 6f6a 6563 7465 6420 2875 7369 e projected (usi │ │ │ +00086890: 6e67 2052 4546 3a20 7072 6f6a 6563 7450 ng REF: projectP │ │ │ +000868a0: 6f69 6e74 7320 2920 6f62 6a65 6374 506f oints ) objectPo │ │ │ +000868b0: 696e 7473 2e20 5468 6520 7573 6520 6f66 ints. The use of │ │ │ +000868c0: 2052 414e 5341 430a 6d61 6b65 7320 7468 RANSAC.makes th │ │ │ +000868d0: 6520 6675 6e63 7469 6f6e 2072 6573 6973 e function resis │ │ │ +000868e0: 7461 6e74 2074 6f20 6f75 746c 6965 7273 tant to outliers │ │ │ +000868f0: 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a ...Note:. │ │ │ +00086900: 3c75 6c3e 0a20 203c 6c69 3e0a 2020 2020
      .
    • . │ │ │ +00086910: 2020 416e 2065 7861 6d70 6c65 206f 6620 An example of │ │ │ +00086920: 686f 7720 746f 2075 7365 2073 6f6c 7665 how to use solve │ │ │ +00086930: 506e 5052 616e 7361 6320 666f 7220 6f62 PnPRansac for ob │ │ │ +00086940: 6a65 6374 2064 6574 6563 7469 6f6e 2063 ject detection c │ │ │ +00086950: 616e 2062 6520 666f 756e 6420 6174 0a20 an be found at. │ │ │ +00086960: 2020 2020 2020 2052 4546 3a20 7475 746f REF: tuto │ │ │ +00086970: 7269 616c 5f72 6561 6c5f 7469 6d65 5f70 rial_real_time_p │ │ │ +00086980: 6f73 650a 2020 3c2f 6c69 3e0a 2020 3c6c ose.
    • . . The def │ │ │ +000869a0: 6175 6c74 206d 6574 686f 6420 7573 6564 ault method used │ │ │ +000869b0: 2074 6f20 6573 7469 6d61 7465 2074 6865 to estimate the │ │ │ +000869c0: 2063 616d 6572 6120 706f 7365 2066 6f72 camera pose for │ │ │ +000869d0: 2074 6865 204d 696e 696d 616c 2053 616d the Minimal Sam │ │ │ +000869e0: 706c 6520 5365 7473 2073 7465 700a 2020 ple Sets step. │ │ │ +000869f0: 2020 2020 2069 7320 2353 4f4c 5645 504e is #SOLVEPN │ │ │ +00086a00: 505f 4550 4e50 2e20 4578 6365 7074 696f P_EPNP. Exceptio │ │ │ +00086a10: 6e73 2061 7265 3a0a 2020 3c75 6c3e 0a20 ns are:.
        . │ │ │ +00086a20: 2020 203c 6c69 3e0a 2020 2020 2020 2020
      • . │ │ │ +00086a30: 2020 6966 2079 6f75 2063 686f 6f73 6520 if you choose │ │ │ +00086a40: 2353 4f4c 5645 504e 505f 5033 5020 6f72 #SOLVEPNP_P3P or │ │ │ +00086a50: 2023 534f 4c56 4550 4e50 5f41 5033 502c #SOLVEPNP_AP3P, │ │ │ +00086a60: 2074 6865 7365 206d 6574 686f 6473 2077 these methods w │ │ │ +00086a70: 696c 6c20 6265 2075 7365 642e 0a20 2020 ill be used.. │ │ │ +00086a80: 203c 2f6c 693e 0a20 2020 203c 6c69 3e0a
      • .
      • . │ │ │ +00086a90: 2020 2020 2020 2020 2020 6966 2074 6865 if the │ │ │ +00086aa0: 206e 756d 6265 7220 6f66 2069 6e70 7574 number of input │ │ │ +00086ab0: 2070 6f69 6e74 7320 6973 2065 7175 616c points is equal │ │ │ +00086ac0: 2074 6f20 342c 2023 534f 4c56 4550 4e50 to 4, #SOLVEPNP │ │ │ +00086ad0: 5f50 3350 2069 7320 7573 6564 2e0a 2020 _P3P is used.. │ │ │ +00086ae0: 2020 3c2f 6c69 3e0a 2020 3c2f 756c 3e0a
      • .
      . │ │ │ +00086af0: 2020 3c6c 693e 0a20 2020 2020 2054 6865
    • . The │ │ │ +00086b00: 206d 6574 686f 6420 7573 6564 2074 6f20 method used to │ │ │ +00086b10: 6573 7469 6d61 7465 2074 6865 2063 616d estimate the cam │ │ │ +00086b20: 6572 6120 706f 7365 2075 7369 6e67 2061 era pose using a │ │ │ +00086b30: 6c6c 2074 6865 2069 6e6c 6965 7273 2069 ll the inliers i │ │ │ +00086b40: 7320 6465 6669 6e65 6420 6279 2074 6865 s defined by the │ │ │ +00086b50: 0a20 2020 2020 2020 666c 6167 7320 7061 . flags pa │ │ │ +00086b60: 7261 6d65 7465 7273 2075 6e6c 6573 7320 rameters unless │ │ │ +00086b70: 6974 2069 7320 6571 7561 6c20 746f 2023 it is equal to # │ │ │ +00086b80: 534f 4c56 4550 4e50 5f50 3350 206f 7220 SOLVEPNP_P3P or │ │ │ +00086b90: 2353 4f4c 5645 504e 505f 4150 3350 2e20 #SOLVEPNP_AP3P. │ │ │ +00086ba0: 496e 2074 6869 7320 6361 7365 2c0a 2020 In this case,. │ │ │ +00086bb0: 2020 2020 2074 6865 206d 6574 686f 6420 the method │ │ │ +00086bc0: 2353 4f4c 5645 504e 505f 4550 4e50 2077 #SOLVEPNP_EPNP w │ │ │ +00086bd0: 696c 6c20 6265 2075 7365 6420 696e 7374 ill be used inst │ │ │ +00086be0: 6561 642e 0a20 203c 2f6c 693e 0a3c 2f75 ead..
    • .
    .
    Retu │ │ │ +00086c00: 726e 733a 3c2f 6474 3e0a 3c64 643e 6175 rns:
    .
    au │ │ │ +00086c10: 746f 6d61 7469 6361 6c6c 7920 6765 6e65 tomatically gene │ │ │ +00086c20: 7261 7465 643c 2f64 643e 0a3c 2f64 6c3e rated
    .
    │ │ │ +00086c30: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • .. │ │ │ +00086d20: 3c68 333e 736f 6c76 6550 6e50 5261 6e73

    solvePnPRans │ │ │ +00086d30: 6163 3c2f 6833 3e0a 3c64 6976 2063 6c61 ac

    .
    .
    pu │ │ │ +00086d90: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static boolean │ │ │ +00086dd0: 266e 6273 703b 3c73 7061 6e20 636c 6173  solvePnPRansac< │ │ │ +00086e00: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(MatOfP │ │ │ +00086e70: 6f69 6e74 3366 3c2f 613e 266e 6273 703b oint3f  │ │ │ +00086e80: 6f62 6a65 6374 506f 696e 7473 2c0a 203c objectPoints,. < │ │ │ +00086e90: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00086ea0: 4d61 744f 6650 6f69 6e74 3266 2e68 746d MatOfPoint2f.htm │ │ │ +00086eb0: 6c22 2074 6974 6c65 3d22 636c 6173 7320 l" title="class │ │ │ +00086ec0: 696e 206f 7267 2e6f 7065 6e63 762e 636f in org.opencv.co │ │ │ +00086ed0: 7265 223e 4d61 744f 6650 6f69 6e74 3266 re">MatOfPoint2f │ │ │ +00086ee0: 3c2f 613e 266e 6273 703b 696d 6167 6550  imageP │ │ │ +00086ef0: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ +00086f40: 3b63 616d 6572 614d 6174 7269 782c 0a20 ;cameraMatrix,. │ │ │ +00086f50: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfDouble< │ │ │ +00086fa0: 2f61 3e26 6e62 7370 3b64 6973 7443 6f65 /a> distCoe │ │ │ +00086fb0: 6666 732c 0a20 3c61 2068 7265 663d 222e ffs,. Mat r │ │ │ +00087000: 7665 632c 0a20 3c61 2068 7265 663d 222e vec,. Mat t │ │ │ +00087050: 7665 632c 0a20 626f 6f6c 6561 6e26 6e62 vec,. boolean&nb │ │ │ +00087060: 7370 3b75 7365 4578 7472 696e 7369 6347 sp;useExtrinsicG │ │ │ +00087070: 7565 7373 2c0a 2069 6e74 266e 6273 703b uess,. int  │ │ │ +00087080: 6974 6572 6174 696f 6e73 436f 756e 742c iterationsCount, │ │ │ +00087090: 0a20 666c 6f61 7426 6e62 7370 3b72 6570 . float rep │ │ │ +000870a0: 726f 6a65 6374 696f 6e45 7272 6f72 293c rojectionError)< │ │ │ +000870b0: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ +000870d0: 4669 6e64 7320 616e 206f 626a 6563 7420 Finds an object │ │ │ +000870e0: 706f 7365 205c 2820 7b7d 5e7b 637d 5c6d pose \( {}^{c}\m │ │ │ +000870f0: 6174 6862 667b 547d 5f6f 205c 2920 6672 athbf{T}_o \) fr │ │ │ +00087100: 6f6d 2033 442d 3244 2070 6f69 6e74 2063 om 3D-2D point c │ │ │ +00087110: 6f72 7265 7370 6f6e 6465 6e63 6573 2075 orrespondences u │ │ │ +00087120: 7369 6e67 2074 6865 2052 414e 5341 4320 sing the RANSAC │ │ │ +00087130: 7363 6865 6d65 2074 6f20 6465 616c 2077 scheme to deal w │ │ │ +00087140: 6974 6820 6261 6420 6d61 7463 6865 732e ith bad matches. │ │ │ +00087150: 0a0a 215b 5065 7273 7065 6374 6976 6520 ..![Perspective │ │ │ +00087160: 7072 6f6a 6563 7469 6f6e 2c20 6672 6f6d projection, from │ │ │ +00087170: 206f 626a 6563 7420 746f 2063 616d 6572 object to camer │ │ │ +00087180: 6120 6672 616d 655d 2870 6963 732f 7069 a frame](pics/pi │ │ │ +00087190: 6e68 6f6c 655f 686f 6d6f 6765 6e65 6f75 nhole_homogeneou │ │ │ +000871a0: 735f 7472 616e 7366 6f72 6d61 7469 6f6e s_transformation │ │ │ +000871b0: 2e6a 7067 297b 2077 6964 7468 3d35 3025 .jpg){ width=50% │ │ │ +000871c0: 207d 0a0a 5345 453a 2052 4546 3a20 6361 }..SEE: REF: ca │ │ │ +000871d0: 6c69 6233 645f 736f 6c76 6550 6e50 3c2f lib3d_solvePnP.
    .
    Para │ │ │ +00087200: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    objectPoi │ │ │ +00087220: 6e74 733c 2f63 6f64 653e 202d 2041 7272 nts - Arr │ │ │ +00087230: 6179 206f 6620 6f62 6a65 6374 2070 6f69 ay of object poi │ │ │ +00087240: 6e74 7320 696e 2074 6865 206f 626a 6563 nts in the objec │ │ │ +00087250: 7420 636f 6f72 6469 6e61 7465 2073 7061 t coordinate spa │ │ │ +00087260: 6365 2c20 4e78 3320 312d 6368 616e 6e65 ce, Nx3 1-channe │ │ │ +00087270: 6c20 6f72 0a31 784e 2f4e 7831 2033 2d63 l or.1xN/Nx1 3-c │ │ │ +00087280: 6861 6e6e 656c 2c20 7768 6572 6520 4e20 hannel, where N │ │ │ +00087290: 6973 2074 6865 206e 756d 6265 7220 6f66 is the number of │ │ │ +000872a0: 2070 6f69 6e74 732e 2076 6563 746f 7226 points. vector& │ │ │ +000872b0: 6c74 3b50 6f69 6e74 3364 2667 743b 2063 lt;Point3d> c │ │ │ +000872c0: 616e 2062 6520 616c 736f 2070 6173 7365 an be also passe │ │ │ +000872d0: 6420 6865 7265 2e3c 2f64 643e 0a3c 6464 d here.
    .
    imagePoin │ │ │ +000872f0: 7473 3c2f 636f 6465 3e20 2d20 4172 7261 ts - Arra │ │ │ +00087300: 7920 6f66 2063 6f72 7265 7370 6f6e 6469 y of correspondi │ │ │ +00087310: 6e67 2069 6d61 6765 2070 6f69 6e74 732c ng image points, │ │ │ +00087320: 204e 7832 2031 2d63 6861 6e6e 656c 206f Nx2 1-channel o │ │ │ +00087330: 7220 3178 4e2f 4e78 3120 322d 6368 616e r 1xN/Nx1 2-chan │ │ │ +00087340: 6e65 6c2c 0a77 6865 7265 204e 2069 7320 nel,.where N is │ │ │ +00087350: 7468 6520 6e75 6d62 6572 206f 6620 706f the number of po │ │ │ +00087360: 696e 7473 2e20 7665 6374 6f72 266c 743b ints. vector< │ │ │ +00087370: 506f 696e 7432 6426 6774 3b20 6361 6e20 Point2d> can │ │ │ +00087380: 6265 2061 6c73 6f20 7061 7373 6564 2068 be also passed h │ │ │ +00087390: 6572 652e 3c2f 6464 3e0a 3c64 643e 3c63 ere.
    .
    cameraMatrix │ │ │ +000873b0: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ +000873c0: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ +000873d0: 206d 6174 7269 7820 5c28 5c63 616d 6572 matrix \(\camer │ │ │ +000873e0: 616d 6174 7269 787b 417d 5c29 202e 3c2f amatrix{A}\) ..
    di │ │ │ +00087400: 7374 436f 6566 6673 3c2f 636f 6465 3e20 stCoeffs │ │ │ +00087410: 2d20 496e 7075 7420 7665 6374 6f72 206f - Input vector o │ │ │ +00087420: 6620 6469 7374 6f72 7469 6f6e 2063 6f65 f distortion coe │ │ │ +00087430: 6666 6963 6965 6e74 730a 5c28 5c64 6973 fficients.\(\dis │ │ │ +00087440: 7463 6f65 6666 735c 292e 2049 6620 7468 tcoeffs\). If th │ │ │ +00087450: 6520 7665 6374 6f72 2069 7320 4e55 4c4c e vector is NULL │ │ │ +00087460: 2f65 6d70 7479 2c20 7468 6520 7a65 726f /empty, the zero │ │ │ +00087470: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ +00087480: 6669 6369 656e 7473 2061 7265 0a61 7373 ficients are.ass │ │ │ +00087490: 756d 6564 2e3c 2f64 643e 0a3c 6464 3e3c umed.
    .
    < │ │ │ +000874a0: 636f 6465 3e72 7665 633c 2f63 6f64 653e code>rvec │ │ │ +000874b0: 202d 204f 7574 7075 7420 726f 7461 7469 - Output rotati │ │ │ +000874c0: 6f6e 2076 6563 746f 7220 2873 6565 2052 on vector (see R │ │ │ +000874d0: 4546 3a20 526f 6472 6967 7565 7320 2920 EF: Rodrigues ) │ │ │ +000874e0: 7468 6174 2c20 746f 6765 7468 6572 2077 that, together w │ │ │ +000874f0: 6974 6820 7476 6563 2c20 6272 696e 6773 ith tvec, brings │ │ │ +00087500: 2070 6f69 6e74 7320 6672 6f6d 0a74 6865 points from.the │ │ │ +00087510: 206d 6f64 656c 2063 6f6f 7264 696e 6174 model coordinat │ │ │ +00087520: 6520 7379 7374 656d 2074 6f20 7468 6520 e system to the │ │ │ +00087530: 6361 6d65 7261 2063 6f6f 7264 696e 6174 camera coordinat │ │ │ +00087540: 6520 7379 7374 656d 2e3c 2f64 643e 0a3c e system.
    .< │ │ │ +00087550: 6464 3e3c 636f 6465 3e74 7665 633c 2f63 dd>tvec - Output tr │ │ │ +00087570: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ +00087580: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 ..
    useExtrinsicGue │ │ │ +000875a0: 7373 3c2f 636f 6465 3e20 2d20 5061 7261 ss - Para │ │ │ +000875b0: 6d65 7465 7220 7573 6564 2066 6f72 2052 meter used for R │ │ │ +000875c0: 4546 3a20 534f 4c56 4550 4e50 5f49 5445 EF: SOLVEPNP_ITE │ │ │ +000875d0: 5241 5449 5645 2e20 4966 2074 7275 6520 RATIVE. If true │ │ │ +000875e0: 2831 292c 2074 6865 2066 756e 6374 696f (1), the functio │ │ │ +000875f0: 6e20 7573 6573 0a74 6865 2070 726f 7669 n uses.the provi │ │ │ +00087600: 6465 6420 7276 6563 2061 6e64 2074 7665 ded rvec and tve │ │ │ +00087610: 6320 7661 6c75 6573 2061 7320 696e 6974 c values as init │ │ │ +00087620: 6961 6c20 6170 7072 6f78 696d 6174 696f ial approximatio │ │ │ +00087630: 6e73 206f 6620 7468 6520 726f 7461 7469 ns of the rotati │ │ │ +00087640: 6f6e 2061 6e64 2074 7261 6e73 6c61 7469 on and translati │ │ │ +00087650: 6f6e 0a76 6563 746f 7273 2c20 7265 7370 on.vectors, resp │ │ │ +00087660: 6563 7469 7665 6c79 2c20 616e 6420 6675 ectively, and fu │ │ │ +00087670: 7274 6865 7220 6f70 7469 6d69 7a65 7320 rther optimizes │ │ │ +00087680: 7468 656d 2e3c 2f64 643e 0a3c 6464 3e3c them.
    .
    < │ │ │ +00087690: 636f 6465 3e69 7465 7261 7469 6f6e 7343 code>iterationsC │ │ │ +000876a0: 6f75 6e74 3c2f 636f 6465 3e20 2d20 4e75 ount - Nu │ │ │ +000876b0: 6d62 6572 206f 6620 6974 6572 6174 696f mber of iteratio │ │ │ +000876c0: 6e73 2e3c 2f64 643e 0a3c 6464 3e3c 636f ns.
    .
    reprojectionE │ │ │ +000876e0: 7272 6f72 3c2f 636f 6465 3e20 2d20 496e rror - In │ │ │ +000876f0: 6c69 6572 2074 6872 6573 686f 6c64 2076 lier threshold v │ │ │ +00087700: 616c 7565 2075 7365 6420 6279 2074 6865 alue used by the │ │ │ +00087710: 2052 414e 5341 4320 7072 6f63 6564 7572 RANSAC procedur │ │ │ +00087720: 652e 2054 6865 2070 6172 616d 6574 6572 e. The parameter │ │ │ +00087730: 2076 616c 7565 0a69 7320 7468 6520 6d61 value.is the ma │ │ │ +00087740: 7869 6d75 6d20 616c 6c6f 7765 6420 6469 ximum allowed di │ │ │ +00087750: 7374 616e 6365 2062 6574 7765 656e 2074 stance between t │ │ │ +00087760: 6865 206f 6273 6572 7665 6420 616e 6420 he observed and │ │ │ +00087770: 636f 6d70 7574 6564 2070 6f69 6e74 2070 computed point p │ │ │ +00087780: 726f 6a65 6374 696f 6e73 2074 6f20 636f rojections to co │ │ │ +00087790: 6e73 6964 6572 2069 740a 616e 2069 6e6c nsider it.an inl │ │ │ +000877a0: 6965 722e 0a0a 5468 6520 6675 6e63 7469 ier...The functi │ │ │ +000877b0: 6f6e 2065 7374 696d 6174 6573 2061 6e20 on estimates an │ │ │ +000877c0: 6f62 6a65 6374 2070 6f73 6520 6769 7665 object pose give │ │ │ +000877d0: 6e20 6120 7365 7420 6f66 206f 626a 6563 n a set of objec │ │ │ +000877e0: 7420 706f 696e 7473 2c20 7468 6569 7220 t points, their │ │ │ +000877f0: 636f 7272 6573 706f 6e64 696e 6720 696d corresponding im │ │ │ +00087800: 6167 650a 7072 6f6a 6563 7469 6f6e 732c age.projections, │ │ │ +00087810: 2061 7320 7765 6c6c 2061 7320 7468 6520 as well as the │ │ │ +00087820: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ +00087830: 206d 6174 7269 7820 616e 6420 7468 6520 matrix and the │ │ │ +00087840: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ +00087850: 6963 6965 6e74 732e 2054 6869 7320 6675 icients. This fu │ │ │ +00087860: 6e63 7469 6f6e 2066 696e 6473 2073 7563 nction finds suc │ │ │ +00087870: 680a 6120 706f 7365 2074 6861 7420 6d69 h.a pose that mi │ │ │ +00087880: 6e69 6d69 7a65 7320 7265 7072 6f6a 6563 nimizes reprojec │ │ │ +00087890: 7469 6f6e 2065 7272 6f72 2c20 7468 6174 tion error, that │ │ │ +000878a0: 2069 732c 2074 6865 2073 756d 206f 6620 is, the sum of │ │ │ +000878b0: 7371 7561 7265 6420 6469 7374 616e 6365 squared distance │ │ │ +000878c0: 7320 6265 7477 6565 6e20 7468 6520 6f62 s between the ob │ │ │ +000878d0: 7365 7276 6564 0a70 726f 6a65 6374 696f served.projectio │ │ │ +000878e0: 6e73 2069 6d61 6765 506f 696e 7473 2061 ns imagePoints a │ │ │ +000878f0: 6e64 2074 6865 2070 726f 6a65 6374 6564 nd the projected │ │ │ +00087900: 2028 7573 696e 6720 5245 463a 2070 726f (using REF: pro │ │ │ +00087910: 6a65 6374 506f 696e 7473 2029 206f 626a jectPoints ) obj │ │ │ +00087920: 6563 7450 6f69 6e74 732e 2054 6865 2075 ectPoints. The u │ │ │ +00087930: 7365 206f 6620 5241 4e53 4143 0a6d 616b se of RANSAC.mak │ │ │ +00087940: 6573 2074 6865 2066 756e 6374 696f 6e20 es the function │ │ │ +00087950: 7265 7369 7374 616e 7420 746f 206f 7574 resistant to out │ │ │ +00087960: 6c69 6572 732e 0a0a 3c62 3e4e 6f74 653a liers...Note: │ │ │ +00087970: 3c2f 623e 0a3c 756c 3e0a 2020 3c6c 693e .
      .
    • │ │ │ +00087980: 0a20 2020 2020 2041 6e20 6578 616d 706c . An exampl │ │ │ +00087990: 6520 6f66 2068 6f77 2074 6f20 7573 6520 e of how to use │ │ │ +000879a0: 736f 6c76 6550 6e50 5261 6e73 6163 2066 solvePnPRansac f │ │ │ +000879b0: 6f72 206f 626a 6563 7420 6465 7465 6374 or object detect │ │ │ +000879c0: 696f 6e20 6361 6e20 6265 2066 6f75 6e64 ion can be found │ │ │ +000879d0: 2061 740a 2020 2020 2020 2020 5245 463a at. REF: │ │ │ +000879e0: 2074 7574 6f72 6961 6c5f 7265 616c 5f74 tutorial_real_t │ │ │ +000879f0: 696d 655f 706f 7365 0a20 203c 2f6c 693e ime_pose.
    • │ │ │ +00087a00: 0a20 203c 6c69 3e0a 2020 2020 2020 5468 .
    • . Th │ │ │ +00087a10: 6520 6465 6661 756c 7420 6d65 7468 6f64 e default method │ │ │ +00087a20: 2075 7365 6420 746f 2065 7374 696d 6174 used to estimat │ │ │ +00087a30: 6520 7468 6520 6361 6d65 7261 2070 6f73 e the camera pos │ │ │ +00087a40: 6520 666f 7220 7468 6520 4d69 6e69 6d61 e for the Minima │ │ │ +00087a50: 6c20 5361 6d70 6c65 2053 6574 7320 7374 l Sample Sets st │ │ │ +00087a60: 6570 0a20 2020 2020 2020 6973 2023 534f ep. is #SO │ │ │ +00087a70: 4c56 4550 4e50 5f45 504e 502e 2045 7863 LVEPNP_EPNP. Exc │ │ │ +00087a80: 6570 7469 6f6e 7320 6172 653a 0a20 203c eptions are:. < │ │ │ +00087a90: 756c 3e0a 2020 2020 3c6c 693e 0a20 2020 ul>.
    • . │ │ │ +00087aa0: 2020 2020 2020 2069 6620 796f 7520 6368 if you ch │ │ │ +00087ab0: 6f6f 7365 2023 534f 4c56 4550 4e50 5f50 oose #SOLVEPNP_P │ │ │ +00087ac0: 3350 206f 7220 2353 4f4c 5645 504e 505f 3P or #SOLVEPNP_ │ │ │ +00087ad0: 4150 3350 2c20 7468 6573 6520 6d65 7468 AP3P, these meth │ │ │ +00087ae0: 6f64 7320 7769 6c6c 2062 6520 7573 6564 ods will be used │ │ │ +00087af0: 2e0a 2020 2020 3c2f 6c69 3e0a 2020 2020 ..
    • . │ │ │ +00087b00: 3c6c 693e 0a20 2020 2020 2020 2020 2069
    • . i │ │ │ +00087b10: 6620 7468 6520 6e75 6d62 6572 206f 6620 f the number of │ │ │ +00087b20: 696e 7075 7420 706f 696e 7473 2069 7320 input points is │ │ │ +00087b30: 6571 7561 6c20 746f 2034 2c20 2353 4f4c equal to 4, #SOL │ │ │ +00087b40: 5645 504e 505f 5033 5020 6973 2075 7365 VEPNP_P3P is use │ │ │ +00087b50: 642e 0a20 2020 203c 2f6c 693e 0a20 203c d..
    • . < │ │ │ +00087b60: 2f75 6c3e 0a20 203c 6c69 3e0a 2020 2020 /ul>.
    • . │ │ │ +00087b70: 2020 5468 6520 6d65 7468 6f64 2075 7365 The method use │ │ │ +00087b80: 6420 746f 2065 7374 696d 6174 6520 7468 d to estimate th │ │ │ +00087b90: 6520 6361 6d65 7261 2070 6f73 6520 7573 e camera pose us │ │ │ +00087ba0: 696e 6720 616c 6c20 7468 6520 696e 6c69 ing all the inli │ │ │ +00087bb0: 6572 7320 6973 2064 6566 696e 6564 2062 ers is defined b │ │ │ +00087bc0: 7920 7468 650a 2020 2020 2020 2066 6c61 y the. fla │ │ │ +00087bd0: 6773 2070 6172 616d 6574 6572 7320 756e gs parameters un │ │ │ +00087be0: 6c65 7373 2069 7420 6973 2065 7175 616c less it is equal │ │ │ +00087bf0: 2074 6f20 2353 4f4c 5645 504e 505f 5033 to #SOLVEPNP_P3 │ │ │ +00087c00: 5020 6f72 2023 534f 4c56 4550 4e50 5f41 P or #SOLVEPNP_A │ │ │ +00087c10: 5033 502e 2049 6e20 7468 6973 2063 6173 P3P. In this cas │ │ │ +00087c20: 652c 0a20 2020 2020 2020 7468 6520 6d65 e,. the me │ │ │ +00087c30: 7468 6f64 2023 534f 4c56 4550 4e50 5f45 thod #SOLVEPNP_E │ │ │ +00087c40: 504e 5020 7769 6c6c 2062 6520 7573 6564 PNP will be used │ │ │ +00087c50: 2069 6e73 7465 6164 2e0a 2020 3c2f 6c69 instead..
    • .
    .
    Returns:
    .< │ │ │ +00087c80: 6464 3e61 7574 6f6d 6174 6963 616c 6c79 dd>automatically │ │ │ +00087c90: 2067 656e 6572 6174 6564 3c2f 6464 3e0a generated. │ │ │ +00087ca0: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    .
    .
  • ..
    .< │ │ │ +00087d90: 6833 3e73 6f6c 7665 506e 5052 616e 7361 h3>solvePnPRansa │ │ │ +00087da0: 633c 2f68 333e 0a3c 6469 7620 636c 6173 c.
    .
    pub │ │ │ +00087e00: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static boolean& │ │ │ +00087e40: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ +00087e60: 736f 6c76 6550 6e50 5261 6e73 6163 3c2f solvePnPRansac(MatOfPo │ │ │ +00087ee0: 696e 7433 663c 2f61 3e26 6e62 7370 3b6f int3f o │ │ │ +00087ef0: 626a 6563 7450 6f69 6e74 732c 0a20 3c61 bjectPoints,. MatOfPoint2f< │ │ │ +00087f50: 2f61 3e26 6e62 7370 3b69 6d61 6765 506f /a> imagePo │ │ │ +00087f60: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. Mat  │ │ │ +00087fb0: 6361 6d65 7261 4d61 7472 6978 2c0a 203c cameraMatrix,. < │ │ │ +00087fc0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00087fd0: 4d61 744f 6644 6f75 626c 652e 6874 6d6c MatOfDouble.html │ │ │ +00087fe0: 2220 7469 746c 653d 2263 6c61 7373 2069 " title="class i │ │ │ +00087ff0: 6e20 6f72 672e 6f70 656e 6376 2e63 6f72 n org.opencv.cor │ │ │ +00088000: 6522 3e4d 6174 4f66 446f 7562 6c65 3c2f e">MatOfDouble distCoef │ │ │ +00088020: 6673 2c0a 203c 6120 6872 6566 3d22 2e2e fs,. Mat rv │ │ │ +00088070: 6563 2c0a 203c 6120 6872 6566 3d22 2e2e ec,. Mat tv │ │ │ +000880c0: 6563 2c0a 2062 6f6f 6c65 616e 266e 6273 ec,. boolean&nbs │ │ │ +000880d0: 703b 7573 6545 7874 7269 6e73 6963 4775 p;useExtrinsicGu │ │ │ +000880e0: 6573 732c 0a20 696e 7426 6e62 7370 3b69 ess,. int i │ │ │ +000880f0: 7465 7261 7469 6f6e 7343 6f75 6e74 293c terationsCount)< │ │ │ +00088100: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ +00088120: 4669 6e64 7320 616e 206f 626a 6563 7420 Finds an object │ │ │ +00088130: 706f 7365 205c 2820 7b7d 5e7b 637d 5c6d pose \( {}^{c}\m │ │ │ +00088140: 6174 6862 667b 547d 5f6f 205c 2920 6672 athbf{T}_o \) fr │ │ │ +00088150: 6f6d 2033 442d 3244 2070 6f69 6e74 2063 om 3D-2D point c │ │ │ +00088160: 6f72 7265 7370 6f6e 6465 6e63 6573 2075 orrespondences u │ │ │ +00088170: 7369 6e67 2074 6865 2052 414e 5341 4320 sing the RANSAC │ │ │ +00088180: 7363 6865 6d65 2074 6f20 6465 616c 2077 scheme to deal w │ │ │ +00088190: 6974 6820 6261 6420 6d61 7463 6865 732e ith bad matches. │ │ │ +000881a0: 0a0a 215b 5065 7273 7065 6374 6976 6520 ..![Perspective │ │ │ +000881b0: 7072 6f6a 6563 7469 6f6e 2c20 6672 6f6d projection, from │ │ │ +000881c0: 206f 626a 6563 7420 746f 2063 616d 6572 object to camer │ │ │ +000881d0: 6120 6672 616d 655d 2870 6963 732f 7069 a frame](pics/pi │ │ │ +000881e0: 6e68 6f6c 655f 686f 6d6f 6765 6e65 6f75 nhole_homogeneou │ │ │ +000881f0: 735f 7472 616e 7366 6f72 6d61 7469 6f6e s_transformation │ │ │ +00088200: 2e6a 7067 297b 2077 6964 7468 3d35 3025 .jpg){ width=50% │ │ │ +00088210: 207d 0a0a 5345 453a 2052 4546 3a20 6361 }..SEE: REF: ca │ │ │ +00088220: 6c69 6233 645f 736f 6c76 6550 6e50 3c2f lib3d_solvePnP.
    .
    Para │ │ │ +00088250: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    objectPoi │ │ │ +00088270: 6e74 733c 2f63 6f64 653e 202d 2041 7272 nts - Arr │ │ │ +00088280: 6179 206f 6620 6f62 6a65 6374 2070 6f69 ay of object poi │ │ │ +00088290: 6e74 7320 696e 2074 6865 206f 626a 6563 nts in the objec │ │ │ +000882a0: 7420 636f 6f72 6469 6e61 7465 2073 7061 t coordinate spa │ │ │ +000882b0: 6365 2c20 4e78 3320 312d 6368 616e 6e65 ce, Nx3 1-channe │ │ │ +000882c0: 6c20 6f72 0a31 784e 2f4e 7831 2033 2d63 l or.1xN/Nx1 3-c │ │ │ +000882d0: 6861 6e6e 656c 2c20 7768 6572 6520 4e20 hannel, where N │ │ │ +000882e0: 6973 2074 6865 206e 756d 6265 7220 6f66 is the number of │ │ │ +000882f0: 2070 6f69 6e74 732e 2076 6563 746f 7226 points. vector& │ │ │ +00088300: 6c74 3b50 6f69 6e74 3364 2667 743b 2063 lt;Point3d> c │ │ │ +00088310: 616e 2062 6520 616c 736f 2070 6173 7365 an be also passe │ │ │ +00088320: 6420 6865 7265 2e3c 2f64 643e 0a3c 6464 d here.
    .
    imagePoin │ │ │ +00088340: 7473 3c2f 636f 6465 3e20 2d20 4172 7261 ts - Arra │ │ │ +00088350: 7920 6f66 2063 6f72 7265 7370 6f6e 6469 y of correspondi │ │ │ +00088360: 6e67 2069 6d61 6765 2070 6f69 6e74 732c ng image points, │ │ │ +00088370: 204e 7832 2031 2d63 6861 6e6e 656c 206f Nx2 1-channel o │ │ │ +00088380: 7220 3178 4e2f 4e78 3120 322d 6368 616e r 1xN/Nx1 2-chan │ │ │ +00088390: 6e65 6c2c 0a77 6865 7265 204e 2069 7320 nel,.where N is │ │ │ +000883a0: 7468 6520 6e75 6d62 6572 206f 6620 706f the number of po │ │ │ +000883b0: 696e 7473 2e20 7665 6374 6f72 266c 743b ints. vector< │ │ │ +000883c0: 506f 696e 7432 6426 6774 3b20 6361 6e20 Point2d> can │ │ │ +000883d0: 6265 2061 6c73 6f20 7061 7373 6564 2068 be also passed h │ │ │ +000883e0: 6572 652e 3c2f 6464 3e0a 3c64 643e 3c63 ere.
    .
    cameraMatrix │ │ │ +00088400: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ +00088410: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ +00088420: 206d 6174 7269 7820 5c28 5c63 616d 6572 matrix \(\camer │ │ │ +00088430: 616d 6174 7269 787b 417d 5c29 202e 3c2f amatrix{A}\) ..
    di │ │ │ +00088450: 7374 436f 6566 6673 3c2f 636f 6465 3e20 stCoeffs │ │ │ +00088460: 2d20 496e 7075 7420 7665 6374 6f72 206f - Input vector o │ │ │ +00088470: 6620 6469 7374 6f72 7469 6f6e 2063 6f65 f distortion coe │ │ │ +00088480: 6666 6963 6965 6e74 730a 5c28 5c64 6973 fficients.\(\dis │ │ │ +00088490: 7463 6f65 6666 735c 292e 2049 6620 7468 tcoeffs\). If th │ │ │ +000884a0: 6520 7665 6374 6f72 2069 7320 4e55 4c4c e vector is NULL │ │ │ +000884b0: 2f65 6d70 7479 2c20 7468 6520 7a65 726f /empty, the zero │ │ │ +000884c0: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ +000884d0: 6669 6369 656e 7473 2061 7265 0a61 7373 ficients are.ass │ │ │ +000884e0: 756d 6564 2e3c 2f64 643e 0a3c 6464 3e3c umed.
    .
    < │ │ │ +000884f0: 636f 6465 3e72 7665 633c 2f63 6f64 653e code>rvec │ │ │ +00088500: 202d 204f 7574 7075 7420 726f 7461 7469 - Output rotati │ │ │ +00088510: 6f6e 2076 6563 746f 7220 2873 6565 2052 on vector (see R │ │ │ +00088520: 4546 3a20 526f 6472 6967 7565 7320 2920 EF: Rodrigues ) │ │ │ +00088530: 7468 6174 2c20 746f 6765 7468 6572 2077 that, together w │ │ │ +00088540: 6974 6820 7476 6563 2c20 6272 696e 6773 ith tvec, brings │ │ │ +00088550: 2070 6f69 6e74 7320 6672 6f6d 0a74 6865 points from.the │ │ │ +00088560: 206d 6f64 656c 2063 6f6f 7264 696e 6174 model coordinat │ │ │ +00088570: 6520 7379 7374 656d 2074 6f20 7468 6520 e system to the │ │ │ +00088580: 6361 6d65 7261 2063 6f6f 7264 696e 6174 camera coordinat │ │ │ +00088590: 6520 7379 7374 656d 2e3c 2f64 643e 0a3c e system.
    .< │ │ │ +000885a0: 6464 3e3c 636f 6465 3e74 7665 633c 2f63 dd>tvec - Output tr │ │ │ +000885c0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ +000885d0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 ..
    useExtrinsicGue │ │ │ +000885f0: 7373 3c2f 636f 6465 3e20 2d20 5061 7261 ss - Para │ │ │ +00088600: 6d65 7465 7220 7573 6564 2066 6f72 2052 meter used for R │ │ │ +00088610: 4546 3a20 534f 4c56 4550 4e50 5f49 5445 EF: SOLVEPNP_ITE │ │ │ +00088620: 5241 5449 5645 2e20 4966 2074 7275 6520 RATIVE. If true │ │ │ +00088630: 2831 292c 2074 6865 2066 756e 6374 696f (1), the functio │ │ │ +00088640: 6e20 7573 6573 0a74 6865 2070 726f 7669 n uses.the provi │ │ │ +00088650: 6465 6420 7276 6563 2061 6e64 2074 7665 ded rvec and tve │ │ │ +00088660: 6320 7661 6c75 6573 2061 7320 696e 6974 c values as init │ │ │ +00088670: 6961 6c20 6170 7072 6f78 696d 6174 696f ial approximatio │ │ │ +00088680: 6e73 206f 6620 7468 6520 726f 7461 7469 ns of the rotati │ │ │ +00088690: 6f6e 2061 6e64 2074 7261 6e73 6c61 7469 on and translati │ │ │ +000886a0: 6f6e 0a76 6563 746f 7273 2c20 7265 7370 on.vectors, resp │ │ │ +000886b0: 6563 7469 7665 6c79 2c20 616e 6420 6675 ectively, and fu │ │ │ +000886c0: 7274 6865 7220 6f70 7469 6d69 7a65 7320 rther optimizes │ │ │ +000886d0: 7468 656d 2e3c 2f64 643e 0a3c 6464 3e3c them.
    .
    < │ │ │ +000886e0: 636f 6465 3e69 7465 7261 7469 6f6e 7343 code>iterationsC │ │ │ +000886f0: 6f75 6e74 3c2f 636f 6465 3e20 2d20 4e75 ount - Nu │ │ │ +00088700: 6d62 6572 206f 6620 6974 6572 6174 696f mber of iteratio │ │ │ +00088710: 6e73 2e0a 6973 2074 6865 206d 6178 696d ns..is the maxim │ │ │ +00088720: 756d 2061 6c6c 6f77 6564 2064 6973 7461 um allowed dista │ │ │ +00088730: 6e63 6520 6265 7477 6565 6e20 7468 6520 nce between the │ │ │ +00088740: 6f62 7365 7276 6564 2061 6e64 2063 6f6d observed and com │ │ │ +00088750: 7075 7465 6420 706f 696e 7420 7072 6f6a puted point proj │ │ │ +00088760: 6563 7469 6f6e 7320 746f 2063 6f6e 7369 ections to consi │ │ │ +00088770: 6465 7220 6974 0a61 6e20 696e 6c69 6572 der it.an inlier │ │ │ +00088780: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ +00088790: 6573 7469 6d61 7465 7320 616e 206f 626a estimates an obj │ │ │ +000887a0: 6563 7420 706f 7365 2067 6976 656e 2061 ect pose given a │ │ │ +000887b0: 2073 6574 206f 6620 6f62 6a65 6374 2070 set of object p │ │ │ +000887c0: 6f69 6e74 732c 2074 6865 6972 2063 6f72 oints, their cor │ │ │ +000887d0: 7265 7370 6f6e 6469 6e67 2069 6d61 6765 responding image │ │ │ +000887e0: 0a70 726f 6a65 6374 696f 6e73 2c20 6173 .projections, as │ │ │ +000887f0: 2077 656c 6c20 6173 2074 6865 2063 616d well as the cam │ │ │ +00088800: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +00088810: 7472 6978 2061 6e64 2074 6865 2064 6973 trix and the dis │ │ │ +00088820: 746f 7274 696f 6e20 636f 6566 6669 6369 tortion coeffici │ │ │ +00088830: 656e 7473 2e20 5468 6973 2066 756e 6374 ents. This funct │ │ │ +00088840: 696f 6e20 6669 6e64 7320 7375 6368 0a61 ion finds such.a │ │ │ +00088850: 2070 6f73 6520 7468 6174 206d 696e 696d pose that minim │ │ │ +00088860: 697a 6573 2072 6570 726f 6a65 6374 696f izes reprojectio │ │ │ +00088870: 6e20 6572 726f 722c 2074 6861 7420 6973 n error, that is │ │ │ +00088880: 2c20 7468 6520 7375 6d20 6f66 2073 7175 , the sum of squ │ │ │ +00088890: 6172 6564 2064 6973 7461 6e63 6573 2062 ared distances b │ │ │ +000888a0: 6574 7765 656e 2074 6865 206f 6273 6572 etween the obser │ │ │ +000888b0: 7665 640a 7072 6f6a 6563 7469 6f6e 7320 ved.projections │ │ │ +000888c0: 696d 6167 6550 6f69 6e74 7320 616e 6420 imagePoints and │ │ │ +000888d0: 7468 6520 7072 6f6a 6563 7465 6420 2875 the projected (u │ │ │ +000888e0: 7369 6e67 2052 4546 3a20 7072 6f6a 6563 sing REF: projec │ │ │ +000888f0: 7450 6f69 6e74 7320 2920 6f62 6a65 6374 tPoints ) object │ │ │ +00088900: 506f 696e 7473 2e20 5468 6520 7573 6520 Points. The use │ │ │ +00088910: 6f66 2052 414e 5341 430a 6d61 6b65 7320 of RANSAC.makes │ │ │ +00088920: 7468 6520 6675 6e63 7469 6f6e 2072 6573 the function res │ │ │ +00088930: 6973 7461 6e74 2074 6f20 6f75 746c 6965 istant to outlie │ │ │ +00088940: 7273 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 rs...Note:.
      .
    • . │ │ │ +00088960: 2020 2020 416e 2065 7861 6d70 6c65 206f An example o │ │ │ +00088970: 6620 686f 7720 746f 2075 7365 2073 6f6c f how to use sol │ │ │ +00088980: 7665 506e 5052 616e 7361 6320 666f 7220 vePnPRansac for │ │ │ +00088990: 6f62 6a65 6374 2064 6574 6563 7469 6f6e object detection │ │ │ +000889a0: 2063 616e 2062 6520 666f 756e 6420 6174 can be found at │ │ │ +000889b0: 0a20 2020 2020 2020 2052 4546 3a20 7475 . REF: tu │ │ │ +000889c0: 746f 7269 616c 5f72 6561 6c5f 7469 6d65 torial_real_time │ │ │ +000889d0: 5f70 6f73 650a 2020 3c2f 6c69 3e0a 2020 _pose.
    • . │ │ │ +000889e0: 3c6c 693e 0a20 2020 2020 2054 6865 2064
    • . The d │ │ │ +000889f0: 6566 6175 6c74 206d 6574 686f 6420 7573 efault method us │ │ │ +00088a00: 6564 2074 6f20 6573 7469 6d61 7465 2074 ed to estimate t │ │ │ +00088a10: 6865 2063 616d 6572 6120 706f 7365 2066 he camera pose f │ │ │ +00088a20: 6f72 2074 6865 204d 696e 696d 616c 2053 or the Minimal S │ │ │ +00088a30: 616d 706c 6520 5365 7473 2073 7465 700a ample Sets step. │ │ │ +00088a40: 2020 2020 2020 2069 7320 2353 4f4c 5645 is #SOLVE │ │ │ +00088a50: 504e 505f 4550 4e50 2e20 4578 6365 7074 PNP_EPNP. Except │ │ │ +00088a60: 696f 6e73 2061 7265 3a0a 2020 3c75 6c3e ions are:.
        │ │ │ +00088a70: 0a20 2020 203c 6c69 3e0a 2020 2020 2020 .
      • . │ │ │ +00088a80: 2020 2020 6966 2079 6f75 2063 686f 6f73 if you choos │ │ │ +00088a90: 6520 2353 4f4c 5645 504e 505f 5033 5020 e #SOLVEPNP_P3P │ │ │ +00088aa0: 6f72 2023 534f 4c56 4550 4e50 5f41 5033 or #SOLVEPNP_AP3 │ │ │ +00088ab0: 502c 2074 6865 7365 206d 6574 686f 6473 P, these methods │ │ │ +00088ac0: 2077 696c 6c20 6265 2075 7365 642e 0a20 will be used.. │ │ │ +00088ad0: 2020 203c 2f6c 693e 0a20 2020 203c 6c69
      • .
      • . if t │ │ │ +00088af0: 6865 206e 756d 6265 7220 6f66 2069 6e70 he number of inp │ │ │ +00088b00: 7574 2070 6f69 6e74 7320 6973 2065 7175 ut points is equ │ │ │ +00088b10: 616c 2074 6f20 342c 2023 534f 4c56 4550 al to 4, #SOLVEP │ │ │ +00088b20: 4e50 5f50 3350 2069 7320 7573 6564 2e0a NP_P3P is used.. │ │ │ +00088b30: 2020 2020 3c2f 6c69 3e0a 2020 3c2f 756c
      • .
      .
    • . T │ │ │ +00088b50: 6865 206d 6574 686f 6420 7573 6564 2074 he method used t │ │ │ +00088b60: 6f20 6573 7469 6d61 7465 2074 6865 2063 o estimate the c │ │ │ +00088b70: 616d 6572 6120 706f 7365 2075 7369 6e67 amera pose using │ │ │ +00088b80: 2061 6c6c 2074 6865 2069 6e6c 6965 7273 all the inliers │ │ │ +00088b90: 2069 7320 6465 6669 6e65 6420 6279 2074 is defined by t │ │ │ +00088ba0: 6865 0a20 2020 2020 2020 666c 6167 7320 he. flags │ │ │ +00088bb0: 7061 7261 6d65 7465 7273 2075 6e6c 6573 parameters unles │ │ │ +00088bc0: 7320 6974 2069 7320 6571 7561 6c20 746f s it is equal to │ │ │ +00088bd0: 2023 534f 4c56 4550 4e50 5f50 3350 206f #SOLVEPNP_P3P o │ │ │ +00088be0: 7220 2353 4f4c 5645 504e 505f 4150 3350 r #SOLVEPNP_AP3P │ │ │ +00088bf0: 2e20 496e 2074 6869 7320 6361 7365 2c0a . In this case,. │ │ │ +00088c00: 2020 2020 2020 2074 6865 206d 6574 686f the metho │ │ │ +00088c10: 6420 2353 4f4c 5645 504e 505f 4550 4e50 d #SOLVEPNP_EPNP │ │ │ +00088c20: 2077 696c 6c20 6265 2075 7365 6420 696e will be used in │ │ │ +00088c30: 7374 6561 642e 0a20 203c 2f6c 693e 0a3c stead..
    • .< │ │ │ +00088c40: 2f75 6c3e 3c2f 6464 3e0a 3c64 743e 5265 /ul>
    .
    Re │ │ │ +00088c50: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ +00088c60: 6175 746f 6d61 7469 6361 6c6c 7920 6765 automatically ge │ │ │ +00088c70: 6e65 7261 7465 643c 2f64 643e 0a3c 2f64 nerated
    ..
    ...
  • . │ │ │ +00088ca0: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    solv │ │ │ +00088d70: 6550 6e50 5261 6e73 6163 3c2f 6833 3e0a ePnPRansac

    . │ │ │ +00088d80: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ +00088da0: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ +00088de0: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ +00088df0: 3c73 7061 6e20 636c 6173 733d 2272 6574 boolea │ │ │ +00088e10: 6e3c 2f73 7061 6e3e 266e 6273 703b 3c73 n solvePn │ │ │ +00088e40: 5052 616e 7361 633c 2f73 7061 6e3e 3c77 PRansac(MatOfPoint3f objectPo │ │ │ +00088ed0: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. MatO │ │ │ +00088f20: 6650 6f69 6e74 3266 3c2f 613e 266e 6273 fPoint2f&nbs │ │ │ +00088f30: 703b 696d 6167 6550 6f69 6e74 732c 0a20 p;imagePoints,. │ │ │ +00088f40: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +00088f80: 2f61 3e26 6e62 7370 3b63 616d 6572 614d /a> cameraM │ │ │ +00088f90: 6174 7269 782c 0a20 3c61 2068 7265 663d atrix,. MatO │ │ │ +00088fe0: 6644 6f75 626c 653c 2f61 3e26 6e62 7370 fDouble  │ │ │ +00088ff0: 3b64 6973 7443 6f65 6666 732c 0a20 3c61 ;distCoeffs,. Mat rvec,. Mat tvec,. bo │ │ │ +000890a0: 6f6c 6561 6e26 6e62 7370 3b75 7365 4578 olean useEx │ │ │ +000890b0: 7472 696e 7369 6347 7565 7373 293c 2f73 trinsicGuess)
    .
    Fi │ │ │ +000890e0: 6e64 7320 616e 206f 626a 6563 7420 706f nds an object po │ │ │ +000890f0: 7365 205c 2820 7b7d 5e7b 637d 5c6d 6174 se \( {}^{c}\mat │ │ │ +00089100: 6862 667b 547d 5f6f 205c 2920 6672 6f6d hbf{T}_o \) from │ │ │ +00089110: 2033 442d 3244 2070 6f69 6e74 2063 6f72 3D-2D point cor │ │ │ +00089120: 7265 7370 6f6e 6465 6e63 6573 2075 7369 respondences usi │ │ │ +00089130: 6e67 2074 6865 2052 414e 5341 4320 7363 ng the RANSAC sc │ │ │ +00089140: 6865 6d65 2074 6f20 6465 616c 2077 6974 heme to deal wit │ │ │ +00089150: 6820 6261 6420 6d61 7463 6865 732e 0a0a h bad matches... │ │ │ +00089160: 215b 5065 7273 7065 6374 6976 6520 7072 ![Perspective pr │ │ │ +00089170: 6f6a 6563 7469 6f6e 2c20 6672 6f6d 206f ojection, from o │ │ │ +00089180: 626a 6563 7420 746f 2063 616d 6572 6120 bject to camera │ │ │ +00089190: 6672 616d 655d 2870 6963 732f 7069 6e68 frame](pics/pinh │ │ │ +000891a0: 6f6c 655f 686f 6d6f 6765 6e65 6f75 735f ole_homogeneous_ │ │ │ +000891b0: 7472 616e 7366 6f72 6d61 7469 6f6e 2e6a transformation.j │ │ │ +000891c0: 7067 297b 2077 6964 7468 3d35 3025 207d pg){ width=50% } │ │ │ +000891d0: 0a0a 5345 453a 2052 4546 3a20 6361 6c69 ..SEE: REF: cali │ │ │ +000891e0: 6233 645f 736f 6c76 6550 6e50 3c2f 6469 b3d_solvePnP.
    .
    Parame │ │ │ +00089210: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ +00089220: 636f 6465 3e6f 626a 6563 7450 6f69 6e74 code>objectPoint │ │ │ +00089230: 733c 2f63 6f64 653e 202d 2041 7272 6179 s - Array │ │ │ +00089240: 206f 6620 6f62 6a65 6374 2070 6f69 6e74 of object point │ │ │ +00089250: 7320 696e 2074 6865 206f 626a 6563 7420 s in the object │ │ │ +00089260: 636f 6f72 6469 6e61 7465 2073 7061 6365 coordinate space │ │ │ +00089270: 2c20 4e78 3320 312d 6368 616e 6e65 6c20 , Nx3 1-channel │ │ │ +00089280: 6f72 0a31 784e 2f4e 7831 2033 2d63 6861 or.1xN/Nx1 3-cha │ │ │ +00089290: 6e6e 656c 2c20 7768 6572 6520 4e20 6973 nnel, where N is │ │ │ +000892a0: 2074 6865 206e 756d 6265 7220 6f66 2070 the number of p │ │ │ +000892b0: 6f69 6e74 732e 2076 6563 746f 7226 6c74 oints. vector< │ │ │ +000892c0: 3b50 6f69 6e74 3364 2667 743b 2063 616e ;Point3d> can │ │ │ +000892d0: 2062 6520 616c 736f 2070 6173 7365 6420 be also passed │ │ │ +000892e0: 6865 7265 2e3c 2f64 643e 0a3c 6464 3e3c here.
    .
    < │ │ │ +000892f0: 636f 6465 3e69 6d61 6765 506f 696e 7473 code>imagePoints │ │ │ +00089300: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ +00089310: 6f66 2063 6f72 7265 7370 6f6e 6469 6e67 of corresponding │ │ │ +00089320: 2069 6d61 6765 2070 6f69 6e74 732c 204e image points, N │ │ │ +00089330: 7832 2031 2d63 6861 6e6e 656c 206f 7220 x2 1-channel or │ │ │ +00089340: 3178 4e2f 4e78 3120 322d 6368 616e 6e65 1xN/Nx1 2-channe │ │ │ +00089350: 6c2c 0a77 6865 7265 204e 2069 7320 7468 l,.where N is th │ │ │ +00089360: 6520 6e75 6d62 6572 206f 6620 706f 696e e number of poin │ │ │ +00089370: 7473 2e20 7665 6374 6f72 266c 743b 506f ts. vector<Po │ │ │ +00089380: 696e 7432 6426 6774 3b20 6361 6e20 6265 int2d> can be │ │ │ +00089390: 2061 6c73 6f20 7061 7373 6564 2068 6572 also passed her │ │ │ +000893a0: 652e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 e.
    .
    cameraMatrix - Input ca │ │ │ +000893d0: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ +000893e0: 6174 7269 7820 5c28 5c63 616d 6572 616d atrix \(\cameram │ │ │ +000893f0: 6174 7269 787b 417d 5c29 202e 3c2f 6464 atrix{A}\) .
    .
    dist │ │ │ +00089410: 436f 6566 6673 3c2f 636f 6465 3e20 2d20 Coeffs - │ │ │ +00089420: 496e 7075 7420 7665 6374 6f72 206f 6620 Input vector of │ │ │ +00089430: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ +00089440: 6963 6965 6e74 730a 5c28 5c64 6973 7463 icients.\(\distc │ │ │ +00089450: 6f65 6666 735c 292e 2049 6620 7468 6520 oeffs\). If the │ │ │ +00089460: 7665 6374 6f72 2069 7320 4e55 4c4c 2f65 vector is NULL/e │ │ │ +00089470: 6d70 7479 2c20 7468 6520 7a65 726f 2064 mpty, the zero d │ │ │ +00089480: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ +00089490: 6369 656e 7473 2061 7265 0a61 7373 756d cients are.assum │ │ │ +000894a0: 6564 2e3c 2f64 643e 0a3c 6464 3e3c 636f ed.
    .
    rvec - │ │ │ +000894c0: 204f 7574 7075 7420 726f 7461 7469 6f6e Output rotation │ │ │ +000894d0: 2076 6563 746f 7220 2873 6565 2052 4546 vector (see REF │ │ │ +000894e0: 3a20 526f 6472 6967 7565 7320 2920 7468 : Rodrigues ) th │ │ │ +000894f0: 6174 2c20 746f 6765 7468 6572 2077 6974 at, together wit │ │ │ +00089500: 6820 7476 6563 2c20 6272 696e 6773 2070 h tvec, brings p │ │ │ +00089510: 6f69 6e74 7320 6672 6f6d 0a74 6865 206d oints from.the m │ │ │ +00089520: 6f64 656c 2063 6f6f 7264 696e 6174 6520 odel coordinate │ │ │ +00089530: 7379 7374 656d 2074 6f20 7468 6520 6361 system to the ca │ │ │ +00089540: 6d65 7261 2063 6f6f 7264 696e 6174 6520 mera coordinate │ │ │ +00089550: 7379 7374 656d 2e3c 2f64 643e 0a3c 6464 system.
    .
    tvec - Output tran │ │ │ +00089580: 736c 6174 696f 6e20 7665 6374 6f72 2e3c slation vector.< │ │ │ +00089590: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e75 /dd>.
    u │ │ │ +000895a0: 7365 4578 7472 696e 7369 6347 7565 7373 seExtrinsicGuess │ │ │ +000895b0: 3c2f 636f 6465 3e20 2d20 5061 7261 6d65 - Parame │ │ │ +000895c0: 7465 7220 7573 6564 2066 6f72 2052 4546 ter used for REF │ │ │ +000895d0: 3a20 534f 4c56 4550 4e50 5f49 5445 5241 : SOLVEPNP_ITERA │ │ │ +000895e0: 5449 5645 2e20 4966 2074 7275 6520 2831 TIVE. If true (1 │ │ │ +000895f0: 292c 2074 6865 2066 756e 6374 696f 6e20 ), the function │ │ │ +00089600: 7573 6573 0a74 6865 2070 726f 7669 6465 uses.the provide │ │ │ +00089610: 6420 7276 6563 2061 6e64 2074 7665 6320 d rvec and tvec │ │ │ +00089620: 7661 6c75 6573 2061 7320 696e 6974 6961 values as initia │ │ │ +00089630: 6c20 6170 7072 6f78 696d 6174 696f 6e73 l approximations │ │ │ +00089640: 206f 6620 7468 6520 726f 7461 7469 6f6e of the rotation │ │ │ +00089650: 2061 6e64 2074 7261 6e73 6c61 7469 6f6e and translation │ │ │ +00089660: 0a76 6563 746f 7273 2c20 7265 7370 6563 .vectors, respec │ │ │ +00089670: 7469 7665 6c79 2c20 616e 6420 6675 7274 tively, and furt │ │ │ +00089680: 6865 7220 6f70 7469 6d69 7a65 7320 7468 her optimizes th │ │ │ +00089690: 656d 2e0a 6973 2074 6865 206d 6178 696d em..is the maxim │ │ │ +000896a0: 756d 2061 6c6c 6f77 6564 2064 6973 7461 um allowed dista │ │ │ +000896b0: 6e63 6520 6265 7477 6565 6e20 7468 6520 nce between the │ │ │ +000896c0: 6f62 7365 7276 6564 2061 6e64 2063 6f6d observed and com │ │ │ +000896d0: 7075 7465 6420 706f 696e 7420 7072 6f6a puted point proj │ │ │ +000896e0: 6563 7469 6f6e 7320 746f 2063 6f6e 7369 ections to consi │ │ │ +000896f0: 6465 7220 6974 0a61 6e20 696e 6c69 6572 der it.an inlier │ │ │ +00089700: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ +00089710: 6573 7469 6d61 7465 7320 616e 206f 626a estimates an obj │ │ │ +00089720: 6563 7420 706f 7365 2067 6976 656e 2061 ect pose given a │ │ │ +00089730: 2073 6574 206f 6620 6f62 6a65 6374 2070 set of object p │ │ │ +00089740: 6f69 6e74 732c 2074 6865 6972 2063 6f72 oints, their cor │ │ │ +00089750: 7265 7370 6f6e 6469 6e67 2069 6d61 6765 responding image │ │ │ +00089760: 0a70 726f 6a65 6374 696f 6e73 2c20 6173 .projections, as │ │ │ +00089770: 2077 656c 6c20 6173 2074 6865 2063 616d well as the cam │ │ │ +00089780: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +00089790: 7472 6978 2061 6e64 2074 6865 2064 6973 trix and the dis │ │ │ +000897a0: 746f 7274 696f 6e20 636f 6566 6669 6369 tortion coeffici │ │ │ +000897b0: 656e 7473 2e20 5468 6973 2066 756e 6374 ents. This funct │ │ │ +000897c0: 696f 6e20 6669 6e64 7320 7375 6368 0a61 ion finds such.a │ │ │ +000897d0: 2070 6f73 6520 7468 6174 206d 696e 696d pose that minim │ │ │ +000897e0: 697a 6573 2072 6570 726f 6a65 6374 696f izes reprojectio │ │ │ +000897f0: 6e20 6572 726f 722c 2074 6861 7420 6973 n error, that is │ │ │ +00089800: 2c20 7468 6520 7375 6d20 6f66 2073 7175 , the sum of squ │ │ │ +00089810: 6172 6564 2064 6973 7461 6e63 6573 2062 ared distances b │ │ │ +00089820: 6574 7765 656e 2074 6865 206f 6273 6572 etween the obser │ │ │ +00089830: 7665 640a 7072 6f6a 6563 7469 6f6e 7320 ved.projections │ │ │ +00089840: 696d 6167 6550 6f69 6e74 7320 616e 6420 imagePoints and │ │ │ +00089850: 7468 6520 7072 6f6a 6563 7465 6420 2875 the projected (u │ │ │ +00089860: 7369 6e67 2052 4546 3a20 7072 6f6a 6563 sing REF: projec │ │ │ +00089870: 7450 6f69 6e74 7320 2920 6f62 6a65 6374 tPoints ) object │ │ │ +00089880: 506f 696e 7473 2e20 5468 6520 7573 6520 Points. The use │ │ │ +00089890: 6f66 2052 414e 5341 430a 6d61 6b65 7320 of RANSAC.makes │ │ │ +000898a0: 7468 6520 6675 6e63 7469 6f6e 2072 6573 the function res │ │ │ +000898b0: 6973 7461 6e74 2074 6f20 6f75 746c 6965 istant to outlie │ │ │ +000898c0: 7273 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 rs...Note:.
      .
    • . │ │ │ +000898e0: 2020 2020 416e 2065 7861 6d70 6c65 206f An example o │ │ │ +000898f0: 6620 686f 7720 746f 2075 7365 2073 6f6c f how to use sol │ │ │ +00089900: 7665 506e 5052 616e 7361 6320 666f 7220 vePnPRansac for │ │ │ +00089910: 6f62 6a65 6374 2064 6574 6563 7469 6f6e object detection │ │ │ +00089920: 2063 616e 2062 6520 666f 756e 6420 6174 can be found at │ │ │ +00089930: 0a20 2020 2020 2020 2052 4546 3a20 7475 . REF: tu │ │ │ +00089940: 746f 7269 616c 5f72 6561 6c5f 7469 6d65 torial_real_time │ │ │ +00089950: 5f70 6f73 650a 2020 3c2f 6c69 3e0a 2020 _pose.
    • . │ │ │ +00089960: 3c6c 693e 0a20 2020 2020 2054 6865 2064
    • . The d │ │ │ +00089970: 6566 6175 6c74 206d 6574 686f 6420 7573 efault method us │ │ │ +00089980: 6564 2074 6f20 6573 7469 6d61 7465 2074 ed to estimate t │ │ │ +00089990: 6865 2063 616d 6572 6120 706f 7365 2066 he camera pose f │ │ │ +000899a0: 6f72 2074 6865 204d 696e 696d 616c 2053 or the Minimal S │ │ │ +000899b0: 616d 706c 6520 5365 7473 2073 7465 700a ample Sets step. │ │ │ +000899c0: 2020 2020 2020 2069 7320 2353 4f4c 5645 is #SOLVE │ │ │ +000899d0: 504e 505f 4550 4e50 2e20 4578 6365 7074 PNP_EPNP. Except │ │ │ +000899e0: 696f 6e73 2061 7265 3a0a 2020 3c75 6c3e ions are:.
        │ │ │ +000899f0: 0a20 2020 203c 6c69 3e0a 2020 2020 2020 .
      • . │ │ │ +00089a00: 2020 2020 6966 2079 6f75 2063 686f 6f73 if you choos │ │ │ +00089a10: 6520 2353 4f4c 5645 504e 505f 5033 5020 e #SOLVEPNP_P3P │ │ │ +00089a20: 6f72 2023 534f 4c56 4550 4e50 5f41 5033 or #SOLVEPNP_AP3 │ │ │ +00089a30: 502c 2074 6865 7365 206d 6574 686f 6473 P, these methods │ │ │ +00089a40: 2077 696c 6c20 6265 2075 7365 642e 0a20 will be used.. │ │ │ +00089a50: 2020 203c 2f6c 693e 0a20 2020 203c 6c69
      • .
      • . if t │ │ │ +00089a70: 6865 206e 756d 6265 7220 6f66 2069 6e70 he number of inp │ │ │ +00089a80: 7574 2070 6f69 6e74 7320 6973 2065 7175 ut points is equ │ │ │ +00089a90: 616c 2074 6f20 342c 2023 534f 4c56 4550 al to 4, #SOLVEP │ │ │ +00089aa0: 4e50 5f50 3350 2069 7320 7573 6564 2e0a NP_P3P is used.. │ │ │ +00089ab0: 2020 2020 3c2f 6c69 3e0a 2020 3c2f 756c
      • .
      .
    • . T │ │ │ +00089ad0: 6865 206d 6574 686f 6420 7573 6564 2074 he method used t │ │ │ +00089ae0: 6f20 6573 7469 6d61 7465 2074 6865 2063 o estimate the c │ │ │ +00089af0: 616d 6572 6120 706f 7365 2075 7369 6e67 amera pose using │ │ │ +00089b00: 2061 6c6c 2074 6865 2069 6e6c 6965 7273 all the inliers │ │ │ +00089b10: 2069 7320 6465 6669 6e65 6420 6279 2074 is defined by t │ │ │ +00089b20: 6865 0a20 2020 2020 2020 666c 6167 7320 he. flags │ │ │ +00089b30: 7061 7261 6d65 7465 7273 2075 6e6c 6573 parameters unles │ │ │ +00089b40: 7320 6974 2069 7320 6571 7561 6c20 746f s it is equal to │ │ │ +00089b50: 2023 534f 4c56 4550 4e50 5f50 3350 206f #SOLVEPNP_P3P o │ │ │ +00089b60: 7220 2353 4f4c 5645 504e 505f 4150 3350 r #SOLVEPNP_AP3P │ │ │ +00089b70: 2e20 496e 2074 6869 7320 6361 7365 2c0a . In this case,. │ │ │ +00089b80: 2020 2020 2020 2074 6865 206d 6574 686f the metho │ │ │ +00089b90: 6420 2353 4f4c 5645 504e 505f 4550 4e50 d #SOLVEPNP_EPNP │ │ │ +00089ba0: 2077 696c 6c20 6265 2075 7365 6420 696e will be used in │ │ │ +00089bb0: 7374 6561 642e 0a20 203c 2f6c 693e 0a3c stead..
    • .< │ │ │ +00089bc0: 2f75 6c3e 3c2f 6464 3e0a 3c64 743e 5265 /ul>
    .
    Re │ │ │ +00089bd0: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ +00089be0: 6175 746f 6d61 7469 6361 6c6c 7920 6765 automatically ge │ │ │ +00089bf0: 6e65 7261 7465 643c 2f64 643e 0a3c 2f64 nerated
    ..
    ..
  • .
  • . │ │ │ +00089c20: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    . │ │ │ +00089ce0: 3c68 333e 736f 6c76 6550 6e50 5261 6e73

    solvePnPRans │ │ │ +00089cf0: 6163 3c2f 6833 3e0a 3c64 6976 2063 6c61 ac

    .
    .
    pu │ │ │ +00089d50: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static boolean │ │ │ +00089d90: 266e 6273 703b 3c73 7061 6e20 636c 6173  solvePnPRansac< │ │ │ +00089dc0: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(MatOfP │ │ │ +00089e30: 6f69 6e74 3366 3c2f 613e 266e 6273 703b oint3f  │ │ │ +00089e40: 6f62 6a65 6374 506f 696e 7473 2c0a 203c objectPoints,. < │ │ │ +00089e50: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00089e60: 4d61 744f 6650 6f69 6e74 3266 2e68 746d MatOfPoint2f.htm │ │ │ +00089e70: 6c22 2074 6974 6c65 3d22 636c 6173 7320 l" title="class │ │ │ +00089e80: 696e 206f 7267 2e6f 7065 6e63 762e 636f in org.opencv.co │ │ │ +00089e90: 7265 223e 4d61 744f 6650 6f69 6e74 3266 re">MatOfPoint2f │ │ │ +00089ea0: 3c2f 613e 266e 6273 703b 696d 6167 6550  imageP │ │ │ +00089eb0: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ +00089f00: 3b63 616d 6572 614d 6174 7269 782c 0a20 ;cameraMatrix,. │ │ │ +00089f10: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfDouble< │ │ │ +00089f60: 2f61 3e26 6e62 7370 3b64 6973 7443 6f65 /a> distCoe │ │ │ +00089f70: 6666 732c 0a20 3c61 2068 7265 663d 222e ffs,. Mat r │ │ │ +00089fc0: 7665 632c 0a20 3c61 2068 7265 663d 222e vec,. Mat t │ │ │ +0008a010: 7665 6329 3c2f 7370 616e 3e3c 2f64 6976 vec)
    .
    Finds an ob │ │ │ +0008a040: 6a65 6374 2070 6f73 6520 5c28 207b 7d5e ject pose \( {}^ │ │ │ +0008a050: 7b63 7d5c 6d61 7468 6266 7b54 7d5f 6f20 {c}\mathbf{T}_o │ │ │ +0008a060: 5c29 2066 726f 6d20 3344 2d32 4420 706f \) from 3D-2D po │ │ │ +0008a070: 696e 7420 636f 7272 6573 706f 6e64 656e int corresponden │ │ │ +0008a080: 6365 7320 7573 696e 6720 7468 6520 5241 ces using the RA │ │ │ +0008a090: 4e53 4143 2073 6368 656d 6520 746f 2064 NSAC scheme to d │ │ │ +0008a0a0: 6561 6c20 7769 7468 2062 6164 206d 6174 eal with bad mat │ │ │ +0008a0b0: 6368 6573 2e0a 0a21 5b50 6572 7370 6563 ches...![Perspec │ │ │ +0008a0c0: 7469 7665 2070 726f 6a65 6374 696f 6e2c tive projection, │ │ │ +0008a0d0: 2066 726f 6d20 6f62 6a65 6374 2074 6f20 from object to │ │ │ +0008a0e0: 6361 6d65 7261 2066 7261 6d65 5d28 7069 camera frame](pi │ │ │ +0008a0f0: 6373 2f70 696e 686f 6c65 5f68 6f6d 6f67 cs/pinhole_homog │ │ │ +0008a100: 656e 656f 7573 5f74 7261 6e73 666f 726d eneous_transform │ │ │ +0008a110: 6174 696f 6e2e 6a70 6729 7b20 7769 6474 ation.jpg){ widt │ │ │ +0008a120: 683d 3530 2520 7d0a 0a53 4545 3a20 5245 h=50% }..SEE: RE │ │ │ +0008a130: 463a 2063 616c 6962 3364 5f73 6f6c 7665 F: calib3d_solve │ │ │ +0008a140: 506e 503c 2f64 6976 3e0a 3c64 6c20 636c PnP
    .
    .
    Parameters:
    .
    obje │ │ │ +0008a180: 6374 506f 696e 7473 3c2f 636f 6465 3e20 ctPoints │ │ │ +0008a190: 2d20 4172 7261 7920 6f66 206f 626a 6563 - Array of objec │ │ │ +0008a1a0: 7420 706f 696e 7473 2069 6e20 7468 6520 t points in the │ │ │ +0008a1b0: 6f62 6a65 6374 2063 6f6f 7264 696e 6174 object coordinat │ │ │ +0008a1c0: 6520 7370 6163 652c 204e 7833 2031 2d63 e space, Nx3 1-c │ │ │ +0008a1d0: 6861 6e6e 656c 206f 720a 3178 4e2f 4e78 hannel or.1xN/Nx │ │ │ +0008a1e0: 3120 332d 6368 616e 6e65 6c2c 2077 6865 1 3-channel, whe │ │ │ +0008a1f0: 7265 204e 2069 7320 7468 6520 6e75 6d62 re N is the numb │ │ │ +0008a200: 6572 206f 6620 706f 696e 7473 2e20 7665 er of points. ve │ │ │ +0008a210: 6374 6f72 266c 743b 506f 696e 7433 6426 ctor<Point3d& │ │ │ +0008a220: 6774 3b20 6361 6e20 6265 2061 6c73 6f20 gt; can be also │ │ │ +0008a230: 7061 7373 6564 2068 6572 652e 3c2f 6464 passed here.
    .
    imag │ │ │ +0008a250: 6550 6f69 6e74 733c 2f63 6f64 653e 202d ePoints - │ │ │ +0008a260: 2041 7272 6179 206f 6620 636f 7272 6573 Array of corres │ │ │ +0008a270: 706f 6e64 696e 6720 696d 6167 6520 706f ponding image po │ │ │ +0008a280: 696e 7473 2c20 4e78 3220 312d 6368 616e ints, Nx2 1-chan │ │ │ +0008a290: 6e65 6c20 6f72 2031 784e 2f4e 7831 2032 nel or 1xN/Nx1 2 │ │ │ +0008a2a0: 2d63 6861 6e6e 656c 2c0a 7768 6572 6520 -channel,.where │ │ │ +0008a2b0: 4e20 6973 2074 6865 206e 756d 6265 7220 N is the number │ │ │ +0008a2c0: 6f66 2070 6f69 6e74 732e 2076 6563 746f of points. vecto │ │ │ +0008a2d0: 7226 6c74 3b50 6f69 6e74 3264 2667 743b r<Point2d> │ │ │ +0008a2e0: 2063 616e 2062 6520 616c 736f 2070 6173 can be also pas │ │ │ +0008a2f0: 7365 6420 6865 7265 2e3c 2f64 643e 0a3c sed here.
    .< │ │ │ +0008a300: 6464 3e3c 636f 6465 3e63 616d 6572 614d dd>cameraM │ │ │ +0008a310: 6174 7269 783c 2f63 6f64 653e 202d 2049 atrix - I │ │ │ +0008a320: 6e70 7574 2063 616d 6572 6120 696e 7472 nput camera intr │ │ │ +0008a330: 696e 7369 6320 6d61 7472 6978 205c 285c insic matrix \(\ │ │ │ +0008a340: 6361 6d65 7261 6d61 7472 6978 7b41 7d5c cameramatrix{A}\ │ │ │ +0008a350: 2920 2e3c 2f64 643e 0a3c 6464 3e3c 636f ) ..
    distCoeffs - Input vec │ │ │ +0008a380: 746f 7220 6f66 2064 6973 746f 7274 696f tor of distortio │ │ │ +0008a390: 6e20 636f 6566 6669 6369 656e 7473 0a5c n coefficients.\ │ │ │ +0008a3a0: 285c 6469 7374 636f 6566 6673 5c29 2e20 (\distcoeffs\). │ │ │ +0008a3b0: 4966 2074 6865 2076 6563 746f 7220 6973 If the vector is │ │ │ +0008a3c0: 204e 554c 4c2f 656d 7074 792c 2074 6865 NULL/empty, the │ │ │ +0008a3d0: 207a 6572 6f20 6469 7374 6f72 7469 6f6e zero distortion │ │ │ +0008a3e0: 2063 6f65 6666 6963 6965 6e74 7320 6172 coefficients ar │ │ │ +0008a3f0: 650a 6173 7375 6d65 642e 3c2f 6464 3e0a e.assumed.
    . │ │ │ +0008a400: 3c64 643e 3c63 6f64 653e 7276 6563 3c2f
    rvec - Output r │ │ │ +0008a420: 6f74 6174 696f 6e20 7665 6374 6f72 2028 otation vector ( │ │ │ +0008a430: 7365 6520 5245 463a 2052 6f64 7269 6775 see REF: Rodrigu │ │ │ +0008a440: 6573 2029 2074 6861 742c 2074 6f67 6574 es ) that, toget │ │ │ +0008a450: 6865 7220 7769 7468 2074 7665 632c 2062 her with tvec, b │ │ │ +0008a460: 7269 6e67 7320 706f 696e 7473 2066 726f rings points fro │ │ │ +0008a470: 6d0a 7468 6520 6d6f 6465 6c20 636f 6f72 m.the model coor │ │ │ +0008a480: 6469 6e61 7465 2073 7973 7465 6d20 746f dinate system to │ │ │ +0008a490: 2074 6865 2063 616d 6572 6120 636f 6f72 the camera coor │ │ │ +0008a4a0: 6469 6e61 7465 2073 7973 7465 6d2e 3c2f dinate system..
    tv │ │ │ +0008a4c0: 6563 3c2f 636f 6465 3e20 2d20 4f75 7470 ec - Outp │ │ │ +0008a4d0: 7574 2074 7261 6e73 6c61 7469 6f6e 2076 ut translation v │ │ │ +0008a4e0: 6563 746f 722e 0a74 6865 2070 726f 7669 ector..the provi │ │ │ +0008a4f0: 6465 6420 7276 6563 2061 6e64 2074 7665 ded rvec and tve │ │ │ +0008a500: 6320 7661 6c75 6573 2061 7320 696e 6974 c values as init │ │ │ +0008a510: 6961 6c20 6170 7072 6f78 696d 6174 696f ial approximatio │ │ │ +0008a520: 6e73 206f 6620 7468 6520 726f 7461 7469 ns of the rotati │ │ │ +0008a530: 6f6e 2061 6e64 2074 7261 6e73 6c61 7469 on and translati │ │ │ +0008a540: 6f6e 0a76 6563 746f 7273 2c20 7265 7370 on.vectors, resp │ │ │ +0008a550: 6563 7469 7665 6c79 2c20 616e 6420 6675 ectively, and fu │ │ │ +0008a560: 7274 6865 7220 6f70 7469 6d69 7a65 7320 rther optimizes │ │ │ +0008a570: 7468 656d 2e0a 6973 2074 6865 206d 6178 them..is the max │ │ │ +0008a580: 696d 756d 2061 6c6c 6f77 6564 2064 6973 imum allowed dis │ │ │ +0008a590: 7461 6e63 6520 6265 7477 6565 6e20 7468 tance between th │ │ │ +0008a5a0: 6520 6f62 7365 7276 6564 2061 6e64 2063 e observed and c │ │ │ +0008a5b0: 6f6d 7075 7465 6420 706f 696e 7420 7072 omputed point pr │ │ │ +0008a5c0: 6f6a 6563 7469 6f6e 7320 746f 2063 6f6e ojections to con │ │ │ +0008a5d0: 7369 6465 7220 6974 0a61 6e20 696e 6c69 sider it.an inli │ │ │ +0008a5e0: 6572 2e0a 0a54 6865 2066 756e 6374 696f er...The functio │ │ │ +0008a5f0: 6e20 6573 7469 6d61 7465 7320 616e 206f n estimates an o │ │ │ +0008a600: 626a 6563 7420 706f 7365 2067 6976 656e bject pose given │ │ │ +0008a610: 2061 2073 6574 206f 6620 6f62 6a65 6374 a set of object │ │ │ +0008a620: 2070 6f69 6e74 732c 2074 6865 6972 2063 points, their c │ │ │ +0008a630: 6f72 7265 7370 6f6e 6469 6e67 2069 6d61 orresponding ima │ │ │ +0008a640: 6765 0a70 726f 6a65 6374 696f 6e73 2c20 ge.projections, │ │ │ +0008a650: 6173 2077 656c 6c20 6173 2074 6865 2063 as well as the c │ │ │ +0008a660: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ +0008a670: 6d61 7472 6978 2061 6e64 2074 6865 2064 matrix and the d │ │ │ +0008a680: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ +0008a690: 6369 656e 7473 2e20 5468 6973 2066 756e cients. This fun │ │ │ +0008a6a0: 6374 696f 6e20 6669 6e64 7320 7375 6368 ction finds such │ │ │ +0008a6b0: 0a61 2070 6f73 6520 7468 6174 206d 696e .a pose that min │ │ │ +0008a6c0: 696d 697a 6573 2072 6570 726f 6a65 6374 imizes reproject │ │ │ +0008a6d0: 696f 6e20 6572 726f 722c 2074 6861 7420 ion error, that │ │ │ +0008a6e0: 6973 2c20 7468 6520 7375 6d20 6f66 2073 is, the sum of s │ │ │ +0008a6f0: 7175 6172 6564 2064 6973 7461 6e63 6573 quared distances │ │ │ +0008a700: 2062 6574 7765 656e 2074 6865 206f 6273 between the obs │ │ │ +0008a710: 6572 7665 640a 7072 6f6a 6563 7469 6f6e erved.projection │ │ │ +0008a720: 7320 696d 6167 6550 6f69 6e74 7320 616e s imagePoints an │ │ │ +0008a730: 6420 7468 6520 7072 6f6a 6563 7465 6420 d the projected │ │ │ +0008a740: 2875 7369 6e67 2052 4546 3a20 7072 6f6a (using REF: proj │ │ │ +0008a750: 6563 7450 6f69 6e74 7320 2920 6f62 6a65 ectPoints ) obje │ │ │ +0008a760: 6374 506f 696e 7473 2e20 5468 6520 7573 ctPoints. The us │ │ │ +0008a770: 6520 6f66 2052 414e 5341 430a 6d61 6b65 e of RANSAC.make │ │ │ +0008a780: 7320 7468 6520 6675 6e63 7469 6f6e 2072 s the function r │ │ │ +0008a790: 6573 6973 7461 6e74 2074 6f20 6f75 746c esistant to outl │ │ │ +0008a7a0: 6965 7273 2e0a 0a3c 623e 4e6f 7465 3a3c iers...Note:< │ │ │ +0008a7b0: 2f62 3e0a 3c75 6c3e 0a20 203c 6c69 3e0a /b>.
      .
    • . │ │ │ +0008a7c0: 2020 2020 2020 416e 2065 7861 6d70 6c65 An example │ │ │ +0008a7d0: 206f 6620 686f 7720 746f 2075 7365 2073 of how to use s │ │ │ +0008a7e0: 6f6c 7665 506e 5052 616e 7361 6320 666f olvePnPRansac fo │ │ │ +0008a7f0: 7220 6f62 6a65 6374 2064 6574 6563 7469 r object detecti │ │ │ +0008a800: 6f6e 2063 616e 2062 6520 666f 756e 6420 on can be found │ │ │ +0008a810: 6174 0a20 2020 2020 2020 2052 4546 3a20 at. REF: │ │ │ +0008a820: 7475 746f 7269 616c 5f72 6561 6c5f 7469 tutorial_real_ti │ │ │ +0008a830: 6d65 5f70 6f73 650a 2020 3c2f 6c69 3e0a me_pose.
    • . │ │ │ +0008a840: 2020 3c6c 693e 0a20 2020 2020 2054 6865
    • . The │ │ │ +0008a850: 2064 6566 6175 6c74 206d 6574 686f 6420 default method │ │ │ +0008a860: 7573 6564 2074 6f20 6573 7469 6d61 7465 used to estimate │ │ │ +0008a870: 2074 6865 2063 616d 6572 6120 706f 7365 the camera pose │ │ │ +0008a880: 2066 6f72 2074 6865 204d 696e 696d 616c for the Minimal │ │ │ +0008a890: 2053 616d 706c 6520 5365 7473 2073 7465 Sample Sets ste │ │ │ +0008a8a0: 700a 2020 2020 2020 2069 7320 2353 4f4c p. is #SOL │ │ │ +0008a8b0: 5645 504e 505f 4550 4e50 2e20 4578 6365 VEPNP_EPNP. Exce │ │ │ +0008a8c0: 7074 696f 6e73 2061 7265 3a0a 2020 3c75 ptions are:. .
    • . │ │ │ +0008a8e0: 2020 2020 2020 6966 2079 6f75 2063 686f if you cho │ │ │ +0008a8f0: 6f73 6520 2353 4f4c 5645 504e 505f 5033 ose #SOLVEPNP_P3 │ │ │ +0008a900: 5020 6f72 2023 534f 4c56 4550 4e50 5f41 P or #SOLVEPNP_A │ │ │ +0008a910: 5033 502c 2074 6865 7365 206d 6574 686f P3P, these metho │ │ │ +0008a920: 6473 2077 696c 6c20 6265 2075 7365 642e ds will be used. │ │ │ +0008a930: 0a20 2020 203c 2f6c 693e 0a20 2020 203c .
    • . < │ │ │ +0008a940: 6c69 3e0a 2020 2020 2020 2020 2020 6966 li>. if │ │ │ +0008a950: 2074 6865 206e 756d 6265 7220 6f66 2069 the number of i │ │ │ +0008a960: 6e70 7574 2070 6f69 6e74 7320 6973 2065 nput points is e │ │ │ +0008a970: 7175 616c 2074 6f20 342c 2023 534f 4c56 qual to 4, #SOLV │ │ │ +0008a980: 4550 4e50 5f50 3350 2069 7320 7573 6564 EPNP_P3P is used │ │ │ +0008a990: 2e0a 2020 2020 3c2f 6c69 3e0a 2020 3c2f .. . .
    • . │ │ │ +0008a9b0: 2054 6865 206d 6574 686f 6420 7573 6564 The method used │ │ │ +0008a9c0: 2074 6f20 6573 7469 6d61 7465 2074 6865 to estimate the │ │ │ +0008a9d0: 2063 616d 6572 6120 706f 7365 2075 7369 camera pose usi │ │ │ +0008a9e0: 6e67 2061 6c6c 2074 6865 2069 6e6c 6965 ng all the inlie │ │ │ +0008a9f0: 7273 2069 7320 6465 6669 6e65 6420 6279 rs is defined by │ │ │ +0008aa00: 2074 6865 0a20 2020 2020 2020 666c 6167 the. flag │ │ │ +0008aa10: 7320 7061 7261 6d65 7465 7273 2075 6e6c s parameters unl │ │ │ +0008aa20: 6573 7320 6974 2069 7320 6571 7561 6c20 ess it is equal │ │ │ +0008aa30: 746f 2023 534f 4c56 4550 4e50 5f50 3350 to #SOLVEPNP_P3P │ │ │ +0008aa40: 206f 7220 2353 4f4c 5645 504e 505f 4150 or #SOLVEPNP_AP │ │ │ +0008aa50: 3350 2e20 496e 2074 6869 7320 6361 7365 3P. In this case │ │ │ +0008aa60: 2c0a 2020 2020 2020 2074 6865 206d 6574 ,. the met │ │ │ +0008aa70: 686f 6420 2353 4f4c 5645 504e 505f 4550 hod #SOLVEPNP_EP │ │ │ +0008aa80: 4e50 2077 696c 6c20 6265 2075 7365 6420 NP will be used │ │ │ +0008aa90: 696e 7374 6561 642e 0a20 203c 2f6c 693e instead..
    • │ │ │ +0008aaa0: 0a3c 2f75 6c3e 3c2f 6464 3e0a 3c64 743e .
    .
    │ │ │ +0008aab0: 5265 7475 726e 733a 3c2f 6474 3e0a 3c64 Returns:
    .automatically │ │ │ +0008aad0: 6765 6e65 7261 7465 643c 2f64 643e 0a3c generated.< │ │ │ +0008aae0: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ..
  • .
  • ..

    solveP3P< │ │ │ +0008b530: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +0008b590: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +0008b5a0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;i │ │ │ +0008b5c0: 6e74 3c2f 7370 616e 3e26 6e62 7370 3b3c nt < │ │ │ +0008b5d0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +0008b5e0: 656e 742d 6e61 6d65 223e 736f 6c76 6550 ent-name">solveP │ │ │ +0008b5f0: 3350 3c2f 7370 616e 3e3c 7762 723e 3c73 3P(Mat  │ │ │ +0008b660: 3b6f 626a 6563 7450 6f69 6e74 732c 0a20 ;objectPoints,. │ │ │ +0008b670: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +0008b6b0: 2f61 3e26 6e62 7370 3b69 6d61 6765 506f /a> imagePo │ │ │ +0008b6c0: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. Mat  │ │ │ +0008b710: 6361 6d65 7261 4d61 7472 6978 2c0a 203c cameraMatrix,. < │ │ │ +0008b720: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0008b730: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0008b740: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0008b750: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat distCoef │ │ │ +0008b770: 6673 2c0a 203c 6120 6872 6566 3d22 6874 fs,. Li │ │ │ +0008b810: 7374 3c2f 613e 266c 743b 3c61 2068 7265 st<Mat> │ │ │ +0008b860: 3b26 6e62 7370 3b72 7665 6373 2c0a 203c ; rvecs,. < │ │ │ +0008b870: 6120 6872 6566 3d22 6874 7470 733a 2f2f a href="https:// │ │ │ +0008b880: 646f 6373 2e6f 7261 636c 652e 636f 6d2f docs.oracle.com/ │ │ │ +0008b890: 656e 2f6a 6176 612f 6a61 7661 7365 2f32 en/java/javase/2 │ │ │ +0008b8a0: 352f 646f 6373 2f61 7069 2f6a 6176 612e 5/docs/api/java. │ │ │ +0008b8b0: 6261 7365 2f6a 6176 612f 7574 696c 2f4c base/java/util/L │ │ │ +0008b8c0: 6973 742e 6874 6d6c 2220 7469 746c 653d ist.html" title= │ │ │ +0008b8d0: 2263 6c61 7373 206f 7220 696e 7465 7266 "class or interf │ │ │ +0008b8e0: 6163 6520 696e 206a 6176 612e 7574 696c ace in java.util │ │ │ +0008b8f0: 2220 636c 6173 733d 2265 7874 6572 6e61 " class="externa │ │ │ +0008b900: 6c2d 6c69 6e6b 223e 4c69 7374 3c2f 613e l-link">List │ │ │ +0008b910: 266c 743b 3c61 2068 7265 663d 222e 2e2f < │ │ │ +0008b950: 4d61 743c 2f61 3e26 6774 3b26 6e62 7370 Mat>  │ │ │ +0008b960: 3b74 7665 6373 2c0a 2069 6e74 266e 6273 ;tvecs,. int&nbs │ │ │ +0008b970: 703b 666c 6167 7329 3c2f 7370 616e 3e3c p;flags)< │ │ │ +0008b980: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Finds a │ │ │ +0008b9a0: 6e20 6f62 6a65 6374 2070 6f73 6520 5c28 n object pose \( │ │ │ +0008b9b0: 207b 7d5e 7b63 7d5c 6d61 7468 6266 7b54 {}^{c}\mathbf{T │ │ │ +0008b9c0: 7d5f 6f20 5c29 2066 726f 6d20 3c62 3e33 }_o \) from 3 │ │ │ +0008b9d0: 3c2f 623e 2033 442d 3244 2070 6f69 6e74 3D-2D point │ │ │ +0008b9e0: 2063 6f72 7265 7370 6f6e 6465 6e63 6573 correspondences │ │ │ +0008b9f0: 2e0a 0a21 5b50 6572 7370 6563 7469 7665 ...![Perspective │ │ │ +0008ba00: 2070 726f 6a65 6374 696f 6e2c 2066 726f projection, fro │ │ │ +0008ba10: 6d20 6f62 6a65 6374 2074 6f20 6361 6d65 m object to came │ │ │ +0008ba20: 7261 2066 7261 6d65 5d28 7069 6373 2f70 ra frame](pics/p │ │ │ +0008ba30: 696e 686f 6c65 5f68 6f6d 6f67 656e 656f inhole_homogeneo │ │ │ +0008ba40: 7573 5f74 7261 6e73 666f 726d 6174 696f us_transformatio │ │ │ +0008ba50: 6e2e 6a70 6729 7b20 7769 6474 683d 3530 n.jpg){ width=50 │ │ │ +0008ba60: 2520 7d0a 0a53 4545 3a20 5245 463a 2063 % }..SEE: REF: c │ │ │ +0008ba70: 616c 6962 3364 5f73 6f6c 7665 506e 503c alib3d_solvePnP< │ │ │ +0008ba80: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ +0008baa0: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .objectPo │ │ │ +0008bac0: 696e 7473 3c2f 636f 6465 3e20 2d20 4172 ints - Ar │ │ │ +0008bad0: 7261 7920 6f66 206f 626a 6563 7420 706f ray of object po │ │ │ +0008bae0: 696e 7473 2069 6e20 7468 6520 6f62 6a65 ints in the obje │ │ │ +0008baf0: 6374 2063 6f6f 7264 696e 6174 6520 7370 ct coordinate sp │ │ │ +0008bb00: 6163 652c 2033 7833 2031 2d63 6861 6e6e ace, 3x3 1-chann │ │ │ +0008bb10: 656c 206f 720a 3178 332f 3378 3120 332d el or.1x3/3x1 3- │ │ │ +0008bb20: 6368 616e 6e65 6c2e 2076 6563 746f 7226 channel. vector& │ │ │ +0008bb30: 6c74 3b50 6f69 6e74 3366 2667 743b 2063 lt;Point3f> c │ │ │ +0008bb40: 616e 2062 6520 616c 736f 2070 6173 7365 an be also passe │ │ │ +0008bb50: 6420 6865 7265 2e3c 2f64 643e 0a3c 6464 d here..
    imagePoin │ │ │ +0008bb70: 7473 3c2f 636f 6465 3e20 2d20 4172 7261 ts - Arra │ │ │ +0008bb80: 7920 6f66 2063 6f72 7265 7370 6f6e 6469 y of correspondi │ │ │ +0008bb90: 6e67 2069 6d61 6765 2070 6f69 6e74 732c ng image points, │ │ │ +0008bba0: 2033 7832 2031 2d63 6861 6e6e 656c 206f 3x2 1-channel o │ │ │ +0008bbb0: 7220 3178 332f 3378 3120 322d 6368 616e r 1x3/3x1 2-chan │ │ │ +0008bbc0: 6e65 6c2e 0a20 7665 6374 6f72 266c 743b nel.. vector< │ │ │ +0008bbd0: 506f 696e 7432 6626 6774 3b20 6361 6e20 Point2f> can │ │ │ +0008bbe0: 6265 2061 6c73 6f20 7061 7373 6564 2068 be also passed h │ │ │ +0008bbf0: 6572 652e 3c2f 6464 3e0a 3c64 643e 3c63 ere.
    .
    cameraMatrix │ │ │ +0008bc10: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ +0008bc20: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ +0008bc30: 206d 6174 7269 7820 5c28 5c63 616d 6572 matrix \(\camer │ │ │ +0008bc40: 616d 6174 7269 787b 417d 5c29 202e 3c2f amatrix{A}\) ..
    di │ │ │ +0008bc60: 7374 436f 6566 6673 3c2f 636f 6465 3e20 stCoeffs │ │ │ +0008bc70: 2d20 496e 7075 7420 7665 6374 6f72 206f - Input vector o │ │ │ +0008bc80: 6620 6469 7374 6f72 7469 6f6e 2063 6f65 f distortion coe │ │ │ +0008bc90: 6666 6963 6965 6e74 730a 5c28 5c64 6973 fficients.\(\dis │ │ │ +0008bca0: 7463 6f65 6666 735c 292e 2049 6620 7468 tcoeffs\). If th │ │ │ +0008bcb0: 6520 7665 6374 6f72 2069 7320 4e55 4c4c e vector is NULL │ │ │ +0008bcc0: 2f65 6d70 7479 2c20 7468 6520 7a65 726f /empty, the zero │ │ │ +0008bcd0: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ +0008bce0: 6669 6369 656e 7473 2061 7265 0a61 7373 ficients are.ass │ │ │ +0008bcf0: 756d 6564 2e3c 2f64 643e 0a3c 6464 3e3c umed.
    .
    < │ │ │ +0008bd00: 636f 6465 3e72 7665 6373 3c2f 636f 6465 code>rvecs - Output rotat │ │ │ +0008bd20: 696f 6e20 7665 6374 6f72 7320 2873 6565 ion vectors (see │ │ │ +0008bd30: 2052 4546 3a20 526f 6472 6967 7565 7320 REF: Rodrigues │ │ │ +0008bd40: 2920 7468 6174 2c20 746f 6765 7468 6572 ) that, together │ │ │ +0008bd50: 2077 6974 6820 7476 6563 732c 2062 7269 with tvecs, bri │ │ │ +0008bd60: 6e67 7320 706f 696e 7473 2066 726f 6d0a ngs points from. │ │ │ +0008bd70: 7468 6520 6d6f 6465 6c20 636f 6f72 6469 the model coordi │ │ │ +0008bd80: 6e61 7465 2073 7973 7465 6d20 746f 2074 nate system to t │ │ │ +0008bd90: 6865 2063 616d 6572 6120 636f 6f72 6469 he camera coordi │ │ │ +0008bda0: 6e61 7465 2073 7973 7465 6d2e 2041 2050 nate system. A P │ │ │ +0008bdb0: 3350 2070 726f 626c 656d 2068 6173 2075 3P problem has u │ │ │ +0008bdc0: 7020 746f 2034 2073 6f6c 7574 696f 6e73 p to 4 solutions │ │ │ +0008bdd0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    tvecs - │ │ │ +0008bdf0: 4f75 7470 7574 2074 7261 6e73 6c61 7469 Output translati │ │ │ +0008be00: 6f6e 2076 6563 746f 7273 2e3c 2f64 643e on vectors.
    │ │ │ +0008be10: 0a3c 6464 3e3c 636f 6465 3e66 6c61 6773 .
    flags │ │ │ +0008be20: 3c2f 636f 6465 3e20 2d20 4d65 7468 6f64 - Method │ │ │ +0008be30: 2066 6f72 2073 6f6c 7669 6e67 2061 2050 for solving a P │ │ │ +0008be40: 3350 2070 726f 626c 656d 3a0a 3c75 6c3e 3P problem:.
      │ │ │ +0008be50: 0a20 203c 6c69 3e0a 2020 2052 4546 3a20 .
    • . REF: │ │ │ +0008be60: 534f 4c56 4550 4e50 5f50 3350 204d 6574 SOLVEPNP_P3P Met │ │ │ +0008be70: 686f 6420 6973 2062 6173 6564 206f 6e20 hod is based on │ │ │ +0008be80: 7468 6520 7061 7065 7220 6f66 2044 696e the paper of Din │ │ │ +0008be90: 672c 2059 2e2c 2059 616e 672c 204a 2e2c g, Y., Yang, J., │ │ │ +0008bea0: 204c 6172 7373 6f6e 2c20 562e 2c20 4f6c Larsson, V., Ol │ │ │ +0008beb0: 7373 6f6e 2c20 432e 2c20 2661 6d70 3b20 sson, C., & │ │ │ +0008bec0: e284 ab73 7472 6f6d 2c20 4b2e 0a22 5265 ...strom, K.."Re │ │ │ +0008bed0: 7669 7369 7469 6e67 2074 6865 2050 3350 visiting the P3P │ │ │ +0008bee0: 2050 726f 626c 656d 2220 2843 4954 453a Problem" (CITE: │ │ │ +0008bef0: 2064 696e 6732 3032 3372 6576 6973 6974 ding2023revisit │ │ │ +0008bf00: 696e 6729 2e0a 2020 3c2f 6c69 3e0a 2020 ing)..
    • . │ │ │ +0008bf10: 3c6c 693e 0a20 2020 5245 463a 2053 4f4c
    • . REF: SOL │ │ │ +0008bf20: 5645 504e 505f 4150 3350 204d 6574 686f VEPNP_AP3P Metho │ │ │ +0008bf30: 6420 6973 2062 6173 6564 206f 6e20 7468 d is based on th │ │ │ +0008bf40: 6520 7061 7065 7220 6f66 2054 2e20 4b65 e paper of T. Ke │ │ │ +0008bf50: 2061 6e64 2053 2e20 526f 756d 656c 696f and S. Roumelio │ │ │ +0008bf60: 7469 732e 0a22 416e 2045 6666 6963 6965 tis.."An Efficie │ │ │ +0008bf70: 6e74 2041 6c67 6562 7261 6963 2053 6f6c nt Algebraic Sol │ │ │ +0008bf80: 7574 696f 6e20 746f 2074 6865 2050 6572 ution to the Per │ │ │ +0008bf90: 7370 6563 7469 7665 2d54 6872 6565 2d50 spective-Three-P │ │ │ +0008bfa0: 6f69 6e74 2050 726f 626c 656d 2220 2843 oint Problem" (C │ │ │ +0008bfb0: 4954 453a 204b 6531 3729 2e0a 2020 3c2f ITE: Ke17).. .
    ..The f │ │ │ +0008bfd0: 756e 6374 696f 6e20 6573 7469 6d61 7465 unction estimate │ │ │ +0008bfe0: 7320 7468 6520 6f62 6a65 6374 2070 6f73 s the object pos │ │ │ +0008bff0: 6520 6769 7665 6e20 3320 6f62 6a65 6374 e given 3 object │ │ │ +0008c000: 2070 6f69 6e74 732c 2074 6865 6972 2063 points, their c │ │ │ +0008c010: 6f72 7265 7370 6f6e 6469 6e67 2069 6d61 orresponding ima │ │ │ +0008c020: 6765 0a70 726f 6a65 6374 696f 6e73 2c20 ge.projections, │ │ │ +0008c030: 6173 2077 656c 6c20 6173 2074 6865 2063 as well as the c │ │ │ +0008c040: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ +0008c050: 6d61 7472 6978 2061 6e64 2074 6865 2064 matrix and the d │ │ │ +0008c060: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ +0008c070: 6369 656e 7473 2e0a 0a3c 623e 4e6f 7465 cients...Note │ │ │ +0008c080: 3a3c 2f62 3e0a 5468 6520 736f 6c75 7469 :.The soluti │ │ │ +0008c090: 6f6e 7320 6172 6520 736f 7274 6564 2062 ons are sorted b │ │ │ +0008c0a0: 7920 7265 7072 6f6a 6563 7469 6f6e 2065 y reprojection e │ │ │ +0008c0b0: 7272 6f72 7320 286c 6f77 6573 7420 746f rrors (lowest to │ │ │ +0008c0c0: 2068 6967 6865 7374 292e 3c2f 6464 3e0a highest).
    . │ │ │ +0008c0d0: 3c64 743e 5265 7475 726e 733a 3c2f 6474
    Returns:
    .
    automatica │ │ │ +0008c0f0: 6c6c 7920 6765 6e65 7261 7465 643c 2f64 lly generated.
    .
    . │ │ │ +0008c110: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e

  • .
    .

    solvePn │ │ │ +0008ac00: 5052 616e 7361 633c 2f68 333e 0a3c 6469 PRansac

    ..public static │ │ │ +0008ac70: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  boolean solvePnPRa │ │ │ +0008acd0: 6e73 6163 3c2f 7370 616e 3e3c 7762 723e nsac │ │ │ +0008ace0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (M │ │ │ +0008ad40: 6174 4f66 506f 696e 7433 663c 2f61 3e26 atOfPoint3f& │ │ │ +0008ad50: 6e62 7370 3b6f 626a 6563 7450 6f69 6e74 nbsp;objectPoint │ │ │ +0008ad60: 732c 0a20 3c61 2068 7265 663d 222e 2e2f s,. MatOfPo │ │ │ +0008adb0: 696e 7432 663c 2f61 3e26 6e62 7370 3b69 int2f i │ │ │ +0008adc0: 6d61 6765 506f 696e 7473 2c0a 203c 6120 magePoints,. Mat │ │ │ +0008ae10: 266e 6273 703b 6361 6d65 7261 4d61 7472  cameraMatr │ │ │ +0008ae20: 6978 2c0a 203c 6120 6872 6566 3d22 2e2e ix,. MatOfDo │ │ │ +0008ae70: 7562 6c65 3c2f 613e 266e 6273 703b 6469 uble di │ │ │ +0008ae80: 7374 436f 6566 6673 2c0a 203c 6120 6872 stCoeffs,. Mat&n │ │ │ +0008aed0: 6273 703b 7276 6563 2c0a 203c 6120 6872 bsp;rvec,. Mat&n │ │ │ +0008af20: 6273 703b 7476 6563 2c0a 203c 6120 6872 bsp;tvec,. Mat&n │ │ │ +0008af70: 6273 703b 696e 6c69 6572 732c 0a20 3c61 bsp;inliers,. Usa │ │ │ +0008afc0: 6350 6172 616d 733c 2f61 3e26 6e62 7370 cParams  │ │ │ +0008afd0: 3b70 6172 616d 7329 3c2f 7370 616e 3e3c ;params)< │ │ │ +0008afe0: 2f64 6976 3e0a 3c2f 6469 763e 0a3c 2f73 /div>..
    .
  • ..
    .

    solve │ │ │ +0008b0e0: 506e 5052 616e 7361 633c 2f68 333e 0a3c PnPRansac

    .< │ │ │ +0008b0f0: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +0008b100: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +0008b110: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +0008b120: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +0008b150: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +0008b160: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +0008b170: 726e 2d74 7970 6522 3e62 6f6f 6c65 616e rn-type">boolean │ │ │ +0008b180: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  solvePnP │ │ │ +0008b1b0: 5261 6e73 6163 3c2f 7370 616e 3e3c 7762 Ransac(MatOfPoint3f objectPoi │ │ │ +0008b240: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. MatOf │ │ │ +0008b290: 506f 696e 7432 663c 2f61 3e26 6e62 7370 Point2f  │ │ │ +0008b2a0: 3b69 6d61 6765 506f 696e 7473 2c0a 203c ;imagePoints,. < │ │ │ +0008b2b0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0008b2c0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0008b2d0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0008b2e0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ +0008b300: 7472 6978 2c0a 203c 6120 6872 6566 3d22 trix,. MatOf │ │ │ +0008b350: 446f 7562 6c65 3c2f 613e 266e 6273 703b Double  │ │ │ +0008b360: 6469 7374 436f 6566 6673 2c0a 203c 6120 distCoeffs,. Mat │ │ │ +0008b3b0: 266e 6273 703b 7276 6563 2c0a 203c 6120  rvec,. Mat │ │ │ +0008b400: 266e 6273 703b 7476 6563 2c0a 203c 6120  tvec,. Mat │ │ │ +0008b450: 266e 6273 703b 696e 6c69 6572 7329 3c2f  inliers)..
    ..
    . │ │ │ +0008c120: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    s │ │ │ +0008c1f0: 6f6c 7665 506e 5052 6566 696e 654c 4d3c olvePnPRefineLM< │ │ │ +0008c200: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +0008c260: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +0008c270: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;v │ │ │ +0008c290: 6f69 643c 2f73 7061 6e3e 266e 6273 703b oid  │ │ │ +0008c2a0: 3c73 7061 6e20 636c 6173 733d 2265 6c65 solve │ │ │ +0008c2c0: 506e 5052 6566 696e 654c 4d3c 2f73 7061 PnPRefineLM │ │ │ +0008c2f0: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ +0008c330: 3c2f 613e 266e 6273 703b 6f62 6a65 6374  object │ │ │ +0008c340: 506f 696e 7473 2c0a 203c 6120 6872 6566 Points,. Mat&nbs │ │ │ +0008c390: 703b 696d 6167 6550 6f69 6e74 732c 0a20 p;imagePoints,. │ │ │ +0008c3a0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +0008c3e0: 2f61 3e26 6e62 7370 3b63 616d 6572 614d /a> cameraM │ │ │ +0008c3f0: 6174 7269 782c 0a20 3c61 2068 7265 663d atrix,. Mat  │ │ │ +0008c440: 3b64 6973 7443 6f65 6666 732c 0a20 3c61 ;distCoeffs,. Mat rvec,. Mat tvec,. TermCriteria< │ │ │ +0008c540: 2f61 3e26 6e62 7370 3b63 7269 7465 7269 /a> criteri │ │ │ +0008c550: 6129 3c2f 7370 616e 3e3c 2f64 6976 3e0a a)
    . │ │ │ +0008c560: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Refine a pose │ │ │ +0008c580: 2028 7468 6520 7472 616e 736c 6174 696f (the translatio │ │ │ +0008c590: 6e20 616e 6420 7468 6520 726f 7461 7469 n and the rotati │ │ │ +0008c5a0: 6f6e 2074 6861 7420 7472 616e 7366 6f72 on that transfor │ │ │ +0008c5b0: 6d20 6120 3344 2070 6f69 6e74 2065 7870 m a 3D point exp │ │ │ +0008c5c0: 7265 7373 6564 2069 6e20 7468 6520 6f62 ressed in the ob │ │ │ +0008c5d0: 6a65 6374 2063 6f6f 7264 696e 6174 6520 ject coordinate │ │ │ +0008c5e0: 6672 616d 650a 746f 2074 6865 2063 616d frame.to the cam │ │ │ +0008c5f0: 6572 6120 636f 6f72 6469 6e61 7465 2066 era coordinate f │ │ │ +0008c600: 7261 6d65 2920 6672 6f6d 2061 2033 442d rame) from a 3D- │ │ │ +0008c610: 3244 2070 6f69 6e74 2063 6f72 7265 7370 2D point corresp │ │ │ +0008c620: 6f6e 6465 6e63 6573 2061 6e64 2073 7461 ondences and sta │ │ │ +0008c630: 7274 696e 6720 6672 6f6d 2061 6e20 696e rting from an in │ │ │ +0008c640: 6974 6961 6c20 736f 6c75 7469 6f6e 2e0a itial solution.. │ │ │ +0008c650: 0a53 4545 3a20 5245 463a 2063 616c 6962 .SEE: REF: calib │ │ │ +0008c660: 3364 5f73 6f6c 7665 506e 503c 2f64 6976 3d_solvePnP
    .
    .
    Paramet │ │ │ +0008c690: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    objectPoints │ │ │ +0008c6b0: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ +0008c6c0: 6f66 206f 626a 6563 7420 706f 696e 7473 of object points │ │ │ +0008c6d0: 2069 6e20 7468 6520 6f62 6a65 6374 2063 in the object c │ │ │ +0008c6e0: 6f6f 7264 696e 6174 6520 7370 6163 652c oordinate space, │ │ │ +0008c6f0: 204e 7833 2031 2d63 6861 6e6e 656c 206f Nx3 1-channel o │ │ │ +0008c700: 7220 3178 4e2f 4e78 3120 332d 6368 616e r 1xN/Nx1 3-chan │ │ │ +0008c710: 6e65 6c2c 0a77 6865 7265 204e 2069 7320 nel,.where N is │ │ │ +0008c720: 7468 6520 6e75 6d62 6572 206f 6620 706f the number of po │ │ │ +0008c730: 696e 7473 2e20 7665 6374 6f72 266c 743b ints. vector< │ │ │ +0008c740: 506f 696e 7433 6426 6774 3b20 6361 6e20 Point3d> can │ │ │ +0008c750: 616c 736f 2062 6520 7061 7373 6564 2068 also be passed h │ │ │ +0008c760: 6572 652e 3c2f 6464 3e0a 3c64 643e 3c63 ere.
    .
    imagePoints< │ │ │ +0008c780: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ +0008c790: 6620 636f 7272 6573 706f 6e64 696e 6720 f corresponding │ │ │ +0008c7a0: 696d 6167 6520 706f 696e 7473 2c20 4e78 image points, Nx │ │ │ +0008c7b0: 3220 312d 6368 616e 6e65 6c20 6f72 2031 2 1-channel or 1 │ │ │ +0008c7c0: 784e 2f4e 7831 2032 2d63 6861 6e6e 656c xN/Nx1 2-channel │ │ │ +0008c7d0: 2c0a 7768 6572 6520 4e20 6973 2074 6865 ,.where N is the │ │ │ +0008c7e0: 206e 756d 6265 7220 6f66 2070 6f69 6e74 number of point │ │ │ +0008c7f0: 732e 2076 6563 746f 7226 6c74 3b50 6f69 s. vector<Poi │ │ │ +0008c800: 6e74 3264 2667 743b 2063 616e 2061 6c73 nt2d> can als │ │ │ +0008c810: 6f20 6265 2070 6173 7365 6420 6865 7265 o be passed here │ │ │ +0008c820: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    cameraMatrix - Input cam │ │ │ +0008c850: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +0008c860: 7472 6978 205c 285c 6361 6d65 7261 6d61 trix \(\camerama │ │ │ +0008c870: 7472 6978 7b41 7d5c 2920 2e3c 2f64 643e trix{A}\) .
    │ │ │ +0008c880: 0a3c 6464 3e3c 636f 6465 3e64 6973 7443 .
    distC │ │ │ +0008c890: 6f65 6666 733c 2f63 6f64 653e 202d 2049 oeffs - I │ │ │ +0008c8a0: 6e70 7574 2076 6563 746f 7220 6f66 2064 nput vector of d │ │ │ +0008c8b0: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ +0008c8c0: 6369 656e 7473 0a5c 285c 6469 7374 636f cients.\(\distco │ │ │ +0008c8d0: 6566 6673 5c29 2e20 4966 2074 6865 2076 effs\). If the v │ │ │ +0008c8e0: 6563 746f 7220 6973 204e 554c 4c2f 656d ector is NULL/em │ │ │ +0008c8f0: 7074 792c 2074 6865 207a 6572 6f20 6469 pty, the zero di │ │ │ +0008c900: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ +0008c910: 6965 6e74 7320 6172 650a 6173 7375 6d65 ients are.assume │ │ │ +0008c920: 642e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 d.
    .
    rvec - │ │ │ +0008c940: 496e 7075 742f 4f75 7470 7574 2072 6f74 Input/Output rot │ │ │ +0008c950: 6174 696f 6e20 7665 6374 6f72 2028 7365 ation vector (se │ │ │ +0008c960: 6520 5245 463a 2052 6f64 7269 6775 6573 e REF: Rodrigues │ │ │ +0008c970: 2029 2074 6861 742c 2074 6f67 6574 6865 ) that, togethe │ │ │ +0008c980: 7220 7769 7468 2074 7665 632c 2062 7269 r with tvec, bri │ │ │ +0008c990: 6e67 7320 706f 696e 7473 2066 726f 6d0a ngs points from. │ │ │ +0008c9a0: 7468 6520 6d6f 6465 6c20 636f 6f72 6469 the model coordi │ │ │ +0008c9b0: 6e61 7465 2073 7973 7465 6d20 746f 2074 nate system to t │ │ │ +0008c9c0: 6865 2063 616d 6572 6120 636f 6f72 6469 he camera coordi │ │ │ +0008c9d0: 6e61 7465 2073 7973 7465 6d2e 2049 6e70 nate system. Inp │ │ │ +0008c9e0: 7574 2076 616c 7565 7320 6172 6520 7573 ut values are us │ │ │ +0008c9f0: 6564 2061 7320 616e 2069 6e69 7469 616c ed as an initial │ │ │ +0008ca00: 2073 6f6c 7574 696f 6e2e 3c2f 6464 3e0a solution.
    . │ │ │ +0008ca10: 3c64 643e 3c63 6f64 653e 7476 6563 3c2f
    tvec - Input/Ou │ │ │ +0008ca30: 7470 7574 2074 7261 6e73 6c61 7469 6f6e tput translation │ │ │ +0008ca40: 2076 6563 746f 722e 2049 6e70 7574 2076 vector. Input v │ │ │ +0008ca50: 616c 7565 7320 6172 6520 7573 6564 2061 alues are used a │ │ │ +0008ca60: 7320 616e 2069 6e69 7469 616c 2073 6f6c s an initial sol │ │ │ +0008ca70: 7574 696f 6e2e 3c2f 6464 3e0a 3c64 643e ution.
    .
    │ │ │ +0008ca80: 3c63 6f64 653e 6372 6974 6572 6961 3c2f criteria - Criteria │ │ │ +0008caa0: 2077 6865 6e20 746f 2073 746f 7020 7468 when to stop th │ │ │ +0008cab0: 6520 4c65 7665 6e62 6572 672d 4d61 7271 e Levenberg-Marq │ │ │ +0008cac0: 7561 7264 2069 7465 7261 7469 7665 2061 uard iterative a │ │ │ +0008cad0: 6c67 6f72 6974 686d 2e0a 0a54 6865 2066 lgorithm...The f │ │ │ +0008cae0: 756e 6374 696f 6e20 7265 6669 6e65 7320 unction refines │ │ │ +0008caf0: 7468 6520 6f62 6a65 6374 2070 6f73 6520 the object pose │ │ │ +0008cb00: 6769 7665 6e20 6174 206c 6561 7374 2033 given at least 3 │ │ │ +0008cb10: 206f 626a 6563 7420 706f 696e 7473 2c20 object points, │ │ │ +0008cb20: 7468 6569 7220 636f 7272 6573 706f 6e64 their correspond │ │ │ +0008cb30: 696e 6720 696d 6167 650a 7072 6f6a 6563 ing image.projec │ │ │ +0008cb40: 7469 6f6e 732c 2061 6e20 696e 6974 6961 tions, an initia │ │ │ +0008cb50: 6c20 736f 6c75 7469 6f6e 2066 6f72 2074 l solution for t │ │ │ +0008cb60: 6865 2072 6f74 6174 696f 6e20 616e 6420 he rotation and │ │ │ +0008cb70: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ +0008cb80: 6f72 2c0a 6173 2077 656c 6c20 6173 2074 or,.as well as t │ │ │ +0008cb90: 6865 2063 616d 6572 6120 696e 7472 696e he camera intrin │ │ │ +0008cba0: 7369 6320 6d61 7472 6978 2061 6e64 2074 sic matrix and t │ │ │ +0008cbb0: 6865 2064 6973 746f 7274 696f 6e20 636f he distortion co │ │ │ +0008cbc0: 6566 6669 6369 656e 7473 2e0a 5468 6520 efficients..The │ │ │ +0008cbd0: 6675 6e63 7469 6f6e 206d 696e 696d 697a function minimiz │ │ │ +0008cbe0: 6573 2074 6865 2070 726f 6a65 6374 696f es the projectio │ │ │ +0008cbf0: 6e20 6572 726f 7220 7769 7468 2072 6573 n error with res │ │ │ +0008cc00: 7065 6374 2074 6f20 7468 6520 726f 7461 pect to the rota │ │ │ +0008cc10: 7469 6f6e 2061 6e64 2074 6865 2074 7261 tion and the tra │ │ │ +0008cc20: 6e73 6c61 7469 6f6e 2076 6563 746f 7273 nslation vectors │ │ │ +0008cc30: 2c20 6163 636f 7264 696e 670a 746f 2061 , according.to a │ │ │ +0008cc40: 204c 6576 656e 6265 7267 2d4d 6172 7175 Levenberg-Marqu │ │ │ +0008cc50: 6172 6474 2069 7465 7261 7469 7665 206d ardt iterative m │ │ │ +0008cc60: 696e 696d 697a 6174 696f 6e20 4349 5445 inimization CITE │ │ │ +0008cc70: 3a20 4d61 6473 656e 3034 2043 4954 453a : Madsen04 CITE: │ │ │ +0008cc80: 2045 6164 6531 3320 7072 6f63 6573 732e Eade13 process. │ │ │ +0008cc90: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ..

    ..
  • . │ │ │ +0008cd60: 0a3c 6833 3e73 6f6c 7665 506e 5052 6566 .

    solvePnPRef │ │ │ +0008cd70: 696e 654c 4d3c 2f68 333e 0a3c 6469 7620 ineLM

    .
    .
    public static void │ │ │ +0008ce10: 266e 6273 703b 3c73 7061 6e20 636c 6173  solvePnPRefineL │ │ │ +0008ce40: 4d3c 2f73 7061 6e3e 3c77 6272 3e3c 7370 M(Mat  │ │ │ +0008ceb0: 6f62 6a65 6374 506f 696e 7473 2c0a 203c objectPoints,. < │ │ │ +0008cec0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0008ced0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0008cee0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0008cef0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat imagePoi │ │ │ +0008cf10: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. Mat c │ │ │ +0008cf60: 616d 6572 614d 6174 7269 782c 0a20 3c61 ameraMatrix,. Mat distCoeff │ │ │ +0008cfc0: 732c 0a20 3c61 2068 7265 663d 222e 2e2f s,. │ │ │ +0008d000: 4d61 743c 2f61 3e26 6e62 7370 3b72 7665 Mat rve │ │ │ +0008d010: 632c 0a20 3c61 2068 7265 663d 222e 2e2f c,. │ │ │ +0008d050: 4d61 743c 2f61 3e26 6e62 7370 3b74 7665 Mat tve │ │ │ +0008d060: 6329 3c2f 7370 616e 3e3c 2f64 6976 3e0a c)
    . │ │ │ +0008d070: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Refine a pose │ │ │ +0008d090: 2028 7468 6520 7472 616e 736c 6174 696f (the translatio │ │ │ +0008d0a0: 6e20 616e 6420 7468 6520 726f 7461 7469 n and the rotati │ │ │ +0008d0b0: 6f6e 2074 6861 7420 7472 616e 7366 6f72 on that transfor │ │ │ +0008d0c0: 6d20 6120 3344 2070 6f69 6e74 2065 7870 m a 3D point exp │ │ │ +0008d0d0: 7265 7373 6564 2069 6e20 7468 6520 6f62 ressed in the ob │ │ │ +0008d0e0: 6a65 6374 2063 6f6f 7264 696e 6174 6520 ject coordinate │ │ │ +0008d0f0: 6672 616d 650a 746f 2074 6865 2063 616d frame.to the cam │ │ │ +0008d100: 6572 6120 636f 6f72 6469 6e61 7465 2066 era coordinate f │ │ │ +0008d110: 7261 6d65 2920 6672 6f6d 2061 2033 442d rame) from a 3D- │ │ │ +0008d120: 3244 2070 6f69 6e74 2063 6f72 7265 7370 2D point corresp │ │ │ +0008d130: 6f6e 6465 6e63 6573 2061 6e64 2073 7461 ondences and sta │ │ │ +0008d140: 7274 696e 6720 6672 6f6d 2061 6e20 696e rting from an in │ │ │ +0008d150: 6974 6961 6c20 736f 6c75 7469 6f6e 2e0a itial solution.. │ │ │ +0008d160: 0a53 4545 3a20 5245 463a 2063 616c 6962 .SEE: REF: calib │ │ │ +0008d170: 3364 5f73 6f6c 7665 506e 503c 2f64 6976 3d_solvePnP
    .
    .
    Paramet │ │ │ +0008d1a0: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    objectPoints │ │ │ +0008d1c0: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ +0008d1d0: 6f66 206f 626a 6563 7420 706f 696e 7473 of object points │ │ │ +0008d1e0: 2069 6e20 7468 6520 6f62 6a65 6374 2063 in the object c │ │ │ +0008d1f0: 6f6f 7264 696e 6174 6520 7370 6163 652c oordinate space, │ │ │ +0008d200: 204e 7833 2031 2d63 6861 6e6e 656c 206f Nx3 1-channel o │ │ │ +0008d210: 7220 3178 4e2f 4e78 3120 332d 6368 616e r 1xN/Nx1 3-chan │ │ │ +0008d220: 6e65 6c2c 0a77 6865 7265 204e 2069 7320 nel,.where N is │ │ │ +0008d230: 7468 6520 6e75 6d62 6572 206f 6620 706f the number of po │ │ │ +0008d240: 696e 7473 2e20 7665 6374 6f72 266c 743b ints. vector< │ │ │ +0008d250: 506f 696e 7433 6426 6774 3b20 6361 6e20 Point3d> can │ │ │ +0008d260: 616c 736f 2062 6520 7061 7373 6564 2068 also be passed h │ │ │ +0008d270: 6572 652e 3c2f 6464 3e0a 3c64 643e 3c63 ere.
    .
    imagePoints< │ │ │ +0008d290: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ +0008d2a0: 6620 636f 7272 6573 706f 6e64 696e 6720 f corresponding │ │ │ +0008d2b0: 696d 6167 6520 706f 696e 7473 2c20 4e78 image points, Nx │ │ │ +0008d2c0: 3220 312d 6368 616e 6e65 6c20 6f72 2031 2 1-channel or 1 │ │ │ +0008d2d0: 784e 2f4e 7831 2032 2d63 6861 6e6e 656c xN/Nx1 2-channel │ │ │ +0008d2e0: 2c0a 7768 6572 6520 4e20 6973 2074 6865 ,.where N is the │ │ │ +0008d2f0: 206e 756d 6265 7220 6f66 2070 6f69 6e74 number of point │ │ │ +0008d300: 732e 2076 6563 746f 7226 6c74 3b50 6f69 s. vector<Poi │ │ │ +0008d310: 6e74 3264 2667 743b 2063 616e 2061 6c73 nt2d> can als │ │ │ +0008d320: 6f20 6265 2070 6173 7365 6420 6865 7265 o be passed here │ │ │ +0008d330: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    cameraMatrix - Input cam │ │ │ +0008d360: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +0008d370: 7472 6978 205c 285c 6361 6d65 7261 6d61 trix \(\camerama │ │ │ +0008d380: 7472 6978 7b41 7d5c 2920 2e3c 2f64 643e trix{A}\) .
    │ │ │ +0008d390: 0a3c 6464 3e3c 636f 6465 3e64 6973 7443 .
    distC │ │ │ +0008d3a0: 6f65 6666 733c 2f63 6f64 653e 202d 2049 oeffs - I │ │ │ +0008d3b0: 6e70 7574 2076 6563 746f 7220 6f66 2064 nput vector of d │ │ │ +0008d3c0: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ +0008d3d0: 6369 656e 7473 0a5c 285c 6469 7374 636f cients.\(\distco │ │ │ +0008d3e0: 6566 6673 5c29 2e20 4966 2074 6865 2076 effs\). If the v │ │ │ +0008d3f0: 6563 746f 7220 6973 204e 554c 4c2f 656d ector is NULL/em │ │ │ +0008d400: 7074 792c 2074 6865 207a 6572 6f20 6469 pty, the zero di │ │ │ +0008d410: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ +0008d420: 6965 6e74 7320 6172 650a 6173 7375 6d65 ients are.assume │ │ │ +0008d430: 642e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 d.
    .
    rvec - │ │ │ +0008d450: 496e 7075 742f 4f75 7470 7574 2072 6f74 Input/Output rot │ │ │ +0008d460: 6174 696f 6e20 7665 6374 6f72 2028 7365 ation vector (se │ │ │ +0008d470: 6520 5245 463a 2052 6f64 7269 6775 6573 e REF: Rodrigues │ │ │ +0008d480: 2029 2074 6861 742c 2074 6f67 6574 6865 ) that, togethe │ │ │ +0008d490: 7220 7769 7468 2074 7665 632c 2062 7269 r with tvec, bri │ │ │ +0008d4a0: 6e67 7320 706f 696e 7473 2066 726f 6d0a ngs points from. │ │ │ +0008d4b0: 7468 6520 6d6f 6465 6c20 636f 6f72 6469 the model coordi │ │ │ +0008d4c0: 6e61 7465 2073 7973 7465 6d20 746f 2074 nate system to t │ │ │ +0008d4d0: 6865 2063 616d 6572 6120 636f 6f72 6469 he camera coordi │ │ │ +0008d4e0: 6e61 7465 2073 7973 7465 6d2e 2049 6e70 nate system. Inp │ │ │ +0008d4f0: 7574 2076 616c 7565 7320 6172 6520 7573 ut values are us │ │ │ +0008d500: 6564 2061 7320 616e 2069 6e69 7469 616c ed as an initial │ │ │ +0008d510: 2073 6f6c 7574 696f 6e2e 3c2f 6464 3e0a solution.
    . │ │ │ +0008d520: 3c64 643e 3c63 6f64 653e 7476 6563 3c2f
    tvec - Input/Ou │ │ │ +0008d540: 7470 7574 2074 7261 6e73 6c61 7469 6f6e tput translation │ │ │ +0008d550: 2076 6563 746f 722e 2049 6e70 7574 2076 vector. Input v │ │ │ +0008d560: 616c 7565 7320 6172 6520 7573 6564 2061 alues are used a │ │ │ +0008d570: 7320 616e 2069 6e69 7469 616c 2073 6f6c s an initial sol │ │ │ +0008d580: 7574 696f 6e2e 0a0a 5468 6520 6675 6e63 ution...The func │ │ │ +0008d590: 7469 6f6e 2072 6566 696e 6573 2074 6865 tion refines the │ │ │ +0008d5a0: 206f 626a 6563 7420 706f 7365 2067 6976 object pose giv │ │ │ +0008d5b0: 656e 2061 7420 6c65 6173 7420 3320 6f62 en at least 3 ob │ │ │ +0008d5c0: 6a65 6374 2070 6f69 6e74 732c 2074 6865 ject points, the │ │ │ +0008d5d0: 6972 2063 6f72 7265 7370 6f6e 6469 6e67 ir corresponding │ │ │ +0008d5e0: 2069 6d61 6765 0a70 726f 6a65 6374 696f image.projectio │ │ │ +0008d5f0: 6e73 2c20 616e 2069 6e69 7469 616c 2073 ns, an initial s │ │ │ +0008d600: 6f6c 7574 696f 6e20 666f 7220 7468 6520 olution for the │ │ │ +0008d610: 726f 7461 7469 6f6e 2061 6e64 2074 7261 rotation and tra │ │ │ +0008d620: 6e73 6c61 7469 6f6e 2076 6563 746f 722c nslation vector, │ │ │ +0008d630: 0a61 7320 7765 6c6c 2061 7320 7468 6520 .as well as the │ │ │ +0008d640: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ +0008d650: 206d 6174 7269 7820 616e 6420 7468 6520 matrix and the │ │ │ +0008d660: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ +0008d670: 6963 6965 6e74 732e 0a54 6865 2066 756e icients..The fun │ │ │ +0008d680: 6374 696f 6e20 6d69 6e69 6d69 7a65 7320 ction minimizes │ │ │ +0008d690: 7468 6520 7072 6f6a 6563 7469 6f6e 2065 the projection e │ │ │ +0008d6a0: 7272 6f72 2077 6974 6820 7265 7370 6563 rror with respec │ │ │ +0008d6b0: 7420 746f 2074 6865 2072 6f74 6174 696f t to the rotatio │ │ │ +0008d6c0: 6e20 616e 6420 7468 6520 7472 616e 736c n and the transl │ │ │ +0008d6d0: 6174 696f 6e20 7665 6374 6f72 732c 2061 ation vectors, a │ │ │ +0008d6e0: 6363 6f72 6469 6e67 0a74 6f20 6120 4c65 ccording.to a Le │ │ │ +0008d6f0: 7665 6e62 6572 672d 4d61 7271 7561 7264 venberg-Marquard │ │ │ +0008d700: 7420 6974 6572 6174 6976 6520 6d69 6e69 t iterative mini │ │ │ +0008d710: 6d69 7a61 7469 6f6e 2043 4954 453a 204d mization CITE: M │ │ │ +0008d720: 6164 7365 6e30 3420 4349 5445 3a20 4561 adsen04 CITE: Ea │ │ │ +0008d730: 6465 3133 2070 726f 6365 7373 2e3c 2f64 de13 process..
    .
    . │ │ │ +0008d750: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e .
  • │ │ │ +0008d760: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    solvePnPR │ │ │ +0008d840: 6566 696e 6556 5653 3c2f 6833 3e0a 3c64 efineVVS

    ..public stati │ │ │ +0008d8b0: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void solvePnPRefi │ │ │ +0008d910: 6e65 5656 533c 2f73 7061 6e3e 3c77 6272 neVVS(Mat&n │ │ │ +0008d980: 6273 703b 6f62 6a65 6374 506f 696e 7473 bsp;objectPoints │ │ │ +0008d990: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +0008d9d0: 6174 3c2f 613e 266e 6273 703b 696d 6167 at imag │ │ │ +0008d9e0: 6550 6f69 6e74 732c 0a20 3c61 2068 7265 ePoints,. Mat&nb │ │ │ +0008da30: 7370 3b63 616d 6572 614d 6174 7269 782c sp;cameraMatrix, │ │ │ +0008da40: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +0008da80: 743c 2f61 3e26 6e62 7370 3b64 6973 7443 t distC │ │ │ +0008da90: 6f65 6666 732c 0a20 3c61 2068 7265 663d oeffs,. Mat  │ │ │ +0008dae0: 3b72 7665 632c 0a20 3c61 2068 7265 663d ;rvec,. Mat  │ │ │ +0008db30: 3b74 7665 632c 0a20 3c61 2068 7265 663d ;tvec,. Ter │ │ │ +0008db80: 6d43 7269 7465 7269 613c 2f61 3e26 6e62 mCriteria&nb │ │ │ +0008db90: 7370 3b63 7269 7465 7269 612c 0a20 646f sp;criteria,. do │ │ │ +0008dba0: 7562 6c65 266e 6273 703b 5656 536c 616d uble VVSlam │ │ │ +0008dbb0: 6264 6129 3c2f 7370 616e 3e3c 2f64 6976 bda).
    Refine a po │ │ │ +0008dbe0: 7365 2028 7468 6520 7472 616e 736c 6174 se (the translat │ │ │ +0008dbf0: 696f 6e20 616e 6420 7468 6520 726f 7461 ion and the rota │ │ │ +0008dc00: 7469 6f6e 2074 6861 7420 7472 616e 7366 tion that transf │ │ │ +0008dc10: 6f72 6d20 6120 3344 2070 6f69 6e74 2065 orm a 3D point e │ │ │ +0008dc20: 7870 7265 7373 6564 2069 6e20 7468 6520 xpressed in the │ │ │ +0008dc30: 6f62 6a65 6374 2063 6f6f 7264 696e 6174 object coordinat │ │ │ +0008dc40: 6520 6672 616d 650a 746f 2074 6865 2063 e frame.to the c │ │ │ +0008dc50: 616d 6572 6120 636f 6f72 6469 6e61 7465 amera coordinate │ │ │ +0008dc60: 2066 7261 6d65 2920 6672 6f6d 2061 2033 frame) from a 3 │ │ │ +0008dc70: 442d 3244 2070 6f69 6e74 2063 6f72 7265 D-2D point corre │ │ │ +0008dc80: 7370 6f6e 6465 6e63 6573 2061 6e64 2073 spondences and s │ │ │ +0008dc90: 7461 7274 696e 6720 6672 6f6d 2061 6e20 tarting from an │ │ │ +0008dca0: 696e 6974 6961 6c20 736f 6c75 7469 6f6e initial solution │ │ │ +0008dcb0: 2e0a 0a53 4545 3a20 5245 463a 2063 616c ...SEE: REF: cal │ │ │ +0008dcc0: 6962 3364 5f73 6f6c 7665 506e 503c 2f64 ib3d_solvePnP.
    .
    Param │ │ │ +0008dcf0: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ +0008dd00: 3c63 6f64 653e 6f62 6a65 6374 506f 696e objectPoin │ │ │ +0008dd10: 7473 3c2f 636f 6465 3e20 2d20 4172 7261 ts - Arra │ │ │ +0008dd20: 7920 6f66 206f 626a 6563 7420 706f 696e y of object poin │ │ │ +0008dd30: 7473 2069 6e20 7468 6520 6f62 6a65 6374 ts in the object │ │ │ +0008dd40: 2063 6f6f 7264 696e 6174 6520 7370 6163 coordinate spac │ │ │ +0008dd50: 652c 204e 7833 2031 2d63 6861 6e6e 656c e, Nx3 1-channel │ │ │ +0008dd60: 206f 7220 3178 4e2f 4e78 3120 332d 6368 or 1xN/Nx1 3-ch │ │ │ +0008dd70: 616e 6e65 6c2c 0a77 6865 7265 204e 2069 annel,.where N i │ │ │ +0008dd80: 7320 7468 6520 6e75 6d62 6572 206f 6620 s the number of │ │ │ +0008dd90: 706f 696e 7473 2e20 7665 6374 6f72 266c points. vector&l │ │ │ +0008dda0: 743b 506f 696e 7433 6426 6774 3b20 6361 t;Point3d> ca │ │ │ +0008ddb0: 6e20 616c 736f 2062 6520 7061 7373 6564 n also be passed │ │ │ +0008ddc0: 2068 6572 652e 3c2f 6464 3e0a 3c64 643e here.
    .
    │ │ │ +0008ddd0: 3c63 6f64 653e 696d 6167 6550 6f69 6e74 imagePoint │ │ │ +0008dde0: 733c 2f63 6f64 653e 202d 2041 7272 6179 s - Array │ │ │ +0008ddf0: 206f 6620 636f 7272 6573 706f 6e64 696e of correspondin │ │ │ +0008de00: 6720 696d 6167 6520 706f 696e 7473 2c20 g image points, │ │ │ +0008de10: 4e78 3220 312d 6368 616e 6e65 6c20 6f72 Nx2 1-channel or │ │ │ +0008de20: 2031 784e 2f4e 7831 2032 2d63 6861 6e6e 1xN/Nx1 2-chann │ │ │ +0008de30: 656c 2c0a 7768 6572 6520 4e20 6973 2074 el,.where N is t │ │ │ +0008de40: 6865 206e 756d 6265 7220 6f66 2070 6f69 he number of poi │ │ │ +0008de50: 6e74 732e 2076 6563 746f 7226 6c74 3b50 nts. vector<P │ │ │ +0008de60: 6f69 6e74 3264 2667 743b 2063 616e 2061 oint2d> can a │ │ │ +0008de70: 6c73 6f20 6265 2070 6173 7365 6420 6865 lso be passed he │ │ │ +0008de80: 7265 2e3c 2f64 643e 0a3c 6464 3e3c 636f re.
    .
    cameraMatrix< │ │ │ +0008dea0: 2f63 6f64 653e 202d 2049 6e70 7574 2063 /code> - Input c │ │ │ +0008deb0: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ +0008dec0: 6d61 7472 6978 205c 285c 6361 6d65 7261 matrix \(\camera │ │ │ +0008ded0: 6d61 7472 6978 7b41 7d5c 2920 2e3c 2f64 matrix{A}\) ..
    dis │ │ │ +0008def0: 7443 6f65 6666 733c 2f63 6f64 653e 202d tCoeffs - │ │ │ +0008df00: 2049 6e70 7574 2076 6563 746f 7220 6f66 Input vector of │ │ │ +0008df10: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ +0008df20: 6669 6369 656e 7473 0a5c 285c 6469 7374 ficients.\(\dist │ │ │ +0008df30: 636f 6566 6673 5c29 2e20 4966 2074 6865 coeffs\). If the │ │ │ +0008df40: 2076 6563 746f 7220 6973 204e 554c 4c2f vector is NULL/ │ │ │ +0008df50: 656d 7074 792c 2074 6865 207a 6572 6f20 empty, the zero │ │ │ +0008df60: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ +0008df70: 6963 6965 6e74 7320 6172 650a 6173 7375 icients are.assu │ │ │ +0008df80: 6d65 642e 3c2f 6464 3e0a 3c64 643e 3c63 med.
    .
    rvec │ │ │ +0008dfa0: 2d20 496e 7075 742f 4f75 7470 7574 2072 - Input/Output r │ │ │ +0008dfb0: 6f74 6174 696f 6e20 7665 6374 6f72 2028 otation vector ( │ │ │ +0008dfc0: 7365 6520 5245 463a 2052 6f64 7269 6775 see REF: Rodrigu │ │ │ +0008dfd0: 6573 2029 2074 6861 742c 2074 6f67 6574 es ) that, toget │ │ │ +0008dfe0: 6865 7220 7769 7468 2074 7665 632c 2062 her with tvec, b │ │ │ +0008dff0: 7269 6e67 7320 706f 696e 7473 2066 726f rings points fro │ │ │ +0008e000: 6d0a 7468 6520 6d6f 6465 6c20 636f 6f72 m.the model coor │ │ │ +0008e010: 6469 6e61 7465 2073 7973 7465 6d20 746f dinate system to │ │ │ +0008e020: 2074 6865 2063 616d 6572 6120 636f 6f72 the camera coor │ │ │ +0008e030: 6469 6e61 7465 2073 7973 7465 6d2e 2049 dinate system. I │ │ │ +0008e040: 6e70 7574 2076 616c 7565 7320 6172 6520 nput values are │ │ │ +0008e050: 7573 6564 2061 7320 616e 2069 6e69 7469 used as an initi │ │ │ +0008e060: 616c 2073 6f6c 7574 696f 6e2e 3c2f 6464 al solution.
    .
    tvec │ │ │ +0008e080: 3c2f 636f 6465 3e20 2d20 496e 7075 742f - Input/ │ │ │ +0008e090: 4f75 7470 7574 2074 7261 6e73 6c61 7469 Output translati │ │ │ +0008e0a0: 6f6e 2076 6563 746f 722e 2049 6e70 7574 on vector. Input │ │ │ +0008e0b0: 2076 616c 7565 7320 6172 6520 7573 6564 values are used │ │ │ +0008e0c0: 2061 7320 616e 2069 6e69 7469 616c 2073 as an initial s │ │ │ +0008e0d0: 6f6c 7574 696f 6e2e 3c2f 6464 3e0a 3c64 olution.
    .criteria │ │ │ +0008e0f0: 3c2f 636f 6465 3e20 2d20 4372 6974 6572 - Criter │ │ │ +0008e100: 6961 2077 6865 6e20 746f 2073 746f 7020 ia when to stop │ │ │ +0008e110: 7468 6520 4c65 7665 6e62 6572 672d 4d61 the Levenberg-Ma │ │ │ +0008e120: 7271 7561 7264 2069 7465 7261 7469 7665 rquard iterative │ │ │ +0008e130: 2061 6c67 6f72 6974 686d 2e3c 2f64 643e algorithm. │ │ │ +0008e140: 0a3c 6464 3e3c 636f 6465 3e56 5653 6c61 .
    VVSla │ │ │ +0008e150: 6d62 6461 3c2f 636f 6465 3e20 2d20 4761 mbda - Ga │ │ │ +0008e160: 696e 2066 6f72 2074 6865 2076 6972 7475 in for the virtu │ │ │ +0008e170: 616c 2076 6973 7561 6c20 7365 7276 6f69 al visual servoi │ │ │ +0008e180: 6e67 2063 6f6e 7472 6f6c 206c 6177 2c20 ng control law, │ │ │ +0008e190: 6571 7569 7661 6c65 6e74 2074 6f20 7468 equivalent to th │ │ │ +0008e1a0: 6520 5c28 5c61 6c70 6861 5c29 0a67 6169 e \(\alpha\).gai │ │ │ +0008e1b0: 6e20 696e 2074 6865 2044 616d 7065 6420 n in the Damped │ │ │ +0008e1c0: 4761 7573 732d 4e65 7774 6f6e 2066 6f72 Gauss-Newton for │ │ │ +0008e1d0: 6d75 6c61 7469 6f6e 2e0a 0a54 6865 2066 mulation...The f │ │ │ +0008e1e0: 756e 6374 696f 6e20 7265 6669 6e65 7320 unction refines │ │ │ +0008e1f0: 7468 6520 6f62 6a65 6374 2070 6f73 6520 the object pose │ │ │ +0008e200: 6769 7665 6e20 6174 206c 6561 7374 2033 given at least 3 │ │ │ +0008e210: 206f 626a 6563 7420 706f 696e 7473 2c20 object points, │ │ │ +0008e220: 7468 6569 7220 636f 7272 6573 706f 6e64 their correspond │ │ │ +0008e230: 696e 6720 696d 6167 650a 7072 6f6a 6563 ing image.projec │ │ │ +0008e240: 7469 6f6e 732c 2061 6e20 696e 6974 6961 tions, an initia │ │ │ +0008e250: 6c20 736f 6c75 7469 6f6e 2066 6f72 2074 l solution for t │ │ │ +0008e260: 6865 2072 6f74 6174 696f 6e20 616e 6420 he rotation and │ │ │ +0008e270: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ +0008e280: 6f72 2c0a 6173 2077 656c 6c20 6173 2074 or,.as well as t │ │ │ +0008e290: 6865 2063 616d 6572 6120 696e 7472 696e he camera intrin │ │ │ +0008e2a0: 7369 6320 6d61 7472 6978 2061 6e64 2074 sic matrix and t │ │ │ +0008e2b0: 6865 2064 6973 746f 7274 696f 6e20 636f he distortion co │ │ │ +0008e2c0: 6566 6669 6369 656e 7473 2e0a 5468 6520 efficients..The │ │ │ +0008e2d0: 6675 6e63 7469 6f6e 206d 696e 696d 697a function minimiz │ │ │ +0008e2e0: 6573 2074 6865 2070 726f 6a65 6374 696f es the projectio │ │ │ +0008e2f0: 6e20 6572 726f 7220 7769 7468 2072 6573 n error with res │ │ │ +0008e300: 7065 6374 2074 6f20 7468 6520 726f 7461 pect to the rota │ │ │ +0008e310: 7469 6f6e 2061 6e64 2074 6865 2074 7261 tion and the tra │ │ │ +0008e320: 6e73 6c61 7469 6f6e 2076 6563 746f 7273 nslation vectors │ │ │ +0008e330: 2c20 7573 696e 6720 610a 7669 7274 7561 , using a.virtua │ │ │ +0008e340: 6c20 7669 7375 616c 2073 6572 766f 696e l visual servoin │ │ │ +0008e350: 6720 2856 5653 2920 4349 5445 3a20 4368 g (VVS) CITE: Ch │ │ │ +0008e360: 6175 6d65 7474 6530 3620 4349 5445 3a20 aumette06 CITE: │ │ │ +0008e370: 4d61 7263 6861 6e64 3136 2073 6368 656d Marchand16 schem │ │ │ +0008e380: 652e 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f e.
    .
    ..
    . │ │ │ +0008e3a0: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • . │ │ │ +0008e470: 0a3c 6833 3e73 6f6c 7665 506e 5052 6566 .

    solvePnPRef │ │ │ +0008e480: 696e 6556 5653 3c2f 6833 3e0a 3c64 6976 ineVVS

    .
    .
    public static< │ │ │ +0008e4f0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> void solvePnPRefine │ │ │ +0008e550: 5656 533c 2f73 7061 6e3e 3c77 6272 3e3c VVS< │ │ │ +0008e560: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +0008e570: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ +0008e5c0: 703b 6f62 6a65 6374 506f 696e 7473 2c0a p;objectPoints,. │ │ │ +0008e5d0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +0008e610: 3c2f 613e 266e 6273 703b 696d 6167 6550  imageP │ │ │ +0008e620: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ +0008e670: 3b63 616d 6572 614d 6174 7269 782c 0a20 ;cameraMatrix,. │ │ │ +0008e680: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +0008e6c0: 2f61 3e26 6e62 7370 3b64 6973 7443 6f65 /a> distCoe │ │ │ +0008e6d0: 6666 732c 0a20 3c61 2068 7265 663d 222e ffs,. Mat r │ │ │ +0008e720: 7665 632c 0a20 3c61 2068 7265 663d 222e vec,. Mat t │ │ │ +0008e770: 7665 632c 0a20 3c61 2068 7265 663d 222e vec,. TermC │ │ │ +0008e7c0: 7269 7465 7269 613c 2f61 3e26 6e62 7370 riteria  │ │ │ +0008e7d0: 3b63 7269 7465 7269 6129 3c2f 7370 616e ;criteria)
    .
    Refin │ │ │ +0008e800: 6520 6120 706f 7365 2028 7468 6520 7472 e a pose (the tr │ │ │ +0008e810: 616e 736c 6174 696f 6e20 616e 6420 7468 anslation and th │ │ │ +0008e820: 6520 726f 7461 7469 6f6e 2074 6861 7420 e rotation that │ │ │ +0008e830: 7472 616e 7366 6f72 6d20 6120 3344 2070 transform a 3D p │ │ │ +0008e840: 6f69 6e74 2065 7870 7265 7373 6564 2069 oint expressed i │ │ │ +0008e850: 6e20 7468 6520 6f62 6a65 6374 2063 6f6f n the object coo │ │ │ +0008e860: 7264 696e 6174 6520 6672 616d 650a 746f rdinate frame.to │ │ │ +0008e870: 2074 6865 2063 616d 6572 6120 636f 6f72 the camera coor │ │ │ +0008e880: 6469 6e61 7465 2066 7261 6d65 2920 6672 dinate frame) fr │ │ │ +0008e890: 6f6d 2061 2033 442d 3244 2070 6f69 6e74 om a 3D-2D point │ │ │ +0008e8a0: 2063 6f72 7265 7370 6f6e 6465 6e63 6573 correspondences │ │ │ +0008e8b0: 2061 6e64 2073 7461 7274 696e 6720 6672 and starting fr │ │ │ +0008e8c0: 6f6d 2061 6e20 696e 6974 6961 6c20 736f om an initial so │ │ │ +0008e8d0: 6c75 7469 6f6e 2e0a 0a53 4545 3a20 5245 lution...SEE: RE │ │ │ +0008e8e0: 463a 2063 616c 6962 3364 5f73 6f6c 7665 F: calib3d_solve │ │ │ +0008e8f0: 506e 503c 2f64 6976 3e0a 3c64 6c20 636c PnP
    .
    .
    Parameters:
    .
    obje │ │ │ +0008e930: 6374 506f 696e 7473 3c2f 636f 6465 3e20 ctPoints │ │ │ +0008e940: 2d20 4172 7261 7920 6f66 206f 626a 6563 - Array of objec │ │ │ +0008e950: 7420 706f 696e 7473 2069 6e20 7468 6520 t points in the │ │ │ +0008e960: 6f62 6a65 6374 2063 6f6f 7264 696e 6174 object coordinat │ │ │ +0008e970: 6520 7370 6163 652c 204e 7833 2031 2d63 e space, Nx3 1-c │ │ │ +0008e980: 6861 6e6e 656c 206f 7220 3178 4e2f 4e78 hannel or 1xN/Nx │ │ │ +0008e990: 3120 332d 6368 616e 6e65 6c2c 0a77 6865 1 3-channel,.whe │ │ │ +0008e9a0: 7265 204e 2069 7320 7468 6520 6e75 6d62 re N is the numb │ │ │ +0008e9b0: 6572 206f 6620 706f 696e 7473 2e20 7665 er of points. ve │ │ │ +0008e9c0: 6374 6f72 266c 743b 506f 696e 7433 6426 ctor<Point3d& │ │ │ +0008e9d0: 6774 3b20 6361 6e20 616c 736f 2062 6520 gt; can also be │ │ │ +0008e9e0: 7061 7373 6564 2068 6572 652e 3c2f 6464 passed here.
    .
    imag │ │ │ +0008ea00: 6550 6f69 6e74 733c 2f63 6f64 653e 202d ePoints - │ │ │ +0008ea10: 2041 7272 6179 206f 6620 636f 7272 6573 Array of corres │ │ │ +0008ea20: 706f 6e64 696e 6720 696d 6167 6520 706f ponding image po │ │ │ +0008ea30: 696e 7473 2c20 4e78 3220 312d 6368 616e ints, Nx2 1-chan │ │ │ +0008ea40: 6e65 6c20 6f72 2031 784e 2f4e 7831 2032 nel or 1xN/Nx1 2 │ │ │ +0008ea50: 2d63 6861 6e6e 656c 2c0a 7768 6572 6520 -channel,.where │ │ │ +0008ea60: 4e20 6973 2074 6865 206e 756d 6265 7220 N is the number │ │ │ +0008ea70: 6f66 2070 6f69 6e74 732e 2076 6563 746f of points. vecto │ │ │ +0008ea80: 7226 6c74 3b50 6f69 6e74 3264 2667 743b r<Point2d> │ │ │ +0008ea90: 2063 616e 2061 6c73 6f20 6265 2070 6173 can also be pas │ │ │ +0008eaa0: 7365 6420 6865 7265 2e3c 2f64 643e 0a3c sed here.
    .< │ │ │ +0008eab0: 6464 3e3c 636f 6465 3e63 616d 6572 614d dd>cameraM │ │ │ +0008eac0: 6174 7269 783c 2f63 6f64 653e 202d 2049 atrix - I │ │ │ +0008ead0: 6e70 7574 2063 616d 6572 6120 696e 7472 nput camera intr │ │ │ +0008eae0: 696e 7369 6320 6d61 7472 6978 205c 285c insic matrix \(\ │ │ │ +0008eaf0: 6361 6d65 7261 6d61 7472 6978 7b41 7d5c cameramatrix{A}\ │ │ │ +0008eb00: 2920 2e3c 2f64 643e 0a3c 6464 3e3c 636f ) ..
    distCoeffs - Input vec │ │ │ +0008eb30: 746f 7220 6f66 2064 6973 746f 7274 696f tor of distortio │ │ │ +0008eb40: 6e20 636f 6566 6669 6369 656e 7473 0a5c n coefficients.\ │ │ │ +0008eb50: 285c 6469 7374 636f 6566 6673 5c29 2e20 (\distcoeffs\). │ │ │ +0008eb60: 4966 2074 6865 2076 6563 746f 7220 6973 If the vector is │ │ │ +0008eb70: 204e 554c 4c2f 656d 7074 792c 2074 6865 NULL/empty, the │ │ │ +0008eb80: 207a 6572 6f20 6469 7374 6f72 7469 6f6e zero distortion │ │ │ +0008eb90: 2063 6f65 6666 6963 6965 6e74 7320 6172 coefficients ar │ │ │ +0008eba0: 650a 6173 7375 6d65 642e 3c2f 6464 3e0a e.assumed.
    . │ │ │ +0008ebb0: 3c64 643e 3c63 6f64 653e 7276 6563 3c2f
    rvec - Input/Ou │ │ │ +0008ebd0: 7470 7574 2072 6f74 6174 696f 6e20 7665 tput rotation ve │ │ │ +0008ebe0: 6374 6f72 2028 7365 6520 5245 463a 2052 ctor (see REF: R │ │ │ +0008ebf0: 6f64 7269 6775 6573 2029 2074 6861 742c odrigues ) that, │ │ │ +0008ec00: 2074 6f67 6574 6865 7220 7769 7468 2074 together with t │ │ │ +0008ec10: 7665 632c 2062 7269 6e67 7320 706f 696e vec, brings poin │ │ │ +0008ec20: 7473 2066 726f 6d0a 7468 6520 6d6f 6465 ts from.the mode │ │ │ +0008ec30: 6c20 636f 6f72 6469 6e61 7465 2073 7973 l coordinate sys │ │ │ +0008ec40: 7465 6d20 746f 2074 6865 2063 616d 6572 tem to the camer │ │ │ +0008ec50: 6120 636f 6f72 6469 6e61 7465 2073 7973 a coordinate sys │ │ │ +0008ec60: 7465 6d2e 2049 6e70 7574 2076 616c 7565 tem. Input value │ │ │ +0008ec70: 7320 6172 6520 7573 6564 2061 7320 616e s are used as an │ │ │ +0008ec80: 2069 6e69 7469 616c 2073 6f6c 7574 696f initial solutio │ │ │ +0008ec90: 6e2e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 n.
    .
    tvec - │ │ │ +0008ecb0: 496e 7075 742f 4f75 7470 7574 2074 7261 Input/Output tra │ │ │ +0008ecc0: 6e73 6c61 7469 6f6e 2076 6563 746f 722e nslation vector. │ │ │ +0008ecd0: 2049 6e70 7574 2076 616c 7565 7320 6172 Input values ar │ │ │ +0008ece0: 6520 7573 6564 2061 7320 616e 2069 6e69 e used as an ini │ │ │ +0008ecf0: 7469 616c 2073 6f6c 7574 696f 6e2e 3c2f tial solution..
    cr │ │ │ +0008ed10: 6974 6572 6961 3c2f 636f 6465 3e20 2d20 iteria - │ │ │ +0008ed20: 4372 6974 6572 6961 2077 6865 6e20 746f Criteria when to │ │ │ +0008ed30: 2073 746f 7020 7468 6520 4c65 7665 6e62 stop the Levenb │ │ │ +0008ed40: 6572 672d 4d61 7271 7561 7264 2069 7465 erg-Marquard ite │ │ │ +0008ed50: 7261 7469 7665 2061 6c67 6f72 6974 686d rative algorithm │ │ │ +0008ed60: 2e0a 6761 696e 2069 6e20 7468 6520 4461 ..gain in the Da │ │ │ +0008ed70: 6d70 6564 2047 6175 7373 2d4e 6577 746f mped Gauss-Newto │ │ │ +0008ed80: 6e20 666f 726d 756c 6174 696f 6e2e 0a0a n formulation... │ │ │ +0008ed90: 5468 6520 6675 6e63 7469 6f6e 2072 6566 The function ref │ │ │ +0008eda0: 696e 6573 2074 6865 206f 626a 6563 7420 ines the object │ │ │ +0008edb0: 706f 7365 2067 6976 656e 2061 7420 6c65 pose given at le │ │ │ +0008edc0: 6173 7420 3320 6f62 6a65 6374 2070 6f69 ast 3 object poi │ │ │ +0008edd0: 6e74 732c 2074 6865 6972 2063 6f72 7265 nts, their corre │ │ │ +0008ede0: 7370 6f6e 6469 6e67 2069 6d61 6765 0a70 sponding image.p │ │ │ +0008edf0: 726f 6a65 6374 696f 6e73 2c20 616e 2069 rojections, an i │ │ │ +0008ee00: 6e69 7469 616c 2073 6f6c 7574 696f 6e20 nitial solution │ │ │ +0008ee10: 666f 7220 7468 6520 726f 7461 7469 6f6e for the rotation │ │ │ +0008ee20: 2061 6e64 2074 7261 6e73 6c61 7469 6f6e and translation │ │ │ +0008ee30: 2076 6563 746f 722c 0a61 7320 7765 6c6c vector,.as well │ │ │ +0008ee40: 2061 7320 7468 6520 6361 6d65 7261 2069 as the camera i │ │ │ +0008ee50: 6e74 7269 6e73 6963 206d 6174 7269 7820 ntrinsic matrix │ │ │ +0008ee60: 616e 6420 7468 6520 6469 7374 6f72 7469 and the distorti │ │ │ +0008ee70: 6f6e 2063 6f65 6666 6963 6965 6e74 732e on coefficients. │ │ │ +0008ee80: 0a54 6865 2066 756e 6374 696f 6e20 6d69 .The function mi │ │ │ +0008ee90: 6e69 6d69 7a65 7320 7468 6520 7072 6f6a nimizes the proj │ │ │ +0008eea0: 6563 7469 6f6e 2065 7272 6f72 2077 6974 ection error wit │ │ │ +0008eeb0: 6820 7265 7370 6563 7420 746f 2074 6865 h respect to the │ │ │ +0008eec0: 2072 6f74 6174 696f 6e20 616e 6420 7468 rotation and th │ │ │ +0008eed0: 6520 7472 616e 736c 6174 696f 6e20 7665 e translation ve │ │ │ +0008eee0: 6374 6f72 732c 2075 7369 6e67 2061 0a76 ctors, using a.v │ │ │ +0008eef0: 6972 7475 616c 2076 6973 7561 6c20 7365 irtual visual se │ │ │ +0008ef00: 7276 6f69 6e67 2028 5656 5329 2043 4954 rvoing (VVS) CIT │ │ │ +0008ef10: 453a 2043 6861 756d 6574 7465 3036 2043 E: Chaumette06 C │ │ │ +0008ef20: 4954 453a 204d 6172 6368 616e 6431 3620 ITE: Marchand16 │ │ │ +0008ef30: 7363 6865 6d65 2e3c 2f64 643e 0a3c 2f64 scheme.
    ..
    .
    .
  • .
  • . │ │ │ +0008ef60: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    sol │ │ │ +0008f010: 7665 506e 5052 6566 696e 6556 5653 3c2f vePnPRefineVVS.
    .
    public │ │ │ +0008f080: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +0008f090: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;vo │ │ │ +0008f0b0: 6964 3c2f 7370 616e 3e26 6e62 7370 3b3c id < │ │ │ +0008f0c0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +0008f0d0: 656e 742d 6e61 6d65 223e 736f 6c76 6550 ent-name">solveP │ │ │ +0008f0e0: 6e50 5265 6669 6e65 5656 533c 2f73 7061 nPRefineVVS │ │ │ +0008f110: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ +0008f150: 3c2f 613e 266e 6273 703b 6f62 6a65 6374  object │ │ │ +0008f160: 506f 696e 7473 2c0a 203c 6120 6872 6566 Points,. Mat&nbs │ │ │ +0008f1b0: 703b 696d 6167 6550 6f69 6e74 732c 0a20 p;imagePoints,. │ │ │ +0008f1c0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +0008f200: 2f61 3e26 6e62 7370 3b63 616d 6572 614d /a> cameraM │ │ │ +0008f210: 6174 7269 782c 0a20 3c61 2068 7265 663d atrix,. Mat  │ │ │ +0008f260: 3b64 6973 7443 6f65 6666 732c 0a20 3c61 ;distCoeffs,. Mat rvec,. Mat tvec)
    .
    Ref │ │ │ +0008f330: 696e 6520 6120 706f 7365 2028 7468 6520 ine a pose (the │ │ │ +0008f340: 7472 616e 736c 6174 696f 6e20 616e 6420 translation and │ │ │ +0008f350: 7468 6520 726f 7461 7469 6f6e 2074 6861 the rotation tha │ │ │ +0008f360: 7420 7472 616e 7366 6f72 6d20 6120 3344 t transform a 3D │ │ │ +0008f370: 2070 6f69 6e74 2065 7870 7265 7373 6564 point expressed │ │ │ +0008f380: 2069 6e20 7468 6520 6f62 6a65 6374 2063 in the object c │ │ │ +0008f390: 6f6f 7264 696e 6174 6520 6672 616d 650a oordinate frame. │ │ │ +0008f3a0: 746f 2074 6865 2063 616d 6572 6120 636f to the camera co │ │ │ +0008f3b0: 6f72 6469 6e61 7465 2066 7261 6d65 2920 ordinate frame) │ │ │ +0008f3c0: 6672 6f6d 2061 2033 442d 3244 2070 6f69 from a 3D-2D poi │ │ │ +0008f3d0: 6e74 2063 6f72 7265 7370 6f6e 6465 6e63 nt correspondenc │ │ │ +0008f3e0: 6573 2061 6e64 2073 7461 7274 696e 6720 es and starting │ │ │ +0008f3f0: 6672 6f6d 2061 6e20 696e 6974 6961 6c20 from an initial │ │ │ +0008f400: 736f 6c75 7469 6f6e 2e0a 0a53 4545 3a20 solution...SEE: │ │ │ +0008f410: 5245 463a 2063 616c 6962 3364 5f73 6f6c REF: calib3d_sol │ │ │ +0008f420: 7665 506e 503c 2f64 6976 3e0a 3c64 6c20 vePnP
    .
    .< │ │ │ +0008f440: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    ob │ │ │ +0008f460: 6a65 6374 506f 696e 7473 3c2f 636f 6465 jectPoints - Array of obj │ │ │ +0008f480: 6563 7420 706f 696e 7473 2069 6e20 7468 ect points in th │ │ │ +0008f490: 6520 6f62 6a65 6374 2063 6f6f 7264 696e e object coordin │ │ │ +0008f4a0: 6174 6520 7370 6163 652c 204e 7833 2031 ate space, Nx3 1 │ │ │ +0008f4b0: 2d63 6861 6e6e 656c 206f 7220 3178 4e2f -channel or 1xN/ │ │ │ +0008f4c0: 4e78 3120 332d 6368 616e 6e65 6c2c 0a77 Nx1 3-channel,.w │ │ │ +0008f4d0: 6865 7265 204e 2069 7320 7468 6520 6e75 here N is the nu │ │ │ +0008f4e0: 6d62 6572 206f 6620 706f 696e 7473 2e20 mber of points. │ │ │ +0008f4f0: 7665 6374 6f72 266c 743b 506f 696e 7433 vector<Point3 │ │ │ +0008f500: 6426 6774 3b20 6361 6e20 616c 736f 2062 d> can also b │ │ │ +0008f510: 6520 7061 7373 6564 2068 6572 652e 3c2f e passed here..
    im │ │ │ +0008f530: 6167 6550 6f69 6e74 733c 2f63 6f64 653e agePoints │ │ │ +0008f540: 202d 2041 7272 6179 206f 6620 636f 7272 - Array of corr │ │ │ +0008f550: 6573 706f 6e64 696e 6720 696d 6167 6520 esponding image │ │ │ +0008f560: 706f 696e 7473 2c20 4e78 3220 312d 6368 points, Nx2 1-ch │ │ │ +0008f570: 616e 6e65 6c20 6f72 2031 784e 2f4e 7831 annel or 1xN/Nx1 │ │ │ +0008f580: 2032 2d63 6861 6e6e 656c 2c0a 7768 6572 2-channel,.wher │ │ │ +0008f590: 6520 4e20 6973 2074 6865 206e 756d 6265 e N is the numbe │ │ │ +0008f5a0: 7220 6f66 2070 6f69 6e74 732e 2076 6563 r of points. vec │ │ │ +0008f5b0: 746f 7226 6c74 3b50 6f69 6e74 3264 2667 tor<Point2d&g │ │ │ +0008f5c0: 743b 2063 616e 2061 6c73 6f20 6265 2070 t; can also be p │ │ │ +0008f5d0: 6173 7365 6420 6865 7265 2e3c 2f64 643e assed here.
    │ │ │ +0008f5e0: 0a3c 6464 3e3c 636f 6465 3e63 616d 6572 .
    camer │ │ │ +0008f5f0: 614d 6174 7269 783c 2f63 6f64 653e 202d aMatrix - │ │ │ +0008f600: 2049 6e70 7574 2063 616d 6572 6120 696e Input camera in │ │ │ +0008f610: 7472 696e 7369 6320 6d61 7472 6978 205c trinsic matrix \ │ │ │ +0008f620: 285c 6361 6d65 7261 6d61 7472 6978 7b41 (\cameramatrix{A │ │ │ +0008f630: 7d5c 2920 2e3c 2f64 643e 0a3c 6464 3e3c }\) .
    .
    < │ │ │ +0008f640: 636f 6465 3e64 6973 7443 6f65 6666 733c code>distCoeffs< │ │ │ +0008f650: 2f63 6f64 653e 202d 2049 6e70 7574 2076 /code> - Input v │ │ │ +0008f660: 6563 746f 7220 6f66 2064 6973 746f 7274 ector of distort │ │ │ +0008f670: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ +0008f680: 0a5c 285c 6469 7374 636f 6566 6673 5c29 .\(\distcoeffs\) │ │ │ +0008f690: 2e20 4966 2074 6865 2076 6563 746f 7220 . If the vector │ │ │ +0008f6a0: 6973 204e 554c 4c2f 656d 7074 792c 2074 is NULL/empty, t │ │ │ +0008f6b0: 6865 207a 6572 6f20 6469 7374 6f72 7469 he zero distorti │ │ │ +0008f6c0: 6f6e 2063 6f65 6666 6963 6965 6e74 7320 on coefficients │ │ │ +0008f6d0: 6172 650a 6173 7375 6d65 642e 3c2f 6464 are.assumed.
    .
    rvec │ │ │ +0008f6f0: 3c2f 636f 6465 3e20 2d20 496e 7075 742f - Input/ │ │ │ +0008f700: 4f75 7470 7574 2072 6f74 6174 696f 6e20 Output rotation │ │ │ +0008f710: 7665 6374 6f72 2028 7365 6520 5245 463a vector (see REF: │ │ │ +0008f720: 2052 6f64 7269 6775 6573 2029 2074 6861 Rodrigues ) tha │ │ │ +0008f730: 742c 2074 6f67 6574 6865 7220 7769 7468 t, together with │ │ │ +0008f740: 2074 7665 632c 2062 7269 6e67 7320 706f tvec, brings po │ │ │ +0008f750: 696e 7473 2066 726f 6d0a 7468 6520 6d6f ints from.the mo │ │ │ +0008f760: 6465 6c20 636f 6f72 6469 6e61 7465 2073 del coordinate s │ │ │ +0008f770: 7973 7465 6d20 746f 2074 6865 2063 616d ystem to the cam │ │ │ +0008f780: 6572 6120 636f 6f72 6469 6e61 7465 2073 era coordinate s │ │ │ +0008f790: 7973 7465 6d2e 2049 6e70 7574 2076 616c ystem. Input val │ │ │ +0008f7a0: 7565 7320 6172 6520 7573 6564 2061 7320 ues are used as │ │ │ +0008f7b0: 616e 2069 6e69 7469 616c 2073 6f6c 7574 an initial solut │ │ │ +0008f7c0: 696f 6e2e 3c2f 6464 3e0a 3c64 643e 3c63 ion.
    .
    tvec │ │ │ +0008f7e0: 2d20 496e 7075 742f 4f75 7470 7574 2074 - Input/Output t │ │ │ +0008f7f0: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ +0008f800: 722e 2049 6e70 7574 2076 616c 7565 7320 r. Input values │ │ │ +0008f810: 6172 6520 7573 6564 2061 7320 616e 2069 are used as an i │ │ │ +0008f820: 6e69 7469 616c 2073 6f6c 7574 696f 6e2e nitial solution. │ │ │ +0008f830: 0a67 6169 6e20 696e 2074 6865 2044 616d .gain in the Dam │ │ │ +0008f840: 7065 6420 4761 7573 732d 4e65 7774 6f6e ped Gauss-Newton │ │ │ +0008f850: 2066 6f72 6d75 6c61 7469 6f6e 2e0a 0a54 formulation...T │ │ │ +0008f860: 6865 2066 756e 6374 696f 6e20 7265 6669 he function refi │ │ │ +0008f870: 6e65 7320 7468 6520 6f62 6a65 6374 2070 nes the object p │ │ │ +0008f880: 6f73 6520 6769 7665 6e20 6174 206c 6561 ose given at lea │ │ │ +0008f890: 7374 2033 206f 626a 6563 7420 706f 696e st 3 object poin │ │ │ +0008f8a0: 7473 2c20 7468 6569 7220 636f 7272 6573 ts, their corres │ │ │ +0008f8b0: 706f 6e64 696e 6720 696d 6167 650a 7072 ponding image.pr │ │ │ +0008f8c0: 6f6a 6563 7469 6f6e 732c 2061 6e20 696e ojections, an in │ │ │ +0008f8d0: 6974 6961 6c20 736f 6c75 7469 6f6e 2066 itial solution f │ │ │ +0008f8e0: 6f72 2074 6865 2072 6f74 6174 696f 6e20 or the rotation │ │ │ +0008f8f0: 616e 6420 7472 616e 736c 6174 696f 6e20 and translation │ │ │ +0008f900: 7665 6374 6f72 2c0a 6173 2077 656c 6c20 vector,.as well │ │ │ +0008f910: 6173 2074 6865 2063 616d 6572 6120 696e as the camera in │ │ │ +0008f920: 7472 696e 7369 6320 6d61 7472 6978 2061 trinsic matrix a │ │ │ +0008f930: 6e64 2074 6865 2064 6973 746f 7274 696f nd the distortio │ │ │ +0008f940: 6e20 636f 6566 6669 6369 656e 7473 2e0a n coefficients.. │ │ │ +0008f950: 5468 6520 6675 6e63 7469 6f6e 206d 696e The function min │ │ │ +0008f960: 696d 697a 6573 2074 6865 2070 726f 6a65 imizes the proje │ │ │ +0008f970: 6374 696f 6e20 6572 726f 7220 7769 7468 ction error with │ │ │ +0008f980: 2072 6573 7065 6374 2074 6f20 7468 6520 respect to the │ │ │ +0008f990: 726f 7461 7469 6f6e 2061 6e64 2074 6865 rotation and the │ │ │ +0008f9a0: 2074 7261 6e73 6c61 7469 6f6e 2076 6563 translation vec │ │ │ +0008f9b0: 746f 7273 2c20 7573 696e 6720 610a 7669 tors, using a.vi │ │ │ +0008f9c0: 7274 7561 6c20 7669 7375 616c 2073 6572 rtual visual ser │ │ │ +0008f9d0: 766f 696e 6720 2856 5653 2920 4349 5445 voing (VVS) CITE │ │ │ +0008f9e0: 3a20 4368 6175 6d65 7474 6530 3620 4349 : Chaumette06 CI │ │ │ +0008f9f0: 5445 3a20 4d61 7263 6861 6e64 3136 2073 TE: Marchand16 s │ │ │ +0008fa00: 6368 656d 652e 3c2f 6464 3e0a 3c2f 646c cheme.
    .
    .
    ..

  • .
  • .< │ │ │ +0008fa30: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +0008fa40: 6574 6169 6c22 2069 643d 2273 6f6c 7665 etail" id="solve │ │ │ +0008fa50: 506e 5047 656e 6572 6963 286f 7267 2e6f PnPGeneric(org.o │ │ │ +0008fa60: 7065 6e63 762e 636f 7265 2e4d 6174 2c6f pencv.core.Mat,o │ │ │ +0008fa70: 7267 2e6f 7065 6e63 762e 636f 7265 2e4d rg.opencv.core.M │ │ │ +0008fa80: 6174 2c6f 7267 2e6f 7065 6e63 762e 636f at,org.opencv.co │ │ │ +0008fa90: 7265 2e4d 6174 2c6f 7267 2e6f 7065 6e63 re.Mat,org.openc │ │ │ +0008faa0: 762e 636f 7265 2e4d 6174 2c6a 6176 612e v.core.Mat,java. │ │ │ +0008fab0: 7574 696c 2e4c 6973 742c 6a61 7661 2e75 util.List,java.u │ │ │ +0008fac0: 7469 6c2e 4c69 7374 2c62 6f6f 6c65 616e til.List,boolean │ │ │ +0008fad0: 2c69 6e74 2c6f 7267 2e6f 7065 6e63 762e ,int,org.opencv. │ │ │ +0008fae0: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ +0008faf0: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ +0008fb00: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ +0008fb10: 2922 3e0a 3c68 333e 736f 6c76 6550 6e50 )">.

    solvePnP │ │ │ +0008fb20: 4765 6e65 7269 633c 2f68 333e 0a3c 6469 Generic

    ..public static │ │ │ +0008fb90: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  int solvePnPGeneri │ │ │ +0008fbf0: 633c 2f73 7061 6e3e 3c77 6272 3e3c 7370 c(Mat  │ │ │ +0008fc60: 6f62 6a65 6374 506f 696e 7473 2c0a 203c objectPoints,. < │ │ │ +0008fc70: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0008fc80: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0008fc90: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0008fca0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat imagePoi │ │ │ +0008fcc0: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. Mat c │ │ │ +0008fd10: 616d 6572 614d 6174 7269 782c 0a20 3c61 ameraMatrix,. Mat distCoeff │ │ │ +0008fd70: 732c 0a20 3c61 2068 7265 663d 2268 7474 s,. Lis │ │ │ +0008fe10: 743c 2f61 3e26 6c74 3b3c 6120 6872 6566 t<Mat> │ │ │ +0008fe60: 266e 6273 703b 7276 6563 732c 0a20 3c61  rvecs,. List& │ │ │ +0008ff10: 6c74 3b3c 6120 6872 6566 3d22 2e2e 2f63 lt;M │ │ │ +0008ff50: 6174 3c2f 613e 2667 743b 266e 6273 703b at>  │ │ │ +0008ff60: 7476 6563 732c 0a20 626f 6f6c 6561 6e26 tvecs,. boolean& │ │ │ +0008ff70: 6e62 7370 3b75 7365 4578 7472 696e 7369 nbsp;useExtrinsi │ │ │ +0008ff80: 6347 7565 7373 2c0a 2069 6e74 266e 6273 cGuess,. int&nbs │ │ │ +0008ff90: 703b 666c 6167 732c 0a20 3c61 2068 7265 p;flags,. Mat&nb │ │ │ +0008ffe0: 7370 3b72 7665 632c 0a20 3c61 2068 7265 sp;rvec,. Mat&nb │ │ │ +00090030: 7370 3b74 7665 632c 0a20 3c61 2068 7265 sp;tvec,. Mat&nb │ │ │ +00090080: 7370 3b72 6570 726f 6a65 6374 696f 6e45 sp;reprojectionE │ │ │ +00090090: 7272 6f72 293c 2f73 7061 6e3e 3c2f 6469 rror).
    Finds an o │ │ │ +000900c0: 626a 6563 7420 706f 7365 205c 2820 7b7d bject pose \( {} │ │ │ +000900d0: 5e7b 637d 5c6d 6174 6862 667b 547d 5f6f ^{c}\mathbf{T}_o │ │ │ +000900e0: 205c 2920 6672 6f6d 2033 442d 3244 2070 \) from 3D-2D p │ │ │ +000900f0: 6f69 6e74 2063 6f72 7265 7370 6f6e 6465 oint corresponde │ │ │ +00090100: 6e63 6573 2e0a 0a21 5b50 6572 7370 6563 nces...![Perspec │ │ │ +00090110: 7469 7665 2070 726f 6a65 6374 696f 6e2c tive projection, │ │ │ +00090120: 2066 726f 6d20 6f62 6a65 6374 2074 6f20 from object to │ │ │ +00090130: 6361 6d65 7261 2066 7261 6d65 5d28 7069 camera frame](pi │ │ │ +00090140: 6373 2f70 696e 686f 6c65 5f68 6f6d 6f67 cs/pinhole_homog │ │ │ +00090150: 656e 656f 7573 5f74 7261 6e73 666f 726d eneous_transform │ │ │ +00090160: 6174 696f 6e2e 6a70 6729 7b20 7769 6474 ation.jpg){ widt │ │ │ +00090170: 683d 3530 2520 7d0a 0a53 4545 3a20 5245 h=50% }..SEE: RE │ │ │ +00090180: 463a 2063 616c 6962 3364 5f73 6f6c 7665 F: calib3d_solve │ │ │ +00090190: 506e 500a 0a54 6869 7320 6675 6e63 7469 PnP..This functi │ │ │ +000901a0: 6f6e 2072 6574 7572 6e73 2061 206c 6973 on returns a lis │ │ │ +000901b0: 7420 6f66 2061 6c6c 2074 6865 2070 6f73 t of all the pos │ │ │ +000901c0: 7369 626c 6520 736f 6c75 7469 6f6e 7320 sible solutions │ │ │ +000901d0: 2861 2073 6f6c 7574 696f 6e20 6973 2061 (a solution is a │ │ │ +000901e0: 2026 6c74 3b72 6f74 6174 696f 6e20 7665 <rotation ve │ │ │ +000901f0: 6374 6f72 2c20 7472 616e 736c 6174 696f ctor, translatio │ │ │ +00090200: 6e20 7665 6374 6f72 2667 743b 0a63 6f75 n vector>.cou │ │ │ +00090210: 706c 6529 2c20 6465 7065 6e64 696e 6720 ple), depending │ │ │ +00090220: 6f6e 2074 6865 206e 756d 6265 7220 6f66 on the number of │ │ │ +00090230: 2069 6e70 7574 2070 6f69 6e74 7320 616e input points an │ │ │ +00090240: 6420 7468 6520 6368 6f73 656e 206d 6574 d the chosen met │ │ │ +00090250: 686f 643a 0a3c 756c 3e0a 2020 3c6c 693e hod:.
      .
    • │ │ │ +00090260: 0a20 5033 5020 6d65 7468 6f64 7320 2852 . P3P methods (R │ │ │ +00090270: 4546 3a20 534f 4c56 4550 4e50 5f50 3350 EF: SOLVEPNP_P3P │ │ │ +00090280: 2c20 5245 463a 2053 4f4c 5645 504e 505f , REF: SOLVEPNP_ │ │ │ +00090290: 4150 3350 293a 2033 206f 7220 3420 696e AP3P): 3 or 4 in │ │ │ +000902a0: 7075 7420 706f 696e 7473 2e20 4e75 6d62 put points. Numb │ │ │ +000902b0: 6572 206f 6620 7265 7475 726e 6564 2073 er of returned s │ │ │ +000902c0: 6f6c 7574 696f 6e73 2063 616e 2062 6520 olutions can be │ │ │ +000902d0: 6265 7477 6565 6e20 3020 616e 6420 3420 between 0 and 4 │ │ │ +000902e0: 7769 7468 2033 2069 6e70 7574 2070 6f69 with 3 input poi │ │ │ +000902f0: 6e74 732e 0a20 203c 2f6c 693e 0a20 203c nts..
    • . < │ │ │ +00090300: 6c69 3e0a 2052 4546 3a20 534f 4c56 4550 li>. REF: SOLVEP │ │ │ +00090310: 4e50 5f49 5050 4520 496e 7075 7420 706f NP_IPPE Input po │ │ │ +00090320: 696e 7473 206d 7573 7420 6265 2026 6774 ints must be > │ │ │ +00090330: 3b3d 2034 2061 6e64 206f 626a 6563 7420 ;= 4 and object │ │ │ +00090340: 706f 696e 7473 206d 7573 7420 6265 2063 points must be c │ │ │ +00090350: 6f70 6c61 6e61 722e 2052 6574 7572 6e73 oplanar. Returns │ │ │ +00090360: 2032 2073 6f6c 7574 696f 6e73 2e0a 2020 2 solutions.. │ │ │ +00090370: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 5245 .
    • . RE │ │ │ +00090380: 463a 2053 4f4c 5645 504e 505f 4950 5045 F: SOLVEPNP_IPPE │ │ │ +00090390: 5f53 5155 4152 4520 5370 6563 6961 6c20 _SQUARE Special │ │ │ +000903a0: 6361 7365 2073 7569 7461 626c 6520 666f case suitable fo │ │ │ +000903b0: 7220 6d61 726b 6572 2070 6f73 6520 6573 r marker pose es │ │ │ +000903c0: 7469 6d61 7469 6f6e 2e0a 4e75 6d62 6572 timation..Number │ │ │ +000903d0: 206f 6620 696e 7075 7420 706f 696e 7473 of input points │ │ │ +000903e0: 206d 7573 7420 6265 2034 2061 6e64 2032 must be 4 and 2 │ │ │ +000903f0: 2073 6f6c 7574 696f 6e73 2061 7265 2072 solutions are r │ │ │ +00090400: 6574 7572 6e65 642e 204f 626a 6563 7420 eturned. Object │ │ │ +00090410: 706f 696e 7473 206d 7573 7420 6265 2064 points must be d │ │ │ +00090420: 6566 696e 6564 2069 6e20 7468 6520 666f efined in the fo │ │ │ +00090430: 6c6c 6f77 696e 6720 6f72 6465 723a 0a20 llowing order:. │ │ │ +00090440: 203c 756c 3e0a 2020 2020 3c6c 693e 0a20
        .
      • . │ │ │ +00090450: 2020 706f 696e 7420 303a 205b 2d73 7175 point 0: [-squ │ │ │ +00090460: 6172 654c 656e 6774 6820 2f20 322c 2020 areLength / 2, │ │ │ +00090470: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ +00090480: 2c20 305d 0a20 2020 203c 2f6c 693e 0a20 , 0].
      • . │ │ │ +00090490: 2020 203c 6c69 3e0a 2020 2070 6f69 6e74
      • . point │ │ │ +000904a0: 2031 3a20 5b20 7371 7561 7265 4c65 6e67 1: [ squareLeng │ │ │ +000904b0: 7468 202f 2032 2c20 2073 7175 6172 654c th / 2, squareL │ │ │ +000904c0: 656e 6774 6820 2f20 322c 2030 5d0a 2020 ength / 2, 0]. │ │ │ +000904d0: 2020 3c2f 6c69 3e0a 2020 2020 3c6c 693e
      • .
      • │ │ │ +000904e0: 0a20 2020 706f 696e 7420 323a 205b 2073 . point 2: [ s │ │ │ +000904f0: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ +00090500: 202d 7371 7561 7265 4c65 6e67 7468 202f -squareLength / │ │ │ +00090510: 2032 2c20 305d 0a20 2020 203c 2f6c 693e 2, 0].
      • │ │ │ +00090520: 0a20 2020 203c 6c69 3e0a 2020 2070 6f69 .
      • . poi │ │ │ +00090530: 6e74 2033 3a20 5b2d 7371 7561 7265 4c65 nt 3: [-squareLe │ │ │ +00090540: 6e67 7468 202f 2032 2c20 2d73 7175 6172 ngth / 2, -squar │ │ │ +00090550: 654c 656e 6774 6820 2f20 322c 2030 5d0a eLength / 2, 0]. │ │ │ +00090560: 2020 2020 3c2f 6c69 3e0a 2020 3c2f 756c
      • .
      .
    • . for al │ │ │ +00090580: 6c20 7468 6520 6f74 6865 7220 666c 6167 l the other flag │ │ │ +00090590: 732c 206e 756d 6265 7220 6f66 2069 6e70 s, number of inp │ │ │ +000905a0: 7574 2070 6f69 6e74 7320 6d75 7374 2062 ut points must b │ │ │ +000905b0: 6520 2667 743b 3d20 3420 616e 6420 6f62 e >= 4 and ob │ │ │ +000905c0: 6a65 6374 2070 6f69 6e74 7320 6361 6e20 ject points can │ │ │ +000905d0: 6265 2069 6e20 616e 7920 636f 6e66 6967 be in any config │ │ │ +000905e0: 7572 6174 696f 6e2e 0a4f 6e6c 7920 3120 uration..Only 1 │ │ │ +000905f0: 736f 6c75 7469 6f6e 2069 7320 7265 7475 solution is retu │ │ │ +00090600: 726e 6564 2e0a 2020 3c2f 6c69 3e0a 3c2f rned..
    • .
    .
    .
    Parameters:
    .
    obje │ │ │ +00090650: 6374 506f 696e 7473 3c2f 636f 6465 3e20 ctPoints │ │ │ +00090660: 2d20 4172 7261 7920 6f66 206f 626a 6563 - Array of objec │ │ │ +00090670: 7420 706f 696e 7473 2069 6e20 7468 6520 t points in the │ │ │ +00090680: 6f62 6a65 6374 2063 6f6f 7264 696e 6174 object coordinat │ │ │ +00090690: 6520 7370 6163 652c 204e 7833 2031 2d63 e space, Nx3 1-c │ │ │ +000906a0: 6861 6e6e 656c 206f 720a 3178 4e2f 4e78 hannel or.1xN/Nx │ │ │ +000906b0: 3120 332d 6368 616e 6e65 6c2c 2077 6865 1 3-channel, whe │ │ │ +000906c0: 7265 204e 2069 7320 7468 6520 6e75 6d62 re N is the numb │ │ │ +000906d0: 6572 206f 6620 706f 696e 7473 2e20 7665 er of points. ve │ │ │ +000906e0: 6374 6f72 266c 743b 506f 696e 7433 6426 ctor<Point3d& │ │ │ +000906f0: 6774 3b20 6361 6e20 6265 2061 6c73 6f20 gt; can be also │ │ │ +00090700: 7061 7373 6564 2068 6572 652e 3c2f 6464 passed here.
    .
    imag │ │ │ +00090720: 6550 6f69 6e74 733c 2f63 6f64 653e 202d ePoints - │ │ │ +00090730: 2041 7272 6179 206f 6620 636f 7272 6573 Array of corres │ │ │ +00090740: 706f 6e64 696e 6720 696d 6167 6520 706f ponding image po │ │ │ +00090750: 696e 7473 2c20 4e78 3220 312d 6368 616e ints, Nx2 1-chan │ │ │ +00090760: 6e65 6c20 6f72 2031 784e 2f4e 7831 2032 nel or 1xN/Nx1 2 │ │ │ +00090770: 2d63 6861 6e6e 656c 2c0a 7768 6572 6520 -channel,.where │ │ │ +00090780: 4e20 6973 2074 6865 206e 756d 6265 7220 N is the number │ │ │ +00090790: 6f66 2070 6f69 6e74 732e 2076 6563 746f of points. vecto │ │ │ +000907a0: 7226 6c74 3b50 6f69 6e74 3264 2667 743b r<Point2d> │ │ │ +000907b0: 2063 616e 2062 6520 616c 736f 2070 6173 can be also pas │ │ │ +000907c0: 7365 6420 6865 7265 2e3c 2f64 643e 0a3c sed here.
    .< │ │ │ +000907d0: 6464 3e3c 636f 6465 3e63 616d 6572 614d dd>cameraM │ │ │ +000907e0: 6174 7269 783c 2f63 6f64 653e 202d 2049 atrix - I │ │ │ +000907f0: 6e70 7574 2063 616d 6572 6120 696e 7472 nput camera intr │ │ │ +00090800: 696e 7369 6320 6d61 7472 6978 205c 285c insic matrix \(\ │ │ │ +00090810: 6361 6d65 7261 6d61 7472 6978 7b41 7d5c cameramatrix{A}\ │ │ │ +00090820: 2920 2e3c 2f64 643e 0a3c 6464 3e3c 636f ) ..
    distCoeffs - Input vec │ │ │ +00090850: 746f 7220 6f66 2064 6973 746f 7274 696f tor of distortio │ │ │ +00090860: 6e20 636f 6566 6669 6369 656e 7473 0a5c n coefficients.\ │ │ │ +00090870: 285c 6469 7374 636f 6566 6673 5c29 2e20 (\distcoeffs\). │ │ │ +00090880: 4966 2074 6865 2076 6563 746f 7220 6973 If the vector is │ │ │ +00090890: 204e 554c 4c2f 656d 7074 792c 2074 6865 NULL/empty, the │ │ │ +000908a0: 207a 6572 6f20 6469 7374 6f72 7469 6f6e zero distortion │ │ │ +000908b0: 2063 6f65 6666 6963 6965 6e74 7320 6172 coefficients ar │ │ │ +000908c0: 650a 6173 7375 6d65 642e 3c2f 6464 3e0a e.assumed.
    . │ │ │ +000908d0: 3c64 643e 3c63 6f64 653e 7276 6563 733c
    rvecs< │ │ │ +000908e0: 2f63 6f64 653e 202d 2056 6563 746f 7220 /code> - Vector │ │ │ +000908f0: 6f66 206f 7574 7075 7420 726f 7461 7469 of output rotati │ │ │ +00090900: 6f6e 2076 6563 746f 7273 2028 7365 6520 on vectors (see │ │ │ +00090910: 5245 463a 2052 6f64 7269 6775 6573 2029 REF: Rodrigues ) │ │ │ +00090920: 2074 6861 742c 2074 6f67 6574 6865 7220 that, together │ │ │ +00090930: 7769 7468 2074 7665 6373 2c20 6272 696e with tvecs, brin │ │ │ +00090940: 6773 2070 6f69 6e74 7320 6672 6f6d 0a74 gs points from.t │ │ │ +00090950: 6865 206d 6f64 656c 2063 6f6f 7264 696e he model coordin │ │ │ +00090960: 6174 6520 7379 7374 656d 2074 6f20 7468 ate system to th │ │ │ +00090970: 6520 6361 6d65 7261 2063 6f6f 7264 696e e camera coordin │ │ │ +00090980: 6174 6520 7379 7374 656d 2e3c 2f64 643e ate system.
    │ │ │ +00090990: 0a3c 6464 3e3c 636f 6465 3e74 7665 6373 .
    tvecs │ │ │ +000909a0: 3c2f 636f 6465 3e20 2d20 5665 6374 6f72 - Vector │ │ │ +000909b0: 206f 6620 6f75 7470 7574 2074 7261 6e73 of output trans │ │ │ +000909c0: 6c61 7469 6f6e 2076 6563 746f 7273 2e3c lation vectors.< │ │ │ +000909d0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e75 /dd>.
    u │ │ │ +000909e0: 7365 4578 7472 696e 7369 6347 7565 7373 seExtrinsicGuess │ │ │ +000909f0: 3c2f 636f 6465 3e20 2d20 5061 7261 6d65 - Parame │ │ │ +00090a00: 7465 7220 7573 6564 2066 6f72 2023 534f ter used for #SO │ │ │ +00090a10: 4c56 4550 4e50 5f49 5445 5241 5449 5645 LVEPNP_ITERATIVE │ │ │ +00090a20: 2e20 4966 2074 7275 6520 2831 292c 2074 . If true (1), t │ │ │ +00090a30: 6865 2066 756e 6374 696f 6e20 7573 6573 he function uses │ │ │ +00090a40: 0a74 6865 2070 726f 7669 6465 6420 7276 .the provided rv │ │ │ +00090a50: 6563 2061 6e64 2074 7665 6320 7661 6c75 ec and tvec valu │ │ │ +00090a60: 6573 2061 7320 696e 6974 6961 6c20 6170 es as initial ap │ │ │ +00090a70: 7072 6f78 696d 6174 696f 6e73 206f 6620 proximations of │ │ │ +00090a80: 7468 6520 726f 7461 7469 6f6e 2061 6e64 the rotation and │ │ │ +00090a90: 2074 7261 6e73 6c61 7469 6f6e 0a76 6563 translation.vec │ │ │ +00090aa0: 746f 7273 2c20 7265 7370 6563 7469 7665 tors, respective │ │ │ +00090ab0: 6c79 2c20 616e 6420 6675 7274 6865 7220 ly, and further │ │ │ +00090ac0: 6f70 7469 6d69 7a65 7320 7468 656d 2e3c optimizes them.< │ │ │ +00090ad0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e66 /dd>.
    f │ │ │ +00090ae0: 6c61 6773 3c2f 636f 6465 3e20 2d20 4d65 lags - Me │ │ │ +00090af0: 7468 6f64 2066 6f72 2073 6f6c 7669 6e67 thod for solving │ │ │ +00090b00: 2061 2050 6e50 2070 726f 626c 656d 3a20 a PnP problem: │ │ │ +00090b10: 7365 6520 5245 463a 2063 616c 6962 3364 see REF: calib3d │ │ │ +00090b20: 5f73 6f6c 7665 506e 505f 666c 6167 733c _solvePnP_flags< │ │ │ +00090b30: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e72 /dd>.
    r │ │ │ +00090b40: 7665 633c 2f63 6f64 653e 202d 2052 6f74 vec - Rot │ │ │ +00090b50: 6174 696f 6e20 7665 6374 6f72 2075 7365 ation vector use │ │ │ +00090b60: 6420 746f 2069 6e69 7469 616c 697a 6520 d to initialize │ │ │ +00090b70: 616e 2069 7465 7261 7469 7665 2050 6e50 an iterative PnP │ │ │ +00090b80: 2072 6566 696e 656d 656e 7420 616c 676f refinement algo │ │ │ +00090b90: 7269 7468 6d2c 2077 6865 6e20 666c 6167 rithm, when flag │ │ │ +00090ba0: 2069 7320 5245 463a 2053 4f4c 5645 504e is REF: SOLVEPN │ │ │ +00090bb0: 505f 4954 4552 4154 4956 450a 616e 6420 P_ITERATIVE.and │ │ │ +00090bc0: 7573 6545 7874 7269 6e73 6963 4775 6573 useExtrinsicGues │ │ │ +00090bd0: 7320 6973 2073 6574 2074 6f20 7472 7565 s is set to true │ │ │ +00090be0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    tvec - T │ │ │ +00090c00: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ +00090c10: 7220 7573 6564 2074 6f20 696e 6974 6961 r used to initia │ │ │ +00090c20: 6c69 7a65 2061 6e20 6974 6572 6174 6976 lize an iterativ │ │ │ +00090c30: 6520 506e 5020 7265 6669 6e65 6d65 6e74 e PnP refinement │ │ │ +00090c40: 2061 6c67 6f72 6974 686d 2c20 7768 656e algorithm, when │ │ │ +00090c50: 2066 6c61 6720 6973 2052 4546 3a20 534f flag is REF: SO │ │ │ +00090c60: 4c56 4550 4e50 5f49 5445 5241 5449 5645 LVEPNP_ITERATIVE │ │ │ +00090c70: 0a61 6e64 2075 7365 4578 7472 696e 7369 .and useExtrinsi │ │ │ +00090c80: 6347 7565 7373 2069 7320 7365 7420 746f cGuess is set to │ │ │ +00090c90: 2074 7275 652e 3c2f 6464 3e0a 3c64 643e true.
    .
    │ │ │ +00090ca0: 3c63 6f64 653e 7265 7072 6f6a 6563 7469 reprojecti │ │ │ +00090cb0: 6f6e 4572 726f 723c 2f63 6f64 653e 202d onError - │ │ │ +00090cc0: 204f 7074 696f 6e61 6c20 7665 6374 6f72 Optional vector │ │ │ +00090cd0: 206f 6620 7265 7072 6f6a 6563 7469 6f6e of reprojection │ │ │ +00090ce0: 2065 7272 6f72 2c20 7468 6174 2069 7320 error, that is │ │ │ +00090cf0: 7468 6520 524d 5320 6572 726f 720a 285c the RMS error.(\ │ │ │ +00090d00: 2820 5c74 6578 747b 524d 5345 7d20 3d20 ( \text{RMSE} = │ │ │ +00090d10: 5c73 7172 747b 5c66 7261 637b 5c73 756d \sqrt{\frac{\sum │ │ │ +00090d20: 5f7b 697d 5e7b 4e7d 205c 6c65 6674 2028 _{i}^{N} \left ( │ │ │ +00090d30: 205c 6861 747b 795f 697d 202d 2079 5f69 \hat{y_i} - y_i │ │ │ +00090d40: 205c 7269 6768 7420 295e 327d 7b4e 7d7d \right )^2}{N}} │ │ │ +00090d50: 205c 2929 2062 6574 7765 656e 2074 6865 \)) between the │ │ │ +00090d60: 2069 6e70 7574 2069 6d61 6765 2070 6f69 input image poi │ │ │ +00090d70: 6e74 730a 616e 6420 7468 6520 3344 206f nts.and the 3D o │ │ │ +00090d80: 626a 6563 7420 706f 696e 7473 2070 726f bject points pro │ │ │ +00090d90: 6a65 6374 6564 2077 6974 6820 7468 6520 jected with the │ │ │ +00090da0: 6573 7469 6d61 7465 6420 706f 7365 2e0a estimated pose.. │ │ │ +00090db0: 0a4d 6f72 6520 696e 666f 726d 6174 696f .More informatio │ │ │ +00090dc0: 6e20 6973 2064 6573 6372 6962 6564 2069 n is described i │ │ │ +00090dd0: 6e20 5245 463a 2063 616c 6962 3364 5f73 n REF: calib3d_s │ │ │ +00090de0: 6f6c 7665 506e 500a 0a3c 623e 4e6f 7465 olvePnP..Note │ │ │ +00090df0: 3a3c 2f62 3e0a 3c75 6c3e 0a20 203c 6c69 :.
      .
    • . An examp │ │ │ +00090e10: 6c65 206f 6620 686f 7720 746f 2075 7365 le of how to use │ │ │ +00090e20: 2073 6f6c 7665 506e 5020 666f 7220 706c solvePnP for pl │ │ │ +00090e30: 616e 6172 2061 7567 6d65 6e74 6564 2072 anar augmented r │ │ │ +00090e40: 6561 6c69 7479 2063 616e 2062 6520 666f eality can be fo │ │ │ +00090e50: 756e 6420 6174 0a20 2020 2020 2020 206f und at. o │ │ │ +00090e60: 7065 6e63 765f 736f 7572 6365 5f63 6f64 pencv_source_cod │ │ │ +00090e70: 652f 7361 6d70 6c65 732f 7079 7468 6f6e e/samples/python │ │ │ +00090e80: 2f70 6c61 6e65 5f61 722e 7079 0a20 203c /plane_ar.py. < │ │ │ +00090e90: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2020 /li>.
    • . │ │ │ +00090ea0: 2020 4966 2079 6f75 2061 7265 2075 7369 If you are usi │ │ │ +00090eb0: 6e67 2050 7974 686f 6e3a 0a20 203c 756c ng Python:.
        .
      • . │ │ │ +00090ed0: 2020 2020 4e75 6d70 7920 6172 7261 7920 Numpy array │ │ │ +00090ee0: 736c 6963 6573 2077 6f6e 2774 2077 6f72 slices won't wor │ │ │ +00090ef0: 6b20 6173 2069 6e70 7574 2062 6563 6175 k as input becau │ │ │ +00090f00: 7365 2073 6f6c 7665 506e 5020 7265 7175 se solvePnP requ │ │ │ +00090f10: 6972 6573 2063 6f6e 7469 6775 6f75 730a ires contiguous. │ │ │ +00090f20: 2020 2020 2020 2020 6172 7261 7973 2028 arrays ( │ │ │ +00090f30: 656e 666f 7263 6564 2062 7920 7468 6520 enforced by the │ │ │ +00090f40: 6173 7365 7274 696f 6e20 7573 696e 6720 assertion using │ │ │ +00090f50: 6376 3a3a 4d61 743a 3a63 6865 636b 5665 cv::Mat::checkVe │ │ │ +00090f60: 6374 6f72 2829 2061 726f 756e 6420 6c69 ctor() around li │ │ │ +00090f70: 6e65 2035 3520 6f66 0a20 2020 2020 2020 ne 55 of. │ │ │ +00090f80: 206d 6f64 756c 6573 2f33 642f 7372 632f modules/3d/src/ │ │ │ +00090f90: 736f 6c76 6570 6e70 2e63 7070 2076 6572 solvepnp.cpp ver │ │ │ +00090fa0: 7369 6f6e 2032 2e34 2e39 290a 2020 2020 sion 2.4.9). │ │ │ +00090fb0: 3c2f 6c69 3e0a 2020 2020 3c6c 693e 0a20
      • .
      • . │ │ │ +00090fc0: 2020 2020 2020 2020 5468 6520 5033 5020 The P3P │ │ │ +00090fd0: 616c 676f 7269 7468 6d20 7265 7175 6972 algorithm requir │ │ │ +00090fe0: 6573 2069 6d61 6765 2070 6f69 6e74 7320 es image points │ │ │ +00090ff0: 746f 2062 6520 696e 2061 6e20 6172 7261 to be in an arra │ │ │ +00091000: 7920 6f66 2073 6861 7065 2028 4e2c 312c y of shape (N,1, │ │ │ +00091010: 3229 2064 7565 0a20 2020 2020 2020 2074 2) due. t │ │ │ +00091020: 6f20 6974 7320 6361 6c6c 696e 6720 6f66 o its calling of │ │ │ +00091030: 2023 756e 6469 7374 6f72 7450 6f69 6e74 #undistortPoint │ │ │ +00091040: 7320 2861 726f 756e 6420 6c69 6e65 2037 s (around line 7 │ │ │ +00091050: 3520 6f66 206d 6f64 756c 6573 2f33 642f 5 of modules/3d/ │ │ │ +00091060: 7372 632f 736f 6c76 6570 6e70 2e63 7070 src/solvepnp.cpp │ │ │ +00091070: 2076 6572 7369 6f6e 2032 2e34 2e39 290a version 2.4.9). │ │ │ +00091080: 2020 2020 2020 2020 7768 6963 6820 7265 which re │ │ │ +00091090: 7175 6972 6573 2032 2d63 6861 6e6e 656c quires 2-channel │ │ │ +000910a0: 2069 6e66 6f72 6d61 7469 6f6e 2e0a 2020 information.. │ │ │ +000910b0: 2020 3c2f 6c69 3e0a 2020 2020 3c6c 693e
      • .
      • │ │ │ +000910c0: 0a20 2020 2020 2020 2020 5468 7573 2c20 . Thus, │ │ │ +000910d0: 6769 7665 6e20 736f 6d65 2064 6174 6120 given some data │ │ │ +000910e0: 4420 3d20 6e70 2e61 7272 6179 282e 2e2e D = np.array(... │ │ │ +000910f0: 2920 7768 6572 6520 442e 7368 6170 6520 ) where D.shape │ │ │ +00091100: 3d20 284e 2c4d 292c 2069 6e20 6f72 6465 = (N,M), in orde │ │ │ +00091110: 7220 746f 2075 7365 2061 2073 7562 7365 r to use a subse │ │ │ +00091120: 7420 6f66 0a20 2020 2020 2020 2069 7420 t of. it │ │ │ +00091130: 6173 2c20 652e 672e 2c20 696d 6167 6550 as, e.g., imageP │ │ │ +00091140: 6f69 6e74 732c 206f 6e65 206d 7573 7420 oints, one must │ │ │ +00091150: 6566 6665 6374 6976 656c 7920 636f 7079 effectively copy │ │ │ +00091160: 2069 7420 696e 746f 2061 206e 6577 2061 it into a new a │ │ │ +00091170: 7272 6179 3a20 696d 6167 6550 6f69 6e74 rray: imagePoint │ │ │ +00091180: 7320 3d0a 2020 2020 2020 2020 6e70 2e61 s =. np.a │ │ │ +00091190: 7363 6f6e 7469 6775 6f75 7361 7272 6179 scontiguousarray │ │ │ +000911a0: 2844 5b3a 2c3a 325d 292e 7265 7368 6170 (D[:,:2]).reshap │ │ │ +000911b0: 6528 284e 2c31 2c32 2929 0a20 2020 203c e((N,1,2)). < │ │ │ +000911c0: 2f6c 693e 0a20 203c 2f75 6c3e 0a20 203c /li>.
      . < │ │ │ +000911d0: 6c69 3e0a 2020 2020 2020 5468 6520 6d69 li>. The mi │ │ │ +000911e0: 6e69 6d75 6d20 6e75 6d62 6572 206f 6620 nimum number of │ │ │ +000911f0: 706f 696e 7473 2069 7320 3420 696e 2074 points is 4 in t │ │ │ +00091200: 6865 2067 656e 6572 616c 2063 6173 652e he general case. │ │ │ +00091210: 2049 6e20 7468 6520 6361 7365 206f 6620 In the case of │ │ │ +00091220: 5245 463a 2053 4f4c 5645 504e 505f 5033 REF: SOLVEPNP_P3 │ │ │ +00091230: 5020 616e 6420 5245 463a 2053 4f4c 5645 P and REF: SOLVE │ │ │ +00091240: 504e 505f 4150 3350 0a20 2020 2020 2020 PNP_AP3P. │ │ │ +00091250: 6d65 7468 6f64 732c 2069 7420 6973 2072 methods, it is r │ │ │ +00091260: 6571 7569 7265 6420 746f 2075 7365 2065 equired to use e │ │ │ +00091270: 7861 6374 6c79 2034 2070 6f69 6e74 7320 xactly 4 points │ │ │ +00091280: 2874 6865 2066 6972 7374 2033 2070 6f69 (the first 3 poi │ │ │ +00091290: 6e74 7320 6172 6520 7573 6564 2074 6f20 nts are used to │ │ │ +000912a0: 6573 7469 6d61 7465 2061 6c6c 2074 6865 estimate all the │ │ │ +000912b0: 2073 6f6c 7574 696f 6e73 0a20 2020 2020 solutions. │ │ │ +000912c0: 2020 6f66 2074 6865 2050 3350 2070 726f of the P3P pro │ │ │ +000912d0: 626c 656d 2c20 7468 6520 6c61 7374 206f blem, the last o │ │ │ +000912e0: 6e65 2069 7320 7573 6564 2074 6f20 7265 ne is used to re │ │ │ +000912f0: 7461 696e 2074 6865 2062 6573 7420 736f tain the best so │ │ │ +00091300: 6c75 7469 6f6e 2074 6861 7420 6d69 6e69 lution that mini │ │ │ +00091310: 6d69 7a65 7320 7468 6520 7265 7072 6f6a mizes the reproj │ │ │ +00091320: 6563 7469 6f6e 2065 7272 6f72 292e 0a20 ection error).. │ │ │ +00091330: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020
    • .
    • . │ │ │ +00091340: 2020 2020 5769 7468 2052 4546 3a20 534f With REF: SO │ │ │ +00091350: 4c56 4550 4e50 5f49 5445 5241 5449 5645 LVEPNP_ITERATIVE │ │ │ +00091360: 206d 6574 686f 6420 616e 6420 3c63 6f64 method and useExtrinsicGu │ │ │ +00091380: 6573 733d 7472 7565 3c2f 636f 6465 3e2c ess=true, │ │ │ +00091390: 2074 6865 206d 696e 696d 756d 206e 756d the minimum num │ │ │ +000913a0: 6265 7220 6f66 2070 6f69 6e74 7320 6973 ber of points is │ │ │ +000913b0: 2033 2028 3320 706f 696e 7473 0a20 2020 3 (3 points. │ │ │ +000913c0: 2020 2020 6172 6520 7375 6666 6963 6965 are sufficie │ │ │ +000913d0: 6e74 2074 6f20 636f 6d70 7574 6520 6120 nt to compute a │ │ │ +000913e0: 706f 7365 2062 7574 2074 6865 7265 2061 pose but there a │ │ │ +000913f0: 7265 2075 7020 746f 2034 2073 6f6c 7574 re up to 4 solut │ │ │ +00091400: 696f 6e73 292e 2054 6865 2069 6e69 7469 ions). The initi │ │ │ +00091410: 616c 2073 6f6c 7574 696f 6e20 7368 6f75 al solution shou │ │ │ +00091420: 6c64 2062 6520 636c 6f73 6520 746f 2074 ld be close to t │ │ │ +00091430: 6865 0a20 2020 2020 2020 676c 6f62 616c he. global │ │ │ +00091440: 2073 6f6c 7574 696f 6e20 746f 2063 6f6e solution to con │ │ │ +00091450: 7665 7267 652e 0a20 203c 2f6c 693e 0a20 verge..
    • . │ │ │ +00091460: 203c 6c69 3e0a 2020 2020 2020 5769 7468
    • . With │ │ │ +00091470: 2052 4546 3a20 534f 4c56 4550 4e50 5f49 REF: SOLVEPNP_I │ │ │ +00091480: 5050 4520 696e 7075 7420 706f 696e 7473 PPE input points │ │ │ +00091490: 206d 7573 7420 6265 2026 6774 3b3d 2034 must be >= 4 │ │ │ +000914a0: 2061 6e64 206f 626a 6563 7420 706f 696e and object poin │ │ │ +000914b0: 7473 206d 7573 7420 6265 2063 6f70 6c61 ts must be copla │ │ │ +000914c0: 6e61 722e 0a20 203c 2f6c 693e 0a20 203c nar..
    • . < │ │ │ +000914d0: 6c69 3e0a 2020 2020 2020 5769 7468 2052 li>. With R │ │ │ +000914e0: 4546 3a20 534f 4c56 4550 4e50 5f49 5050 EF: SOLVEPNP_IPP │ │ │ +000914f0: 455f 5351 5541 5245 2074 6869 7320 6973 E_SQUARE this is │ │ │ +00091500: 2061 2073 7065 6369 616c 2063 6173 6520 a special case │ │ │ +00091510: 7375 6974 6162 6c65 2066 6f72 206d 6172 suitable for mar │ │ │ +00091520: 6b65 7220 706f 7365 2065 7374 696d 6174 ker pose estimat │ │ │ +00091530: 696f 6e2e 0a20 2020 2020 2020 4e75 6d62 ion.. Numb │ │ │ +00091540: 6572 206f 6620 696e 7075 7420 706f 696e er of input poin │ │ │ +00091550: 7473 206d 7573 7420 6265 2034 2e20 4f62 ts must be 4. Ob │ │ │ +00091560: 6a65 6374 2070 6f69 6e74 7320 6d75 7374 ject points must │ │ │ +00091570: 2062 6520 6465 6669 6e65 6420 696e 2074 be defined in t │ │ │ +00091580: 6865 2066 6f6c 6c6f 7769 6e67 206f 7264 he following ord │ │ │ +00091590: 6572 3a0a 2020 3c75 6c3e 0a20 2020 203c er:.
        . < │ │ │ +000915a0: 6c69 3e0a 2020 2020 2020 2020 2020 706f li>. po │ │ │ +000915b0: 696e 7420 303a 205b 2d73 7175 6172 654c int 0: [-squareL │ │ │ +000915c0: 656e 6774 6820 2f20 322c 2020 7371 7561 ength / 2, squa │ │ │ +000915d0: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ +000915e0: 0a20 2020 203c 2f6c 693e 0a20 2020 203c . . < │ │ │ +000915f0: 6c69 3e0a 2020 2020 2020 2020 2020 706f li>. po │ │ │ +00091600: 696e 7420 313a 205b 2073 7175 6172 654c int 1: [ squareL │ │ │ +00091610: 656e 6774 6820 2f20 322c 2020 7371 7561 ength / 2, squa │ │ │ +00091620: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ +00091630: 0a20 2020 203c 2f6c 693e 0a20 2020 203c . . < │ │ │ +00091640: 6c69 3e0a 2020 2020 2020 2020 2020 706f li>. po │ │ │ +00091650: 696e 7420 323a 205b 2073 7175 6172 654c int 2: [ squareL │ │ │ +00091660: 656e 6774 6820 2f20 322c 202d 7371 7561 ength / 2, -squa │ │ │ +00091670: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ +00091680: 0a20 2020 203c 2f6c 693e 0a20 2020 203c . . < │ │ │ +00091690: 6c69 3e0a 2020 2020 2020 2020 2020 706f li>. po │ │ │ +000916a0: 696e 7420 333a 205b 2d73 7175 6172 654c int 3: [-squareL │ │ │ +000916b0: 656e 6774 6820 2f20 322c 202d 7371 7561 ength / 2, -squa │ │ │ +000916c0: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ +000916d0: 0a20 2020 203c 2f6c 693e 0a20 203c 2f75 . . .
      • . │ │ │ +000916f0: 5769 7468 2052 4546 3a20 534f 4c56 4550 With REF: SOLVEP │ │ │ +00091700: 4e50 5f53 5150 4e50 2069 6e70 7574 2070 NP_SQPNP input p │ │ │ +00091710: 6f69 6e74 7320 6d75 7374 2062 6520 2667 oints must be &g │ │ │ +00091720: 743b 3d20 330a 2020 3c2f 6c69 3e0a 3c2f t;= 3.
      • .
    .
    Ret │ │ │ +00091740: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e61 urns:
    .
    a │ │ │ +00091750: 7574 6f6d 6174 6963 616c 6c79 2067 656e utomatically gen │ │ │ +00091760: 6572 6174 6564 3c2f 6464 3e0a 3c2f 646c erated
    .
    ...
  • .
  • .< │ │ │ +00091790: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +000917a0: 6574 6169 6c22 2069 643d 2273 6f6c 7665 etail" id="solve │ │ │ +000917b0: 506e 5047 656e 6572 6963 286f 7267 2e6f PnPGeneric(org.o │ │ │ +000917c0: 7065 6e63 762e 636f 7265 2e4d 6174 2c6f pencv.core.Mat,o │ │ │ +000917d0: 7267 2e6f 7065 6e63 762e 636f 7265 2e4d rg.opencv.core.M │ │ │ +000917e0: 6174 2c6f 7267 2e6f 7065 6e63 762e 636f at,org.opencv.co │ │ │ +000917f0: 7265 2e4d 6174 2c6f 7267 2e6f 7065 6e63 re.Mat,org.openc │ │ │ +00091800: 762e 636f 7265 2e4d 6174 2c6a 6176 612e v.core.Mat,java. │ │ │ +00091810: 7574 696c 2e4c 6973 742c 6a61 7661 2e75 util.List,java.u │ │ │ +00091820: 7469 6c2e 4c69 7374 2c62 6f6f 6c65 616e til.List,boolean │ │ │ +00091830: 2c69 6e74 2c6f 7267 2e6f 7065 6e63 762e ,int,org.opencv. │ │ │ +00091840: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ +00091850: 6e63 762e 636f 7265 2e4d 6174 2922 3e0a ncv.core.Mat)">. │ │ │ +00091860: 3c68 333e 736f 6c76 6550 6e50 4765 6e65

    solvePnPGene │ │ │ +00091870: 7269 633c 2f68 333e 0a3c 6469 7620 636c ric

    .
    .
    p │ │ │ +000918d0: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static int&nb │ │ │ +00091910: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;so │ │ │ +00091930: 6c76 6550 6e50 4765 6e65 7269 633c 2f73 lvePnPGeneric(M │ │ │ +000919a0: 6174 3c2f 613e 266e 6273 703b 6f62 6a65 at obje │ │ │ +000919b0: 6374 506f 696e 7473 2c0a 203c 6120 6872 ctPoints,. Mat&n │ │ │ +00091a00: 6273 703b 696d 6167 6550 6f69 6e74 732c bsp;imagePoints, │ │ │ +00091a10: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +00091a50: 743c 2f61 3e26 6e62 7370 3b63 616d 6572 t camer │ │ │ +00091a60: 614d 6174 7269 782c 0a20 3c61 2068 7265 aMatrix,. Mat&nb │ │ │ +00091ab0: 7370 3b64 6973 7443 6f65 6666 732c 0a20 sp;distCoeffs,. │ │ │ +00091ac0: 3c61 2068 7265 663d 2268 7474 7073 3a2f List<Mat>&nbs │ │ │ +00091bb0: 703b 7276 6563 732c 0a20 3c61 2068 7265 p;rvecs,. List<< │ │ │ +00091c60: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00091c70: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +00091c80: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +00091c90: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat> tvec │ │ │ +00091cb0: 732c 0a20 626f 6f6c 6561 6e26 6e62 7370 s,. boolean  │ │ │ +00091cc0: 3b75 7365 4578 7472 696e 7369 6347 7565 ;useExtrinsicGue │ │ │ +00091cd0: 7373 2c0a 2069 6e74 266e 6273 703b 666c ss,. int fl │ │ │ +00091ce0: 6167 732c 0a20 3c61 2068 7265 663d 222e ags,. Mat r │ │ │ +00091d30: 7665 632c 0a20 3c61 2068 7265 663d 222e vec,. Mat t │ │ │ +00091d80: 7665 6329 3c2f 7370 616e 3e3c 2f64 6976 vec)
    .
    Finds an ob │ │ │ +00091db0: 6a65 6374 2070 6f73 6520 5c28 207b 7d5e ject pose \( {}^ │ │ │ +00091dc0: 7b63 7d5c 6d61 7468 6266 7b54 7d5f 6f20 {c}\mathbf{T}_o │ │ │ +00091dd0: 5c29 2066 726f 6d20 3344 2d32 4420 706f \) from 3D-2D po │ │ │ +00091de0: 696e 7420 636f 7272 6573 706f 6e64 656e int corresponden │ │ │ +00091df0: 6365 732e 0a0a 215b 5065 7273 7065 6374 ces...![Perspect │ │ │ +00091e00: 6976 6520 7072 6f6a 6563 7469 6f6e 2c20 ive projection, │ │ │ +00091e10: 6672 6f6d 206f 626a 6563 7420 746f 2063 from object to c │ │ │ +00091e20: 616d 6572 6120 6672 616d 655d 2870 6963 amera frame](pic │ │ │ +00091e30: 732f 7069 6e68 6f6c 655f 686f 6d6f 6765 s/pinhole_homoge │ │ │ +00091e40: 6e65 6f75 735f 7472 616e 7366 6f72 6d61 neous_transforma │ │ │ +00091e50: 7469 6f6e 2e6a 7067 297b 2077 6964 7468 tion.jpg){ width │ │ │ +00091e60: 3d35 3025 207d 0a0a 5345 453a 2052 4546 =50% }..SEE: REF │ │ │ +00091e70: 3a20 6361 6c69 6233 645f 736f 6c76 6550 : calib3d_solveP │ │ │ +00091e80: 6e50 0a0a 5468 6973 2066 756e 6374 696f nP..This functio │ │ │ +00091e90: 6e20 7265 7475 726e 7320 6120 6c69 7374 n returns a list │ │ │ +00091ea0: 206f 6620 616c 6c20 7468 6520 706f 7373 of all the poss │ │ │ +00091eb0: 6962 6c65 2073 6f6c 7574 696f 6e73 2028 ible solutions ( │ │ │ +00091ec0: 6120 736f 6c75 7469 6f6e 2069 7320 6120 a solution is a │ │ │ +00091ed0: 266c 743b 726f 7461 7469 6f6e 2076 6563 <rotation vec │ │ │ +00091ee0: 746f 722c 2074 7261 6e73 6c61 7469 6f6e tor, translation │ │ │ +00091ef0: 2076 6563 746f 7226 6774 3b0a 636f 7570 vector>.coup │ │ │ +00091f00: 6c65 292c 2064 6570 656e 6469 6e67 206f le), depending o │ │ │ +00091f10: 6e20 7468 6520 6e75 6d62 6572 206f 6620 n the number of │ │ │ +00091f20: 696e 7075 7420 706f 696e 7473 2061 6e64 input points and │ │ │ +00091f30: 2074 6865 2063 686f 7365 6e20 6d65 7468 the chosen meth │ │ │ +00091f40: 6f64 3a0a 3c75 6c3e 0a20 203c 6c69 3e0a od:.
      .
    • . │ │ │ +00091f50: 2050 3350 206d 6574 686f 6473 2028 5245 P3P methods (RE │ │ │ +00091f60: 463a 2053 4f4c 5645 504e 505f 5033 502c F: SOLVEPNP_P3P, │ │ │ +00091f70: 2052 4546 3a20 534f 4c56 4550 4e50 5f41 REF: SOLVEPNP_A │ │ │ +00091f80: 5033 5029 3a20 3320 6f72 2034 2069 6e70 P3P): 3 or 4 inp │ │ │ +00091f90: 7574 2070 6f69 6e74 732e 204e 756d 6265 ut points. Numbe │ │ │ +00091fa0: 7220 6f66 2072 6574 7572 6e65 6420 736f r of returned so │ │ │ +00091fb0: 6c75 7469 6f6e 7320 6361 6e20 6265 2062 lutions can be b │ │ │ +00091fc0: 6574 7765 656e 2030 2061 6e64 2034 2077 etween 0 and 4 w │ │ │ +00091fd0: 6974 6820 3320 696e 7075 7420 706f 696e ith 3 input poin │ │ │ +00091fe0: 7473 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c ts..
    • . . REF: SOLVEPN │ │ │ +00092000: 505f 4950 5045 2049 6e70 7574 2070 6f69 P_IPPE Input poi │ │ │ +00092010: 6e74 7320 6d75 7374 2062 6520 2667 743b nts must be > │ │ │ +00092020: 3d20 3420 616e 6420 6f62 6a65 6374 2070 = 4 and object p │ │ │ +00092030: 6f69 6e74 7320 6d75 7374 2062 6520 636f oints must be co │ │ │ +00092040: 706c 616e 6172 2e20 5265 7475 726e 7320 planar. Returns │ │ │ +00092050: 3220 736f 6c75 7469 6f6e 732e 0a20 203c 2 solutions.. < │ │ │ +00092060: 2f6c 693e 0a20 203c 6c69 3e0a 2052 4546 /li>.
    • . REF │ │ │ +00092070: 3a20 534f 4c56 4550 4e50 5f49 5050 455f : SOLVEPNP_IPPE_ │ │ │ +00092080: 5351 5541 5245 2053 7065 6369 616c 2063 SQUARE Special c │ │ │ +00092090: 6173 6520 7375 6974 6162 6c65 2066 6f72 ase suitable for │ │ │ +000920a0: 206d 6172 6b65 7220 706f 7365 2065 7374 marker pose est │ │ │ +000920b0: 696d 6174 696f 6e2e 0a4e 756d 6265 7220 imation..Number │ │ │ +000920c0: 6f66 2069 6e70 7574 2070 6f69 6e74 7320 of input points │ │ │ +000920d0: 6d75 7374 2062 6520 3420 616e 6420 3220 must be 4 and 2 │ │ │ +000920e0: 736f 6c75 7469 6f6e 7320 6172 6520 7265 solutions are re │ │ │ +000920f0: 7475 726e 6564 2e20 4f62 6a65 6374 2070 turned. Object p │ │ │ +00092100: 6f69 6e74 7320 6d75 7374 2062 6520 6465 oints must be de │ │ │ +00092110: 6669 6e65 6420 696e 2074 6865 2066 6f6c fined in the fol │ │ │ +00092120: 6c6f 7769 6e67 206f 7264 6572 3a0a 2020 lowing order:. │ │ │ +00092130: 3c75 6c3e 0a20 2020 203c 6c69 3e0a 2020
        .
      • . │ │ │ +00092140: 2070 6f69 6e74 2030 3a20 5b2d 7371 7561 point 0: [-squa │ │ │ +00092150: 7265 4c65 6e67 7468 202f 2032 2c20 2073 reLength / 2, s │ │ │ +00092160: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ +00092170: 2030 5d0a 2020 2020 3c2f 6c69 3e0a 2020 0].
      • . │ │ │ +00092180: 2020 3c6c 693e 0a20 2020 706f 696e 7420
      • . point │ │ │ +00092190: 313a 205b 2073 7175 6172 654c 656e 6774 1: [ squareLengt │ │ │ +000921a0: 6820 2f20 322c 2020 7371 7561 7265 4c65 h / 2, squareLe │ │ │ +000921b0: 6e67 7468 202f 2032 2c20 305d 0a20 2020 ngth / 2, 0]. │ │ │ +000921c0: 203c 2f6c 693e 0a20 2020 203c 6c69 3e0a
      • .
      • . │ │ │ +000921d0: 2020 2070 6f69 6e74 2032 3a20 5b20 7371 point 2: [ sq │ │ │ +000921e0: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +000921f0: 2d73 7175 6172 654c 656e 6774 6820 2f20 -squareLength / │ │ │ +00092200: 322c 2030 5d0a 2020 2020 3c2f 6c69 3e0a 2, 0].
      • . │ │ │ +00092210: 2020 2020 3c6c 693e 0a20 2020 706f 696e
      • . poin │ │ │ +00092220: 7420 333a 205b 2d73 7175 6172 654c 656e t 3: [-squareLen │ │ │ +00092230: 6774 6820 2f20 322c 202d 7371 7561 7265 gth / 2, -square │ │ │ +00092240: 4c65 6e67 7468 202f 2032 2c20 305d 0a20 Length / 2, 0]. │ │ │ +00092250: 2020 203c 2f6c 693e 0a20 203c 2f75 6c3e
      • .
      │ │ │ +00092260: 0a20 203c 6c69 3e0a 2066 6f72 2061 6c6c .
    • . for all │ │ │ +00092270: 2074 6865 206f 7468 6572 2066 6c61 6773 the other flags │ │ │ +00092280: 2c20 6e75 6d62 6572 206f 6620 696e 7075 , number of inpu │ │ │ +00092290: 7420 706f 696e 7473 206d 7573 7420 6265 t points must be │ │ │ +000922a0: 2026 6774 3b3d 2034 2061 6e64 206f 626a >= 4 and obj │ │ │ +000922b0: 6563 7420 706f 696e 7473 2063 616e 2062 ect points can b │ │ │ +000922c0: 6520 696e 2061 6e79 2063 6f6e 6669 6775 e in any configu │ │ │ +000922d0: 7261 7469 6f6e 2e0a 4f6e 6c79 2031 2073 ration..Only 1 s │ │ │ +000922e0: 6f6c 7574 696f 6e20 6973 2072 6574 7572 olution is retur │ │ │ +000922f0: 6e65 642e 0a20 203c 2f6c 693e 0a3c 2f75 ned..
    • .
    .
    .
    │ │ │ +00092320: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ +00092330: 0a3c 6464 3e3c 636f 6465 3e6f 626a 6563 .
    objec │ │ │ +00092340: 7450 6f69 6e74 733c 2f63 6f64 653e 202d tPoints - │ │ │ +00092350: 2041 7272 6179 206f 6620 6f62 6a65 6374 Array of object │ │ │ +00092360: 2070 6f69 6e74 7320 696e 2074 6865 206f points in the o │ │ │ +00092370: 626a 6563 7420 636f 6f72 6469 6e61 7465 bject coordinate │ │ │ +00092380: 2073 7061 6365 2c20 4e78 3320 312d 6368 space, Nx3 1-ch │ │ │ +00092390: 616e 6e65 6c20 6f72 0a31 784e 2f4e 7831 annel or.1xN/Nx1 │ │ │ +000923a0: 2033 2d63 6861 6e6e 656c 2c20 7768 6572 3-channel, wher │ │ │ +000923b0: 6520 4e20 6973 2074 6865 206e 756d 6265 e N is the numbe │ │ │ +000923c0: 7220 6f66 2070 6f69 6e74 732e 2076 6563 r of points. vec │ │ │ +000923d0: 746f 7226 6c74 3b50 6f69 6e74 3364 2667 tor<Point3d&g │ │ │ +000923e0: 743b 2063 616e 2062 6520 616c 736f 2070 t; can be also p │ │ │ +000923f0: 6173 7365 6420 6865 7265 2e3c 2f64 643e assed here.
    │ │ │ +00092400: 0a3c 6464 3e3c 636f 6465 3e69 6d61 6765 .
    image │ │ │ +00092410: 506f 696e 7473 3c2f 636f 6465 3e20 2d20 Points - │ │ │ +00092420: 4172 7261 7920 6f66 2063 6f72 7265 7370 Array of corresp │ │ │ +00092430: 6f6e 6469 6e67 2069 6d61 6765 2070 6f69 onding image poi │ │ │ +00092440: 6e74 732c 204e 7832 2031 2d63 6861 6e6e nts, Nx2 1-chann │ │ │ +00092450: 656c 206f 7220 3178 4e2f 4e78 3120 322d el or 1xN/Nx1 2- │ │ │ +00092460: 6368 616e 6e65 6c2c 0a77 6865 7265 204e channel,.where N │ │ │ +00092470: 2069 7320 7468 6520 6e75 6d62 6572 206f is the number o │ │ │ +00092480: 6620 706f 696e 7473 2e20 7665 6374 6f72 f points. vector │ │ │ +00092490: 266c 743b 506f 696e 7432 6426 6774 3b20 <Point2d> │ │ │ +000924a0: 6361 6e20 6265 2061 6c73 6f20 7061 7373 can be also pass │ │ │ +000924b0: 6564 2068 6572 652e 3c2f 6464 3e0a 3c64 ed here.
    .cameraMa │ │ │ +000924d0: 7472 6978 3c2f 636f 6465 3e20 2d20 496e trix - In │ │ │ +000924e0: 7075 7420 6361 6d65 7261 2069 6e74 7269 put camera intri │ │ │ +000924f0: 6e73 6963 206d 6174 7269 7820 5c28 5c63 nsic matrix \(\c │ │ │ +00092500: 616d 6572 616d 6174 7269 787b 417d 5c29 ameramatrix{A}\) │ │ │ +00092510: 202e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 ..
    distCoeffs - Input vect │ │ │ +00092540: 6f72 206f 6620 6469 7374 6f72 7469 6f6e or of distortion │ │ │ +00092550: 2063 6f65 6666 6963 6965 6e74 730a 5c28 coefficients.\( │ │ │ +00092560: 5c64 6973 7463 6f65 6666 735c 292e 2049 \distcoeffs\). I │ │ │ +00092570: 6620 7468 6520 7665 6374 6f72 2069 7320 f the vector is │ │ │ +00092580: 4e55 4c4c 2f65 6d70 7479 2c20 7468 6520 NULL/empty, the │ │ │ +00092590: 7a65 726f 2064 6973 746f 7274 696f 6e20 zero distortion │ │ │ +000925a0: 636f 6566 6669 6369 656e 7473 2061 7265 coefficients are │ │ │ +000925b0: 0a61 7373 756d 6564 2e3c 2f64 643e 0a3c .assumed.
    .< │ │ │ +000925c0: 6464 3e3c 636f 6465 3e72 7665 6373 3c2f dd>rvecs - Vector o │ │ │ +000925e0: 6620 6f75 7470 7574 2072 6f74 6174 696f f output rotatio │ │ │ +000925f0: 6e20 7665 6374 6f72 7320 2873 6565 2052 n vectors (see R │ │ │ +00092600: 4546 3a20 526f 6472 6967 7565 7320 2920 EF: Rodrigues ) │ │ │ +00092610: 7468 6174 2c20 746f 6765 7468 6572 2077 that, together w │ │ │ +00092620: 6974 6820 7476 6563 732c 2062 7269 6e67 ith tvecs, bring │ │ │ +00092630: 7320 706f 696e 7473 2066 726f 6d0a 7468 s points from.th │ │ │ +00092640: 6520 6d6f 6465 6c20 636f 6f72 6469 6e61 e model coordina │ │ │ +00092650: 7465 2073 7973 7465 6d20 746f 2074 6865 te system to the │ │ │ +00092660: 2063 616d 6572 6120 636f 6f72 6469 6e61 camera coordina │ │ │ +00092670: 7465 2073 7973 7465 6d2e 3c2f 6464 3e0a te system.. │ │ │ +00092680: 3c64 643e 3c63 6f64 653e 7476 6563 733c
    tvecs< │ │ │ +00092690: 2f63 6f64 653e 202d 2056 6563 746f 7220 /code> - Vector │ │ │ +000926a0: 6f66 206f 7574 7075 7420 7472 616e 736c of output transl │ │ │ +000926b0: 6174 696f 6e20 7665 6374 6f72 732e 3c2f ation vectors..
    us │ │ │ +000926d0: 6545 7874 7269 6e73 6963 4775 6573 733c eExtrinsicGuess< │ │ │ +000926e0: 2f63 6f64 653e 202d 2050 6172 616d 6574 /code> - Paramet │ │ │ +000926f0: 6572 2075 7365 6420 666f 7220 2353 4f4c er used for #SOL │ │ │ +00092700: 5645 504e 505f 4954 4552 4154 4956 452e VEPNP_ITERATIVE. │ │ │ +00092710: 2049 6620 7472 7565 2028 3129 2c20 7468 If true (1), th │ │ │ +00092720: 6520 6675 6e63 7469 6f6e 2075 7365 730a e function uses. │ │ │ +00092730: 7468 6520 7072 6f76 6964 6564 2072 7665 the provided rve │ │ │ +00092740: 6320 616e 6420 7476 6563 2076 616c 7565 c and tvec value │ │ │ +00092750: 7320 6173 2069 6e69 7469 616c 2061 7070 s as initial app │ │ │ +00092760: 726f 7869 6d61 7469 6f6e 7320 6f66 2074 roximations of t │ │ │ +00092770: 6865 2072 6f74 6174 696f 6e20 616e 6420 he rotation and │ │ │ +00092780: 7472 616e 736c 6174 696f 6e0a 7665 6374 translation.vect │ │ │ +00092790: 6f72 732c 2072 6573 7065 6374 6976 656c ors, respectivel │ │ │ +000927a0: 792c 2061 6e64 2066 7572 7468 6572 206f y, and further o │ │ │ +000927b0: 7074 696d 697a 6573 2074 6865 6d2e 3c2f ptimizes them..
    fl │ │ │ +000927d0: 6167 733c 2f63 6f64 653e 202d 204d 6574 ags - Met │ │ │ +000927e0: 686f 6420 666f 7220 736f 6c76 696e 6720 hod for solving │ │ │ +000927f0: 6120 506e 5020 7072 6f62 6c65 6d3a 2073 a PnP problem: s │ │ │ +00092800: 6565 2052 4546 3a20 6361 6c69 6233 645f ee REF: calib3d_ │ │ │ +00092810: 736f 6c76 6550 6e50 5f66 6c61 6773 3c2f solvePnP_flags.
    rv │ │ │ +00092830: 6563 3c2f 636f 6465 3e20 2d20 526f 7461 ec - Rota │ │ │ +00092840: 7469 6f6e 2076 6563 746f 7220 7573 6564 tion vector used │ │ │ +00092850: 2074 6f20 696e 6974 6961 6c69 7a65 2061 to initialize a │ │ │ +00092860: 6e20 6974 6572 6174 6976 6520 506e 5020 n iterative PnP │ │ │ +00092870: 7265 6669 6e65 6d65 6e74 2061 6c67 6f72 refinement algor │ │ │ +00092880: 6974 686d 2c20 7768 656e 2066 6c61 6720 ithm, when flag │ │ │ +00092890: 6973 2052 4546 3a20 534f 4c56 4550 4e50 is REF: SOLVEPNP │ │ │ +000928a0: 5f49 5445 5241 5449 5645 0a61 6e64 2075 _ITERATIVE.and u │ │ │ +000928b0: 7365 4578 7472 696e 7369 6347 7565 7373 seExtrinsicGuess │ │ │ +000928c0: 2069 7320 7365 7420 746f 2074 7275 652e is set to true. │ │ │ +000928d0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000928e0: 7476 6563 3c2f 636f 6465 3e20 2d20 5472 tvec - Tr │ │ │ +000928f0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ +00092900: 2075 7365 6420 746f 2069 6e69 7469 616c used to initial │ │ │ +00092910: 697a 6520 616e 2069 7465 7261 7469 7665 ize an iterative │ │ │ +00092920: 2050 6e50 2072 6566 696e 656d 656e 7420 PnP refinement │ │ │ +00092930: 616c 676f 7269 7468 6d2c 2077 6865 6e20 algorithm, when │ │ │ +00092940: 666c 6167 2069 7320 5245 463a 2053 4f4c flag is REF: SOL │ │ │ +00092950: 5645 504e 505f 4954 4552 4154 4956 450a VEPNP_ITERATIVE. │ │ │ +00092960: 616e 6420 7573 6545 7874 7269 6e73 6963 and useExtrinsic │ │ │ +00092970: 4775 6573 7320 6973 2073 6574 2074 6f20 Guess is set to │ │ │ +00092980: 7472 7565 2e0a 285c 2820 5c74 6578 747b true..(\( \text{ │ │ │ +00092990: 524d 5345 7d20 3d20 5c73 7172 747b 5c66 RMSE} = \sqrt{\f │ │ │ +000929a0: 7261 637b 5c73 756d 5f7b 697d 5e7b 4e7d rac{\sum_{i}^{N} │ │ │ +000929b0: 205c 6c65 6674 2028 205c 6861 747b 795f \left ( \hat{y_ │ │ │ +000929c0: 697d 202d 2079 5f69 205c 7269 6768 7420 i} - y_i \right │ │ │ +000929d0: 295e 327d 7b4e 7d7d 205c 2929 2062 6574 )^2}{N}} \)) bet │ │ │ +000929e0: 7765 656e 2074 6865 2069 6e70 7574 2069 ween the input i │ │ │ +000929f0: 6d61 6765 2070 6f69 6e74 730a 616e 6420 mage points.and │ │ │ +00092a00: 7468 6520 3344 206f 626a 6563 7420 706f the 3D object po │ │ │ +00092a10: 696e 7473 2070 726f 6a65 6374 6564 2077 ints projected w │ │ │ +00092a20: 6974 6820 7468 6520 6573 7469 6d61 7465 ith the estimate │ │ │ +00092a30: 6420 706f 7365 2e0a 0a4d 6f72 6520 696e d pose...More in │ │ │ +00092a40: 666f 726d 6174 696f 6e20 6973 2064 6573 formation is des │ │ │ +00092a50: 6372 6962 6564 2069 6e20 5245 463a 2063 cribed in REF: c │ │ │ +00092a60: 616c 6962 3364 5f73 6f6c 7665 506e 500a alib3d_solvePnP. │ │ │ +00092a70: 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a 3c75 .Note:..
  • . │ │ │ +00092a90: 416e 2065 7861 6d70 6c65 206f 6620 686f An example of ho │ │ │ +00092aa0: 7720 746f 2075 7365 2073 6f6c 7665 506e w to use solvePn │ │ │ +00092ab0: 5020 666f 7220 706c 616e 6172 2061 7567 P for planar aug │ │ │ +00092ac0: 6d65 6e74 6564 2072 6561 6c69 7479 2063 mented reality c │ │ │ +00092ad0: 616e 2062 6520 666f 756e 6420 6174 0a20 an be found at. │ │ │ +00092ae0: 2020 2020 2020 206f 7065 6e63 765f 736f opencv_so │ │ │ +00092af0: 7572 6365 5f63 6f64 652f 7361 6d70 6c65 urce_code/sample │ │ │ +00092b00: 732f 7079 7468 6f6e 2f70 6c61 6e65 5f61 s/python/plane_a │ │ │ +00092b10: 722e 7079 0a20 203c 2f6c 693e 0a20 203c r.py.
  • . < │ │ │ +00092b20: 6c69 3e0a 2020 2020 2020 4966 2079 6f75 li>. If you │ │ │ +00092b30: 2061 7265 2075 7369 6e67 2050 7974 686f are using Pytho │ │ │ +00092b40: 6e3a 0a20 203c 756c 3e0a 2020 2020 3c6c n:.
      . . Nump │ │ │ +00092b60: 7920 6172 7261 7920 736c 6963 6573 2077 y array slices w │ │ │ +00092b70: 6f6e 2774 2077 6f72 6b20 6173 2069 6e70 on't work as inp │ │ │ +00092b80: 7574 2062 6563 6175 7365 2073 6f6c 7665 ut because solve │ │ │ +00092b90: 506e 5020 7265 7175 6972 6573 2063 6f6e PnP requires con │ │ │ +00092ba0: 7469 6775 6f75 730a 2020 2020 2020 2020 tiguous. │ │ │ +00092bb0: 6172 7261 7973 2028 656e 666f 7263 6564 arrays (enforced │ │ │ +00092bc0: 2062 7920 7468 6520 6173 7365 7274 696f by the assertio │ │ │ +00092bd0: 6e20 7573 696e 6720 6376 3a3a 4d61 743a n using cv::Mat: │ │ │ +00092be0: 3a63 6865 636b 5665 6374 6f72 2829 2061 :checkVector() a │ │ │ +00092bf0: 726f 756e 6420 6c69 6e65 2035 3520 6f66 round line 55 of │ │ │ +00092c00: 0a20 2020 2020 2020 206d 6f64 756c 6573 . modules │ │ │ +00092c10: 2f33 642f 7372 632f 736f 6c76 6570 6e70 /3d/src/solvepnp │ │ │ +00092c20: 2e63 7070 2076 6572 7369 6f6e 2032 2e34 .cpp version 2.4 │ │ │ +00092c30: 2e39 290a 2020 2020 3c2f 6c69 3e0a 2020 .9). . │ │ │ +00092c40: 2020 3c6c 693e 0a20 2020 2020 2020 2020
    • . │ │ │ +00092c50: 5468 6520 5033 5020 616c 676f 7269 7468 The P3P algorith │ │ │ +00092c60: 6d20 7265 7175 6972 6573 2069 6d61 6765 m requires image │ │ │ +00092c70: 2070 6f69 6e74 7320 746f 2062 6520 696e points to be in │ │ │ +00092c80: 2061 6e20 6172 7261 7920 6f66 2073 6861 an array of sha │ │ │ +00092c90: 7065 2028 4e2c 312c 3229 2064 7565 0a20 pe (N,1,2) due. │ │ │ +00092ca0: 2020 2020 2020 2074 6f20 6974 7320 6361 to its ca │ │ │ +00092cb0: 6c6c 696e 6720 6f66 2023 756e 6469 7374 lling of #undist │ │ │ +00092cc0: 6f72 7450 6f69 6e74 7320 2861 726f 756e ortPoints (aroun │ │ │ +00092cd0: 6420 6c69 6e65 2037 3520 6f66 206d 6f64 d line 75 of mod │ │ │ +00092ce0: 756c 6573 2f33 642f 7372 632f 736f 6c76 ules/3d/src/solv │ │ │ +00092cf0: 6570 6e70 2e63 7070 2076 6572 7369 6f6e epnp.cpp version │ │ │ +00092d00: 2032 2e34 2e39 290a 2020 2020 2020 2020 2.4.9). │ │ │ +00092d10: 7768 6963 6820 7265 7175 6972 6573 2032 which requires 2 │ │ │ +00092d20: 2d63 6861 6e6e 656c 2069 6e66 6f72 6d61 -channel informa │ │ │ +00092d30: 7469 6f6e 2e0a 2020 2020 3c2f 6c69 3e0a tion..
    • . │ │ │ +00092d40: 2020 2020 3c6c 693e 0a20 2020 2020 2020
    • . │ │ │ +00092d50: 2020 5468 7573 2c20 6769 7665 6e20 736f Thus, given so │ │ │ +00092d60: 6d65 2064 6174 6120 4420 3d20 6e70 2e61 me data D = np.a │ │ │ +00092d70: 7272 6179 282e 2e2e 2920 7768 6572 6520 rray(...) where │ │ │ +00092d80: 442e 7368 6170 6520 3d20 284e 2c4d 292c D.shape = (N,M), │ │ │ +00092d90: 2069 6e20 6f72 6465 7220 746f 2075 7365 in order to use │ │ │ +00092da0: 2061 2073 7562 7365 7420 6f66 0a20 2020 a subset of. │ │ │ +00092db0: 2020 2020 2069 7420 6173 2c20 652e 672e it as, e.g. │ │ │ +00092dc0: 2c20 696d 6167 6550 6f69 6e74 732c 206f , imagePoints, o │ │ │ +00092dd0: 6e65 206d 7573 7420 6566 6665 6374 6976 ne must effectiv │ │ │ +00092de0: 656c 7920 636f 7079 2069 7420 696e 746f ely copy it into │ │ │ +00092df0: 2061 206e 6577 2061 7272 6179 3a20 696d a new array: im │ │ │ +00092e00: 6167 6550 6f69 6e74 7320 3d0a 2020 2020 agePoints =. │ │ │ +00092e10: 2020 2020 6e70 2e61 7363 6f6e 7469 6775 np.ascontigu │ │ │ +00092e20: 6f75 7361 7272 6179 2844 5b3a 2c3a 325d ousarray(D[:,:2] │ │ │ +00092e30: 292e 7265 7368 6170 6528 284e 2c31 2c32 ).reshape((N,1,2 │ │ │ +00092e40: 2929 0a20 2020 203c 2f6c 693e 0a20 203c )).
    • . < │ │ │ +00092e50: 2f75 6c3e 0a20 203c 6c69 3e0a 2020 2020 /ul>.
    • . │ │ │ +00092e60: 2020 5468 6520 6d69 6e69 6d75 6d20 6e75 The minimum nu │ │ │ +00092e70: 6d62 6572 206f 6620 706f 696e 7473 2069 mber of points i │ │ │ +00092e80: 7320 3420 696e 2074 6865 2067 656e 6572 s 4 in the gener │ │ │ +00092e90: 616c 2063 6173 652e 2049 6e20 7468 6520 al case. In the │ │ │ +00092ea0: 6361 7365 206f 6620 5245 463a 2053 4f4c case of REF: SOL │ │ │ +00092eb0: 5645 504e 505f 5033 5020 616e 6420 5245 VEPNP_P3P and RE │ │ │ +00092ec0: 463a 2053 4f4c 5645 504e 505f 4150 3350 F: SOLVEPNP_AP3P │ │ │ +00092ed0: 0a20 2020 2020 2020 6d65 7468 6f64 732c . methods, │ │ │ +00092ee0: 2069 7420 6973 2072 6571 7569 7265 6420 it is required │ │ │ +00092ef0: 746f 2075 7365 2065 7861 6374 6c79 2034 to use exactly 4 │ │ │ +00092f00: 2070 6f69 6e74 7320 2874 6865 2066 6972 points (the fir │ │ │ +00092f10: 7374 2033 2070 6f69 6e74 7320 6172 6520 st 3 points are │ │ │ +00092f20: 7573 6564 2074 6f20 6573 7469 6d61 7465 used to estimate │ │ │ +00092f30: 2061 6c6c 2074 6865 2073 6f6c 7574 696f all the solutio │ │ │ +00092f40: 6e73 0a20 2020 2020 2020 6f66 2074 6865 ns. of the │ │ │ +00092f50: 2050 3350 2070 726f 626c 656d 2c20 7468 P3P problem, th │ │ │ +00092f60: 6520 6c61 7374 206f 6e65 2069 7320 7573 e last one is us │ │ │ +00092f70: 6564 2074 6f20 7265 7461 696e 2074 6865 ed to retain the │ │ │ +00092f80: 2062 6573 7420 736f 6c75 7469 6f6e 2074 best solution t │ │ │ +00092f90: 6861 7420 6d69 6e69 6d69 7a65 7320 7468 hat minimizes th │ │ │ +00092fa0: 6520 7265 7072 6f6a 6563 7469 6f6e 2065 e reprojection e │ │ │ +00092fb0: 7272 6f72 292e 0a20 203c 2f6c 693e 0a20 rror)..
    • . │ │ │ +00092fc0: 203c 6c69 3e0a 2020 2020 2020 5769 7468
    • . With │ │ │ +00092fd0: 2052 4546 3a20 534f 4c56 4550 4e50 5f49 REF: SOLVEPNP_I │ │ │ +00092fe0: 5445 5241 5449 5645 206d 6574 686f 6420 TERATIVE method │ │ │ +00092ff0: 616e 6420 3c63 6f64 653e 7573 6545 7874 and useExt │ │ │ +00093000: 7269 6e73 6963 4775 6573 733d 7472 7565 rinsicGuess=true │ │ │ +00093010: 3c2f 636f 6465 3e2c 2074 6865 206d 696e , the min │ │ │ +00093020: 696d 756d 206e 756d 6265 7220 6f66 2070 imum number of p │ │ │ +00093030: 6f69 6e74 7320 6973 2033 2028 3320 706f oints is 3 (3 po │ │ │ +00093040: 696e 7473 0a20 2020 2020 2020 6172 6520 ints. are │ │ │ +00093050: 7375 6666 6963 6965 6e74 2074 6f20 636f sufficient to co │ │ │ +00093060: 6d70 7574 6520 6120 706f 7365 2062 7574 mpute a pose but │ │ │ +00093070: 2074 6865 7265 2061 7265 2075 7020 746f there are up to │ │ │ +00093080: 2034 2073 6f6c 7574 696f 6e73 292e 2054 4 solutions). T │ │ │ +00093090: 6865 2069 6e69 7469 616c 2073 6f6c 7574 he initial solut │ │ │ +000930a0: 696f 6e20 7368 6f75 6c64 2062 6520 636c ion should be cl │ │ │ +000930b0: 6f73 6520 746f 2074 6865 0a20 2020 2020 ose to the. │ │ │ +000930c0: 2020 676c 6f62 616c 2073 6f6c 7574 696f global solutio │ │ │ +000930d0: 6e20 746f 2063 6f6e 7665 7267 652e 0a20 n to converge.. │ │ │ +000930e0: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020
    • .
    • . │ │ │ +000930f0: 2020 2020 5769 7468 2052 4546 3a20 534f With REF: SO │ │ │ +00093100: 4c56 4550 4e50 5f49 5050 4520 696e 7075 LVEPNP_IPPE inpu │ │ │ +00093110: 7420 706f 696e 7473 206d 7573 7420 6265 t points must be │ │ │ +00093120: 2026 6774 3b3d 2034 2061 6e64 206f 626a >= 4 and obj │ │ │ +00093130: 6563 7420 706f 696e 7473 206d 7573 7420 ect points must │ │ │ +00093140: 6265 2063 6f70 6c61 6e61 722e 0a20 203c be coplanar.. < │ │ │ +00093150: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2020 /li>.
    • . │ │ │ +00093160: 2020 5769 7468 2052 4546 3a20 534f 4c56 With REF: SOLV │ │ │ +00093170: 4550 4e50 5f49 5050 455f 5351 5541 5245 EPNP_IPPE_SQUARE │ │ │ +00093180: 2074 6869 7320 6973 2061 2073 7065 6369 this is a speci │ │ │ +00093190: 616c 2063 6173 6520 7375 6974 6162 6c65 al case suitable │ │ │ +000931a0: 2066 6f72 206d 6172 6b65 7220 706f 7365 for marker pose │ │ │ +000931b0: 2065 7374 696d 6174 696f 6e2e 0a20 2020 estimation.. │ │ │ +000931c0: 2020 2020 4e75 6d62 6572 206f 6620 696e Number of in │ │ │ +000931d0: 7075 7420 706f 696e 7473 206d 7573 7420 put points must │ │ │ +000931e0: 6265 2034 2e20 4f62 6a65 6374 2070 6f69 be 4. Object poi │ │ │ +000931f0: 6e74 7320 6d75 7374 2062 6520 6465 6669 nts must be defi │ │ │ +00093200: 6e65 6420 696e 2074 6865 2066 6f6c 6c6f ned in the follo │ │ │ +00093210: 7769 6e67 206f 7264 6572 3a0a 2020 3c75 wing order:. .
    • . │ │ │ +00093230: 2020 2020 2020 706f 696e 7420 303a 205b point 0: [ │ │ │ +00093240: 2d73 7175 6172 654c 656e 6774 6820 2f20 -squareLength / │ │ │ +00093250: 322c 2020 7371 7561 7265 4c65 6e67 7468 2, squareLength │ │ │ +00093260: 202f 2032 2c20 305d 0a20 2020 203c 2f6c / 2, 0]. .
    • . │ │ │ +00093280: 2020 2020 2020 706f 696e 7420 313a 205b point 1: [ │ │ │ +00093290: 2073 7175 6172 654c 656e 6774 6820 2f20 squareLength / │ │ │ +000932a0: 322c 2020 7371 7561 7265 4c65 6e67 7468 2, squareLength │ │ │ +000932b0: 202f 2032 2c20 305d 0a20 2020 203c 2f6c / 2, 0]. .
    • . │ │ │ +000932d0: 2020 2020 2020 706f 696e 7420 323a 205b point 2: [ │ │ │ +000932e0: 2073 7175 6172 654c 656e 6774 6820 2f20 squareLength / │ │ │ +000932f0: 322c 202d 7371 7561 7265 4c65 6e67 7468 2, -squareLength │ │ │ +00093300: 202f 2032 2c20 305d 0a20 2020 203c 2f6c / 2, 0]. .
    • . │ │ │ +00093320: 2020 2020 2020 706f 696e 7420 333a 205b point 3: [ │ │ │ +00093330: 2d73 7175 6172 654c 656e 6774 6820 2f20 -squareLength / │ │ │ +00093340: 322c 202d 7371 7561 7265 4c65 6e67 7468 2, -squareLength │ │ │ +00093350: 202f 2032 2c20 305d 0a20 2020 203c 2f6c / 2, 0]. .
    .
  • . With REF │ │ │ +00093380: 3a20 534f 4c56 4550 4e50 5f53 5150 4e50 : SOLVEPNP_SQPNP │ │ │ +00093390: 2069 6e70 7574 2070 6f69 6e74 7320 6d75 input points mu │ │ │ +000933a0: 7374 2062 6520 2667 743b 3d20 330a 2020 st be >= 3. │ │ │ +000933b0: 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64 643e
  • .
    │ │ │ +000933c0: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    automatic │ │ │ +000933e0: 616c 6c79 2067 656e 6572 6174 6564 3c2f ally generated.
    .
    │ │ │ +00093400: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 ..
  • .
  • .
    .

    solvePnP │ │ │ +000934e0: 4765 6e65 7269 633c 2f68 333e 0a3c 6469 Generic

    ..public static │ │ │ +00093550: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  int findEssentialM │ │ │ -000935b0: 6174 3c2f 7370 616e 3e3c 7762 723e 3c73 at(Mat  │ │ │ -00093620: 3b70 6f69 6e74 7331 2c0a 203c 6120 6872 ;points1,. Mat&n │ │ │ -00093670: 6273 703b 706f 696e 7473 322c 0a20 3c61 bsp;points2,. Mat cameraMat │ │ │ -000936d0: 7269 782c 0a20 696e 7426 6e62 7370 3b6d rix,. int m │ │ │ -000936e0: 6574 686f 6429 3c2f 7370 616e 3e3c 2f64 ethod).
    Calculate │ │ │ -00093710: 7320 616e 2065 7373 656e 7469 616c 206d s an essential m │ │ │ -00093720: 6174 7269 7820 6672 6f6d 2074 6865 2063 atrix from the c │ │ │ -00093730: 6f72 7265 7370 6f6e 6469 6e67 2070 6f69 orresponding poi │ │ │ -00093740: 6e74 7320 696e 2074 776f 2069 6d61 6765 nts in two image │ │ │ -00093750: 732e 3c2f 6469 763e 0a3c 646c 2063 6c61 s.
    .
    .
    │ │ │ -00093770: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ -00093780: 0a3c 6464 3e3c 636f 6465 3e70 6f69 6e74 .
    point │ │ │ -00093790: 7331 3c2f 636f 6465 3e20 2d20 4172 7261 s1 - Arra │ │ │ -000937a0: 7920 6f66 204e 2028 4e20 2667 743b 3d20 y of N (N >= │ │ │ -000937b0: 3529 2032 4420 706f 696e 7473 2066 726f 5) 2D points fro │ │ │ -000937c0: 6d20 7468 6520 6669 7273 7420 696d 6167 m the first imag │ │ │ -000937d0: 652e 2054 6865 2070 6f69 6e74 2063 6f6f e. The point coo │ │ │ -000937e0: 7264 696e 6174 6573 2073 686f 756c 640a rdinates should. │ │ │ -000937f0: 6265 2066 6c6f 6174 696e 672d 706f 696e be floating-poin │ │ │ -00093800: 7420 2873 696e 676c 6520 6f72 2064 6f75 t (single or dou │ │ │ -00093810: 626c 6520 7072 6563 6973 696f 6e29 2e3c ble precision).< │ │ │ -00093820: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e70 /dd>.
    p │ │ │ -00093830: 6f69 6e74 7332 3c2f 636f 6465 3e20 2d20 oints2 - │ │ │ -00093840: 4172 7261 7920 6f66 2074 6865 2073 6563 Array of the sec │ │ │ -00093850: 6f6e 6420 696d 6167 6520 706f 696e 7473 ond image points │ │ │ -00093860: 206f 6620 7468 6520 7361 6d65 2073 697a of the same siz │ │ │ -00093870: 6520 616e 6420 666f 726d 6174 2061 7320 e and format as │ │ │ -00093880: 706f 696e 7473 312e 3c2f 6464 3e0a 3c64 points1.
    .cameraMa │ │ │ -000938a0: 7472 6978 3c2f 636f 6465 3e20 2d20 4361 trix - Ca │ │ │ -000938b0: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -000938c0: 6174 7269 7820 5c28 5c63 616d 6572 616d atrix \(\cameram │ │ │ -000938d0: 6174 7269 787b 417d 5c29 202e 0a4e 6f74 atrix{A}\) ..Not │ │ │ -000938e0: 6520 7468 6174 2074 6869 7320 6675 6e63 e that this func │ │ │ -000938f0: 7469 6f6e 2061 7373 756d 6573 2074 6861 tion assumes tha │ │ │ -00093900: 7420 706f 696e 7473 3120 616e 6420 706f t points1 and po │ │ │ -00093910: 696e 7473 3220 6172 6520 6665 6174 7572 ints2 are featur │ │ │ -00093920: 6520 706f 696e 7473 2066 726f 6d20 6361 e points from ca │ │ │ -00093930: 6d65 7261 7320 7769 7468 2074 6865 0a73 meras with the.s │ │ │ -00093940: 616d 6520 6361 6d65 7261 2069 6e74 7269 ame camera intri │ │ │ -00093950: 6e73 6963 206d 6174 7269 782e 2049 6620 nsic matrix. If │ │ │ -00093960: 7468 6973 2061 7373 756d 7074 696f 6e20 this assumption │ │ │ -00093970: 646f 6573 206e 6f74 2068 6f6c 6420 666f does not hold fo │ │ │ -00093980: 7220 796f 7572 2075 7365 2063 6173 652c r your use case, │ │ │ -00093990: 2075 7365 2061 6e6f 7468 6572 0a66 756e use another.fun │ │ │ -000939a0: 6374 696f 6e20 6f76 6572 6c6f 6164 206f ction overload o │ │ │ -000939b0: 7220 2375 6e64 6973 746f 7274 506f 696e r #undistortPoin │ │ │ -000939c0: 7473 2077 6974 6820 3c63 6f64 653e 5020 ts with P │ │ │ -000939d0: 3d20 6376 3a3a 4e6f 4172 7261 7928 293c = cv::NoArray()< │ │ │ -000939e0: 2f63 6f64 653e 2066 6f72 2062 6f74 6820 /code> for both │ │ │ -000939f0: 6361 6d65 7261 7320 746f 2074 7261 6e73 cameras to trans │ │ │ -00093a00: 666f 726d 2069 6d61 6765 0a70 6f69 6e74 form image.point │ │ │ -00093a10: 7320 746f 206e 6f72 6d61 6c69 7a65 6420 s to normalized │ │ │ -00093a20: 696d 6167 6520 636f 6f72 6469 6e61 7465 image coordinate │ │ │ -00093a30: 732c 2077 6869 6368 2061 7265 2076 616c s, which are val │ │ │ -00093a40: 6964 2066 6f72 2074 6865 2069 6465 6e74 id for the ident │ │ │ -00093a50: 6974 7920 6361 6d65 7261 2069 6e74 7269 ity camera intri │ │ │ -00093a60: 6e73 6963 206d 6174 7269 782e 0a57 6865 nsic matrix..Whe │ │ │ -00093a70: 6e20 7061 7373 696e 6720 7468 6573 6520 n passing these │ │ │ -00093a80: 636f 6f72 6469 6e61 7465 732c 2070 6173 coordinates, pas │ │ │ -00093a90: 7320 7468 6520 6964 656e 7469 7479 206d s the identity m │ │ │ -00093aa0: 6174 7269 7820 666f 7220 7468 6973 2070 atrix for this p │ │ │ -00093ab0: 6172 616d 6574 6572 2e3c 2f64 643e 0a3c arameter..< │ │ │ -00093ac0: 6464 3e3c 636f 6465 3e6d 6574 686f 643c dd>method< │ │ │ -00093ad0: 2f63 6f64 653e 202d 204d 6574 686f 6420 /code> - Method │ │ │ -00093ae0: 666f 7220 636f 6d70 7574 696e 6720 616e for computing an │ │ │ -00093af0: 2065 7373 656e 7469 616c 206d 6174 7269 essential matri │ │ │ -00093b00: 782e 0a3c 756c 3e0a 2020 3c6c 693e 0a20 x..
      .
    • . │ │ │ -00093b10: 2020 5245 463a 2052 414e 5341 4320 666f REF: RANSAC fo │ │ │ -00093b20: 7220 7468 6520 5241 4e53 4143 2061 6c67 r the RANSAC alg │ │ │ -00093b30: 6f72 6974 686d 2e0a 2020 3c2f 6c69 3e0a orithm..
    • . │ │ │ -00093b40: 2020 3c6c 693e 0a20 2020 5245 463a 204c
    • . REF: L │ │ │ -00093b50: 4d45 4453 2066 6f72 2074 6865 204c 4d65 MEDS for the LMe │ │ │ -00093b60: 6453 2061 6c67 6f72 6974 686d 2e0a 2020 dS algorithm.. │ │ │ -00093b70: 3c2f 6c69 3e0a 3c2f 756c 3e0a 636f 6e66
    • .
    .conf │ │ │ -00093b80: 6964 656e 6365 2028 7072 6f62 6162 696c idence (probabil │ │ │ -00093b90: 6974 7929 2074 6861 7420 7468 6520 6573 ity) that the es │ │ │ -00093ba0: 7469 6d61 7465 6420 6d61 7472 6978 2069 timated matrix i │ │ │ -00093bb0: 7320 636f 7272 6563 742e 0a6c 696e 6520 s correct..line │ │ │ -00093bc0: 696e 2070 6978 656c 732c 2062 6579 6f6e in pixels, beyon │ │ │ -00093bd0: 6420 7768 6963 6820 7468 6520 706f 696e d which the poin │ │ │ -00093be0: 7420 6973 2063 6f6e 7369 6465 7265 6420 t is considered │ │ │ -00093bf0: 616e 206f 7574 6c69 6572 2061 6e64 2069 an outlier and i │ │ │ -00093c00: 7320 6e6f 7420 7573 6564 2066 6f72 2063 s not used for c │ │ │ -00093c10: 6f6d 7075 7469 6e67 2074 6865 0a66 696e omputing the.fin │ │ │ -00093c20: 616c 2066 756e 6461 6d65 6e74 616c 206d al fundamental m │ │ │ -00093c30: 6174 7269 782e 2049 7420 6361 6e20 6265 atrix. It can be │ │ │ -00093c40: 2073 6574 2074 6f20 736f 6d65 7468 696e set to somethin │ │ │ -00093c50: 6720 6c69 6b65 2031 2d33 2c20 6465 7065 g like 1-3, depe │ │ │ -00093c60: 6e64 696e 6720 6f6e 2074 6865 2061 6363 nding on the acc │ │ │ -00093c70: 7572 6163 7920 6f66 2074 6865 0a70 6f69 uracy of the.poi │ │ │ -00093c80: 6e74 206c 6f63 616c 697a 6174 696f 6e2c nt localization, │ │ │ -00093c90: 2069 6d61 6765 2072 6573 6f6c 7574 696f image resolutio │ │ │ -00093ca0: 6e2c 2061 6e64 2074 6865 2069 6d61 6765 n, and the image │ │ │ -00093cb0: 206e 6f69 7365 2e0a 666f 7220 7468 6520 noise..for the │ │ │ -00093cc0: 6f74 6865 7220 706f 696e 7473 2e20 5468 other points. Th │ │ │ -00093cd0: 6520 6172 7261 7920 6973 2063 6f6d 7075 e array is compu │ │ │ -00093ce0: 7465 6420 6f6e 6c79 2069 6e20 7468 6520 ted only in the │ │ │ -00093cf0: 5241 4e53 4143 2061 6e64 204c 4d65 6453 RANSAC and LMedS │ │ │ -00093d00: 206d 6574 686f 6473 2e0a 0a54 6869 7320 methods...This │ │ │ -00093d10: 6675 6e63 7469 6f6e 2065 7374 696d 6174 function estimat │ │ │ -00093d20: 6573 2065 7373 656e 7469 616c 206d 6174 es essential mat │ │ │ -00093d30: 7269 7820 6261 7365 6420 6f6e 2074 6865 rix based on the │ │ │ -00093d40: 2066 6976 652d 706f 696e 7420 616c 676f five-point algo │ │ │ -00093d50: 7269 7468 6d20 736f 6c76 6572 2069 6e20 rithm solver in │ │ │ -00093d60: 4349 5445 3a20 4e69 7374 6572 3033 202e CITE: Nister03 . │ │ │ -00093d70: 0a43 4954 453a 2053 7465 7765 6e69 7573 .CITE: Stewenius │ │ │ -00093d80: 4346 5320 6973 2061 6c73 6f20 6120 7265 CFS is also a re │ │ │ -00093d90: 6c61 7465 642e 2054 6865 2065 7069 706f lated. The epipo │ │ │ -00093da0: 6c61 7220 6765 6f6d 6574 7279 2069 7320 lar geometry is │ │ │ -00093db0: 6465 7363 7269 6265 6420 6279 2074 6865 described by the │ │ │ -00093dc0: 2066 6f6c 6c6f 7769 6e67 2065 7175 6174 following equat │ │ │ -00093dd0: 696f 6e3a 0a0a 5c28 5b70 5f32 3b20 315d ion:..\([p_2; 1] │ │ │ -00093de0: 5e54 204b 5e7b 2d54 7d20 4520 4b5e 7b2d ^T K^{-T} E K^{- │ │ │ -00093df0: 317d 205b 705f 313b 2031 5d20 3d20 305c 1} [p_1; 1] = 0\ │ │ │ -00093e00: 290a 0a77 6865 7265 205c 2845 5c29 2069 )..where \(E\) i │ │ │ -00093e10: 7320 616e 2065 7373 656e 7469 616c 206d s an essential m │ │ │ -00093e20: 6174 7269 782c 205c 2870 5f31 5c29 2061 atrix, \(p_1\) a │ │ │ -00093e30: 6e64 205c 2870 5f32 5c29 2061 7265 2063 nd \(p_2\) are c │ │ │ -00093e40: 6f72 7265 7370 6f6e 6469 6e67 2070 6f69 orresponding poi │ │ │ -00093e50: 6e74 7320 696e 2074 6865 2066 6972 7374 nts in the first │ │ │ -00093e60: 2061 6e64 2074 6865 0a73 6563 6f6e 6420 and the.second │ │ │ -00093e70: 696d 6167 6573 2c20 7265 7370 6563 7469 images, respecti │ │ │ -00093e80: 7665 6c79 2e20 5468 6520 7265 7375 6c74 vely. The result │ │ │ -00093e90: 206f 6620 7468 6973 2066 756e 6374 696f of this functio │ │ │ -00093ea0: 6e20 6d61 7920 6265 2070 6173 7365 6420 n may be passed │ │ │ -00093eb0: 6675 7274 6865 7220 746f 0a23 6465 636f further to.#deco │ │ │ -00093ec0: 6d70 6f73 6545 7373 656e 7469 616c 4d61 mposeEssentialMa │ │ │ -00093ed0: 7420 6f72 2023 7265 636f 7665 7250 6f73 t or #recoverPos │ │ │ -00093ee0: 6520 746f 2072 6563 6f76 6572 2074 6865 e to recover the │ │ │ -00093ef0: 2072 656c 6174 6976 6520 706f 7365 2062 relative pose b │ │ │ -00093f00: 6574 7765 656e 2063 616d 6572 6173 2e3c etween cameras.< │ │ │ -00093f10: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ -00093f20: 3a3c 2f64 743e 0a3c 6464 3e61 7574 6f6d :
    .
    autom │ │ │ -00093f30: 6174 6963 616c 6c79 2067 656e 6572 6174 atically generat │ │ │ -00093f40: 6564 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f ed
    .
    ..
    . │ │ │ -00093f60: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..

    findE │ │ │ -00093fe0: 7373 656e 7469 616c 4d61 743c 2f68 333e ssentialMat

    │ │ │ -00093ff0: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ -00094010: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ -00094030: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ -00094040: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ -00094050: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ -00094060: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;Mat findEssent │ │ │ -000940f0: 6961 6c4d 6174 3c2f 7370 616e 3e3c 7762 ialMat(Mat& │ │ │ -00094160: 6e62 7370 3b70 6f69 6e74 7331 2c0a 203c nbsp;points1,. < │ │ │ -00094170: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -00094180: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -00094190: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000941a0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat points2, │ │ │ -000941c0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -00094200: 743c 2f61 3e26 6e62 7370 3b63 616d 6572 t camer │ │ │ -00094210: 614d 6174 7269 7829 3c2f 7370 616e 3e3c aMatrix)< │ │ │ -00094220: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Calcula │ │ │ -00094240: 7465 7320 616e 2065 7373 656e 7469 616c tes an essential │ │ │ -00094250: 206d 6174 7269 7820 6672 6f6d 2074 6865 matrix from the │ │ │ -00094260: 2063 6f72 7265 7370 6f6e 6469 6e67 2070 corresponding p │ │ │ -00094270: 6f69 6e74 7320 696e 2074 776f 2069 6d61 oints in two ima │ │ │ -00094280: 6765 732e 3c2f 6469 763e 0a3c 646c 2063 ges.
    .
    .Parameters:.
    poi │ │ │ -000942c0: 6e74 7331 3c2f 636f 6465 3e20 2d20 4172 nts1 - Ar │ │ │ -000942d0: 7261 7920 6f66 204e 2028 4e20 2667 743b ray of N (N > │ │ │ -000942e0: 3d20 3529 2032 4420 706f 696e 7473 2066 = 5) 2D points f │ │ │ -000942f0: 726f 6d20 7468 6520 6669 7273 7420 696d rom the first im │ │ │ -00094300: 6167 652e 2054 6865 2070 6f69 6e74 2063 age. The point c │ │ │ -00094310: 6f6f 7264 696e 6174 6573 2073 686f 756c oordinates shoul │ │ │ -00094320: 640a 6265 2066 6c6f 6174 696e 672d 706f d.be floating-po │ │ │ -00094330: 696e 7420 2873 696e 676c 6520 6f72 2064 int (single or d │ │ │ -00094340: 6f75 626c 6520 7072 6563 6973 696f 6e29 ouble precision) │ │ │ -00094350: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    points2 │ │ │ -00094370: 2d20 4172 7261 7920 6f66 2074 6865 2073 - Array of the s │ │ │ -00094380: 6563 6f6e 6420 696d 6167 6520 706f 696e econd image poin │ │ │ -00094390: 7473 206f 6620 7468 6520 7361 6d65 2073 ts of the same s │ │ │ -000943a0: 697a 6520 616e 6420 666f 726d 6174 2061 ize and format a │ │ │ -000943b0: 7320 706f 696e 7473 312e 3c2f 6464 3e0a s points1.
    . │ │ │ -000943c0: 3c64 643e 3c63 6f64 653e 6361 6d65 7261
    camera │ │ │ -000943d0: 4d61 7472 6978 3c2f 636f 6465 3e20 2d20 Matrix - │ │ │ -000943e0: 4361 6d65 7261 2069 6e74 7269 6e73 6963 Camera intrinsic │ │ │ -000943f0: 206d 6174 7269 7820 5c28 5c63 616d 6572 matrix \(\camer │ │ │ -00094400: 616d 6174 7269 787b 417d 5c29 202e 0a4e amatrix{A}\) ..N │ │ │ -00094410: 6f74 6520 7468 6174 2074 6869 7320 6675 ote that this fu │ │ │ -00094420: 6e63 7469 6f6e 2061 7373 756d 6573 2074 nction assumes t │ │ │ -00094430: 6861 7420 706f 696e 7473 3120 616e 6420 hat points1 and │ │ │ -00094440: 706f 696e 7473 3220 6172 6520 6665 6174 points2 are feat │ │ │ -00094450: 7572 6520 706f 696e 7473 2066 726f 6d20 ure points from │ │ │ -00094460: 6361 6d65 7261 7320 7769 7468 2074 6865 cameras with the │ │ │ -00094470: 0a73 616d 6520 6361 6d65 7261 2069 6e74 .same camera int │ │ │ -00094480: 7269 6e73 6963 206d 6174 7269 782e 2049 rinsic matrix. I │ │ │ -00094490: 6620 7468 6973 2061 7373 756d 7074 696f f this assumptio │ │ │ -000944a0: 6e20 646f 6573 206e 6f74 2068 6f6c 6420 n does not hold │ │ │ -000944b0: 666f 7220 796f 7572 2075 7365 2063 6173 for your use cas │ │ │ -000944c0: 652c 2075 7365 2061 6e6f 7468 6572 0a66 e, use another.f │ │ │ -000944d0: 756e 6374 696f 6e20 6f76 6572 6c6f 6164 unction overload │ │ │ -000944e0: 206f 7220 2375 6e64 6973 746f 7274 506f or #undistortPo │ │ │ -000944f0: 696e 7473 2077 6974 6820 3c63 6f64 653e ints with │ │ │ -00094500: 5020 3d20 6376 3a3a 4e6f 4172 7261 7928 P = cv::NoArray( │ │ │ -00094510: 293c 2f63 6f64 653e 2066 6f72 2062 6f74 ) for bot │ │ │ -00094520: 6820 6361 6d65 7261 7320 746f 2074 7261 h cameras to tra │ │ │ -00094530: 6e73 666f 726d 2069 6d61 6765 0a70 6f69 nsform image.poi │ │ │ -00094540: 6e74 7320 746f 206e 6f72 6d61 6c69 7a65 nts to normalize │ │ │ -00094550: 6420 696d 6167 6520 636f 6f72 6469 6e61 d image coordina │ │ │ -00094560: 7465 732c 2077 6869 6368 2061 7265 2076 tes, which are v │ │ │ -00094570: 616c 6964 2066 6f72 2074 6865 2069 6465 alid for the ide │ │ │ -00094580: 6e74 6974 7920 6361 6d65 7261 2069 6e74 ntity camera int │ │ │ -00094590: 7269 6e73 6963 206d 6174 7269 782e 0a57 rinsic matrix..W │ │ │ -000945a0: 6865 6e20 7061 7373 696e 6720 7468 6573 hen passing thes │ │ │ -000945b0: 6520 636f 6f72 6469 6e61 7465 732c 2070 e coordinates, p │ │ │ -000945c0: 6173 7320 7468 6520 6964 656e 7469 7479 ass the identity │ │ │ -000945d0: 206d 6174 7269 7820 666f 7220 7468 6973 matrix for this │ │ │ -000945e0: 2070 6172 616d 6574 6572 2e0a 3c75 6c3e parameter..
      │ │ │ -000945f0: 0a20 203c 6c69 3e0a 2020 2052 4546 3a20 .
    • . REF: │ │ │ -00094600: 5241 4e53 4143 2066 6f72 2074 6865 2052 RANSAC for the R │ │ │ -00094610: 414e 5341 4320 616c 676f 7269 7468 6d2e ANSAC algorithm. │ │ │ -00094620: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ -00094630: 2020 2052 4546 3a20 4c4d 4544 5320 666f REF: LMEDS fo │ │ │ -00094640: 7220 7468 6520 4c4d 6564 5320 616c 676f r the LMedS algo │ │ │ -00094650: 7269 7468 6d2e 0a20 203c 2f6c 693e 0a3c rithm..
    • .< │ │ │ -00094660: 2f75 6c3e 0a63 6f6e 6669 6465 6e63 6520 /ul>.confidence │ │ │ -00094670: 2870 726f 6261 6269 6c69 7479 2920 7468 (probability) th │ │ │ -00094680: 6174 2074 6865 2065 7374 696d 6174 6564 at the estimated │ │ │ -00094690: 206d 6174 7269 7820 6973 2063 6f72 7265 matrix is corre │ │ │ -000946a0: 6374 2e0a 6c69 6e65 2069 6e20 7069 7865 ct..line in pixe │ │ │ -000946b0: 6c73 2c20 6265 796f 6e64 2077 6869 6368 ls, beyond which │ │ │ -000946c0: 2074 6865 2070 6f69 6e74 2069 7320 636f the point is co │ │ │ -000946d0: 6e73 6964 6572 6564 2061 6e20 6f75 746c nsidered an outl │ │ │ -000946e0: 6965 7220 616e 6420 6973 206e 6f74 2075 ier and is not u │ │ │ -000946f0: 7365 6420 666f 7220 636f 6d70 7574 696e sed for computin │ │ │ -00094700: 6720 7468 650a 6669 6e61 6c20 6675 6e64 g the.final fund │ │ │ -00094710: 616d 656e 7461 6c20 6d61 7472 6978 2e20 amental matrix. │ │ │ -00094720: 4974 2063 616e 2062 6520 7365 7420 746f It can be set to │ │ │ -00094730: 2073 6f6d 6574 6869 6e67 206c 696b 6520 something like │ │ │ -00094740: 312d 332c 2064 6570 656e 6469 6e67 206f 1-3, depending o │ │ │ -00094750: 6e20 7468 6520 6163 6375 7261 6379 206f n the accuracy o │ │ │ -00094760: 6620 7468 650a 706f 696e 7420 6c6f 6361 f the.point loca │ │ │ -00094770: 6c69 7a61 7469 6f6e 2c20 696d 6167 6520 lization, image │ │ │ -00094780: 7265 736f 6c75 7469 6f6e 2c20 616e 6420 resolution, and │ │ │ -00094790: 7468 6520 696d 6167 6520 6e6f 6973 652e the image noise. │ │ │ -000947a0: 0a66 6f72 2074 6865 206f 7468 6572 2070 .for the other p │ │ │ -000947b0: 6f69 6e74 732e 2054 6865 2061 7272 6179 oints. The array │ │ │ -000947c0: 2069 7320 636f 6d70 7574 6564 206f 6e6c is computed onl │ │ │ -000947d0: 7920 696e 2074 6865 2052 414e 5341 4320 y in the RANSAC │ │ │ -000947e0: 616e 6420 4c4d 6564 5320 6d65 7468 6f64 and LMedS method │ │ │ -000947f0: 732e 0a0a 5468 6973 2066 756e 6374 696f s...This functio │ │ │ -00094800: 6e20 6573 7469 6d61 7465 7320 6573 7365 n estimates esse │ │ │ -00094810: 6e74 6961 6c20 6d61 7472 6978 2062 6173 ntial matrix bas │ │ │ -00094820: 6564 206f 6e20 7468 6520 6669 7665 2d70 ed on the five-p │ │ │ -00094830: 6f69 6e74 2061 6c67 6f72 6974 686d 2073 oint algorithm s │ │ │ -00094840: 6f6c 7665 7220 696e 2043 4954 453a 204e olver in CITE: N │ │ │ -00094850: 6973 7465 7230 3320 2e0a 4349 5445 3a20 ister03 ..CITE: │ │ │ -00094860: 5374 6577 656e 6975 7343 4653 2069 7320 SteweniusCFS is │ │ │ -00094870: 616c 736f 2061 2072 656c 6174 6564 2e20 also a related. │ │ │ -00094880: 5468 6520 6570 6970 6f6c 6172 2067 656f The epipolar geo │ │ │ -00094890: 6d65 7472 7920 6973 2064 6573 6372 6962 metry is describ │ │ │ -000948a0: 6564 2062 7920 7468 6520 666f 6c6c 6f77 ed by the follow │ │ │ -000948b0: 696e 6720 6571 7561 7469 6f6e 3a0a 0a5c ing equation:..\ │ │ │ -000948c0: 285b 705f 323b 2031 5d5e 5420 4b5e 7b2d ([p_2; 1]^T K^{- │ │ │ -000948d0: 547d 2045 204b 5e7b 2d31 7d20 5b70 5f31 T} E K^{-1} [p_1 │ │ │ -000948e0: 3b20 315d 203d 2030 5c29 0a0a 7768 6572 ; 1] = 0\)..wher │ │ │ -000948f0: 6520 5c28 455c 2920 6973 2061 6e20 6573 e \(E\) is an es │ │ │ -00094900: 7365 6e74 6961 6c20 6d61 7472 6978 2c20 sential matrix, │ │ │ -00094910: 5c28 705f 315c 2920 616e 6420 5c28 705f \(p_1\) and \(p_ │ │ │ -00094920: 325c 2920 6172 6520 636f 7272 6573 706f 2\) are correspo │ │ │ -00094930: 6e64 696e 6720 706f 696e 7473 2069 6e20 nding points in │ │ │ -00094940: 7468 6520 6669 7273 7420 616e 6420 7468 the first and th │ │ │ -00094950: 650a 7365 636f 6e64 2069 6d61 6765 732c e.second images, │ │ │ -00094960: 2072 6573 7065 6374 6976 656c 792e 2054 respectively. T │ │ │ -00094970: 6865 2072 6573 756c 7420 6f66 2074 6869 he result of thi │ │ │ -00094980: 7320 6675 6e63 7469 6f6e 206d 6179 2062 s function may b │ │ │ -00094990: 6520 7061 7373 6564 2066 7572 7468 6572 e passed further │ │ │ -000949a0: 2074 6f0a 2364 6563 6f6d 706f 7365 4573 to.#decomposeEs │ │ │ -000949b0: 7365 6e74 6961 6c4d 6174 206f 7220 2372 sentialMat or #r │ │ │ -000949c0: 6563 6f76 6572 506f 7365 2074 6f20 7265 ecoverPose to re │ │ │ -000949d0: 636f 7665 7220 7468 6520 7265 6c61 7469 cover the relati │ │ │ -000949e0: 7665 2070 6f73 6520 6265 7477 6565 6e20 ve pose between │ │ │ -000949f0: 6361 6d65 7261 732e 3c2f 6464 3e0a 3c64 cameras.
    .Returns:. │ │ │ -00094a10: 3c64 643e 6175 746f 6d61 7469 6361 6c6c
    automaticall │ │ │ -00094a20: 7920 6765 6e65 7261 7465 643c 2f64 643e y generated
    │ │ │ -00094a30: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    .
    ..
  • .< │ │ │ -00094a50: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .

    findEssen │ │ │ -00094b00: 7469 616c 4d61 743c 2f68 333e 0a3c 6469 tialMat

    ..public static │ │ │ -00094b70: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  Mat findEssentialM │ │ │ -00094c10: 6174 3c2f 7370 616e 3e3c 7762 723e 3c73 at(Mat  │ │ │ -00094c80: 3b70 6f69 6e74 7331 2c0a 203c 6120 6872 ;points1,. Mat&n │ │ │ -00094cd0: 6273 703b 706f 696e 7473 322c 0a20 646f bsp;points2,. do │ │ │ -00094ce0: 7562 6c65 266e 6273 703b 666f 6361 6c2c uble focal, │ │ │ -00094cf0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . │ │ │ -00094d30: 506f 696e 743c 2f61 3e26 6e62 7370 3b70 Point p │ │ │ -00094d40: 702c 0a20 696e 7426 6e62 7370 3b6d 6574 p,. int met │ │ │ -00094d50: 686f 642c 0a20 646f 7562 6c65 266e 6273 hod,. double&nbs │ │ │ -00094d60: 703b 7072 6f62 2c0a 2064 6f75 626c 6526 p;prob,. double& │ │ │ -00094d70: 6e62 7370 3b74 6872 6573 686f 6c64 2c0a nbsp;threshold,. │ │ │ -00094d80: 2069 6e74 266e 6273 703b 6d61 7849 7465 int maxIte │ │ │ -00094d90: 7273 2c0a 203c 6120 6872 6566 3d22 2e2e rs,. Mat ma │ │ │ -00094de0: 736b 293c 2f73 7061 6e3e 3c2f 6469 763e sk) │ │ │ -00094df0: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ -00094e10: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    points1 - Array of N ( │ │ │ -00094e40: 4e20 2667 743b 3d20 3529 2032 4420 706f N >= 5) 2D po │ │ │ -00094e50: 696e 7473 2066 726f 6d20 7468 6520 6669 ints from the fi │ │ │ -00094e60: 7273 7420 696d 6167 652e 2054 6865 2070 rst image. The p │ │ │ -00094e70: 6f69 6e74 2063 6f6f 7264 696e 6174 6573 oint coordinates │ │ │ -00094e80: 2073 686f 756c 640a 6265 2066 6c6f 6174 should.be float │ │ │ -00094e90: 696e 672d 706f 696e 7420 2873 696e 676c ing-point (singl │ │ │ -00094ea0: 6520 6f72 2064 6f75 626c 6520 7072 6563 e or double prec │ │ │ -00094eb0: 6973 696f 6e29 2e3c 2f64 643e 0a3c 6464 ision).
    .
    points2 - Array of │ │ │ -00094ee0: 2074 6865 2073 6563 6f6e 6420 696d 6167 the second imag │ │ │ -00094ef0: 6520 706f 696e 7473 206f 6620 7468 6520 e points of the │ │ │ -00094f00: 7361 6d65 2073 697a 6520 616e 6420 666f same size and fo │ │ │ -00094f10: 726d 6174 2061 7320 706f 696e 7473 3120 rmat as points1 │ │ │ -00094f20: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    focal - │ │ │ -00094f40: 666f 6361 6c20 6c65 6e67 7468 206f 6620 focal length of │ │ │ -00094f50: 7468 6520 6361 6d65 7261 2e20 4e6f 7465 the camera. Note │ │ │ -00094f60: 2074 6861 7420 7468 6973 2066 756e 6374 that this funct │ │ │ -00094f70: 696f 6e20 6173 7375 6d65 7320 7468 6174 ion assumes that │ │ │ -00094f80: 2070 6f69 6e74 7331 2061 6e64 2070 6f69 points1 and poi │ │ │ -00094f90: 6e74 7332 0a61 7265 2066 6561 7475 7265 nts2.are feature │ │ │ -00094fa0: 2070 6f69 6e74 7320 6672 6f6d 2063 616d points from cam │ │ │ -00094fb0: 6572 6173 2077 6974 6820 7361 6d65 2066 eras with same f │ │ │ -00094fc0: 6f63 616c 206c 656e 6774 6820 616e 6420 ocal length and │ │ │ -00094fd0: 7072 696e 6369 7061 6c20 706f 696e 742e principal point. │ │ │ -00094fe0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -00094ff0: 7070 3c2f 636f 6465 3e20 2d20 7072 696e pp - prin │ │ │ -00095000: 6369 7061 6c20 706f 696e 7420 6f66 2074 cipal point of t │ │ │ -00095010: 6865 2063 616d 6572 612e 3c2f 6464 3e0a he camera.
    . │ │ │ -00095020: 3c64 643e 3c63 6f64 653e 6d65 7468 6f64
    method │ │ │ -00095030: 3c2f 636f 6465 3e20 2d20 4d65 7468 6f64 - Method │ │ │ -00095040: 2066 6f72 2063 6f6d 7075 7469 6e67 2061 for computing a │ │ │ -00095050: 2066 756e 6461 6d65 6e74 616c 206d 6174 fundamental mat │ │ │ -00095060: 7269 782e 0a3c 756c 3e0a 2020 3c6c 693e rix..
      .
    • │ │ │ -00095070: 0a20 2020 5245 463a 2052 414e 5341 4320 . REF: RANSAC │ │ │ -00095080: 666f 7220 7468 6520 5241 4e53 4143 2061 for the RANSAC a │ │ │ -00095090: 6c67 6f72 6974 686d 2e0a 2020 3c2f 6c69 lgorithm..
    • .
    • . REF: │ │ │ -000950b0: 204c 4d45 4453 2066 6f72 2074 6865 204c LMEDS for the L │ │ │ -000950c0: 4d65 6453 2061 6c67 6f72 6974 686d 2e0a MedS algorithm.. │ │ │ -000950d0: 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64
    • .
    .
    pro │ │ │ -000950f0: 623c 2f63 6f64 653e 202d 2050 6172 616d b - Param │ │ │ -00095100: 6574 6572 2075 7365 6420 666f 7220 7468 eter used for th │ │ │ -00095110: 6520 5241 4e53 4143 206f 7220 4c4d 6564 e RANSAC or LMed │ │ │ -00095120: 5320 6d65 7468 6f64 7320 6f6e 6c79 2e20 S methods only. │ │ │ -00095130: 4974 2073 7065 6369 6669 6573 2061 2064 It specifies a d │ │ │ -00095140: 6573 6972 6162 6c65 206c 6576 656c 206f esirable level o │ │ │ -00095150: 660a 636f 6e66 6964 656e 6365 2028 7072 f.confidence (pr │ │ │ -00095160: 6f62 6162 696c 6974 7929 2074 6861 7420 obability) that │ │ │ -00095170: 7468 6520 6573 7469 6d61 7465 6420 6d61 the estimated ma │ │ │ -00095180: 7472 6978 2069 7320 636f 7272 6563 742e trix is correct. │ │ │ -00095190: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000951a0: 7468 7265 7368 6f6c 643c 2f63 6f64 653e threshold │ │ │ -000951b0: 202d 2050 6172 616d 6574 6572 2075 7365 - Parameter use │ │ │ -000951c0: 6420 666f 7220 5241 4e53 4143 2e20 4974 d for RANSAC. It │ │ │ -000951d0: 2069 7320 7468 6520 6d61 7869 6d75 6d20 is the maximum │ │ │ -000951e0: 6469 7374 616e 6365 2066 726f 6d20 6120 distance from a │ │ │ -000951f0: 706f 696e 7420 746f 2061 6e20 6570 6970 point to an epip │ │ │ -00095200: 6f6c 6172 0a6c 696e 6520 696e 2070 6978 olar.line in pix │ │ │ -00095210: 656c 732c 2062 6579 6f6e 6420 7768 6963 els, beyond whic │ │ │ -00095220: 6820 7468 6520 706f 696e 7420 6973 2063 h the point is c │ │ │ -00095230: 6f6e 7369 6465 7265 6420 616e 206f 7574 onsidered an out │ │ │ -00095240: 6c69 6572 2061 6e64 2069 7320 6e6f 7420 lier and is not │ │ │ -00095250: 7573 6564 2066 6f72 2063 6f6d 7075 7469 used for computi │ │ │ -00095260: 6e67 2074 6865 0a66 696e 616c 2066 756e ng the.final fun │ │ │ -00095270: 6461 6d65 6e74 616c 206d 6174 7269 782e damental matrix. │ │ │ -00095280: 2049 7420 6361 6e20 6265 2073 6574 2074 It can be set t │ │ │ -00095290: 6f20 736f 6d65 7468 696e 6720 6c69 6b65 o something like │ │ │ -000952a0: 2031 2d33 2c20 6465 7065 6e64 696e 6720 1-3, depending │ │ │ -000952b0: 6f6e 2074 6865 2061 6363 7572 6163 7920 on the accuracy │ │ │ -000952c0: 6f66 2074 6865 0a70 6f69 6e74 206c 6f63 of the.point loc │ │ │ -000952d0: 616c 697a 6174 696f 6e2c 2069 6d61 6765 alization, image │ │ │ -000952e0: 2072 6573 6f6c 7574 696f 6e2c 2061 6e64 resolution, and │ │ │ -000952f0: 2074 6865 2069 6d61 6765 206e 6f69 7365 the image noise │ │ │ -00095300: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    maxIters │ │ │ -00095320: 202d 2054 6865 206d 6178 696d 756d 206e - The maximum n │ │ │ -00095330: 756d 6265 7220 6f66 2072 6f62 7573 7420 umber of robust │ │ │ -00095340: 6d65 7468 6f64 2069 7465 7261 7469 6f6e method iteration │ │ │ -00095350: 732e 0a0a 5468 6973 2066 756e 6374 696f s...This functio │ │ │ -00095360: 6e20 6469 6666 6572 7320 6672 6f6d 2074 n differs from t │ │ │ -00095370: 6865 206f 6e65 2061 626f 7665 2074 6861 he one above tha │ │ │ -00095380: 7420 6974 2063 6f6d 7075 7465 7320 6361 t it computes ca │ │ │ -00095390: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -000953a0: 6174 7269 7820 6672 6f6d 2066 6f63 616c atrix from focal │ │ │ -000953b0: 206c 656e 6774 6820 616e 640a 7072 696e length and.prin │ │ │ -000953c0: 6369 7061 6c20 706f 696e 743a 0a0a 5c28 cipal point:..\( │ │ │ -000953d0: 4120 3d0a 5c62 6567 696e 7b62 6d61 7472 A =.\begin{bmatr │ │ │ -000953e0: 6978 7d0a 6620 2661 6d70 3b20 3020 2661 ix}.f & 0 &a │ │ │ -000953f0: 6d70 3b20 785f 7b70 707d 2020 5c5c 0a30 mp; x_{pp} \\.0 │ │ │ -00095400: 2026 616d 703b 2066 2026 616d 703b 2079 & f & y │ │ │ -00095410: 5f7b 7070 7d20 205c 5c0a 3020 2661 6d70 _{pp} \\.0 & │ │ │ -00095420: 3b20 3020 2661 6d70 3b20 310a 5c65 6e64 ; 0 & 1.\end │ │ │ -00095430: 7b62 6d61 7472 6978 7d5c 293c 2f64 643e {bmatrix}\)
    │ │ │ -00095440: 0a3c 6464 3e3c 636f 6465 3e6d 6173 6b3c .
    mask< │ │ │ -00095450: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ -00095460: 6172 7261 7920 6f66 204e 2065 6c65 6d65 array of N eleme │ │ │ -00095470: 6e74 732c 2065 7665 7279 2065 6c65 6d65 nts, every eleme │ │ │ -00095480: 6e74 206f 6620 7768 6963 6820 6973 2073 nt of which is s │ │ │ -00095490: 6574 2074 6f20 3020 666f 7220 6f75 746c et to 0 for outl │ │ │ -000954a0: 6965 7273 2061 6e64 2074 6f20 310a 666f iers and to 1.fo │ │ │ -000954b0: 7220 7468 6520 6f74 6865 7220 706f 696e r the other poin │ │ │ -000954c0: 7473 2e20 5468 6520 6172 7261 7920 6973 ts. The array is │ │ │ -000954d0: 2063 6f6d 7075 7465 6420 6f6e 6c79 2069 computed only i │ │ │ -000954e0: 6e20 7468 6520 5241 4e53 4143 2061 6e64 n the RANSAC and │ │ │ -000954f0: 204c 4d65 6453 206d 6574 686f 6473 2e3c LMedS methods.< │ │ │ -00095500: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ -00095510: 3a3c 2f64 743e 0a3c 6464 3e61 7574 6f6d :
    .
    autom │ │ │ -00095520: 6174 6963 616c 6c79 2067 656e 6572 6174 atically generat │ │ │ -00095530: 6564 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f ed
    .
    ..
    . │ │ │ -00095550: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374 .
  • ..

    findEs │ │ │ -000955f0: 7365 6e74 6961 6c4d 6174 3c2f 6833 3e0a sentialMat

    . │ │ │ -00095600: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ -00095620: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ -00095660: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ -00095670: 3c73 7061 6e20 636c 6173 733d 2272 6574 Mat findEssenti │ │ │ -00095700: 616c 4d61 743c 2f73 7061 6e3e 3c77 6272 alMat(Mat&n │ │ │ -00095770: 6273 703b 706f 696e 7473 312c 0a20 3c61 bsp;points1,. Mat points2,. │ │ │ -000957d0: 2064 6f75 626c 6526 6e62 7370 3b66 6f63 double foc │ │ │ -000957e0: 616c 2c0a 203c 6120 6872 6566 3d22 2e2e al,. Point&nbs │ │ │ -00095830: 703b 7070 2c0a 2069 6e74 266e 6273 703b p;pp,. int  │ │ │ -00095840: 6d65 7468 6f64 2c0a 2064 6f75 626c 6526 method,. double& │ │ │ -00095850: 6e62 7370 3b70 726f 622c 0a20 646f 7562 nbsp;prob,. doub │ │ │ -00095860: 6c65 266e 6273 703b 7468 7265 7368 6f6c le threshol │ │ │ -00095870: 642c 0a20 696e 7426 6e62 7370 3b6d 6178 d,. int max │ │ │ -00095880: 4974 6572 7329 3c2f 7370 616e 3e3c 2f64 Iters).
    .
    Param │ │ │ -000958b0: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ -000958c0: 3c63 6f64 653e 706f 696e 7473 313c 2f63 points1 - Array of │ │ │ -000958e0: 4e20 284e 2026 6774 3b3d 2035 2920 3244 N (N >= 5) 2D │ │ │ -000958f0: 2070 6f69 6e74 7320 6672 6f6d 2074 6865 points from the │ │ │ -00095900: 2066 6972 7374 2069 6d61 6765 2e20 5468 first image. Th │ │ │ -00095910: 6520 706f 696e 7420 636f 6f72 6469 6e61 e point coordina │ │ │ -00095920: 7465 7320 7368 6f75 6c64 0a62 6520 666c tes should.be fl │ │ │ -00095930: 6f61 7469 6e67 2d70 6f69 6e74 2028 7369 oating-point (si │ │ │ -00095940: 6e67 6c65 206f 7220 646f 7562 6c65 2070 ngle or double p │ │ │ -00095950: 7265 6369 7369 6f6e 292e 3c2f 6464 3e0a recision).
    . │ │ │ -00095960: 3c64 643e 3c63 6f64 653e 706f 696e 7473
    points │ │ │ -00095970: 323c 2f63 6f64 653e 202d 2041 7272 6179 2 - Array │ │ │ -00095980: 206f 6620 7468 6520 7365 636f 6e64 2069 of the second i │ │ │ -00095990: 6d61 6765 2070 6f69 6e74 7320 6f66 2074 mage points of t │ │ │ -000959a0: 6865 2073 616d 6520 7369 7a65 2061 6e64 he same size and │ │ │ -000959b0: 2066 6f72 6d61 7420 6173 2070 6f69 6e74 format as point │ │ │ -000959c0: 7331 202e 3c2f 6464 3e0a 3c64 643e 3c63 s1 .
    .
    focal │ │ │ -000959e0: 202d 2066 6f63 616c 206c 656e 6774 6820 - focal length │ │ │ -000959f0: 6f66 2074 6865 2063 616d 6572 612e 204e of the camera. N │ │ │ -00095a00: 6f74 6520 7468 6174 2074 6869 7320 6675 ote that this fu │ │ │ -00095a10: 6e63 7469 6f6e 2061 7373 756d 6573 2074 nction assumes t │ │ │ -00095a20: 6861 7420 706f 696e 7473 3120 616e 6420 hat points1 and │ │ │ -00095a30: 706f 696e 7473 320a 6172 6520 6665 6174 points2.are feat │ │ │ -00095a40: 7572 6520 706f 696e 7473 2066 726f 6d20 ure points from │ │ │ -00095a50: 6361 6d65 7261 7320 7769 7468 2073 616d cameras with sam │ │ │ -00095a60: 6520 666f 6361 6c20 6c65 6e67 7468 2061 e focal length a │ │ │ -00095a70: 6e64 2070 7269 6e63 6970 616c 2070 6f69 nd principal poi │ │ │ -00095a80: 6e74 2e3c 2f64 643e 0a3c 6464 3e3c 636f nt.
    .
    pp - p │ │ │ -00095aa0: 7269 6e63 6970 616c 2070 6f69 6e74 206f rincipal point o │ │ │ -00095ab0: 6620 7468 6520 6361 6d65 7261 2e3c 2f64 f the camera..
    met │ │ │ -00095ad0: 686f 643c 2f63 6f64 653e 202d 204d 6574 hod - Met │ │ │ -00095ae0: 686f 6420 666f 7220 636f 6d70 7574 696e hod for computin │ │ │ -00095af0: 6720 6120 6675 6e64 616d 656e 7461 6c20 g a fundamental │ │ │ -00095b00: 6d61 7472 6978 2e0a 3c75 6c3e 0a20 203c matrix..
      . < │ │ │ -00095b10: 6c69 3e0a 2020 2052 4546 3a20 5241 4e53 li>. REF: RANS │ │ │ -00095b20: 4143 2066 6f72 2074 6865 2052 414e 5341 AC for the RANSA │ │ │ -00095b30: 4320 616c 676f 7269 7468 6d2e 0a20 203c C algorithm.. < │ │ │ -00095b40: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2052 /li>.
    • . R │ │ │ -00095b50: 4546 3a20 4c4d 4544 5320 666f 7220 7468 EF: LMEDS for th │ │ │ -00095b60: 6520 4c4d 6564 5320 616c 676f 7269 7468 e LMedS algorith │ │ │ -00095b70: 6d2e 0a20 203c 2f6c 693e 0a3c 2f75 6c3e m..
    • .
    │ │ │ -00095b80: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -00095b90: 7072 6f62 3c2f 636f 6465 3e20 2d20 5061 prob - Pa │ │ │ -00095ba0: 7261 6d65 7465 7220 7573 6564 2066 6f72 rameter used for │ │ │ -00095bb0: 2074 6865 2052 414e 5341 4320 6f72 204c the RANSAC or L │ │ │ -00095bc0: 4d65 6453 206d 6574 686f 6473 206f 6e6c MedS methods onl │ │ │ -00095bd0: 792e 2049 7420 7370 6563 6966 6965 7320 y. It specifies │ │ │ -00095be0: 6120 6465 7369 7261 626c 6520 6c65 7665 a desirable leve │ │ │ -00095bf0: 6c20 6f66 0a63 6f6e 6669 6465 6e63 6520 l of.confidence │ │ │ -00095c00: 2870 726f 6261 6269 6c69 7479 2920 7468 (probability) th │ │ │ -00095c10: 6174 2074 6865 2065 7374 696d 6174 6564 at the estimated │ │ │ -00095c20: 206d 6174 7269 7820 6973 2063 6f72 7265 matrix is corre │ │ │ -00095c30: 6374 2e0a 666f 7220 7468 6520 6f74 6865 ct..for the othe │ │ │ -00095c40: 7220 706f 696e 7473 2e20 5468 6520 6172 r points. The ar │ │ │ -00095c50: 7261 7920 6973 2063 6f6d 7075 7465 6420 ray is computed │ │ │ -00095c60: 6f6e 6c79 2069 6e20 7468 6520 5241 4e53 only in the RANS │ │ │ -00095c70: 4143 2061 6e64 204c 4d65 6453 206d 6574 AC and LMedS met │ │ │ -00095c80: 686f 6473 2e3c 2f64 643e 0a3c 6464 3e3c hods.
    .
    < │ │ │ -00095c90: 636f 6465 3e74 6872 6573 686f 6c64 3c2f code>threshold - Paramete │ │ │ -00095cb0: 7220 7573 6564 2066 6f72 2052 414e 5341 r used for RANSA │ │ │ -00095cc0: 432e 2049 7420 6973 2074 6865 206d 6178 C. It is the max │ │ │ -00095cd0: 696d 756d 2064 6973 7461 6e63 6520 6672 imum distance fr │ │ │ -00095ce0: 6f6d 2061 2070 6f69 6e74 2074 6f20 616e om a point to an │ │ │ -00095cf0: 2065 7069 706f 6c61 720a 6c69 6e65 2069 epipolar.line i │ │ │ -00095d00: 6e20 7069 7865 6c73 2c20 6265 796f 6e64 n pixels, beyond │ │ │ -00095d10: 2077 6869 6368 2074 6865 2070 6f69 6e74 which the point │ │ │ -00095d20: 2069 7320 636f 6e73 6964 6572 6564 2061 is considered a │ │ │ -00095d30: 6e20 6f75 746c 6965 7220 616e 6420 6973 n outlier and is │ │ │ -00095d40: 206e 6f74 2075 7365 6420 666f 7220 636f not used for co │ │ │ -00095d50: 6d70 7574 696e 6720 7468 650a 6669 6e61 mputing the.fina │ │ │ -00095d60: 6c20 6675 6e64 616d 656e 7461 6c20 6d61 l fundamental ma │ │ │ -00095d70: 7472 6978 2e20 4974 2063 616e 2062 6520 trix. It can be │ │ │ -00095d80: 7365 7420 746f 2073 6f6d 6574 6869 6e67 set to something │ │ │ -00095d90: 206c 696b 6520 312d 332c 2064 6570 656e like 1-3, depen │ │ │ -00095da0: 6469 6e67 206f 6e20 7468 6520 6163 6375 ding on the accu │ │ │ -00095db0: 7261 6379 206f 6620 7468 650a 706f 696e racy of the.poin │ │ │ -00095dc0: 7420 6c6f 6361 6c69 7a61 7469 6f6e 2c20 t localization, │ │ │ -00095dd0: 696d 6167 6520 7265 736f 6c75 7469 6f6e image resolution │ │ │ -00095de0: 2c20 616e 6420 7468 6520 696d 6167 6520 , and the image │ │ │ -00095df0: 6e6f 6973 652e 3c2f 6464 3e0a 3c64 643e noise.
    .
    │ │ │ -00095e00: 3c63 6f64 653e 6d61 7849 7465 7273 3c2f maxIters - The maxi │ │ │ -00095e20: 6d75 6d20 6e75 6d62 6572 206f 6620 726f mum number of ro │ │ │ -00095e30: 6275 7374 206d 6574 686f 6420 6974 6572 bust method iter │ │ │ -00095e40: 6174 696f 6e73 2e0a 0a54 6869 7320 6675 ations...This fu │ │ │ -00095e50: 6e63 7469 6f6e 2064 6966 6665 7273 2066 nction differs f │ │ │ -00095e60: 726f 6d20 7468 6520 6f6e 6520 6162 6f76 rom the one abov │ │ │ -00095e70: 6520 7468 6174 2069 7420 636f 6d70 7574 e that it comput │ │ │ -00095e80: 6573 2063 616d 6572 6120 696e 7472 696e es camera intrin │ │ │ -00095e90: 7369 6320 6d61 7472 6978 2066 726f 6d20 sic matrix from │ │ │ -00095ea0: 666f 6361 6c20 6c65 6e67 7468 2061 6e64 focal length and │ │ │ -00095eb0: 0a70 7269 6e63 6970 616c 2070 6f69 6e74 .principal point │ │ │ -00095ec0: 3a0a 0a5c 2841 203d 0a5c 6265 6769 6e7b :..\(A =.\begin{ │ │ │ -00095ed0: 626d 6174 7269 787d 0a66 2026 616d 703b bmatrix}.f & │ │ │ -00095ee0: 2030 2026 616d 703b 2078 5f7b 7070 7d20 0 & x_{pp} │ │ │ -00095ef0: 205c 5c0a 3020 2661 6d70 3b20 6620 2661 \\.0 & f &a │ │ │ -00095f00: 6d70 3b20 795f 7b70 707d 2020 5c5c 0a30 mp; y_{pp} \\.0 │ │ │ -00095f10: 2026 616d 703b 2030 2026 616d 703b 2031 & 0 & 1 │ │ │ -00095f20: 0a5c 656e 647b 626d 6174 7269 787d 5c29 .\end{bmatrix}\) │ │ │ -00095f30: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ -00095f40: 733a 3c2f 6474 3e0a 3c64 643e 6175 746f s:
    .
    auto │ │ │ -00095f50: 6d61 7469 6361 6c6c 7920 6765 6e65 7261 matically genera │ │ │ -00095f60: 7465 643c 2f64 643e 0a3c 2f64 6c3e 0a3c ted
    .
    .< │ │ │ -00095f70: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>. │ │ │ -00095f80: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    findEssen │ │ │ -00096020: 7469 616c 4d61 743c 2f68 333e 0a3c 6469 tialMat

    ..public static │ │ │ -00096090: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  Mat findEssentialM │ │ │ -00096130: 6174 3c2f 7370 616e 3e3c 7762 723e 3c73 at(Mat  │ │ │ -000961a0: 3b70 6f69 6e74 7331 2c0a 203c 6120 6872 ;points1,. Mat&n │ │ │ -000961f0: 6273 703b 706f 696e 7473 322c 0a20 646f bsp;points2,. do │ │ │ -00096200: 7562 6c65 266e 6273 703b 666f 6361 6c2c uble focal, │ │ │ -00096210: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . │ │ │ -00096250: 506f 696e 743c 2f61 3e26 6e62 7370 3b70 Point p │ │ │ -00096260: 702c 0a20 696e 7426 6e62 7370 3b6d 6574 p,. int met │ │ │ -00096270: 686f 642c 0a20 646f 7562 6c65 266e 6273 hod,. double&nbs │ │ │ -00096280: 703b 7072 6f62 2c0a 2064 6f75 626c 6526 p;prob,. double& │ │ │ -00096290: 6e62 7370 3b74 6872 6573 686f 6c64 293c nbsp;threshold)< │ │ │ -000962a0: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 646c /span>.
    . │ │ │ -000962c0: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -000962d0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e70 /dt>.
    p │ │ │ -000962e0: 6f69 6e74 7331 3c2f 636f 6465 3e20 2d20 oints1 - │ │ │ -000962f0: 4172 7261 7920 6f66 204e 2028 4e20 2667 Array of N (N &g │ │ │ -00096300: 743b 3d20 3529 2032 4420 706f 696e 7473 t;= 5) 2D points │ │ │ -00096310: 2066 726f 6d20 7468 6520 6669 7273 7420 from the first │ │ │ -00096320: 696d 6167 652e 2054 6865 2070 6f69 6e74 image. The point │ │ │ -00096330: 2063 6f6f 7264 696e 6174 6573 2073 686f coordinates sho │ │ │ -00096340: 756c 640a 6265 2066 6c6f 6174 696e 672d uld.be floating- │ │ │ -00096350: 706f 696e 7420 2873 696e 676c 6520 6f72 point (single or │ │ │ -00096360: 2064 6f75 626c 6520 7072 6563 6973 696f double precisio │ │ │ -00096370: 6e29 2e3c 2f64 643e 0a3c 6464 3e3c 636f n).
    .
    points2 - Array of the │ │ │ -000963a0: 2073 6563 6f6e 6420 696d 6167 6520 706f second image po │ │ │ -000963b0: 696e 7473 206f 6620 7468 6520 7361 6d65 ints of the same │ │ │ -000963c0: 2073 697a 6520 616e 6420 666f 726d 6174 size and format │ │ │ -000963d0: 2061 7320 706f 696e 7473 3120 2e3c 2f64 as points1 ..
    foc │ │ │ -000963f0: 616c 3c2f 636f 6465 3e20 2d20 666f 6361 al - foca │ │ │ -00096400: 6c20 6c65 6e67 7468 206f 6620 7468 6520 l length of the │ │ │ -00096410: 6361 6d65 7261 2e20 4e6f 7465 2074 6861 camera. Note tha │ │ │ -00096420: 7420 7468 6973 2066 756e 6374 696f 6e20 t this function │ │ │ -00096430: 6173 7375 6d65 7320 7468 6174 2070 6f69 assumes that poi │ │ │ -00096440: 6e74 7331 2061 6e64 2070 6f69 6e74 7332 nts1 and points2 │ │ │ -00096450: 0a61 7265 2066 6561 7475 7265 2070 6f69 .are feature poi │ │ │ -00096460: 6e74 7320 6672 6f6d 2063 616d 6572 6173 nts from cameras │ │ │ -00096470: 2077 6974 6820 7361 6d65 2066 6f63 616c with same focal │ │ │ -00096480: 206c 656e 6774 6820 616e 6420 7072 696e length and prin │ │ │ -00096490: 6369 7061 6c20 706f 696e 742e 3c2f 6464 cipal point.
    .
    pp - principa │ │ │ -000964c0: 6c20 706f 696e 7420 6f66 2074 6865 2063 l point of the c │ │ │ -000964d0: 616d 6572 612e 3c2f 6464 3e0a 3c64 643e amera.
    .
    │ │ │ -000964e0: 3c63 6f64 653e 6d65 7468 6f64 3c2f 636f method - Method for │ │ │ -00096500: 2063 6f6d 7075 7469 6e67 2061 2066 756e computing a fun │ │ │ -00096510: 6461 6d65 6e74 616c 206d 6174 7269 782e damental matrix. │ │ │ -00096520: 0a3c 756c 3e0a 2020 3c6c 693e 0a20 2020 .
      .
    • . │ │ │ -00096530: 5245 463a 2052 414e 5341 4320 666f 7220 REF: RANSAC for │ │ │ -00096540: 7468 6520 5241 4e53 4143 2061 6c67 6f72 the RANSAC algor │ │ │ -00096550: 6974 686d 2e0a 2020 3c2f 6c69 3e0a 2020 ithm..
    • . │ │ │ -00096560: 3c6c 693e 0a20 2020 5245 463a 204c 4d45
    • . REF: LME │ │ │ -00096570: 4453 2066 6f72 2074 6865 204c 4d65 6453 DS for the LMedS │ │ │ -00096580: 2061 6c67 6f72 6974 686d 2e0a 2020 3c2f algorithm.. .
    .< │ │ │ -000965a0: 6464 3e3c 636f 6465 3e70 726f 623c 2f63 dd>prob - Parameter │ │ │ -000965c0: 2075 7365 6420 666f 7220 7468 6520 5241 used for the RA │ │ │ -000965d0: 4e53 4143 206f 7220 4c4d 6564 5320 6d65 NSAC or LMedS me │ │ │ -000965e0: 7468 6f64 7320 6f6e 6c79 2e20 4974 2073 thods only. It s │ │ │ -000965f0: 7065 6369 6669 6573 2061 2064 6573 6972 pecifies a desir │ │ │ -00096600: 6162 6c65 206c 6576 656c 206f 660a 636f able level of.co │ │ │ -00096610: 6e66 6964 656e 6365 2028 7072 6f62 6162 nfidence (probab │ │ │ -00096620: 696c 6974 7929 2074 6861 7420 7468 6520 ility) that the │ │ │ -00096630: 6573 7469 6d61 7465 6420 6d61 7472 6978 estimated matrix │ │ │ -00096640: 2069 7320 636f 7272 6563 742e 0a66 6f72 is correct..for │ │ │ -00096650: 2074 6865 206f 7468 6572 2070 6f69 6e74 the other point │ │ │ -00096660: 732e 2054 6865 2061 7272 6179 2069 7320 s. The array is │ │ │ -00096670: 636f 6d70 7574 6564 206f 6e6c 7920 696e computed only in │ │ │ -00096680: 2074 6865 2052 414e 5341 4320 616e 6420 the RANSAC and │ │ │ -00096690: 4c4d 6564 5320 6d65 7468 6f64 732e 0a0a LMedS methods... │ │ │ -000966a0: 5468 6973 2066 756e 6374 696f 6e20 6469 This function di │ │ │ -000966b0: 6666 6572 7320 6672 6f6d 2074 6865 206f ffers from the o │ │ │ -000966c0: 6e65 2061 626f 7665 2074 6861 7420 6974 ne above that it │ │ │ -000966d0: 2063 6f6d 7075 7465 7320 6361 6d65 7261 computes camera │ │ │ -000966e0: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ -000966f0: 7820 6672 6f6d 2066 6f63 616c 206c 656e x from focal len │ │ │ -00096700: 6774 6820 616e 640a 7072 696e 6369 7061 gth and.principa │ │ │ -00096710: 6c20 706f 696e 743a 0a0a 5c28 4120 3d0a l point:..\(A =. │ │ │ -00096720: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ -00096730: 6620 2661 6d70 3b20 3020 2661 6d70 3b20 f & 0 & │ │ │ -00096740: 785f 7b70 707d 2020 5c5c 0a30 2026 616d x_{pp} \\.0 &am │ │ │ -00096750: 703b 2066 2026 616d 703b 2079 5f7b 7070 p; f & y_{pp │ │ │ -00096760: 7d20 205c 5c0a 3020 2661 6d70 3b20 3020 } \\.0 & 0 │ │ │ -00096770: 2661 6d70 3b20 310a 5c65 6e64 7b62 6d61 & 1.\end{bma │ │ │ -00096780: 7472 6978 7d5c 293c 2f64 643e 0a3c 6464 trix}\).
    threshold │ │ │ -000967a0: 3c2f 636f 6465 3e20 2d20 5061 7261 6d65 - Parame │ │ │ -000967b0: 7465 7220 7573 6564 2066 6f72 2052 414e ter used for RAN │ │ │ -000967c0: 5341 432e 2049 7420 6973 2074 6865 206d SAC. It is the m │ │ │ -000967d0: 6178 696d 756d 2064 6973 7461 6e63 6520 aximum distance │ │ │ -000967e0: 6672 6f6d 2061 2070 6f69 6e74 2074 6f20 from a point to │ │ │ -000967f0: 616e 2065 7069 706f 6c61 720a 6c69 6e65 an epipolar.line │ │ │ -00096800: 2069 6e20 7069 7865 6c73 2c20 6265 796f in pixels, beyo │ │ │ -00096810: 6e64 2077 6869 6368 2074 6865 2070 6f69 nd which the poi │ │ │ -00096820: 6e74 2069 7320 636f 6e73 6964 6572 6564 nt is considered │ │ │ -00096830: 2061 6e20 6f75 746c 6965 7220 616e 6420 an outlier and │ │ │ -00096840: 6973 206e 6f74 2075 7365 6420 666f 7220 is not used for │ │ │ -00096850: 636f 6d70 7574 696e 6720 7468 650a 6669 computing the.fi │ │ │ -00096860: 6e61 6c20 6675 6e64 616d 656e 7461 6c20 nal fundamental │ │ │ -00096870: 6d61 7472 6978 2e20 4974 2063 616e 2062 matrix. It can b │ │ │ -00096880: 6520 7365 7420 746f 2073 6f6d 6574 6869 e set to somethi │ │ │ -00096890: 6e67 206c 696b 6520 312d 332c 2064 6570 ng like 1-3, dep │ │ │ -000968a0: 656e 6469 6e67 206f 6e20 7468 6520 6163 ending on the ac │ │ │ -000968b0: 6375 7261 6379 206f 6620 7468 650a 706f curacy of the.po │ │ │ -000968c0: 696e 7420 6c6f 6361 6c69 7a61 7469 6f6e int localization │ │ │ -000968d0: 2c20 696d 6167 6520 7265 736f 6c75 7469 , image resoluti │ │ │ -000968e0: 6f6e 2c20 616e 6420 7468 6520 696d 6167 on, and the imag │ │ │ -000968f0: 6520 6e6f 6973 652e 3c2f 6464 3e0a 3c64 e noise.
    .Returns:. │ │ │ -00096910: 3c64 643e 6175 746f 6d61 7469 6361 6c6c
    automaticall │ │ │ -00096920: 7920 6765 6e65 7261 7465 643c 2f64 643e y generated
    │ │ │ -00096930: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    ...
  • .< │ │ │ -00096950: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .

    correc │ │ │ -000ac1c0: 744d 6174 6368 6573 3c2f 6833 3e0a 3c64 tMatches

    ..public stati │ │ │ -000ac230: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void correctMatch │ │ │ -000ac290: 6573 3c2f 7370 616e 3e3c 7762 723e 3c73 es(Mat  │ │ │ -000ac300: 3b46 2c0a 203c 6120 6872 6566 3d22 2e2e ;F,. Mat po │ │ │ -000ac350: 696e 7473 312c 0a20 3c61 2068 7265 663d ints1,. Mat  │ │ │ -000ac3a0: 3b70 6f69 6e74 7332 2c0a 203c 6120 6872 ;points2,. Mat&n │ │ │ -000ac3f0: 6273 703b 6e65 7750 6f69 6e74 7331 2c0a bsp;newPoints1,. │ │ │ -000ac400: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000ac440: 3c2f 613e 266e 6273 703b 6e65 7750 6f69  newPoi │ │ │ -000ac450: 6e74 7332 293c 2f73 7061 6e3e 3c2f 6469 nts2).
    Refines co │ │ │ -000ac480: 6f72 6469 6e61 7465 7320 6f66 2063 6f72 ordinates of cor │ │ │ -000ac490: 7265 7370 6f6e 6469 6e67 2070 6f69 6e74 responding point │ │ │ -000ac4a0: 732e 3c2f 6469 763e 0a3c 646c 2063 6c61 s.
    .
    .
    │ │ │ -000ac4c0: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ -000ac4d0: 0a3c 6464 3e3c 636f 6465 3e46 3c2f 636f .
    F - 3x3 fundam │ │ │ -000ac4f0: 656e 7461 6c20 6d61 7472 6978 2e3c 2f64 ental matrix..
    poi │ │ │ -000ac510: 6e74 7331 3c2f 636f 6465 3e20 2d20 3178 nts1 - 1x │ │ │ -000ac520: 4e20 6172 7261 7920 636f 6e74 6169 6e69 N array containi │ │ │ -000ac530: 6e67 2074 6865 2066 6972 7374 2073 6574 ng the first set │ │ │ -000ac540: 206f 6620 706f 696e 7473 2e3c 2f64 643e of points.
    │ │ │ -000ac550: 0a3c 6464 3e3c 636f 6465 3e70 6f69 6e74 .
    point │ │ │ -000ac560: 7332 3c2f 636f 6465 3e20 2d20 3178 4e20 s2 - 1xN │ │ │ -000ac570: 6172 7261 7920 636f 6e74 6169 6e69 6e67 array containing │ │ │ -000ac580: 2074 6865 2073 6563 6f6e 6420 7365 7420 the second set │ │ │ -000ac590: 6f66 2070 6f69 6e74 732e 3c2f 6464 3e0a of points.
    . │ │ │ -000ac5a0: 3c64 643e 3c63 6f64 653e 6e65 7750 6f69
    newPoi │ │ │ -000ac5b0: 6e74 7331 3c2f 636f 6465 3e20 2d20 5468 nts1 - Th │ │ │ -000ac5c0: 6520 6f70 7469 6d69 7a65 6420 706f 696e e optimized poin │ │ │ -000ac5d0: 7473 312e 3c2f 6464 3e0a 3c64 643e 3c63 ts1.
    .
    newPoints2 - The opti │ │ │ -000ac600: 6d69 7a65 6420 706f 696e 7473 322e 0a0a mized points2... │ │ │ -000ac610: 5468 6520 6675 6e63 7469 6f6e 2069 6d70 The function imp │ │ │ -000ac620: 6c65 6d65 6e74 7320 7468 6520 4f70 7469 lements the Opti │ │ │ -000ac630: 6d61 6c20 5472 6961 6e67 756c 6174 696f mal Triangulatio │ │ │ -000ac640: 6e20 4d65 7468 6f64 2028 7365 6520 4d75 n Method (see Mu │ │ │ -000ac650: 6c74 6970 6c65 2056 6965 7720 4765 6f6d ltiple View Geom │ │ │ -000ac660: 6574 7279 2043 4954 453a 2048 6172 746c etry CITE: Hartl │ │ │ -000ac670: 6579 5a30 3020 666f 7220 6465 7461 696c eyZ00 for detail │ │ │ -000ac680: 7329 2e0a 466f 7220 6561 6368 2067 6976 s)..For each giv │ │ │ -000ac690: 656e 2070 6f69 6e74 2063 6f72 7265 7370 en point corresp │ │ │ -000ac6a0: 6f6e 6465 6e63 6520 706f 696e 7473 315b ondence points1[ │ │ │ -000ac6b0: 695d 2026 6c74 3b2d 2667 743b 2070 6f69 i] <-> poi │ │ │ -000ac6c0: 6e74 7332 5b69 5d2c 2061 6e64 2061 2066 nts2[i], and a f │ │ │ -000ac6d0: 756e 6461 6d65 6e74 616c 206d 6174 7269 undamental matri │ │ │ -000ac6e0: 7820 462c 2069 740a 636f 6d70 7574 6573 x F, it.computes │ │ │ -000ac6f0: 2074 6865 2063 6f72 7265 6374 6564 2063 the corrected c │ │ │ -000ac700: 6f72 7265 7370 6f6e 6465 6e63 6573 206e orrespondences n │ │ │ -000ac710: 6577 506f 696e 7473 315b 695d 2026 6c74 ewPoints1[i] < │ │ │ -000ac720: 3b2d 2667 743b 206e 6577 506f 696e 7473 ;-> newPoints │ │ │ -000ac730: 325b 695d 2074 6861 7420 6d69 6e69 6d69 2[i] that minimi │ │ │ -000ac740: 7a65 2074 6865 2067 656f 6d65 7472 6963 ze the geometric │ │ │ -000ac750: 0a65 7272 6f72 205c 2864 2870 6f69 6e74 .error \(d(point │ │ │ -000ac760: 7331 5b69 5d2c 206e 6577 506f 696e 7473 s1[i], newPoints │ │ │ -000ac770: 315b 695d 295e 3220 2b20 6428 706f 696e 1[i])^2 + d(poin │ │ │ -000ac780: 7473 325b 695d 2c6e 6577 506f 696e 7473 ts2[i],newPoints │ │ │ -000ac790: 325b 695d 295e 325c 2920 2877 6865 7265 2[i])^2\) (where │ │ │ -000ac7a0: 205c 2864 2861 2c62 295c 2920 6973 2074 \(d(a,b)\) is t │ │ │ -000ac7b0: 6865 0a67 656f 6d65 7472 6963 2064 6973 he.geometric dis │ │ │ -000ac7c0: 7461 6e63 6520 6265 7477 6565 6e20 706f tance between po │ │ │ -000ac7d0: 696e 7473 205c 2861 5c29 2061 6e64 205c ints \(a\) and \ │ │ │ -000ac7e0: 2862 5c29 2029 2073 7562 6a65 6374 2074 (b\) ) subject t │ │ │ -000ac7f0: 6f20 7468 6520 6570 6970 6f6c 6172 2063 o the epipolar c │ │ │ -000ac800: 6f6e 7374 7261 696e 740a 5c28 6e65 7750 onstraint.\(newP │ │ │ -000ac810: 6f69 6e74 7332 5e54 205c 6364 6f74 2046 oints2^T \cdot F │ │ │ -000ac820: 205c 6364 6f74 206e 6577 506f 696e 7473 \cdot newPoints │ │ │ -000ac830: 3120 3d20 305c 2920 2e3c 2f64 643e 0a3c 1 = 0\) .
    .< │ │ │ -000ac840: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>....
  • .
    .

    sampsonDistance │ │ │ -000ac8e0: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ -000ac940: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -000ac950: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -000ac970: 646f 7562 6c65 3c2f 7370 616e 3e26 6e62 double&nb │ │ │ -000ac980: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;sa │ │ │ -000ac9a0: 6d70 736f 6e44 6973 7461 6e63 653c 2f73 mpsonDistance(M │ │ │ -000aca10: 6174 3c2f 613e 266e 6273 703b 7074 312c at pt1, │ │ │ +000935a0: 223e 736f 6c76 6550 6e50 4765 6e65 7269 ">solvePnPGeneri │ │ │ +000935b0: 633c 2f73 7061 6e3e 3c77 6272 3e3c 7370 c(Mat  │ │ │ +00093620: 6f62 6a65 6374 506f 696e 7473 2c0a 203c objectPoints,. < │ │ │ +00093630: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00093640: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +00093650: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +00093660: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat imagePoi │ │ │ +00093680: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. Mat c │ │ │ +000936d0: 616d 6572 614d 6174 7269 782c 0a20 3c61 ameraMatrix,. Mat distCoeff │ │ │ +00093730: 732c 0a20 3c61 2068 7265 663d 2268 7474 s,. Lis │ │ │ +000937d0: 743c 2f61 3e26 6c74 3b3c 6120 6872 6566 t<Mat> │ │ │ +00093820: 266e 6273 703b 7276 6563 732c 0a20 3c61  rvecs,. List& │ │ │ +000938d0: 6c74 3b3c 6120 6872 6566 3d22 2e2e 2f63 lt;M │ │ │ +00093910: 6174 3c2f 613e 2667 743b 266e 6273 703b at>  │ │ │ +00093920: 7476 6563 732c 0a20 626f 6f6c 6561 6e26 tvecs,. boolean& │ │ │ +00093930: 6e62 7370 3b75 7365 4578 7472 696e 7369 nbsp;useExtrinsi │ │ │ +00093940: 6347 7565 7373 2c0a 2069 6e74 266e 6273 cGuess,. int&nbs │ │ │ +00093950: 703b 666c 6167 732c 0a20 3c61 2068 7265 p;flags,. Mat&nb │ │ │ +000939a0: 7370 3b72 7665 6329 3c2f 7370 616e 3e3c sp;rvec)< │ │ │ +000939b0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Finds a │ │ │ +000939d0: 6e20 6f62 6a65 6374 2070 6f73 6520 5c28 n object pose \( │ │ │ +000939e0: 207b 7d5e 7b63 7d5c 6d61 7468 6266 7b54 {}^{c}\mathbf{T │ │ │ +000939f0: 7d5f 6f20 5c29 2066 726f 6d20 3344 2d32 }_o \) from 3D-2 │ │ │ +00093a00: 4420 706f 696e 7420 636f 7272 6573 706f D point correspo │ │ │ +00093a10: 6e64 656e 6365 732e 0a0a 215b 5065 7273 ndences...![Pers │ │ │ +00093a20: 7065 6374 6976 6520 7072 6f6a 6563 7469 pective projecti │ │ │ +00093a30: 6f6e 2c20 6672 6f6d 206f 626a 6563 7420 on, from object │ │ │ +00093a40: 746f 2063 616d 6572 6120 6672 616d 655d to camera frame] │ │ │ +00093a50: 2870 6963 732f 7069 6e68 6f6c 655f 686f (pics/pinhole_ho │ │ │ +00093a60: 6d6f 6765 6e65 6f75 735f 7472 616e 7366 mogeneous_transf │ │ │ +00093a70: 6f72 6d61 7469 6f6e 2e6a 7067 297b 2077 ormation.jpg){ w │ │ │ +00093a80: 6964 7468 3d35 3025 207d 0a0a 5345 453a idth=50% }..SEE: │ │ │ +00093a90: 2052 4546 3a20 6361 6c69 6233 645f 736f REF: calib3d_so │ │ │ +00093aa0: 6c76 6550 6e50 0a0a 5468 6973 2066 756e lvePnP..This fun │ │ │ +00093ab0: 6374 696f 6e20 7265 7475 726e 7320 6120 ction returns a │ │ │ +00093ac0: 6c69 7374 206f 6620 616c 6c20 7468 6520 list of all the │ │ │ +00093ad0: 706f 7373 6962 6c65 2073 6f6c 7574 696f possible solutio │ │ │ +00093ae0: 6e73 2028 6120 736f 6c75 7469 6f6e 2069 ns (a solution i │ │ │ +00093af0: 7320 6120 266c 743b 726f 7461 7469 6f6e s a <rotation │ │ │ +00093b00: 2076 6563 746f 722c 2074 7261 6e73 6c61 vector, transla │ │ │ +00093b10: 7469 6f6e 2076 6563 746f 7226 6774 3b0a tion vector>. │ │ │ +00093b20: 636f 7570 6c65 292c 2064 6570 656e 6469 couple), dependi │ │ │ +00093b30: 6e67 206f 6e20 7468 6520 6e75 6d62 6572 ng on the number │ │ │ +00093b40: 206f 6620 696e 7075 7420 706f 696e 7473 of input points │ │ │ +00093b50: 2061 6e64 2074 6865 2063 686f 7365 6e20 and the chosen │ │ │ +00093b60: 6d65 7468 6f64 3a0a 3c75 6c3e 0a20 203c method:.
      . < │ │ │ +00093b70: 6c69 3e0a 2050 3350 206d 6574 686f 6473 li>. P3P methods │ │ │ +00093b80: 2028 5245 463a 2053 4f4c 5645 504e 505f (REF: SOLVEPNP_ │ │ │ +00093b90: 5033 502c 2052 4546 3a20 534f 4c56 4550 P3P, REF: SOLVEP │ │ │ +00093ba0: 4e50 5f41 5033 5029 3a20 3320 6f72 2034 NP_AP3P): 3 or 4 │ │ │ +00093bb0: 2069 6e70 7574 2070 6f69 6e74 732e 204e input points. N │ │ │ +00093bc0: 756d 6265 7220 6f66 2072 6574 7572 6e65 umber of returne │ │ │ +00093bd0: 6420 736f 6c75 7469 6f6e 7320 6361 6e20 d solutions can │ │ │ +00093be0: 6265 2062 6574 7765 656e 2030 2061 6e64 be between 0 and │ │ │ +00093bf0: 2034 2077 6974 6820 3320 696e 7075 7420 4 with 3 input │ │ │ +00093c00: 706f 696e 7473 2e0a 2020 3c2f 6c69 3e0a points.. . │ │ │ +00093c10: 2020 3c6c 693e 0a20 5245 463a 2053 4f4c
    • . REF: SOL │ │ │ +00093c20: 5645 504e 505f 4950 5045 2049 6e70 7574 VEPNP_IPPE Input │ │ │ +00093c30: 2070 6f69 6e74 7320 6d75 7374 2062 6520 points must be │ │ │ +00093c40: 2667 743b 3d20 3420 616e 6420 6f62 6a65 >= 4 and obje │ │ │ +00093c50: 6374 2070 6f69 6e74 7320 6d75 7374 2062 ct points must b │ │ │ +00093c60: 6520 636f 706c 616e 6172 2e20 5265 7475 e coplanar. Retu │ │ │ +00093c70: 726e 7320 3220 736f 6c75 7469 6f6e 732e rns 2 solutions. │ │ │ +00093c80: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ +00093c90: 2052 4546 3a20 534f 4c56 4550 4e50 5f49 REF: SOLVEPNP_I │ │ │ +00093ca0: 5050 455f 5351 5541 5245 2053 7065 6369 PPE_SQUARE Speci │ │ │ +00093cb0: 616c 2063 6173 6520 7375 6974 6162 6c65 al case suitable │ │ │ +00093cc0: 2066 6f72 206d 6172 6b65 7220 706f 7365 for marker pose │ │ │ +00093cd0: 2065 7374 696d 6174 696f 6e2e 0a4e 756d estimation..Num │ │ │ +00093ce0: 6265 7220 6f66 2069 6e70 7574 2070 6f69 ber of input poi │ │ │ +00093cf0: 6e74 7320 6d75 7374 2062 6520 3420 616e nts must be 4 an │ │ │ +00093d00: 6420 3220 736f 6c75 7469 6f6e 7320 6172 d 2 solutions ar │ │ │ +00093d10: 6520 7265 7475 726e 6564 2e20 4f62 6a65 e returned. Obje │ │ │ +00093d20: 6374 2070 6f69 6e74 7320 6d75 7374 2062 ct points must b │ │ │ +00093d30: 6520 6465 6669 6e65 6420 696e 2074 6865 e defined in the │ │ │ +00093d40: 2066 6f6c 6c6f 7769 6e67 206f 7264 6572 following order │ │ │ +00093d50: 3a0a 2020 3c75 6c3e 0a20 2020 203c 6c69 :.
        .
      • . point 0: [- │ │ │ +00093d70: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ +00093d80: 2c20 2073 7175 6172 654c 656e 6774 6820 , squareLength │ │ │ +00093d90: 2f20 322c 2030 5d0a 2020 2020 3c2f 6c69 / 2, 0].
      • .
      • . po │ │ │ +00093db0: 696e 7420 313a 205b 2073 7175 6172 654c int 1: [ squareL │ │ │ +00093dc0: 656e 6774 6820 2f20 322c 2020 7371 7561 ength / 2, squa │ │ │ +00093dd0: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ +00093de0: 0a20 2020 203c 2f6c 693e 0a20 2020 203c .
      • . < │ │ │ +00093df0: 6c69 3e0a 2020 2070 6f69 6e74 2032 3a20 li>. point 2: │ │ │ +00093e00: 5b20 7371 7561 7265 4c65 6e67 7468 202f [ squareLength / │ │ │ +00093e10: 2032 2c20 2d73 7175 6172 654c 656e 6774 2, -squareLengt │ │ │ +00093e20: 6820 2f20 322c 2030 5d0a 2020 2020 3c2f h / 2, 0]. .
      • . │ │ │ +00093e40: 706f 696e 7420 333a 205b 2d73 7175 6172 point 3: [-squar │ │ │ +00093e50: 654c 656e 6774 6820 2f20 322c 202d 7371 eLength / 2, -sq │ │ │ +00093e60: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +00093e70: 305d 0a20 2020 203c 2f6c 693e 0a20 203c 0].
      • . < │ │ │ +00093e80: 2f75 6c3e 0a20 203c 6c69 3e0a 2066 6f72 /ul>.
      • . for │ │ │ +00093e90: 2061 6c6c 2074 6865 206f 7468 6572 2066 all the other f │ │ │ +00093ea0: 6c61 6773 2c20 6e75 6d62 6572 206f 6620 lags, number of │ │ │ +00093eb0: 696e 7075 7420 706f 696e 7473 206d 7573 input points mus │ │ │ +00093ec0: 7420 6265 2026 6774 3b3d 2034 2061 6e64 t be >= 4 and │ │ │ +00093ed0: 206f 626a 6563 7420 706f 696e 7473 2063 object points c │ │ │ +00093ee0: 616e 2062 6520 696e 2061 6e79 2063 6f6e an be in any con │ │ │ +00093ef0: 6669 6775 7261 7469 6f6e 2e0a 4f6e 6c79 figuration..Only │ │ │ +00093f00: 2031 2073 6f6c 7574 696f 6e20 6973 2072 1 solution is r │ │ │ +00093f10: 6574 7572 6e65 642e 0a20 203c 2f6c 693e eturned..
      • │ │ │ +00093f20: 0a3c 2f75 6c3e 3c2f 6469 763e 0a3c 646c .
    .
    . │ │ │ +00093f40: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ +00093f50: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e6f /dt>.
    o │ │ │ +00093f60: 626a 6563 7450 6f69 6e74 733c 2f63 6f64 bjectPoints - Array of ob │ │ │ +00093f80: 6a65 6374 2070 6f69 6e74 7320 696e 2074 ject points in t │ │ │ +00093f90: 6865 206f 626a 6563 7420 636f 6f72 6469 he object coordi │ │ │ +00093fa0: 6e61 7465 2073 7061 6365 2c20 4e78 3320 nate space, Nx3 │ │ │ +00093fb0: 312d 6368 616e 6e65 6c20 6f72 0a31 784e 1-channel or.1xN │ │ │ +00093fc0: 2f4e 7831 2033 2d63 6861 6e6e 656c 2c20 /Nx1 3-channel, │ │ │ +00093fd0: 7768 6572 6520 4e20 6973 2074 6865 206e where N is the n │ │ │ +00093fe0: 756d 6265 7220 6f66 2070 6f69 6e74 732e umber of points. │ │ │ +00093ff0: 2076 6563 746f 7226 6c74 3b50 6f69 6e74 vector<Point │ │ │ +00094000: 3364 2667 743b 2063 616e 2062 6520 616c 3d> can be al │ │ │ +00094010: 736f 2070 6173 7365 6420 6865 7265 2e3c so passed here.< │ │ │ +00094020: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e69 /dd>.
    i │ │ │ +00094030: 6d61 6765 506f 696e 7473 3c2f 636f 6465 magePoints - Array of cor │ │ │ +00094050: 7265 7370 6f6e 6469 6e67 2069 6d61 6765 responding image │ │ │ +00094060: 2070 6f69 6e74 732c 204e 7832 2031 2d63 points, Nx2 1-c │ │ │ +00094070: 6861 6e6e 656c 206f 7220 3178 4e2f 4e78 hannel or 1xN/Nx │ │ │ +00094080: 3120 322d 6368 616e 6e65 6c2c 0a77 6865 1 2-channel,.whe │ │ │ +00094090: 7265 204e 2069 7320 7468 6520 6e75 6d62 re N is the numb │ │ │ +000940a0: 6572 206f 6620 706f 696e 7473 2e20 7665 er of points. ve │ │ │ +000940b0: 6374 6f72 266c 743b 506f 696e 7432 6426 ctor<Point2d& │ │ │ +000940c0: 6774 3b20 6361 6e20 6265 2061 6c73 6f20 gt; can be also │ │ │ +000940d0: 7061 7373 6564 2068 6572 652e 3c2f 6464 passed here.
    .
    came │ │ │ +000940f0: 7261 4d61 7472 6978 3c2f 636f 6465 3e20 raMatrix │ │ │ +00094100: 2d20 496e 7075 7420 6361 6d65 7261 2069 - Input camera i │ │ │ +00094110: 6e74 7269 6e73 6963 206d 6174 7269 7820 ntrinsic matrix │ │ │ +00094120: 5c28 5c63 616d 6572 616d 6174 7269 787b \(\cameramatrix{ │ │ │ +00094130: 417d 5c29 202e 3c2f 6464 3e0a 3c64 643e A}\) .
    .
    │ │ │ +00094140: 3c63 6f64 653e 6469 7374 436f 6566 6673 distCoeffs │ │ │ +00094150: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ +00094160: 7665 6374 6f72 206f 6620 6469 7374 6f72 vector of distor │ │ │ +00094170: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ +00094180: 730a 5c28 5c64 6973 7463 6f65 6666 735c s.\(\distcoeffs\ │ │ │ +00094190: 292e 2049 6620 7468 6520 7665 6374 6f72 ). If the vector │ │ │ +000941a0: 2069 7320 4e55 4c4c 2f65 6d70 7479 2c20 is NULL/empty, │ │ │ +000941b0: 7468 6520 7a65 726f 2064 6973 746f 7274 the zero distort │ │ │ +000941c0: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ +000941d0: 2061 7265 0a61 7373 756d 6564 2e3c 2f64 are.assumed..
    rve │ │ │ +000941f0: 6373 3c2f 636f 6465 3e20 2d20 5665 6374 cs - Vect │ │ │ +00094200: 6f72 206f 6620 6f75 7470 7574 2072 6f74 or of output rot │ │ │ +00094210: 6174 696f 6e20 7665 6374 6f72 7320 2873 ation vectors (s │ │ │ +00094220: 6565 2052 4546 3a20 526f 6472 6967 7565 ee REF: Rodrigue │ │ │ +00094230: 7320 2920 7468 6174 2c20 746f 6765 7468 s ) that, togeth │ │ │ +00094240: 6572 2077 6974 6820 7476 6563 732c 2062 er with tvecs, b │ │ │ +00094250: 7269 6e67 7320 706f 696e 7473 2066 726f rings points fro │ │ │ +00094260: 6d0a 7468 6520 6d6f 6465 6c20 636f 6f72 m.the model coor │ │ │ +00094270: 6469 6e61 7465 2073 7973 7465 6d20 746f dinate system to │ │ │ +00094280: 2074 6865 2063 616d 6572 6120 636f 6f72 the camera coor │ │ │ +00094290: 6469 6e61 7465 2073 7973 7465 6d2e 3c2f dinate system..
    tv │ │ │ +000942b0: 6563 733c 2f63 6f64 653e 202d 2056 6563 ecs - Vec │ │ │ +000942c0: 746f 7220 6f66 206f 7574 7075 7420 7472 tor of output tr │ │ │ +000942d0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ +000942e0: 732e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 s.
    .
    useExtrinsicGu │ │ │ +00094300: 6573 733c 2f63 6f64 653e 202d 2050 6172 ess - Par │ │ │ +00094310: 616d 6574 6572 2075 7365 6420 666f 7220 ameter used for │ │ │ +00094320: 2353 4f4c 5645 504e 505f 4954 4552 4154 #SOLVEPNP_ITERAT │ │ │ +00094330: 4956 452e 2049 6620 7472 7565 2028 3129 IVE. If true (1) │ │ │ +00094340: 2c20 7468 6520 6675 6e63 7469 6f6e 2075 , the function u │ │ │ +00094350: 7365 730a 7468 6520 7072 6f76 6964 6564 ses.the provided │ │ │ +00094360: 2072 7665 6320 616e 6420 7476 6563 2076 rvec and tvec v │ │ │ +00094370: 616c 7565 7320 6173 2069 6e69 7469 616c alues as initial │ │ │ +00094380: 2061 7070 726f 7869 6d61 7469 6f6e 7320 approximations │ │ │ +00094390: 6f66 2074 6865 2072 6f74 6174 696f 6e20 of the rotation │ │ │ +000943a0: 616e 6420 7472 616e 736c 6174 696f 6e0a and translation. │ │ │ +000943b0: 7665 6374 6f72 732c 2072 6573 7065 6374 vectors, respect │ │ │ +000943c0: 6976 656c 792c 2061 6e64 2066 7572 7468 ively, and furth │ │ │ +000943d0: 6572 206f 7074 696d 697a 6573 2074 6865 er optimizes the │ │ │ +000943e0: 6d2e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 m.
    .
    flags - │ │ │ +00094400: 204d 6574 686f 6420 666f 7220 736f 6c76 Method for solv │ │ │ +00094410: 696e 6720 6120 506e 5020 7072 6f62 6c65 ing a PnP proble │ │ │ +00094420: 6d3a 2073 6565 2052 4546 3a20 6361 6c69 m: see REF: cali │ │ │ +00094430: 6233 645f 736f 6c76 6550 6e50 5f66 6c61 b3d_solvePnP_fla │ │ │ +00094440: 6773 3c2f 6464 3e0a 3c64 643e 3c63 6f64 gs
    .
    rvec - │ │ │ +00094460: 526f 7461 7469 6f6e 2076 6563 746f 7220 Rotation vector │ │ │ +00094470: 7573 6564 2074 6f20 696e 6974 6961 6c69 used to initiali │ │ │ +00094480: 7a65 2061 6e20 6974 6572 6174 6976 6520 ze an iterative │ │ │ +00094490: 506e 5020 7265 6669 6e65 6d65 6e74 2061 PnP refinement a │ │ │ +000944a0: 6c67 6f72 6974 686d 2c20 7768 656e 2066 lgorithm, when f │ │ │ +000944b0: 6c61 6720 6973 2052 4546 3a20 534f 4c56 lag is REF: SOLV │ │ │ +000944c0: 4550 4e50 5f49 5445 5241 5449 5645 0a61 EPNP_ITERATIVE.a │ │ │ +000944d0: 6e64 2075 7365 4578 7472 696e 7369 6347 nd useExtrinsicG │ │ │ +000944e0: 7565 7373 2069 7320 7365 7420 746f 2074 uess is set to t │ │ │ +000944f0: 7275 652e 0a61 6e64 2075 7365 4578 7472 rue..and useExtr │ │ │ +00094500: 696e 7369 6347 7565 7373 2069 7320 7365 insicGuess is se │ │ │ +00094510: 7420 746f 2074 7275 652e 0a28 5c28 205c t to true..(\( \ │ │ │ +00094520: 7465 7874 7b52 4d53 457d 203d 205c 7371 text{RMSE} = \sq │ │ │ +00094530: 7274 7b5c 6672 6163 7b5c 7375 6d5f 7b69 rt{\frac{\sum_{i │ │ │ +00094540: 7d5e 7b4e 7d20 5c6c 6566 7420 2820 5c68 }^{N} \left ( \h │ │ │ +00094550: 6174 7b79 5f69 7d20 2d20 795f 6920 5c72 at{y_i} - y_i \r │ │ │ +00094560: 6967 6874 2029 5e32 7d7b 4e7d 7d20 5c29 ight )^2}{N}} \) │ │ │ +00094570: 2920 6265 7477 6565 6e20 7468 6520 696e ) between the in │ │ │ +00094580: 7075 7420 696d 6167 6520 706f 696e 7473 put image points │ │ │ +00094590: 0a61 6e64 2074 6865 2033 4420 6f62 6a65 .and the 3D obje │ │ │ +000945a0: 6374 2070 6f69 6e74 7320 7072 6f6a 6563 ct points projec │ │ │ +000945b0: 7465 6420 7769 7468 2074 6865 2065 7374 ted with the est │ │ │ +000945c0: 696d 6174 6564 2070 6f73 652e 0a0a 4d6f imated pose...Mo │ │ │ +000945d0: 7265 2069 6e66 6f72 6d61 7469 6f6e 2069 re information i │ │ │ +000945e0: 7320 6465 7363 7269 6265 6420 696e 2052 s described in R │ │ │ +000945f0: 4546 3a20 6361 6c69 6233 645f 736f 6c76 EF: calib3d_solv │ │ │ +00094600: 6550 6e50 0a0a 3c62 3e4e 6f74 653a 3c2f ePnP..Note:.
      .
    • . │ │ │ +00094620: 2020 2020 2041 6e20 6578 616d 706c 6520 An example │ │ │ +00094630: 6f66 2068 6f77 2074 6f20 7573 6520 736f of how to use so │ │ │ +00094640: 6c76 6550 6e50 2066 6f72 2070 6c61 6e61 lvePnP for plana │ │ │ +00094650: 7220 6175 676d 656e 7465 6420 7265 616c r augmented real │ │ │ +00094660: 6974 7920 6361 6e20 6265 2066 6f75 6e64 ity can be found │ │ │ +00094670: 2061 740a 2020 2020 2020 2020 6f70 656e at. open │ │ │ +00094680: 6376 5f73 6f75 7263 655f 636f 6465 2f73 cv_source_code/s │ │ │ +00094690: 616d 706c 6573 2f70 7974 686f 6e2f 706c amples/python/pl │ │ │ +000946a0: 616e 655f 6172 2e70 790a 2020 3c2f 6c69 ane_ar.py.
    • .
    • . I │ │ │ +000946c0: 6620 796f 7520 6172 6520 7573 696e 6720 f you are using │ │ │ +000946d0: 5079 7468 6f6e 3a0a 2020 3c75 6c3e 0a20 Python:.
        . │ │ │ +000946e0: 2020 203c 6c69 3e0a 2020 2020 2020 2020
      • . │ │ │ +000946f0: 204e 756d 7079 2061 7272 6179 2073 6c69 Numpy array sli │ │ │ +00094700: 6365 7320 776f 6e27 7420 776f 726b 2061 ces won't work a │ │ │ +00094710: 7320 696e 7075 7420 6265 6361 7573 6520 s input because │ │ │ +00094720: 736f 6c76 6550 6e50 2072 6571 7569 7265 solvePnP require │ │ │ +00094730: 7320 636f 6e74 6967 756f 7573 0a20 2020 s contiguous. │ │ │ +00094740: 2020 2020 2061 7272 6179 7320 2865 6e66 arrays (enf │ │ │ +00094750: 6f72 6365 6420 6279 2074 6865 2061 7373 orced by the ass │ │ │ +00094760: 6572 7469 6f6e 2075 7369 6e67 2063 763a ertion using cv: │ │ │ +00094770: 3a4d 6174 3a3a 6368 6563 6b56 6563 746f :Mat::checkVecto │ │ │ +00094780: 7228 2920 6172 6f75 6e64 206c 696e 6520 r() around line │ │ │ +00094790: 3535 206f 660a 2020 2020 2020 2020 6d6f 55 of. mo │ │ │ +000947a0: 6475 6c65 732f 3364 2f73 7263 2f73 6f6c dules/3d/src/sol │ │ │ +000947b0: 7665 706e 702e 6370 7020 7665 7273 696f vepnp.cpp versio │ │ │ +000947c0: 6e20 322e 342e 3929 0a20 2020 203c 2f6c n 2.4.9). .
      • . │ │ │ +000947e0: 2020 2020 2054 6865 2050 3350 2061 6c67 The P3P alg │ │ │ +000947f0: 6f72 6974 686d 2072 6571 7569 7265 7320 orithm requires │ │ │ +00094800: 696d 6167 6520 706f 696e 7473 2074 6f20 image points to │ │ │ +00094810: 6265 2069 6e20 616e 2061 7272 6179 206f be in an array o │ │ │ +00094820: 6620 7368 6170 6520 284e 2c31 2c32 2920 f shape (N,1,2) │ │ │ +00094830: 6475 650a 2020 2020 2020 2020 746f 2069 due. to i │ │ │ +00094840: 7473 2063 616c 6c69 6e67 206f 6620 2375 ts calling of #u │ │ │ +00094850: 6e64 6973 746f 7274 506f 696e 7473 2028 ndistortPoints ( │ │ │ +00094860: 6172 6f75 6e64 206c 696e 6520 3735 206f around line 75 o │ │ │ +00094870: 6620 6d6f 6475 6c65 732f 3364 2f73 7263 f modules/3d/src │ │ │ +00094880: 2f73 6f6c 7665 706e 702e 6370 7020 7665 /solvepnp.cpp ve │ │ │ +00094890: 7273 696f 6e20 322e 342e 3929 0a20 2020 rsion 2.4.9). │ │ │ +000948a0: 2020 2020 2077 6869 6368 2072 6571 7569 which requi │ │ │ +000948b0: 7265 7320 322d 6368 616e 6e65 6c20 696e res 2-channel in │ │ │ +000948c0: 666f 726d 6174 696f 6e2e 0a20 2020 203c formation.. < │ │ │ +000948d0: 2f6c 693e 0a20 2020 203c 6c69 3e0a 2020 /li>.
      • . │ │ │ +000948e0: 2020 2020 2020 2054 6875 732c 2067 6976 Thus, giv │ │ │ +000948f0: 656e 2073 6f6d 6520 6461 7461 2044 203d en some data D = │ │ │ +00094900: 206e 702e 6172 7261 7928 2e2e 2e29 2077 np.array(...) w │ │ │ +00094910: 6865 7265 2044 2e73 6861 7065 203d 2028 here D.shape = ( │ │ │ +00094920: 4e2c 4d29 2c20 696e 206f 7264 6572 2074 N,M), in order t │ │ │ +00094930: 6f20 7573 6520 6120 7375 6273 6574 206f o use a subset o │ │ │ +00094940: 660a 2020 2020 2020 2020 6974 2061 732c f. it as, │ │ │ +00094950: 2065 2e67 2e2c 2069 6d61 6765 506f 696e e.g., imagePoin │ │ │ +00094960: 7473 2c20 6f6e 6520 6d75 7374 2065 6666 ts, one must eff │ │ │ +00094970: 6563 7469 7665 6c79 2063 6f70 7920 6974 ectively copy it │ │ │ +00094980: 2069 6e74 6f20 6120 6e65 7720 6172 7261 into a new arra │ │ │ +00094990: 793a 2069 6d61 6765 506f 696e 7473 203d y: imagePoints = │ │ │ +000949a0: 0a20 2020 2020 2020 206e 702e 6173 636f . np.asco │ │ │ +000949b0: 6e74 6967 756f 7573 6172 7261 7928 445b ntiguousarray(D[ │ │ │ +000949c0: 3a2c 3a32 5d29 2e72 6573 6861 7065 2828 :,:2]).reshape(( │ │ │ +000949d0: 4e2c 312c 3229 290a 2020 2020 3c2f 6c69 N,1,2)).
      • .
      .
    • │ │ │ +000949f0: 0a20 2020 2020 2054 6865 206d 696e 696d . The minim │ │ │ +00094a00: 756d 206e 756d 6265 7220 6f66 2070 6f69 um number of poi │ │ │ +00094a10: 6e74 7320 6973 2034 2069 6e20 7468 6520 nts is 4 in the │ │ │ +00094a20: 6765 6e65 7261 6c20 6361 7365 2e20 496e general case. In │ │ │ +00094a30: 2074 6865 2063 6173 6520 6f66 2052 4546 the case of REF │ │ │ +00094a40: 3a20 534f 4c56 4550 4e50 5f50 3350 2061 : SOLVEPNP_P3P a │ │ │ +00094a50: 6e64 2052 4546 3a20 534f 4c56 4550 4e50 nd REF: SOLVEPNP │ │ │ +00094a60: 5f41 5033 500a 2020 2020 2020 206d 6574 _AP3P. met │ │ │ +00094a70: 686f 6473 2c20 6974 2069 7320 7265 7175 hods, it is requ │ │ │ +00094a80: 6972 6564 2074 6f20 7573 6520 6578 6163 ired to use exac │ │ │ +00094a90: 746c 7920 3420 706f 696e 7473 2028 7468 tly 4 points (th │ │ │ +00094aa0: 6520 6669 7273 7420 3320 706f 696e 7473 e first 3 points │ │ │ +00094ab0: 2061 7265 2075 7365 6420 746f 2065 7374 are used to est │ │ │ +00094ac0: 696d 6174 6520 616c 6c20 7468 6520 736f imate all the so │ │ │ +00094ad0: 6c75 7469 6f6e 730a 2020 2020 2020 206f lutions. o │ │ │ +00094ae0: 6620 7468 6520 5033 5020 7072 6f62 6c65 f the P3P proble │ │ │ +00094af0: 6d2c 2074 6865 206c 6173 7420 6f6e 6520 m, the last one │ │ │ +00094b00: 6973 2075 7365 6420 746f 2072 6574 6169 is used to retai │ │ │ +00094b10: 6e20 7468 6520 6265 7374 2073 6f6c 7574 n the best solut │ │ │ +00094b20: 696f 6e20 7468 6174 206d 696e 696d 697a ion that minimiz │ │ │ +00094b30: 6573 2074 6865 2072 6570 726f 6a65 6374 es the reproject │ │ │ +00094b40: 696f 6e20 6572 726f 7229 2e0a 2020 3c2f ion error).. .
    • . │ │ │ +00094b60: 2057 6974 6820 5245 463a 2053 4f4c 5645 With REF: SOLVE │ │ │ +00094b70: 504e 505f 4954 4552 4154 4956 4520 6d65 PNP_ITERATIVE me │ │ │ +00094b80: 7468 6f64 2061 6e64 203c 636f 6465 3e75 thod and u │ │ │ +00094b90: 7365 4578 7472 696e 7369 6347 7565 7373 seExtrinsicGuess │ │ │ +00094ba0: 3d74 7275 653c 2f63 6f64 653e 2c20 7468 =true, th │ │ │ +00094bb0: 6520 6d69 6e69 6d75 6d20 6e75 6d62 6572 e minimum number │ │ │ +00094bc0: 206f 6620 706f 696e 7473 2069 7320 3320 of points is 3 │ │ │ +00094bd0: 2833 2070 6f69 6e74 730a 2020 2020 2020 (3 points. │ │ │ +00094be0: 2061 7265 2073 7566 6669 6369 656e 7420 are sufficient │ │ │ +00094bf0: 746f 2063 6f6d 7075 7465 2061 2070 6f73 to compute a pos │ │ │ +00094c00: 6520 6275 7420 7468 6572 6520 6172 6520 e but there are │ │ │ +00094c10: 7570 2074 6f20 3420 736f 6c75 7469 6f6e up to 4 solution │ │ │ +00094c20: 7329 2e20 5468 6520 696e 6974 6961 6c20 s). The initial │ │ │ +00094c30: 736f 6c75 7469 6f6e 2073 686f 756c 6420 solution should │ │ │ +00094c40: 6265 2063 6c6f 7365 2074 6f20 7468 650a be close to the. │ │ │ +00094c50: 2020 2020 2020 2067 6c6f 6261 6c20 736f global so │ │ │ +00094c60: 6c75 7469 6f6e 2074 6f20 636f 6e76 6572 lution to conver │ │ │ +00094c70: 6765 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c ge..
    • . . With RE │ │ │ +00094c90: 463a 2053 4f4c 5645 504e 505f 4950 5045 F: SOLVEPNP_IPPE │ │ │ +00094ca0: 2069 6e70 7574 2070 6f69 6e74 7320 6d75 input points mu │ │ │ +00094cb0: 7374 2062 6520 2667 743b 3d20 3420 616e st be >= 4 an │ │ │ +00094cc0: 6420 6f62 6a65 6374 2070 6f69 6e74 7320 d object points │ │ │ +00094cd0: 6d75 7374 2062 6520 636f 706c 616e 6172 must be coplanar │ │ │ +00094ce0: 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c 693e .. .
    • │ │ │ +00094cf0: 0a20 2020 2020 2057 6974 6820 5245 463a . With REF: │ │ │ +00094d00: 2053 4f4c 5645 504e 505f 4950 5045 5f53 SOLVEPNP_IPPE_S │ │ │ +00094d10: 5155 4152 4520 7468 6973 2069 7320 6120 QUARE this is a │ │ │ +00094d20: 7370 6563 6961 6c20 6361 7365 2073 7569 special case sui │ │ │ +00094d30: 7461 626c 6520 666f 7220 6d61 726b 6572 table for marker │ │ │ +00094d40: 2070 6f73 6520 6573 7469 6d61 7469 6f6e pose estimation │ │ │ +00094d50: 2e0a 2020 2020 2020 204e 756d 6265 7220 .. Number │ │ │ +00094d60: 6f66 2069 6e70 7574 2070 6f69 6e74 7320 of input points │ │ │ +00094d70: 6d75 7374 2062 6520 342e 204f 626a 6563 must be 4. Objec │ │ │ +00094d80: 7420 706f 696e 7473 206d 7573 7420 6265 t points must be │ │ │ +00094d90: 2064 6566 696e 6564 2069 6e20 7468 6520 defined in the │ │ │ +00094da0: 666f 6c6c 6f77 696e 6720 6f72 6465 723a following order: │ │ │ +00094db0: 0a20 203c 756c 3e0a 2020 2020 3c6c 693e .
        .
      • │ │ │ +00094dc0: 0a20 2020 2020 2020 2020 2070 6f69 6e74 . point │ │ │ +00094dd0: 2030 3a20 5b2d 7371 7561 7265 4c65 6e67 0: [-squareLeng │ │ │ +00094de0: 7468 202f 2032 2c20 2073 7175 6172 654c th / 2, squareL │ │ │ +00094df0: 656e 6774 6820 2f20 322c 2030 5d0a 2020 ength / 2, 0]. │ │ │ +00094e00: 2020 3c2f 6c69 3e0a 2020 2020 3c6c 693e
      • .
      • │ │ │ +00094e10: 0a20 2020 2020 2020 2020 2070 6f69 6e74 . point │ │ │ +00094e20: 2031 3a20 5b20 7371 7561 7265 4c65 6e67 1: [ squareLeng │ │ │ +00094e30: 7468 202f 2032 2c20 2073 7175 6172 654c th / 2, squareL │ │ │ +00094e40: 656e 6774 6820 2f20 322c 2030 5d0a 2020 ength / 2, 0]. │ │ │ +00094e50: 2020 3c2f 6c69 3e0a 2020 2020 3c6c 693e
      • .
      • │ │ │ +00094e60: 0a20 2020 2020 2020 2020 2070 6f69 6e74 . point │ │ │ +00094e70: 2032 3a20 5b20 7371 7561 7265 4c65 6e67 2: [ squareLeng │ │ │ +00094e80: 7468 202f 2032 2c20 2d73 7175 6172 654c th / 2, -squareL │ │ │ +00094e90: 656e 6774 6820 2f20 322c 2030 5d0a 2020 ength / 2, 0]. │ │ │ +00094ea0: 2020 3c2f 6c69 3e0a 2020 2020 3c6c 693e
      • .
      • │ │ │ +00094eb0: 0a20 2020 2020 2020 2020 2070 6f69 6e74 . point │ │ │ +00094ec0: 2033 3a20 5b2d 7371 7561 7265 4c65 6e67 3: [-squareLeng │ │ │ +00094ed0: 7468 202f 2032 2c20 2d73 7175 6172 654c th / 2, -squareL │ │ │ +00094ee0: 656e 6774 6820 2f20 322c 2030 5d0a 2020 ength / 2, 0]. │ │ │ +00094ef0: 2020 3c2f 6c69 3e0a 2020 3c2f 756c 3e0a
      • .
      . │ │ │ +00094f00: 2020 3c6c 693e 0a20 2020 2020 2057 6974
    • . Wit │ │ │ +00094f10: 6820 5245 463a 2053 4f4c 5645 504e 505f h REF: SOLVEPNP_ │ │ │ +00094f20: 5351 504e 5020 696e 7075 7420 706f 696e SQPNP input poin │ │ │ +00094f30: 7473 206d 7573 7420 6265 2026 6774 3b3d ts must be >= │ │ │ +00094f40: 2033 0a20 203c 2f6c 693e 0a3c 2f75 6c3e 3.
    • .
    │ │ │ +00094f50: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ +00094f60: 733a 3c2f 6474 3e0a 3c64 643e 6175 746f s:
    .
    auto │ │ │ +00094f70: 6d61 7469 6361 6c6c 7920 6765 6e65 7261 matically genera │ │ │ +00094f80: 7465 643c 2f64 643e 0a3c 2f64 6c3e 0a3c ted
    .
    .< │ │ │ +00094f90: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ +00094fa0: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    solvePn │ │ │ +00095060: 5047 656e 6572 6963 3c2f 6833 3e0a 3c64 PGeneric

    ..public stati │ │ │ +000950d0: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c int solvePnPGener │ │ │ +00095130: 6963 3c2f 7370 616e 3e3c 7762 723e 3c73 ic(Mat  │ │ │ +000951a0: 3b6f 626a 6563 7450 6f69 6e74 732c 0a20 ;objectPoints,. │ │ │ +000951b0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000951f0: 2f61 3e26 6e62 7370 3b69 6d61 6765 506f /a> imagePo │ │ │ +00095200: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. Mat  │ │ │ +00095250: 6361 6d65 7261 4d61 7472 6978 2c0a 203c cameraMatrix,. < │ │ │ +00095260: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +00095270: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +00095280: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +00095290: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat distCoef │ │ │ +000952b0: 6673 2c0a 203c 6120 6872 6566 3d22 6874 fs,. Li │ │ │ +00095350: 7374 3c2f 613e 266c 743b 3c61 2068 7265 st<Mat> │ │ │ +000953a0: 3b26 6e62 7370 3b72 7665 6373 2c0a 203c ; rvecs,. < │ │ │ +000953b0: 6120 6872 6566 3d22 6874 7470 733a 2f2f a href="https:// │ │ │ +000953c0: 646f 6373 2e6f 7261 636c 652e 636f 6d2f docs.oracle.com/ │ │ │ +000953d0: 656e 2f6a 6176 612f 6a61 7661 7365 2f32 en/java/javase/2 │ │ │ +000953e0: 352f 646f 6373 2f61 7069 2f6a 6176 612e 5/docs/api/java. │ │ │ +000953f0: 6261 7365 2f6a 6176 612f 7574 696c 2f4c base/java/util/L │ │ │ +00095400: 6973 742e 6874 6d6c 2220 7469 746c 653d ist.html" title= │ │ │ +00095410: 2263 6c61 7373 206f 7220 696e 7465 7266 "class or interf │ │ │ +00095420: 6163 6520 696e 206a 6176 612e 7574 696c ace in java.util │ │ │ +00095430: 2220 636c 6173 733d 2265 7874 6572 6e61 " class="externa │ │ │ +00095440: 6c2d 6c69 6e6b 223e 4c69 7374 3c2f 613e l-link">List │ │ │ +00095450: 266c 743b 3c61 2068 7265 663d 222e 2e2f < │ │ │ +00095490: 4d61 743c 2f61 3e26 6774 3b26 6e62 7370 Mat>  │ │ │ +000954a0: 3b74 7665 6373 2c0a 2062 6f6f 6c65 616e ;tvecs,. boolean │ │ │ +000954b0: 266e 6273 703b 7573 6545 7874 7269 6e73  useExtrins │ │ │ +000954c0: 6963 4775 6573 732c 0a20 696e 7426 6e62 icGuess,. int&nb │ │ │ +000954d0: 7370 3b66 6c61 6773 293c 2f73 7061 6e3e sp;flags) │ │ │ +000954e0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173 .
    Finds │ │ │ +00095500: 616e 206f 626a 6563 7420 706f 7365 205c an object pose \ │ │ │ +00095510: 2820 7b7d 5e7b 637d 5c6d 6174 6862 667b ( {}^{c}\mathbf{ │ │ │ +00095520: 547d 5f6f 205c 2920 6672 6f6d 2033 442d T}_o \) from 3D- │ │ │ +00095530: 3244 2070 6f69 6e74 2063 6f72 7265 7370 2D point corresp │ │ │ +00095540: 6f6e 6465 6e63 6573 2e0a 0a21 5b50 6572 ondences...![Per │ │ │ +00095550: 7370 6563 7469 7665 2070 726f 6a65 6374 spective project │ │ │ +00095560: 696f 6e2c 2066 726f 6d20 6f62 6a65 6374 ion, from object │ │ │ +00095570: 2074 6f20 6361 6d65 7261 2066 7261 6d65 to camera frame │ │ │ +00095580: 5d28 7069 6373 2f70 696e 686f 6c65 5f68 ](pics/pinhole_h │ │ │ +00095590: 6f6d 6f67 656e 656f 7573 5f74 7261 6e73 omogeneous_trans │ │ │ +000955a0: 666f 726d 6174 696f 6e2e 6a70 6729 7b20 formation.jpg){ │ │ │ +000955b0: 7769 6474 683d 3530 2520 7d0a 0a53 4545 width=50% }..SEE │ │ │ +000955c0: 3a20 5245 463a 2063 616c 6962 3364 5f73 : REF: calib3d_s │ │ │ +000955d0: 6f6c 7665 506e 500a 0a54 6869 7320 6675 olvePnP..This fu │ │ │ +000955e0: 6e63 7469 6f6e 2072 6574 7572 6e73 2061 nction returns a │ │ │ +000955f0: 206c 6973 7420 6f66 2061 6c6c 2074 6865 list of all the │ │ │ +00095600: 2070 6f73 7369 626c 6520 736f 6c75 7469 possible soluti │ │ │ +00095610: 6f6e 7320 2861 2073 6f6c 7574 696f 6e20 ons (a solution │ │ │ +00095620: 6973 2061 2026 6c74 3b72 6f74 6174 696f is a <rotatio │ │ │ +00095630: 6e20 7665 6374 6f72 2c20 7472 616e 736c n vector, transl │ │ │ +00095640: 6174 696f 6e20 7665 6374 6f72 2667 743b ation vector> │ │ │ +00095650: 0a63 6f75 706c 6529 2c20 6465 7065 6e64 .couple), depend │ │ │ +00095660: 696e 6720 6f6e 2074 6865 206e 756d 6265 ing on the numbe │ │ │ +00095670: 7220 6f66 2069 6e70 7574 2070 6f69 6e74 r of input point │ │ │ +00095680: 7320 616e 6420 7468 6520 6368 6f73 656e s and the chosen │ │ │ +00095690: 206d 6574 686f 643a 0a3c 756c 3e0a 2020 method:.
      . │ │ │ +000956a0: 3c6c 693e 0a20 5033 5020 6d65 7468 6f64
    • . P3P method │ │ │ +000956b0: 7320 2852 4546 3a20 534f 4c56 4550 4e50 s (REF: SOLVEPNP │ │ │ +000956c0: 5f50 3350 2c20 5245 463a 2053 4f4c 5645 _P3P, REF: SOLVE │ │ │ +000956d0: 504e 505f 4150 3350 293a 2033 206f 7220 PNP_AP3P): 3 or │ │ │ +000956e0: 3420 696e 7075 7420 706f 696e 7473 2e20 4 input points. │ │ │ +000956f0: 4e75 6d62 6572 206f 6620 7265 7475 726e Number of return │ │ │ +00095700: 6564 2073 6f6c 7574 696f 6e73 2063 616e ed solutions can │ │ │ +00095710: 2062 6520 6265 7477 6565 6e20 3020 616e be between 0 an │ │ │ +00095720: 6420 3420 7769 7468 2033 2069 6e70 7574 d 4 with 3 input │ │ │ +00095730: 2070 6f69 6e74 732e 0a20 203c 2f6c 693e points..
    • │ │ │ +00095740: 0a20 203c 6c69 3e0a 2052 4546 3a20 534f .
    • . REF: SO │ │ │ +00095750: 4c56 4550 4e50 5f49 5050 4520 496e 7075 LVEPNP_IPPE Inpu │ │ │ +00095760: 7420 706f 696e 7473 206d 7573 7420 6265 t points must be │ │ │ +00095770: 2026 6774 3b3d 2034 2061 6e64 206f 626a >= 4 and obj │ │ │ +00095780: 6563 7420 706f 696e 7473 206d 7573 7420 ect points must │ │ │ +00095790: 6265 2063 6f70 6c61 6e61 722e 2052 6574 be coplanar. Ret │ │ │ +000957a0: 7572 6e73 2032 2073 6f6c 7574 696f 6e73 urns 2 solutions │ │ │ +000957b0: 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c 693e ..
    • .
    • │ │ │ +000957c0: 0a20 5245 463a 2053 4f4c 5645 504e 505f . REF: SOLVEPNP_ │ │ │ +000957d0: 4950 5045 5f53 5155 4152 4520 5370 6563 IPPE_SQUARE Spec │ │ │ +000957e0: 6961 6c20 6361 7365 2073 7569 7461 626c ial case suitabl │ │ │ +000957f0: 6520 666f 7220 6d61 726b 6572 2070 6f73 e for marker pos │ │ │ +00095800: 6520 6573 7469 6d61 7469 6f6e 2e0a 4e75 e estimation..Nu │ │ │ +00095810: 6d62 6572 206f 6620 696e 7075 7420 706f mber of input po │ │ │ +00095820: 696e 7473 206d 7573 7420 6265 2034 2061 ints must be 4 a │ │ │ +00095830: 6e64 2032 2073 6f6c 7574 696f 6e73 2061 nd 2 solutions a │ │ │ +00095840: 7265 2072 6574 7572 6e65 642e 204f 626a re returned. Obj │ │ │ +00095850: 6563 7420 706f 696e 7473 206d 7573 7420 ect points must │ │ │ +00095860: 6265 2064 6566 696e 6564 2069 6e20 7468 be defined in th │ │ │ +00095870: 6520 666f 6c6c 6f77 696e 6720 6f72 6465 e following orde │ │ │ +00095880: 723a 0a20 203c 756c 3e0a 2020 2020 3c6c r:.
        . . point 0: [ │ │ │ +000958a0: 2d73 7175 6172 654c 656e 6774 6820 2f20 -squareLength / │ │ │ +000958b0: 322c 2020 7371 7561 7265 4c65 6e67 7468 2, squareLength │ │ │ +000958c0: 202f 2032 2c20 305d 0a20 2020 203c 2f6c / 2, 0]. .
      • . p │ │ │ +000958e0: 6f69 6e74 2031 3a20 5b20 7371 7561 7265 oint 1: [ square │ │ │ +000958f0: 4c65 6e67 7468 202f 2032 2c20 2073 7175 Length / 2, squ │ │ │ +00095900: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ +00095910: 5d0a 2020 2020 3c2f 6c69 3e0a 2020 2020 ].
      • . │ │ │ +00095920: 3c6c 693e 0a20 2020 706f 696e 7420 323a
      • . point 2: │ │ │ +00095930: 205b 2073 7175 6172 654c 656e 6774 6820 [ squareLength │ │ │ +00095940: 2f20 322c 202d 7371 7561 7265 4c65 6e67 / 2, -squareLeng │ │ │ +00095950: 7468 202f 2032 2c20 305d 0a20 2020 203c th / 2, 0]. < │ │ │ +00095960: 2f6c 693e 0a20 2020 203c 6c69 3e0a 2020 /li>.
      • . │ │ │ +00095970: 2070 6f69 6e74 2033 3a20 5b2d 7371 7561 point 3: [-squa │ │ │ +00095980: 7265 4c65 6e67 7468 202f 2032 2c20 2d73 reLength / 2, -s │ │ │ +00095990: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ +000959a0: 2030 5d0a 2020 2020 3c2f 6c69 3e0a 2020 0].
      • . │ │ │ +000959b0: 3c2f 756c 3e0a 2020 3c6c 693e 0a20 666f
      .
    • . fo │ │ │ +000959c0: 7220 616c 6c20 7468 6520 6f74 6865 7220 r all the other │ │ │ +000959d0: 666c 6167 732c 206e 756d 6265 7220 6f66 flags, number of │ │ │ +000959e0: 2069 6e70 7574 2070 6f69 6e74 7320 6d75 input points mu │ │ │ +000959f0: 7374 2062 6520 2667 743b 3d20 3420 616e st be >= 4 an │ │ │ +00095a00: 6420 6f62 6a65 6374 2070 6f69 6e74 7320 d object points │ │ │ +00095a10: 6361 6e20 6265 2069 6e20 616e 7920 636f can be in any co │ │ │ +00095a20: 6e66 6967 7572 6174 696f 6e2e 0a4f 6e6c nfiguration..Onl │ │ │ +00095a30: 7920 3120 736f 6c75 7469 6f6e 2069 7320 y 1 solution is │ │ │ +00095a40: 7265 7475 726e 6564 2e0a 2020 3c2f 6c69 returned..
    • .
    . │ │ │ +00095a70: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +00095a80: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +00095a90: 6f62 6a65 6374 506f 696e 7473 3c2f 636f objectPoints - Array of o │ │ │ +00095ab0: 626a 6563 7420 706f 696e 7473 2069 6e20 bject points in │ │ │ +00095ac0: 7468 6520 6f62 6a65 6374 2063 6f6f 7264 the object coord │ │ │ +00095ad0: 696e 6174 6520 7370 6163 652c 204e 7833 inate space, Nx3 │ │ │ +00095ae0: 2031 2d63 6861 6e6e 656c 206f 720a 3178 1-channel or.1x │ │ │ +00095af0: 4e2f 4e78 3120 332d 6368 616e 6e65 6c2c N/Nx1 3-channel, │ │ │ +00095b00: 2077 6865 7265 204e 2069 7320 7468 6520 where N is the │ │ │ +00095b10: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ +00095b20: 2e20 7665 6374 6f72 266c 743b 506f 696e . vector<Poin │ │ │ +00095b30: 7433 6426 6774 3b20 6361 6e20 6265 2061 t3d> can be a │ │ │ +00095b40: 6c73 6f20 7061 7373 6564 2068 6572 652e lso passed here. │ │ │ +00095b50: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +00095b60: 696d 6167 6550 6f69 6e74 733c 2f63 6f64 imagePoints - Array of co │ │ │ +00095b80: 7272 6573 706f 6e64 696e 6720 696d 6167 rresponding imag │ │ │ +00095b90: 6520 706f 696e 7473 2c20 4e78 3220 312d e points, Nx2 1- │ │ │ +00095ba0: 6368 616e 6e65 6c20 6f72 2031 784e 2f4e channel or 1xN/N │ │ │ +00095bb0: 7831 2032 2d63 6861 6e6e 656c 2c0a 7768 x1 2-channel,.wh │ │ │ +00095bc0: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ +00095bd0: 6265 7220 6f66 2070 6f69 6e74 732e 2076 ber of points. v │ │ │ +00095be0: 6563 746f 7226 6c74 3b50 6f69 6e74 3264 ector<Point2d │ │ │ +00095bf0: 2667 743b 2063 616e 2062 6520 616c 736f > can be also │ │ │ +00095c00: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    cam │ │ │ +00095c20: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ +00095c30: 202d 2049 6e70 7574 2063 616d 6572 6120 - Input camera │ │ │ +00095c40: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ +00095c50: 205c 285c 6361 6d65 7261 6d61 7472 6978 \(\cameramatrix │ │ │ +00095c60: 7b41 7d5c 2920 2e3c 2f64 643e 0a3c 6464 {A}\) .
    .
    distCoeff │ │ │ +00095c80: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ +00095c90: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ +00095ca0: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ +00095cb0: 7473 0a5c 285c 6469 7374 636f 6566 6673 ts.\(\distcoeffs │ │ │ +00095cc0: 5c29 2e20 4966 2074 6865 2076 6563 746f \). If the vecto │ │ │ +00095cd0: 7220 6973 204e 554c 4c2f 656d 7074 792c r is NULL/empty, │ │ │ +00095ce0: 2074 6865 207a 6572 6f20 6469 7374 6f72 the zero distor │ │ │ +00095cf0: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ +00095d00: 7320 6172 650a 6173 7375 6d65 642e 3c2f s are.assumed..
    rv │ │ │ +00095d20: 6563 733c 2f63 6f64 653e 202d 2056 6563 ecs - Vec │ │ │ +00095d30: 746f 7220 6f66 206f 7574 7075 7420 726f tor of output ro │ │ │ +00095d40: 7461 7469 6f6e 2076 6563 746f 7273 2028 tation vectors ( │ │ │ +00095d50: 7365 6520 5245 463a 2052 6f64 7269 6775 see REF: Rodrigu │ │ │ +00095d60: 6573 2029 2074 6861 742c 2074 6f67 6574 es ) that, toget │ │ │ +00095d70: 6865 7220 7769 7468 2074 7665 6373 2c20 her with tvecs, │ │ │ +00095d80: 6272 696e 6773 2070 6f69 6e74 7320 6672 brings points fr │ │ │ +00095d90: 6f6d 0a74 6865 206d 6f64 656c 2063 6f6f om.the model coo │ │ │ +00095da0: 7264 696e 6174 6520 7379 7374 656d 2074 rdinate system t │ │ │ +00095db0: 6f20 7468 6520 6361 6d65 7261 2063 6f6f o the camera coo │ │ │ +00095dc0: 7264 696e 6174 6520 7379 7374 656d 2e3c rdinate system.< │ │ │ +00095dd0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ +00095de0: 7665 6373 3c2f 636f 6465 3e20 2d20 5665 vecs - Ve │ │ │ +00095df0: 6374 6f72 206f 6620 6f75 7470 7574 2074 ctor of output t │ │ │ +00095e00: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ +00095e10: 7273 2e3c 2f64 643e 0a3c 6464 3e3c 636f rs.
    .
    useExtrinsicG │ │ │ +00095e30: 7565 7373 3c2f 636f 6465 3e20 2d20 5061 uess - Pa │ │ │ +00095e40: 7261 6d65 7465 7220 7573 6564 2066 6f72 rameter used for │ │ │ +00095e50: 2023 534f 4c56 4550 4e50 5f49 5445 5241 #SOLVEPNP_ITERA │ │ │ +00095e60: 5449 5645 2e20 4966 2074 7275 6520 2831 TIVE. If true (1 │ │ │ +00095e70: 292c 2074 6865 2066 756e 6374 696f 6e20 ), the function │ │ │ +00095e80: 7573 6573 0a74 6865 2070 726f 7669 6465 uses.the provide │ │ │ +00095e90: 6420 7276 6563 2061 6e64 2074 7665 6320 d rvec and tvec │ │ │ +00095ea0: 7661 6c75 6573 2061 7320 696e 6974 6961 values as initia │ │ │ +00095eb0: 6c20 6170 7072 6f78 696d 6174 696f 6e73 l approximations │ │ │ +00095ec0: 206f 6620 7468 6520 726f 7461 7469 6f6e of the rotation │ │ │ +00095ed0: 2061 6e64 2074 7261 6e73 6c61 7469 6f6e and translation │ │ │ +00095ee0: 0a76 6563 746f 7273 2c20 7265 7370 6563 .vectors, respec │ │ │ +00095ef0: 7469 7665 6c79 2c20 616e 6420 6675 7274 tively, and furt │ │ │ +00095f00: 6865 7220 6f70 7469 6d69 7a65 7320 7468 her optimizes th │ │ │ +00095f10: 656d 2e3c 2f64 643e 0a3c 6464 3e3c 636f em.
    .
    flags │ │ │ +00095f30: 2d20 4d65 7468 6f64 2066 6f72 2073 6f6c - Method for sol │ │ │ +00095f40: 7669 6e67 2061 2050 6e50 2070 726f 626c ving a PnP probl │ │ │ +00095f50: 656d 3a20 7365 6520 5245 463a 2063 616c em: see REF: cal │ │ │ +00095f60: 6962 3364 5f73 6f6c 7665 506e 505f 666c ib3d_solvePnP_fl │ │ │ +00095f70: 6167 730a 616e 6420 7573 6545 7874 7269 ags.and useExtri │ │ │ +00095f80: 6e73 6963 4775 6573 7320 6973 2073 6574 nsicGuess is set │ │ │ +00095f90: 2074 6f20 7472 7565 2e0a 616e 6420 7573 to true..and us │ │ │ +00095fa0: 6545 7874 7269 6e73 6963 4775 6573 7320 eExtrinsicGuess │ │ │ +00095fb0: 6973 2073 6574 2074 6f20 7472 7565 2e0a is set to true.. │ │ │ +00095fc0: 285c 2820 5c74 6578 747b 524d 5345 7d20 (\( \text{RMSE} │ │ │ +00095fd0: 3d20 5c73 7172 747b 5c66 7261 637b 5c73 = \sqrt{\frac{\s │ │ │ +00095fe0: 756d 5f7b 697d 5e7b 4e7d 205c 6c65 6674 um_{i}^{N} \left │ │ │ +00095ff0: 2028 205c 6861 747b 795f 697d 202d 2079 ( \hat{y_i} - y │ │ │ +00096000: 5f69 205c 7269 6768 7420 295e 327d 7b4e _i \right )^2}{N │ │ │ +00096010: 7d7d 205c 2929 2062 6574 7765 656e 2074 }} \)) between t │ │ │ +00096020: 6865 2069 6e70 7574 2069 6d61 6765 2070 he input image p │ │ │ +00096030: 6f69 6e74 730a 616e 6420 7468 6520 3344 oints.and the 3D │ │ │ +00096040: 206f 626a 6563 7420 706f 696e 7473 2070 object points p │ │ │ +00096050: 726f 6a65 6374 6564 2077 6974 6820 7468 rojected with th │ │ │ +00096060: 6520 6573 7469 6d61 7465 6420 706f 7365 e estimated pose │ │ │ +00096070: 2e0a 0a4d 6f72 6520 696e 666f 726d 6174 ...More informat │ │ │ +00096080: 696f 6e20 6973 2064 6573 6372 6962 6564 ion is described │ │ │ +00096090: 2069 6e20 5245 463a 2063 616c 6962 3364 in REF: calib3d │ │ │ +000960a0: 5f73 6f6c 7665 506e 500a 0a3c 623e 4e6f _solvePnP..No │ │ │ +000960b0: 7465 3a3c 2f62 3e0a 3c75 6c3e 0a20 203c te:.
      . < │ │ │ +000960c0: 6c69 3e0a 2020 2020 2020 416e 2065 7861 li>. An exa │ │ │ +000960d0: 6d70 6c65 206f 6620 686f 7720 746f 2075 mple of how to u │ │ │ +000960e0: 7365 2073 6f6c 7665 506e 5020 666f 7220 se solvePnP for │ │ │ +000960f0: 706c 616e 6172 2061 7567 6d65 6e74 6564 planar augmented │ │ │ +00096100: 2072 6561 6c69 7479 2063 616e 2062 6520 reality can be │ │ │ +00096110: 666f 756e 6420 6174 0a20 2020 2020 2020 found at. │ │ │ +00096120: 206f 7065 6e63 765f 736f 7572 6365 5f63 opencv_source_c │ │ │ +00096130: 6f64 652f 7361 6d70 6c65 732f 7079 7468 ode/samples/pyth │ │ │ +00096140: 6f6e 2f70 6c61 6e65 5f61 722e 7079 0a20 on/plane_ar.py. │ │ │ +00096150: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020 .
    • . │ │ │ +00096160: 2020 2020 4966 2079 6f75 2061 7265 2075 If you are u │ │ │ +00096170: 7369 6e67 2050 7974 686f 6e3a 0a20 203c sing Python:. < │ │ │ +00096180: 756c 3e0a 2020 2020 3c6c 693e 0a20 2020 ul>.
    • . │ │ │ +00096190: 2020 2020 2020 4e75 6d70 7920 6172 7261 Numpy arra │ │ │ +000961a0: 7920 736c 6963 6573 2077 6f6e 2774 2077 y slices won't w │ │ │ +000961b0: 6f72 6b20 6173 2069 6e70 7574 2062 6563 ork as input bec │ │ │ +000961c0: 6175 7365 2073 6f6c 7665 506e 5020 7265 ause solvePnP re │ │ │ +000961d0: 7175 6972 6573 2063 6f6e 7469 6775 6f75 quires contiguou │ │ │ +000961e0: 730a 2020 2020 2020 2020 6172 7261 7973 s. arrays │ │ │ +000961f0: 2028 656e 666f 7263 6564 2062 7920 7468 (enforced by th │ │ │ +00096200: 6520 6173 7365 7274 696f 6e20 7573 696e e assertion usin │ │ │ +00096210: 6720 6376 3a3a 4d61 743a 3a63 6865 636b g cv::Mat::check │ │ │ +00096220: 5665 6374 6f72 2829 2061 726f 756e 6420 Vector() around │ │ │ +00096230: 6c69 6e65 2035 3520 6f66 0a20 2020 2020 line 55 of. │ │ │ +00096240: 2020 206d 6f64 756c 6573 2f33 642f 7372 modules/3d/sr │ │ │ +00096250: 632f 736f 6c76 6570 6e70 2e63 7070 2076 c/solvepnp.cpp v │ │ │ +00096260: 6572 7369 6f6e 2032 2e34 2e39 290a 2020 ersion 2.4.9). │ │ │ +00096270: 2020 3c2f 6c69 3e0a 2020 2020 3c6c 693e
    • .
    • │ │ │ +00096280: 0a20 2020 2020 2020 2020 5468 6520 5033 . The P3 │ │ │ +00096290: 5020 616c 676f 7269 7468 6d20 7265 7175 P algorithm requ │ │ │ +000962a0: 6972 6573 2069 6d61 6765 2070 6f69 6e74 ires image point │ │ │ +000962b0: 7320 746f 2062 6520 696e 2061 6e20 6172 s to be in an ar │ │ │ +000962c0: 7261 7920 6f66 2073 6861 7065 2028 4e2c ray of shape (N, │ │ │ +000962d0: 312c 3229 2064 7565 0a20 2020 2020 2020 1,2) due. │ │ │ +000962e0: 2074 6f20 6974 7320 6361 6c6c 696e 6720 to its calling │ │ │ +000962f0: 6f66 2023 756e 6469 7374 6f72 7450 6f69 of #undistortPoi │ │ │ +00096300: 6e74 7320 2861 726f 756e 6420 6c69 6e65 nts (around line │ │ │ +00096310: 2037 3520 6f66 206d 6f64 756c 6573 2f33 75 of modules/3 │ │ │ +00096320: 642f 7372 632f 736f 6c76 6570 6e70 2e63 d/src/solvepnp.c │ │ │ +00096330: 7070 2076 6572 7369 6f6e 2032 2e34 2e39 pp version 2.4.9 │ │ │ +00096340: 290a 2020 2020 2020 2020 7768 6963 6820 ). which │ │ │ +00096350: 7265 7175 6972 6573 2032 2d63 6861 6e6e requires 2-chann │ │ │ +00096360: 656c 2069 6e66 6f72 6d61 7469 6f6e 2e0a el information.. │ │ │ +00096370: 2020 2020 3c2f 6c69 3e0a 2020 2020 3c6c
    • . . Thus │ │ │ +00096390: 2c20 6769 7665 6e20 736f 6d65 2064 6174 , given some dat │ │ │ +000963a0: 6120 4420 3d20 6e70 2e61 7272 6179 282e a D = np.array(. │ │ │ +000963b0: 2e2e 2920 7768 6572 6520 442e 7368 6170 ..) where D.shap │ │ │ +000963c0: 6520 3d20 284e 2c4d 292c 2069 6e20 6f72 e = (N,M), in or │ │ │ +000963d0: 6465 7220 746f 2075 7365 2061 2073 7562 der to use a sub │ │ │ +000963e0: 7365 7420 6f66 0a20 2020 2020 2020 2069 set of. i │ │ │ +000963f0: 7420 6173 2c20 652e 672e 2c20 696d 6167 t as, e.g., imag │ │ │ +00096400: 6550 6f69 6e74 732c 206f 6e65 206d 7573 ePoints, one mus │ │ │ +00096410: 7420 6566 6665 6374 6976 656c 7920 636f t effectively co │ │ │ +00096420: 7079 2069 7420 696e 746f 2061 206e 6577 py it into a new │ │ │ +00096430: 2061 7272 6179 3a20 696d 6167 6550 6f69 array: imagePoi │ │ │ +00096440: 6e74 7320 3d0a 2020 2020 2020 2020 6e70 nts =. np │ │ │ +00096450: 2e61 7363 6f6e 7469 6775 6f75 7361 7272 .ascontiguousarr │ │ │ +00096460: 6179 2844 5b3a 2c3a 325d 292e 7265 7368 ay(D[:,:2]).resh │ │ │ +00096470: 6170 6528 284e 2c31 2c32 2929 0a20 2020 ape((N,1,2)). │ │ │ +00096480: 203c 2f6c 693e 0a20 203c 2f75 6c3e 0a20 .
    . │ │ │ +00096490: 203c 6c69 3e0a 2020 2020 2020 5468 6520
  • . The │ │ │ +000964a0: 6d69 6e69 6d75 6d20 6e75 6d62 6572 206f minimum number o │ │ │ +000964b0: 6620 706f 696e 7473 2069 7320 3420 696e f points is 4 in │ │ │ +000964c0: 2074 6865 2067 656e 6572 616c 2063 6173 the general cas │ │ │ +000964d0: 652e 2049 6e20 7468 6520 6361 7365 206f e. In the case o │ │ │ +000964e0: 6620 5245 463a 2053 4f4c 5645 504e 505f f REF: SOLVEPNP_ │ │ │ +000964f0: 5033 5020 616e 6420 5245 463a 2053 4f4c P3P and REF: SOL │ │ │ +00096500: 5645 504e 505f 4150 3350 0a20 2020 2020 VEPNP_AP3P. │ │ │ +00096510: 2020 6d65 7468 6f64 732c 2069 7420 6973 methods, it is │ │ │ +00096520: 2072 6571 7569 7265 6420 746f 2075 7365 required to use │ │ │ +00096530: 2065 7861 6374 6c79 2034 2070 6f69 6e74 exactly 4 point │ │ │ +00096540: 7320 2874 6865 2066 6972 7374 2033 2070 s (the first 3 p │ │ │ +00096550: 6f69 6e74 7320 6172 6520 7573 6564 2074 oints are used t │ │ │ +00096560: 6f20 6573 7469 6d61 7465 2061 6c6c 2074 o estimate all t │ │ │ +00096570: 6865 2073 6f6c 7574 696f 6e73 0a20 2020 he solutions. │ │ │ +00096580: 2020 2020 6f66 2074 6865 2050 3350 2070 of the P3P p │ │ │ +00096590: 726f 626c 656d 2c20 7468 6520 6c61 7374 roblem, the last │ │ │ +000965a0: 206f 6e65 2069 7320 7573 6564 2074 6f20 one is used to │ │ │ +000965b0: 7265 7461 696e 2074 6865 2062 6573 7420 retain the best │ │ │ +000965c0: 736f 6c75 7469 6f6e 2074 6861 7420 6d69 solution that mi │ │ │ +000965d0: 6e69 6d69 7a65 7320 7468 6520 7265 7072 nimizes the repr │ │ │ +000965e0: 6f6a 6563 7469 6f6e 2065 7272 6f72 292e ojection error). │ │ │ +000965f0: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
  • .
  • . │ │ │ +00096600: 2020 2020 2020 5769 7468 2052 4546 3a20 With REF: │ │ │ +00096610: 534f 4c56 4550 4e50 5f49 5445 5241 5449 SOLVEPNP_ITERATI │ │ │ +00096620: 5645 206d 6574 686f 6420 616e 6420 3c63 VE method and useExtrinsic │ │ │ +00096640: 4775 6573 733d 7472 7565 3c2f 636f 6465 Guess=true, the minimum n │ │ │ +00096660: 756d 6265 7220 6f66 2070 6f69 6e74 7320 umber of points │ │ │ +00096670: 6973 2033 2028 3320 706f 696e 7473 0a20 is 3 (3 points. │ │ │ +00096680: 2020 2020 2020 6172 6520 7375 6666 6963 are suffic │ │ │ +00096690: 6965 6e74 2074 6f20 636f 6d70 7574 6520 ient to compute │ │ │ +000966a0: 6120 706f 7365 2062 7574 2074 6865 7265 a pose but there │ │ │ +000966b0: 2061 7265 2075 7020 746f 2034 2073 6f6c are up to 4 sol │ │ │ +000966c0: 7574 696f 6e73 292e 2054 6865 2069 6e69 utions). The ini │ │ │ +000966d0: 7469 616c 2073 6f6c 7574 696f 6e20 7368 tial solution sh │ │ │ +000966e0: 6f75 6c64 2062 6520 636c 6f73 6520 746f ould be close to │ │ │ +000966f0: 2074 6865 0a20 2020 2020 2020 676c 6f62 the. glob │ │ │ +00096700: 616c 2073 6f6c 7574 696f 6e20 746f 2063 al solution to c │ │ │ +00096710: 6f6e 7665 7267 652e 0a20 203c 2f6c 693e onverge..
  • │ │ │ +00096720: 0a20 203c 6c69 3e0a 2020 2020 2020 5769 .
  • . Wi │ │ │ +00096730: 7468 2052 4546 3a20 534f 4c56 4550 4e50 th REF: SOLVEPNP │ │ │ +00096740: 5f49 5050 4520 696e 7075 7420 706f 696e _IPPE input poin │ │ │ +00096750: 7473 206d 7573 7420 6265 2026 6774 3b3d ts must be >= │ │ │ +00096760: 2034 2061 6e64 206f 626a 6563 7420 706f 4 and object po │ │ │ +00096770: 696e 7473 206d 7573 7420 6265 2063 6f70 ints must be cop │ │ │ +00096780: 6c61 6e61 722e 0a20 203c 2f6c 693e 0a20 lanar..
  • . │ │ │ +00096790: 203c 6c69 3e0a 2020 2020 2020 5769 7468
  • . With │ │ │ +000967a0: 2052 4546 3a20 534f 4c56 4550 4e50 5f49 REF: SOLVEPNP_I │ │ │ +000967b0: 5050 455f 5351 5541 5245 2074 6869 7320 PPE_SQUARE this │ │ │ +000967c0: 6973 2061 2073 7065 6369 616c 2063 6173 is a special cas │ │ │ +000967d0: 6520 7375 6974 6162 6c65 2066 6f72 206d e suitable for m │ │ │ +000967e0: 6172 6b65 7220 706f 7365 2065 7374 696d arker pose estim │ │ │ +000967f0: 6174 696f 6e2e 0a20 2020 2020 2020 4e75 ation.. Nu │ │ │ +00096800: 6d62 6572 206f 6620 696e 7075 7420 706f mber of input po │ │ │ +00096810: 696e 7473 206d 7573 7420 6265 2034 2e20 ints must be 4. │ │ │ +00096820: 4f62 6a65 6374 2070 6f69 6e74 7320 6d75 Object points mu │ │ │ +00096830: 7374 2062 6520 6465 6669 6e65 6420 696e st be defined in │ │ │ +00096840: 2074 6865 2066 6f6c 6c6f 7769 6e67 206f the following o │ │ │ +00096850: 7264 6572 3a0a 2020 3c75 6c3e 0a20 2020 rder:.
      . │ │ │ +00096860: 203c 6c69 3e0a 2020 2020 2020 2020 2020
    • . │ │ │ +00096870: 706f 696e 7420 303a 205b 2d73 7175 6172 point 0: [-squar │ │ │ +00096880: 654c 656e 6774 6820 2f20 322c 2020 7371 eLength / 2, sq │ │ │ +00096890: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +000968a0: 305d 0a20 2020 203c 2f6c 693e 0a20 2020 0].
    • . │ │ │ +000968b0: 203c 6c69 3e0a 2020 2020 2020 2020 2020
    • . │ │ │ +000968c0: 706f 696e 7420 313a 205b 2073 7175 6172 point 1: [ squar │ │ │ +000968d0: 654c 656e 6774 6820 2f20 322c 2020 7371 eLength / 2, sq │ │ │ +000968e0: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +000968f0: 305d 0a20 2020 203c 2f6c 693e 0a20 2020 0].
    • . │ │ │ +00096900: 203c 6c69 3e0a 2020 2020 2020 2020 2020
    • . │ │ │ +00096910: 706f 696e 7420 323a 205b 2073 7175 6172 point 2: [ squar │ │ │ +00096920: 654c 656e 6774 6820 2f20 322c 202d 7371 eLength / 2, -sq │ │ │ +00096930: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +00096940: 305d 0a20 2020 203c 2f6c 693e 0a20 2020 0].
    • . │ │ │ +00096950: 203c 6c69 3e0a 2020 2020 2020 2020 2020
    • . │ │ │ +00096960: 706f 696e 7420 333a 205b 2d73 7175 6172 point 3: [-squar │ │ │ +00096970: 654c 656e 6774 6820 2f20 322c 202d 7371 eLength / 2, -sq │ │ │ +00096980: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +00096990: 305d 0a20 2020 203c 2f6c 693e 0a20 203c 0].
    • . < │ │ │ +000969a0: 2f75 6c3e 0a20 203c 6c69 3e0a 2020 2020 /ul>.
    • . │ │ │ +000969b0: 2020 5769 7468 2052 4546 3a20 534f 4c56 With REF: SOLV │ │ │ +000969c0: 4550 4e50 5f53 5150 4e50 2069 6e70 7574 EPNP_SQPNP input │ │ │ +000969d0: 2070 6f69 6e74 7320 6d75 7374 2062 6520 points must be │ │ │ +000969e0: 2667 743b 3d20 330a 2020 3c2f 6c69 3e0a >= 3.
    • . │ │ │ +000969f0: 3c2f 756c 3e3c 2f64 643e 0a3c 6474 3e52
  • .
    R │ │ │ +00096a00: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    automatically g │ │ │ +00096a20: 656e 6572 6174 6564 3c2f 6464 3e0a 3c2f enerated
    ...
    .
  • .
  • │ │ │ +00096a50: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    solveP │ │ │ +00096b00: 6e50 4765 6e65 7269 633c 2f68 333e 0a3c nPGeneric

    .< │ │ │ +00096b10: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +00096b20: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +00096b30: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +00096b40: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +00096b70: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +00096b80: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +00096b90: 726e 2d74 7970 6522 3e69 6e74 3c2f 7370 rn-type">int solvePnPGene │ │ │ +00096bd0: 7269 633c 2f73 7061 6e3e 3c77 6272 3e3c ric< │ │ │ +00096be0: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +00096bf0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ +00096c40: 703b 6f62 6a65 6374 506f 696e 7473 2c0a p;objectPoints,. │ │ │ +00096c50: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +00096c90: 3c2f 613e 266e 6273 703b 696d 6167 6550  imageP │ │ │ +00096ca0: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ +00096cf0: 3b63 616d 6572 614d 6174 7269 782c 0a20 ;cameraMatrix,. │ │ │ +00096d00: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +00096d40: 2f61 3e26 6e62 7370 3b64 6973 7443 6f65 /a> distCoe │ │ │ +00096d50: 6666 732c 0a20 3c61 2068 7265 663d 2268 ffs,. L │ │ │ +00096df0: 6973 743c 2f61 3e26 6c74 3b3c 6120 6872 ist<Mat&g │ │ │ +00096e40: 743b 266e 6273 703b 7276 6563 732c 0a20 t; rvecs,. │ │ │ +00096e50: 3c61 2068 7265 663d 2268 7474 7073 3a2f List<Mat>&nbs │ │ │ +00096f40: 703b 7476 6563 732c 0a20 626f 6f6c 6561 p;tvecs,. boolea │ │ │ +00096f50: 6e26 6e62 7370 3b75 7365 4578 7472 696e n useExtrin │ │ │ +00096f60: 7369 6347 7565 7373 293c 2f73 7061 6e3e sicGuess) │ │ │ +00096f70: 3c2f 6469 763e 0a3c 6469 7620 636c 6173 .
    Finds │ │ │ +00096f90: 616e 206f 626a 6563 7420 706f 7365 205c an object pose \ │ │ │ +00096fa0: 2820 7b7d 5e7b 637d 5c6d 6174 6862 667b ( {}^{c}\mathbf{ │ │ │ +00096fb0: 547d 5f6f 205c 2920 6672 6f6d 2033 442d T}_o \) from 3D- │ │ │ +00096fc0: 3244 2070 6f69 6e74 2063 6f72 7265 7370 2D point corresp │ │ │ +00096fd0: 6f6e 6465 6e63 6573 2e0a 0a21 5b50 6572 ondences...![Per │ │ │ +00096fe0: 7370 6563 7469 7665 2070 726f 6a65 6374 spective project │ │ │ +00096ff0: 696f 6e2c 2066 726f 6d20 6f62 6a65 6374 ion, from object │ │ │ +00097000: 2074 6f20 6361 6d65 7261 2066 7261 6d65 to camera frame │ │ │ +00097010: 5d28 7069 6373 2f70 696e 686f 6c65 5f68 ](pics/pinhole_h │ │ │ +00097020: 6f6d 6f67 656e 656f 7573 5f74 7261 6e73 omogeneous_trans │ │ │ +00097030: 666f 726d 6174 696f 6e2e 6a70 6729 7b20 formation.jpg){ │ │ │ +00097040: 7769 6474 683d 3530 2520 7d0a 0a53 4545 width=50% }..SEE │ │ │ +00097050: 3a20 5245 463a 2063 616c 6962 3364 5f73 : REF: calib3d_s │ │ │ +00097060: 6f6c 7665 506e 500a 0a54 6869 7320 6675 olvePnP..This fu │ │ │ +00097070: 6e63 7469 6f6e 2072 6574 7572 6e73 2061 nction returns a │ │ │ +00097080: 206c 6973 7420 6f66 2061 6c6c 2074 6865 list of all the │ │ │ +00097090: 2070 6f73 7369 626c 6520 736f 6c75 7469 possible soluti │ │ │ +000970a0: 6f6e 7320 2861 2073 6f6c 7574 696f 6e20 ons (a solution │ │ │ +000970b0: 6973 2061 2026 6c74 3b72 6f74 6174 696f is a <rotatio │ │ │ +000970c0: 6e20 7665 6374 6f72 2c20 7472 616e 736c n vector, transl │ │ │ +000970d0: 6174 696f 6e20 7665 6374 6f72 2667 743b ation vector> │ │ │ +000970e0: 0a63 6f75 706c 6529 2c20 6465 7065 6e64 .couple), depend │ │ │ +000970f0: 696e 6720 6f6e 2074 6865 206e 756d 6265 ing on the numbe │ │ │ +00097100: 7220 6f66 2069 6e70 7574 2070 6f69 6e74 r of input point │ │ │ +00097110: 7320 616e 6420 7468 6520 6368 6f73 656e s and the chosen │ │ │ +00097120: 206d 6574 686f 643a 0a3c 756c 3e0a 2020 method:.
      . │ │ │ +00097130: 3c6c 693e 0a20 5033 5020 6d65 7468 6f64
    • . P3P method │ │ │ +00097140: 7320 2852 4546 3a20 534f 4c56 4550 4e50 s (REF: SOLVEPNP │ │ │ +00097150: 5f50 3350 2c20 5245 463a 2053 4f4c 5645 _P3P, REF: SOLVE │ │ │ +00097160: 504e 505f 4150 3350 293a 2033 206f 7220 PNP_AP3P): 3 or │ │ │ +00097170: 3420 696e 7075 7420 706f 696e 7473 2e20 4 input points. │ │ │ +00097180: 4e75 6d62 6572 206f 6620 7265 7475 726e Number of return │ │ │ +00097190: 6564 2073 6f6c 7574 696f 6e73 2063 616e ed solutions can │ │ │ +000971a0: 2062 6520 6265 7477 6565 6e20 3020 616e be between 0 an │ │ │ +000971b0: 6420 3420 7769 7468 2033 2069 6e70 7574 d 4 with 3 input │ │ │ +000971c0: 2070 6f69 6e74 732e 0a20 203c 2f6c 693e points..
    • │ │ │ +000971d0: 0a20 203c 6c69 3e0a 2052 4546 3a20 534f .
    • . REF: SO │ │ │ +000971e0: 4c56 4550 4e50 5f49 5050 4520 496e 7075 LVEPNP_IPPE Inpu │ │ │ +000971f0: 7420 706f 696e 7473 206d 7573 7420 6265 t points must be │ │ │ +00097200: 2026 6774 3b3d 2034 2061 6e64 206f 626a >= 4 and obj │ │ │ +00097210: 6563 7420 706f 696e 7473 206d 7573 7420 ect points must │ │ │ +00097220: 6265 2063 6f70 6c61 6e61 722e 2052 6574 be coplanar. Ret │ │ │ +00097230: 7572 6e73 2032 2073 6f6c 7574 696f 6e73 urns 2 solutions │ │ │ +00097240: 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c 693e ..
    • .
    • │ │ │ +00097250: 0a20 5245 463a 2053 4f4c 5645 504e 505f . REF: SOLVEPNP_ │ │ │ +00097260: 4950 5045 5f53 5155 4152 4520 5370 6563 IPPE_SQUARE Spec │ │ │ +00097270: 6961 6c20 6361 7365 2073 7569 7461 626c ial case suitabl │ │ │ +00097280: 6520 666f 7220 6d61 726b 6572 2070 6f73 e for marker pos │ │ │ +00097290: 6520 6573 7469 6d61 7469 6f6e 2e0a 4e75 e estimation..Nu │ │ │ +000972a0: 6d62 6572 206f 6620 696e 7075 7420 706f mber of input po │ │ │ +000972b0: 696e 7473 206d 7573 7420 6265 2034 2061 ints must be 4 a │ │ │ +000972c0: 6e64 2032 2073 6f6c 7574 696f 6e73 2061 nd 2 solutions a │ │ │ +000972d0: 7265 2072 6574 7572 6e65 642e 204f 626a re returned. Obj │ │ │ +000972e0: 6563 7420 706f 696e 7473 206d 7573 7420 ect points must │ │ │ +000972f0: 6265 2064 6566 696e 6564 2069 6e20 7468 be defined in th │ │ │ +00097300: 6520 666f 6c6c 6f77 696e 6720 6f72 6465 e following orde │ │ │ +00097310: 723a 0a20 203c 756c 3e0a 2020 2020 3c6c r:.
        . . point 0: [ │ │ │ +00097330: 2d73 7175 6172 654c 656e 6774 6820 2f20 -squareLength / │ │ │ +00097340: 322c 2020 7371 7561 7265 4c65 6e67 7468 2, squareLength │ │ │ +00097350: 202f 2032 2c20 305d 0a20 2020 203c 2f6c / 2, 0]. .
      • . p │ │ │ +00097370: 6f69 6e74 2031 3a20 5b20 7371 7561 7265 oint 1: [ square │ │ │ +00097380: 4c65 6e67 7468 202f 2032 2c20 2073 7175 Length / 2, squ │ │ │ +00097390: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ +000973a0: 5d0a 2020 2020 3c2f 6c69 3e0a 2020 2020 ].
      • . │ │ │ +000973b0: 3c6c 693e 0a20 2020 706f 696e 7420 323a
      • . point 2: │ │ │ +000973c0: 205b 2073 7175 6172 654c 656e 6774 6820 [ squareLength │ │ │ +000973d0: 2f20 322c 202d 7371 7561 7265 4c65 6e67 / 2, -squareLeng │ │ │ +000973e0: 7468 202f 2032 2c20 305d 0a20 2020 203c th / 2, 0]. < │ │ │ +000973f0: 2f6c 693e 0a20 2020 203c 6c69 3e0a 2020 /li>.
      • . │ │ │ +00097400: 2070 6f69 6e74 2033 3a20 5b2d 7371 7561 point 3: [-squa │ │ │ +00097410: 7265 4c65 6e67 7468 202f 2032 2c20 2d73 reLength / 2, -s │ │ │ +00097420: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ +00097430: 2030 5d0a 2020 2020 3c2f 6c69 3e0a 2020 0].
      • . │ │ │ +00097440: 3c2f 756c 3e0a 2020 3c6c 693e 0a20 666f
      .
    • . fo │ │ │ +00097450: 7220 616c 6c20 7468 6520 6f74 6865 7220 r all the other │ │ │ +00097460: 666c 6167 732c 206e 756d 6265 7220 6f66 flags, number of │ │ │ +00097470: 2069 6e70 7574 2070 6f69 6e74 7320 6d75 input points mu │ │ │ +00097480: 7374 2062 6520 2667 743b 3d20 3420 616e st be >= 4 an │ │ │ +00097490: 6420 6f62 6a65 6374 2070 6f69 6e74 7320 d object points │ │ │ +000974a0: 6361 6e20 6265 2069 6e20 616e 7920 636f can be in any co │ │ │ +000974b0: 6e66 6967 7572 6174 696f 6e2e 0a4f 6e6c nfiguration..Onl │ │ │ +000974c0: 7920 3120 736f 6c75 7469 6f6e 2069 7320 y 1 solution is │ │ │ +000974d0: 7265 7475 726e 6564 2e0a 2020 3c2f 6c69 returned..
    • .
    . │ │ │ +00097500: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +00097510: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +00097520: 6f62 6a65 6374 506f 696e 7473 3c2f 636f objectPoints - Array of o │ │ │ +00097540: 626a 6563 7420 706f 696e 7473 2069 6e20 bject points in │ │ │ +00097550: 7468 6520 6f62 6a65 6374 2063 6f6f 7264 the object coord │ │ │ +00097560: 696e 6174 6520 7370 6163 652c 204e 7833 inate space, Nx3 │ │ │ +00097570: 2031 2d63 6861 6e6e 656c 206f 720a 3178 1-channel or.1x │ │ │ +00097580: 4e2f 4e78 3120 332d 6368 616e 6e65 6c2c N/Nx1 3-channel, │ │ │ +00097590: 2077 6865 7265 204e 2069 7320 7468 6520 where N is the │ │ │ +000975a0: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ +000975b0: 2e20 7665 6374 6f72 266c 743b 506f 696e . vector<Poin │ │ │ +000975c0: 7433 6426 6774 3b20 6361 6e20 6265 2061 t3d> can be a │ │ │ +000975d0: 6c73 6f20 7061 7373 6564 2068 6572 652e lso passed here. │ │ │ +000975e0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000975f0: 696d 6167 6550 6f69 6e74 733c 2f63 6f64 imagePoints - Array of co │ │ │ +00097610: 7272 6573 706f 6e64 696e 6720 696d 6167 rresponding imag │ │ │ +00097620: 6520 706f 696e 7473 2c20 4e78 3220 312d e points, Nx2 1- │ │ │ +00097630: 6368 616e 6e65 6c20 6f72 2031 784e 2f4e channel or 1xN/N │ │ │ +00097640: 7831 2032 2d63 6861 6e6e 656c 2c0a 7768 x1 2-channel,.wh │ │ │ +00097650: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ +00097660: 6265 7220 6f66 2070 6f69 6e74 732e 2076 ber of points. v │ │ │ +00097670: 6563 746f 7226 6c74 3b50 6f69 6e74 3264 ector<Point2d │ │ │ +00097680: 2667 743b 2063 616e 2062 6520 616c 736f > can be also │ │ │ +00097690: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    cam │ │ │ +000976b0: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ +000976c0: 202d 2049 6e70 7574 2063 616d 6572 6120 - Input camera │ │ │ +000976d0: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ +000976e0: 205c 285c 6361 6d65 7261 6d61 7472 6978 \(\cameramatrix │ │ │ +000976f0: 7b41 7d5c 2920 2e3c 2f64 643e 0a3c 6464 {A}\) .
    .
    distCoeff │ │ │ +00097710: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ +00097720: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ +00097730: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ +00097740: 7473 0a5c 285c 6469 7374 636f 6566 6673 ts.\(\distcoeffs │ │ │ +00097750: 5c29 2e20 4966 2074 6865 2076 6563 746f \). If the vecto │ │ │ +00097760: 7220 6973 204e 554c 4c2f 656d 7074 792c r is NULL/empty, │ │ │ +00097770: 2074 6865 207a 6572 6f20 6469 7374 6f72 the zero distor │ │ │ +00097780: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ +00097790: 7320 6172 650a 6173 7375 6d65 642e 3c2f s are.assumed..
    rv │ │ │ +000977b0: 6563 733c 2f63 6f64 653e 202d 2056 6563 ecs - Vec │ │ │ +000977c0: 746f 7220 6f66 206f 7574 7075 7420 726f tor of output ro │ │ │ +000977d0: 7461 7469 6f6e 2076 6563 746f 7273 2028 tation vectors ( │ │ │ +000977e0: 7365 6520 5245 463a 2052 6f64 7269 6775 see REF: Rodrigu │ │ │ +000977f0: 6573 2029 2074 6861 742c 2074 6f67 6574 es ) that, toget │ │ │ +00097800: 6865 7220 7769 7468 2074 7665 6373 2c20 her with tvecs, │ │ │ +00097810: 6272 696e 6773 2070 6f69 6e74 7320 6672 brings points fr │ │ │ +00097820: 6f6d 0a74 6865 206d 6f64 656c 2063 6f6f om.the model coo │ │ │ +00097830: 7264 696e 6174 6520 7379 7374 656d 2074 rdinate system t │ │ │ +00097840: 6f20 7468 6520 6361 6d65 7261 2063 6f6f o the camera coo │ │ │ +00097850: 7264 696e 6174 6520 7379 7374 656d 2e3c rdinate system.< │ │ │ +00097860: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ +00097870: 7665 6373 3c2f 636f 6465 3e20 2d20 5665 vecs - Ve │ │ │ +00097880: 6374 6f72 206f 6620 6f75 7470 7574 2074 ctor of output t │ │ │ +00097890: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ +000978a0: 7273 2e3c 2f64 643e 0a3c 6464 3e3c 636f rs.
    .
    useExtrinsicG │ │ │ +000978c0: 7565 7373 3c2f 636f 6465 3e20 2d20 5061 uess - Pa │ │ │ +000978d0: 7261 6d65 7465 7220 7573 6564 2066 6f72 rameter used for │ │ │ +000978e0: 2023 534f 4c56 4550 4e50 5f49 5445 5241 #SOLVEPNP_ITERA │ │ │ +000978f0: 5449 5645 2e20 4966 2074 7275 6520 2831 TIVE. If true (1 │ │ │ +00097900: 292c 2074 6865 2066 756e 6374 696f 6e20 ), the function │ │ │ +00097910: 7573 6573 0a74 6865 2070 726f 7669 6465 uses.the provide │ │ │ +00097920: 6420 7276 6563 2061 6e64 2074 7665 6320 d rvec and tvec │ │ │ +00097930: 7661 6c75 6573 2061 7320 696e 6974 6961 values as initia │ │ │ +00097940: 6c20 6170 7072 6f78 696d 6174 696f 6e73 l approximations │ │ │ +00097950: 206f 6620 7468 6520 726f 7461 7469 6f6e of the rotation │ │ │ +00097960: 2061 6e64 2074 7261 6e73 6c61 7469 6f6e and translation │ │ │ +00097970: 0a76 6563 746f 7273 2c20 7265 7370 6563 .vectors, respec │ │ │ +00097980: 7469 7665 6c79 2c20 616e 6420 6675 7274 tively, and furt │ │ │ +00097990: 6865 7220 6f70 7469 6d69 7a65 7320 7468 her optimizes th │ │ │ +000979a0: 656d 2e0a 616e 6420 7573 6545 7874 7269 em..and useExtri │ │ │ +000979b0: 6e73 6963 4775 6573 7320 6973 2073 6574 nsicGuess is set │ │ │ +000979c0: 2074 6f20 7472 7565 2e0a 616e 6420 7573 to true..and us │ │ │ +000979d0: 6545 7874 7269 6e73 6963 4775 6573 7320 eExtrinsicGuess │ │ │ +000979e0: 6973 2073 6574 2074 6f20 7472 7565 2e0a is set to true.. │ │ │ +000979f0: 285c 2820 5c74 6578 747b 524d 5345 7d20 (\( \text{RMSE} │ │ │ +00097a00: 3d20 5c73 7172 747b 5c66 7261 637b 5c73 = \sqrt{\frac{\s │ │ │ +00097a10: 756d 5f7b 697d 5e7b 4e7d 205c 6c65 6674 um_{i}^{N} \left │ │ │ +00097a20: 2028 205c 6861 747b 795f 697d 202d 2079 ( \hat{y_i} - y │ │ │ +00097a30: 5f69 205c 7269 6768 7420 295e 327d 7b4e _i \right )^2}{N │ │ │ +00097a40: 7d7d 205c 2929 2062 6574 7765 656e 2074 }} \)) between t │ │ │ +00097a50: 6865 2069 6e70 7574 2069 6d61 6765 2070 he input image p │ │ │ +00097a60: 6f69 6e74 730a 616e 6420 7468 6520 3344 oints.and the 3D │ │ │ +00097a70: 206f 626a 6563 7420 706f 696e 7473 2070 object points p │ │ │ +00097a80: 726f 6a65 6374 6564 2077 6974 6820 7468 rojected with th │ │ │ +00097a90: 6520 6573 7469 6d61 7465 6420 706f 7365 e estimated pose │ │ │ +00097aa0: 2e0a 0a4d 6f72 6520 696e 666f 726d 6174 ...More informat │ │ │ +00097ab0: 696f 6e20 6973 2064 6573 6372 6962 6564 ion is described │ │ │ +00097ac0: 2069 6e20 5245 463a 2063 616c 6962 3364 in REF: calib3d │ │ │ +00097ad0: 5f73 6f6c 7665 506e 500a 0a3c 623e 4e6f _solvePnP..No │ │ │ +00097ae0: 7465 3a3c 2f62 3e0a 3c75 6c3e 0a20 203c te:.
      . < │ │ │ +00097af0: 6c69 3e0a 2020 2020 2020 416e 2065 7861 li>. An exa │ │ │ +00097b00: 6d70 6c65 206f 6620 686f 7720 746f 2075 mple of how to u │ │ │ +00097b10: 7365 2073 6f6c 7665 506e 5020 666f 7220 se solvePnP for │ │ │ +00097b20: 706c 616e 6172 2061 7567 6d65 6e74 6564 planar augmented │ │ │ +00097b30: 2072 6561 6c69 7479 2063 616e 2062 6520 reality can be │ │ │ +00097b40: 666f 756e 6420 6174 0a20 2020 2020 2020 found at. │ │ │ +00097b50: 206f 7065 6e63 765f 736f 7572 6365 5f63 opencv_source_c │ │ │ +00097b60: 6f64 652f 7361 6d70 6c65 732f 7079 7468 ode/samples/pyth │ │ │ +00097b70: 6f6e 2f70 6c61 6e65 5f61 722e 7079 0a20 on/plane_ar.py. │ │ │ +00097b80: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020 .
    • . │ │ │ +00097b90: 2020 2020 4966 2079 6f75 2061 7265 2075 If you are u │ │ │ +00097ba0: 7369 6e67 2050 7974 686f 6e3a 0a20 203c sing Python:. < │ │ │ +00097bb0: 756c 3e0a 2020 2020 3c6c 693e 0a20 2020 ul>.
    • . │ │ │ +00097bc0: 2020 2020 2020 4e75 6d70 7920 6172 7261 Numpy arra │ │ │ +00097bd0: 7920 736c 6963 6573 2077 6f6e 2774 2077 y slices won't w │ │ │ +00097be0: 6f72 6b20 6173 2069 6e70 7574 2062 6563 ork as input bec │ │ │ +00097bf0: 6175 7365 2073 6f6c 7665 506e 5020 7265 ause solvePnP re │ │ │ +00097c00: 7175 6972 6573 2063 6f6e 7469 6775 6f75 quires contiguou │ │ │ +00097c10: 730a 2020 2020 2020 2020 6172 7261 7973 s. arrays │ │ │ +00097c20: 2028 656e 666f 7263 6564 2062 7920 7468 (enforced by th │ │ │ +00097c30: 6520 6173 7365 7274 696f 6e20 7573 696e e assertion usin │ │ │ +00097c40: 6720 6376 3a3a 4d61 743a 3a63 6865 636b g cv::Mat::check │ │ │ +00097c50: 5665 6374 6f72 2829 2061 726f 756e 6420 Vector() around │ │ │ +00097c60: 6c69 6e65 2035 3520 6f66 0a20 2020 2020 line 55 of. │ │ │ +00097c70: 2020 206d 6f64 756c 6573 2f33 642f 7372 modules/3d/sr │ │ │ +00097c80: 632f 736f 6c76 6570 6e70 2e63 7070 2076 c/solvepnp.cpp v │ │ │ +00097c90: 6572 7369 6f6e 2032 2e34 2e39 290a 2020 ersion 2.4.9). │ │ │ +00097ca0: 2020 3c2f 6c69 3e0a 2020 2020 3c6c 693e
    • .
    • │ │ │ +00097cb0: 0a20 2020 2020 2020 2020 5468 6520 5033 . The P3 │ │ │ +00097cc0: 5020 616c 676f 7269 7468 6d20 7265 7175 P algorithm requ │ │ │ +00097cd0: 6972 6573 2069 6d61 6765 2070 6f69 6e74 ires image point │ │ │ +00097ce0: 7320 746f 2062 6520 696e 2061 6e20 6172 s to be in an ar │ │ │ +00097cf0: 7261 7920 6f66 2073 6861 7065 2028 4e2c ray of shape (N, │ │ │ +00097d00: 312c 3229 2064 7565 0a20 2020 2020 2020 1,2) due. │ │ │ +00097d10: 2074 6f20 6974 7320 6361 6c6c 696e 6720 to its calling │ │ │ +00097d20: 6f66 2023 756e 6469 7374 6f72 7450 6f69 of #undistortPoi │ │ │ +00097d30: 6e74 7320 2861 726f 756e 6420 6c69 6e65 nts (around line │ │ │ +00097d40: 2037 3520 6f66 206d 6f64 756c 6573 2f33 75 of modules/3 │ │ │ +00097d50: 642f 7372 632f 736f 6c76 6570 6e70 2e63 d/src/solvepnp.c │ │ │ +00097d60: 7070 2076 6572 7369 6f6e 2032 2e34 2e39 pp version 2.4.9 │ │ │ +00097d70: 290a 2020 2020 2020 2020 7768 6963 6820 ). which │ │ │ +00097d80: 7265 7175 6972 6573 2032 2d63 6861 6e6e requires 2-chann │ │ │ +00097d90: 656c 2069 6e66 6f72 6d61 7469 6f6e 2e0a el information.. │ │ │ +00097da0: 2020 2020 3c2f 6c69 3e0a 2020 2020 3c6c
    • . . Thus │ │ │ +00097dc0: 2c20 6769 7665 6e20 736f 6d65 2064 6174 , given some dat │ │ │ +00097dd0: 6120 4420 3d20 6e70 2e61 7272 6179 282e a D = np.array(. │ │ │ +00097de0: 2e2e 2920 7768 6572 6520 442e 7368 6170 ..) where D.shap │ │ │ +00097df0: 6520 3d20 284e 2c4d 292c 2069 6e20 6f72 e = (N,M), in or │ │ │ +00097e00: 6465 7220 746f 2075 7365 2061 2073 7562 der to use a sub │ │ │ +00097e10: 7365 7420 6f66 0a20 2020 2020 2020 2069 set of. i │ │ │ +00097e20: 7420 6173 2c20 652e 672e 2c20 696d 6167 t as, e.g., imag │ │ │ +00097e30: 6550 6f69 6e74 732c 206f 6e65 206d 7573 ePoints, one mus │ │ │ +00097e40: 7420 6566 6665 6374 6976 656c 7920 636f t effectively co │ │ │ +00097e50: 7079 2069 7420 696e 746f 2061 206e 6577 py it into a new │ │ │ +00097e60: 2061 7272 6179 3a20 696d 6167 6550 6f69 array: imagePoi │ │ │ +00097e70: 6e74 7320 3d0a 2020 2020 2020 2020 6e70 nts =. np │ │ │ +00097e80: 2e61 7363 6f6e 7469 6775 6f75 7361 7272 .ascontiguousarr │ │ │ +00097e90: 6179 2844 5b3a 2c3a 325d 292e 7265 7368 ay(D[:,:2]).resh │ │ │ +00097ea0: 6170 6528 284e 2c31 2c32 2929 0a20 2020 ape((N,1,2)). │ │ │ +00097eb0: 203c 2f6c 693e 0a20 203c 2f75 6c3e 0a20 .
    . │ │ │ +00097ec0: 203c 6c69 3e0a 2020 2020 2020 5468 6520
  • . The │ │ │ +00097ed0: 6d69 6e69 6d75 6d20 6e75 6d62 6572 206f minimum number o │ │ │ +00097ee0: 6620 706f 696e 7473 2069 7320 3420 696e f points is 4 in │ │ │ +00097ef0: 2074 6865 2067 656e 6572 616c 2063 6173 the general cas │ │ │ +00097f00: 652e 2049 6e20 7468 6520 6361 7365 206f e. In the case o │ │ │ +00097f10: 6620 5245 463a 2053 4f4c 5645 504e 505f f REF: SOLVEPNP_ │ │ │ +00097f20: 5033 5020 616e 6420 5245 463a 2053 4f4c P3P and REF: SOL │ │ │ +00097f30: 5645 504e 505f 4150 3350 0a20 2020 2020 VEPNP_AP3P. │ │ │ +00097f40: 2020 6d65 7468 6f64 732c 2069 7420 6973 methods, it is │ │ │ +00097f50: 2072 6571 7569 7265 6420 746f 2075 7365 required to use │ │ │ +00097f60: 2065 7861 6374 6c79 2034 2070 6f69 6e74 exactly 4 point │ │ │ +00097f70: 7320 2874 6865 2066 6972 7374 2033 2070 s (the first 3 p │ │ │ +00097f80: 6f69 6e74 7320 6172 6520 7573 6564 2074 oints are used t │ │ │ +00097f90: 6f20 6573 7469 6d61 7465 2061 6c6c 2074 o estimate all t │ │ │ +00097fa0: 6865 2073 6f6c 7574 696f 6e73 0a20 2020 he solutions. │ │ │ +00097fb0: 2020 2020 6f66 2074 6865 2050 3350 2070 of the P3P p │ │ │ +00097fc0: 726f 626c 656d 2c20 7468 6520 6c61 7374 roblem, the last │ │ │ +00097fd0: 206f 6e65 2069 7320 7573 6564 2074 6f20 one is used to │ │ │ +00097fe0: 7265 7461 696e 2074 6865 2062 6573 7420 retain the best │ │ │ +00097ff0: 736f 6c75 7469 6f6e 2074 6861 7420 6d69 solution that mi │ │ │ +00098000: 6e69 6d69 7a65 7320 7468 6520 7265 7072 nimizes the repr │ │ │ +00098010: 6f6a 6563 7469 6f6e 2065 7272 6f72 292e ojection error). │ │ │ +00098020: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
  • .
  • . │ │ │ +00098030: 2020 2020 2020 5769 7468 2052 4546 3a20 With REF: │ │ │ +00098040: 534f 4c56 4550 4e50 5f49 5445 5241 5449 SOLVEPNP_ITERATI │ │ │ +00098050: 5645 206d 6574 686f 6420 616e 6420 3c63 VE method and useExtrinsic │ │ │ +00098070: 4775 6573 733d 7472 7565 3c2f 636f 6465 Guess=true, the minimum n │ │ │ +00098090: 756d 6265 7220 6f66 2070 6f69 6e74 7320 umber of points │ │ │ +000980a0: 6973 2033 2028 3320 706f 696e 7473 0a20 is 3 (3 points. │ │ │ +000980b0: 2020 2020 2020 6172 6520 7375 6666 6963 are suffic │ │ │ +000980c0: 6965 6e74 2074 6f20 636f 6d70 7574 6520 ient to compute │ │ │ +000980d0: 6120 706f 7365 2062 7574 2074 6865 7265 a pose but there │ │ │ +000980e0: 2061 7265 2075 7020 746f 2034 2073 6f6c are up to 4 sol │ │ │ +000980f0: 7574 696f 6e73 292e 2054 6865 2069 6e69 utions). The ini │ │ │ +00098100: 7469 616c 2073 6f6c 7574 696f 6e20 7368 tial solution sh │ │ │ +00098110: 6f75 6c64 2062 6520 636c 6f73 6520 746f ould be close to │ │ │ +00098120: 2074 6865 0a20 2020 2020 2020 676c 6f62 the. glob │ │ │ +00098130: 616c 2073 6f6c 7574 696f 6e20 746f 2063 al solution to c │ │ │ +00098140: 6f6e 7665 7267 652e 0a20 203c 2f6c 693e onverge..
  • │ │ │ +00098150: 0a20 203c 6c69 3e0a 2020 2020 2020 5769 .
  • . Wi │ │ │ +00098160: 7468 2052 4546 3a20 534f 4c56 4550 4e50 th REF: SOLVEPNP │ │ │ +00098170: 5f49 5050 4520 696e 7075 7420 706f 696e _IPPE input poin │ │ │ +00098180: 7473 206d 7573 7420 6265 2026 6774 3b3d ts must be >= │ │ │ +00098190: 2034 2061 6e64 206f 626a 6563 7420 706f 4 and object po │ │ │ +000981a0: 696e 7473 206d 7573 7420 6265 2063 6f70 ints must be cop │ │ │ +000981b0: 6c61 6e61 722e 0a20 203c 2f6c 693e 0a20 lanar..
  • . │ │ │ +000981c0: 203c 6c69 3e0a 2020 2020 2020 5769 7468
  • . With │ │ │ +000981d0: 2052 4546 3a20 534f 4c56 4550 4e50 5f49 REF: SOLVEPNP_I │ │ │ +000981e0: 5050 455f 5351 5541 5245 2074 6869 7320 PPE_SQUARE this │ │ │ +000981f0: 6973 2061 2073 7065 6369 616c 2063 6173 is a special cas │ │ │ +00098200: 6520 7375 6974 6162 6c65 2066 6f72 206d e suitable for m │ │ │ +00098210: 6172 6b65 7220 706f 7365 2065 7374 696d arker pose estim │ │ │ +00098220: 6174 696f 6e2e 0a20 2020 2020 2020 4e75 ation.. Nu │ │ │ +00098230: 6d62 6572 206f 6620 696e 7075 7420 706f mber of input po │ │ │ +00098240: 696e 7473 206d 7573 7420 6265 2034 2e20 ints must be 4. │ │ │ +00098250: 4f62 6a65 6374 2070 6f69 6e74 7320 6d75 Object points mu │ │ │ +00098260: 7374 2062 6520 6465 6669 6e65 6420 696e st be defined in │ │ │ +00098270: 2074 6865 2066 6f6c 6c6f 7769 6e67 206f the following o │ │ │ +00098280: 7264 6572 3a0a 2020 3c75 6c3e 0a20 2020 rder:.
      . │ │ │ +00098290: 203c 6c69 3e0a 2020 2020 2020 2020 2020
    • . │ │ │ +000982a0: 706f 696e 7420 303a 205b 2d73 7175 6172 point 0: [-squar │ │ │ +000982b0: 654c 656e 6774 6820 2f20 322c 2020 7371 eLength / 2, sq │ │ │ +000982c0: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +000982d0: 305d 0a20 2020 203c 2f6c 693e 0a20 2020 0].
    • . │ │ │ +000982e0: 203c 6c69 3e0a 2020 2020 2020 2020 2020
    • . │ │ │ +000982f0: 706f 696e 7420 313a 205b 2073 7175 6172 point 1: [ squar │ │ │ +00098300: 654c 656e 6774 6820 2f20 322c 2020 7371 eLength / 2, sq │ │ │ +00098310: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +00098320: 305d 0a20 2020 203c 2f6c 693e 0a20 2020 0].
    • . │ │ │ +00098330: 203c 6c69 3e0a 2020 2020 2020 2020 2020
    • . │ │ │ +00098340: 706f 696e 7420 323a 205b 2073 7175 6172 point 2: [ squar │ │ │ +00098350: 654c 656e 6774 6820 2f20 322c 202d 7371 eLength / 2, -sq │ │ │ +00098360: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +00098370: 305d 0a20 2020 203c 2f6c 693e 0a20 2020 0].
    • . │ │ │ +00098380: 203c 6c69 3e0a 2020 2020 2020 2020 2020
    • . │ │ │ +00098390: 706f 696e 7420 333a 205b 2d73 7175 6172 point 3: [-squar │ │ │ +000983a0: 654c 656e 6774 6820 2f20 322c 202d 7371 eLength / 2, -sq │ │ │ +000983b0: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +000983c0: 305d 0a20 2020 203c 2f6c 693e 0a20 203c 0].
    • . < │ │ │ +000983d0: 2f75 6c3e 0a20 203c 6c69 3e0a 2020 2020 /ul>.
    • . │ │ │ +000983e0: 2020 5769 7468 2052 4546 3a20 534f 4c56 With REF: SOLV │ │ │ +000983f0: 4550 4e50 5f53 5150 4e50 2069 6e70 7574 EPNP_SQPNP input │ │ │ +00098400: 2070 6f69 6e74 7320 6d75 7374 2062 6520 points must be │ │ │ +00098410: 2667 743b 3d20 330a 2020 3c2f 6c69 3e0a >= 3.
    • . │ │ │ +00098420: 3c2f 756c 3e3c 2f64 643e 0a3c 6474 3e52
  • .
    R │ │ │ +00098430: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    automatically g │ │ │ +00098450: 656e 6572 6174 6564 3c2f 6464 3e0a 3c2f enerated
    ....
  • .
  • │ │ │ +00098480: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .solvePnPGeneri │ │ │ +00098530: 633c 2f68 333e 0a3c 6469 7620 636c 6173 c.
    .
    pub │ │ │ +00098590: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static int  │ │ │ +000985d0: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;solv │ │ │ +000985f0: 6550 6e50 4765 6e65 7269 633c 2f73 7061 ePnPGeneric │ │ │ +00098620: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ +00098660: 3c2f 613e 266e 6273 703b 6f62 6a65 6374  object │ │ │ +00098670: 506f 696e 7473 2c0a 203c 6120 6872 6566 Points,. Mat&nbs │ │ │ +000986c0: 703b 696d 6167 6550 6f69 6e74 732c 0a20 p;imagePoints,. │ │ │ +000986d0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +00098710: 2f61 3e26 6e62 7370 3b63 616d 6572 614d /a> cameraM │ │ │ +00098720: 6174 7269 782c 0a20 3c61 2068 7265 663d atrix,. Mat  │ │ │ +00098770: 3b64 6973 7443 6f65 6666 732c 0a20 3c61 ;distCoeffs,. List& │ │ │ +00098820: 6c74 3b3c 6120 6872 6566 3d22 2e2e 2f63 lt;M │ │ │ +00098860: 6174 3c2f 613e 2667 743b 266e 6273 703b at>  │ │ │ +00098870: 7276 6563 732c 0a20 3c61 2068 7265 663d rvecs,. List<Mat │ │ │ +00098960: 2667 743b 266e 6273 703b 7476 6563 7329 > tvecs) │ │ │ +00098970: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Finds an object │ │ │ +000989a0: 2070 6f73 6520 5c28 207b 7d5e 7b63 7d5c pose \( {}^{c}\ │ │ │ +000989b0: 6d61 7468 6266 7b54 7d5f 6f20 5c29 2066 mathbf{T}_o \) f │ │ │ +000989c0: 726f 6d20 3344 2d32 4420 706f 696e 7420 rom 3D-2D point │ │ │ +000989d0: 636f 7272 6573 706f 6e64 656e 6365 732e correspondences. │ │ │ +000989e0: 0a0a 215b 5065 7273 7065 6374 6976 6520 ..![Perspective │ │ │ +000989f0: 7072 6f6a 6563 7469 6f6e 2c20 6672 6f6d projection, from │ │ │ +00098a00: 206f 626a 6563 7420 746f 2063 616d 6572 object to camer │ │ │ +00098a10: 6120 6672 616d 655d 2870 6963 732f 7069 a frame](pics/pi │ │ │ +00098a20: 6e68 6f6c 655f 686f 6d6f 6765 6e65 6f75 nhole_homogeneou │ │ │ +00098a30: 735f 7472 616e 7366 6f72 6d61 7469 6f6e s_transformation │ │ │ +00098a40: 2e6a 7067 297b 2077 6964 7468 3d35 3025 .jpg){ width=50% │ │ │ +00098a50: 207d 0a0a 5345 453a 2052 4546 3a20 6361 }..SEE: REF: ca │ │ │ +00098a60: 6c69 6233 645f 736f 6c76 6550 6e50 0a0a lib3d_solvePnP.. │ │ │ +00098a70: 5468 6973 2066 756e 6374 696f 6e20 7265 This function re │ │ │ +00098a80: 7475 726e 7320 6120 6c69 7374 206f 6620 turns a list of │ │ │ +00098a90: 616c 6c20 7468 6520 706f 7373 6962 6c65 all the possible │ │ │ +00098aa0: 2073 6f6c 7574 696f 6e73 2028 6120 736f solutions (a so │ │ │ +00098ab0: 6c75 7469 6f6e 2069 7320 6120 266c 743b lution is a < │ │ │ +00098ac0: 726f 7461 7469 6f6e 2076 6563 746f 722c rotation vector, │ │ │ +00098ad0: 2074 7261 6e73 6c61 7469 6f6e 2076 6563 translation vec │ │ │ +00098ae0: 746f 7226 6774 3b0a 636f 7570 6c65 292c tor>.couple), │ │ │ +00098af0: 2064 6570 656e 6469 6e67 206f 6e20 7468 depending on th │ │ │ +00098b00: 6520 6e75 6d62 6572 206f 6620 696e 7075 e number of inpu │ │ │ +00098b10: 7420 706f 696e 7473 2061 6e64 2074 6865 t points and the │ │ │ +00098b20: 2063 686f 7365 6e20 6d65 7468 6f64 3a0a chosen method:. │ │ │ +00098b30: 3c75 6c3e 0a20 203c 6c69 3e0a 2050 3350
      .
    • . P3P │ │ │ +00098b40: 206d 6574 686f 6473 2028 5245 463a 2053 methods (REF: S │ │ │ +00098b50: 4f4c 5645 504e 505f 5033 502c 2052 4546 OLVEPNP_P3P, REF │ │ │ +00098b60: 3a20 534f 4c56 4550 4e50 5f41 5033 5029 : SOLVEPNP_AP3P) │ │ │ +00098b70: 3a20 3320 6f72 2034 2069 6e70 7574 2070 : 3 or 4 input p │ │ │ +00098b80: 6f69 6e74 732e 204e 756d 6265 7220 6f66 oints. Number of │ │ │ +00098b90: 2072 6574 7572 6e65 6420 736f 6c75 7469 returned soluti │ │ │ +00098ba0: 6f6e 7320 6361 6e20 6265 2062 6574 7765 ons can be betwe │ │ │ +00098bb0: 656e 2030 2061 6e64 2034 2077 6974 6820 en 0 and 4 with │ │ │ +00098bc0: 3320 696e 7075 7420 706f 696e 7473 2e0a 3 input points.. │ │ │ +00098bd0: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ +00098be0: 5245 463a 2053 4f4c 5645 504e 505f 4950 REF: SOLVEPNP_IP │ │ │ +00098bf0: 5045 2049 6e70 7574 2070 6f69 6e74 7320 PE Input points │ │ │ +00098c00: 6d75 7374 2062 6520 2667 743b 3d20 3420 must be >= 4 │ │ │ +00098c10: 616e 6420 6f62 6a65 6374 2070 6f69 6e74 and object point │ │ │ +00098c20: 7320 6d75 7374 2062 6520 636f 706c 616e s must be coplan │ │ │ +00098c30: 6172 2e20 5265 7475 726e 7320 3220 736f ar. Returns 2 so │ │ │ +00098c40: 6c75 7469 6f6e 732e 0a20 203c 2f6c 693e lutions..
    • │ │ │ +00098c50: 0a20 203c 6c69 3e0a 2052 4546 3a20 534f .
    • . REF: SO │ │ │ +00098c60: 4c56 4550 4e50 5f49 5050 455f 5351 5541 LVEPNP_IPPE_SQUA │ │ │ +00098c70: 5245 2053 7065 6369 616c 2063 6173 6520 RE Special case │ │ │ +00098c80: 7375 6974 6162 6c65 2066 6f72 206d 6172 suitable for mar │ │ │ +00098c90: 6b65 7220 706f 7365 2065 7374 696d 6174 ker pose estimat │ │ │ +00098ca0: 696f 6e2e 0a4e 756d 6265 7220 6f66 2069 ion..Number of i │ │ │ +00098cb0: 6e70 7574 2070 6f69 6e74 7320 6d75 7374 nput points must │ │ │ +00098cc0: 2062 6520 3420 616e 6420 3220 736f 6c75 be 4 and 2 solu │ │ │ +00098cd0: 7469 6f6e 7320 6172 6520 7265 7475 726e tions are return │ │ │ +00098ce0: 6564 2e20 4f62 6a65 6374 2070 6f69 6e74 ed. Object point │ │ │ +00098cf0: 7320 6d75 7374 2062 6520 6465 6669 6e65 s must be define │ │ │ +00098d00: 6420 696e 2074 6865 2066 6f6c 6c6f 7769 d in the followi │ │ │ +00098d10: 6e67 206f 7264 6572 3a0a 2020 3c75 6c3e ng order:.
        │ │ │ +00098d20: 0a20 2020 203c 6c69 3e0a 2020 2070 6f69 .
      • . poi │ │ │ +00098d30: 6e74 2030 3a20 5b2d 7371 7561 7265 4c65 nt 0: [-squareLe │ │ │ +00098d40: 6e67 7468 202f 2032 2c20 2073 7175 6172 ngth / 2, squar │ │ │ +00098d50: 654c 656e 6774 6820 2f20 322c 2030 5d0a eLength / 2, 0]. │ │ │ +00098d60: 2020 2020 3c2f 6c69 3e0a 2020 2020 3c6c
      • . . point 1: [ │ │ │ +00098d80: 2073 7175 6172 654c 656e 6774 6820 2f20 squareLength / │ │ │ +00098d90: 322c 2020 7371 7561 7265 4c65 6e67 7468 2, squareLength │ │ │ +00098da0: 202f 2032 2c20 305d 0a20 2020 203c 2f6c / 2, 0]. .
      • . p │ │ │ +00098dc0: 6f69 6e74 2032 3a20 5b20 7371 7561 7265 oint 2: [ square │ │ │ +00098dd0: 4c65 6e67 7468 202f 2032 2c20 2d73 7175 Length / 2, -squ │ │ │ +00098de0: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ +00098df0: 5d0a 2020 2020 3c2f 6c69 3e0a 2020 2020 ].
      • . │ │ │ +00098e00: 3c6c 693e 0a20 2020 706f 696e 7420 333a
      • . point 3: │ │ │ +00098e10: 205b 2d73 7175 6172 654c 656e 6774 6820 [-squareLength │ │ │ +00098e20: 2f20 322c 202d 7371 7561 7265 4c65 6e67 / 2, -squareLeng │ │ │ +00098e30: 7468 202f 2032 2c20 305d 0a20 2020 203c th / 2, 0]. < │ │ │ +00098e40: 2f6c 693e 0a20 203c 2f75 6c3e 0a20 203c /li>.
      . < │ │ │ +00098e50: 6c69 3e0a 2066 6f72 2061 6c6c 2074 6865 li>. for all the │ │ │ +00098e60: 206f 7468 6572 2066 6c61 6773 2c20 6e75 other flags, nu │ │ │ +00098e70: 6d62 6572 206f 6620 696e 7075 7420 706f mber of input po │ │ │ +00098e80: 696e 7473 206d 7573 7420 6265 2026 6774 ints must be > │ │ │ +00098e90: 3b3d 2034 2061 6e64 206f 626a 6563 7420 ;= 4 and object │ │ │ +00098ea0: 706f 696e 7473 2063 616e 2062 6520 696e points can be in │ │ │ +00098eb0: 2061 6e79 2063 6f6e 6669 6775 7261 7469 any configurati │ │ │ +00098ec0: 6f6e 2e0a 4f6e 6c79 2031 2073 6f6c 7574 on..Only 1 solut │ │ │ +00098ed0: 696f 6e20 6973 2072 6574 7572 6e65 642e ion is returned. │ │ │ +00098ee0: 0a20 203c 2f6c 693e 0a3c 2f75 6c3e 3c2f .
    • .
    .
    .
    Para │ │ │ +00098f10: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    objectPoi │ │ │ +00098f30: 6e74 733c 2f63 6f64 653e 202d 2041 7272 nts - Arr │ │ │ +00098f40: 6179 206f 6620 6f62 6a65 6374 2070 6f69 ay of object poi │ │ │ +00098f50: 6e74 7320 696e 2074 6865 206f 626a 6563 nts in the objec │ │ │ +00098f60: 7420 636f 6f72 6469 6e61 7465 2073 7061 t coordinate spa │ │ │ +00098f70: 6365 2c20 4e78 3320 312d 6368 616e 6e65 ce, Nx3 1-channe │ │ │ +00098f80: 6c20 6f72 0a31 784e 2f4e 7831 2033 2d63 l or.1xN/Nx1 3-c │ │ │ +00098f90: 6861 6e6e 656c 2c20 7768 6572 6520 4e20 hannel, where N │ │ │ +00098fa0: 6973 2074 6865 206e 756d 6265 7220 6f66 is the number of │ │ │ +00098fb0: 2070 6f69 6e74 732e 2076 6563 746f 7226 points. vector& │ │ │ +00098fc0: 6c74 3b50 6f69 6e74 3364 2667 743b 2063 lt;Point3d> c │ │ │ +00098fd0: 616e 2062 6520 616c 736f 2070 6173 7365 an be also passe │ │ │ +00098fe0: 6420 6865 7265 2e3c 2f64 643e 0a3c 6464 d here.
    .
    imagePoin │ │ │ +00099000: 7473 3c2f 636f 6465 3e20 2d20 4172 7261 ts - Arra │ │ │ +00099010: 7920 6f66 2063 6f72 7265 7370 6f6e 6469 y of correspondi │ │ │ +00099020: 6e67 2069 6d61 6765 2070 6f69 6e74 732c ng image points, │ │ │ +00099030: 204e 7832 2031 2d63 6861 6e6e 656c 206f Nx2 1-channel o │ │ │ +00099040: 7220 3178 4e2f 4e78 3120 322d 6368 616e r 1xN/Nx1 2-chan │ │ │ +00099050: 6e65 6c2c 0a77 6865 7265 204e 2069 7320 nel,.where N is │ │ │ +00099060: 7468 6520 6e75 6d62 6572 206f 6620 706f the number of po │ │ │ +00099070: 696e 7473 2e20 7665 6374 6f72 266c 743b ints. vector< │ │ │ +00099080: 506f 696e 7432 6426 6774 3b20 6361 6e20 Point2d> can │ │ │ +00099090: 6265 2061 6c73 6f20 7061 7373 6564 2068 be also passed h │ │ │ +000990a0: 6572 652e 3c2f 6464 3e0a 3c64 643e 3c63 ere.
    .
    cameraMatrix │ │ │ +000990c0: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ +000990d0: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ +000990e0: 206d 6174 7269 7820 5c28 5c63 616d 6572 matrix \(\camer │ │ │ +000990f0: 616d 6174 7269 787b 417d 5c29 202e 3c2f amatrix{A}\) ..
    di │ │ │ +00099110: 7374 436f 6566 6673 3c2f 636f 6465 3e20 stCoeffs │ │ │ +00099120: 2d20 496e 7075 7420 7665 6374 6f72 206f - Input vector o │ │ │ +00099130: 6620 6469 7374 6f72 7469 6f6e 2063 6f65 f distortion coe │ │ │ +00099140: 6666 6963 6965 6e74 730a 5c28 5c64 6973 fficients.\(\dis │ │ │ +00099150: 7463 6f65 6666 735c 292e 2049 6620 7468 tcoeffs\). If th │ │ │ +00099160: 6520 7665 6374 6f72 2069 7320 4e55 4c4c e vector is NULL │ │ │ +00099170: 2f65 6d70 7479 2c20 7468 6520 7a65 726f /empty, the zero │ │ │ +00099180: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ +00099190: 6669 6369 656e 7473 2061 7265 0a61 7373 ficients are.ass │ │ │ +000991a0: 756d 6564 2e3c 2f64 643e 0a3c 6464 3e3c umed.
    .
    < │ │ │ +000991b0: 636f 6465 3e72 7665 6373 3c2f 636f 6465 code>rvecs - Vector of ou │ │ │ +000991d0: 7470 7574 2072 6f74 6174 696f 6e20 7665 tput rotation ve │ │ │ +000991e0: 6374 6f72 7320 2873 6565 2052 4546 3a20 ctors (see REF: │ │ │ +000991f0: 526f 6472 6967 7565 7320 2920 7468 6174 Rodrigues ) that │ │ │ +00099200: 2c20 746f 6765 7468 6572 2077 6974 6820 , together with │ │ │ +00099210: 7476 6563 732c 2062 7269 6e67 7320 706f tvecs, brings po │ │ │ +00099220: 696e 7473 2066 726f 6d0a 7468 6520 6d6f ints from.the mo │ │ │ +00099230: 6465 6c20 636f 6f72 6469 6e61 7465 2073 del coordinate s │ │ │ +00099240: 7973 7465 6d20 746f 2074 6865 2063 616d ystem to the cam │ │ │ +00099250: 6572 6120 636f 6f72 6469 6e61 7465 2073 era coordinate s │ │ │ +00099260: 7973 7465 6d2e 3c2f 6464 3e0a 3c64 643e ystem.
    .
    │ │ │ +00099270: 3c63 6f64 653e 7476 6563 733c 2f63 6f64 tvecs - Vector of o │ │ │ +00099290: 7574 7075 7420 7472 616e 736c 6174 696f utput translatio │ │ │ +000992a0: 6e20 7665 6374 6f72 732e 0a74 6865 2070 n vectors..the p │ │ │ +000992b0: 726f 7669 6465 6420 7276 6563 2061 6e64 rovided rvec and │ │ │ +000992c0: 2074 7665 6320 7661 6c75 6573 2061 7320 tvec values as │ │ │ +000992d0: 696e 6974 6961 6c20 6170 7072 6f78 696d initial approxim │ │ │ +000992e0: 6174 696f 6e73 206f 6620 7468 6520 726f ations of the ro │ │ │ +000992f0: 7461 7469 6f6e 2061 6e64 2074 7261 6e73 tation and trans │ │ │ +00099300: 6c61 7469 6f6e 0a76 6563 746f 7273 2c20 lation.vectors, │ │ │ +00099310: 7265 7370 6563 7469 7665 6c79 2c20 616e respectively, an │ │ │ +00099320: 6420 6675 7274 6865 7220 6f70 7469 6d69 d further optimi │ │ │ +00099330: 7a65 7320 7468 656d 2e0a 616e 6420 7573 zes them..and us │ │ │ +00099340: 6545 7874 7269 6e73 6963 4775 6573 7320 eExtrinsicGuess │ │ │ +00099350: 6973 2073 6574 2074 6f20 7472 7565 2e0a is set to true.. │ │ │ +00099360: 616e 6420 7573 6545 7874 7269 6e73 6963 and useExtrinsic │ │ │ +00099370: 4775 6573 7320 6973 2073 6574 2074 6f20 Guess is set to │ │ │ +00099380: 7472 7565 2e0a 285c 2820 5c74 6578 747b true..(\( \text{ │ │ │ +00099390: 524d 5345 7d20 3d20 5c73 7172 747b 5c66 RMSE} = \sqrt{\f │ │ │ +000993a0: 7261 637b 5c73 756d 5f7b 697d 5e7b 4e7d rac{\sum_{i}^{N} │ │ │ +000993b0: 205c 6c65 6674 2028 205c 6861 747b 795f \left ( \hat{y_ │ │ │ +000993c0: 697d 202d 2079 5f69 205c 7269 6768 7420 i} - y_i \right │ │ │ +000993d0: 295e 327d 7b4e 7d7d 205c 2929 2062 6574 )^2}{N}} \)) bet │ │ │ +000993e0: 7765 656e 2074 6865 2069 6e70 7574 2069 ween the input i │ │ │ +000993f0: 6d61 6765 2070 6f69 6e74 730a 616e 6420 mage points.and │ │ │ +00099400: 7468 6520 3344 206f 626a 6563 7420 706f the 3D object po │ │ │ +00099410: 696e 7473 2070 726f 6a65 6374 6564 2077 ints projected w │ │ │ +00099420: 6974 6820 7468 6520 6573 7469 6d61 7465 ith the estimate │ │ │ +00099430: 6420 706f 7365 2e0a 0a4d 6f72 6520 696e d pose...More in │ │ │ +00099440: 666f 726d 6174 696f 6e20 6973 2064 6573 formation is des │ │ │ +00099450: 6372 6962 6564 2069 6e20 5245 463a 2063 cribed in REF: c │ │ │ +00099460: 616c 6962 3364 5f73 6f6c 7665 506e 500a alib3d_solvePnP. │ │ │ +00099470: 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a 3c75 .Note:..
  • . │ │ │ +00099490: 416e 2065 7861 6d70 6c65 206f 6620 686f An example of ho │ │ │ +000994a0: 7720 746f 2075 7365 2073 6f6c 7665 506e w to use solvePn │ │ │ +000994b0: 5020 666f 7220 706c 616e 6172 2061 7567 P for planar aug │ │ │ +000994c0: 6d65 6e74 6564 2072 6561 6c69 7479 2063 mented reality c │ │ │ +000994d0: 616e 2062 6520 666f 756e 6420 6174 0a20 an be found at. │ │ │ +000994e0: 2020 2020 2020 206f 7065 6e63 765f 736f opencv_so │ │ │ +000994f0: 7572 6365 5f63 6f64 652f 7361 6d70 6c65 urce_code/sample │ │ │ +00099500: 732f 7079 7468 6f6e 2f70 6c61 6e65 5f61 s/python/plane_a │ │ │ +00099510: 722e 7079 0a20 203c 2f6c 693e 0a20 203c r.py.
  • . < │ │ │ +00099520: 6c69 3e0a 2020 2020 2020 4966 2079 6f75 li>. If you │ │ │ +00099530: 2061 7265 2075 7369 6e67 2050 7974 686f are using Pytho │ │ │ +00099540: 6e3a 0a20 203c 756c 3e0a 2020 2020 3c6c n:.
      . . Nump │ │ │ +00099560: 7920 6172 7261 7920 736c 6963 6573 2077 y array slices w │ │ │ +00099570: 6f6e 2774 2077 6f72 6b20 6173 2069 6e70 on't work as inp │ │ │ +00099580: 7574 2062 6563 6175 7365 2073 6f6c 7665 ut because solve │ │ │ +00099590: 506e 5020 7265 7175 6972 6573 2063 6f6e PnP requires con │ │ │ +000995a0: 7469 6775 6f75 730a 2020 2020 2020 2020 tiguous. │ │ │ +000995b0: 6172 7261 7973 2028 656e 666f 7263 6564 arrays (enforced │ │ │ +000995c0: 2062 7920 7468 6520 6173 7365 7274 696f by the assertio │ │ │ +000995d0: 6e20 7573 696e 6720 6376 3a3a 4d61 743a n using cv::Mat: │ │ │ +000995e0: 3a63 6865 636b 5665 6374 6f72 2829 2061 :checkVector() a │ │ │ +000995f0: 726f 756e 6420 6c69 6e65 2035 3520 6f66 round line 55 of │ │ │ +00099600: 0a20 2020 2020 2020 206d 6f64 756c 6573 . modules │ │ │ +00099610: 2f33 642f 7372 632f 736f 6c76 6570 6e70 /3d/src/solvepnp │ │ │ +00099620: 2e63 7070 2076 6572 7369 6f6e 2032 2e34 .cpp version 2.4 │ │ │ +00099630: 2e39 290a 2020 2020 3c2f 6c69 3e0a 2020 .9). . │ │ │ +00099640: 2020 3c6c 693e 0a20 2020 2020 2020 2020
    • . │ │ │ +00099650: 5468 6520 5033 5020 616c 676f 7269 7468 The P3P algorith │ │ │ +00099660: 6d20 7265 7175 6972 6573 2069 6d61 6765 m requires image │ │ │ +00099670: 2070 6f69 6e74 7320 746f 2062 6520 696e points to be in │ │ │ +00099680: 2061 6e20 6172 7261 7920 6f66 2073 6861 an array of sha │ │ │ +00099690: 7065 2028 4e2c 312c 3229 2064 7565 0a20 pe (N,1,2) due. │ │ │ +000996a0: 2020 2020 2020 2074 6f20 6974 7320 6361 to its ca │ │ │ +000996b0: 6c6c 696e 6720 6f66 2023 756e 6469 7374 lling of #undist │ │ │ +000996c0: 6f72 7450 6f69 6e74 7320 2861 726f 756e ortPoints (aroun │ │ │ +000996d0: 6420 6c69 6e65 2037 3520 6f66 206d 6f64 d line 75 of mod │ │ │ +000996e0: 756c 6573 2f33 642f 7372 632f 736f 6c76 ules/3d/src/solv │ │ │ +000996f0: 6570 6e70 2e63 7070 2076 6572 7369 6f6e epnp.cpp version │ │ │ +00099700: 2032 2e34 2e39 290a 2020 2020 2020 2020 2.4.9). │ │ │ +00099710: 7768 6963 6820 7265 7175 6972 6573 2032 which requires 2 │ │ │ +00099720: 2d63 6861 6e6e 656c 2069 6e66 6f72 6d61 -channel informa │ │ │ +00099730: 7469 6f6e 2e0a 2020 2020 3c2f 6c69 3e0a tion..
    • . │ │ │ +00099740: 2020 2020 3c6c 693e 0a20 2020 2020 2020
    • . │ │ │ +00099750: 2020 5468 7573 2c20 6769 7665 6e20 736f Thus, given so │ │ │ +00099760: 6d65 2064 6174 6120 4420 3d20 6e70 2e61 me data D = np.a │ │ │ +00099770: 7272 6179 282e 2e2e 2920 7768 6572 6520 rray(...) where │ │ │ +00099780: 442e 7368 6170 6520 3d20 284e 2c4d 292c D.shape = (N,M), │ │ │ +00099790: 2069 6e20 6f72 6465 7220 746f 2075 7365 in order to use │ │ │ +000997a0: 2061 2073 7562 7365 7420 6f66 0a20 2020 a subset of. │ │ │ +000997b0: 2020 2020 2069 7420 6173 2c20 652e 672e it as, e.g. │ │ │ +000997c0: 2c20 696d 6167 6550 6f69 6e74 732c 206f , imagePoints, o │ │ │ +000997d0: 6e65 206d 7573 7420 6566 6665 6374 6976 ne must effectiv │ │ │ +000997e0: 656c 7920 636f 7079 2069 7420 696e 746f ely copy it into │ │ │ +000997f0: 2061 206e 6577 2061 7272 6179 3a20 696d a new array: im │ │ │ +00099800: 6167 6550 6f69 6e74 7320 3d0a 2020 2020 agePoints =. │ │ │ +00099810: 2020 2020 6e70 2e61 7363 6f6e 7469 6775 np.ascontigu │ │ │ +00099820: 6f75 7361 7272 6179 2844 5b3a 2c3a 325d ousarray(D[:,:2] │ │ │ +00099830: 292e 7265 7368 6170 6528 284e 2c31 2c32 ).reshape((N,1,2 │ │ │ +00099840: 2929 0a20 2020 203c 2f6c 693e 0a20 203c )).
    • . < │ │ │ +00099850: 2f75 6c3e 0a20 203c 6c69 3e0a 2020 2020 /ul>.
    • . │ │ │ +00099860: 2020 5468 6520 6d69 6e69 6d75 6d20 6e75 The minimum nu │ │ │ +00099870: 6d62 6572 206f 6620 706f 696e 7473 2069 mber of points i │ │ │ +00099880: 7320 3420 696e 2074 6865 2067 656e 6572 s 4 in the gener │ │ │ +00099890: 616c 2063 6173 652e 2049 6e20 7468 6520 al case. In the │ │ │ +000998a0: 6361 7365 206f 6620 5245 463a 2053 4f4c case of REF: SOL │ │ │ +000998b0: 5645 504e 505f 5033 5020 616e 6420 5245 VEPNP_P3P and RE │ │ │ +000998c0: 463a 2053 4f4c 5645 504e 505f 4150 3350 F: SOLVEPNP_AP3P │ │ │ +000998d0: 0a20 2020 2020 2020 6d65 7468 6f64 732c . methods, │ │ │ +000998e0: 2069 7420 6973 2072 6571 7569 7265 6420 it is required │ │ │ +000998f0: 746f 2075 7365 2065 7861 6374 6c79 2034 to use exactly 4 │ │ │ +00099900: 2070 6f69 6e74 7320 2874 6865 2066 6972 points (the fir │ │ │ +00099910: 7374 2033 2070 6f69 6e74 7320 6172 6520 st 3 points are │ │ │ +00099920: 7573 6564 2074 6f20 6573 7469 6d61 7465 used to estimate │ │ │ +00099930: 2061 6c6c 2074 6865 2073 6f6c 7574 696f all the solutio │ │ │ +00099940: 6e73 0a20 2020 2020 2020 6f66 2074 6865 ns. of the │ │ │ +00099950: 2050 3350 2070 726f 626c 656d 2c20 7468 P3P problem, th │ │ │ +00099960: 6520 6c61 7374 206f 6e65 2069 7320 7573 e last one is us │ │ │ +00099970: 6564 2074 6f20 7265 7461 696e 2074 6865 ed to retain the │ │ │ +00099980: 2062 6573 7420 736f 6c75 7469 6f6e 2074 best solution t │ │ │ +00099990: 6861 7420 6d69 6e69 6d69 7a65 7320 7468 hat minimizes th │ │ │ +000999a0: 6520 7265 7072 6f6a 6563 7469 6f6e 2065 e reprojection e │ │ │ +000999b0: 7272 6f72 292e 0a20 203c 2f6c 693e 0a20 rror)..
    • . │ │ │ +000999c0: 203c 6c69 3e0a 2020 2020 2020 5769 7468
    • . With │ │ │ +000999d0: 2052 4546 3a20 534f 4c56 4550 4e50 5f49 REF: SOLVEPNP_I │ │ │ +000999e0: 5445 5241 5449 5645 206d 6574 686f 6420 TERATIVE method │ │ │ +000999f0: 616e 6420 3c63 6f64 653e 7573 6545 7874 and useExt │ │ │ +00099a00: 7269 6e73 6963 4775 6573 733d 7472 7565 rinsicGuess=true │ │ │ +00099a10: 3c2f 636f 6465 3e2c 2074 6865 206d 696e , the min │ │ │ +00099a20: 696d 756d 206e 756d 6265 7220 6f66 2070 imum number of p │ │ │ +00099a30: 6f69 6e74 7320 6973 2033 2028 3320 706f oints is 3 (3 po │ │ │ +00099a40: 696e 7473 0a20 2020 2020 2020 6172 6520 ints. are │ │ │ +00099a50: 7375 6666 6963 6965 6e74 2074 6f20 636f sufficient to co │ │ │ +00099a60: 6d70 7574 6520 6120 706f 7365 2062 7574 mpute a pose but │ │ │ +00099a70: 2074 6865 7265 2061 7265 2075 7020 746f there are up to │ │ │ +00099a80: 2034 2073 6f6c 7574 696f 6e73 292e 2054 4 solutions). T │ │ │ +00099a90: 6865 2069 6e69 7469 616c 2073 6f6c 7574 he initial solut │ │ │ +00099aa0: 696f 6e20 7368 6f75 6c64 2062 6520 636c ion should be cl │ │ │ +00099ab0: 6f73 6520 746f 2074 6865 0a20 2020 2020 ose to the. │ │ │ +00099ac0: 2020 676c 6f62 616c 2073 6f6c 7574 696f global solutio │ │ │ +00099ad0: 6e20 746f 2063 6f6e 7665 7267 652e 0a20 n to converge.. │ │ │ +00099ae0: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020
    • .
    • . │ │ │ +00099af0: 2020 2020 5769 7468 2052 4546 3a20 534f With REF: SO │ │ │ +00099b00: 4c56 4550 4e50 5f49 5050 4520 696e 7075 LVEPNP_IPPE inpu │ │ │ +00099b10: 7420 706f 696e 7473 206d 7573 7420 6265 t points must be │ │ │ +00099b20: 2026 6774 3b3d 2034 2061 6e64 206f 626a >= 4 and obj │ │ │ +00099b30: 6563 7420 706f 696e 7473 206d 7573 7420 ect points must │ │ │ +00099b40: 6265 2063 6f70 6c61 6e61 722e 0a20 203c be coplanar.. < │ │ │ +00099b50: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2020 /li>.
    • . │ │ │ +00099b60: 2020 5769 7468 2052 4546 3a20 534f 4c56 With REF: SOLV │ │ │ +00099b70: 4550 4e50 5f49 5050 455f 5351 5541 5245 EPNP_IPPE_SQUARE │ │ │ +00099b80: 2074 6869 7320 6973 2061 2073 7065 6369 this is a speci │ │ │ +00099b90: 616c 2063 6173 6520 7375 6974 6162 6c65 al case suitable │ │ │ +00099ba0: 2066 6f72 206d 6172 6b65 7220 706f 7365 for marker pose │ │ │ +00099bb0: 2065 7374 696d 6174 696f 6e2e 0a20 2020 estimation.. │ │ │ +00099bc0: 2020 2020 4e75 6d62 6572 206f 6620 696e Number of in │ │ │ +00099bd0: 7075 7420 706f 696e 7473 206d 7573 7420 put points must │ │ │ +00099be0: 6265 2034 2e20 4f62 6a65 6374 2070 6f69 be 4. Object poi │ │ │ +00099bf0: 6e74 7320 6d75 7374 2062 6520 6465 6669 nts must be defi │ │ │ +00099c00: 6e65 6420 696e 2074 6865 2066 6f6c 6c6f ned in the follo │ │ │ +00099c10: 7769 6e67 206f 7264 6572 3a0a 2020 3c75 wing order:. .
    • . │ │ │ +00099c30: 2020 2020 2020 706f 696e 7420 303a 205b point 0: [ │ │ │ +00099c40: 2d73 7175 6172 654c 656e 6774 6820 2f20 -squareLength / │ │ │ +00099c50: 322c 2020 7371 7561 7265 4c65 6e67 7468 2, squareLength │ │ │ +00099c60: 202f 2032 2c20 305d 0a20 2020 203c 2f6c / 2, 0]. .
    • . │ │ │ +00099c80: 2020 2020 2020 706f 696e 7420 313a 205b point 1: [ │ │ │ +00099c90: 2073 7175 6172 654c 656e 6774 6820 2f20 squareLength / │ │ │ +00099ca0: 322c 2020 7371 7561 7265 4c65 6e67 7468 2, squareLength │ │ │ +00099cb0: 202f 2032 2c20 305d 0a20 2020 203c 2f6c / 2, 0]. .
    • . │ │ │ +00099cd0: 2020 2020 2020 706f 696e 7420 323a 205b point 2: [ │ │ │ +00099ce0: 2073 7175 6172 654c 656e 6774 6820 2f20 squareLength / │ │ │ +00099cf0: 322c 202d 7371 7561 7265 4c65 6e67 7468 2, -squareLength │ │ │ +00099d00: 202f 2032 2c20 305d 0a20 2020 203c 2f6c / 2, 0]. .
    • . │ │ │ +00099d20: 2020 2020 2020 706f 696e 7420 333a 205b point 3: [ │ │ │ +00099d30: 2d73 7175 6172 654c 656e 6774 6820 2f20 -squareLength / │ │ │ +00099d40: 322c 202d 7371 7561 7265 4c65 6e67 7468 2, -squareLength │ │ │ +00099d50: 202f 2032 2c20 305d 0a20 2020 203c 2f6c / 2, 0]. .
    .
  • . With REF │ │ │ +00099d80: 3a20 534f 4c56 4550 4e50 5f53 5150 4e50 : SOLVEPNP_SQPNP │ │ │ +00099d90: 2069 6e70 7574 2070 6f69 6e74 7320 6d75 input points mu │ │ │ +00099da0: 7374 2062 6520 2667 743b 3d20 330a 2020 st be >= 3. │ │ │ +00099db0: 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64 643e
  • .
    │ │ │ +00099dc0: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    automatic │ │ │ +00099de0: 616c 6c79 2067 656e 6572 6174 6564 3c2f ally generated.
    .
    │ │ │ +00099e00: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
    .
  • .
  • .
    .

    convertPointsTo │ │ │ +00099e90: 486f 6d6f 6765 6e65 6f75 733c 2f68 333e Homogeneous

    │ │ │ +00099ea0: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ +00099ec0: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ +00099ee0: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ +00099ef0: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ +00099f00: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ +00099f10: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;void< │ │ │ +00099f30: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> convertPo │ │ │ +00099f60: 696e 7473 546f 486f 6d6f 6765 6e65 6f75 intsToHomogeneou │ │ │ +00099f70: 733c 2f73 7061 6e3e 3c77 6272 3e3c 7370 s(Mat  │ │ │ +00099fe0: 7372 632c 0a20 3c61 2068 7265 663d 222e src,. Mat d │ │ │ +0009a030: 7374 2c0a 2069 6e74 266e 6273 703b 6474 st,. int dt │ │ │ +0009a040: 7970 6529 3c2f 7370 616e 3e3c 2f64 6976 ype)
    .
    Converts po │ │ │ +0009a070: 696e 7473 2066 726f 6d20 4575 636c 6964 ints from Euclid │ │ │ +0009a080: 6561 6e20 746f 2068 6f6d 6f67 656e 656f ean to homogeneo │ │ │ +0009a090: 7573 2073 7061 6365 2e3c 2f64 6976 3e0a us space.
    . │ │ │ +0009a0a0: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ +0009a0c0: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    src - I │ │ │ +0009a0e0: 6e70 7574 2076 6563 746f 7220 6f66 204e nput vector of N │ │ │ +0009a0f0: 2d64 696d 656e 7369 6f6e 616c 2070 6f69 -dimensional poi │ │ │ +0009a100: 6e74 732e 3c2f 6464 3e0a 3c64 643e 3c63 nts.
    .
    dst - │ │ │ +0009a120: 204f 7574 7075 7420 7665 6374 6f72 206f Output vector o │ │ │ +0009a130: 6620 4e2b 312d 6469 6d65 6e73 696f 6e61 f N+1-dimensiona │ │ │ +0009a140: 6c20 706f 696e 7473 2e3c 2f64 643e 0a3c l points.
    .< │ │ │ +0009a150: 6464 3e3c 636f 6465 3e64 7479 7065 3c2f dd>dtype - The desi │ │ │ +0009a170: 7265 6420 6f75 7470 7574 2061 7272 6179 red output array │ │ │ +0009a180: 2064 6570 7468 2028 6569 7468 6572 2043 depth (either C │ │ │ +0009a190: 565f 3332 4620 6f72 2043 565f 3634 4620 V_32F or CV_64F │ │ │ +0009a1a0: 6172 6520 6375 7272 656e 746c 7920 7375 are currently su │ │ │ +0009a1b0: 7070 6f72 7465 6429 2e0a 2020 2020 4966 pported).. If │ │ │ +0009a1c0: 2069 7427 7320 2d31 2c20 7468 656e 2069 it's -1, then i │ │ │ +0009a1d0: 7427 7320 7365 7420 6175 746f 6d61 7469 t's set automati │ │ │ +0009a1e0: 6361 6c6c 7920 746f 2043 565f 3332 4620 cally to CV_32F │ │ │ +0009a1f0: 6f72 2043 565f 3634 462c 2064 6570 656e or CV_64F, depen │ │ │ +0009a200: 6469 6e67 206f 6e20 7468 6520 696e 7075 ding on the inpu │ │ │ +0009a210: 7420 6465 7074 682e 0a0a 5468 6520 6675 t depth...The fu │ │ │ +0009a220: 6e63 7469 6f6e 2063 6f6e 7665 7274 7320 nction converts │ │ │ +0009a230: 706f 696e 7473 2066 726f 6d20 4575 636c points from Eucl │ │ │ +0009a240: 6964 6561 6e20 746f 2068 6f6d 6f67 656e idean to homogen │ │ │ +0009a250: 656f 7573 2073 7061 6365 2062 7920 6170 eous space by ap │ │ │ +0009a260: 7065 6e64 696e 6720 3127 7320 746f 2074 pending 1's to t │ │ │ +0009a270: 6865 2074 7570 6c65 206f 660a 706f 696e he tuple of.poin │ │ │ +0009a280: 7420 636f 6f72 6469 6e61 7465 732e 2054 t coordinates. T │ │ │ +0009a290: 6861 7420 6973 2c20 6561 6368 2070 6f69 hat is, each poi │ │ │ +0009a2a0: 6e74 2028 7831 2c20 7832 2c20 2e2e 2e2c nt (x1, x2, ..., │ │ │ +0009a2b0: 2078 6e29 2069 7320 636f 6e76 6572 7465 xn) is converte │ │ │ +0009a2c0: 6420 746f 2028 7831 2c20 7832 2c20 2e2e d to (x1, x2, .. │ │ │ +0009a2d0: 2e2c 2078 6e2c 2031 292e 3c2f 6464 3e0a ., xn, 1).. │ │ │ +0009a2e0: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    .
    .
  • ..
    .

    convert │ │ │ +0009a370: 506f 696e 7473 546f 486f 6d6f 6765 6e65 PointsToHomogene │ │ │ +0009a380: 6f75 733c 2f68 333e 0a3c 6469 7620 636c ous

    .
    .
    p │ │ │ +0009a3e0: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static void&n │ │ │ +0009a420: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;c │ │ │ +0009a440: 6f6e 7665 7274 506f 696e 7473 546f 486f onvertPointsToHo │ │ │ +0009a450: 6d6f 6765 6e65 6f75 733c 2f73 7061 6e3e mogeneous │ │ │ +0009a460: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ +0009a480: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0009a490: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0009a4a0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0009a4b0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat src,. Mat dst)
    .
    Conv │ │ │ +0009a540: 6572 7473 2070 6f69 6e74 7320 6672 6f6d erts points from │ │ │ +0009a550: 2045 7563 6c69 6465 616e 2074 6f20 686f Euclidean to ho │ │ │ +0009a560: 6d6f 6765 6e65 6f75 7320 7370 6163 652e mogeneous space. │ │ │ +0009a570: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ +0009a590: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ +0009a5a0: 6464 3e3c 636f 6465 3e73 7263 3c2f 636f dd>src - Input vect │ │ │ +0009a5c0: 6f72 206f 6620 4e2d 6469 6d65 6e73 696f or of N-dimensio │ │ │ +0009a5d0: 6e61 6c20 706f 696e 7473 2e3c 2f64 643e nal points. │ │ │ +0009a5e0: 0a3c 6464 3e3c 636f 6465 3e64 7374 3c2f .
    dst - Output v │ │ │ +0009a600: 6563 746f 7220 6f66 204e 2b31 2d64 696d ector of N+1-dim │ │ │ +0009a610: 656e 7369 6f6e 616c 2070 6f69 6e74 732e ensional points. │ │ │ +0009a620: 0a20 2020 2049 6620 6974 2773 202d 312c . If it's -1, │ │ │ +0009a630: 2074 6865 6e20 6974 2773 2073 6574 2061 then it's set a │ │ │ +0009a640: 7574 6f6d 6174 6963 616c 6c79 2074 6f20 utomatically to │ │ │ +0009a650: 4356 5f33 3246 206f 7220 4356 5f36 3446 CV_32F or CV_64F │ │ │ +0009a660: 2c20 6465 7065 6e64 696e 6720 6f6e 2074 , depending on t │ │ │ +0009a670: 6865 2069 6e70 7574 2064 6570 7468 2e0a he input depth.. │ │ │ +0009a680: 0a54 6865 2066 756e 6374 696f 6e20 636f .The function co │ │ │ +0009a690: 6e76 6572 7473 2070 6f69 6e74 7320 6672 nverts points fr │ │ │ +0009a6a0: 6f6d 2045 7563 6c69 6465 616e 2074 6f20 om Euclidean to │ │ │ +0009a6b0: 686f 6d6f 6765 6e65 6f75 7320 7370 6163 homogeneous spac │ │ │ +0009a6c0: 6520 6279 2061 7070 656e 6469 6e67 2031 e by appending 1 │ │ │ +0009a6d0: 2773 2074 6f20 7468 6520 7475 706c 6520 's to the tuple │ │ │ +0009a6e0: 6f66 0a70 6f69 6e74 2063 6f6f 7264 696e of.point coordin │ │ │ +0009a6f0: 6174 6573 2e20 5468 6174 2069 732c 2065 ates. That is, e │ │ │ +0009a700: 6163 6820 706f 696e 7420 2878 312c 2078 ach point (x1, x │ │ │ +0009a710: 322c 202e 2e2e 2c20 786e 2920 6973 2063 2, ..., xn) is c │ │ │ +0009a720: 6f6e 7665 7274 6564 2074 6f20 2878 312c onverted to (x1, │ │ │ +0009a730: 2078 322c 202e 2e2e 2c20 786e 2c20 3129 x2, ..., xn, 1) │ │ │ +0009a740: 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 .
    .
    ..
    .< │ │ │ +0009a760: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    convertPoi │ │ │ +0009a7e0: 6e74 7346 726f 6d48 6f6d 6f67 656e 656f ntsFromHomogeneo │ │ │ +0009a7f0: 7573 3c2f 6833 3e0a 3c64 6976 2063 6c61 us

    .
    .
    pu │ │ │ +0009a850: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static void&nb │ │ │ +0009a890: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;co │ │ │ +0009a8b0: 6e76 6572 7450 6f69 6e74 7346 726f 6d48 nvertPointsFromH │ │ │ +0009a8c0: 6f6d 6f67 656e 656f 7573 3c2f 7370 616e omogeneous( │ │ │ +0009a8f0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +0009a930: 2f61 3e26 6e62 7370 3b73 7263 2c0a 203c /a> src,. < │ │ │ +0009a940: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0009a950: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0009a960: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0009a970: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dst,. in │ │ │ +0009a990: 7426 6e62 7370 3b64 7479 7065 293c 2f73 t dtype)
    .
    Co │ │ │ +0009a9c0: 6e76 6572 7473 2070 6f69 6e74 7320 6672 nverts points fr │ │ │ +0009a9d0: 6f6d 2068 6f6d 6f67 656e 656f 7573 2074 om homogeneous t │ │ │ +0009a9e0: 6f20 4575 636c 6964 6561 6e20 7370 6163 o Euclidean spac │ │ │ +0009a9f0: 652e 3c2f 6469 763e 0a3c 646c 2063 6c61 e.
    .
    .
    │ │ │ +0009aa10: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ +0009aa20: 0a3c 6464 3e3c 636f 6465 3e73 7263 3c2f .
    src - Input ve │ │ │ +0009aa40: 6374 6f72 206f 6620 4e2d 6469 6d65 6e73 ctor of N-dimens │ │ │ +0009aa50: 696f 6e61 6c20 706f 696e 7473 2e3c 2f64 ional points..
    dst │ │ │ +0009aa70: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +0009aa80: 2076 6563 746f 7220 6f66 204e 2d31 2d64 vector of N-1-d │ │ │ +0009aa90: 696d 656e 7369 6f6e 616c 2070 6f69 6e74 imensional point │ │ │ +0009aaa0: 732e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 s.
    .
    dtype - │ │ │ +0009aac0: 2054 6865 2064 6573 6972 6564 206f 7574 The desired out │ │ │ +0009aad0: 7075 7420 6172 7261 7920 6465 7074 6820 put array depth │ │ │ +0009aae0: 2865 6974 6865 7220 4356 5f33 3246 206f (either CV_32F o │ │ │ +0009aaf0: 7220 4356 5f36 3446 2061 7265 2063 7572 r CV_64F are cur │ │ │ +0009ab00: 7265 6e74 6c79 2073 7570 706f 7274 6564 rently supported │ │ │ +0009ab10: 292e 0a20 2020 2049 6620 6974 2773 202d ).. If it's - │ │ │ +0009ab20: 312c 2074 6865 6e20 6974 2773 2073 6574 1, then it's set │ │ │ +0009ab30: 2061 7574 6f6d 6174 6963 616c 6c79 2074 automatically t │ │ │ +0009ab40: 6f20 4356 5f33 3246 206f 7220 4356 5f36 o CV_32F or CV_6 │ │ │ +0009ab50: 3446 2c20 6465 7065 6e64 696e 6720 6f6e 4F, depending on │ │ │ +0009ab60: 2074 6865 2069 6e70 7574 2064 6570 7468 the input depth │ │ │ +0009ab70: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ +0009ab80: 636f 6e76 6572 7473 2070 6f69 6e74 7320 converts points │ │ │ +0009ab90: 686f 6d6f 6765 6e65 6f75 7320 746f 2045 homogeneous to E │ │ │ +0009aba0: 7563 6c69 6465 616e 2073 7061 6365 2075 uclidean space u │ │ │ +0009abb0: 7369 6e67 2070 6572 7370 6563 7469 7665 sing perspective │ │ │ +0009abc0: 2070 726f 6a65 6374 696f 6e2e 2054 6861 projection. Tha │ │ │ +0009abd0: 7420 6973 2c0a 6561 6368 2070 6f69 6e74 t is,.each point │ │ │ +0009abe0: 2028 7831 2c20 7832 2c20 2e2e 2e20 7828 (x1, x2, ... x( │ │ │ +0009abf0: 6e2d 3129 2c20 786e 2920 6973 2063 6f6e n-1), xn) is con │ │ │ +0009ac00: 7665 7274 6564 2074 6f20 2878 312f 786e verted to (x1/xn │ │ │ +0009ac10: 2c20 7832 2f78 6e2c 202e 2e2e 2c20 7828 , x2/xn, ..., x( │ │ │ +0009ac20: 6e2d 3129 2f78 6e29 2e20 5768 656e 2078 n-1)/xn). When x │ │ │ +0009ac30: 6e3d 302c 2074 6865 0a6f 7574 7075 7420 n=0, the.output │ │ │ +0009ac40: 706f 696e 7420 636f 6f72 6469 6e61 7465 point coordinate │ │ │ +0009ac50: 7320 7769 6c6c 2062 6520 2830 2c30 2c30 s will be (0,0,0 │ │ │ +0009ac60: 2c2e 2e2e 292e 3c2f 6464 3e0a 3c2f 646c ,...).
    .
    .
    ..
  • .
  • .< │ │ │ +0009ac90: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +0009aca0: 6574 6169 6c22 2069 643d 2263 6f6e 7665 etail" id="conve │ │ │ +0009acb0: 7274 506f 696e 7473 4672 6f6d 486f 6d6f rtPointsFromHomo │ │ │ +0009acc0: 6765 6e65 6f75 7328 6f72 672e 6f70 656e geneous(org.open │ │ │ +0009acd0: 6376 2e63 6f72 652e 4d61 742c 6f72 672e cv.core.Mat,org. │ │ │ +0009ace0: 6f70 656e 6376 2e63 6f72 652e 4d61 7429 opencv.core.Mat) │ │ │ +0009acf0: 223e 0a3c 6833 3e63 6f6e 7665 7274 506f ">.

    convertPo │ │ │ +0009ad00: 696e 7473 4672 6f6d 486f 6d6f 6765 6e65 intsFromHomogene │ │ │ +0009ad10: 6f75 733c 2f68 333e 0a3c 6469 7620 636c ous

    .
    ..
    Co │ │ │ +0009aed0: 6e76 6572 7473 2070 6f69 6e74 7320 6672 nverts points fr │ │ │ +0009aee0: 6f6d 2068 6f6d 6f67 656e 656f 7573 2074 om homogeneous t │ │ │ +0009aef0: 6f20 4575 636c 6964 6561 6e20 7370 6163 o Euclidean spac │ │ │ +0009af00: 652e 3c2f 6469 763e 0a3c 646c 2063 6c61 e.
    .
    .
    │ │ │ +0009af20: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ +0009af30: 0a3c 6464 3e3c 636f 6465 3e73 7263 3c2f .
    src - Input ve │ │ │ +0009af50: 6374 6f72 206f 6620 4e2d 6469 6d65 6e73 ctor of N-dimens │ │ │ +0009af60: 696f 6e61 6c20 706f 696e 7473 2e3c 2f64 ional points..
    dst │ │ │ +0009af80: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +0009af90: 2076 6563 746f 7220 6f66 204e 2d31 2d64 vector of N-1-d │ │ │ +0009afa0: 696d 656e 7369 6f6e 616c 2070 6f69 6e74 imensional point │ │ │ +0009afb0: 732e 0a20 2020 2049 6620 6974 2773 202d s.. If it's - │ │ │ +0009afc0: 312c 2074 6865 6e20 6974 2773 2073 6574 1, then it's set │ │ │ +0009afd0: 2061 7574 6f6d 6174 6963 616c 6c79 2074 automatically t │ │ │ +0009afe0: 6f20 4356 5f33 3246 206f 7220 4356 5f36 o CV_32F or CV_6 │ │ │ +0009aff0: 3446 2c20 6465 7065 6e64 696e 6720 6f6e 4F, depending on │ │ │ +0009b000: 2074 6865 2069 6e70 7574 2064 6570 7468 the input depth │ │ │ +0009b010: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ +0009b020: 636f 6e76 6572 7473 2070 6f69 6e74 7320 converts points │ │ │ +0009b030: 686f 6d6f 6765 6e65 6f75 7320 746f 2045 homogeneous to E │ │ │ +0009b040: 7563 6c69 6465 616e 2073 7061 6365 2075 uclidean space u │ │ │ +0009b050: 7369 6e67 2070 6572 7370 6563 7469 7665 sing perspective │ │ │ +0009b060: 2070 726f 6a65 6374 696f 6e2e 2054 6861 projection. Tha │ │ │ +0009b070: 7420 6973 2c0a 6561 6368 2070 6f69 6e74 t is,.each point │ │ │ +0009b080: 2028 7831 2c20 7832 2c20 2e2e 2e20 7828 (x1, x2, ... x( │ │ │ +0009b090: 6e2d 3129 2c20 786e 2920 6973 2063 6f6e n-1), xn) is con │ │ │ +0009b0a0: 7665 7274 6564 2074 6f20 2878 312f 786e verted to (x1/xn │ │ │ +0009b0b0: 2c20 7832 2f78 6e2c 202e 2e2e 2c20 7828 , x2/xn, ..., x( │ │ │ +0009b0c0: 6e2d 3129 2f78 6e29 2e20 5768 656e 2078 n-1)/xn). When x │ │ │ +0009b0d0: 6e3d 302c 2074 6865 0a6f 7574 7075 7420 n=0, the.output │ │ │ +0009b0e0: 706f 696e 7420 636f 6f72 6469 6e61 7465 point coordinate │ │ │ +0009b0f0: 7320 7769 6c6c 2062 6520 2830 2c30 2c30 s will be (0,0,0 │ │ │ +0009b100: 2c2e 2e2e 292e 3c2f 6464 3e0a 3c2f 646c ,...).
    .
    .
    ..
  • .
  • .< │ │ │ +0009b130: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +0009b140: 6574 6169 6c22 2069 643d 2266 696e 6446 etail" id="findF │ │ │ +0009b150: 756e 6461 6d65 6e74 616c 4d61 7428 6f72 undamentalMat(or │ │ │ +0009b160: 672e 6f70 656e 6376 2e63 6f72 652e 4d61 g.opencv.core.Ma │ │ │ +0009b170: 744f 6650 6f69 6e74 3266 2c6f 7267 2e6f tOfPoint2f,org.o │ │ │ +0009b180: 7065 6e63 762e 636f 7265 2e4d 6174 4f66 pencv.core.MatOf │ │ │ +0009b190: 506f 696e 7432 662c 696e 742c 646f 7562 Point2f,int,doub │ │ │ +0009b1a0: 6c65 2c64 6f75 626c 652c 696e 742c 6f72 le,double,int,or │ │ │ +0009b1b0: 672e 6f70 656e 6376 2e63 6f72 652e 4d61 g.opencv.core.Ma │ │ │ +0009b1c0: 7429 223e 0a3c 6833 3e66 696e 6446 756e t)">.

    findFun │ │ │ +0009b1d0: 6461 6d65 6e74 616c 4d61 743c 2f68 333e damentalMat

    │ │ │ +0009b1e0: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ +0009b200: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ +0009b220: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ +0009b230: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ +0009b240: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ +0009b250: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;Mat findFundam │ │ │ +0009b2e0: 656e 7461 6c4d 6174 3c2f 7370 616e 3e3c entalMat< │ │ │ +0009b2f0: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(MatOfPoint2f< │ │ │ +0009b360: 2f61 3e26 6e62 7370 3b70 6f69 6e74 7331 /a> points1 │ │ │ +0009b370: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. MatOfPoi │ │ │ +0009b3c0: 6e74 3266 3c2f 613e 266e 6273 703b 706f nt2f po │ │ │ +0009b3d0: 696e 7473 322c 0a20 696e 7426 6e62 7370 ints2,. int  │ │ │ +0009b3e0: 3b6d 6574 686f 642c 0a20 646f 7562 6c65 ;method,. double │ │ │ +0009b3f0: 266e 6273 703b 7261 6e73 6163 5265 7072  ransacRepr │ │ │ +0009b400: 6f6a 5468 7265 7368 6f6c 642c 0a20 646f ojThreshold,. do │ │ │ +0009b410: 7562 6c65 266e 6273 703b 636f 6e66 6964 uble confid │ │ │ +0009b420: 656e 6365 2c0a 2069 6e74 266e 6273 703b ence,. int  │ │ │ +0009b430: 6d61 7849 7465 7273 2c0a 203c 6120 6872 maxIters,. Mat&n │ │ │ +0009b480: 6273 703b 6d61 736b 293c 2f73 7061 6e3e bsp;mask) │ │ │ +0009b490: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Calcul │ │ │ +0009b4b0: 6174 6573 2061 2066 756e 6461 6d65 6e74 ates a fundament │ │ │ +0009b4c0: 616c 206d 6174 7269 7820 6672 6f6d 2074 al matrix from t │ │ │ +0009b4d0: 6865 2063 6f72 7265 7370 6f6e 6469 6e67 he corresponding │ │ │ +0009b4e0: 2070 6f69 6e74 7320 696e 2074 776f 2069 points in two i │ │ │ +0009b4f0: 6d61 6765 732e 3c2f 6469 763e 0a3c 646c mages.
    .
    . │ │ │ +0009b510: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ +0009b520: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e70 /dt>.
    p │ │ │ +0009b530: 6f69 6e74 7331 3c2f 636f 6465 3e20 2d20 oints1 - │ │ │ +0009b540: 4172 7261 7920 6f66 204e 2070 6f69 6e74 Array of N point │ │ │ +0009b550: 7320 6672 6f6d 2074 6865 2066 6972 7374 s from the first │ │ │ +0009b560: 2069 6d61 6765 2e20 5468 6520 706f 696e image. The poin │ │ │ +0009b570: 7420 636f 6f72 6469 6e61 7465 7320 7368 t coordinates sh │ │ │ +0009b580: 6f75 6c64 2062 650a 666c 6f61 7469 6e67 ould be.floating │ │ │ +0009b590: 2d70 6f69 6e74 2028 7369 6e67 6c65 206f -point (single o │ │ │ +0009b5a0: 7220 646f 7562 6c65 2070 7265 6369 7369 r double precisi │ │ │ +0009b5b0: 6f6e 292e 3c2f 6464 3e0a 3c64 643e 3c63 on).
    .
    points2 - Array of th │ │ │ +0009b5e0: 6520 7365 636f 6e64 2069 6d61 6765 2070 e second image p │ │ │ +0009b5f0: 6f69 6e74 7320 6f66 2074 6865 2073 616d oints of the sam │ │ │ +0009b600: 6520 7369 7a65 2061 6e64 2066 6f72 6d61 e size and forma │ │ │ +0009b610: 7420 6173 2070 6f69 6e74 7331 202e 3c2f t as points1 ..
    me │ │ │ +0009b630: 7468 6f64 3c2f 636f 6465 3e20 2d20 4d65 thod - Me │ │ │ +0009b640: 7468 6f64 2066 6f72 2063 6f6d 7075 7469 thod for computi │ │ │ +0009b650: 6e67 2061 2066 756e 6461 6d65 6e74 616c ng a fundamental │ │ │ +0009b660: 206d 6174 7269 782e 0a3c 756c 3e0a 2020 matrix..
      . │ │ │ +0009b670: 3c6c 693e 0a20 2020 5245 463a 2046 4d5f
    • . REF: FM_ │ │ │ +0009b680: 3750 4f49 4e54 2066 6f72 2061 2037 2d70 7POINT for a 7-p │ │ │ +0009b690: 6f69 6e74 2061 6c67 6f72 6974 686d 2e20 oint algorithm. │ │ │ +0009b6a0: 5c28 4e20 3d20 375c 290a 2020 3c2f 6c69 \(N = 7\).
    • .
    • . REF: │ │ │ +0009b6c0: 2046 4d5f 3850 4f49 4e54 2066 6f72 2061 FM_8POINT for a │ │ │ +0009b6d0: 6e20 382d 706f 696e 7420 616c 676f 7269 n 8-point algori │ │ │ +0009b6e0: 7468 6d2e 205c 284e 205c 6765 2038 5c29 thm. \(N \ge 8\) │ │ │ +0009b6f0: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ +0009b700: 2020 2052 4546 3a20 464d 5f52 414e 5341 REF: FM_RANSA │ │ │ +0009b710: 4320 666f 7220 7468 6520 5241 4e53 4143 C for the RANSAC │ │ │ +0009b720: 2061 6c67 6f72 6974 686d 2e20 5c28 4e20 algorithm. \(N │ │ │ +0009b730: 5c67 6520 385c 290a 2020 3c2f 6c69 3e0a \ge 8\).
    • . │ │ │ +0009b740: 2020 3c6c 693e 0a20 2020 5245 463a 2046
    • . REF: F │ │ │ +0009b750: 4d5f 4c4d 4544 5320 666f 7220 7468 6520 M_LMEDS for the │ │ │ +0009b760: 4c4d 6564 5320 616c 676f 7269 7468 6d2e LMedS algorithm. │ │ │ +0009b770: 205c 284e 205c 6765 2038 5c29 0a20 203c \(N \ge 8\). < │ │ │ +0009b780: 2f6c 693e 0a3c 2f75 6c3e 3c2f 6464 3e0a /li>.
    . │ │ │ +0009b790: 3c64 643e 3c63 6f64 653e 7261 6e73 6163
    ransac │ │ │ +0009b7a0: 5265 7072 6f6a 5468 7265 7368 6f6c 643c ReprojThreshold< │ │ │ +0009b7b0: 2f63 6f64 653e 202d 2050 6172 616d 6574 /code> - Paramet │ │ │ +0009b7c0: 6572 2075 7365 6420 6f6e 6c79 2066 6f72 er used only for │ │ │ +0009b7d0: 2052 414e 5341 432e 2049 7420 6973 2074 RANSAC. It is t │ │ │ +0009b7e0: 6865 206d 6178 696d 756d 2064 6973 7461 he maximum dista │ │ │ +0009b7f0: 6e63 6520 6672 6f6d 2061 2070 6f69 6e74 nce from a point │ │ │ +0009b800: 2074 6f20 616e 2065 7069 706f 6c61 720a to an epipolar. │ │ │ +0009b810: 6c69 6e65 2069 6e20 7069 7865 6c73 2c20 line in pixels, │ │ │ +0009b820: 6265 796f 6e64 2077 6869 6368 2074 6865 beyond which the │ │ │ +0009b830: 2070 6f69 6e74 2069 7320 636f 6e73 6964 point is consid │ │ │ +0009b840: 6572 6564 2061 6e20 6f75 746c 6965 7220 ered an outlier │ │ │ +0009b850: 616e 6420 6973 206e 6f74 2075 7365 6420 and is not used │ │ │ +0009b860: 666f 7220 636f 6d70 7574 696e 6720 7468 for computing th │ │ │ +0009b870: 650a 6669 6e61 6c20 6675 6e64 616d 656e e.final fundamen │ │ │ +0009b880: 7461 6c20 6d61 7472 6978 2e20 4974 2063 tal matrix. It c │ │ │ +0009b890: 616e 2062 6520 7365 7420 746f 2073 6f6d an be set to som │ │ │ +0009b8a0: 6574 6869 6e67 206c 696b 6520 312d 332c ething like 1-3, │ │ │ +0009b8b0: 2064 6570 656e 6469 6e67 206f 6e20 7468 depending on th │ │ │ +0009b8c0: 6520 6163 6375 7261 6379 206f 6620 7468 e accuracy of th │ │ │ +0009b8d0: 650a 706f 696e 7420 6c6f 6361 6c69 7a61 e.point localiza │ │ │ +0009b8e0: 7469 6f6e 2c20 696d 6167 6520 7265 736f tion, image reso │ │ │ +0009b8f0: 6c75 7469 6f6e 2c20 616e 6420 7468 6520 lution, and the │ │ │ +0009b900: 696d 6167 6520 6e6f 6973 652e 3c2f 6464 image noise.
    .
    conf │ │ │ +0009b920: 6964 656e 6365 3c2f 636f 6465 3e20 2d20 idence - │ │ │ +0009b930: 5061 7261 6d65 7465 7220 7573 6564 2066 Parameter used f │ │ │ +0009b940: 6f72 2074 6865 2052 414e 5341 4320 616e or the RANSAC an │ │ │ +0009b950: 6420 4c4d 6564 5320 6d65 7468 6f64 7320 d LMedS methods │ │ │ +0009b960: 6f6e 6c79 2e20 4974 2073 7065 6369 6669 only. It specifi │ │ │ +0009b970: 6573 2061 2064 6573 6972 6162 6c65 206c es a desirable l │ │ │ +0009b980: 6576 656c 0a6f 6620 636f 6e66 6964 656e evel.of confiden │ │ │ +0009b990: 6365 2028 7072 6f62 6162 696c 6974 7929 ce (probability) │ │ │ +0009b9a0: 2074 6861 7420 7468 6520 6573 7469 6d61 that the estima │ │ │ +0009b9b0: 7465 6420 6d61 7472 6978 2069 7320 636f ted matrix is co │ │ │ +0009b9c0: 7272 6563 742e 3c2f 6464 3e0a 3c64 643e rrect.
    .
    │ │ │ +0009b9d0: 3c63 6f64 653e 6d61 7849 7465 7273 3c2f maxIters - The maxi │ │ │ +0009b9f0: 6d75 6d20 6e75 6d62 6572 206f 6620 726f mum number of ro │ │ │ +0009ba00: 6275 7374 206d 6574 686f 6420 6974 6572 bust method iter │ │ │ +0009ba10: 6174 696f 6e73 2e0a 0a54 6865 2065 7069 ations...The epi │ │ │ +0009ba20: 706f 6c61 7220 6765 6f6d 6574 7279 2069 polar geometry i │ │ │ +0009ba30: 7320 6465 7363 7269 6265 6420 6279 2074 s described by t │ │ │ +0009ba40: 6865 2066 6f6c 6c6f 7769 6e67 2065 7175 he following equ │ │ │ +0009ba50: 6174 696f 6e3a 0a0a 5c28 5b70 5f32 3b20 ation:..\([p_2; │ │ │ +0009ba60: 315d 5e54 2046 205b 705f 313b 2031 5d20 1]^T F [p_1; 1] │ │ │ +0009ba70: 3d20 305c 290a 0a77 6865 7265 205c 2846 = 0\)..where \(F │ │ │ +0009ba80: 5c29 2069 7320 6120 6675 6e64 616d 656e \) is a fundamen │ │ │ +0009ba90: 7461 6c20 6d61 7472 6978 2c20 5c28 705f tal matrix, \(p_ │ │ │ +0009baa0: 315c 2920 616e 6420 5c28 705f 325c 2920 1\) and \(p_2\) │ │ │ +0009bab0: 6172 6520 636f 7272 6573 706f 6e64 696e are correspondin │ │ │ +0009bac0: 6720 706f 696e 7473 2069 6e20 7468 6520 g points in the │ │ │ +0009bad0: 6669 7273 7420 616e 6420 7468 650a 7365 first and the.se │ │ │ +0009bae0: 636f 6e64 2069 6d61 6765 732c 2072 6573 cond images, res │ │ │ +0009baf0: 7065 6374 6976 656c 792e 0a0a 5468 6520 pectively...The │ │ │ +0009bb00: 6675 6e63 7469 6f6e 2063 616c 6375 6c61 function calcula │ │ │ +0009bb10: 7465 7320 7468 6520 6675 6e64 616d 656e tes the fundamen │ │ │ +0009bb20: 7461 6c20 6d61 7472 6978 2075 7369 6e67 tal matrix using │ │ │ +0009bb30: 206f 6e65 206f 6620 666f 7572 206d 6574 one of four met │ │ │ +0009bb40: 686f 6473 206c 6973 7465 6420 6162 6f76 hods listed abov │ │ │ +0009bb50: 6520 616e 6420 7265 7475 726e 730a 7468 e and returns.th │ │ │ +0009bb60: 6520 666f 756e 6420 6675 6e64 616d 656e e found fundamen │ │ │ +0009bb70: 7461 6c20 6d61 7472 6978 2e20 4e6f 726d tal matrix. Norm │ │ │ +0009bb80: 616c 6c79 206a 7573 7420 6f6e 6520 6d61 ally just one ma │ │ │ +0009bb90: 7472 6978 2069 7320 666f 756e 642e 2042 trix is found. B │ │ │ +0009bba0: 7574 2069 6e20 6361 7365 206f 6620 7468 ut in case of th │ │ │ +0009bbb0: 6520 372d 706f 696e 740a 616c 676f 7269 e 7-point.algori │ │ │ +0009bbc0: 7468 6d2c 2074 6865 2066 756e 6374 696f thm, the functio │ │ │ +0009bbd0: 6e20 6d61 7920 7265 7475 726e 2075 7020 n may return up │ │ │ +0009bbe0: 746f 2033 2073 6f6c 7574 696f 6e73 2028 to 3 solutions ( │ │ │ +0009bbf0: 205c 2839 205c 7469 6d65 7320 335c 2920 \(9 \times 3\) │ │ │ +0009bc00: 6d61 7472 6978 2074 6861 7420 7374 6f72 matrix that stor │ │ │ +0009bc10: 6573 2061 6c6c 2033 0a6d 6174 7269 6365 es all 3.matrice │ │ │ +0009bc20: 7320 7365 7175 656e 7469 616c 6c79 292e s sequentially). │ │ │ +0009bc30: 0a0a 5468 6520 6361 6c63 756c 6174 6564 ..The calculated │ │ │ +0009bc40: 2066 756e 6461 6d65 6e74 616c 206d 6174 fundamental mat │ │ │ +0009bc50: 7269 7820 6d61 7920 6265 2070 6173 7365 rix may be passe │ │ │ +0009bc60: 6420 6675 7274 6865 7220 746f 2023 636f d further to #co │ │ │ +0009bc70: 6d70 7574 6543 6f72 7265 7370 6f6e 6445 mputeCorrespondE │ │ │ +0009bc80: 7069 6c69 6e65 7320 7468 6174 2066 696e pilines that fin │ │ │ +0009bc90: 6473 2074 6865 0a65 7069 706f 6c61 7220 ds the.epipolar │ │ │ +0009bca0: 6c69 6e65 7320 636f 7272 6573 706f 6e64 lines correspond │ │ │ +0009bcb0: 696e 6720 746f 2074 6865 2073 7065 6369 ing to the speci │ │ │ +0009bcc0: 6669 6564 2070 6f69 6e74 732e 2049 7420 fied points. It │ │ │ +0009bcd0: 6361 6e20 616c 736f 2062 6520 7061 7373 can also be pass │ │ │ +0009bce0: 6564 2074 6f0a 2373 7465 7265 6f52 6563 ed to.#stereoRec │ │ │ +0009bcf0: 7469 6679 556e 6361 6c69 6272 6174 6564 tifyUncalibrated │ │ │ +0009bd00: 2074 6f20 636f 6d70 7574 6520 7468 6520 to compute the │ │ │ +0009bd10: 7265 6374 6966 6963 6174 696f 6e20 7472 rectification tr │ │ │ +0009bd20: 616e 7366 6f72 6d61 7469 6f6e 2e20 3a0a ansformation. :. │ │ │ +0009bd30: 3c63 6f64 653e 0a20 2020 202f 2f20 4578 . // Ex │ │ │ +0009bd40: 616d 706c 652e 2045 7374 696d 6174 696f ample. Estimatio │ │ │ +0009bd50: 6e20 6f66 2066 756e 6461 6d65 6e74 616c n of fundamental │ │ │ +0009bd60: 206d 6174 7269 7820 7573 696e 6720 7468 matrix using th │ │ │ +0009bd70: 6520 5241 4e53 4143 2061 6c67 6f72 6974 e RANSAC algorit │ │ │ +0009bd80: 686d 0a20 2020 2069 6e74 2070 6f69 6e74 hm. int point │ │ │ +0009bd90: 5f63 6f75 6e74 203d 2031 3030 3b0a 2020 _count = 100;. │ │ │ +0009bda0: 2020 7665 6374 6f72 266c 743b 506f 696e vector<Poin │ │ │ +0009bdb0: 7432 6626 6774 3b20 706f 696e 7473 3128 t2f> points1( │ │ │ +0009bdc0: 706f 696e 745f 636f 756e 7429 3b0a 2020 point_count);. │ │ │ +0009bdd0: 2020 7665 6374 6f72 266c 743b 506f 696e vector<Poin │ │ │ +0009bde0: 7432 6626 6774 3b20 706f 696e 7473 3228 t2f> points2( │ │ │ +0009bdf0: 706f 696e 745f 636f 756e 7429 3b0a 0a20 point_count);.. │ │ │ +0009be00: 2020 202f 2f20 696e 6974 6961 6c69 7a65 // initialize │ │ │ +0009be10: 2074 6865 2070 6f69 6e74 7320 6865 7265 the points here │ │ │ +0009be20: 202e 2e2e 0a20 2020 2066 6f72 2820 696e .... for( in │ │ │ +0009be30: 7420 6920 3d20 303b 2069 2026 6c74 3b20 t i = 0; i < │ │ │ +0009be40: 706f 696e 745f 636f 756e 743b 2069 2b2b point_count; i++ │ │ │ +0009be50: 2029 0a20 2020 207b 0a20 2020 2020 2020 ). {. │ │ │ +0009be60: 2070 6f69 6e74 7331 5b69 5d20 3d20 2e2e points1[i] = .. │ │ │ +0009be70: 2e3b 0a20 2020 2020 2020 2070 6f69 6e74 .;. point │ │ │ +0009be80: 7332 5b69 5d20 3d20 2e2e 2e3b 0a20 2020 s2[i] = ...;. │ │ │ +0009be90: 207d 0a0a 2020 2020 4d61 7420 6675 6e64 }.. Mat fund │ │ │ +0009bea0: 616d 656e 7461 6c5f 6d61 7472 6978 203d amental_matrix = │ │ │ +0009beb0: 0a20 2020 2020 6669 6e64 4675 6e64 616d . findFundam │ │ │ +0009bec0: 656e 7461 6c4d 6174 2870 6f69 6e74 7331 entalMat(points1 │ │ │ +0009bed0: 2c20 706f 696e 7473 322c 2046 4d5f 5241 , points2, FM_RA │ │ │ +0009bee0: 4e53 4143 2c20 332c 2030 2e39 3929 3b0a NSAC, 3, 0.99);. │ │ │ +0009bef0: 3c2f 636f 6465 3e3c 2f64 643e 0a3c 6464
    .
    mask - optional ou │ │ │ +0009bf20: 7470 7574 206d 6173 6b3c 2f64 643e 0a3c tput mask
    .< │ │ │ +0009bf30: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ +0009bf40: 0a3c 6464 3e61 7574 6f6d 6174 6963 616c .
    automatical │ │ │ +0009bf50: 6c79 2067 656e 6572 6174 6564 3c2f 6464 ly generated
    .
    .
    .< │ │ │ +0009bf70: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ +0009bf80: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    findF │ │ │ +0009c010: 756e 6461 6d65 6e74 616c 4d61 743c 2f68 undamentalMat.
    .
    public │ │ │ +0009c080: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +0009c090: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;Mat │ │ │ +0009c0f0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  findFund │ │ │ +0009c120: 616d 656e 7461 6c4d 6174 3c2f 7370 616e amentalMat( │ │ │ +0009c150: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfPoint2 │ │ │ +0009c1a0: 663c 2f61 3e26 6e62 7370 3b70 6f69 6e74 f point │ │ │ +0009c1b0: 7331 2c0a 203c 6120 6872 6566 3d22 2e2e s1,. MatOfP │ │ │ +0009c200: 6f69 6e74 3266 3c2f 613e 266e 6273 703b oint2f  │ │ │ +0009c210: 706f 696e 7473 322c 0a20 696e 7426 6e62 points2,. int&nb │ │ │ +0009c220: 7370 3b6d 6574 686f 642c 0a20 646f 7562 sp;method,. doub │ │ │ +0009c230: 6c65 266e 6273 703b 7261 6e73 6163 5265 le ransacRe │ │ │ +0009c240: 7072 6f6a 5468 7265 7368 6f6c 642c 0a20 projThreshold,. │ │ │ +0009c250: 646f 7562 6c65 266e 6273 703b 636f 6e66 double conf │ │ │ +0009c260: 6964 656e 6365 2c0a 2069 6e74 266e 6273 idence,. int&nbs │ │ │ +0009c270: 703b 6d61 7849 7465 7273 293c 2f73 7061 p;maxIters)
    .
    Calc │ │ │ +0009c2a0: 756c 6174 6573 2061 2066 756e 6461 6d65 ulates a fundame │ │ │ +0009c2b0: 6e74 616c 206d 6174 7269 7820 6672 6f6d ntal matrix from │ │ │ +0009c2c0: 2074 6865 2063 6f72 7265 7370 6f6e 6469 the correspondi │ │ │ +0009c2d0: 6e67 2070 6f69 6e74 7320 696e 2074 776f ng points in two │ │ │ +0009c2e0: 2069 6d61 6765 732e 3c2f 6469 763e 0a3c images.
    .< │ │ │ +0009c2f0: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ +0009c300: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ +0009c310: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    points1 │ │ │ +0009c330: 2d20 4172 7261 7920 6f66 204e 2070 6f69 - Array of N poi │ │ │ +0009c340: 6e74 7320 6672 6f6d 2074 6865 2066 6972 nts from the fir │ │ │ +0009c350: 7374 2069 6d61 6765 2e20 5468 6520 706f st image. The po │ │ │ +0009c360: 696e 7420 636f 6f72 6469 6e61 7465 7320 int coordinates │ │ │ +0009c370: 7368 6f75 6c64 2062 650a 666c 6f61 7469 should be.floati │ │ │ +0009c380: 6e67 2d70 6f69 6e74 2028 7369 6e67 6c65 ng-point (single │ │ │ +0009c390: 206f 7220 646f 7562 6c65 2070 7265 6369 or double preci │ │ │ +0009c3a0: 7369 6f6e 292e 3c2f 6464 3e0a 3c64 643e sion).
    .
    │ │ │ +0009c3b0: 3c63 6f64 653e 706f 696e 7473 323c 2f63 points2 - Array of │ │ │ +0009c3d0: 7468 6520 7365 636f 6e64 2069 6d61 6765 the second image │ │ │ +0009c3e0: 2070 6f69 6e74 7320 6f66 2074 6865 2073 points of the s │ │ │ +0009c3f0: 616d 6520 7369 7a65 2061 6e64 2066 6f72 ame size and for │ │ │ +0009c400: 6d61 7420 6173 2070 6f69 6e74 7331 202e mat as points1 . │ │ │ +0009c410: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +0009c420: 6d65 7468 6f64 3c2f 636f 6465 3e20 2d20 method - │ │ │ +0009c430: 4d65 7468 6f64 2066 6f72 2063 6f6d 7075 Method for compu │ │ │ +0009c440: 7469 6e67 2061 2066 756e 6461 6d65 6e74 ting a fundament │ │ │ +0009c450: 616c 206d 6174 7269 782e 0a3c 756c 3e0a al matrix..
      . │ │ │ +0009c460: 2020 3c6c 693e 0a20 2020 5245 463a 2046
    • . REF: F │ │ │ +0009c470: 4d5f 3750 4f49 4e54 2066 6f72 2061 2037 M_7POINT for a 7 │ │ │ +0009c480: 2d70 6f69 6e74 2061 6c67 6f72 6974 686d -point algorithm │ │ │ +0009c490: 2e20 5c28 4e20 3d20 375c 290a 2020 3c2f . \(N = 7\). .
    • . RE │ │ │ +0009c4b0: 463a 2046 4d5f 3850 4f49 4e54 2066 6f72 F: FM_8POINT for │ │ │ +0009c4c0: 2061 6e20 382d 706f 696e 7420 616c 676f an 8-point algo │ │ │ +0009c4d0: 7269 7468 6d2e 205c 284e 205c 6765 2038 rithm. \(N \ge 8 │ │ │ +0009c4e0: 5c29 0a20 203c 2f6c 693e 0a20 203c 6c69 \).
    • .
    • . REF: FM_RAN │ │ │ +0009c500: 5341 4320 666f 7220 7468 6520 5241 4e53 SAC for the RANS │ │ │ +0009c510: 4143 2061 6c67 6f72 6974 686d 2e20 5c28 AC algorithm. \( │ │ │ +0009c520: 4e20 5c67 6520 385c 290a 2020 3c2f 6c69 N \ge 8\).
    • .
    • . REF: │ │ │ +0009c540: 2046 4d5f 4c4d 4544 5320 666f 7220 7468 FM_LMEDS for th │ │ │ +0009c550: 6520 4c4d 6564 5320 616c 676f 7269 7468 e LMedS algorith │ │ │ +0009c560: 6d2e 205c 284e 205c 6765 2038 5c29 0a20 m. \(N \ge 8\). │ │ │ +0009c570: 203c 2f6c 693e 0a3c 2f75 6c3e 3c2f 6464
    • .
    .
    rans │ │ │ +0009c590: 6163 5265 7072 6f6a 5468 7265 7368 6f6c acReprojThreshol │ │ │ +0009c5a0: 643c 2f63 6f64 653e 202d 2050 6172 616d d - Param │ │ │ +0009c5b0: 6574 6572 2075 7365 6420 6f6e 6c79 2066 eter used only f │ │ │ +0009c5c0: 6f72 2052 414e 5341 432e 2049 7420 6973 or RANSAC. It is │ │ │ +0009c5d0: 2074 6865 206d 6178 696d 756d 2064 6973 the maximum dis │ │ │ +0009c5e0: 7461 6e63 6520 6672 6f6d 2061 2070 6f69 tance from a poi │ │ │ +0009c5f0: 6e74 2074 6f20 616e 2065 7069 706f 6c61 nt to an epipola │ │ │ +0009c600: 720a 6c69 6e65 2069 6e20 7069 7865 6c73 r.line in pixels │ │ │ +0009c610: 2c20 6265 796f 6e64 2077 6869 6368 2074 , beyond which t │ │ │ +0009c620: 6865 2070 6f69 6e74 2069 7320 636f 6e73 he point is cons │ │ │ +0009c630: 6964 6572 6564 2061 6e20 6f75 746c 6965 idered an outlie │ │ │ +0009c640: 7220 616e 6420 6973 206e 6f74 2075 7365 r and is not use │ │ │ +0009c650: 6420 666f 7220 636f 6d70 7574 696e 6720 d for computing │ │ │ +0009c660: 7468 650a 6669 6e61 6c20 6675 6e64 616d the.final fundam │ │ │ +0009c670: 656e 7461 6c20 6d61 7472 6978 2e20 4974 ental matrix. It │ │ │ +0009c680: 2063 616e 2062 6520 7365 7420 746f 2073 can be set to s │ │ │ +0009c690: 6f6d 6574 6869 6e67 206c 696b 6520 312d omething like 1- │ │ │ +0009c6a0: 332c 2064 6570 656e 6469 6e67 206f 6e20 3, depending on │ │ │ +0009c6b0: 7468 6520 6163 6375 7261 6379 206f 6620 the accuracy of │ │ │ +0009c6c0: 7468 650a 706f 696e 7420 6c6f 6361 6c69 the.point locali │ │ │ +0009c6d0: 7a61 7469 6f6e 2c20 696d 6167 6520 7265 zation, image re │ │ │ +0009c6e0: 736f 6c75 7469 6f6e 2c20 616e 6420 7468 solution, and th │ │ │ +0009c6f0: 6520 696d 6167 6520 6e6f 6973 652e 3c2f e image noise..
    co │ │ │ +0009c710: 6e66 6964 656e 6365 3c2f 636f 6465 3e20 nfidence │ │ │ +0009c720: 2d20 5061 7261 6d65 7465 7220 7573 6564 - Parameter used │ │ │ +0009c730: 2066 6f72 2074 6865 2052 414e 5341 4320 for the RANSAC │ │ │ +0009c740: 616e 6420 4c4d 6564 5320 6d65 7468 6f64 and LMedS method │ │ │ +0009c750: 7320 6f6e 6c79 2e20 4974 2073 7065 6369 s only. It speci │ │ │ +0009c760: 6669 6573 2061 2064 6573 6972 6162 6c65 fies a desirable │ │ │ +0009c770: 206c 6576 656c 0a6f 6620 636f 6e66 6964 level.of confid │ │ │ +0009c780: 656e 6365 2028 7072 6f62 6162 696c 6974 ence (probabilit │ │ │ +0009c790: 7929 2074 6861 7420 7468 6520 6573 7469 y) that the esti │ │ │ +0009c7a0: 6d61 7465 6420 6d61 7472 6978 2069 7320 mated matrix is │ │ │ +0009c7b0: 636f 7272 6563 742e 3c2f 6464 3e0a 3c64 correct.
    .maxIters │ │ │ +0009c7d0: 3c2f 636f 6465 3e20 2d20 5468 6520 6d61 - The ma │ │ │ +0009c7e0: 7869 6d75 6d20 6e75 6d62 6572 206f 6620 ximum number of │ │ │ +0009c7f0: 726f 6275 7374 206d 6574 686f 6420 6974 robust method it │ │ │ +0009c800: 6572 6174 696f 6e73 2e0a 0a54 6865 2065 erations...The e │ │ │ +0009c810: 7069 706f 6c61 7220 6765 6f6d 6574 7279 pipolar geometry │ │ │ +0009c820: 2069 7320 6465 7363 7269 6265 6420 6279 is described by │ │ │ +0009c830: 2074 6865 2066 6f6c 6c6f 7769 6e67 2065 the following e │ │ │ +0009c840: 7175 6174 696f 6e3a 0a0a 5c28 5b70 5f32 quation:..\([p_2 │ │ │ +0009c850: 3b20 315d 5e54 2046 205b 705f 313b 2031 ; 1]^T F [p_1; 1 │ │ │ +0009c860: 5d20 3d20 305c 290a 0a77 6865 7265 205c ] = 0\)..where \ │ │ │ +0009c870: 2846 5c29 2069 7320 6120 6675 6e64 616d (F\) is a fundam │ │ │ +0009c880: 656e 7461 6c20 6d61 7472 6978 2c20 5c28 ental matrix, \( │ │ │ +0009c890: 705f 315c 2920 616e 6420 5c28 705f 325c p_1\) and \(p_2\ │ │ │ +0009c8a0: 2920 6172 6520 636f 7272 6573 706f 6e64 ) are correspond │ │ │ +0009c8b0: 696e 6720 706f 696e 7473 2069 6e20 7468 ing points in th │ │ │ +0009c8c0: 6520 6669 7273 7420 616e 6420 7468 650a e first and the. │ │ │ +0009c8d0: 7365 636f 6e64 2069 6d61 6765 732c 2072 second images, r │ │ │ +0009c8e0: 6573 7065 6374 6976 656c 792e 0a0a 5468 espectively...Th │ │ │ +0009c8f0: 6520 6675 6e63 7469 6f6e 2063 616c 6375 e function calcu │ │ │ +0009c900: 6c61 7465 7320 7468 6520 6675 6e64 616d lates the fundam │ │ │ +0009c910: 656e 7461 6c20 6d61 7472 6978 2075 7369 ental matrix usi │ │ │ +0009c920: 6e67 206f 6e65 206f 6620 666f 7572 206d ng one of four m │ │ │ +0009c930: 6574 686f 6473 206c 6973 7465 6420 6162 ethods listed ab │ │ │ +0009c940: 6f76 6520 616e 6420 7265 7475 726e 730a ove and returns. │ │ │ +0009c950: 7468 6520 666f 756e 6420 6675 6e64 616d the found fundam │ │ │ +0009c960: 656e 7461 6c20 6d61 7472 6978 2e20 4e6f ental matrix. No │ │ │ +0009c970: 726d 616c 6c79 206a 7573 7420 6f6e 6520 rmally just one │ │ │ +0009c980: 6d61 7472 6978 2069 7320 666f 756e 642e matrix is found. │ │ │ +0009c990: 2042 7574 2069 6e20 6361 7365 206f 6620 But in case of │ │ │ +0009c9a0: 7468 6520 372d 706f 696e 740a 616c 676f the 7-point.algo │ │ │ +0009c9b0: 7269 7468 6d2c 2074 6865 2066 756e 6374 rithm, the funct │ │ │ +0009c9c0: 696f 6e20 6d61 7920 7265 7475 726e 2075 ion may return u │ │ │ +0009c9d0: 7020 746f 2033 2073 6f6c 7574 696f 6e73 p to 3 solutions │ │ │ +0009c9e0: 2028 205c 2839 205c 7469 6d65 7320 335c ( \(9 \times 3\ │ │ │ +0009c9f0: 2920 6d61 7472 6978 2074 6861 7420 7374 ) matrix that st │ │ │ +0009ca00: 6f72 6573 2061 6c6c 2033 0a6d 6174 7269 ores all 3.matri │ │ │ +0009ca10: 6365 7320 7365 7175 656e 7469 616c 6c79 ces sequentially │ │ │ +0009ca20: 292e 0a0a 5468 6520 6361 6c63 756c 6174 )...The calculat │ │ │ +0009ca30: 6564 2066 756e 6461 6d65 6e74 616c 206d ed fundamental m │ │ │ +0009ca40: 6174 7269 7820 6d61 7920 6265 2070 6173 atrix may be pas │ │ │ +0009ca50: 7365 6420 6675 7274 6865 7220 746f 2023 sed further to # │ │ │ +0009ca60: 636f 6d70 7574 6543 6f72 7265 7370 6f6e computeCorrespon │ │ │ +0009ca70: 6445 7069 6c69 6e65 7320 7468 6174 2066 dEpilines that f │ │ │ +0009ca80: 696e 6473 2074 6865 0a65 7069 706f 6c61 inds the.epipola │ │ │ +0009ca90: 7220 6c69 6e65 7320 636f 7272 6573 706f r lines correspo │ │ │ +0009caa0: 6e64 696e 6720 746f 2074 6865 2073 7065 nding to the spe │ │ │ +0009cab0: 6369 6669 6564 2070 6f69 6e74 732e 2049 cified points. I │ │ │ +0009cac0: 7420 6361 6e20 616c 736f 2062 6520 7061 t can also be pa │ │ │ +0009cad0: 7373 6564 2074 6f0a 2373 7465 7265 6f52 ssed to.#stereoR │ │ │ +0009cae0: 6563 7469 6679 556e 6361 6c69 6272 6174 ectifyUncalibrat │ │ │ +0009caf0: 6564 2074 6f20 636f 6d70 7574 6520 7468 ed to compute th │ │ │ +0009cb00: 6520 7265 6374 6966 6963 6174 696f 6e20 e rectification │ │ │ +0009cb10: 7472 616e 7366 6f72 6d61 7469 6f6e 2e20 transformation. │ │ │ +0009cb20: 3a0a 3c63 6f64 653e 0a20 2020 202f 2f20 :.. // │ │ │ +0009cb30: 4578 616d 706c 652e 2045 7374 696d 6174 Example. Estimat │ │ │ +0009cb40: 696f 6e20 6f66 2066 756e 6461 6d65 6e74 ion of fundament │ │ │ +0009cb50: 616c 206d 6174 7269 7820 7573 696e 6720 al matrix using │ │ │ +0009cb60: 7468 6520 5241 4e53 4143 2061 6c67 6f72 the RANSAC algor │ │ │ +0009cb70: 6974 686d 0a20 2020 2069 6e74 2070 6f69 ithm. int poi │ │ │ +0009cb80: 6e74 5f63 6f75 6e74 203d 2031 3030 3b0a nt_count = 100;. │ │ │ +0009cb90: 2020 2020 7665 6374 6f72 266c 743b 506f vector<Po │ │ │ +0009cba0: 696e 7432 6626 6774 3b20 706f 696e 7473 int2f> points │ │ │ +0009cbb0: 3128 706f 696e 745f 636f 756e 7429 3b0a 1(point_count);. │ │ │ +0009cbc0: 2020 2020 7665 6374 6f72 266c 743b 506f vector<Po │ │ │ +0009cbd0: 696e 7432 6626 6774 3b20 706f 696e 7473 int2f> points │ │ │ +0009cbe0: 3228 706f 696e 745f 636f 756e 7429 3b0a 2(point_count);. │ │ │ +0009cbf0: 0a20 2020 202f 2f20 696e 6974 6961 6c69 . // initiali │ │ │ +0009cc00: 7a65 2074 6865 2070 6f69 6e74 7320 6865 ze the points he │ │ │ +0009cc10: 7265 202e 2e2e 0a20 2020 2066 6f72 2820 re .... for( │ │ │ +0009cc20: 696e 7420 6920 3d20 303b 2069 2026 6c74 int i = 0; i < │ │ │ +0009cc30: 3b20 706f 696e 745f 636f 756e 743b 2069 ; point_count; i │ │ │ +0009cc40: 2b2b 2029 0a20 2020 207b 0a20 2020 2020 ++ ). {. │ │ │ +0009cc50: 2020 2070 6f69 6e74 7331 5b69 5d20 3d20 points1[i] = │ │ │ +0009cc60: 2e2e 2e3b 0a20 2020 2020 2020 2070 6f69 ...;. poi │ │ │ +0009cc70: 6e74 7332 5b69 5d20 3d20 2e2e 2e3b 0a20 nts2[i] = ...;. │ │ │ +0009cc80: 2020 207d 0a0a 2020 2020 4d61 7420 6675 }.. Mat fu │ │ │ +0009cc90: 6e64 616d 656e 7461 6c5f 6d61 7472 6978 ndamental_matrix │ │ │ +0009cca0: 203d 0a20 2020 2020 6669 6e64 4675 6e64 =. findFund │ │ │ +0009ccb0: 616d 656e 7461 6c4d 6174 2870 6f69 6e74 amentalMat(point │ │ │ +0009ccc0: 7331 2c20 706f 696e 7473 322c 2046 4d5f s1, points2, FM_ │ │ │ +0009ccd0: 5241 4e53 4143 2c20 332c 2030 2e39 3929 RANSAC, 3, 0.99) │ │ │ +0009cce0: 3b0a 3c2f 636f 6465 3e3c 2f64 643e 0a3c ;..< │ │ │ +0009ccf0: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ +0009cd00: 0a3c 6464 3e61 7574 6f6d 6174 6963 616c .
    automatical │ │ │ +0009cd10: 6c79 2067 656e 6572 6174 6564 3c2f 6464 ly generated
    .

  • ..< │ │ │ +0009cd30: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.. │ │ │ +0009cd40: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    findF │ │ │ +0009cde0: 756e 6461 6d65 6e74 616c 4d61 743c 2f68 undamentalMat.
    .
    public │ │ │ +0009ce50: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +0009ce60: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;Mat │ │ │ +0009cec0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  findFund │ │ │ +0009cef0: 616d 656e 7461 6c4d 6174 3c2f 7370 616e amentalMat( │ │ │ +0009cf20: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfPoint2 │ │ │ +0009cf70: 663c 2f61 3e26 6e62 7370 3b70 6f69 6e74 f point │ │ │ +0009cf80: 7331 2c0a 203c 6120 6872 6566 3d22 2e2e s1,. MatOfP │ │ │ +0009cfd0: 6f69 6e74 3266 3c2f 613e 266e 6273 703b oint2f  │ │ │ +0009cfe0: 706f 696e 7473 322c 0a20 696e 7426 6e62 points2,. int&nb │ │ │ +0009cff0: 7370 3b6d 6574 686f 642c 0a20 646f 7562 sp;method,. doub │ │ │ +0009d000: 6c65 266e 6273 703b 7261 6e73 6163 5265 le ransacRe │ │ │ +0009d010: 7072 6f6a 5468 7265 7368 6f6c 642c 0a20 projThreshold,. │ │ │ +0009d020: 646f 7562 6c65 266e 6273 703b 636f 6e66 double conf │ │ │ +0009d030: 6964 656e 6365 2c0a 203c 6120 6872 6566 idence,. Mat&nbs │ │ │ +0009d080: 703b 6d61 736b 293c 2f73 7061 6e3e 3c2f p;mask).
    ..

  • .
  • .
    . │ │ │ +0009d130: 3c68 333e 6669 6e64 4675 6e64 616d 656e

    findFundamen │ │ │ +0009d140: 7461 6c4d 6174 3c2f 6833 3e0a 3c64 6976 talMat

    .
    .
    public static< │ │ │ +0009d1b0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> Mat │ │ │ +0009d220: 266e 6273 703b 3c73 7061 6e20 636c 6173  findFundamental │ │ │ +0009d250: 4d61 743c 2f73 7061 6e3e 3c77 6272 3e3c Mat< │ │ │ +0009d260: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +0009d270: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Ma │ │ │ +0009d2c0: 744f 6650 6f69 6e74 3266 3c2f 613e 266e tOfPoint2f&n │ │ │ +0009d2d0: 6273 703b 706f 696e 7473 312c 0a20 3c61 bsp;points1,. MatOfPoint2f< │ │ │ +0009d330: 2f61 3e26 6e62 7370 3b70 6f69 6e74 7332 /a> points2 │ │ │ +0009d340: 2c0a 2069 6e74 266e 6273 703b 6d65 7468 ,. int meth │ │ │ +0009d350: 6f64 2c0a 2064 6f75 626c 6526 6e62 7370 od,. double  │ │ │ +0009d360: 3b72 616e 7361 6352 6570 726f 6a54 6872 ;ransacReprojThr │ │ │ +0009d370: 6573 686f 6c64 2c0a 2064 6f75 626c 6526 eshold,. double& │ │ │ +0009d380: 6e62 7370 3b63 6f6e 6669 6465 6e63 6529 nbsp;confidence) │ │ │ +0009d390: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c2f
    ..
    . │ │ │ +0009d3b0: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..

    findFundam │ │ │ +0009d440: 656e 7461 6c4d 6174 3c2f 6833 3e0a 3c64 entalMat

    ..public stati │ │ │ +0009d4b0: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c 
    Mat findFundament │ │ │ +0009d550: 616c 4d61 743c 2f73 7061 6e3e 3c77 6272 alMat( │ │ │ +0009d5c0: 4d61 744f 6650 6f69 6e74 3266 3c2f 613e MatOfPoint2f │ │ │ +0009d5d0: 266e 6273 703b 706f 696e 7473 312c 0a20  points1,. │ │ │ +0009d5e0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 MatOfPoint2 │ │ │ +0009d630: 663c 2f61 3e26 6e62 7370 3b70 6f69 6e74 f point │ │ │ +0009d640: 7332 2c0a 2069 6e74 266e 6273 703b 6d65 s2,. int me │ │ │ +0009d650: 7468 6f64 2c0a 2064 6f75 626c 6526 6e62 thod,. double&nb │ │ │ +0009d660: 7370 3b72 616e 7361 6352 6570 726f 6a54 sp;ransacReprojT │ │ │ +0009d670: 6872 6573 686f 6c64 293c 2f73 7061 6e3e hreshold) │ │ │ +0009d680: 3c2f 6469 763e 0a3c 2f64 6976 3e0a 3c2f ...
  • .< │ │ │ +0009d6a0: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .

    findFund │ │ │ +0009d720: 616d 656e 7461 6c4d 6174 3c2f 6833 3e0a amentalMat

    . │ │ │ +0009d730: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ +0009d750: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ +0009d790: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ +0009d7a0: 3c73 7061 6e20 636c 6173 733d 2272 6574 Mat findFundame │ │ │ +0009d830: 6e74 616c 4d61 743c 2f73 7061 6e3e 3c77 ntalMat(MatOfPoint2f points1, │ │ │ +0009d8c0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . MatOfPoin │ │ │ +0009d910: 7432 663c 2f61 3e26 6e62 7370 3b70 6f69 t2f poi │ │ │ +0009d920: 6e74 7332 2c0a 2069 6e74 266e 6273 703b nts2,. int  │ │ │ +0009d930: 6d65 7468 6f64 293c 2f73 7061 6e3e 3c2f method).
    ...
  • .
    .findFundamenta │ │ │ +0009d9e0: 6c4d 6174 3c2f 6833 3e0a 3c64 6976 2063 lMat.
    .
    │ │ │ +0009da40: 7075 626c 6963 2073 7461 7469 633c 2f73 public static  │ │ │ +0009dab0: 4d61 743c 2f61 3e3c 2f73 7061 6e3e 266e Mat&n │ │ │ +0009dac0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;f │ │ │ +0009dae0: 696e 6446 756e 6461 6d65 6e74 616c 4d61 indFundamentalMa │ │ │ +0009daf0: 743c 2f73 7061 6e3e 3c77 6272 3e3c 7370 t(MatO │ │ │ +0009db60: 6650 6f69 6e74 3266 3c2f 613e 266e 6273 fPoint2f&nbs │ │ │ +0009db70: 703b 706f 696e 7473 312c 0a20 3c61 2068 p;points1,. MatOfPoint2f points2)< │ │ │ +0009dbe0: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 2f64 /span>
    ..
    .< │ │ │ +0009dc00: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    fin │ │ │ +0009dcb0: 6446 756e 6461 6d65 6e74 616c 4d61 743c dFundamentalMat< │ │ │ +0009dcc0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +0009dd20: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +0009dd30: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;< │ │ │ +0009dd50: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0009dd60: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0009dd70: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0009dd80: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat < │ │ │ +0009dda0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +0009ddb0: 656e 742d 6e61 6d65 223e 6669 6e64 4675 ent-name">findFu │ │ │ +0009ddc0: 6e64 616d 656e 7461 6c4d 6174 3c2f 7370 ndamentalMat(MatOfPoin │ │ │ +0009de40: 7432 663c 2f61 3e26 6e62 7370 3b70 6f69 t2f poi │ │ │ +0009de50: 6e74 7331 2c0a 203c 6120 6872 6566 3d22 nts1,. MatO │ │ │ +0009dea0: 6650 6f69 6e74 3266 3c2f 613e 266e 6273 fPoint2f&nbs │ │ │ +0009deb0: 703b 706f 696e 7473 322c 0a20 3c61 2068 p;points2,. Mat& │ │ │ +0009df00: 6e62 7370 3b6d 6173 6b2c 0a20 3c61 2068 nbsp;mask,. UsacP │ │ │ +0009df50: 6172 616d 733c 2f61 3e26 6e62 7370 3b70 arams p │ │ │ +0009df60: 6172 616d 7329 3c2f 7370 616e 3e3c 2f64 arams).
    ..

  • .
  • │ │ │ +0009df90: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    findE │ │ │ +0009e030: 7373 656e 7469 616c 4d61 743c 2f68 333e ssentialMat

    │ │ │ +0009e040: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ +0009e060: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ +0009e080: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ +0009e090: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ +0009e0a0: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ +0009e0b0: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;Mat findEssent │ │ │ +0009e140: 6961 6c4d 6174 3c2f 7370 616e 3e3c 7762 ialMat(Mat& │ │ │ +0009e1b0: 6e62 7370 3b70 6f69 6e74 7331 2c0a 203c nbsp;points1,. < │ │ │ +0009e1c0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0009e1d0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0009e1e0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0009e1f0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat points2, │ │ │ +0009e210: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +0009e250: 743c 2f61 3e26 6e62 7370 3b63 616d 6572 t camer │ │ │ +0009e260: 614d 6174 7269 782c 0a20 696e 7426 6e62 aMatrix,. int&nb │ │ │ +0009e270: 7370 3b6d 6574 686f 642c 0a20 646f 7562 sp;method,. doub │ │ │ +0009e280: 6c65 266e 6273 703b 7072 6f62 2c0a 2064 le prob,. d │ │ │ +0009e290: 6f75 626c 6526 6e62 7370 3b74 6872 6573 ouble thres │ │ │ +0009e2a0: 686f 6c64 2c0a 2069 6e74 266e 6273 703b hold,. int  │ │ │ +0009e2b0: 6d61 7849 7465 7273 2c0a 203c 6120 6872 maxIters,. Mat&n │ │ │ +0009e300: 6273 703b 6d61 736b 293c 2f73 7061 6e3e bsp;mask) │ │ │ +0009e310: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Calcul │ │ │ +0009e330: 6174 6573 2061 6e20 6573 7365 6e74 6961 ates an essentia │ │ │ +0009e340: 6c20 6d61 7472 6978 2066 726f 6d20 7468 l matrix from th │ │ │ +0009e350: 6520 636f 7272 6573 706f 6e64 696e 6720 e corresponding │ │ │ +0009e360: 706f 696e 7473 2069 6e20 7477 6f20 696d points in two im │ │ │ +0009e370: 6167 6573 2e3c 2f64 6976 3e0a 3c64 6c20 ages.
    .
    .< │ │ │ +0009e390: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    po │ │ │ +0009e3b0: 696e 7473 313c 2f63 6f64 653e 202d 2041 ints1 - A │ │ │ +0009e3c0: 7272 6179 206f 6620 4e20 284e 2026 6774 rray of N (N > │ │ │ +0009e3d0: 3b3d 2035 2920 3244 2070 6f69 6e74 7320 ;= 5) 2D points │ │ │ +0009e3e0: 6672 6f6d 2074 6865 2066 6972 7374 2069 from the first i │ │ │ +0009e3f0: 6d61 6765 2e20 5468 6520 706f 696e 7420 mage. The point │ │ │ +0009e400: 636f 6f72 6469 6e61 7465 7320 7368 6f75 coordinates shou │ │ │ +0009e410: 6c64 0a62 6520 666c 6f61 7469 6e67 2d70 ld.be floating-p │ │ │ +0009e420: 6f69 6e74 2028 7369 6e67 6c65 206f 7220 oint (single or │ │ │ +0009e430: 646f 7562 6c65 2070 7265 6369 7369 6f6e double precision │ │ │ +0009e440: 292e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 ).
    .
    points2 │ │ │ +0009e460: 202d 2041 7272 6179 206f 6620 7468 6520 - Array of the │ │ │ +0009e470: 7365 636f 6e64 2069 6d61 6765 2070 6f69 second image poi │ │ │ +0009e480: 6e74 7320 6f66 2074 6865 2073 616d 6520 nts of the same │ │ │ +0009e490: 7369 7a65 2061 6e64 2066 6f72 6d61 7420 size and format │ │ │ +0009e4a0: 6173 2070 6f69 6e74 7331 2e3c 2f64 643e as points1.
    │ │ │ +0009e4b0: 0a3c 6464 3e3c 636f 6465 3e63 616d 6572 .
    camer │ │ │ +0009e4c0: 614d 6174 7269 783c 2f63 6f64 653e 202d aMatrix - │ │ │ +0009e4d0: 2043 616d 6572 6120 696e 7472 696e 7369 Camera intrinsi │ │ │ +0009e4e0: 6320 6d61 7472 6978 205c 285c 6361 6d65 c matrix \(\came │ │ │ +0009e4f0: 7261 6d61 7472 6978 7b41 7d5c 2920 2e0a ramatrix{A}\) .. │ │ │ +0009e500: 4e6f 7465 2074 6861 7420 7468 6973 2066 Note that this f │ │ │ +0009e510: 756e 6374 696f 6e20 6173 7375 6d65 7320 unction assumes │ │ │ +0009e520: 7468 6174 2070 6f69 6e74 7331 2061 6e64 that points1 and │ │ │ +0009e530: 2070 6f69 6e74 7332 2061 7265 2066 6561 points2 are fea │ │ │ +0009e540: 7475 7265 2070 6f69 6e74 7320 6672 6f6d ture points from │ │ │ +0009e550: 2063 616d 6572 6173 2077 6974 6820 7468 cameras with th │ │ │ +0009e560: 650a 7361 6d65 2063 616d 6572 6120 696e e.same camera in │ │ │ +0009e570: 7472 696e 7369 6320 6d61 7472 6978 2e20 trinsic matrix. │ │ │ +0009e580: 4966 2074 6869 7320 6173 7375 6d70 7469 If this assumpti │ │ │ +0009e590: 6f6e 2064 6f65 7320 6e6f 7420 686f 6c64 on does not hold │ │ │ +0009e5a0: 2066 6f72 2079 6f75 7220 7573 6520 6361 for your use ca │ │ │ +0009e5b0: 7365 2c20 7573 6520 616e 6f74 6865 720a se, use another. │ │ │ +0009e5c0: 6675 6e63 7469 6f6e 206f 7665 726c 6f61 function overloa │ │ │ +0009e5d0: 6420 6f72 2023 756e 6469 7374 6f72 7450 d or #undistortP │ │ │ +0009e5e0: 6f69 6e74 7320 7769 7468 203c 636f 6465 oints with P = cv::NoArray │ │ │ +0009e600: 2829 3c2f 636f 6465 3e20 666f 7220 626f () for bo │ │ │ +0009e610: 7468 2063 616d 6572 6173 2074 6f20 7472 th cameras to tr │ │ │ +0009e620: 616e 7366 6f72 6d20 696d 6167 650a 706f ansform image.po │ │ │ +0009e630: 696e 7473 2074 6f20 6e6f 726d 616c 697a ints to normaliz │ │ │ +0009e640: 6564 2069 6d61 6765 2063 6f6f 7264 696e ed image coordin │ │ │ +0009e650: 6174 6573 2c20 7768 6963 6820 6172 6520 ates, which are │ │ │ +0009e660: 7661 6c69 6420 666f 7220 7468 6520 6964 valid for the id │ │ │ +0009e670: 656e 7469 7479 2063 616d 6572 6120 696e entity camera in │ │ │ +0009e680: 7472 696e 7369 6320 6d61 7472 6978 2e0a trinsic matrix.. │ │ │ +0009e690: 5768 656e 2070 6173 7369 6e67 2074 6865 When passing the │ │ │ +0009e6a0: 7365 2063 6f6f 7264 696e 6174 6573 2c20 se coordinates, │ │ │ +0009e6b0: 7061 7373 2074 6865 2069 6465 6e74 6974 pass the identit │ │ │ +0009e6c0: 7920 6d61 7472 6978 2066 6f72 2074 6869 y matrix for thi │ │ │ +0009e6d0: 7320 7061 7261 6d65 7465 722e 3c2f 6464 s parameter.
    .
    meth │ │ │ +0009e6f0: 6f64 3c2f 636f 6465 3e20 2d20 4d65 7468 od - Meth │ │ │ +0009e700: 6f64 2066 6f72 2063 6f6d 7075 7469 6e67 od for computing │ │ │ +0009e710: 2061 6e20 6573 7365 6e74 6961 6c20 6d61 an essential ma │ │ │ +0009e720: 7472 6978 2e0a 3c75 6c3e 0a20 203c 6c69 trix..
      .
    • . REF: RANSAC │ │ │ +0009e740: 2066 6f72 2074 6865 2052 414e 5341 4320 for the RANSAC │ │ │ +0009e750: 616c 676f 7269 7468 6d2e 0a20 203c 2f6c algorithm.. .
    • . REF │ │ │ +0009e770: 3a20 4c4d 4544 5320 666f 7220 7468 6520 : LMEDS for the │ │ │ +0009e780: 4c4d 6564 5320 616c 676f 7269 7468 6d2e LMedS algorithm. │ │ │ +0009e790: 0a20 203c 2f6c 693e 0a3c 2f75 6c3e 3c2f .
    • .
    .
    pr │ │ │ +0009e7b0: 6f62 3c2f 636f 6465 3e20 2d20 5061 7261 ob - Para │ │ │ +0009e7c0: 6d65 7465 7220 7573 6564 2066 6f72 2074 meter used for t │ │ │ +0009e7d0: 6865 2052 414e 5341 4320 6f72 204c 4d65 he RANSAC or LMe │ │ │ +0009e7e0: 6453 206d 6574 686f 6473 206f 6e6c 792e dS methods only. │ │ │ +0009e7f0: 2049 7420 7370 6563 6966 6965 7320 6120 It specifies a │ │ │ +0009e800: 6465 7369 7261 626c 6520 6c65 7665 6c20 desirable level │ │ │ +0009e810: 6f66 0a63 6f6e 6669 6465 6e63 6520 2870 of.confidence (p │ │ │ +0009e820: 726f 6261 6269 6c69 7479 2920 7468 6174 robability) that │ │ │ +0009e830: 2074 6865 2065 7374 696d 6174 6564 206d the estimated m │ │ │ +0009e840: 6174 7269 7820 6973 2063 6f72 7265 6374 atrix is correct │ │ │ +0009e850: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    threshold - Parameter us │ │ │ +0009e880: 6564 2066 6f72 2052 414e 5341 432e 2049 ed for RANSAC. I │ │ │ +0009e890: 7420 6973 2074 6865 206d 6178 696d 756d t is the maximum │ │ │ +0009e8a0: 2064 6973 7461 6e63 6520 6672 6f6d 2061 distance from a │ │ │ +0009e8b0: 2070 6f69 6e74 2074 6f20 616e 2065 7069 point to an epi │ │ │ +0009e8c0: 706f 6c61 720a 6c69 6e65 2069 6e20 7069 polar.line in pi │ │ │ +0009e8d0: 7865 6c73 2c20 6265 796f 6e64 2077 6869 xels, beyond whi │ │ │ +0009e8e0: 6368 2074 6865 2070 6f69 6e74 2069 7320 ch the point is │ │ │ +0009e8f0: 636f 6e73 6964 6572 6564 2061 6e20 6f75 considered an ou │ │ │ +0009e900: 746c 6965 7220 616e 6420 6973 206e 6f74 tlier and is not │ │ │ +0009e910: 2075 7365 6420 666f 7220 636f 6d70 7574 used for comput │ │ │ +0009e920: 696e 6720 7468 650a 6669 6e61 6c20 6675 ing the.final fu │ │ │ +0009e930: 6e64 616d 656e 7461 6c20 6d61 7472 6978 ndamental matrix │ │ │ +0009e940: 2e20 4974 2063 616e 2062 6520 7365 7420 . It can be set │ │ │ +0009e950: 746f 2073 6f6d 6574 6869 6e67 206c 696b to something lik │ │ │ +0009e960: 6520 312d 332c 2064 6570 656e 6469 6e67 e 1-3, depending │ │ │ +0009e970: 206f 6e20 7468 6520 6163 6375 7261 6379 on the accuracy │ │ │ +0009e980: 206f 6620 7468 650a 706f 696e 7420 6c6f of the.point lo │ │ │ +0009e990: 6361 6c69 7a61 7469 6f6e 2c20 696d 6167 calization, imag │ │ │ +0009e9a0: 6520 7265 736f 6c75 7469 6f6e 2c20 616e e resolution, an │ │ │ +0009e9b0: 6420 7468 6520 696d 6167 6520 6e6f 6973 d the image nois │ │ │ +0009e9c0: 652e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 e.
    .
    maxIters - The maximum │ │ │ +0009e9f0: 6e75 6d62 6572 206f 6620 726f 6275 7374 number of robust │ │ │ +0009ea00: 206d 6574 686f 6420 6974 6572 6174 696f method iteratio │ │ │ +0009ea10: 6e73 2e0a 0a54 6869 7320 6675 6e63 7469 ns...This functi │ │ │ +0009ea20: 6f6e 2065 7374 696d 6174 6573 2065 7373 on estimates ess │ │ │ +0009ea30: 656e 7469 616c 206d 6174 7269 7820 6261 ential matrix ba │ │ │ +0009ea40: 7365 6420 6f6e 2074 6865 2066 6976 652d sed on the five- │ │ │ +0009ea50: 706f 696e 7420 616c 676f 7269 7468 6d20 point algorithm │ │ │ +0009ea60: 736f 6c76 6572 2069 6e20 4349 5445 3a20 solver in CITE: │ │ │ +0009ea70: 4e69 7374 6572 3033 202e 0a43 4954 453a Nister03 ..CITE: │ │ │ +0009ea80: 2053 7465 7765 6e69 7573 4346 5320 6973 SteweniusCFS is │ │ │ +0009ea90: 2061 6c73 6f20 6120 7265 6c61 7465 642e also a related. │ │ │ +0009eaa0: 2054 6865 2065 7069 706f 6c61 7220 6765 The epipolar ge │ │ │ +0009eab0: 6f6d 6574 7279 2069 7320 6465 7363 7269 ometry is descri │ │ │ +0009eac0: 6265 6420 6279 2074 6865 2066 6f6c 6c6f bed by the follo │ │ │ +0009ead0: 7769 6e67 2065 7175 6174 696f 6e3a 0a0a wing equation:.. │ │ │ +0009eae0: 5c28 5b70 5f32 3b20 315d 5e54 204b 5e7b \([p_2; 1]^T K^{ │ │ │ +0009eaf0: 2d54 7d20 4520 4b5e 7b2d 317d 205b 705f -T} E K^{-1} [p_ │ │ │ +0009eb00: 313b 2031 5d20 3d20 305c 290a 0a77 6865 1; 1] = 0\)..whe │ │ │ +0009eb10: 7265 205c 2845 5c29 2069 7320 616e 2065 re \(E\) is an e │ │ │ +0009eb20: 7373 656e 7469 616c 206d 6174 7269 782c ssential matrix, │ │ │ +0009eb30: 205c 2870 5f31 5c29 2061 6e64 205c 2870 \(p_1\) and \(p │ │ │ +0009eb40: 5f32 5c29 2061 7265 2063 6f72 7265 7370 _2\) are corresp │ │ │ +0009eb50: 6f6e 6469 6e67 2070 6f69 6e74 7320 696e onding points in │ │ │ +0009eb60: 2074 6865 2066 6972 7374 2061 6e64 2074 the first and t │ │ │ +0009eb70: 6865 0a73 6563 6f6e 6420 696d 6167 6573 he.second images │ │ │ +0009eb80: 2c20 7265 7370 6563 7469 7665 6c79 2e20 , respectively. │ │ │ +0009eb90: 5468 6520 7265 7375 6c74 206f 6620 7468 The result of th │ │ │ +0009eba0: 6973 2066 756e 6374 696f 6e20 6d61 7920 is function may │ │ │ +0009ebb0: 6265 2070 6173 7365 6420 6675 7274 6865 be passed furthe │ │ │ +0009ebc0: 7220 746f 0a23 6465 636f 6d70 6f73 6545 r to.#decomposeE │ │ │ +0009ebd0: 7373 656e 7469 616c 4d61 7420 6f72 2023 ssentialMat or # │ │ │ +0009ebe0: 7265 636f 7665 7250 6f73 6520 746f 2072 recoverPose to r │ │ │ +0009ebf0: 6563 6f76 6572 2074 6865 2072 656c 6174 ecover the relat │ │ │ +0009ec00: 6976 6520 706f 7365 2062 6574 7765 656e ive pose between │ │ │ +0009ec10: 2063 616d 6572 6173 2e3c 2f64 643e 0a3c cameras.
    .< │ │ │ +0009ec20: 6464 3e3c 636f 6465 3e6d 6173 6b3c 2f63 dd>mask - Output ar │ │ │ +0009ec40: 7261 7920 6f66 204e 2065 6c65 6d65 6e74 ray of N element │ │ │ +0009ec50: 732c 2065 7665 7279 2065 6c65 6d65 6e74 s, every element │ │ │ +0009ec60: 206f 6620 7768 6963 6820 6973 2073 6574 of which is set │ │ │ +0009ec70: 2074 6f20 3020 666f 7220 6f75 746c 6965 to 0 for outlie │ │ │ +0009ec80: 7273 2061 6e64 2074 6f20 310a 666f 7220 rs and to 1.for │ │ │ +0009ec90: 7468 6520 6f74 6865 7220 706f 696e 7473 the other points │ │ │ +0009eca0: 2e20 5468 6520 6172 7261 7920 6973 2063 . The array is c │ │ │ +0009ecb0: 6f6d 7075 7465 6420 6f6e 6c79 2069 6e20 omputed only in │ │ │ +0009ecc0: 7468 6520 5241 4e53 4143 2061 6e64 204c the RANSAC and L │ │ │ +0009ecd0: 4d65 6453 206d 6574 686f 6473 2e3c 2f64 MedS methods..
    Returns:< │ │ │ +0009ecf0: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
    automat │ │ │ +0009ed00: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ +0009ed10: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ..
    ..
  • ..

    f │ │ │ +0009edc0: 696e 6445 7373 656e 7469 616c 4d61 743c indEssentialMat< │ │ │ +0009edd0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +0009ee30: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +0009ee40: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;< │ │ │ +0009ee60: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +0009ee70: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +0009ee80: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +0009ee90: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat < │ │ │ +0009eeb0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +0009eec0: 656e 742d 6e61 6d65 223e 6669 6e64 4573 ent-name">findEs │ │ │ +0009eed0: 7365 6e74 6961 6c4d 6174 3c2f 7370 616e sentialMat( │ │ │ +0009ef00: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +0009ef40: 2f61 3e26 6e62 7370 3b70 6f69 6e74 7331 /a> points1 │ │ │ +0009ef50: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +0009ef90: 6174 3c2f 613e 266e 6273 703b 706f 696e at poin │ │ │ +0009efa0: 7473 322c 0a20 3c61 2068 7265 663d 222e ts2,. Mat c │ │ │ +0009eff0: 616d 6572 614d 6174 7269 782c 0a20 696e ameraMatrix,. in │ │ │ +0009f000: 7426 6e62 7370 3b6d 6574 686f 642c 0a20 t method,. │ │ │ +0009f010: 646f 7562 6c65 266e 6273 703b 7072 6f62 double prob │ │ │ +0009f020: 2c0a 2064 6f75 626c 6526 6e62 7370 3b74 ,. double t │ │ │ +0009f030: 6872 6573 686f 6c64 2c0a 2069 6e74 266e hreshold,. int&n │ │ │ +0009f040: 6273 703b 6d61 7849 7465 7273 293c 2f73 bsp;maxIters)
    .
    Ca │ │ │ +0009f070: 6c63 756c 6174 6573 2061 6e20 6573 7365 lculates an esse │ │ │ +0009f080: 6e74 6961 6c20 6d61 7472 6978 2066 726f ntial matrix fro │ │ │ +0009f090: 6d20 7468 6520 636f 7272 6573 706f 6e64 m the correspond │ │ │ +0009f0a0: 696e 6720 706f 696e 7473 2069 6e20 7477 ing points in tw │ │ │ +0009f0b0: 6f20 696d 6167 6573 2e3c 2f64 6976 3e0a o images.
    . │ │ │ +0009f0c0: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ +0009f0e0: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    points1 │ │ │ +0009f100: 202d 2041 7272 6179 206f 6620 4e20 284e - Array of N (N │ │ │ +0009f110: 2026 6774 3b3d 2035 2920 3244 2070 6f69 >= 5) 2D poi │ │ │ +0009f120: 6e74 7320 6672 6f6d 2074 6865 2066 6972 nts from the fir │ │ │ +0009f130: 7374 2069 6d61 6765 2e20 5468 6520 706f st image. The po │ │ │ +0009f140: 696e 7420 636f 6f72 6469 6e61 7465 7320 int coordinates │ │ │ +0009f150: 7368 6f75 6c64 0a62 6520 666c 6f61 7469 should.be floati │ │ │ +0009f160: 6e67 2d70 6f69 6e74 2028 7369 6e67 6c65 ng-point (single │ │ │ +0009f170: 206f 7220 646f 7562 6c65 2070 7265 6369 or double preci │ │ │ +0009f180: 7369 6f6e 292e 3c2f 6464 3e0a 3c64 643e sion).
    .
    │ │ │ +0009f190: 3c63 6f64 653e 706f 696e 7473 323c 2f63 points2 - Array of │ │ │ +0009f1b0: 7468 6520 7365 636f 6e64 2069 6d61 6765 the second image │ │ │ +0009f1c0: 2070 6f69 6e74 7320 6f66 2074 6865 2073 points of the s │ │ │ +0009f1d0: 616d 6520 7369 7a65 2061 6e64 2066 6f72 ame size and for │ │ │ +0009f1e0: 6d61 7420 6173 2070 6f69 6e74 7331 2e3c mat as points1.< │ │ │ +0009f1f0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ +0009f200: 616d 6572 614d 6174 7269 783c 2f63 6f64 ameraMatrix - Camera intr │ │ │ +0009f220: 696e 7369 6320 6d61 7472 6978 205c 285c insic matrix \(\ │ │ │ +0009f230: 6361 6d65 7261 6d61 7472 6978 7b41 7d5c cameramatrix{A}\ │ │ │ +0009f240: 2920 2e0a 4e6f 7465 2074 6861 7420 7468 ) ..Note that th │ │ │ +0009f250: 6973 2066 756e 6374 696f 6e20 6173 7375 is function assu │ │ │ +0009f260: 6d65 7320 7468 6174 2070 6f69 6e74 7331 mes that points1 │ │ │ +0009f270: 2061 6e64 2070 6f69 6e74 7332 2061 7265 and points2 are │ │ │ +0009f280: 2066 6561 7475 7265 2070 6f69 6e74 7320 feature points │ │ │ +0009f290: 6672 6f6d 2063 616d 6572 6173 2077 6974 from cameras wit │ │ │ +0009f2a0: 6820 7468 650a 7361 6d65 2063 616d 6572 h the.same camer │ │ │ +0009f2b0: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ +0009f2c0: 6978 2e20 4966 2074 6869 7320 6173 7375 ix. If this assu │ │ │ +0009f2d0: 6d70 7469 6f6e 2064 6f65 7320 6e6f 7420 mption does not │ │ │ +0009f2e0: 686f 6c64 2066 6f72 2079 6f75 7220 7573 hold for your us │ │ │ +0009f2f0: 6520 6361 7365 2c20 7573 6520 616e 6f74 e case, use anot │ │ │ +0009f300: 6865 720a 6675 6e63 7469 6f6e 206f 7665 her.function ove │ │ │ +0009f310: 726c 6f61 6420 6f72 2023 756e 6469 7374 rload or #undist │ │ │ +0009f320: 6f72 7450 6f69 6e74 7320 7769 7468 203c ortPoints with < │ │ │ +0009f330: 636f 6465 3e50 203d 2063 763a 3a4e 6f41 code>P = cv::NoA │ │ │ +0009f340: 7272 6179 2829 3c2f 636f 6465 3e20 666f rray() fo │ │ │ +0009f350: 7220 626f 7468 2063 616d 6572 6173 2074 r both cameras t │ │ │ +0009f360: 6f20 7472 616e 7366 6f72 6d20 696d 6167 o transform imag │ │ │ +0009f370: 650a 706f 696e 7473 2074 6f20 6e6f 726d e.points to norm │ │ │ +0009f380: 616c 697a 6564 2069 6d61 6765 2063 6f6f alized image coo │ │ │ +0009f390: 7264 696e 6174 6573 2c20 7768 6963 6820 rdinates, which │ │ │ +0009f3a0: 6172 6520 7661 6c69 6420 666f 7220 7468 are valid for th │ │ │ +0009f3b0: 6520 6964 656e 7469 7479 2063 616d 6572 e identity camer │ │ │ +0009f3c0: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ +0009f3d0: 6978 2e0a 5768 656e 2070 6173 7369 6e67 ix..When passing │ │ │ +0009f3e0: 2074 6865 7365 2063 6f6f 7264 696e 6174 these coordinat │ │ │ +0009f3f0: 6573 2c20 7061 7373 2074 6865 2069 6465 es, pass the ide │ │ │ +0009f400: 6e74 6974 7920 6d61 7472 6978 2066 6f72 ntity matrix for │ │ │ +0009f410: 2074 6869 7320 7061 7261 6d65 7465 722e this parameter. │ │ │ +0009f420: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +0009f430: 6d65 7468 6f64 3c2f 636f 6465 3e20 2d20 method - │ │ │ +0009f440: 4d65 7468 6f64 2066 6f72 2063 6f6d 7075 Method for compu │ │ │ +0009f450: 7469 6e67 2061 6e20 6573 7365 6e74 6961 ting an essentia │ │ │ +0009f460: 6c20 6d61 7472 6978 2e0a 3c75 6c3e 0a20 l matrix..
      . │ │ │ +0009f470: 203c 6c69 3e0a 2020 2052 4546 3a20 5241
    • . REF: RA │ │ │ +0009f480: 4e53 4143 2066 6f72 2074 6865 2052 414e NSAC for the RAN │ │ │ +0009f490: 5341 4320 616c 676f 7269 7468 6d2e 0a20 SAC algorithm.. │ │ │ +0009f4a0: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020
    • .
    • . │ │ │ +0009f4b0: 2052 4546 3a20 4c4d 4544 5320 666f 7220 REF: LMEDS for │ │ │ +0009f4c0: 7468 6520 4c4d 6564 5320 616c 676f 7269 the LMedS algori │ │ │ +0009f4d0: 7468 6d2e 0a20 203c 2f6c 693e 0a3c 2f75 thm..
    • .
    .
    prob - │ │ │ +0009f500: 5061 7261 6d65 7465 7220 7573 6564 2066 Parameter used f │ │ │ +0009f510: 6f72 2074 6865 2052 414e 5341 4320 6f72 or the RANSAC or │ │ │ +0009f520: 204c 4d65 6453 206d 6574 686f 6473 206f LMedS methods o │ │ │ +0009f530: 6e6c 792e 2049 7420 7370 6563 6966 6965 nly. It specifie │ │ │ +0009f540: 7320 6120 6465 7369 7261 626c 6520 6c65 s a desirable le │ │ │ +0009f550: 7665 6c20 6f66 0a63 6f6e 6669 6465 6e63 vel of.confidenc │ │ │ +0009f560: 6520 2870 726f 6261 6269 6c69 7479 2920 e (probability) │ │ │ +0009f570: 7468 6174 2074 6865 2065 7374 696d 6174 that the estimat │ │ │ +0009f580: 6564 206d 6174 7269 7820 6973 2063 6f72 ed matrix is cor │ │ │ +0009f590: 7265 6374 2e3c 2f64 643e 0a3c 6464 3e3c rect.
    .
    < │ │ │ +0009f5a0: 636f 6465 3e74 6872 6573 686f 6c64 3c2f code>threshold - Paramete │ │ │ +0009f5c0: 7220 7573 6564 2066 6f72 2052 414e 5341 r used for RANSA │ │ │ +0009f5d0: 432e 2049 7420 6973 2074 6865 206d 6178 C. It is the max │ │ │ +0009f5e0: 696d 756d 2064 6973 7461 6e63 6520 6672 imum distance fr │ │ │ +0009f5f0: 6f6d 2061 2070 6f69 6e74 2074 6f20 616e om a point to an │ │ │ +0009f600: 2065 7069 706f 6c61 720a 6c69 6e65 2069 epipolar.line i │ │ │ +0009f610: 6e20 7069 7865 6c73 2c20 6265 796f 6e64 n pixels, beyond │ │ │ +0009f620: 2077 6869 6368 2074 6865 2070 6f69 6e74 which the point │ │ │ +0009f630: 2069 7320 636f 6e73 6964 6572 6564 2061 is considered a │ │ │ +0009f640: 6e20 6f75 746c 6965 7220 616e 6420 6973 n outlier and is │ │ │ +0009f650: 206e 6f74 2075 7365 6420 666f 7220 636f not used for co │ │ │ +0009f660: 6d70 7574 696e 6720 7468 650a 6669 6e61 mputing the.fina │ │ │ +0009f670: 6c20 6675 6e64 616d 656e 7461 6c20 6d61 l fundamental ma │ │ │ +0009f680: 7472 6978 2e20 4974 2063 616e 2062 6520 trix. It can be │ │ │ +0009f690: 7365 7420 746f 2073 6f6d 6574 6869 6e67 set to something │ │ │ +0009f6a0: 206c 696b 6520 312d 332c 2064 6570 656e like 1-3, depen │ │ │ +0009f6b0: 6469 6e67 206f 6e20 7468 6520 6163 6375 ding on the accu │ │ │ +0009f6c0: 7261 6379 206f 6620 7468 650a 706f 696e racy of the.poin │ │ │ +0009f6d0: 7420 6c6f 6361 6c69 7a61 7469 6f6e 2c20 t localization, │ │ │ +0009f6e0: 696d 6167 6520 7265 736f 6c75 7469 6f6e image resolution │ │ │ +0009f6f0: 2c20 616e 6420 7468 6520 696d 6167 6520 , and the image │ │ │ +0009f700: 6e6f 6973 652e 0a66 6f72 2074 6865 206f noise..for the o │ │ │ +0009f710: 7468 6572 2070 6f69 6e74 732e 2054 6865 ther points. The │ │ │ +0009f720: 2061 7272 6179 2069 7320 636f 6d70 7574 array is comput │ │ │ +0009f730: 6564 206f 6e6c 7920 696e 2074 6865 2052 ed only in the R │ │ │ +0009f740: 414e 5341 4320 616e 6420 4c4d 6564 5320 ANSAC and LMedS │ │ │ +0009f750: 6d65 7468 6f64 732e 3c2f 6464 3e0a 3c64 methods.
    .maxIters │ │ │ +0009f770: 3c2f 636f 6465 3e20 2d20 5468 6520 6d61 - The ma │ │ │ +0009f780: 7869 6d75 6d20 6e75 6d62 6572 206f 6620 ximum number of │ │ │ +0009f790: 726f 6275 7374 206d 6574 686f 6420 6974 robust method it │ │ │ +0009f7a0: 6572 6174 696f 6e73 2e0a 0a54 6869 7320 erations...This │ │ │ +0009f7b0: 6675 6e63 7469 6f6e 2065 7374 696d 6174 function estimat │ │ │ +0009f7c0: 6573 2065 7373 656e 7469 616c 206d 6174 es essential mat │ │ │ +0009f7d0: 7269 7820 6261 7365 6420 6f6e 2074 6865 rix based on the │ │ │ +0009f7e0: 2066 6976 652d 706f 696e 7420 616c 676f five-point algo │ │ │ +0009f7f0: 7269 7468 6d20 736f 6c76 6572 2069 6e20 rithm solver in │ │ │ +0009f800: 4349 5445 3a20 4e69 7374 6572 3033 202e CITE: Nister03 . │ │ │ +0009f810: 0a43 4954 453a 2053 7465 7765 6e69 7573 .CITE: Stewenius │ │ │ +0009f820: 4346 5320 6973 2061 6c73 6f20 6120 7265 CFS is also a re │ │ │ +0009f830: 6c61 7465 642e 2054 6865 2065 7069 706f lated. The epipo │ │ │ +0009f840: 6c61 7220 6765 6f6d 6574 7279 2069 7320 lar geometry is │ │ │ +0009f850: 6465 7363 7269 6265 6420 6279 2074 6865 described by the │ │ │ +0009f860: 2066 6f6c 6c6f 7769 6e67 2065 7175 6174 following equat │ │ │ +0009f870: 696f 6e3a 0a0a 5c28 5b70 5f32 3b20 315d ion:..\([p_2; 1] │ │ │ +0009f880: 5e54 204b 5e7b 2d54 7d20 4520 4b5e 7b2d ^T K^{-T} E K^{- │ │ │ +0009f890: 317d 205b 705f 313b 2031 5d20 3d20 305c 1} [p_1; 1] = 0\ │ │ │ +0009f8a0: 290a 0a77 6865 7265 205c 2845 5c29 2069 )..where \(E\) i │ │ │ +0009f8b0: 7320 616e 2065 7373 656e 7469 616c 206d s an essential m │ │ │ +0009f8c0: 6174 7269 782c 205c 2870 5f31 5c29 2061 atrix, \(p_1\) a │ │ │ +0009f8d0: 6e64 205c 2870 5f32 5c29 2061 7265 2063 nd \(p_2\) are c │ │ │ +0009f8e0: 6f72 7265 7370 6f6e 6469 6e67 2070 6f69 orresponding poi │ │ │ +0009f8f0: 6e74 7320 696e 2074 6865 2066 6972 7374 nts in the first │ │ │ +0009f900: 2061 6e64 2074 6865 0a73 6563 6f6e 6420 and the.second │ │ │ +0009f910: 696d 6167 6573 2c20 7265 7370 6563 7469 images, respecti │ │ │ +0009f920: 7665 6c79 2e20 5468 6520 7265 7375 6c74 vely. The result │ │ │ +0009f930: 206f 6620 7468 6973 2066 756e 6374 696f of this functio │ │ │ +0009f940: 6e20 6d61 7920 6265 2070 6173 7365 6420 n may be passed │ │ │ +0009f950: 6675 7274 6865 7220 746f 0a23 6465 636f further to.#deco │ │ │ +0009f960: 6d70 6f73 6545 7373 656e 7469 616c 4d61 mposeEssentialMa │ │ │ +0009f970: 7420 6f72 2023 7265 636f 7665 7250 6f73 t or #recoverPos │ │ │ +0009f980: 6520 746f 2072 6563 6f76 6572 2074 6865 e to recover the │ │ │ +0009f990: 2072 656c 6174 6976 6520 706f 7365 2062 relative pose b │ │ │ +0009f9a0: 6574 7765 656e 2063 616d 6572 6173 2e3c etween cameras.< │ │ │ +0009f9b0: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ +0009f9c0: 3a3c 2f64 743e 0a3c 6464 3e61 7574 6f6d :
    .
    autom │ │ │ +0009f9d0: 6174 6963 616c 6c79 2067 656e 6572 6174 atically generat │ │ │ +0009f9e0: 6564 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f ed
    .
    ..

  • . │ │ │ +0009fa00: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374 .
  • ..

    fin │ │ │ +0009fa90: 6445 7373 656e 7469 616c 4d61 743c 2f68 dEssentialMat.
    .
    public │ │ │ +0009fb00: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +0009fb10: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;Mat │ │ │ +0009fb70: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  findEsse │ │ │ +0009fba0: 6e74 6961 6c4d 6174 3c2f 7370 616e 3e3c ntialMat< │ │ │ +0009fbb0: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat points1,. │ │ │ +0009fc20: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +0009fc60: 3c2f 613e 266e 6273 703b 706f 696e 7473  points │ │ │ +0009fc70: 322c 0a20 3c61 2068 7265 663d 222e 2e2f 2,. │ │ │ +0009fcb0: 4d61 743c 2f61 3e26 6e62 7370 3b63 616d Mat cam │ │ │ +0009fcc0: 6572 614d 6174 7269 782c 0a20 696e 7426 eraMatrix,. int& │ │ │ +0009fcd0: 6e62 7370 3b6d 6574 686f 642c 0a20 646f nbsp;method,. do │ │ │ +0009fce0: 7562 6c65 266e 6273 703b 7072 6f62 2c0a uble prob,. │ │ │ +0009fcf0: 2064 6f75 626c 6526 6e62 7370 3b74 6872 double thr │ │ │ +0009fd00: 6573 686f 6c64 293c 2f73 7061 6e3e 3c2f eshold).
    Calculat │ │ │ +0009fd30: 6573 2061 6e20 6573 7365 6e74 6961 6c20 es an essential │ │ │ +0009fd40: 6d61 7472 6978 2066 726f 6d20 7468 6520 matrix from the │ │ │ +0009fd50: 636f 7272 6573 706f 6e64 696e 6720 706f corresponding po │ │ │ +0009fd60: 696e 7473 2069 6e20 7477 6f20 696d 6167 ints in two imag │ │ │ +0009fd70: 6573 2e3c 2f64 6976 3e0a 3c64 6c20 636c es.
    .
    .
    Parameters:
    .
    poin │ │ │ +0009fdb0: 7473 313c 2f63 6f64 653e 202d 2041 7272 ts1 - Arr │ │ │ +0009fdc0: 6179 206f 6620 4e20 284e 2026 6774 3b3d ay of N (N >= │ │ │ +0009fdd0: 2035 2920 3244 2070 6f69 6e74 7320 6672 5) 2D points fr │ │ │ +0009fde0: 6f6d 2074 6865 2066 6972 7374 2069 6d61 om the first ima │ │ │ +0009fdf0: 6765 2e20 5468 6520 706f 696e 7420 636f ge. The point co │ │ │ +0009fe00: 6f72 6469 6e61 7465 7320 7368 6f75 6c64 ordinates should │ │ │ +0009fe10: 0a62 6520 666c 6f61 7469 6e67 2d70 6f69 .be floating-poi │ │ │ +0009fe20: 6e74 2028 7369 6e67 6c65 206f 7220 646f nt (single or do │ │ │ +0009fe30: 7562 6c65 2070 7265 6369 7369 6f6e 292e uble precision). │ │ │ +0009fe40: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +0009fe50: 706f 696e 7473 323c 2f63 6f64 653e 202d points2 - │ │ │ +0009fe60: 2041 7272 6179 206f 6620 7468 6520 7365 Array of the se │ │ │ +0009fe70: 636f 6e64 2069 6d61 6765 2070 6f69 6e74 cond image point │ │ │ +0009fe80: 7320 6f66 2074 6865 2073 616d 6520 7369 s of the same si │ │ │ +0009fe90: 7a65 2061 6e64 2066 6f72 6d61 7420 6173 ze and format as │ │ │ +0009fea0: 2070 6f69 6e74 7331 2e3c 2f64 643e 0a3c points1.
    .< │ │ │ +0009feb0: 6464 3e3c 636f 6465 3e63 616d 6572 614d dd>cameraM │ │ │ +0009fec0: 6174 7269 783c 2f63 6f64 653e 202d 2043 atrix - C │ │ │ +0009fed0: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ +0009fee0: 6d61 7472 6978 205c 285c 6361 6d65 7261 matrix \(\camera │ │ │ +0009fef0: 6d61 7472 6978 7b41 7d5c 2920 2e0a 4e6f matrix{A}\) ..No │ │ │ +0009ff00: 7465 2074 6861 7420 7468 6973 2066 756e te that this fun │ │ │ +0009ff10: 6374 696f 6e20 6173 7375 6d65 7320 7468 ction assumes th │ │ │ +0009ff20: 6174 2070 6f69 6e74 7331 2061 6e64 2070 at points1 and p │ │ │ +0009ff30: 6f69 6e74 7332 2061 7265 2066 6561 7475 oints2 are featu │ │ │ +0009ff40: 7265 2070 6f69 6e74 7320 6672 6f6d 2063 re points from c │ │ │ +0009ff50: 616d 6572 6173 2077 6974 6820 7468 650a ameras with the. │ │ │ +0009ff60: 7361 6d65 2063 616d 6572 6120 696e 7472 same camera intr │ │ │ +0009ff70: 696e 7369 6320 6d61 7472 6978 2e20 4966 insic matrix. If │ │ │ +0009ff80: 2074 6869 7320 6173 7375 6d70 7469 6f6e this assumption │ │ │ +0009ff90: 2064 6f65 7320 6e6f 7420 686f 6c64 2066 does not hold f │ │ │ +0009ffa0: 6f72 2079 6f75 7220 7573 6520 6361 7365 or your use case │ │ │ +0009ffb0: 2c20 7573 6520 616e 6f74 6865 720a 6675 , use another.fu │ │ │ +0009ffc0: 6e63 7469 6f6e 206f 7665 726c 6f61 6420 nction overload │ │ │ +0009ffd0: 6f72 2023 756e 6469 7374 6f72 7450 6f69 or #undistortPoi │ │ │ +0009ffe0: 6e74 7320 7769 7468 203c 636f 6465 3e50 nts with P │ │ │ +0009fff0: 203d 2063 763a 3a4e 6f41 7272 6179 2829 = cv::NoArray() │ │ │ +000a0000: 3c2f 636f 6465 3e20 666f 7220 626f 7468 for both │ │ │ +000a0010: 2063 616d 6572 6173 2074 6f20 7472 616e cameras to tran │ │ │ +000a0020: 7366 6f72 6d20 696d 6167 650a 706f 696e sform image.poin │ │ │ +000a0030: 7473 2074 6f20 6e6f 726d 616c 697a 6564 ts to normalized │ │ │ +000a0040: 2069 6d61 6765 2063 6f6f 7264 696e 6174 image coordinat │ │ │ +000a0050: 6573 2c20 7768 6963 6820 6172 6520 7661 es, which are va │ │ │ +000a0060: 6c69 6420 666f 7220 7468 6520 6964 656e lid for the iden │ │ │ +000a0070: 7469 7479 2063 616d 6572 6120 696e 7472 tity camera intr │ │ │ +000a0080: 696e 7369 6320 6d61 7472 6978 2e0a 5768 insic matrix..Wh │ │ │ +000a0090: 656e 2070 6173 7369 6e67 2074 6865 7365 en passing these │ │ │ +000a00a0: 2063 6f6f 7264 696e 6174 6573 2c20 7061 coordinates, pa │ │ │ +000a00b0: 7373 2074 6865 2069 6465 6e74 6974 7920 ss the identity │ │ │ +000a00c0: 6d61 7472 6978 2066 6f72 2074 6869 7320 matrix for this │ │ │ +000a00d0: 7061 7261 6d65 7465 722e 3c2f 6464 3e0a parameter.. │ │ │ +000a00e0: 3c64 643e 3c63 6f64 653e 6d65 7468 6f64
    method │ │ │ +000a00f0: 3c2f 636f 6465 3e20 2d20 4d65 7468 6f64 - Method │ │ │ +000a0100: 2066 6f72 2063 6f6d 7075 7469 6e67 2061 for computing a │ │ │ +000a0110: 6e20 6573 7365 6e74 6961 6c20 6d61 7472 n essential matr │ │ │ +000a0120: 6978 2e0a 3c75 6c3e 0a20 203c 6c69 3e0a ix..
      .
    • . │ │ │ +000a0130: 2020 2052 4546 3a20 5241 4e53 4143 2066 REF: RANSAC f │ │ │ +000a0140: 6f72 2074 6865 2052 414e 5341 4320 616c or the RANSAC al │ │ │ +000a0150: 676f 7269 7468 6d2e 0a20 203c 2f6c 693e gorithm..
    • │ │ │ +000a0160: 0a20 203c 6c69 3e0a 2020 2052 4546 3a20 .
    • . REF: │ │ │ +000a0170: 4c4d 4544 5320 666f 7220 7468 6520 4c4d LMEDS for the LM │ │ │ +000a0180: 6564 5320 616c 676f 7269 7468 6d2e 0a20 edS algorithm.. │ │ │ +000a0190: 203c 2f6c 693e 0a3c 2f75 6c3e 3c2f 6464
    • .
    .
    prob │ │ │ +000a01b0: 3c2f 636f 6465 3e20 2d20 5061 7261 6d65 - Parame │ │ │ +000a01c0: 7465 7220 7573 6564 2066 6f72 2074 6865 ter used for the │ │ │ +000a01d0: 2052 414e 5341 4320 6f72 204c 4d65 6453 RANSAC or LMedS │ │ │ +000a01e0: 206d 6574 686f 6473 206f 6e6c 792e 2049 methods only. I │ │ │ +000a01f0: 7420 7370 6563 6966 6965 7320 6120 6465 t specifies a de │ │ │ +000a0200: 7369 7261 626c 6520 6c65 7665 6c20 6f66 sirable level of │ │ │ +000a0210: 0a63 6f6e 6669 6465 6e63 6520 2870 726f .confidence (pro │ │ │ +000a0220: 6261 6269 6c69 7479 2920 7468 6174 2074 bability) that t │ │ │ +000a0230: 6865 2065 7374 696d 6174 6564 206d 6174 he estimated mat │ │ │ +000a0240: 7269 7820 6973 2063 6f72 7265 6374 2e3c rix is correct.< │ │ │ +000a0250: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ +000a0260: 6872 6573 686f 6c64 3c2f 636f 6465 3e20 hreshold │ │ │ +000a0270: 2d20 5061 7261 6d65 7465 7220 7573 6564 - Parameter used │ │ │ +000a0280: 2066 6f72 2052 414e 5341 432e 2049 7420 for RANSAC. It │ │ │ +000a0290: 6973 2074 6865 206d 6178 696d 756d 2064 is the maximum d │ │ │ +000a02a0: 6973 7461 6e63 6520 6672 6f6d 2061 2070 istance from a p │ │ │ +000a02b0: 6f69 6e74 2074 6f20 616e 2065 7069 706f oint to an epipo │ │ │ +000a02c0: 6c61 720a 6c69 6e65 2069 6e20 7069 7865 lar.line in pixe │ │ │ +000a02d0: 6c73 2c20 6265 796f 6e64 2077 6869 6368 ls, beyond which │ │ │ +000a02e0: 2074 6865 2070 6f69 6e74 2069 7320 636f the point is co │ │ │ +000a02f0: 6e73 6964 6572 6564 2061 6e20 6f75 746c nsidered an outl │ │ │ +000a0300: 6965 7220 616e 6420 6973 206e 6f74 2075 ier and is not u │ │ │ +000a0310: 7365 6420 666f 7220 636f 6d70 7574 696e sed for computin │ │ │ +000a0320: 6720 7468 650a 6669 6e61 6c20 6675 6e64 g the.final fund │ │ │ +000a0330: 616d 656e 7461 6c20 6d61 7472 6978 2e20 amental matrix. │ │ │ +000a0340: 4974 2063 616e 2062 6520 7365 7420 746f It can be set to │ │ │ +000a0350: 2073 6f6d 6574 6869 6e67 206c 696b 6520 something like │ │ │ +000a0360: 312d 332c 2064 6570 656e 6469 6e67 206f 1-3, depending o │ │ │ +000a0370: 6e20 7468 6520 6163 6375 7261 6379 206f n the accuracy o │ │ │ +000a0380: 6620 7468 650a 706f 696e 7420 6c6f 6361 f the.point loca │ │ │ +000a0390: 6c69 7a61 7469 6f6e 2c20 696d 6167 6520 lization, image │ │ │ +000a03a0: 7265 736f 6c75 7469 6f6e 2c20 616e 6420 resolution, and │ │ │ +000a03b0: 7468 6520 696d 6167 6520 6e6f 6973 652e the image noise. │ │ │ +000a03c0: 0a66 6f72 2074 6865 206f 7468 6572 2070 .for the other p │ │ │ +000a03d0: 6f69 6e74 732e 2054 6865 2061 7272 6179 oints. The array │ │ │ +000a03e0: 2069 7320 636f 6d70 7574 6564 206f 6e6c is computed onl │ │ │ +000a03f0: 7920 696e 2074 6865 2052 414e 5341 4320 y in the RANSAC │ │ │ +000a0400: 616e 6420 4c4d 6564 5320 6d65 7468 6f64 and LMedS method │ │ │ +000a0410: 732e 0a0a 5468 6973 2066 756e 6374 696f s...This functio │ │ │ +000a0420: 6e20 6573 7469 6d61 7465 7320 6573 7365 n estimates esse │ │ │ +000a0430: 6e74 6961 6c20 6d61 7472 6978 2062 6173 ntial matrix bas │ │ │ +000a0440: 6564 206f 6e20 7468 6520 6669 7665 2d70 ed on the five-p │ │ │ +000a0450: 6f69 6e74 2061 6c67 6f72 6974 686d 2073 oint algorithm s │ │ │ +000a0460: 6f6c 7665 7220 696e 2043 4954 453a 204e olver in CITE: N │ │ │ +000a0470: 6973 7465 7230 3320 2e0a 4349 5445 3a20 ister03 ..CITE: │ │ │ +000a0480: 5374 6577 656e 6975 7343 4653 2069 7320 SteweniusCFS is │ │ │ +000a0490: 616c 736f 2061 2072 656c 6174 6564 2e20 also a related. │ │ │ +000a04a0: 5468 6520 6570 6970 6f6c 6172 2067 656f The epipolar geo │ │ │ +000a04b0: 6d65 7472 7920 6973 2064 6573 6372 6962 metry is describ │ │ │ +000a04c0: 6564 2062 7920 7468 6520 666f 6c6c 6f77 ed by the follow │ │ │ +000a04d0: 696e 6720 6571 7561 7469 6f6e 3a0a 0a5c ing equation:..\ │ │ │ +000a04e0: 285b 705f 323b 2031 5d5e 5420 4b5e 7b2d ([p_2; 1]^T K^{- │ │ │ +000a04f0: 547d 2045 204b 5e7b 2d31 7d20 5b70 5f31 T} E K^{-1} [p_1 │ │ │ +000a0500: 3b20 315d 203d 2030 5c29 0a0a 7768 6572 ; 1] = 0\)..wher │ │ │ +000a0510: 6520 5c28 455c 2920 6973 2061 6e20 6573 e \(E\) is an es │ │ │ +000a0520: 7365 6e74 6961 6c20 6d61 7472 6978 2c20 sential matrix, │ │ │ +000a0530: 5c28 705f 315c 2920 616e 6420 5c28 705f \(p_1\) and \(p_ │ │ │ +000a0540: 325c 2920 6172 6520 636f 7272 6573 706f 2\) are correspo │ │ │ +000a0550: 6e64 696e 6720 706f 696e 7473 2069 6e20 nding points in │ │ │ +000a0560: 7468 6520 6669 7273 7420 616e 6420 7468 the first and th │ │ │ +000a0570: 650a 7365 636f 6e64 2069 6d61 6765 732c e.second images, │ │ │ +000a0580: 2072 6573 7065 6374 6976 656c 792e 2054 respectively. T │ │ │ +000a0590: 6865 2072 6573 756c 7420 6f66 2074 6869 he result of thi │ │ │ +000a05a0: 7320 6675 6e63 7469 6f6e 206d 6179 2062 s function may b │ │ │ +000a05b0: 6520 7061 7373 6564 2066 7572 7468 6572 e passed further │ │ │ +000a05c0: 2074 6f0a 2364 6563 6f6d 706f 7365 4573 to.#decomposeEs │ │ │ +000a05d0: 7365 6e74 6961 6c4d 6174 206f 7220 2372 sentialMat or #r │ │ │ +000a05e0: 6563 6f76 6572 506f 7365 2074 6f20 7265 ecoverPose to re │ │ │ +000a05f0: 636f 7665 7220 7468 6520 7265 6c61 7469 cover the relati │ │ │ +000a0600: 7665 2070 6f73 6520 6265 7477 6565 6e20 ve pose between │ │ │ +000a0610: 6361 6d65 7261 732e 3c2f 6464 3e0a 3c64 cameras.
    .Returns:. │ │ │ +000a0630: 3c64 643e 6175 746f 6d61 7469 6361 6c6c
    automaticall │ │ │ +000a0640: 7920 6765 6e65 7261 7465 643c 2f64 643e y generated
    │ │ │ +000a0650: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    .
    ..

  • .< │ │ │ +000a0670: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .

    f │ │ │ +000a06f0: 696e 6445 7373 656e 7469 616c 4d61 743c indEssentialMat< │ │ │ +000a0700: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +000a0760: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +000a0770: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;< │ │ │ +000a0790: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000a07a0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000a07b0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000a07c0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat < │ │ │ +000a07e0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +000a07f0: 656e 742d 6e61 6d65 223e 6669 6e64 4573 ent-name">findEs │ │ │ +000a0800: 7365 6e74 6961 6c4d 6174 3c2f 7370 616e sentialMat( │ │ │ +000a0830: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000a0870: 2f61 3e26 6e62 7370 3b70 6f69 6e74 7331 /a> points1 │ │ │ +000a0880: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000a08c0: 6174 3c2f 613e 266e 6273 703b 706f 696e at poin │ │ │ +000a08d0: 7473 322c 0a20 3c61 2068 7265 663d 222e ts2,. Mat c │ │ │ +000a0920: 616d 6572 614d 6174 7269 782c 0a20 696e ameraMatrix,. in │ │ │ +000a0930: 7426 6e62 7370 3b6d 6574 686f 642c 0a20 t method,. │ │ │ +000a0940: 646f 7562 6c65 266e 6273 703b 7072 6f62 double prob │ │ │ +000a0950: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ +000a0960: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ +000a0970: 223e 4361 6c63 756c 6174 6573 2061 6e20 ">Calculates an │ │ │ +000a0980: 6573 7365 6e74 6961 6c20 6d61 7472 6978 essential matrix │ │ │ +000a0990: 2066 726f 6d20 7468 6520 636f 7272 6573 from the corres │ │ │ +000a09a0: 706f 6e64 696e 6720 706f 696e 7473 2069 ponding points i │ │ │ +000a09b0: 6e20 7477 6f20 696d 6167 6573 2e3c 2f64 n two images..
    .
    Param │ │ │ +000a09e0: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ +000a09f0: 3c63 6f64 653e 706f 696e 7473 313c 2f63 points1 - Array of │ │ │ +000a0a10: 4e20 284e 2026 6774 3b3d 2035 2920 3244 N (N >= 5) 2D │ │ │ +000a0a20: 2070 6f69 6e74 7320 6672 6f6d 2074 6865 points from the │ │ │ +000a0a30: 2066 6972 7374 2069 6d61 6765 2e20 5468 first image. Th │ │ │ +000a0a40: 6520 706f 696e 7420 636f 6f72 6469 6e61 e point coordina │ │ │ +000a0a50: 7465 7320 7368 6f75 6c64 0a62 6520 666c tes should.be fl │ │ │ +000a0a60: 6f61 7469 6e67 2d70 6f69 6e74 2028 7369 oating-point (si │ │ │ +000a0a70: 6e67 6c65 206f 7220 646f 7562 6c65 2070 ngle or double p │ │ │ +000a0a80: 7265 6369 7369 6f6e 292e 3c2f 6464 3e0a recision).
    . │ │ │ +000a0a90: 3c64 643e 3c63 6f64 653e 706f 696e 7473
    points │ │ │ +000a0aa0: 323c 2f63 6f64 653e 202d 2041 7272 6179 2 - Array │ │ │ +000a0ab0: 206f 6620 7468 6520 7365 636f 6e64 2069 of the second i │ │ │ +000a0ac0: 6d61 6765 2070 6f69 6e74 7320 6f66 2074 mage points of t │ │ │ +000a0ad0: 6865 2073 616d 6520 7369 7a65 2061 6e64 he same size and │ │ │ +000a0ae0: 2066 6f72 6d61 7420 6173 2070 6f69 6e74 format as point │ │ │ +000a0af0: 7331 2e3c 2f64 643e 0a3c 6464 3e3c 636f s1.
    .
    cameraMatrix< │ │ │ +000a0b10: 2f63 6f64 653e 202d 2043 616d 6572 6120 /code> - Camera │ │ │ +000a0b20: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ +000a0b30: 205c 285c 6361 6d65 7261 6d61 7472 6978 \(\cameramatrix │ │ │ +000a0b40: 7b41 7d5c 2920 2e0a 4e6f 7465 2074 6861 {A}\) ..Note tha │ │ │ +000a0b50: 7420 7468 6973 2066 756e 6374 696f 6e20 t this function │ │ │ +000a0b60: 6173 7375 6d65 7320 7468 6174 2070 6f69 assumes that poi │ │ │ +000a0b70: 6e74 7331 2061 6e64 2070 6f69 6e74 7332 nts1 and points2 │ │ │ +000a0b80: 2061 7265 2066 6561 7475 7265 2070 6f69 are feature poi │ │ │ +000a0b90: 6e74 7320 6672 6f6d 2063 616d 6572 6173 nts from cameras │ │ │ +000a0ba0: 2077 6974 6820 7468 650a 7361 6d65 2063 with the.same c │ │ │ +000a0bb0: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ +000a0bc0: 6d61 7472 6978 2e20 4966 2074 6869 7320 matrix. If this │ │ │ +000a0bd0: 6173 7375 6d70 7469 6f6e 2064 6f65 7320 assumption does │ │ │ +000a0be0: 6e6f 7420 686f 6c64 2066 6f72 2079 6f75 not hold for you │ │ │ +000a0bf0: 7220 7573 6520 6361 7365 2c20 7573 6520 r use case, use │ │ │ +000a0c00: 616e 6f74 6865 720a 6675 6e63 7469 6f6e another.function │ │ │ +000a0c10: 206f 7665 726c 6f61 6420 6f72 2023 756e overload or #un │ │ │ +000a0c20: 6469 7374 6f72 7450 6f69 6e74 7320 7769 distortPoints wi │ │ │ +000a0c30: 7468 203c 636f 6465 3e50 203d 2063 763a th P = cv: │ │ │ +000a0c40: 3a4e 6f41 7272 6179 2829 3c2f 636f 6465 :NoArray() for both camer │ │ │ +000a0c60: 6173 2074 6f20 7472 616e 7366 6f72 6d20 as to transform │ │ │ +000a0c70: 696d 6167 650a 706f 696e 7473 2074 6f20 image.points to │ │ │ +000a0c80: 6e6f 726d 616c 697a 6564 2069 6d61 6765 normalized image │ │ │ +000a0c90: 2063 6f6f 7264 696e 6174 6573 2c20 7768 coordinates, wh │ │ │ +000a0ca0: 6963 6820 6172 6520 7661 6c69 6420 666f ich are valid fo │ │ │ +000a0cb0: 7220 7468 6520 6964 656e 7469 7479 2063 r the identity c │ │ │ +000a0cc0: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ +000a0cd0: 6d61 7472 6978 2e0a 5768 656e 2070 6173 matrix..When pas │ │ │ +000a0ce0: 7369 6e67 2074 6865 7365 2063 6f6f 7264 sing these coord │ │ │ +000a0cf0: 696e 6174 6573 2c20 7061 7373 2074 6865 inates, pass the │ │ │ +000a0d00: 2069 6465 6e74 6974 7920 6d61 7472 6978 identity matrix │ │ │ +000a0d10: 2066 6f72 2074 6869 7320 7061 7261 6d65 for this parame │ │ │ +000a0d20: 7465 722e 3c2f 6464 3e0a 3c64 643e 3c63 ter.
    .
    method - Method for c │ │ │ +000a0d50: 6f6d 7075 7469 6e67 2061 6e20 6573 7365 omputing an esse │ │ │ +000a0d60: 6e74 6961 6c20 6d61 7472 6978 2e0a 3c75 ntial matrix...
  • . REF │ │ │ +000a0d80: 3a20 5241 4e53 4143 2066 6f72 2074 6865 : RANSAC for the │ │ │ +000a0d90: 2052 414e 5341 4320 616c 676f 7269 7468 RANSAC algorith │ │ │ +000a0da0: 6d2e 0a20 203c 2f6c 693e 0a20 203c 6c69 m..
  • .
  • . REF: LMEDS │ │ │ +000a0dc0: 666f 7220 7468 6520 4c4d 6564 5320 616c for the LMedS al │ │ │ +000a0dd0: 676f 7269 7468 6d2e 0a20 203c 2f6c 693e gorithm..
  • │ │ │ +000a0de0: 0a3c 2f75 6c3e 3c2f 6464 3e0a 3c64 643e .
    .
    │ │ │ +000a0df0: 3c63 6f64 653e 7072 6f62 3c2f 636f 6465 prob - Parameter us │ │ │ +000a0e10: 6564 2066 6f72 2074 6865 2052 414e 5341 ed for the RANSA │ │ │ +000a0e20: 4320 6f72 204c 4d65 6453 206d 6574 686f C or LMedS metho │ │ │ +000a0e30: 6473 206f 6e6c 792e 2049 7420 7370 6563 ds only. It spec │ │ │ +000a0e40: 6966 6965 7320 6120 6465 7369 7261 626c ifies a desirabl │ │ │ +000a0e50: 6520 6c65 7665 6c20 6f66 0a63 6f6e 6669 e level of.confi │ │ │ +000a0e60: 6465 6e63 6520 2870 726f 6261 6269 6c69 dence (probabili │ │ │ +000a0e70: 7479 2920 7468 6174 2074 6865 2065 7374 ty) that the est │ │ │ +000a0e80: 696d 6174 6564 206d 6174 7269 7820 6973 imated matrix is │ │ │ +000a0e90: 2063 6f72 7265 6374 2e0a 6c69 6e65 2069 correct..line i │ │ │ +000a0ea0: 6e20 7069 7865 6c73 2c20 6265 796f 6e64 n pixels, beyond │ │ │ +000a0eb0: 2077 6869 6368 2074 6865 2070 6f69 6e74 which the point │ │ │ +000a0ec0: 2069 7320 636f 6e73 6964 6572 6564 2061 is considered a │ │ │ +000a0ed0: 6e20 6f75 746c 6965 7220 616e 6420 6973 n outlier and is │ │ │ +000a0ee0: 206e 6f74 2075 7365 6420 666f 7220 636f not used for co │ │ │ +000a0ef0: 6d70 7574 696e 6720 7468 650a 6669 6e61 mputing the.fina │ │ │ +000a0f00: 6c20 6675 6e64 616d 656e 7461 6c20 6d61 l fundamental ma │ │ │ +000a0f10: 7472 6978 2e20 4974 2063 616e 2062 6520 trix. It can be │ │ │ +000a0f20: 7365 7420 746f 2073 6f6d 6574 6869 6e67 set to something │ │ │ +000a0f30: 206c 696b 6520 312d 332c 2064 6570 656e like 1-3, depen │ │ │ +000a0f40: 6469 6e67 206f 6e20 7468 6520 6163 6375 ding on the accu │ │ │ +000a0f50: 7261 6379 206f 6620 7468 650a 706f 696e racy of the.poin │ │ │ +000a0f60: 7420 6c6f 6361 6c69 7a61 7469 6f6e 2c20 t localization, │ │ │ +000a0f70: 696d 6167 6520 7265 736f 6c75 7469 6f6e image resolution │ │ │ +000a0f80: 2c20 616e 6420 7468 6520 696d 6167 6520 , and the image │ │ │ +000a0f90: 6e6f 6973 652e 0a66 6f72 2074 6865 206f noise..for the o │ │ │ +000a0fa0: 7468 6572 2070 6f69 6e74 732e 2054 6865 ther points. The │ │ │ +000a0fb0: 2061 7272 6179 2069 7320 636f 6d70 7574 array is comput │ │ │ +000a0fc0: 6564 206f 6e6c 7920 696e 2074 6865 2052 ed only in the R │ │ │ +000a0fd0: 414e 5341 4320 616e 6420 4c4d 6564 5320 ANSAC and LMedS │ │ │ +000a0fe0: 6d65 7468 6f64 732e 0a0a 5468 6973 2066 methods...This f │ │ │ +000a0ff0: 756e 6374 696f 6e20 6573 7469 6d61 7465 unction estimate │ │ │ +000a1000: 7320 6573 7365 6e74 6961 6c20 6d61 7472 s essential matr │ │ │ +000a1010: 6978 2062 6173 6564 206f 6e20 7468 6520 ix based on the │ │ │ +000a1020: 6669 7665 2d70 6f69 6e74 2061 6c67 6f72 five-point algor │ │ │ +000a1030: 6974 686d 2073 6f6c 7665 7220 696e 2043 ithm solver in C │ │ │ +000a1040: 4954 453a 204e 6973 7465 7230 3320 2e0a ITE: Nister03 .. │ │ │ +000a1050: 4349 5445 3a20 5374 6577 656e 6975 7343 CITE: SteweniusC │ │ │ +000a1060: 4653 2069 7320 616c 736f 2061 2072 656c FS is also a rel │ │ │ +000a1070: 6174 6564 2e20 5468 6520 6570 6970 6f6c ated. The epipol │ │ │ +000a1080: 6172 2067 656f 6d65 7472 7920 6973 2064 ar geometry is d │ │ │ +000a1090: 6573 6372 6962 6564 2062 7920 7468 6520 escribed by the │ │ │ +000a10a0: 666f 6c6c 6f77 696e 6720 6571 7561 7469 following equati │ │ │ +000a10b0: 6f6e 3a0a 0a5c 285b 705f 323b 2031 5d5e on:..\([p_2; 1]^ │ │ │ +000a10c0: 5420 4b5e 7b2d 547d 2045 204b 5e7b 2d31 T K^{-T} E K^{-1 │ │ │ +000a10d0: 7d20 5b70 5f31 3b20 315d 203d 2030 5c29 } [p_1; 1] = 0\) │ │ │ +000a10e0: 0a0a 7768 6572 6520 5c28 455c 2920 6973 ..where \(E\) is │ │ │ +000a10f0: 2061 6e20 6573 7365 6e74 6961 6c20 6d61 an essential ma │ │ │ +000a1100: 7472 6978 2c20 5c28 705f 315c 2920 616e trix, \(p_1\) an │ │ │ +000a1110: 6420 5c28 705f 325c 2920 6172 6520 636f d \(p_2\) are co │ │ │ +000a1120: 7272 6573 706f 6e64 696e 6720 706f 696e rresponding poin │ │ │ +000a1130: 7473 2069 6e20 7468 6520 6669 7273 7420 ts in the first │ │ │ +000a1140: 616e 6420 7468 650a 7365 636f 6e64 2069 and the.second i │ │ │ +000a1150: 6d61 6765 732c 2072 6573 7065 6374 6976 mages, respectiv │ │ │ +000a1160: 656c 792e 2054 6865 2072 6573 756c 7420 ely. The result │ │ │ +000a1170: 6f66 2074 6869 7320 6675 6e63 7469 6f6e of this function │ │ │ +000a1180: 206d 6179 2062 6520 7061 7373 6564 2066 may be passed f │ │ │ +000a1190: 7572 7468 6572 2074 6f0a 2364 6563 6f6d urther to.#decom │ │ │ +000a11a0: 706f 7365 4573 7365 6e74 6961 6c4d 6174 poseEssentialMat │ │ │ +000a11b0: 206f 7220 2372 6563 6f76 6572 506f 7365 or #recoverPose │ │ │ +000a11c0: 2074 6f20 7265 636f 7665 7220 7468 6520 to recover the │ │ │ +000a11d0: 7265 6c61 7469 7665 2070 6f73 6520 6265 relative pose be │ │ │ +000a11e0: 7477 6565 6e20 6361 6d65 7261 732e 3c2f tween cameras..
    Returns: │ │ │ +000a1200: 3c2f 6474 3e0a 3c64 643e 6175 746f 6d61
    .
    automa │ │ │ +000a1210: 7469 6361 6c6c 7920 6765 6e65 7261 7465 tically generate │ │ │ +000a1220: 643c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 d
    .
    ..

    .< │ │ │ +000a1240: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    fi │ │ │ +000a12c0: 6e64 4573 7365 6e74 6961 6c4d 6174 3c2f ndEssentialMat.
    .
    public │ │ │ +000a1330: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +000a1340: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;Mat findEss │ │ │ +000a13d0: 656e 7469 616c 4d61 743c 2f73 7061 6e3e entialMat │ │ │ +000a13e0: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ +000a1400: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000a1410: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000a1420: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000a1430: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat points1, │ │ │ +000a1450: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000a1490: 743c 2f61 3e26 6e62 7370 3b70 6f69 6e74 t point │ │ │ +000a14a0: 7332 2c0a 203c 6120 6872 6566 3d22 2e2e s2,. Mat ca │ │ │ +000a14f0: 6d65 7261 4d61 7472 6978 2c0a 2069 6e74 meraMatrix,. int │ │ │ +000a1500: 266e 6273 703b 6d65 7468 6f64 293c 2f73  method)
    .
    Ca │ │ │ +000a1530: 6c63 756c 6174 6573 2061 6e20 6573 7365 lculates an esse │ │ │ +000a1540: 6e74 6961 6c20 6d61 7472 6978 2066 726f ntial matrix fro │ │ │ +000a1550: 6d20 7468 6520 636f 7272 6573 706f 6e64 m the correspond │ │ │ +000a1560: 696e 6720 706f 696e 7473 2069 6e20 7477 ing points in tw │ │ │ +000a1570: 6f20 696d 6167 6573 2e3c 2f64 6976 3e0a o images.
    . │ │ │ +000a1580: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ +000a15a0: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    points1 │ │ │ +000a15c0: 202d 2041 7272 6179 206f 6620 4e20 284e - Array of N (N │ │ │ +000a15d0: 2026 6774 3b3d 2035 2920 3244 2070 6f69 >= 5) 2D poi │ │ │ +000a15e0: 6e74 7320 6672 6f6d 2074 6865 2066 6972 nts from the fir │ │ │ +000a15f0: 7374 2069 6d61 6765 2e20 5468 6520 706f st image. The po │ │ │ +000a1600: 696e 7420 636f 6f72 6469 6e61 7465 7320 int coordinates │ │ │ +000a1610: 7368 6f75 6c64 0a62 6520 666c 6f61 7469 should.be floati │ │ │ +000a1620: 6e67 2d70 6f69 6e74 2028 7369 6e67 6c65 ng-point (single │ │ │ +000a1630: 206f 7220 646f 7562 6c65 2070 7265 6369 or double preci │ │ │ +000a1640: 7369 6f6e 292e 3c2f 6464 3e0a 3c64 643e sion).
    .
    │ │ │ +000a1650: 3c63 6f64 653e 706f 696e 7473 323c 2f63 points2 - Array of │ │ │ +000a1670: 7468 6520 7365 636f 6e64 2069 6d61 6765 the second image │ │ │ +000a1680: 2070 6f69 6e74 7320 6f66 2074 6865 2073 points of the s │ │ │ +000a1690: 616d 6520 7369 7a65 2061 6e64 2066 6f72 ame size and for │ │ │ +000a16a0: 6d61 7420 6173 2070 6f69 6e74 7331 2e3c mat as points1.< │ │ │ +000a16b0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ +000a16c0: 616d 6572 614d 6174 7269 783c 2f63 6f64 ameraMatrix - Camera intr │ │ │ +000a16e0: 696e 7369 6320 6d61 7472 6978 205c 285c insic matrix \(\ │ │ │ +000a16f0: 6361 6d65 7261 6d61 7472 6978 7b41 7d5c cameramatrix{A}\ │ │ │ +000a1700: 2920 2e0a 4e6f 7465 2074 6861 7420 7468 ) ..Note that th │ │ │ +000a1710: 6973 2066 756e 6374 696f 6e20 6173 7375 is function assu │ │ │ +000a1720: 6d65 7320 7468 6174 2070 6f69 6e74 7331 mes that points1 │ │ │ +000a1730: 2061 6e64 2070 6f69 6e74 7332 2061 7265 and points2 are │ │ │ +000a1740: 2066 6561 7475 7265 2070 6f69 6e74 7320 feature points │ │ │ +000a1750: 6672 6f6d 2063 616d 6572 6173 2077 6974 from cameras wit │ │ │ +000a1760: 6820 7468 650a 7361 6d65 2063 616d 6572 h the.same camer │ │ │ +000a1770: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ +000a1780: 6978 2e20 4966 2074 6869 7320 6173 7375 ix. If this assu │ │ │ +000a1790: 6d70 7469 6f6e 2064 6f65 7320 6e6f 7420 mption does not │ │ │ +000a17a0: 686f 6c64 2066 6f72 2079 6f75 7220 7573 hold for your us │ │ │ +000a17b0: 6520 6361 7365 2c20 7573 6520 616e 6f74 e case, use anot │ │ │ +000a17c0: 6865 720a 6675 6e63 7469 6f6e 206f 7665 her.function ove │ │ │ +000a17d0: 726c 6f61 6420 6f72 2023 756e 6469 7374 rload or #undist │ │ │ +000a17e0: 6f72 7450 6f69 6e74 7320 7769 7468 203c ortPoints with < │ │ │ +000a17f0: 636f 6465 3e50 203d 2063 763a 3a4e 6f41 code>P = cv::NoA │ │ │ +000a1800: 7272 6179 2829 3c2f 636f 6465 3e20 666f rray() fo │ │ │ +000a1810: 7220 626f 7468 2063 616d 6572 6173 2074 r both cameras t │ │ │ +000a1820: 6f20 7472 616e 7366 6f72 6d20 696d 6167 o transform imag │ │ │ +000a1830: 650a 706f 696e 7473 2074 6f20 6e6f 726d e.points to norm │ │ │ +000a1840: 616c 697a 6564 2069 6d61 6765 2063 6f6f alized image coo │ │ │ +000a1850: 7264 696e 6174 6573 2c20 7768 6963 6820 rdinates, which │ │ │ +000a1860: 6172 6520 7661 6c69 6420 666f 7220 7468 are valid for th │ │ │ +000a1870: 6520 6964 656e 7469 7479 2063 616d 6572 e identity camer │ │ │ +000a1880: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ +000a1890: 6978 2e0a 5768 656e 2070 6173 7369 6e67 ix..When passing │ │ │ +000a18a0: 2074 6865 7365 2063 6f6f 7264 696e 6174 these coordinat │ │ │ +000a18b0: 6573 2c20 7061 7373 2074 6865 2069 6465 es, pass the ide │ │ │ +000a18c0: 6e74 6974 7920 6d61 7472 6978 2066 6f72 ntity matrix for │ │ │ +000a18d0: 2074 6869 7320 7061 7261 6d65 7465 722e this parameter. │ │ │ +000a18e0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000a18f0: 6d65 7468 6f64 3c2f 636f 6465 3e20 2d20 method - │ │ │ +000a1900: 4d65 7468 6f64 2066 6f72 2063 6f6d 7075 Method for compu │ │ │ +000a1910: 7469 6e67 2061 6e20 6573 7365 6e74 6961 ting an essentia │ │ │ +000a1920: 6c20 6d61 7472 6978 2e0a 3c75 6c3e 0a20 l matrix..
      . │ │ │ +000a1930: 203c 6c69 3e0a 2020 2052 4546 3a20 5241
    • . REF: RA │ │ │ +000a1940: 4e53 4143 2066 6f72 2074 6865 2052 414e NSAC for the RAN │ │ │ +000a1950: 5341 4320 616c 676f 7269 7468 6d2e 0a20 SAC algorithm.. │ │ │ +000a1960: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020
    • .
    • . │ │ │ +000a1970: 2052 4546 3a20 4c4d 4544 5320 666f 7220 REF: LMEDS for │ │ │ +000a1980: 7468 6520 4c4d 6564 5320 616c 676f 7269 the LMedS algori │ │ │ +000a1990: 7468 6d2e 0a20 203c 2f6c 693e 0a3c 2f75 thm..
    • .
      .confidence (p │ │ │ +000a19b0: 726f 6261 6269 6c69 7479 2920 7468 6174 robability) that │ │ │ +000a19c0: 2074 6865 2065 7374 696d 6174 6564 206d the estimated m │ │ │ +000a19d0: 6174 7269 7820 6973 2063 6f72 7265 6374 atrix is correct │ │ │ +000a19e0: 2e0a 6c69 6e65 2069 6e20 7069 7865 6c73 ..line in pixels │ │ │ +000a19f0: 2c20 6265 796f 6e64 2077 6869 6368 2074 , beyond which t │ │ │ +000a1a00: 6865 2070 6f69 6e74 2069 7320 636f 6e73 he point is cons │ │ │ +000a1a10: 6964 6572 6564 2061 6e20 6f75 746c 6965 idered an outlie │ │ │ +000a1a20: 7220 616e 6420 6973 206e 6f74 2075 7365 r and is not use │ │ │ +000a1a30: 6420 666f 7220 636f 6d70 7574 696e 6720 d for computing │ │ │ +000a1a40: 7468 650a 6669 6e61 6c20 6675 6e64 616d the.final fundam │ │ │ +000a1a50: 656e 7461 6c20 6d61 7472 6978 2e20 4974 ental matrix. It │ │ │ +000a1a60: 2063 616e 2062 6520 7365 7420 746f 2073 can be set to s │ │ │ +000a1a70: 6f6d 6574 6869 6e67 206c 696b 6520 312d omething like 1- │ │ │ +000a1a80: 332c 2064 6570 656e 6469 6e67 206f 6e20 3, depending on │ │ │ +000a1a90: 7468 6520 6163 6375 7261 6379 206f 6620 the accuracy of │ │ │ +000a1aa0: 7468 650a 706f 696e 7420 6c6f 6361 6c69 the.point locali │ │ │ +000a1ab0: 7a61 7469 6f6e 2c20 696d 6167 6520 7265 zation, image re │ │ │ +000a1ac0: 736f 6c75 7469 6f6e 2c20 616e 6420 7468 solution, and th │ │ │ +000a1ad0: 6520 696d 6167 6520 6e6f 6973 652e 0a66 e image noise..f │ │ │ +000a1ae0: 6f72 2074 6865 206f 7468 6572 2070 6f69 or the other poi │ │ │ +000a1af0: 6e74 732e 2054 6865 2061 7272 6179 2069 nts. The array i │ │ │ +000a1b00: 7320 636f 6d70 7574 6564 206f 6e6c 7920 s computed only │ │ │ +000a1b10: 696e 2074 6865 2052 414e 5341 4320 616e in the RANSAC an │ │ │ +000a1b20: 6420 4c4d 6564 5320 6d65 7468 6f64 732e d LMedS methods. │ │ │ +000a1b30: 0a0a 5468 6973 2066 756e 6374 696f 6e20 ..This function │ │ │ +000a1b40: 6573 7469 6d61 7465 7320 6573 7365 6e74 estimates essent │ │ │ +000a1b50: 6961 6c20 6d61 7472 6978 2062 6173 6564 ial matrix based │ │ │ +000a1b60: 206f 6e20 7468 6520 6669 7665 2d70 6f69 on the five-poi │ │ │ +000a1b70: 6e74 2061 6c67 6f72 6974 686d 2073 6f6c nt algorithm sol │ │ │ +000a1b80: 7665 7220 696e 2043 4954 453a 204e 6973 ver in CITE: Nis │ │ │ +000a1b90: 7465 7230 3320 2e0a 4349 5445 3a20 5374 ter03 ..CITE: St │ │ │ +000a1ba0: 6577 656e 6975 7343 4653 2069 7320 616c eweniusCFS is al │ │ │ +000a1bb0: 736f 2061 2072 656c 6174 6564 2e20 5468 so a related. Th │ │ │ +000a1bc0: 6520 6570 6970 6f6c 6172 2067 656f 6d65 e epipolar geome │ │ │ +000a1bd0: 7472 7920 6973 2064 6573 6372 6962 6564 try is described │ │ │ +000a1be0: 2062 7920 7468 6520 666f 6c6c 6f77 696e by the followin │ │ │ +000a1bf0: 6720 6571 7561 7469 6f6e 3a0a 0a5c 285b g equation:..\([ │ │ │ +000a1c00: 705f 323b 2031 5d5e 5420 4b5e 7b2d 547d p_2; 1]^T K^{-T} │ │ │ +000a1c10: 2045 204b 5e7b 2d31 7d20 5b70 5f31 3b20 E K^{-1} [p_1; │ │ │ +000a1c20: 315d 203d 2030 5c29 0a0a 7768 6572 6520 1] = 0\)..where │ │ │ +000a1c30: 5c28 455c 2920 6973 2061 6e20 6573 7365 \(E\) is an esse │ │ │ +000a1c40: 6e74 6961 6c20 6d61 7472 6978 2c20 5c28 ntial matrix, \( │ │ │ +000a1c50: 705f 315c 2920 616e 6420 5c28 705f 325c p_1\) and \(p_2\ │ │ │ +000a1c60: 2920 6172 6520 636f 7272 6573 706f 6e64 ) are correspond │ │ │ +000a1c70: 696e 6720 706f 696e 7473 2069 6e20 7468 ing points in th │ │ │ +000a1c80: 6520 6669 7273 7420 616e 6420 7468 650a e first and the. │ │ │ +000a1c90: 7365 636f 6e64 2069 6d61 6765 732c 2072 second images, r │ │ │ +000a1ca0: 6573 7065 6374 6976 656c 792e 2054 6865 espectively. The │ │ │ +000a1cb0: 2072 6573 756c 7420 6f66 2074 6869 7320 result of this │ │ │ +000a1cc0: 6675 6e63 7469 6f6e 206d 6179 2062 6520 function may be │ │ │ +000a1cd0: 7061 7373 6564 2066 7572 7468 6572 2074 passed further t │ │ │ +000a1ce0: 6f0a 2364 6563 6f6d 706f 7365 4573 7365 o.#decomposeEsse │ │ │ +000a1cf0: 6e74 6961 6c4d 6174 206f 7220 2372 6563 ntialMat or #rec │ │ │ +000a1d00: 6f76 6572 506f 7365 2074 6f20 7265 636f overPose to reco │ │ │ +000a1d10: 7665 7220 7468 6520 7265 6c61 7469 7665 ver the relative │ │ │ +000a1d20: 2070 6f73 6520 6265 7477 6565 6e20 6361 pose between ca │ │ │ +000a1d30: 6d65 7261 732e 3c2f 6464 3e0a 3c64 743e meras.
    .
    │ │ │ +000a1d40: 5265 7475 726e 733a 3c2f 6474 3e0a 3c64 Returns:
    .automatically │ │ │ +000a1d60: 6765 6e65 7261 7465 643c 2f64 643e 0a3c generated.< │ │ │ +000a1d70: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ..

  • .
  • .
    .findEssentialM │ │ │ +000a1e10: 6174 3c2f 6833 3e0a 3c64 6976 2063 6c61 at.
    .
    pu │ │ │ +000a1e70: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static Ma │ │ │ +000a1ee0: 743c 2f61 3e3c 2f73 7061 6e3e 266e 6273 t&nbs │ │ │ +000a1ef0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;fin │ │ │ +000a1f10: 6445 7373 656e 7469 616c 4d61 743c 2f73 dEssentialMat(M │ │ │ +000a1f80: 6174 3c2f 613e 266e 6273 703b 706f 696e at poin │ │ │ +000a1f90: 7473 312c 0a20 3c61 2068 7265 663d 222e ts1,. Mat p │ │ │ +000a1fe0: 6f69 6e74 7332 2c0a 203c 6120 6872 6566 oints2,. Mat&nbs │ │ │ +000a2030: 703b 6361 6d65 7261 4d61 7472 6978 293c p;cameraMatrix)< │ │ │ +000a2040: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ +000a2060: 4361 6c63 756c 6174 6573 2061 6e20 6573 Calculates an es │ │ │ +000a2070: 7365 6e74 6961 6c20 6d61 7472 6978 2066 sential matrix f │ │ │ +000a2080: 726f 6d20 7468 6520 636f 7272 6573 706f rom the correspo │ │ │ +000a2090: 6e64 696e 6720 706f 696e 7473 2069 6e20 nding points in │ │ │ +000a20a0: 7477 6f20 696d 6167 6573 2e3c 2f64 6976 two images.
    .
    .
    Paramet │ │ │ +000a20d0: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    points1 - Array of N │ │ │ +000a2100: 284e 2026 6774 3b3d 2035 2920 3244 2070 (N >= 5) 2D p │ │ │ +000a2110: 6f69 6e74 7320 6672 6f6d 2074 6865 2066 oints from the f │ │ │ +000a2120: 6972 7374 2069 6d61 6765 2e20 5468 6520 irst image. The │ │ │ +000a2130: 706f 696e 7420 636f 6f72 6469 6e61 7465 point coordinate │ │ │ +000a2140: 7320 7368 6f75 6c64 0a62 6520 666c 6f61 s should.be floa │ │ │ +000a2150: 7469 6e67 2d70 6f69 6e74 2028 7369 6e67 ting-point (sing │ │ │ +000a2160: 6c65 206f 7220 646f 7562 6c65 2070 7265 le or double pre │ │ │ +000a2170: 6369 7369 6f6e 292e 3c2f 6464 3e0a 3c64 cision).
    .points2< │ │ │ +000a2190: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ +000a21a0: 6620 7468 6520 7365 636f 6e64 2069 6d61 f the second ima │ │ │ +000a21b0: 6765 2070 6f69 6e74 7320 6f66 2074 6865 ge points of the │ │ │ +000a21c0: 2073 616d 6520 7369 7a65 2061 6e64 2066 same size and f │ │ │ +000a21d0: 6f72 6d61 7420 6173 2070 6f69 6e74 7331 ormat as points1 │ │ │ +000a21e0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 ..
    cameraMatrix - Camera in │ │ │ +000a2210: 7472 696e 7369 6320 6d61 7472 6978 205c trinsic matrix \ │ │ │ +000a2220: 285c 6361 6d65 7261 6d61 7472 6978 7b41 (\cameramatrix{A │ │ │ +000a2230: 7d5c 2920 2e0a 4e6f 7465 2074 6861 7420 }\) ..Note that │ │ │ +000a2240: 7468 6973 2066 756e 6374 696f 6e20 6173 this function as │ │ │ +000a2250: 7375 6d65 7320 7468 6174 2070 6f69 6e74 sumes that point │ │ │ +000a2260: 7331 2061 6e64 2070 6f69 6e74 7332 2061 s1 and points2 a │ │ │ +000a2270: 7265 2066 6561 7475 7265 2070 6f69 6e74 re feature point │ │ │ +000a2280: 7320 6672 6f6d 2063 616d 6572 6173 2077 s from cameras w │ │ │ +000a2290: 6974 6820 7468 650a 7361 6d65 2063 616d ith the.same cam │ │ │ +000a22a0: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +000a22b0: 7472 6978 2e20 4966 2074 6869 7320 6173 trix. If this as │ │ │ +000a22c0: 7375 6d70 7469 6f6e 2064 6f65 7320 6e6f sumption does no │ │ │ +000a22d0: 7420 686f 6c64 2066 6f72 2079 6f75 7220 t hold for your │ │ │ +000a22e0: 7573 6520 6361 7365 2c20 7573 6520 616e use case, use an │ │ │ +000a22f0: 6f74 6865 720a 6675 6e63 7469 6f6e 206f other.function o │ │ │ +000a2300: 7665 726c 6f61 6420 6f72 2023 756e 6469 verload or #undi │ │ │ +000a2310: 7374 6f72 7450 6f69 6e74 7320 7769 7468 stortPoints with │ │ │ +000a2320: 203c 636f 6465 3e50 203d 2063 763a 3a4e P = cv::N │ │ │ +000a2330: 6f41 7272 6179 2829 3c2f 636f 6465 3e20 oArray() │ │ │ +000a2340: 666f 7220 626f 7468 2063 616d 6572 6173 for both cameras │ │ │ +000a2350: 2074 6f20 7472 616e 7366 6f72 6d20 696d to transform im │ │ │ +000a2360: 6167 650a 706f 696e 7473 2074 6f20 6e6f age.points to no │ │ │ +000a2370: 726d 616c 697a 6564 2069 6d61 6765 2063 rmalized image c │ │ │ +000a2380: 6f6f 7264 696e 6174 6573 2c20 7768 6963 oordinates, whic │ │ │ +000a2390: 6820 6172 6520 7661 6c69 6420 666f 7220 h are valid for │ │ │ +000a23a0: 7468 6520 6964 656e 7469 7479 2063 616d the identity cam │ │ │ +000a23b0: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +000a23c0: 7472 6978 2e0a 5768 656e 2070 6173 7369 trix..When passi │ │ │ +000a23d0: 6e67 2074 6865 7365 2063 6f6f 7264 696e ng these coordin │ │ │ +000a23e0: 6174 6573 2c20 7061 7373 2074 6865 2069 ates, pass the i │ │ │ +000a23f0: 6465 6e74 6974 7920 6d61 7472 6978 2066 dentity matrix f │ │ │ +000a2400: 6f72 2074 6869 7320 7061 7261 6d65 7465 or this paramete │ │ │ +000a2410: 722e 0a3c 756c 3e0a 2020 3c6c 693e 0a20 r..
      .
    • . │ │ │ +000a2420: 2020 5245 463a 2052 414e 5341 4320 666f REF: RANSAC fo │ │ │ +000a2430: 7220 7468 6520 5241 4e53 4143 2061 6c67 r the RANSAC alg │ │ │ +000a2440: 6f72 6974 686d 2e0a 2020 3c2f 6c69 3e0a orithm..
    • . │ │ │ +000a2450: 2020 3c6c 693e 0a20 2020 5245 463a 204c
    • . REF: L │ │ │ +000a2460: 4d45 4453 2066 6f72 2074 6865 204c 4d65 MEDS for the LMe │ │ │ +000a2470: 6453 2061 6c67 6f72 6974 686d 2e0a 2020 dS algorithm.. │ │ │ +000a2480: 3c2f 6c69 3e0a 3c2f 756c 3e0a 636f 6e66
    • .
    .conf │ │ │ +000a2490: 6964 656e 6365 2028 7072 6f62 6162 696c idence (probabil │ │ │ +000a24a0: 6974 7929 2074 6861 7420 7468 6520 6573 ity) that the es │ │ │ +000a24b0: 7469 6d61 7465 6420 6d61 7472 6978 2069 timated matrix i │ │ │ +000a24c0: 7320 636f 7272 6563 742e 0a6c 696e 6520 s correct..line │ │ │ +000a24d0: 696e 2070 6978 656c 732c 2062 6579 6f6e in pixels, beyon │ │ │ +000a24e0: 6420 7768 6963 6820 7468 6520 706f 696e d which the poin │ │ │ +000a24f0: 7420 6973 2063 6f6e 7369 6465 7265 6420 t is considered │ │ │ +000a2500: 616e 206f 7574 6c69 6572 2061 6e64 2069 an outlier and i │ │ │ +000a2510: 7320 6e6f 7420 7573 6564 2066 6f72 2063 s not used for c │ │ │ +000a2520: 6f6d 7075 7469 6e67 2074 6865 0a66 696e omputing the.fin │ │ │ +000a2530: 616c 2066 756e 6461 6d65 6e74 616c 206d al fundamental m │ │ │ +000a2540: 6174 7269 782e 2049 7420 6361 6e20 6265 atrix. It can be │ │ │ +000a2550: 2073 6574 2074 6f20 736f 6d65 7468 696e set to somethin │ │ │ +000a2560: 6720 6c69 6b65 2031 2d33 2c20 6465 7065 g like 1-3, depe │ │ │ +000a2570: 6e64 696e 6720 6f6e 2074 6865 2061 6363 nding on the acc │ │ │ +000a2580: 7572 6163 7920 6f66 2074 6865 0a70 6f69 uracy of the.poi │ │ │ +000a2590: 6e74 206c 6f63 616c 697a 6174 696f 6e2c nt localization, │ │ │ +000a25a0: 2069 6d61 6765 2072 6573 6f6c 7574 696f image resolutio │ │ │ +000a25b0: 6e2c 2061 6e64 2074 6865 2069 6d61 6765 n, and the image │ │ │ +000a25c0: 206e 6f69 7365 2e0a 666f 7220 7468 6520 noise..for the │ │ │ +000a25d0: 6f74 6865 7220 706f 696e 7473 2e20 5468 other points. Th │ │ │ +000a25e0: 6520 6172 7261 7920 6973 2063 6f6d 7075 e array is compu │ │ │ +000a25f0: 7465 6420 6f6e 6c79 2069 6e20 7468 6520 ted only in the │ │ │ +000a2600: 5241 4e53 4143 2061 6e64 204c 4d65 6453 RANSAC and LMedS │ │ │ +000a2610: 206d 6574 686f 6473 2e0a 0a54 6869 7320 methods...This │ │ │ +000a2620: 6675 6e63 7469 6f6e 2065 7374 696d 6174 function estimat │ │ │ +000a2630: 6573 2065 7373 656e 7469 616c 206d 6174 es essential mat │ │ │ +000a2640: 7269 7820 6261 7365 6420 6f6e 2074 6865 rix based on the │ │ │ +000a2650: 2066 6976 652d 706f 696e 7420 616c 676f five-point algo │ │ │ +000a2660: 7269 7468 6d20 736f 6c76 6572 2069 6e20 rithm solver in │ │ │ +000a2670: 4349 5445 3a20 4e69 7374 6572 3033 202e CITE: Nister03 . │ │ │ +000a2680: 0a43 4954 453a 2053 7465 7765 6e69 7573 .CITE: Stewenius │ │ │ +000a2690: 4346 5320 6973 2061 6c73 6f20 6120 7265 CFS is also a re │ │ │ +000a26a0: 6c61 7465 642e 2054 6865 2065 7069 706f lated. The epipo │ │ │ +000a26b0: 6c61 7220 6765 6f6d 6574 7279 2069 7320 lar geometry is │ │ │ +000a26c0: 6465 7363 7269 6265 6420 6279 2074 6865 described by the │ │ │ +000a26d0: 2066 6f6c 6c6f 7769 6e67 2065 7175 6174 following equat │ │ │ +000a26e0: 696f 6e3a 0a0a 5c28 5b70 5f32 3b20 315d ion:..\([p_2; 1] │ │ │ +000a26f0: 5e54 204b 5e7b 2d54 7d20 4520 4b5e 7b2d ^T K^{-T} E K^{- │ │ │ +000a2700: 317d 205b 705f 313b 2031 5d20 3d20 305c 1} [p_1; 1] = 0\ │ │ │ +000a2710: 290a 0a77 6865 7265 205c 2845 5c29 2069 )..where \(E\) i │ │ │ +000a2720: 7320 616e 2065 7373 656e 7469 616c 206d s an essential m │ │ │ +000a2730: 6174 7269 782c 205c 2870 5f31 5c29 2061 atrix, \(p_1\) a │ │ │ +000a2740: 6e64 205c 2870 5f32 5c29 2061 7265 2063 nd \(p_2\) are c │ │ │ +000a2750: 6f72 7265 7370 6f6e 6469 6e67 2070 6f69 orresponding poi │ │ │ +000a2760: 6e74 7320 696e 2074 6865 2066 6972 7374 nts in the first │ │ │ +000a2770: 2061 6e64 2074 6865 0a73 6563 6f6e 6420 and the.second │ │ │ +000a2780: 696d 6167 6573 2c20 7265 7370 6563 7469 images, respecti │ │ │ +000a2790: 7665 6c79 2e20 5468 6520 7265 7375 6c74 vely. The result │ │ │ +000a27a0: 206f 6620 7468 6973 2066 756e 6374 696f of this functio │ │ │ +000a27b0: 6e20 6d61 7920 6265 2070 6173 7365 6420 n may be passed │ │ │ +000a27c0: 6675 7274 6865 7220 746f 0a23 6465 636f further to.#deco │ │ │ +000a27d0: 6d70 6f73 6545 7373 656e 7469 616c 4d61 mposeEssentialMa │ │ │ +000a27e0: 7420 6f72 2023 7265 636f 7665 7250 6f73 t or #recoverPos │ │ │ +000a27f0: 6520 746f 2072 6563 6f76 6572 2074 6865 e to recover the │ │ │ +000a2800: 2072 656c 6174 6976 6520 706f 7365 2062 relative pose b │ │ │ +000a2810: 6574 7765 656e 2063 616d 6572 6173 2e3c etween cameras.< │ │ │ +000a2820: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ +000a2830: 3a3c 2f64 743e 0a3c 6464 3e61 7574 6f6d :
    .
    autom │ │ │ +000a2840: 6174 6963 616c 6c79 2067 656e 6572 6174 atically generat │ │ │ +000a2850: 6564 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f ed
    .
    ..
    . │ │ │ +000a2870: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..

    fi │ │ │ +000a2920: 6e64 4573 7365 6e74 6961 6c4d 6174 3c2f ndEssentialMat.
    .
    public │ │ │ +000a2990: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +000a29a0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;Mat findEss │ │ │ +000a2a30: 656e 7469 616c 4d61 743c 2f73 7061 6e3e entialMat │ │ │ +000a2a40: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ +000a2a60: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000a2a70: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000a2a80: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000a2a90: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat points1, │ │ │ +000a2ab0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000a2af0: 743c 2f61 3e26 6e62 7370 3b70 6f69 6e74 t point │ │ │ +000a2b00: 7332 2c0a 2064 6f75 626c 6526 6e62 7370 s2,. double  │ │ │ +000a2b10: 3b66 6f63 616c 2c0a 203c 6120 6872 6566 ;focal,. Point │ │ │ +000a2b60: 266e 6273 703b 7070 2c0a 2069 6e74 266e  pp,. int&n │ │ │ +000a2b70: 6273 703b 6d65 7468 6f64 2c0a 2064 6f75 bsp;method,. dou │ │ │ +000a2b80: 626c 6526 6e62 7370 3b70 726f 622c 0a20 ble prob,. │ │ │ +000a2b90: 646f 7562 6c65 266e 6273 703b 7468 7265 double thre │ │ │ +000a2ba0: 7368 6f6c 642c 0a20 696e 7426 6e62 7370 shold,. int  │ │ │ +000a2bb0: 3b6d 6178 4974 6572 732c 0a20 3c61 2068 ;maxIters,. Mat& │ │ │ +000a2c00: 6e62 7370 3b6d 6173 6b29 3c2f 7370 616e nbsp;mask)
    .
    .
    P │ │ │ +000a2c30: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ +000a2c40: 3c64 643e 3c63 6f64 653e 706f 696e 7473
    points │ │ │ +000a2c50: 313c 2f63 6f64 653e 202d 2041 7272 6179 1 - Array │ │ │ +000a2c60: 206f 6620 4e20 284e 2026 6774 3b3d 2035 of N (N >= 5 │ │ │ +000a2c70: 2920 3244 2070 6f69 6e74 7320 6672 6f6d ) 2D points from │ │ │ +000a2c80: 2074 6865 2066 6972 7374 2069 6d61 6765 the first image │ │ │ +000a2c90: 2e20 5468 6520 706f 696e 7420 636f 6f72 . The point coor │ │ │ +000a2ca0: 6469 6e61 7465 7320 7368 6f75 6c64 0a62 dinates should.b │ │ │ +000a2cb0: 6520 666c 6f61 7469 6e67 2d70 6f69 6e74 e floating-point │ │ │ +000a2cc0: 2028 7369 6e67 6c65 206f 7220 646f 7562 (single or doub │ │ │ +000a2cd0: 6c65 2070 7265 6369 7369 6f6e 292e 3c2f le precision)..
    po │ │ │ +000a2cf0: 696e 7473 323c 2f63 6f64 653e 202d 2041 ints2 - A │ │ │ +000a2d00: 7272 6179 206f 6620 7468 6520 7365 636f rray of the seco │ │ │ +000a2d10: 6e64 2069 6d61 6765 2070 6f69 6e74 7320 nd image points │ │ │ +000a2d20: 6f66 2074 6865 2073 616d 6520 7369 7a65 of the same size │ │ │ +000a2d30: 2061 6e64 2066 6f72 6d61 7420 6173 2070 and format as p │ │ │ +000a2d40: 6f69 6e74 7331 202e 3c2f 6464 3e0a 3c64 oints1 .
    .focal - focal len │ │ │ +000a2d70: 6774 6820 6f66 2074 6865 2063 616d 6572 gth of the camer │ │ │ +000a2d80: 612e 204e 6f74 6520 7468 6174 2074 6869 a. Note that thi │ │ │ +000a2d90: 7320 6675 6e63 7469 6f6e 2061 7373 756d s function assum │ │ │ +000a2da0: 6573 2074 6861 7420 706f 696e 7473 3120 es that points1 │ │ │ +000a2db0: 616e 6420 706f 696e 7473 320a 6172 6520 and points2.are │ │ │ +000a2dc0: 6665 6174 7572 6520 706f 696e 7473 2066 feature points f │ │ │ +000a2dd0: 726f 6d20 6361 6d65 7261 7320 7769 7468 rom cameras with │ │ │ +000a2de0: 2073 616d 6520 666f 6361 6c20 6c65 6e67 same focal leng │ │ │ +000a2df0: 7468 2061 6e64 2070 7269 6e63 6970 616c th and principal │ │ │ +000a2e00: 2070 6f69 6e74 2e3c 2f64 643e 0a3c 6464 point..
    pp │ │ │ +000a2e20: 202d 2070 7269 6e63 6970 616c 2070 6f69 - principal poi │ │ │ +000a2e30: 6e74 206f 6620 7468 6520 6361 6d65 7261 nt of the camera │ │ │ +000a2e40: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    method - │ │ │ +000a2e60: 204d 6574 686f 6420 666f 7220 636f 6d70 Method for comp │ │ │ +000a2e70: 7574 696e 6720 6120 6675 6e64 616d 656e uting a fundamen │ │ │ +000a2e80: 7461 6c20 6d61 7472 6978 2e0a 3c75 6c3e tal matrix..
      │ │ │ +000a2e90: 0a20 203c 6c69 3e0a 2020 2052 4546 3a20 .
    • . REF: │ │ │ +000a2ea0: 5241 4e53 4143 2066 6f72 2074 6865 2052 RANSAC for the R │ │ │ +000a2eb0: 414e 5341 4320 616c 676f 7269 7468 6d2e ANSAC algorithm. │ │ │ +000a2ec0: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ +000a2ed0: 2020 2052 4546 3a20 4c4d 4544 5320 666f REF: LMEDS fo │ │ │ +000a2ee0: 7220 7468 6520 4c4d 6564 5320 616c 676f r the LMedS algo │ │ │ +000a2ef0: 7269 7468 6d2e 0a20 203c 2f6c 693e 0a3c rithm..
    • .< │ │ │ +000a2f00: 2f75 6c3e 3c2f 6464 3e0a 3c64 643e 3c63 /ul>
    .
    prob │ │ │ +000a2f20: 2d20 5061 7261 6d65 7465 7220 7573 6564 - Parameter used │ │ │ +000a2f30: 2066 6f72 2074 6865 2052 414e 5341 4320 for the RANSAC │ │ │ +000a2f40: 6f72 204c 4d65 6453 206d 6574 686f 6473 or LMedS methods │ │ │ +000a2f50: 206f 6e6c 792e 2049 7420 7370 6563 6966 only. It specif │ │ │ +000a2f60: 6965 7320 6120 6465 7369 7261 626c 6520 ies a desirable │ │ │ +000a2f70: 6c65 7665 6c20 6f66 0a63 6f6e 6669 6465 level of.confide │ │ │ +000a2f80: 6e63 6520 2870 726f 6261 6269 6c69 7479 nce (probability │ │ │ +000a2f90: 2920 7468 6174 2074 6865 2065 7374 696d ) that the estim │ │ │ +000a2fa0: 6174 6564 206d 6174 7269 7820 6973 2063 ated matrix is c │ │ │ +000a2fb0: 6f72 7265 6374 2e3c 2f64 643e 0a3c 6464 orrect.
    .
    threshold │ │ │ +000a2fd0: 3c2f 636f 6465 3e20 2d20 5061 7261 6d65 - Parame │ │ │ +000a2fe0: 7465 7220 7573 6564 2066 6f72 2052 414e ter used for RAN │ │ │ +000a2ff0: 5341 432e 2049 7420 6973 2074 6865 206d SAC. It is the m │ │ │ +000a3000: 6178 696d 756d 2064 6973 7461 6e63 6520 aximum distance │ │ │ +000a3010: 6672 6f6d 2061 2070 6f69 6e74 2074 6f20 from a point to │ │ │ +000a3020: 616e 2065 7069 706f 6c61 720a 6c69 6e65 an epipolar.line │ │ │ +000a3030: 2069 6e20 7069 7865 6c73 2c20 6265 796f in pixels, beyo │ │ │ +000a3040: 6e64 2077 6869 6368 2074 6865 2070 6f69 nd which the poi │ │ │ +000a3050: 6e74 2069 7320 636f 6e73 6964 6572 6564 nt is considered │ │ │ +000a3060: 2061 6e20 6f75 746c 6965 7220 616e 6420 an outlier and │ │ │ +000a3070: 6973 206e 6f74 2075 7365 6420 666f 7220 is not used for │ │ │ +000a3080: 636f 6d70 7574 696e 6720 7468 650a 6669 computing the.fi │ │ │ +000a3090: 6e61 6c20 6675 6e64 616d 656e 7461 6c20 nal fundamental │ │ │ +000a30a0: 6d61 7472 6978 2e20 4974 2063 616e 2062 matrix. It can b │ │ │ +000a30b0: 6520 7365 7420 746f 2073 6f6d 6574 6869 e set to somethi │ │ │ +000a30c0: 6e67 206c 696b 6520 312d 332c 2064 6570 ng like 1-3, dep │ │ │ +000a30d0: 656e 6469 6e67 206f 6e20 7468 6520 6163 ending on the ac │ │ │ +000a30e0: 6375 7261 6379 206f 6620 7468 650a 706f curacy of the.po │ │ │ +000a30f0: 696e 7420 6c6f 6361 6c69 7a61 7469 6f6e int localization │ │ │ +000a3100: 2c20 696d 6167 6520 7265 736f 6c75 7469 , image resoluti │ │ │ +000a3110: 6f6e 2c20 616e 6420 7468 6520 696d 6167 on, and the imag │ │ │ +000a3120: 6520 6e6f 6973 652e 3c2f 6464 3e0a 3c64 e noise.
    .maxIters │ │ │ +000a3140: 3c2f 636f 6465 3e20 2d20 5468 6520 6d61 - The ma │ │ │ +000a3150: 7869 6d75 6d20 6e75 6d62 6572 206f 6620 ximum number of │ │ │ +000a3160: 726f 6275 7374 206d 6574 686f 6420 6974 robust method it │ │ │ +000a3170: 6572 6174 696f 6e73 2e0a 0a54 6869 7320 erations...This │ │ │ +000a3180: 6675 6e63 7469 6f6e 2064 6966 6665 7273 function differs │ │ │ +000a3190: 2066 726f 6d20 7468 6520 6f6e 6520 6162 from the one ab │ │ │ +000a31a0: 6f76 6520 7468 6174 2069 7420 636f 6d70 ove that it comp │ │ │ +000a31b0: 7574 6573 2063 616d 6572 6120 696e 7472 utes camera intr │ │ │ +000a31c0: 696e 7369 6320 6d61 7472 6978 2066 726f insic matrix fro │ │ │ +000a31d0: 6d20 666f 6361 6c20 6c65 6e67 7468 2061 m focal length a │ │ │ +000a31e0: 6e64 0a70 7269 6e63 6970 616c 2070 6f69 nd.principal poi │ │ │ +000a31f0: 6e74 3a0a 0a5c 2841 203d 0a5c 6265 6769 nt:..\(A =.\begi │ │ │ +000a3200: 6e7b 626d 6174 7269 787d 0a66 2026 616d n{bmatrix}.f &am │ │ │ +000a3210: 703b 2030 2026 616d 703b 2078 5f7b 7070 p; 0 & x_{pp │ │ │ +000a3220: 7d20 205c 5c0a 3020 2661 6d70 3b20 6620 } \\.0 & f │ │ │ +000a3230: 2661 6d70 3b20 795f 7b70 707d 2020 5c5c & y_{pp} \\ │ │ │ +000a3240: 0a30 2026 616d 703b 2030 2026 616d 703b .0 & 0 & │ │ │ +000a3250: 2031 0a5c 656e 647b 626d 6174 7269 787d 1.\end{bmatrix} │ │ │ +000a3260: 5c29 3c2f 6464 3e0a 3c64 643e 3c63 6f64 \).
    mask - │ │ │ +000a3280: 4f75 7470 7574 2061 7272 6179 206f 6620 Output array of │ │ │ +000a3290: 4e20 656c 656d 656e 7473 2c20 6576 6572 N elements, ever │ │ │ +000a32a0: 7920 656c 656d 656e 7420 6f66 2077 6869 y element of whi │ │ │ +000a32b0: 6368 2069 7320 7365 7420 746f 2030 2066 ch is set to 0 f │ │ │ +000a32c0: 6f72 206f 7574 6c69 6572 7320 616e 6420 or outliers and │ │ │ +000a32d0: 746f 2031 0a66 6f72 2074 6865 206f 7468 to 1.for the oth │ │ │ +000a32e0: 6572 2070 6f69 6e74 732e 2054 6865 2061 er points. The a │ │ │ +000a32f0: 7272 6179 2069 7320 636f 6d70 7574 6564 rray is computed │ │ │ +000a3300: 206f 6e6c 7920 696e 2074 6865 2052 414e only in the RAN │ │ │ +000a3310: 5341 4320 616e 6420 4c4d 6564 5320 6d65 SAC and LMedS me │ │ │ +000a3320: 7468 6f64 732e 3c2f 6464 3e0a 3c64 743e thods.
    .
    │ │ │ +000a3330: 5265 7475 726e 733a 3c2f 6474 3e0a 3c64 Returns:
    .automatically │ │ │ +000a3350: 6765 6e65 7261 7465 643c 2f64 643e 0a3c generated.< │ │ │ +000a3360: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ..

  • .
  • .
    .

    findEssentialMa │ │ │ +000a3420: 743c 2f68 333e 0a3c 6469 7620 636c 6173 t

    .
    .
    pub │ │ │ +000a3480: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static Mat │ │ │ +000a34f0: 3c2f 613e 3c2f 7370 616e 3e26 6e62 7370   │ │ │ +000a3500: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;find │ │ │ +000a3520: 4573 7365 6e74 6961 6c4d 6174 3c2f 7370 EssentialMat(Ma │ │ │ +000a3590: 743c 2f61 3e26 6e62 7370 3b70 6f69 6e74 t point │ │ │ +000a35a0: 7331 2c0a 203c 6120 6872 6566 3d22 2e2e s1,. Mat po │ │ │ +000a35f0: 696e 7473 322c 0a20 646f 7562 6c65 266e ints2,. double&n │ │ │ +000a3600: 6273 703b 666f 6361 6c2c 0a20 3c61 2068 bsp;focal,. Point< │ │ │ +000a3650: 2f61 3e26 6e62 7370 3b70 702c 0a20 696e /a> pp,. in │ │ │ +000a3660: 7426 6e62 7370 3b6d 6574 686f 642c 0a20 t method,. │ │ │ +000a3670: 646f 7562 6c65 266e 6273 703b 7072 6f62 double prob │ │ │ +000a3680: 2c0a 2064 6f75 626c 6526 6e62 7370 3b74 ,. double t │ │ │ +000a3690: 6872 6573 686f 6c64 2c0a 2069 6e74 266e hreshold,. int&n │ │ │ +000a36a0: 6273 703b 6d61 7849 7465 7273 293c 2f73 bsp;maxIters)
    .
    .Parameters:.
    poi │ │ │ +000a36f0: 6e74 7331 3c2f 636f 6465 3e20 2d20 4172 nts1 - Ar │ │ │ +000a3700: 7261 7920 6f66 204e 2028 4e20 2667 743b ray of N (N > │ │ │ +000a3710: 3d20 3529 2032 4420 706f 696e 7473 2066 = 5) 2D points f │ │ │ +000a3720: 726f 6d20 7468 6520 6669 7273 7420 696d rom the first im │ │ │ +000a3730: 6167 652e 2054 6865 2070 6f69 6e74 2063 age. The point c │ │ │ +000a3740: 6f6f 7264 696e 6174 6573 2073 686f 756c oordinates shoul │ │ │ +000a3750: 640a 6265 2066 6c6f 6174 696e 672d 706f d.be floating-po │ │ │ +000a3760: 696e 7420 2873 696e 676c 6520 6f72 2064 int (single or d │ │ │ +000a3770: 6f75 626c 6520 7072 6563 6973 696f 6e29 ouble precision) │ │ │ +000a3780: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    points2 │ │ │ +000a37a0: 2d20 4172 7261 7920 6f66 2074 6865 2073 - Array of the s │ │ │ +000a37b0: 6563 6f6e 6420 696d 6167 6520 706f 696e econd image poin │ │ │ +000a37c0: 7473 206f 6620 7468 6520 7361 6d65 2073 ts of the same s │ │ │ +000a37d0: 697a 6520 616e 6420 666f 726d 6174 2061 ize and format a │ │ │ +000a37e0: 7320 706f 696e 7473 3120 2e3c 2f64 643e s points1 .
    │ │ │ +000a37f0: 0a3c 6464 3e3c 636f 6465 3e66 6f63 616c .
    focal │ │ │ +000a3800: 3c2f 636f 6465 3e20 2d20 666f 6361 6c20 - focal │ │ │ +000a3810: 6c65 6e67 7468 206f 6620 7468 6520 6361 length of the ca │ │ │ +000a3820: 6d65 7261 2e20 4e6f 7465 2074 6861 7420 mera. Note that │ │ │ +000a3830: 7468 6973 2066 756e 6374 696f 6e20 6173 this function as │ │ │ +000a3840: 7375 6d65 7320 7468 6174 2070 6f69 6e74 sumes that point │ │ │ +000a3850: 7331 2061 6e64 2070 6f69 6e74 7332 0a61 s1 and points2.a │ │ │ +000a3860: 7265 2066 6561 7475 7265 2070 6f69 6e74 re feature point │ │ │ +000a3870: 7320 6672 6f6d 2063 616d 6572 6173 2077 s from cameras w │ │ │ +000a3880: 6974 6820 7361 6d65 2066 6f63 616c 206c ith same focal l │ │ │ +000a3890: 656e 6774 6820 616e 6420 7072 696e 6369 ength and princi │ │ │ +000a38a0: 7061 6c20 706f 696e 742e 3c2f 6464 3e0a pal point.
    . │ │ │ +000a38b0: 3c64 643e 3c63 6f64 653e 7070 3c2f 636f
    pp - principal │ │ │ +000a38d0: 706f 696e 7420 6f66 2074 6865 2063 616d point of the cam │ │ │ +000a38e0: 6572 612e 3c2f 6464 3e0a 3c64 643e 3c63 era.
    .
    method - Method for c │ │ │ +000a3910: 6f6d 7075 7469 6e67 2061 2066 756e 6461 omputing a funda │ │ │ +000a3920: 6d65 6e74 616c 206d 6174 7269 782e 0a3c mental matrix..< │ │ │ +000a3930: 756c 3e0a 2020 3c6c 693e 0a20 2020 5245 ul>.
  • . RE │ │ │ +000a3940: 463a 2052 414e 5341 4320 666f 7220 7468 F: RANSAC for th │ │ │ +000a3950: 6520 5241 4e53 4143 2061 6c67 6f72 6974 e RANSAC algorit │ │ │ +000a3960: 686d 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c hm..
  • . . REF: LMEDS │ │ │ +000a3980: 2066 6f72 2074 6865 204c 4d65 6453 2061 for the LMedS a │ │ │ +000a3990: 6c67 6f72 6974 686d 2e0a 2020 3c2f 6c69 lgorithm..
  • ..
    prob - Parameter u │ │ │ +000a39d0: 7365 6420 666f 7220 7468 6520 5241 4e53 sed for the RANS │ │ │ +000a39e0: 4143 206f 7220 4c4d 6564 5320 6d65 7468 AC or LMedS meth │ │ │ +000a39f0: 6f64 7320 6f6e 6c79 2e20 4974 2073 7065 ods only. It spe │ │ │ +000a3a00: 6369 6669 6573 2061 2064 6573 6972 6162 cifies a desirab │ │ │ +000a3a10: 6c65 206c 6576 656c 206f 660a 636f 6e66 le level of.conf │ │ │ +000a3a20: 6964 656e 6365 2028 7072 6f62 6162 696c idence (probabil │ │ │ +000a3a30: 6974 7929 2074 6861 7420 7468 6520 6573 ity) that the es │ │ │ +000a3a40: 7469 6d61 7465 6420 6d61 7472 6978 2069 timated matrix i │ │ │ +000a3a50: 7320 636f 7272 6563 742e 0a66 6f72 2074 s correct..for t │ │ │ +000a3a60: 6865 206f 7468 6572 2070 6f69 6e74 732e he other points. │ │ │ +000a3a70: 2054 6865 2061 7272 6179 2069 7320 636f The array is co │ │ │ +000a3a80: 6d70 7574 6564 206f 6e6c 7920 696e 2074 mputed only in t │ │ │ +000a3a90: 6865 2052 414e 5341 4320 616e 6420 4c4d he RANSAC and LM │ │ │ +000a3aa0: 6564 5320 6d65 7468 6f64 732e 3c2f 6464 edS methods.
    .
    thre │ │ │ +000a3ac0: 7368 6f6c 643c 2f63 6f64 653e 202d 2050 shold - P │ │ │ +000a3ad0: 6172 616d 6574 6572 2075 7365 6420 666f arameter used fo │ │ │ +000a3ae0: 7220 5241 4e53 4143 2e20 4974 2069 7320 r RANSAC. It is │ │ │ +000a3af0: 7468 6520 6d61 7869 6d75 6d20 6469 7374 the maximum dist │ │ │ +000a3b00: 616e 6365 2066 726f 6d20 6120 706f 696e ance from a poin │ │ │ +000a3b10: 7420 746f 2061 6e20 6570 6970 6f6c 6172 t to an epipolar │ │ │ +000a3b20: 0a6c 696e 6520 696e 2070 6978 656c 732c .line in pixels, │ │ │ +000a3b30: 2062 6579 6f6e 6420 7768 6963 6820 7468 beyond which th │ │ │ +000a3b40: 6520 706f 696e 7420 6973 2063 6f6e 7369 e point is consi │ │ │ +000a3b50: 6465 7265 6420 616e 206f 7574 6c69 6572 dered an outlier │ │ │ +000a3b60: 2061 6e64 2069 7320 6e6f 7420 7573 6564 and is not used │ │ │ +000a3b70: 2066 6f72 2063 6f6d 7075 7469 6e67 2074 for computing t │ │ │ +000a3b80: 6865 0a66 696e 616c 2066 756e 6461 6d65 he.final fundame │ │ │ +000a3b90: 6e74 616c 206d 6174 7269 782e 2049 7420 ntal matrix. It │ │ │ +000a3ba0: 6361 6e20 6265 2073 6574 2074 6f20 736f can be set to so │ │ │ +000a3bb0: 6d65 7468 696e 6720 6c69 6b65 2031 2d33 mething like 1-3 │ │ │ +000a3bc0: 2c20 6465 7065 6e64 696e 6720 6f6e 2074 , depending on t │ │ │ +000a3bd0: 6865 2061 6363 7572 6163 7920 6f66 2074 he accuracy of t │ │ │ +000a3be0: 6865 0a70 6f69 6e74 206c 6f63 616c 697a he.point localiz │ │ │ +000a3bf0: 6174 696f 6e2c 2069 6d61 6765 2072 6573 ation, image res │ │ │ +000a3c00: 6f6c 7574 696f 6e2c 2061 6e64 2074 6865 olution, and the │ │ │ +000a3c10: 2069 6d61 6765 206e 6f69 7365 2e3c 2f64 image noise..
    max │ │ │ +000a3c30: 4974 6572 733c 2f63 6f64 653e 202d 2054 Iters - T │ │ │ +000a3c40: 6865 206d 6178 696d 756d 206e 756d 6265 he maximum numbe │ │ │ +000a3c50: 7220 6f66 2072 6f62 7573 7420 6d65 7468 r of robust meth │ │ │ +000a3c60: 6f64 2069 7465 7261 7469 6f6e 732e 0a0a od iterations... │ │ │ +000a3c70: 5468 6973 2066 756e 6374 696f 6e20 6469 This function di │ │ │ +000a3c80: 6666 6572 7320 6672 6f6d 2074 6865 206f ffers from the o │ │ │ +000a3c90: 6e65 2061 626f 7665 2074 6861 7420 6974 ne above that it │ │ │ +000a3ca0: 2063 6f6d 7075 7465 7320 6361 6d65 7261 computes camera │ │ │ +000a3cb0: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ +000a3cc0: 7820 6672 6f6d 2066 6f63 616c 206c 656e x from focal len │ │ │ +000a3cd0: 6774 6820 616e 640a 7072 696e 6369 7061 gth and.principa │ │ │ +000a3ce0: 6c20 706f 696e 743a 0a0a 5c28 4120 3d0a l point:..\(A =. │ │ │ +000a3cf0: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ +000a3d00: 6620 2661 6d70 3b20 3020 2661 6d70 3b20 f & 0 & │ │ │ +000a3d10: 785f 7b70 707d 2020 5c5c 0a30 2026 616d x_{pp} \\.0 &am │ │ │ +000a3d20: 703b 2066 2026 616d 703b 2079 5f7b 7070 p; f & y_{pp │ │ │ +000a3d30: 7d20 205c 5c0a 3020 2661 6d70 3b20 3020 } \\.0 & 0 │ │ │ +000a3d40: 2661 6d70 3b20 310a 5c65 6e64 7b62 6d61 & 1.\end{bma │ │ │ +000a3d50: 7472 6978 7d5c 293c 2f64 643e 0a3c 6474 trix}\)
    .
    Returns:
    .< │ │ │ +000a3d70: 6464 3e61 7574 6f6d 6174 6963 616c 6c79 dd>automatically │ │ │ +000a3d80: 2067 656e 6572 6174 6564 3c2f 6464 3e0a generated. │ │ │ +000a3d90: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73 ..
    ...
    .

    fi │ │ │ +000a3e40: 6e64 4573 7365 6e74 6961 6c4d 6174 3c2f ndEssentialMat.
    .
    public │ │ │ +000a3eb0: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +000a3ec0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;Mat findEss │ │ │ +000a3f50: 656e 7469 616c 4d61 743c 2f73 7061 6e3e entialMat │ │ │ +000a3f60: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ +000a3f80: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000a3f90: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000a3fa0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000a3fb0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat points1, │ │ │ +000a3fd0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000a4010: 743c 2f61 3e26 6e62 7370 3b70 6f69 6e74 t point │ │ │ +000a4020: 7332 2c0a 2064 6f75 626c 6526 6e62 7370 s2,. double  │ │ │ +000a4030: 3b66 6f63 616c 2c0a 203c 6120 6872 6566 ;focal,. Point │ │ │ +000a4080: 266e 6273 703b 7070 2c0a 2069 6e74 266e  pp,. int&n │ │ │ +000a4090: 6273 703b 6d65 7468 6f64 2c0a 2064 6f75 bsp;method,. dou │ │ │ +000a40a0: 626c 6526 6e62 7370 3b70 726f 622c 0a20 ble prob,. │ │ │ +000a40b0: 646f 7562 6c65 266e 6273 703b 7468 7265 double thre │ │ │ +000a40c0: 7368 6f6c 6429 3c2f 7370 616e 3e3c 2f64 shold).
    .
    Param │ │ │ +000a40f0: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ +000a4100: 3c63 6f64 653e 706f 696e 7473 313c 2f63 points1 - Array of │ │ │ +000a4120: 4e20 284e 2026 6774 3b3d 2035 2920 3244 N (N >= 5) 2D │ │ │ +000a4130: 2070 6f69 6e74 7320 6672 6f6d 2074 6865 points from the │ │ │ +000a4140: 2066 6972 7374 2069 6d61 6765 2e20 5468 first image. Th │ │ │ +000a4150: 6520 706f 696e 7420 636f 6f72 6469 6e61 e point coordina │ │ │ +000a4160: 7465 7320 7368 6f75 6c64 0a62 6520 666c tes should.be fl │ │ │ +000a4170: 6f61 7469 6e67 2d70 6f69 6e74 2028 7369 oating-point (si │ │ │ +000a4180: 6e67 6c65 206f 7220 646f 7562 6c65 2070 ngle or double p │ │ │ +000a4190: 7265 6369 7369 6f6e 292e 3c2f 6464 3e0a recision).
    . │ │ │ +000a41a0: 3c64 643e 3c63 6f64 653e 706f 696e 7473
    points │ │ │ +000a41b0: 323c 2f63 6f64 653e 202d 2041 7272 6179 2 - Array │ │ │ +000a41c0: 206f 6620 7468 6520 7365 636f 6e64 2069 of the second i │ │ │ +000a41d0: 6d61 6765 2070 6f69 6e74 7320 6f66 2074 mage points of t │ │ │ +000a41e0: 6865 2073 616d 6520 7369 7a65 2061 6e64 he same size and │ │ │ +000a41f0: 2066 6f72 6d61 7420 6173 2070 6f69 6e74 format as point │ │ │ +000a4200: 7331 202e 3c2f 6464 3e0a 3c64 643e 3c63 s1 .
    .
    focal │ │ │ +000a4220: 202d 2066 6f63 616c 206c 656e 6774 6820 - focal length │ │ │ +000a4230: 6f66 2074 6865 2063 616d 6572 612e 204e of the camera. N │ │ │ +000a4240: 6f74 6520 7468 6174 2074 6869 7320 6675 ote that this fu │ │ │ +000a4250: 6e63 7469 6f6e 2061 7373 756d 6573 2074 nction assumes t │ │ │ +000a4260: 6861 7420 706f 696e 7473 3120 616e 6420 hat points1 and │ │ │ +000a4270: 706f 696e 7473 320a 6172 6520 6665 6174 points2.are feat │ │ │ +000a4280: 7572 6520 706f 696e 7473 2066 726f 6d20 ure points from │ │ │ +000a4290: 6361 6d65 7261 7320 7769 7468 2073 616d cameras with sam │ │ │ +000a42a0: 6520 666f 6361 6c20 6c65 6e67 7468 2061 e focal length a │ │ │ +000a42b0: 6e64 2070 7269 6e63 6970 616c 2070 6f69 nd principal poi │ │ │ +000a42c0: 6e74 2e3c 2f64 643e 0a3c 6464 3e3c 636f nt.
    .
    pp - p │ │ │ +000a42e0: 7269 6e63 6970 616c 2070 6f69 6e74 206f rincipal point o │ │ │ +000a42f0: 6620 7468 6520 6361 6d65 7261 2e3c 2f64 f the camera..
    met │ │ │ +000a4310: 686f 643c 2f63 6f64 653e 202d 204d 6574 hod - Met │ │ │ +000a4320: 686f 6420 666f 7220 636f 6d70 7574 696e hod for computin │ │ │ +000a4330: 6720 6120 6675 6e64 616d 656e 7461 6c20 g a fundamental │ │ │ +000a4340: 6d61 7472 6978 2e0a 3c75 6c3e 0a20 203c matrix..
      . < │ │ │ +000a4350: 6c69 3e0a 2020 2052 4546 3a20 5241 4e53 li>. REF: RANS │ │ │ +000a4360: 4143 2066 6f72 2074 6865 2052 414e 5341 AC for the RANSA │ │ │ +000a4370: 4320 616c 676f 7269 7468 6d2e 0a20 203c C algorithm.. < │ │ │ +000a4380: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2052 /li>.
    • . R │ │ │ +000a4390: 4546 3a20 4c4d 4544 5320 666f 7220 7468 EF: LMEDS for th │ │ │ +000a43a0: 6520 4c4d 6564 5320 616c 676f 7269 7468 e LMedS algorith │ │ │ +000a43b0: 6d2e 0a20 203c 2f6c 693e 0a3c 2f75 6c3e m..
    • .
    │ │ │ +000a43c0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000a43d0: 7072 6f62 3c2f 636f 6465 3e20 2d20 5061 prob - Pa │ │ │ +000a43e0: 7261 6d65 7465 7220 7573 6564 2066 6f72 rameter used for │ │ │ +000a43f0: 2074 6865 2052 414e 5341 4320 6f72 204c the RANSAC or L │ │ │ +000a4400: 4d65 6453 206d 6574 686f 6473 206f 6e6c MedS methods onl │ │ │ +000a4410: 792e 2049 7420 7370 6563 6966 6965 7320 y. It specifies │ │ │ +000a4420: 6120 6465 7369 7261 626c 6520 6c65 7665 a desirable leve │ │ │ +000a4430: 6c20 6f66 0a63 6f6e 6669 6465 6e63 6520 l of.confidence │ │ │ +000a4440: 2870 726f 6261 6269 6c69 7479 2920 7468 (probability) th │ │ │ +000a4450: 6174 2074 6865 2065 7374 696d 6174 6564 at the estimated │ │ │ +000a4460: 206d 6174 7269 7820 6973 2063 6f72 7265 matrix is corre │ │ │ +000a4470: 6374 2e0a 666f 7220 7468 6520 6f74 6865 ct..for the othe │ │ │ +000a4480: 7220 706f 696e 7473 2e20 5468 6520 6172 r points. The ar │ │ │ +000a4490: 7261 7920 6973 2063 6f6d 7075 7465 6420 ray is computed │ │ │ +000a44a0: 6f6e 6c79 2069 6e20 7468 6520 5241 4e53 only in the RANS │ │ │ +000a44b0: 4143 2061 6e64 204c 4d65 6453 206d 6574 AC and LMedS met │ │ │ +000a44c0: 686f 6473 2e0a 0a54 6869 7320 6675 6e63 hods...This func │ │ │ +000a44d0: 7469 6f6e 2064 6966 6665 7273 2066 726f tion differs fro │ │ │ +000a44e0: 6d20 7468 6520 6f6e 6520 6162 6f76 6520 m the one above │ │ │ +000a44f0: 7468 6174 2069 7420 636f 6d70 7574 6573 that it computes │ │ │ +000a4500: 2063 616d 6572 6120 696e 7472 696e 7369 camera intrinsi │ │ │ +000a4510: 6320 6d61 7472 6978 2066 726f 6d20 666f c matrix from fo │ │ │ +000a4520: 6361 6c20 6c65 6e67 7468 2061 6e64 0a70 cal length and.p │ │ │ +000a4530: 7269 6e63 6970 616c 2070 6f69 6e74 3a0a rincipal point:. │ │ │ +000a4540: 0a5c 2841 203d 0a5c 6265 6769 6e7b 626d .\(A =.\begin{bm │ │ │ +000a4550: 6174 7269 787d 0a66 2026 616d 703b 2030 atrix}.f & 0 │ │ │ +000a4560: 2026 616d 703b 2078 5f7b 7070 7d20 205c & x_{pp} \ │ │ │ +000a4570: 5c0a 3020 2661 6d70 3b20 6620 2661 6d70 \.0 & f & │ │ │ +000a4580: 3b20 795f 7b70 707d 2020 5c5c 0a30 2026 ; y_{pp} \\.0 & │ │ │ +000a4590: 616d 703b 2030 2026 616d 703b 2031 0a5c amp; 0 & 1.\ │ │ │ +000a45a0: 656e 647b 626d 6174 7269 787d 5c29 3c2f end{bmatrix}\).
    th │ │ │ +000a45c0: 7265 7368 6f6c 643c 2f63 6f64 653e 202d reshold - │ │ │ +000a45d0: 2050 6172 616d 6574 6572 2075 7365 6420 Parameter used │ │ │ +000a45e0: 666f 7220 5241 4e53 4143 2e20 4974 2069 for RANSAC. It i │ │ │ +000a45f0: 7320 7468 6520 6d61 7869 6d75 6d20 6469 s the maximum di │ │ │ +000a4600: 7374 616e 6365 2066 726f 6d20 6120 706f stance from a po │ │ │ +000a4610: 696e 7420 746f 2061 6e20 6570 6970 6f6c int to an epipol │ │ │ +000a4620: 6172 0a6c 696e 6520 696e 2070 6978 656c ar.line in pixel │ │ │ +000a4630: 732c 2062 6579 6f6e 6420 7768 6963 6820 s, beyond which │ │ │ +000a4640: 7468 6520 706f 696e 7420 6973 2063 6f6e the point is con │ │ │ +000a4650: 7369 6465 7265 6420 616e 206f 7574 6c69 sidered an outli │ │ │ +000a4660: 6572 2061 6e64 2069 7320 6e6f 7420 7573 er and is not us │ │ │ +000a4670: 6564 2066 6f72 2063 6f6d 7075 7469 6e67 ed for computing │ │ │ +000a4680: 2074 6865 0a66 696e 616c 2066 756e 6461 the.final funda │ │ │ +000a4690: 6d65 6e74 616c 206d 6174 7269 782e 2049 mental matrix. I │ │ │ +000a46a0: 7420 6361 6e20 6265 2073 6574 2074 6f20 t can be set to │ │ │ +000a46b0: 736f 6d65 7468 696e 6720 6c69 6b65 2031 something like 1 │ │ │ +000a46c0: 2d33 2c20 6465 7065 6e64 696e 6720 6f6e -3, depending on │ │ │ +000a46d0: 2074 6865 2061 6363 7572 6163 7920 6f66 the accuracy of │ │ │ +000a46e0: 2074 6865 0a70 6f69 6e74 206c 6f63 616c the.point local │ │ │ +000a46f0: 697a 6174 696f 6e2c 2069 6d61 6765 2072 ization, image r │ │ │ +000a4700: 6573 6f6c 7574 696f 6e2c 2061 6e64 2074 esolution, and t │ │ │ +000a4710: 6865 2069 6d61 6765 206e 6f69 7365 2e3c he image noise.< │ │ │ +000a4720: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ +000a4730: 3a3c 2f64 743e 0a3c 6464 3e61 7574 6f6d :
    .
    autom │ │ │ +000a4740: 6174 6963 616c 6c79 2067 656e 6572 6174 atically generat │ │ │ +000a4750: 6564 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f ed
    .
    ..

    . │ │ │ +000a4770: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374 .
  • ..

    f │ │ │ +000a4800: 696e 6445 7373 656e 7469 616c 4d61 743c indEssentialMat< │ │ │ +000a4810: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +000a4870: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +000a4880: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;< │ │ │ +000a48a0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000a48b0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000a48c0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000a48d0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat < │ │ │ +000a48f0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +000a4900: 656e 742d 6e61 6d65 223e 6669 6e64 4573 ent-name">findEs │ │ │ +000a4910: 7365 6e74 6961 6c4d 6174 3c2f 7370 616e sentialMat( │ │ │ +000a4940: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000a4980: 2f61 3e26 6e62 7370 3b70 6f69 6e74 7331 /a> points1 │ │ │ +000a4990: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000a49d0: 6174 3c2f 613e 266e 6273 703b 706f 696e at poin │ │ │ +000a49e0: 7473 322c 0a20 646f 7562 6c65 266e 6273 ts2,. double&nbs │ │ │ +000a49f0: 703b 666f 6361 6c2c 0a20 3c61 2068 7265 p;focal,. Point pp,. int& │ │ │ +000a4a50: 6e62 7370 3b6d 6574 686f 642c 0a20 646f nbsp;method,. do │ │ │ +000a4a60: 7562 6c65 266e 6273 703b 7072 6f62 293c uble prob)< │ │ │ +000a4a70: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 646c /span>
    .
    . │ │ │ +000a4a90: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ +000a4aa0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e70 /dt>.
    p │ │ │ +000a4ab0: 6f69 6e74 7331 3c2f 636f 6465 3e20 2d20 oints1 - │ │ │ +000a4ac0: 4172 7261 7920 6f66 204e 2028 4e20 2667 Array of N (N &g │ │ │ +000a4ad0: 743b 3d20 3529 2032 4420 706f 696e 7473 t;= 5) 2D points │ │ │ +000a4ae0: 2066 726f 6d20 7468 6520 6669 7273 7420 from the first │ │ │ +000a4af0: 696d 6167 652e 2054 6865 2070 6f69 6e74 image. The point │ │ │ +000a4b00: 2063 6f6f 7264 696e 6174 6573 2073 686f coordinates sho │ │ │ +000a4b10: 756c 640a 6265 2066 6c6f 6174 696e 672d uld.be floating- │ │ │ +000a4b20: 706f 696e 7420 2873 696e 676c 6520 6f72 point (single or │ │ │ +000a4b30: 2064 6f75 626c 6520 7072 6563 6973 696f double precisio │ │ │ +000a4b40: 6e29 2e3c 2f64 643e 0a3c 6464 3e3c 636f n).
    .
    points2 - Array of the │ │ │ +000a4b70: 2073 6563 6f6e 6420 696d 6167 6520 706f second image po │ │ │ +000a4b80: 696e 7473 206f 6620 7468 6520 7361 6d65 ints of the same │ │ │ +000a4b90: 2073 697a 6520 616e 6420 666f 726d 6174 size and format │ │ │ +000a4ba0: 2061 7320 706f 696e 7473 3120 2e3c 2f64 as points1 ..
    foc │ │ │ +000a4bc0: 616c 3c2f 636f 6465 3e20 2d20 666f 6361 al - foca │ │ │ +000a4bd0: 6c20 6c65 6e67 7468 206f 6620 7468 6520 l length of the │ │ │ +000a4be0: 6361 6d65 7261 2e20 4e6f 7465 2074 6861 camera. Note tha │ │ │ +000a4bf0: 7420 7468 6973 2066 756e 6374 696f 6e20 t this function │ │ │ +000a4c00: 6173 7375 6d65 7320 7468 6174 2070 6f69 assumes that poi │ │ │ +000a4c10: 6e74 7331 2061 6e64 2070 6f69 6e74 7332 nts1 and points2 │ │ │ +000a4c20: 0a61 7265 2066 6561 7475 7265 2070 6f69 .are feature poi │ │ │ +000a4c30: 6e74 7320 6672 6f6d 2063 616d 6572 6173 nts from cameras │ │ │ +000a4c40: 2077 6974 6820 7361 6d65 2066 6f63 616c with same focal │ │ │ +000a4c50: 206c 656e 6774 6820 616e 6420 7072 696e length and prin │ │ │ +000a4c60: 6369 7061 6c20 706f 696e 742e 3c2f 6464 cipal point.
    .
    pp - principa │ │ │ +000a4c90: 6c20 706f 696e 7420 6f66 2074 6865 2063 l point of the c │ │ │ +000a4ca0: 616d 6572 612e 3c2f 6464 3e0a 3c64 643e amera.
    .
    │ │ │ +000a4cb0: 3c63 6f64 653e 6d65 7468 6f64 3c2f 636f method - Method for │ │ │ +000a4cd0: 2063 6f6d 7075 7469 6e67 2061 2066 756e computing a fun │ │ │ +000a4ce0: 6461 6d65 6e74 616c 206d 6174 7269 782e damental matrix. │ │ │ +000a4cf0: 0a3c 756c 3e0a 2020 3c6c 693e 0a20 2020 .
      .
    • . │ │ │ +000a4d00: 5245 463a 2052 414e 5341 4320 666f 7220 REF: RANSAC for │ │ │ +000a4d10: 7468 6520 5241 4e53 4143 2061 6c67 6f72 the RANSAC algor │ │ │ +000a4d20: 6974 686d 2e0a 2020 3c2f 6c69 3e0a 2020 ithm..
    • . │ │ │ +000a4d30: 3c6c 693e 0a20 2020 5245 463a 204c 4d45
    • . REF: LME │ │ │ +000a4d40: 4453 2066 6f72 2074 6865 204c 4d65 6453 DS for the LMedS │ │ │ +000a4d50: 2061 6c67 6f72 6974 686d 2e0a 2020 3c2f algorithm.. .
    .line i │ │ │ +000a4d70: 6e20 7069 7865 6c73 2c20 6265 796f 6e64 n pixels, beyond │ │ │ +000a4d80: 2077 6869 6368 2074 6865 2070 6f69 6e74 which the point │ │ │ +000a4d90: 2069 7320 636f 6e73 6964 6572 6564 2061 is considered a │ │ │ +000a4da0: 6e20 6f75 746c 6965 7220 616e 6420 6973 n outlier and is │ │ │ +000a4db0: 206e 6f74 2075 7365 6420 666f 7220 636f not used for co │ │ │ +000a4dc0: 6d70 7574 696e 6720 7468 650a 6669 6e61 mputing the.fina │ │ │ +000a4dd0: 6c20 6675 6e64 616d 656e 7461 6c20 6d61 l fundamental ma │ │ │ +000a4de0: 7472 6978 2e20 4974 2063 616e 2062 6520 trix. It can be │ │ │ +000a4df0: 7365 7420 746f 2073 6f6d 6574 6869 6e67 set to something │ │ │ +000a4e00: 206c 696b 6520 312d 332c 2064 6570 656e like 1-3, depen │ │ │ +000a4e10: 6469 6e67 206f 6e20 7468 6520 6163 6375 ding on the accu │ │ │ +000a4e20: 7261 6379 206f 6620 7468 650a 706f 696e racy of the.poin │ │ │ +000a4e30: 7420 6c6f 6361 6c69 7a61 7469 6f6e 2c20 t localization, │ │ │ +000a4e40: 696d 6167 6520 7265 736f 6c75 7469 6f6e image resolution │ │ │ +000a4e50: 2c20 616e 6420 7468 6520 696d 6167 6520 , and the image │ │ │ +000a4e60: 6e6f 6973 652e 3c2f 6464 3e0a 3c64 643e noise.
    .
    │ │ │ +000a4e70: 3c63 6f64 653e 7072 6f62 3c2f 636f 6465 prob - Parameter us │ │ │ +000a4e90: 6564 2066 6f72 2074 6865 2052 414e 5341 ed for the RANSA │ │ │ +000a4ea0: 4320 6f72 204c 4d65 6453 206d 6574 686f C or LMedS metho │ │ │ +000a4eb0: 6473 206f 6e6c 792e 2049 7420 7370 6563 ds only. It spec │ │ │ +000a4ec0: 6966 6965 7320 6120 6465 7369 7261 626c ifies a desirabl │ │ │ +000a4ed0: 6520 6c65 7665 6c20 6f66 0a63 6f6e 6669 e level of.confi │ │ │ +000a4ee0: 6465 6e63 6520 2870 726f 6261 6269 6c69 dence (probabili │ │ │ +000a4ef0: 7479 2920 7468 6174 2074 6865 2065 7374 ty) that the est │ │ │ +000a4f00: 696d 6174 6564 206d 6174 7269 7820 6973 imated matrix is │ │ │ +000a4f10: 2063 6f72 7265 6374 2e0a 666f 7220 7468 correct..for th │ │ │ +000a4f20: 6520 6f74 6865 7220 706f 696e 7473 2e20 e other points. │ │ │ +000a4f30: 5468 6520 6172 7261 7920 6973 2063 6f6d The array is com │ │ │ +000a4f40: 7075 7465 6420 6f6e 6c79 2069 6e20 7468 puted only in th │ │ │ +000a4f50: 6520 5241 4e53 4143 2061 6e64 204c 4d65 e RANSAC and LMe │ │ │ +000a4f60: 6453 206d 6574 686f 6473 2e0a 0a54 6869 dS methods...Thi │ │ │ +000a4f70: 7320 6675 6e63 7469 6f6e 2064 6966 6665 s function diffe │ │ │ +000a4f80: 7273 2066 726f 6d20 7468 6520 6f6e 6520 rs from the one │ │ │ +000a4f90: 6162 6f76 6520 7468 6174 2069 7420 636f above that it co │ │ │ +000a4fa0: 6d70 7574 6573 2063 616d 6572 6120 696e mputes camera in │ │ │ +000a4fb0: 7472 696e 7369 6320 6d61 7472 6978 2066 trinsic matrix f │ │ │ +000a4fc0: 726f 6d20 666f 6361 6c20 6c65 6e67 7468 rom focal length │ │ │ +000a4fd0: 2061 6e64 0a70 7269 6e63 6970 616c 2070 and.principal p │ │ │ +000a4fe0: 6f69 6e74 3a0a 0a5c 2841 203d 0a5c 6265 oint:..\(A =.\be │ │ │ +000a4ff0: 6769 6e7b 626d 6174 7269 787d 0a66 2026 gin{bmatrix}.f & │ │ │ +000a5000: 616d 703b 2030 2026 616d 703b 2078 5f7b amp; 0 & x_{ │ │ │ +000a5010: 7070 7d20 205c 5c0a 3020 2661 6d70 3b20 pp} \\.0 & │ │ │ +000a5020: 6620 2661 6d70 3b20 795f 7b70 707d 2020 f & y_{pp} │ │ │ +000a5030: 5c5c 0a30 2026 616d 703b 2030 2026 616d \\.0 & 0 &am │ │ │ +000a5040: 703b 2031 0a5c 656e 647b 626d 6174 7269 p; 1.\end{bmatri │ │ │ +000a5050: 787d 5c29 3c2f 6464 3e0a 3c64 743e 5265 x}\)
    .
    Re │ │ │ +000a5060: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ +000a5070: 6175 746f 6d61 7469 6361 6c6c 7920 6765 automatically ge │ │ │ +000a5080: 6e65 7261 7465 643c 2f64 643e 0a3c 2f64 nerated
    ..
    ..

  • .
  • . │ │ │ +000a50b0: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    fin │ │ │ +000a5130: 6445 7373 656e 7469 616c 4d61 743c 2f68 dEssentialMat.
    .
    public │ │ │ +000a51a0: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +000a51b0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;Mat │ │ │ +000a5210: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  findEsse │ │ │ +000a5240: 6e74 6961 6c4d 6174 3c2f 7370 616e 3e3c ntialMat< │ │ │ +000a5250: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat points1,. │ │ │ +000a52c0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000a5300: 3c2f 613e 266e 6273 703b 706f 696e 7473  points │ │ │ +000a5310: 322c 0a20 646f 7562 6c65 266e 6273 703b 2,. double  │ │ │ +000a5320: 666f 6361 6c2c 0a20 3c61 2068 7265 663d focal,. Point& │ │ │ +000a5370: 6e62 7370 3b70 702c 0a20 696e 7426 6e62 nbsp;pp,. int&nb │ │ │ +000a5380: 7370 3b6d 6574 686f 6429 3c2f 7370 616e sp;method)
    .
    .
    P │ │ │ +000a53b0: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ +000a53c0: 3c64 643e 3c63 6f64 653e 706f 696e 7473
    points │ │ │ +000a53d0: 313c 2f63 6f64 653e 202d 2041 7272 6179 1 - Array │ │ │ +000a53e0: 206f 6620 4e20 284e 2026 6774 3b3d 2035 of N (N >= 5 │ │ │ +000a53f0: 2920 3244 2070 6f69 6e74 7320 6672 6f6d ) 2D points from │ │ │ +000a5400: 2074 6865 2066 6972 7374 2069 6d61 6765 the first image │ │ │ +000a5410: 2e20 5468 6520 706f 696e 7420 636f 6f72 . The point coor │ │ │ +000a5420: 6469 6e61 7465 7320 7368 6f75 6c64 0a62 dinates should.b │ │ │ +000a5430: 6520 666c 6f61 7469 6e67 2d70 6f69 6e74 e floating-point │ │ │ +000a5440: 2028 7369 6e67 6c65 206f 7220 646f 7562 (single or doub │ │ │ +000a5450: 6c65 2070 7265 6369 7369 6f6e 292e 3c2f le precision)..
    po │ │ │ +000a5470: 696e 7473 323c 2f63 6f64 653e 202d 2041 ints2 - A │ │ │ +000a5480: 7272 6179 206f 6620 7468 6520 7365 636f rray of the seco │ │ │ +000a5490: 6e64 2069 6d61 6765 2070 6f69 6e74 7320 nd image points │ │ │ +000a54a0: 6f66 2074 6865 2073 616d 6520 7369 7a65 of the same size │ │ │ +000a54b0: 2061 6e64 2066 6f72 6d61 7420 6173 2070 and format as p │ │ │ +000a54c0: 6f69 6e74 7331 202e 3c2f 6464 3e0a 3c64 oints1 .
    .focal - focal len │ │ │ +000a54f0: 6774 6820 6f66 2074 6865 2063 616d 6572 gth of the camer │ │ │ +000a5500: 612e 204e 6f74 6520 7468 6174 2074 6869 a. Note that thi │ │ │ +000a5510: 7320 6675 6e63 7469 6f6e 2061 7373 756d s function assum │ │ │ +000a5520: 6573 2074 6861 7420 706f 696e 7473 3120 es that points1 │ │ │ +000a5530: 616e 6420 706f 696e 7473 320a 6172 6520 and points2.are │ │ │ +000a5540: 6665 6174 7572 6520 706f 696e 7473 2066 feature points f │ │ │ +000a5550: 726f 6d20 6361 6d65 7261 7320 7769 7468 rom cameras with │ │ │ +000a5560: 2073 616d 6520 666f 6361 6c20 6c65 6e67 same focal leng │ │ │ +000a5570: 7468 2061 6e64 2070 7269 6e63 6970 616c th and principal │ │ │ +000a5580: 2070 6f69 6e74 2e3c 2f64 643e 0a3c 6464 point..
    pp │ │ │ +000a55a0: 202d 2070 7269 6e63 6970 616c 2070 6f69 - principal poi │ │ │ +000a55b0: 6e74 206f 6620 7468 6520 6361 6d65 7261 nt of the camera │ │ │ +000a55c0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    method - │ │ │ +000a55e0: 204d 6574 686f 6420 666f 7220 636f 6d70 Method for comp │ │ │ +000a55f0: 7574 696e 6720 6120 6675 6e64 616d 656e uting a fundamen │ │ │ +000a5600: 7461 6c20 6d61 7472 6978 2e0a 3c75 6c3e tal matrix..
      │ │ │ +000a5610: 0a20 203c 6c69 3e0a 2020 2052 4546 3a20 .
    • . REF: │ │ │ +000a5620: 5241 4e53 4143 2066 6f72 2074 6865 2052 RANSAC for the R │ │ │ +000a5630: 414e 5341 4320 616c 676f 7269 7468 6d2e ANSAC algorithm. │ │ │ +000a5640: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ +000a5650: 2020 2052 4546 3a20 4c4d 4544 5320 666f REF: LMEDS fo │ │ │ +000a5660: 7220 7468 6520 4c4d 6564 5320 616c 676f r the LMedS algo │ │ │ +000a5670: 7269 7468 6d2e 0a20 203c 2f6c 693e 0a3c rithm..
    • .< │ │ │ +000a5680: 2f75 6c3e 0a6c 696e 6520 696e 2070 6978 /ul>.line in pix │ │ │ +000a5690: 656c 732c 2062 6579 6f6e 6420 7768 6963 els, beyond whic │ │ │ +000a56a0: 6820 7468 6520 706f 696e 7420 6973 2063 h the point is c │ │ │ +000a56b0: 6f6e 7369 6465 7265 6420 616e 206f 7574 onsidered an out │ │ │ +000a56c0: 6c69 6572 2061 6e64 2069 7320 6e6f 7420 lier and is not │ │ │ +000a56d0: 7573 6564 2066 6f72 2063 6f6d 7075 7469 used for computi │ │ │ +000a56e0: 6e67 2074 6865 0a66 696e 616c 2066 756e ng the.final fun │ │ │ +000a56f0: 6461 6d65 6e74 616c 206d 6174 7269 782e damental matrix. │ │ │ +000a5700: 2049 7420 6361 6e20 6265 2073 6574 2074 It can be set t │ │ │ +000a5710: 6f20 736f 6d65 7468 696e 6720 6c69 6b65 o something like │ │ │ +000a5720: 2031 2d33 2c20 6465 7065 6e64 696e 6720 1-3, depending │ │ │ +000a5730: 6f6e 2074 6865 2061 6363 7572 6163 7920 on the accuracy │ │ │ +000a5740: 6f66 2074 6865 0a70 6f69 6e74 206c 6f63 of the.point loc │ │ │ +000a5750: 616c 697a 6174 696f 6e2c 2069 6d61 6765 alization, image │ │ │ +000a5760: 2072 6573 6f6c 7574 696f 6e2c 2061 6e64 resolution, and │ │ │ +000a5770: 2074 6865 2069 6d61 6765 206e 6f69 7365 the image noise │ │ │ +000a5780: 2e0a 636f 6e66 6964 656e 6365 2028 7072 ..confidence (pr │ │ │ +000a5790: 6f62 6162 696c 6974 7929 2074 6861 7420 obability) that │ │ │ +000a57a0: 7468 6520 6573 7469 6d61 7465 6420 6d61 the estimated ma │ │ │ +000a57b0: 7472 6978 2069 7320 636f 7272 6563 742e trix is correct. │ │ │ +000a57c0: 0a66 6f72 2074 6865 206f 7468 6572 2070 .for the other p │ │ │ +000a57d0: 6f69 6e74 732e 2054 6865 2061 7272 6179 oints. The array │ │ │ +000a57e0: 2069 7320 636f 6d70 7574 6564 206f 6e6c is computed onl │ │ │ +000a57f0: 7920 696e 2074 6865 2052 414e 5341 4320 y in the RANSAC │ │ │ +000a5800: 616e 6420 4c4d 6564 5320 6d65 7468 6f64 and LMedS method │ │ │ +000a5810: 732e 0a0a 5468 6973 2066 756e 6374 696f s...This functio │ │ │ +000a5820: 6e20 6469 6666 6572 7320 6672 6f6d 2074 n differs from t │ │ │ +000a5830: 6865 206f 6e65 2061 626f 7665 2074 6861 he one above tha │ │ │ +000a5840: 7420 6974 2063 6f6d 7075 7465 7320 6361 t it computes ca │ │ │ +000a5850: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ +000a5860: 6174 7269 7820 6672 6f6d 2066 6f63 616c atrix from focal │ │ │ +000a5870: 206c 656e 6774 6820 616e 640a 7072 696e length and.prin │ │ │ +000a5880: 6369 7061 6c20 706f 696e 743a 0a0a 5c28 cipal point:..\( │ │ │ +000a5890: 4120 3d0a 5c62 6567 696e 7b62 6d61 7472 A =.\begin{bmatr │ │ │ +000a58a0: 6978 7d0a 6620 2661 6d70 3b20 3020 2661 ix}.f & 0 &a │ │ │ +000a58b0: 6d70 3b20 785f 7b70 707d 2020 5c5c 0a30 mp; x_{pp} \\.0 │ │ │ +000a58c0: 2026 616d 703b 2066 2026 616d 703b 2079 & f & y │ │ │ +000a58d0: 5f7b 7070 7d20 205c 5c0a 3020 2661 6d70 _{pp} \\.0 & │ │ │ +000a58e0: 3b20 3020 2661 6d70 3b20 310a 5c65 6e64 ; 0 & 1.\end │ │ │ +000a58f0: 7b62 6d61 7472 6978 7d5c 293c 2f64 643e {bmatrix}\)
    │ │ │ +000a5900: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    automatic │ │ │ +000a5920: 616c 6c79 2067 656e 6572 6174 6564 3c2f ally generated.
    .
    │ │ │ +000a5940: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .

    .
  • .
  • .
    .

    │ │ │ +000a59d0: 6669 6e64 4573 7365 6e74 6961 6c4d 6174 findEssentialMat │ │ │ +000a59e0: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ +000a5a40: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ +000a5a50: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ +000a5a70: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000a5ab0: 2f61 3e3c 2f73 7061 6e3e 266e 6273 703b /a>  │ │ │ +000a5ac0: 3c73 7061 6e20 636c 6173 733d 2265 6c65 findE │ │ │ +000a5ae0: 7373 656e 7469 616c 4d61 743c 2f73 7061 ssentialMat │ │ │ +000a5b10: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ +000a5b50: 3c2f 613e 266e 6273 703b 706f 696e 7473  points │ │ │ +000a5b60: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ +000a5ba0: 4d61 743c 2f61 3e26 6e62 7370 3b70 6f69 Mat poi │ │ │ +000a5bb0: 6e74 7332 2c0a 2064 6f75 626c 6526 6e62 nts2,. double&nb │ │ │ +000a5bc0: 7370 3b66 6f63 616c 2c0a 203c 6120 6872 sp;focal,. Point pp)
    .
    .
    │ │ │ +000a5c40: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ +000a5c50: 0a3c 6464 3e3c 636f 6465 3e70 6f69 6e74 .
    point │ │ │ +000a5c60: 7331 3c2f 636f 6465 3e20 2d20 4172 7261 s1 - Arra │ │ │ +000a5c70: 7920 6f66 204e 2028 4e20 2667 743b 3d20 y of N (N >= │ │ │ +000a5c80: 3529 2032 4420 706f 696e 7473 2066 726f 5) 2D points fro │ │ │ +000a5c90: 6d20 7468 6520 6669 7273 7420 696d 6167 m the first imag │ │ │ +000a5ca0: 652e 2054 6865 2070 6f69 6e74 2063 6f6f e. The point coo │ │ │ +000a5cb0: 7264 696e 6174 6573 2073 686f 756c 640a rdinates should. │ │ │ +000a5cc0: 6265 2066 6c6f 6174 696e 672d 706f 696e be floating-poin │ │ │ +000a5cd0: 7420 2873 696e 676c 6520 6f72 2064 6f75 t (single or dou │ │ │ +000a5ce0: 626c 6520 7072 6563 6973 696f 6e29 2e3c ble precision).< │ │ │ +000a5cf0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e70 /dd>.
    p │ │ │ +000a5d00: 6f69 6e74 7332 3c2f 636f 6465 3e20 2d20 oints2 - │ │ │ +000a5d10: 4172 7261 7920 6f66 2074 6865 2073 6563 Array of the sec │ │ │ +000a5d20: 6f6e 6420 696d 6167 6520 706f 696e 7473 ond image points │ │ │ +000a5d30: 206f 6620 7468 6520 7361 6d65 2073 697a of the same siz │ │ │ +000a5d40: 6520 616e 6420 666f 726d 6174 2061 7320 e and format as │ │ │ +000a5d50: 706f 696e 7473 3120 2e3c 2f64 643e 0a3c points1 .
    .< │ │ │ +000a5d60: 6464 3e3c 636f 6465 3e66 6f63 616c 3c2f dd>focal - focal le │ │ │ +000a5d80: 6e67 7468 206f 6620 7468 6520 6361 6d65 ngth of the came │ │ │ +000a5d90: 7261 2e20 4e6f 7465 2074 6861 7420 7468 ra. Note that th │ │ │ +000a5da0: 6973 2066 756e 6374 696f 6e20 6173 7375 is function assu │ │ │ +000a5db0: 6d65 7320 7468 6174 2070 6f69 6e74 7331 mes that points1 │ │ │ +000a5dc0: 2061 6e64 2070 6f69 6e74 7332 0a61 7265 and points2.are │ │ │ +000a5dd0: 2066 6561 7475 7265 2070 6f69 6e74 7320 feature points │ │ │ +000a5de0: 6672 6f6d 2063 616d 6572 6173 2077 6974 from cameras wit │ │ │ +000a5df0: 6820 7361 6d65 2066 6f63 616c 206c 656e h same focal len │ │ │ +000a5e00: 6774 6820 616e 6420 7072 696e 6369 7061 gth and principa │ │ │ +000a5e10: 6c20 706f 696e 742e 3c2f 6464 3e0a 3c64 l point..pp - principal po │ │ │ +000a5e40: 696e 7420 6f66 2074 6865 2063 616d 6572 int of the camer │ │ │ +000a5e50: 612e 0a3c 756c 3e0a 2020 3c6c 693e 0a20 a..
      .
    • . │ │ │ +000a5e60: 2020 5245 463a 2052 414e 5341 4320 666f REF: RANSAC fo │ │ │ +000a5e70: 7220 7468 6520 5241 4e53 4143 2061 6c67 r the RANSAC alg │ │ │ +000a5e80: 6f72 6974 686d 2e0a 2020 3c2f 6c69 3e0a orithm..
    • . │ │ │ +000a5e90: 2020 3c6c 693e 0a20 2020 5245 463a 204c
    • . REF: L │ │ │ +000a5ea0: 4d45 4453 2066 6f72 2074 6865 204c 4d65 MEDS for the LMe │ │ │ +000a5eb0: 6453 2061 6c67 6f72 6974 686d 2e0a 2020 dS algorithm.. │ │ │ +000a5ec0: 3c2f 6c69 3e0a 3c2f 756c 3e0a 6c69 6e65
    • .
    .line │ │ │ +000a5ed0: 2069 6e20 7069 7865 6c73 2c20 6265 796f in pixels, beyo │ │ │ +000a5ee0: 6e64 2077 6869 6368 2074 6865 2070 6f69 nd which the poi │ │ │ +000a5ef0: 6e74 2069 7320 636f 6e73 6964 6572 6564 nt is considered │ │ │ +000a5f00: 2061 6e20 6f75 746c 6965 7220 616e 6420 an outlier and │ │ │ +000a5f10: 6973 206e 6f74 2075 7365 6420 666f 7220 is not used for │ │ │ +000a5f20: 636f 6d70 7574 696e 6720 7468 650a 6669 computing the.fi │ │ │ +000a5f30: 6e61 6c20 6675 6e64 616d 656e 7461 6c20 nal fundamental │ │ │ +000a5f40: 6d61 7472 6978 2e20 4974 2063 616e 2062 matrix. It can b │ │ │ +000a5f50: 6520 7365 7420 746f 2073 6f6d 6574 6869 e set to somethi │ │ │ +000a5f60: 6e67 206c 696b 6520 312d 332c 2064 6570 ng like 1-3, dep │ │ │ +000a5f70: 656e 6469 6e67 206f 6e20 7468 6520 6163 ending on the ac │ │ │ +000a5f80: 6375 7261 6379 206f 6620 7468 650a 706f curacy of the.po │ │ │ +000a5f90: 696e 7420 6c6f 6361 6c69 7a61 7469 6f6e int localization │ │ │ +000a5fa0: 2c20 696d 6167 6520 7265 736f 6c75 7469 , image resoluti │ │ │ +000a5fb0: 6f6e 2c20 616e 6420 7468 6520 696d 6167 on, and the imag │ │ │ +000a5fc0: 6520 6e6f 6973 652e 0a63 6f6e 6669 6465 e noise..confide │ │ │ +000a5fd0: 6e63 6520 2870 726f 6261 6269 6c69 7479 nce (probability │ │ │ +000a5fe0: 2920 7468 6174 2074 6865 2065 7374 696d ) that the estim │ │ │ +000a5ff0: 6174 6564 206d 6174 7269 7820 6973 2063 ated matrix is c │ │ │ +000a6000: 6f72 7265 6374 2e0a 666f 7220 7468 6520 orrect..for the │ │ │ +000a6010: 6f74 6865 7220 706f 696e 7473 2e20 5468 other points. Th │ │ │ +000a6020: 6520 6172 7261 7920 6973 2063 6f6d 7075 e array is compu │ │ │ +000a6030: 7465 6420 6f6e 6c79 2069 6e20 7468 6520 ted only in the │ │ │ +000a6040: 5241 4e53 4143 2061 6e64 204c 4d65 6453 RANSAC and LMedS │ │ │ +000a6050: 206d 6574 686f 6473 2e0a 0a54 6869 7320 methods...This │ │ │ +000a6060: 6675 6e63 7469 6f6e 2064 6966 6665 7273 function differs │ │ │ +000a6070: 2066 726f 6d20 7468 6520 6f6e 6520 6162 from the one ab │ │ │ +000a6080: 6f76 6520 7468 6174 2069 7420 636f 6d70 ove that it comp │ │ │ +000a6090: 7574 6573 2063 616d 6572 6120 696e 7472 utes camera intr │ │ │ +000a60a0: 696e 7369 6320 6d61 7472 6978 2066 726f insic matrix fro │ │ │ +000a60b0: 6d20 666f 6361 6c20 6c65 6e67 7468 2061 m focal length a │ │ │ +000a60c0: 6e64 0a70 7269 6e63 6970 616c 2070 6f69 nd.principal poi │ │ │ +000a60d0: 6e74 3a0a 0a5c 2841 203d 0a5c 6265 6769 nt:..\(A =.\begi │ │ │ +000a60e0: 6e7b 626d 6174 7269 787d 0a66 2026 616d n{bmatrix}.f &am │ │ │ +000a60f0: 703b 2030 2026 616d 703b 2078 5f7b 7070 p; 0 & x_{pp │ │ │ +000a6100: 7d20 205c 5c0a 3020 2661 6d70 3b20 6620 } \\.0 & f │ │ │ +000a6110: 2661 6d70 3b20 795f 7b70 707d 2020 5c5c & y_{pp} \\ │ │ │ +000a6120: 0a30 2026 616d 703b 2030 2026 616d 703b .0 & 0 & │ │ │ +000a6130: 2031 0a5c 656e 647b 626d 6174 7269 787d 1.\end{bmatrix} │ │ │ +000a6140: 5c29 3c2f 6464 3e0a 3c64 743e 5265 7475 \).
    Retu │ │ │ +000a6150: 726e 733a 3c2f 6474 3e0a 3c64 643e 6175 rns:
    .
    au │ │ │ +000a6160: 746f 6d61 7469 6361 6c6c 7920 6765 6e65 tomatically gene │ │ │ +000a6170: 7261 7465 643c 2f64 643e 0a3c 2f64 6c3e rated
    .
    │ │ │ +000a6180: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • ..

    findEssentialMa │ │ │ +000a6210: 743c 2f68 333e 0a3c 6469 7620 636c 6173 t

    .
    .
    pub │ │ │ +000a6270: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static Mat │ │ │ +000a62e0: 3c2f 613e 3c2f 7370 616e 3e26 6e62 7370   │ │ │ +000a62f0: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;find │ │ │ +000a6310: 4573 7365 6e74 6961 6c4d 6174 3c2f 7370 EssentialMat(Ma │ │ │ +000a6380: 743c 2f61 3e26 6e62 7370 3b70 6f69 6e74 t point │ │ │ +000a6390: 7331 2c0a 203c 6120 6872 6566 3d22 2e2e s1,. Mat po │ │ │ +000a63e0: 696e 7473 322c 0a20 646f 7562 6c65 266e ints2,. double&n │ │ │ +000a63f0: 6273 703b 666f 6361 6c29 3c2f 7370 616e bsp;focal)
    .
    .
    P │ │ │ +000a6420: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ +000a6430: 3c64 643e 3c63 6f64 653e 706f 696e 7473
    points │ │ │ +000a6440: 313c 2f63 6f64 653e 202d 2041 7272 6179 1 - Array │ │ │ +000a6450: 206f 6620 4e20 284e 2026 6774 3b3d 2035 of N (N >= 5 │ │ │ +000a6460: 2920 3244 2070 6f69 6e74 7320 6672 6f6d ) 2D points from │ │ │ +000a6470: 2074 6865 2066 6972 7374 2069 6d61 6765 the first image │ │ │ +000a6480: 2e20 5468 6520 706f 696e 7420 636f 6f72 . The point coor │ │ │ +000a6490: 6469 6e61 7465 7320 7368 6f75 6c64 0a62 dinates should.b │ │ │ +000a64a0: 6520 666c 6f61 7469 6e67 2d70 6f69 6e74 e floating-point │ │ │ +000a64b0: 2028 7369 6e67 6c65 206f 7220 646f 7562 (single or doub │ │ │ +000a64c0: 6c65 2070 7265 6369 7369 6f6e 292e 3c2f le precision)..
    po │ │ │ +000a64e0: 696e 7473 323c 2f63 6f64 653e 202d 2041 ints2 - A │ │ │ +000a64f0: 7272 6179 206f 6620 7468 6520 7365 636f rray of the seco │ │ │ +000a6500: 6e64 2069 6d61 6765 2070 6f69 6e74 7320 nd image points │ │ │ +000a6510: 6f66 2074 6865 2073 616d 6520 7369 7a65 of the same size │ │ │ +000a6520: 2061 6e64 2066 6f72 6d61 7420 6173 2070 and format as p │ │ │ +000a6530: 6f69 6e74 7331 202e 3c2f 6464 3e0a 3c64 oints1 .
    .focal - focal len │ │ │ +000a6560: 6774 6820 6f66 2074 6865 2063 616d 6572 gth of the camer │ │ │ +000a6570: 612e 204e 6f74 6520 7468 6174 2074 6869 a. Note that thi │ │ │ +000a6580: 7320 6675 6e63 7469 6f6e 2061 7373 756d s function assum │ │ │ +000a6590: 6573 2074 6861 7420 706f 696e 7473 3120 es that points1 │ │ │ +000a65a0: 616e 6420 706f 696e 7473 320a 6172 6520 and points2.are │ │ │ +000a65b0: 6665 6174 7572 6520 706f 696e 7473 2066 feature points f │ │ │ +000a65c0: 726f 6d20 6361 6d65 7261 7320 7769 7468 rom cameras with │ │ │ +000a65d0: 2073 616d 6520 666f 6361 6c20 6c65 6e67 same focal leng │ │ │ +000a65e0: 7468 2061 6e64 2070 7269 6e63 6970 616c th and principal │ │ │ +000a65f0: 2070 6f69 6e74 2e0a 3c75 6c3e 0a20 203c point..
      . < │ │ │ +000a6600: 6c69 3e0a 2020 2052 4546 3a20 5241 4e53 li>. REF: RANS │ │ │ +000a6610: 4143 2066 6f72 2074 6865 2052 414e 5341 AC for the RANSA │ │ │ +000a6620: 4320 616c 676f 7269 7468 6d2e 0a20 203c C algorithm.. < │ │ │ +000a6630: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2052 /li>.
    • . R │ │ │ +000a6640: 4546 3a20 4c4d 4544 5320 666f 7220 7468 EF: LMEDS for th │ │ │ +000a6650: 6520 4c4d 6564 5320 616c 676f 7269 7468 e LMedS algorith │ │ │ +000a6660: 6d2e 0a20 203c 2f6c 693e 0a3c 2f75 6c3e m..
    • .
    │ │ │ +000a6670: 0a6c 696e 6520 696e 2070 6978 656c 732c .line in pixels, │ │ │ +000a6680: 2062 6579 6f6e 6420 7768 6963 6820 7468 beyond which th │ │ │ +000a6690: 6520 706f 696e 7420 6973 2063 6f6e 7369 e point is consi │ │ │ +000a66a0: 6465 7265 6420 616e 206f 7574 6c69 6572 dered an outlier │ │ │ +000a66b0: 2061 6e64 2069 7320 6e6f 7420 7573 6564 and is not used │ │ │ +000a66c0: 2066 6f72 2063 6f6d 7075 7469 6e67 2074 for computing t │ │ │ +000a66d0: 6865 0a66 696e 616c 2066 756e 6461 6d65 he.final fundame │ │ │ +000a66e0: 6e74 616c 206d 6174 7269 782e 2049 7420 ntal matrix. It │ │ │ +000a66f0: 6361 6e20 6265 2073 6574 2074 6f20 736f can be set to so │ │ │ +000a6700: 6d65 7468 696e 6720 6c69 6b65 2031 2d33 mething like 1-3 │ │ │ +000a6710: 2c20 6465 7065 6e64 696e 6720 6f6e 2074 , depending on t │ │ │ +000a6720: 6865 2061 6363 7572 6163 7920 6f66 2074 he accuracy of t │ │ │ +000a6730: 6865 0a70 6f69 6e74 206c 6f63 616c 697a he.point localiz │ │ │ +000a6740: 6174 696f 6e2c 2069 6d61 6765 2072 6573 ation, image res │ │ │ +000a6750: 6f6c 7574 696f 6e2c 2061 6e64 2074 6865 olution, and the │ │ │ +000a6760: 2069 6d61 6765 206e 6f69 7365 2e0a 636f image noise..co │ │ │ +000a6770: 6e66 6964 656e 6365 2028 7072 6f62 6162 nfidence (probab │ │ │ +000a6780: 696c 6974 7929 2074 6861 7420 7468 6520 ility) that the │ │ │ +000a6790: 6573 7469 6d61 7465 6420 6d61 7472 6978 estimated matrix │ │ │ +000a67a0: 2069 7320 636f 7272 6563 742e 0a66 6f72 is correct..for │ │ │ +000a67b0: 2074 6865 206f 7468 6572 2070 6f69 6e74 the other point │ │ │ +000a67c0: 732e 2054 6865 2061 7272 6179 2069 7320 s. The array is │ │ │ +000a67d0: 636f 6d70 7574 6564 206f 6e6c 7920 696e computed only in │ │ │ +000a67e0: 2074 6865 2052 414e 5341 4320 616e 6420 the RANSAC and │ │ │ +000a67f0: 4c4d 6564 5320 6d65 7468 6f64 732e 0a0a LMedS methods... │ │ │ +000a6800: 5468 6973 2066 756e 6374 696f 6e20 6469 This function di │ │ │ +000a6810: 6666 6572 7320 6672 6f6d 2074 6865 206f ffers from the o │ │ │ +000a6820: 6e65 2061 626f 7665 2074 6861 7420 6974 ne above that it │ │ │ +000a6830: 2063 6f6d 7075 7465 7320 6361 6d65 7261 computes camera │ │ │ +000a6840: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ +000a6850: 7820 6672 6f6d 2066 6f63 616c 206c 656e x from focal len │ │ │ +000a6860: 6774 6820 616e 640a 7072 696e 6369 7061 gth and.principa │ │ │ +000a6870: 6c20 706f 696e 743a 0a0a 5c28 4120 3d0a l point:..\(A =. │ │ │ +000a6880: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ +000a6890: 6620 2661 6d70 3b20 3020 2661 6d70 3b20 f & 0 & │ │ │ +000a68a0: 785f 7b70 707d 2020 5c5c 0a30 2026 616d x_{pp} \\.0 &am │ │ │ +000a68b0: 703b 2066 2026 616d 703b 2079 5f7b 7070 p; f & y_{pp │ │ │ +000a68c0: 7d20 205c 5c0a 3020 2661 6d70 3b20 3020 } \\.0 & 0 │ │ │ +000a68d0: 2661 6d70 3b20 310a 5c65 6e64 7b62 6d61 & 1.\end{bma │ │ │ +000a68e0: 7472 6978 7d5c 293c 2f64 643e 0a3c 6474 trix}\).
    Returns:
    .< │ │ │ +000a6900: 6464 3e61 7574 6f6d 6174 6963 616c 6c79 dd>automatically │ │ │ +000a6910: 2067 656e 6572 6174 6564 3c2f 6464 3e0a generated. │ │ │ +000a6920: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    .
    .
  • ..
    .

    f │ │ │ +000a69a0: 696e 6445 7373 656e 7469 616c 4d61 743c indEssentialMat< │ │ │ +000a69b0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +000a6a10: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +000a6a20: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;< │ │ │ +000a6a40: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000a6a50: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000a6a60: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000a6a70: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat < │ │ │ +000a6a90: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +000a6aa0: 656e 742d 6e61 6d65 223e 6669 6e64 4573 ent-name">findEs │ │ │ +000a6ab0: 7365 6e74 6961 6c4d 6174 3c2f 7370 616e sentialMat( │ │ │ +000a6ae0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000a6b20: 2f61 3e26 6e62 7370 3b70 6f69 6e74 7331 /a> points1 │ │ │ +000a6b30: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000a6b70: 6174 3c2f 613e 266e 6273 703b 706f 696e at poin │ │ │ +000a6b80: 7473 3229 3c2f 7370 616e 3e3c 2f64 6976 ts2)
    .
    .
    Paramet │ │ │ +000a6bb0: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    points1 - Array of N │ │ │ +000a6be0: 284e 2026 6774 3b3d 2035 2920 3244 2070 (N >= 5) 2D p │ │ │ +000a6bf0: 6f69 6e74 7320 6672 6f6d 2074 6865 2066 oints from the f │ │ │ +000a6c00: 6972 7374 2069 6d61 6765 2e20 5468 6520 irst image. The │ │ │ +000a6c10: 706f 696e 7420 636f 6f72 6469 6e61 7465 point coordinate │ │ │ +000a6c20: 7320 7368 6f75 6c64 0a62 6520 666c 6f61 s should.be floa │ │ │ +000a6c30: 7469 6e67 2d70 6f69 6e74 2028 7369 6e67 ting-point (sing │ │ │ +000a6c40: 6c65 206f 7220 646f 7562 6c65 2070 7265 le or double pre │ │ │ +000a6c50: 6369 7369 6f6e 292e 3c2f 6464 3e0a 3c64 cision).
    .points2< │ │ │ +000a6c70: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ +000a6c80: 6620 7468 6520 7365 636f 6e64 2069 6d61 f the second ima │ │ │ +000a6c90: 6765 2070 6f69 6e74 7320 6f66 2074 6865 ge points of the │ │ │ +000a6ca0: 2073 616d 6520 7369 7a65 2061 6e64 2066 same size and f │ │ │ +000a6cb0: 6f72 6d61 7420 6173 2070 6f69 6e74 7331 ormat as points1 │ │ │ +000a6cc0: 202e 0a61 7265 2066 6561 7475 7265 2070 ..are feature p │ │ │ +000a6cd0: 6f69 6e74 7320 6672 6f6d 2063 616d 6572 oints from camer │ │ │ +000a6ce0: 6173 2077 6974 6820 7361 6d65 2066 6f63 as with same foc │ │ │ +000a6cf0: 616c 206c 656e 6774 6820 616e 6420 7072 al length and pr │ │ │ +000a6d00: 696e 6369 7061 6c20 706f 696e 742e 0a3c incipal point..< │ │ │ +000a6d10: 756c 3e0a 2020 3c6c 693e 0a20 2020 5245 ul>.
  • . RE │ │ │ +000a6d20: 463a 2052 414e 5341 4320 666f 7220 7468 F: RANSAC for th │ │ │ +000a6d30: 6520 5241 4e53 4143 2061 6c67 6f72 6974 e RANSAC algorit │ │ │ +000a6d40: 686d 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c hm..
  • . . REF: LMEDS │ │ │ +000a6d60: 2066 6f72 2074 6865 204c 4d65 6453 2061 for the LMedS a │ │ │ +000a6d70: 6c67 6f72 6974 686d 2e0a 2020 3c2f 6c69 lgorithm.. ..line in │ │ │ +000a6d90: 7069 7865 6c73 2c20 6265 796f 6e64 2077 pixels, beyond w │ │ │ +000a6da0: 6869 6368 2074 6865 2070 6f69 6e74 2069 hich the point i │ │ │ +000a6db0: 7320 636f 6e73 6964 6572 6564 2061 6e20 s considered an │ │ │ +000a6dc0: 6f75 746c 6965 7220 616e 6420 6973 206e outlier and is n │ │ │ +000a6dd0: 6f74 2075 7365 6420 666f 7220 636f 6d70 ot used for comp │ │ │ +000a6de0: 7574 696e 6720 7468 650a 6669 6e61 6c20 uting the.final │ │ │ +000a6df0: 6675 6e64 616d 656e 7461 6c20 6d61 7472 fundamental matr │ │ │ +000a6e00: 6978 2e20 4974 2063 616e 2062 6520 7365 ix. It can be se │ │ │ +000a6e10: 7420 746f 2073 6f6d 6574 6869 6e67 206c t to something l │ │ │ +000a6e20: 696b 6520 312d 332c 2064 6570 656e 6469 ike 1-3, dependi │ │ │ +000a6e30: 6e67 206f 6e20 7468 6520 6163 6375 7261 ng on the accura │ │ │ +000a6e40: 6379 206f 6620 7468 650a 706f 696e 7420 cy of the.point │ │ │ +000a6e50: 6c6f 6361 6c69 7a61 7469 6f6e 2c20 696d localization, im │ │ │ +000a6e60: 6167 6520 7265 736f 6c75 7469 6f6e 2c20 age resolution, │ │ │ +000a6e70: 616e 6420 7468 6520 696d 6167 6520 6e6f and the image no │ │ │ +000a6e80: 6973 652e 0a63 6f6e 6669 6465 6e63 6520 ise..confidence │ │ │ +000a6e90: 2870 726f 6261 6269 6c69 7479 2920 7468 (probability) th │ │ │ +000a6ea0: 6174 2074 6865 2065 7374 696d 6174 6564 at the estimated │ │ │ +000a6eb0: 206d 6174 7269 7820 6973 2063 6f72 7265 matrix is corre │ │ │ +000a6ec0: 6374 2e0a 666f 7220 7468 6520 6f74 6865 ct..for the othe │ │ │ +000a6ed0: 7220 706f 696e 7473 2e20 5468 6520 6172 r points. The ar │ │ │ +000a6ee0: 7261 7920 6973 2063 6f6d 7075 7465 6420 ray is computed │ │ │ +000a6ef0: 6f6e 6c79 2069 6e20 7468 6520 5241 4e53 only in the RANS │ │ │ +000a6f00: 4143 2061 6e64 204c 4d65 6453 206d 6574 AC and LMedS met │ │ │ +000a6f10: 686f 6473 2e0a 0a54 6869 7320 6675 6e63 hods...This func │ │ │ +000a6f20: 7469 6f6e 2064 6966 6665 7273 2066 726f tion differs fro │ │ │ +000a6f30: 6d20 7468 6520 6f6e 6520 6162 6f76 6520 m the one above │ │ │ +000a6f40: 7468 6174 2069 7420 636f 6d70 7574 6573 that it computes │ │ │ +000a6f50: 2063 616d 6572 6120 696e 7472 696e 7369 camera intrinsi │ │ │ +000a6f60: 6320 6d61 7472 6978 2066 726f 6d20 666f c matrix from fo │ │ │ +000a6f70: 6361 6c20 6c65 6e67 7468 2061 6e64 0a70 cal length and.p │ │ │ +000a6f80: 7269 6e63 6970 616c 2070 6f69 6e74 3a0a rincipal point:. │ │ │ +000a6f90: 0a5c 2841 203d 0a5c 6265 6769 6e7b 626d .\(A =.\begin{bm │ │ │ +000a6fa0: 6174 7269 787d 0a66 2026 616d 703b 2030 atrix}.f & 0 │ │ │ +000a6fb0: 2026 616d 703b 2078 5f7b 7070 7d20 205c & x_{pp} \ │ │ │ +000a6fc0: 5c0a 3020 2661 6d70 3b20 6620 2661 6d70 \.0 & f & │ │ │ +000a6fd0: 3b20 795f 7b70 707d 2020 5c5c 0a30 2026 ; y_{pp} \\.0 & │ │ │ +000a6fe0: 616d 703b 2030 2026 616d 703b 2031 0a5c amp; 0 & 1.\ │ │ │ +000a6ff0: 656e 647b 626d 6174 7269 787d 5c29 3c2f end{bmatrix}\).
    Returns: │ │ │ +000a7010: 3c2f 6474 3e0a 3c64 643e 6175 746f 6d61
    .
    automa │ │ │ +000a7020: 7469 6361 6c6c 7920 6765 6e65 7261 7465 tically generate │ │ │ +000a7030: 643c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 d
    .
    ..

    .< │ │ │ +000a7050: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    find │ │ │ +000a7130: 4573 7365 6e74 6961 6c4d 6174 3c2f 6833 EssentialMat

    .
    .
    │ │ │ +000a7180: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +000a71a0: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +000a71b0: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;Mat< │ │ │ +000a7210: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> findEssen │ │ │ +000a7240: 7469 616c 4d61 743c 2f73 7061 6e3e 3c77 tialMat(Mat │ │ │ +000a72b0: 266e 6273 703b 706f 696e 7473 312c 0a20  points1,. │ │ │ +000a72c0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000a7300: 2f61 3e26 6e62 7370 3b70 6f69 6e74 7332 /a> points2 │ │ │ +000a7310: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000a7350: 6174 3c2f 613e 266e 6273 703b 6361 6d65 at came │ │ │ +000a7360: 7261 4d61 7472 6978 312c 0a20 3c61 2068 raMatrix1,. Mat& │ │ │ +000a73b0: 6e62 7370 3b64 6973 7443 6f65 6666 7331 nbsp;distCoeffs1 │ │ │ +000a73c0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000a7400: 6174 3c2f 613e 266e 6273 703b 6361 6d65 at came │ │ │ +000a7410: 7261 4d61 7472 6978 322c 0a20 3c61 2068 raMatrix2,. Mat& │ │ │ +000a7460: 6e62 7370 3b64 6973 7443 6f65 6666 7332 nbsp;distCoeffs2 │ │ │ +000a7470: 2c0a 2069 6e74 266e 6273 703b 6d65 7468 ,. int meth │ │ │ +000a7480: 6f64 2c0a 2064 6f75 626c 6526 6e62 7370 od,. double  │ │ │ +000a7490: 3b70 726f 622c 0a20 646f 7562 6c65 266e ;prob,. double&n │ │ │ +000a74a0: 6273 703b 7468 7265 7368 6f6c 642c 0a20 bsp;threshold,. │ │ │ +000a74b0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000a74f0: 2f61 3e26 6e62 7370 3b6d 6173 6b29 3c2f /a> mask)
    .
    C │ │ │ +000a7520: 616c 6375 6c61 7465 7320 616e 2065 7373 alculates an ess │ │ │ +000a7530: 656e 7469 616c 206d 6174 7269 7820 6672 ential matrix fr │ │ │ +000a7540: 6f6d 2074 6865 2063 6f72 7265 7370 6f6e om the correspon │ │ │ +000a7550: 6469 6e67 2070 6f69 6e74 7320 696e 2074 ding points in t │ │ │ +000a7560: 776f 2069 6d61 6765 7320 6672 6f6d 2070 wo images from p │ │ │ +000a7570: 6f74 656e 7469 616c 6c79 2074 776f 2064 otentially two d │ │ │ +000a7580: 6966 6665 7265 6e74 2063 616d 6572 6173 ifferent cameras │ │ │ +000a7590: 2e3c 2f64 6976 3e0a 3c64 6c20 636c 6173 .
    .
    .
    P │ │ │ +000a75b0: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ +000a75c0: 3c64 643e 3c63 6f64 653e 706f 696e 7473
    points │ │ │ +000a75d0: 313c 2f63 6f64 653e 202d 2041 7272 6179 1 - Array │ │ │ +000a75e0: 206f 6620 4e20 284e 2026 6774 3b3d 2035 of N (N >= 5 │ │ │ +000a75f0: 2920 3244 2070 6f69 6e74 7320 6672 6f6d ) 2D points from │ │ │ +000a7600: 2074 6865 2066 6972 7374 2069 6d61 6765 the first image │ │ │ +000a7610: 2e20 5468 6520 706f 696e 7420 636f 6f72 . The point coor │ │ │ +000a7620: 6469 6e61 7465 7320 7368 6f75 6c64 0a62 dinates should.b │ │ │ +000a7630: 6520 666c 6f61 7469 6e67 2d70 6f69 6e74 e floating-point │ │ │ +000a7640: 2028 7369 6e67 6c65 206f 7220 646f 7562 (single or doub │ │ │ +000a7650: 6c65 2070 7265 6369 7369 6f6e 292e 3c2f le precision)..
    po │ │ │ +000a7670: 696e 7473 323c 2f63 6f64 653e 202d 2041 ints2 - A │ │ │ +000a7680: 7272 6179 206f 6620 7468 6520 7365 636f rray of the seco │ │ │ +000a7690: 6e64 2069 6d61 6765 2070 6f69 6e74 7320 nd image points │ │ │ +000a76a0: 6f66 2074 6865 2073 616d 6520 7369 7a65 of the same size │ │ │ +000a76b0: 2061 6e64 2066 6f72 6d61 7420 6173 2070 and format as p │ │ │ +000a76c0: 6f69 6e74 7331 2e3c 2f64 643e 0a3c 6464 oints1.
    .
    cameraMat │ │ │ +000a76e0: 7269 7831 3c2f 636f 6465 3e20 2d20 4361 rix1 - Ca │ │ │ +000a76f0: 6d65 7261 206d 6174 7269 7820 666f 7220 mera matrix for │ │ │ +000a7700: 7468 6520 6669 7273 7420 6361 6d65 7261 the first camera │ │ │ +000a7710: 205c 284b 203d 205c 7665 6374 6872 6565 \(K = \vecthree │ │ │ +000a7720: 7468 7265 657b 665f 787d 7b30 7d7b 635f three{f_x}{0}{c_ │ │ │ +000a7730: 787d 7b30 7d7b 665f 797d 7b63 5f79 7d7b x}{0}{f_y}{c_y}{ │ │ │ +000a7740: 307d 7b30 7d7b 317d 5c29 202e 3c2f 6464 0}{0}{1}\) .
    .
    dist │ │ │ +000a7760: 436f 6566 6673 313c 2f63 6f64 653e 202d Coeffs1 - │ │ │ +000a7770: 2049 6e70 7574 2076 6563 746f 7220 6f66 Input vector of │ │ │ +000a7780: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ +000a7790: 6669 6369 656e 7473 2066 6f72 2074 6865 ficients for the │ │ │ +000a77a0: 2066 6972 7374 2063 616d 6572 610a 5c28 first camera.\( │ │ │ +000a77b0: 286b 5f31 2c20 6b5f 322c 2070 5f31 2c20 (k_1, k_2, p_1, │ │ │ +000a77c0: 705f 325b 2c20 6b5f 335b 2c20 6b5f 342c p_2[, k_3[, k_4, │ │ │ +000a77d0: 206b 5f35 2c20 6b5f 365b 2c20 735f 312c k_5, k_6[, s_1, │ │ │ +000a77e0: 2073 5f32 2c20 735f 332c 2073 5f34 5b2c s_2, s_3, s_4[, │ │ │ +000a77f0: 205c 7461 755f 782c 205c 7461 755f 795d \tau_x, \tau_y] │ │ │ +000a7800: 5d5d 5d29 5c29 0a6f 6620 342c 2035 2c20 ]]])\).of 4, 5, │ │ │ +000a7810: 382c 2031 3220 6f72 2031 3420 656c 656d 8, 12 or 14 elem │ │ │ +000a7820: 656e 7473 2e20 4966 2074 6865 2076 6563 ents. If the vec │ │ │ +000a7830: 746f 7220 6973 204e 554c 4c2f 656d 7074 tor is NULL/empt │ │ │ +000a7840: 792c 2074 6865 207a 6572 6f20 6469 7374 y, the zero dist │ │ │ +000a7850: 6f72 7469 6f6e 2063 6f65 6666 6963 6965 ortion coefficie │ │ │ +000a7860: 6e74 7320 6172 6520 6173 7375 6d65 642e nts are assumed. │ │ │ +000a7870: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000a7880: 6361 6d65 7261 4d61 7472 6978 323c 2f63 cameraMatrix2 - Camera ma │ │ │ +000a78a0: 7472 6978 2066 6f72 2074 6865 2073 6563 trix for the sec │ │ │ +000a78b0: 6f6e 6420 6361 6d65 7261 205c 284b 203d ond camera \(K = │ │ │ +000a78c0: 205c 7665 6374 6872 6565 7468 7265 657b \vecthreethree{ │ │ │ +000a78d0: 665f 787d 7b30 7d7b 635f 787d 7b30 7d7b f_x}{0}{c_x}{0}{ │ │ │ +000a78e0: 665f 797d 7b63 5f79 7d7b 307d 7b30 7d7b f_y}{c_y}{0}{0}{ │ │ │ +000a78f0: 317d 5c29 202e 3c2f 6464 3e0a 3c64 643e 1}\) .
    .
    │ │ │ +000a7900: 3c63 6f64 653e 6469 7374 436f 6566 6673 distCoeffs │ │ │ +000a7910: 323c 2f63 6f64 653e 202d 2049 6e70 7574 2 - Input │ │ │ +000a7920: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ +000a7930: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ +000a7940: 7473 2066 6f72 2074 6865 2073 6563 6f6e ts for the secon │ │ │ +000a7950: 6420 6361 6d65 7261 0a5c 2828 6b5f 312c d camera.\((k_1, │ │ │ +000a7960: 206b 5f32 2c20 705f 312c 2070 5f32 5b2c k_2, p_1, p_2[, │ │ │ +000a7970: 206b 5f33 5b2c 206b 5f34 2c20 6b5f 352c k_3[, k_4, k_5, │ │ │ +000a7980: 206b 5f36 5b2c 2073 5f31 2c20 735f 322c k_6[, s_1, s_2, │ │ │ +000a7990: 2073 5f33 2c20 735f 345b 2c20 5c74 6175 s_3, s_4[, \tau │ │ │ +000a79a0: 5f78 2c20 5c74 6175 5f79 5d5d 5d5d 295c _x, \tau_y]]]])\ │ │ │ +000a79b0: 290a 6f66 2034 2c20 352c 2038 2c20 3132 ).of 4, 5, 8, 12 │ │ │ +000a79c0: 206f 7220 3134 2065 6c65 6d65 6e74 732e or 14 elements. │ │ │ +000a79d0: 2049 6620 7468 6520 7665 6374 6f72 2069 If the vector i │ │ │ +000a79e0: 7320 4e55 4c4c 2f65 6d70 7479 2c20 7468 s NULL/empty, th │ │ │ +000a79f0: 6520 7a65 726f 2064 6973 746f 7274 696f e zero distortio │ │ │ +000a7a00: 6e20 636f 6566 6669 6369 656e 7473 2061 n coefficients a │ │ │ +000a7a10: 7265 2061 7373 756d 6564 2e3c 2f64 643e re assumed.
    │ │ │ +000a7a20: 0a3c 6464 3e3c 636f 6465 3e6d 6574 686f .
    metho │ │ │ +000a7a30: 643c 2f63 6f64 653e 202d 204d 6574 686f d - Metho │ │ │ +000a7a40: 6420 666f 7220 636f 6d70 7574 696e 6720 d for computing │ │ │ +000a7a50: 616e 2065 7373 656e 7469 616c 206d 6174 an essential mat │ │ │ +000a7a60: 7269 782e 0a3c 756c 3e0a 2020 3c6c 693e rix..
      .
    • │ │ │ +000a7a70: 0a20 2020 5245 463a 2052 414e 5341 4320 . REF: RANSAC │ │ │ +000a7a80: 666f 7220 7468 6520 5241 4e53 4143 2061 for the RANSAC a │ │ │ +000a7a90: 6c67 6f72 6974 686d 2e0a 2020 3c2f 6c69 lgorithm..
    • .
    • . REF: │ │ │ +000a7ab0: 204c 4d45 4453 2066 6f72 2074 6865 204c LMEDS for the L │ │ │ +000a7ac0: 4d65 6453 2061 6c67 6f72 6974 686d 2e0a MedS algorithm.. │ │ │ +000a7ad0: 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64
    • .
    .
    pro │ │ │ +000a7af0: 623c 2f63 6f64 653e 202d 2050 6172 616d b - Param │ │ │ +000a7b00: 6574 6572 2075 7365 6420 666f 7220 7468 eter used for th │ │ │ +000a7b10: 6520 5241 4e53 4143 206f 7220 4c4d 6564 e RANSAC or LMed │ │ │ +000a7b20: 5320 6d65 7468 6f64 7320 6f6e 6c79 2e20 S methods only. │ │ │ +000a7b30: 4974 2073 7065 6369 6669 6573 2061 2064 It specifies a d │ │ │ +000a7b40: 6573 6972 6162 6c65 206c 6576 656c 206f esirable level o │ │ │ +000a7b50: 660a 636f 6e66 6964 656e 6365 2028 7072 f.confidence (pr │ │ │ +000a7b60: 6f62 6162 696c 6974 7929 2074 6861 7420 obability) that │ │ │ +000a7b70: 7468 6520 6573 7469 6d61 7465 6420 6d61 the estimated ma │ │ │ +000a7b80: 7472 6978 2069 7320 636f 7272 6563 742e trix is correct. │ │ │ +000a7b90: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000a7ba0: 7468 7265 7368 6f6c 643c 2f63 6f64 653e threshold │ │ │ +000a7bb0: 202d 2050 6172 616d 6574 6572 2075 7365 - Parameter use │ │ │ +000a7bc0: 6420 666f 7220 5241 4e53 4143 2e20 4974 d for RANSAC. It │ │ │ +000a7bd0: 2069 7320 7468 6520 6d61 7869 6d75 6d20 is the maximum │ │ │ +000a7be0: 6469 7374 616e 6365 2066 726f 6d20 6120 distance from a │ │ │ +000a7bf0: 706f 696e 7420 746f 2061 6e20 6570 6970 point to an epip │ │ │ +000a7c00: 6f6c 6172 0a6c 696e 6520 696e 2070 6978 olar.line in pix │ │ │ +000a7c10: 656c 732c 2062 6579 6f6e 6420 7768 6963 els, beyond whic │ │ │ +000a7c20: 6820 7468 6520 706f 696e 7420 6973 2063 h the point is c │ │ │ +000a7c30: 6f6e 7369 6465 7265 6420 616e 206f 7574 onsidered an out │ │ │ +000a7c40: 6c69 6572 2061 6e64 2069 7320 6e6f 7420 lier and is not │ │ │ +000a7c50: 7573 6564 2066 6f72 2063 6f6d 7075 7469 used for computi │ │ │ +000a7c60: 6e67 2074 6865 0a66 696e 616c 2066 756e ng the.final fun │ │ │ +000a7c70: 6461 6d65 6e74 616c 206d 6174 7269 782e damental matrix. │ │ │ +000a7c80: 2049 7420 6361 6e20 6265 2073 6574 2074 It can be set t │ │ │ +000a7c90: 6f20 736f 6d65 7468 696e 6720 6c69 6b65 o something like │ │ │ +000a7ca0: 2031 2d33 2c20 6465 7065 6e64 696e 6720 1-3, depending │ │ │ +000a7cb0: 6f6e 2074 6865 2061 6363 7572 6163 7920 on the accuracy │ │ │ +000a7cc0: 6f66 2074 6865 0a70 6f69 6e74 206c 6f63 of the.point loc │ │ │ +000a7cd0: 616c 697a 6174 696f 6e2c 2069 6d61 6765 alization, image │ │ │ +000a7ce0: 2072 6573 6f6c 7574 696f 6e2c 2061 6e64 resolution, and │ │ │ +000a7cf0: 2074 6865 2069 6d61 6765 206e 6f69 7365 the image noise │ │ │ +000a7d00: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    mask - O │ │ │ +000a7d20: 7574 7075 7420 6172 7261 7920 6f66 204e utput array of N │ │ │ +000a7d30: 2065 6c65 6d65 6e74 732c 2065 7665 7279 elements, every │ │ │ +000a7d40: 2065 6c65 6d65 6e74 206f 6620 7768 6963 element of whic │ │ │ +000a7d50: 6820 6973 2073 6574 2074 6f20 3020 666f h is set to 0 fo │ │ │ +000a7d60: 7220 6f75 746c 6965 7273 2061 6e64 2074 r outliers and t │ │ │ +000a7d70: 6f20 310a 666f 7220 7468 6520 6f74 6865 o 1.for the othe │ │ │ +000a7d80: 7220 706f 696e 7473 2e20 5468 6520 6172 r points. The ar │ │ │ +000a7d90: 7261 7920 6973 2063 6f6d 7075 7465 6420 ray is computed │ │ │ +000a7da0: 6f6e 6c79 2069 6e20 7468 6520 5241 4e53 only in the RANS │ │ │ +000a7db0: 4143 2061 6e64 204c 4d65 6453 206d 6574 AC and LMedS met │ │ │ +000a7dc0: 686f 6473 2e0a 0a54 6869 7320 6675 6e63 hods...This func │ │ │ +000a7dd0: 7469 6f6e 2065 7374 696d 6174 6573 2065 tion estimates e │ │ │ +000a7de0: 7373 656e 7469 616c 206d 6174 7269 7820 ssential matrix │ │ │ +000a7df0: 6261 7365 6420 6f6e 2074 6865 2066 6976 based on the fiv │ │ │ +000a7e00: 652d 706f 696e 7420 616c 676f 7269 7468 e-point algorith │ │ │ +000a7e10: 6d20 736f 6c76 6572 2069 6e20 4349 5445 m solver in CITE │ │ │ +000a7e20: 3a20 4e69 7374 6572 3033 202e 0a43 4954 : Nister03 ..CIT │ │ │ +000a7e30: 453a 2053 7465 7765 6e69 7573 4346 5320 E: SteweniusCFS │ │ │ +000a7e40: 6973 2061 6c73 6f20 6120 7265 6c61 7465 is also a relate │ │ │ +000a7e50: 642e 2054 6865 2065 7069 706f 6c61 7220 d. The epipolar │ │ │ +000a7e60: 6765 6f6d 6574 7279 2069 7320 6465 7363 geometry is desc │ │ │ +000a7e70: 7269 6265 6420 6279 2074 6865 2066 6f6c ribed by the fol │ │ │ +000a7e80: 6c6f 7769 6e67 2065 7175 6174 696f 6e3a lowing equation: │ │ │ +000a7e90: 0a0a 5c28 5b70 5f32 3b20 315d 5e54 204b ..\([p_2; 1]^T K │ │ │ +000a7ea0: 5e7b 2d54 7d20 4520 4b5e 7b2d 317d 205b ^{-T} E K^{-1} [ │ │ │ +000a7eb0: 705f 313b 2031 5d20 3d20 305c 290a 0a77 p_1; 1] = 0\)..w │ │ │ +000a7ec0: 6865 7265 205c 2845 5c29 2069 7320 616e here \(E\) is an │ │ │ +000a7ed0: 2065 7373 656e 7469 616c 206d 6174 7269 essential matri │ │ │ +000a7ee0: 782c 205c 2870 5f31 5c29 2061 6e64 205c x, \(p_1\) and \ │ │ │ +000a7ef0: 2870 5f32 5c29 2061 7265 2063 6f72 7265 (p_2\) are corre │ │ │ +000a7f00: 7370 6f6e 6469 6e67 2070 6f69 6e74 7320 sponding points │ │ │ +000a7f10: 696e 2074 6865 2066 6972 7374 2061 6e64 in the first and │ │ │ +000a7f20: 2074 6865 0a73 6563 6f6e 6420 696d 6167 the.second imag │ │ │ +000a7f30: 6573 2c20 7265 7370 6563 7469 7665 6c79 es, respectively │ │ │ +000a7f40: 2e20 5468 6520 7265 7375 6c74 206f 6620 . The result of │ │ │ +000a7f50: 7468 6973 2066 756e 6374 696f 6e20 6d61 this function ma │ │ │ +000a7f60: 7920 6265 2070 6173 7365 6420 6675 7274 y be passed furt │ │ │ +000a7f70: 6865 7220 746f 0a23 6465 636f 6d70 6f73 her to.#decompos │ │ │ +000a7f80: 6545 7373 656e 7469 616c 4d61 7420 6f72 eEssentialMat or │ │ │ +000a7f90: 2020 2372 6563 6f76 6572 506f 7365 2074 #recoverPose t │ │ │ +000a7fa0: 6f20 7265 636f 7665 7220 7468 6520 7265 o recover the re │ │ │ +000a7fb0: 6c61 7469 7665 2070 6f73 6520 6265 7477 lative pose betw │ │ │ +000a7fc0: 6565 6e20 6361 6d65 7261 732e 3c2f 6464 een cameras.
    .
    Returns:.
    automati │ │ │ +000a7ff0: 6361 6c6c 7920 6765 6e65 7261 7465 643c cally generated< │ │ │ +000a8000: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .
  • ..
  • .
    .

    findEssent │ │ │ +000a80f0: 6961 6c4d 6174 3c2f 6833 3e0a 3c64 6976 ialMat

    .
    .
    public static< │ │ │ +000a8160: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> Mat │ │ │ +000a81d0: 266e 6273 703b 3c73 7061 6e20 636c 6173  findEssentialMa │ │ │ +000a8200: 743c 2f73 7061 6e3e 3c77 6272 3e3c 7370 t(Mat  │ │ │ +000a8270: 706f 696e 7473 312c 0a20 3c61 2068 7265 points1,. Mat&nb │ │ │ +000a82c0: 7370 3b70 6f69 6e74 7332 2c0a 203c 6120 sp;points2,. Mat │ │ │ +000a8310: 266e 6273 703b 6361 6d65 7261 4d61 7472  cameraMatr │ │ │ +000a8320: 6978 312c 0a20 3c61 2068 7265 663d 222e ix1,. Mat d │ │ │ +000a8370: 6973 7443 6f65 6666 7331 2c0a 203c 6120 istCoeffs1,. Mat │ │ │ +000a83c0: 266e 6273 703b 6361 6d65 7261 4d61 7472  cameraMatr │ │ │ +000a83d0: 6978 322c 0a20 3c61 2068 7265 663d 222e ix2,. Mat d │ │ │ +000a8420: 6973 7443 6f65 6666 7332 2c0a 2069 6e74 istCoeffs2,. int │ │ │ +000a8430: 266e 6273 703b 6d65 7468 6f64 2c0a 2064  method,. d │ │ │ +000a8440: 6f75 626c 6526 6e62 7370 3b70 726f 622c ouble prob, │ │ │ +000a8450: 0a20 646f 7562 6c65 266e 6273 703b 7468 . double th │ │ │ +000a8460: 7265 7368 6f6c 6429 3c2f 7370 616e 3e3c reshold)< │ │ │ +000a8470: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Calcula │ │ │ +000a8490: 7465 7320 616e 2065 7373 656e 7469 616c tes an essential │ │ │ +000a84a0: 206d 6174 7269 7820 6672 6f6d 2074 6865 matrix from the │ │ │ +000a84b0: 2063 6f72 7265 7370 6f6e 6469 6e67 2070 corresponding p │ │ │ +000a84c0: 6f69 6e74 7320 696e 2074 776f 2069 6d61 oints in two ima │ │ │ +000a84d0: 6765 7320 6672 6f6d 2070 6f74 656e 7469 ges from potenti │ │ │ +000a84e0: 616c 6c79 2074 776f 2064 6966 6665 7265 ally two differe │ │ │ +000a84f0: 6e74 2063 616d 6572 6173 2e3c 2f64 6976 nt cameras.
    .
    .
    Paramet │ │ │ +000a8520: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    points1 - Array of N │ │ │ +000a8550: 284e 2026 6774 3b3d 2035 2920 3244 2070 (N >= 5) 2D p │ │ │ +000a8560: 6f69 6e74 7320 6672 6f6d 2074 6865 2066 oints from the f │ │ │ +000a8570: 6972 7374 2069 6d61 6765 2e20 5468 6520 irst image. The │ │ │ +000a8580: 706f 696e 7420 636f 6f72 6469 6e61 7465 point coordinate │ │ │ +000a8590: 7320 7368 6f75 6c64 0a62 6520 666c 6f61 s should.be floa │ │ │ +000a85a0: 7469 6e67 2d70 6f69 6e74 2028 7369 6e67 ting-point (sing │ │ │ +000a85b0: 6c65 206f 7220 646f 7562 6c65 2070 7265 le or double pre │ │ │ +000a85c0: 6369 7369 6f6e 292e 3c2f 6464 3e0a 3c64 cision).
    .points2< │ │ │ +000a85e0: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ +000a85f0: 6620 7468 6520 7365 636f 6e64 2069 6d61 f the second ima │ │ │ +000a8600: 6765 2070 6f69 6e74 7320 6f66 2074 6865 ge points of the │ │ │ +000a8610: 2073 616d 6520 7369 7a65 2061 6e64 2066 same size and f │ │ │ +000a8620: 6f72 6d61 7420 6173 2070 6f69 6e74 7331 ormat as points1 │ │ │ +000a8630: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 ..
    cameraMatrix1 - Camera m │ │ │ +000a8660: 6174 7269 7820 666f 7220 7468 6520 6669 atrix for the fi │ │ │ +000a8670: 7273 7420 6361 6d65 7261 205c 284b 203d rst camera \(K = │ │ │ +000a8680: 205c 7665 6374 6872 6565 7468 7265 657b \vecthreethree{ │ │ │ +000a8690: 665f 787d 7b30 7d7b 635f 787d 7b30 7d7b f_x}{0}{c_x}{0}{ │ │ │ +000a86a0: 665f 797d 7b63 5f79 7d7b 307d 7b30 7d7b f_y}{c_y}{0}{0}{ │ │ │ +000a86b0: 317d 5c29 202e 3c2f 6464 3e0a 3c64 643e 1}\) .
    .
    │ │ │ +000a86c0: 3c63 6f64 653e 6469 7374 436f 6566 6673 distCoeffs │ │ │ +000a86d0: 313c 2f63 6f64 653e 202d 2049 6e70 7574 1 - Input │ │ │ +000a86e0: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ +000a86f0: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ +000a8700: 7473 2066 6f72 2074 6865 2066 6972 7374 ts for the first │ │ │ +000a8710: 2063 616d 6572 610a 5c28 286b 5f31 2c20 camera.\((k_1, │ │ │ +000a8720: 6b5f 322c 2070 5f31 2c20 705f 325b 2c20 k_2, p_1, p_2[, │ │ │ +000a8730: 6b5f 335b 2c20 6b5f 342c 206b 5f35 2c20 k_3[, k_4, k_5, │ │ │ +000a8740: 6b5f 365b 2c20 735f 312c 2073 5f32 2c20 k_6[, s_1, s_2, │ │ │ +000a8750: 735f 332c 2073 5f34 5b2c 205c 7461 755f s_3, s_4[, \tau_ │ │ │ +000a8760: 782c 205c 7461 755f 795d 5d5d 5d29 5c29 x, \tau_y]]]])\) │ │ │ +000a8770: 0a6f 6620 342c 2035 2c20 382c 2031 3220 .of 4, 5, 8, 12 │ │ │ +000a8780: 6f72 2031 3420 656c 656d 656e 7473 2e20 or 14 elements. │ │ │ +000a8790: 4966 2074 6865 2076 6563 746f 7220 6973 If the vector is │ │ │ +000a87a0: 204e 554c 4c2f 656d 7074 792c 2074 6865 NULL/empty, the │ │ │ +000a87b0: 207a 6572 6f20 6469 7374 6f72 7469 6f6e zero distortion │ │ │ +000a87c0: 2063 6f65 6666 6963 6965 6e74 7320 6172 coefficients ar │ │ │ +000a87d0: 6520 6173 7375 6d65 642e 3c2f 6464 3e0a e assumed.
    . │ │ │ +000a87e0: 3c64 643e 3c63 6f64 653e 6361 6d65 7261
    camera │ │ │ +000a87f0: 4d61 7472 6978 323c 2f63 6f64 653e 202d Matrix2 - │ │ │ +000a8800: 2043 616d 6572 6120 6d61 7472 6978 2066 Camera matrix f │ │ │ +000a8810: 6f72 2074 6865 2073 6563 6f6e 6420 6361 or the second ca │ │ │ +000a8820: 6d65 7261 205c 284b 203d 205c 7665 6374 mera \(K = \vect │ │ │ +000a8830: 6872 6565 7468 7265 657b 665f 787d 7b30 hreethree{f_x}{0 │ │ │ +000a8840: 7d7b 635f 787d 7b30 7d7b 665f 797d 7b63 }{c_x}{0}{f_y}{c │ │ │ +000a8850: 5f79 7d7b 307d 7b30 7d7b 317d 5c29 202e _y}{0}{0}{1}\) . │ │ │ +000a8860: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000a8870: 6469 7374 436f 6566 6673 323c 2f63 6f64 distCoeffs2 - Input vecto │ │ │ +000a8890: 7220 6f66 2064 6973 746f 7274 696f 6e20 r of distortion │ │ │ +000a88a0: 636f 6566 6669 6369 656e 7473 2066 6f72 coefficients for │ │ │ +000a88b0: 2074 6865 2073 6563 6f6e 6420 6361 6d65 the second came │ │ │ +000a88c0: 7261 0a5c 2828 6b5f 312c 206b 5f32 2c20 ra.\((k_1, k_2, │ │ │ +000a88d0: 705f 312c 2070 5f32 5b2c 206b 5f33 5b2c p_1, p_2[, k_3[, │ │ │ +000a88e0: 206b 5f34 2c20 6b5f 352c 206b 5f36 5b2c k_4, k_5, k_6[, │ │ │ +000a88f0: 2073 5f31 2c20 735f 322c 2073 5f33 2c20 s_1, s_2, s_3, │ │ │ +000a8900: 735f 345b 2c20 5c74 6175 5f78 2c20 5c74 s_4[, \tau_x, \t │ │ │ +000a8910: 6175 5f79 5d5d 5d5d 295c 290a 6f66 2034 au_y]]]])\).of 4 │ │ │ +000a8920: 2c20 352c 2038 2c20 3132 206f 7220 3134 , 5, 8, 12 or 14 │ │ │ +000a8930: 2065 6c65 6d65 6e74 732e 2049 6620 7468 elements. If th │ │ │ +000a8940: 6520 7665 6374 6f72 2069 7320 4e55 4c4c e vector is NULL │ │ │ +000a8950: 2f65 6d70 7479 2c20 7468 6520 7a65 726f /empty, the zero │ │ │ +000a8960: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ +000a8970: 6669 6369 656e 7473 2061 7265 2061 7373 ficients are ass │ │ │ +000a8980: 756d 6564 2e3c 2f64 643e 0a3c 6464 3e3c umed.
    .
    < │ │ │ +000a8990: 636f 6465 3e6d 6574 686f 643c 2f63 6f64 code>method - Method for │ │ │ +000a89b0: 636f 6d70 7574 696e 6720 616e 2065 7373 computing an ess │ │ │ +000a89c0: 656e 7469 616c 206d 6174 7269 782e 0a3c ential matrix..< │ │ │ +000a89d0: 756c 3e0a 2020 3c6c 693e 0a20 2020 5245 ul>.
  • . RE │ │ │ +000a89e0: 463a 2052 414e 5341 4320 666f 7220 7468 F: RANSAC for th │ │ │ +000a89f0: 6520 5241 4e53 4143 2061 6c67 6f72 6974 e RANSAC algorit │ │ │ +000a8a00: 686d 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c hm..
  • . . REF: LMEDS │ │ │ +000a8a20: 2066 6f72 2074 6865 204c 4d65 6453 2061 for the LMedS a │ │ │ +000a8a30: 6c67 6f72 6974 686d 2e0a 2020 3c2f 6c69 lgorithm..
  • ..
    prob - Parameter u │ │ │ +000a8a70: 7365 6420 666f 7220 7468 6520 5241 4e53 sed for the RANS │ │ │ +000a8a80: 4143 206f 7220 4c4d 6564 5320 6d65 7468 AC or LMedS meth │ │ │ +000a8a90: 6f64 7320 6f6e 6c79 2e20 4974 2073 7065 ods only. It spe │ │ │ +000a8aa0: 6369 6669 6573 2061 2064 6573 6972 6162 cifies a desirab │ │ │ +000a8ab0: 6c65 206c 6576 656c 206f 660a 636f 6e66 le level of.conf │ │ │ +000a8ac0: 6964 656e 6365 2028 7072 6f62 6162 696c idence (probabil │ │ │ +000a8ad0: 6974 7929 2074 6861 7420 7468 6520 6573 ity) that the es │ │ │ +000a8ae0: 7469 6d61 7465 6420 6d61 7472 6978 2069 timated matrix i │ │ │ +000a8af0: 7320 636f 7272 6563 742e 3c2f 6464 3e0a s correct.
    . │ │ │ +000a8b00: 3c64 643e 3c63 6f64 653e 7468 7265 7368
    thresh │ │ │ +000a8b10: 6f6c 643c 2f63 6f64 653e 202d 2050 6172 old - Par │ │ │ +000a8b20: 616d 6574 6572 2075 7365 6420 666f 7220 ameter used for │ │ │ +000a8b30: 5241 4e53 4143 2e20 4974 2069 7320 7468 RANSAC. It is th │ │ │ +000a8b40: 6520 6d61 7869 6d75 6d20 6469 7374 616e e maximum distan │ │ │ +000a8b50: 6365 2066 726f 6d20 6120 706f 696e 7420 ce from a point │ │ │ +000a8b60: 746f 2061 6e20 6570 6970 6f6c 6172 0a6c to an epipolar.l │ │ │ +000a8b70: 696e 6520 696e 2070 6978 656c 732c 2062 ine in pixels, b │ │ │ +000a8b80: 6579 6f6e 6420 7768 6963 6820 7468 6520 eyond which the │ │ │ +000a8b90: 706f 696e 7420 6973 2063 6f6e 7369 6465 point is conside │ │ │ +000a8ba0: 7265 6420 616e 206f 7574 6c69 6572 2061 red an outlier a │ │ │ +000a8bb0: 6e64 2069 7320 6e6f 7420 7573 6564 2066 nd is not used f │ │ │ +000a8bc0: 6f72 2063 6f6d 7075 7469 6e67 2074 6865 or computing the │ │ │ +000a8bd0: 0a66 696e 616c 2066 756e 6461 6d65 6e74 .final fundament │ │ │ +000a8be0: 616c 206d 6174 7269 782e 2049 7420 6361 al matrix. It ca │ │ │ +000a8bf0: 6e20 6265 2073 6574 2074 6f20 736f 6d65 n be set to some │ │ │ +000a8c00: 7468 696e 6720 6c69 6b65 2031 2d33 2c20 thing like 1-3, │ │ │ +000a8c10: 6465 7065 6e64 696e 6720 6f6e 2074 6865 depending on the │ │ │ +000a8c20: 2061 6363 7572 6163 7920 6f66 2074 6865 accuracy of the │ │ │ +000a8c30: 0a70 6f69 6e74 206c 6f63 616c 697a 6174 .point localizat │ │ │ +000a8c40: 696f 6e2c 2069 6d61 6765 2072 6573 6f6c ion, image resol │ │ │ +000a8c50: 7574 696f 6e2c 2061 6e64 2074 6865 2069 ution, and the i │ │ │ +000a8c60: 6d61 6765 206e 6f69 7365 2e0a 666f 7220 mage noise..for │ │ │ +000a8c70: 7468 6520 6f74 6865 7220 706f 696e 7473 the other points │ │ │ +000a8c80: 2e20 5468 6520 6172 7261 7920 6973 2063 . The array is c │ │ │ +000a8c90: 6f6d 7075 7465 6420 6f6e 6c79 2069 6e20 omputed only in │ │ │ +000a8ca0: 7468 6520 5241 4e53 4143 2061 6e64 204c the RANSAC and L │ │ │ +000a8cb0: 4d65 6453 206d 6574 686f 6473 2e0a 0a54 MedS methods...T │ │ │ +000a8cc0: 6869 7320 6675 6e63 7469 6f6e 2065 7374 his function est │ │ │ +000a8cd0: 696d 6174 6573 2065 7373 656e 7469 616c imates essential │ │ │ +000a8ce0: 206d 6174 7269 7820 6261 7365 6420 6f6e matrix based on │ │ │ +000a8cf0: 2074 6865 2066 6976 652d 706f 696e 7420 the five-point │ │ │ +000a8d00: 616c 676f 7269 7468 6d20 736f 6c76 6572 algorithm solver │ │ │ +000a8d10: 2069 6e20 4349 5445 3a20 4e69 7374 6572 in CITE: Nister │ │ │ +000a8d20: 3033 202e 0a43 4954 453a 2053 7465 7765 03 ..CITE: Stewe │ │ │ +000a8d30: 6e69 7573 4346 5320 6973 2061 6c73 6f20 niusCFS is also │ │ │ +000a8d40: 6120 7265 6c61 7465 642e 2054 6865 2065 a related. The e │ │ │ +000a8d50: 7069 706f 6c61 7220 6765 6f6d 6574 7279 pipolar geometry │ │ │ +000a8d60: 2069 7320 6465 7363 7269 6265 6420 6279 is described by │ │ │ +000a8d70: 2074 6865 2066 6f6c 6c6f 7769 6e67 2065 the following e │ │ │ +000a8d80: 7175 6174 696f 6e3a 0a0a 5c28 5b70 5f32 quation:..\([p_2 │ │ │ +000a8d90: 3b20 315d 5e54 204b 5e7b 2d54 7d20 4520 ; 1]^T K^{-T} E │ │ │ +000a8da0: 4b5e 7b2d 317d 205b 705f 313b 2031 5d20 K^{-1} [p_1; 1] │ │ │ +000a8db0: 3d20 305c 290a 0a77 6865 7265 205c 2845 = 0\)..where \(E │ │ │ +000a8dc0: 5c29 2069 7320 616e 2065 7373 656e 7469 \) is an essenti │ │ │ +000a8dd0: 616c 206d 6174 7269 782c 205c 2870 5f31 al matrix, \(p_1 │ │ │ +000a8de0: 5c29 2061 6e64 205c 2870 5f32 5c29 2061 \) and \(p_2\) a │ │ │ +000a8df0: 7265 2063 6f72 7265 7370 6f6e 6469 6e67 re corresponding │ │ │ +000a8e00: 2070 6f69 6e74 7320 696e 2074 6865 2066 points in the f │ │ │ +000a8e10: 6972 7374 2061 6e64 2074 6865 0a73 6563 irst and the.sec │ │ │ +000a8e20: 6f6e 6420 696d 6167 6573 2c20 7265 7370 ond images, resp │ │ │ +000a8e30: 6563 7469 7665 6c79 2e20 5468 6520 7265 ectively. The re │ │ │ +000a8e40: 7375 6c74 206f 6620 7468 6973 2066 756e sult of this fun │ │ │ +000a8e50: 6374 696f 6e20 6d61 7920 6265 2070 6173 ction may be pas │ │ │ +000a8e60: 7365 6420 6675 7274 6865 7220 746f 0a23 sed further to.# │ │ │ +000a8e70: 6465 636f 6d70 6f73 6545 7373 656e 7469 decomposeEssenti │ │ │ +000a8e80: 616c 4d61 7420 6f72 2020 2372 6563 6f76 alMat or #recov │ │ │ +000a8e90: 6572 506f 7365 2074 6f20 7265 636f 7665 erPose to recove │ │ │ +000a8ea0: 7220 7468 6520 7265 6c61 7469 7665 2070 r the relative p │ │ │ +000a8eb0: 6f73 6520 6265 7477 6565 6e20 6361 6d65 ose between came │ │ │ +000a8ec0: 7261 732e 3c2f 6464 3e0a 3c64 743e 5265 ras.
    .
    Re │ │ │ +000a8ed0: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ +000a8ee0: 6175 746f 6d61 7469 6361 6c6c 7920 6765 automatically ge │ │ │ +000a8ef0: 6e65 7261 7465 643c 2f64 643e 0a3c 2f64 nerated
    .....
  • . │ │ │ +000a8f20: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    findEssen │ │ │ +000a8fe0: 7469 616c 4d61 743c 2f68 333e 0a3c 6469 tialMat

    ..public static │ │ │ +000a9050: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  Mat findEssentialM │ │ │ +000a90f0: 6174 3c2f 7370 616e 3e3c 7762 723e 3c73 at(Mat  │ │ │ +000a9160: 3b70 6f69 6e74 7331 2c0a 203c 6120 6872 ;points1,. Mat&n │ │ │ +000a91b0: 6273 703b 706f 696e 7473 322c 0a20 3c61 bsp;points2,. Mat cameraMat │ │ │ +000a9210: 7269 7831 2c0a 203c 6120 6872 6566 3d22 rix1,. Mat  │ │ │ +000a9260: 6469 7374 436f 6566 6673 312c 0a20 3c61 distCoeffs1,. Mat cameraMat │ │ │ +000a92c0: 7269 7832 2c0a 203c 6120 6872 6566 3d22 rix2,. Mat  │ │ │ +000a9310: 6469 7374 436f 6566 6673 322c 0a20 696e distCoeffs2,. in │ │ │ +000a9320: 7426 6e62 7370 3b6d 6574 686f 642c 0a20 t method,. │ │ │ +000a9330: 646f 7562 6c65 266e 6273 703b 7072 6f62 double prob │ │ │ +000a9340: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c ).< │ │ │ +000a9350: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ +000a9360: 223e 4361 6c63 756c 6174 6573 2061 6e20 ">Calculates an │ │ │ +000a9370: 6573 7365 6e74 6961 6c20 6d61 7472 6978 essential matrix │ │ │ +000a9380: 2066 726f 6d20 7468 6520 636f 7272 6573 from the corres │ │ │ +000a9390: 706f 6e64 696e 6720 706f 696e 7473 2069 ponding points i │ │ │ +000a93a0: 6e20 7477 6f20 696d 6167 6573 2066 726f n two images fro │ │ │ +000a93b0: 6d20 706f 7465 6e74 6961 6c6c 7920 7477 m potentially tw │ │ │ +000a93c0: 6f20 6469 6666 6572 656e 7420 6361 6d65 o different came │ │ │ +000a93d0: 7261 732e 3c2f 6469 763e 0a3c 646c 2063 ras..
    .Parameters:.
    poi │ │ │ +000a9410: 6e74 7331 3c2f 636f 6465 3e20 2d20 4172 nts1 - Ar │ │ │ +000a9420: 7261 7920 6f66 204e 2028 4e20 2667 743b ray of N (N > │ │ │ +000a9430: 3d20 3529 2032 4420 706f 696e 7473 2066 = 5) 2D points f │ │ │ +000a9440: 726f 6d20 7468 6520 6669 7273 7420 696d rom the first im │ │ │ +000a9450: 6167 652e 2054 6865 2070 6f69 6e74 2063 age. The point c │ │ │ +000a9460: 6f6f 7264 696e 6174 6573 2073 686f 756c oordinates shoul │ │ │ +000a9470: 640a 6265 2066 6c6f 6174 696e 672d 706f d.be floating-po │ │ │ +000a9480: 696e 7420 2873 696e 676c 6520 6f72 2064 int (single or d │ │ │ +000a9490: 6f75 626c 6520 7072 6563 6973 696f 6e29 ouble precision) │ │ │ +000a94a0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    points2 │ │ │ +000a94c0: 2d20 4172 7261 7920 6f66 2074 6865 2073 - Array of the s │ │ │ +000a94d0: 6563 6f6e 6420 696d 6167 6520 706f 696e econd image poin │ │ │ +000a94e0: 7473 206f 6620 7468 6520 7361 6d65 2073 ts of the same s │ │ │ +000a94f0: 697a 6520 616e 6420 666f 726d 6174 2061 ize and format a │ │ │ +000a9500: 7320 706f 696e 7473 312e 3c2f 6464 3e0a s points1.
    . │ │ │ +000a9510: 3c64 643e 3c63 6f64 653e 6361 6d65 7261
    camera │ │ │ +000a9520: 4d61 7472 6978 313c 2f63 6f64 653e 202d Matrix1 - │ │ │ +000a9530: 2043 616d 6572 6120 6d61 7472 6978 2066 Camera matrix f │ │ │ +000a9540: 6f72 2074 6865 2066 6972 7374 2063 616d or the first cam │ │ │ +000a9550: 6572 6120 5c28 4b20 3d20 5c76 6563 7468 era \(K = \vecth │ │ │ +000a9560: 7265 6574 6872 6565 7b66 5f78 7d7b 307d reethree{f_x}{0} │ │ │ +000a9570: 7b63 5f78 7d7b 307d 7b66 5f79 7d7b 635f {c_x}{0}{f_y}{c_ │ │ │ +000a9580: 797d 7b30 7d7b 307d 7b31 7d5c 2920 2e3c y}{0}{0}{1}\) .< │ │ │ +000a9590: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ +000a95a0: 6973 7443 6f65 6666 7331 3c2f 636f 6465 istCoeffs1 - Input vector │ │ │ +000a95c0: 206f 6620 6469 7374 6f72 7469 6f6e 2063 of distortion c │ │ │ +000a95d0: 6f65 6666 6963 6965 6e74 7320 666f 7220 oefficients for │ │ │ +000a95e0: 7468 6520 6669 7273 7420 6361 6d65 7261 the first camera │ │ │ +000a95f0: 0a5c 2828 6b5f 312c 206b 5f32 2c20 705f .\((k_1, k_2, p_ │ │ │ +000a9600: 312c 2070 5f32 5b2c 206b 5f33 5b2c 206b 1, p_2[, k_3[, k │ │ │ +000a9610: 5f34 2c20 6b5f 352c 206b 5f36 5b2c 2073 _4, k_5, k_6[, s │ │ │ +000a9620: 5f31 2c20 735f 322c 2073 5f33 2c20 735f _1, s_2, s_3, s_ │ │ │ +000a9630: 345b 2c20 5c74 6175 5f78 2c20 5c74 6175 4[, \tau_x, \tau │ │ │ +000a9640: 5f79 5d5d 5d5d 295c 290a 6f66 2034 2c20 _y]]]])\).of 4, │ │ │ +000a9650: 352c 2038 2c20 3132 206f 7220 3134 2065 5, 8, 12 or 14 e │ │ │ +000a9660: 6c65 6d65 6e74 732e 2049 6620 7468 6520 lements. If the │ │ │ +000a9670: 7665 6374 6f72 2069 7320 4e55 4c4c 2f65 vector is NULL/e │ │ │ +000a9680: 6d70 7479 2c20 7468 6520 7a65 726f 2064 mpty, the zero d │ │ │ +000a9690: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ +000a96a0: 6369 656e 7473 2061 7265 2061 7373 756d cients are assum │ │ │ +000a96b0: 6564 2e3c 2f64 643e 0a3c 6464 3e3c 636f ed.
    .
    cameraMatrix2 │ │ │ +000a96d0: 3c2f 636f 6465 3e20 2d20 4361 6d65 7261 - Camera │ │ │ +000a96e0: 206d 6174 7269 7820 666f 7220 7468 6520 matrix for the │ │ │ +000a96f0: 7365 636f 6e64 2063 616d 6572 6120 5c28 second camera \( │ │ │ +000a9700: 4b20 3d20 5c76 6563 7468 7265 6574 6872 K = \vecthreethr │ │ │ +000a9710: 6565 7b66 5f78 7d7b 307d 7b63 5f78 7d7b ee{f_x}{0}{c_x}{ │ │ │ +000a9720: 307d 7b66 5f79 7d7b 635f 797d 7b30 7d7b 0}{f_y}{c_y}{0}{ │ │ │ +000a9730: 307d 7b31 7d5c 2920 2e3c 2f64 643e 0a3c 0}{1}\) .
    .< │ │ │ +000a9740: 6464 3e3c 636f 6465 3e64 6973 7443 6f65 dd>distCoe │ │ │ +000a9750: 6666 7332 3c2f 636f 6465 3e20 2d20 496e ffs2 - In │ │ │ +000a9760: 7075 7420 7665 6374 6f72 206f 6620 6469 put vector of di │ │ │ +000a9770: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ +000a9780: 6965 6e74 7320 666f 7220 7468 6520 7365 ients for the se │ │ │ +000a9790: 636f 6e64 2063 616d 6572 610a 5c28 286b cond camera.\((k │ │ │ +000a97a0: 5f31 2c20 6b5f 322c 2070 5f31 2c20 705f _1, k_2, p_1, p_ │ │ │ +000a97b0: 325b 2c20 6b5f 335b 2c20 6b5f 342c 206b 2[, k_3[, k_4, k │ │ │ +000a97c0: 5f35 2c20 6b5f 365b 2c20 735f 312c 2073 _5, k_6[, s_1, s │ │ │ +000a97d0: 5f32 2c20 735f 332c 2073 5f34 5b2c 205c _2, s_3, s_4[, \ │ │ │ +000a97e0: 7461 755f 782c 205c 7461 755f 795d 5d5d tau_x, \tau_y]]] │ │ │ +000a97f0: 5d29 5c29 0a6f 6620 342c 2035 2c20 382c ])\).of 4, 5, 8, │ │ │ +000a9800: 2031 3220 6f72 2031 3420 656c 656d 656e 12 or 14 elemen │ │ │ +000a9810: 7473 2e20 4966 2074 6865 2076 6563 746f ts. If the vecto │ │ │ +000a9820: 7220 6973 204e 554c 4c2f 656d 7074 792c r is NULL/empty, │ │ │ +000a9830: 2074 6865 207a 6572 6f20 6469 7374 6f72 the zero distor │ │ │ +000a9840: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ +000a9850: 7320 6172 6520 6173 7375 6d65 642e 3c2f s are assumed..
    me │ │ │ +000a9870: 7468 6f64 3c2f 636f 6465 3e20 2d20 4d65 thod - Me │ │ │ +000a9880: 7468 6f64 2066 6f72 2063 6f6d 7075 7469 thod for computi │ │ │ +000a9890: 6e67 2061 6e20 6573 7365 6e74 6961 6c20 ng an essential │ │ │ +000a98a0: 6d61 7472 6978 2e0a 3c75 6c3e 0a20 203c matrix..
      . < │ │ │ +000a98b0: 6c69 3e0a 2020 2052 4546 3a20 5241 4e53 li>. REF: RANS │ │ │ +000a98c0: 4143 2066 6f72 2074 6865 2052 414e 5341 AC for the RANSA │ │ │ +000a98d0: 4320 616c 676f 7269 7468 6d2e 0a20 203c C algorithm.. < │ │ │ +000a98e0: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2052 /li>.
    • . R │ │ │ +000a98f0: 4546 3a20 4c4d 4544 5320 666f 7220 7468 EF: LMEDS for th │ │ │ +000a9900: 6520 4c4d 6564 5320 616c 676f 7269 7468 e LMedS algorith │ │ │ +000a9910: 6d2e 0a20 203c 2f6c 693e 0a3c 2f75 6c3e m..
    • .
    │ │ │ +000a9920: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000a9930: 7072 6f62 3c2f 636f 6465 3e20 2d20 5061 prob - Pa │ │ │ +000a9940: 7261 6d65 7465 7220 7573 6564 2066 6f72 rameter used for │ │ │ +000a9950: 2074 6865 2052 414e 5341 4320 6f72 204c the RANSAC or L │ │ │ +000a9960: 4d65 6453 206d 6574 686f 6473 206f 6e6c MedS methods onl │ │ │ +000a9970: 792e 2049 7420 7370 6563 6966 6965 7320 y. It specifies │ │ │ +000a9980: 6120 6465 7369 7261 626c 6520 6c65 7665 a desirable leve │ │ │ +000a9990: 6c20 6f66 0a63 6f6e 6669 6465 6e63 6520 l of.confidence │ │ │ +000a99a0: 2870 726f 6261 6269 6c69 7479 2920 7468 (probability) th │ │ │ +000a99b0: 6174 2074 6865 2065 7374 696d 6174 6564 at the estimated │ │ │ +000a99c0: 206d 6174 7269 7820 6973 2063 6f72 7265 matrix is corre │ │ │ +000a99d0: 6374 2e0a 6c69 6e65 2069 6e20 7069 7865 ct..line in pixe │ │ │ +000a99e0: 6c73 2c20 6265 796f 6e64 2077 6869 6368 ls, beyond which │ │ │ +000a99f0: 2074 6865 2070 6f69 6e74 2069 7320 636f the point is co │ │ │ +000a9a00: 6e73 6964 6572 6564 2061 6e20 6f75 746c nsidered an outl │ │ │ +000a9a10: 6965 7220 616e 6420 6973 206e 6f74 2075 ier and is not u │ │ │ +000a9a20: 7365 6420 666f 7220 636f 6d70 7574 696e sed for computin │ │ │ +000a9a30: 6720 7468 650a 6669 6e61 6c20 6675 6e64 g the.final fund │ │ │ +000a9a40: 616d 656e 7461 6c20 6d61 7472 6978 2e20 amental matrix. │ │ │ +000a9a50: 4974 2063 616e 2062 6520 7365 7420 746f It can be set to │ │ │ +000a9a60: 2073 6f6d 6574 6869 6e67 206c 696b 6520 something like │ │ │ +000a9a70: 312d 332c 2064 6570 656e 6469 6e67 206f 1-3, depending o │ │ │ +000a9a80: 6e20 7468 6520 6163 6375 7261 6379 206f n the accuracy o │ │ │ +000a9a90: 6620 7468 650a 706f 696e 7420 6c6f 6361 f the.point loca │ │ │ +000a9aa0: 6c69 7a61 7469 6f6e 2c20 696d 6167 6520 lization, image │ │ │ +000a9ab0: 7265 736f 6c75 7469 6f6e 2c20 616e 6420 resolution, and │ │ │ +000a9ac0: 7468 6520 696d 6167 6520 6e6f 6973 652e the image noise. │ │ │ +000a9ad0: 0a66 6f72 2074 6865 206f 7468 6572 2070 .for the other p │ │ │ +000a9ae0: 6f69 6e74 732e 2054 6865 2061 7272 6179 oints. The array │ │ │ +000a9af0: 2069 7320 636f 6d70 7574 6564 206f 6e6c is computed onl │ │ │ +000a9b00: 7920 696e 2074 6865 2052 414e 5341 4320 y in the RANSAC │ │ │ +000a9b10: 616e 6420 4c4d 6564 5320 6d65 7468 6f64 and LMedS method │ │ │ +000a9b20: 732e 0a0a 5468 6973 2066 756e 6374 696f s...This functio │ │ │ +000a9b30: 6e20 6573 7469 6d61 7465 7320 6573 7365 n estimates esse │ │ │ +000a9b40: 6e74 6961 6c20 6d61 7472 6978 2062 6173 ntial matrix bas │ │ │ +000a9b50: 6564 206f 6e20 7468 6520 6669 7665 2d70 ed on the five-p │ │ │ +000a9b60: 6f69 6e74 2061 6c67 6f72 6974 686d 2073 oint algorithm s │ │ │ +000a9b70: 6f6c 7665 7220 696e 2043 4954 453a 204e olver in CITE: N │ │ │ +000a9b80: 6973 7465 7230 3320 2e0a 4349 5445 3a20 ister03 ..CITE: │ │ │ +000a9b90: 5374 6577 656e 6975 7343 4653 2069 7320 SteweniusCFS is │ │ │ +000a9ba0: 616c 736f 2061 2072 656c 6174 6564 2e20 also a related. │ │ │ +000a9bb0: 5468 6520 6570 6970 6f6c 6172 2067 656f The epipolar geo │ │ │ +000a9bc0: 6d65 7472 7920 6973 2064 6573 6372 6962 metry is describ │ │ │ +000a9bd0: 6564 2062 7920 7468 6520 666f 6c6c 6f77 ed by the follow │ │ │ +000a9be0: 696e 6720 6571 7561 7469 6f6e 3a0a 0a5c ing equation:..\ │ │ │ +000a9bf0: 285b 705f 323b 2031 5d5e 5420 4b5e 7b2d ([p_2; 1]^T K^{- │ │ │ +000a9c00: 547d 2045 204b 5e7b 2d31 7d20 5b70 5f31 T} E K^{-1} [p_1 │ │ │ +000a9c10: 3b20 315d 203d 2030 5c29 0a0a 7768 6572 ; 1] = 0\)..wher │ │ │ +000a9c20: 6520 5c28 455c 2920 6973 2061 6e20 6573 e \(E\) is an es │ │ │ +000a9c30: 7365 6e74 6961 6c20 6d61 7472 6978 2c20 sential matrix, │ │ │ +000a9c40: 5c28 705f 315c 2920 616e 6420 5c28 705f \(p_1\) and \(p_ │ │ │ +000a9c50: 325c 2920 6172 6520 636f 7272 6573 706f 2\) are correspo │ │ │ +000a9c60: 6e64 696e 6720 706f 696e 7473 2069 6e20 nding points in │ │ │ +000a9c70: 7468 6520 6669 7273 7420 616e 6420 7468 the first and th │ │ │ +000a9c80: 650a 7365 636f 6e64 2069 6d61 6765 732c e.second images, │ │ │ +000a9c90: 2072 6573 7065 6374 6976 656c 792e 2054 respectively. T │ │ │ +000a9ca0: 6865 2072 6573 756c 7420 6f66 2074 6869 he result of thi │ │ │ +000a9cb0: 7320 6675 6e63 7469 6f6e 206d 6179 2062 s function may b │ │ │ +000a9cc0: 6520 7061 7373 6564 2066 7572 7468 6572 e passed further │ │ │ +000a9cd0: 2074 6f0a 2364 6563 6f6d 706f 7365 4573 to.#decomposeEs │ │ │ +000a9ce0: 7365 6e74 6961 6c4d 6174 206f 7220 2023 sentialMat or # │ │ │ +000a9cf0: 7265 636f 7665 7250 6f73 6520 746f 2072 recoverPose to r │ │ │ +000a9d00: 6563 6f76 6572 2074 6865 2072 656c 6174 ecover the relat │ │ │ +000a9d10: 6976 6520 706f 7365 2062 6574 7765 656e ive pose between │ │ │ +000a9d20: 2063 616d 6572 6173 2e3c 2f64 643e 0a3c cameras.
    .< │ │ │ +000a9d30: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ +000a9d40: 0a3c 6464 3e61 7574 6f6d 6174 6963 616c .
    automatical │ │ │ +000a9d50: 6c79 2067 656e 6572 6174 6564 3c2f 6464 ly generated
    .
    ..< │ │ │ +000a9d70: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ +000a9d80: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    │ │ │ +000a9e30: 0a3c 6833 3e66 696e 6445 7373 656e 7469 .

    findEssenti │ │ │ +000a9e40: 616c 4d61 743c 2f68 333e 0a3c 6469 7620 alMat

    .
    .
    public static Mat& │ │ │ +000a9f20: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ +000a9f40: 6669 6e64 4573 7365 6e74 6961 6c4d 6174 findEssentialMat │ │ │ +000a9f50: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat p │ │ │ +000a9fc0: 6f69 6e74 7331 2c0a 203c 6120 6872 6566 oints1,. Mat&nbs │ │ │ +000aa010: 703b 706f 696e 7473 322c 0a20 3c61 2068 p;points2,. Mat& │ │ │ +000aa060: 6e62 7370 3b63 616d 6572 614d 6174 7269 nbsp;cameraMatri │ │ │ +000aa070: 7831 2c0a 203c 6120 6872 6566 3d22 2e2e x1,. Mat di │ │ │ +000aa0c0: 7374 436f 6566 6673 312c 0a20 3c61 2068 stCoeffs1,. Mat& │ │ │ +000aa110: 6e62 7370 3b63 616d 6572 614d 6174 7269 nbsp;cameraMatri │ │ │ +000aa120: 7832 2c0a 203c 6120 6872 6566 3d22 2e2e x2,. Mat di │ │ │ +000aa170: 7374 436f 6566 6673 322c 0a20 696e 7426 stCoeffs2,. int& │ │ │ +000aa180: 6e62 7370 3b6d 6574 686f 6429 3c2f 7370 nbsp;method)
    .
    Cal │ │ │ +000aa1b0: 6375 6c61 7465 7320 616e 2065 7373 656e culates an essen │ │ │ +000aa1c0: 7469 616c 206d 6174 7269 7820 6672 6f6d tial matrix from │ │ │ +000aa1d0: 2074 6865 2063 6f72 7265 7370 6f6e 6469 the correspondi │ │ │ +000aa1e0: 6e67 2070 6f69 6e74 7320 696e 2074 776f ng points in two │ │ │ +000aa1f0: 2069 6d61 6765 7320 6672 6f6d 2070 6f74 images from pot │ │ │ +000aa200: 656e 7469 616c 6c79 2074 776f 2064 6966 entially two dif │ │ │ +000aa210: 6665 7265 6e74 2063 616d 6572 6173 2e3c ferent cameras.< │ │ │ +000aa220: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ +000aa240: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .points1< │ │ │ +000aa260: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ +000aa270: 6620 4e20 284e 2026 6774 3b3d 2035 2920 f N (N >= 5) │ │ │ +000aa280: 3244 2070 6f69 6e74 7320 6672 6f6d 2074 2D points from t │ │ │ +000aa290: 6865 2066 6972 7374 2069 6d61 6765 2e20 he first image. │ │ │ +000aa2a0: 5468 6520 706f 696e 7420 636f 6f72 6469 The point coordi │ │ │ +000aa2b0: 6e61 7465 7320 7368 6f75 6c64 0a62 6520 nates should.be │ │ │ +000aa2c0: 666c 6f61 7469 6e67 2d70 6f69 6e74 2028 floating-point ( │ │ │ +000aa2d0: 7369 6e67 6c65 206f 7220 646f 7562 6c65 single or double │ │ │ +000aa2e0: 2070 7265 6369 7369 6f6e 292e 3c2f 6464 precision)..
    poin │ │ │ +000aa300: 7473 323c 2f63 6f64 653e 202d 2041 7272 ts2 - Arr │ │ │ +000aa310: 6179 206f 6620 7468 6520 7365 636f 6e64 ay of the second │ │ │ +000aa320: 2069 6d61 6765 2070 6f69 6e74 7320 6f66 image points of │ │ │ +000aa330: 2074 6865 2073 616d 6520 7369 7a65 2061 the same size a │ │ │ +000aa340: 6e64 2066 6f72 6d61 7420 6173 2070 6f69 nd format as poi │ │ │ +000aa350: 6e74 7331 2e3c 2f64 643e 0a3c 6464 3e3c nts1.
    .
    < │ │ │ +000aa360: 636f 6465 3e63 616d 6572 614d 6174 7269 code>cameraMatri │ │ │ +000aa370: 7831 3c2f 636f 6465 3e20 2d20 4361 6d65 x1 - Came │ │ │ +000aa380: 7261 206d 6174 7269 7820 666f 7220 7468 ra matrix for th │ │ │ +000aa390: 6520 6669 7273 7420 6361 6d65 7261 205c e first camera \ │ │ │ +000aa3a0: 284b 203d 205c 7665 6374 6872 6565 7468 (K = \vecthreeth │ │ │ +000aa3b0: 7265 657b 665f 787d 7b30 7d7b 635f 787d ree{f_x}{0}{c_x} │ │ │ +000aa3c0: 7b30 7d7b 665f 797d 7b63 5f79 7d7b 307d {0}{f_y}{c_y}{0} │ │ │ +000aa3d0: 7b30 7d7b 317d 5c29 202e 3c2f 6464 3e0a {0}{1}\) .
    . │ │ │ +000aa3e0: 3c64 643e 3c63 6f64 653e 6469 7374 436f
    distCo │ │ │ +000aa3f0: 6566 6673 313c 2f63 6f64 653e 202d 2049 effs1 - I │ │ │ +000aa400: 6e70 7574 2076 6563 746f 7220 6f66 2064 nput vector of d │ │ │ +000aa410: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ +000aa420: 6369 656e 7473 2066 6f72 2074 6865 2066 cients for the f │ │ │ +000aa430: 6972 7374 2063 616d 6572 610a 5c28 286b irst camera.\((k │ │ │ +000aa440: 5f31 2c20 6b5f 322c 2070 5f31 2c20 705f _1, k_2, p_1, p_ │ │ │ +000aa450: 325b 2c20 6b5f 335b 2c20 6b5f 342c 206b 2[, k_3[, k_4, k │ │ │ +000aa460: 5f35 2c20 6b5f 365b 2c20 735f 312c 2073 _5, k_6[, s_1, s │ │ │ +000aa470: 5f32 2c20 735f 332c 2073 5f34 5b2c 205c _2, s_3, s_4[, \ │ │ │ +000aa480: 7461 755f 782c 205c 7461 755f 795d 5d5d tau_x, \tau_y]]] │ │ │ +000aa490: 5d29 5c29 0a6f 6620 342c 2035 2c20 382c ])\).of 4, 5, 8, │ │ │ +000aa4a0: 2031 3220 6f72 2031 3420 656c 656d 656e 12 or 14 elemen │ │ │ +000aa4b0: 7473 2e20 4966 2074 6865 2076 6563 746f ts. If the vecto │ │ │ +000aa4c0: 7220 6973 204e 554c 4c2f 656d 7074 792c r is NULL/empty, │ │ │ +000aa4d0: 2074 6865 207a 6572 6f20 6469 7374 6f72 the zero distor │ │ │ +000aa4e0: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ +000aa4f0: 7320 6172 6520 6173 7375 6d65 642e 3c2f s are assumed..
    ca │ │ │ +000aa510: 6d65 7261 4d61 7472 6978 323c 2f63 6f64 meraMatrix2 - Camera matr │ │ │ +000aa530: 6978 2066 6f72 2074 6865 2073 6563 6f6e ix for the secon │ │ │ +000aa540: 6420 6361 6d65 7261 205c 284b 203d 205c d camera \(K = \ │ │ │ +000aa550: 7665 6374 6872 6565 7468 7265 657b 665f vecthreethree{f_ │ │ │ +000aa560: 787d 7b30 7d7b 635f 787d 7b30 7d7b 665f x}{0}{c_x}{0}{f_ │ │ │ +000aa570: 797d 7b63 5f79 7d7b 307d 7b30 7d7b 317d y}{c_y}{0}{0}{1} │ │ │ +000aa580: 5c29 202e 3c2f 6464 3e0a 3c64 643e 3c63 \) .
    .
    distCoeffs2< │ │ │ +000aa5a0: 2f63 6f64 653e 202d 2049 6e70 7574 2076 /code> - Input v │ │ │ +000aa5b0: 6563 746f 7220 6f66 2064 6973 746f 7274 ector of distort │ │ │ +000aa5c0: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ +000aa5d0: 2066 6f72 2074 6865 2073 6563 6f6e 6420 for the second │ │ │ +000aa5e0: 6361 6d65 7261 0a5c 2828 6b5f 312c 206b camera.\((k_1, k │ │ │ +000aa5f0: 5f32 2c20 705f 312c 2070 5f32 5b2c 206b _2, p_1, p_2[, k │ │ │ +000aa600: 5f33 5b2c 206b 5f34 2c20 6b5f 352c 206b _3[, k_4, k_5, k │ │ │ +000aa610: 5f36 5b2c 2073 5f31 2c20 735f 322c 2073 _6[, s_1, s_2, s │ │ │ +000aa620: 5f33 2c20 735f 345b 2c20 5c74 6175 5f78 _3, s_4[, \tau_x │ │ │ +000aa630: 2c20 5c74 6175 5f79 5d5d 5d5d 295c 290a , \tau_y]]]])\). │ │ │ +000aa640: 6f66 2034 2c20 352c 2038 2c20 3132 206f of 4, 5, 8, 12 o │ │ │ +000aa650: 7220 3134 2065 6c65 6d65 6e74 732e 2049 r 14 elements. I │ │ │ +000aa660: 6620 7468 6520 7665 6374 6f72 2069 7320 f the vector is │ │ │ +000aa670: 4e55 4c4c 2f65 6d70 7479 2c20 7468 6520 NULL/empty, the │ │ │ +000aa680: 7a65 726f 2064 6973 746f 7274 696f 6e20 zero distortion │ │ │ +000aa690: 636f 6566 6669 6369 656e 7473 2061 7265 coefficients are │ │ │ +000aa6a0: 2061 7373 756d 6564 2e3c 2f64 643e 0a3c assumed.
    .< │ │ │ +000aa6b0: 6464 3e3c 636f 6465 3e6d 6574 686f 643c dd>method< │ │ │ +000aa6c0: 2f63 6f64 653e 202d 204d 6574 686f 6420 /code> - Method │ │ │ +000aa6d0: 666f 7220 636f 6d70 7574 696e 6720 616e for computing an │ │ │ +000aa6e0: 2065 7373 656e 7469 616c 206d 6174 7269 essential matri │ │ │ +000aa6f0: 782e 0a3c 756c 3e0a 2020 3c6c 693e 0a20 x..
      .
    • . │ │ │ +000aa700: 2020 5245 463a 2052 414e 5341 4320 666f REF: RANSAC fo │ │ │ +000aa710: 7220 7468 6520 5241 4e53 4143 2061 6c67 r the RANSAC alg │ │ │ +000aa720: 6f72 6974 686d 2e0a 2020 3c2f 6c69 3e0a orithm..
    • . │ │ │ +000aa730: 2020 3c6c 693e 0a20 2020 5245 463a 204c
    • . REF: L │ │ │ +000aa740: 4d45 4453 2066 6f72 2074 6865 204c 4d65 MEDS for the LMe │ │ │ +000aa750: 6453 2061 6c67 6f72 6974 686d 2e0a 2020 dS algorithm.. │ │ │ +000aa760: 3c2f 6c69 3e0a 3c2f 756c 3e0a 636f 6e66
    • .
    .conf │ │ │ +000aa770: 6964 656e 6365 2028 7072 6f62 6162 696c idence (probabil │ │ │ +000aa780: 6974 7929 2074 6861 7420 7468 6520 6573 ity) that the es │ │ │ +000aa790: 7469 6d61 7465 6420 6d61 7472 6978 2069 timated matrix i │ │ │ +000aa7a0: 7320 636f 7272 6563 742e 0a6c 696e 6520 s correct..line │ │ │ +000aa7b0: 696e 2070 6978 656c 732c 2062 6579 6f6e in pixels, beyon │ │ │ +000aa7c0: 6420 7768 6963 6820 7468 6520 706f 696e d which the poin │ │ │ +000aa7d0: 7420 6973 2063 6f6e 7369 6465 7265 6420 t is considered │ │ │ +000aa7e0: 616e 206f 7574 6c69 6572 2061 6e64 2069 an outlier and i │ │ │ +000aa7f0: 7320 6e6f 7420 7573 6564 2066 6f72 2063 s not used for c │ │ │ +000aa800: 6f6d 7075 7469 6e67 2074 6865 0a66 696e omputing the.fin │ │ │ +000aa810: 616c 2066 756e 6461 6d65 6e74 616c 206d al fundamental m │ │ │ +000aa820: 6174 7269 782e 2049 7420 6361 6e20 6265 atrix. It can be │ │ │ +000aa830: 2073 6574 2074 6f20 736f 6d65 7468 696e set to somethin │ │ │ +000aa840: 6720 6c69 6b65 2031 2d33 2c20 6465 7065 g like 1-3, depe │ │ │ +000aa850: 6e64 696e 6720 6f6e 2074 6865 2061 6363 nding on the acc │ │ │ +000aa860: 7572 6163 7920 6f66 2074 6865 0a70 6f69 uracy of the.poi │ │ │ +000aa870: 6e74 206c 6f63 616c 697a 6174 696f 6e2c nt localization, │ │ │ +000aa880: 2069 6d61 6765 2072 6573 6f6c 7574 696f image resolutio │ │ │ +000aa890: 6e2c 2061 6e64 2074 6865 2069 6d61 6765 n, and the image │ │ │ +000aa8a0: 206e 6f69 7365 2e0a 666f 7220 7468 6520 noise..for the │ │ │ +000aa8b0: 6f74 6865 7220 706f 696e 7473 2e20 5468 other points. Th │ │ │ +000aa8c0: 6520 6172 7261 7920 6973 2063 6f6d 7075 e array is compu │ │ │ +000aa8d0: 7465 6420 6f6e 6c79 2069 6e20 7468 6520 ted only in the │ │ │ +000aa8e0: 5241 4e53 4143 2061 6e64 204c 4d65 6453 RANSAC and LMedS │ │ │ +000aa8f0: 206d 6574 686f 6473 2e0a 0a54 6869 7320 methods...This │ │ │ +000aa900: 6675 6e63 7469 6f6e 2065 7374 696d 6174 function estimat │ │ │ +000aa910: 6573 2065 7373 656e 7469 616c 206d 6174 es essential mat │ │ │ +000aa920: 7269 7820 6261 7365 6420 6f6e 2074 6865 rix based on the │ │ │ +000aa930: 2066 6976 652d 706f 696e 7420 616c 676f five-point algo │ │ │ +000aa940: 7269 7468 6d20 736f 6c76 6572 2069 6e20 rithm solver in │ │ │ +000aa950: 4349 5445 3a20 4e69 7374 6572 3033 202e CITE: Nister03 . │ │ │ +000aa960: 0a43 4954 453a 2053 7465 7765 6e69 7573 .CITE: Stewenius │ │ │ +000aa970: 4346 5320 6973 2061 6c73 6f20 6120 7265 CFS is also a re │ │ │ +000aa980: 6c61 7465 642e 2054 6865 2065 7069 706f lated. The epipo │ │ │ +000aa990: 6c61 7220 6765 6f6d 6574 7279 2069 7320 lar geometry is │ │ │ +000aa9a0: 6465 7363 7269 6265 6420 6279 2074 6865 described by the │ │ │ +000aa9b0: 2066 6f6c 6c6f 7769 6e67 2065 7175 6174 following equat │ │ │ +000aa9c0: 696f 6e3a 0a0a 5c28 5b70 5f32 3b20 315d ion:..\([p_2; 1] │ │ │ +000aa9d0: 5e54 204b 5e7b 2d54 7d20 4520 4b5e 7b2d ^T K^{-T} E K^{- │ │ │ +000aa9e0: 317d 205b 705f 313b 2031 5d20 3d20 305c 1} [p_1; 1] = 0\ │ │ │ +000aa9f0: 290a 0a77 6865 7265 205c 2845 5c29 2069 )..where \(E\) i │ │ │ +000aaa00: 7320 616e 2065 7373 656e 7469 616c 206d s an essential m │ │ │ +000aaa10: 6174 7269 782c 205c 2870 5f31 5c29 2061 atrix, \(p_1\) a │ │ │ +000aaa20: 6e64 205c 2870 5f32 5c29 2061 7265 2063 nd \(p_2\) are c │ │ │ +000aaa30: 6f72 7265 7370 6f6e 6469 6e67 2070 6f69 orresponding poi │ │ │ +000aaa40: 6e74 7320 696e 2074 6865 2066 6972 7374 nts in the first │ │ │ +000aaa50: 2061 6e64 2074 6865 0a73 6563 6f6e 6420 and the.second │ │ │ +000aaa60: 696d 6167 6573 2c20 7265 7370 6563 7469 images, respecti │ │ │ +000aaa70: 7665 6c79 2e20 5468 6520 7265 7375 6c74 vely. The result │ │ │ +000aaa80: 206f 6620 7468 6973 2066 756e 6374 696f of this functio │ │ │ +000aaa90: 6e20 6d61 7920 6265 2070 6173 7365 6420 n may be passed │ │ │ +000aaaa0: 6675 7274 6865 7220 746f 0a23 6465 636f further to.#deco │ │ │ +000aaab0: 6d70 6f73 6545 7373 656e 7469 616c 4d61 mposeEssentialMa │ │ │ +000aaac0: 7420 6f72 2020 2372 6563 6f76 6572 506f t or #recoverPo │ │ │ +000aaad0: 7365 2074 6f20 7265 636f 7665 7220 7468 se to recover th │ │ │ +000aaae0: 6520 7265 6c61 7469 7665 2070 6f73 6520 e relative pose │ │ │ +000aaaf0: 6265 7477 6565 6e20 6361 6d65 7261 732e between cameras. │ │ │ +000aab00: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e .
    Return │ │ │ +000aab10: 733a 3c2f 6474 3e0a 3c64 643e 6175 746f s:
    .
    auto │ │ │ +000aab20: 6d61 7469 6361 6c6c 7920 6765 6e65 7261 matically genera │ │ │ +000aab30: 7465 643c 2f64 643e 0a3c 2f64 6c3e 0a3c ted
    .
    .< │ │ │ +000aab40: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ +000aab50: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    findEsse │ │ │ +000aac10: 6e74 6961 6c4d 6174 3c2f 6833 3e0a 3c64 ntialMat

    ..public stati │ │ │ +000aac80: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c Mat findEssential │ │ │ +000aad20: 4d61 743c 2f73 7061 6e3e 3c77 6272 3e3c Mat< │ │ │ +000aad30: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +000aad40: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ +000aad90: 703b 706f 696e 7473 312c 0a20 3c61 2068 p;points1,. Mat& │ │ │ +000aade0: 6e62 7370 3b70 6f69 6e74 7332 2c0a 203c nbsp;points2,. < │ │ │ +000aadf0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000aae00: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000aae10: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000aae20: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ +000aae40: 7472 6978 312c 0a20 3c61 2068 7265 663d trix1,. Mat  │ │ │ +000aae90: 3b64 6973 7443 6f65 6666 7331 2c0a 203c ;distCoeffs1,. < │ │ │ +000aaea0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000aaeb0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000aaec0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000aaed0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ +000aaef0: 7472 6978 322c 0a20 3c61 2068 7265 663d trix2,. Mat  │ │ │ +000aaf40: 3b64 6973 7443 6f65 6666 7332 293c 2f73 ;distCoeffs2).
    Ca │ │ │ +000aaf70: 6c63 756c 6174 6573 2061 6e20 6573 7365 lculates an esse │ │ │ +000aaf80: 6e74 6961 6c20 6d61 7472 6978 2066 726f ntial matrix fro │ │ │ +000aaf90: 6d20 7468 6520 636f 7272 6573 706f 6e64 m the correspond │ │ │ +000aafa0: 696e 6720 706f 696e 7473 2069 6e20 7477 ing points in tw │ │ │ +000aafb0: 6f20 696d 6167 6573 2066 726f 6d20 706f o images from po │ │ │ +000aafc0: 7465 6e74 6961 6c6c 7920 7477 6f20 6469 tentially two di │ │ │ +000aafd0: 6666 6572 656e 7420 6361 6d65 7261 732e fferent cameras. │ │ │ +000aafe0: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ +000ab000: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ +000ab010: 6464 3e3c 636f 6465 3e70 6f69 6e74 7331 dd>points1 │ │ │ +000ab020: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ +000ab030: 6f66 204e 2028 4e20 2667 743b 3d20 3529 of N (N >= 5) │ │ │ +000ab040: 2032 4420 706f 696e 7473 2066 726f 6d20 2D points from │ │ │ +000ab050: 7468 6520 6669 7273 7420 696d 6167 652e the first image. │ │ │ +000ab060: 2054 6865 2070 6f69 6e74 2063 6f6f 7264 The point coord │ │ │ +000ab070: 696e 6174 6573 2073 686f 756c 640a 6265 inates should.be │ │ │ +000ab080: 2066 6c6f 6174 696e 672d 706f 696e 7420 floating-point │ │ │ +000ab090: 2873 696e 676c 6520 6f72 2064 6f75 626c (single or doubl │ │ │ +000ab0a0: 6520 7072 6563 6973 696f 6e29 2e3c 2f64 e precision)..
    poi │ │ │ +000ab0c0: 6e74 7332 3c2f 636f 6465 3e20 2d20 4172 nts2 - Ar │ │ │ +000ab0d0: 7261 7920 6f66 2074 6865 2073 6563 6f6e ray of the secon │ │ │ +000ab0e0: 6420 696d 6167 6520 706f 696e 7473 206f d image points o │ │ │ +000ab0f0: 6620 7468 6520 7361 6d65 2073 697a 6520 f the same size │ │ │ +000ab100: 616e 6420 666f 726d 6174 2061 7320 706f and format as po │ │ │ +000ab110: 696e 7473 312e 3c2f 6464 3e0a 3c64 643e ints1.
    .
    │ │ │ +000ab120: 3c63 6f64 653e 6361 6d65 7261 4d61 7472 cameraMatr │ │ │ +000ab130: 6978 313c 2f63 6f64 653e 202d 2043 616d ix1 - Cam │ │ │ +000ab140: 6572 6120 6d61 7472 6978 2066 6f72 2074 era matrix for t │ │ │ +000ab150: 6865 2066 6972 7374 2063 616d 6572 6120 he first camera │ │ │ +000ab160: 5c28 4b20 3d20 5c76 6563 7468 7265 6574 \(K = \vecthreet │ │ │ +000ab170: 6872 6565 7b66 5f78 7d7b 307d 7b63 5f78 hree{f_x}{0}{c_x │ │ │ +000ab180: 7d7b 307d 7b66 5f79 7d7b 635f 797d 7b30 }{0}{f_y}{c_y}{0 │ │ │ +000ab190: 7d7b 307d 7b31 7d5c 2920 2e3c 2f64 643e }{0}{1}\) .
    │ │ │ +000ab1a0: 0a3c 6464 3e3c 636f 6465 3e64 6973 7443 .
    distC │ │ │ +000ab1b0: 6f65 6666 7331 3c2f 636f 6465 3e20 2d20 oeffs1 - │ │ │ +000ab1c0: 496e 7075 7420 7665 6374 6f72 206f 6620 Input vector of │ │ │ +000ab1d0: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ +000ab1e0: 6963 6965 6e74 7320 666f 7220 7468 6520 icients for the │ │ │ +000ab1f0: 6669 7273 7420 6361 6d65 7261 0a5c 2828 first camera.\(( │ │ │ +000ab200: 6b5f 312c 206b 5f32 2c20 705f 312c 2070 k_1, k_2, p_1, p │ │ │ +000ab210: 5f32 5b2c 206b 5f33 5b2c 206b 5f34 2c20 _2[, k_3[, k_4, │ │ │ +000ab220: 6b5f 352c 206b 5f36 5b2c 2073 5f31 2c20 k_5, k_6[, s_1, │ │ │ +000ab230: 735f 322c 2073 5f33 2c20 735f 345b 2c20 s_2, s_3, s_4[, │ │ │ +000ab240: 5c74 6175 5f78 2c20 5c74 6175 5f79 5d5d \tau_x, \tau_y]] │ │ │ +000ab250: 5d5d 295c 290a 6f66 2034 2c20 352c 2038 ]])\).of 4, 5, 8 │ │ │ +000ab260: 2c20 3132 206f 7220 3134 2065 6c65 6d65 , 12 or 14 eleme │ │ │ +000ab270: 6e74 732e 2049 6620 7468 6520 7665 6374 nts. If the vect │ │ │ +000ab280: 6f72 2069 7320 4e55 4c4c 2f65 6d70 7479 or is NULL/empty │ │ │ +000ab290: 2c20 7468 6520 7a65 726f 2064 6973 746f , the zero disto │ │ │ +000ab2a0: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ +000ab2b0: 7473 2061 7265 2061 7373 756d 6564 2e3c ts are assumed.< │ │ │ +000ab2c0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ +000ab2d0: 616d 6572 614d 6174 7269 7832 3c2f 636f ameraMatrix2 - Camera mat │ │ │ +000ab2f0: 7269 7820 666f 7220 7468 6520 7365 636f rix for the seco │ │ │ +000ab300: 6e64 2063 616d 6572 6120 5c28 4b20 3d20 nd camera \(K = │ │ │ +000ab310: 5c76 6563 7468 7265 6574 6872 6565 7b66 \vecthreethree{f │ │ │ +000ab320: 5f78 7d7b 307d 7b63 5f78 7d7b 307d 7b66 _x}{0}{c_x}{0}{f │ │ │ +000ab330: 5f79 7d7b 635f 797d 7b30 7d7b 307d 7b31 _y}{c_y}{0}{0}{1 │ │ │ +000ab340: 7d5c 2920 2e3c 2f64 643e 0a3c 6464 3e3c }\) .
    .
    < │ │ │ +000ab350: 636f 6465 3e64 6973 7443 6f65 6666 7332 code>distCoeffs2 │ │ │ +000ab360: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ +000ab370: 7665 6374 6f72 206f 6620 6469 7374 6f72 vector of distor │ │ │ +000ab380: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ +000ab390: 7320 666f 7220 7468 6520 7365 636f 6e64 s for the second │ │ │ +000ab3a0: 2063 616d 6572 610a 5c28 286b 5f31 2c20 camera.\((k_1, │ │ │ +000ab3b0: 6b5f 322c 2070 5f31 2c20 705f 325b 2c20 k_2, p_1, p_2[, │ │ │ +000ab3c0: 6b5f 335b 2c20 6b5f 342c 206b 5f35 2c20 k_3[, k_4, k_5, │ │ │ +000ab3d0: 6b5f 365b 2c20 735f 312c 2073 5f32 2c20 k_6[, s_1, s_2, │ │ │ +000ab3e0: 735f 332c 2073 5f34 5b2c 205c 7461 755f s_3, s_4[, \tau_ │ │ │ +000ab3f0: 782c 205c 7461 755f 795d 5d5d 5d29 5c29 x, \tau_y]]]])\) │ │ │ +000ab400: 0a6f 6620 342c 2035 2c20 382c 2031 3220 .of 4, 5, 8, 12 │ │ │ +000ab410: 6f72 2031 3420 656c 656d 656e 7473 2e20 or 14 elements. │ │ │ +000ab420: 4966 2074 6865 2076 6563 746f 7220 6973 If the vector is │ │ │ +000ab430: 204e 554c 4c2f 656d 7074 792c 2074 6865 NULL/empty, the │ │ │ +000ab440: 207a 6572 6f20 6469 7374 6f72 7469 6f6e zero distortion │ │ │ +000ab450: 2063 6f65 6666 6963 6965 6e74 7320 6172 coefficients ar │ │ │ +000ab460: 6520 6173 7375 6d65 642e 0a3c 756c 3e0a e assumed..
      . │ │ │ +000ab470: 2020 3c6c 693e 0a20 2020 5245 463a 2052
    • . REF: R │ │ │ +000ab480: 414e 5341 4320 666f 7220 7468 6520 5241 ANSAC for the RA │ │ │ +000ab490: 4e53 4143 2061 6c67 6f72 6974 686d 2e0a NSAC algorithm.. │ │ │ +000ab4a0: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ +000ab4b0: 2020 5245 463a 204c 4d45 4453 2066 6f72 REF: LMEDS for │ │ │ +000ab4c0: 2074 6865 204c 4d65 6453 2061 6c67 6f72 the LMedS algor │ │ │ +000ab4d0: 6974 686d 2e0a 2020 3c2f 6c69 3e0a 3c2f ithm..
    • ..confidence ( │ │ │ +000ab4f0: 7072 6f62 6162 696c 6974 7929 2074 6861 probability) tha │ │ │ +000ab500: 7420 7468 6520 6573 7469 6d61 7465 6420 t the estimated │ │ │ +000ab510: 6d61 7472 6978 2069 7320 636f 7272 6563 matrix is correc │ │ │ +000ab520: 742e 0a6c 696e 6520 696e 2070 6978 656c t..line in pixel │ │ │ +000ab530: 732c 2062 6579 6f6e 6420 7768 6963 6820 s, beyond which │ │ │ +000ab540: 7468 6520 706f 696e 7420 6973 2063 6f6e the point is con │ │ │ +000ab550: 7369 6465 7265 6420 616e 206f 7574 6c69 sidered an outli │ │ │ +000ab560: 6572 2061 6e64 2069 7320 6e6f 7420 7573 er and is not us │ │ │ +000ab570: 6564 2066 6f72 2063 6f6d 7075 7469 6e67 ed for computing │ │ │ +000ab580: 2074 6865 0a66 696e 616c 2066 756e 6461 the.final funda │ │ │ +000ab590: 6d65 6e74 616c 206d 6174 7269 782e 2049 mental matrix. I │ │ │ +000ab5a0: 7420 6361 6e20 6265 2073 6574 2074 6f20 t can be set to │ │ │ +000ab5b0: 736f 6d65 7468 696e 6720 6c69 6b65 2031 something like 1 │ │ │ +000ab5c0: 2d33 2c20 6465 7065 6e64 696e 6720 6f6e -3, depending on │ │ │ +000ab5d0: 2074 6865 2061 6363 7572 6163 7920 6f66 the accuracy of │ │ │ +000ab5e0: 2074 6865 0a70 6f69 6e74 206c 6f63 616c the.point local │ │ │ +000ab5f0: 697a 6174 696f 6e2c 2069 6d61 6765 2072 ization, image r │ │ │ +000ab600: 6573 6f6c 7574 696f 6e2c 2061 6e64 2074 esolution, and t │ │ │ +000ab610: 6865 2069 6d61 6765 206e 6f69 7365 2e0a he image noise.. │ │ │ +000ab620: 666f 7220 7468 6520 6f74 6865 7220 706f for the other po │ │ │ +000ab630: 696e 7473 2e20 5468 6520 6172 7261 7920 ints. The array │ │ │ +000ab640: 6973 2063 6f6d 7075 7465 6420 6f6e 6c79 is computed only │ │ │ +000ab650: 2069 6e20 7468 6520 5241 4e53 4143 2061 in the RANSAC a │ │ │ +000ab660: 6e64 204c 4d65 6453 206d 6574 686f 6473 nd LMedS methods │ │ │ +000ab670: 2e0a 0a54 6869 7320 6675 6e63 7469 6f6e ...This function │ │ │ +000ab680: 2065 7374 696d 6174 6573 2065 7373 656e estimates essen │ │ │ +000ab690: 7469 616c 206d 6174 7269 7820 6261 7365 tial matrix base │ │ │ +000ab6a0: 6420 6f6e 2074 6865 2066 6976 652d 706f d on the five-po │ │ │ +000ab6b0: 696e 7420 616c 676f 7269 7468 6d20 736f int algorithm so │ │ │ +000ab6c0: 6c76 6572 2069 6e20 4349 5445 3a20 4e69 lver in CITE: Ni │ │ │ +000ab6d0: 7374 6572 3033 202e 0a43 4954 453a 2053 ster03 ..CITE: S │ │ │ +000ab6e0: 7465 7765 6e69 7573 4346 5320 6973 2061 teweniusCFS is a │ │ │ +000ab6f0: 6c73 6f20 6120 7265 6c61 7465 642e 2054 lso a related. T │ │ │ +000ab700: 6865 2065 7069 706f 6c61 7220 6765 6f6d he epipolar geom │ │ │ +000ab710: 6574 7279 2069 7320 6465 7363 7269 6265 etry is describe │ │ │ +000ab720: 6420 6279 2074 6865 2066 6f6c 6c6f 7769 d by the followi │ │ │ +000ab730: 6e67 2065 7175 6174 696f 6e3a 0a0a 5c28 ng equation:..\( │ │ │ +000ab740: 5b70 5f32 3b20 315d 5e54 204b 5e7b 2d54 [p_2; 1]^T K^{-T │ │ │ +000ab750: 7d20 4520 4b5e 7b2d 317d 205b 705f 313b } E K^{-1} [p_1; │ │ │ +000ab760: 2031 5d20 3d20 305c 290a 0a77 6865 7265 1] = 0\)..where │ │ │ +000ab770: 205c 2845 5c29 2069 7320 616e 2065 7373 \(E\) is an ess │ │ │ +000ab780: 656e 7469 616c 206d 6174 7269 782c 205c ential matrix, \ │ │ │ +000ab790: 2870 5f31 5c29 2061 6e64 205c 2870 5f32 (p_1\) and \(p_2 │ │ │ +000ab7a0: 5c29 2061 7265 2063 6f72 7265 7370 6f6e \) are correspon │ │ │ +000ab7b0: 6469 6e67 2070 6f69 6e74 7320 696e 2074 ding points in t │ │ │ +000ab7c0: 6865 2066 6972 7374 2061 6e64 2074 6865 he first and the │ │ │ +000ab7d0: 0a73 6563 6f6e 6420 696d 6167 6573 2c20 .second images, │ │ │ +000ab7e0: 7265 7370 6563 7469 7665 6c79 2e20 5468 respectively. Th │ │ │ +000ab7f0: 6520 7265 7375 6c74 206f 6620 7468 6973 e result of this │ │ │ +000ab800: 2066 756e 6374 696f 6e20 6d61 7920 6265 function may be │ │ │ +000ab810: 2070 6173 7365 6420 6675 7274 6865 7220 passed further │ │ │ +000ab820: 746f 0a23 6465 636f 6d70 6f73 6545 7373 to.#decomposeEss │ │ │ +000ab830: 656e 7469 616c 4d61 7420 6f72 2020 2372 entialMat or #r │ │ │ +000ab840: 6563 6f76 6572 506f 7365 2074 6f20 7265 ecoverPose to re │ │ │ +000ab850: 636f 7665 7220 7468 6520 7265 6c61 7469 cover the relati │ │ │ +000ab860: 7665 2070 6f73 6520 6265 7477 6565 6e20 ve pose between │ │ │ +000ab870: 6361 6d65 7261 732e 3c2f 6464 3e0a 3c64 cameras.
    .Returns:. │ │ │ +000ab890: 3c64 643e 6175 746f 6d61 7469 6361 6c6c
    automaticall │ │ │ +000ab8a0: 7920 6765 6e65 7261 7465 643c 2f64 643e y generated
    │ │ │ +000ab8b0: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    ...
  • .< │ │ │ +000ab8d0: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .< │ │ │ +000ab9b0: 6833 3e66 696e 6445 7373 656e 7469 616c h3>findEssential │ │ │ +000ab9c0: 4d61 743c 2f68 333e 0a3c 6469 7620 636c Mat.
    .
    p │ │ │ +000aba20: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static M │ │ │ +000aba90: 6174 3c2f 613e 3c2f 7370 616e 3e26 6e62 at&nb │ │ │ +000abaa0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;fi │ │ │ +000abac0: 6e64 4573 7365 6e74 6961 6c4d 6174 3c2f ndEssentialMat( │ │ │ +000abb30: 4d61 743c 2f61 3e26 6e62 7370 3b70 6f69 Mat poi │ │ │ +000abb40: 6e74 7331 2c0a 203c 6120 6872 6566 3d22 nts1,. Mat  │ │ │ +000abb90: 706f 696e 7473 322c 0a20 3c61 2068 7265 points2,. Mat&nb │ │ │ +000abbe0: 7370 3b63 616d 6572 614d 6174 7269 7831 sp;cameraMatrix1 │ │ │ +000abbf0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000abc30: 6174 3c2f 613e 266e 6273 703b 6361 6d65 at came │ │ │ +000abc40: 7261 4d61 7472 6978 322c 0a20 3c61 2068 raMatrix2,. Mat& │ │ │ +000abc90: 6e62 7370 3b64 6973 745f 636f 6566 6631 nbsp;dist_coeff1 │ │ │ +000abca0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000abce0: 6174 3c2f 613e 266e 6273 703b 6469 7374 at dist │ │ │ +000abcf0: 5f63 6f65 6666 322c 0a20 3c61 2068 7265 _coeff2,. Mat&nb │ │ │ +000abd40: 7370 3b6d 6173 6b2c 0a20 3c61 2068 7265 sp;mask,. UsacPar │ │ │ +000abd90: 616d 733c 2f61 3e26 6e62 7370 3b70 6172 ams par │ │ │ +000abda0: 616d 7329 3c2f 7370 616e 3e3c 2f64 6976 ams)
    .
    ...
  • .< │ │ │ +000abdd0: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +000abde0: 6574 6169 6c22 2069 643d 2264 6563 6f6d etail" id="decom │ │ │ +000abdf0: 706f 7365 4573 7365 6e74 6961 6c4d 6174 poseEssentialMat │ │ │ +000abe00: 286f 7267 2e6f 7065 6e63 762e 636f 7265 (org.opencv.core │ │ │ +000abe10: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ +000abe20: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ +000abe30: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ +000abe40: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ +000abe50: 2922 3e0a 3c68 333e 6465 636f 6d70 6f73 )">.

    decompos │ │ │ +000abe60: 6545 7373 656e 7469 616c 4d61 743c 2f68 eEssentialMat.
    .
    public │ │ │ +000abed0: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +000abee0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;voi │ │ │ +000abf00: 643c 2f73 7061 6e3e 266e 6273 703b 3c73 d decompo │ │ │ +000abf30: 7365 4573 7365 6e74 6961 6c4d 6174 3c2f seEssentialMat( │ │ │ +000abfa0: 4d61 743c 2f61 3e26 6e62 7370 3b45 2c0a Mat E,. │ │ │ +000abfb0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000abff0: 3c2f 613e 266e 6273 703b 5231 2c0a 203c  R1,. < │ │ │ +000ac000: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000ac010: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000ac020: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000ac030: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat R2,. Mat │ │ │ +000ac090: 266e 6273 703b 7429 3c2f 7370 616e 3e3c  t)< │ │ │ +000ac0a0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Decompo │ │ │ +000ac0c0: 7365 2061 6e20 6573 7365 6e74 6961 6c20 se an essential │ │ │ +000ac0d0: 6d61 7472 6978 2074 6f20 706f 7373 6962 matrix to possib │ │ │ +000ac0e0: 6c65 2072 6f74 6174 696f 6e73 2061 6e64 le rotations and │ │ │ +000ac0f0: 2074 7261 6e73 6c61 7469 6f6e 2e3c 2f64 translation..
    .
    Param │ │ │ +000ac120: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ +000ac130: 3c63 6f64 653e 453c 2f63 6f64 653e 202d E - │ │ │ +000ac140: 2054 6865 2069 6e70 7574 2065 7373 656e The input essen │ │ │ +000ac150: 7469 616c 206d 6174 7269 782e 3c2f 6464 tial matrix.
    .
    R1 - One poss │ │ │ +000ac180: 6962 6c65 2072 6f74 6174 696f 6e20 6d61 ible rotation ma │ │ │ +000ac190: 7472 6978 2e3c 2f64 643e 0a3c 6464 3e3c trix.
    .
    < │ │ │ +000ac1a0: 636f 6465 3e52 323c 2f63 6f64 653e 202d code>R2 - │ │ │ +000ac1b0: 2041 6e6f 7468 6572 2070 6f73 7369 626c Another possibl │ │ │ +000ac1c0: 6520 726f 7461 7469 6f6e 206d 6174 7269 e rotation matri │ │ │ +000ac1d0: 782e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 x.
    .
    t - One │ │ │ +000ac1f0: 2070 6f73 7369 626c 6520 7472 616e 736c possible transl │ │ │ +000ac200: 6174 696f 6e2e 0a0a 5468 6973 2066 756e ation...This fun │ │ │ +000ac210: 6374 696f 6e20 6465 636f 6d70 6f73 6573 ction decomposes │ │ │ +000ac220: 2074 6865 2065 7373 656e 7469 616c 206d the essential m │ │ │ +000ac230: 6174 7269 7820 4520 7573 696e 6720 7376 atrix E using sv │ │ │ +000ac240: 6420 6465 636f 6d70 6f73 6974 696f 6e20 d decomposition │ │ │ +000ac250: 4349 5445 3a20 4861 7274 6c65 795a 3030 CITE: HartleyZ00 │ │ │ +000ac260: 2e20 496e 0a67 656e 6572 616c 2c20 666f . In.general, fo │ │ │ +000ac270: 7572 2070 6f73 7369 626c 6520 706f 7365 ur possible pose │ │ │ +000ac280: 7320 6578 6973 7420 666f 7220 7468 6520 s exist for the │ │ │ +000ac290: 6465 636f 6d70 6f73 6974 696f 6e20 6f66 decomposition of │ │ │ +000ac2a0: 2045 2e20 5468 6579 2061 7265 205c 285b E. They are \([ │ │ │ +000ac2b0: 525f 312c 2074 5d5c 292c 0a5c 285b 525f R_1, t]\),.\([R_ │ │ │ +000ac2c0: 312c 202d 745d 5c29 2c20 5c28 5b52 5f32 1, -t]\), \([R_2 │ │ │ +000ac2d0: 2c20 745d 5c29 2c20 5c28 5b52 5f32 2c20 , t]\), \([R_2, │ │ │ +000ac2e0: 2d74 5d5c 292e 0a0a 4966 2045 2067 6976 -t]\)...If E giv │ │ │ +000ac2f0: 6573 2074 6865 2065 7069 706f 6c61 7220 es the epipolar │ │ │ +000ac300: 636f 6e73 7472 6169 6e74 205c 285b 705f constraint \([p_ │ │ │ +000ac310: 323b 2031 5d5e 5420 415e 7b2d 547d 2045 2; 1]^T A^{-T} E │ │ │ +000ac320: 2041 5e7b 2d31 7d20 5b70 5f31 3b20 315d A^{-1} [p_1; 1] │ │ │ +000ac330: 203d 2030 5c29 2062 6574 7765 656e 2074 = 0\) between t │ │ │ +000ac340: 6865 2069 6d61 6765 0a70 6f69 6e74 7320 he image.points │ │ │ +000ac350: 5c28 705f 315c 2920 696e 2074 6865 2066 \(p_1\) in the f │ │ │ +000ac360: 6972 7374 2069 6d61 6765 2061 6e64 205c irst image and \ │ │ │ +000ac370: 2870 5f32 5c29 2069 6e20 7365 636f 6e64 (p_2\) in second │ │ │ +000ac380: 2069 6d61 6765 2c20 7468 656e 2061 6e79 image, then any │ │ │ +000ac390: 206f 6620 7468 6520 7475 706c 6573 0a5c of the tuples.\ │ │ │ +000ac3a0: 285b 525f 312c 2074 5d5c 292c 205c 285b ([R_1, t]\), \([ │ │ │ +000ac3b0: 525f 312c 202d 745d 5c29 2c20 5c28 5b52 R_1, -t]\), \([R │ │ │ +000ac3c0: 5f32 2c20 745d 5c29 2c20 5c28 5b52 5f32 _2, t]\), \([R_2 │ │ │ +000ac3d0: 2c20 2d74 5d5c 2920 6973 2061 2063 6861 , -t]\) is a cha │ │ │ +000ac3e0: 6e67 6520 6f66 2062 6173 6973 2066 726f nge of basis fro │ │ │ +000ac3f0: 6d20 7468 6520 6669 7273 740a 6361 6d65 m the first.came │ │ │ +000ac400: 7261 2773 2063 6f6f 7264 696e 6174 6520 ra's coordinate │ │ │ +000ac410: 7379 7374 656d 2074 6f20 7468 6520 7365 system to the se │ │ │ +000ac420: 636f 6e64 2063 616d 6572 6127 7320 636f cond camera's co │ │ │ +000ac430: 6f72 6469 6e61 7465 2073 7973 7465 6d2e ordinate system. │ │ │ +000ac440: 2048 6f77 6576 6572 2c20 6279 2064 6563 However, by dec │ │ │ +000ac450: 6f6d 706f 7369 6e67 2045 2c20 6f6e 650a omposing E, one. │ │ │ +000ac460: 6361 6e20 6f6e 6c79 2067 6574 2074 6865 can only get the │ │ │ +000ac470: 2064 6972 6563 7469 6f6e 206f 6620 7468 direction of th │ │ │ +000ac480: 6520 7472 616e 736c 6174 696f 6e2e 2046 e translation. F │ │ │ +000ac490: 6f72 2074 6869 7320 7265 6173 6f6e 2c20 or this reason, │ │ │ +000ac4a0: 7468 6520 7472 616e 736c 6174 696f 6e20 the translation │ │ │ +000ac4b0: 7420 6973 2072 6574 7572 6e65 6420 7769 t is returned wi │ │ │ +000ac4c0: 7468 0a75 6e69 7420 6c65 6e67 7468 2e3c th.unit length.< │ │ │ +000ac4d0: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .

  • ..
  • .
    .

    recoverPose

    .
    .
    │ │ │ +000ac650: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +000ac670: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +000ac680: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;int< │ │ │ +000ac6a0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> recoverPo │ │ │ +000ac6d0: 7365 3c2f 7370 616e 3e3c 7762 723e 3c73 se(Mat  │ │ │ +000ac740: 3b70 6f69 6e74 7331 2c0a 203c 6120 6872 ;points1,. Mat&n │ │ │ +000ac790: 6273 703b 706f 696e 7473 322c 0a20 3c61 bsp;points2,. Mat cameraMat │ │ │ +000ac7f0: 7269 7831 2c0a 203c 6120 6872 6566 3d22 rix1,. Mat  │ │ │ +000ac840: 6469 7374 436f 6566 6673 312c 0a20 3c61 distCoeffs1,. Mat cameraMat │ │ │ +000ac8a0: 7269 7832 2c0a 203c 6120 6872 6566 3d22 rix2,. Mat  │ │ │ +000ac8f0: 6469 7374 436f 6566 6673 322c 0a20 3c61 distCoeffs2,. Mat E,. Mat&n │ │ │ +000ac990: 6273 703b 522c 0a20 3c61 2068 7265 663d bsp;R,. Mat  │ │ │ +000ac9e0: 3b74 2c0a 2069 6e74 266e 6273 703b 6d65 ;t,. int me │ │ │ +000ac9f0: 7468 6f64 2c0a 2064 6f75 626c 6526 6e62 thod,. double&nb │ │ │ +000aca00: 7370 3b70 726f 622c 0a20 646f 7562 6c65 sp;prob,. double │ │ │ +000aca10: 266e 6273 703b 7468 7265 7368 6f6c 642c  threshold, │ │ │ 000aca20: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000aca60: 743c 2f61 3e26 6e62 7370 3b70 7432 2c0a t pt2,. │ │ │ -000aca70: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000acab0: 3c2f 613e 266e 6273 703b 4629 3c2f 7370  F)
    .
    Cal │ │ │ -000acae0: 6375 6c61 7465 7320 7468 6520 5361 6d70 culates the Samp │ │ │ -000acaf0: 736f 6e20 4469 7374 616e 6365 2062 6574 son Distance bet │ │ │ -000acb00: 7765 656e 2074 776f 2070 6f69 6e74 732e ween two points. │ │ │ -000acb10: 0a0a 5468 6520 6675 6e63 7469 6f6e 2063 ..The function c │ │ │ -000acb20: 763a 3a73 616d 7073 6f6e 4469 7374 616e v::sampsonDistan │ │ │ -000acb30: 6365 2063 616c 6375 6c61 7465 7320 616e ce calculates an │ │ │ -000acb40: 6420 7265 7475 726e 7320 7468 6520 6669 d returns the fi │ │ │ -000acb50: 7273 7420 6f72 6465 7220 6170 7072 6f78 rst order approx │ │ │ -000acb60: 696d 6174 696f 6e20 6f66 2074 6865 2067 imation of the g │ │ │ -000acb70: 656f 6d65 7472 6963 2065 7272 6f72 2061 eometric error a │ │ │ -000acb80: 733a 0a5c 280a 7364 2820 5c74 6578 7474 s:.\(.sd( \textt │ │ │ -000acb90: 747b 7074 317d 202c 205c 7465 7874 7474 t{pt1} , \texttt │ │ │ -000acba0: 7b70 7432 7d20 293d 0a5c 6672 6163 7b28 {pt2} )=.\frac{( │ │ │ -000acbb0: 5c74 6578 7474 747b 7074 327d 5e74 205c \texttt{pt2}^t \ │ │ │ -000acbc0: 6364 6f74 205c 7465 7874 7474 7b46 7d20 cdot \texttt{F} │ │ │ -000acbd0: 5c63 646f 7420 5c74 6578 7474 747b 7074 \cdot \texttt{pt │ │ │ -000acbe0: 317d 295e 327d 0a7b 2828 5c74 6578 7474 1})^2}.{((\textt │ │ │ -000acbf0: 747b 467d 205c 6364 6f74 205c 7465 7874 t{F} \cdot \text │ │ │ -000acc00: 7474 7b70 7431 7d29 2830 2929 5e32 202b tt{pt1})(0))^2 + │ │ │ -000acc10: 0a28 285c 7465 7874 7474 7b46 7d20 5c63 .((\texttt{F} \c │ │ │ -000acc20: 646f 7420 5c74 6578 7474 747b 7074 317d dot \texttt{pt1} │ │ │ -000acc30: 2928 3129 295e 3220 2b0a 2828 5c74 6578 )(1))^2 +.((\tex │ │ │ -000acc40: 7474 747b 467d 5e74 205c 6364 6f74 205c ttt{F}^t \cdot \ │ │ │ -000acc50: 7465 7874 7474 7b70 7432 7d29 2830 2929 texttt{pt2})(0)) │ │ │ -000acc60: 5e32 202b 0a28 285c 7465 7874 7474 7b46 ^2 +.((\texttt{F │ │ │ -000acc70: 7d5e 7420 5c63 646f 7420 5c74 6578 7474 }^t \cdot \textt │ │ │ -000acc80: 747b 7074 327d 2928 3129 295e 327d 0a5c t{pt2})(1))^2}.\ │ │ │ -000acc90: 290a 5468 6520 6675 6e64 616d 656e 7461 ).The fundamenta │ │ │ -000acca0: 6c20 6d61 7472 6978 206d 6179 2062 6520 l matrix may be │ │ │ -000accb0: 6361 6c63 756c 6174 6564 2075 7369 6e67 calculated using │ │ │ -000accc0: 2074 6865 2023 6669 6e64 4675 6e64 616d the #findFundam │ │ │ -000accd0: 656e 7461 6c4d 6174 2066 756e 6374 696f entalMat functio │ │ │ -000acce0: 6e2e 2053 6565 2043 4954 453a 2048 6172 n. See CITE: Har │ │ │ -000accf0: 746c 6579 5a30 3020 3131 2e34 2e33 2066 tleyZ00 11.4.3 f │ │ │ -000acd00: 6f72 2064 6574 6169 6c73 2e3c 2f64 6976 or details.
    .
    .
    Paramet │ │ │ -000acd30: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    pt1 - │ │ │ -000acd50: 2066 6972 7374 2068 6f6d 6f67 656e 656f first homogeneo │ │ │ -000acd60: 7573 2032 6420 706f 696e 743c 2f64 643e us 2d point
    │ │ │ -000acd70: 0a3c 6464 3e3c 636f 6465 3e70 7432 3c2f .
    pt2 - second h │ │ │ -000acd90: 6f6d 6f67 656e 656f 7573 2032 6420 706f omogeneous 2d po │ │ │ -000acda0: 696e 743c 2f64 643e 0a3c 6464 3e3c 636f int
    .
    F - fu │ │ │ -000acdc0: 6e64 616d 656e 7461 6c20 6d61 7472 6978 ndamental matrix │ │ │ -000acdd0: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ -000acde0: 733a 3c2f 6474 3e0a 3c64 643e 5468 6520 s:
    .
    The │ │ │ -000acdf0: 636f 6d70 7574 6564 2053 616d 7073 6f6e computed Sampson │ │ │ -000ace00: 2064 6973 7461 6e63 652e 3c2f 6464 3e0a distance.
    . │ │ │ -000ace10: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    ..
  • ..
    │ │ │ -000acec0: 0a3c 6833 3e65 7374 696d 6174 6541 6666 .

    estimateAff │ │ │ -000aced0: 696e 6533 443c 2f68 333e 0a3c 6469 7620 ine3D

    .
    .
    public static boolean estimateAffi │ │ │ -000acfa0: 6e65 3344 3c2f 7370 616e 3e3c 7762 723e ne3D │ │ │ -000acfb0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ -000ad010: 7370 3b73 7263 2c0a 203c 6120 6872 6566 sp;src,. Mat&nbs │ │ │ -000ad060: 703b 6473 742c 0a20 3c61 2068 7265 663d p;dst,. Mat  │ │ │ -000ad0b0: 3b6f 7574 2c0a 203c 6120 6872 6566 3d22 ;out,. Mat  │ │ │ -000ad100: 696e 6c69 6572 732c 0a20 646f 7562 6c65 inliers,. double │ │ │ -000ad110: 266e 6273 703b 7261 6e73 6163 5468 7265  ransacThre │ │ │ -000ad120: 7368 6f6c 642c 0a20 646f 7562 6c65 266e shold,. double&n │ │ │ -000ad130: 6273 703b 636f 6e66 6964 656e 6365 293c bsp;confidence)< │ │ │ -000ad140: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ -000ad160: 436f 6d70 7574 6573 2061 6e20 6f70 7469 Computes an opti │ │ │ -000ad170: 6d61 6c20 6166 6669 6e65 2074 7261 6e73 mal affine trans │ │ │ -000ad180: 666f 726d 6174 696f 6e20 6265 7477 6565 formation betwee │ │ │ -000ad190: 6e20 7477 6f20 3344 2070 6f69 6e74 2073 n two 3D point s │ │ │ -000ad1a0: 6574 732e 0a0a 4974 2063 6f6d 7075 7465 ets...It compute │ │ │ -000ad1b0: 730a 5c28 0a5c 6265 6769 6e7b 626d 6174 s.\(.\begin{bmat │ │ │ -000ad1c0: 7269 787d 0a78 5c5c 0a79 5c5c 0a7a 5c5c rix}.x\\.y\\.z\\ │ │ │ -000ad1d0: 0a5c 656e 647b 626d 6174 7269 787d 0a3d .\end{bmatrix}.= │ │ │ -000ad1e0: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ -000ad1f0: 0a61 5f7b 3131 7d20 2661 6d70 3b20 615f .a_{11} & a_ │ │ │ -000ad200: 7b31 327d 2026 616d 703b 2061 5f7b 3133 {12} & a_{13 │ │ │ -000ad210: 7d5c 5c0a 615f 7b32 317d 2026 616d 703b }\\.a_{21} & │ │ │ -000ad220: 2061 5f7b 3232 7d20 2661 6d70 3b20 615f a_{22} & a_ │ │ │ -000ad230: 7b32 337d 5c5c 0a61 5f7b 3331 7d20 2661 {23}\\.a_{31} &a │ │ │ -000ad240: 6d70 3b20 615f 7b33 327d 2026 616d 703b mp; a_{32} & │ │ │ -000ad250: 2061 5f7b 3333 7d5c 5c0a 5c65 6e64 7b62 a_{33}\\.\end{b │ │ │ -000ad260: 6d61 7472 6978 7d0a 5c62 6567 696e 7b62 matrix}.\begin{b │ │ │ -000ad270: 6d61 7472 6978 7d0a 585c 5c0a 595c 5c0a matrix}.X\\.Y\\. │ │ │ -000ad280: 5a5c 5c0a 5c65 6e64 7b62 6d61 7472 6978 Z\\.\end{bmatrix │ │ │ -000ad290: 7d0a 2b0a 5c62 6567 696e 7b62 6d61 7472 }.+.\begin{bmatr │ │ │ -000ad2a0: 6978 7d0a 625f 315c 5c0a 625f 325c 5c0a ix}.b_1\\.b_2\\. │ │ │ -000ad2b0: 625f 335c 5c0a 5c65 6e64 7b62 6d61 7472 b_3\\.\end{bmatr │ │ │ -000ad2c0: 6978 7d0a 5c29 3c2f 6469 763e 0a3c 646c ix}.\)
    .
    . │ │ │ -000ad2e0: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -000ad2f0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e73 /dt>.
    s │ │ │ -000ad300: 7263 3c2f 636f 6465 3e20 2d20 4669 7273 rc - Firs │ │ │ -000ad310: 7420 696e 7075 7420 3344 2070 6f69 6e74 t input 3D point │ │ │ -000ad320: 2073 6574 2063 6f6e 7461 696e 696e 6720 set containing │ │ │ -000ad330: 5c28 2858 2c59 2c5a 295c 292e 3c2f 6464 \((X,Y,Z)\).
    .
    dst< │ │ │ -000ad350: 2f63 6f64 653e 202d 2053 6563 6f6e 6420 /code> - Second │ │ │ -000ad360: 696e 7075 7420 3344 2070 6f69 6e74 2073 input 3D point s │ │ │ -000ad370: 6574 2063 6f6e 7461 696e 696e 6720 5c28 et containing \( │ │ │ -000ad380: 2878 2c79 2c7a 295c 292e 3c2f 6464 3e0a (x,y,z)\).
    . │ │ │ -000ad390: 3c64 643e 3c63 6f64 653e 6f75 743c 2f63
    out - Output 3D │ │ │ -000ad3b0: 2061 6666 696e 6520 7472 616e 7366 6f72 affine transfor │ │ │ -000ad3c0: 6d61 7469 6f6e 206d 6174 7269 7820 5c28 mation matrix \( │ │ │ -000ad3d0: 3320 5c74 696d 6573 2034 5c29 206f 6620 3 \times 4\) of │ │ │ -000ad3e0: 7468 6520 666f 726d 0a5c 280a 5c62 6567 the form.\(.\beg │ │ │ -000ad3f0: 696e 7b62 6d61 7472 6978 7d0a 615f 7b31 in{bmatrix}.a_{1 │ │ │ -000ad400: 317d 2026 616d 703b 2061 5f7b 3132 7d20 1} & a_{12} │ │ │ -000ad410: 2661 6d70 3b20 615f 7b31 337d 2026 616d & a_{13} &am │ │ │ -000ad420: 703b 2062 5f31 5c5c 0a61 5f7b 3231 7d20 p; b_1\\.a_{21} │ │ │ -000ad430: 2661 6d70 3b20 615f 7b32 327d 2026 616d & a_{22} &am │ │ │ -000ad440: 703b 2061 5f7b 3233 7d20 2661 6d70 3b20 p; a_{23} & │ │ │ -000ad450: 625f 325c 5c0a 615f 7b33 317d 2026 616d b_2\\.a_{31} &am │ │ │ -000ad460: 703b 2061 5f7b 3332 7d20 2661 6d70 3b20 p; a_{32} & │ │ │ -000ad470: 615f 7b33 337d 2026 616d 703b 2062 5f33 a_{33} & b_3 │ │ │ -000ad480: 5c5c 0a5c 656e 647b 626d 6174 7269 787d \\.\end{bmatrix} │ │ │ -000ad490: 0a5c 293c 2f64 643e 0a3c 6464 3e3c 636f .\)
    .
    inliers - Output vecto │ │ │ -000ad4c0: 7220 696e 6469 6361 7469 6e67 2077 6869 r indicating whi │ │ │ -000ad4d0: 6368 2070 6f69 6e74 7320 6172 6520 696e ch points are in │ │ │ -000ad4e0: 6c69 6572 7320 2831 2d69 6e6c 6965 722c liers (1-inlier, │ │ │ -000ad4f0: 2030 2d6f 7574 6c69 6572 292e 3c2f 6464 0-outlier).
    .
    rans │ │ │ -000ad510: 6163 5468 7265 7368 6f6c 643c 2f63 6f64 acThreshold - Maximum rep │ │ │ -000ad530: 726f 6a65 6374 696f 6e20 6572 726f 7220 rojection error │ │ │ -000ad540: 696e 2074 6865 2052 414e 5341 4320 616c in the RANSAC al │ │ │ -000ad550: 676f 7269 7468 6d20 746f 2063 6f6e 7369 gorithm to consi │ │ │ -000ad560: 6465 7220 6120 706f 696e 7420 6173 0a61 der a point as.a │ │ │ -000ad570: 6e20 696e 6c69 6572 2e3c 2f64 643e 0a3c n inlier.
    .< │ │ │ -000ad580: 6464 3e3c 636f 6465 3e63 6f6e 6669 6465 dd>confide │ │ │ -000ad590: 6e63 653c 2f63 6f64 653e 202d 2043 6f6e nce - Con │ │ │ -000ad5a0: 6669 6465 6e63 6520 6c65 7665 6c2c 2062 fidence level, b │ │ │ -000ad5b0: 6574 7765 656e 2030 2061 6e64 2031 2c20 etween 0 and 1, │ │ │ -000ad5c0: 666f 7220 7468 6520 6573 7469 6d61 7465 for the estimate │ │ │ -000ad5d0: 6420 7472 616e 7366 6f72 6d61 7469 6f6e d transformation │ │ │ -000ad5e0: 2e20 416e 7974 6869 6e67 0a62 6574 7765 . Anything.betwe │ │ │ -000ad5f0: 656e 2030 2e39 3520 616e 6420 302e 3939 en 0.95 and 0.99 │ │ │ -000ad600: 2069 7320 7573 7561 6c6c 7920 676f 6f64 is usually good │ │ │ -000ad610: 2065 6e6f 7567 682e 2056 616c 7565 7320 enough. Values │ │ │ -000ad620: 746f 6f20 636c 6f73 6520 746f 2031 2063 too close to 1 c │ │ │ -000ad630: 616e 2073 6c6f 7720 646f 776e 2074 6865 an slow down the │ │ │ -000ad640: 2065 7374 696d 6174 696f 6e0a 7369 676e estimation.sign │ │ │ -000ad650: 6966 6963 616e 746c 792e 2056 616c 7565 ificantly. Value │ │ │ -000ad660: 7320 6c6f 7765 7220 7468 616e 2030 2e38 s lower than 0.8 │ │ │ -000ad670: 2d30 2e39 2063 616e 2072 6573 756c 7420 -0.9 can result │ │ │ -000ad680: 696e 2061 6e20 696e 636f 7272 6563 746c in an incorrectl │ │ │ -000ad690: 7920 6573 7469 6d61 7465 6420 7472 616e y estimated tran │ │ │ -000ad6a0: 7366 6f72 6d61 7469 6f6e 2e3c 2f64 643e sformation. │ │ │ -000ad6b0: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    Whether a │ │ │ -000ad6d0: 2073 6f6c 7574 696f 6e20 7761 7320 666f solution was fo │ │ │ -000ad6e0: 756e 642e 0a0a 5468 6520 6675 6e63 7469 und...The functi │ │ │ -000ad6f0: 6f6e 2065 7374 696d 6174 6573 2061 6e20 on estimates an │ │ │ -000ad700: 6f70 7469 6d61 6c20 3344 2061 6666 696e optimal 3D affin │ │ │ -000ad710: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ -000ad720: 2062 6574 7765 656e 2074 776f 2033 4420 between two 3D │ │ │ -000ad730: 706f 696e 7420 7365 7473 2075 7369 6e67 point sets using │ │ │ -000ad740: 2074 6865 0a52 414e 5341 4320 616c 676f the.RANSAC algo │ │ │ -000ad750: 7269 7468 6d2e 3c2f 6464 3e0a 3c2f 646c rithm.
    .
    ....
  • .< │ │ │ -000ad780: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ -000ad790: 6574 6169 6c22 2069 643d 2265 7374 696d etail" id="estim │ │ │ -000ad7a0: 6174 6541 6666 696e 6533 4428 6f72 672e ateAffine3D(org. │ │ │ -000ad7b0: 6f70 656e 6376 2e63 6f72 652e 4d61 742c opencv.core.Mat, │ │ │ -000ad7c0: 6f72 672e 6f70 656e 6376 2e63 6f72 652e org.opencv.core. │ │ │ -000ad7d0: 4d61 742c 6f72 672e 6f70 656e 6376 2e63 Mat,org.opencv.c │ │ │ -000ad7e0: 6f72 652e 4d61 742c 6f72 672e 6f70 656e ore.Mat,org.open │ │ │ -000ad7f0: 6376 2e63 6f72 652e 4d61 742c 646f 7562 cv.core.Mat,doub │ │ │ -000ad800: 6c65 2922 3e0a 3c68 333e 6573 7469 6d61 le)">.

    estima │ │ │ -000ad810: 7465 4166 6669 6e65 3344 3c2f 6833 3e0a teAffine3D

    . │ │ │ -000ad820: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ -000ad840: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ -000ad880: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ -000ad890: 3c73 7061 6e20 636c 6173 733d 2272 6574 boolea │ │ │ -000ad8b0: 6e3c 2f73 7061 6e3e 266e 6273 703b 3c73 n estimat │ │ │ -000ad8e0: 6541 6666 696e 6533 443c 2f73 7061 6e3e eAffine3D │ │ │ -000ad8f0: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ -000ad910: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000ad920: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000ad930: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000ad940: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat src,. Mat dst,. Mat │ │ │ -000ad9f0: 266e 6273 703b 6f75 742c 0a20 3c61 2068  out,. Mat& │ │ │ -000ada40: 6e62 7370 3b69 6e6c 6965 7273 2c0a 2064 nbsp;inliers,. d │ │ │ -000ada50: 6f75 626c 6526 6e62 7370 3b72 616e 7361 ouble ransa │ │ │ -000ada60: 6354 6872 6573 686f 6c64 293c 2f73 7061 cThreshold)
    .
    Comp │ │ │ -000ada90: 7574 6573 2061 6e20 6f70 7469 6d61 6c20 utes an optimal │ │ │ -000adaa0: 6166 6669 6e65 2074 7261 6e73 666f 726d affine transform │ │ │ -000adab0: 6174 696f 6e20 6265 7477 6565 6e20 7477 ation between tw │ │ │ -000adac0: 6f20 3344 2070 6f69 6e74 2073 6574 732e o 3D point sets. │ │ │ -000adad0: 0a0a 4974 2063 6f6d 7075 7465 730a 5c28 ..It computes.\( │ │ │ -000adae0: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ -000adaf0: 0a78 5c5c 0a79 5c5c 0a7a 5c5c 0a5c 656e .x\\.y\\.z\\.\en │ │ │ -000adb00: 647b 626d 6174 7269 787d 0a3d 0a5c 6265 d{bmatrix}.=.\be │ │ │ -000adb10: 6769 6e7b 626d 6174 7269 787d 0a61 5f7b gin{bmatrix}.a_{ │ │ │ -000adb20: 3131 7d20 2661 6d70 3b20 615f 7b31 327d 11} & a_{12} │ │ │ -000adb30: 2026 616d 703b 2061 5f7b 3133 7d5c 5c0a & a_{13}\\. │ │ │ -000adb40: 615f 7b32 317d 2026 616d 703b 2061 5f7b a_{21} & a_{ │ │ │ -000adb50: 3232 7d20 2661 6d70 3b20 615f 7b32 337d 22} & a_{23} │ │ │ -000adb60: 5c5c 0a61 5f7b 3331 7d20 2661 6d70 3b20 \\.a_{31} & │ │ │ -000adb70: 615f 7b33 327d 2026 616d 703b 2061 5f7b a_{32} & a_{ │ │ │ -000adb80: 3333 7d5c 5c0a 5c65 6e64 7b62 6d61 7472 33}\\.\end{bmatr │ │ │ -000adb90: 6978 7d0a 5c62 6567 696e 7b62 6d61 7472 ix}.\begin{bmatr │ │ │ -000adba0: 6978 7d0a 585c 5c0a 595c 5c0a 5a5c 5c0a ix}.X\\.Y\\.Z\\. │ │ │ -000adbb0: 5c65 6e64 7b62 6d61 7472 6978 7d0a 2b0a \end{bmatrix}.+. │ │ │ -000adbc0: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ -000adbd0: 625f 315c 5c0a 625f 325c 5c0a 625f 335c b_1\\.b_2\\.b_3\ │ │ │ -000adbe0: 5c0a 5c65 6e64 7b62 6d61 7472 6978 7d0a \.\end{bmatrix}. │ │ │ -000adbf0: 5c29 3c2f 6469 763e 0a3c 646c 2063 6c61 \)
    .
    .
    │ │ │ -000adc10: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ -000adc20: 0a3c 6464 3e3c 636f 6465 3e73 7263 3c2f .
    src - First in │ │ │ -000adc40: 7075 7420 3344 2070 6f69 6e74 2073 6574 put 3D point set │ │ │ -000adc50: 2063 6f6e 7461 696e 696e 6720 5c28 2858 containing \((X │ │ │ -000adc60: 2c59 2c5a 295c 292e 3c2f 6464 3e0a 3c64 ,Y,Z)\).
    .dst - Second inpu │ │ │ -000adc90: 7420 3344 2070 6f69 6e74 2073 6574 2063 t 3D point set c │ │ │ -000adca0: 6f6e 7461 696e 696e 6720 5c28 2878 2c79 ontaining \((x,y │ │ │ -000adcb0: 2c7a 295c 292e 3c2f 6464 3e0a 3c64 643e ,z)\)..
    │ │ │ -000adcc0: 3c63 6f64 653e 6f75 743c 2f63 6f64 653e out │ │ │ -000adcd0: 202d 204f 7574 7075 7420 3344 2061 6666 - Output 3D aff │ │ │ -000adce0: 696e 6520 7472 616e 7366 6f72 6d61 7469 ine transformati │ │ │ -000adcf0: 6f6e 206d 6174 7269 7820 5c28 3320 5c74 on matrix \(3 \t │ │ │ -000add00: 696d 6573 2034 5c29 206f 6620 7468 6520 imes 4\) of the │ │ │ -000add10: 666f 726d 0a5c 280a 5c62 6567 696e 7b62 form.\(.\begin{b │ │ │ -000add20: 6d61 7472 6978 7d0a 615f 7b31 317d 2026 matrix}.a_{11} & │ │ │ -000add30: 616d 703b 2061 5f7b 3132 7d20 2661 6d70 amp; a_{12} & │ │ │ -000add40: 3b20 615f 7b31 337d 2026 616d 703b 2062 ; a_{13} & b │ │ │ -000add50: 5f31 5c5c 0a61 5f7b 3231 7d20 2661 6d70 _1\\.a_{21} & │ │ │ -000add60: 3b20 615f 7b32 327d 2026 616d 703b 2061 ; a_{22} & a │ │ │ -000add70: 5f7b 3233 7d20 2661 6d70 3b20 625f 325c _{23} & b_2\ │ │ │ -000add80: 5c0a 615f 7b33 317d 2026 616d 703b 2061 \.a_{31} & a │ │ │ -000add90: 5f7b 3332 7d20 2661 6d70 3b20 615f 7b33 _{32} & a_{3 │ │ │ -000adda0: 337d 2026 616d 703b 2062 5f33 5c5c 0a5c 3} & b_3\\.\ │ │ │ -000addb0: 656e 647b 626d 6174 7269 787d 0a5c 293c end{bmatrix}.\)< │ │ │ -000addc0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e69 /dd>.
    i │ │ │ -000addd0: 6e6c 6965 7273 3c2f 636f 6465 3e20 2d20 nliers - │ │ │ -000adde0: 4f75 7470 7574 2076 6563 746f 7220 696e Output vector in │ │ │ -000addf0: 6469 6361 7469 6e67 2077 6869 6368 2070 dicating which p │ │ │ -000ade00: 6f69 6e74 7320 6172 6520 696e 6c69 6572 oints are inlier │ │ │ -000ade10: 7320 2831 2d69 6e6c 6965 722c 2030 2d6f s (1-inlier, 0-o │ │ │ -000ade20: 7574 6c69 6572 292e 3c2f 6464 3e0a 3c64 utlier).
    .ransacTh │ │ │ -000ade40: 7265 7368 6f6c 643c 2f63 6f64 653e 202d reshold - │ │ │ -000ade50: 204d 6178 696d 756d 2072 6570 726f 6a65 Maximum reproje │ │ │ -000ade60: 6374 696f 6e20 6572 726f 7220 696e 2074 ction error in t │ │ │ -000ade70: 6865 2052 414e 5341 4320 616c 676f 7269 he RANSAC algori │ │ │ -000ade80: 7468 6d20 746f 2063 6f6e 7369 6465 7220 thm to consider │ │ │ -000ade90: 6120 706f 696e 7420 6173 0a61 6e20 696e a point as.an in │ │ │ -000adea0: 6c69 6572 2e0a 6265 7477 6565 6e20 302e lier..between 0. │ │ │ -000adeb0: 3935 2061 6e64 2030 2e39 3920 6973 2075 95 and 0.99 is u │ │ │ -000adec0: 7375 616c 6c79 2067 6f6f 6420 656e 6f75 sually good enou │ │ │ -000aded0: 6768 2e20 5661 6c75 6573 2074 6f6f 2063 gh. Values too c │ │ │ -000adee0: 6c6f 7365 2074 6f20 3120 6361 6e20 736c lose to 1 can sl │ │ │ -000adef0: 6f77 2064 6f77 6e20 7468 6520 6573 7469 ow down the esti │ │ │ -000adf00: 6d61 7469 6f6e 0a73 6967 6e69 6669 6361 mation.significa │ │ │ -000adf10: 6e74 6c79 2e20 5661 6c75 6573 206c 6f77 ntly. Values low │ │ │ -000adf20: 6572 2074 6861 6e20 302e 382d 302e 3920 er than 0.8-0.9 │ │ │ -000adf30: 6361 6e20 7265 7375 6c74 2069 6e20 616e can result in an │ │ │ -000adf40: 2069 6e63 6f72 7265 6374 6c79 2065 7374 incorrectly est │ │ │ -000adf50: 696d 6174 6564 2074 7261 6e73 666f 726d imated transform │ │ │ -000adf60: 6174 696f 6e2e 3c2f 6464 3e0a 3c64 743e ation..
    │ │ │ -000adf70: 5265 7475 726e 733a 3c2f 6474 3e0a 3c64 Returns:
    .Whether a solu │ │ │ -000adf90: 7469 6f6e 2077 6173 2066 6f75 6e64 2e0a tion was found.. │ │ │ -000adfa0: 0a54 6865 2066 756e 6374 696f 6e20 6573 .The function es │ │ │ -000adfb0: 7469 6d61 7465 7320 616e 206f 7074 696d timates an optim │ │ │ -000adfc0: 616c 2033 4420 6166 6669 6e65 2074 7261 al 3D affine tra │ │ │ -000adfd0: 6e73 666f 726d 6174 696f 6e20 6265 7477 nsformation betw │ │ │ -000adfe0: 6565 6e20 7477 6f20 3344 2070 6f69 6e74 een two 3D point │ │ │ -000adff0: 2073 6574 7320 7573 696e 6720 7468 650a sets using the. │ │ │ -000ae000: 5241 4e53 4143 2061 6c67 6f72 6974 686d RANSAC algorithm │ │ │ -000ae010: 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 ..
    ..
  • .< │ │ │ -000ae030: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    es │ │ │ -000ae0c0: 7469 6d61 7465 4166 6669 6e65 3344 3c2f timateAffine3D.
    .
    public │ │ │ -000ae130: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ -000ae140: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;bo │ │ │ -000ae160: 6f6c 6561 6e3c 2f73 7061 6e3e 266e 6273 olean&nbs │ │ │ -000ae170: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;est │ │ │ -000ae190: 696d 6174 6541 6666 696e 6533 443c 2f73 imateAffine3D(M │ │ │ -000ae200: 6174 3c2f 613e 266e 6273 703b 7372 632c at src, │ │ │ -000ae210: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000ae250: 743c 2f61 3e26 6e62 7370 3b64 7374 2c0a t dst,. │ │ │ -000ae260: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000ae2a0: 3c2f 613e 266e 6273 703b 6f75 742c 0a20  out,. │ │ │ -000ae2b0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000ae2f0: 2f61 3e26 6e62 7370 3b69 6e6c 6965 7273 /a> inliers │ │ │ -000ae300: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ -000ae310: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -000ae320: 223e 436f 6d70 7574 6573 2061 6e20 6f70 ">Computes an op │ │ │ -000ae330: 7469 6d61 6c20 6166 6669 6e65 2074 7261 timal affine tra │ │ │ -000ae340: 6e73 666f 726d 6174 696f 6e20 6265 7477 nsformation betw │ │ │ -000ae350: 6565 6e20 7477 6f20 3344 2070 6f69 6e74 een two 3D point │ │ │ -000ae360: 2073 6574 732e 0a0a 4974 2063 6f6d 7075 sets...It compu │ │ │ -000ae370: 7465 730a 5c28 0a5c 6265 6769 6e7b 626d tes.\(.\begin{bm │ │ │ -000ae380: 6174 7269 787d 0a78 5c5c 0a79 5c5c 0a7a atrix}.x\\.y\\.z │ │ │ -000ae390: 5c5c 0a5c 656e 647b 626d 6174 7269 787d \\.\end{bmatrix} │ │ │ -000ae3a0: 0a3d 0a5c 6265 6769 6e7b 626d 6174 7269 .=.\begin{bmatri │ │ │ -000ae3b0: 787d 0a61 5f7b 3131 7d20 2661 6d70 3b20 x}.a_{11} & │ │ │ -000ae3c0: 615f 7b31 327d 2026 616d 703b 2061 5f7b a_{12} & a_{ │ │ │ -000ae3d0: 3133 7d5c 5c0a 615f 7b32 317d 2026 616d 13}\\.a_{21} &am │ │ │ -000ae3e0: 703b 2061 5f7b 3232 7d20 2661 6d70 3b20 p; a_{22} & │ │ │ -000ae3f0: 615f 7b32 337d 5c5c 0a61 5f7b 3331 7d20 a_{23}\\.a_{31} │ │ │ -000ae400: 2661 6d70 3b20 615f 7b33 327d 2026 616d & a_{32} &am │ │ │ -000ae410: 703b 2061 5f7b 3333 7d5c 5c0a 5c65 6e64 p; a_{33}\\.\end │ │ │ -000ae420: 7b62 6d61 7472 6978 7d0a 5c62 6567 696e {bmatrix}.\begin │ │ │ -000ae430: 7b62 6d61 7472 6978 7d0a 585c 5c0a 595c {bmatrix}.X\\.Y\ │ │ │ -000ae440: 5c0a 5a5c 5c0a 5c65 6e64 7b62 6d61 7472 \.Z\\.\end{bmatr │ │ │ -000ae450: 6978 7d0a 2b0a 5c62 6567 696e 7b62 6d61 ix}.+.\begin{bma │ │ │ -000ae460: 7472 6978 7d0a 625f 315c 5c0a 625f 325c trix}.b_1\\.b_2\ │ │ │ -000ae470: 5c0a 625f 335c 5c0a 5c65 6e64 7b62 6d61 \.b_3\\.\end{bma │ │ │ -000ae480: 7472 6978 7d0a 5c29 3c2f 6469 763e 0a3c trix}.\)
    .< │ │ │ -000ae490: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ -000ae4a0: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ -000ae4b0: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    src - Fi │ │ │ -000ae4d0: 7273 7420 696e 7075 7420 3344 2070 6f69 rst input 3D poi │ │ │ -000ae4e0: 6e74 2073 6574 2063 6f6e 7461 696e 696e nt set containin │ │ │ -000ae4f0: 6720 5c28 2858 2c59 2c5a 295c 292e 3c2f g \((X,Y,Z)\)..
    ds │ │ │ -000ae510: 743c 2f63 6f64 653e 202d 2053 6563 6f6e t - Secon │ │ │ -000ae520: 6420 696e 7075 7420 3344 2070 6f69 6e74 d input 3D point │ │ │ -000ae530: 2073 6574 2063 6f6e 7461 696e 696e 6720 set containing │ │ │ -000ae540: 5c28 2878 2c79 2c7a 295c 292e 3c2f 6464 \((x,y,z)\).
    .
    out< │ │ │ -000ae560: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ -000ae570: 3344 2061 6666 696e 6520 7472 616e 7366 3D affine transf │ │ │ -000ae580: 6f72 6d61 7469 6f6e 206d 6174 7269 7820 ormation matrix │ │ │ -000ae590: 5c28 3320 5c74 696d 6573 2034 5c29 206f \(3 \times 4\) o │ │ │ -000ae5a0: 6620 7468 6520 666f 726d 0a5c 280a 5c62 f the form.\(.\b │ │ │ -000ae5b0: 6567 696e 7b62 6d61 7472 6978 7d0a 615f egin{bmatrix}.a_ │ │ │ -000ae5c0: 7b31 317d 2026 616d 703b 2061 5f7b 3132 {11} & a_{12 │ │ │ -000ae5d0: 7d20 2661 6d70 3b20 615f 7b31 337d 2026 } & a_{13} & │ │ │ -000ae5e0: 616d 703b 2062 5f31 5c5c 0a61 5f7b 3231 amp; b_1\\.a_{21 │ │ │ -000ae5f0: 7d20 2661 6d70 3b20 615f 7b32 327d 2026 } & a_{22} & │ │ │ -000ae600: 616d 703b 2061 5f7b 3233 7d20 2661 6d70 amp; a_{23} & │ │ │ -000ae610: 3b20 625f 325c 5c0a 615f 7b33 317d 2026 ; b_2\\.a_{31} & │ │ │ -000ae620: 616d 703b 2061 5f7b 3332 7d20 2661 6d70 amp; a_{32} & │ │ │ -000ae630: 3b20 615f 7b33 337d 2026 616d 703b 2062 ; a_{33} & b │ │ │ -000ae640: 5f33 5c5c 0a5c 656e 647b 626d 6174 7269 _3\\.\end{bmatri │ │ │ -000ae650: 787d 0a5c 293c 2f64 643e 0a3c 6464 3e3c x}.\)
    .
    < │ │ │ -000ae660: 636f 6465 3e69 6e6c 6965 7273 3c2f 636f code>inliers - Output vec │ │ │ -000ae680: 746f 7220 696e 6469 6361 7469 6e67 2077 tor indicating w │ │ │ -000ae690: 6869 6368 2070 6f69 6e74 7320 6172 6520 hich points are │ │ │ -000ae6a0: 696e 6c69 6572 7320 2831 2d69 6e6c 6965 inliers (1-inlie │ │ │ -000ae6b0: 722c 2030 2d6f 7574 6c69 6572 292e 0a61 r, 0-outlier)..a │ │ │ -000ae6c0: 6e20 696e 6c69 6572 2e0a 6265 7477 6565 n inlier..betwee │ │ │ -000ae6d0: 6e20 302e 3935 2061 6e64 2030 2e39 3920 n 0.95 and 0.99 │ │ │ -000ae6e0: 6973 2075 7375 616c 6c79 2067 6f6f 6420 is usually good │ │ │ -000ae6f0: 656e 6f75 6768 2e20 5661 6c75 6573 2074 enough. Values t │ │ │ -000ae700: 6f6f 2063 6c6f 7365 2074 6f20 3120 6361 oo close to 1 ca │ │ │ -000ae710: 6e20 736c 6f77 2064 6f77 6e20 7468 6520 n slow down the │ │ │ -000ae720: 6573 7469 6d61 7469 6f6e 0a73 6967 6e69 estimation.signi │ │ │ -000ae730: 6669 6361 6e74 6c79 2e20 5661 6c75 6573 ficantly. Values │ │ │ -000ae740: 206c 6f77 6572 2074 6861 6e20 302e 382d lower than 0.8- │ │ │ -000ae750: 302e 3920 6361 6e20 7265 7375 6c74 2069 0.9 can result i │ │ │ -000ae760: 6e20 616e 2069 6e63 6f72 7265 6374 6c79 n an incorrectly │ │ │ -000ae770: 2065 7374 696d 6174 6564 2074 7261 6e73 estimated trans │ │ │ -000ae780: 666f 726d 6174 696f 6e2e 3c2f 6464 3e0a formation.
    . │ │ │ -000ae790: 3c64 743e 5265 7475 726e 733a 3c2f 6474
    Returns:
    .
    Whether a │ │ │ -000ae7b0: 736f 6c75 7469 6f6e 2077 6173 2066 6f75 solution was fou │ │ │ -000ae7c0: 6e64 2e0a 0a54 6865 2066 756e 6374 696f nd...The functio │ │ │ -000ae7d0: 6e20 6573 7469 6d61 7465 7320 616e 206f n estimates an o │ │ │ -000ae7e0: 7074 696d 616c 2033 4420 6166 6669 6e65 ptimal 3D affine │ │ │ -000ae7f0: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ -000ae800: 6265 7477 6565 6e20 7477 6f20 3344 2070 between two 3D p │ │ │ -000ae810: 6f69 6e74 2073 6574 7320 7573 696e 6720 oint sets using │ │ │ -000ae820: 7468 650a 5241 4e53 4143 2061 6c67 6f72 the.RANSAC algor │ │ │ -000ae830: 6974 686d 2e3c 2f64 643e 0a3c 2f64 6c3e ithm.
    . │ │ │ -000ae840: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f ...

  • .
  • ..

    estim │ │ │ -000ae8d0: 6174 6541 6666 696e 6533 443c 2f68 333e ateAffine3D

    │ │ │ -000ae8e0: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ -000ae900: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ -000ae920: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ -000ae930: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ -000ae940: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ -000ae950: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;Mat estimateAf │ │ │ -000ae9e0: 6669 6e65 3344 3c2f 7370 616e 3e3c 7762 fine3D(Mat& │ │ │ -000aea50: 6e62 7370 3b73 7263 2c0a 203c 6120 6872 nbsp;src,. Mat&n │ │ │ -000aeaa0: 6273 703b 6473 742c 0a20 646f 7562 6c65 bsp;dst,. double │ │ │ -000aeab0: 5b5d 266e 6273 703b 7363 616c 652c 0a20 [] scale,. │ │ │ -000aeac0: 626f 6f6c 6561 6e26 6e62 7370 3b66 6f72 boolean for │ │ │ -000aead0: 6365 5f72 6f74 6174 696f 6e29 3c2f 7370 ce_rotation)
    .
    Com │ │ │ -000aeb00: 7075 7465 7320 616e 206f 7074 696d 616c putes an optimal │ │ │ -000aeb10: 2061 6666 696e 6520 7472 616e 7366 6f72 affine transfor │ │ │ -000aeb20: 6d61 7469 6f6e 2062 6574 7765 656e 2074 mation between t │ │ │ -000aeb30: 776f 2033 4420 706f 696e 7420 7365 7473 wo 3D point sets │ │ │ -000aeb40: 2e0a 0a49 7420 636f 6d70 7574 6573 205c ...It computes \ │ │ │ -000aeb50: 2852 2c73 2c74 5c29 206d 696e 696d 697a (R,s,t\) minimiz │ │ │ -000aeb60: 696e 6720 5c28 5c73 756d 7b69 7d20 6473 ing \(\sum{i} ds │ │ │ -000aeb70: 745f 6920 2d20 6320 5c63 646f 7420 5220 t_i - c \cdot R │ │ │ -000aeb80: 5c63 646f 7420 7372 635f 6920 5c29 0a77 \cdot src_i \).w │ │ │ -000aeb90: 6865 7265 205c 2852 5c29 2069 7320 6120 here \(R\) is a │ │ │ -000aeba0: 3378 3320 726f 7461 7469 6f6e 206d 6174 3x3 rotation mat │ │ │ -000aebb0: 7269 782c 205c 2874 5c29 2069 7320 6120 rix, \(t\) is a │ │ │ -000aebc0: 3378 3120 7472 616e 736c 6174 696f 6e20 3x1 translation │ │ │ -000aebd0: 7665 6374 6f72 2061 6e64 205c 2873 5c29 vector and \(s\) │ │ │ -000aebe0: 2069 7320 610a 7363 616c 6172 2073 697a is a.scalar siz │ │ │ -000aebf0: 6520 7661 6c75 652e 2054 6869 7320 6973 e value. This is │ │ │ -000aec00: 2061 6e20 696d 706c 656d 656e 7461 7469 an implementati │ │ │ -000aec10: 6f6e 206f 6620 7468 6520 616c 676f 7269 on of the algori │ │ │ -000aec20: 7468 6d20 6279 2055 6d65 7961 6d61 205c thm by Umeyama \ │ │ │ -000aec30: 6369 7465 2075 6d65 7961 6d61 3139 3931 cite umeyama1991 │ │ │ -000aec40: 6c65 6173 7420 2e0a 5468 6520 6573 7469 least ..The esti │ │ │ -000aec50: 6d61 7465 6420 6166 6669 6e65 2074 7261 mated affine tra │ │ │ -000aec60: 6e73 666f 726d 2068 6173 2061 2068 6f6d nsform has a hom │ │ │ -000aec70: 6f67 656e 656f 7573 2073 6361 6c65 2077 ogeneous scale w │ │ │ -000aec80: 6869 6368 2069 7320 6120 7375 6263 6c61 hich is a subcla │ │ │ -000aec90: 7373 206f 6620 6166 6669 6e65 0a74 7261 ss of affine.tra │ │ │ -000aeca0: 6e73 666f 726d 6174 696f 6e73 2077 6974 nsformations wit │ │ │ -000aecb0: 6820 3720 6465 6772 6565 7320 6f66 2066 h 7 degrees of f │ │ │ -000aecc0: 7265 6564 6f6d 2e20 5468 6520 7061 6972 reedom. The pair │ │ │ -000aecd0: 6564 2070 6f69 6e74 2073 6574 7320 6e65 ed point sets ne │ │ │ -000aece0: 6564 2074 6f20 636f 6d70 7269 7365 2061 ed to comprise a │ │ │ -000aecf0: 7420 6c65 6173 7420 330a 706f 696e 7473 t least 3.points │ │ │ -000aed00: 2065 6163 682e 3c2f 6469 763e 0a3c 646c each.
    .
    . │ │ │ -000aed20: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -000aed30: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e73 /dt>.
    s │ │ │ -000aed40: 7263 3c2f 636f 6465 3e20 2d20 4669 7273 rc - Firs │ │ │ -000aed50: 7420 696e 7075 7420 3344 2070 6f69 6e74 t input 3D point │ │ │ -000aed60: 2073 6574 2e3c 2f64 643e 0a3c 6464 3e3c set.
    .
    < │ │ │ -000aed70: 636f 6465 3e64 7374 3c2f 636f 6465 3e20 code>dst │ │ │ -000aed80: 2d20 5365 636f 6e64 2069 6e70 7574 2033 - Second input 3 │ │ │ -000aed90: 4420 706f 696e 7420 7365 742e 3c2f 6464 D point set.
    .
    scal │ │ │ -000aedb0: 653c 2f63 6f64 653e 202d 2049 6620 6e75 e - If nu │ │ │ -000aedc0: 6c6c 2069 7320 7061 7373 6564 2c20 7468 ll is passed, th │ │ │ -000aedd0: 6520 7363 616c 6520 7061 7261 6d65 7465 e scale paramete │ │ │ -000aede0: 7220 6320 7769 6c6c 2062 6520 6173 7375 r c will be assu │ │ │ -000aedf0: 6d65 6420 746f 2062 6520 312e 302e 0a45 med to be 1.0..E │ │ │ -000aee00: 6c73 6520 7468 6520 706f 696e 7465 642d lse the pointed- │ │ │ -000aee10: 746f 2076 6172 6961 626c 6520 7769 6c6c to variable will │ │ │ -000aee20: 2062 6520 7365 7420 746f 2074 6865 206f be set to the o │ │ │ -000aee30: 7074 696d 616c 2073 6361 6c65 2e3c 2f64 ptimal scale..
    for │ │ │ -000aee50: 6365 5f72 6f74 6174 696f 6e3c 2f63 6f64 ce_rotation - If true, th │ │ │ -000aee70: 6520 7265 7475 726e 6564 2072 6f74 6174 e returned rotat │ │ │ -000aee80: 696f 6e20 7769 6c6c 206e 6576 6572 2062 ion will never b │ │ │ -000aee90: 6520 6120 7265 666c 6563 7469 6f6e 2e0a e a reflection.. │ │ │ -000aeea0: 5468 6973 206d 6967 6874 2062 6520 756e This might be un │ │ │ -000aeeb0: 7761 6e74 6564 2c20 652e 672e 2077 6865 wanted, e.g. whe │ │ │ -000aeec0: 6e20 6f70 7469 6d69 7a69 6e67 2061 2074 n optimizing a t │ │ │ -000aeed0: 7261 6e73 666f 726d 2062 6574 7765 656e ransform between │ │ │ -000aeee0: 2061 2072 6967 6874 2d20 616e 6420 610a a right- and a. │ │ │ -000aeef0: 6c65 6674 2d68 616e 6465 6420 636f 6f72 left-handed coor │ │ │ -000aef00: 6469 6e61 7465 2073 7973 7465 6d2e 3c2f dinate system..
    Returns: │ │ │ -000aef20: 3c2f 6474 3e0a 3c64 643e 3344 2061 6666
    .
    3D aff │ │ │ -000aef30: 696e 6520 7472 616e 7366 6f72 6d61 7469 ine transformati │ │ │ -000aef40: 6f6e 206d 6174 7269 7820 5c28 3320 5c74 on matrix \(3 \t │ │ │ -000aef50: 696d 6573 2034 5c29 206f 6620 7468 6520 imes 4\) of the │ │ │ -000aef60: 666f 726d 0a5c 2854 203d 0a5c 6265 6769 form.\(T =.\begi │ │ │ -000aef70: 6e7b 626d 6174 7269 787d 0a52 2026 616d n{bmatrix}.R &am │ │ │ -000aef80: 703b 2074 5c5c 0a5c 656e 647b 626d 6174 p; t\\.\end{bmat │ │ │ -000aef90: 7269 787d 0a5c 293c 2f64 643e 0a3c 2f64 rix}.\)
    ..
    ..
  • .
  • . │ │ │ -000aefc0: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    │ │ │ -000af020: 0a3c 6833 3e65 7374 696d 6174 6541 6666 .

    estimateAff │ │ │ -000af030: 696e 6533 443c 2f68 333e 0a3c 6469 7620 ine3D

    .
    .
    public static Mat& │ │ │ -000af110: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -000af130: 6573 7469 6d61 7465 4166 6669 6e65 3344 estimateAffine3D │ │ │ -000af140: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat s │ │ │ -000af1b0: 7263 2c0a 203c 6120 6872 6566 3d22 2e2e rc,. Mat ds │ │ │ -000af200: 742c 0a20 646f 7562 6c65 5b5d 266e 6273 t,. double[]&nbs │ │ │ -000af210: 703b 7363 616c 6529 3c2f 7370 616e 3e3c p;scale)< │ │ │ -000af220: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Compute │ │ │ -000af240: 7320 616e 206f 7074 696d 616c 2061 6666 s an optimal aff │ │ │ -000af250: 696e 6520 7472 616e 7366 6f72 6d61 7469 ine transformati │ │ │ -000af260: 6f6e 2062 6574 7765 656e 2074 776f 2033 on between two 3 │ │ │ -000af270: 4420 706f 696e 7420 7365 7473 2e0a 0a49 D point sets...I │ │ │ -000af280: 7420 636f 6d70 7574 6573 205c 2852 2c73 t computes \(R,s │ │ │ -000af290: 2c74 5c29 206d 696e 696d 697a 696e 6720 ,t\) minimizing │ │ │ -000af2a0: 5c28 5c73 756d 7b69 7d20 6473 745f 6920 \(\sum{i} dst_i │ │ │ -000af2b0: 2d20 6320 5c63 646f 7420 5220 5c63 646f - c \cdot R \cdo │ │ │ -000af2c0: 7420 7372 635f 6920 5c29 0a77 6865 7265 t src_i \).where │ │ │ -000af2d0: 205c 2852 5c29 2069 7320 6120 3378 3320 \(R\) is a 3x3 │ │ │ -000af2e0: 726f 7461 7469 6f6e 206d 6174 7269 782c rotation matrix, │ │ │ -000af2f0: 205c 2874 5c29 2069 7320 6120 3378 3120 \(t\) is a 3x1 │ │ │ -000af300: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ -000af310: 6f72 2061 6e64 205c 2873 5c29 2069 7320 or and \(s\) is │ │ │ -000af320: 610a 7363 616c 6172 2073 697a 6520 7661 a.scalar size va │ │ │ -000af330: 6c75 652e 2054 6869 7320 6973 2061 6e20 lue. This is an │ │ │ -000af340: 696d 706c 656d 656e 7461 7469 6f6e 206f implementation o │ │ │ -000af350: 6620 7468 6520 616c 676f 7269 7468 6d20 f the algorithm │ │ │ -000af360: 6279 2055 6d65 7961 6d61 205c 6369 7465 by Umeyama \cite │ │ │ -000af370: 2075 6d65 7961 6d61 3139 3931 6c65 6173 umeyama1991leas │ │ │ -000af380: 7420 2e0a 5468 6520 6573 7469 6d61 7465 t ..The estimate │ │ │ -000af390: 6420 6166 6669 6e65 2074 7261 6e73 666f d affine transfo │ │ │ -000af3a0: 726d 2068 6173 2061 2068 6f6d 6f67 656e rm has a homogen │ │ │ -000af3b0: 656f 7573 2073 6361 6c65 2077 6869 6368 eous scale which │ │ │ -000af3c0: 2069 7320 6120 7375 6263 6c61 7373 206f is a subclass o │ │ │ -000af3d0: 6620 6166 6669 6e65 0a74 7261 6e73 666f f affine.transfo │ │ │ -000af3e0: 726d 6174 696f 6e73 2077 6974 6820 3720 rmations with 7 │ │ │ -000af3f0: 6465 6772 6565 7320 6f66 2066 7265 6564 degrees of freed │ │ │ -000af400: 6f6d 2e20 5468 6520 7061 6972 6564 2070 om. The paired p │ │ │ -000af410: 6f69 6e74 2073 6574 7320 6e65 6564 2074 oint sets need t │ │ │ -000af420: 6f20 636f 6d70 7269 7365 2061 7420 6c65 o comprise at le │ │ │ -000af430: 6173 7420 330a 706f 696e 7473 2065 6163 ast 3.points eac │ │ │ -000af440: 682e 3c2f 6469 763e 0a3c 646c 2063 6c61 h.
    .
    .
    │ │ │ -000af460: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ -000af470: 0a3c 6464 3e3c 636f 6465 3e73 7263 3c2f .
    src - First in │ │ │ -000af490: 7075 7420 3344 2070 6f69 6e74 2073 6574 put 3D point set │ │ │ -000af4a0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    dst - Se │ │ │ -000af4c0: 636f 6e64 2069 6e70 7574 2033 4420 706f cond input 3D po │ │ │ -000af4d0: 696e 7420 7365 742e 3c2f 6464 3e0a 3c64 int set.
    .scale - If null i │ │ │ -000af500: 7320 7061 7373 6564 2c20 7468 6520 7363 s passed, the sc │ │ │ -000af510: 616c 6520 7061 7261 6d65 7465 7220 6320 ale parameter c │ │ │ -000af520: 7769 6c6c 2062 6520 6173 7375 6d65 6420 will be assumed │ │ │ -000af530: 746f 2062 6520 312e 302e 0a45 6c73 6520 to be 1.0..Else │ │ │ -000af540: 7468 6520 706f 696e 7465 642d 746f 2076 the pointed-to v │ │ │ -000af550: 6172 6961 626c 6520 7769 6c6c 2062 6520 ariable will be │ │ │ -000af560: 7365 7420 746f 2074 6865 206f 7074 696d set to the optim │ │ │ -000af570: 616c 2073 6361 6c65 2e0a 5468 6973 206d al scale..This m │ │ │ -000af580: 6967 6874 2062 6520 756e 7761 6e74 6564 ight be unwanted │ │ │ -000af590: 2c20 652e 672e 2077 6865 6e20 6f70 7469 , e.g. when opti │ │ │ -000af5a0: 6d69 7a69 6e67 2061 2074 7261 6e73 666f mizing a transfo │ │ │ -000af5b0: 726d 2062 6574 7765 656e 2061 2072 6967 rm between a rig │ │ │ -000af5c0: 6874 2d20 616e 6420 610a 6c65 6674 2d68 ht- and a.left-h │ │ │ -000af5d0: 616e 6465 6420 636f 6f72 6469 6e61 7465 anded coordinate │ │ │ -000af5e0: 2073 7973 7465 6d2e 3c2f 6464 3e0a 3c64 system..Returns:. │ │ │ -000af600: 3c64 643e 3344 2061 6666 696e 6520 7472
    3D affine tr │ │ │ -000af610: 616e 7366 6f72 6d61 7469 6f6e 206d 6174 ansformation mat │ │ │ -000af620: 7269 7820 5c28 3320 5c74 696d 6573 2034 rix \(3 \times 4 │ │ │ -000af630: 5c29 206f 6620 7468 6520 666f 726d 0a5c \) of the form.\ │ │ │ -000af640: 2854 203d 0a5c 6265 6769 6e7b 626d 6174 (T =.\begin{bmat │ │ │ -000af650: 7269 787d 0a52 2026 616d 703b 2074 5c5c rix}.R & t\\ │ │ │ -000af660: 0a5c 656e 647b 626d 6174 7269 787d 0a5c .\end{bmatrix}.\ │ │ │ -000af670: 293c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 )
    .
    ..
    .< │ │ │ -000af690: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    estimateAf │ │ │ -000af700: 6669 6e65 3344 3c2f 6833 3e0a 3c64 6976 fine3D

    .
    .
    public static< │ │ │ -000af770: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> Mat │ │ │ -000af7e0: 266e 6273 703b 3c73 7061 6e20 636c 6173  estimateAffine3 │ │ │ -000af810: 443c 2f73 7061 6e3e 3c77 6272 3e3c 7370 D(Mat  │ │ │ -000af880: 7372 632c 0a20 3c61 2068 7265 663d 222e src,. Mat d │ │ │ -000af8d0: 7374 293c 2f73 7061 6e3e 3c2f 6469 763e st)
    │ │ │ -000af8e0: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Computes an │ │ │ -000af900: 6f70 7469 6d61 6c20 6166 6669 6e65 2074 optimal affine t │ │ │ -000af910: 7261 6e73 666f 726d 6174 696f 6e20 6265 ransformation be │ │ │ -000af920: 7477 6565 6e20 7477 6f20 3344 2070 6f69 tween two 3D poi │ │ │ -000af930: 6e74 2073 6574 732e 0a0a 4974 2063 6f6d nt sets...It com │ │ │ -000af940: 7075 7465 7320 5c28 522c 732c 745c 2920 putes \(R,s,t\) │ │ │ -000af950: 6d69 6e69 6d69 7a69 6e67 205c 285c 7375 minimizing \(\su │ │ │ -000af960: 6d7b 697d 2064 7374 5f69 202d 2063 205c m{i} dst_i - c \ │ │ │ -000af970: 6364 6f74 2052 205c 6364 6f74 2073 7263 cdot R \cdot src │ │ │ -000af980: 5f69 205c 290a 7768 6572 6520 5c28 525c _i \).where \(R\ │ │ │ -000af990: 2920 6973 2061 2033 7833 2072 6f74 6174 ) is a 3x3 rotat │ │ │ -000af9a0: 696f 6e20 6d61 7472 6978 2c20 5c28 745c ion matrix, \(t\ │ │ │ -000af9b0: 2920 6973 2061 2033 7831 2074 7261 6e73 ) is a 3x1 trans │ │ │ -000af9c0: 6c61 7469 6f6e 2076 6563 746f 7220 616e lation vector an │ │ │ -000af9d0: 6420 5c28 735c 2920 6973 2061 0a73 6361 d \(s\) is a.sca │ │ │ -000af9e0: 6c61 7220 7369 7a65 2076 616c 7565 2e20 lar size value. │ │ │ -000af9f0: 5468 6973 2069 7320 616e 2069 6d70 6c65 This is an imple │ │ │ -000afa00: 6d65 6e74 6174 696f 6e20 6f66 2074 6865 mentation of the │ │ │ -000afa10: 2061 6c67 6f72 6974 686d 2062 7920 556d algorithm by Um │ │ │ -000afa20: 6579 616d 6120 5c63 6974 6520 756d 6579 eyama \cite umey │ │ │ -000afa30: 616d 6131 3939 316c 6561 7374 202e 0a54 ama1991least ..T │ │ │ -000afa40: 6865 2065 7374 696d 6174 6564 2061 6666 he estimated aff │ │ │ -000afa50: 696e 6520 7472 616e 7366 6f72 6d20 6861 ine transform ha │ │ │ -000afa60: 7320 6120 686f 6d6f 6765 6e65 6f75 7320 s a homogeneous │ │ │ -000afa70: 7363 616c 6520 7768 6963 6820 6973 2061 scale which is a │ │ │ -000afa80: 2073 7562 636c 6173 7320 6f66 2061 6666 subclass of aff │ │ │ -000afa90: 696e 650a 7472 616e 7366 6f72 6d61 7469 ine.transformati │ │ │ -000afaa0: 6f6e 7320 7769 7468 2037 2064 6567 7265 ons with 7 degre │ │ │ -000afab0: 6573 206f 6620 6672 6565 646f 6d2e 2054 es of freedom. T │ │ │ -000afac0: 6865 2070 6169 7265 6420 706f 696e 7420 he paired point │ │ │ -000afad0: 7365 7473 206e 6565 6420 746f 2063 6f6d sets need to com │ │ │ -000afae0: 7072 6973 6520 6174 206c 6561 7374 2033 prise at least 3 │ │ │ -000afaf0: 0a70 6f69 6e74 7320 6561 6368 2e3c 2f64 .points each..
    .
    Param │ │ │ -000afb20: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ -000afb30: 3c63 6f64 653e 7372 633c 2f63 6f64 653e src │ │ │ -000afb40: 202d 2046 6972 7374 2069 6e70 7574 2033 - First input 3 │ │ │ -000afb50: 4420 706f 696e 7420 7365 742e 3c2f 6464 D point set.
    .
    dst< │ │ │ -000afb70: 2f63 6f64 653e 202d 2053 6563 6f6e 6420 /code> - Second │ │ │ -000afb80: 696e 7075 7420 3344 2070 6f69 6e74 2073 input 3D point s │ │ │ -000afb90: 6574 2e0a 456c 7365 2074 6865 2070 6f69 et..Else the poi │ │ │ -000afba0: 6e74 6564 2d74 6f20 7661 7269 6162 6c65 nted-to variable │ │ │ -000afbb0: 2077 696c 6c20 6265 2073 6574 2074 6f20 will be set to │ │ │ -000afbc0: 7468 6520 6f70 7469 6d61 6c20 7363 616c the optimal scal │ │ │ -000afbd0: 652e 0a54 6869 7320 6d69 6768 7420 6265 e..This might be │ │ │ -000afbe0: 2075 6e77 616e 7465 642c 2065 2e67 2e20 unwanted, e.g. │ │ │ -000afbf0: 7768 656e 206f 7074 696d 697a 696e 6720 when optimizing │ │ │ -000afc00: 6120 7472 616e 7366 6f72 6d20 6265 7477 a transform betw │ │ │ -000afc10: 6565 6e20 6120 7269 6768 742d 2061 6e64 een a right- and │ │ │ -000afc20: 2061 0a6c 6566 742d 6861 6e64 6564 2063 a.left-handed c │ │ │ -000afc30: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ -000afc40: 2e3c 2f64 643e 0a3c 6474 3e52 6574 7572 .
    .
    Retur │ │ │ -000afc50: 6e73 3a3c 2f64 743e 0a3c 6464 3e33 4420 ns:
    .
    3D │ │ │ -000afc60: 6166 6669 6e65 2074 7261 6e73 666f 726d affine transform │ │ │ -000afc70: 6174 696f 6e20 6d61 7472 6978 205c 2833 ation matrix \(3 │ │ │ -000afc80: 205c 7469 6d65 7320 345c 2920 6f66 2074 \times 4\) of t │ │ │ -000afc90: 6865 2066 6f72 6d0a 5c28 5420 3d0a 5c62 he form.\(T =.\b │ │ │ -000afca0: 6567 696e 7b62 6d61 7472 6978 7d0a 5220 egin{bmatrix}.R │ │ │ -000afcb0: 2661 6d70 3b20 745c 5c0a 5c65 6e64 7b62 & t\\.\end{b │ │ │ -000afcc0: 6d61 7472 6978 7d0a 5c29 3c2f 6464 3e0a matrix}.\)
    . │ │ │ -000afcd0: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    .
    .
  • ..
    .

    estima │ │ │ -000afd90: 7465 5472 616e 736c 6174 696f 6e33 443c teTranslation3D< │ │ │ -000afda0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -000afe00: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -000afe10: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;b │ │ │ -000afe30: 6f6f 6c65 616e 3c2f 7370 616e 3e26 6e62 oolean&nb │ │ │ -000afe40: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;es │ │ │ -000afe60: 7469 6d61 7465 5472 616e 736c 6174 696f timateTranslatio │ │ │ -000afe70: 6e33 443c 2f73 7061 6e3e 3c77 6272 3e3c n3D< │ │ │ -000afe80: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ -000afe90: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ -000afee0: 703b 7372 632c 0a20 3c61 2068 7265 663d p;src,. Mat  │ │ │ -000aff30: 3b64 7374 2c0a 203c 6120 6872 6566 3d22 ;dst,. Mat  │ │ │ -000aff80: 6f75 742c 0a20 3c61 2068 7265 663d 222e out,. Mat i │ │ │ -000affd0: 6e6c 6965 7273 2c0a 2064 6f75 626c 6526 nliers,. double& │ │ │ -000affe0: 6e62 7370 3b72 616e 7361 6354 6872 6573 nbsp;ransacThres │ │ │ -000afff0: 686f 6c64 2c0a 2064 6f75 626c 6526 6e62 hold,. double&nb │ │ │ -000b0000: 7370 3b63 6f6e 6669 6465 6e63 6529 3c2f sp;confidence)
    .
    C │ │ │ -000b0030: 6f6d 7075 7465 7320 616e 206f 7074 696d omputes an optim │ │ │ -000b0040: 616c 2074 7261 6e73 6c61 7469 6f6e 2062 al translation b │ │ │ -000b0050: 6574 7765 656e 2074 776f 2033 4420 706f etween two 3D po │ │ │ -000b0060: 696e 7420 7365 7473 2e0a 0a49 7420 636f int sets...It co │ │ │ -000b0070: 6d70 7574 6573 0a5c 280a 5c62 6567 696e mputes.\(.\begin │ │ │ -000b0080: 7b62 6d61 7472 6978 7d0a 785c 5c0a 795c {bmatrix}.x\\.y\ │ │ │ -000b0090: 5c0a 7a5c 5c0a 5c65 6e64 7b62 6d61 7472 \.z\\.\end{bmatr │ │ │ -000b00a0: 6978 7d0a 3d0a 5c62 6567 696e 7b62 6d61 ix}.=.\begin{bma │ │ │ -000b00b0: 7472 6978 7d0a 585c 5c0a 595c 5c0a 5a5c trix}.X\\.Y\\.Z\ │ │ │ -000b00c0: 5c0a 5c65 6e64 7b62 6d61 7472 6978 7d0a \.\end{bmatrix}. │ │ │ -000b00d0: 2b0a 5c62 6567 696e 7b62 6d61 7472 6978 +.\begin{bmatrix │ │ │ -000b00e0: 7d0a 625f 315c 5c0a 625f 325c 5c0a 625f }.b_1\\.b_2\\.b_ │ │ │ -000b00f0: 335c 5c0a 5c65 6e64 7b62 6d61 7472 6978 3\\.\end{bmatrix │ │ │ -000b0100: 7d0a 5c29 3c2f 6469 763e 0a3c 646c 2063 }.\)
    .
    .Parameters:.
    src │ │ │ -000b0140: 3c2f 636f 6465 3e20 2d20 4669 7273 7420 - First │ │ │ -000b0150: 696e 7075 7420 3344 2070 6f69 6e74 2073 input 3D point s │ │ │ -000b0160: 6574 2063 6f6e 7461 696e 696e 6720 5c28 et containing \( │ │ │ -000b0170: 2858 2c59 2c5a 295c 292e 3c2f 6464 3e0a (X,Y,Z)\).
    . │ │ │ -000b0180: 3c64 643e 3c63 6f64 653e 6473 743c 2f63
    dst - Second in │ │ │ -000b01a0: 7075 7420 3344 2070 6f69 6e74 2073 6574 put 3D point set │ │ │ -000b01b0: 2063 6f6e 7461 696e 696e 6720 5c28 2878 containing \((x │ │ │ -000b01c0: 2c79 2c7a 295c 292e 3c2f 6464 3e0a 3c64 ,y,z)\).
    .out - Output 3D t │ │ │ -000b01f0: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ -000b0200: 7220 5c28 3320 5c74 696d 6573 2031 5c29 r \(3 \times 1\) │ │ │ -000b0210: 206f 6620 7468 6520 666f 726d 0a5c 280a of the form.\(. │ │ │ -000b0220: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ -000b0230: 625f 3120 5c5c 0a62 5f32 205c 5c0a 625f b_1 \\.b_2 \\.b_ │ │ │ -000b0240: 3320 5c5c 0a5c 656e 647b 626d 6174 7269 3 \\.\end{bmatri │ │ │ -000b0250: 787d 0a5c 293c 2f64 643e 0a3c 6464 3e3c x}.\).
    < │ │ │ -000b0260: 636f 6465 3e69 6e6c 6965 7273 3c2f 636f code>inliers - Output vec │ │ │ -000b0280: 746f 7220 696e 6469 6361 7469 6e67 2077 tor indicating w │ │ │ -000b0290: 6869 6368 2070 6f69 6e74 7320 6172 6520 hich points are │ │ │ -000b02a0: 696e 6c69 6572 7320 2831 2d69 6e6c 6965 inliers (1-inlie │ │ │ -000b02b0: 722c 2030 2d6f 7574 6c69 6572 292e 3c2f r, 0-outlier)..
    ra │ │ │ -000b02d0: 6e73 6163 5468 7265 7368 6f6c 643c 2f63 nsacThreshold - Maximum r │ │ │ -000b02f0: 6570 726f 6a65 6374 696f 6e20 6572 726f eprojection erro │ │ │ -000b0300: 7220 696e 2074 6865 2052 414e 5341 4320 r in the RANSAC │ │ │ -000b0310: 616c 676f 7269 7468 6d20 746f 2063 6f6e algorithm to con │ │ │ -000b0320: 7369 6465 7220 6120 706f 696e 7420 6173 sider a point as │ │ │ -000b0330: 0a61 6e20 696e 6c69 6572 2e3c 2f64 643e .an inlier.
    │ │ │ -000b0340: 0a3c 6464 3e3c 636f 6465 3e63 6f6e 6669 .
    confi │ │ │ -000b0350: 6465 6e63 653c 2f63 6f64 653e 202d 2043 dence - C │ │ │ -000b0360: 6f6e 6669 6465 6e63 6520 6c65 7665 6c2c onfidence level, │ │ │ -000b0370: 2062 6574 7765 656e 2030 2061 6e64 2031 between 0 and 1 │ │ │ -000b0380: 2c20 666f 7220 7468 6520 6573 7469 6d61 , for the estima │ │ │ -000b0390: 7465 6420 7472 616e 7366 6f72 6d61 7469 ted transformati │ │ │ -000b03a0: 6f6e 2e20 416e 7974 6869 6e67 0a62 6574 on. Anything.bet │ │ │ -000b03b0: 7765 656e 2030 2e39 3520 616e 6420 302e ween 0.95 and 0. │ │ │ -000b03c0: 3939 2069 7320 7573 7561 6c6c 7920 676f 99 is usually go │ │ │ -000b03d0: 6f64 2065 6e6f 7567 682e 2056 616c 7565 od enough. Value │ │ │ -000b03e0: 7320 746f 6f20 636c 6f73 6520 746f 2031 s too close to 1 │ │ │ -000b03f0: 2063 616e 2073 6c6f 7720 646f 776e 2074 can slow down t │ │ │ -000b0400: 6865 2065 7374 696d 6174 696f 6e0a 7369 he estimation.si │ │ │ -000b0410: 676e 6966 6963 616e 746c 792e 2056 616c gnificantly. Val │ │ │ -000b0420: 7565 7320 6c6f 7765 7220 7468 616e 2030 ues lower than 0 │ │ │ -000b0430: 2e38 2d30 2e39 2063 616e 2072 6573 756c .8-0.9 can resul │ │ │ -000b0440: 7420 696e 2061 6e20 696e 636f 7272 6563 t in an incorrec │ │ │ -000b0450: 746c 7920 6573 7469 6d61 7465 6420 7472 tly estimated tr │ │ │ -000b0460: 616e 7366 6f72 6d61 7469 6f6e 2e3c 2f64 ansformation..
    Returns:< │ │ │ -000b0480: 2f64 743e 0a3c 6464 3e57 6865 7468 6572 /dt>.
    Whether │ │ │ -000b0490: 2061 2074 7261 6e73 6c61 7469 6f6e 2077 a translation w │ │ │ -000b04a0: 6173 2066 6f75 6e64 2e0a 0a54 6865 2066 as found...The f │ │ │ -000b04b0: 756e 6374 696f 6e20 6573 7469 6d61 7465 unction estimate │ │ │ -000b04c0: 7320 616e 206f 7074 696d 616c 2033 4420 s an optimal 3D │ │ │ -000b04d0: 7472 616e 736c 6174 696f 6e20 6265 7477 translation betw │ │ │ -000b04e0: 6565 6e20 7477 6f20 3344 2070 6f69 6e74 een two 3D point │ │ │ -000b04f0: 2073 6574 7320 7573 696e 6720 7468 650a sets using the. │ │ │ -000b0500: 5241 4e53 4143 2061 6c67 6f72 6974 686d RANSAC algorithm │ │ │ -000b0510: 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 .
    .
    ..

    .< │ │ │ -000b0530: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
    .< │ │ │ +000ada60: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
  • ..

    estima │ │ │ -000b05d0: 7465 5472 616e 736c 6174 696f 6e33 443c teTranslation3D< │ │ │ -000b05e0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -000b0640: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -000b0650: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;b │ │ │ -000b0670: 6f6f 6c65 616e 3c2f 7370 616e 3e26 6e62 oolean&nb │ │ │ -000b0680: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;es │ │ │ -000b06a0: 7469 6d61 7465 5472 616e 736c 6174 696f timateTranslatio │ │ │ -000b06b0: 6e33 443c 2f73 7061 6e3e 3c77 6272 3e3c n3D< │ │ │ -000b06c0: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ -000b06d0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ -000b0720: 703b 7372 632c 0a20 3c61 2068 7265 663d p;src,.  mask) │ │ │ +000aca70: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Recovers the re │ │ │ +000acaa0: 6c61 7469 7665 2063 616d 6572 6120 726f lative camera ro │ │ │ +000acab0: 7461 7469 6f6e 2061 6e64 2074 6865 2074 tation and the t │ │ │ +000acac0: 7261 6e73 6c61 7469 6f6e 2066 726f 6d20 ranslation from │ │ │ +000acad0: 636f 7272 6573 706f 6e64 696e 6720 706f corresponding po │ │ │ +000acae0: 696e 7473 2069 6e20 7477 6f20 696d 6167 ints in two imag │ │ │ +000acaf0: 6573 2066 726f 6d20 7477 6f20 6469 6666 es from two diff │ │ │ +000acb00: 6572 656e 7420 6361 6d65 7261 732c 2075 erent cameras, u │ │ │ +000acb10: 7369 6e67 2063 6869 7261 6c69 7479 2063 sing chirality c │ │ │ +000acb20: 6865 636b 2e20 5265 7475 726e 7320 7468 heck. Returns th │ │ │ +000acb30: 6520 6e75 6d62 6572 206f 660a 696e 6c69 e number of.inli │ │ │ +000acb40: 6572 7320 7468 6174 2070 6173 7320 7468 ers that pass th │ │ │ +000acb50: 6520 6368 6563 6b2e 3c2f 6469 763e 0a3c e check.
    .< │ │ │ +000acb60: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ +000acb70: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ +000acb80: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    points1 │ │ │ +000acba0: 2d20 4172 7261 7920 6f66 204e 2032 4420 - Array of N 2D │ │ │ +000acbb0: 706f 696e 7473 2066 726f 6d20 7468 6520 points from the │ │ │ +000acbc0: 6669 7273 7420 696d 6167 652e 2054 6865 first image. The │ │ │ +000acbd0: 2070 6f69 6e74 2063 6f6f 7264 696e 6174 point coordinat │ │ │ +000acbe0: 6573 2073 686f 756c 6420 6265 0a66 6c6f es should be.flo │ │ │ +000acbf0: 6174 696e 672d 706f 696e 7420 2873 696e ating-point (sin │ │ │ +000acc00: 676c 6520 6f72 2064 6f75 626c 6520 7072 gle or double pr │ │ │ +000acc10: 6563 6973 696f 6e29 2e3c 2f64 643e 0a3c ecision).
    .< │ │ │ +000acc20: 6464 3e3c 636f 6465 3e70 6f69 6e74 7332 dd>points2 │ │ │ +000acc30: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ +000acc40: 6f66 2074 6865 2073 6563 6f6e 6420 696d of the second im │ │ │ +000acc50: 6167 6520 706f 696e 7473 206f 6620 7468 age points of th │ │ │ +000acc60: 6520 7361 6d65 2073 697a 6520 616e 6420 e same size and │ │ │ +000acc70: 666f 726d 6174 2061 7320 706f 696e 7473 format as points │ │ │ +000acc80: 3120 2e3c 2f64 643e 0a3c 6464 3e3c 636f 1 ..
    cameraMatrix1 │ │ │ +000acca0: 3c2f 636f 6465 3e20 2d20 496e 7075 742f - Input/ │ │ │ +000accb0: 6f75 7470 7574 2063 616d 6572 6120 6d61 output camera ma │ │ │ +000accc0: 7472 6978 2066 6f72 2074 6865 2066 6972 trix for the fir │ │ │ +000accd0: 7374 2063 616d 6572 612c 2074 6865 2073 st camera, the s │ │ │ +000acce0: 616d 6520 6173 2069 6e0a 5245 463a 2063 ame as in.REF: c │ │ │ +000accf0: 616c 6962 7261 7465 4361 6d65 7261 2e20 alibrateCamera. │ │ │ +000acd00: 4675 7274 6865 726d 6f72 652c 2066 6f72 Furthermore, for │ │ │ +000acd10: 2074 6865 2073 7465 7265 6f20 6361 7365 the stereo case │ │ │ +000acd20: 2c20 6164 6469 7469 6f6e 616c 2066 6c61 , additional fla │ │ │ +000acd30: 6773 206d 6179 2062 6520 7573 6564 2c20 gs may be used, │ │ │ +000acd40: 7365 6520 6265 6c6f 772e 3c2f 6464 3e0a see below.
    . │ │ │ +000acd50: 3c64 643e 3c63 6f64 653e 6469 7374 436f
    distCo │ │ │ +000acd60: 6566 6673 313c 2f63 6f64 653e 202d 2049 effs1 - I │ │ │ +000acd70: 6e70 7574 2f6f 7574 7075 7420 7665 6374 nput/output vect │ │ │ +000acd80: 6f72 206f 6620 6469 7374 6f72 7469 6f6e or of distortion │ │ │ +000acd90: 2063 6f65 6666 6963 6965 6e74 732c 2074 coefficients, t │ │ │ +000acda0: 6865 2073 616d 6520 6173 2069 6e0a 5245 he same as in.RE │ │ │ +000acdb0: 463a 2063 616c 6962 7261 7465 4361 6d65 F: calibrateCame │ │ │ +000acdc0: 7261 2e3c 2f64 643e 0a3c 6464 3e3c 636f ra.
    .
    cameraMatrix2 │ │ │ +000acde0: 3c2f 636f 6465 3e20 2d20 496e 7075 742f - Input/ │ │ │ +000acdf0: 6f75 7470 7574 2063 616d 6572 6120 6d61 output camera ma │ │ │ +000ace00: 7472 6978 2066 6f72 2074 6865 2066 6972 trix for the fir │ │ │ +000ace10: 7374 2063 616d 6572 612c 2074 6865 2073 st camera, the s │ │ │ +000ace20: 616d 6520 6173 2069 6e0a 5245 463a 2063 ame as in.REF: c │ │ │ +000ace30: 616c 6962 7261 7465 4361 6d65 7261 2e20 alibrateCamera. │ │ │ +000ace40: 4675 7274 6865 726d 6f72 652c 2066 6f72 Furthermore, for │ │ │ +000ace50: 2074 6865 2073 7465 7265 6f20 6361 7365 the stereo case │ │ │ +000ace60: 2c20 6164 6469 7469 6f6e 616c 2066 6c61 , additional fla │ │ │ +000ace70: 6773 206d 6179 2062 6520 7573 6564 2c20 gs may be used, │ │ │ +000ace80: 7365 6520 6265 6c6f 772e 3c2f 6464 3e0a see below.
    . │ │ │ +000ace90: 3c64 643e 3c63 6f64 653e 6469 7374 436f
    distCo │ │ │ +000acea0: 6566 6673 323c 2f63 6f64 653e 202d 2049 effs2 - I │ │ │ +000aceb0: 6e70 7574 2f6f 7574 7075 7420 7665 6374 nput/output vect │ │ │ +000acec0: 6f72 206f 6620 6469 7374 6f72 7469 6f6e or of distortion │ │ │ +000aced0: 2063 6f65 6666 6963 6965 6e74 732c 2074 coefficients, t │ │ │ +000acee0: 6865 2073 616d 6520 6173 2069 6e0a 5245 he same as in.RE │ │ │ +000acef0: 463a 2063 616c 6962 7261 7465 4361 6d65 F: calibrateCame │ │ │ +000acf00: 7261 2e3c 2f64 643e 0a3c 6464 3e3c 636f ra.
    .
    E - Th │ │ │ +000acf20: 6520 6f75 7470 7574 2065 7373 656e 7469 e output essenti │ │ │ +000acf30: 616c 206d 6174 7269 782e 3c2f 6464 3e0a al matrix.
    . │ │ │ +000acf40: 3c64 643e 3c63 6f64 653e 523c 2f63 6f64
    R - Output rota │ │ │ +000acf60: 7469 6f6e 206d 6174 7269 782e 2054 6f67 tion matrix. Tog │ │ │ +000acf70: 6574 6865 7220 7769 7468 2074 6865 2074 ether with the t │ │ │ +000acf80: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ +000acf90: 722c 2074 6869 7320 6d61 7472 6978 206d r, this matrix m │ │ │ +000acfa0: 616b 6573 2075 7020 6120 7475 706c 650a akes up a tuple. │ │ │ +000acfb0: 7468 6174 2070 6572 666f 726d 7320 6120 that performs a │ │ │ +000acfc0: 6368 616e 6765 206f 6620 6261 7369 7320 change of basis │ │ │ +000acfd0: 6672 6f6d 2074 6865 2066 6972 7374 2063 from the first c │ │ │ +000acfe0: 616d 6572 6127 7320 636f 6f72 6469 6e61 amera's coordina │ │ │ +000acff0: 7465 2073 7973 7465 6d20 746f 2074 6865 te system to the │ │ │ +000ad000: 2073 6563 6f6e 6420 6361 6d65 7261 2773 second camera's │ │ │ +000ad010: 0a63 6f6f 7264 696e 6174 6520 7379 7374 .coordinate syst │ │ │ +000ad020: 656d 2e20 4e6f 7465 2074 6861 742c 2069 em. Note that, i │ │ │ +000ad030: 6e20 6765 6e65 7261 6c2c 2074 2063 616e n general, t can │ │ │ +000ad040: 206e 6f74 2062 6520 7573 6564 2066 6f72 not be used for │ │ │ +000ad050: 2074 6869 7320 7475 706c 652c 2073 6565 this tuple, see │ │ │ +000ad060: 2074 6865 2070 6172 616d 6574 6572 0a64 the parameter.d │ │ │ +000ad070: 6573 6372 6962 6564 2062 656c 6f77 2e3c escribed below.< │ │ │ +000ad080: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ +000ad090: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +000ad0a0: 2074 7261 6e73 6c61 7469 6f6e 2076 6563 translation vec │ │ │ +000ad0b0: 746f 722e 2054 6869 7320 7665 6374 6f72 tor. This vector │ │ │ +000ad0c0: 2069 7320 6f62 7461 696e 6564 2062 7920 is obtained by │ │ │ +000ad0d0: 5245 463a 2064 6563 6f6d 706f 7365 4573 REF: decomposeEs │ │ │ +000ad0e0: 7365 6e74 6961 6c4d 6174 2061 6e64 0a74 sentialMat and.t │ │ │ +000ad0f0: 6865 7265 666f 7265 2069 7320 6f6e 6c79 herefore is only │ │ │ +000ad100: 206b 6e6f 776e 2075 7020 746f 2073 6361 known up to sca │ │ │ +000ad110: 6c65 2c20 692e 652e 2074 2069 7320 7468 le, i.e. t is th │ │ │ +000ad120: 6520 6469 7265 6374 696f 6e20 6f66 2074 e direction of t │ │ │ +000ad130: 6865 2074 7261 6e73 6c61 7469 6f6e 2076 he translation v │ │ │ +000ad140: 6563 746f 7220 616e 6420 6861 7320 756e ector and has un │ │ │ +000ad150: 6974 0a6c 656e 6774 682e 3c2f 6464 3e0a it.length.
    . │ │ │ +000ad160: 3c64 643e 3c63 6f64 653e 6d65 7468 6f64
    method │ │ │ +000ad170: 3c2f 636f 6465 3e20 2d20 4d65 7468 6f64 - Method │ │ │ +000ad180: 2066 6f72 2063 6f6d 7075 7469 6e67 2061 for computing a │ │ │ +000ad190: 6e20 6573 7365 6e74 6961 6c20 6d61 7472 n essential matr │ │ │ +000ad1a0: 6978 2e0a 3c75 6c3e 0a20 203c 6c69 3e0a ix..
      .
    • . │ │ │ +000ad1b0: 2020 2052 4546 3a20 5241 4e53 4143 2066 REF: RANSAC f │ │ │ +000ad1c0: 6f72 2074 6865 2052 414e 5341 4320 616c or the RANSAC al │ │ │ +000ad1d0: 676f 7269 7468 6d2e 0a20 203c 2f6c 693e gorithm..
    • │ │ │ +000ad1e0: 0a20 203c 6c69 3e0a 2020 2052 4546 3a20 .
    • . REF: │ │ │ +000ad1f0: 4c4d 4544 5320 666f 7220 7468 6520 4c4d LMEDS for the LM │ │ │ +000ad200: 6564 5320 616c 676f 7269 7468 6d2e 0a20 edS algorithm.. │ │ │ +000ad210: 203c 2f6c 693e 0a3c 2f75 6c3e 3c2f 6464
    • .
    .
    prob │ │ │ +000ad230: 3c2f 636f 6465 3e20 2d20 5061 7261 6d65 - Parame │ │ │ +000ad240: 7465 7220 7573 6564 2066 6f72 2074 6865 ter used for the │ │ │ +000ad250: 2052 414e 5341 4320 6f72 204c 4d65 6453 RANSAC or LMedS │ │ │ +000ad260: 206d 6574 686f 6473 206f 6e6c 792e 2049 methods only. I │ │ │ +000ad270: 7420 7370 6563 6966 6965 7320 6120 6465 t specifies a de │ │ │ +000ad280: 7369 7261 626c 6520 6c65 7665 6c20 6f66 sirable level of │ │ │ +000ad290: 0a63 6f6e 6669 6465 6e63 6520 2870 726f .confidence (pro │ │ │ +000ad2a0: 6261 6269 6c69 7479 2920 7468 6174 2074 bability) that t │ │ │ +000ad2b0: 6865 2065 7374 696d 6174 6564 206d 6174 he estimated mat │ │ │ +000ad2c0: 7269 7820 6973 2063 6f72 7265 6374 2e3c rix is correct.< │ │ │ +000ad2d0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ +000ad2e0: 6872 6573 686f 6c64 3c2f 636f 6465 3e20 hreshold │ │ │ +000ad2f0: 2d20 5061 7261 6d65 7465 7220 7573 6564 - Parameter used │ │ │ +000ad300: 2066 6f72 2052 414e 5341 432e 2049 7420 for RANSAC. It │ │ │ +000ad310: 6973 2074 6865 206d 6178 696d 756d 2064 is the maximum d │ │ │ +000ad320: 6973 7461 6e63 6520 6672 6f6d 2061 2070 istance from a p │ │ │ +000ad330: 6f69 6e74 2074 6f20 616e 2065 7069 706f oint to an epipo │ │ │ +000ad340: 6c61 720a 6c69 6e65 2069 6e20 7069 7865 lar.line in pixe │ │ │ +000ad350: 6c73 2c20 6265 796f 6e64 2077 6869 6368 ls, beyond which │ │ │ +000ad360: 2074 6865 2070 6f69 6e74 2069 7320 636f the point is co │ │ │ +000ad370: 6e73 6964 6572 6564 2061 6e20 6f75 746c nsidered an outl │ │ │ +000ad380: 6965 7220 616e 6420 6973 206e 6f74 2075 ier and is not u │ │ │ +000ad390: 7365 6420 666f 7220 636f 6d70 7574 696e sed for computin │ │ │ +000ad3a0: 6720 7468 650a 6669 6e61 6c20 6675 6e64 g the.final fund │ │ │ +000ad3b0: 616d 656e 7461 6c20 6d61 7472 6978 2e20 amental matrix. │ │ │ +000ad3c0: 4974 2063 616e 2062 6520 7365 7420 746f It can be set to │ │ │ +000ad3d0: 2073 6f6d 6574 6869 6e67 206c 696b 6520 something like │ │ │ +000ad3e0: 312d 332c 2064 6570 656e 6469 6e67 206f 1-3, depending o │ │ │ +000ad3f0: 6e20 7468 6520 6163 6375 7261 6379 206f n the accuracy o │ │ │ +000ad400: 6620 7468 650a 706f 696e 7420 6c6f 6361 f the.point loca │ │ │ +000ad410: 6c69 7a61 7469 6f6e 2c20 696d 6167 6520 lization, image │ │ │ +000ad420: 7265 736f 6c75 7469 6f6e 2c20 616e 6420 resolution, and │ │ │ +000ad430: 7468 6520 696d 6167 6520 6e6f 6973 652e the image noise. │ │ │ +000ad440: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000ad450: 6d61 736b 3c2f 636f 6465 3e20 2d20 496e mask - In │ │ │ +000ad460: 7075 742f 6f75 7470 7574 206d 6173 6b20 put/output mask │ │ │ +000ad470: 666f 7220 696e 6c69 6572 7320 696e 2070 for inliers in p │ │ │ +000ad480: 6f69 6e74 7331 2061 6e64 2070 6f69 6e74 oints1 and point │ │ │ +000ad490: 7332 2e20 4966 2069 7420 6973 206e 6f74 s2. If it is not │ │ │ +000ad4a0: 2065 6d70 7479 2c20 7468 656e 2069 7420 empty, then it │ │ │ +000ad4b0: 6d61 726b 730a 696e 6c69 6572 7320 696e marks.inliers in │ │ │ +000ad4c0: 2070 6f69 6e74 7331 2061 6e64 2070 6f69 points1 and poi │ │ │ +000ad4d0: 6e74 7332 2066 6f72 2074 6865 2067 6976 nts2 for the giv │ │ │ +000ad4e0: 656e 2065 7373 656e 7469 616c 206d 6174 en essential mat │ │ │ +000ad4f0: 7269 7820 452e 204f 6e6c 7920 7468 6573 rix E. Only thes │ │ │ +000ad500: 6520 696e 6c69 6572 7320 7769 6c6c 2062 e inliers will b │ │ │ +000ad510: 6520 7573 6564 2074 6f0a 7265 636f 7665 e used to.recove │ │ │ +000ad520: 7220 706f 7365 2e20 496e 2074 6865 206f r pose. In the o │ │ │ +000ad530: 7574 7075 7420 6d61 736b 206f 6e6c 7920 utput mask only │ │ │ +000ad540: 696e 6c69 6572 7320 7768 6963 6820 7061 inliers which pa │ │ │ +000ad550: 7373 2074 6865 2063 6869 7261 6c69 7479 ss the chirality │ │ │ +000ad560: 2063 6865 636b 2e0a 0a54 6869 7320 6675 check...This fu │ │ │ +000ad570: 6e63 7469 6f6e 2064 6563 6f6d 706f 7365 nction decompose │ │ │ +000ad580: 7320 616e 2065 7373 656e 7469 616c 206d s an essential m │ │ │ +000ad590: 6174 7269 7820 7573 696e 6720 5245 463a atrix using REF: │ │ │ +000ad5a0: 2064 6563 6f6d 706f 7365 4573 7365 6e74 decomposeEssent │ │ │ +000ad5b0: 6961 6c4d 6174 2061 6e64 2074 6865 6e20 ialMat and then │ │ │ +000ad5c0: 7665 7269 6669 6573 0a70 6f73 7369 626c verifies.possibl │ │ │ +000ad5d0: 6520 706f 7365 2068 7970 6f74 6865 7365 e pose hypothese │ │ │ +000ad5e0: 7320 6279 2064 6f69 6e67 2063 6869 7261 s by doing chira │ │ │ +000ad5f0: 6c69 7479 2063 6865 636b 2e20 5468 6520 lity check. The │ │ │ +000ad600: 6368 6972 616c 6974 7920 6368 6563 6b20 chirality check │ │ │ +000ad610: 6d65 616e 7320 7468 6174 2074 6865 0a74 means that the.t │ │ │ +000ad620: 7269 616e 6775 6c61 7465 6420 3344 2070 riangulated 3D p │ │ │ +000ad630: 6f69 6e74 7320 7368 6f75 6c64 2068 6176 oints should hav │ │ │ +000ad640: 6520 706f 7369 7469 7665 2064 6570 7468 e positive depth │ │ │ +000ad650: 2e20 536f 6d65 2064 6574 6169 6c73 2063 . Some details c │ │ │ +000ad660: 616e 2062 6520 666f 756e 6420 696e 2043 an be found in C │ │ │ +000ad670: 4954 453a 204e 6973 7465 7230 332e 0a0a ITE: Nister03... │ │ │ +000ad680: 5468 6973 2066 756e 6374 696f 6e20 6361 This function ca │ │ │ +000ad690: 6e20 6265 2075 7365 6420 746f 2070 726f n be used to pro │ │ │ +000ad6a0: 6365 7373 2074 6865 206f 7574 7075 7420 cess the output │ │ │ +000ad6b0: 4520 616e 6420 6d61 736b 2066 726f 6d20 E and mask from │ │ │ +000ad6c0: 5245 463a 2066 696e 6445 7373 656e 7469 REF: findEssenti │ │ │ +000ad6d0: 616c 4d61 742e 2049 6e20 7468 6973 0a73 alMat. In this.s │ │ │ +000ad6e0: 6365 6e61 7269 6f2c 2070 6f69 6e74 7331 cenario, points1 │ │ │ +000ad6f0: 2061 6e64 2070 6f69 6e74 7332 2061 7265 and points2 are │ │ │ +000ad700: 2074 6865 2073 616d 6520 696e 7075 7420 the same input │ │ │ +000ad710: 666f 7220 6669 6e64 4573 7365 6e74 6961 for findEssentia │ │ │ +000ad720: 6c4d 6174 2e3a 0a3c 636f 6465 3e0a 2020 lMat.:.. │ │ │ +000ad730: 2020 2f2f 2045 7861 6d70 6c65 2e20 4573 // Example. Es │ │ │ +000ad740: 7469 6d61 7469 6f6e 206f 6620 6675 6e64 timation of fund │ │ │ +000ad750: 616d 656e 7461 6c20 6d61 7472 6978 2075 amental matrix u │ │ │ +000ad760: 7369 6e67 2074 6865 2052 414e 5341 4320 sing the RANSAC │ │ │ +000ad770: 616c 676f 7269 7468 6d0a 2020 2020 696e algorithm. in │ │ │ +000ad780: 7420 706f 696e 745f 636f 756e 7420 3d20 t point_count = │ │ │ +000ad790: 3130 303b 0a20 2020 2076 6563 746f 7226 100;. vector& │ │ │ +000ad7a0: 6c74 3b50 6f69 6e74 3266 2667 743b 2070 lt;Point2f> p │ │ │ +000ad7b0: 6f69 6e74 7331 2870 6f69 6e74 5f63 6f75 oints1(point_cou │ │ │ +000ad7c0: 6e74 293b 0a20 2020 2076 6563 746f 7226 nt);. vector& │ │ │ +000ad7d0: 6c74 3b50 6f69 6e74 3266 2667 743b 2070 lt;Point2f> p │ │ │ +000ad7e0: 6f69 6e74 7332 2870 6f69 6e74 5f63 6f75 oints2(point_cou │ │ │ +000ad7f0: 6e74 293b 0a0a 2020 2020 2f2f 2069 6e69 nt);.. // ini │ │ │ +000ad800: 7469 616c 697a 6520 7468 6520 706f 696e tialize the poin │ │ │ +000ad810: 7473 2068 6572 6520 2e2e 2e0a 2020 2020 ts here .... │ │ │ +000ad820: 666f 7228 2069 6e74 2069 203d 2030 3b20 for( int i = 0; │ │ │ +000ad830: 6920 266c 743b 2070 6f69 6e74 5f63 6f75 i < point_cou │ │ │ +000ad840: 6e74 3b20 692b 2b20 290a 2020 2020 7b0a nt; i++ ). {. │ │ │ +000ad850: 2020 2020 2020 2020 706f 696e 7473 315b points1[ │ │ │ +000ad860: 695d 203d 202e 2e2e 3b0a 2020 2020 2020 i] = ...;. │ │ │ +000ad870: 2020 706f 696e 7473 325b 695d 203d 202e points2[i] = . │ │ │ +000ad880: 2e2e 3b0a 2020 2020 7d0a 0a20 2020 202f ..;. }.. / │ │ │ +000ad890: 2f20 496e 7075 743a 2063 616d 6572 6120 / Input: camera │ │ │ +000ad8a0: 6361 6c69 6272 6174 696f 6e20 6f66 2062 calibration of b │ │ │ +000ad8b0: 6f74 6820 6361 6d65 7261 732c 2066 6f72 oth cameras, for │ │ │ +000ad8c0: 2065 7861 6d70 6c65 2075 7369 6e67 2069 example using i │ │ │ +000ad8d0: 6e74 7269 6e73 6963 2063 6865 7373 626f ntrinsic chessbo │ │ │ +000ad8e0: 6172 6420 6361 6c69 6272 6174 696f 6e2e ard calibration. │ │ │ +000ad8f0: 0a20 2020 204d 6174 2063 616d 6572 614d . Mat cameraM │ │ │ +000ad900: 6174 7269 7831 2c20 6469 7374 436f 6566 atrix1, distCoef │ │ │ +000ad910: 6673 312c 2063 616d 6572 614d 6174 7269 fs1, cameraMatri │ │ │ +000ad920: 7832 2c20 6469 7374 436f 6566 6673 323b x2, distCoeffs2; │ │ │ +000ad930: 0a0a 2020 2020 2f2f 204f 7574 7075 743a .. // Output: │ │ │ +000ad940: 2045 7373 656e 7469 616c 206d 6174 7269 Essential matri │ │ │ +000ad950: 782c 2072 656c 6174 6976 6520 726f 7461 x, relative rota │ │ │ +000ad960: 7469 6f6e 2061 6e64 2072 656c 6174 6976 tion and relativ │ │ │ +000ad970: 6520 7472 616e 736c 6174 696f 6e2e 0a20 e translation.. │ │ │ +000ad980: 2020 204d 6174 2045 2c20 522c 2074 2c20 Mat E, R, t, │ │ │ +000ad990: 6d61 736b 3b0a 0a20 2020 2072 6563 6f76 mask;.. recov │ │ │ +000ad9a0: 6572 506f 7365 2870 6f69 6e74 7331 2c20 erPose(points1, │ │ │ +000ad9b0: 706f 696e 7473 322c 2063 616d 6572 614d points2, cameraM │ │ │ +000ad9c0: 6174 7269 7831 2c20 6469 7374 436f 6566 atrix1, distCoef │ │ │ +000ad9d0: 6673 312c 2063 616d 6572 614d 6174 7269 fs1, cameraMatri │ │ │ +000ad9e0: 7832 2c20 6469 7374 436f 6566 6673 322c x2, distCoeffs2, │ │ │ +000ad9f0: 2045 2c20 522c 2074 2c20 6d61 736b 293b E, R, t, mask); │ │ │ +000ada00: 0a3c 2f63 6f64 653e 3c2f 6464 3e0a 3c64 .
    .Returns:. │ │ │ +000ada20: 3c64 643e 6175 746f 6d61 7469 6361 6c6c
    automaticall │ │ │ +000ada30: 7920 6765 6e65 7261 7465 643c 2f64 643e y generated
    │ │ │ +000ada40: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f ....

  • .

    recover │ │ │ +000adb60: 506f 7365 3c2f 6833 3e0a 3c64 6976 2063 Pose

    .
    .
    │ │ │ +000adbc0: 7075 626c 6963 2073 7461 7469 633c 2f73 public static int&n │ │ │ +000adc00: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;r │ │ │ +000adc20: 6563 6f76 6572 506f 7365 3c2f 7370 616e ecoverPose( │ │ │ +000adc50: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000adc90: 2f61 3e26 6e62 7370 3b70 6f69 6e74 7331 /a> points1 │ │ │ +000adca0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000adce0: 6174 3c2f 613e 266e 6273 703b 706f 696e at poin │ │ │ +000adcf0: 7473 322c 0a20 3c61 2068 7265 663d 222e ts2,. Mat c │ │ │ +000add40: 616d 6572 614d 6174 7269 7831 2c0a 203c ameraMatrix1,. < │ │ │ +000add50: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000add60: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000add70: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000add80: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat distCoef │ │ │ +000adda0: 6673 312c 0a20 3c61 2068 7265 663d 222e fs1,. Mat c │ │ │ +000addf0: 616d 6572 614d 6174 7269 7832 2c0a 203c ameraMatrix2,. < │ │ │ +000ade00: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000ade10: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000ade20: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000ade30: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat distCoef │ │ │ +000ade50: 6673 322c 0a20 3c61 2068 7265 663d 222e fs2,. Mat E │ │ │ +000adea0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000adee0: 6174 3c2f 613e 266e 6273 703b 522c 0a20 at R,. │ │ │ +000adef0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000adf30: 2f61 3e26 6e62 7370 3b74 2c0a 2069 6e74 /a> t,. int │ │ │ +000adf40: 266e 6273 703b 6d65 7468 6f64 2c0a 2064  method,. d │ │ │ +000adf50: 6f75 626c 6526 6e62 7370 3b70 726f 622c ouble prob, │ │ │ +000adf60: 0a20 646f 7562 6c65 266e 6273 703b 7468 . double th │ │ │ +000adf70: 7265 7368 6f6c 6429 3c2f 7370 616e 3e3c reshold)< │ │ │ +000adf80: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Recover │ │ │ +000adfa0: 7320 7468 6520 7265 6c61 7469 7665 2063 s the relative c │ │ │ +000adfb0: 616d 6572 6120 726f 7461 7469 6f6e 2061 amera rotation a │ │ │ +000adfc0: 6e64 2074 6865 2074 7261 6e73 6c61 7469 nd the translati │ │ │ +000adfd0: 6f6e 2066 726f 6d20 636f 7272 6573 706f on from correspo │ │ │ +000adfe0: 6e64 696e 6720 706f 696e 7473 2069 6e20 nding points in │ │ │ +000adff0: 7477 6f20 696d 6167 6573 2066 726f 6d20 two images from │ │ │ +000ae000: 7477 6f20 6469 6666 6572 656e 7420 6361 two different ca │ │ │ +000ae010: 6d65 7261 732c 2075 7369 6e67 2063 6869 meras, using chi │ │ │ +000ae020: 7261 6c69 7479 2063 6865 636b 2e20 5265 rality check. Re │ │ │ +000ae030: 7475 726e 7320 7468 6520 6e75 6d62 6572 turns the number │ │ │ +000ae040: 206f 660a 696e 6c69 6572 7320 7468 6174 of.inliers that │ │ │ +000ae050: 2070 6173 7320 7468 6520 6368 6563 6b2e pass the check. │ │ │ +000ae060: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ +000ae080: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ +000ae090: 6464 3e3c 636f 6465 3e70 6f69 6e74 7331 dd>points1 │ │ │ +000ae0a0: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ +000ae0b0: 6f66 204e 2032 4420 706f 696e 7473 2066 of N 2D points f │ │ │ +000ae0c0: 726f 6d20 7468 6520 6669 7273 7420 696d rom the first im │ │ │ +000ae0d0: 6167 652e 2054 6865 2070 6f69 6e74 2063 age. The point c │ │ │ +000ae0e0: 6f6f 7264 696e 6174 6573 2073 686f 756c oordinates shoul │ │ │ +000ae0f0: 6420 6265 0a66 6c6f 6174 696e 672d 706f d be.floating-po │ │ │ +000ae100: 696e 7420 2873 696e 676c 6520 6f72 2064 int (single or d │ │ │ +000ae110: 6f75 626c 6520 7072 6563 6973 696f 6e29 ouble precision) │ │ │ +000ae120: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 ..
    points2 │ │ │ +000ae140: 2d20 4172 7261 7920 6f66 2074 6865 2073 - Array of the s │ │ │ +000ae150: 6563 6f6e 6420 696d 6167 6520 706f 696e econd image poin │ │ │ +000ae160: 7473 206f 6620 7468 6520 7361 6d65 2073 ts of the same s │ │ │ +000ae170: 697a 6520 616e 6420 666f 726d 6174 2061 ize and format a │ │ │ +000ae180: 7320 706f 696e 7473 3120 2e3c 2f64 643e s points1 .
    │ │ │ +000ae190: 0a3c 6464 3e3c 636f 6465 3e63 616d 6572 .
    camer │ │ │ +000ae1a0: 614d 6174 7269 7831 3c2f 636f 6465 3e20 aMatrix1 │ │ │ +000ae1b0: 2d20 496e 7075 742f 6f75 7470 7574 2063 - Input/output c │ │ │ +000ae1c0: 616d 6572 6120 6d61 7472 6978 2066 6f72 amera matrix for │ │ │ +000ae1d0: 2074 6865 2066 6972 7374 2063 616d 6572 the first camer │ │ │ +000ae1e0: 612c 2074 6865 2073 616d 6520 6173 2069 a, the same as i │ │ │ +000ae1f0: 6e0a 5245 463a 2063 616c 6962 7261 7465 n.REF: calibrate │ │ │ +000ae200: 4361 6d65 7261 2e20 4675 7274 6865 726d Camera. Furtherm │ │ │ +000ae210: 6f72 652c 2066 6f72 2074 6865 2073 7465 ore, for the ste │ │ │ +000ae220: 7265 6f20 6361 7365 2c20 6164 6469 7469 reo case, additi │ │ │ +000ae230: 6f6e 616c 2066 6c61 6773 206d 6179 2062 onal flags may b │ │ │ +000ae240: 6520 7573 6564 2c20 7365 6520 6265 6c6f e used, see belo │ │ │ +000ae250: 772e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 w.
    .
    distCoeffs1 - Input/out │ │ │ +000ae280: 7075 7420 7665 6374 6f72 206f 6620 6469 put vector of di │ │ │ +000ae290: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ +000ae2a0: 6965 6e74 732c 2074 6865 2073 616d 6520 ients, the same │ │ │ +000ae2b0: 6173 2069 6e0a 5245 463a 2063 616c 6962 as in.REF: calib │ │ │ +000ae2c0: 7261 7465 4361 6d65 7261 2e3c 2f64 643e rateCamera.
    │ │ │ +000ae2d0: 0a3c 6464 3e3c 636f 6465 3e63 616d 6572 .
    camer │ │ │ +000ae2e0: 614d 6174 7269 7832 3c2f 636f 6465 3e20 aMatrix2 │ │ │ +000ae2f0: 2d20 496e 7075 742f 6f75 7470 7574 2063 - Input/output c │ │ │ +000ae300: 616d 6572 6120 6d61 7472 6978 2066 6f72 amera matrix for │ │ │ +000ae310: 2074 6865 2066 6972 7374 2063 616d 6572 the first camer │ │ │ +000ae320: 612c 2074 6865 2073 616d 6520 6173 2069 a, the same as i │ │ │ +000ae330: 6e0a 5245 463a 2063 616c 6962 7261 7465 n.REF: calibrate │ │ │ +000ae340: 4361 6d65 7261 2e20 4675 7274 6865 726d Camera. Furtherm │ │ │ +000ae350: 6f72 652c 2066 6f72 2074 6865 2073 7465 ore, for the ste │ │ │ +000ae360: 7265 6f20 6361 7365 2c20 6164 6469 7469 reo case, additi │ │ │ +000ae370: 6f6e 616c 2066 6c61 6773 206d 6179 2062 onal flags may b │ │ │ +000ae380: 6520 7573 6564 2c20 7365 6520 6265 6c6f e used, see belo │ │ │ +000ae390: 772e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 w.
    .
    distCoeffs2 - Input/out │ │ │ +000ae3c0: 7075 7420 7665 6374 6f72 206f 6620 6469 put vector of di │ │ │ +000ae3d0: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ +000ae3e0: 6965 6e74 732c 2074 6865 2073 616d 6520 ients, the same │ │ │ +000ae3f0: 6173 2069 6e0a 5245 463a 2063 616c 6962 as in.REF: calib │ │ │ +000ae400: 7261 7465 4361 6d65 7261 2e3c 2f64 643e rateCamera.
    │ │ │ +000ae410: 0a3c 6464 3e3c 636f 6465 3e45 3c2f 636f .
    E - The output │ │ │ +000ae430: 2065 7373 656e 7469 616c 206d 6174 7269 essential matri │ │ │ +000ae440: 782e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 x.
    .
    R - Out │ │ │ +000ae460: 7075 7420 726f 7461 7469 6f6e 206d 6174 put rotation mat │ │ │ +000ae470: 7269 782e 2054 6f67 6574 6865 7220 7769 rix. Together wi │ │ │ +000ae480: 7468 2074 6865 2074 7261 6e73 6c61 7469 th the translati │ │ │ +000ae490: 6f6e 2076 6563 746f 722c 2074 6869 7320 on vector, this │ │ │ +000ae4a0: 6d61 7472 6978 206d 616b 6573 2075 7020 matrix makes up │ │ │ +000ae4b0: 6120 7475 706c 650a 7468 6174 2070 6572 a tuple.that per │ │ │ +000ae4c0: 666f 726d 7320 6120 6368 616e 6765 206f forms a change o │ │ │ +000ae4d0: 6620 6261 7369 7320 6672 6f6d 2074 6865 f basis from the │ │ │ +000ae4e0: 2066 6972 7374 2063 616d 6572 6127 7320 first camera's │ │ │ +000ae4f0: 636f 6f72 6469 6e61 7465 2073 7973 7465 coordinate syste │ │ │ +000ae500: 6d20 746f 2074 6865 2073 6563 6f6e 6420 m to the second │ │ │ +000ae510: 6361 6d65 7261 2773 0a63 6f6f 7264 696e camera's.coordin │ │ │ +000ae520: 6174 6520 7379 7374 656d 2e20 4e6f 7465 ate system. Note │ │ │ +000ae530: 2074 6861 742c 2069 6e20 6765 6e65 7261 that, in genera │ │ │ +000ae540: 6c2c 2074 2063 616e 206e 6f74 2062 6520 l, t can not be │ │ │ +000ae550: 7573 6564 2066 6f72 2074 6869 7320 7475 used for this tu │ │ │ +000ae560: 706c 652c 2073 6565 2074 6865 2070 6172 ple, see the par │ │ │ +000ae570: 616d 6574 6572 0a64 6573 6372 6962 6564 ameter.described │ │ │ +000ae580: 2062 656c 6f77 2e3c 2f64 643e 0a3c 6464 below.
    .
    t │ │ │ +000ae5a0: 2d20 4f75 7470 7574 2074 7261 6e73 6c61 - Output transla │ │ │ +000ae5b0: 7469 6f6e 2076 6563 746f 722e 2054 6869 tion vector. Thi │ │ │ +000ae5c0: 7320 7665 6374 6f72 2069 7320 6f62 7461 s vector is obta │ │ │ +000ae5d0: 696e 6564 2062 7920 5245 463a 2064 6563 ined by REF: dec │ │ │ +000ae5e0: 6f6d 706f 7365 4573 7365 6e74 6961 6c4d omposeEssentialM │ │ │ +000ae5f0: 6174 2061 6e64 0a74 6865 7265 666f 7265 at and.therefore │ │ │ +000ae600: 2069 7320 6f6e 6c79 206b 6e6f 776e 2075 is only known u │ │ │ +000ae610: 7020 746f 2073 6361 6c65 2c20 692e 652e p to scale, i.e. │ │ │ +000ae620: 2074 2069 7320 7468 6520 6469 7265 6374 t is the direct │ │ │ +000ae630: 696f 6e20 6f66 2074 6865 2074 7261 6e73 ion of the trans │ │ │ +000ae640: 6c61 7469 6f6e 2076 6563 746f 7220 616e lation vector an │ │ │ +000ae650: 6420 6861 7320 756e 6974 0a6c 656e 6774 d has unit.lengt │ │ │ +000ae660: 682e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 h.
    .
    method │ │ │ +000ae680: 2d20 4d65 7468 6f64 2066 6f72 2063 6f6d - Method for com │ │ │ +000ae690: 7075 7469 6e67 2061 6e20 6573 7365 6e74 puting an essent │ │ │ +000ae6a0: 6961 6c20 6d61 7472 6978 2e0a 3c75 6c3e ial matrix..
      │ │ │ +000ae6b0: 0a20 203c 6c69 3e0a 2020 2052 4546 3a20 .
    • . REF: │ │ │ +000ae6c0: 5241 4e53 4143 2066 6f72 2074 6865 2052 RANSAC for the R │ │ │ +000ae6d0: 414e 5341 4320 616c 676f 7269 7468 6d2e ANSAC algorithm. │ │ │ +000ae6e0: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ +000ae6f0: 2020 2052 4546 3a20 4c4d 4544 5320 666f REF: LMEDS fo │ │ │ +000ae700: 7220 7468 6520 4c4d 6564 5320 616c 676f r the LMedS algo │ │ │ +000ae710: 7269 7468 6d2e 0a20 203c 2f6c 693e 0a3c rithm..
    • .< │ │ │ +000ae720: 2f75 6c3e 3c2f 6464 3e0a 3c64 643e 3c63 /ul>
    .
    prob │ │ │ +000ae740: 2d20 5061 7261 6d65 7465 7220 7573 6564 - Parameter used │ │ │ +000ae750: 2066 6f72 2074 6865 2052 414e 5341 4320 for the RANSAC │ │ │ +000ae760: 6f72 204c 4d65 6453 206d 6574 686f 6473 or LMedS methods │ │ │ +000ae770: 206f 6e6c 792e 2049 7420 7370 6563 6966 only. It specif │ │ │ +000ae780: 6965 7320 6120 6465 7369 7261 626c 6520 ies a desirable │ │ │ +000ae790: 6c65 7665 6c20 6f66 0a63 6f6e 6669 6465 level of.confide │ │ │ +000ae7a0: 6e63 6520 2870 726f 6261 6269 6c69 7479 nce (probability │ │ │ +000ae7b0: 2920 7468 6174 2074 6865 2065 7374 696d ) that the estim │ │ │ +000ae7c0: 6174 6564 206d 6174 7269 7820 6973 2063 ated matrix is c │ │ │ +000ae7d0: 6f72 7265 6374 2e3c 2f64 643e 0a3c 6464 orrect.
    .
    threshold │ │ │ +000ae7f0: 3c2f 636f 6465 3e20 2d20 5061 7261 6d65 - Parame │ │ │ +000ae800: 7465 7220 7573 6564 2066 6f72 2052 414e ter used for RAN │ │ │ +000ae810: 5341 432e 2049 7420 6973 2074 6865 206d SAC. It is the m │ │ │ +000ae820: 6178 696d 756d 2064 6973 7461 6e63 6520 aximum distance │ │ │ +000ae830: 6672 6f6d 2061 2070 6f69 6e74 2074 6f20 from a point to │ │ │ +000ae840: 616e 2065 7069 706f 6c61 720a 6c69 6e65 an epipolar.line │ │ │ +000ae850: 2069 6e20 7069 7865 6c73 2c20 6265 796f in pixels, beyo │ │ │ +000ae860: 6e64 2077 6869 6368 2074 6865 2070 6f69 nd which the poi │ │ │ +000ae870: 6e74 2069 7320 636f 6e73 6964 6572 6564 nt is considered │ │ │ +000ae880: 2061 6e20 6f75 746c 6965 7220 616e 6420 an outlier and │ │ │ +000ae890: 6973 206e 6f74 2075 7365 6420 666f 7220 is not used for │ │ │ +000ae8a0: 636f 6d70 7574 696e 6720 7468 650a 6669 computing the.fi │ │ │ +000ae8b0: 6e61 6c20 6675 6e64 616d 656e 7461 6c20 nal fundamental │ │ │ +000ae8c0: 6d61 7472 6978 2e20 4974 2063 616e 2062 matrix. It can b │ │ │ +000ae8d0: 6520 7365 7420 746f 2073 6f6d 6574 6869 e set to somethi │ │ │ +000ae8e0: 6e67 206c 696b 6520 312d 332c 2064 6570 ng like 1-3, dep │ │ │ +000ae8f0: 656e 6469 6e67 206f 6e20 7468 6520 6163 ending on the ac │ │ │ +000ae900: 6375 7261 6379 206f 6620 7468 650a 706f curacy of the.po │ │ │ +000ae910: 696e 7420 6c6f 6361 6c69 7a61 7469 6f6e int localization │ │ │ +000ae920: 2c20 696d 6167 6520 7265 736f 6c75 7469 , image resoluti │ │ │ +000ae930: 6f6e 2c20 616e 6420 7468 6520 696d 6167 on, and the imag │ │ │ +000ae940: 6520 6e6f 6973 652e 0a69 6e6c 6965 7273 e noise..inliers │ │ │ +000ae950: 2069 6e20 706f 696e 7473 3120 616e 6420 in points1 and │ │ │ +000ae960: 706f 696e 7473 3220 666f 7220 7468 6520 points2 for the │ │ │ +000ae970: 6769 7665 6e20 6573 7365 6e74 6961 6c20 given essential │ │ │ +000ae980: 6d61 7472 6978 2045 2e20 4f6e 6c79 2074 matrix E. Only t │ │ │ +000ae990: 6865 7365 2069 6e6c 6965 7273 2077 696c hese inliers wil │ │ │ +000ae9a0: 6c20 6265 2075 7365 6420 746f 0a72 6563 l be used to.rec │ │ │ +000ae9b0: 6f76 6572 2070 6f73 652e 2049 6e20 7468 over pose. In th │ │ │ +000ae9c0: 6520 6f75 7470 7574 206d 6173 6b20 6f6e e output mask on │ │ │ +000ae9d0: 6c79 2069 6e6c 6965 7273 2077 6869 6368 ly inliers which │ │ │ +000ae9e0: 2070 6173 7320 7468 6520 6368 6972 616c pass the chiral │ │ │ +000ae9f0: 6974 7920 6368 6563 6b2e 0a0a 5468 6973 ity check...This │ │ │ +000aea00: 2066 756e 6374 696f 6e20 6465 636f 6d70 function decomp │ │ │ +000aea10: 6f73 6573 2061 6e20 6573 7365 6e74 6961 oses an essentia │ │ │ +000aea20: 6c20 6d61 7472 6978 2075 7369 6e67 2052 l matrix using R │ │ │ +000aea30: 4546 3a20 6465 636f 6d70 6f73 6545 7373 EF: decomposeEss │ │ │ +000aea40: 656e 7469 616c 4d61 7420 616e 6420 7468 entialMat and th │ │ │ +000aea50: 656e 2076 6572 6966 6965 730a 706f 7373 en verifies.poss │ │ │ +000aea60: 6962 6c65 2070 6f73 6520 6879 706f 7468 ible pose hypoth │ │ │ +000aea70: 6573 6573 2062 7920 646f 696e 6720 6368 eses by doing ch │ │ │ +000aea80: 6972 616c 6974 7920 6368 6563 6b2e 2054 irality check. T │ │ │ +000aea90: 6865 2063 6869 7261 6c69 7479 2063 6865 he chirality che │ │ │ +000aeaa0: 636b 206d 6561 6e73 2074 6861 7420 7468 ck means that th │ │ │ +000aeab0: 650a 7472 6961 6e67 756c 6174 6564 2033 e.triangulated 3 │ │ │ +000aeac0: 4420 706f 696e 7473 2073 686f 756c 6420 D points should │ │ │ +000aead0: 6861 7665 2070 6f73 6974 6976 6520 6465 have positive de │ │ │ +000aeae0: 7074 682e 2053 6f6d 6520 6465 7461 696c pth. Some detail │ │ │ +000aeaf0: 7320 6361 6e20 6265 2066 6f75 6e64 2069 s can be found i │ │ │ +000aeb00: 6e20 4349 5445 3a20 4e69 7374 6572 3033 n CITE: Nister03 │ │ │ +000aeb10: 2e0a 0a54 6869 7320 6675 6e63 7469 6f6e ...This function │ │ │ +000aeb20: 2063 616e 2062 6520 7573 6564 2074 6f20 can be used to │ │ │ +000aeb30: 7072 6f63 6573 7320 7468 6520 6f75 7470 process the outp │ │ │ +000aeb40: 7574 2045 2061 6e64 206d 6173 6b20 6672 ut E and mask fr │ │ │ +000aeb50: 6f6d 2052 4546 3a20 6669 6e64 4573 7365 om REF: findEsse │ │ │ +000aeb60: 6e74 6961 6c4d 6174 2e20 496e 2074 6869 ntialMat. In thi │ │ │ +000aeb70: 730a 7363 656e 6172 696f 2c20 706f 696e s.scenario, poin │ │ │ +000aeb80: 7473 3120 616e 6420 706f 696e 7473 3220 ts1 and points2 │ │ │ +000aeb90: 6172 6520 7468 6520 7361 6d65 2069 6e70 are the same inp │ │ │ +000aeba0: 7574 2066 6f72 2066 696e 6445 7373 656e ut for findEssen │ │ │ +000aebb0: 7469 616c 4d61 742e 3a0a 3c63 6f64 653e tialMat.:. │ │ │ +000aebc0: 0a20 2020 202f 2f20 4578 616d 706c 652e . // Example. │ │ │ +000aebd0: 2045 7374 696d 6174 696f 6e20 6f66 2066 Estimation of f │ │ │ +000aebe0: 756e 6461 6d65 6e74 616c 206d 6174 7269 undamental matri │ │ │ +000aebf0: 7820 7573 696e 6720 7468 6520 5241 4e53 x using the RANS │ │ │ +000aec00: 4143 2061 6c67 6f72 6974 686d 0a20 2020 AC algorithm. │ │ │ +000aec10: 2069 6e74 2070 6f69 6e74 5f63 6f75 6e74 int point_count │ │ │ +000aec20: 203d 2031 3030 3b0a 2020 2020 7665 6374 = 100;. vect │ │ │ +000aec30: 6f72 266c 743b 506f 696e 7432 6626 6774 or<Point2f> │ │ │ +000aec40: 3b20 706f 696e 7473 3128 706f 696e 745f ; points1(point_ │ │ │ +000aec50: 636f 756e 7429 3b0a 2020 2020 7665 6374 count);. vect │ │ │ +000aec60: 6f72 266c 743b 506f 696e 7432 6626 6774 or<Point2f> │ │ │ +000aec70: 3b20 706f 696e 7473 3228 706f 696e 745f ; points2(point_ │ │ │ +000aec80: 636f 756e 7429 3b0a 0a20 2020 202f 2f20 count);.. // │ │ │ +000aec90: 696e 6974 6961 6c69 7a65 2074 6865 2070 initialize the p │ │ │ +000aeca0: 6f69 6e74 7320 6865 7265 202e 2e2e 0a20 oints here .... │ │ │ +000aecb0: 2020 2066 6f72 2820 696e 7420 6920 3d20 for( int i = │ │ │ +000aecc0: 303b 2069 2026 6c74 3b20 706f 696e 745f 0; i < point_ │ │ │ +000aecd0: 636f 756e 743b 2069 2b2b 2029 0a20 2020 count; i++ ). │ │ │ +000aece0: 207b 0a20 2020 2020 2020 2070 6f69 6e74 {. point │ │ │ +000aecf0: 7331 5b69 5d20 3d20 2e2e 2e3b 0a20 2020 s1[i] = ...;. │ │ │ +000aed00: 2020 2020 2070 6f69 6e74 7332 5b69 5d20 points2[i] │ │ │ +000aed10: 3d20 2e2e 2e3b 0a20 2020 207d 0a0a 2020 = ...;. }.. │ │ │ +000aed20: 2020 2f2f 2049 6e70 7574 3a20 6361 6d65 // Input: came │ │ │ +000aed30: 7261 2063 616c 6962 7261 7469 6f6e 206f ra calibration o │ │ │ +000aed40: 6620 626f 7468 2063 616d 6572 6173 2c20 f both cameras, │ │ │ +000aed50: 666f 7220 6578 616d 706c 6520 7573 696e for example usin │ │ │ +000aed60: 6720 696e 7472 696e 7369 6320 6368 6573 g intrinsic ches │ │ │ +000aed70: 7362 6f61 7264 2063 616c 6962 7261 7469 sboard calibrati │ │ │ +000aed80: 6f6e 2e0a 2020 2020 4d61 7420 6361 6d65 on.. Mat came │ │ │ +000aed90: 7261 4d61 7472 6978 312c 2064 6973 7443 raMatrix1, distC │ │ │ +000aeda0: 6f65 6666 7331 2c20 6361 6d65 7261 4d61 oeffs1, cameraMa │ │ │ +000aedb0: 7472 6978 322c 2064 6973 7443 6f65 6666 trix2, distCoeff │ │ │ +000aedc0: 7332 3b0a 0a20 2020 202f 2f20 4f75 7470 s2;.. // Outp │ │ │ +000aedd0: 7574 3a20 4573 7365 6e74 6961 6c20 6d61 ut: Essential ma │ │ │ +000aede0: 7472 6978 2c20 7265 6c61 7469 7665 2072 trix, relative r │ │ │ +000aedf0: 6f74 6174 696f 6e20 616e 6420 7265 6c61 otation and rela │ │ │ +000aee00: 7469 7665 2074 7261 6e73 6c61 7469 6f6e tive translation │ │ │ +000aee10: 2e0a 2020 2020 4d61 7420 452c 2052 2c20 .. Mat E, R, │ │ │ +000aee20: 742c 206d 6173 6b3b 0a0a 2020 2020 7265 t, mask;.. re │ │ │ +000aee30: 636f 7665 7250 6f73 6528 706f 696e 7473 coverPose(points │ │ │ +000aee40: 312c 2070 6f69 6e74 7332 2c20 6361 6d65 1, points2, came │ │ │ +000aee50: 7261 4d61 7472 6978 312c 2064 6973 7443 raMatrix1, distC │ │ │ +000aee60: 6f65 6666 7331 2c20 6361 6d65 7261 4d61 oeffs1, cameraMa │ │ │ +000aee70: 7472 6978 322c 2064 6973 7443 6f65 6666 trix2, distCoeff │ │ │ +000aee80: 7332 2c20 452c 2052 2c20 742c 206d 6173 s2, E, R, t, mas │ │ │ +000aee90: 6b29 3b0a 3c2f 636f 6465 3e3c 2f64 643e k);.
    │ │ │ +000aeea0: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    automatic │ │ │ +000aeec0: 616c 6c79 2067 656e 6572 6174 6564 3c2f ally generated.
    .
    │ │ │ +000aeee0: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
    ..
  • .
    │ │ │ +000aefe0: 0a3c 6833 3e72 6563 6f76 6572 506f 7365 .

    recoverPose │ │ │ +000aeff0: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ +000af050: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ +000af060: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ +000af080: 696e 743c 2f73 7061 6e3e 266e 6273 703b int  │ │ │ +000af090: 3c73 7061 6e20 636c 6173 733d 2265 6c65 recov │ │ │ +000af0b0: 6572 506f 7365 3c2f 7370 616e 3e3c 7762 erPose(Mat& │ │ │ +000af120: 6e62 7370 3b70 6f69 6e74 7331 2c0a 203c nbsp;points1,. < │ │ │ +000af130: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000af140: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000af150: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000af160: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat points2, │ │ │ +000af180: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000af1c0: 743c 2f61 3e26 6e62 7370 3b63 616d 6572 t camer │ │ │ +000af1d0: 614d 6174 7269 7831 2c0a 203c 6120 6872 aMatrix1,. Mat&n │ │ │ +000af220: 6273 703b 6469 7374 436f 6566 6673 312c bsp;distCoeffs1, │ │ │ +000af230: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000af270: 743c 2f61 3e26 6e62 7370 3b63 616d 6572 t camer │ │ │ +000af280: 614d 6174 7269 7832 2c0a 203c 6120 6872 aMatrix2,. Mat&n │ │ │ +000af2d0: 6273 703b 6469 7374 436f 6566 6673 322c bsp;distCoeffs2, │ │ │ +000af2e0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000af320: 743c 2f61 3e26 6e62 7370 3b45 2c0a 203c t E,. < │ │ │ +000af330: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000af340: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000af350: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000af360: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat R,. Mat& │ │ │ +000af3c0: 6e62 7370 3b74 2c0a 2069 6e74 266e 6273 nbsp;t,. int&nbs │ │ │ +000af3d0: 703b 6d65 7468 6f64 2c0a 2064 6f75 626c p;method,. doubl │ │ │ +000af3e0: 6526 6e62 7370 3b70 726f 6229 3c2f 7370 e prob)
    .
    Rec │ │ │ +000af410: 6f76 6572 7320 7468 6520 7265 6c61 7469 overs the relati │ │ │ +000af420: 7665 2063 616d 6572 6120 726f 7461 7469 ve camera rotati │ │ │ +000af430: 6f6e 2061 6e64 2074 6865 2074 7261 6e73 on and the trans │ │ │ +000af440: 6c61 7469 6f6e 2066 726f 6d20 636f 7272 lation from corr │ │ │ +000af450: 6573 706f 6e64 696e 6720 706f 696e 7473 esponding points │ │ │ +000af460: 2069 6e20 7477 6f20 696d 6167 6573 2066 in two images f │ │ │ +000af470: 726f 6d20 7477 6f20 6469 6666 6572 656e rom two differen │ │ │ +000af480: 7420 6361 6d65 7261 732c 2075 7369 6e67 t cameras, using │ │ │ +000af490: 2063 6869 7261 6c69 7479 2063 6865 636b chirality check │ │ │ +000af4a0: 2e20 5265 7475 726e 7320 7468 6520 6e75 . Returns the nu │ │ │ +000af4b0: 6d62 6572 206f 660a 696e 6c69 6572 7320 mber of.inliers │ │ │ +000af4c0: 7468 6174 2070 6173 7320 7468 6520 6368 that pass the ch │ │ │ +000af4d0: 6563 6b2e 3c2f 6469 763e 0a3c 646c 2063 eck.
    .
    .Parameters:.
    poi │ │ │ +000af510: 6e74 7331 3c2f 636f 6465 3e20 2d20 4172 nts1 - Ar │ │ │ +000af520: 7261 7920 6f66 204e 2032 4420 706f 696e ray of N 2D poin │ │ │ +000af530: 7473 2066 726f 6d20 7468 6520 6669 7273 ts from the firs │ │ │ +000af540: 7420 696d 6167 652e 2054 6865 2070 6f69 t image. The poi │ │ │ +000af550: 6e74 2063 6f6f 7264 696e 6174 6573 2073 nt coordinates s │ │ │ +000af560: 686f 756c 6420 6265 0a66 6c6f 6174 696e hould be.floatin │ │ │ +000af570: 672d 706f 696e 7420 2873 696e 676c 6520 g-point (single │ │ │ +000af580: 6f72 2064 6f75 626c 6520 7072 6563 6973 or double precis │ │ │ +000af590: 696f 6e29 2e3c 2f64 643e 0a3c 6464 3e3c ion).
    .
    < │ │ │ +000af5a0: 636f 6465 3e70 6f69 6e74 7332 3c2f 636f code>points2 - Array of t │ │ │ +000af5c0: 6865 2073 6563 6f6e 6420 696d 6167 6520 he second image │ │ │ +000af5d0: 706f 696e 7473 206f 6620 7468 6520 7361 points of the sa │ │ │ +000af5e0: 6d65 2073 697a 6520 616e 6420 666f 726d me size and form │ │ │ +000af5f0: 6174 2061 7320 706f 696e 7473 3120 2e3c at as points1 .< │ │ │ +000af600: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ +000af610: 616d 6572 614d 6174 7269 7831 3c2f 636f ameraMatrix1 - Input/outp │ │ │ +000af630: 7574 2063 616d 6572 6120 6d61 7472 6978 ut camera matrix │ │ │ +000af640: 2066 6f72 2074 6865 2066 6972 7374 2063 for the first c │ │ │ +000af650: 616d 6572 612c 2074 6865 2073 616d 6520 amera, the same │ │ │ +000af660: 6173 2069 6e0a 5245 463a 2063 616c 6962 as in.REF: calib │ │ │ +000af670: 7261 7465 4361 6d65 7261 2e20 4675 7274 rateCamera. Furt │ │ │ +000af680: 6865 726d 6f72 652c 2066 6f72 2074 6865 hermore, for the │ │ │ +000af690: 2073 7465 7265 6f20 6361 7365 2c20 6164 stereo case, ad │ │ │ +000af6a0: 6469 7469 6f6e 616c 2066 6c61 6773 206d ditional flags m │ │ │ +000af6b0: 6179 2062 6520 7573 6564 2c20 7365 6520 ay be used, see │ │ │ +000af6c0: 6265 6c6f 772e 3c2f 6464 3e0a 3c64 643e below.
    .
    │ │ │ +000af6d0: 3c63 6f64 653e 6469 7374 436f 6566 6673 distCoeffs │ │ │ +000af6e0: 313c 2f63 6f64 653e 202d 2049 6e70 7574 1 - Input │ │ │ +000af6f0: 2f6f 7574 7075 7420 7665 6374 6f72 206f /output vector o │ │ │ +000af700: 6620 6469 7374 6f72 7469 6f6e 2063 6f65 f distortion coe │ │ │ +000af710: 6666 6963 6965 6e74 732c 2074 6865 2073 fficients, the s │ │ │ +000af720: 616d 6520 6173 2069 6e0a 5245 463a 2063 ame as in.REF: c │ │ │ +000af730: 616c 6962 7261 7465 4361 6d65 7261 2e3c alibrateCamera.< │ │ │ +000af740: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ +000af750: 616d 6572 614d 6174 7269 7832 3c2f 636f ameraMatrix2 - Input/outp │ │ │ +000af770: 7574 2063 616d 6572 6120 6d61 7472 6978 ut camera matrix │ │ │ +000af780: 2066 6f72 2074 6865 2066 6972 7374 2063 for the first c │ │ │ +000af790: 616d 6572 612c 2074 6865 2073 616d 6520 amera, the same │ │ │ +000af7a0: 6173 2069 6e0a 5245 463a 2063 616c 6962 as in.REF: calib │ │ │ +000af7b0: 7261 7465 4361 6d65 7261 2e20 4675 7274 rateCamera. Furt │ │ │ +000af7c0: 6865 726d 6f72 652c 2066 6f72 2074 6865 hermore, for the │ │ │ +000af7d0: 2073 7465 7265 6f20 6361 7365 2c20 6164 stereo case, ad │ │ │ +000af7e0: 6469 7469 6f6e 616c 2066 6c61 6773 206d ditional flags m │ │ │ +000af7f0: 6179 2062 6520 7573 6564 2c20 7365 6520 ay be used, see │ │ │ +000af800: 6265 6c6f 772e 3c2f 6464 3e0a 3c64 643e below.
    .
    │ │ │ +000af810: 3c63 6f64 653e 6469 7374 436f 6566 6673 distCoeffs │ │ │ +000af820: 323c 2f63 6f64 653e 202d 2049 6e70 7574 2 - Input │ │ │ +000af830: 2f6f 7574 7075 7420 7665 6374 6f72 206f /output vector o │ │ │ +000af840: 6620 6469 7374 6f72 7469 6f6e 2063 6f65 f distortion coe │ │ │ +000af850: 6666 6963 6965 6e74 732c 2074 6865 2073 fficients, the s │ │ │ +000af860: 616d 6520 6173 2069 6e0a 5245 463a 2063 ame as in.REF: c │ │ │ +000af870: 616c 6962 7261 7465 4361 6d65 7261 2e3c alibrateCamera.< │ │ │ +000af880: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e45 /dd>.
    E │ │ │ +000af890: 3c2f 636f 6465 3e20 2d20 5468 6520 6f75 - The ou │ │ │ +000af8a0: 7470 7574 2065 7373 656e 7469 616c 206d tput essential m │ │ │ +000af8b0: 6174 7269 782e 3c2f 6464 3e0a 3c64 643e atrix.
    .
    │ │ │ +000af8c0: 3c63 6f64 653e 523c 2f63 6f64 653e 202d R - │ │ │ +000af8d0: 204f 7574 7075 7420 726f 7461 7469 6f6e Output rotation │ │ │ +000af8e0: 206d 6174 7269 782e 2054 6f67 6574 6865 matrix. Togethe │ │ │ +000af8f0: 7220 7769 7468 2074 6865 2074 7261 6e73 r with the trans │ │ │ +000af900: 6c61 7469 6f6e 2076 6563 746f 722c 2074 lation vector, t │ │ │ +000af910: 6869 7320 6d61 7472 6978 206d 616b 6573 his matrix makes │ │ │ +000af920: 2075 7020 6120 7475 706c 650a 7468 6174 up a tuple.that │ │ │ +000af930: 2070 6572 666f 726d 7320 6120 6368 616e performs a chan │ │ │ +000af940: 6765 206f 6620 6261 7369 7320 6672 6f6d ge of basis from │ │ │ +000af950: 2074 6865 2066 6972 7374 2063 616d 6572 the first camer │ │ │ +000af960: 6127 7320 636f 6f72 6469 6e61 7465 2073 a's coordinate s │ │ │ +000af970: 7973 7465 6d20 746f 2074 6865 2073 6563 ystem to the sec │ │ │ +000af980: 6f6e 6420 6361 6d65 7261 2773 0a63 6f6f ond camera's.coo │ │ │ +000af990: 7264 696e 6174 6520 7379 7374 656d 2e20 rdinate system. │ │ │ +000af9a0: 4e6f 7465 2074 6861 742c 2069 6e20 6765 Note that, in ge │ │ │ +000af9b0: 6e65 7261 6c2c 2074 2063 616e 206e 6f74 neral, t can not │ │ │ +000af9c0: 2062 6520 7573 6564 2066 6f72 2074 6869 be used for thi │ │ │ +000af9d0: 7320 7475 706c 652c 2073 6565 2074 6865 s tuple, see the │ │ │ +000af9e0: 2070 6172 616d 6574 6572 0a64 6573 6372 parameter.descr │ │ │ +000af9f0: 6962 6564 2062 656c 6f77 2e3c 2f64 643e ibed below.
    │ │ │ +000afa00: 0a3c 6464 3e3c 636f 6465 3e74 3c2f 636f .
    t - Output tra │ │ │ +000afa20: 6e73 6c61 7469 6f6e 2076 6563 746f 722e nslation vector. │ │ │ +000afa30: 2054 6869 7320 7665 6374 6f72 2069 7320 This vector is │ │ │ +000afa40: 6f62 7461 696e 6564 2062 7920 5245 463a obtained by REF: │ │ │ +000afa50: 2064 6563 6f6d 706f 7365 4573 7365 6e74 decomposeEssent │ │ │ +000afa60: 6961 6c4d 6174 2061 6e64 0a74 6865 7265 ialMat and.there │ │ │ +000afa70: 666f 7265 2069 7320 6f6e 6c79 206b 6e6f fore is only kno │ │ │ +000afa80: 776e 2075 7020 746f 2073 6361 6c65 2c20 wn up to scale, │ │ │ +000afa90: 692e 652e 2074 2069 7320 7468 6520 6469 i.e. t is the di │ │ │ +000afaa0: 7265 6374 696f 6e20 6f66 2074 6865 2074 rection of the t │ │ │ +000afab0: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ +000afac0: 7220 616e 6420 6861 7320 756e 6974 0a6c r and has unit.l │ │ │ +000afad0: 656e 6774 682e 3c2f 6464 3e0a 3c64 643e ength.
    .
    │ │ │ +000afae0: 3c63 6f64 653e 6d65 7468 6f64 3c2f 636f method - Method for │ │ │ +000afb00: 2063 6f6d 7075 7469 6e67 2061 6e20 6573 computing an es │ │ │ +000afb10: 7365 6e74 6961 6c20 6d61 7472 6978 2e0a sential matrix.. │ │ │ +000afb20: 3c75 6c3e 0a20 203c 6c69 3e0a 2020 2052
      .
    • . R │ │ │ +000afb30: 4546 3a20 5241 4e53 4143 2066 6f72 2074 EF: RANSAC for t │ │ │ +000afb40: 6865 2052 414e 5341 4320 616c 676f 7269 he RANSAC algori │ │ │ +000afb50: 7468 6d2e 0a20 203c 2f6c 693e 0a20 203c thm..
    • . < │ │ │ +000afb60: 6c69 3e0a 2020 2052 4546 3a20 4c4d 4544 li>. REF: LMED │ │ │ +000afb70: 5320 666f 7220 7468 6520 4c4d 6564 5320 S for the LMedS │ │ │ +000afb80: 616c 676f 7269 7468 6d2e 0a20 203c 2f6c algorithm.. .
    .prob - Parameter │ │ │ +000afbc0: 7573 6564 2066 6f72 2074 6865 2052 414e used for the RAN │ │ │ +000afbd0: 5341 4320 6f72 204c 4d65 6453 206d 6574 SAC or LMedS met │ │ │ +000afbe0: 686f 6473 206f 6e6c 792e 2049 7420 7370 hods only. It sp │ │ │ +000afbf0: 6563 6966 6965 7320 6120 6465 7369 7261 ecifies a desira │ │ │ +000afc00: 626c 6520 6c65 7665 6c20 6f66 0a63 6f6e ble level of.con │ │ │ +000afc10: 6669 6465 6e63 6520 2870 726f 6261 6269 fidence (probabi │ │ │ +000afc20: 6c69 7479 2920 7468 6174 2074 6865 2065 lity) that the e │ │ │ +000afc30: 7374 696d 6174 6564 206d 6174 7269 7820 stimated matrix │ │ │ +000afc40: 6973 2063 6f72 7265 6374 2e0a 6c69 6e65 is correct..line │ │ │ +000afc50: 2069 6e20 7069 7865 6c73 2c20 6265 796f in pixels, beyo │ │ │ +000afc60: 6e64 2077 6869 6368 2074 6865 2070 6f69 nd which the poi │ │ │ +000afc70: 6e74 2069 7320 636f 6e73 6964 6572 6564 nt is considered │ │ │ +000afc80: 2061 6e20 6f75 746c 6965 7220 616e 6420 an outlier and │ │ │ +000afc90: 6973 206e 6f74 2075 7365 6420 666f 7220 is not used for │ │ │ +000afca0: 636f 6d70 7574 696e 6720 7468 650a 6669 computing the.fi │ │ │ +000afcb0: 6e61 6c20 6675 6e64 616d 656e 7461 6c20 nal fundamental │ │ │ +000afcc0: 6d61 7472 6978 2e20 4974 2063 616e 2062 matrix. It can b │ │ │ +000afcd0: 6520 7365 7420 746f 2073 6f6d 6574 6869 e set to somethi │ │ │ +000afce0: 6e67 206c 696b 6520 312d 332c 2064 6570 ng like 1-3, dep │ │ │ +000afcf0: 656e 6469 6e67 206f 6e20 7468 6520 6163 ending on the ac │ │ │ +000afd00: 6375 7261 6379 206f 6620 7468 650a 706f curacy of the.po │ │ │ +000afd10: 696e 7420 6c6f 6361 6c69 7a61 7469 6f6e int localization │ │ │ +000afd20: 2c20 696d 6167 6520 7265 736f 6c75 7469 , image resoluti │ │ │ +000afd30: 6f6e 2c20 616e 6420 7468 6520 696d 6167 on, and the imag │ │ │ +000afd40: 6520 6e6f 6973 652e 0a69 6e6c 6965 7273 e noise..inliers │ │ │ +000afd50: 2069 6e20 706f 696e 7473 3120 616e 6420 in points1 and │ │ │ +000afd60: 706f 696e 7473 3220 666f 7220 7468 6520 points2 for the │ │ │ +000afd70: 6769 7665 6e20 6573 7365 6e74 6961 6c20 given essential │ │ │ +000afd80: 6d61 7472 6978 2045 2e20 4f6e 6c79 2074 matrix E. Only t │ │ │ +000afd90: 6865 7365 2069 6e6c 6965 7273 2077 696c hese inliers wil │ │ │ +000afda0: 6c20 6265 2075 7365 6420 746f 0a72 6563 l be used to.rec │ │ │ +000afdb0: 6f76 6572 2070 6f73 652e 2049 6e20 7468 over pose. In th │ │ │ +000afdc0: 6520 6f75 7470 7574 206d 6173 6b20 6f6e e output mask on │ │ │ +000afdd0: 6c79 2069 6e6c 6965 7273 2077 6869 6368 ly inliers which │ │ │ +000afde0: 2070 6173 7320 7468 6520 6368 6972 616c pass the chiral │ │ │ +000afdf0: 6974 7920 6368 6563 6b2e 0a0a 5468 6973 ity check...This │ │ │ +000afe00: 2066 756e 6374 696f 6e20 6465 636f 6d70 function decomp │ │ │ +000afe10: 6f73 6573 2061 6e20 6573 7365 6e74 6961 oses an essentia │ │ │ +000afe20: 6c20 6d61 7472 6978 2075 7369 6e67 2052 l matrix using R │ │ │ +000afe30: 4546 3a20 6465 636f 6d70 6f73 6545 7373 EF: decomposeEss │ │ │ +000afe40: 656e 7469 616c 4d61 7420 616e 6420 7468 entialMat and th │ │ │ +000afe50: 656e 2076 6572 6966 6965 730a 706f 7373 en verifies.poss │ │ │ +000afe60: 6962 6c65 2070 6f73 6520 6879 706f 7468 ible pose hypoth │ │ │ +000afe70: 6573 6573 2062 7920 646f 696e 6720 6368 eses by doing ch │ │ │ +000afe80: 6972 616c 6974 7920 6368 6563 6b2e 2054 irality check. T │ │ │ +000afe90: 6865 2063 6869 7261 6c69 7479 2063 6865 he chirality che │ │ │ +000afea0: 636b 206d 6561 6e73 2074 6861 7420 7468 ck means that th │ │ │ +000afeb0: 650a 7472 6961 6e67 756c 6174 6564 2033 e.triangulated 3 │ │ │ +000afec0: 4420 706f 696e 7473 2073 686f 756c 6420 D points should │ │ │ +000afed0: 6861 7665 2070 6f73 6974 6976 6520 6465 have positive de │ │ │ +000afee0: 7074 682e 2053 6f6d 6520 6465 7461 696c pth. Some detail │ │ │ +000afef0: 7320 6361 6e20 6265 2066 6f75 6e64 2069 s can be found i │ │ │ +000aff00: 6e20 4349 5445 3a20 4e69 7374 6572 3033 n CITE: Nister03 │ │ │ +000aff10: 2e0a 0a54 6869 7320 6675 6e63 7469 6f6e ...This function │ │ │ +000aff20: 2063 616e 2062 6520 7573 6564 2074 6f20 can be used to │ │ │ +000aff30: 7072 6f63 6573 7320 7468 6520 6f75 7470 process the outp │ │ │ +000aff40: 7574 2045 2061 6e64 206d 6173 6b20 6672 ut E and mask fr │ │ │ +000aff50: 6f6d 2052 4546 3a20 6669 6e64 4573 7365 om REF: findEsse │ │ │ +000aff60: 6e74 6961 6c4d 6174 2e20 496e 2074 6869 ntialMat. In thi │ │ │ +000aff70: 730a 7363 656e 6172 696f 2c20 706f 696e s.scenario, poin │ │ │ +000aff80: 7473 3120 616e 6420 706f 696e 7473 3220 ts1 and points2 │ │ │ +000aff90: 6172 6520 7468 6520 7361 6d65 2069 6e70 are the same inp │ │ │ +000affa0: 7574 2066 6f72 2066 696e 6445 7373 656e ut for findEssen │ │ │ +000affb0: 7469 616c 4d61 742e 3a0a 3c63 6f64 653e tialMat.:. │ │ │ +000affc0: 0a20 2020 202f 2f20 4578 616d 706c 652e . // Example. │ │ │ +000affd0: 2045 7374 696d 6174 696f 6e20 6f66 2066 Estimation of f │ │ │ +000affe0: 756e 6461 6d65 6e74 616c 206d 6174 7269 undamental matri │ │ │ +000afff0: 7820 7573 696e 6720 7468 6520 5241 4e53 x using the RANS │ │ │ +000b0000: 4143 2061 6c67 6f72 6974 686d 0a20 2020 AC algorithm. │ │ │ +000b0010: 2069 6e74 2070 6f69 6e74 5f63 6f75 6e74 int point_count │ │ │ +000b0020: 203d 2031 3030 3b0a 2020 2020 7665 6374 = 100;. vect │ │ │ +000b0030: 6f72 266c 743b 506f 696e 7432 6626 6774 or<Point2f> │ │ │ +000b0040: 3b20 706f 696e 7473 3128 706f 696e 745f ; points1(point_ │ │ │ +000b0050: 636f 756e 7429 3b0a 2020 2020 7665 6374 count);. vect │ │ │ +000b0060: 6f72 266c 743b 506f 696e 7432 6626 6774 or<Point2f> │ │ │ +000b0070: 3b20 706f 696e 7473 3228 706f 696e 745f ; points2(point_ │ │ │ +000b0080: 636f 756e 7429 3b0a 0a20 2020 202f 2f20 count);.. // │ │ │ +000b0090: 696e 6974 6961 6c69 7a65 2074 6865 2070 initialize the p │ │ │ +000b00a0: 6f69 6e74 7320 6865 7265 202e 2e2e 0a20 oints here .... │ │ │ +000b00b0: 2020 2066 6f72 2820 696e 7420 6920 3d20 for( int i = │ │ │ +000b00c0: 303b 2069 2026 6c74 3b20 706f 696e 745f 0; i < point_ │ │ │ +000b00d0: 636f 756e 743b 2069 2b2b 2029 0a20 2020 count; i++ ). │ │ │ +000b00e0: 207b 0a20 2020 2020 2020 2070 6f69 6e74 {. point │ │ │ +000b00f0: 7331 5b69 5d20 3d20 2e2e 2e3b 0a20 2020 s1[i] = ...;. │ │ │ +000b0100: 2020 2020 2070 6f69 6e74 7332 5b69 5d20 points2[i] │ │ │ +000b0110: 3d20 2e2e 2e3b 0a20 2020 207d 0a0a 2020 = ...;. }.. │ │ │ +000b0120: 2020 2f2f 2049 6e70 7574 3a20 6361 6d65 // Input: came │ │ │ +000b0130: 7261 2063 616c 6962 7261 7469 6f6e 206f ra calibration o │ │ │ +000b0140: 6620 626f 7468 2063 616d 6572 6173 2c20 f both cameras, │ │ │ +000b0150: 666f 7220 6578 616d 706c 6520 7573 696e for example usin │ │ │ +000b0160: 6720 696e 7472 696e 7369 6320 6368 6573 g intrinsic ches │ │ │ +000b0170: 7362 6f61 7264 2063 616c 6962 7261 7469 sboard calibrati │ │ │ +000b0180: 6f6e 2e0a 2020 2020 4d61 7420 6361 6d65 on.. Mat came │ │ │ +000b0190: 7261 4d61 7472 6978 312c 2064 6973 7443 raMatrix1, distC │ │ │ +000b01a0: 6f65 6666 7331 2c20 6361 6d65 7261 4d61 oeffs1, cameraMa │ │ │ +000b01b0: 7472 6978 322c 2064 6973 7443 6f65 6666 trix2, distCoeff │ │ │ +000b01c0: 7332 3b0a 0a20 2020 202f 2f20 4f75 7470 s2;.. // Outp │ │ │ +000b01d0: 7574 3a20 4573 7365 6e74 6961 6c20 6d61 ut: Essential ma │ │ │ +000b01e0: 7472 6978 2c20 7265 6c61 7469 7665 2072 trix, relative r │ │ │ +000b01f0: 6f74 6174 696f 6e20 616e 6420 7265 6c61 otation and rela │ │ │ +000b0200: 7469 7665 2074 7261 6e73 6c61 7469 6f6e tive translation │ │ │ +000b0210: 2e0a 2020 2020 4d61 7420 452c 2052 2c20 .. Mat E, R, │ │ │ +000b0220: 742c 206d 6173 6b3b 0a0a 2020 2020 7265 t, mask;.. re │ │ │ +000b0230: 636f 7665 7250 6f73 6528 706f 696e 7473 coverPose(points │ │ │ +000b0240: 312c 2070 6f69 6e74 7332 2c20 6361 6d65 1, points2, came │ │ │ +000b0250: 7261 4d61 7472 6978 312c 2064 6973 7443 raMatrix1, distC │ │ │ +000b0260: 6f65 6666 7331 2c20 6361 6d65 7261 4d61 oeffs1, cameraMa │ │ │ +000b0270: 7472 6978 322c 2064 6973 7443 6f65 6666 trix2, distCoeff │ │ │ +000b0280: 7332 2c20 452c 2052 2c20 742c 206d 6173 s2, E, R, t, mas │ │ │ +000b0290: 6b29 3b0a 3c2f 636f 6465 3e3c 2f64 643e k);. │ │ │ +000b02a0: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    automatic │ │ │ +000b02c0: 616c 6c79 2067 656e 6572 6174 6564 3c2f ally generated.
    .
    │ │ │ +000b02e0: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
    .
  • .
  • .
    .

    re │ │ │ +000b03e0: 636f 7665 7250 6f73 653c 2f68 333e 0a3c coverPose

    .< │ │ │ +000b03f0: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +000b0400: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +000b0410: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +000b0420: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +000b0450: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +000b0460: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +000b0470: 726e 2d74 7970 6522 3e69 6e74 3c2f 7370 rn-type">int recoverPose< │ │ │ +000b04b0: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat po │ │ │ +000b0520: 696e 7473 312c 0a20 3c61 2068 7265 663d ints1,. Mat  │ │ │ +000b0570: 3b70 6f69 6e74 7332 2c0a 203c 6120 6872 ;points2,. Mat&n │ │ │ +000b05c0: 6273 703b 6361 6d65 7261 4d61 7472 6978 bsp;cameraMatrix │ │ │ +000b05d0: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ +000b0610: 4d61 743c 2f61 3e26 6e62 7370 3b64 6973 Mat dis │ │ │ +000b0620: 7443 6f65 6666 7331 2c0a 203c 6120 6872 tCoeffs1,. Mat&n │ │ │ +000b0670: 6273 703b 6361 6d65 7261 4d61 7472 6978 bsp;cameraMatrix │ │ │ +000b0680: 322c 0a20 3c61 2068 7265 663d 222e 2e2f 2,. │ │ │ +000b06c0: 4d61 743c 2f61 3e26 6e62 7370 3b64 6973 Mat dis │ │ │ +000b06d0: 7443 6f65 6666 7332 2c0a 203c 6120 6872 tCoeffs2,. Mat&n │ │ │ +000b0720: 6273 703b 452c 0a20 3c61 2068 7265 663d bsp;E,. Mat  │ │ │ -000b0770: 3b64 7374 2c0a 203c 6120 6872 6566 3d22 ;dst,. Mat  │ │ │ -000b07c0: 6f75 742c 0a20 3c61 2068 7265 663d 222e out,. Mat i │ │ │ -000b0810: 6e6c 6965 7273 2c0a 2064 6f75 626c 6526 nliers,. double& │ │ │ -000b0820: 6e62 7370 3b72 616e 7361 6354 6872 6573 nbsp;ransacThres │ │ │ -000b0830: 686f 6c64 293c 2f73 7061 6e3e 3c2f 6469 hold).
    Computes a │ │ │ -000b0860: 6e20 6f70 7469 6d61 6c20 7472 616e 736c n optimal transl │ │ │ -000b0870: 6174 696f 6e20 6265 7477 6565 6e20 7477 ation between tw │ │ │ -000b0880: 6f20 3344 2070 6f69 6e74 2073 6574 732e o 3D point sets. │ │ │ -000b0890: 0a0a 4974 2063 6f6d 7075 7465 730a 5c28 ..It computes.\( │ │ │ -000b08a0: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ -000b08b0: 0a78 5c5c 0a79 5c5c 0a7a 5c5c 0a5c 656e .x\\.y\\.z\\.\en │ │ │ -000b08c0: 647b 626d 6174 7269 787d 0a3d 0a5c 6265 d{bmatrix}.=.\be │ │ │ -000b08d0: 6769 6e7b 626d 6174 7269 787d 0a58 5c5c gin{bmatrix}.X\\ │ │ │ -000b08e0: 0a59 5c5c 0a5a 5c5c 0a5c 656e 647b 626d .Y\\.Z\\.\end{bm │ │ │ -000b08f0: 6174 7269 787d 0a2b 0a5c 6265 6769 6e7b atrix}.+.\begin{ │ │ │ -000b0900: 626d 6174 7269 787d 0a62 5f31 5c5c 0a62 bmatrix}.b_1\\.b │ │ │ -000b0910: 5f32 5c5c 0a62 5f33 5c5c 0a5c 656e 647b _2\\.b_3\\.\end{ │ │ │ -000b0920: 626d 6174 7269 787d 0a5c 293c 2f64 6976 bmatrix}.\)
    .
    .
    Paramet │ │ │ -000b0950: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    src - │ │ │ -000b0970: 2046 6972 7374 2069 6e70 7574 2033 4420 First input 3D │ │ │ -000b0980: 706f 696e 7420 7365 7420 636f 6e74 6169 point set contai │ │ │ -000b0990: 6e69 6e67 205c 2828 582c 592c 5a29 5c29 ning \((X,Y,Z)\) │ │ │ -000b09a0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    dst - Se │ │ │ -000b09c0: 636f 6e64 2069 6e70 7574 2033 4420 706f cond input 3D po │ │ │ -000b09d0: 696e 7420 7365 7420 636f 6e74 6169 6e69 int set containi │ │ │ -000b09e0: 6e67 205c 2828 782c 792c 7a29 5c29 2e3c ng \((x,y,z)\).< │ │ │ -000b09f0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e6f /dd>.
    o │ │ │ -000b0a00: 7574 3c2f 636f 6465 3e20 2d20 4f75 7470 ut - Outp │ │ │ -000b0a10: 7574 2033 4420 7472 616e 736c 6174 696f ut 3D translatio │ │ │ -000b0a20: 6e20 7665 6374 6f72 205c 2833 205c 7469 n vector \(3 \ti │ │ │ -000b0a30: 6d65 7320 315c 2920 6f66 2074 6865 2066 mes 1\) of the f │ │ │ -000b0a40: 6f72 6d0a 5c28 0a5c 6265 6769 6e7b 626d orm.\(.\begin{bm │ │ │ -000b0a50: 6174 7269 787d 0a62 5f31 205c 5c0a 625f atrix}.b_1 \\.b_ │ │ │ -000b0a60: 3220 5c5c 0a62 5f33 205c 5c0a 5c65 6e64 2 \\.b_3 \\.\end │ │ │ -000b0a70: 7b62 6d61 7472 6978 7d0a 5c29 3c2f 6464 {bmatrix}.\)
    .
    inli │ │ │ -000b0a90: 6572 733c 2f63 6f64 653e 202d 204f 7574 ers - Out │ │ │ -000b0aa0: 7075 7420 7665 6374 6f72 2069 6e64 6963 put vector indic │ │ │ -000b0ab0: 6174 696e 6720 7768 6963 6820 706f 696e ating which poin │ │ │ -000b0ac0: 7473 2061 7265 2069 6e6c 6965 7273 2028 ts are inliers ( │ │ │ -000b0ad0: 312d 696e 6c69 6572 2c20 302d 6f75 746c 1-inlier, 0-outl │ │ │ -000b0ae0: 6965 7229 2e3c 2f64 643e 0a3c 6464 3e3c ier).
    .
    < │ │ │ -000b0af0: 636f 6465 3e72 616e 7361 6354 6872 6573 code>ransacThres │ │ │ -000b0b00: 686f 6c64 3c2f 636f 6465 3e20 2d20 4d61 hold - Ma │ │ │ -000b0b10: 7869 6d75 6d20 7265 7072 6f6a 6563 7469 ximum reprojecti │ │ │ -000b0b20: 6f6e 2065 7272 6f72 2069 6e20 7468 6520 on error in the │ │ │ -000b0b30: 5241 4e53 4143 2061 6c67 6f72 6974 686d RANSAC algorithm │ │ │ -000b0b40: 2074 6f20 636f 6e73 6964 6572 2061 2070 to consider a p │ │ │ -000b0b50: 6f69 6e74 2061 730a 616e 2069 6e6c 6965 oint as.an inlie │ │ │ -000b0b60: 722e 0a62 6574 7765 656e 2030 2e39 3520 r..between 0.95 │ │ │ -000b0b70: 616e 6420 302e 3939 2069 7320 7573 7561 and 0.99 is usua │ │ │ -000b0b80: 6c6c 7920 676f 6f64 2065 6e6f 7567 682e lly good enough. │ │ │ -000b0b90: 2056 616c 7565 7320 746f 6f20 636c 6f73 Values too clos │ │ │ -000b0ba0: 6520 746f 2031 2063 616e 2073 6c6f 7720 e to 1 can slow │ │ │ -000b0bb0: 646f 776e 2074 6865 2065 7374 696d 6174 down the estimat │ │ │ -000b0bc0: 696f 6e0a 7369 676e 6966 6963 616e 746c ion.significantl │ │ │ -000b0bd0: 792e 2056 616c 7565 7320 6c6f 7765 7220 y. Values lower │ │ │ -000b0be0: 7468 616e 2030 2e38 2d30 2e39 2063 616e than 0.8-0.9 can │ │ │ -000b0bf0: 2072 6573 756c 7420 696e 2061 6e20 696e result in an in │ │ │ -000b0c00: 636f 7272 6563 746c 7920 6573 7469 6d61 correctly estima │ │ │ -000b0c10: 7465 6420 7472 616e 7366 6f72 6d61 7469 ted transformati │ │ │ -000b0c20: 6f6e 2e3c 2f64 643e 0a3c 6474 3e52 6574 on.
    .
    Ret │ │ │ -000b0c30: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e57 urns:
    .
    W │ │ │ -000b0c40: 6865 7468 6572 2061 2074 7261 6e73 6c61 hether a transla │ │ │ -000b0c50: 7469 6f6e 2077 6173 2066 6f75 6e64 2e0a tion was found.. │ │ │ -000b0c60: 0a54 6865 2066 756e 6374 696f 6e20 6573 .The function es │ │ │ -000b0c70: 7469 6d61 7465 7320 616e 206f 7074 696d timates an optim │ │ │ -000b0c80: 616c 2033 4420 7472 616e 736c 6174 696f al 3D translatio │ │ │ -000b0c90: 6e20 6265 7477 6565 6e20 7477 6f20 3344 n between two 3D │ │ │ -000b0ca0: 2070 6f69 6e74 2073 6574 7320 7573 696e point sets usin │ │ │ -000b0cb0: 6720 7468 650a 5241 4e53 4143 2061 6c67 g the.RANSAC alg │ │ │ -000b0cc0: 6f72 6974 686d 2e3c 2f64 643e 0a3c 2f64 orithm.
    ....
  • .
  • . │ │ │ -000b0cf0: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    estimat │ │ │ -000b0d80: 6554 7261 6e73 6c61 7469 6f6e 3344 3c2f eTranslation3D.
    .
    public │ │ │ -000b0df0: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ -000b0e00: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;bo │ │ │ -000b0e20: 6f6c 6561 6e3c 2f73 7061 6e3e 266e 6273 olean&nbs │ │ │ -000b0e30: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;est │ │ │ -000b0e50: 696d 6174 6554 7261 6e73 6c61 7469 6f6e imateTranslation │ │ │ -000b0e60: 3344 3c2f 7370 616e 3e3c 7762 723e 3c73 3D(Mat  │ │ │ -000b0ed0: 3b73 7263 2c0a 203c 6120 6872 6566 3d22 ;src,. Mat  │ │ │ -000b0f20: 6473 742c 0a20 3c61 2068 7265 663d 222e dst,. Mat o │ │ │ -000b0f70: 7574 2c0a 203c 6120 6872 6566 3d22 2e2e ut,. Mat in │ │ │ -000b0fc0: 6c69 6572 7329 3c2f 7370 616e 3e3c 2f64 liers).
    Computes │ │ │ -000b0ff0: 616e 206f 7074 696d 616c 2074 7261 6e73 an optimal trans │ │ │ -000b1000: 6c61 7469 6f6e 2062 6574 7765 656e 2074 lation between t │ │ │ -000b1010: 776f 2033 4420 706f 696e 7420 7365 7473 wo 3D point sets │ │ │ -000b1020: 2e0a 0a49 7420 636f 6d70 7574 6573 0a5c ...It computes.\ │ │ │ -000b1030: 280a 5c62 6567 696e 7b62 6d61 7472 6978 (.\begin{bmatrix │ │ │ -000b1040: 7d0a 785c 5c0a 795c 5c0a 7a5c 5c0a 5c65 }.x\\.y\\.z\\.\e │ │ │ -000b1050: 6e64 7b62 6d61 7472 6978 7d0a 3d0a 5c62 nd{bmatrix}.=.\b │ │ │ -000b1060: 6567 696e 7b62 6d61 7472 6978 7d0a 585c egin{bmatrix}.X\ │ │ │ -000b1070: 5c0a 595c 5c0a 5a5c 5c0a 5c65 6e64 7b62 \.Y\\.Z\\.\end{b │ │ │ -000b1080: 6d61 7472 6978 7d0a 2b0a 5c62 6567 696e matrix}.+.\begin │ │ │ -000b1090: 7b62 6d61 7472 6978 7d0a 625f 315c 5c0a {bmatrix}.b_1\\. │ │ │ -000b10a0: 625f 325c 5c0a 625f 335c 5c0a 5c65 6e64 b_2\\.b_3\\.\end │ │ │ -000b10b0: 7b62 6d61 7472 6978 7d0a 5c29 3c2f 6469 {bmatrix}.\).
    .
    Parame │ │ │ -000b10e0: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ -000b10f0: 636f 6465 3e73 7263 3c2f 636f 6465 3e20 code>src │ │ │ -000b1100: 2d20 4669 7273 7420 696e 7075 7420 3344 - First input 3D │ │ │ -000b1110: 2070 6f69 6e74 2073 6574 2063 6f6e 7461 point set conta │ │ │ -000b1120: 696e 696e 6720 5c28 2858 2c59 2c5a 295c ining \((X,Y,Z)\ │ │ │ -000b1130: 292e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 ).
    .
    dst - S │ │ │ -000b1150: 6563 6f6e 6420 696e 7075 7420 3344 2070 econd input 3D p │ │ │ -000b1160: 6f69 6e74 2073 6574 2063 6f6e 7461 696e oint set contain │ │ │ -000b1170: 696e 6720 5c28 2878 2c79 2c7a 295c 292e ing \((x,y,z)\). │ │ │ -000b1180: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000b1190: 6f75 743c 2f63 6f64 653e 202d 204f 7574 out - Out │ │ │ -000b11a0: 7075 7420 3344 2074 7261 6e73 6c61 7469 put 3D translati │ │ │ -000b11b0: 6f6e 2076 6563 746f 7220 5c28 3320 5c74 on vector \(3 \t │ │ │ -000b11c0: 696d 6573 2031 5c29 206f 6620 7468 6520 imes 1\) of the │ │ │ -000b11d0: 666f 726d 0a5c 280a 5c62 6567 696e 7b62 form.\(.\begin{b │ │ │ -000b11e0: 6d61 7472 6978 7d0a 625f 3120 5c5c 0a62 matrix}.b_1 \\.b │ │ │ -000b11f0: 5f32 205c 5c0a 625f 3320 5c5c 0a5c 656e _2 \\.b_3 \\.\en │ │ │ -000b1200: 647b 626d 6174 7269 787d 0a5c 293c 2f64 d{bmatrix}.\).
    inl │ │ │ -000b1220: 6965 7273 3c2f 636f 6465 3e20 2d20 4f75 iers - Ou │ │ │ -000b1230: 7470 7574 2076 6563 746f 7220 696e 6469 tput vector indi │ │ │ -000b1240: 6361 7469 6e67 2077 6869 6368 2070 6f69 cating which poi │ │ │ -000b1250: 6e74 7320 6172 6520 696e 6c69 6572 7320 nts are inliers │ │ │ -000b1260: 2831 2d69 6e6c 6965 722c 2030 2d6f 7574 (1-inlier, 0-out │ │ │ -000b1270: 6c69 6572 292e 0a61 6e20 696e 6c69 6572 lier)..an inlier │ │ │ -000b1280: 2e0a 6265 7477 6565 6e20 302e 3935 2061 ..between 0.95 a │ │ │ -000b1290: 6e64 2030 2e39 3920 6973 2075 7375 616c nd 0.99 is usual │ │ │ -000b12a0: 6c79 2067 6f6f 6420 656e 6f75 6768 2e20 ly good enough. │ │ │ -000b12b0: 5661 6c75 6573 2074 6f6f 2063 6c6f 7365 Values too close │ │ │ -000b12c0: 2074 6f20 3120 6361 6e20 736c 6f77 2064 to 1 can slow d │ │ │ -000b12d0: 6f77 6e20 7468 6520 6573 7469 6d61 7469 own the estimati │ │ │ -000b12e0: 6f6e 0a73 6967 6e69 6669 6361 6e74 6c79 on.significantly │ │ │ -000b12f0: 2e20 5661 6c75 6573 206c 6f77 6572 2074 . Values lower t │ │ │ -000b1300: 6861 6e20 302e 382d 302e 3920 6361 6e20 han 0.8-0.9 can │ │ │ -000b1310: 7265 7375 6c74 2069 6e20 616e 2069 6e63 result in an inc │ │ │ -000b1320: 6f72 7265 6374 6c79 2065 7374 696d 6174 orrectly estimat │ │ │ -000b1330: 6564 2074 7261 6e73 666f 726d 6174 696f ed transformatio │ │ │ -000b1340: 6e2e 3c2f 6464 3e0a 3c64 743e 5265 7475 n.
    .
    Retu │ │ │ -000b1350: 726e 733a 3c2f 6474 3e0a 3c64 643e 5768 rns:
    .
    Wh │ │ │ -000b1360: 6574 6865 7220 6120 7472 616e 736c 6174 ether a translat │ │ │ -000b1370: 696f 6e20 7761 7320 666f 756e 642e 0a0a ion was found... │ │ │ -000b1380: 5468 6520 6675 6e63 7469 6f6e 2065 7374 The function est │ │ │ -000b1390: 696d 6174 6573 2061 6e20 6f70 7469 6d61 imates an optima │ │ │ -000b13a0: 6c20 3344 2074 7261 6e73 6c61 7469 6f6e l 3D translation │ │ │ -000b13b0: 2062 6574 7765 656e 2074 776f 2033 4420 between two 3D │ │ │ -000b13c0: 706f 696e 7420 7365 7473 2075 7369 6e67 point sets using │ │ │ -000b13d0: 2074 6865 0a52 414e 5341 4320 616c 676f the.RANSAC algo │ │ │ -000b13e0: 7269 7468 6d2e 3c2f 6464 3e0a 3c2f 646c rithm.
    .
    .
    ..

  • .
  • .< │ │ │ -000b1410: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ -000b1420: 6574 6169 6c22 2069 643d 2265 7374 696d etail" id="estim │ │ │ -000b1430: 6174 6541 6666 696e 6532 4428 6f72 672e ateAffine2D(org. │ │ │ -000b1440: 6f70 656e 6376 2e63 6f72 652e 4d61 742c opencv.core.Mat, │ │ │ -000b1450: 6f72 672e 6f70 656e 6376 2e63 6f72 652e org.opencv.core. │ │ │ -000b1460: 4d61 742c 6f72 672e 6f70 656e 6376 2e63 Mat,org.opencv.c │ │ │ -000b1470: 6f72 652e 4d61 742c 696e 742c 646f 7562 ore.Mat,int,doub │ │ │ -000b1480: 6c65 2c6c 6f6e 672c 646f 7562 6c65 2c6c le,long,double,l │ │ │ -000b1490: 6f6e 6729 223e 0a3c 6833 3e65 7374 696d ong)">.

    estim │ │ │ -000b14a0: 6174 6541 6666 696e 6532 443c 2f68 333e ateAffine2D

    │ │ │ -000b14b0: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ -000b14d0: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ -000b14f0: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ -000b1500: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ -000b1510: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ -000b1520: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;Mat estimateAf │ │ │ -000b15b0: 6669 6e65 3244 3c2f 7370 616e 3e3c 7762 fine2D(Mat& │ │ │ -000b1620: 6e62 7370 3b66 726f 6d2c 0a20 3c61 2068 nbsp;from,. Mat& │ │ │ -000b1670: 6e62 7370 3b74 6f2c 0a20 3c61 2068 7265 nbsp;to,. Mat&nb │ │ │ -000b16c0: 7370 3b69 6e6c 6965 7273 2c0a 2069 6e74 sp;inliers,. int │ │ │ -000b16d0: 266e 6273 703b 6d65 7468 6f64 2c0a 2064  method,. d │ │ │ -000b16e0: 6f75 626c 6526 6e62 7370 3b72 616e 7361 ouble ransa │ │ │ -000b16f0: 6352 6570 726f 6a54 6872 6573 686f 6c64 cReprojThreshold │ │ │ -000b1700: 2c0a 206c 6f6e 6726 6e62 7370 3b6d 6178 ,. long max │ │ │ -000b1710: 4974 6572 732c 0a20 646f 7562 6c65 266e Iters,. double&n │ │ │ -000b1720: 6273 703b 636f 6e66 6964 656e 6365 2c0a bsp;confidence,. │ │ │ -000b1730: 206c 6f6e 6726 6e62 7370 3b72 6566 696e long refin │ │ │ -000b1740: 6549 7465 7273 293c 2f73 7061 6e3e 3c2f eIters).
    Computes │ │ │ -000b1770: 2061 6e20 6f70 7469 6d61 6c20 6166 6669 an optimal affi │ │ │ -000b1780: 6e65 2074 7261 6e73 666f 726d 6174 696f ne transformatio │ │ │ -000b1790: 6e20 6265 7477 6565 6e20 7477 6f20 3244 n between two 2D │ │ │ -000b17a0: 2070 6f69 6e74 2073 6574 732e 0a0a 4974 point sets...It │ │ │ -000b17b0: 2063 6f6d 7075 7465 730a 5c28 0a5c 6265 computes.\(.\be │ │ │ -000b17c0: 6769 6e7b 626d 6174 7269 787d 0a78 5c5c gin{bmatrix}.x\\ │ │ │ -000b17d0: 0a79 5c5c 0a5c 656e 647b 626d 6174 7269 .y\\.\end{bmatri │ │ │ -000b17e0: 787d 0a3d 0a5c 6265 6769 6e7b 626d 6174 x}.=.\begin{bmat │ │ │ -000b17f0: 7269 787d 0a61 5f7b 3131 7d20 2661 6d70 rix}.a_{11} & │ │ │ -000b1800: 3b20 615f 7b31 327d 5c5c 0a61 5f7b 3231 ; a_{12}\\.a_{21 │ │ │ -000b1810: 7d20 2661 6d70 3b20 615f 7b32 327d 5c5c } & a_{22}\\ │ │ │ -000b1820: 0a5c 656e 647b 626d 6174 7269 787d 0a5c .\end{bmatrix}.\ │ │ │ -000b1830: 6265 6769 6e7b 626d 6174 7269 787d 0a58 begin{bmatrix}.X │ │ │ -000b1840: 5c5c 0a59 5c5c 0a5c 656e 647b 626d 6174 \\.Y\\.\end{bmat │ │ │ -000b1850: 7269 787d 0a2b 0a5c 6265 6769 6e7b 626d rix}.+.\begin{bm │ │ │ -000b1860: 6174 7269 787d 0a62 5f31 5c5c 0a62 5f32 atrix}.b_1\\.b_2 │ │ │ -000b1870: 5c5c 0a5c 656e 647b 626d 6174 7269 787d \\.\end{bmatrix} │ │ │ -000b1880: 0a5c 293c 2f64 6976 3e0a 3c64 6c20 636c .\)
    .
    .
    Parameters:
    .
    from │ │ │ -000b18c0: 3c2f 636f 6465 3e20 2d20 4669 7273 7420 - First │ │ │ -000b18d0: 696e 7075 7420 3244 2070 6f69 6e74 2073 input 2D point s │ │ │ -000b18e0: 6574 2063 6f6e 7461 696e 696e 6720 5c28 et containing \( │ │ │ -000b18f0: 2858 2c59 295c 292e 3c2f 6464 3e0a 3c64 (X,Y)\).
    .to - Second input │ │ │ -000b1920: 2032 4420 706f 696e 7420 7365 7420 636f 2D point set co │ │ │ -000b1930: 6e74 6169 6e69 6e67 205c 2828 782c 7929 ntaining \((x,y) │ │ │ -000b1940: 5c29 2e3c 2f64 643e 0a3c 6464 3e3c 636f \)..
    inliers - Output vecto │ │ │ -000b1970: 7220 696e 6469 6361 7469 6e67 2077 6869 r indicating whi │ │ │ -000b1980: 6368 2070 6f69 6e74 7320 6172 6520 696e ch points are in │ │ │ -000b1990: 6c69 6572 7320 2831 2d69 6e6c 6965 722c liers (1-inlier, │ │ │ -000b19a0: 2030 2d6f 7574 6c69 6572 292e 3c2f 6464 0-outlier).
    .
    meth │ │ │ -000b19c0: 6f64 3c2f 636f 6465 3e20 2d20 526f 6275 od - Robu │ │ │ -000b19d0: 7374 206d 6574 686f 6420 7573 6564 2074 st method used t │ │ │ -000b19e0: 6f20 636f 6d70 7574 6520 7472 616e 7366 o compute transf │ │ │ -000b19f0: 6f72 6d61 7469 6f6e 2e20 5468 6520 666f ormation. The fo │ │ │ -000b1a00: 6c6c 6f77 696e 6720 6d65 7468 6f64 7320 llowing methods │ │ │ -000b1a10: 6172 6520 706f 7373 6962 6c65 3a0a 3c75 are possible:..
  • . REF │ │ │ -000b1a30: 3a20 5241 4e53 4143 202d 2052 414e 5341 : RANSAC - RANSA │ │ │ -000b1a40: 432d 6261 7365 6420 726f 6275 7374 206d C-based robust m │ │ │ -000b1a50: 6574 686f 640a 2020 3c2f 6c69 3e0a 2020 ethod.
  • . │ │ │ -000b1a60: 3c6c 693e 0a20 2020 5245 463a 204c 4d45
  • . REF: LME │ │ │ -000b1a70: 4453 202d 204c 6561 7374 2d4d 6564 6961 DS - Least-Media │ │ │ -000b1a80: 6e20 726f 6275 7374 206d 6574 686f 640a n robust method. │ │ │ -000b1a90: 5241 4e53 4143 2069 7320 7468 6520 6465 RANSAC is the de │ │ │ -000b1aa0: 6661 756c 7420 6d65 7468 6f64 2e0a 2020 fault method.. │ │ │ -000b1ab0: 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64 643e
  • .
    │ │ │ -000b1ac0: 0a3c 6464 3e3c 636f 6465 3e72 616e 7361 .
    ransa │ │ │ -000b1ad0: 6352 6570 726f 6a54 6872 6573 686f 6c64 cReprojThreshold │ │ │ -000b1ae0: 3c2f 636f 6465 3e20 2d20 4d61 7869 6d75 - Maximu │ │ │ -000b1af0: 6d20 7265 7072 6f6a 6563 7469 6f6e 2065 m reprojection e │ │ │ -000b1b00: 7272 6f72 2069 6e20 7468 6520 5241 4e53 rror in the RANS │ │ │ -000b1b10: 4143 2061 6c67 6f72 6974 686d 2074 6f20 AC algorithm to │ │ │ -000b1b20: 636f 6e73 6964 6572 0a61 2070 6f69 6e74 consider.a point │ │ │ -000b1b30: 2061 7320 616e 2069 6e6c 6965 722e 2041 as an inlier. A │ │ │ -000b1b40: 7070 6c69 6573 206f 6e6c 7920 746f 2052 pplies only to R │ │ │ -000b1b50: 414e 5341 432e 3c2f 6464 3e0a 3c64 643e ANSAC.
    .
    │ │ │ -000b1b60: 3c63 6f64 653e 6d61 7849 7465 7273 3c2f maxIters - The maxi │ │ │ -000b1b80: 6d75 6d20 6e75 6d62 6572 206f 6620 726f mum number of ro │ │ │ -000b1b90: 6275 7374 206d 6574 686f 6420 6974 6572 bust method iter │ │ │ -000b1ba0: 6174 696f 6e73 2e3c 2f64 643e 0a3c 6464 ations.
    .
    confidenc │ │ │ -000b1bc0: 653c 2f63 6f64 653e 202d 2043 6f6e 6669 e - Confi │ │ │ -000b1bd0: 6465 6e63 6520 6c65 7665 6c2c 2062 6574 dence level, bet │ │ │ -000b1be0: 7765 656e 2030 2061 6e64 2031 2c20 666f ween 0 and 1, fo │ │ │ -000b1bf0: 7220 7468 6520 6573 7469 6d61 7465 6420 r the estimated │ │ │ -000b1c00: 7472 616e 7366 6f72 6d61 7469 6f6e 2e20 transformation. │ │ │ -000b1c10: 416e 7974 6869 6e67 0a62 6574 7765 656e Anything.between │ │ │ -000b1c20: 2030 2e39 3520 616e 6420 302e 3939 2069 0.95 and 0.99 i │ │ │ -000b1c30: 7320 7573 7561 6c6c 7920 676f 6f64 2065 s usually good e │ │ │ -000b1c40: 6e6f 7567 682e 2056 616c 7565 7320 746f nough. Values to │ │ │ -000b1c50: 6f20 636c 6f73 6520 746f 2031 2063 616e o close to 1 can │ │ │ -000b1c60: 2073 6c6f 7720 646f 776e 2074 6865 2065 slow down the e │ │ │ -000b1c70: 7374 696d 6174 696f 6e0a 7369 676e 6966 stimation.signif │ │ │ -000b1c80: 6963 616e 746c 792e 2056 616c 7565 7320 icantly. Values │ │ │ -000b1c90: 6c6f 7765 7220 7468 616e 2030 2e38 2d30 lower than 0.8-0 │ │ │ -000b1ca0: 2e39 2063 616e 2072 6573 756c 7420 696e .9 can result in │ │ │ -000b1cb0: 2061 6e20 696e 636f 7272 6563 746c 7920 an incorrectly │ │ │ -000b1cc0: 6573 7469 6d61 7465 6420 7472 616e 7366 estimated transf │ │ │ -000b1cd0: 6f72 6d61 7469 6f6e 2e3c 2f64 643e 0a3c ormation.
    .< │ │ │ -000b1ce0: 6464 3e3c 636f 6465 3e72 6566 696e 6549 dd>refineI │ │ │ -000b1cf0: 7465 7273 3c2f 636f 6465 3e20 2d20 4d61 ters - Ma │ │ │ -000b1d00: 7869 6d75 6d20 6e75 6d62 6572 206f 6620 ximum number of │ │ │ -000b1d10: 6974 6572 6174 696f 6e73 206f 6620 7265 iterations of re │ │ │ -000b1d20: 6669 6e69 6e67 2061 6c67 6f72 6974 686d fining algorithm │ │ │ -000b1d30: 2028 4c65 7665 6e62 6572 672d 4d61 7271 (Levenberg-Marq │ │ │ -000b1d40: 7561 7264 7429 2e0a 5061 7373 696e 6720 uardt)..Passing │ │ │ -000b1d50: 3020 7769 6c6c 2064 6973 6162 6c65 2072 0 will disable r │ │ │ -000b1d60: 6566 696e 696e 672c 2073 6f20 7468 6520 efining, so the │ │ │ -000b1d70: 6f75 7470 7574 206d 6174 7269 7820 7769 output matrix wi │ │ │ -000b1d80: 6c6c 2062 6520 6f75 7470 7574 206f 6620 ll be output of │ │ │ -000b1d90: 726f 6275 7374 206d 6574 686f 642e 3c2f robust method..
    Returns: │ │ │ -000b1db0: 3c2f 6474 3e0a 3c64 643e 4f75 7470 7574
    .
    Output │ │ │ -000b1dc0: 2032 4420 6166 6669 6e65 2074 7261 6e73 2D affine trans │ │ │ -000b1dd0: 666f 726d 6174 696f 6e20 6d61 7472 6978 formation matrix │ │ │ -000b1de0: 205c 2832 205c 7469 6d65 7320 335c 2920 \(2 \times 3\) │ │ │ -000b1df0: 6f72 2065 6d70 7479 206d 6174 7269 7820 or empty matrix │ │ │ -000b1e00: 6966 2074 7261 6e73 666f 726d 6174 696f if transformatio │ │ │ -000b1e10: 6e0a 636f 756c 6420 6e6f 7420 6265 2065 n.could not be e │ │ │ -000b1e20: 7374 696d 6174 6564 2e20 5468 6520 7265 stimated. The re │ │ │ -000b1e30: 7475 726e 6564 206d 6174 7269 7820 6861 turned matrix ha │ │ │ -000b1e40: 7320 7468 6520 666f 6c6c 6f77 696e 6720 s the following │ │ │ -000b1e50: 666f 726d 3a0a 5c28 0a5c 6265 6769 6e7b form:.\(.\begin{ │ │ │ -000b1e60: 626d 6174 7269 787d 0a61 5f7b 3131 7d20 bmatrix}.a_{11} │ │ │ -000b1e70: 2661 6d70 3b20 615f 7b31 327d 2026 616d & a_{12} &am │ │ │ -000b1e80: 703b 2062 5f31 5c5c 0a61 5f7b 3231 7d20 p; b_1\\.a_{21} │ │ │ -000b1e90: 2661 6d70 3b20 615f 7b32 327d 2026 616d & a_{22} &am │ │ │ -000b1ea0: 703b 2062 5f32 5c5c 0a5c 656e 647b 626d p; b_2\\.\end{bm │ │ │ -000b1eb0: 6174 7269 787d 0a5c 290a 0a54 6865 2066 atrix}.\)..The f │ │ │ -000b1ec0: 756e 6374 696f 6e20 6573 7469 6d61 7465 unction estimate │ │ │ -000b1ed0: 7320 616e 206f 7074 696d 616c 2032 4420 s an optimal 2D │ │ │ -000b1ee0: 6166 6669 6e65 2074 7261 6e73 666f 726d affine transform │ │ │ -000b1ef0: 6174 696f 6e20 6265 7477 6565 6e20 7477 ation between tw │ │ │ -000b1f00: 6f20 3244 2070 6f69 6e74 2073 6574 7320 o 2D point sets │ │ │ -000b1f10: 7573 696e 6720 7468 650a 7365 6c65 6374 using the.select │ │ │ -000b1f20: 6564 2072 6f62 7573 7420 616c 676f 7269 ed robust algori │ │ │ -000b1f30: 7468 6d2e 0a0a 5468 6520 636f 6d70 7574 thm...The comput │ │ │ -000b1f40: 6564 2074 7261 6e73 666f 726d 6174 696f ed transformatio │ │ │ -000b1f50: 6e20 6973 2074 6865 6e20 7265 6669 6e65 n is then refine │ │ │ -000b1f60: 6420 6675 7274 6865 7220 2875 7369 6e67 d further (using │ │ │ -000b1f70: 206f 6e6c 7920 696e 6c69 6572 7329 2077 only inliers) w │ │ │ -000b1f80: 6974 6820 7468 650a 4c65 7665 6e62 6572 ith the.Levenber │ │ │ -000b1f90: 672d 4d61 7271 7561 7264 7420 6d65 7468 g-Marquardt meth │ │ │ -000b1fa0: 6f64 2074 6f20 7265 6475 6365 2074 6865 od to reduce the │ │ │ -000b1fb0: 2072 652d 7072 6f6a 6563 7469 6f6e 2065 re-projection e │ │ │ -000b1fc0: 7272 6f72 2065 7665 6e20 6d6f 7265 2e0a rror even more.. │ │ │ -000b1fd0: 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a 5468 .Note:.Th │ │ │ -000b1fe0: 6520 5241 4e53 4143 206d 6574 686f 6420 e RANSAC method │ │ │ -000b1ff0: 6361 6e20 6861 6e64 6c65 2070 7261 6374 can handle pract │ │ │ -000b2000: 6963 616c 6c79 2061 6e79 2072 6174 696f ically any ratio │ │ │ -000b2010: 206f 6620 6f75 746c 6965 7273 2062 7574 of outliers but │ │ │ -000b2020: 206e 6565 6473 2061 2074 6872 6573 686f needs a thresho │ │ │ -000b2030: 6c64 2074 6f0a 6469 7374 696e 6775 6973 ld to.distinguis │ │ │ -000b2040: 6820 696e 6c69 6572 7320 6672 6f6d 206f h inliers from o │ │ │ -000b2050: 7574 6c69 6572 732e 2054 6865 206d 6574 utliers. The met │ │ │ -000b2060: 686f 6420 4c4d 6544 5320 646f 6573 206e hod LMeDS does n │ │ │ -000b2070: 6f74 206e 6565 6420 616e 7920 7468 7265 ot need any thre │ │ │ -000b2080: 7368 6f6c 6420 6275 7420 6974 2077 6f72 shold but it wor │ │ │ -000b2090: 6b73 0a63 6f72 7265 6374 6c79 206f 6e6c ks.correctly onl │ │ │ -000b20a0: 7920 7768 656e 2074 6865 7265 2061 7265 y when there are │ │ │ -000b20b0: 206d 6f72 6520 7468 616e 2035 3025 206f more than 50% o │ │ │ -000b20c0: 6620 696e 6c69 6572 732e 0a0a 5345 453a f inliers...SEE: │ │ │ -000b20d0: 2065 7374 696d 6174 6541 6666 696e 6550 estimateAffineP │ │ │ -000b20e0: 6172 7469 616c 3244 2c20 6765 7441 6666 artial2D, getAff │ │ │ -000b20f0: 696e 6554 7261 6e73 666f 726d 3c2f 6464 ineTransform
    .
    .
    .< │ │ │ -000b2110: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ -000b2120: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    esti │ │ │ -000b21b0: 6d61 7465 4166 6669 6e65 3244 3c2f 6833 mateAffine2D

    .
    .
    │ │ │ -000b2200: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -000b2220: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -000b2230: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;Mat< │ │ │ -000b2290: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> estimateA │ │ │ -000b22c0: 6666 696e 6532 443c 2f73 7061 6e3e 3c77 ffine2D(Mat │ │ │ -000b2330: 266e 6273 703b 6672 6f6d 2c0a 203c 6120  from,. Mat │ │ │ -000b2380: 266e 6273 703b 746f 2c0a 203c 6120 6872  to,. Mat&n │ │ │ -000b23d0: 6273 703b 696e 6c69 6572 732c 0a20 696e bsp;inliers,. in │ │ │ -000b23e0: 7426 6e62 7370 3b6d 6574 686f 642c 0a20 t method,. │ │ │ -000b23f0: 646f 7562 6c65 266e 6273 703b 7261 6e73 double rans │ │ │ -000b2400: 6163 5265 7072 6f6a 5468 7265 7368 6f6c acReprojThreshol │ │ │ -000b2410: 642c 0a20 6c6f 6e67 266e 6273 703b 6d61 d,. long ma │ │ │ -000b2420: 7849 7465 7273 2c0a 2064 6f75 626c 6526 xIters,. double& │ │ │ -000b2430: 6e62 7370 3b63 6f6e 6669 6465 6e63 6529 nbsp;confidence) │ │ │ -000b2440: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Computes an opt │ │ │ -000b2470: 696d 616c 2061 6666 696e 6520 7472 616e imal affine tran │ │ │ -000b2480: 7366 6f72 6d61 7469 6f6e 2062 6574 7765 sformation betwe │ │ │ -000b2490: 656e 2074 776f 2032 4420 706f 696e 7420 en two 2D point │ │ │ -000b24a0: 7365 7473 2e0a 0a49 7420 636f 6d70 7574 sets...It comput │ │ │ -000b24b0: 6573 0a5c 280a 5c62 6567 696e 7b62 6d61 es.\(.\begin{bma │ │ │ -000b24c0: 7472 6978 7d0a 785c 5c0a 795c 5c0a 5c65 trix}.x\\.y\\.\e │ │ │ -000b24d0: 6e64 7b62 6d61 7472 6978 7d0a 3d0a 5c62 nd{bmatrix}.=.\b │ │ │ -000b24e0: 6567 696e 7b62 6d61 7472 6978 7d0a 615f egin{bmatrix}.a_ │ │ │ -000b24f0: 7b31 317d 2026 616d 703b 2061 5f7b 3132 {11} & a_{12 │ │ │ -000b2500: 7d5c 5c0a 615f 7b32 317d 2026 616d 703b }\\.a_{21} & │ │ │ -000b2510: 2061 5f7b 3232 7d5c 5c0a 5c65 6e64 7b62 a_{22}\\.\end{b │ │ │ -000b2520: 6d61 7472 6978 7d0a 5c62 6567 696e 7b62 matrix}.\begin{b │ │ │ -000b2530: 6d61 7472 6978 7d0a 585c 5c0a 595c 5c0a matrix}.X\\.Y\\. │ │ │ -000b2540: 5c65 6e64 7b62 6d61 7472 6978 7d0a 2b0a \end{bmatrix}.+. │ │ │ -000b2550: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ -000b2560: 625f 315c 5c0a 625f 325c 5c0a 5c65 6e64 b_1\\.b_2\\.\end │ │ │ -000b2570: 7b62 6d61 7472 6978 7d0a 5c29 3c2f 6469 {bmatrix}.\).
    .
    Parame │ │ │ -000b25a0: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ -000b25b0: 636f 6465 3e66 726f 6d3c 2f63 6f64 653e code>from │ │ │ -000b25c0: 202d 2046 6972 7374 2069 6e70 7574 2032 - First input 2 │ │ │ -000b25d0: 4420 706f 696e 7420 7365 7420 636f 6e74 D point set cont │ │ │ -000b25e0: 6169 6e69 6e67 205c 2828 582c 5929 5c29 aining \((X,Y)\) │ │ │ -000b25f0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    to - Sec │ │ │ -000b2610: 6f6e 6420 696e 7075 7420 3244 2070 6f69 ond input 2D poi │ │ │ -000b2620: 6e74 2073 6574 2063 6f6e 7461 696e 696e nt set containin │ │ │ -000b2630: 6720 5c28 2878 2c79 295c 292e 3c2f 6464 g \((x,y)\).
    .
    inli │ │ │ -000b2650: 6572 733c 2f63 6f64 653e 202d 204f 7574 ers - Out │ │ │ -000b2660: 7075 7420 7665 6374 6f72 2069 6e64 6963 put vector indic │ │ │ -000b2670: 6174 696e 6720 7768 6963 6820 706f 696e ating which poin │ │ │ -000b2680: 7473 2061 7265 2069 6e6c 6965 7273 2028 ts are inliers ( │ │ │ -000b2690: 312d 696e 6c69 6572 2c20 302d 6f75 746c 1-inlier, 0-outl │ │ │ -000b26a0: 6965 7229 2e3c 2f64 643e 0a3c 6464 3e3c ier).
    .
    < │ │ │ -000b26b0: 636f 6465 3e6d 6574 686f 643c 2f63 6f64 code>method - Robust meth │ │ │ -000b26d0: 6f64 2075 7365 6420 746f 2063 6f6d 7075 od used to compu │ │ │ -000b26e0: 7465 2074 7261 6e73 666f 726d 6174 696f te transformatio │ │ │ -000b26f0: 6e2e 2054 6865 2066 6f6c 6c6f 7769 6e67 n. The following │ │ │ -000b2700: 206d 6574 686f 6473 2061 7265 2070 6f73 methods are pos │ │ │ -000b2710: 7369 626c 653a 0a3c 756c 3e0a 2020 3c6c sible:.
      . . REF: RANSA │ │ │ -000b2730: 4320 2d20 5241 4e53 4143 2d62 6173 6564 C - RANSAC-based │ │ │ -000b2740: 2072 6f62 7573 7420 6d65 7468 6f64 0a20 robust method. │ │ │ -000b2750: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020 .
    • . │ │ │ -000b2760: 2052 4546 3a20 4c4d 4544 5320 2d20 4c65 REF: LMEDS - Le │ │ │ -000b2770: 6173 742d 4d65 6469 616e 2072 6f62 7573 ast-Median robus │ │ │ -000b2780: 7420 6d65 7468 6f64 0a52 414e 5341 4320 t method.RANSAC │ │ │ -000b2790: 6973 2074 6865 2064 6566 6175 6c74 206d is the default m │ │ │ -000b27a0: 6574 686f 642e 0a20 203c 2f6c 693e 0a3c ethod..
    • .< │ │ │ -000b27b0: 2f75 6c3e 3c2f 6464 3e0a 3c64 643e 3c63 /ul>
    .
    ransacReproj │ │ │ -000b27d0: 5468 7265 7368 6f6c 643c 2f63 6f64 653e Threshold │ │ │ -000b27e0: 202d 204d 6178 696d 756d 2072 6570 726f - Maximum repro │ │ │ -000b27f0: 6a65 6374 696f 6e20 6572 726f 7220 696e jection error in │ │ │ -000b2800: 2074 6865 2052 414e 5341 4320 616c 676f the RANSAC algo │ │ │ -000b2810: 7269 7468 6d20 746f 2063 6f6e 7369 6465 rithm to conside │ │ │ -000b2820: 720a 6120 706f 696e 7420 6173 2061 6e20 r.a point as an │ │ │ -000b2830: 696e 6c69 6572 2e20 4170 706c 6965 7320 inlier. Applies │ │ │ -000b2840: 6f6e 6c79 2074 6f20 5241 4e53 4143 2e3c only to RANSAC.< │ │ │ -000b2850: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e6d /dd>.
    m │ │ │ -000b2860: 6178 4974 6572 733c 2f63 6f64 653e 202d axIters - │ │ │ -000b2870: 2054 6865 206d 6178 696d 756d 206e 756d The maximum num │ │ │ -000b2880: 6265 7220 6f66 2072 6f62 7573 7420 6d65 ber of robust me │ │ │ -000b2890: 7468 6f64 2069 7465 7261 7469 6f6e 732e thod iterations. │ │ │ -000b28a0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000b28b0: 636f 6e66 6964 656e 6365 3c2f 636f 6465 confidence - Confidence l │ │ │ -000b28d0: 6576 656c 2c20 6265 7477 6565 6e20 3020 evel, between 0 │ │ │ -000b28e0: 616e 6420 312c 2066 6f72 2074 6865 2065 and 1, for the e │ │ │ -000b28f0: 7374 696d 6174 6564 2074 7261 6e73 666f stimated transfo │ │ │ -000b2900: 726d 6174 696f 6e2e 2041 6e79 7468 696e rmation. Anythin │ │ │ -000b2910: 670a 6265 7477 6565 6e20 302e 3935 2061 g.between 0.95 a │ │ │ -000b2920: 6e64 2030 2e39 3920 6973 2075 7375 616c nd 0.99 is usual │ │ │ -000b2930: 6c79 2067 6f6f 6420 656e 6f75 6768 2e20 ly good enough. │ │ │ -000b2940: 5661 6c75 6573 2074 6f6f 2063 6c6f 7365 Values too close │ │ │ -000b2950: 2074 6f20 3120 6361 6e20 736c 6f77 2064 to 1 can slow d │ │ │ -000b2960: 6f77 6e20 7468 6520 6573 7469 6d61 7469 own the estimati │ │ │ -000b2970: 6f6e 0a73 6967 6e69 6669 6361 6e74 6c79 on.significantly │ │ │ -000b2980: 2e20 5661 6c75 6573 206c 6f77 6572 2074 . Values lower t │ │ │ -000b2990: 6861 6e20 302e 382d 302e 3920 6361 6e20 han 0.8-0.9 can │ │ │ -000b29a0: 7265 7375 6c74 2069 6e20 616e 2069 6e63 result in an inc │ │ │ -000b29b0: 6f72 7265 6374 6c79 2065 7374 696d 6174 orrectly estimat │ │ │ -000b29c0: 6564 2074 7261 6e73 666f 726d 6174 696f ed transformatio │ │ │ -000b29d0: 6e2e 0a50 6173 7369 6e67 2030 2077 696c n..Passing 0 wil │ │ │ -000b29e0: 6c20 6469 7361 626c 6520 7265 6669 6e69 l disable refini │ │ │ -000b29f0: 6e67 2c20 736f 2074 6865 206f 7574 7075 ng, so the outpu │ │ │ -000b2a00: 7420 6d61 7472 6978 2077 696c 6c20 6265 t matrix will be │ │ │ -000b2a10: 206f 7574 7075 7420 6f66 2072 6f62 7573 output of robus │ │ │ -000b2a20: 7420 6d65 7468 6f64 2e3c 2f64 643e 0a3c t method.
    .< │ │ │ -000b2a30: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ -000b2a40: 0a3c 6464 3e4f 7574 7075 7420 3244 2061 .
    Output 2D a │ │ │ -000b2a50: 6666 696e 6520 7472 616e 7366 6f72 6d61 ffine transforma │ │ │ -000b2a60: 7469 6f6e 206d 6174 7269 7820 5c28 3220 tion matrix \(2 │ │ │ -000b2a70: 5c74 696d 6573 2033 5c29 206f 7220 656d \times 3\) or em │ │ │ -000b2a80: 7074 7920 6d61 7472 6978 2069 6620 7472 pty matrix if tr │ │ │ -000b2a90: 616e 7366 6f72 6d61 7469 6f6e 0a63 6f75 ansformation.cou │ │ │ -000b2aa0: 6c64 206e 6f74 2062 6520 6573 7469 6d61 ld not be estima │ │ │ -000b2ab0: 7465 642e 2054 6865 2072 6574 7572 6e65 ted. The returne │ │ │ -000b2ac0: 6420 6d61 7472 6978 2068 6173 2074 6865 d matrix has the │ │ │ -000b2ad0: 2066 6f6c 6c6f 7769 6e67 2066 6f72 6d3a following form: │ │ │ -000b2ae0: 0a5c 280a 5c62 6567 696e 7b62 6d61 7472 .\(.\begin{bmatr │ │ │ -000b2af0: 6978 7d0a 615f 7b31 317d 2026 616d 703b ix}.a_{11} & │ │ │ -000b2b00: 2061 5f7b 3132 7d20 2661 6d70 3b20 625f a_{12} & b_ │ │ │ -000b2b10: 315c 5c0a 615f 7b32 317d 2026 616d 703b 1\\.a_{21} & │ │ │ -000b2b20: 2061 5f7b 3232 7d20 2661 6d70 3b20 625f a_{22} & b_ │ │ │ -000b2b30: 325c 5c0a 5c65 6e64 7b62 6d61 7472 6978 2\\.\end{bmatrix │ │ │ -000b2b40: 7d0a 5c29 0a0a 5468 6520 6675 6e63 7469 }.\)..The functi │ │ │ -000b2b50: 6f6e 2065 7374 696d 6174 6573 2061 6e20 on estimates an │ │ │ -000b2b60: 6f70 7469 6d61 6c20 3244 2061 6666 696e optimal 2D affin │ │ │ -000b2b70: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ -000b2b80: 2062 6574 7765 656e 2074 776f 2032 4420 between two 2D │ │ │ -000b2b90: 706f 696e 7420 7365 7473 2075 7369 6e67 point sets using │ │ │ -000b2ba0: 2074 6865 0a73 656c 6563 7465 6420 726f the.selected ro │ │ │ -000b2bb0: 6275 7374 2061 6c67 6f72 6974 686d 2e0a bust algorithm.. │ │ │ -000b2bc0: 0a54 6865 2063 6f6d 7075 7465 6420 7472 .The computed tr │ │ │ -000b2bd0: 616e 7366 6f72 6d61 7469 6f6e 2069 7320 ansformation is │ │ │ -000b2be0: 7468 656e 2072 6566 696e 6564 2066 7572 then refined fur │ │ │ -000b2bf0: 7468 6572 2028 7573 696e 6720 6f6e 6c79 ther (using only │ │ │ -000b2c00: 2069 6e6c 6965 7273 2920 7769 7468 2074 inliers) with t │ │ │ -000b2c10: 6865 0a4c 6576 656e 6265 7267 2d4d 6172 he.Levenberg-Mar │ │ │ -000b2c20: 7175 6172 6474 206d 6574 686f 6420 746f quardt method to │ │ │ -000b2c30: 2072 6564 7563 6520 7468 6520 7265 2d70 reduce the re-p │ │ │ -000b2c40: 726f 6a65 6374 696f 6e20 6572 726f 7220 rojection error │ │ │ -000b2c50: 6576 656e 206d 6f72 652e 0a0a 3c62 3e4e even more...N │ │ │ -000b2c60: 6f74 653a 3c2f 623e 0a54 6865 2052 414e ote:.The RAN │ │ │ -000b2c70: 5341 4320 6d65 7468 6f64 2063 616e 2068 SAC method can h │ │ │ -000b2c80: 616e 646c 6520 7072 6163 7469 6361 6c6c andle practicall │ │ │ -000b2c90: 7920 616e 7920 7261 7469 6f20 6f66 206f y any ratio of o │ │ │ -000b2ca0: 7574 6c69 6572 7320 6275 7420 6e65 6564 utliers but need │ │ │ -000b2cb0: 7320 6120 7468 7265 7368 6f6c 6420 746f s a threshold to │ │ │ -000b2cc0: 0a64 6973 7469 6e67 7569 7368 2069 6e6c .distinguish inl │ │ │ -000b2cd0: 6965 7273 2066 726f 6d20 6f75 746c 6965 iers from outlie │ │ │ -000b2ce0: 7273 2e20 5468 6520 6d65 7468 6f64 204c rs. The method L │ │ │ -000b2cf0: 4d65 4453 2064 6f65 7320 6e6f 7420 6e65 MeDS does not ne │ │ │ -000b2d00: 6564 2061 6e79 2074 6872 6573 686f 6c64 ed any threshold │ │ │ -000b2d10: 2062 7574 2069 7420 776f 726b 730a 636f but it works.co │ │ │ -000b2d20: 7272 6563 746c 7920 6f6e 6c79 2077 6865 rrectly only whe │ │ │ -000b2d30: 6e20 7468 6572 6520 6172 6520 6d6f 7265 n there are more │ │ │ -000b2d40: 2074 6861 6e20 3530 2520 6f66 2069 6e6c than 50% of inl │ │ │ -000b2d50: 6965 7273 2e0a 0a53 4545 3a20 6573 7469 iers...SEE: esti │ │ │ -000b2d60: 6d61 7465 4166 6669 6e65 5061 7274 6961 mateAffinePartia │ │ │ -000b2d70: 6c32 442c 2067 6574 4166 6669 6e65 5472 l2D, getAffineTr │ │ │ -000b2d80: 616e 7366 6f72 6d3c 2f64 643e 0a3c 2f64 ansform
    ..
    ..
  • .
  • . │ │ │ -000b2db0: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    │ │ │ -000b2e30: 6573 7469 6d61 7465 4166 6669 6e65 3244 estimateAffine2D │ │ │ -000b2e40: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ -000b2ea0: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -000b2eb0: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -000b2ed0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000b2f10: 2f61 3e3c 2f73 7061 6e3e 266e 6273 703b /a>  │ │ │ -000b2f20: 3c73 7061 6e20 636c 6173 733d 2265 6c65 estim │ │ │ -000b2f40: 6174 6541 6666 696e 6532 443c 2f73 7061 ateAffine2D │ │ │ -000b2f70: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ -000b2fb0: 3c2f 613e 266e 6273 703b 6672 6f6d 2c0a  from,. │ │ │ -000b2fc0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000b3000: 3c2f 613e 266e 6273 703b 746f 2c0a 203c  to,. < │ │ │ -000b3010: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000b3020: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000b3030: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000b3040: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat inliers, │ │ │ -000b3060: 0a20 696e 7426 6e62 7370 3b6d 6574 686f . int metho │ │ │ -000b3070: 642c 0a20 646f 7562 6c65 266e 6273 703b d,. double  │ │ │ -000b3080: 7261 6e73 6163 5265 7072 6f6a 5468 7265 ransacReprojThre │ │ │ -000b3090: 7368 6f6c 642c 0a20 6c6f 6e67 266e 6273 shold,. long&nbs │ │ │ -000b30a0: 703b 6d61 7849 7465 7273 293c 2f73 7061 p;maxIters)
    .
    Comp │ │ │ -000b30d0: 7574 6573 2061 6e20 6f70 7469 6d61 6c20 utes an optimal │ │ │ -000b30e0: 6166 6669 6e65 2074 7261 6e73 666f 726d affine transform │ │ │ -000b30f0: 6174 696f 6e20 6265 7477 6565 6e20 7477 ation between tw │ │ │ -000b3100: 6f20 3244 2070 6f69 6e74 2073 6574 732e o 2D point sets. │ │ │ -000b3110: 0a0a 4974 2063 6f6d 7075 7465 730a 5c28 ..It computes.\( │ │ │ -000b3120: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ -000b3130: 0a78 5c5c 0a79 5c5c 0a5c 656e 647b 626d .x\\.y\\.\end{bm │ │ │ -000b3140: 6174 7269 787d 0a3d 0a5c 6265 6769 6e7b atrix}.=.\begin{ │ │ │ -000b3150: 626d 6174 7269 787d 0a61 5f7b 3131 7d20 bmatrix}.a_{11} │ │ │ -000b3160: 2661 6d70 3b20 615f 7b31 327d 5c5c 0a61 & a_{12}\\.a │ │ │ -000b3170: 5f7b 3231 7d20 2661 6d70 3b20 615f 7b32 _{21} & a_{2 │ │ │ -000b3180: 327d 5c5c 0a5c 656e 647b 626d 6174 7269 2}\\.\end{bmatri │ │ │ -000b3190: 787d 0a5c 6265 6769 6e7b 626d 6174 7269 x}.\begin{bmatri │ │ │ -000b31a0: 787d 0a58 5c5c 0a59 5c5c 0a5c 656e 647b x}.X\\.Y\\.\end{ │ │ │ -000b31b0: 626d 6174 7269 787d 0a2b 0a5c 6265 6769 bmatrix}.+.\begi │ │ │ -000b31c0: 6e7b 626d 6174 7269 787d 0a62 5f31 5c5c n{bmatrix}.b_1\\ │ │ │ -000b31d0: 0a62 5f32 5c5c 0a5c 656e 647b 626d 6174 .b_2\\.\end{bmat │ │ │ -000b31e0: 7269 787d 0a5c 293c 2f64 6976 3e0a 3c64 rix}.\)
    . │ │ │ -000b3200: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ -000b3210: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000b3220: 6672 6f6d 3c2f 636f 6465 3e20 2d20 4669 from - Fi │ │ │ -000b3230: 7273 7420 696e 7075 7420 3244 2070 6f69 rst input 2D poi │ │ │ -000b3240: 6e74 2073 6574 2063 6f6e 7461 696e 696e nt set containin │ │ │ -000b3250: 6720 5c28 2858 2c59 295c 292e 3c2f 6464 g \((X,Y)\).
    .
    to - Second i │ │ │ -000b3280: 6e70 7574 2032 4420 706f 696e 7420 7365 nput 2D point se │ │ │ -000b3290: 7420 636f 6e74 6169 6e69 6e67 205c 2828 t containing \(( │ │ │ -000b32a0: 782c 7929 5c29 2e3c 2f64 643e 0a3c 6464 x,y)\).
    .
    inliers - Output v │ │ │ -000b32d0: 6563 746f 7220 696e 6469 6361 7469 6e67 ector indicating │ │ │ -000b32e0: 2077 6869 6368 2070 6f69 6e74 7320 6172 which points ar │ │ │ -000b32f0: 6520 696e 6c69 6572 7320 2831 2d69 6e6c e inliers (1-inl │ │ │ -000b3300: 6965 722c 2030 2d6f 7574 6c69 6572 292e ier, 0-outlier). │ │ │ -000b3310: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000b3320: 6d65 7468 6f64 3c2f 636f 6465 3e20 2d20 method - │ │ │ -000b3330: 526f 6275 7374 206d 6574 686f 6420 7573 Robust method us │ │ │ -000b3340: 6564 2074 6f20 636f 6d70 7574 6520 7472 ed to compute tr │ │ │ -000b3350: 616e 7366 6f72 6d61 7469 6f6e 2e20 5468 ansformation. Th │ │ │ -000b3360: 6520 666f 6c6c 6f77 696e 6720 6d65 7468 e following meth │ │ │ -000b3370: 6f64 7320 6172 6520 706f 7373 6962 6c65 ods are possible │ │ │ -000b3380: 3a0a 3c75 6c3e 0a20 203c 6c69 3e0a 2020 :.
      .
    • . │ │ │ -000b3390: 2052 4546 3a20 5241 4e53 4143 202d 2052 REF: RANSAC - R │ │ │ -000b33a0: 414e 5341 432d 6261 7365 6420 726f 6275 ANSAC-based robu │ │ │ -000b33b0: 7374 206d 6574 686f 640a 2020 3c2f 6c69 st method.
    • .
    • . REF: │ │ │ -000b33d0: 204c 4d45 4453 202d 204c 6561 7374 2d4d LMEDS - Least-M │ │ │ -000b33e0: 6564 6961 6e20 726f 6275 7374 206d 6574 edian robust met │ │ │ -000b33f0: 686f 640a 5241 4e53 4143 2069 7320 7468 hod.RANSAC is th │ │ │ -000b3400: 6520 6465 6661 756c 7420 6d65 7468 6f64 e default method │ │ │ -000b3410: 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c ..
    • .
    < │ │ │ -000b3420: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e72 /dd>.
    r │ │ │ -000b3430: 616e 7361 6352 6570 726f 6a54 6872 6573 ansacReprojThres │ │ │ -000b3440: 686f 6c64 3c2f 636f 6465 3e20 2d20 4d61 hold - Ma │ │ │ -000b3450: 7869 6d75 6d20 7265 7072 6f6a 6563 7469 ximum reprojecti │ │ │ -000b3460: 6f6e 2065 7272 6f72 2069 6e20 7468 6520 on error in the │ │ │ -000b3470: 5241 4e53 4143 2061 6c67 6f72 6974 686d RANSAC algorithm │ │ │ -000b3480: 2074 6f20 636f 6e73 6964 6572 0a61 2070 to consider.a p │ │ │ -000b3490: 6f69 6e74 2061 7320 616e 2069 6e6c 6965 oint as an inlie │ │ │ -000b34a0: 722e 2041 7070 6c69 6573 206f 6e6c 7920 r. Applies only │ │ │ -000b34b0: 746f 2052 414e 5341 432e 3c2f 6464 3e0a to RANSAC.
    . │ │ │ -000b34c0: 3c64 643e 3c63 6f64 653e 6d61 7849 7465
    maxIte │ │ │ -000b34d0: 7273 3c2f 636f 6465 3e20 2d20 5468 6520 rs - The │ │ │ -000b34e0: 6d61 7869 6d75 6d20 6e75 6d62 6572 206f maximum number o │ │ │ -000b34f0: 6620 726f 6275 7374 206d 6574 686f 6420 f robust method │ │ │ -000b3500: 6974 6572 6174 696f 6e73 2e0a 6265 7477 iterations..betw │ │ │ -000b3510: 6565 6e20 302e 3935 2061 6e64 2030 2e39 een 0.95 and 0.9 │ │ │ -000b3520: 3920 6973 2075 7375 616c 6c79 2067 6f6f 9 is usually goo │ │ │ -000b3530: 6420 656e 6f75 6768 2e20 5661 6c75 6573 d enough. Values │ │ │ -000b3540: 2074 6f6f 2063 6c6f 7365 2074 6f20 3120 too close to 1 │ │ │ -000b3550: 6361 6e20 736c 6f77 2064 6f77 6e20 7468 can slow down th │ │ │ -000b3560: 6520 6573 7469 6d61 7469 6f6e 0a73 6967 e estimation.sig │ │ │ -000b3570: 6e69 6669 6361 6e74 6c79 2e20 5661 6c75 nificantly. Valu │ │ │ -000b3580: 6573 206c 6f77 6572 2074 6861 6e20 302e es lower than 0. │ │ │ -000b3590: 382d 302e 3920 6361 6e20 7265 7375 6c74 8-0.9 can result │ │ │ -000b35a0: 2069 6e20 616e 2069 6e63 6f72 7265 6374 in an incorrect │ │ │ -000b35b0: 6c79 2065 7374 696d 6174 6564 2074 7261 ly estimated tra │ │ │ -000b35c0: 6e73 666f 726d 6174 696f 6e2e 0a50 6173 nsformation..Pas │ │ │ -000b35d0: 7369 6e67 2030 2077 696c 6c20 6469 7361 sing 0 will disa │ │ │ -000b35e0: 626c 6520 7265 6669 6e69 6e67 2c20 736f ble refining, so │ │ │ -000b35f0: 2074 6865 206f 7574 7075 7420 6d61 7472 the output matr │ │ │ -000b3600: 6978 2077 696c 6c20 6265 206f 7574 7075 ix will be outpu │ │ │ -000b3610: 7420 6f66 2072 6f62 7573 7420 6d65 7468 t of robust meth │ │ │ -000b3620: 6f64 2e3c 2f64 643e 0a3c 6474 3e52 6574 od.
    .
    Ret │ │ │ -000b3630: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e4f urns:
    .
    O │ │ │ -000b3640: 7574 7075 7420 3244 2061 6666 696e 6520 utput 2D affine │ │ │ -000b3650: 7472 616e 7366 6f72 6d61 7469 6f6e 206d transformation m │ │ │ -000b3660: 6174 7269 7820 5c28 3220 5c74 696d 6573 atrix \(2 \times │ │ │ -000b3670: 2033 5c29 206f 7220 656d 7074 7920 6d61 3\) or empty ma │ │ │ -000b3680: 7472 6978 2069 6620 7472 616e 7366 6f72 trix if transfor │ │ │ -000b3690: 6d61 7469 6f6e 0a63 6f75 6c64 206e 6f74 mation.could not │ │ │ -000b36a0: 2062 6520 6573 7469 6d61 7465 642e 2054 be estimated. T │ │ │ -000b36b0: 6865 2072 6574 7572 6e65 6420 6d61 7472 he returned matr │ │ │ -000b36c0: 6978 2068 6173 2074 6865 2066 6f6c 6c6f ix has the follo │ │ │ -000b36d0: 7769 6e67 2066 6f72 6d3a 0a5c 280a 5c62 wing form:.\(.\b │ │ │ -000b36e0: 6567 696e 7b62 6d61 7472 6978 7d0a 615f egin{bmatrix}.a_ │ │ │ -000b36f0: 7b31 317d 2026 616d 703b 2061 5f7b 3132 {11} & a_{12 │ │ │ -000b3700: 7d20 2661 6d70 3b20 625f 315c 5c0a 615f } & b_1\\.a_ │ │ │ -000b3710: 7b32 317d 2026 616d 703b 2061 5f7b 3232 {21} & a_{22 │ │ │ -000b3720: 7d20 2661 6d70 3b20 625f 325c 5c0a 5c65 } & b_2\\.\e │ │ │ -000b3730: 6e64 7b62 6d61 7472 6978 7d0a 5c29 0a0a nd{bmatrix}.\).. │ │ │ -000b3740: 5468 6520 6675 6e63 7469 6f6e 2065 7374 The function est │ │ │ -000b3750: 696d 6174 6573 2061 6e20 6f70 7469 6d61 imates an optima │ │ │ -000b3760: 6c20 3244 2061 6666 696e 6520 7472 616e l 2D affine tran │ │ │ -000b3770: 7366 6f72 6d61 7469 6f6e 2062 6574 7765 sformation betwe │ │ │ -000b3780: 656e 2074 776f 2032 4420 706f 696e 7420 en two 2D point │ │ │ -000b3790: 7365 7473 2075 7369 6e67 2074 6865 0a73 sets using the.s │ │ │ -000b37a0: 656c 6563 7465 6420 726f 6275 7374 2061 elected robust a │ │ │ -000b37b0: 6c67 6f72 6974 686d 2e0a 0a54 6865 2063 lgorithm...The c │ │ │ -000b37c0: 6f6d 7075 7465 6420 7472 616e 7366 6f72 omputed transfor │ │ │ -000b37d0: 6d61 7469 6f6e 2069 7320 7468 656e 2072 mation is then r │ │ │ -000b37e0: 6566 696e 6564 2066 7572 7468 6572 2028 efined further ( │ │ │ -000b37f0: 7573 696e 6720 6f6e 6c79 2069 6e6c 6965 using only inlie │ │ │ -000b3800: 7273 2920 7769 7468 2074 6865 0a4c 6576 rs) with the.Lev │ │ │ -000b3810: 656e 6265 7267 2d4d 6172 7175 6172 6474 enberg-Marquardt │ │ │ -000b3820: 206d 6574 686f 6420 746f 2072 6564 7563 method to reduc │ │ │ -000b3830: 6520 7468 6520 7265 2d70 726f 6a65 6374 e the re-project │ │ │ -000b3840: 696f 6e20 6572 726f 7220 6576 656e 206d ion error even m │ │ │ -000b3850: 6f72 652e 0a0a 3c62 3e4e 6f74 653a 3c2f ore...Note:.The RANSAC me │ │ │ -000b3870: 7468 6f64 2063 616e 2068 616e 646c 6520 thod can handle │ │ │ -000b3880: 7072 6163 7469 6361 6c6c 7920 616e 7920 practically any │ │ │ -000b3890: 7261 7469 6f20 6f66 206f 7574 6c69 6572 ratio of outlier │ │ │ -000b38a0: 7320 6275 7420 6e65 6564 7320 6120 7468 s but needs a th │ │ │ -000b38b0: 7265 7368 6f6c 6420 746f 0a64 6973 7469 reshold to.disti │ │ │ -000b38c0: 6e67 7569 7368 2069 6e6c 6965 7273 2066 nguish inliers f │ │ │ -000b38d0: 726f 6d20 6f75 746c 6965 7273 2e20 5468 rom outliers. Th │ │ │ -000b38e0: 6520 6d65 7468 6f64 204c 4d65 4453 2064 e method LMeDS d │ │ │ -000b38f0: 6f65 7320 6e6f 7420 6e65 6564 2061 6e79 oes not need any │ │ │ -000b3900: 2074 6872 6573 686f 6c64 2062 7574 2069 threshold but i │ │ │ -000b3910: 7420 776f 726b 730a 636f 7272 6563 746c t works.correctl │ │ │ -000b3920: 7920 6f6e 6c79 2077 6865 6e20 7468 6572 y only when ther │ │ │ -000b3930: 6520 6172 6520 6d6f 7265 2074 6861 6e20 e are more than │ │ │ -000b3940: 3530 2520 6f66 2069 6e6c 6965 7273 2e0a 50% of inliers.. │ │ │ -000b3950: 0a53 4545 3a20 6573 7469 6d61 7465 4166 .SEE: estimateAf │ │ │ -000b3960: 6669 6e65 5061 7274 6961 6c32 442c 2067 finePartial2D, g │ │ │ -000b3970: 6574 4166 6669 6e65 5472 616e 7366 6f72 etAffineTransfor │ │ │ -000b3980: 6d3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 m
    ..
    .
    .< │ │ │ -000b39a0: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • . │ │ │ -000b3a20: 0a3c 6833 3e65 7374 696d 6174 6541 6666 .

    estimateAff │ │ │ -000b3a30: 696e 6532 443c 2f68 333e 0a3c 6469 7620 ine2D

    .
    .
    public static Mat& │ │ │ -000b3b10: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -000b3b30: 6573 7469 6d61 7465 4166 6669 6e65 3244 estimateAffine2D │ │ │ -000b3b40: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat f │ │ │ -000b3bb0: 726f 6d2c 0a20 3c61 2068 7265 663d 222e rom,. Mat t │ │ │ -000b3c00: 6f2c 0a20 3c61 2068 7265 663d 222e 2e2f o,. │ │ │ -000b3c40: 4d61 743c 2f61 3e26 6e62 7370 3b69 6e6c Mat inl │ │ │ -000b3c50: 6965 7273 2c0a 2069 6e74 266e 6273 703b iers,. int  │ │ │ -000b3c60: 6d65 7468 6f64 2c0a 2064 6f75 626c 6526 method,. double& │ │ │ -000b3c70: 6e62 7370 3b72 616e 7361 6352 6570 726f nbsp;ransacRepro │ │ │ -000b3c80: 6a54 6872 6573 686f 6c64 293c 2f73 7061 jThreshold)
    .
    Comp │ │ │ -000b3cb0: 7574 6573 2061 6e20 6f70 7469 6d61 6c20 utes an optimal │ │ │ -000b3cc0: 6166 6669 6e65 2074 7261 6e73 666f 726d affine transform │ │ │ -000b3cd0: 6174 696f 6e20 6265 7477 6565 6e20 7477 ation between tw │ │ │ -000b3ce0: 6f20 3244 2070 6f69 6e74 2073 6574 732e o 2D point sets. │ │ │ -000b3cf0: 0a0a 4974 2063 6f6d 7075 7465 730a 5c28 ..It computes.\( │ │ │ -000b3d00: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ -000b3d10: 0a78 5c5c 0a79 5c5c 0a5c 656e 647b 626d .x\\.y\\.\end{bm │ │ │ -000b3d20: 6174 7269 787d 0a3d 0a5c 6265 6769 6e7b atrix}.=.\begin{ │ │ │ -000b3d30: 626d 6174 7269 787d 0a61 5f7b 3131 7d20 bmatrix}.a_{11} │ │ │ -000b3d40: 2661 6d70 3b20 615f 7b31 327d 5c5c 0a61 & a_{12}\\.a │ │ │ -000b3d50: 5f7b 3231 7d20 2661 6d70 3b20 615f 7b32 _{21} & a_{2 │ │ │ -000b3d60: 327d 5c5c 0a5c 656e 647b 626d 6174 7269 2}\\.\end{bmatri │ │ │ -000b3d70: 787d 0a5c 6265 6769 6e7b 626d 6174 7269 x}.\begin{bmatri │ │ │ -000b3d80: 787d 0a58 5c5c 0a59 5c5c 0a5c 656e 647b x}.X\\.Y\\.\end{ │ │ │ -000b3d90: 626d 6174 7269 787d 0a2b 0a5c 6265 6769 bmatrix}.+.\begi │ │ │ -000b3da0: 6e7b 626d 6174 7269 787d 0a62 5f31 5c5c n{bmatrix}.b_1\\ │ │ │ -000b3db0: 0a62 5f32 5c5c 0a5c 656e 647b 626d 6174 .b_2\\.\end{bmat │ │ │ -000b3dc0: 7269 787d 0a5c 293c 2f64 6976 3e0a 3c64 rix}.\)
    . │ │ │ -000b3de0: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ -000b3df0: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000b3e00: 6672 6f6d 3c2f 636f 6465 3e20 2d20 4669 from - Fi │ │ │ -000b3e10: 7273 7420 696e 7075 7420 3244 2070 6f69 rst input 2D poi │ │ │ -000b3e20: 6e74 2073 6574 2063 6f6e 7461 696e 696e nt set containin │ │ │ -000b3e30: 6720 5c28 2858 2c59 295c 292e 3c2f 6464 g \((X,Y)\).
    .
    to - Second i │ │ │ -000b3e60: 6e70 7574 2032 4420 706f 696e 7420 7365 nput 2D point se │ │ │ -000b3e70: 7420 636f 6e74 6169 6e69 6e67 205c 2828 t containing \(( │ │ │ -000b3e80: 782c 7929 5c29 2e3c 2f64 643e 0a3c 6464 x,y)\).
    .
    inliers - Output v │ │ │ -000b3eb0: 6563 746f 7220 696e 6469 6361 7469 6e67 ector indicating │ │ │ -000b3ec0: 2077 6869 6368 2070 6f69 6e74 7320 6172 which points ar │ │ │ -000b3ed0: 6520 696e 6c69 6572 7320 2831 2d69 6e6c e inliers (1-inl │ │ │ -000b3ee0: 6965 722c 2030 2d6f 7574 6c69 6572 292e ier, 0-outlier). │ │ │ -000b3ef0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000b3f00: 6d65 7468 6f64 3c2f 636f 6465 3e20 2d20 method - │ │ │ -000b3f10: 526f 6275 7374 206d 6574 686f 6420 7573 Robust method us │ │ │ -000b3f20: 6564 2074 6f20 636f 6d70 7574 6520 7472 ed to compute tr │ │ │ -000b3f30: 616e 7366 6f72 6d61 7469 6f6e 2e20 5468 ansformation. Th │ │ │ -000b3f40: 6520 666f 6c6c 6f77 696e 6720 6d65 7468 e following meth │ │ │ -000b3f50: 6f64 7320 6172 6520 706f 7373 6962 6c65 ods are possible │ │ │ -000b3f60: 3a0a 3c75 6c3e 0a20 203c 6c69 3e0a 2020 :.
      .
    • . │ │ │ -000b3f70: 2052 4546 3a20 5241 4e53 4143 202d 2052 REF: RANSAC - R │ │ │ -000b3f80: 414e 5341 432d 6261 7365 6420 726f 6275 ANSAC-based robu │ │ │ -000b3f90: 7374 206d 6574 686f 640a 2020 3c2f 6c69 st method.
    • .
    • . REF: │ │ │ -000b3fb0: 204c 4d45 4453 202d 204c 6561 7374 2d4d LMEDS - Least-M │ │ │ -000b3fc0: 6564 6961 6e20 726f 6275 7374 206d 6574 edian robust met │ │ │ -000b3fd0: 686f 640a 5241 4e53 4143 2069 7320 7468 hod.RANSAC is th │ │ │ -000b3fe0: 6520 6465 6661 756c 7420 6d65 7468 6f64 e default method │ │ │ -000b3ff0: 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c ..
    • .
    < │ │ │ -000b4000: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e72 /dd>.
    r │ │ │ -000b4010: 616e 7361 6352 6570 726f 6a54 6872 6573 ansacReprojThres │ │ │ -000b4020: 686f 6c64 3c2f 636f 6465 3e20 2d20 4d61 hold - Ma │ │ │ -000b4030: 7869 6d75 6d20 7265 7072 6f6a 6563 7469 ximum reprojecti │ │ │ -000b4040: 6f6e 2065 7272 6f72 2069 6e20 7468 6520 on error in the │ │ │ -000b4050: 5241 4e53 4143 2061 6c67 6f72 6974 686d RANSAC algorithm │ │ │ -000b4060: 2074 6f20 636f 6e73 6964 6572 0a61 2070 to consider.a p │ │ │ -000b4070: 6f69 6e74 2061 7320 616e 2069 6e6c 6965 oint as an inlie │ │ │ -000b4080: 722e 2041 7070 6c69 6573 206f 6e6c 7920 r. Applies only │ │ │ -000b4090: 746f 2052 414e 5341 432e 0a62 6574 7765 to RANSAC..betwe │ │ │ -000b40a0: 656e 2030 2e39 3520 616e 6420 302e 3939 en 0.95 and 0.99 │ │ │ -000b40b0: 2069 7320 7573 7561 6c6c 7920 676f 6f64 is usually good │ │ │ -000b40c0: 2065 6e6f 7567 682e 2056 616c 7565 7320 enough. Values │ │ │ -000b40d0: 746f 6f20 636c 6f73 6520 746f 2031 2063 too close to 1 c │ │ │ -000b40e0: 616e 2073 6c6f 7720 646f 776e 2074 6865 an slow down the │ │ │ -000b40f0: 2065 7374 696d 6174 696f 6e0a 7369 676e estimation.sign │ │ │ -000b4100: 6966 6963 616e 746c 792e 2056 616c 7565 ificantly. Value │ │ │ -000b4110: 7320 6c6f 7765 7220 7468 616e 2030 2e38 s lower than 0.8 │ │ │ -000b4120: 2d30 2e39 2063 616e 2072 6573 756c 7420 -0.9 can result │ │ │ -000b4130: 696e 2061 6e20 696e 636f 7272 6563 746c in an incorrectl │ │ │ -000b4140: 7920 6573 7469 6d61 7465 6420 7472 616e y estimated tran │ │ │ -000b4150: 7366 6f72 6d61 7469 6f6e 2e0a 5061 7373 sformation..Pass │ │ │ -000b4160: 696e 6720 3020 7769 6c6c 2064 6973 6162 ing 0 will disab │ │ │ -000b4170: 6c65 2072 6566 696e 696e 672c 2073 6f20 le refining, so │ │ │ -000b4180: 7468 6520 6f75 7470 7574 206d 6174 7269 the output matri │ │ │ -000b4190: 7820 7769 6c6c 2062 6520 6f75 7470 7574 x will be output │ │ │ -000b41a0: 206f 6620 726f 6275 7374 206d 6574 686f of robust metho │ │ │ -000b41b0: 642e 3c2f 6464 3e0a 3c64 743e 5265 7475 d.
    .
    Retu │ │ │ -000b41c0: 726e 733a 3c2f 6474 3e0a 3c64 643e 4f75 rns:
    .
    Ou │ │ │ -000b41d0: 7470 7574 2032 4420 6166 6669 6e65 2074 tput 2D affine t │ │ │ -000b41e0: 7261 6e73 666f 726d 6174 696f 6e20 6d61 ransformation ma │ │ │ -000b41f0: 7472 6978 205c 2832 205c 7469 6d65 7320 trix \(2 \times │ │ │ -000b4200: 335c 2920 6f72 2065 6d70 7479 206d 6174 3\) or empty mat │ │ │ -000b4210: 7269 7820 6966 2074 7261 6e73 666f 726d rix if transform │ │ │ -000b4220: 6174 696f 6e0a 636f 756c 6420 6e6f 7420 ation.could not │ │ │ -000b4230: 6265 2065 7374 696d 6174 6564 2e20 5468 be estimated. Th │ │ │ -000b4240: 6520 7265 7475 726e 6564 206d 6174 7269 e returned matri │ │ │ -000b4250: 7820 6861 7320 7468 6520 666f 6c6c 6f77 x has the follow │ │ │ -000b4260: 696e 6720 666f 726d 3a0a 5c28 0a5c 6265 ing form:.\(.\be │ │ │ -000b4270: 6769 6e7b 626d 6174 7269 787d 0a61 5f7b gin{bmatrix}.a_{ │ │ │ -000b4280: 3131 7d20 2661 6d70 3b20 615f 7b31 327d 11} & a_{12} │ │ │ -000b4290: 2026 616d 703b 2062 5f31 5c5c 0a61 5f7b & b_1\\.a_{ │ │ │ -000b42a0: 3231 7d20 2661 6d70 3b20 615f 7b32 327d 21} & a_{22} │ │ │ -000b42b0: 2026 616d 703b 2062 5f32 5c5c 0a5c 656e & b_2\\.\en │ │ │ -000b42c0: 647b 626d 6174 7269 787d 0a5c 290a 0a54 d{bmatrix}.\)..T │ │ │ -000b42d0: 6865 2066 756e 6374 696f 6e20 6573 7469 he function esti │ │ │ -000b42e0: 6d61 7465 7320 616e 206f 7074 696d 616c mates an optimal │ │ │ -000b42f0: 2032 4420 6166 6669 6e65 2074 7261 6e73 2D affine trans │ │ │ -000b4300: 666f 726d 6174 696f 6e20 6265 7477 6565 formation betwee │ │ │ -000b4310: 6e20 7477 6f20 3244 2070 6f69 6e74 2073 n two 2D point s │ │ │ -000b4320: 6574 7320 7573 696e 6720 7468 650a 7365 ets using the.se │ │ │ -000b4330: 6c65 6374 6564 2072 6f62 7573 7420 616c lected robust al │ │ │ -000b4340: 676f 7269 7468 6d2e 0a0a 5468 6520 636f gorithm...The co │ │ │ -000b4350: 6d70 7574 6564 2074 7261 6e73 666f 726d mputed transform │ │ │ -000b4360: 6174 696f 6e20 6973 2074 6865 6e20 7265 ation is then re │ │ │ -000b4370: 6669 6e65 6420 6675 7274 6865 7220 2875 fined further (u │ │ │ -000b4380: 7369 6e67 206f 6e6c 7920 696e 6c69 6572 sing only inlier │ │ │ -000b4390: 7329 2077 6974 6820 7468 650a 4c65 7665 s) with the.Leve │ │ │ -000b43a0: 6e62 6572 672d 4d61 7271 7561 7264 7420 nberg-Marquardt │ │ │ -000b43b0: 6d65 7468 6f64 2074 6f20 7265 6475 6365 method to reduce │ │ │ -000b43c0: 2074 6865 2072 652d 7072 6f6a 6563 7469 the re-projecti │ │ │ -000b43d0: 6f6e 2065 7272 6f72 2065 7665 6e20 6d6f on error even mo │ │ │ -000b43e0: 7265 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 re...Note:.The RANSAC met │ │ │ -000b4400: 686f 6420 6361 6e20 6861 6e64 6c65 2070 hod can handle p │ │ │ -000b4410: 7261 6374 6963 616c 6c79 2061 6e79 2072 ractically any r │ │ │ -000b4420: 6174 696f 206f 6620 6f75 746c 6965 7273 atio of outliers │ │ │ -000b4430: 2062 7574 206e 6565 6473 2061 2074 6872 but needs a thr │ │ │ -000b4440: 6573 686f 6c64 2074 6f0a 6469 7374 696e eshold to.distin │ │ │ -000b4450: 6775 6973 6820 696e 6c69 6572 7320 6672 guish inliers fr │ │ │ -000b4460: 6f6d 206f 7574 6c69 6572 732e 2054 6865 om outliers. The │ │ │ -000b4470: 206d 6574 686f 6420 4c4d 6544 5320 646f method LMeDS do │ │ │ -000b4480: 6573 206e 6f74 206e 6565 6420 616e 7920 es not need any │ │ │ -000b4490: 7468 7265 7368 6f6c 6420 6275 7420 6974 threshold but it │ │ │ -000b44a0: 2077 6f72 6b73 0a63 6f72 7265 6374 6c79 works.correctly │ │ │ -000b44b0: 206f 6e6c 7920 7768 656e 2074 6865 7265 only when there │ │ │ -000b44c0: 2061 7265 206d 6f72 6520 7468 616e 2035 are more than 5 │ │ │ -000b44d0: 3025 206f 6620 696e 6c69 6572 732e 0a0a 0% of inliers... │ │ │ -000b44e0: 5345 453a 2065 7374 696d 6174 6541 6666 SEE: estimateAff │ │ │ -000b44f0: 696e 6550 6172 7469 616c 3244 2c20 6765 inePartial2D, ge │ │ │ -000b4500: 7441 6666 696e 6554 7261 6e73 666f 726d tAffineTransform │ │ │ -000b4510: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .....
  • ..

    est │ │ │ -000b45b0: 696d 6174 6541 6666 696e 6532 443c 2f68 imateAffine2D.
    .
    public │ │ │ -000b4620: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ -000b4630: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;Mat │ │ │ -000b4690: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  estimate │ │ │ -000b46c0: 4166 6669 6e65 3244 3c2f 7370 616e 3e3c Affine2D< │ │ │ -000b46d0: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat from,. Mat to,. Mat& │ │ │ -000b47d0: 6e62 7370 3b69 6e6c 6965 7273 2c0a 2069 nbsp;inliers,. i │ │ │ -000b47e0: 6e74 266e 6273 703b 6d65 7468 6f64 293c nt method)< │ │ │ -000b47f0: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ -000b4810: 436f 6d70 7574 6573 2061 6e20 6f70 7469 Computes an opti │ │ │ -000b4820: 6d61 6c20 6166 6669 6e65 2074 7261 6e73 mal affine trans │ │ │ -000b4830: 666f 726d 6174 696f 6e20 6265 7477 6565 formation betwee │ │ │ -000b4840: 6e20 7477 6f20 3244 2070 6f69 6e74 2073 n two 2D point s │ │ │ -000b4850: 6574 732e 0a0a 4974 2063 6f6d 7075 7465 ets...It compute │ │ │ -000b4860: 730a 5c28 0a5c 6265 6769 6e7b 626d 6174 s.\(.\begin{bmat │ │ │ -000b4870: 7269 787d 0a78 5c5c 0a79 5c5c 0a5c 656e rix}.x\\.y\\.\en │ │ │ -000b4880: 647b 626d 6174 7269 787d 0a3d 0a5c 6265 d{bmatrix}.=.\be │ │ │ -000b4890: 6769 6e7b 626d 6174 7269 787d 0a61 5f7b gin{bmatrix}.a_{ │ │ │ -000b48a0: 3131 7d20 2661 6d70 3b20 615f 7b31 327d 11} & a_{12} │ │ │ -000b48b0: 5c5c 0a61 5f7b 3231 7d20 2661 6d70 3b20 \\.a_{21} & │ │ │ -000b48c0: 615f 7b32 327d 5c5c 0a5c 656e 647b 626d a_{22}\\.\end{bm │ │ │ -000b48d0: 6174 7269 787d 0a5c 6265 6769 6e7b 626d atrix}.\begin{bm │ │ │ -000b48e0: 6174 7269 787d 0a58 5c5c 0a59 5c5c 0a5c atrix}.X\\.Y\\.\ │ │ │ -000b48f0: 656e 647b 626d 6174 7269 787d 0a2b 0a5c end{bmatrix}.+.\ │ │ │ -000b4900: 6265 6769 6e7b 626d 6174 7269 787d 0a62 begin{bmatrix}.b │ │ │ -000b4910: 5f31 5c5c 0a62 5f32 5c5c 0a5c 656e 647b _1\\.b_2\\.\end{ │ │ │ -000b4920: 626d 6174 7269 787d 0a5c 293c 2f64 6976 bmatrix}.\)
    .
    .
    Paramet │ │ │ -000b4950: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    from │ │ │ -000b4970: 2d20 4669 7273 7420 696e 7075 7420 3244 - First input 2D │ │ │ -000b4980: 2070 6f69 6e74 2073 6574 2063 6f6e 7461 point set conta │ │ │ -000b4990: 696e 696e 6720 5c28 2858 2c59 295c 292e ining \((X,Y)\). │ │ │ -000b49a0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000b49b0: 746f 3c2f 636f 6465 3e20 2d20 5365 636f to - Seco │ │ │ -000b49c0: 6e64 2069 6e70 7574 2032 4420 706f 696e nd input 2D poin │ │ │ -000b49d0: 7420 7365 7420 636f 6e74 6169 6e69 6e67 t set containing │ │ │ -000b49e0: 205c 2828 782c 7929 5c29 2e3c 2f64 643e \((x,y)\).
    │ │ │ -000b49f0: 0a3c 6464 3e3c 636f 6465 3e69 6e6c 6965 .
    inlie │ │ │ -000b4a00: 7273 3c2f 636f 6465 3e20 2d20 4f75 7470 rs - Outp │ │ │ -000b4a10: 7574 2076 6563 746f 7220 696e 6469 6361 ut vector indica │ │ │ -000b4a20: 7469 6e67 2077 6869 6368 2070 6f69 6e74 ting which point │ │ │ -000b4a30: 7320 6172 6520 696e 6c69 6572 7320 2831 s are inliers (1 │ │ │ -000b4a40: 2d69 6e6c 6965 722c 2030 2d6f 7574 6c69 -inlier, 0-outli │ │ │ -000b4a50: 6572 292e 3c2f 6464 3e0a 3c64 643e 3c63 er).
    .
    method - Robust metho │ │ │ -000b4a80: 6420 7573 6564 2074 6f20 636f 6d70 7574 d used to comput │ │ │ -000b4a90: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ -000b4aa0: 2e20 5468 6520 666f 6c6c 6f77 696e 6720 . The following │ │ │ -000b4ab0: 6d65 7468 6f64 7320 6172 6520 706f 7373 methods are poss │ │ │ -000b4ac0: 6962 6c65 3a0a 3c75 6c3e 0a20 203c 6c69 ible:.
      .
    • . REF: RANSAC │ │ │ -000b4ae0: 202d 2052 414e 5341 432d 6261 7365 6420 - RANSAC-based │ │ │ -000b4af0: 726f 6275 7374 206d 6574 686f 640a 2020 robust method. │ │ │ -000b4b00: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020
    • .
    • . │ │ │ -000b4b10: 5245 463a 204c 4d45 4453 202d 204c 6561 REF: LMEDS - Lea │ │ │ -000b4b20: 7374 2d4d 6564 6961 6e20 726f 6275 7374 st-Median robust │ │ │ -000b4b30: 206d 6574 686f 640a 5241 4e53 4143 2069 method.RANSAC i │ │ │ -000b4b40: 7320 7468 6520 6465 6661 756c 7420 6d65 s the default me │ │ │ -000b4b50: 7468 6f64 2e0a 2020 3c2f 6c69 3e0a 3c2f thod..
    • ..a point as a │ │ │ -000b4b70: 6e20 696e 6c69 6572 2e20 4170 706c 6965 n inlier. Applie │ │ │ -000b4b80: 7320 6f6e 6c79 2074 6f20 5241 4e53 4143 s only to RANSAC │ │ │ -000b4b90: 2e0a 6265 7477 6565 6e20 302e 3935 2061 ..between 0.95 a │ │ │ -000b4ba0: 6e64 2030 2e39 3920 6973 2075 7375 616c nd 0.99 is usual │ │ │ -000b4bb0: 6c79 2067 6f6f 6420 656e 6f75 6768 2e20 ly good enough. │ │ │ -000b4bc0: 5661 6c75 6573 2074 6f6f 2063 6c6f 7365 Values too close │ │ │ -000b4bd0: 2074 6f20 3120 6361 6e20 736c 6f77 2064 to 1 can slow d │ │ │ -000b4be0: 6f77 6e20 7468 6520 6573 7469 6d61 7469 own the estimati │ │ │ -000b4bf0: 6f6e 0a73 6967 6e69 6669 6361 6e74 6c79 on.significantly │ │ │ -000b4c00: 2e20 5661 6c75 6573 206c 6f77 6572 2074 . Values lower t │ │ │ -000b4c10: 6861 6e20 302e 382d 302e 3920 6361 6e20 han 0.8-0.9 can │ │ │ -000b4c20: 7265 7375 6c74 2069 6e20 616e 2069 6e63 result in an inc │ │ │ -000b4c30: 6f72 7265 6374 6c79 2065 7374 696d 6174 orrectly estimat │ │ │ -000b4c40: 6564 2074 7261 6e73 666f 726d 6174 696f ed transformatio │ │ │ -000b4c50: 6e2e 0a50 6173 7369 6e67 2030 2077 696c n..Passing 0 wil │ │ │ -000b4c60: 6c20 6469 7361 626c 6520 7265 6669 6e69 l disable refini │ │ │ -000b4c70: 6e67 2c20 736f 2074 6865 206f 7574 7075 ng, so the outpu │ │ │ -000b4c80: 7420 6d61 7472 6978 2077 696c 6c20 6265 t matrix will be │ │ │ -000b4c90: 206f 7574 7075 7420 6f66 2072 6f62 7573 output of robus │ │ │ -000b4ca0: 7420 6d65 7468 6f64 2e3c 2f64 643e 0a3c t method.
    .< │ │ │ -000b4cb0: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ -000b4cc0: 0a3c 6464 3e4f 7574 7075 7420 3244 2061 .
    Output 2D a │ │ │ -000b4cd0: 6666 696e 6520 7472 616e 7366 6f72 6d61 ffine transforma │ │ │ -000b4ce0: 7469 6f6e 206d 6174 7269 7820 5c28 3220 tion matrix \(2 │ │ │ -000b4cf0: 5c74 696d 6573 2033 5c29 206f 7220 656d \times 3\) or em │ │ │ -000b4d00: 7074 7920 6d61 7472 6978 2069 6620 7472 pty matrix if tr │ │ │ -000b4d10: 616e 7366 6f72 6d61 7469 6f6e 0a63 6f75 ansformation.cou │ │ │ -000b4d20: 6c64 206e 6f74 2062 6520 6573 7469 6d61 ld not be estima │ │ │ -000b4d30: 7465 642e 2054 6865 2072 6574 7572 6e65 ted. The returne │ │ │ -000b4d40: 6420 6d61 7472 6978 2068 6173 2074 6865 d matrix has the │ │ │ -000b4d50: 2066 6f6c 6c6f 7769 6e67 2066 6f72 6d3a following form: │ │ │ -000b4d60: 0a5c 280a 5c62 6567 696e 7b62 6d61 7472 .\(.\begin{bmatr │ │ │ -000b4d70: 6978 7d0a 615f 7b31 317d 2026 616d 703b ix}.a_{11} & │ │ │ -000b4d80: 2061 5f7b 3132 7d20 2661 6d70 3b20 625f a_{12} & b_ │ │ │ -000b4d90: 315c 5c0a 615f 7b32 317d 2026 616d 703b 1\\.a_{21} & │ │ │ -000b4da0: 2061 5f7b 3232 7d20 2661 6d70 3b20 625f a_{22} & b_ │ │ │ -000b4db0: 325c 5c0a 5c65 6e64 7b62 6d61 7472 6978 2\\.\end{bmatrix │ │ │ -000b4dc0: 7d0a 5c29 0a0a 5468 6520 6675 6e63 7469 }.\)..The functi │ │ │ -000b4dd0: 6f6e 2065 7374 696d 6174 6573 2061 6e20 on estimates an │ │ │ -000b4de0: 6f70 7469 6d61 6c20 3244 2061 6666 696e optimal 2D affin │ │ │ -000b4df0: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ -000b4e00: 2062 6574 7765 656e 2074 776f 2032 4420 between two 2D │ │ │ -000b4e10: 706f 696e 7420 7365 7473 2075 7369 6e67 point sets using │ │ │ -000b4e20: 2074 6865 0a73 656c 6563 7465 6420 726f the.selected ro │ │ │ -000b4e30: 6275 7374 2061 6c67 6f72 6974 686d 2e0a bust algorithm.. │ │ │ -000b4e40: 0a54 6865 2063 6f6d 7075 7465 6420 7472 .The computed tr │ │ │ -000b4e50: 616e 7366 6f72 6d61 7469 6f6e 2069 7320 ansformation is │ │ │ -000b4e60: 7468 656e 2072 6566 696e 6564 2066 7572 then refined fur │ │ │ -000b4e70: 7468 6572 2028 7573 696e 6720 6f6e 6c79 ther (using only │ │ │ -000b4e80: 2069 6e6c 6965 7273 2920 7769 7468 2074 inliers) with t │ │ │ -000b4e90: 6865 0a4c 6576 656e 6265 7267 2d4d 6172 he.Levenberg-Mar │ │ │ -000b4ea0: 7175 6172 6474 206d 6574 686f 6420 746f quardt method to │ │ │ -000b4eb0: 2072 6564 7563 6520 7468 6520 7265 2d70 reduce the re-p │ │ │ -000b4ec0: 726f 6a65 6374 696f 6e20 6572 726f 7220 rojection error │ │ │ -000b4ed0: 6576 656e 206d 6f72 652e 0a0a 3c62 3e4e even more...N │ │ │ -000b4ee0: 6f74 653a 3c2f 623e 0a54 6865 2052 414e ote:.The RAN │ │ │ -000b4ef0: 5341 4320 6d65 7468 6f64 2063 616e 2068 SAC method can h │ │ │ -000b4f00: 616e 646c 6520 7072 6163 7469 6361 6c6c andle practicall │ │ │ -000b4f10: 7920 616e 7920 7261 7469 6f20 6f66 206f y any ratio of o │ │ │ -000b4f20: 7574 6c69 6572 7320 6275 7420 6e65 6564 utliers but need │ │ │ -000b4f30: 7320 6120 7468 7265 7368 6f6c 6420 746f s a threshold to │ │ │ -000b4f40: 0a64 6973 7469 6e67 7569 7368 2069 6e6c .distinguish inl │ │ │ -000b4f50: 6965 7273 2066 726f 6d20 6f75 746c 6965 iers from outlie │ │ │ -000b4f60: 7273 2e20 5468 6520 6d65 7468 6f64 204c rs. The method L │ │ │ -000b4f70: 4d65 4453 2064 6f65 7320 6e6f 7420 6e65 MeDS does not ne │ │ │ -000b4f80: 6564 2061 6e79 2074 6872 6573 686f 6c64 ed any threshold │ │ │ -000b4f90: 2062 7574 2069 7420 776f 726b 730a 636f but it works.co │ │ │ -000b4fa0: 7272 6563 746c 7920 6f6e 6c79 2077 6865 rrectly only whe │ │ │ -000b4fb0: 6e20 7468 6572 6520 6172 6520 6d6f 7265 n there are more │ │ │ -000b4fc0: 2074 6861 6e20 3530 2520 6f66 2069 6e6c than 50% of inl │ │ │ -000b4fd0: 6965 7273 2e0a 0a53 4545 3a20 6573 7469 iers...SEE: esti │ │ │ -000b4fe0: 6d61 7465 4166 6669 6e65 5061 7274 6961 mateAffinePartia │ │ │ -000b4ff0: 6c32 442c 2067 6574 4166 6669 6e65 5472 l2D, getAffineTr │ │ │ -000b5000: 616e 7366 6f72 6d3c 2f64 643e 0a3c 2f64 ansform
    ....

  • .
  • . │ │ │ -000b5030: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    │ │ │ -000b50a0: 6573 7469 6d61 7465 4166 6669 6e65 3244 estimateAffine2D │ │ │ -000b50b0: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ -000b5110: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -000b5120: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -000b5140: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000b5180: 2f61 3e3c 2f73 7061 6e3e 266e 6273 703b /a>  │ │ │ -000b5190: 3c73 7061 6e20 636c 6173 733d 2265 6c65 estim │ │ │ -000b51b0: 6174 6541 6666 696e 6532 443c 2f73 7061 ateAffine2D │ │ │ -000b51e0: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ -000b5220: 3c2f 613e 266e 6273 703b 6672 6f6d 2c0a  from,. │ │ │ -000b5230: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000b5270: 3c2f 613e 266e 6273 703b 746f 2c0a 203c  to,. < │ │ │ -000b5280: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000b5290: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000b52a0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000b52b0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat inliers) │ │ │ -000b52d0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Computes an opt │ │ │ -000b5300: 696d 616c 2061 6666 696e 6520 7472 616e imal affine tran │ │ │ -000b5310: 7366 6f72 6d61 7469 6f6e 2062 6574 7765 sformation betwe │ │ │ -000b5320: 656e 2074 776f 2032 4420 706f 696e 7420 en two 2D point │ │ │ -000b5330: 7365 7473 2e0a 0a49 7420 636f 6d70 7574 sets...It comput │ │ │ -000b5340: 6573 0a5c 280a 5c62 6567 696e 7b62 6d61 es.\(.\begin{bma │ │ │ -000b5350: 7472 6978 7d0a 785c 5c0a 795c 5c0a 5c65 trix}.x\\.y\\.\e │ │ │ -000b5360: 6e64 7b62 6d61 7472 6978 7d0a 3d0a 5c62 nd{bmatrix}.=.\b │ │ │ -000b5370: 6567 696e 7b62 6d61 7472 6978 7d0a 615f egin{bmatrix}.a_ │ │ │ -000b5380: 7b31 317d 2026 616d 703b 2061 5f7b 3132 {11} & a_{12 │ │ │ -000b5390: 7d5c 5c0a 615f 7b32 317d 2026 616d 703b }\\.a_{21} & │ │ │ -000b53a0: 2061 5f7b 3232 7d5c 5c0a 5c65 6e64 7b62 a_{22}\\.\end{b │ │ │ -000b53b0: 6d61 7472 6978 7d0a 5c62 6567 696e 7b62 matrix}.\begin{b │ │ │ -000b53c0: 6d61 7472 6978 7d0a 585c 5c0a 595c 5c0a matrix}.X\\.Y\\. │ │ │ -000b53d0: 5c65 6e64 7b62 6d61 7472 6978 7d0a 2b0a \end{bmatrix}.+. │ │ │ -000b53e0: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ -000b53f0: 625f 315c 5c0a 625f 325c 5c0a 5c65 6e64 b_1\\.b_2\\.\end │ │ │ -000b5400: 7b62 6d61 7472 6978 7d0a 5c29 3c2f 6469 {bmatrix}.\).
    .
    Parame │ │ │ -000b5430: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ -000b5440: 636f 6465 3e66 726f 6d3c 2f63 6f64 653e code>from │ │ │ -000b5450: 202d 2046 6972 7374 2069 6e70 7574 2032 - First input 2 │ │ │ -000b5460: 4420 706f 696e 7420 7365 7420 636f 6e74 D point set cont │ │ │ -000b5470: 6169 6e69 6e67 205c 2828 582c 5929 5c29 aining \((X,Y)\) │ │ │ -000b5480: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    to - Sec │ │ │ -000b54a0: 6f6e 6420 696e 7075 7420 3244 2070 6f69 ond input 2D poi │ │ │ -000b54b0: 6e74 2073 6574 2063 6f6e 7461 696e 696e nt set containin │ │ │ -000b54c0: 6720 5c28 2878 2c79 295c 292e 3c2f 6464 g \((x,y)\).
    .
    inli │ │ │ -000b54e0: 6572 733c 2f63 6f64 653e 202d 204f 7574 ers - Out │ │ │ -000b54f0: 7075 7420 7665 6374 6f72 2069 6e64 6963 put vector indic │ │ │ -000b5500: 6174 696e 6720 7768 6963 6820 706f 696e ating which poin │ │ │ -000b5510: 7473 2061 7265 2069 6e6c 6965 7273 2028 ts are inliers ( │ │ │ -000b5520: 312d 696e 6c69 6572 2c20 302d 6f75 746c 1-inlier, 0-outl │ │ │ -000b5530: 6965 7229 2e0a 3c75 6c3e 0a20 203c 6c69 ier)..
      .
    • . REF: RANSAC │ │ │ -000b5550: 202d 2052 414e 5341 432d 6261 7365 6420 - RANSAC-based │ │ │ -000b5560: 726f 6275 7374 206d 6574 686f 640a 2020 robust method. │ │ │ -000b5570: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020
    • .
    • . │ │ │ -000b5580: 5245 463a 204c 4d45 4453 202d 204c 6561 REF: LMEDS - Lea │ │ │ -000b5590: 7374 2d4d 6564 6961 6e20 726f 6275 7374 st-Median robust │ │ │ -000b55a0: 206d 6574 686f 640a 5241 4e53 4143 2069 method.RANSAC i │ │ │ -000b55b0: 7320 7468 6520 6465 6661 756c 7420 6d65 s the default me │ │ │ -000b55c0: 7468 6f64 2e0a 2020 3c2f 6c69 3e0a 3c2f thod..
    • ..a point as a │ │ │ -000b55e0: 6e20 696e 6c69 6572 2e20 4170 706c 6965 n inlier. Applie │ │ │ -000b55f0: 7320 6f6e 6c79 2074 6f20 5241 4e53 4143 s only to RANSAC │ │ │ -000b5600: 2e0a 6265 7477 6565 6e20 302e 3935 2061 ..between 0.95 a │ │ │ -000b5610: 6e64 2030 2e39 3920 6973 2075 7375 616c nd 0.99 is usual │ │ │ -000b5620: 6c79 2067 6f6f 6420 656e 6f75 6768 2e20 ly good enough. │ │ │ -000b5630: 5661 6c75 6573 2074 6f6f 2063 6c6f 7365 Values too close │ │ │ -000b5640: 2074 6f20 3120 6361 6e20 736c 6f77 2064 to 1 can slow d │ │ │ -000b5650: 6f77 6e20 7468 6520 6573 7469 6d61 7469 own the estimati │ │ │ -000b5660: 6f6e 0a73 6967 6e69 6669 6361 6e74 6c79 on.significantly │ │ │ -000b5670: 2e20 5661 6c75 6573 206c 6f77 6572 2074 . Values lower t │ │ │ -000b5680: 6861 6e20 302e 382d 302e 3920 6361 6e20 han 0.8-0.9 can │ │ │ -000b5690: 7265 7375 6c74 2069 6e20 616e 2069 6e63 result in an inc │ │ │ -000b56a0: 6f72 7265 6374 6c79 2065 7374 696d 6174 orrectly estimat │ │ │ -000b56b0: 6564 2074 7261 6e73 666f 726d 6174 696f ed transformatio │ │ │ -000b56c0: 6e2e 0a50 6173 7369 6e67 2030 2077 696c n..Passing 0 wil │ │ │ -000b56d0: 6c20 6469 7361 626c 6520 7265 6669 6e69 l disable refini │ │ │ -000b56e0: 6e67 2c20 736f 2074 6865 206f 7574 7075 ng, so the outpu │ │ │ -000b56f0: 7420 6d61 7472 6978 2077 696c 6c20 6265 t matrix will be │ │ │ -000b5700: 206f 7574 7075 7420 6f66 2072 6f62 7573 output of robus │ │ │ -000b5710: 7420 6d65 7468 6f64 2e3c 2f64 643e 0a3c t method.
    .< │ │ │ -000b5720: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ -000b5730: 0a3c 6464 3e4f 7574 7075 7420 3244 2061 .
    Output 2D a │ │ │ -000b5740: 6666 696e 6520 7472 616e 7366 6f72 6d61 ffine transforma │ │ │ -000b5750: 7469 6f6e 206d 6174 7269 7820 5c28 3220 tion matrix \(2 │ │ │ -000b5760: 5c74 696d 6573 2033 5c29 206f 7220 656d \times 3\) or em │ │ │ -000b5770: 7074 7920 6d61 7472 6978 2069 6620 7472 pty matrix if tr │ │ │ -000b5780: 616e 7366 6f72 6d61 7469 6f6e 0a63 6f75 ansformation.cou │ │ │ -000b5790: 6c64 206e 6f74 2062 6520 6573 7469 6d61 ld not be estima │ │ │ -000b57a0: 7465 642e 2054 6865 2072 6574 7572 6e65 ted. The returne │ │ │ -000b57b0: 6420 6d61 7472 6978 2068 6173 2074 6865 d matrix has the │ │ │ -000b57c0: 2066 6f6c 6c6f 7769 6e67 2066 6f72 6d3a following form: │ │ │ -000b57d0: 0a5c 280a 5c62 6567 696e 7b62 6d61 7472 .\(.\begin{bmatr │ │ │ -000b57e0: 6978 7d0a 615f 7b31 317d 2026 616d 703b ix}.a_{11} & │ │ │ -000b57f0: 2061 5f7b 3132 7d20 2661 6d70 3b20 625f a_{12} & b_ │ │ │ -000b5800: 315c 5c0a 615f 7b32 317d 2026 616d 703b 1\\.a_{21} & │ │ │ -000b5810: 2061 5f7b 3232 7d20 2661 6d70 3b20 625f a_{22} & b_ │ │ │ -000b5820: 325c 5c0a 5c65 6e64 7b62 6d61 7472 6978 2\\.\end{bmatrix │ │ │ -000b5830: 7d0a 5c29 0a0a 5468 6520 6675 6e63 7469 }.\)..The functi │ │ │ -000b5840: 6f6e 2065 7374 696d 6174 6573 2061 6e20 on estimates an │ │ │ -000b5850: 6f70 7469 6d61 6c20 3244 2061 6666 696e optimal 2D affin │ │ │ -000b5860: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ -000b5870: 2062 6574 7765 656e 2074 776f 2032 4420 between two 2D │ │ │ -000b5880: 706f 696e 7420 7365 7473 2075 7369 6e67 point sets using │ │ │ -000b5890: 2074 6865 0a73 656c 6563 7465 6420 726f the.selected ro │ │ │ -000b58a0: 6275 7374 2061 6c67 6f72 6974 686d 2e0a bust algorithm.. │ │ │ -000b58b0: 0a54 6865 2063 6f6d 7075 7465 6420 7472 .The computed tr │ │ │ -000b58c0: 616e 7366 6f72 6d61 7469 6f6e 2069 7320 ansformation is │ │ │ -000b58d0: 7468 656e 2072 6566 696e 6564 2066 7572 then refined fur │ │ │ -000b58e0: 7468 6572 2028 7573 696e 6720 6f6e 6c79 ther (using only │ │ │ -000b58f0: 2069 6e6c 6965 7273 2920 7769 7468 2074 inliers) with t │ │ │ -000b5900: 6865 0a4c 6576 656e 6265 7267 2d4d 6172 he.Levenberg-Mar │ │ │ -000b5910: 7175 6172 6474 206d 6574 686f 6420 746f quardt method to │ │ │ -000b5920: 2072 6564 7563 6520 7468 6520 7265 2d70 reduce the re-p │ │ │ -000b5930: 726f 6a65 6374 696f 6e20 6572 726f 7220 rojection error │ │ │ -000b5940: 6576 656e 206d 6f72 652e 0a0a 3c62 3e4e even more...N │ │ │ -000b5950: 6f74 653a 3c2f 623e 0a54 6865 2052 414e ote:.The RAN │ │ │ -000b5960: 5341 4320 6d65 7468 6f64 2063 616e 2068 SAC method can h │ │ │ -000b5970: 616e 646c 6520 7072 6163 7469 6361 6c6c andle practicall │ │ │ -000b5980: 7920 616e 7920 7261 7469 6f20 6f66 206f y any ratio of o │ │ │ -000b5990: 7574 6c69 6572 7320 6275 7420 6e65 6564 utliers but need │ │ │ -000b59a0: 7320 6120 7468 7265 7368 6f6c 6420 746f s a threshold to │ │ │ -000b59b0: 0a64 6973 7469 6e67 7569 7368 2069 6e6c .distinguish inl │ │ │ -000b59c0: 6965 7273 2066 726f 6d20 6f75 746c 6965 iers from outlie │ │ │ -000b59d0: 7273 2e20 5468 6520 6d65 7468 6f64 204c rs. The method L │ │ │ -000b59e0: 4d65 4453 2064 6f65 7320 6e6f 7420 6e65 MeDS does not ne │ │ │ -000b59f0: 6564 2061 6e79 2074 6872 6573 686f 6c64 ed any threshold │ │ │ -000b5a00: 2062 7574 2069 7420 776f 726b 730a 636f but it works.co │ │ │ -000b5a10: 7272 6563 746c 7920 6f6e 6c79 2077 6865 rrectly only whe │ │ │ -000b5a20: 6e20 7468 6572 6520 6172 6520 6d6f 7265 n there are more │ │ │ -000b5a30: 2074 6861 6e20 3530 2520 6f66 2069 6e6c than 50% of inl │ │ │ -000b5a40: 6965 7273 2e0a 0a53 4545 3a20 6573 7469 iers...SEE: esti │ │ │ -000b5a50: 6d61 7465 4166 6669 6e65 5061 7274 6961 mateAffinePartia │ │ │ -000b5a60: 6c32 442c 2067 6574 4166 6669 6e65 5472 l2D, getAffineTr │ │ │ -000b5a70: 616e 7366 6f72 6d3c 2f64 643e 0a3c 2f64 ansform
    ..
    ..
  • .
  • . │ │ │ -000b5aa0: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    esti │ │ │ -000b5b00: 6d61 7465 4166 6669 6e65 3244 3c2f 6833 mateAffine2D

    .
    .
    │ │ │ -000b5b50: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -000b5b70: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -000b5b80: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;Mat< │ │ │ -000b5be0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> estimateA │ │ │ -000b5c10: 6666 696e 6532 443c 2f73 7061 6e3e 3c77 ffine2D(Mat │ │ │ -000b5c80: 266e 6273 703b 6672 6f6d 2c0a 203c 6120  from,. Mat │ │ │ -000b5cd0: 266e 6273 703b 746f 293c 2f73 7061 6e3e  to) │ │ │ -000b5ce0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Comput │ │ │ -000b5d00: 6573 2061 6e20 6f70 7469 6d61 6c20 6166 es an optimal af │ │ │ -000b5d10: 6669 6e65 2074 7261 6e73 666f 726d 6174 fine transformat │ │ │ -000b5d20: 696f 6e20 6265 7477 6565 6e20 7477 6f20 ion between two │ │ │ -000b5d30: 3244 2070 6f69 6e74 2073 6574 732e 0a0a 2D point sets... │ │ │ -000b5d40: 4974 2063 6f6d 7075 7465 730a 5c28 0a5c It computes.\(.\ │ │ │ -000b5d50: 6265 6769 6e7b 626d 6174 7269 787d 0a78 begin{bmatrix}.x │ │ │ -000b5d60: 5c5c 0a79 5c5c 0a5c 656e 647b 626d 6174 \\.y\\.\end{bmat │ │ │ -000b5d70: 7269 787d 0a3d 0a5c 6265 6769 6e7b 626d rix}.=.\begin{bm │ │ │ -000b5d80: 6174 7269 787d 0a61 5f7b 3131 7d20 2661 atrix}.a_{11} &a │ │ │ -000b5d90: 6d70 3b20 615f 7b31 327d 5c5c 0a61 5f7b mp; a_{12}\\.a_{ │ │ │ -000b5da0: 3231 7d20 2661 6d70 3b20 615f 7b32 327d 21} & a_{22} │ │ │ -000b5db0: 5c5c 0a5c 656e 647b 626d 6174 7269 787d \\.\end{bmatrix} │ │ │ -000b5dc0: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ -000b5dd0: 0a58 5c5c 0a59 5c5c 0a5c 656e 647b 626d .X\\.Y\\.\end{bm │ │ │ -000b5de0: 6174 7269 787d 0a2b 0a5c 6265 6769 6e7b atrix}.+.\begin{ │ │ │ -000b5df0: 626d 6174 7269 787d 0a62 5f31 5c5c 0a62 bmatrix}.b_1\\.b │ │ │ -000b5e00: 5f32 5c5c 0a5c 656e 647b 626d 6174 7269 _2\\.\end{bmatri │ │ │ -000b5e10: 787d 0a5c 293c 2f64 6976 3e0a 3c64 6c20 x}.\)
    .
    .< │ │ │ -000b5e30: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    fr │ │ │ -000b5e50: 6f6d 3c2f 636f 6465 3e20 2d20 4669 7273 om - Firs │ │ │ -000b5e60: 7420 696e 7075 7420 3244 2070 6f69 6e74 t input 2D point │ │ │ -000b5e70: 2073 6574 2063 6f6e 7461 696e 696e 6720 set containing │ │ │ -000b5e80: 5c28 2858 2c59 295c 292e 3c2f 6464 3e0a \((X,Y)\).
    . │ │ │ -000b5e90: 3c64 643e 3c63 6f64 653e 746f 3c2f 636f
    to - Second inp │ │ │ -000b5eb0: 7574 2032 4420 706f 696e 7420 7365 7420 ut 2D point set │ │ │ -000b5ec0: 636f 6e74 6169 6e69 6e67 205c 2828 782c containing \((x, │ │ │ -000b5ed0: 7929 5c29 2e0a 3c75 6c3e 0a20 203c 6c69 y)\)..
      .
    • . REF: RANSAC │ │ │ -000b5ef0: 202d 2052 414e 5341 432d 6261 7365 6420 - RANSAC-based │ │ │ -000b5f00: 726f 6275 7374 206d 6574 686f 640a 2020 robust method. │ │ │ -000b5f10: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020
    • .
    • . │ │ │ -000b5f20: 5245 463a 204c 4d45 4453 202d 204c 6561 REF: LMEDS - Lea │ │ │ -000b5f30: 7374 2d4d 6564 6961 6e20 726f 6275 7374 st-Median robust │ │ │ -000b5f40: 206d 6574 686f 640a 5241 4e53 4143 2069 method.RANSAC i │ │ │ -000b5f50: 7320 7468 6520 6465 6661 756c 7420 6d65 s the default me │ │ │ -000b5f60: 7468 6f64 2e0a 2020 3c2f 6c69 3e0a 3c2f thod..
    • ..a point as a │ │ │ -000b5f80: 6e20 696e 6c69 6572 2e20 4170 706c 6965 n inlier. Applie │ │ │ -000b5f90: 7320 6f6e 6c79 2074 6f20 5241 4e53 4143 s only to RANSAC │ │ │ -000b5fa0: 2e0a 6265 7477 6565 6e20 302e 3935 2061 ..between 0.95 a │ │ │ -000b5fb0: 6e64 2030 2e39 3920 6973 2075 7375 616c nd 0.99 is usual │ │ │ -000b5fc0: 6c79 2067 6f6f 6420 656e 6f75 6768 2e20 ly good enough. │ │ │ -000b5fd0: 5661 6c75 6573 2074 6f6f 2063 6c6f 7365 Values too close │ │ │ -000b5fe0: 2074 6f20 3120 6361 6e20 736c 6f77 2064 to 1 can slow d │ │ │ -000b5ff0: 6f77 6e20 7468 6520 6573 7469 6d61 7469 own the estimati │ │ │ -000b6000: 6f6e 0a73 6967 6e69 6669 6361 6e74 6c79 on.significantly │ │ │ -000b6010: 2e20 5661 6c75 6573 206c 6f77 6572 2074 . Values lower t │ │ │ -000b6020: 6861 6e20 302e 382d 302e 3920 6361 6e20 han 0.8-0.9 can │ │ │ -000b6030: 7265 7375 6c74 2069 6e20 616e 2069 6e63 result in an inc │ │ │ -000b6040: 6f72 7265 6374 6c79 2065 7374 696d 6174 orrectly estimat │ │ │ -000b6050: 6564 2074 7261 6e73 666f 726d 6174 696f ed transformatio │ │ │ -000b6060: 6e2e 0a50 6173 7369 6e67 2030 2077 696c n..Passing 0 wil │ │ │ -000b6070: 6c20 6469 7361 626c 6520 7265 6669 6e69 l disable refini │ │ │ -000b6080: 6e67 2c20 736f 2074 6865 206f 7574 7075 ng, so the outpu │ │ │ -000b6090: 7420 6d61 7472 6978 2077 696c 6c20 6265 t matrix will be │ │ │ -000b60a0: 206f 7574 7075 7420 6f66 2072 6f62 7573 output of robus │ │ │ -000b60b0: 7420 6d65 7468 6f64 2e3c 2f64 643e 0a3c t method.
    .< │ │ │ -000b60c0: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ -000b60d0: 0a3c 6464 3e4f 7574 7075 7420 3244 2061 .
    Output 2D a │ │ │ -000b60e0: 6666 696e 6520 7472 616e 7366 6f72 6d61 ffine transforma │ │ │ -000b60f0: 7469 6f6e 206d 6174 7269 7820 5c28 3220 tion matrix \(2 │ │ │ -000b6100: 5c74 696d 6573 2033 5c29 206f 7220 656d \times 3\) or em │ │ │ -000b6110: 7074 7920 6d61 7472 6978 2069 6620 7472 pty matrix if tr │ │ │ -000b6120: 616e 7366 6f72 6d61 7469 6f6e 0a63 6f75 ansformation.cou │ │ │ -000b6130: 6c64 206e 6f74 2062 6520 6573 7469 6d61 ld not be estima │ │ │ -000b6140: 7465 642e 2054 6865 2072 6574 7572 6e65 ted. The returne │ │ │ -000b6150: 6420 6d61 7472 6978 2068 6173 2074 6865 d matrix has the │ │ │ -000b6160: 2066 6f6c 6c6f 7769 6e67 2066 6f72 6d3a following form: │ │ │ -000b6170: 0a5c 280a 5c62 6567 696e 7b62 6d61 7472 .\(.\begin{bmatr │ │ │ -000b6180: 6978 7d0a 615f 7b31 317d 2026 616d 703b ix}.a_{11} & │ │ │ -000b6190: 2061 5f7b 3132 7d20 2661 6d70 3b20 625f a_{12} & b_ │ │ │ -000b61a0: 315c 5c0a 615f 7b32 317d 2026 616d 703b 1\\.a_{21} & │ │ │ -000b61b0: 2061 5f7b 3232 7d20 2661 6d70 3b20 625f a_{22} & b_ │ │ │ -000b61c0: 325c 5c0a 5c65 6e64 7b62 6d61 7472 6978 2\\.\end{bmatrix │ │ │ -000b61d0: 7d0a 5c29 0a0a 5468 6520 6675 6e63 7469 }.\)..The functi │ │ │ -000b61e0: 6f6e 2065 7374 696d 6174 6573 2061 6e20 on estimates an │ │ │ -000b61f0: 6f70 7469 6d61 6c20 3244 2061 6666 696e optimal 2D affin │ │ │ -000b6200: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ -000b6210: 2062 6574 7765 656e 2074 776f 2032 4420 between two 2D │ │ │ -000b6220: 706f 696e 7420 7365 7473 2075 7369 6e67 point sets using │ │ │ -000b6230: 2074 6865 0a73 656c 6563 7465 6420 726f the.selected ro │ │ │ -000b6240: 6275 7374 2061 6c67 6f72 6974 686d 2e0a bust algorithm.. │ │ │ -000b6250: 0a54 6865 2063 6f6d 7075 7465 6420 7472 .The computed tr │ │ │ -000b6260: 616e 7366 6f72 6d61 7469 6f6e 2069 7320 ansformation is │ │ │ -000b6270: 7468 656e 2072 6566 696e 6564 2066 7572 then refined fur │ │ │ -000b6280: 7468 6572 2028 7573 696e 6720 6f6e 6c79 ther (using only │ │ │ -000b6290: 2069 6e6c 6965 7273 2920 7769 7468 2074 inliers) with t │ │ │ -000b62a0: 6865 0a4c 6576 656e 6265 7267 2d4d 6172 he.Levenberg-Mar │ │ │ -000b62b0: 7175 6172 6474 206d 6574 686f 6420 746f quardt method to │ │ │ -000b62c0: 2072 6564 7563 6520 7468 6520 7265 2d70 reduce the re-p │ │ │ -000b62d0: 726f 6a65 6374 696f 6e20 6572 726f 7220 rojection error │ │ │ -000b62e0: 6576 656e 206d 6f72 652e 0a0a 3c62 3e4e even more...N │ │ │ -000b62f0: 6f74 653a 3c2f 623e 0a54 6865 2052 414e ote:.The RAN │ │ │ -000b6300: 5341 4320 6d65 7468 6f64 2063 616e 2068 SAC method can h │ │ │ -000b6310: 616e 646c 6520 7072 6163 7469 6361 6c6c andle practicall │ │ │ -000b6320: 7920 616e 7920 7261 7469 6f20 6f66 206f y any ratio of o │ │ │ -000b6330: 7574 6c69 6572 7320 6275 7420 6e65 6564 utliers but need │ │ │ -000b6340: 7320 6120 7468 7265 7368 6f6c 6420 746f s a threshold to │ │ │ -000b6350: 0a64 6973 7469 6e67 7569 7368 2069 6e6c .distinguish inl │ │ │ -000b6360: 6965 7273 2066 726f 6d20 6f75 746c 6965 iers from outlie │ │ │ -000b6370: 7273 2e20 5468 6520 6d65 7468 6f64 204c rs. The method L │ │ │ -000b6380: 4d65 4453 2064 6f65 7320 6e6f 7420 6e65 MeDS does not ne │ │ │ -000b6390: 6564 2061 6e79 2074 6872 6573 686f 6c64 ed any threshold │ │ │ -000b63a0: 2062 7574 2069 7420 776f 726b 730a 636f but it works.co │ │ │ -000b63b0: 7272 6563 746c 7920 6f6e 6c79 2077 6865 rrectly only whe │ │ │ -000b63c0: 6e20 7468 6572 6520 6172 6520 6d6f 7265 n there are more │ │ │ -000b63d0: 2074 6861 6e20 3530 2520 6f66 2069 6e6c than 50% of inl │ │ │ -000b63e0: 6965 7273 2e0a 0a53 4545 3a20 6573 7469 iers...SEE: esti │ │ │ -000b63f0: 6d61 7465 4166 6669 6e65 5061 7274 6961 mateAffinePartia │ │ │ -000b6400: 6c32 442c 2067 6574 4166 6669 6e65 5472 l2D, getAffineTr │ │ │ -000b6410: 616e 7366 6f72 6d3c 2f64 643e 0a3c 2f64 ansform
    ..
    ..
  • .
  • . │ │ │ -000b6440: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    e │ │ │ -000b64d0: 7374 696d 6174 6541 6666 696e 6532 443c stimateAffine2D< │ │ │ -000b64e0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -000b6540: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -000b6550: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;< │ │ │ -000b6570: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000b6580: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000b6590: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000b65a0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat < │ │ │ -000b65c0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ -000b65d0: 656e 742d 6e61 6d65 223e 6573 7469 6d61 ent-name">estima │ │ │ -000b65e0: 7465 4166 6669 6e65 3244 3c2f 7370 616e teAffine2D( │ │ │ -000b6610: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000b6650: 2f61 3e26 6e62 7370 3b70 7473 312c 0a20 /a> pts1,. │ │ │ -000b6660: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000b66a0: 2f61 3e26 6e62 7370 3b70 7473 322c 0a20 /a> pts2,. │ │ │ -000b66b0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000b66f0: 2f61 3e26 6e62 7370 3b69 6e6c 6965 7273 /a> inliers │ │ │ -000b6700: 2c0a 203c 6120 6872 6566 3d22 5573 6163 ,. UsacParams │ │ │ -000b6750: 266e 6273 703b 7061 7261 6d73 293c 2f73  params)
    .
    .

    ..
  • .
    .

    estim │ │ │ -000b6820: 6174 6541 6666 696e 6550 6172 7469 616c ateAffinePartial │ │ │ -000b6830: 3244 3c2f 6833 3e0a 3c64 6976 2063 6c61 2D

    .
    .
    pu │ │ │ -000b6890: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static Ma │ │ │ -000b6900: 743c 2f61 3e3c 2f73 7061 6e3e 266e 6273 t&nbs │ │ │ -000b6910: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;est │ │ │ -000b6930: 696d 6174 6541 6666 696e 6550 6172 7469 imateAffineParti │ │ │ -000b6940: 616c 3244 3c2f 7370 616e 3e3c 7762 723e al2D │ │ │ -000b6950: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ -000b69b0: 7370 3b66 726f 6d2c 0a20 3c61 2068 7265 sp;from,. Mat&nb │ │ │ -000b6a00: 7370 3b74 6f2c 0a20 3c61 2068 7265 663d sp;to,. Mat  │ │ │ -000b6a50: 3b69 6e6c 6965 7273 2c0a 2069 6e74 266e ;inliers,. int&n │ │ │ -000b6a60: 6273 703b 6d65 7468 6f64 2c0a 2064 6f75 bsp;method,. dou │ │ │ -000b6a70: 626c 6526 6e62 7370 3b72 616e 7361 6352 ble ransacR │ │ │ -000b6a80: 6570 726f 6a54 6872 6573 686f 6c64 2c0a eprojThreshold,. │ │ │ -000b6a90: 206c 6f6e 6726 6e62 7370 3b6d 6178 4974 long maxIt │ │ │ -000b6aa0: 6572 732c 0a20 646f 7562 6c65 266e 6273 ers,. double&nbs │ │ │ -000b6ab0: 703b 636f 6e66 6964 656e 6365 2c0a 206c p;confidence,. l │ │ │ -000b6ac0: 6f6e 6726 6e62 7370 3b72 6566 696e 6549 ong refineI │ │ │ -000b6ad0: 7465 7273 293c 2f73 7061 6e3e 3c2f 6469 ters).
    Computes a │ │ │ -000b6b00: 6e20 6f70 7469 6d61 6c20 6c69 6d69 7465 n optimal limite │ │ │ -000b6b10: 6420 6166 6669 6e65 2074 7261 6e73 666f d affine transfo │ │ │ -000b6b20: 726d 6174 696f 6e20 7769 7468 2034 2064 rmation with 4 d │ │ │ -000b6b30: 6567 7265 6573 206f 6620 6672 6565 646f egrees of freedo │ │ │ -000b6b40: 6d20 6265 7477 6565 6e0a 7477 6f20 3244 m between.two 2D │ │ │ -000b6b50: 2070 6f69 6e74 2073 6574 732e 3c2f 6469 point sets..
    .
    Parame │ │ │ -000b6b80: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ -000b6b90: 636f 6465 3e66 726f 6d3c 2f63 6f64 653e code>from │ │ │ -000b6ba0: 202d 2046 6972 7374 2069 6e70 7574 2032 - First input 2 │ │ │ -000b6bb0: 4420 706f 696e 7420 7365 742e 3c2f 6464 D point set.
    .
    to - Second i │ │ │ -000b6be0: 6e70 7574 2032 4420 706f 696e 7420 7365 nput 2D point se │ │ │ -000b6bf0: 742e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 t.
    .
    inliers │ │ │ -000b6c10: 202d 204f 7574 7075 7420 7665 6374 6f72 - Output vector │ │ │ -000b6c20: 2069 6e64 6963 6174 696e 6720 7768 6963 indicating whic │ │ │ -000b6c30: 6820 706f 696e 7473 2061 7265 2069 6e6c h points are inl │ │ │ -000b6c40: 6965 7273 2e3c 2f64 643e 0a3c 6464 3e3c iers.
    .
    < │ │ │ -000b6c50: 636f 6465 3e6d 6574 686f 643c 2f63 6f64 code>method - Robust meth │ │ │ -000b6c70: 6f64 2075 7365 6420 746f 2063 6f6d 7075 od used to compu │ │ │ -000b6c80: 7465 2074 7261 6e73 666f 726d 6174 696f te transformatio │ │ │ -000b6c90: 6e2e 2054 6865 2066 6f6c 6c6f 7769 6e67 n. The following │ │ │ -000b6ca0: 206d 6574 686f 6473 2061 7265 2070 6f73 methods are pos │ │ │ -000b6cb0: 7369 626c 653a 0a3c 756c 3e0a 2020 3c6c sible:.
      . . REF: RANSA │ │ │ -000b6cd0: 4320 2d20 5241 4e53 4143 2d62 6173 6564 C - RANSAC-based │ │ │ -000b6ce0: 2072 6f62 7573 7420 6d65 7468 6f64 0a20 robust method. │ │ │ -000b6cf0: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020 .
    • . │ │ │ -000b6d00: 2052 4546 3a20 4c4d 4544 5320 2d20 4c65 REF: LMEDS - Le │ │ │ -000b6d10: 6173 742d 4d65 6469 616e 2072 6f62 7573 ast-Median robus │ │ │ -000b6d20: 7420 6d65 7468 6f64 0a52 414e 5341 4320 t method.RANSAC │ │ │ -000b6d30: 6973 2074 6865 2064 6566 6175 6c74 206d is the default m │ │ │ -000b6d40: 6574 686f 642e 0a20 203c 2f6c 693e 0a3c ethod..
    • .< │ │ │ -000b6d50: 2f75 6c3e 3c2f 6464 3e0a 3c64 643e 3c63 /ul>
    .
    ransacReproj │ │ │ -000b6d70: 5468 7265 7368 6f6c 643c 2f63 6f64 653e Threshold │ │ │ -000b6d80: 202d 204d 6178 696d 756d 2072 6570 726f - Maximum repro │ │ │ -000b6d90: 6a65 6374 696f 6e20 6572 726f 7220 696e jection error in │ │ │ -000b6da0: 2074 6865 2052 414e 5341 4320 616c 676f the RANSAC algo │ │ │ -000b6db0: 7269 7468 6d20 746f 2063 6f6e 7369 6465 rithm to conside │ │ │ -000b6dc0: 720a 6120 706f 696e 7420 6173 2061 6e20 r.a point as an │ │ │ -000b6dd0: 696e 6c69 6572 2e20 4170 706c 6965 7320 inlier. Applies │ │ │ -000b6de0: 6f6e 6c79 2074 6f20 5241 4e53 4143 2e3c only to RANSAC.< │ │ │ -000b6df0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e6d /dd>.
    m │ │ │ -000b6e00: 6178 4974 6572 733c 2f63 6f64 653e 202d axIters - │ │ │ -000b6e10: 2054 6865 206d 6178 696d 756d 206e 756d The maximum num │ │ │ -000b6e20: 6265 7220 6f66 2072 6f62 7573 7420 6d65 ber of robust me │ │ │ -000b6e30: 7468 6f64 2069 7465 7261 7469 6f6e 732e thod iterations. │ │ │ -000b6e40: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000b6e50: 636f 6e66 6964 656e 6365 3c2f 636f 6465 confidence - Confidence l │ │ │ -000b6e70: 6576 656c 2c20 6265 7477 6565 6e20 3020 evel, between 0 │ │ │ -000b6e80: 616e 6420 312c 2066 6f72 2074 6865 2065 and 1, for the e │ │ │ -000b6e90: 7374 696d 6174 6564 2074 7261 6e73 666f stimated transfo │ │ │ -000b6ea0: 726d 6174 696f 6e2e 2041 6e79 7468 696e rmation. Anythin │ │ │ -000b6eb0: 670a 6265 7477 6565 6e20 302e 3935 2061 g.between 0.95 a │ │ │ -000b6ec0: 6e64 2030 2e39 3920 6973 2075 7375 616c nd 0.99 is usual │ │ │ -000b6ed0: 6c79 2067 6f6f 6420 656e 6f75 6768 2e20 ly good enough. │ │ │ -000b6ee0: 5661 6c75 6573 2074 6f6f 2063 6c6f 7365 Values too close │ │ │ -000b6ef0: 2074 6f20 3120 6361 6e20 736c 6f77 2064 to 1 can slow d │ │ │ -000b6f00: 6f77 6e20 7468 6520 6573 7469 6d61 7469 own the estimati │ │ │ -000b6f10: 6f6e 0a73 6967 6e69 6669 6361 6e74 6c79 on.significantly │ │ │ -000b6f20: 2e20 5661 6c75 6573 206c 6f77 6572 2074 . Values lower t │ │ │ -000b6f30: 6861 6e20 302e 382d 302e 3920 6361 6e20 han 0.8-0.9 can │ │ │ -000b6f40: 7265 7375 6c74 2069 6e20 616e 2069 6e63 result in an inc │ │ │ -000b6f50: 6f72 7265 6374 6c79 2065 7374 696d 6174 orrectly estimat │ │ │ -000b6f60: 6564 2074 7261 6e73 666f 726d 6174 696f ed transformatio │ │ │ -000b6f70: 6e2e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 n.
    .
    refineIters - Maximum n │ │ │ -000b6fa0: 756d 6265 7220 6f66 2069 7465 7261 7469 umber of iterati │ │ │ -000b6fb0: 6f6e 7320 6f66 2072 6566 696e 696e 6720 ons of refining │ │ │ -000b6fc0: 616c 676f 7269 7468 6d20 284c 6576 656e algorithm (Leven │ │ │ -000b6fd0: 6265 7267 2d4d 6172 7175 6172 6474 292e berg-Marquardt). │ │ │ -000b6fe0: 0a50 6173 7369 6e67 2030 2077 696c 6c20 .Passing 0 will │ │ │ -000b6ff0: 6469 7361 626c 6520 7265 6669 6e69 6e67 disable refining │ │ │ -000b7000: 2c20 736f 2074 6865 206f 7574 7075 7420 , so the output │ │ │ -000b7010: 6d61 7472 6978 2077 696c 6c20 6265 206f matrix will be o │ │ │ -000b7020: 7574 7075 7420 6f66 2072 6f62 7573 7420 utput of robust │ │ │ -000b7030: 6d65 7468 6f64 2e3c 2f64 643e 0a3c 6474 method.
    .
    Returns:
    .< │ │ │ -000b7050: 6464 3e4f 7574 7075 7420 3244 2061 6666 dd>Output 2D aff │ │ │ -000b7060: 696e 6520 7472 616e 7366 6f72 6d61 7469 ine transformati │ │ │ -000b7070: 6f6e 2028 3420 6465 6772 6565 7320 6f66 on (4 degrees of │ │ │ -000b7080: 2066 7265 6564 6f6d 2920 6d61 7472 6978 freedom) matrix │ │ │ -000b7090: 205c 2832 205c 7469 6d65 7320 335c 2920 \(2 \times 3\) │ │ │ -000b70a0: 6f72 0a65 6d70 7479 206d 6174 7269 7820 or.empty matrix │ │ │ -000b70b0: 6966 2074 7261 6e73 666f 726d 6174 696f if transformatio │ │ │ -000b70c0: 6e20 636f 756c 6420 6e6f 7420 6265 2065 n could not be e │ │ │ -000b70d0: 7374 696d 6174 6564 2e0a 0a54 6865 2066 stimated...The f │ │ │ -000b70e0: 756e 6374 696f 6e20 6573 7469 6d61 7465 unction estimate │ │ │ -000b70f0: 7320 616e 206f 7074 696d 616c 2032 4420 s an optimal 2D │ │ │ -000b7100: 6166 6669 6e65 2074 7261 6e73 666f 726d affine transform │ │ │ -000b7110: 6174 696f 6e20 7769 7468 2034 2064 6567 ation with 4 deg │ │ │ -000b7120: 7265 6573 206f 6620 6672 6565 646f 6d20 rees of freedom │ │ │ -000b7130: 6c69 6d69 7465 6420 746f 0a63 6f6d 6269 limited to.combi │ │ │ -000b7140: 6e61 7469 6f6e 7320 6f66 2074 7261 6e73 nations of trans │ │ │ -000b7150: 6c61 7469 6f6e 2c20 726f 7461 7469 6f6e lation, rotation │ │ │ -000b7160: 2c20 616e 6420 756e 6966 6f72 6d20 7363 , and uniform sc │ │ │ -000b7170: 616c 696e 672e 2055 7365 7320 7468 6520 aling. Uses the │ │ │ -000b7180: 7365 6c65 6374 6564 2061 6c67 6f72 6974 selected algorit │ │ │ -000b7190: 686d 2066 6f72 2072 6f62 7573 740a 6573 hm for robust.es │ │ │ -000b71a0: 7469 6d61 7469 6f6e 2e0a 0a54 6865 2063 timation...The c │ │ │ -000b71b0: 6f6d 7075 7465 6420 7472 616e 7366 6f72 omputed transfor │ │ │ -000b71c0: 6d61 7469 6f6e 2069 7320 7468 656e 2072 mation is then r │ │ │ -000b71d0: 6566 696e 6564 2066 7572 7468 6572 2028 efined further ( │ │ │ -000b71e0: 7573 696e 6720 6f6e 6c79 2069 6e6c 6965 using only inlie │ │ │ -000b71f0: 7273 2920 7769 7468 2074 6865 0a4c 6576 rs) with the.Lev │ │ │ -000b7200: 656e 6265 7267 2d4d 6172 7175 6172 6474 enberg-Marquardt │ │ │ -000b7210: 206d 6574 686f 6420 746f 2072 6564 7563 method to reduc │ │ │ -000b7220: 6520 7468 6520 7265 2d70 726f 6a65 6374 e the re-project │ │ │ -000b7230: 696f 6e20 6572 726f 7220 6576 656e 206d ion error even m │ │ │ -000b7240: 6f72 652e 0a0a 4573 7469 6d61 7465 6420 ore...Estimated │ │ │ -000b7250: 7472 616e 7366 6f72 6d61 7469 6f6e 206d transformation m │ │ │ -000b7260: 6174 7269 7820 6973 3a0a 5c28 205c 6265 atrix is:.\( \be │ │ │ -000b7270: 6769 6e7b 626d 6174 7269 787d 205c 636f gin{bmatrix} \co │ │ │ -000b7280: 7328 5c74 6865 7461 2920 5c63 646f 7420 s(\theta) \cdot │ │ │ -000b7290: 7320 2661 6d70 3b20 2d5c 7369 6e28 5c74 s & -\sin(\t │ │ │ -000b72a0: 6865 7461 2920 5c63 646f 7420 7320 2661 heta) \cdot s &a │ │ │ -000b72b0: 6d70 3b20 745f 7820 5c5c 0a20 2020 2020 mp; t_x \\. │ │ │ -000b72c0: 2020 2020 2020 2020 2020 205c 7369 6e28 \sin( │ │ │ -000b72d0: 5c74 6865 7461 2920 5c63 646f 7420 7320 \theta) \cdot s │ │ │ -000b72e0: 2661 6d70 3b20 5c63 6f73 285c 7468 6574 & \cos(\thet │ │ │ -000b72f0: 6129 205c 6364 6f74 2073 2026 616d 703b a) \cdot s & │ │ │ -000b7300: 2074 5f79 0a5c 656e 647b 626d 6174 7269 t_y.\end{bmatri │ │ │ -000b7310: 787d 205c 290a 5768 6572 6520 5c28 205c x} \).Where \( \ │ │ │ -000b7320: 7468 6574 6120 5c29 2069 7320 7468 6520 theta \) is the │ │ │ -000b7330: 726f 7461 7469 6f6e 2061 6e67 6c65 2c20 rotation angle, │ │ │ -000b7340: 5c28 2073 205c 2920 7468 6520 7363 616c \( s \) the scal │ │ │ -000b7350: 696e 6720 6661 6374 6f72 2061 6e64 205c ing factor and \ │ │ │ -000b7360: 2820 745f 782c 2074 5f79 205c 2920 6172 ( t_x, t_y \) ar │ │ │ -000b7370: 650a 7472 616e 736c 6174 696f 6e73 2069 e.translations i │ │ │ -000b7380: 6e20 5c28 2078 2c20 7920 5c29 2061 7865 n \( x, y \) axe │ │ │ -000b7390: 7320 7265 7370 6563 7469 7665 6c79 2e0a s respectively.. │ │ │ -000b73a0: 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a 5468 .Note:.Th │ │ │ -000b73b0: 6520 5241 4e53 4143 206d 6574 686f 6420 e RANSAC method │ │ │ -000b73c0: 6361 6e20 6861 6e64 6c65 2070 7261 6374 can handle pract │ │ │ -000b73d0: 6963 616c 6c79 2061 6e79 2072 6174 696f ically any ratio │ │ │ -000b73e0: 206f 6620 6f75 746c 6965 7273 2062 7574 of outliers but │ │ │ -000b73f0: 206e 6565 6420 6120 7468 7265 7368 6f6c need a threshol │ │ │ -000b7400: 6420 746f 0a64 6973 7469 6e67 7569 7368 d to.distinguish │ │ │ -000b7410: 2069 6e6c 6965 7273 2066 726f 6d20 6f75 inliers from ou │ │ │ -000b7420: 746c 6965 7273 2e20 5468 6520 6d65 7468 tliers. The meth │ │ │ -000b7430: 6f64 204c 4d65 4453 2064 6f65 7320 6e6f od LMeDS does no │ │ │ -000b7440: 7420 6e65 6564 2061 6e79 2074 6872 6573 t need any thres │ │ │ -000b7450: 686f 6c64 2062 7574 2069 7420 776f 726b hold but it work │ │ │ -000b7460: 730a 636f 7272 6563 746c 7920 6f6e 6c79 s.correctly only │ │ │ -000b7470: 2077 6865 6e20 7468 6572 6520 6172 6520 when there are │ │ │ -000b7480: 6d6f 7265 2074 6861 6e20 3530 2520 6f66 more than 50% of │ │ │ -000b7490: 2069 6e6c 6965 7273 2e0a 0a53 4545 3a20 inliers...SEE: │ │ │ -000b74a0: 6573 7469 6d61 7465 4166 6669 6e65 3244 estimateAffine2D │ │ │ -000b74b0: 2c20 6765 7441 6666 696e 6554 7261 6e73 , getAffineTrans │ │ │ -000b74c0: 666f 726d 3c2f 6464 3e0a 3c2f 646c 3e0a form.
    . │ │ │ -000b74d0: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e
    .
    .
  • .
    .

    findEsse │ │ │ -000969e0: 6e74 6961 6c4d 6174 3c2f 6833 3e0a 3c64 ntialMat

    ..public stati │ │ │ -00096a50: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c Mat findEssential │ │ │ -00096af0: 4d61 743c 2f73 7061 6e3e 3c77 6272 3e3c Mat< │ │ │ -00096b00: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ -00096b10: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ -00096b60: 703b 706f 696e 7473 312c 0a20 3c61 2068 p;points1,. Mat& │ │ │ -00096bb0: 6e62 7370 3b70 6f69 6e74 7332 2c0a 2064 nbsp;points2,. d │ │ │ -00096bc0: 6f75 626c 6526 6e62 7370 3b66 6f63 616c ouble focal │ │ │ -00096bd0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. Point  │ │ │ -00096c20: 7070 2c0a 2069 6e74 266e 6273 703b 6d65 pp,. int me │ │ │ -00096c30: 7468 6f64 2c0a 2064 6f75 626c 6526 6e62 thod,. double&nb │ │ │ -00096c40: 7370 3b70 726f 6229 3c2f 7370 616e 3e3c sp;prob)< │ │ │ -00096c50: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ -00096c70: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .points1< │ │ │ -00096c90: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ -00096ca0: 6620 4e20 284e 2026 6774 3b3d 2035 2920 f N (N >= 5) │ │ │ -00096cb0: 3244 2070 6f69 6e74 7320 6672 6f6d 2074 2D points from t │ │ │ -00096cc0: 6865 2066 6972 7374 2069 6d61 6765 2e20 he first image. │ │ │ -00096cd0: 5468 6520 706f 696e 7420 636f 6f72 6469 The point coordi │ │ │ -00096ce0: 6e61 7465 7320 7368 6f75 6c64 0a62 6520 nates should.be │ │ │ -00096cf0: 666c 6f61 7469 6e67 2d70 6f69 6e74 2028 floating-point ( │ │ │ -00096d00: 7369 6e67 6c65 206f 7220 646f 7562 6c65 single or double │ │ │ -00096d10: 2070 7265 6369 7369 6f6e 292e 3c2f 6464 precision)..
    poin │ │ │ -00096d30: 7473 323c 2f63 6f64 653e 202d 2041 7272 ts2 - Arr │ │ │ -00096d40: 6179 206f 6620 7468 6520 7365 636f 6e64 ay of the second │ │ │ -00096d50: 2069 6d61 6765 2070 6f69 6e74 7320 6f66 image points of │ │ │ -00096d60: 2074 6865 2073 616d 6520 7369 7a65 2061 the same size a │ │ │ -00096d70: 6e64 2066 6f72 6d61 7420 6173 2070 6f69 nd format as poi │ │ │ -00096d80: 6e74 7331 202e 3c2f 6464 3e0a 3c64 643e nts1 .
    .
    │ │ │ -00096d90: 3c63 6f64 653e 666f 6361 6c3c 2f63 6f64 focal - focal lengt │ │ │ -00096db0: 6820 6f66 2074 6865 2063 616d 6572 612e h of the camera. │ │ │ -00096dc0: 204e 6f74 6520 7468 6174 2074 6869 7320 Note that this │ │ │ -00096dd0: 6675 6e63 7469 6f6e 2061 7373 756d 6573 function assumes │ │ │ -00096de0: 2074 6861 7420 706f 696e 7473 3120 616e that points1 an │ │ │ -00096df0: 6420 706f 696e 7473 320a 6172 6520 6665 d points2.are fe │ │ │ -00096e00: 6174 7572 6520 706f 696e 7473 2066 726f ature points fro │ │ │ -00096e10: 6d20 6361 6d65 7261 7320 7769 7468 2073 m cameras with s │ │ │ -00096e20: 616d 6520 666f 6361 6c20 6c65 6e67 7468 ame focal length │ │ │ -00096e30: 2061 6e64 2070 7269 6e63 6970 616c 2070 and principal p │ │ │ -00096e40: 6f69 6e74 2e3c 2f64 643e 0a3c 6464 3e3c oint.
    .
    < │ │ │ -00096e50: 636f 6465 3e70 703c 2f63 6f64 653e 202d code>pp - │ │ │ -00096e60: 2070 7269 6e63 6970 616c 2070 6f69 6e74 principal point │ │ │ -00096e70: 206f 6620 7468 6520 6361 6d65 7261 2e3c of the camera.< │ │ │ -00096e80: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e6d /dd>.
    m │ │ │ -00096e90: 6574 686f 643c 2f63 6f64 653e 202d 204d ethod - M │ │ │ -00096ea0: 6574 686f 6420 666f 7220 636f 6d70 7574 ethod for comput │ │ │ -00096eb0: 696e 6720 6120 6675 6e64 616d 656e 7461 ing a fundamenta │ │ │ -00096ec0: 6c20 6d61 7472 6978 2e0a 3c75 6c3e 0a20 l matrix..
      . │ │ │ -00096ed0: 203c 6c69 3e0a 2020 2052 4546 3a20 5241
    • . REF: RA │ │ │ -00096ee0: 4e53 4143 2066 6f72 2074 6865 2052 414e NSAC for the RAN │ │ │ -00096ef0: 5341 4320 616c 676f 7269 7468 6d2e 0a20 SAC algorithm.. │ │ │ -00096f00: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020
    • .
    • . │ │ │ -00096f10: 2052 4546 3a20 4c4d 4544 5320 666f 7220 REF: LMEDS for │ │ │ -00096f20: 7468 6520 4c4d 6564 5320 616c 676f 7269 the LMedS algori │ │ │ -00096f30: 7468 6d2e 0a20 203c 2f6c 693e 0a3c 2f75 thm..
    • .
      .line in pixel │ │ │ -00096f50: 732c 2062 6579 6f6e 6420 7768 6963 6820 s, beyond which │ │ │ -00096f60: 7468 6520 706f 696e 7420 6973 2063 6f6e the point is con │ │ │ -00096f70: 7369 6465 7265 6420 616e 206f 7574 6c69 sidered an outli │ │ │ -00096f80: 6572 2061 6e64 2069 7320 6e6f 7420 7573 er and is not us │ │ │ -00096f90: 6564 2066 6f72 2063 6f6d 7075 7469 6e67 ed for computing │ │ │ -00096fa0: 2074 6865 0a66 696e 616c 2066 756e 6461 the.final funda │ │ │ -00096fb0: 6d65 6e74 616c 206d 6174 7269 782e 2049 mental matrix. I │ │ │ -00096fc0: 7420 6361 6e20 6265 2073 6574 2074 6f20 t can be set to │ │ │ -00096fd0: 736f 6d65 7468 696e 6720 6c69 6b65 2031 something like 1 │ │ │ -00096fe0: 2d33 2c20 6465 7065 6e64 696e 6720 6f6e -3, depending on │ │ │ -00096ff0: 2074 6865 2061 6363 7572 6163 7920 6f66 the accuracy of │ │ │ -00097000: 2074 6865 0a70 6f69 6e74 206c 6f63 616c the.point local │ │ │ -00097010: 697a 6174 696f 6e2c 2069 6d61 6765 2072 ization, image r │ │ │ -00097020: 6573 6f6c 7574 696f 6e2c 2061 6e64 2074 esolution, and t │ │ │ -00097030: 6865 2069 6d61 6765 206e 6f69 7365 2e3c he image noise.< │ │ │ -00097040: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e70 /dd>.
      p │ │ │ -00097050: 726f 623c 2f63 6f64 653e 202d 2050 6172 rob - Par │ │ │ -00097060: 616d 6574 6572 2075 7365 6420 666f 7220 ameter used for │ │ │ -00097070: 7468 6520 5241 4e53 4143 206f 7220 4c4d the RANSAC or LM │ │ │ -00097080: 6564 5320 6d65 7468 6f64 7320 6f6e 6c79 edS methods only │ │ │ -00097090: 2e20 4974 2073 7065 6369 6669 6573 2061 . It specifies a │ │ │ -000970a0: 2064 6573 6972 6162 6c65 206c 6576 656c desirable level │ │ │ -000970b0: 206f 660a 636f 6e66 6964 656e 6365 2028 of.confidence ( │ │ │ -000970c0: 7072 6f62 6162 696c 6974 7929 2074 6861 probability) tha │ │ │ -000970d0: 7420 7468 6520 6573 7469 6d61 7465 6420 t the estimated │ │ │ -000970e0: 6d61 7472 6978 2069 7320 636f 7272 6563 matrix is correc │ │ │ -000970f0: 742e 0a66 6f72 2074 6865 206f 7468 6572 t..for the other │ │ │ -00097100: 2070 6f69 6e74 732e 2054 6865 2061 7272 points. The arr │ │ │ -00097110: 6179 2069 7320 636f 6d70 7574 6564 206f ay is computed o │ │ │ -00097120: 6e6c 7920 696e 2074 6865 2052 414e 5341 nly in the RANSA │ │ │ -00097130: 4320 616e 6420 4c4d 6564 5320 6d65 7468 C and LMedS meth │ │ │ -00097140: 6f64 732e 0a0a 5468 6973 2066 756e 6374 ods...This funct │ │ │ -00097150: 696f 6e20 6469 6666 6572 7320 6672 6f6d ion differs from │ │ │ -00097160: 2074 6865 206f 6e65 2061 626f 7665 2074 the one above t │ │ │ -00097170: 6861 7420 6974 2063 6f6d 7075 7465 7320 hat it computes │ │ │ -00097180: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ -00097190: 206d 6174 7269 7820 6672 6f6d 2066 6f63 matrix from foc │ │ │ -000971a0: 616c 206c 656e 6774 6820 616e 640a 7072 al length and.pr │ │ │ -000971b0: 696e 6369 7061 6c20 706f 696e 743a 0a0a incipal point:.. │ │ │ -000971c0: 5c28 4120 3d0a 5c62 6567 696e 7b62 6d61 \(A =.\begin{bma │ │ │ -000971d0: 7472 6978 7d0a 6620 2661 6d70 3b20 3020 trix}.f & 0 │ │ │ -000971e0: 2661 6d70 3b20 785f 7b70 707d 2020 5c5c & x_{pp} \\ │ │ │ -000971f0: 0a30 2026 616d 703b 2066 2026 616d 703b .0 & f & │ │ │ -00097200: 2079 5f7b 7070 7d20 205c 5c0a 3020 2661 y_{pp} \\.0 &a │ │ │ -00097210: 6d70 3b20 3020 2661 6d70 3b20 310a 5c65 mp; 0 & 1.\e │ │ │ -00097220: 6e64 7b62 6d61 7472 6978 7d5c 293c 2f64 nd{bmatrix}\).
      Returns:< │ │ │ -00097240: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
      automat │ │ │ -00097250: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ -00097260: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
      .
    ..
    ..
  • ..

    findEssent │ │ │ -00097310: 6961 6c4d 6174 3c2f 6833 3e0a 3c64 6976 ialMat

    .
    .
    public static< │ │ │ -00097380: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> Mat │ │ │ -000973f0: 266e 6273 703b 3c73 7061 6e20 636c 6173  findEssentialMa │ │ │ -00097420: 743c 2f73 7061 6e3e 3c77 6272 3e3c 7370 t(Mat  │ │ │ -00097490: 706f 696e 7473 312c 0a20 3c61 2068 7265 points1,. Mat&nb │ │ │ -000974e0: 7370 3b70 6f69 6e74 7332 2c0a 2064 6f75 sp;points2,. dou │ │ │ -000974f0: 626c 6526 6e62 7370 3b66 6f63 616c 2c0a ble focal,. │ │ │ -00097500: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 P │ │ │ -00097540: 6f69 6e74 3c2f 613e 266e 6273 703b 7070 oint pp │ │ │ -00097550: 2c0a 2069 6e74 266e 6273 703b 6d65 7468 ,. int meth │ │ │ -00097560: 6f64 293c 2f73 7061 6e3e 3c2f 6469 763e od)
    │ │ │ -00097570: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ -00097590: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    points1 - Array of N ( │ │ │ -000975c0: 4e20 2667 743b 3d20 3529 2032 4420 706f N >= 5) 2D po │ │ │ -000975d0: 696e 7473 2066 726f 6d20 7468 6520 6669 ints from the fi │ │ │ -000975e0: 7273 7420 696d 6167 652e 2054 6865 2070 rst image. The p │ │ │ -000975f0: 6f69 6e74 2063 6f6f 7264 696e 6174 6573 oint coordinates │ │ │ -00097600: 2073 686f 756c 640a 6265 2066 6c6f 6174 should.be float │ │ │ -00097610: 696e 672d 706f 696e 7420 2873 696e 676c ing-point (singl │ │ │ -00097620: 6520 6f72 2064 6f75 626c 6520 7072 6563 e or double prec │ │ │ -00097630: 6973 696f 6e29 2e3c 2f64 643e 0a3c 6464 ision).
    .
    points2 - Array of │ │ │ -00097660: 2074 6865 2073 6563 6f6e 6420 696d 6167 the second imag │ │ │ -00097670: 6520 706f 696e 7473 206f 6620 7468 6520 e points of the │ │ │ -00097680: 7361 6d65 2073 697a 6520 616e 6420 666f same size and fo │ │ │ -00097690: 726d 6174 2061 7320 706f 696e 7473 3120 rmat as points1 │ │ │ -000976a0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    focal - │ │ │ -000976c0: 666f 6361 6c20 6c65 6e67 7468 206f 6620 focal length of │ │ │ -000976d0: 7468 6520 6361 6d65 7261 2e20 4e6f 7465 the camera. Note │ │ │ -000976e0: 2074 6861 7420 7468 6973 2066 756e 6374 that this funct │ │ │ -000976f0: 696f 6e20 6173 7375 6d65 7320 7468 6174 ion assumes that │ │ │ -00097700: 2070 6f69 6e74 7331 2061 6e64 2070 6f69 points1 and poi │ │ │ -00097710: 6e74 7332 0a61 7265 2066 6561 7475 7265 nts2.are feature │ │ │ -00097720: 2070 6f69 6e74 7320 6672 6f6d 2063 616d points from cam │ │ │ -00097730: 6572 6173 2077 6974 6820 7361 6d65 2066 eras with same f │ │ │ -00097740: 6f63 616c 206c 656e 6774 6820 616e 6420 ocal length and │ │ │ -00097750: 7072 696e 6369 7061 6c20 706f 696e 742e principal point. │ │ │ -00097760: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -00097770: 7070 3c2f 636f 6465 3e20 2d20 7072 696e pp - prin │ │ │ -00097780: 6369 7061 6c20 706f 696e 7420 6f66 2074 cipal point of t │ │ │ -00097790: 6865 2063 616d 6572 612e 3c2f 6464 3e0a he camera.
    . │ │ │ -000977a0: 3c64 643e 3c63 6f64 653e 6d65 7468 6f64
    method │ │ │ -000977b0: 3c2f 636f 6465 3e20 2d20 4d65 7468 6f64 - Method │ │ │ -000977c0: 2066 6f72 2063 6f6d 7075 7469 6e67 2061 for computing a │ │ │ -000977d0: 2066 756e 6461 6d65 6e74 616c 206d 6174 fundamental mat │ │ │ -000977e0: 7269 782e 0a3c 756c 3e0a 2020 3c6c 693e rix..
      .
    • │ │ │ -000977f0: 0a20 2020 5245 463a 2052 414e 5341 4320 . REF: RANSAC │ │ │ -00097800: 666f 7220 7468 6520 5241 4e53 4143 2061 for the RANSAC a │ │ │ -00097810: 6c67 6f72 6974 686d 2e0a 2020 3c2f 6c69 lgorithm..
    • .
    • . REF: │ │ │ -00097830: 204c 4d45 4453 2066 6f72 2074 6865 204c LMEDS for the L │ │ │ -00097840: 4d65 6453 2061 6c67 6f72 6974 686d 2e0a MedS algorithm.. │ │ │ -00097850: 2020 3c2f 6c69 3e0a 3c2f 756c 3e0a 6c69
    • .
    .li │ │ │ -00097860: 6e65 2069 6e20 7069 7865 6c73 2c20 6265 ne in pixels, be │ │ │ -00097870: 796f 6e64 2077 6869 6368 2074 6865 2070 yond which the p │ │ │ -00097880: 6f69 6e74 2069 7320 636f 6e73 6964 6572 oint is consider │ │ │ -00097890: 6564 2061 6e20 6f75 746c 6965 7220 616e ed an outlier an │ │ │ -000978a0: 6420 6973 206e 6f74 2075 7365 6420 666f d is not used fo │ │ │ -000978b0: 7220 636f 6d70 7574 696e 6720 7468 650a r computing the. │ │ │ -000978c0: 6669 6e61 6c20 6675 6e64 616d 656e 7461 final fundamenta │ │ │ -000978d0: 6c20 6d61 7472 6978 2e20 4974 2063 616e l matrix. It can │ │ │ -000978e0: 2062 6520 7365 7420 746f 2073 6f6d 6574 be set to somet │ │ │ -000978f0: 6869 6e67 206c 696b 6520 312d 332c 2064 hing like 1-3, d │ │ │ -00097900: 6570 656e 6469 6e67 206f 6e20 7468 6520 epending on the │ │ │ -00097910: 6163 6375 7261 6379 206f 6620 7468 650a accuracy of the. │ │ │ -00097920: 706f 696e 7420 6c6f 6361 6c69 7a61 7469 point localizati │ │ │ -00097930: 6f6e 2c20 696d 6167 6520 7265 736f 6c75 on, image resolu │ │ │ -00097940: 7469 6f6e 2c20 616e 6420 7468 6520 696d tion, and the im │ │ │ -00097950: 6167 6520 6e6f 6973 652e 0a63 6f6e 6669 age noise..confi │ │ │ -00097960: 6465 6e63 6520 2870 726f 6261 6269 6c69 dence (probabili │ │ │ -00097970: 7479 2920 7468 6174 2074 6865 2065 7374 ty) that the est │ │ │ -00097980: 696d 6174 6564 206d 6174 7269 7820 6973 imated matrix is │ │ │ -00097990: 2063 6f72 7265 6374 2e0a 666f 7220 7468 correct..for th │ │ │ -000979a0: 6520 6f74 6865 7220 706f 696e 7473 2e20 e other points. │ │ │ -000979b0: 5468 6520 6172 7261 7920 6973 2063 6f6d The array is com │ │ │ -000979c0: 7075 7465 6420 6f6e 6c79 2069 6e20 7468 puted only in th │ │ │ -000979d0: 6520 5241 4e53 4143 2061 6e64 204c 4d65 e RANSAC and LMe │ │ │ -000979e0: 6453 206d 6574 686f 6473 2e0a 0a54 6869 dS methods...Thi │ │ │ -000979f0: 7320 6675 6e63 7469 6f6e 2064 6966 6665 s function diffe │ │ │ -00097a00: 7273 2066 726f 6d20 7468 6520 6f6e 6520 rs from the one │ │ │ -00097a10: 6162 6f76 6520 7468 6174 2069 7420 636f above that it co │ │ │ -00097a20: 6d70 7574 6573 2063 616d 6572 6120 696e mputes camera in │ │ │ -00097a30: 7472 696e 7369 6320 6d61 7472 6978 2066 trinsic matrix f │ │ │ -00097a40: 726f 6d20 666f 6361 6c20 6c65 6e67 7468 rom focal length │ │ │ -00097a50: 2061 6e64 0a70 7269 6e63 6970 616c 2070 and.principal p │ │ │ -00097a60: 6f69 6e74 3a0a 0a5c 2841 203d 0a5c 6265 oint:..\(A =.\be │ │ │ -00097a70: 6769 6e7b 626d 6174 7269 787d 0a66 2026 gin{bmatrix}.f & │ │ │ -00097a80: 616d 703b 2030 2026 616d 703b 2078 5f7b amp; 0 & x_{ │ │ │ -00097a90: 7070 7d20 205c 5c0a 3020 2661 6d70 3b20 pp} \\.0 & │ │ │ -00097aa0: 6620 2661 6d70 3b20 795f 7b70 707d 2020 f & y_{pp} │ │ │ -00097ab0: 5c5c 0a30 2026 616d 703b 2030 2026 616d \\.0 & 0 &am │ │ │ -00097ac0: 703b 2031 0a5c 656e 647b 626d 6174 7269 p; 1.\end{bmatri │ │ │ -00097ad0: 787d 5c29 3c2f 6464 3e0a 3c64 743e 5265 x}\)
    .
    Re │ │ │ -00097ae0: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ -00097af0: 6175 746f 6d61 7469 6361 6c6c 7920 6765 automatically ge │ │ │ -00097b00: 6e65 7261 7465 643c 2f64 643e 0a3c 2f64 nerated
    ..
    ..
  • .
  • . │ │ │ -00097b30: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    findEss │ │ │ -00097bb0: 656e 7469 616c 4d61 743c 2f68 333e 0a3c entialMat

    .< │ │ │ -00097bc0: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ -00097bd0: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ -00097be0: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ -00097bf0: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ -00097c20: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ -00097c30: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ -00097c40: 726e 2d74 7970 6522 3e3c 6120 6872 6566 rn-type">Mat findEssentia │ │ │ -00097cc0: 6c4d 6174 3c2f 7370 616e 3e3c 7762 723e lMat │ │ │ -00097cd0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ -00097d30: 7370 3b70 6f69 6e74 7331 2c0a 203c 6120 sp;points1,. Mat │ │ │ -00097d80: 266e 6273 703b 706f 696e 7473 322c 0a20  points2,. │ │ │ -00097d90: 646f 7562 6c65 266e 6273 703b 666f 6361 double foca │ │ │ -00097da0: 6c2c 0a20 3c61 2068 7265 663d 222e 2e2f l,. Point  │ │ │ -00097df0: 3b70 7029 3c2f 7370 616e 3e3c 2f64 6976 ;pp).
    .
    Paramet │ │ │ -00097e20: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    points1 - Array of N │ │ │ -00097e50: 284e 2026 6774 3b3d 2035 2920 3244 2070 (N >= 5) 2D p │ │ │ -00097e60: 6f69 6e74 7320 6672 6f6d 2074 6865 2066 oints from the f │ │ │ -00097e70: 6972 7374 2069 6d61 6765 2e20 5468 6520 irst image. The │ │ │ -00097e80: 706f 696e 7420 636f 6f72 6469 6e61 7465 point coordinate │ │ │ -00097e90: 7320 7368 6f75 6c64 0a62 6520 666c 6f61 s should.be floa │ │ │ -00097ea0: 7469 6e67 2d70 6f69 6e74 2028 7369 6e67 ting-point (sing │ │ │ -00097eb0: 6c65 206f 7220 646f 7562 6c65 2070 7265 le or double pre │ │ │ -00097ec0: 6369 7369 6f6e 292e 3c2f 6464 3e0a 3c64 cision).
    .points2< │ │ │ -00097ee0: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ -00097ef0: 6620 7468 6520 7365 636f 6e64 2069 6d61 f the second ima │ │ │ -00097f00: 6765 2070 6f69 6e74 7320 6f66 2074 6865 ge points of the │ │ │ -00097f10: 2073 616d 6520 7369 7a65 2061 6e64 2066 same size and f │ │ │ -00097f20: 6f72 6d61 7420 6173 2070 6f69 6e74 7331 ormat as points1 │ │ │ -00097f30: 202e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 ..
    focal - │ │ │ -00097f50: 2066 6f63 616c 206c 656e 6774 6820 6f66 focal length of │ │ │ -00097f60: 2074 6865 2063 616d 6572 612e 204e 6f74 the camera. Not │ │ │ -00097f70: 6520 7468 6174 2074 6869 7320 6675 6e63 e that this func │ │ │ -00097f80: 7469 6f6e 2061 7373 756d 6573 2074 6861 tion assumes tha │ │ │ -00097f90: 7420 706f 696e 7473 3120 616e 6420 706f t points1 and po │ │ │ -00097fa0: 696e 7473 320a 6172 6520 6665 6174 7572 ints2.are featur │ │ │ -00097fb0: 6520 706f 696e 7473 2066 726f 6d20 6361 e points from ca │ │ │ -00097fc0: 6d65 7261 7320 7769 7468 2073 616d 6520 meras with same │ │ │ -00097fd0: 666f 6361 6c20 6c65 6e67 7468 2061 6e64 focal length and │ │ │ -00097fe0: 2070 7269 6e63 6970 616c 2070 6f69 6e74 principal point │ │ │ -00097ff0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    pp - pri │ │ │ -00098010: 6e63 6970 616c 2070 6f69 6e74 206f 6620 ncipal point of │ │ │ -00098020: 7468 6520 6361 6d65 7261 2e0a 3c75 6c3e the camera..
      │ │ │ -00098030: 0a20 203c 6c69 3e0a 2020 2052 4546 3a20 .
    • . REF: │ │ │ -00098040: 5241 4e53 4143 2066 6f72 2074 6865 2052 RANSAC for the R │ │ │ -00098050: 414e 5341 4320 616c 676f 7269 7468 6d2e ANSAC algorithm. │ │ │ -00098060: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ -00098070: 2020 2052 4546 3a20 4c4d 4544 5320 666f REF: LMEDS fo │ │ │ -00098080: 7220 7468 6520 4c4d 6564 5320 616c 676f r the LMedS algo │ │ │ -00098090: 7269 7468 6d2e 0a20 203c 2f6c 693e 0a3c rithm..
    • .< │ │ │ -000980a0: 2f75 6c3e 0a6c 696e 6520 696e 2070 6978 /ul>.line in pix │ │ │ -000980b0: 656c 732c 2062 6579 6f6e 6420 7768 6963 els, beyond whic │ │ │ -000980c0: 6820 7468 6520 706f 696e 7420 6973 2063 h the point is c │ │ │ -000980d0: 6f6e 7369 6465 7265 6420 616e 206f 7574 onsidered an out │ │ │ -000980e0: 6c69 6572 2061 6e64 2069 7320 6e6f 7420 lier and is not │ │ │ -000980f0: 7573 6564 2066 6f72 2063 6f6d 7075 7469 used for computi │ │ │ -00098100: 6e67 2074 6865 0a66 696e 616c 2066 756e ng the.final fun │ │ │ -00098110: 6461 6d65 6e74 616c 206d 6174 7269 782e damental matrix. │ │ │ -00098120: 2049 7420 6361 6e20 6265 2073 6574 2074 It can be set t │ │ │ -00098130: 6f20 736f 6d65 7468 696e 6720 6c69 6b65 o something like │ │ │ -00098140: 2031 2d33 2c20 6465 7065 6e64 696e 6720 1-3, depending │ │ │ -00098150: 6f6e 2074 6865 2061 6363 7572 6163 7920 on the accuracy │ │ │ -00098160: 6f66 2074 6865 0a70 6f69 6e74 206c 6f63 of the.point loc │ │ │ -00098170: 616c 697a 6174 696f 6e2c 2069 6d61 6765 alization, image │ │ │ -00098180: 2072 6573 6f6c 7574 696f 6e2c 2061 6e64 resolution, and │ │ │ -00098190: 2074 6865 2069 6d61 6765 206e 6f69 7365 the image noise │ │ │ -000981a0: 2e0a 636f 6e66 6964 656e 6365 2028 7072 ..confidence (pr │ │ │ -000981b0: 6f62 6162 696c 6974 7929 2074 6861 7420 obability) that │ │ │ -000981c0: 7468 6520 6573 7469 6d61 7465 6420 6d61 the estimated ma │ │ │ -000981d0: 7472 6978 2069 7320 636f 7272 6563 742e trix is correct. │ │ │ -000981e0: 0a66 6f72 2074 6865 206f 7468 6572 2070 .for the other p │ │ │ -000981f0: 6f69 6e74 732e 2054 6865 2061 7272 6179 oints. The array │ │ │ -00098200: 2069 7320 636f 6d70 7574 6564 206f 6e6c is computed onl │ │ │ -00098210: 7920 696e 2074 6865 2052 414e 5341 4320 y in the RANSAC │ │ │ -00098220: 616e 6420 4c4d 6564 5320 6d65 7468 6f64 and LMedS method │ │ │ -00098230: 732e 0a0a 5468 6973 2066 756e 6374 696f s...This functio │ │ │ -00098240: 6e20 6469 6666 6572 7320 6672 6f6d 2074 n differs from t │ │ │ -00098250: 6865 206f 6e65 2061 626f 7665 2074 6861 he one above tha │ │ │ -00098260: 7420 6974 2063 6f6d 7075 7465 7320 6361 t it computes ca │ │ │ -00098270: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -00098280: 6174 7269 7820 6672 6f6d 2066 6f63 616c atrix from focal │ │ │ -00098290: 206c 656e 6774 6820 616e 640a 7072 696e length and.prin │ │ │ -000982a0: 6369 7061 6c20 706f 696e 743a 0a0a 5c28 cipal point:..\( │ │ │ -000982b0: 4120 3d0a 5c62 6567 696e 7b62 6d61 7472 A =.\begin{bmatr │ │ │ -000982c0: 6978 7d0a 6620 2661 6d70 3b20 3020 2661 ix}.f & 0 &a │ │ │ -000982d0: 6d70 3b20 785f 7b70 707d 2020 5c5c 0a30 mp; x_{pp} \\.0 │ │ │ -000982e0: 2026 616d 703b 2066 2026 616d 703b 2079 & f & y │ │ │ -000982f0: 5f7b 7070 7d20 205c 5c0a 3020 2661 6d70 _{pp} \\.0 & │ │ │ -00098300: 3b20 3020 2661 6d70 3b20 310a 5c65 6e64 ; 0 & 1.\end │ │ │ -00098310: 7b62 6d61 7472 6978 7d5c 293c 2f64 643e {bmatrix}\)
    │ │ │ -00098320: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    automatic │ │ │ -00098340: 616c 6c79 2067 656e 6572 6174 6564 3c2f ally generated.
    . │ │ │ -00098360: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
    .
  • .
  • .
    .

    findEs │ │ │ -000983e0: 7365 6e74 6961 6c4d 6174 3c2f 6833 3e0a sentialMat

    . │ │ │ -000983f0: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ -00098410: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ -00098450: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ -00098460: 3c73 7061 6e20 636c 6173 733d 2272 6574 Mat findEssenti │ │ │ -000984f0: 616c 4d61 743c 2f73 7061 6e3e 3c77 6272 alMat(Mat&n │ │ │ -00098560: 6273 703b 706f 696e 7473 312c 0a20 3c61 bsp;points1,. Mat points2,. │ │ │ -000985c0: 2064 6f75 626c 6526 6e62 7370 3b66 6f63 double foc │ │ │ -000985d0: 616c 293c 2f73 7061 6e3e 3c2f 6469 763e al)
    │ │ │ -000985e0: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ -00098600: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    points1 - Array of N ( │ │ │ -00098630: 4e20 2667 743b 3d20 3529 2032 4420 706f N >= 5) 2D po │ │ │ -00098640: 696e 7473 2066 726f 6d20 7468 6520 6669 ints from the fi │ │ │ -00098650: 7273 7420 696d 6167 652e 2054 6865 2070 rst image. The p │ │ │ -00098660: 6f69 6e74 2063 6f6f 7264 696e 6174 6573 oint coordinates │ │ │ -00098670: 2073 686f 756c 640a 6265 2066 6c6f 6174 should.be float │ │ │ -00098680: 696e 672d 706f 696e 7420 2873 696e 676c ing-point (singl │ │ │ -00098690: 6520 6f72 2064 6f75 626c 6520 7072 6563 e or double prec │ │ │ -000986a0: 6973 696f 6e29 2e3c 2f64 643e 0a3c 6464 ision).
    .
    points2 - Array of │ │ │ -000986d0: 2074 6865 2073 6563 6f6e 6420 696d 6167 the second imag │ │ │ -000986e0: 6520 706f 696e 7473 206f 6620 7468 6520 e points of the │ │ │ -000986f0: 7361 6d65 2073 697a 6520 616e 6420 666f same size and fo │ │ │ -00098700: 726d 6174 2061 7320 706f 696e 7473 3120 rmat as points1 │ │ │ -00098710: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    focal - │ │ │ -00098730: 666f 6361 6c20 6c65 6e67 7468 206f 6620 focal length of │ │ │ -00098740: 7468 6520 6361 6d65 7261 2e20 4e6f 7465 the camera. Note │ │ │ -00098750: 2074 6861 7420 7468 6973 2066 756e 6374 that this funct │ │ │ -00098760: 696f 6e20 6173 7375 6d65 7320 7468 6174 ion assumes that │ │ │ -00098770: 2070 6f69 6e74 7331 2061 6e64 2070 6f69 points1 and poi │ │ │ -00098780: 6e74 7332 0a61 7265 2066 6561 7475 7265 nts2.are feature │ │ │ -00098790: 2070 6f69 6e74 7320 6672 6f6d 2063 616d points from cam │ │ │ -000987a0: 6572 6173 2077 6974 6820 7361 6d65 2066 eras with same f │ │ │ -000987b0: 6f63 616c 206c 656e 6774 6820 616e 6420 ocal length and │ │ │ -000987c0: 7072 696e 6369 7061 6c20 706f 696e 742e principal point. │ │ │ -000987d0: 0a3c 756c 3e0a 2020 3c6c 693e 0a20 2020 .
      .
    • . │ │ │ -000987e0: 5245 463a 2052 414e 5341 4320 666f 7220 REF: RANSAC for │ │ │ -000987f0: 7468 6520 5241 4e53 4143 2061 6c67 6f72 the RANSAC algor │ │ │ -00098800: 6974 686d 2e0a 2020 3c2f 6c69 3e0a 2020 ithm..
    • . │ │ │ -00098810: 3c6c 693e 0a20 2020 5245 463a 204c 4d45
    • . REF: LME │ │ │ -00098820: 4453 2066 6f72 2074 6865 204c 4d65 6453 DS for the LMedS │ │ │ -00098830: 2061 6c67 6f72 6974 686d 2e0a 2020 3c2f algorithm.. .
    .line i │ │ │ -00098850: 6e20 7069 7865 6c73 2c20 6265 796f 6e64 n pixels, beyond │ │ │ -00098860: 2077 6869 6368 2074 6865 2070 6f69 6e74 which the point │ │ │ -00098870: 2069 7320 636f 6e73 6964 6572 6564 2061 is considered a │ │ │ -00098880: 6e20 6f75 746c 6965 7220 616e 6420 6973 n outlier and is │ │ │ -00098890: 206e 6f74 2075 7365 6420 666f 7220 636f not used for co │ │ │ -000988a0: 6d70 7574 696e 6720 7468 650a 6669 6e61 mputing the.fina │ │ │ -000988b0: 6c20 6675 6e64 616d 656e 7461 6c20 6d61 l fundamental ma │ │ │ -000988c0: 7472 6978 2e20 4974 2063 616e 2062 6520 trix. It can be │ │ │ -000988d0: 7365 7420 746f 2073 6f6d 6574 6869 6e67 set to something │ │ │ -000988e0: 206c 696b 6520 312d 332c 2064 6570 656e like 1-3, depen │ │ │ -000988f0: 6469 6e67 206f 6e20 7468 6520 6163 6375 ding on the accu │ │ │ -00098900: 7261 6379 206f 6620 7468 650a 706f 696e racy of the.poin │ │ │ -00098910: 7420 6c6f 6361 6c69 7a61 7469 6f6e 2c20 t localization, │ │ │ -00098920: 696d 6167 6520 7265 736f 6c75 7469 6f6e image resolution │ │ │ -00098930: 2c20 616e 6420 7468 6520 696d 6167 6520 , and the image │ │ │ -00098940: 6e6f 6973 652e 0a63 6f6e 6669 6465 6e63 noise..confidenc │ │ │ -00098950: 6520 2870 726f 6261 6269 6c69 7479 2920 e (probability) │ │ │ -00098960: 7468 6174 2074 6865 2065 7374 696d 6174 that the estimat │ │ │ -00098970: 6564 206d 6174 7269 7820 6973 2063 6f72 ed matrix is cor │ │ │ -00098980: 7265 6374 2e0a 666f 7220 7468 6520 6f74 rect..for the ot │ │ │ -00098990: 6865 7220 706f 696e 7473 2e20 5468 6520 her points. The │ │ │ -000989a0: 6172 7261 7920 6973 2063 6f6d 7075 7465 array is compute │ │ │ -000989b0: 6420 6f6e 6c79 2069 6e20 7468 6520 5241 d only in the RA │ │ │ -000989c0: 4e53 4143 2061 6e64 204c 4d65 6453 206d NSAC and LMedS m │ │ │ -000989d0: 6574 686f 6473 2e0a 0a54 6869 7320 6675 ethods...This fu │ │ │ -000989e0: 6e63 7469 6f6e 2064 6966 6665 7273 2066 nction differs f │ │ │ -000989f0: 726f 6d20 7468 6520 6f6e 6520 6162 6f76 rom the one abov │ │ │ -00098a00: 6520 7468 6174 2069 7420 636f 6d70 7574 e that it comput │ │ │ -00098a10: 6573 2063 616d 6572 6120 696e 7472 696e es camera intrin │ │ │ -00098a20: 7369 6320 6d61 7472 6978 2066 726f 6d20 sic matrix from │ │ │ -00098a30: 666f 6361 6c20 6c65 6e67 7468 2061 6e64 focal length and │ │ │ -00098a40: 0a70 7269 6e63 6970 616c 2070 6f69 6e74 .principal point │ │ │ -00098a50: 3a0a 0a5c 2841 203d 0a5c 6265 6769 6e7b :..\(A =.\begin{ │ │ │ -00098a60: 626d 6174 7269 787d 0a66 2026 616d 703b bmatrix}.f & │ │ │ -00098a70: 2030 2026 616d 703b 2078 5f7b 7070 7d20 0 & x_{pp} │ │ │ -00098a80: 205c 5c0a 3020 2661 6d70 3b20 6620 2661 \\.0 & f &a │ │ │ -00098a90: 6d70 3b20 795f 7b70 707d 2020 5c5c 0a30 mp; y_{pp} \\.0 │ │ │ -00098aa0: 2026 616d 703b 2030 2026 616d 703b 2031 & 0 & 1 │ │ │ -00098ab0: 0a5c 656e 647b 626d 6174 7269 787d 5c29 .\end{bmatrix}\) │ │ │ -00098ac0: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ -00098ad0: 733a 3c2f 6474 3e0a 3c64 643e 6175 746f s:
    .
    auto │ │ │ -00098ae0: 6d61 7469 6361 6c6c 7920 6765 6e65 7261 matically genera │ │ │ -00098af0: 7465 643c 2f64 643e 0a3c 2f64 6c3e 0a3c ted
    .
    .< │ │ │ -00098b00: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ -00098b10: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    findEsse │ │ │ -00098b80: 6e74 6961 6c4d 6174 3c2f 6833 3e0a 3c64 ntialMat

    ..public stati │ │ │ -00098bf0: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c Mat findEssential │ │ │ -00098c90: 4d61 743c 2f73 7061 6e3e 3c77 6272 3e3c Mat< │ │ │ -00098ca0: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ -00098cb0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ -00098d00: 703b 706f 696e 7473 312c 0a20 3c61 2068 p;points1,. Mat& │ │ │ -00098d50: 6e62 7370 3b70 6f69 6e74 7332 293c 2f73 nbsp;points2).
    .Parameters:.
    poi │ │ │ -00098da0: 6e74 7331 3c2f 636f 6465 3e20 2d20 4172 nts1 - Ar │ │ │ -00098db0: 7261 7920 6f66 204e 2028 4e20 2667 743b ray of N (N > │ │ │ -00098dc0: 3d20 3529 2032 4420 706f 696e 7473 2066 = 5) 2D points f │ │ │ -00098dd0: 726f 6d20 7468 6520 6669 7273 7420 696d rom the first im │ │ │ -00098de0: 6167 652e 2054 6865 2070 6f69 6e74 2063 age. The point c │ │ │ -00098df0: 6f6f 7264 696e 6174 6573 2073 686f 756c oordinates shoul │ │ │ -00098e00: 640a 6265 2066 6c6f 6174 696e 672d 706f d.be floating-po │ │ │ -00098e10: 696e 7420 2873 696e 676c 6520 6f72 2064 int (single or d │ │ │ -00098e20: 6f75 626c 6520 7072 6563 6973 696f 6e29 ouble precision) │ │ │ -00098e30: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    points2 │ │ │ -00098e50: 2d20 4172 7261 7920 6f66 2074 6865 2073 - Array of the s │ │ │ -00098e60: 6563 6f6e 6420 696d 6167 6520 706f 696e econd image poin │ │ │ -00098e70: 7473 206f 6620 7468 6520 7361 6d65 2073 ts of the same s │ │ │ -00098e80: 697a 6520 616e 6420 666f 726d 6174 2061 ize and format a │ │ │ -00098e90: 7320 706f 696e 7473 3120 2e0a 6172 6520 s points1 ..are │ │ │ -00098ea0: 6665 6174 7572 6520 706f 696e 7473 2066 feature points f │ │ │ -00098eb0: 726f 6d20 6361 6d65 7261 7320 7769 7468 rom cameras with │ │ │ -00098ec0: 2073 616d 6520 666f 6361 6c20 6c65 6e67 same focal leng │ │ │ -00098ed0: 7468 2061 6e64 2070 7269 6e63 6970 616c th and principal │ │ │ -00098ee0: 2070 6f69 6e74 2e0a 3c75 6c3e 0a20 203c point..
      . < │ │ │ -00098ef0: 6c69 3e0a 2020 2052 4546 3a20 5241 4e53 li>. REF: RANS │ │ │ -00098f00: 4143 2066 6f72 2074 6865 2052 414e 5341 AC for the RANSA │ │ │ -00098f10: 4320 616c 676f 7269 7468 6d2e 0a20 203c C algorithm.. < │ │ │ -00098f20: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2052 /li>.
    • . R │ │ │ -00098f30: 4546 3a20 4c4d 4544 5320 666f 7220 7468 EF: LMEDS for th │ │ │ -00098f40: 6520 4c4d 6564 5320 616c 676f 7269 7468 e LMedS algorith │ │ │ -00098f50: 6d2e 0a20 203c 2f6c 693e 0a3c 2f75 6c3e m..
    • .
    │ │ │ -00098f60: 0a6c 696e 6520 696e 2070 6978 656c 732c .line in pixels, │ │ │ -00098f70: 2062 6579 6f6e 6420 7768 6963 6820 7468 beyond which th │ │ │ -00098f80: 6520 706f 696e 7420 6973 2063 6f6e 7369 e point is consi │ │ │ -00098f90: 6465 7265 6420 616e 206f 7574 6c69 6572 dered an outlier │ │ │ -00098fa0: 2061 6e64 2069 7320 6e6f 7420 7573 6564 and is not used │ │ │ -00098fb0: 2066 6f72 2063 6f6d 7075 7469 6e67 2074 for computing t │ │ │ -00098fc0: 6865 0a66 696e 616c 2066 756e 6461 6d65 he.final fundame │ │ │ -00098fd0: 6e74 616c 206d 6174 7269 782e 2049 7420 ntal matrix. It │ │ │ -00098fe0: 6361 6e20 6265 2073 6574 2074 6f20 736f can be set to so │ │ │ -00098ff0: 6d65 7468 696e 6720 6c69 6b65 2031 2d33 mething like 1-3 │ │ │ -00099000: 2c20 6465 7065 6e64 696e 6720 6f6e 2074 , depending on t │ │ │ -00099010: 6865 2061 6363 7572 6163 7920 6f66 2074 he accuracy of t │ │ │ -00099020: 6865 0a70 6f69 6e74 206c 6f63 616c 697a he.point localiz │ │ │ -00099030: 6174 696f 6e2c 2069 6d61 6765 2072 6573 ation, image res │ │ │ -00099040: 6f6c 7574 696f 6e2c 2061 6e64 2074 6865 olution, and the │ │ │ -00099050: 2069 6d61 6765 206e 6f69 7365 2e0a 636f image noise..co │ │ │ -00099060: 6e66 6964 656e 6365 2028 7072 6f62 6162 nfidence (probab │ │ │ -00099070: 696c 6974 7929 2074 6861 7420 7468 6520 ility) that the │ │ │ -00099080: 6573 7469 6d61 7465 6420 6d61 7472 6978 estimated matrix │ │ │ -00099090: 2069 7320 636f 7272 6563 742e 0a66 6f72 is correct..for │ │ │ -000990a0: 2074 6865 206f 7468 6572 2070 6f69 6e74 the other point │ │ │ -000990b0: 732e 2054 6865 2061 7272 6179 2069 7320 s. The array is │ │ │ -000990c0: 636f 6d70 7574 6564 206f 6e6c 7920 696e computed only in │ │ │ -000990d0: 2074 6865 2052 414e 5341 4320 616e 6420 the RANSAC and │ │ │ -000990e0: 4c4d 6564 5320 6d65 7468 6f64 732e 0a0a LMedS methods... │ │ │ -000990f0: 5468 6973 2066 756e 6374 696f 6e20 6469 This function di │ │ │ -00099100: 6666 6572 7320 6672 6f6d 2074 6865 206f ffers from the o │ │ │ -00099110: 6e65 2061 626f 7665 2074 6861 7420 6974 ne above that it │ │ │ -00099120: 2063 6f6d 7075 7465 7320 6361 6d65 7261 computes camera │ │ │ -00099130: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ -00099140: 7820 6672 6f6d 2066 6f63 616c 206c 656e x from focal len │ │ │ -00099150: 6774 6820 616e 640a 7072 696e 6369 7061 gth and.principa │ │ │ -00099160: 6c20 706f 696e 743a 0a0a 5c28 4120 3d0a l point:..\(A =. │ │ │ -00099170: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ -00099180: 6620 2661 6d70 3b20 3020 2661 6d70 3b20 f & 0 & │ │ │ -00099190: 785f 7b70 707d 2020 5c5c 0a30 2026 616d x_{pp} \\.0 &am │ │ │ -000991a0: 703b 2066 2026 616d 703b 2079 5f7b 7070 p; f & y_{pp │ │ │ -000991b0: 7d20 205c 5c0a 3020 2661 6d70 3b20 3020 } \\.0 & 0 │ │ │ -000991c0: 2661 6d70 3b20 310a 5c65 6e64 7b62 6d61 & 1.\end{bma │ │ │ -000991d0: 7472 6978 7d5c 293c 2f64 643e 0a3c 6474 trix}\)
    .
    Returns:
    .< │ │ │ -000991f0: 6464 3e61 7574 6f6d 6174 6963 616c 6c79 dd>automatically │ │ │ -00099200: 2067 656e 6572 6174 6564 3c2f 6464 3e0a generated. │ │ │ -00099210: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    ..
    .
  • ..
    │ │ │ -00099300: 0a3c 6833 3e66 696e 6445 7373 656e 7469 .

    findEssenti │ │ │ -00099310: 616c 4d61 743c 2f68 333e 0a3c 6469 7620 alMat

    .
    .
    public static Mat& │ │ │ -000993f0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -00099410: 6669 6e64 4573 7365 6e74 6961 6c4d 6174 findEssentialMat │ │ │ -00099420: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat p │ │ │ -00099490: 6f69 6e74 7331 2c0a 203c 6120 6872 6566 oints1,. Mat&nbs │ │ │ -000994e0: 703b 706f 696e 7473 322c 0a20 3c61 2068 p;points2,. Mat& │ │ │ -00099530: 6e62 7370 3b63 616d 6572 614d 6174 7269 nbsp;cameraMatri │ │ │ -00099540: 7831 2c0a 203c 6120 6872 6566 3d22 2e2e x1,. Mat di │ │ │ -00099590: 7374 436f 6566 6673 312c 0a20 3c61 2068 stCoeffs1,. Mat& │ │ │ -000995e0: 6e62 7370 3b63 616d 6572 614d 6174 7269 nbsp;cameraMatri │ │ │ -000995f0: 7832 2c0a 203c 6120 6872 6566 3d22 2e2e x2,. Mat di │ │ │ -00099640: 7374 436f 6566 6673 322c 0a20 696e 7426 stCoeffs2,. int& │ │ │ -00099650: 6e62 7370 3b6d 6574 686f 642c 0a20 646f nbsp;method,. do │ │ │ -00099660: 7562 6c65 266e 6273 703b 7072 6f62 2c0a uble prob,. │ │ │ -00099670: 2064 6f75 626c 6526 6e62 7370 3b74 6872 double thr │ │ │ -00099680: 6573 686f 6c64 2c0a 203c 6120 6872 6566 eshold,. Mat&nbs │ │ │ -000996d0: 703b 6d61 736b 293c 2f73 7061 6e3e 3c2f p;mask).
    Calculat │ │ │ -00099700: 6573 2061 6e20 6573 7365 6e74 6961 6c20 es an essential │ │ │ -00099710: 6d61 7472 6978 2066 726f 6d20 7468 6520 matrix from the │ │ │ -00099720: 636f 7272 6573 706f 6e64 696e 6720 706f corresponding po │ │ │ -00099730: 696e 7473 2069 6e20 7477 6f20 696d 6167 ints in two imag │ │ │ -00099740: 6573 2066 726f 6d20 706f 7465 6e74 6961 es from potentia │ │ │ -00099750: 6c6c 7920 7477 6f20 6469 6666 6572 656e lly two differen │ │ │ -00099760: 7420 6361 6d65 7261 732e 3c2f 6469 763e t cameras.
    │ │ │ -00099770: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ -00099790: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    points1 - Array of N ( │ │ │ -000997c0: 4e20 2667 743b 3d20 3529 2032 4420 706f N >= 5) 2D po │ │ │ -000997d0: 696e 7473 2066 726f 6d20 7468 6520 6669 ints from the fi │ │ │ -000997e0: 7273 7420 696d 6167 652e 2054 6865 2070 rst image. The p │ │ │ -000997f0: 6f69 6e74 2063 6f6f 7264 696e 6174 6573 oint coordinates │ │ │ -00099800: 2073 686f 756c 640a 6265 2066 6c6f 6174 should.be float │ │ │ -00099810: 696e 672d 706f 696e 7420 2873 696e 676c ing-point (singl │ │ │ -00099820: 6520 6f72 2064 6f75 626c 6520 7072 6563 e or double prec │ │ │ -00099830: 6973 696f 6e29 2e3c 2f64 643e 0a3c 6464 ision).
    .
    points2 - Array of │ │ │ -00099860: 2074 6865 2073 6563 6f6e 6420 696d 6167 the second imag │ │ │ -00099870: 6520 706f 696e 7473 206f 6620 7468 6520 e points of the │ │ │ -00099880: 7361 6d65 2073 697a 6520 616e 6420 666f same size and fo │ │ │ -00099890: 726d 6174 2061 7320 706f 696e 7473 312e rmat as points1. │ │ │ -000998a0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000998b0: 6361 6d65 7261 4d61 7472 6978 313c 2f63 cameraMatrix1 - Camera ma │ │ │ -000998d0: 7472 6978 2066 6f72 2074 6865 2066 6972 trix for the fir │ │ │ -000998e0: 7374 2063 616d 6572 6120 5c28 4b20 3d20 st camera \(K = │ │ │ -000998f0: 5c76 6563 7468 7265 6574 6872 6565 7b66 \vecthreethree{f │ │ │ -00099900: 5f78 7d7b 307d 7b63 5f78 7d7b 307d 7b66 _x}{0}{c_x}{0}{f │ │ │ -00099910: 5f79 7d7b 635f 797d 7b30 7d7b 307d 7b31 _y}{c_y}{0}{0}{1 │ │ │ -00099920: 7d5c 2920 2e3c 2f64 643e 0a3c 6464 3e3c }\) .
    .
    < │ │ │ -00099930: 636f 6465 3e64 6973 7443 6f65 6666 7331 code>distCoeffs1 │ │ │ -00099940: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ -00099950: 7665 6374 6f72 206f 6620 6469 7374 6f72 vector of distor │ │ │ -00099960: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ -00099970: 7320 666f 7220 7468 6520 6669 7273 7420 s for the first │ │ │ -00099980: 6361 6d65 7261 0a5c 2828 6b5f 312c 206b camera.\((k_1, k │ │ │ -00099990: 5f32 2c20 705f 312c 2070 5f32 5b2c 206b _2, p_1, p_2[, k │ │ │ -000999a0: 5f33 5b2c 206b 5f34 2c20 6b5f 352c 206b _3[, k_4, k_5, k │ │ │ -000999b0: 5f36 5b2c 2073 5f31 2c20 735f 322c 2073 _6[, s_1, s_2, s │ │ │ -000999c0: 5f33 2c20 735f 345b 2c20 5c74 6175 5f78 _3, s_4[, \tau_x │ │ │ -000999d0: 2c20 5c74 6175 5f79 5d5d 5d5d 295c 290a , \tau_y]]]])\). │ │ │ -000999e0: 6f66 2034 2c20 352c 2038 2c20 3132 206f of 4, 5, 8, 12 o │ │ │ -000999f0: 7220 3134 2065 6c65 6d65 6e74 732e 2049 r 14 elements. I │ │ │ -00099a00: 6620 7468 6520 7665 6374 6f72 2069 7320 f the vector is │ │ │ -00099a10: 4e55 4c4c 2f65 6d70 7479 2c20 7468 6520 NULL/empty, the │ │ │ -00099a20: 7a65 726f 2064 6973 746f 7274 696f 6e20 zero distortion │ │ │ -00099a30: 636f 6566 6669 6369 656e 7473 2061 7265 coefficients are │ │ │ -00099a40: 2061 7373 756d 6564 2e3c 2f64 643e 0a3c assumed.
    .< │ │ │ -00099a50: 6464 3e3c 636f 6465 3e63 616d 6572 614d dd>cameraM │ │ │ -00099a60: 6174 7269 7832 3c2f 636f 6465 3e20 2d20 atrix2 - │ │ │ -00099a70: 4361 6d65 7261 206d 6174 7269 7820 666f Camera matrix fo │ │ │ -00099a80: 7220 7468 6520 7365 636f 6e64 2063 616d r the second cam │ │ │ -00099a90: 6572 6120 5c28 4b20 3d20 5c76 6563 7468 era \(K = \vecth │ │ │ -00099aa0: 7265 6574 6872 6565 7b66 5f78 7d7b 307d reethree{f_x}{0} │ │ │ -00099ab0: 7b63 5f78 7d7b 307d 7b66 5f79 7d7b 635f {c_x}{0}{f_y}{c_ │ │ │ -00099ac0: 797d 7b30 7d7b 307d 7b31 7d5c 2920 2e3c y}{0}{0}{1}\) .< │ │ │ -00099ad0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -00099ae0: 6973 7443 6f65 6666 7332 3c2f 636f 6465 istCoeffs2 - Input vector │ │ │ -00099b00: 206f 6620 6469 7374 6f72 7469 6f6e 2063 of distortion c │ │ │ -00099b10: 6f65 6666 6963 6965 6e74 7320 666f 7220 oefficients for │ │ │ -00099b20: 7468 6520 7365 636f 6e64 2063 616d 6572 the second camer │ │ │ -00099b30: 610a 5c28 286b 5f31 2c20 6b5f 322c 2070 a.\((k_1, k_2, p │ │ │ -00099b40: 5f31 2c20 705f 325b 2c20 6b5f 335b 2c20 _1, p_2[, k_3[, │ │ │ -00099b50: 6b5f 342c 206b 5f35 2c20 6b5f 365b 2c20 k_4, k_5, k_6[, │ │ │ -00099b60: 735f 312c 2073 5f32 2c20 735f 332c 2073 s_1, s_2, s_3, s │ │ │ -00099b70: 5f34 5b2c 205c 7461 755f 782c 205c 7461 _4[, \tau_x, \ta │ │ │ -00099b80: 755f 795d 5d5d 5d29 5c29 0a6f 6620 342c u_y]]]])\).of 4, │ │ │ -00099b90: 2035 2c20 382c 2031 3220 6f72 2031 3420 5, 8, 12 or 14 │ │ │ -00099ba0: 656c 656d 656e 7473 2e20 4966 2074 6865 elements. If the │ │ │ -00099bb0: 2076 6563 746f 7220 6973 204e 554c 4c2f vector is NULL/ │ │ │ -00099bc0: 656d 7074 792c 2074 6865 207a 6572 6f20 empty, the zero │ │ │ -00099bd0: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ -00099be0: 6963 6965 6e74 7320 6172 6520 6173 7375 icients are assu │ │ │ -00099bf0: 6d65 642e 3c2f 6464 3e0a 3c64 643e 3c63 med.
    .
    method - Method for c │ │ │ -00099c20: 6f6d 7075 7469 6e67 2061 6e20 6573 7365 omputing an esse │ │ │ -00099c30: 6e74 6961 6c20 6d61 7472 6978 2e0a 3c75 ntial matrix...
  • . REF │ │ │ -00099c50: 3a20 5241 4e53 4143 2066 6f72 2074 6865 : RANSAC for the │ │ │ -00099c60: 2052 414e 5341 4320 616c 676f 7269 7468 RANSAC algorith │ │ │ -00099c70: 6d2e 0a20 203c 2f6c 693e 0a20 203c 6c69 m..
  • .
  • . REF: LMEDS │ │ │ -00099c90: 666f 7220 7468 6520 4c4d 6564 5320 616c for the LMedS al │ │ │ -00099ca0: 676f 7269 7468 6d2e 0a20 203c 2f6c 693e gorithm..
  • │ │ │ -00099cb0: 0a3c 2f75 6c3e 3c2f 6464 3e0a 3c64 643e .
    .
    │ │ │ -00099cc0: 3c63 6f64 653e 7072 6f62 3c2f 636f 6465 prob - Parameter us │ │ │ -00099ce0: 6564 2066 6f72 2074 6865 2052 414e 5341 ed for the RANSA │ │ │ -00099cf0: 4320 6f72 204c 4d65 6453 206d 6574 686f C or LMedS metho │ │ │ -00099d00: 6473 206f 6e6c 792e 2049 7420 7370 6563 ds only. It spec │ │ │ -00099d10: 6966 6965 7320 6120 6465 7369 7261 626c ifies a desirabl │ │ │ -00099d20: 6520 6c65 7665 6c20 6f66 0a63 6f6e 6669 e level of.confi │ │ │ -00099d30: 6465 6e63 6520 2870 726f 6261 6269 6c69 dence (probabili │ │ │ -00099d40: 7479 2920 7468 6174 2074 6865 2065 7374 ty) that the est │ │ │ -00099d50: 696d 6174 6564 206d 6174 7269 7820 6973 imated matrix is │ │ │ -00099d60: 2063 6f72 7265 6374 2e3c 2f64 643e 0a3c correct.
    .< │ │ │ -00099d70: 6464 3e3c 636f 6465 3e74 6872 6573 686f dd>thresho │ │ │ -00099d80: 6c64 3c2f 636f 6465 3e20 2d20 5061 7261 ld - Para │ │ │ -00099d90: 6d65 7465 7220 7573 6564 2066 6f72 2052 meter used for R │ │ │ -00099da0: 414e 5341 432e 2049 7420 6973 2074 6865 ANSAC. It is the │ │ │ -00099db0: 206d 6178 696d 756d 2064 6973 7461 6e63 maximum distanc │ │ │ -00099dc0: 6520 6672 6f6d 2061 2070 6f69 6e74 2074 e from a point t │ │ │ -00099dd0: 6f20 616e 2065 7069 706f 6c61 720a 6c69 o an epipolar.li │ │ │ -00099de0: 6e65 2069 6e20 7069 7865 6c73 2c20 6265 ne in pixels, be │ │ │ -00099df0: 796f 6e64 2077 6869 6368 2074 6865 2070 yond which the p │ │ │ -00099e00: 6f69 6e74 2069 7320 636f 6e73 6964 6572 oint is consider │ │ │ -00099e10: 6564 2061 6e20 6f75 746c 6965 7220 616e ed an outlier an │ │ │ -00099e20: 6420 6973 206e 6f74 2075 7365 6420 666f d is not used fo │ │ │ -00099e30: 7220 636f 6d70 7574 696e 6720 7468 650a r computing the. │ │ │ -00099e40: 6669 6e61 6c20 6675 6e64 616d 656e 7461 final fundamenta │ │ │ -00099e50: 6c20 6d61 7472 6978 2e20 4974 2063 616e l matrix. It can │ │ │ -00099e60: 2062 6520 7365 7420 746f 2073 6f6d 6574 be set to somet │ │ │ -00099e70: 6869 6e67 206c 696b 6520 312d 332c 2064 hing like 1-3, d │ │ │ -00099e80: 6570 656e 6469 6e67 206f 6e20 7468 6520 epending on the │ │ │ -00099e90: 6163 6375 7261 6379 206f 6620 7468 650a accuracy of the. │ │ │ -00099ea0: 706f 696e 7420 6c6f 6361 6c69 7a61 7469 point localizati │ │ │ -00099eb0: 6f6e 2c20 696d 6167 6520 7265 736f 6c75 on, image resolu │ │ │ -00099ec0: 7469 6f6e 2c20 616e 6420 7468 6520 696d tion, and the im │ │ │ -00099ed0: 6167 6520 6e6f 6973 652e 3c2f 6464 3e0a age noise.. │ │ │ -00099ee0: 3c64 643e 3c63 6f64 653e 6d61 736b 3c2f
    mask - Output a │ │ │ -00099f00: 7272 6179 206f 6620 4e20 656c 656d 656e rray of N elemen │ │ │ -00099f10: 7473 2c20 6576 6572 7920 656c 656d 656e ts, every elemen │ │ │ -00099f20: 7420 6f66 2077 6869 6368 2069 7320 7365 t of which is se │ │ │ -00099f30: 7420 746f 2030 2066 6f72 206f 7574 6c69 t to 0 for outli │ │ │ -00099f40: 6572 7320 616e 6420 746f 2031 0a66 6f72 ers and to 1.for │ │ │ -00099f50: 2074 6865 206f 7468 6572 2070 6f69 6e74 the other point │ │ │ -00099f60: 732e 2054 6865 2061 7272 6179 2069 7320 s. The array is │ │ │ -00099f70: 636f 6d70 7574 6564 206f 6e6c 7920 696e computed only in │ │ │ -00099f80: 2074 6865 2052 414e 5341 4320 616e 6420 the RANSAC and │ │ │ -00099f90: 4c4d 6564 5320 6d65 7468 6f64 732e 0a0a LMedS methods... │ │ │ -00099fa0: 5468 6973 2066 756e 6374 696f 6e20 6573 This function es │ │ │ -00099fb0: 7469 6d61 7465 7320 6573 7365 6e74 6961 timates essentia │ │ │ -00099fc0: 6c20 6d61 7472 6978 2062 6173 6564 206f l matrix based o │ │ │ -00099fd0: 6e20 7468 6520 6669 7665 2d70 6f69 6e74 n the five-point │ │ │ -00099fe0: 2061 6c67 6f72 6974 686d 2073 6f6c 7665 algorithm solve │ │ │ -00099ff0: 7220 696e 2043 4954 453a 204e 6973 7465 r in CITE: Niste │ │ │ -0009a000: 7230 3320 2e0a 4349 5445 3a20 5374 6577 r03 ..CITE: Stew │ │ │ -0009a010: 656e 6975 7343 4653 2069 7320 616c 736f eniusCFS is also │ │ │ -0009a020: 2061 2072 656c 6174 6564 2e20 5468 6520 a related. The │ │ │ -0009a030: 6570 6970 6f6c 6172 2067 656f 6d65 7472 epipolar geometr │ │ │ -0009a040: 7920 6973 2064 6573 6372 6962 6564 2062 y is described b │ │ │ -0009a050: 7920 7468 6520 666f 6c6c 6f77 696e 6720 y the following │ │ │ -0009a060: 6571 7561 7469 6f6e 3a0a 0a5c 285b 705f equation:..\([p_ │ │ │ -0009a070: 323b 2031 5d5e 5420 4b5e 7b2d 547d 2045 2; 1]^T K^{-T} E │ │ │ -0009a080: 204b 5e7b 2d31 7d20 5b70 5f31 3b20 315d K^{-1} [p_1; 1] │ │ │ -0009a090: 203d 2030 5c29 0a0a 7768 6572 6520 5c28 = 0\)..where \( │ │ │ -0009a0a0: 455c 2920 6973 2061 6e20 6573 7365 6e74 E\) is an essent │ │ │ -0009a0b0: 6961 6c20 6d61 7472 6978 2c20 5c28 705f ial matrix, \(p_ │ │ │ -0009a0c0: 315c 2920 616e 6420 5c28 705f 325c 2920 1\) and \(p_2\) │ │ │ -0009a0d0: 6172 6520 636f 7272 6573 706f 6e64 696e are correspondin │ │ │ -0009a0e0: 6720 706f 696e 7473 2069 6e20 7468 6520 g points in the │ │ │ -0009a0f0: 6669 7273 7420 616e 6420 7468 650a 7365 first and the.se │ │ │ -0009a100: 636f 6e64 2069 6d61 6765 732c 2072 6573 cond images, res │ │ │ -0009a110: 7065 6374 6976 656c 792e 2054 6865 2072 pectively. The r │ │ │ -0009a120: 6573 756c 7420 6f66 2074 6869 7320 6675 esult of this fu │ │ │ -0009a130: 6e63 7469 6f6e 206d 6179 2062 6520 7061 nction may be pa │ │ │ -0009a140: 7373 6564 2066 7572 7468 6572 2074 6f0a ssed further to. │ │ │ -0009a150: 2364 6563 6f6d 706f 7365 4573 7365 6e74 #decomposeEssent │ │ │ -0009a160: 6961 6c4d 6174 206f 7220 2023 7265 636f ialMat or #reco │ │ │ -0009a170: 7665 7250 6f73 6520 746f 2072 6563 6f76 verPose to recov │ │ │ -0009a180: 6572 2074 6865 2072 656c 6174 6976 6520 er the relative │ │ │ -0009a190: 706f 7365 2062 6574 7765 656e 2063 616d pose between cam │ │ │ -0009a1a0: 6572 6173 2e3c 2f64 643e 0a3c 6474 3e52 eras.
    .
    R │ │ │ -0009a1b0: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    automatically g │ │ │ -0009a1d0: 656e 6572 6174 6564 3c2f 6464 3e0a 3c2f enerated
    ..
    ...
  • │ │ │ -0009a200: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    f │ │ │ -0009a2c0: 696e 6445 7373 656e 7469 616c 4d61 743c indEssentialMat< │ │ │ -0009a2d0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -0009a330: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -0009a340: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;< │ │ │ -0009a360: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0009a370: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0009a380: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0009a390: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat < │ │ │ -0009a3b0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ -0009a3c0: 656e 742d 6e61 6d65 223e 6669 6e64 4573 ent-name">findEs │ │ │ -0009a3d0: 7365 6e74 6961 6c4d 6174 3c2f 7370 616e sentialMat( │ │ │ -0009a400: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0009a440: 2f61 3e26 6e62 7370 3b70 6f69 6e74 7331 /a> points1 │ │ │ -0009a450: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -0009a490: 6174 3c2f 613e 266e 6273 703b 706f 696e at poin │ │ │ -0009a4a0: 7473 322c 0a20 3c61 2068 7265 663d 222e ts2,. Mat c │ │ │ -0009a4f0: 616d 6572 614d 6174 7269 7831 2c0a 203c ameraMatrix1,. < │ │ │ -0009a500: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0009a510: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0009a520: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0009a530: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat distCoef │ │ │ -0009a550: 6673 312c 0a20 3c61 2068 7265 663d 222e fs1,. Mat c │ │ │ -0009a5a0: 616d 6572 614d 6174 7269 7832 2c0a 203c ameraMatrix2,. < │ │ │ -0009a5b0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0009a5c0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0009a5d0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0009a5e0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat distCoef │ │ │ -0009a600: 6673 322c 0a20 696e 7426 6e62 7370 3b6d fs2,. int m │ │ │ -0009a610: 6574 686f 642c 0a20 646f 7562 6c65 266e ethod,. double&n │ │ │ -0009a620: 6273 703b 7072 6f62 2c0a 2064 6f75 626c bsp;prob,. doubl │ │ │ -0009a630: 6526 6e62 7370 3b74 6872 6573 686f 6c64 e threshold │ │ │ -0009a640: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ -0009a650: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -0009a660: 223e 4361 6c63 756c 6174 6573 2061 6e20 ">Calculates an │ │ │ -0009a670: 6573 7365 6e74 6961 6c20 6d61 7472 6978 essential matrix │ │ │ -0009a680: 2066 726f 6d20 7468 6520 636f 7272 6573 from the corres │ │ │ -0009a690: 706f 6e64 696e 6720 706f 696e 7473 2069 ponding points i │ │ │ -0009a6a0: 6e20 7477 6f20 696d 6167 6573 2066 726f n two images fro │ │ │ -0009a6b0: 6d20 706f 7465 6e74 6961 6c6c 7920 7477 m potentially tw │ │ │ -0009a6c0: 6f20 6469 6666 6572 656e 7420 6361 6d65 o different came │ │ │ -0009a6d0: 7261 732e 3c2f 6469 763e 0a3c 646c 2063 ras.
    .
    .Parameters:.
    poi │ │ │ -0009a710: 6e74 7331 3c2f 636f 6465 3e20 2d20 4172 nts1 - Ar │ │ │ -0009a720: 7261 7920 6f66 204e 2028 4e20 2667 743b ray of N (N > │ │ │ -0009a730: 3d20 3529 2032 4420 706f 696e 7473 2066 = 5) 2D points f │ │ │ -0009a740: 726f 6d20 7468 6520 6669 7273 7420 696d rom the first im │ │ │ -0009a750: 6167 652e 2054 6865 2070 6f69 6e74 2063 age. The point c │ │ │ -0009a760: 6f6f 7264 696e 6174 6573 2073 686f 756c oordinates shoul │ │ │ -0009a770: 640a 6265 2066 6c6f 6174 696e 672d 706f d.be floating-po │ │ │ -0009a780: 696e 7420 2873 696e 676c 6520 6f72 2064 int (single or d │ │ │ -0009a790: 6f75 626c 6520 7072 6563 6973 696f 6e29 ouble precision) │ │ │ -0009a7a0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    points2 │ │ │ -0009a7c0: 2d20 4172 7261 7920 6f66 2074 6865 2073 - Array of the s │ │ │ -0009a7d0: 6563 6f6e 6420 696d 6167 6520 706f 696e econd image poin │ │ │ -0009a7e0: 7473 206f 6620 7468 6520 7361 6d65 2073 ts of the same s │ │ │ -0009a7f0: 697a 6520 616e 6420 666f 726d 6174 2061 ize and format a │ │ │ -0009a800: 7320 706f 696e 7473 312e 3c2f 6464 3e0a s points1.
    . │ │ │ -0009a810: 3c64 643e 3c63 6f64 653e 6361 6d65 7261
    camera │ │ │ -0009a820: 4d61 7472 6978 313c 2f63 6f64 653e 202d Matrix1 - │ │ │ -0009a830: 2043 616d 6572 6120 6d61 7472 6978 2066 Camera matrix f │ │ │ -0009a840: 6f72 2074 6865 2066 6972 7374 2063 616d or the first cam │ │ │ -0009a850: 6572 6120 5c28 4b20 3d20 5c76 6563 7468 era \(K = \vecth │ │ │ -0009a860: 7265 6574 6872 6565 7b66 5f78 7d7b 307d reethree{f_x}{0} │ │ │ -0009a870: 7b63 5f78 7d7b 307d 7b66 5f79 7d7b 635f {c_x}{0}{f_y}{c_ │ │ │ -0009a880: 797d 7b30 7d7b 307d 7b31 7d5c 2920 2e3c y}{0}{0}{1}\) .< │ │ │ -0009a890: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -0009a8a0: 6973 7443 6f65 6666 7331 3c2f 636f 6465 istCoeffs1 - Input vector │ │ │ -0009a8c0: 206f 6620 6469 7374 6f72 7469 6f6e 2063 of distortion c │ │ │ -0009a8d0: 6f65 6666 6963 6965 6e74 7320 666f 7220 oefficients for │ │ │ -0009a8e0: 7468 6520 6669 7273 7420 6361 6d65 7261 the first camera │ │ │ -0009a8f0: 0a5c 2828 6b5f 312c 206b 5f32 2c20 705f .\((k_1, k_2, p_ │ │ │ -0009a900: 312c 2070 5f32 5b2c 206b 5f33 5b2c 206b 1, p_2[, k_3[, k │ │ │ -0009a910: 5f34 2c20 6b5f 352c 206b 5f36 5b2c 2073 _4, k_5, k_6[, s │ │ │ -0009a920: 5f31 2c20 735f 322c 2073 5f33 2c20 735f _1, s_2, s_3, s_ │ │ │ -0009a930: 345b 2c20 5c74 6175 5f78 2c20 5c74 6175 4[, \tau_x, \tau │ │ │ -0009a940: 5f79 5d5d 5d5d 295c 290a 6f66 2034 2c20 _y]]]])\).of 4, │ │ │ -0009a950: 352c 2038 2c20 3132 206f 7220 3134 2065 5, 8, 12 or 14 e │ │ │ -0009a960: 6c65 6d65 6e74 732e 2049 6620 7468 6520 lements. If the │ │ │ -0009a970: 7665 6374 6f72 2069 7320 4e55 4c4c 2f65 vector is NULL/e │ │ │ -0009a980: 6d70 7479 2c20 7468 6520 7a65 726f 2064 mpty, the zero d │ │ │ -0009a990: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ -0009a9a0: 6369 656e 7473 2061 7265 2061 7373 756d cients are assum │ │ │ -0009a9b0: 6564 2e3c 2f64 643e 0a3c 6464 3e3c 636f ed.
    .
    cameraMatrix2 │ │ │ -0009a9d0: 3c2f 636f 6465 3e20 2d20 4361 6d65 7261 - Camera │ │ │ -0009a9e0: 206d 6174 7269 7820 666f 7220 7468 6520 matrix for the │ │ │ -0009a9f0: 7365 636f 6e64 2063 616d 6572 6120 5c28 second camera \( │ │ │ -0009aa00: 4b20 3d20 5c76 6563 7468 7265 6574 6872 K = \vecthreethr │ │ │ -0009aa10: 6565 7b66 5f78 7d7b 307d 7b63 5f78 7d7b ee{f_x}{0}{c_x}{ │ │ │ -0009aa20: 307d 7b66 5f79 7d7b 635f 797d 7b30 7d7b 0}{f_y}{c_y}{0}{ │ │ │ -0009aa30: 307d 7b31 7d5c 2920 2e3c 2f64 643e 0a3c 0}{1}\) .
    .< │ │ │ -0009aa40: 6464 3e3c 636f 6465 3e64 6973 7443 6f65 dd>distCoe │ │ │ -0009aa50: 6666 7332 3c2f 636f 6465 3e20 2d20 496e ffs2 - In │ │ │ -0009aa60: 7075 7420 7665 6374 6f72 206f 6620 6469 put vector of di │ │ │ -0009aa70: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ -0009aa80: 6965 6e74 7320 666f 7220 7468 6520 7365 ients for the se │ │ │ -0009aa90: 636f 6e64 2063 616d 6572 610a 5c28 286b cond camera.\((k │ │ │ -0009aaa0: 5f31 2c20 6b5f 322c 2070 5f31 2c20 705f _1, k_2, p_1, p_ │ │ │ -0009aab0: 325b 2c20 6b5f 335b 2c20 6b5f 342c 206b 2[, k_3[, k_4, k │ │ │ -0009aac0: 5f35 2c20 6b5f 365b 2c20 735f 312c 2073 _5, k_6[, s_1, s │ │ │ -0009aad0: 5f32 2c20 735f 332c 2073 5f34 5b2c 205c _2, s_3, s_4[, \ │ │ │ -0009aae0: 7461 755f 782c 205c 7461 755f 795d 5d5d tau_x, \tau_y]]] │ │ │ -0009aaf0: 5d29 5c29 0a6f 6620 342c 2035 2c20 382c ])\).of 4, 5, 8, │ │ │ -0009ab00: 2031 3220 6f72 2031 3420 656c 656d 656e 12 or 14 elemen │ │ │ -0009ab10: 7473 2e20 4966 2074 6865 2076 6563 746f ts. If the vecto │ │ │ -0009ab20: 7220 6973 204e 554c 4c2f 656d 7074 792c r is NULL/empty, │ │ │ -0009ab30: 2074 6865 207a 6572 6f20 6469 7374 6f72 the zero distor │ │ │ -0009ab40: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ -0009ab50: 7320 6172 6520 6173 7375 6d65 642e 3c2f s are assumed..
    me │ │ │ -0009ab70: 7468 6f64 3c2f 636f 6465 3e20 2d20 4d65 thod - Me │ │ │ -0009ab80: 7468 6f64 2066 6f72 2063 6f6d 7075 7469 thod for computi │ │ │ -0009ab90: 6e67 2061 6e20 6573 7365 6e74 6961 6c20 ng an essential │ │ │ -0009aba0: 6d61 7472 6978 2e0a 3c75 6c3e 0a20 203c matrix..
      . < │ │ │ -0009abb0: 6c69 3e0a 2020 2052 4546 3a20 5241 4e53 li>. REF: RANS │ │ │ -0009abc0: 4143 2066 6f72 2074 6865 2052 414e 5341 AC for the RANSA │ │ │ -0009abd0: 4320 616c 676f 7269 7468 6d2e 0a20 203c C algorithm.. < │ │ │ -0009abe0: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2052 /li>.
    • . R │ │ │ -0009abf0: 4546 3a20 4c4d 4544 5320 666f 7220 7468 EF: LMEDS for th │ │ │ -0009ac00: 6520 4c4d 6564 5320 616c 676f 7269 7468 e LMedS algorith │ │ │ -0009ac10: 6d2e 0a20 203c 2f6c 693e 0a3c 2f75 6c3e m..
    • .
    │ │ │ -0009ac20: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -0009ac30: 7072 6f62 3c2f 636f 6465 3e20 2d20 5061 prob - Pa │ │ │ -0009ac40: 7261 6d65 7465 7220 7573 6564 2066 6f72 rameter used for │ │ │ -0009ac50: 2074 6865 2052 414e 5341 4320 6f72 204c the RANSAC or L │ │ │ -0009ac60: 4d65 6453 206d 6574 686f 6473 206f 6e6c MedS methods onl │ │ │ -0009ac70: 792e 2049 7420 7370 6563 6966 6965 7320 y. It specifies │ │ │ -0009ac80: 6120 6465 7369 7261 626c 6520 6c65 7665 a desirable leve │ │ │ -0009ac90: 6c20 6f66 0a63 6f6e 6669 6465 6e63 6520 l of.confidence │ │ │ -0009aca0: 2870 726f 6261 6269 6c69 7479 2920 7468 (probability) th │ │ │ -0009acb0: 6174 2074 6865 2065 7374 696d 6174 6564 at the estimated │ │ │ -0009acc0: 206d 6174 7269 7820 6973 2063 6f72 7265 matrix is corre │ │ │ -0009acd0: 6374 2e3c 2f64 643e 0a3c 6464 3e3c 636f ct.
    .
    threshold - Parameter │ │ │ -0009ad00: 7573 6564 2066 6f72 2052 414e 5341 432e used for RANSAC. │ │ │ -0009ad10: 2049 7420 6973 2074 6865 206d 6178 696d It is the maxim │ │ │ -0009ad20: 756d 2064 6973 7461 6e63 6520 6672 6f6d um distance from │ │ │ -0009ad30: 2061 2070 6f69 6e74 2074 6f20 616e 2065 a point to an e │ │ │ -0009ad40: 7069 706f 6c61 720a 6c69 6e65 2069 6e20 pipolar.line in │ │ │ -0009ad50: 7069 7865 6c73 2c20 6265 796f 6e64 2077 pixels, beyond w │ │ │ -0009ad60: 6869 6368 2074 6865 2070 6f69 6e74 2069 hich the point i │ │ │ -0009ad70: 7320 636f 6e73 6964 6572 6564 2061 6e20 s considered an │ │ │ -0009ad80: 6f75 746c 6965 7220 616e 6420 6973 206e outlier and is n │ │ │ -0009ad90: 6f74 2075 7365 6420 666f 7220 636f 6d70 ot used for comp │ │ │ -0009ada0: 7574 696e 6720 7468 650a 6669 6e61 6c20 uting the.final │ │ │ -0009adb0: 6675 6e64 616d 656e 7461 6c20 6d61 7472 fundamental matr │ │ │ -0009adc0: 6978 2e20 4974 2063 616e 2062 6520 7365 ix. It can be se │ │ │ -0009add0: 7420 746f 2073 6f6d 6574 6869 6e67 206c t to something l │ │ │ -0009ade0: 696b 6520 312d 332c 2064 6570 656e 6469 ike 1-3, dependi │ │ │ -0009adf0: 6e67 206f 6e20 7468 6520 6163 6375 7261 ng on the accura │ │ │ -0009ae00: 6379 206f 6620 7468 650a 706f 696e 7420 cy of the.point │ │ │ -0009ae10: 6c6f 6361 6c69 7a61 7469 6f6e 2c20 696d localization, im │ │ │ -0009ae20: 6167 6520 7265 736f 6c75 7469 6f6e 2c20 age resolution, │ │ │ -0009ae30: 616e 6420 7468 6520 696d 6167 6520 6e6f and the image no │ │ │ -0009ae40: 6973 652e 0a66 6f72 2074 6865 206f 7468 ise..for the oth │ │ │ -0009ae50: 6572 2070 6f69 6e74 732e 2054 6865 2061 er points. The a │ │ │ -0009ae60: 7272 6179 2069 7320 636f 6d70 7574 6564 rray is computed │ │ │ -0009ae70: 206f 6e6c 7920 696e 2074 6865 2052 414e only in the RAN │ │ │ -0009ae80: 5341 4320 616e 6420 4c4d 6564 5320 6d65 SAC and LMedS me │ │ │ -0009ae90: 7468 6f64 732e 0a0a 5468 6973 2066 756e thods...This fun │ │ │ -0009aea0: 6374 696f 6e20 6573 7469 6d61 7465 7320 ction estimates │ │ │ -0009aeb0: 6573 7365 6e74 6961 6c20 6d61 7472 6978 essential matrix │ │ │ -0009aec0: 2062 6173 6564 206f 6e20 7468 6520 6669 based on the fi │ │ │ -0009aed0: 7665 2d70 6f69 6e74 2061 6c67 6f72 6974 ve-point algorit │ │ │ -0009aee0: 686d 2073 6f6c 7665 7220 696e 2043 4954 hm solver in CIT │ │ │ -0009aef0: 453a 204e 6973 7465 7230 3320 2e0a 4349 E: Nister03 ..CI │ │ │ -0009af00: 5445 3a20 5374 6577 656e 6975 7343 4653 TE: SteweniusCFS │ │ │ -0009af10: 2069 7320 616c 736f 2061 2072 656c 6174 is also a relat │ │ │ -0009af20: 6564 2e20 5468 6520 6570 6970 6f6c 6172 ed. The epipolar │ │ │ -0009af30: 2067 656f 6d65 7472 7920 6973 2064 6573 geometry is des │ │ │ -0009af40: 6372 6962 6564 2062 7920 7468 6520 666f cribed by the fo │ │ │ -0009af50: 6c6c 6f77 696e 6720 6571 7561 7469 6f6e llowing equation │ │ │ -0009af60: 3a0a 0a5c 285b 705f 323b 2031 5d5e 5420 :..\([p_2; 1]^T │ │ │ -0009af70: 4b5e 7b2d 547d 2045 204b 5e7b 2d31 7d20 K^{-T} E K^{-1} │ │ │ -0009af80: 5b70 5f31 3b20 315d 203d 2030 5c29 0a0a [p_1; 1] = 0\).. │ │ │ -0009af90: 7768 6572 6520 5c28 455c 2920 6973 2061 where \(E\) is a │ │ │ -0009afa0: 6e20 6573 7365 6e74 6961 6c20 6d61 7472 n essential matr │ │ │ -0009afb0: 6978 2c20 5c28 705f 315c 2920 616e 6420 ix, \(p_1\) and │ │ │ -0009afc0: 5c28 705f 325c 2920 6172 6520 636f 7272 \(p_2\) are corr │ │ │ -0009afd0: 6573 706f 6e64 696e 6720 706f 696e 7473 esponding points │ │ │ -0009afe0: 2069 6e20 7468 6520 6669 7273 7420 616e in the first an │ │ │ -0009aff0: 6420 7468 650a 7365 636f 6e64 2069 6d61 d the.second ima │ │ │ -0009b000: 6765 732c 2072 6573 7065 6374 6976 656c ges, respectivel │ │ │ -0009b010: 792e 2054 6865 2072 6573 756c 7420 6f66 y. The result of │ │ │ -0009b020: 2074 6869 7320 6675 6e63 7469 6f6e 206d this function m │ │ │ -0009b030: 6179 2062 6520 7061 7373 6564 2066 7572 ay be passed fur │ │ │ -0009b040: 7468 6572 2074 6f0a 2364 6563 6f6d 706f ther to.#decompo │ │ │ -0009b050: 7365 4573 7365 6e74 6961 6c4d 6174 206f seEssentialMat o │ │ │ -0009b060: 7220 2023 7265 636f 7665 7250 6f73 6520 r #recoverPose │ │ │ -0009b070: 746f 2072 6563 6f76 6572 2074 6865 2072 to recover the r │ │ │ -0009b080: 656c 6174 6976 6520 706f 7365 2062 6574 elative pose bet │ │ │ -0009b090: 7765 656e 2063 616d 6572 6173 2e3c 2f64 ween cameras..
    Returns:< │ │ │ -0009b0b0: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
    automat │ │ │ -0009b0c0: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ -0009b0d0: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ..

    ..
  • ..

    │ │ │ -0009b1b0: 6669 6e64 4573 7365 6e74 6961 6c4d 6174 findEssentialMat │ │ │ -0009b1c0: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ -0009b220: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -0009b230: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -0009b250: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0009b290: 2f61 3e3c 2f73 7061 6e3e 266e 6273 703b /a>  │ │ │ -0009b2a0: 3c73 7061 6e20 636c 6173 733d 2265 6c65 findE │ │ │ -0009b2c0: 7373 656e 7469 616c 4d61 743c 2f73 7061 ssentialMat │ │ │ -0009b2f0: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ -0009b330: 3c2f 613e 266e 6273 703b 706f 696e 7473  points │ │ │ -0009b340: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ -0009b380: 4d61 743c 2f61 3e26 6e62 7370 3b70 6f69 Mat poi │ │ │ -0009b390: 6e74 7332 2c0a 203c 6120 6872 6566 3d22 nts2,. Mat  │ │ │ -0009b3e0: 6361 6d65 7261 4d61 7472 6978 312c 0a20 cameraMatrix1,. │ │ │ -0009b3f0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0009b430: 2f61 3e26 6e62 7370 3b64 6973 7443 6f65 /a> distCoe │ │ │ -0009b440: 6666 7331 2c0a 203c 6120 6872 6566 3d22 ffs1,. Mat  │ │ │ -0009b490: 6361 6d65 7261 4d61 7472 6978 322c 0a20 cameraMatrix2,. │ │ │ -0009b4a0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0009b4e0: 2f61 3e26 6e62 7370 3b64 6973 7443 6f65 /a> distCoe │ │ │ -0009b4f0: 6666 7332 2c0a 2069 6e74 266e 6273 703b ffs2,. int  │ │ │ -0009b500: 6d65 7468 6f64 2c0a 2064 6f75 626c 6526 method,. double& │ │ │ -0009b510: 6e62 7370 3b70 726f 6229 3c2f 7370 616e nbsp;prob)
    .
    Calcu │ │ │ -0009b540: 6c61 7465 7320 616e 2065 7373 656e 7469 lates an essenti │ │ │ -0009b550: 616c 206d 6174 7269 7820 6672 6f6d 2074 al matrix from t │ │ │ -0009b560: 6865 2063 6f72 7265 7370 6f6e 6469 6e67 he corresponding │ │ │ -0009b570: 2070 6f69 6e74 7320 696e 2074 776f 2069 points in two i │ │ │ -0009b580: 6d61 6765 7320 6672 6f6d 2070 6f74 656e mages from poten │ │ │ -0009b590: 7469 616c 6c79 2074 776f 2064 6966 6665 tially two diffe │ │ │ -0009b5a0: 7265 6e74 2063 616d 6572 6173 2e3c 2f64 rent cameras..
    .
    Param │ │ │ -0009b5d0: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ -0009b5e0: 3c63 6f64 653e 706f 696e 7473 313c 2f63 points1 - Array of │ │ │ -0009b600: 4e20 284e 2026 6774 3b3d 2035 2920 3244 N (N >= 5) 2D │ │ │ -0009b610: 2070 6f69 6e74 7320 6672 6f6d 2074 6865 points from the │ │ │ -0009b620: 2066 6972 7374 2069 6d61 6765 2e20 5468 first image. Th │ │ │ -0009b630: 6520 706f 696e 7420 636f 6f72 6469 6e61 e point coordina │ │ │ -0009b640: 7465 7320 7368 6f75 6c64 0a62 6520 666c tes should.be fl │ │ │ -0009b650: 6f61 7469 6e67 2d70 6f69 6e74 2028 7369 oating-point (si │ │ │ -0009b660: 6e67 6c65 206f 7220 646f 7562 6c65 2070 ngle or double p │ │ │ -0009b670: 7265 6369 7369 6f6e 292e 3c2f 6464 3e0a recision).
    . │ │ │ -0009b680: 3c64 643e 3c63 6f64 653e 706f 696e 7473
    points │ │ │ -0009b690: 323c 2f63 6f64 653e 202d 2041 7272 6179 2 - Array │ │ │ -0009b6a0: 206f 6620 7468 6520 7365 636f 6e64 2069 of the second i │ │ │ -0009b6b0: 6d61 6765 2070 6f69 6e74 7320 6f66 2074 mage points of t │ │ │ -0009b6c0: 6865 2073 616d 6520 7369 7a65 2061 6e64 he same size and │ │ │ -0009b6d0: 2066 6f72 6d61 7420 6173 2070 6f69 6e74 format as point │ │ │ -0009b6e0: 7331 2e3c 2f64 643e 0a3c 6464 3e3c 636f s1.
    .
    cameraMatrix1 │ │ │ -0009b700: 3c2f 636f 6465 3e20 2d20 4361 6d65 7261 - Camera │ │ │ -0009b710: 206d 6174 7269 7820 666f 7220 7468 6520 matrix for the │ │ │ -0009b720: 6669 7273 7420 6361 6d65 7261 205c 284b first camera \(K │ │ │ -0009b730: 203d 205c 7665 6374 6872 6565 7468 7265 = \vecthreethre │ │ │ -0009b740: 657b 665f 787d 7b30 7d7b 635f 787d 7b30 e{f_x}{0}{c_x}{0 │ │ │ -0009b750: 7d7b 665f 797d 7b63 5f79 7d7b 307d 7b30 }{f_y}{c_y}{0}{0 │ │ │ -0009b760: 7d7b 317d 5c29 202e 3c2f 6464 3e0a 3c64 }{1}\) .
    .distCoef │ │ │ -0009b780: 6673 313c 2f63 6f64 653e 202d 2049 6e70 fs1 - Inp │ │ │ -0009b790: 7574 2076 6563 746f 7220 6f66 2064 6973 ut vector of dis │ │ │ -0009b7a0: 746f 7274 696f 6e20 636f 6566 6669 6369 tortion coeffici │ │ │ -0009b7b0: 656e 7473 2066 6f72 2074 6865 2066 6972 ents for the fir │ │ │ -0009b7c0: 7374 2063 616d 6572 610a 5c28 286b 5f31 st camera.\((k_1 │ │ │ -0009b7d0: 2c20 6b5f 322c 2070 5f31 2c20 705f 325b , k_2, p_1, p_2[ │ │ │ -0009b7e0: 2c20 6b5f 335b 2c20 6b5f 342c 206b 5f35 , k_3[, k_4, k_5 │ │ │ -0009b7f0: 2c20 6b5f 365b 2c20 735f 312c 2073 5f32 , k_6[, s_1, s_2 │ │ │ -0009b800: 2c20 735f 332c 2073 5f34 5b2c 205c 7461 , s_3, s_4[, \ta │ │ │ -0009b810: 755f 782c 205c 7461 755f 795d 5d5d 5d29 u_x, \tau_y]]]]) │ │ │ -0009b820: 5c29 0a6f 6620 342c 2035 2c20 382c 2031 \).of 4, 5, 8, 1 │ │ │ -0009b830: 3220 6f72 2031 3420 656c 656d 656e 7473 2 or 14 elements │ │ │ -0009b840: 2e20 4966 2074 6865 2076 6563 746f 7220 . If the vector │ │ │ -0009b850: 6973 204e 554c 4c2f 656d 7074 792c 2074 is NULL/empty, t │ │ │ -0009b860: 6865 207a 6572 6f20 6469 7374 6f72 7469 he zero distorti │ │ │ -0009b870: 6f6e 2063 6f65 6666 6963 6965 6e74 7320 on coefficients │ │ │ -0009b880: 6172 6520 6173 7375 6d65 642e 3c2f 6464 are assumed..
    came │ │ │ -0009b8a0: 7261 4d61 7472 6978 323c 2f63 6f64 653e raMatrix2 │ │ │ -0009b8b0: 202d 2043 616d 6572 6120 6d61 7472 6978 - Camera matrix │ │ │ -0009b8c0: 2066 6f72 2074 6865 2073 6563 6f6e 6420 for the second │ │ │ -0009b8d0: 6361 6d65 7261 205c 284b 203d 205c 7665 camera \(K = \ve │ │ │ -0009b8e0: 6374 6872 6565 7468 7265 657b 665f 787d cthreethree{f_x} │ │ │ -0009b8f0: 7b30 7d7b 635f 787d 7b30 7d7b 665f 797d {0}{c_x}{0}{f_y} │ │ │ -0009b900: 7b63 5f79 7d7b 307d 7b30 7d7b 317d 5c29 {c_y}{0}{0}{1}\) │ │ │ -0009b910: 202e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 .
    .
    distCoeffs2 - Input vec │ │ │ -0009b940: 746f 7220 6f66 2064 6973 746f 7274 696f tor of distortio │ │ │ -0009b950: 6e20 636f 6566 6669 6369 656e 7473 2066 n coefficients f │ │ │ -0009b960: 6f72 2074 6865 2073 6563 6f6e 6420 6361 or the second ca │ │ │ -0009b970: 6d65 7261 0a5c 2828 6b5f 312c 206b 5f32 mera.\((k_1, k_2 │ │ │ -0009b980: 2c20 705f 312c 2070 5f32 5b2c 206b 5f33 , p_1, p_2[, k_3 │ │ │ -0009b990: 5b2c 206b 5f34 2c20 6b5f 352c 206b 5f36 [, k_4, k_5, k_6 │ │ │ -0009b9a0: 5b2c 2073 5f31 2c20 735f 322c 2073 5f33 [, s_1, s_2, s_3 │ │ │ -0009b9b0: 2c20 735f 345b 2c20 5c74 6175 5f78 2c20 , s_4[, \tau_x, │ │ │ -0009b9c0: 5c74 6175 5f79 5d5d 5d5d 295c 290a 6f66 \tau_y]]]])\).of │ │ │ -0009b9d0: 2034 2c20 352c 2038 2c20 3132 206f 7220 4, 5, 8, 12 or │ │ │ -0009b9e0: 3134 2065 6c65 6d65 6e74 732e 2049 6620 14 elements. If │ │ │ -0009b9f0: 7468 6520 7665 6374 6f72 2069 7320 4e55 the vector is NU │ │ │ -0009ba00: 4c4c 2f65 6d70 7479 2c20 7468 6520 7a65 LL/empty, the ze │ │ │ -0009ba10: 726f 2064 6973 746f 7274 696f 6e20 636f ro distortion co │ │ │ -0009ba20: 6566 6669 6369 656e 7473 2061 7265 2061 efficients are a │ │ │ -0009ba30: 7373 756d 6564 2e3c 2f64 643e 0a3c 6464 ssumed.
    .
    method - Method fo │ │ │ -0009ba60: 7220 636f 6d70 7574 696e 6720 616e 2065 r computing an e │ │ │ -0009ba70: 7373 656e 7469 616c 206d 6174 7269 782e ssential matrix. │ │ │ -0009ba80: 0a3c 756c 3e0a 2020 3c6c 693e 0a20 2020 .
      .
    • . │ │ │ -0009ba90: 5245 463a 2052 414e 5341 4320 666f 7220 REF: RANSAC for │ │ │ -0009baa0: 7468 6520 5241 4e53 4143 2061 6c67 6f72 the RANSAC algor │ │ │ -0009bab0: 6974 686d 2e0a 2020 3c2f 6c69 3e0a 2020 ithm..
    • . │ │ │ -0009bac0: 3c6c 693e 0a20 2020 5245 463a 204c 4d45
    • . REF: LME │ │ │ -0009bad0: 4453 2066 6f72 2074 6865 204c 4d65 6453 DS for the LMedS │ │ │ -0009bae0: 2061 6c67 6f72 6974 686d 2e0a 2020 3c2f algorithm.. .
    .< │ │ │ -0009bb00: 6464 3e3c 636f 6465 3e70 726f 623c 2f63 dd>prob - Parameter │ │ │ -0009bb20: 2075 7365 6420 666f 7220 7468 6520 5241 used for the RA │ │ │ -0009bb30: 4e53 4143 206f 7220 4c4d 6564 5320 6d65 NSAC or LMedS me │ │ │ -0009bb40: 7468 6f64 7320 6f6e 6c79 2e20 4974 2073 thods only. It s │ │ │ -0009bb50: 7065 6369 6669 6573 2061 2064 6573 6972 pecifies a desir │ │ │ -0009bb60: 6162 6c65 206c 6576 656c 206f 660a 636f able level of.co │ │ │ -0009bb70: 6e66 6964 656e 6365 2028 7072 6f62 6162 nfidence (probab │ │ │ -0009bb80: 696c 6974 7929 2074 6861 7420 7468 6520 ility) that the │ │ │ -0009bb90: 6573 7469 6d61 7465 6420 6d61 7472 6978 estimated matrix │ │ │ -0009bba0: 2069 7320 636f 7272 6563 742e 0a6c 696e is correct..lin │ │ │ -0009bbb0: 6520 696e 2070 6978 656c 732c 2062 6579 e in pixels, bey │ │ │ -0009bbc0: 6f6e 6420 7768 6963 6820 7468 6520 706f ond which the po │ │ │ -0009bbd0: 696e 7420 6973 2063 6f6e 7369 6465 7265 int is considere │ │ │ -0009bbe0: 6420 616e 206f 7574 6c69 6572 2061 6e64 d an outlier and │ │ │ -0009bbf0: 2069 7320 6e6f 7420 7573 6564 2066 6f72 is not used for │ │ │ -0009bc00: 2063 6f6d 7075 7469 6e67 2074 6865 0a66 computing the.f │ │ │ -0009bc10: 696e 616c 2066 756e 6461 6d65 6e74 616c inal fundamental │ │ │ -0009bc20: 206d 6174 7269 782e 2049 7420 6361 6e20 matrix. It can │ │ │ -0009bc30: 6265 2073 6574 2074 6f20 736f 6d65 7468 be set to someth │ │ │ -0009bc40: 696e 6720 6c69 6b65 2031 2d33 2c20 6465 ing like 1-3, de │ │ │ -0009bc50: 7065 6e64 696e 6720 6f6e 2074 6865 2061 pending on the a │ │ │ -0009bc60: 6363 7572 6163 7920 6f66 2074 6865 0a70 ccuracy of the.p │ │ │ -0009bc70: 6f69 6e74 206c 6f63 616c 697a 6174 696f oint localizatio │ │ │ -0009bc80: 6e2c 2069 6d61 6765 2072 6573 6f6c 7574 n, image resolut │ │ │ -0009bc90: 696f 6e2c 2061 6e64 2074 6865 2069 6d61 ion, and the ima │ │ │ -0009bca0: 6765 206e 6f69 7365 2e0a 666f 7220 7468 ge noise..for th │ │ │ -0009bcb0: 6520 6f74 6865 7220 706f 696e 7473 2e20 e other points. │ │ │ -0009bcc0: 5468 6520 6172 7261 7920 6973 2063 6f6d The array is com │ │ │ -0009bcd0: 7075 7465 6420 6f6e 6c79 2069 6e20 7468 puted only in th │ │ │ -0009bce0: 6520 5241 4e53 4143 2061 6e64 204c 4d65 e RANSAC and LMe │ │ │ -0009bcf0: 6453 206d 6574 686f 6473 2e0a 0a54 6869 dS methods...Thi │ │ │ -0009bd00: 7320 6675 6e63 7469 6f6e 2065 7374 696d s function estim │ │ │ -0009bd10: 6174 6573 2065 7373 656e 7469 616c 206d ates essential m │ │ │ -0009bd20: 6174 7269 7820 6261 7365 6420 6f6e 2074 atrix based on t │ │ │ -0009bd30: 6865 2066 6976 652d 706f 696e 7420 616c he five-point al │ │ │ -0009bd40: 676f 7269 7468 6d20 736f 6c76 6572 2069 gorithm solver i │ │ │ -0009bd50: 6e20 4349 5445 3a20 4e69 7374 6572 3033 n CITE: Nister03 │ │ │ -0009bd60: 202e 0a43 4954 453a 2053 7465 7765 6e69 ..CITE: Steweni │ │ │ -0009bd70: 7573 4346 5320 6973 2061 6c73 6f20 6120 usCFS is also a │ │ │ -0009bd80: 7265 6c61 7465 642e 2054 6865 2065 7069 related. The epi │ │ │ -0009bd90: 706f 6c61 7220 6765 6f6d 6574 7279 2069 polar geometry i │ │ │ -0009bda0: 7320 6465 7363 7269 6265 6420 6279 2074 s described by t │ │ │ -0009bdb0: 6865 2066 6f6c 6c6f 7769 6e67 2065 7175 he following equ │ │ │ -0009bdc0: 6174 696f 6e3a 0a0a 5c28 5b70 5f32 3b20 ation:..\([p_2; │ │ │ -0009bdd0: 315d 5e54 204b 5e7b 2d54 7d20 4520 4b5e 1]^T K^{-T} E K^ │ │ │ -0009bde0: 7b2d 317d 205b 705f 313b 2031 5d20 3d20 {-1} [p_1; 1] = │ │ │ -0009bdf0: 305c 290a 0a77 6865 7265 205c 2845 5c29 0\)..where \(E\) │ │ │ -0009be00: 2069 7320 616e 2065 7373 656e 7469 616c is an essential │ │ │ -0009be10: 206d 6174 7269 782c 205c 2870 5f31 5c29 matrix, \(p_1\) │ │ │ -0009be20: 2061 6e64 205c 2870 5f32 5c29 2061 7265 and \(p_2\) are │ │ │ -0009be30: 2063 6f72 7265 7370 6f6e 6469 6e67 2070 corresponding p │ │ │ -0009be40: 6f69 6e74 7320 696e 2074 6865 2066 6972 oints in the fir │ │ │ -0009be50: 7374 2061 6e64 2074 6865 0a73 6563 6f6e st and the.secon │ │ │ -0009be60: 6420 696d 6167 6573 2c20 7265 7370 6563 d images, respec │ │ │ -0009be70: 7469 7665 6c79 2e20 5468 6520 7265 7375 tively. The resu │ │ │ -0009be80: 6c74 206f 6620 7468 6973 2066 756e 6374 lt of this funct │ │ │ -0009be90: 696f 6e20 6d61 7920 6265 2070 6173 7365 ion may be passe │ │ │ -0009bea0: 6420 6675 7274 6865 7220 746f 0a23 6465 d further to.#de │ │ │ -0009beb0: 636f 6d70 6f73 6545 7373 656e 7469 616c composeEssential │ │ │ -0009bec0: 4d61 7420 6f72 2020 2372 6563 6f76 6572 Mat or #recover │ │ │ -0009bed0: 506f 7365 2074 6f20 7265 636f 7665 7220 Pose to recover │ │ │ -0009bee0: 7468 6520 7265 6c61 7469 7665 2070 6f73 the relative pos │ │ │ -0009bef0: 6520 6265 7477 6565 6e20 6361 6d65 7261 e between camera │ │ │ -0009bf00: 732e 3c2f 6464 3e0a 3c64 743e 5265 7475 s..
    Retu │ │ │ -0009bf10: 726e 733a 3c2f 6474 3e0a 3c64 643e 6175 rns:
    .
    au │ │ │ -0009bf20: 746f 6d61 7469 6361 6c6c 7920 6765 6e65 tomatically gene │ │ │ -0009bf30: 7261 7465 643c 2f64 643e 0a3c 2f64 6c3e rated
    .
    │ │ │ -0009bf40: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • ..

    fi │ │ │ -0009c010: 6e64 4573 7365 6e74 6961 6c4d 6174 3c2f ndEssentialMat.
    .
    public │ │ │ -0009c080: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ -0009c090: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;Mat findEss │ │ │ -0009c120: 656e 7469 616c 4d61 743c 2f73 7061 6e3e entialMat │ │ │ -0009c130: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ -0009c150: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0009c160: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0009c170: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0009c180: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat points1, │ │ │ -0009c1a0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -0009c1e0: 743c 2f61 3e26 6e62 7370 3b70 6f69 6e74 t point │ │ │ -0009c1f0: 7332 2c0a 203c 6120 6872 6566 3d22 2e2e s2,. Mat ca │ │ │ -0009c240: 6d65 7261 4d61 7472 6978 312c 0a20 3c61 meraMatrix1,. Mat distCoeff │ │ │ -0009c2a0: 7331 2c0a 203c 6120 6872 6566 3d22 2e2e s1,. Mat ca │ │ │ -0009c2f0: 6d65 7261 4d61 7472 6978 322c 0a20 3c61 meraMatrix2,. Mat distCoeff │ │ │ -0009c350: 7332 2c0a 2069 6e74 266e 6273 703b 6d65 s2,. int me │ │ │ -0009c360: 7468 6f64 293c 2f73 7061 6e3e 3c2f 6469 thod).
    Calculates │ │ │ -0009c390: 2061 6e20 6573 7365 6e74 6961 6c20 6d61 an essential ma │ │ │ -0009c3a0: 7472 6978 2066 726f 6d20 7468 6520 636f trix from the co │ │ │ -0009c3b0: 7272 6573 706f 6e64 696e 6720 706f 696e rresponding poin │ │ │ -0009c3c0: 7473 2069 6e20 7477 6f20 696d 6167 6573 ts in two images │ │ │ -0009c3d0: 2066 726f 6d20 706f 7465 6e74 6961 6c6c from potentiall │ │ │ -0009c3e0: 7920 7477 6f20 6469 6666 6572 656e 7420 y two different │ │ │ -0009c3f0: 6361 6d65 7261 732e 3c2f 6469 763e 0a3c cameras.
    .< │ │ │ -0009c400: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ -0009c410: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ -0009c420: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    points1 │ │ │ -0009c440: 2d20 4172 7261 7920 6f66 204e 2028 4e20 - Array of N (N │ │ │ -0009c450: 2667 743b 3d20 3529 2032 4420 706f 696e >= 5) 2D poin │ │ │ -0009c460: 7473 2066 726f 6d20 7468 6520 6669 7273 ts from the firs │ │ │ -0009c470: 7420 696d 6167 652e 2054 6865 2070 6f69 t image. The poi │ │ │ -0009c480: 6e74 2063 6f6f 7264 696e 6174 6573 2073 nt coordinates s │ │ │ -0009c490: 686f 756c 640a 6265 2066 6c6f 6174 696e hould.be floatin │ │ │ -0009c4a0: 672d 706f 696e 7420 2873 696e 676c 6520 g-point (single │ │ │ -0009c4b0: 6f72 2064 6f75 626c 6520 7072 6563 6973 or double precis │ │ │ -0009c4c0: 696f 6e29 2e3c 2f64 643e 0a3c 6464 3e3c ion).
    .
    < │ │ │ -0009c4d0: 636f 6465 3e70 6f69 6e74 7332 3c2f 636f code>points2 - Array of t │ │ │ -0009c4f0: 6865 2073 6563 6f6e 6420 696d 6167 6520 he second image │ │ │ -0009c500: 706f 696e 7473 206f 6620 7468 6520 7361 points of the sa │ │ │ -0009c510: 6d65 2073 697a 6520 616e 6420 666f 726d me size and form │ │ │ -0009c520: 6174 2061 7320 706f 696e 7473 312e 3c2f at as points1..
    ca │ │ │ -0009c540: 6d65 7261 4d61 7472 6978 313c 2f63 6f64 meraMatrix1 - Camera matr │ │ │ -0009c560: 6978 2066 6f72 2074 6865 2066 6972 7374 ix for the first │ │ │ -0009c570: 2063 616d 6572 6120 5c28 4b20 3d20 5c76 camera \(K = \v │ │ │ -0009c580: 6563 7468 7265 6574 6872 6565 7b66 5f78 ecthreethree{f_x │ │ │ -0009c590: 7d7b 307d 7b63 5f78 7d7b 307d 7b66 5f79 }{0}{c_x}{0}{f_y │ │ │ -0009c5a0: 7d7b 635f 797d 7b30 7d7b 307d 7b31 7d5c }{c_y}{0}{0}{1}\ │ │ │ -0009c5b0: 2920 2e3c 2f64 643e 0a3c 6464 3e3c 636f ) .
    .
    distCoeffs1 - Input ve │ │ │ -0009c5e0: 6374 6f72 206f 6620 6469 7374 6f72 7469 ctor of distorti │ │ │ -0009c5f0: 6f6e 2063 6f65 6666 6963 6965 6e74 7320 on coefficients │ │ │ -0009c600: 666f 7220 7468 6520 6669 7273 7420 6361 for the first ca │ │ │ -0009c610: 6d65 7261 0a5c 2828 6b5f 312c 206b 5f32 mera.\((k_1, k_2 │ │ │ -0009c620: 2c20 705f 312c 2070 5f32 5b2c 206b 5f33 , p_1, p_2[, k_3 │ │ │ -0009c630: 5b2c 206b 5f34 2c20 6b5f 352c 206b 5f36 [, k_4, k_5, k_6 │ │ │ -0009c640: 5b2c 2073 5f31 2c20 735f 322c 2073 5f33 [, s_1, s_2, s_3 │ │ │ -0009c650: 2c20 735f 345b 2c20 5c74 6175 5f78 2c20 , s_4[, \tau_x, │ │ │ -0009c660: 5c74 6175 5f79 5d5d 5d5d 295c 290a 6f66 \tau_y]]]])\).of │ │ │ -0009c670: 2034 2c20 352c 2038 2c20 3132 206f 7220 4, 5, 8, 12 or │ │ │ -0009c680: 3134 2065 6c65 6d65 6e74 732e 2049 6620 14 elements. If │ │ │ -0009c690: 7468 6520 7665 6374 6f72 2069 7320 4e55 the vector is NU │ │ │ -0009c6a0: 4c4c 2f65 6d70 7479 2c20 7468 6520 7a65 LL/empty, the ze │ │ │ -0009c6b0: 726f 2064 6973 746f 7274 696f 6e20 636f ro distortion co │ │ │ -0009c6c0: 6566 6669 6369 656e 7473 2061 7265 2061 efficients are a │ │ │ -0009c6d0: 7373 756d 6564 2e3c 2f64 643e 0a3c 6464 ssumed.
    .
    cameraMat │ │ │ -0009c6f0: 7269 7832 3c2f 636f 6465 3e20 2d20 4361 rix2 - Ca │ │ │ -0009c700: 6d65 7261 206d 6174 7269 7820 666f 7220 mera matrix for │ │ │ -0009c710: 7468 6520 7365 636f 6e64 2063 616d 6572 the second camer │ │ │ -0009c720: 6120 5c28 4b20 3d20 5c76 6563 7468 7265 a \(K = \vecthre │ │ │ -0009c730: 6574 6872 6565 7b66 5f78 7d7b 307d 7b63 ethree{f_x}{0}{c │ │ │ -0009c740: 5f78 7d7b 307d 7b66 5f79 7d7b 635f 797d _x}{0}{f_y}{c_y} │ │ │ -0009c750: 7b30 7d7b 307d 7b31 7d5c 2920 2e3c 2f64 {0}{0}{1}\) ..
    dis │ │ │ -0009c770: 7443 6f65 6666 7332 3c2f 636f 6465 3e20 tCoeffs2 │ │ │ -0009c780: 2d20 496e 7075 7420 7665 6374 6f72 206f - Input vector o │ │ │ -0009c790: 6620 6469 7374 6f72 7469 6f6e 2063 6f65 f distortion coe │ │ │ -0009c7a0: 6666 6963 6965 6e74 7320 666f 7220 7468 fficients for th │ │ │ -0009c7b0: 6520 7365 636f 6e64 2063 616d 6572 610a e second camera. │ │ │ -0009c7c0: 5c28 286b 5f31 2c20 6b5f 322c 2070 5f31 \((k_1, k_2, p_1 │ │ │ -0009c7d0: 2c20 705f 325b 2c20 6b5f 335b 2c20 6b5f , p_2[, k_3[, k_ │ │ │ -0009c7e0: 342c 206b 5f35 2c20 6b5f 365b 2c20 735f 4, k_5, k_6[, s_ │ │ │ -0009c7f0: 312c 2073 5f32 2c20 735f 332c 2073 5f34 1, s_2, s_3, s_4 │ │ │ -0009c800: 5b2c 205c 7461 755f 782c 205c 7461 755f [, \tau_x, \tau_ │ │ │ -0009c810: 795d 5d5d 5d29 5c29 0a6f 6620 342c 2035 y]]]])\).of 4, 5 │ │ │ -0009c820: 2c20 382c 2031 3220 6f72 2031 3420 656c , 8, 12 or 14 el │ │ │ -0009c830: 656d 656e 7473 2e20 4966 2074 6865 2076 ements. If the v │ │ │ -0009c840: 6563 746f 7220 6973 204e 554c 4c2f 656d ector is NULL/em │ │ │ -0009c850: 7074 792c 2074 6865 207a 6572 6f20 6469 pty, the zero di │ │ │ -0009c860: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ -0009c870: 6965 6e74 7320 6172 6520 6173 7375 6d65 ients are assume │ │ │ -0009c880: 642e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 d.
    .
    method │ │ │ -0009c8a0: 2d20 4d65 7468 6f64 2066 6f72 2063 6f6d - Method for com │ │ │ -0009c8b0: 7075 7469 6e67 2061 6e20 6573 7365 6e74 puting an essent │ │ │ -0009c8c0: 6961 6c20 6d61 7472 6978 2e0a 3c75 6c3e ial matrix..
      │ │ │ -0009c8d0: 0a20 203c 6c69 3e0a 2020 2052 4546 3a20 .
    • . REF: │ │ │ -0009c8e0: 5241 4e53 4143 2066 6f72 2074 6865 2052 RANSAC for the R │ │ │ -0009c8f0: 414e 5341 4320 616c 676f 7269 7468 6d2e ANSAC algorithm. │ │ │ -0009c900: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ -0009c910: 2020 2052 4546 3a20 4c4d 4544 5320 666f REF: LMEDS fo │ │ │ -0009c920: 7220 7468 6520 4c4d 6564 5320 616c 676f r the LMedS algo │ │ │ -0009c930: 7269 7468 6d2e 0a20 203c 2f6c 693e 0a3c rithm..
    • .< │ │ │ -0009c940: 2f75 6c3e 0a63 6f6e 6669 6465 6e63 6520 /ul>.confidence │ │ │ -0009c950: 2870 726f 6261 6269 6c69 7479 2920 7468 (probability) th │ │ │ -0009c960: 6174 2074 6865 2065 7374 696d 6174 6564 at the estimated │ │ │ -0009c970: 206d 6174 7269 7820 6973 2063 6f72 7265 matrix is corre │ │ │ -0009c980: 6374 2e0a 6c69 6e65 2069 6e20 7069 7865 ct..line in pixe │ │ │ -0009c990: 6c73 2c20 6265 796f 6e64 2077 6869 6368 ls, beyond which │ │ │ -0009c9a0: 2074 6865 2070 6f69 6e74 2069 7320 636f the point is co │ │ │ -0009c9b0: 6e73 6964 6572 6564 2061 6e20 6f75 746c nsidered an outl │ │ │ -0009c9c0: 6965 7220 616e 6420 6973 206e 6f74 2075 ier and is not u │ │ │ -0009c9d0: 7365 6420 666f 7220 636f 6d70 7574 696e sed for computin │ │ │ -0009c9e0: 6720 7468 650a 6669 6e61 6c20 6675 6e64 g the.final fund │ │ │ -0009c9f0: 616d 656e 7461 6c20 6d61 7472 6978 2e20 amental matrix. │ │ │ -0009ca00: 4974 2063 616e 2062 6520 7365 7420 746f It can be set to │ │ │ -0009ca10: 2073 6f6d 6574 6869 6e67 206c 696b 6520 something like │ │ │ -0009ca20: 312d 332c 2064 6570 656e 6469 6e67 206f 1-3, depending o │ │ │ -0009ca30: 6e20 7468 6520 6163 6375 7261 6379 206f n the accuracy o │ │ │ -0009ca40: 6620 7468 650a 706f 696e 7420 6c6f 6361 f the.point loca │ │ │ -0009ca50: 6c69 7a61 7469 6f6e 2c20 696d 6167 6520 lization, image │ │ │ -0009ca60: 7265 736f 6c75 7469 6f6e 2c20 616e 6420 resolution, and │ │ │ -0009ca70: 7468 6520 696d 6167 6520 6e6f 6973 652e the image noise. │ │ │ -0009ca80: 0a66 6f72 2074 6865 206f 7468 6572 2070 .for the other p │ │ │ -0009ca90: 6f69 6e74 732e 2054 6865 2061 7272 6179 oints. The array │ │ │ -0009caa0: 2069 7320 636f 6d70 7574 6564 206f 6e6c is computed onl │ │ │ -0009cab0: 7920 696e 2074 6865 2052 414e 5341 4320 y in the RANSAC │ │ │ -0009cac0: 616e 6420 4c4d 6564 5320 6d65 7468 6f64 and LMedS method │ │ │ -0009cad0: 732e 0a0a 5468 6973 2066 756e 6374 696f s...This functio │ │ │ -0009cae0: 6e20 6573 7469 6d61 7465 7320 6573 7365 n estimates esse │ │ │ -0009caf0: 6e74 6961 6c20 6d61 7472 6978 2062 6173 ntial matrix bas │ │ │ -0009cb00: 6564 206f 6e20 7468 6520 6669 7665 2d70 ed on the five-p │ │ │ -0009cb10: 6f69 6e74 2061 6c67 6f72 6974 686d 2073 oint algorithm s │ │ │ -0009cb20: 6f6c 7665 7220 696e 2043 4954 453a 204e olver in CITE: N │ │ │ -0009cb30: 6973 7465 7230 3320 2e0a 4349 5445 3a20 ister03 ..CITE: │ │ │ -0009cb40: 5374 6577 656e 6975 7343 4653 2069 7320 SteweniusCFS is │ │ │ -0009cb50: 616c 736f 2061 2072 656c 6174 6564 2e20 also a related. │ │ │ -0009cb60: 5468 6520 6570 6970 6f6c 6172 2067 656f The epipolar geo │ │ │ -0009cb70: 6d65 7472 7920 6973 2064 6573 6372 6962 metry is describ │ │ │ -0009cb80: 6564 2062 7920 7468 6520 666f 6c6c 6f77 ed by the follow │ │ │ -0009cb90: 696e 6720 6571 7561 7469 6f6e 3a0a 0a5c ing equation:..\ │ │ │ -0009cba0: 285b 705f 323b 2031 5d5e 5420 4b5e 7b2d ([p_2; 1]^T K^{- │ │ │ -0009cbb0: 547d 2045 204b 5e7b 2d31 7d20 5b70 5f31 T} E K^{-1} [p_1 │ │ │ -0009cbc0: 3b20 315d 203d 2030 5c29 0a0a 7768 6572 ; 1] = 0\)..wher │ │ │ -0009cbd0: 6520 5c28 455c 2920 6973 2061 6e20 6573 e \(E\) is an es │ │ │ -0009cbe0: 7365 6e74 6961 6c20 6d61 7472 6978 2c20 sential matrix, │ │ │ -0009cbf0: 5c28 705f 315c 2920 616e 6420 5c28 705f \(p_1\) and \(p_ │ │ │ -0009cc00: 325c 2920 6172 6520 636f 7272 6573 706f 2\) are correspo │ │ │ -0009cc10: 6e64 696e 6720 706f 696e 7473 2069 6e20 nding points in │ │ │ -0009cc20: 7468 6520 6669 7273 7420 616e 6420 7468 the first and th │ │ │ -0009cc30: 650a 7365 636f 6e64 2069 6d61 6765 732c e.second images, │ │ │ -0009cc40: 2072 6573 7065 6374 6976 656c 792e 2054 respectively. T │ │ │ -0009cc50: 6865 2072 6573 756c 7420 6f66 2074 6869 he result of thi │ │ │ -0009cc60: 7320 6675 6e63 7469 6f6e 206d 6179 2062 s function may b │ │ │ -0009cc70: 6520 7061 7373 6564 2066 7572 7468 6572 e passed further │ │ │ -0009cc80: 2074 6f0a 2364 6563 6f6d 706f 7365 4573 to.#decomposeEs │ │ │ -0009cc90: 7365 6e74 6961 6c4d 6174 206f 7220 2023 sentialMat or # │ │ │ -0009cca0: 7265 636f 7665 7250 6f73 6520 746f 2072 recoverPose to r │ │ │ -0009ccb0: 6563 6f76 6572 2074 6865 2072 656c 6174 ecover the relat │ │ │ -0009ccc0: 6976 6520 706f 7365 2062 6574 7765 656e ive pose between │ │ │ -0009ccd0: 2063 616d 6572 6173 2e3c 2f64 643e 0a3c cameras.
    .< │ │ │ -0009cce0: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ -0009ccf0: 0a3c 6464 3e61 7574 6f6d 6174 6963 616c .
    automatical │ │ │ -0009cd00: 6c79 2067 656e 6572 6174 6564 3c2f 6464 ly generated
    ..
    .< │ │ │ -0009cd20: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.

  • . │ │ │ -0009cd30: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    findEssentialMa │ │ │ -0009cdf0: 743c 2f68 333e 0a3c 6469 7620 636c 6173 t

    .
    .
    pub │ │ │ -0009ce50: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static Mat │ │ │ -0009cec0: 3c2f 613e 3c2f 7370 616e 3e26 6e62 7370   │ │ │ -0009ced0: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;find │ │ │ -0009cef0: 4573 7365 6e74 6961 6c4d 6174 3c2f 7370 EssentialMat(Ma │ │ │ -0009cf60: 743c 2f61 3e26 6e62 7370 3b70 6f69 6e74 t point │ │ │ -0009cf70: 7331 2c0a 203c 6120 6872 6566 3d22 2e2e s1,. Mat po │ │ │ -0009cfc0: 696e 7473 322c 0a20 3c61 2068 7265 663d ints2,. Mat  │ │ │ -0009d010: 3b63 616d 6572 614d 6174 7269 7831 2c0a ;cameraMatrix1,. │ │ │ -0009d020: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0009d060: 3c2f 613e 266e 6273 703b 6469 7374 436f  distCo │ │ │ -0009d070: 6566 6673 312c 0a20 3c61 2068 7265 663d effs1,. Mat  │ │ │ -0009d0c0: 3b63 616d 6572 614d 6174 7269 7832 2c0a ;cameraMatrix2,. │ │ │ -0009d0d0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0009d110: 3c2f 613e 266e 6273 703b 6469 7374 436f  distCo │ │ │ -0009d120: 6566 6673 3229 3c2f 7370 616e 3e3c 2f64 effs2).
    Calculate │ │ │ -0009d150: 7320 616e 2065 7373 656e 7469 616c 206d s an essential m │ │ │ -0009d160: 6174 7269 7820 6672 6f6d 2074 6865 2063 atrix from the c │ │ │ -0009d170: 6f72 7265 7370 6f6e 6469 6e67 2070 6f69 orresponding poi │ │ │ -0009d180: 6e74 7320 696e 2074 776f 2069 6d61 6765 nts in two image │ │ │ -0009d190: 7320 6672 6f6d 2070 6f74 656e 7469 616c s from potential │ │ │ -0009d1a0: 6c79 2074 776f 2064 6966 6665 7265 6e74 ly two different │ │ │ -0009d1b0: 2063 616d 6572 6173 2e3c 2f64 6976 3e0a cameras.
    . │ │ │ -0009d1c0: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ -0009d1e0: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    points1 │ │ │ -0009d200: 202d 2041 7272 6179 206f 6620 4e20 284e - Array of N (N │ │ │ -0009d210: 2026 6774 3b3d 2035 2920 3244 2070 6f69 >= 5) 2D poi │ │ │ -0009d220: 6e74 7320 6672 6f6d 2074 6865 2066 6972 nts from the fir │ │ │ -0009d230: 7374 2069 6d61 6765 2e20 5468 6520 706f st image. The po │ │ │ -0009d240: 696e 7420 636f 6f72 6469 6e61 7465 7320 int coordinates │ │ │ -0009d250: 7368 6f75 6c64 0a62 6520 666c 6f61 7469 should.be floati │ │ │ -0009d260: 6e67 2d70 6f69 6e74 2028 7369 6e67 6c65 ng-point (single │ │ │ -0009d270: 206f 7220 646f 7562 6c65 2070 7265 6369 or double preci │ │ │ -0009d280: 7369 6f6e 292e 3c2f 6464 3e0a 3c64 643e sion).
    .
    │ │ │ -0009d290: 3c63 6f64 653e 706f 696e 7473 323c 2f63 points2 - Array of │ │ │ -0009d2b0: 7468 6520 7365 636f 6e64 2069 6d61 6765 the second image │ │ │ -0009d2c0: 2070 6f69 6e74 7320 6f66 2074 6865 2073 points of the s │ │ │ -0009d2d0: 616d 6520 7369 7a65 2061 6e64 2066 6f72 ame size and for │ │ │ -0009d2e0: 6d61 7420 6173 2070 6f69 6e74 7331 2e3c mat as points1.< │ │ │ -0009d2f0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ -0009d300: 616d 6572 614d 6174 7269 7831 3c2f 636f ameraMatrix1 - Camera mat │ │ │ -0009d320: 7269 7820 666f 7220 7468 6520 6669 7273 rix for the firs │ │ │ -0009d330: 7420 6361 6d65 7261 205c 284b 203d 205c t camera \(K = \ │ │ │ -0009d340: 7665 6374 6872 6565 7468 7265 657b 665f vecthreethree{f_ │ │ │ -0009d350: 787d 7b30 7d7b 635f 787d 7b30 7d7b 665f x}{0}{c_x}{0}{f_ │ │ │ -0009d360: 797d 7b63 5f79 7d7b 307d 7b30 7d7b 317d y}{c_y}{0}{0}{1} │ │ │ -0009d370: 5c29 202e 3c2f 6464 3e0a 3c64 643e 3c63 \) .
    .
    distCoeffs1< │ │ │ -0009d390: 2f63 6f64 653e 202d 2049 6e70 7574 2076 /code> - Input v │ │ │ -0009d3a0: 6563 746f 7220 6f66 2064 6973 746f 7274 ector of distort │ │ │ -0009d3b0: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ -0009d3c0: 2066 6f72 2074 6865 2066 6972 7374 2063 for the first c │ │ │ -0009d3d0: 616d 6572 610a 5c28 286b 5f31 2c20 6b5f amera.\((k_1, k_ │ │ │ -0009d3e0: 322c 2070 5f31 2c20 705f 325b 2c20 6b5f 2, p_1, p_2[, k_ │ │ │ -0009d3f0: 335b 2c20 6b5f 342c 206b 5f35 2c20 6b5f 3[, k_4, k_5, k_ │ │ │ -0009d400: 365b 2c20 735f 312c 2073 5f32 2c20 735f 6[, s_1, s_2, s_ │ │ │ -0009d410: 332c 2073 5f34 5b2c 205c 7461 755f 782c 3, s_4[, \tau_x, │ │ │ -0009d420: 205c 7461 755f 795d 5d5d 5d29 5c29 0a6f \tau_y]]]])\).o │ │ │ -0009d430: 6620 342c 2035 2c20 382c 2031 3220 6f72 f 4, 5, 8, 12 or │ │ │ -0009d440: 2031 3420 656c 656d 656e 7473 2e20 4966 14 elements. If │ │ │ -0009d450: 2074 6865 2076 6563 746f 7220 6973 204e the vector is N │ │ │ -0009d460: 554c 4c2f 656d 7074 792c 2074 6865 207a ULL/empty, the z │ │ │ -0009d470: 6572 6f20 6469 7374 6f72 7469 6f6e 2063 ero distortion c │ │ │ -0009d480: 6f65 6666 6963 6965 6e74 7320 6172 6520 oefficients are │ │ │ -0009d490: 6173 7375 6d65 642e 3c2f 6464 3e0a 3c64 assumed.
    .cameraMa │ │ │ -0009d4b0: 7472 6978 323c 2f63 6f64 653e 202d 2043 trix2 - C │ │ │ -0009d4c0: 616d 6572 6120 6d61 7472 6978 2066 6f72 amera matrix for │ │ │ -0009d4d0: 2074 6865 2073 6563 6f6e 6420 6361 6d65 the second came │ │ │ -0009d4e0: 7261 205c 284b 203d 205c 7665 6374 6872 ra \(K = \vecthr │ │ │ -0009d4f0: 6565 7468 7265 657b 665f 787d 7b30 7d7b eethree{f_x}{0}{ │ │ │ -0009d500: 635f 787d 7b30 7d7b 665f 797d 7b63 5f79 c_x}{0}{f_y}{c_y │ │ │ -0009d510: 7d7b 307d 7b30 7d7b 317d 5c29 202e 3c2f }{0}{0}{1}\) ..
    di │ │ │ -0009d530: 7374 436f 6566 6673 323c 2f63 6f64 653e stCoeffs2 │ │ │ -0009d540: 202d 2049 6e70 7574 2076 6563 746f 7220 - Input vector │ │ │ -0009d550: 6f66 2064 6973 746f 7274 696f 6e20 636f of distortion co │ │ │ -0009d560: 6566 6669 6369 656e 7473 2066 6f72 2074 efficients for t │ │ │ -0009d570: 6865 2073 6563 6f6e 6420 6361 6d65 7261 he second camera │ │ │ -0009d580: 0a5c 2828 6b5f 312c 206b 5f32 2c20 705f .\((k_1, k_2, p_ │ │ │ -0009d590: 312c 2070 5f32 5b2c 206b 5f33 5b2c 206b 1, p_2[, k_3[, k │ │ │ -0009d5a0: 5f34 2c20 6b5f 352c 206b 5f36 5b2c 2073 _4, k_5, k_6[, s │ │ │ -0009d5b0: 5f31 2c20 735f 322c 2073 5f33 2c20 735f _1, s_2, s_3, s_ │ │ │ -0009d5c0: 345b 2c20 5c74 6175 5f78 2c20 5c74 6175 4[, \tau_x, \tau │ │ │ -0009d5d0: 5f79 5d5d 5d5d 295c 290a 6f66 2034 2c20 _y]]]])\).of 4, │ │ │ -0009d5e0: 352c 2038 2c20 3132 206f 7220 3134 2065 5, 8, 12 or 14 e │ │ │ -0009d5f0: 6c65 6d65 6e74 732e 2049 6620 7468 6520 lements. If the │ │ │ -0009d600: 7665 6374 6f72 2069 7320 4e55 4c4c 2f65 vector is NULL/e │ │ │ -0009d610: 6d70 7479 2c20 7468 6520 7a65 726f 2064 mpty, the zero d │ │ │ -0009d620: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ -0009d630: 6369 656e 7473 2061 7265 2061 7373 756d cients are assum │ │ │ -0009d640: 6564 2e0a 3c75 6c3e 0a20 203c 6c69 3e0a ed..
      .
    • . │ │ │ -0009d650: 2020 2052 4546 3a20 5241 4e53 4143 2066 REF: RANSAC f │ │ │ -0009d660: 6f72 2074 6865 2052 414e 5341 4320 616c or the RANSAC al │ │ │ -0009d670: 676f 7269 7468 6d2e 0a20 203c 2f6c 693e gorithm..
    • │ │ │ -0009d680: 0a20 203c 6c69 3e0a 2020 2052 4546 3a20 .
    • . REF: │ │ │ -0009d690: 4c4d 4544 5320 666f 7220 7468 6520 4c4d LMEDS for the LM │ │ │ -0009d6a0: 6564 5320 616c 676f 7269 7468 6d2e 0a20 edS algorithm.. │ │ │ -0009d6b0: 203c 2f6c 693e 0a3c 2f75 6c3e 0a63 6f6e
    • .
    .con │ │ │ -0009d6c0: 6669 6465 6e63 6520 2870 726f 6261 6269 fidence (probabi │ │ │ -0009d6d0: 6c69 7479 2920 7468 6174 2074 6865 2065 lity) that the e │ │ │ -0009d6e0: 7374 696d 6174 6564 206d 6174 7269 7820 stimated matrix │ │ │ -0009d6f0: 6973 2063 6f72 7265 6374 2e0a 6c69 6e65 is correct..line │ │ │ -0009d700: 2069 6e20 7069 7865 6c73 2c20 6265 796f in pixels, beyo │ │ │ -0009d710: 6e64 2077 6869 6368 2074 6865 2070 6f69 nd which the poi │ │ │ -0009d720: 6e74 2069 7320 636f 6e73 6964 6572 6564 nt is considered │ │ │ -0009d730: 2061 6e20 6f75 746c 6965 7220 616e 6420 an outlier and │ │ │ -0009d740: 6973 206e 6f74 2075 7365 6420 666f 7220 is not used for │ │ │ -0009d750: 636f 6d70 7574 696e 6720 7468 650a 6669 computing the.fi │ │ │ -0009d760: 6e61 6c20 6675 6e64 616d 656e 7461 6c20 nal fundamental │ │ │ -0009d770: 6d61 7472 6978 2e20 4974 2063 616e 2062 matrix. It can b │ │ │ -0009d780: 6520 7365 7420 746f 2073 6f6d 6574 6869 e set to somethi │ │ │ -0009d790: 6e67 206c 696b 6520 312d 332c 2064 6570 ng like 1-3, dep │ │ │ -0009d7a0: 656e 6469 6e67 206f 6e20 7468 6520 6163 ending on the ac │ │ │ -0009d7b0: 6375 7261 6379 206f 6620 7468 650a 706f curacy of the.po │ │ │ -0009d7c0: 696e 7420 6c6f 6361 6c69 7a61 7469 6f6e int localization │ │ │ -0009d7d0: 2c20 696d 6167 6520 7265 736f 6c75 7469 , image resoluti │ │ │ -0009d7e0: 6f6e 2c20 616e 6420 7468 6520 696d 6167 on, and the imag │ │ │ -0009d7f0: 6520 6e6f 6973 652e 0a66 6f72 2074 6865 e noise..for the │ │ │ -0009d800: 206f 7468 6572 2070 6f69 6e74 732e 2054 other points. T │ │ │ -0009d810: 6865 2061 7272 6179 2069 7320 636f 6d70 he array is comp │ │ │ -0009d820: 7574 6564 206f 6e6c 7920 696e 2074 6865 uted only in the │ │ │ -0009d830: 2052 414e 5341 4320 616e 6420 4c4d 6564 RANSAC and LMed │ │ │ -0009d840: 5320 6d65 7468 6f64 732e 0a0a 5468 6973 S methods...This │ │ │ -0009d850: 2066 756e 6374 696f 6e20 6573 7469 6d61 function estima │ │ │ -0009d860: 7465 7320 6573 7365 6e74 6961 6c20 6d61 tes essential ma │ │ │ -0009d870: 7472 6978 2062 6173 6564 206f 6e20 7468 trix based on th │ │ │ -0009d880: 6520 6669 7665 2d70 6f69 6e74 2061 6c67 e five-point alg │ │ │ -0009d890: 6f72 6974 686d 2073 6f6c 7665 7220 696e orithm solver in │ │ │ -0009d8a0: 2043 4954 453a 204e 6973 7465 7230 3320 CITE: Nister03 │ │ │ -0009d8b0: 2e0a 4349 5445 3a20 5374 6577 656e 6975 ..CITE: Steweniu │ │ │ -0009d8c0: 7343 4653 2069 7320 616c 736f 2061 2072 sCFS is also a r │ │ │ -0009d8d0: 656c 6174 6564 2e20 5468 6520 6570 6970 elated. The epip │ │ │ -0009d8e0: 6f6c 6172 2067 656f 6d65 7472 7920 6973 olar geometry is │ │ │ -0009d8f0: 2064 6573 6372 6962 6564 2062 7920 7468 described by th │ │ │ -0009d900: 6520 666f 6c6c 6f77 696e 6720 6571 7561 e following equa │ │ │ -0009d910: 7469 6f6e 3a0a 0a5c 285b 705f 323b 2031 tion:..\([p_2; 1 │ │ │ -0009d920: 5d5e 5420 4b5e 7b2d 547d 2045 204b 5e7b ]^T K^{-T} E K^{ │ │ │ -0009d930: 2d31 7d20 5b70 5f31 3b20 315d 203d 2030 -1} [p_1; 1] = 0 │ │ │ -0009d940: 5c29 0a0a 7768 6572 6520 5c28 455c 2920 \)..where \(E\) │ │ │ -0009d950: 6973 2061 6e20 6573 7365 6e74 6961 6c20 is an essential │ │ │ -0009d960: 6d61 7472 6978 2c20 5c28 705f 315c 2920 matrix, \(p_1\) │ │ │ -0009d970: 616e 6420 5c28 705f 325c 2920 6172 6520 and \(p_2\) are │ │ │ -0009d980: 636f 7272 6573 706f 6e64 696e 6720 706f corresponding po │ │ │ -0009d990: 696e 7473 2069 6e20 7468 6520 6669 7273 ints in the firs │ │ │ -0009d9a0: 7420 616e 6420 7468 650a 7365 636f 6e64 t and the.second │ │ │ -0009d9b0: 2069 6d61 6765 732c 2072 6573 7065 6374 images, respect │ │ │ -0009d9c0: 6976 656c 792e 2054 6865 2072 6573 756c ively. The resul │ │ │ -0009d9d0: 7420 6f66 2074 6869 7320 6675 6e63 7469 t of this functi │ │ │ -0009d9e0: 6f6e 206d 6179 2062 6520 7061 7373 6564 on may be passed │ │ │ -0009d9f0: 2066 7572 7468 6572 2074 6f0a 2364 6563 further to.#dec │ │ │ -0009da00: 6f6d 706f 7365 4573 7365 6e74 6961 6c4d omposeEssentialM │ │ │ -0009da10: 6174 206f 7220 2023 7265 636f 7665 7250 at or #recoverP │ │ │ -0009da20: 6f73 6520 746f 2072 6563 6f76 6572 2074 ose to recover t │ │ │ -0009da30: 6865 2072 656c 6174 6976 6520 706f 7365 he relative pose │ │ │ -0009da40: 2062 6574 7765 656e 2063 616d 6572 6173 between cameras │ │ │ -0009da50: 2e3c 2f64 643e 0a3c 6474 3e52 6574 7572 .
    .
    Retur │ │ │ -0009da60: 6e73 3a3c 2f64 743e 0a3c 6464 3e61 7574 ns:
    .
    aut │ │ │ -0009da70: 6f6d 6174 6963 616c 6c79 2067 656e 6572 omatically gener │ │ │ -0009da80: 6174 6564 3c2f 6464 3e0a 3c2f 646c 3e0a ated
    .
    . │ │ │ -0009da90: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e
    .
    .
  • .
  • ..

    find │ │ │ -0009db90: 4573 7365 6e74 6961 6c4d 6174 3c2f 6833 EssentialMat

    .
    .
    │ │ │ -0009dbe0: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -0009dc00: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -0009dc10: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;Mat< │ │ │ -0009dc70: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> findEssen │ │ │ -0009dca0: 7469 616c 4d61 743c 2f73 7061 6e3e 3c77 tialMat(Mat │ │ │ -0009dd10: 266e 6273 703b 706f 696e 7473 312c 0a20  points1,. │ │ │ -0009dd20: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0009dd60: 2f61 3e26 6e62 7370 3b70 6f69 6e74 7332 /a> points2 │ │ │ -0009dd70: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -0009ddb0: 6174 3c2f 613e 266e 6273 703b 6361 6d65 at came │ │ │ -0009ddc0: 7261 4d61 7472 6978 312c 0a20 3c61 2068 raMatrix1,. Mat& │ │ │ -0009de10: 6e62 7370 3b63 616d 6572 614d 6174 7269 nbsp;cameraMatri │ │ │ -0009de20: 7832 2c0a 203c 6120 6872 6566 3d22 2e2e x2,. Mat di │ │ │ -0009de70: 7374 5f63 6f65 6666 312c 0a20 3c61 2068 st_coeff1,. Mat& │ │ │ -0009dec0: 6e62 7370 3b64 6973 745f 636f 6566 6632 nbsp;dist_coeff2 │ │ │ -0009ded0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -0009df10: 6174 3c2f 613e 266e 6273 703b 6d61 736b at mask │ │ │ -0009df20: 2c0a 203c 6120 6872 6566 3d22 5573 6163 ,. UsacParams │ │ │ -0009df70: 266e 6273 703b 7061 7261 6d73 293c 2f73  params)
    .
    .
  • ..
  • .
    .

    decomposeEssent │ │ │ -0009e040: 6961 6c4d 6174 3c2f 6833 3e0a 3c64 6976 ialMat

    .
    .
    public static< │ │ │ -0009e0b0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> void decomposeEssen │ │ │ -0009e110: 7469 616c 4d61 743c 2f73 7061 6e3e 3c77 tialMat(Mat │ │ │ -0009e180: 266e 6273 703b 452c 0a20 3c61 2068 7265  E,. Mat&nb │ │ │ -0009e1d0: 7370 3b52 312c 0a20 3c61 2068 7265 663d sp;R1,. Mat  │ │ │ -0009e220: 3b52 322c 0a20 3c61 2068 7265 663d 222e ;R2,. Mat t │ │ │ -0009e270: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ -0009e280: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -0009e290: 223e 4465 636f 6d70 6f73 6520 616e 2065 ">Decompose an e │ │ │ -0009e2a0: 7373 656e 7469 616c 206d 6174 7269 7820 ssential matrix │ │ │ -0009e2b0: 746f 2070 6f73 7369 626c 6520 726f 7461 to possible rota │ │ │ -0009e2c0: 7469 6f6e 7320 616e 6420 7472 616e 736c tions and transl │ │ │ -0009e2d0: 6174 696f 6e2e 3c2f 6469 763e 0a3c 646c ation.
    .
    . │ │ │ -0009e2f0: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -0009e300: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e45 /dt>.
    E │ │ │ -0009e310: 3c2f 636f 6465 3e20 2d20 5468 6520 696e - The in │ │ │ -0009e320: 7075 7420 6573 7365 6e74 6961 6c20 6d61 put essential ma │ │ │ -0009e330: 7472 6978 2e3c 2f64 643e 0a3c 6464 3e3c trix.
    .
    < │ │ │ -0009e340: 636f 6465 3e52 313c 2f63 6f64 653e 202d code>R1 - │ │ │ -0009e350: 204f 6e65 2070 6f73 7369 626c 6520 726f One possible ro │ │ │ -0009e360: 7461 7469 6f6e 206d 6174 7269 782e 3c2f tation matrix..
    R2 │ │ │ -0009e380: 3c2f 636f 6465 3e20 2d20 416e 6f74 6865 - Anothe │ │ │ -0009e390: 7220 706f 7373 6962 6c65 2072 6f74 6174 r possible rotat │ │ │ -0009e3a0: 696f 6e20 6d61 7472 6978 2e3c 2f64 643e ion matrix.
    │ │ │ -0009e3b0: 0a3c 6464 3e3c 636f 6465 3e74 3c2f 636f .
    t - One possib │ │ │ -0009e3d0: 6c65 2074 7261 6e73 6c61 7469 6f6e 2e0a le translation.. │ │ │ -0009e3e0: 0a54 6869 7320 6675 6e63 7469 6f6e 2064 .This function d │ │ │ -0009e3f0: 6563 6f6d 706f 7365 7320 7468 6520 6573 ecomposes the es │ │ │ -0009e400: 7365 6e74 6961 6c20 6d61 7472 6978 2045 sential matrix E │ │ │ -0009e410: 2075 7369 6e67 2073 7664 2064 6563 6f6d using svd decom │ │ │ -0009e420: 706f 7369 7469 6f6e 2043 4954 453a 2048 position CITE: H │ │ │ -0009e430: 6172 746c 6579 5a30 302e 2049 6e0a 6765 artleyZ00. In.ge │ │ │ -0009e440: 6e65 7261 6c2c 2066 6f75 7220 706f 7373 neral, four poss │ │ │ -0009e450: 6962 6c65 2070 6f73 6573 2065 7869 7374 ible poses exist │ │ │ -0009e460: 2066 6f72 2074 6865 2064 6563 6f6d 706f for the decompo │ │ │ -0009e470: 7369 7469 6f6e 206f 6620 452e 2054 6865 sition of E. The │ │ │ -0009e480: 7920 6172 6520 5c28 5b52 5f31 2c20 745d y are \([R_1, t] │ │ │ -0009e490: 5c29 2c0a 5c28 5b52 5f31 2c20 2d74 5d5c \),.\([R_1, -t]\ │ │ │ -0009e4a0: 292c 205c 285b 525f 322c 2074 5d5c 292c ), \([R_2, t]\), │ │ │ -0009e4b0: 205c 285b 525f 322c 202d 745d 5c29 2e0a \([R_2, -t]\).. │ │ │ -0009e4c0: 0a49 6620 4520 6769 7665 7320 7468 6520 .If E gives the │ │ │ -0009e4d0: 6570 6970 6f6c 6172 2063 6f6e 7374 7261 epipolar constra │ │ │ -0009e4e0: 696e 7420 5c28 5b70 5f32 3b20 315d 5e54 int \([p_2; 1]^T │ │ │ -0009e4f0: 2041 5e7b 2d54 7d20 4520 415e 7b2d 317d A^{-T} E A^{-1} │ │ │ -0009e500: 205b 705f 313b 2031 5d20 3d20 305c 2920 [p_1; 1] = 0\) │ │ │ -0009e510: 6265 7477 6565 6e20 7468 6520 696d 6167 between the imag │ │ │ -0009e520: 650a 706f 696e 7473 205c 2870 5f31 5c29 e.points \(p_1\) │ │ │ -0009e530: 2069 6e20 7468 6520 6669 7273 7420 696d in the first im │ │ │ -0009e540: 6167 6520 616e 6420 5c28 705f 325c 2920 age and \(p_2\) │ │ │ -0009e550: 696e 2073 6563 6f6e 6420 696d 6167 652c in second image, │ │ │ -0009e560: 2074 6865 6e20 616e 7920 6f66 2074 6865 then any of the │ │ │ -0009e570: 2074 7570 6c65 730a 5c28 5b52 5f31 2c20 tuples.\([R_1, │ │ │ -0009e580: 745d 5c29 2c20 5c28 5b52 5f31 2c20 2d74 t]\), \([R_1, -t │ │ │ -0009e590: 5d5c 292c 205c 285b 525f 322c 2074 5d5c ]\), \([R_2, t]\ │ │ │ -0009e5a0: 292c 205c 285b 525f 322c 202d 745d 5c29 ), \([R_2, -t]\) │ │ │ -0009e5b0: 2069 7320 6120 6368 616e 6765 206f 6620 is a change of │ │ │ -0009e5c0: 6261 7369 7320 6672 6f6d 2074 6865 2066 basis from the f │ │ │ -0009e5d0: 6972 7374 0a63 616d 6572 6127 7320 636f irst.camera's co │ │ │ -0009e5e0: 6f72 6469 6e61 7465 2073 7973 7465 6d20 ordinate system │ │ │ -0009e5f0: 746f 2074 6865 2073 6563 6f6e 6420 6361 to the second ca │ │ │ -0009e600: 6d65 7261 2773 2063 6f6f 7264 696e 6174 mera's coordinat │ │ │ -0009e610: 6520 7379 7374 656d 2e20 486f 7765 7665 e system. Howeve │ │ │ -0009e620: 722c 2062 7920 6465 636f 6d70 6f73 696e r, by decomposin │ │ │ -0009e630: 6720 452c 206f 6e65 0a63 616e 206f 6e6c g E, one.can onl │ │ │ -0009e640: 7920 6765 7420 7468 6520 6469 7265 6374 y get the direct │ │ │ -0009e650: 696f 6e20 6f66 2074 6865 2074 7261 6e73 ion of the trans │ │ │ -0009e660: 6c61 7469 6f6e 2e20 466f 7220 7468 6973 lation. For this │ │ │ -0009e670: 2072 6561 736f 6e2c 2074 6865 2074 7261 reason, the tra │ │ │ -0009e680: 6e73 6c61 7469 6f6e 2074 2069 7320 7265 nslation t is re │ │ │ -0009e690: 7475 726e 6564 2077 6974 680a 756e 6974 turned with.unit │ │ │ -0009e6a0: 206c 656e 6774 682e 3c2f 6464 3e0a 3c2f length.
    ....
  • .
  • │ │ │ -0009e6d0: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    recove │ │ │ -0009e7e0: 7250 6f73 653c 2f68 333e 0a3c 6469 7620 rPose

    .
    .
    public static int& │ │ │ -0009e880: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -0009e8a0: 7265 636f 7665 7250 6f73 653c 2f73 7061 recoverPose │ │ │ -0009e8d0: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ -0009e910: 3c2f 613e 266e 6273 703b 706f 696e 7473  points │ │ │ -0009e920: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ -0009e960: 4d61 743c 2f61 3e26 6e62 7370 3b70 6f69 Mat poi │ │ │ -0009e970: 6e74 7332 2c0a 203c 6120 6872 6566 3d22 nts2,. Mat  │ │ │ -0009e9c0: 6361 6d65 7261 4d61 7472 6978 312c 0a20 cameraMatrix1,. │ │ │ -0009e9d0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0009ea10: 2f61 3e26 6e62 7370 3b64 6973 7443 6f65 /a> distCoe │ │ │ -0009ea20: 6666 7331 2c0a 203c 6120 6872 6566 3d22 ffs1,. Mat  │ │ │ -0009ea70: 6361 6d65 7261 4d61 7472 6978 322c 0a20 cameraMatrix2,. │ │ │ -0009ea80: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -0009eac0: 2f61 3e26 6e62 7370 3b64 6973 7443 6f65 /a> distCoe │ │ │ -0009ead0: 6666 7332 2c0a 203c 6120 6872 6566 3d22 ffs2,. Mat  │ │ │ -0009eb20: 452c 0a20 3c61 2068 7265 663d 222e 2e2f E,. │ │ │ -0009eb60: 4d61 743c 2f61 3e26 6e62 7370 3b52 2c0a Mat R,. │ │ │ -0009eb70: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -0009ebb0: 3c2f 613e 266e 6273 703b 742c 0a20 696e  t,. in │ │ │ -0009ebc0: 7426 6e62 7370 3b6d 6574 686f 642c 0a20 t method,. │ │ │ -0009ebd0: 646f 7562 6c65 266e 6273 703b 7072 6f62 double prob │ │ │ -0009ebe0: 2c0a 2064 6f75 626c 6526 6e62 7370 3b74 ,. double t │ │ │ -0009ebf0: 6872 6573 686f 6c64 2c0a 203c 6120 6872 hreshold,. Mat&n │ │ │ -0009ec40: 6273 703b 6d61 736b 293c 2f73 7061 6e3e bsp;mask) │ │ │ -0009ec50: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Recove │ │ │ -0009ec70: 7273 2074 6865 2072 656c 6174 6976 6520 rs the relative │ │ │ -0009ec80: 6361 6d65 7261 2072 6f74 6174 696f 6e20 camera rotation │ │ │ -0009ec90: 616e 6420 7468 6520 7472 616e 736c 6174 and the translat │ │ │ -0009eca0: 696f 6e20 6672 6f6d 2063 6f72 7265 7370 ion from corresp │ │ │ -0009ecb0: 6f6e 6469 6e67 2070 6f69 6e74 7320 696e onding points in │ │ │ -0009ecc0: 2074 776f 2069 6d61 6765 7320 6672 6f6d two images from │ │ │ -0009ecd0: 2074 776f 2064 6966 6665 7265 6e74 2063 two different c │ │ │ -0009ece0: 616d 6572 6173 2c20 7573 696e 6720 6368 ameras, using ch │ │ │ -0009ecf0: 6972 616c 6974 7920 6368 6563 6b2e 2052 irality check. R │ │ │ -0009ed00: 6574 7572 6e73 2074 6865 206e 756d 6265 eturns the numbe │ │ │ -0009ed10: 7220 6f66 0a69 6e6c 6965 7273 2074 6861 r of.inliers tha │ │ │ -0009ed20: 7420 7061 7373 2074 6865 2063 6865 636b t pass the check │ │ │ -0009ed30: 2e3c 2f64 6976 3e0a 3c64 6c20 636c 6173 .
    .
    .
    P │ │ │ -0009ed50: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ -0009ed60: 3c64 643e 3c63 6f64 653e 706f 696e 7473
    points │ │ │ -0009ed70: 313c 2f63 6f64 653e 202d 2041 7272 6179 1 - Array │ │ │ -0009ed80: 206f 6620 4e20 3244 2070 6f69 6e74 7320 of N 2D points │ │ │ -0009ed90: 6672 6f6d 2074 6865 2066 6972 7374 2069 from the first i │ │ │ -0009eda0: 6d61 6765 2e20 5468 6520 706f 696e 7420 mage. The point │ │ │ -0009edb0: 636f 6f72 6469 6e61 7465 7320 7368 6f75 coordinates shou │ │ │ -0009edc0: 6c64 2062 650a 666c 6f61 7469 6e67 2d70 ld be.floating-p │ │ │ -0009edd0: 6f69 6e74 2028 7369 6e67 6c65 206f 7220 oint (single or │ │ │ -0009ede0: 646f 7562 6c65 2070 7265 6369 7369 6f6e double precision │ │ │ -0009edf0: 292e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 ).
    .
    points2 │ │ │ -0009ee10: 202d 2041 7272 6179 206f 6620 7468 6520 - Array of the │ │ │ -0009ee20: 7365 636f 6e64 2069 6d61 6765 2070 6f69 second image poi │ │ │ -0009ee30: 6e74 7320 6f66 2074 6865 2073 616d 6520 nts of the same │ │ │ -0009ee40: 7369 7a65 2061 6e64 2066 6f72 6d61 7420 size and format │ │ │ -0009ee50: 6173 2070 6f69 6e74 7331 202e 3c2f 6464 as points1 .
    .
    came │ │ │ -0009ee70: 7261 4d61 7472 6978 313c 2f63 6f64 653e raMatrix1 │ │ │ -0009ee80: 202d 2049 6e70 7574 2f6f 7574 7075 7420 - Input/output │ │ │ -0009ee90: 6361 6d65 7261 206d 6174 7269 7820 666f camera matrix fo │ │ │ -0009eea0: 7220 7468 6520 6669 7273 7420 6361 6d65 r the first came │ │ │ -0009eeb0: 7261 2c20 7468 6520 7361 6d65 2061 7320 ra, the same as │ │ │ -0009eec0: 696e 0a52 4546 3a20 6361 6c69 6272 6174 in.REF: calibrat │ │ │ -0009eed0: 6543 616d 6572 612e 2046 7572 7468 6572 eCamera. Further │ │ │ -0009eee0: 6d6f 7265 2c20 666f 7220 7468 6520 7374 more, for the st │ │ │ -0009eef0: 6572 656f 2063 6173 652c 2061 6464 6974 ereo case, addit │ │ │ -0009ef00: 696f 6e61 6c20 666c 6167 7320 6d61 7920 ional flags may │ │ │ -0009ef10: 6265 2075 7365 642c 2073 6565 2062 656c be used, see bel │ │ │ -0009ef20: 6f77 2e3c 2f64 643e 0a3c 6464 3e3c 636f ow.
    .
    distCoeffs1 - Input/ou │ │ │ -0009ef50: 7470 7574 2076 6563 746f 7220 6f66 2064 tput vector of d │ │ │ -0009ef60: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ -0009ef70: 6369 656e 7473 2c20 7468 6520 7361 6d65 cients, the same │ │ │ -0009ef80: 2061 7320 696e 0a52 4546 3a20 6361 6c69 as in.REF: cali │ │ │ -0009ef90: 6272 6174 6543 616d 6572 612e 3c2f 6464 brateCamera.
    .
    came │ │ │ -0009efb0: 7261 4d61 7472 6978 323c 2f63 6f64 653e raMatrix2 │ │ │ -0009efc0: 202d 2049 6e70 7574 2f6f 7574 7075 7420 - Input/output │ │ │ -0009efd0: 6361 6d65 7261 206d 6174 7269 7820 666f camera matrix fo │ │ │ -0009efe0: 7220 7468 6520 6669 7273 7420 6361 6d65 r the first came │ │ │ -0009eff0: 7261 2c20 7468 6520 7361 6d65 2061 7320 ra, the same as │ │ │ -0009f000: 696e 0a52 4546 3a20 6361 6c69 6272 6174 in.REF: calibrat │ │ │ -0009f010: 6543 616d 6572 612e 2046 7572 7468 6572 eCamera. Further │ │ │ -0009f020: 6d6f 7265 2c20 666f 7220 7468 6520 7374 more, for the st │ │ │ -0009f030: 6572 656f 2063 6173 652c 2061 6464 6974 ereo case, addit │ │ │ -0009f040: 696f 6e61 6c20 666c 6167 7320 6d61 7920 ional flags may │ │ │ -0009f050: 6265 2075 7365 642c 2073 6565 2062 656c be used, see bel │ │ │ -0009f060: 6f77 2e3c 2f64 643e 0a3c 6464 3e3c 636f ow.
    .
    distCoeffs2 - Input/ou │ │ │ -0009f090: 7470 7574 2076 6563 746f 7220 6f66 2064 tput vector of d │ │ │ -0009f0a0: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ -0009f0b0: 6369 656e 7473 2c20 7468 6520 7361 6d65 cients, the same │ │ │ -0009f0c0: 2061 7320 696e 0a52 4546 3a20 6361 6c69 as in.REF: cali │ │ │ -0009f0d0: 6272 6174 6543 616d 6572 612e 3c2f 6464 brateCamera.
    .
    E - The outpu │ │ │ -0009f100: 7420 6573 7365 6e74 6961 6c20 6d61 7472 t essential matr │ │ │ -0009f110: 6978 2e3c 2f64 643e 0a3c 6464 3e3c 636f ix.
    .
    R - Ou │ │ │ -0009f130: 7470 7574 2072 6f74 6174 696f 6e20 6d61 tput rotation ma │ │ │ -0009f140: 7472 6978 2e20 546f 6765 7468 6572 2077 trix. Together w │ │ │ -0009f150: 6974 6820 7468 6520 7472 616e 736c 6174 ith the translat │ │ │ -0009f160: 696f 6e20 7665 6374 6f72 2c20 7468 6973 ion vector, this │ │ │ -0009f170: 206d 6174 7269 7820 6d61 6b65 7320 7570 matrix makes up │ │ │ -0009f180: 2061 2074 7570 6c65 0a74 6861 7420 7065 a tuple.that pe │ │ │ -0009f190: 7266 6f72 6d73 2061 2063 6861 6e67 6520 rforms a change │ │ │ -0009f1a0: 6f66 2062 6173 6973 2066 726f 6d20 7468 of basis from th │ │ │ -0009f1b0: 6520 6669 7273 7420 6361 6d65 7261 2773 e first camera's │ │ │ -0009f1c0: 2063 6f6f 7264 696e 6174 6520 7379 7374 coordinate syst │ │ │ -0009f1d0: 656d 2074 6f20 7468 6520 7365 636f 6e64 em to the second │ │ │ -0009f1e0: 2063 616d 6572 6127 730a 636f 6f72 6469 camera's.coordi │ │ │ -0009f1f0: 6e61 7465 2073 7973 7465 6d2e 204e 6f74 nate system. Not │ │ │ -0009f200: 6520 7468 6174 2c20 696e 2067 656e 6572 e that, in gener │ │ │ -0009f210: 616c 2c20 7420 6361 6e20 6e6f 7420 6265 al, t can not be │ │ │ -0009f220: 2075 7365 6420 666f 7220 7468 6973 2074 used for this t │ │ │ -0009f230: 7570 6c65 2c20 7365 6520 7468 6520 7061 uple, see the pa │ │ │ -0009f240: 7261 6d65 7465 720a 6465 7363 7269 6265 rameter.describe │ │ │ -0009f250: 6420 6265 6c6f 772e 3c2f 6464 3e0a 3c64 d below.
    .t │ │ │ -0009f270: 202d 204f 7574 7075 7420 7472 616e 736c - Output transl │ │ │ -0009f280: 6174 696f 6e20 7665 6374 6f72 2e20 5468 ation vector. Th │ │ │ -0009f290: 6973 2076 6563 746f 7220 6973 206f 6274 is vector is obt │ │ │ -0009f2a0: 6169 6e65 6420 6279 2052 4546 3a20 6465 ained by REF: de │ │ │ -0009f2b0: 636f 6d70 6f73 6545 7373 656e 7469 616c composeEssential │ │ │ -0009f2c0: 4d61 7420 616e 640a 7468 6572 6566 6f72 Mat and.therefor │ │ │ -0009f2d0: 6520 6973 206f 6e6c 7920 6b6e 6f77 6e20 e is only known │ │ │ -0009f2e0: 7570 2074 6f20 7363 616c 652c 2069 2e65 up to scale, i.e │ │ │ -0009f2f0: 2e20 7420 6973 2074 6865 2064 6972 6563 . t is the direc │ │ │ -0009f300: 7469 6f6e 206f 6620 7468 6520 7472 616e tion of the tran │ │ │ -0009f310: 736c 6174 696f 6e20 7665 6374 6f72 2061 slation vector a │ │ │ -0009f320: 6e64 2068 6173 2075 6e69 740a 6c65 6e67 nd has unit.leng │ │ │ -0009f330: 7468 2e3c 2f64 643e 0a3c 6464 3e3c 636f th..
    method │ │ │ -0009f350: 202d 204d 6574 686f 6420 666f 7220 636f - Method for co │ │ │ -0009f360: 6d70 7574 696e 6720 616e 2065 7373 656e mputing an essen │ │ │ -0009f370: 7469 616c 206d 6174 7269 782e 0a3c 756c tial matrix..
      .
    • . REF: │ │ │ -0009f390: 2052 414e 5341 4320 666f 7220 7468 6520 RANSAC for the │ │ │ -0009f3a0: 5241 4e53 4143 2061 6c67 6f72 6974 686d RANSAC algorithm │ │ │ -0009f3b0: 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c 693e ..
    • .
    • │ │ │ -0009f3c0: 0a20 2020 5245 463a 204c 4d45 4453 2066 . REF: LMEDS f │ │ │ -0009f3d0: 6f72 2074 6865 204c 4d65 6453 2061 6c67 or the LMedS alg │ │ │ -0009f3e0: 6f72 6974 686d 2e0a 2020 3c2f 6c69 3e0a orithm..
    • . │ │ │ -0009f3f0: 3c2f 756c 3e3c 2f64 643e 0a3c 6464 3e3c
    .
    < │ │ │ -0009f400: 636f 6465 3e70 726f 623c 2f63 6f64 653e code>prob │ │ │ -0009f410: 202d 2050 6172 616d 6574 6572 2075 7365 - Parameter use │ │ │ -0009f420: 6420 666f 7220 7468 6520 5241 4e53 4143 d for the RANSAC │ │ │ -0009f430: 206f 7220 4c4d 6564 5320 6d65 7468 6f64 or LMedS method │ │ │ -0009f440: 7320 6f6e 6c79 2e20 4974 2073 7065 6369 s only. It speci │ │ │ -0009f450: 6669 6573 2061 2064 6573 6972 6162 6c65 fies a desirable │ │ │ -0009f460: 206c 6576 656c 206f 660a 636f 6e66 6964 level of.confid │ │ │ -0009f470: 656e 6365 2028 7072 6f62 6162 696c 6974 ence (probabilit │ │ │ -0009f480: 7929 2074 6861 7420 7468 6520 6573 7469 y) that the esti │ │ │ -0009f490: 6d61 7465 6420 6d61 7472 6978 2069 7320 mated matrix is │ │ │ -0009f4a0: 636f 7272 6563 742e 3c2f 6464 3e0a 3c64 correct.
    .threshol │ │ │ -0009f4c0: 643c 2f63 6f64 653e 202d 2050 6172 616d d - Param │ │ │ -0009f4d0: 6574 6572 2075 7365 6420 666f 7220 5241 eter used for RA │ │ │ -0009f4e0: 4e53 4143 2e20 4974 2069 7320 7468 6520 NSAC. It is the │ │ │ -0009f4f0: 6d61 7869 6d75 6d20 6469 7374 616e 6365 maximum distance │ │ │ -0009f500: 2066 726f 6d20 6120 706f 696e 7420 746f from a point to │ │ │ -0009f510: 2061 6e20 6570 6970 6f6c 6172 0a6c 696e an epipolar.lin │ │ │ -0009f520: 6520 696e 2070 6978 656c 732c 2062 6579 e in pixels, bey │ │ │ -0009f530: 6f6e 6420 7768 6963 6820 7468 6520 706f ond which the po │ │ │ -0009f540: 696e 7420 6973 2063 6f6e 7369 6465 7265 int is considere │ │ │ -0009f550: 6420 616e 206f 7574 6c69 6572 2061 6e64 d an outlier and │ │ │ -0009f560: 2069 7320 6e6f 7420 7573 6564 2066 6f72 is not used for │ │ │ -0009f570: 2063 6f6d 7075 7469 6e67 2074 6865 0a66 computing the.f │ │ │ -0009f580: 696e 616c 2066 756e 6461 6d65 6e74 616c inal fundamental │ │ │ -0009f590: 206d 6174 7269 782e 2049 7420 6361 6e20 matrix. It can │ │ │ -0009f5a0: 6265 2073 6574 2074 6f20 736f 6d65 7468 be set to someth │ │ │ -0009f5b0: 696e 6720 6c69 6b65 2031 2d33 2c20 6465 ing like 1-3, de │ │ │ -0009f5c0: 7065 6e64 696e 6720 6f6e 2074 6865 2061 pending on the a │ │ │ -0009f5d0: 6363 7572 6163 7920 6f66 2074 6865 0a70 ccuracy of the.p │ │ │ -0009f5e0: 6f69 6e74 206c 6f63 616c 697a 6174 696f oint localizatio │ │ │ -0009f5f0: 6e2c 2069 6d61 6765 2072 6573 6f6c 7574 n, image resolut │ │ │ -0009f600: 696f 6e2c 2061 6e64 2074 6865 2069 6d61 ion, and the ima │ │ │ -0009f610: 6765 206e 6f69 7365 2e3c 2f64 643e 0a3c ge noise..< │ │ │ -0009f620: 6464 3e3c 636f 6465 3e6d 6173 6b3c 2f63 dd>mask - Input/out │ │ │ -0009f640: 7075 7420 6d61 736b 2066 6f72 2069 6e6c put mask for inl │ │ │ -0009f650: 6965 7273 2069 6e20 706f 696e 7473 3120 iers in points1 │ │ │ -0009f660: 616e 6420 706f 696e 7473 322e 2049 6620 and points2. If │ │ │ -0009f670: 6974 2069 7320 6e6f 7420 656d 7074 792c it is not empty, │ │ │ -0009f680: 2074 6865 6e20 6974 206d 6172 6b73 0a69 then it marks.i │ │ │ -0009f690: 6e6c 6965 7273 2069 6e20 706f 696e 7473 nliers in points │ │ │ -0009f6a0: 3120 616e 6420 706f 696e 7473 3220 666f 1 and points2 fo │ │ │ -0009f6b0: 7220 7468 6520 6769 7665 6e20 6573 7365 r the given esse │ │ │ -0009f6c0: 6e74 6961 6c20 6d61 7472 6978 2045 2e20 ntial matrix E. │ │ │ -0009f6d0: 4f6e 6c79 2074 6865 7365 2069 6e6c 6965 Only these inlie │ │ │ -0009f6e0: 7273 2077 696c 6c20 6265 2075 7365 6420 rs will be used │ │ │ -0009f6f0: 746f 0a72 6563 6f76 6572 2070 6f73 652e to.recover pose. │ │ │ -0009f700: 2049 6e20 7468 6520 6f75 7470 7574 206d In the output m │ │ │ -0009f710: 6173 6b20 6f6e 6c79 2069 6e6c 6965 7273 ask only inliers │ │ │ -0009f720: 2077 6869 6368 2070 6173 7320 7468 6520 which pass the │ │ │ -0009f730: 6368 6972 616c 6974 7920 6368 6563 6b2e chirality check. │ │ │ -0009f740: 0a0a 5468 6973 2066 756e 6374 696f 6e20 ..This function │ │ │ -0009f750: 6465 636f 6d70 6f73 6573 2061 6e20 6573 decomposes an es │ │ │ -0009f760: 7365 6e74 6961 6c20 6d61 7472 6978 2075 sential matrix u │ │ │ -0009f770: 7369 6e67 2052 4546 3a20 6465 636f 6d70 sing REF: decomp │ │ │ -0009f780: 6f73 6545 7373 656e 7469 616c 4d61 7420 oseEssentialMat │ │ │ -0009f790: 616e 6420 7468 656e 2076 6572 6966 6965 and then verifie │ │ │ -0009f7a0: 730a 706f 7373 6962 6c65 2070 6f73 6520 s.possible pose │ │ │ -0009f7b0: 6879 706f 7468 6573 6573 2062 7920 646f hypotheses by do │ │ │ -0009f7c0: 696e 6720 6368 6972 616c 6974 7920 6368 ing chirality ch │ │ │ -0009f7d0: 6563 6b2e 2054 6865 2063 6869 7261 6c69 eck. The chirali │ │ │ -0009f7e0: 7479 2063 6865 636b 206d 6561 6e73 2074 ty check means t │ │ │ -0009f7f0: 6861 7420 7468 650a 7472 6961 6e67 756c hat the.triangul │ │ │ -0009f800: 6174 6564 2033 4420 706f 696e 7473 2073 ated 3D points s │ │ │ -0009f810: 686f 756c 6420 6861 7665 2070 6f73 6974 hould have posit │ │ │ -0009f820: 6976 6520 6465 7074 682e 2053 6f6d 6520 ive depth. Some │ │ │ -0009f830: 6465 7461 696c 7320 6361 6e20 6265 2066 details can be f │ │ │ -0009f840: 6f75 6e64 2069 6e20 4349 5445 3a20 4e69 ound in CITE: Ni │ │ │ -0009f850: 7374 6572 3033 2e0a 0a54 6869 7320 6675 ster03...This fu │ │ │ -0009f860: 6e63 7469 6f6e 2063 616e 2062 6520 7573 nction can be us │ │ │ -0009f870: 6564 2074 6f20 7072 6f63 6573 7320 7468 ed to process th │ │ │ -0009f880: 6520 6f75 7470 7574 2045 2061 6e64 206d e output E and m │ │ │ -0009f890: 6173 6b20 6672 6f6d 2052 4546 3a20 6669 ask from REF: fi │ │ │ -0009f8a0: 6e64 4573 7365 6e74 6961 6c4d 6174 2e20 ndEssentialMat. │ │ │ -0009f8b0: 496e 2074 6869 730a 7363 656e 6172 696f In this.scenario │ │ │ -0009f8c0: 2c20 706f 696e 7473 3120 616e 6420 706f , points1 and po │ │ │ -0009f8d0: 696e 7473 3220 6172 6520 7468 6520 7361 ints2 are the sa │ │ │ -0009f8e0: 6d65 2069 6e70 7574 2066 6f72 2066 696e me input for fin │ │ │ -0009f8f0: 6445 7373 656e 7469 616c 4d61 742e 3a0a dEssentialMat.:. │ │ │ -0009f900: 3c63 6f64 653e 0a20 2020 202f 2f20 4578 . // Ex │ │ │ -0009f910: 616d 706c 652e 2045 7374 696d 6174 696f ample. Estimatio │ │ │ -0009f920: 6e20 6f66 2066 756e 6461 6d65 6e74 616c n of fundamental │ │ │ -0009f930: 206d 6174 7269 7820 7573 696e 6720 7468 matrix using th │ │ │ -0009f940: 6520 5241 4e53 4143 2061 6c67 6f72 6974 e RANSAC algorit │ │ │ -0009f950: 686d 0a20 2020 2069 6e74 2070 6f69 6e74 hm. int point │ │ │ -0009f960: 5f63 6f75 6e74 203d 2031 3030 3b0a 2020 _count = 100;. │ │ │ -0009f970: 2020 7665 6374 6f72 266c 743b 506f 696e vector<Poin │ │ │ -0009f980: 7432 6626 6774 3b20 706f 696e 7473 3128 t2f> points1( │ │ │ -0009f990: 706f 696e 745f 636f 756e 7429 3b0a 2020 point_count);. │ │ │ -0009f9a0: 2020 7665 6374 6f72 266c 743b 506f 696e vector<Poin │ │ │ -0009f9b0: 7432 6626 6774 3b20 706f 696e 7473 3228 t2f> points2( │ │ │ -0009f9c0: 706f 696e 745f 636f 756e 7429 3b0a 0a20 point_count);.. │ │ │ -0009f9d0: 2020 202f 2f20 696e 6974 6961 6c69 7a65 // initialize │ │ │ -0009f9e0: 2074 6865 2070 6f69 6e74 7320 6865 7265 the points here │ │ │ -0009f9f0: 202e 2e2e 0a20 2020 2066 6f72 2820 696e .... for( in │ │ │ -0009fa00: 7420 6920 3d20 303b 2069 2026 6c74 3b20 t i = 0; i < │ │ │ -0009fa10: 706f 696e 745f 636f 756e 743b 2069 2b2b point_count; i++ │ │ │ -0009fa20: 2029 0a20 2020 207b 0a20 2020 2020 2020 ). {. │ │ │ -0009fa30: 2070 6f69 6e74 7331 5b69 5d20 3d20 2e2e points1[i] = .. │ │ │ -0009fa40: 2e3b 0a20 2020 2020 2020 2070 6f69 6e74 .;. point │ │ │ -0009fa50: 7332 5b69 5d20 3d20 2e2e 2e3b 0a20 2020 s2[i] = ...;. │ │ │ -0009fa60: 207d 0a0a 2020 2020 2f2f 2049 6e70 7574 }.. // Input │ │ │ -0009fa70: 3a20 6361 6d65 7261 2063 616c 6962 7261 : camera calibra │ │ │ -0009fa80: 7469 6f6e 206f 6620 626f 7468 2063 616d tion of both cam │ │ │ -0009fa90: 6572 6173 2c20 666f 7220 6578 616d 706c eras, for exampl │ │ │ -0009faa0: 6520 7573 696e 6720 696e 7472 696e 7369 e using intrinsi │ │ │ -0009fab0: 6320 6368 6573 7362 6f61 7264 2063 616c c chessboard cal │ │ │ -0009fac0: 6962 7261 7469 6f6e 2e0a 2020 2020 4d61 ibration.. Ma │ │ │ -0009fad0: 7420 6361 6d65 7261 4d61 7472 6978 312c t cameraMatrix1, │ │ │ -0009fae0: 2064 6973 7443 6f65 6666 7331 2c20 6361 distCoeffs1, ca │ │ │ -0009faf0: 6d65 7261 4d61 7472 6978 322c 2064 6973 meraMatrix2, dis │ │ │ -0009fb00: 7443 6f65 6666 7332 3b0a 0a20 2020 202f tCoeffs2;.. / │ │ │ -0009fb10: 2f20 4f75 7470 7574 3a20 4573 7365 6e74 / Output: Essent │ │ │ -0009fb20: 6961 6c20 6d61 7472 6978 2c20 7265 6c61 ial matrix, rela │ │ │ -0009fb30: 7469 7665 2072 6f74 6174 696f 6e20 616e tive rotation an │ │ │ -0009fb40: 6420 7265 6c61 7469 7665 2074 7261 6e73 d relative trans │ │ │ -0009fb50: 6c61 7469 6f6e 2e0a 2020 2020 4d61 7420 lation.. Mat │ │ │ -0009fb60: 452c 2052 2c20 742c 206d 6173 6b3b 0a0a E, R, t, mask;.. │ │ │ -0009fb70: 2020 2020 7265 636f 7665 7250 6f73 6528 recoverPose( │ │ │ -0009fb80: 706f 696e 7473 312c 2070 6f69 6e74 7332 points1, points2 │ │ │ -0009fb90: 2c20 6361 6d65 7261 4d61 7472 6978 312c , cameraMatrix1, │ │ │ -0009fba0: 2064 6973 7443 6f65 6666 7331 2c20 6361 distCoeffs1, ca │ │ │ -0009fbb0: 6d65 7261 4d61 7472 6978 322c 2064 6973 meraMatrix2, dis │ │ │ -0009fbc0: 7443 6f65 6666 7332 2c20 452c 2052 2c20 tCoeffs2, E, R, │ │ │ -0009fbd0: 742c 206d 6173 6b29 3b0a 3c2f 636f 6465 t, mask);..
    Retur │ │ │ -0009fbf0: 6e73 3a3c 2f64 743e 0a3c 6464 3e61 7574 ns:
    .
    aut │ │ │ -0009fc00: 6f6d 6174 6963 616c 6c79 2067 656e 6572 omatically gener │ │ │ -0009fc10: 6174 6564 3c2f 6464 3e0a 3c2f 646c 3e0a ated
    .
    . │ │ │ -0009fc20: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e
    .
    .
  • .
  • ..recoverPose.
    .
    public │ │ │ -0009fda0: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ -0009fdb0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;int │ │ │ -0009fdd0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  recoverP │ │ │ -0009fe00: 6f73 653c 2f73 7061 6e3e 3c77 6272 3e3c ose< │ │ │ -0009fe10: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ -0009fe20: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ -0009fe70: 703b 706f 696e 7473 312c 0a20 3c61 2068 p;points1,. Mat& │ │ │ -0009fec0: 6e62 7370 3b70 6f69 6e74 7332 2c0a 203c nbsp;points2,. < │ │ │ -0009fed0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0009fee0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0009fef0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0009ff00: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ -0009ff20: 7472 6978 312c 0a20 3c61 2068 7265 663d trix1,. Mat  │ │ │ -0009ff70: 3b64 6973 7443 6f65 6666 7331 2c0a 203c ;distCoeffs1,. < │ │ │ -0009ff80: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -0009ff90: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -0009ffa0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -0009ffb0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ -0009ffd0: 7472 6978 322c 0a20 3c61 2068 7265 663d trix2,. Mat  │ │ │ -000a0020: 3b64 6973 7443 6f65 6666 7332 2c0a 203c ;distCoeffs2,. < │ │ │ -000a0030: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000a0040: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000a0050: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000a0060: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat E,. Mat& │ │ │ -000a00c0: 6e62 7370 3b52 2c0a 203c 6120 6872 6566 nbsp;R,. Mat&nbs │ │ │ -000a0110: 703b 742c 0a20 696e 7426 6e62 7370 3b6d p;t,. int m │ │ │ -000a0120: 6574 686f 642c 0a20 646f 7562 6c65 266e ethod,. double&n │ │ │ -000a0130: 6273 703b 7072 6f62 2c0a 2064 6f75 626c bsp;prob,. doubl │ │ │ -000a0140: 6526 6e62 7370 3b74 6872 6573 686f 6c64 e threshold │ │ │ -000a0150: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ -000a0160: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -000a0170: 223e 5265 636f 7665 7273 2074 6865 2072 ">Recovers the r │ │ │ -000a0180: 656c 6174 6976 6520 6361 6d65 7261 2072 elative camera r │ │ │ -000a0190: 6f74 6174 696f 6e20 616e 6420 7468 6520 otation and the │ │ │ -000a01a0: 7472 616e 736c 6174 696f 6e20 6672 6f6d translation from │ │ │ -000a01b0: 2063 6f72 7265 7370 6f6e 6469 6e67 2070 corresponding p │ │ │ -000a01c0: 6f69 6e74 7320 696e 2074 776f 2069 6d61 oints in two ima │ │ │ -000a01d0: 6765 7320 6672 6f6d 2074 776f 2064 6966 ges from two dif │ │ │ -000a01e0: 6665 7265 6e74 2063 616d 6572 6173 2c20 ferent cameras, │ │ │ -000a01f0: 7573 696e 6720 6368 6972 616c 6974 7920 using chirality │ │ │ -000a0200: 6368 6563 6b2e 2052 6574 7572 6e73 2074 check. Returns t │ │ │ -000a0210: 6865 206e 756d 6265 7220 6f66 0a69 6e6c he number of.inl │ │ │ -000a0220: 6965 7273 2074 6861 7420 7061 7373 2074 iers that pass t │ │ │ -000a0230: 6865 2063 6865 636b 2e3c 2f64 6976 3e0a he check.
    . │ │ │ -000a0240: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ -000a0260: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    points1 │ │ │ -000a0280: 202d 2041 7272 6179 206f 6620 4e20 3244 - Array of N 2D │ │ │ -000a0290: 2070 6f69 6e74 7320 6672 6f6d 2074 6865 points from the │ │ │ -000a02a0: 2066 6972 7374 2069 6d61 6765 2e20 5468 first image. Th │ │ │ -000a02b0: 6520 706f 696e 7420 636f 6f72 6469 6e61 e point coordina │ │ │ -000a02c0: 7465 7320 7368 6f75 6c64 2062 650a 666c tes should be.fl │ │ │ -000a02d0: 6f61 7469 6e67 2d70 6f69 6e74 2028 7369 oating-point (si │ │ │ -000a02e0: 6e67 6c65 206f 7220 646f 7562 6c65 2070 ngle or double p │ │ │ -000a02f0: 7265 6369 7369 6f6e 292e 3c2f 6464 3e0a recision).
    . │ │ │ -000a0300: 3c64 643e 3c63 6f64 653e 706f 696e 7473
    points │ │ │ -000a0310: 323c 2f63 6f64 653e 202d 2041 7272 6179 2 - Array │ │ │ -000a0320: 206f 6620 7468 6520 7365 636f 6e64 2069 of the second i │ │ │ -000a0330: 6d61 6765 2070 6f69 6e74 7320 6f66 2074 mage points of t │ │ │ -000a0340: 6865 2073 616d 6520 7369 7a65 2061 6e64 he same size and │ │ │ -000a0350: 2066 6f72 6d61 7420 6173 2070 6f69 6e74 format as point │ │ │ -000a0360: 7331 202e 3c2f 6464 3e0a 3c64 643e 3c63 s1 .
    .
    cameraMatrix │ │ │ -000a0380: 313c 2f63 6f64 653e 202d 2049 6e70 7574 1 - Input │ │ │ -000a0390: 2f6f 7574 7075 7420 6361 6d65 7261 206d /output camera m │ │ │ -000a03a0: 6174 7269 7820 666f 7220 7468 6520 6669 atrix for the fi │ │ │ -000a03b0: 7273 7420 6361 6d65 7261 2c20 7468 6520 rst camera, the │ │ │ -000a03c0: 7361 6d65 2061 7320 696e 0a52 4546 3a20 same as in.REF: │ │ │ -000a03d0: 6361 6c69 6272 6174 6543 616d 6572 612e calibrateCamera. │ │ │ -000a03e0: 2046 7572 7468 6572 6d6f 7265 2c20 666f Furthermore, fo │ │ │ -000a03f0: 7220 7468 6520 7374 6572 656f 2063 6173 r the stereo cas │ │ │ -000a0400: 652c 2061 6464 6974 696f 6e61 6c20 666c e, additional fl │ │ │ -000a0410: 6167 7320 6d61 7920 6265 2075 7365 642c ags may be used, │ │ │ -000a0420: 2073 6565 2062 656c 6f77 2e3c 2f64 643e see below.
    │ │ │ -000a0430: 0a3c 6464 3e3c 636f 6465 3e64 6973 7443 .
    distC │ │ │ -000a0440: 6f65 6666 7331 3c2f 636f 6465 3e20 2d20 oeffs1 - │ │ │ -000a0450: 496e 7075 742f 6f75 7470 7574 2076 6563 Input/output vec │ │ │ -000a0460: 746f 7220 6f66 2064 6973 746f 7274 696f tor of distortio │ │ │ -000a0470: 6e20 636f 6566 6669 6369 656e 7473 2c20 n coefficients, │ │ │ -000a0480: 7468 6520 7361 6d65 2061 7320 696e 0a52 the same as in.R │ │ │ -000a0490: 4546 3a20 6361 6c69 6272 6174 6543 616d EF: calibrateCam │ │ │ -000a04a0: 6572 612e 3c2f 6464 3e0a 3c64 643e 3c63 era.
    .
    cameraMatrix │ │ │ -000a04c0: 323c 2f63 6f64 653e 202d 2049 6e70 7574 2 - Input │ │ │ -000a04d0: 2f6f 7574 7075 7420 6361 6d65 7261 206d /output camera m │ │ │ -000a04e0: 6174 7269 7820 666f 7220 7468 6520 6669 atrix for the fi │ │ │ -000a04f0: 7273 7420 6361 6d65 7261 2c20 7468 6520 rst camera, the │ │ │ -000a0500: 7361 6d65 2061 7320 696e 0a52 4546 3a20 same as in.REF: │ │ │ -000a0510: 6361 6c69 6272 6174 6543 616d 6572 612e calibrateCamera. │ │ │ -000a0520: 2046 7572 7468 6572 6d6f 7265 2c20 666f Furthermore, fo │ │ │ -000a0530: 7220 7468 6520 7374 6572 656f 2063 6173 r the stereo cas │ │ │ -000a0540: 652c 2061 6464 6974 696f 6e61 6c20 666c e, additional fl │ │ │ -000a0550: 6167 7320 6d61 7920 6265 2075 7365 642c ags may be used, │ │ │ -000a0560: 2073 6565 2062 656c 6f77 2e3c 2f64 643e see below.
    │ │ │ -000a0570: 0a3c 6464 3e3c 636f 6465 3e64 6973 7443 .
    distC │ │ │ -000a0580: 6f65 6666 7332 3c2f 636f 6465 3e20 2d20 oeffs2 - │ │ │ -000a0590: 496e 7075 742f 6f75 7470 7574 2076 6563 Input/output vec │ │ │ -000a05a0: 746f 7220 6f66 2064 6973 746f 7274 696f tor of distortio │ │ │ -000a05b0: 6e20 636f 6566 6669 6369 656e 7473 2c20 n coefficients, │ │ │ -000a05c0: 7468 6520 7361 6d65 2061 7320 696e 0a52 the same as in.R │ │ │ -000a05d0: 4546 3a20 6361 6c69 6272 6174 6543 616d EF: calibrateCam │ │ │ -000a05e0: 6572 612e 3c2f 6464 3e0a 3c64 643e 3c63 era.
    .
    E - T │ │ │ -000a0600: 6865 206f 7574 7075 7420 6573 7365 6e74 he output essent │ │ │ -000a0610: 6961 6c20 6d61 7472 6978 2e3c 2f64 643e ial matrix.
    │ │ │ -000a0620: 0a3c 6464 3e3c 636f 6465 3e52 3c2f 636f .
    R - Output rot │ │ │ -000a0640: 6174 696f 6e20 6d61 7472 6978 2e20 546f ation matrix. To │ │ │ -000a0650: 6765 7468 6572 2077 6974 6820 7468 6520 gether with the │ │ │ -000a0660: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ -000a0670: 6f72 2c20 7468 6973 206d 6174 7269 7820 or, this matrix │ │ │ -000a0680: 6d61 6b65 7320 7570 2061 2074 7570 6c65 makes up a tuple │ │ │ -000a0690: 0a74 6861 7420 7065 7266 6f72 6d73 2061 .that performs a │ │ │ -000a06a0: 2063 6861 6e67 6520 6f66 2062 6173 6973 change of basis │ │ │ -000a06b0: 2066 726f 6d20 7468 6520 6669 7273 7420 from the first │ │ │ -000a06c0: 6361 6d65 7261 2773 2063 6f6f 7264 696e camera's coordin │ │ │ -000a06d0: 6174 6520 7379 7374 656d 2074 6f20 7468 ate system to th │ │ │ -000a06e0: 6520 7365 636f 6e64 2063 616d 6572 6127 e second camera' │ │ │ -000a06f0: 730a 636f 6f72 6469 6e61 7465 2073 7973 s.coordinate sys │ │ │ -000a0700: 7465 6d2e 204e 6f74 6520 7468 6174 2c20 tem. Note that, │ │ │ -000a0710: 696e 2067 656e 6572 616c 2c20 7420 6361 in general, t ca │ │ │ -000a0720: 6e20 6e6f 7420 6265 2075 7365 6420 666f n not be used fo │ │ │ -000a0730: 7220 7468 6973 2074 7570 6c65 2c20 7365 r this tuple, se │ │ │ -000a0740: 6520 7468 6520 7061 7261 6d65 7465 720a e the parameter. │ │ │ -000a0750: 6465 7363 7269 6265 6420 6265 6c6f 772e described below. │ │ │ -000a0760: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000a0770: 743c 2f63 6f64 653e 202d 204f 7574 7075 t - Outpu │ │ │ -000a0780: 7420 7472 616e 736c 6174 696f 6e20 7665 t translation ve │ │ │ -000a0790: 6374 6f72 2e20 5468 6973 2076 6563 746f ctor. This vecto │ │ │ -000a07a0: 7220 6973 206f 6274 6169 6e65 6420 6279 r is obtained by │ │ │ -000a07b0: 2052 4546 3a20 6465 636f 6d70 6f73 6545 REF: decomposeE │ │ │ -000a07c0: 7373 656e 7469 616c 4d61 7420 616e 640a ssentialMat and. │ │ │ -000a07d0: 7468 6572 6566 6f72 6520 6973 206f 6e6c therefore is onl │ │ │ -000a07e0: 7920 6b6e 6f77 6e20 7570 2074 6f20 7363 y known up to sc │ │ │ -000a07f0: 616c 652c 2069 2e65 2e20 7420 6973 2074 ale, i.e. t is t │ │ │ -000a0800: 6865 2064 6972 6563 7469 6f6e 206f 6620 he direction of │ │ │ -000a0810: 7468 6520 7472 616e 736c 6174 696f 6e20 the translation │ │ │ -000a0820: 7665 6374 6f72 2061 6e64 2068 6173 2075 vector and has u │ │ │ -000a0830: 6e69 740a 6c65 6e67 7468 2e3c 2f64 643e nit.length.
    │ │ │ -000a0840: 0a3c 6464 3e3c 636f 6465 3e6d 6574 686f .
    metho │ │ │ -000a0850: 643c 2f63 6f64 653e 202d 204d 6574 686f d - Metho │ │ │ -000a0860: 6420 666f 7220 636f 6d70 7574 696e 6720 d for computing │ │ │ -000a0870: 616e 2065 7373 656e 7469 616c 206d 6174 an essential mat │ │ │ -000a0880: 7269 782e 0a3c 756c 3e0a 2020 3c6c 693e rix..
      .
    • │ │ │ -000a0890: 0a20 2020 5245 463a 2052 414e 5341 4320 . REF: RANSAC │ │ │ -000a08a0: 666f 7220 7468 6520 5241 4e53 4143 2061 for the RANSAC a │ │ │ -000a08b0: 6c67 6f72 6974 686d 2e0a 2020 3c2f 6c69 lgorithm..
    • .
    • . REF: │ │ │ -000a08d0: 204c 4d45 4453 2066 6f72 2074 6865 204c LMEDS for the L │ │ │ -000a08e0: 4d65 6453 2061 6c67 6f72 6974 686d 2e0a MedS algorithm.. │ │ │ -000a08f0: 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64
    • .
    .
    pro │ │ │ -000a0910: 623c 2f63 6f64 653e 202d 2050 6172 616d b - Param │ │ │ -000a0920: 6574 6572 2075 7365 6420 666f 7220 7468 eter used for th │ │ │ -000a0930: 6520 5241 4e53 4143 206f 7220 4c4d 6564 e RANSAC or LMed │ │ │ -000a0940: 5320 6d65 7468 6f64 7320 6f6e 6c79 2e20 S methods only. │ │ │ -000a0950: 4974 2073 7065 6369 6669 6573 2061 2064 It specifies a d │ │ │ -000a0960: 6573 6972 6162 6c65 206c 6576 656c 206f esirable level o │ │ │ -000a0970: 660a 636f 6e66 6964 656e 6365 2028 7072 f.confidence (pr │ │ │ -000a0980: 6f62 6162 696c 6974 7929 2074 6861 7420 obability) that │ │ │ -000a0990: 7468 6520 6573 7469 6d61 7465 6420 6d61 the estimated ma │ │ │ -000a09a0: 7472 6978 2069 7320 636f 7272 6563 742e trix is correct. │ │ │ -000a09b0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000a09c0: 7468 7265 7368 6f6c 643c 2f63 6f64 653e threshold │ │ │ -000a09d0: 202d 2050 6172 616d 6574 6572 2075 7365 - Parameter use │ │ │ -000a09e0: 6420 666f 7220 5241 4e53 4143 2e20 4974 d for RANSAC. It │ │ │ -000a09f0: 2069 7320 7468 6520 6d61 7869 6d75 6d20 is the maximum │ │ │ -000a0a00: 6469 7374 616e 6365 2066 726f 6d20 6120 distance from a │ │ │ -000a0a10: 706f 696e 7420 746f 2061 6e20 6570 6970 point to an epip │ │ │ -000a0a20: 6f6c 6172 0a6c 696e 6520 696e 2070 6978 olar.line in pix │ │ │ -000a0a30: 656c 732c 2062 6579 6f6e 6420 7768 6963 els, beyond whic │ │ │ -000a0a40: 6820 7468 6520 706f 696e 7420 6973 2063 h the point is c │ │ │ -000a0a50: 6f6e 7369 6465 7265 6420 616e 206f 7574 onsidered an out │ │ │ -000a0a60: 6c69 6572 2061 6e64 2069 7320 6e6f 7420 lier and is not │ │ │ -000a0a70: 7573 6564 2066 6f72 2063 6f6d 7075 7469 used for computi │ │ │ -000a0a80: 6e67 2074 6865 0a66 696e 616c 2066 756e ng the.final fun │ │ │ -000a0a90: 6461 6d65 6e74 616c 206d 6174 7269 782e damental matrix. │ │ │ -000a0aa0: 2049 7420 6361 6e20 6265 2073 6574 2074 It can be set t │ │ │ -000a0ab0: 6f20 736f 6d65 7468 696e 6720 6c69 6b65 o something like │ │ │ -000a0ac0: 2031 2d33 2c20 6465 7065 6e64 696e 6720 1-3, depending │ │ │ -000a0ad0: 6f6e 2074 6865 2061 6363 7572 6163 7920 on the accuracy │ │ │ -000a0ae0: 6f66 2074 6865 0a70 6f69 6e74 206c 6f63 of the.point loc │ │ │ -000a0af0: 616c 697a 6174 696f 6e2c 2069 6d61 6765 alization, image │ │ │ -000a0b00: 2072 6573 6f6c 7574 696f 6e2c 2061 6e64 resolution, and │ │ │ -000a0b10: 2074 6865 2069 6d61 6765 206e 6f69 7365 the image noise │ │ │ -000a0b20: 2e0a 696e 6c69 6572 7320 696e 2070 6f69 ..inliers in poi │ │ │ -000a0b30: 6e74 7331 2061 6e64 2070 6f69 6e74 7332 nts1 and points2 │ │ │ -000a0b40: 2066 6f72 2074 6865 2067 6976 656e 2065 for the given e │ │ │ -000a0b50: 7373 656e 7469 616c 206d 6174 7269 7820 ssential matrix │ │ │ -000a0b60: 452e 204f 6e6c 7920 7468 6573 6520 696e E. Only these in │ │ │ -000a0b70: 6c69 6572 7320 7769 6c6c 2062 6520 7573 liers will be us │ │ │ -000a0b80: 6564 2074 6f0a 7265 636f 7665 7220 706f ed to.recover po │ │ │ -000a0b90: 7365 2e20 496e 2074 6865 206f 7574 7075 se. In the outpu │ │ │ -000a0ba0: 7420 6d61 736b 206f 6e6c 7920 696e 6c69 t mask only inli │ │ │ -000a0bb0: 6572 7320 7768 6963 6820 7061 7373 2074 ers which pass t │ │ │ -000a0bc0: 6865 2063 6869 7261 6c69 7479 2063 6865 he chirality che │ │ │ -000a0bd0: 636b 2e0a 0a54 6869 7320 6675 6e63 7469 ck...This functi │ │ │ -000a0be0: 6f6e 2064 6563 6f6d 706f 7365 7320 616e on decomposes an │ │ │ -000a0bf0: 2065 7373 656e 7469 616c 206d 6174 7269 essential matri │ │ │ -000a0c00: 7820 7573 696e 6720 5245 463a 2064 6563 x using REF: dec │ │ │ -000a0c10: 6f6d 706f 7365 4573 7365 6e74 6961 6c4d omposeEssentialM │ │ │ -000a0c20: 6174 2061 6e64 2074 6865 6e20 7665 7269 at and then veri │ │ │ -000a0c30: 6669 6573 0a70 6f73 7369 626c 6520 706f fies.possible po │ │ │ -000a0c40: 7365 2068 7970 6f74 6865 7365 7320 6279 se hypotheses by │ │ │ -000a0c50: 2064 6f69 6e67 2063 6869 7261 6c69 7479 doing chirality │ │ │ -000a0c60: 2063 6865 636b 2e20 5468 6520 6368 6972 check. The chir │ │ │ -000a0c70: 616c 6974 7920 6368 6563 6b20 6d65 616e ality check mean │ │ │ -000a0c80: 7320 7468 6174 2074 6865 0a74 7269 616e s that the.trian │ │ │ -000a0c90: 6775 6c61 7465 6420 3344 2070 6f69 6e74 gulated 3D point │ │ │ -000a0ca0: 7320 7368 6f75 6c64 2068 6176 6520 706f s should have po │ │ │ -000a0cb0: 7369 7469 7665 2064 6570 7468 2e20 536f sitive depth. So │ │ │ -000a0cc0: 6d65 2064 6574 6169 6c73 2063 616e 2062 me details can b │ │ │ -000a0cd0: 6520 666f 756e 6420 696e 2043 4954 453a e found in CITE: │ │ │ -000a0ce0: 204e 6973 7465 7230 332e 0a0a 5468 6973 Nister03...This │ │ │ -000a0cf0: 2066 756e 6374 696f 6e20 6361 6e20 6265 function can be │ │ │ -000a0d00: 2075 7365 6420 746f 2070 726f 6365 7373 used to process │ │ │ -000a0d10: 2074 6865 206f 7574 7075 7420 4520 616e the output E an │ │ │ -000a0d20: 6420 6d61 736b 2066 726f 6d20 5245 463a d mask from REF: │ │ │ -000a0d30: 2066 696e 6445 7373 656e 7469 616c 4d61 findEssentialMa │ │ │ -000a0d40: 742e 2049 6e20 7468 6973 0a73 6365 6e61 t. In this.scena │ │ │ -000a0d50: 7269 6f2c 2070 6f69 6e74 7331 2061 6e64 rio, points1 and │ │ │ -000a0d60: 2070 6f69 6e74 7332 2061 7265 2074 6865 points2 are the │ │ │ -000a0d70: 2073 616d 6520 696e 7075 7420 666f 7220 same input for │ │ │ -000a0d80: 6669 6e64 4573 7365 6e74 6961 6c4d 6174 findEssentialMat │ │ │ -000a0d90: 2e3a 0a3c 636f 6465 3e0a 2020 2020 2f2f .:.. // │ │ │ -000a0da0: 2045 7861 6d70 6c65 2e20 4573 7469 6d61 Example. Estima │ │ │ -000a0db0: 7469 6f6e 206f 6620 6675 6e64 616d 656e tion of fundamen │ │ │ -000a0dc0: 7461 6c20 6d61 7472 6978 2075 7369 6e67 tal matrix using │ │ │ -000a0dd0: 2074 6865 2052 414e 5341 4320 616c 676f the RANSAC algo │ │ │ -000a0de0: 7269 7468 6d0a 2020 2020 696e 7420 706f rithm. int po │ │ │ -000a0df0: 696e 745f 636f 756e 7420 3d20 3130 303b int_count = 100; │ │ │ -000a0e00: 0a20 2020 2076 6563 746f 7226 6c74 3b50 . vector<P │ │ │ -000a0e10: 6f69 6e74 3266 2667 743b 2070 6f69 6e74 oint2f> point │ │ │ -000a0e20: 7331 2870 6f69 6e74 5f63 6f75 6e74 293b s1(point_count); │ │ │ -000a0e30: 0a20 2020 2076 6563 746f 7226 6c74 3b50 . vector<P │ │ │ -000a0e40: 6f69 6e74 3266 2667 743b 2070 6f69 6e74 oint2f> point │ │ │ -000a0e50: 7332 2870 6f69 6e74 5f63 6f75 6e74 293b s2(point_count); │ │ │ -000a0e60: 0a0a 2020 2020 2f2f 2069 6e69 7469 616c .. // initial │ │ │ -000a0e70: 697a 6520 7468 6520 706f 696e 7473 2068 ize the points h │ │ │ -000a0e80: 6572 6520 2e2e 2e0a 2020 2020 666f 7228 ere .... for( │ │ │ -000a0e90: 2069 6e74 2069 203d 2030 3b20 6920 266c int i = 0; i &l │ │ │ -000a0ea0: 743b 2070 6f69 6e74 5f63 6f75 6e74 3b20 t; point_count; │ │ │ -000a0eb0: 692b 2b20 290a 2020 2020 7b0a 2020 2020 i++ ). {. │ │ │ -000a0ec0: 2020 2020 706f 696e 7473 315b 695d 203d points1[i] = │ │ │ -000a0ed0: 202e 2e2e 3b0a 2020 2020 2020 2020 706f ...;. po │ │ │ -000a0ee0: 696e 7473 325b 695d 203d 202e 2e2e 3b0a ints2[i] = ...;. │ │ │ -000a0ef0: 2020 2020 7d0a 0a20 2020 202f 2f20 496e }.. // In │ │ │ -000a0f00: 7075 743a 2063 616d 6572 6120 6361 6c69 put: camera cali │ │ │ -000a0f10: 6272 6174 696f 6e20 6f66 2062 6f74 6820 bration of both │ │ │ -000a0f20: 6361 6d65 7261 732c 2066 6f72 2065 7861 cameras, for exa │ │ │ -000a0f30: 6d70 6c65 2075 7369 6e67 2069 6e74 7269 mple using intri │ │ │ -000a0f40: 6e73 6963 2063 6865 7373 626f 6172 6420 nsic chessboard │ │ │ -000a0f50: 6361 6c69 6272 6174 696f 6e2e 0a20 2020 calibration.. │ │ │ -000a0f60: 204d 6174 2063 616d 6572 614d 6174 7269 Mat cameraMatri │ │ │ -000a0f70: 7831 2c20 6469 7374 436f 6566 6673 312c x1, distCoeffs1, │ │ │ -000a0f80: 2063 616d 6572 614d 6174 7269 7832 2c20 cameraMatrix2, │ │ │ -000a0f90: 6469 7374 436f 6566 6673 323b 0a0a 2020 distCoeffs2;.. │ │ │ -000a0fa0: 2020 2f2f 204f 7574 7075 743a 2045 7373 // Output: Ess │ │ │ -000a0fb0: 656e 7469 616c 206d 6174 7269 782c 2072 ential matrix, r │ │ │ -000a0fc0: 656c 6174 6976 6520 726f 7461 7469 6f6e elative rotation │ │ │ -000a0fd0: 2061 6e64 2072 656c 6174 6976 6520 7472 and relative tr │ │ │ -000a0fe0: 616e 736c 6174 696f 6e2e 0a20 2020 204d anslation.. M │ │ │ -000a0ff0: 6174 2045 2c20 522c 2074 2c20 6d61 736b at E, R, t, mask │ │ │ -000a1000: 3b0a 0a20 2020 2072 6563 6f76 6572 506f ;.. recoverPo │ │ │ -000a1010: 7365 2870 6f69 6e74 7331 2c20 706f 696e se(points1, poin │ │ │ -000a1020: 7473 322c 2063 616d 6572 614d 6174 7269 ts2, cameraMatri │ │ │ -000a1030: 7831 2c20 6469 7374 436f 6566 6673 312c x1, distCoeffs1, │ │ │ -000a1040: 2063 616d 6572 614d 6174 7269 7832 2c20 cameraMatrix2, │ │ │ -000a1050: 6469 7374 436f 6566 6673 322c 2045 2c20 distCoeffs2, E, │ │ │ -000a1060: 522c 2074 2c20 6d61 736b 293b 0a3c 2f63 R, t, mask);.
    .
    Re │ │ │ -000a1080: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ -000a1090: 6175 746f 6d61 7469 6361 6c6c 7920 6765 automatically ge │ │ │ -000a10a0: 6e65 7261 7465 643c 2f64 643e 0a3c 2f64 nerated
    ....
  • .
  • . │ │ │ -000a10d0: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    re │ │ │ -000a11c0: 636f 7665 7250 6f73 653c 2f68 333e 0a3c coverPose

    .< │ │ │ -000a11d0: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ -000a11e0: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ -000a11f0: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ -000a1200: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ -000a1230: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ -000a1240: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ -000a1250: 726e 2d74 7970 6522 3e69 6e74 3c2f 7370 rn-type">int recoverPose< │ │ │ -000a1290: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat po │ │ │ -000a1300: 696e 7473 312c 0a20 3c61 2068 7265 663d ints1,. Mat  │ │ │ -000a1350: 3b70 6f69 6e74 7332 2c0a 203c 6120 6872 ;points2,. Mat&n │ │ │ -000a13a0: 6273 703b 6361 6d65 7261 4d61 7472 6978 bsp;cameraMatrix │ │ │ -000a13b0: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ -000a13f0: 4d61 743c 2f61 3e26 6e62 7370 3b64 6973 Mat dis │ │ │ -000a1400: 7443 6f65 6666 7331 2c0a 203c 6120 6872 tCoeffs1,. Mat&n │ │ │ -000a1450: 6273 703b 6361 6d65 7261 4d61 7472 6978 bsp;cameraMatrix │ │ │ -000a1460: 322c 0a20 3c61 2068 7265 663d 222e 2e2f 2,. │ │ │ -000a14a0: 4d61 743c 2f61 3e26 6e62 7370 3b64 6973 Mat dis │ │ │ -000a14b0: 7443 6f65 6666 7332 2c0a 203c 6120 6872 tCoeffs2,. Mat&n │ │ │ -000a1500: 6273 703b 452c 0a20 3c61 2068 7265 663d bsp;E,. Mat  │ │ │ -000a1550: 3b52 2c0a 203c 6120 6872 6566 3d22 2e2e ;R,. Mat t, │ │ │ -000a15a0: 0a20 696e 7426 6e62 7370 3b6d 6574 686f . int metho │ │ │ -000a15b0: 642c 0a20 646f 7562 6c65 266e 6273 703b d,. double  │ │ │ -000a15c0: 7072 6f62 293c 2f73 7061 6e3e 3c2f 6469 prob).
    Recovers t │ │ │ -000a15f0: 6865 2072 656c 6174 6976 6520 6361 6d65 he relative came │ │ │ -000a1600: 7261 2072 6f74 6174 696f 6e20 616e 6420 ra rotation and │ │ │ -000a1610: 7468 6520 7472 616e 736c 6174 696f 6e20 the translation │ │ │ -000a1620: 6672 6f6d 2063 6f72 7265 7370 6f6e 6469 from correspondi │ │ │ -000a1630: 6e67 2070 6f69 6e74 7320 696e 2074 776f ng points in two │ │ │ -000a1640: 2069 6d61 6765 7320 6672 6f6d 2074 776f images from two │ │ │ -000a1650: 2064 6966 6665 7265 6e74 2063 616d 6572 different camer │ │ │ -000a1660: 6173 2c20 7573 696e 6720 6368 6972 616c as, using chiral │ │ │ -000a1670: 6974 7920 6368 6563 6b2e 2052 6574 7572 ity check. Retur │ │ │ -000a1680: 6e73 2074 6865 206e 756d 6265 7220 6f66 ns the number of │ │ │ -000a1690: 0a69 6e6c 6965 7273 2074 6861 7420 7061 .inliers that pa │ │ │ -000a16a0: 7373 2074 6865 2063 6865 636b 2e3c 2f64 ss the check..
    .
    Param │ │ │ -000a16d0: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ -000a16e0: 3c63 6f64 653e 706f 696e 7473 313c 2f63 points1 - Array of │ │ │ -000a1700: 4e20 3244 2070 6f69 6e74 7320 6672 6f6d N 2D points from │ │ │ -000a1710: 2074 6865 2066 6972 7374 2069 6d61 6765 the first image │ │ │ -000a1720: 2e20 5468 6520 706f 696e 7420 636f 6f72 . The point coor │ │ │ -000a1730: 6469 6e61 7465 7320 7368 6f75 6c64 2062 dinates should b │ │ │ -000a1740: 650a 666c 6f61 7469 6e67 2d70 6f69 6e74 e.floating-point │ │ │ -000a1750: 2028 7369 6e67 6c65 206f 7220 646f 7562 (single or doub │ │ │ -000a1760: 6c65 2070 7265 6369 7369 6f6e 292e 3c2f le precision)..
    po │ │ │ -000a1780: 696e 7473 323c 2f63 6f64 653e 202d 2041 ints2 - A │ │ │ -000a1790: 7272 6179 206f 6620 7468 6520 7365 636f rray of the seco │ │ │ -000a17a0: 6e64 2069 6d61 6765 2070 6f69 6e74 7320 nd image points │ │ │ -000a17b0: 6f66 2074 6865 2073 616d 6520 7369 7a65 of the same size │ │ │ -000a17c0: 2061 6e64 2066 6f72 6d61 7420 6173 2070 and format as p │ │ │ -000a17d0: 6f69 6e74 7331 202e 3c2f 6464 3e0a 3c64 oints1 .
    .cameraMa │ │ │ -000a17f0: 7472 6978 313c 2f63 6f64 653e 202d 2049 trix1 - I │ │ │ -000a1800: 6e70 7574 2f6f 7574 7075 7420 6361 6d65 nput/output came │ │ │ -000a1810: 7261 206d 6174 7269 7820 666f 7220 7468 ra matrix for th │ │ │ -000a1820: 6520 6669 7273 7420 6361 6d65 7261 2c20 e first camera, │ │ │ -000a1830: 7468 6520 7361 6d65 2061 7320 696e 0a52 the same as in.R │ │ │ -000a1840: 4546 3a20 6361 6c69 6272 6174 6543 616d EF: calibrateCam │ │ │ -000a1850: 6572 612e 2046 7572 7468 6572 6d6f 7265 era. Furthermore │ │ │ -000a1860: 2c20 666f 7220 7468 6520 7374 6572 656f , for the stereo │ │ │ -000a1870: 2063 6173 652c 2061 6464 6974 696f 6e61 case, additiona │ │ │ -000a1880: 6c20 666c 6167 7320 6d61 7920 6265 2075 l flags may be u │ │ │ -000a1890: 7365 642c 2073 6565 2062 656c 6f77 2e3c sed, see below.< │ │ │ -000a18a0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -000a18b0: 6973 7443 6f65 6666 7331 3c2f 636f 6465 istCoeffs1 - Input/output │ │ │ -000a18d0: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ -000a18e0: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ -000a18f0: 7473 2c20 7468 6520 7361 6d65 2061 7320 ts, the same as │ │ │ -000a1900: 696e 0a52 4546 3a20 6361 6c69 6272 6174 in.REF: calibrat │ │ │ -000a1910: 6543 616d 6572 612e 3c2f 6464 3e0a 3c64 eCamera.
    .cameraMa │ │ │ -000a1930: 7472 6978 323c 2f63 6f64 653e 202d 2049 trix2 - I │ │ │ -000a1940: 6e70 7574 2f6f 7574 7075 7420 6361 6d65 nput/output came │ │ │ -000a1950: 7261 206d 6174 7269 7820 666f 7220 7468 ra matrix for th │ │ │ -000a1960: 6520 6669 7273 7420 6361 6d65 7261 2c20 e first camera, │ │ │ -000a1970: 7468 6520 7361 6d65 2061 7320 696e 0a52 the same as in.R │ │ │ -000a1980: 4546 3a20 6361 6c69 6272 6174 6543 616d EF: calibrateCam │ │ │ -000a1990: 6572 612e 2046 7572 7468 6572 6d6f 7265 era. Furthermore │ │ │ -000a19a0: 2c20 666f 7220 7468 6520 7374 6572 656f , for the stereo │ │ │ -000a19b0: 2063 6173 652c 2061 6464 6974 696f 6e61 case, additiona │ │ │ -000a19c0: 6c20 666c 6167 7320 6d61 7920 6265 2075 l flags may be u │ │ │ -000a19d0: 7365 642c 2073 6565 2062 656c 6f77 2e3c sed, see below.< │ │ │ -000a19e0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -000a19f0: 6973 7443 6f65 6666 7332 3c2f 636f 6465 istCoeffs2 - Input/output │ │ │ -000a1a10: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ -000a1a20: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ -000a1a30: 7473 2c20 7468 6520 7361 6d65 2061 7320 ts, the same as │ │ │ -000a1a40: 696e 0a52 4546 3a20 6361 6c69 6272 6174 in.REF: calibrat │ │ │ -000a1a50: 6543 616d 6572 612e 3c2f 6464 3e0a 3c64 eCamera.
    .E │ │ │ -000a1a70: 202d 2054 6865 206f 7574 7075 7420 6573 - The output es │ │ │ -000a1a80: 7365 6e74 6961 6c20 6d61 7472 6978 2e3c sential matrix.< │ │ │ -000a1a90: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e52 /dd>.
    R │ │ │ -000a1aa0: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ -000a1ab0: 2072 6f74 6174 696f 6e20 6d61 7472 6978 rotation matrix │ │ │ -000a1ac0: 2e20 546f 6765 7468 6572 2077 6974 6820 . Together with │ │ │ -000a1ad0: 7468 6520 7472 616e 736c 6174 696f 6e20 the translation │ │ │ -000a1ae0: 7665 6374 6f72 2c20 7468 6973 206d 6174 vector, this mat │ │ │ -000a1af0: 7269 7820 6d61 6b65 7320 7570 2061 2074 rix makes up a t │ │ │ -000a1b00: 7570 6c65 0a74 6861 7420 7065 7266 6f72 uple.that perfor │ │ │ -000a1b10: 6d73 2061 2063 6861 6e67 6520 6f66 2062 ms a change of b │ │ │ -000a1b20: 6173 6973 2066 726f 6d20 7468 6520 6669 asis from the fi │ │ │ -000a1b30: 7273 7420 6361 6d65 7261 2773 2063 6f6f rst camera's coo │ │ │ -000a1b40: 7264 696e 6174 6520 7379 7374 656d 2074 rdinate system t │ │ │ -000a1b50: 6f20 7468 6520 7365 636f 6e64 2063 616d o the second cam │ │ │ -000a1b60: 6572 6127 730a 636f 6f72 6469 6e61 7465 era's.coordinate │ │ │ -000a1b70: 2073 7973 7465 6d2e 204e 6f74 6520 7468 system. Note th │ │ │ -000a1b80: 6174 2c20 696e 2067 656e 6572 616c 2c20 at, in general, │ │ │ -000a1b90: 7420 6361 6e20 6e6f 7420 6265 2075 7365 t can not be use │ │ │ -000a1ba0: 6420 666f 7220 7468 6973 2074 7570 6c65 d for this tuple │ │ │ -000a1bb0: 2c20 7365 6520 7468 6520 7061 7261 6d65 , see the parame │ │ │ -000a1bc0: 7465 720a 6465 7363 7269 6265 6420 6265 ter.described be │ │ │ -000a1bd0: 6c6f 772e 3c2f 6464 3e0a 3c64 643e 3c63 low.
    .
    t - O │ │ │ -000a1bf0: 7574 7075 7420 7472 616e 736c 6174 696f utput translatio │ │ │ -000a1c00: 6e20 7665 6374 6f72 2e20 5468 6973 2076 n vector. This v │ │ │ -000a1c10: 6563 746f 7220 6973 206f 6274 6169 6e65 ector is obtaine │ │ │ -000a1c20: 6420 6279 2052 4546 3a20 6465 636f 6d70 d by REF: decomp │ │ │ -000a1c30: 6f73 6545 7373 656e 7469 616c 4d61 7420 oseEssentialMat │ │ │ -000a1c40: 616e 640a 7468 6572 6566 6f72 6520 6973 and.therefore is │ │ │ -000a1c50: 206f 6e6c 7920 6b6e 6f77 6e20 7570 2074 only known up t │ │ │ -000a1c60: 6f20 7363 616c 652c 2069 2e65 2e20 7420 o scale, i.e. t │ │ │ -000a1c70: 6973 2074 6865 2064 6972 6563 7469 6f6e is the direction │ │ │ -000a1c80: 206f 6620 7468 6520 7472 616e 736c 6174 of the translat │ │ │ -000a1c90: 696f 6e20 7665 6374 6f72 2061 6e64 2068 ion vector and h │ │ │ -000a1ca0: 6173 2075 6e69 740a 6c65 6e67 7468 2e3c as unit.length.< │ │ │ -000a1cb0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e6d /dd>.
    m │ │ │ -000a1cc0: 6574 686f 643c 2f63 6f64 653e 202d 204d ethod - M │ │ │ -000a1cd0: 6574 686f 6420 666f 7220 636f 6d70 7574 ethod for comput │ │ │ -000a1ce0: 696e 6720 616e 2065 7373 656e 7469 616c ing an essential │ │ │ -000a1cf0: 206d 6174 7269 782e 0a3c 756c 3e0a 2020 matrix..
      . │ │ │ -000a1d00: 3c6c 693e 0a20 2020 5245 463a 2052 414e
    • . REF: RAN │ │ │ -000a1d10: 5341 4320 666f 7220 7468 6520 5241 4e53 SAC for the RANS │ │ │ -000a1d20: 4143 2061 6c67 6f72 6974 686d 2e0a 2020 AC algorithm.. │ │ │ -000a1d30: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020
    • .
    • . │ │ │ -000a1d40: 5245 463a 204c 4d45 4453 2066 6f72 2074 REF: LMEDS for t │ │ │ -000a1d50: 6865 204c 4d65 6453 2061 6c67 6f72 6974 he LMedS algorit │ │ │ -000a1d60: 686d 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c hm..
    • .
    .
    prob - P │ │ │ -000a1d90: 6172 616d 6574 6572 2075 7365 6420 666f arameter used fo │ │ │ -000a1da0: 7220 7468 6520 5241 4e53 4143 206f 7220 r the RANSAC or │ │ │ -000a1db0: 4c4d 6564 5320 6d65 7468 6f64 7320 6f6e LMedS methods on │ │ │ -000a1dc0: 6c79 2e20 4974 2073 7065 6369 6669 6573 ly. It specifies │ │ │ -000a1dd0: 2061 2064 6573 6972 6162 6c65 206c 6576 a desirable lev │ │ │ -000a1de0: 656c 206f 660a 636f 6e66 6964 656e 6365 el of.confidence │ │ │ -000a1df0: 2028 7072 6f62 6162 696c 6974 7929 2074 (probability) t │ │ │ -000a1e00: 6861 7420 7468 6520 6573 7469 6d61 7465 hat the estimate │ │ │ -000a1e10: 6420 6d61 7472 6978 2069 7320 636f 7272 d matrix is corr │ │ │ -000a1e20: 6563 742e 0a6c 696e 6520 696e 2070 6978 ect..line in pix │ │ │ -000a1e30: 656c 732c 2062 6579 6f6e 6420 7768 6963 els, beyond whic │ │ │ -000a1e40: 6820 7468 6520 706f 696e 7420 6973 2063 h the point is c │ │ │ -000a1e50: 6f6e 7369 6465 7265 6420 616e 206f 7574 onsidered an out │ │ │ -000a1e60: 6c69 6572 2061 6e64 2069 7320 6e6f 7420 lier and is not │ │ │ -000a1e70: 7573 6564 2066 6f72 2063 6f6d 7075 7469 used for computi │ │ │ -000a1e80: 6e67 2074 6865 0a66 696e 616c 2066 756e ng the.final fun │ │ │ -000a1e90: 6461 6d65 6e74 616c 206d 6174 7269 782e damental matrix. │ │ │ -000a1ea0: 2049 7420 6361 6e20 6265 2073 6574 2074 It can be set t │ │ │ -000a1eb0: 6f20 736f 6d65 7468 696e 6720 6c69 6b65 o something like │ │ │ -000a1ec0: 2031 2d33 2c20 6465 7065 6e64 696e 6720 1-3, depending │ │ │ -000a1ed0: 6f6e 2074 6865 2061 6363 7572 6163 7920 on the accuracy │ │ │ -000a1ee0: 6f66 2074 6865 0a70 6f69 6e74 206c 6f63 of the.point loc │ │ │ -000a1ef0: 616c 697a 6174 696f 6e2c 2069 6d61 6765 alization, image │ │ │ -000a1f00: 2072 6573 6f6c 7574 696f 6e2c 2061 6e64 resolution, and │ │ │ -000a1f10: 2074 6865 2069 6d61 6765 206e 6f69 7365 the image noise │ │ │ -000a1f20: 2e0a 696e 6c69 6572 7320 696e 2070 6f69 ..inliers in poi │ │ │ -000a1f30: 6e74 7331 2061 6e64 2070 6f69 6e74 7332 nts1 and points2 │ │ │ -000a1f40: 2066 6f72 2074 6865 2067 6976 656e 2065 for the given e │ │ │ -000a1f50: 7373 656e 7469 616c 206d 6174 7269 7820 ssential matrix │ │ │ -000a1f60: 452e 204f 6e6c 7920 7468 6573 6520 696e E. Only these in │ │ │ -000a1f70: 6c69 6572 7320 7769 6c6c 2062 6520 7573 liers will be us │ │ │ -000a1f80: 6564 2074 6f0a 7265 636f 7665 7220 706f ed to.recover po │ │ │ -000a1f90: 7365 2e20 496e 2074 6865 206f 7574 7075 se. In the outpu │ │ │ -000a1fa0: 7420 6d61 736b 206f 6e6c 7920 696e 6c69 t mask only inli │ │ │ -000a1fb0: 6572 7320 7768 6963 6820 7061 7373 2074 ers which pass t │ │ │ -000a1fc0: 6865 2063 6869 7261 6c69 7479 2063 6865 he chirality che │ │ │ -000a1fd0: 636b 2e0a 0a54 6869 7320 6675 6e63 7469 ck...This functi │ │ │ -000a1fe0: 6f6e 2064 6563 6f6d 706f 7365 7320 616e on decomposes an │ │ │ -000a1ff0: 2065 7373 656e 7469 616c 206d 6174 7269 essential matri │ │ │ -000a2000: 7820 7573 696e 6720 5245 463a 2064 6563 x using REF: dec │ │ │ -000a2010: 6f6d 706f 7365 4573 7365 6e74 6961 6c4d omposeEssentialM │ │ │ -000a2020: 6174 2061 6e64 2074 6865 6e20 7665 7269 at and then veri │ │ │ -000a2030: 6669 6573 0a70 6f73 7369 626c 6520 706f fies.possible po │ │ │ -000a2040: 7365 2068 7970 6f74 6865 7365 7320 6279 se hypotheses by │ │ │ -000a2050: 2064 6f69 6e67 2063 6869 7261 6c69 7479 doing chirality │ │ │ -000a2060: 2063 6865 636b 2e20 5468 6520 6368 6972 check. The chir │ │ │ -000a2070: 616c 6974 7920 6368 6563 6b20 6d65 616e ality check mean │ │ │ -000a2080: 7320 7468 6174 2074 6865 0a74 7269 616e s that the.trian │ │ │ -000a2090: 6775 6c61 7465 6420 3344 2070 6f69 6e74 gulated 3D point │ │ │ -000a20a0: 7320 7368 6f75 6c64 2068 6176 6520 706f s should have po │ │ │ -000a20b0: 7369 7469 7665 2064 6570 7468 2e20 536f sitive depth. So │ │ │ -000a20c0: 6d65 2064 6574 6169 6c73 2063 616e 2062 me details can b │ │ │ -000a20d0: 6520 666f 756e 6420 696e 2043 4954 453a e found in CITE: │ │ │ -000a20e0: 204e 6973 7465 7230 332e 0a0a 5468 6973 Nister03...This │ │ │ -000a20f0: 2066 756e 6374 696f 6e20 6361 6e20 6265 function can be │ │ │ -000a2100: 2075 7365 6420 746f 2070 726f 6365 7373 used to process │ │ │ -000a2110: 2074 6865 206f 7574 7075 7420 4520 616e the output E an │ │ │ -000a2120: 6420 6d61 736b 2066 726f 6d20 5245 463a d mask from REF: │ │ │ -000a2130: 2066 696e 6445 7373 656e 7469 616c 4d61 findEssentialMa │ │ │ -000a2140: 742e 2049 6e20 7468 6973 0a73 6365 6e61 t. In this.scena │ │ │ -000a2150: 7269 6f2c 2070 6f69 6e74 7331 2061 6e64 rio, points1 and │ │ │ -000a2160: 2070 6f69 6e74 7332 2061 7265 2074 6865 points2 are the │ │ │ -000a2170: 2073 616d 6520 696e 7075 7420 666f 7220 same input for │ │ │ -000a2180: 6669 6e64 4573 7365 6e74 6961 6c4d 6174 findEssentialMat │ │ │ -000a2190: 2e3a 0a3c 636f 6465 3e0a 2020 2020 2f2f .:.. // │ │ │ -000a21a0: 2045 7861 6d70 6c65 2e20 4573 7469 6d61 Example. Estima │ │ │ -000a21b0: 7469 6f6e 206f 6620 6675 6e64 616d 656e tion of fundamen │ │ │ -000a21c0: 7461 6c20 6d61 7472 6978 2075 7369 6e67 tal matrix using │ │ │ -000a21d0: 2074 6865 2052 414e 5341 4320 616c 676f the RANSAC algo │ │ │ -000a21e0: 7269 7468 6d0a 2020 2020 696e 7420 706f rithm. int po │ │ │ -000a21f0: 696e 745f 636f 756e 7420 3d20 3130 303b int_count = 100; │ │ │ -000a2200: 0a20 2020 2076 6563 746f 7226 6c74 3b50 . vector<P │ │ │ -000a2210: 6f69 6e74 3266 2667 743b 2070 6f69 6e74 oint2f> point │ │ │ -000a2220: 7331 2870 6f69 6e74 5f63 6f75 6e74 293b s1(point_count); │ │ │ -000a2230: 0a20 2020 2076 6563 746f 7226 6c74 3b50 . vector<P │ │ │ -000a2240: 6f69 6e74 3266 2667 743b 2070 6f69 6e74 oint2f> point │ │ │ -000a2250: 7332 2870 6f69 6e74 5f63 6f75 6e74 293b s2(point_count); │ │ │ -000a2260: 0a0a 2020 2020 2f2f 2069 6e69 7469 616c .. // initial │ │ │ -000a2270: 697a 6520 7468 6520 706f 696e 7473 2068 ize the points h │ │ │ -000a2280: 6572 6520 2e2e 2e0a 2020 2020 666f 7228 ere .... for( │ │ │ -000a2290: 2069 6e74 2069 203d 2030 3b20 6920 266c int i = 0; i &l │ │ │ -000a22a0: 743b 2070 6f69 6e74 5f63 6f75 6e74 3b20 t; point_count; │ │ │ -000a22b0: 692b 2b20 290a 2020 2020 7b0a 2020 2020 i++ ). {. │ │ │ -000a22c0: 2020 2020 706f 696e 7473 315b 695d 203d points1[i] = │ │ │ -000a22d0: 202e 2e2e 3b0a 2020 2020 2020 2020 706f ...;. po │ │ │ -000a22e0: 696e 7473 325b 695d 203d 202e 2e2e 3b0a ints2[i] = ...;. │ │ │ -000a22f0: 2020 2020 7d0a 0a20 2020 202f 2f20 496e }.. // In │ │ │ -000a2300: 7075 743a 2063 616d 6572 6120 6361 6c69 put: camera cali │ │ │ -000a2310: 6272 6174 696f 6e20 6f66 2062 6f74 6820 bration of both │ │ │ -000a2320: 6361 6d65 7261 732c 2066 6f72 2065 7861 cameras, for exa │ │ │ -000a2330: 6d70 6c65 2075 7369 6e67 2069 6e74 7269 mple using intri │ │ │ -000a2340: 6e73 6963 2063 6865 7373 626f 6172 6420 nsic chessboard │ │ │ -000a2350: 6361 6c69 6272 6174 696f 6e2e 0a20 2020 calibration.. │ │ │ -000a2360: 204d 6174 2063 616d 6572 614d 6174 7269 Mat cameraMatri │ │ │ -000a2370: 7831 2c20 6469 7374 436f 6566 6673 312c x1, distCoeffs1, │ │ │ -000a2380: 2063 616d 6572 614d 6174 7269 7832 2c20 cameraMatrix2, │ │ │ -000a2390: 6469 7374 436f 6566 6673 323b 0a0a 2020 distCoeffs2;.. │ │ │ -000a23a0: 2020 2f2f 204f 7574 7075 743a 2045 7373 // Output: Ess │ │ │ -000a23b0: 656e 7469 616c 206d 6174 7269 782c 2072 ential matrix, r │ │ │ -000a23c0: 656c 6174 6976 6520 726f 7461 7469 6f6e elative rotation │ │ │ -000a23d0: 2061 6e64 2072 656c 6174 6976 6520 7472 and relative tr │ │ │ -000a23e0: 616e 736c 6174 696f 6e2e 0a20 2020 204d anslation.. M │ │ │ -000a23f0: 6174 2045 2c20 522c 2074 2c20 6d61 736b at E, R, t, mask │ │ │ -000a2400: 3b0a 0a20 2020 2072 6563 6f76 6572 506f ;.. recoverPo │ │ │ -000a2410: 7365 2870 6f69 6e74 7331 2c20 706f 696e se(points1, poin │ │ │ -000a2420: 7473 322c 2063 616d 6572 614d 6174 7269 ts2, cameraMatri │ │ │ -000a2430: 7831 2c20 6469 7374 436f 6566 6673 312c x1, distCoeffs1, │ │ │ -000a2440: 2063 616d 6572 614d 6174 7269 7832 2c20 cameraMatrix2, │ │ │ -000a2450: 6469 7374 436f 6566 6673 322c 2045 2c20 distCoeffs2, E, │ │ │ -000a2460: 522c 2074 2c20 6d61 736b 293b 0a3c 2f63 R, t, mask);.
    .
    Re │ │ │ -000a2480: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ -000a2490: 6175 746f 6d61 7469 6361 6c6c 7920 6765 automatically ge │ │ │ -000a24a0: 6e65 7261 7465 643c 2f64 643e 0a3c 2f64 nerated
    ..
    ..
  • .
  • . │ │ │ -000a24d0: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    recoverPo │ │ │ -000a25c0: 7365 3c2f 6833 3e0a 3c64 6976 2063 6c61 se

    .
    .
    pu │ │ │ -000a2620: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static int&nbs │ │ │ -000a2660: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;rec │ │ │ -000a2680: 6f76 6572 506f 7365 3c2f 7370 616e 3e3c overPose< │ │ │ -000a2690: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat points1,. │ │ │ -000a2700: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000a2740: 3c2f 613e 266e 6273 703b 706f 696e 7473  points │ │ │ -000a2750: 322c 0a20 3c61 2068 7265 663d 222e 2e2f 2,. │ │ │ -000a2790: 4d61 743c 2f61 3e26 6e62 7370 3b63 616d Mat cam │ │ │ -000a27a0: 6572 614d 6174 7269 7831 2c0a 203c 6120 eraMatrix1,. Mat │ │ │ -000a27f0: 266e 6273 703b 6469 7374 436f 6566 6673  distCoeffs │ │ │ -000a2800: 312c 0a20 3c61 2068 7265 663d 222e 2e2f 1,. │ │ │ -000a2840: 4d61 743c 2f61 3e26 6e62 7370 3b63 616d Mat cam │ │ │ -000a2850: 6572 614d 6174 7269 7832 2c0a 203c 6120 eraMatrix2,. Mat │ │ │ -000a28a0: 266e 6273 703b 6469 7374 436f 6566 6673  distCoeffs │ │ │ -000a28b0: 322c 0a20 3c61 2068 7265 663d 222e 2e2f 2,. │ │ │ -000a28f0: 4d61 743c 2f61 3e26 6e62 7370 3b45 2c0a Mat E,. │ │ │ -000a2900: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000a2940: 3c2f 613e 266e 6273 703b 522c 0a20 3c61  R,. Mat t,. int&n │ │ │ -000a29a0: 6273 703b 6d65 7468 6f64 293c 2f73 7061 bsp;method)
    .
    Reco │ │ │ -000a29d0: 7665 7273 2074 6865 2072 656c 6174 6976 vers the relativ │ │ │ -000a29e0: 6520 6361 6d65 7261 2072 6f74 6174 696f e camera rotatio │ │ │ -000a29f0: 6e20 616e 6420 7468 6520 7472 616e 736c n and the transl │ │ │ -000a2a00: 6174 696f 6e20 6672 6f6d 2063 6f72 7265 ation from corre │ │ │ -000a2a10: 7370 6f6e 6469 6e67 2070 6f69 6e74 7320 sponding points │ │ │ -000a2a20: 696e 2074 776f 2069 6d61 6765 7320 6672 in two images fr │ │ │ -000a2a30: 6f6d 2074 776f 2064 6966 6665 7265 6e74 om two different │ │ │ -000a2a40: 2063 616d 6572 6173 2c20 7573 696e 6720 cameras, using │ │ │ -000a2a50: 6368 6972 616c 6974 7920 6368 6563 6b2e chirality check. │ │ │ -000a2a60: 2052 6574 7572 6e73 2074 6865 206e 756d Returns the num │ │ │ -000a2a70: 6265 7220 6f66 0a69 6e6c 6965 7273 2074 ber of.inliers t │ │ │ -000a2a80: 6861 7420 7061 7373 2074 6865 2063 6865 hat pass the che │ │ │ -000a2a90: 636b 2e3c 2f64 6976 3e0a 3c64 6c20 636c ck.
    .
    .
    Parameters:
    .
    poin │ │ │ -000a2ad0: 7473 313c 2f63 6f64 653e 202d 2041 7272 ts1 - Arr │ │ │ -000a2ae0: 6179 206f 6620 4e20 3244 2070 6f69 6e74 ay of N 2D point │ │ │ -000a2af0: 7320 6672 6f6d 2074 6865 2066 6972 7374 s from the first │ │ │ -000a2b00: 2069 6d61 6765 2e20 5468 6520 706f 696e image. The poin │ │ │ -000a2b10: 7420 636f 6f72 6469 6e61 7465 7320 7368 t coordinates sh │ │ │ -000a2b20: 6f75 6c64 2062 650a 666c 6f61 7469 6e67 ould be.floating │ │ │ -000a2b30: 2d70 6f69 6e74 2028 7369 6e67 6c65 206f -point (single o │ │ │ -000a2b40: 7220 646f 7562 6c65 2070 7265 6369 7369 r double precisi │ │ │ -000a2b50: 6f6e 292e 3c2f 6464 3e0a 3c64 643e 3c63 on).
    .
    points2 - Array of th │ │ │ -000a2b80: 6520 7365 636f 6e64 2069 6d61 6765 2070 e second image p │ │ │ -000a2b90: 6f69 6e74 7320 6f66 2074 6865 2073 616d oints of the sam │ │ │ -000a2ba0: 6520 7369 7a65 2061 6e64 2066 6f72 6d61 e size and forma │ │ │ -000a2bb0: 7420 6173 2070 6f69 6e74 7331 202e 3c2f t as points1 ..
    ca │ │ │ -000a2bd0: 6d65 7261 4d61 7472 6978 313c 2f63 6f64 meraMatrix1 - Input/outpu │ │ │ -000a2bf0: 7420 6361 6d65 7261 206d 6174 7269 7820 t camera matrix │ │ │ -000a2c00: 666f 7220 7468 6520 6669 7273 7420 6361 for the first ca │ │ │ -000a2c10: 6d65 7261 2c20 7468 6520 7361 6d65 2061 mera, the same a │ │ │ -000a2c20: 7320 696e 0a52 4546 3a20 6361 6c69 6272 s in.REF: calibr │ │ │ -000a2c30: 6174 6543 616d 6572 612e 2046 7572 7468 ateCamera. Furth │ │ │ -000a2c40: 6572 6d6f 7265 2c20 666f 7220 7468 6520 ermore, for the │ │ │ -000a2c50: 7374 6572 656f 2063 6173 652c 2061 6464 stereo case, add │ │ │ -000a2c60: 6974 696f 6e61 6c20 666c 6167 7320 6d61 itional flags ma │ │ │ -000a2c70: 7920 6265 2075 7365 642c 2073 6565 2062 y be used, see b │ │ │ -000a2c80: 656c 6f77 2e3c 2f64 643e 0a3c 6464 3e3c elow.
    .
    < │ │ │ -000a2c90: 636f 6465 3e64 6973 7443 6f65 6666 7331 code>distCoeffs1 │ │ │ -000a2ca0: 3c2f 636f 6465 3e20 2d20 496e 7075 742f - Input/ │ │ │ -000a2cb0: 6f75 7470 7574 2076 6563 746f 7220 6f66 output vector of │ │ │ -000a2cc0: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ -000a2cd0: 6669 6369 656e 7473 2c20 7468 6520 7361 ficients, the sa │ │ │ -000a2ce0: 6d65 2061 7320 696e 0a52 4546 3a20 6361 me as in.REF: ca │ │ │ -000a2cf0: 6c69 6272 6174 6543 616d 6572 612e 3c2f librateCamera..
    ca │ │ │ -000a2d10: 6d65 7261 4d61 7472 6978 323c 2f63 6f64 meraMatrix2 - Input/outpu │ │ │ -000a2d30: 7420 6361 6d65 7261 206d 6174 7269 7820 t camera matrix │ │ │ -000a2d40: 666f 7220 7468 6520 6669 7273 7420 6361 for the first ca │ │ │ -000a2d50: 6d65 7261 2c20 7468 6520 7361 6d65 2061 mera, the same a │ │ │ -000a2d60: 7320 696e 0a52 4546 3a20 6361 6c69 6272 s in.REF: calibr │ │ │ -000a2d70: 6174 6543 616d 6572 612e 2046 7572 7468 ateCamera. Furth │ │ │ -000a2d80: 6572 6d6f 7265 2c20 666f 7220 7468 6520 ermore, for the │ │ │ -000a2d90: 7374 6572 656f 2063 6173 652c 2061 6464 stereo case, add │ │ │ -000a2da0: 6974 696f 6e61 6c20 666c 6167 7320 6d61 itional flags ma │ │ │ -000a2db0: 7920 6265 2075 7365 642c 2073 6565 2062 y be used, see b │ │ │ -000a2dc0: 656c 6f77 2e3c 2f64 643e 0a3c 6464 3e3c elow.
    .
    < │ │ │ -000a2dd0: 636f 6465 3e64 6973 7443 6f65 6666 7332 code>distCoeffs2 │ │ │ -000a2de0: 3c2f 636f 6465 3e20 2d20 496e 7075 742f - Input/ │ │ │ -000a2df0: 6f75 7470 7574 2076 6563 746f 7220 6f66 output vector of │ │ │ -000a2e00: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ -000a2e10: 6669 6369 656e 7473 2c20 7468 6520 7361 ficients, the sa │ │ │ -000a2e20: 6d65 2061 7320 696e 0a52 4546 3a20 6361 me as in.REF: ca │ │ │ -000a2e30: 6c69 6272 6174 6543 616d 6572 612e 3c2f librateCamera..
    E< │ │ │ -000a2e50: 2f63 6f64 653e 202d 2054 6865 206f 7574 /code> - The out │ │ │ -000a2e60: 7075 7420 6573 7365 6e74 6961 6c20 6d61 put essential ma │ │ │ -000a2e70: 7472 6978 2e3c 2f64 643e 0a3c 6464 3e3c trix.
    .
    < │ │ │ -000a2e80: 636f 6465 3e52 3c2f 636f 6465 3e20 2d20 code>R - │ │ │ -000a2e90: 4f75 7470 7574 2072 6f74 6174 696f 6e20 Output rotation │ │ │ -000a2ea0: 6d61 7472 6978 2e20 546f 6765 7468 6572 matrix. Together │ │ │ -000a2eb0: 2077 6974 6820 7468 6520 7472 616e 736c with the transl │ │ │ -000a2ec0: 6174 696f 6e20 7665 6374 6f72 2c20 7468 ation vector, th │ │ │ -000a2ed0: 6973 206d 6174 7269 7820 6d61 6b65 7320 is matrix makes │ │ │ -000a2ee0: 7570 2061 2074 7570 6c65 0a74 6861 7420 up a tuple.that │ │ │ -000a2ef0: 7065 7266 6f72 6d73 2061 2063 6861 6e67 performs a chang │ │ │ -000a2f00: 6520 6f66 2062 6173 6973 2066 726f 6d20 e of basis from │ │ │ -000a2f10: 7468 6520 6669 7273 7420 6361 6d65 7261 the first camera │ │ │ -000a2f20: 2773 2063 6f6f 7264 696e 6174 6520 7379 's coordinate sy │ │ │ -000a2f30: 7374 656d 2074 6f20 7468 6520 7365 636f stem to the seco │ │ │ -000a2f40: 6e64 2063 616d 6572 6127 730a 636f 6f72 nd camera's.coor │ │ │ -000a2f50: 6469 6e61 7465 2073 7973 7465 6d2e 204e dinate system. N │ │ │ -000a2f60: 6f74 6520 7468 6174 2c20 696e 2067 656e ote that, in gen │ │ │ -000a2f70: 6572 616c 2c20 7420 6361 6e20 6e6f 7420 eral, t can not │ │ │ -000a2f80: 6265 2075 7365 6420 666f 7220 7468 6973 be used for this │ │ │ -000a2f90: 2074 7570 6c65 2c20 7365 6520 7468 6520 tuple, see the │ │ │ -000a2fa0: 7061 7261 6d65 7465 720a 6465 7363 7269 parameter.descri │ │ │ -000a2fb0: 6265 6420 6265 6c6f 772e 3c2f 6464 3e0a bed below.
    . │ │ │ -000a2fc0: 3c64 643e 3c63 6f64 653e 743c 2f63 6f64
    t - Output tran │ │ │ -000a2fe0: 736c 6174 696f 6e20 7665 6374 6f72 2e20 slation vector. │ │ │ -000a2ff0: 5468 6973 2076 6563 746f 7220 6973 206f This vector is o │ │ │ -000a3000: 6274 6169 6e65 6420 6279 2052 4546 3a20 btained by REF: │ │ │ -000a3010: 6465 636f 6d70 6f73 6545 7373 656e 7469 decomposeEssenti │ │ │ -000a3020: 616c 4d61 7420 616e 640a 7468 6572 6566 alMat and.theref │ │ │ -000a3030: 6f72 6520 6973 206f 6e6c 7920 6b6e 6f77 ore is only know │ │ │ -000a3040: 6e20 7570 2074 6f20 7363 616c 652c 2069 n up to scale, i │ │ │ -000a3050: 2e65 2e20 7420 6973 2074 6865 2064 6972 .e. t is the dir │ │ │ -000a3060: 6563 7469 6f6e 206f 6620 7468 6520 7472 ection of the tr │ │ │ -000a3070: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ -000a3080: 2061 6e64 2068 6173 2075 6e69 740a 6c65 and has unit.le │ │ │ -000a3090: 6e67 7468 2e3c 2f64 643e 0a3c 6464 3e3c ngth.
    .
    < │ │ │ -000a30a0: 636f 6465 3e6d 6574 686f 643c 2f63 6f64 code>method - Method for │ │ │ -000a30c0: 636f 6d70 7574 696e 6720 616e 2065 7373 computing an ess │ │ │ -000a30d0: 656e 7469 616c 206d 6174 7269 782e 0a3c ential matrix..< │ │ │ -000a30e0: 756c 3e0a 2020 3c6c 693e 0a20 2020 5245 ul>.
  • . RE │ │ │ -000a30f0: 463a 2052 414e 5341 4320 666f 7220 7468 F: RANSAC for th │ │ │ -000a3100: 6520 5241 4e53 4143 2061 6c67 6f72 6974 e RANSAC algorit │ │ │ -000a3110: 686d 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c hm..
  • . . REF: LMEDS │ │ │ -000a3130: 2066 6f72 2074 6865 204c 4d65 6453 2061 for the LMedS a │ │ │ -000a3140: 6c67 6f72 6974 686d 2e0a 2020 3c2f 6c69 lgorithm..
  • ..confiden │ │ │ -000a3160: 6365 2028 7072 6f62 6162 696c 6974 7929 ce (probability) │ │ │ -000a3170: 2074 6861 7420 7468 6520 6573 7469 6d61 that the estima │ │ │ -000a3180: 7465 6420 6d61 7472 6978 2069 7320 636f ted matrix is co │ │ │ -000a3190: 7272 6563 742e 0a6c 696e 6520 696e 2070 rrect..line in p │ │ │ -000a31a0: 6978 656c 732c 2062 6579 6f6e 6420 7768 ixels, beyond wh │ │ │ -000a31b0: 6963 6820 7468 6520 706f 696e 7420 6973 ich the point is │ │ │ -000a31c0: 2063 6f6e 7369 6465 7265 6420 616e 206f considered an o │ │ │ -000a31d0: 7574 6c69 6572 2061 6e64 2069 7320 6e6f utlier and is no │ │ │ -000a31e0: 7420 7573 6564 2066 6f72 2063 6f6d 7075 t used for compu │ │ │ -000a31f0: 7469 6e67 2074 6865 0a66 696e 616c 2066 ting the.final f │ │ │ -000a3200: 756e 6461 6d65 6e74 616c 206d 6174 7269 undamental matri │ │ │ -000a3210: 782e 2049 7420 6361 6e20 6265 2073 6574 x. It can be set │ │ │ -000a3220: 2074 6f20 736f 6d65 7468 696e 6720 6c69 to something li │ │ │ -000a3230: 6b65 2031 2d33 2c20 6465 7065 6e64 696e ke 1-3, dependin │ │ │ -000a3240: 6720 6f6e 2074 6865 2061 6363 7572 6163 g on the accurac │ │ │ -000a3250: 7920 6f66 2074 6865 0a70 6f69 6e74 206c y of the.point l │ │ │ -000a3260: 6f63 616c 697a 6174 696f 6e2c 2069 6d61 ocalization, ima │ │ │ -000a3270: 6765 2072 6573 6f6c 7574 696f 6e2c 2061 ge resolution, a │ │ │ -000a3280: 6e64 2074 6865 2069 6d61 6765 206e 6f69 nd the image noi │ │ │ -000a3290: 7365 2e0a 696e 6c69 6572 7320 696e 2070 se..inliers in p │ │ │ -000a32a0: 6f69 6e74 7331 2061 6e64 2070 6f69 6e74 oints1 and point │ │ │ -000a32b0: 7332 2066 6f72 2074 6865 2067 6976 656e s2 for the given │ │ │ -000a32c0: 2065 7373 656e 7469 616c 206d 6174 7269 essential matri │ │ │ -000a32d0: 7820 452e 204f 6e6c 7920 7468 6573 6520 x E. Only these │ │ │ -000a32e0: 696e 6c69 6572 7320 7769 6c6c 2062 6520 inliers will be │ │ │ -000a32f0: 7573 6564 2074 6f0a 7265 636f 7665 7220 used to.recover │ │ │ -000a3300: 706f 7365 2e20 496e 2074 6865 206f 7574 pose. In the out │ │ │ -000a3310: 7075 7420 6d61 736b 206f 6e6c 7920 696e put mask only in │ │ │ -000a3320: 6c69 6572 7320 7768 6963 6820 7061 7373 liers which pass │ │ │ -000a3330: 2074 6865 2063 6869 7261 6c69 7479 2063 the chirality c │ │ │ -000a3340: 6865 636b 2e0a 0a54 6869 7320 6675 6e63 heck...This func │ │ │ -000a3350: 7469 6f6e 2064 6563 6f6d 706f 7365 7320 tion decomposes │ │ │ -000a3360: 616e 2065 7373 656e 7469 616c 206d 6174 an essential mat │ │ │ -000a3370: 7269 7820 7573 696e 6720 5245 463a 2064 rix using REF: d │ │ │ -000a3380: 6563 6f6d 706f 7365 4573 7365 6e74 6961 ecomposeEssentia │ │ │ -000a3390: 6c4d 6174 2061 6e64 2074 6865 6e20 7665 lMat and then ve │ │ │ -000a33a0: 7269 6669 6573 0a70 6f73 7369 626c 6520 rifies.possible │ │ │ -000a33b0: 706f 7365 2068 7970 6f74 6865 7365 7320 pose hypotheses │ │ │ -000a33c0: 6279 2064 6f69 6e67 2063 6869 7261 6c69 by doing chirali │ │ │ -000a33d0: 7479 2063 6865 636b 2e20 5468 6520 6368 ty check. The ch │ │ │ -000a33e0: 6972 616c 6974 7920 6368 6563 6b20 6d65 irality check me │ │ │ -000a33f0: 616e 7320 7468 6174 2074 6865 0a74 7269 ans that the.tri │ │ │ -000a3400: 616e 6775 6c61 7465 6420 3344 2070 6f69 angulated 3D poi │ │ │ -000a3410: 6e74 7320 7368 6f75 6c64 2068 6176 6520 nts should have │ │ │ -000a3420: 706f 7369 7469 7665 2064 6570 7468 2e20 positive depth. │ │ │ -000a3430: 536f 6d65 2064 6574 6169 6c73 2063 616e Some details can │ │ │ -000a3440: 2062 6520 666f 756e 6420 696e 2043 4954 be found in CIT │ │ │ -000a3450: 453a 204e 6973 7465 7230 332e 0a0a 5468 E: Nister03...Th │ │ │ -000a3460: 6973 2066 756e 6374 696f 6e20 6361 6e20 is function can │ │ │ -000a3470: 6265 2075 7365 6420 746f 2070 726f 6365 be used to proce │ │ │ -000a3480: 7373 2074 6865 206f 7574 7075 7420 4520 ss the output E │ │ │ -000a3490: 616e 6420 6d61 736b 2066 726f 6d20 5245 and mask from RE │ │ │ -000a34a0: 463a 2066 696e 6445 7373 656e 7469 616c F: findEssential │ │ │ -000a34b0: 4d61 742e 2049 6e20 7468 6973 0a73 6365 Mat. In this.sce │ │ │ -000a34c0: 6e61 7269 6f2c 2070 6f69 6e74 7331 2061 nario, points1 a │ │ │ -000a34d0: 6e64 2070 6f69 6e74 7332 2061 7265 2074 nd points2 are t │ │ │ -000a34e0: 6865 2073 616d 6520 696e 7075 7420 666f he same input fo │ │ │ -000a34f0: 7220 6669 6e64 4573 7365 6e74 6961 6c4d r findEssentialM │ │ │ -000a3500: 6174 2e3a 0a3c 636f 6465 3e0a 2020 2020 at.:.. │ │ │ -000a3510: 2f2f 2045 7861 6d70 6c65 2e20 4573 7469 // Example. Esti │ │ │ -000a3520: 6d61 7469 6f6e 206f 6620 6675 6e64 616d mation of fundam │ │ │ -000a3530: 656e 7461 6c20 6d61 7472 6978 2075 7369 ental matrix usi │ │ │ -000a3540: 6e67 2074 6865 2052 414e 5341 4320 616c ng the RANSAC al │ │ │ -000a3550: 676f 7269 7468 6d0a 2020 2020 696e 7420 gorithm. int │ │ │ -000a3560: 706f 696e 745f 636f 756e 7420 3d20 3130 point_count = 10 │ │ │ -000a3570: 303b 0a20 2020 2076 6563 746f 7226 6c74 0;. vector< │ │ │ -000a3580: 3b50 6f69 6e74 3266 2667 743b 2070 6f69 ;Point2f> poi │ │ │ -000a3590: 6e74 7331 2870 6f69 6e74 5f63 6f75 6e74 nts1(point_count │ │ │ -000a35a0: 293b 0a20 2020 2076 6563 746f 7226 6c74 );. vector< │ │ │ -000a35b0: 3b50 6f69 6e74 3266 2667 743b 2070 6f69 ;Point2f> poi │ │ │ -000a35c0: 6e74 7332 2870 6f69 6e74 5f63 6f75 6e74 nts2(point_count │ │ │ -000a35d0: 293b 0a0a 2020 2020 2f2f 2069 6e69 7469 );.. // initi │ │ │ -000a35e0: 616c 697a 6520 7468 6520 706f 696e 7473 alize the points │ │ │ -000a35f0: 2068 6572 6520 2e2e 2e0a 2020 2020 666f here .... fo │ │ │ -000a3600: 7228 2069 6e74 2069 203d 2030 3b20 6920 r( int i = 0; i │ │ │ -000a3610: 266c 743b 2070 6f69 6e74 5f63 6f75 6e74 < point_count │ │ │ -000a3620: 3b20 692b 2b20 290a 2020 2020 7b0a 2020 ; i++ ). {. │ │ │ -000a3630: 2020 2020 2020 706f 696e 7473 315b 695d points1[i] │ │ │ -000a3640: 203d 202e 2e2e 3b0a 2020 2020 2020 2020 = ...;. │ │ │ -000a3650: 706f 696e 7473 325b 695d 203d 202e 2e2e points2[i] = ... │ │ │ -000a3660: 3b0a 2020 2020 7d0a 0a20 2020 202f 2f20 ;. }.. // │ │ │ -000a3670: 496e 7075 743a 2063 616d 6572 6120 6361 Input: camera ca │ │ │ -000a3680: 6c69 6272 6174 696f 6e20 6f66 2062 6f74 libration of bot │ │ │ -000a3690: 6820 6361 6d65 7261 732c 2066 6f72 2065 h cameras, for e │ │ │ -000a36a0: 7861 6d70 6c65 2075 7369 6e67 2069 6e74 xample using int │ │ │ -000a36b0: 7269 6e73 6963 2063 6865 7373 626f 6172 rinsic chessboar │ │ │ -000a36c0: 6420 6361 6c69 6272 6174 696f 6e2e 0a20 d calibration.. │ │ │ -000a36d0: 2020 204d 6174 2063 616d 6572 614d 6174 Mat cameraMat │ │ │ -000a36e0: 7269 7831 2c20 6469 7374 436f 6566 6673 rix1, distCoeffs │ │ │ -000a36f0: 312c 2063 616d 6572 614d 6174 7269 7832 1, cameraMatrix2 │ │ │ -000a3700: 2c20 6469 7374 436f 6566 6673 323b 0a0a , distCoeffs2;.. │ │ │ -000a3710: 2020 2020 2f2f 204f 7574 7075 743a 2045 // Output: E │ │ │ -000a3720: 7373 656e 7469 616c 206d 6174 7269 782c ssential matrix, │ │ │ -000a3730: 2072 656c 6174 6976 6520 726f 7461 7469 relative rotati │ │ │ -000a3740: 6f6e 2061 6e64 2072 656c 6174 6976 6520 on and relative │ │ │ -000a3750: 7472 616e 736c 6174 696f 6e2e 0a20 2020 translation.. │ │ │ -000a3760: 204d 6174 2045 2c20 522c 2074 2c20 6d61 Mat E, R, t, ma │ │ │ -000a3770: 736b 3b0a 0a20 2020 2072 6563 6f76 6572 sk;.. recover │ │ │ -000a3780: 506f 7365 2870 6f69 6e74 7331 2c20 706f Pose(points1, po │ │ │ -000a3790: 696e 7473 322c 2063 616d 6572 614d 6174 ints2, cameraMat │ │ │ -000a37a0: 7269 7831 2c20 6469 7374 436f 6566 6673 rix1, distCoeffs │ │ │ -000a37b0: 312c 2063 616d 6572 614d 6174 7269 7832 1, cameraMatrix2 │ │ │ -000a37c0: 2c20 6469 7374 436f 6566 6673 322c 2045 , distCoeffs2, E │ │ │ -000a37d0: 2c20 522c 2074 2c20 6d61 736b 293b 0a3c , R, t, mask);.< │ │ │ -000a37e0: 2f63 6f64 653e 3c2f 6464 3e0a 3c64 743e /code>.
    │ │ │ -000a37f0: 5265 7475 726e 733a 3c2f 6474 3e0a 3c64 Returns:
    .automatically │ │ │ -000a3810: 6765 6e65 7261 7465 643c 2f64 643e 0a3c generated.< │ │ │ -000a3820: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>....
  • .
    │ │ │ -000a3920: 0a3c 6833 3e72 6563 6f76 6572 506f 7365 .

    recoverPose │ │ │ -000a3930: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ -000a3990: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -000a39a0: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -000a39c0: 696e 743c 2f73 7061 6e3e 266e 6273 703b int  │ │ │ -000a39d0: 3c73 7061 6e20 636c 6173 733d 2265 6c65 recov │ │ │ -000a39f0: 6572 506f 7365 3c2f 7370 616e 3e3c 7762 erPose(Mat& │ │ │ -000a3a60: 6e62 7370 3b70 6f69 6e74 7331 2c0a 203c nbsp;points1,. < │ │ │ -000a3a70: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000a3a80: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000a3a90: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000a3aa0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat points2, │ │ │ -000a3ac0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000a3b00: 743c 2f61 3e26 6e62 7370 3b63 616d 6572 t camer │ │ │ -000a3b10: 614d 6174 7269 7831 2c0a 203c 6120 6872 aMatrix1,. Mat&n │ │ │ -000a3b60: 6273 703b 6469 7374 436f 6566 6673 312c bsp;distCoeffs1, │ │ │ -000a3b70: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000a3bb0: 743c 2f61 3e26 6e62 7370 3b63 616d 6572 t camer │ │ │ -000a3bc0: 614d 6174 7269 7832 2c0a 203c 6120 6872 aMatrix2,. Mat&n │ │ │ -000a3c10: 6273 703b 6469 7374 436f 6566 6673 322c bsp;distCoeffs2, │ │ │ -000a3c20: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000a3c60: 743c 2f61 3e26 6e62 7370 3b45 2c0a 203c t E,. < │ │ │ -000a3c70: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000a3c80: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000a3c90: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000a3ca0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat R,. Mat& │ │ │ -000a3d00: 6e62 7370 3b74 293c 2f73 7061 6e3e 3c2f nbsp;t).
    Recovers │ │ │ -000a3d30: 2074 6865 2072 656c 6174 6976 6520 6361 the relative ca │ │ │ -000a3d40: 6d65 7261 2072 6f74 6174 696f 6e20 616e mera rotation an │ │ │ -000a3d50: 6420 7468 6520 7472 616e 736c 6174 696f d the translatio │ │ │ -000a3d60: 6e20 6672 6f6d 2063 6f72 7265 7370 6f6e n from correspon │ │ │ -000a3d70: 6469 6e67 2070 6f69 6e74 7320 696e 2074 ding points in t │ │ │ -000a3d80: 776f 2069 6d61 6765 7320 6672 6f6d 2074 wo images from t │ │ │ -000a3d90: 776f 2064 6966 6665 7265 6e74 2063 616d wo different cam │ │ │ -000a3da0: 6572 6173 2c20 7573 696e 6720 6368 6972 eras, using chir │ │ │ -000a3db0: 616c 6974 7920 6368 6563 6b2e 2052 6574 ality check. Ret │ │ │ -000a3dc0: 7572 6e73 2074 6865 206e 756d 6265 7220 urns the number │ │ │ -000a3dd0: 6f66 0a69 6e6c 6965 7273 2074 6861 7420 of.inliers that │ │ │ -000a3de0: 7061 7373 2074 6865 2063 6865 636b 2e3c pass the check.< │ │ │ -000a3df0: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ -000a3e10: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .points1< │ │ │ -000a3e30: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ -000a3e40: 6620 4e20 3244 2070 6f69 6e74 7320 6672 f N 2D points fr │ │ │ -000a3e50: 6f6d 2074 6865 2066 6972 7374 2069 6d61 om the first ima │ │ │ -000a3e60: 6765 2e20 5468 6520 706f 696e 7420 636f ge. The point co │ │ │ -000a3e70: 6f72 6469 6e61 7465 7320 7368 6f75 6c64 ordinates should │ │ │ -000a3e80: 2062 650a 666c 6f61 7469 6e67 2d70 6f69 be.floating-poi │ │ │ -000a3e90: 6e74 2028 7369 6e67 6c65 206f 7220 646f nt (single or do │ │ │ -000a3ea0: 7562 6c65 2070 7265 6369 7369 6f6e 292e uble precision). │ │ │ -000a3eb0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e .
    │ │ │ -000a3ec0: 706f 696e 7473 323c 2f63 6f64 653e 202d points2 - │ │ │ -000a3ed0: 2041 7272 6179 206f 6620 7468 6520 7365 Array of the se │ │ │ -000a3ee0: 636f 6e64 2069 6d61 6765 2070 6f69 6e74 cond image point │ │ │ -000a3ef0: 7320 6f66 2074 6865 2073 616d 6520 7369 s of the same si │ │ │ -000a3f00: 7a65 2061 6e64 2066 6f72 6d61 7420 6173 ze and format as │ │ │ -000a3f10: 2070 6f69 6e74 7331 202e 3c2f 6464 3e0a points1 .
    . │ │ │ -000a3f20: 3c64 643e 3c63 6f64 653e 6361 6d65 7261
    camera │ │ │ -000a3f30: 4d61 7472 6978 313c 2f63 6f64 653e 202d Matrix1 - │ │ │ -000a3f40: 2049 6e70 7574 2f6f 7574 7075 7420 6361 Input/output ca │ │ │ -000a3f50: 6d65 7261 206d 6174 7269 7820 666f 7220 mera matrix for │ │ │ -000a3f60: 7468 6520 6669 7273 7420 6361 6d65 7261 the first camera │ │ │ -000a3f70: 2c20 7468 6520 7361 6d65 2061 7320 696e , the same as in │ │ │ -000a3f80: 0a52 4546 3a20 6361 6c69 6272 6174 6543 .REF: calibrateC │ │ │ -000a3f90: 616d 6572 612e 2046 7572 7468 6572 6d6f amera. Furthermo │ │ │ -000a3fa0: 7265 2c20 666f 7220 7468 6520 7374 6572 re, for the ster │ │ │ -000a3fb0: 656f 2063 6173 652c 2061 6464 6974 696f eo case, additio │ │ │ -000a3fc0: 6e61 6c20 666c 6167 7320 6d61 7920 6265 nal flags may be │ │ │ -000a3fd0: 2075 7365 642c 2073 6565 2062 656c 6f77 used, see below │ │ │ -000a3fe0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    distCoeffs1 - Input/outp │ │ │ -000a4010: 7574 2076 6563 746f 7220 6f66 2064 6973 ut vector of dis │ │ │ -000a4020: 746f 7274 696f 6e20 636f 6566 6669 6369 tortion coeffici │ │ │ -000a4030: 656e 7473 2c20 7468 6520 7361 6d65 2061 ents, the same a │ │ │ -000a4040: 7320 696e 0a52 4546 3a20 6361 6c69 6272 s in.REF: calibr │ │ │ -000a4050: 6174 6543 616d 6572 612e 3c2f 6464 3e0a ateCamera.
    . │ │ │ -000a4060: 3c64 643e 3c63 6f64 653e 6361 6d65 7261
    camera │ │ │ -000a4070: 4d61 7472 6978 323c 2f63 6f64 653e 202d Matrix2 - │ │ │ -000a4080: 2049 6e70 7574 2f6f 7574 7075 7420 6361 Input/output ca │ │ │ -000a4090: 6d65 7261 206d 6174 7269 7820 666f 7220 mera matrix for │ │ │ -000a40a0: 7468 6520 6669 7273 7420 6361 6d65 7261 the first camera │ │ │ -000a40b0: 2c20 7468 6520 7361 6d65 2061 7320 696e , the same as in │ │ │ -000a40c0: 0a52 4546 3a20 6361 6c69 6272 6174 6543 .REF: calibrateC │ │ │ -000a40d0: 616d 6572 612e 2046 7572 7468 6572 6d6f amera. Furthermo │ │ │ -000a40e0: 7265 2c20 666f 7220 7468 6520 7374 6572 re, for the ster │ │ │ -000a40f0: 656f 2063 6173 652c 2061 6464 6974 696f eo case, additio │ │ │ -000a4100: 6e61 6c20 666c 6167 7320 6d61 7920 6265 nal flags may be │ │ │ -000a4110: 2075 7365 642c 2073 6565 2062 656c 6f77 used, see below │ │ │ -000a4120: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    distCoeffs2 - Input/outp │ │ │ -000a4150: 7574 2076 6563 746f 7220 6f66 2064 6973 ut vector of dis │ │ │ -000a4160: 746f 7274 696f 6e20 636f 6566 6669 6369 tortion coeffici │ │ │ -000a4170: 656e 7473 2c20 7468 6520 7361 6d65 2061 ents, the same a │ │ │ -000a4180: 7320 696e 0a52 4546 3a20 6361 6c69 6272 s in.REF: calibr │ │ │ -000a4190: 6174 6543 616d 6572 612e 3c2f 6464 3e0a ateCamera.
    . │ │ │ -000a41a0: 3c64 643e 3c63 6f64 653e 453c 2f63 6f64
    E - The output │ │ │ -000a41c0: 6573 7365 6e74 6961 6c20 6d61 7472 6978 essential matrix │ │ │ -000a41d0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    R - Outp │ │ │ -000a41f0: 7574 2072 6f74 6174 696f 6e20 6d61 7472 ut rotation matr │ │ │ -000a4200: 6978 2e20 546f 6765 7468 6572 2077 6974 ix. Together wit │ │ │ -000a4210: 6820 7468 6520 7472 616e 736c 6174 696f h the translatio │ │ │ -000a4220: 6e20 7665 6374 6f72 2c20 7468 6973 206d n vector, this m │ │ │ -000a4230: 6174 7269 7820 6d61 6b65 7320 7570 2061 atrix makes up a │ │ │ -000a4240: 2074 7570 6c65 0a74 6861 7420 7065 7266 tuple.that perf │ │ │ -000a4250: 6f72 6d73 2061 2063 6861 6e67 6520 6f66 orms a change of │ │ │ -000a4260: 2062 6173 6973 2066 726f 6d20 7468 6520 basis from the │ │ │ -000a4270: 6669 7273 7420 6361 6d65 7261 2773 2063 first camera's c │ │ │ -000a4280: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ -000a4290: 2074 6f20 7468 6520 7365 636f 6e64 2063 to the second c │ │ │ -000a42a0: 616d 6572 6127 730a 636f 6f72 6469 6e61 amera's.coordina │ │ │ -000a42b0: 7465 2073 7973 7465 6d2e 204e 6f74 6520 te system. Note │ │ │ -000a42c0: 7468 6174 2c20 696e 2067 656e 6572 616c that, in general │ │ │ -000a42d0: 2c20 7420 6361 6e20 6e6f 7420 6265 2075 , t can not be u │ │ │ -000a42e0: 7365 6420 666f 7220 7468 6973 2074 7570 sed for this tup │ │ │ -000a42f0: 6c65 2c20 7365 6520 7468 6520 7061 7261 le, see the para │ │ │ -000a4300: 6d65 7465 720a 6465 7363 7269 6265 6420 meter.described │ │ │ -000a4310: 6265 6c6f 772e 3c2f 6464 3e0a 3c64 643e below.
    .
    │ │ │ -000a4320: 3c63 6f64 653e 743c 2f63 6f64 653e 202d t - │ │ │ -000a4330: 204f 7574 7075 7420 7472 616e 736c 6174 Output translat │ │ │ -000a4340: 696f 6e20 7665 6374 6f72 2e20 5468 6973 ion vector. This │ │ │ -000a4350: 2076 6563 746f 7220 6973 206f 6274 6169 vector is obtai │ │ │ -000a4360: 6e65 6420 6279 2052 4546 3a20 6465 636f ned by REF: deco │ │ │ -000a4370: 6d70 6f73 6545 7373 656e 7469 616c 4d61 mposeEssentialMa │ │ │ -000a4380: 7420 616e 640a 7468 6572 6566 6f72 6520 t and.therefore │ │ │ -000a4390: 6973 206f 6e6c 7920 6b6e 6f77 6e20 7570 is only known up │ │ │ -000a43a0: 2074 6f20 7363 616c 652c 2069 2e65 2e20 to scale, i.e. │ │ │ -000a43b0: 7420 6973 2074 6865 2064 6972 6563 7469 t is the directi │ │ │ -000a43c0: 6f6e 206f 6620 7468 6520 7472 616e 736c on of the transl │ │ │ -000a43d0: 6174 696f 6e20 7665 6374 6f72 2061 6e64 ation vector and │ │ │ -000a43e0: 2068 6173 2075 6e69 740a 6c65 6e67 7468 has unit.length │ │ │ -000a43f0: 2e0a 3c75 6c3e 0a20 203c 6c69 3e0a 2020 ..
      .
    • . │ │ │ -000a4400: 2052 4546 3a20 5241 4e53 4143 2066 6f72 REF: RANSAC for │ │ │ -000a4410: 2074 6865 2052 414e 5341 4320 616c 676f the RANSAC algo │ │ │ -000a4420: 7269 7468 6d2e 0a20 203c 2f6c 693e 0a20 rithm..
    • . │ │ │ -000a4430: 203c 6c69 3e0a 2020 2052 4546 3a20 4c4d
    • . REF: LM │ │ │ -000a4440: 4544 5320 666f 7220 7468 6520 4c4d 6564 EDS for the LMed │ │ │ -000a4450: 5320 616c 676f 7269 7468 6d2e 0a20 203c S algorithm.. < │ │ │ -000a4460: 2f6c 693e 0a3c 2f75 6c3e 0a63 6f6e 6669 /li>.
    .confi │ │ │ -000a4470: 6465 6e63 6520 2870 726f 6261 6269 6c69 dence (probabili │ │ │ -000a4480: 7479 2920 7468 6174 2074 6865 2065 7374 ty) that the est │ │ │ -000a4490: 696d 6174 6564 206d 6174 7269 7820 6973 imated matrix is │ │ │ -000a44a0: 2063 6f72 7265 6374 2e0a 6c69 6e65 2069 correct..line i │ │ │ -000a44b0: 6e20 7069 7865 6c73 2c20 6265 796f 6e64 n pixels, beyond │ │ │ -000a44c0: 2077 6869 6368 2074 6865 2070 6f69 6e74 which the point │ │ │ -000a44d0: 2069 7320 636f 6e73 6964 6572 6564 2061 is considered a │ │ │ -000a44e0: 6e20 6f75 746c 6965 7220 616e 6420 6973 n outlier and is │ │ │ -000a44f0: 206e 6f74 2075 7365 6420 666f 7220 636f not used for co │ │ │ -000a4500: 6d70 7574 696e 6720 7468 650a 6669 6e61 mputing the.fina │ │ │ -000a4510: 6c20 6675 6e64 616d 656e 7461 6c20 6d61 l fundamental ma │ │ │ -000a4520: 7472 6978 2e20 4974 2063 616e 2062 6520 trix. It can be │ │ │ -000a4530: 7365 7420 746f 2073 6f6d 6574 6869 6e67 set to something │ │ │ -000a4540: 206c 696b 6520 312d 332c 2064 6570 656e like 1-3, depen │ │ │ -000a4550: 6469 6e67 206f 6e20 7468 6520 6163 6375 ding on the accu │ │ │ -000a4560: 7261 6379 206f 6620 7468 650a 706f 696e racy of the.poin │ │ │ -000a4570: 7420 6c6f 6361 6c69 7a61 7469 6f6e 2c20 t localization, │ │ │ -000a4580: 696d 6167 6520 7265 736f 6c75 7469 6f6e image resolution │ │ │ -000a4590: 2c20 616e 6420 7468 6520 696d 6167 6520 , and the image │ │ │ -000a45a0: 6e6f 6973 652e 0a69 6e6c 6965 7273 2069 noise..inliers i │ │ │ -000a45b0: 6e20 706f 696e 7473 3120 616e 6420 706f n points1 and po │ │ │ -000a45c0: 696e 7473 3220 666f 7220 7468 6520 6769 ints2 for the gi │ │ │ -000a45d0: 7665 6e20 6573 7365 6e74 6961 6c20 6d61 ven essential ma │ │ │ -000a45e0: 7472 6978 2045 2e20 4f6e 6c79 2074 6865 trix E. Only the │ │ │ -000a45f0: 7365 2069 6e6c 6965 7273 2077 696c 6c20 se inliers will │ │ │ -000a4600: 6265 2075 7365 6420 746f 0a72 6563 6f76 be used to.recov │ │ │ -000a4610: 6572 2070 6f73 652e 2049 6e20 7468 6520 er pose. In the │ │ │ -000a4620: 6f75 7470 7574 206d 6173 6b20 6f6e 6c79 output mask only │ │ │ -000a4630: 2069 6e6c 6965 7273 2077 6869 6368 2070 inliers which p │ │ │ -000a4640: 6173 7320 7468 6520 6368 6972 616c 6974 ass the chiralit │ │ │ -000a4650: 7920 6368 6563 6b2e 0a0a 5468 6973 2066 y check...This f │ │ │ -000a4660: 756e 6374 696f 6e20 6465 636f 6d70 6f73 unction decompos │ │ │ -000a4670: 6573 2061 6e20 6573 7365 6e74 6961 6c20 es an essential │ │ │ -000a4680: 6d61 7472 6978 2075 7369 6e67 2052 4546 matrix using REF │ │ │ -000a4690: 3a20 6465 636f 6d70 6f73 6545 7373 656e : decomposeEssen │ │ │ -000a46a0: 7469 616c 4d61 7420 616e 6420 7468 656e tialMat and then │ │ │ -000a46b0: 2076 6572 6966 6965 730a 706f 7373 6962 verifies.possib │ │ │ -000a46c0: 6c65 2070 6f73 6520 6879 706f 7468 6573 le pose hypothes │ │ │ -000a46d0: 6573 2062 7920 646f 696e 6720 6368 6972 es by doing chir │ │ │ -000a46e0: 616c 6974 7920 6368 6563 6b2e 2054 6865 ality check. The │ │ │ -000a46f0: 2063 6869 7261 6c69 7479 2063 6865 636b chirality check │ │ │ -000a4700: 206d 6561 6e73 2074 6861 7420 7468 650a means that the. │ │ │ -000a4710: 7472 6961 6e67 756c 6174 6564 2033 4420 triangulated 3D │ │ │ -000a4720: 706f 696e 7473 2073 686f 756c 6420 6861 points should ha │ │ │ -000a4730: 7665 2070 6f73 6974 6976 6520 6465 7074 ve positive dept │ │ │ -000a4740: 682e 2053 6f6d 6520 6465 7461 696c 7320 h. Some details │ │ │ -000a4750: 6361 6e20 6265 2066 6f75 6e64 2069 6e20 can be found in │ │ │ -000a4760: 4349 5445 3a20 4e69 7374 6572 3033 2e0a CITE: Nister03.. │ │ │ -000a4770: 0a54 6869 7320 6675 6e63 7469 6f6e 2063 .This function c │ │ │ -000a4780: 616e 2062 6520 7573 6564 2074 6f20 7072 an be used to pr │ │ │ -000a4790: 6f63 6573 7320 7468 6520 6f75 7470 7574 ocess the output │ │ │ -000a47a0: 2045 2061 6e64 206d 6173 6b20 6672 6f6d E and mask from │ │ │ -000a47b0: 2052 4546 3a20 6669 6e64 4573 7365 6e74 REF: findEssent │ │ │ -000a47c0: 6961 6c4d 6174 2e20 496e 2074 6869 730a ialMat. In this. │ │ │ -000a47d0: 7363 656e 6172 696f 2c20 706f 696e 7473 scenario, points │ │ │ -000a47e0: 3120 616e 6420 706f 696e 7473 3220 6172 1 and points2 ar │ │ │ -000a47f0: 6520 7468 6520 7361 6d65 2069 6e70 7574 e the same input │ │ │ -000a4800: 2066 6f72 2066 696e 6445 7373 656e 7469 for findEssenti │ │ │ -000a4810: 616c 4d61 742e 3a0a 3c63 6f64 653e 0a20 alMat.:.. │ │ │ -000a4820: 2020 202f 2f20 4578 616d 706c 652e 2045 // Example. E │ │ │ -000a4830: 7374 696d 6174 696f 6e20 6f66 2066 756e stimation of fun │ │ │ -000a4840: 6461 6d65 6e74 616c 206d 6174 7269 7820 damental matrix │ │ │ -000a4850: 7573 696e 6720 7468 6520 5241 4e53 4143 using the RANSAC │ │ │ -000a4860: 2061 6c67 6f72 6974 686d 0a20 2020 2069 algorithm. i │ │ │ -000a4870: 6e74 2070 6f69 6e74 5f63 6f75 6e74 203d nt point_count = │ │ │ -000a4880: 2031 3030 3b0a 2020 2020 7665 6374 6f72 100;. vector │ │ │ -000a4890: 266c 743b 506f 696e 7432 6626 6774 3b20 <Point2f> │ │ │ -000a48a0: 706f 696e 7473 3128 706f 696e 745f 636f points1(point_co │ │ │ -000a48b0: 756e 7429 3b0a 2020 2020 7665 6374 6f72 unt);. vector │ │ │ -000a48c0: 266c 743b 506f 696e 7432 6626 6774 3b20 <Point2f> │ │ │ -000a48d0: 706f 696e 7473 3228 706f 696e 745f 636f points2(point_co │ │ │ -000a48e0: 756e 7429 3b0a 0a20 2020 202f 2f20 696e unt);.. // in │ │ │ -000a48f0: 6974 6961 6c69 7a65 2074 6865 2070 6f69 itialize the poi │ │ │ -000a4900: 6e74 7320 6865 7265 202e 2e2e 0a20 2020 nts here .... │ │ │ -000a4910: 2066 6f72 2820 696e 7420 6920 3d20 303b for( int i = 0; │ │ │ -000a4920: 2069 2026 6c74 3b20 706f 696e 745f 636f i < point_co │ │ │ -000a4930: 756e 743b 2069 2b2b 2029 0a20 2020 207b unt; i++ ). { │ │ │ -000a4940: 0a20 2020 2020 2020 2070 6f69 6e74 7331 . points1 │ │ │ -000a4950: 5b69 5d20 3d20 2e2e 2e3b 0a20 2020 2020 [i] = ...;. │ │ │ -000a4960: 2020 2070 6f69 6e74 7332 5b69 5d20 3d20 points2[i] = │ │ │ -000a4970: 2e2e 2e3b 0a20 2020 207d 0a0a 2020 2020 ...;. }.. │ │ │ -000a4980: 2f2f 2049 6e70 7574 3a20 6361 6d65 7261 // Input: camera │ │ │ -000a4990: 2063 616c 6962 7261 7469 6f6e 206f 6620 calibration of │ │ │ -000a49a0: 626f 7468 2063 616d 6572 6173 2c20 666f both cameras, fo │ │ │ -000a49b0: 7220 6578 616d 706c 6520 7573 696e 6720 r example using │ │ │ -000a49c0: 696e 7472 696e 7369 6320 6368 6573 7362 intrinsic chessb │ │ │ -000a49d0: 6f61 7264 2063 616c 6962 7261 7469 6f6e oard calibration │ │ │ -000a49e0: 2e0a 2020 2020 4d61 7420 6361 6d65 7261 .. Mat camera │ │ │ -000a49f0: 4d61 7472 6978 312c 2064 6973 7443 6f65 Matrix1, distCoe │ │ │ -000a4a00: 6666 7331 2c20 6361 6d65 7261 4d61 7472 ffs1, cameraMatr │ │ │ -000a4a10: 6978 322c 2064 6973 7443 6f65 6666 7332 ix2, distCoeffs2 │ │ │ -000a4a20: 3b0a 0a20 2020 202f 2f20 4f75 7470 7574 ;.. // Output │ │ │ -000a4a30: 3a20 4573 7365 6e74 6961 6c20 6d61 7472 : Essential matr │ │ │ -000a4a40: 6978 2c20 7265 6c61 7469 7665 2072 6f74 ix, relative rot │ │ │ -000a4a50: 6174 696f 6e20 616e 6420 7265 6c61 7469 ation and relati │ │ │ -000a4a60: 7665 2074 7261 6e73 6c61 7469 6f6e 2e0a ve translation.. │ │ │ -000a4a70: 2020 2020 4d61 7420 452c 2052 2c20 742c Mat E, R, t, │ │ │ -000a4a80: 206d 6173 6b3b 0a0a 2020 2020 7265 636f mask;.. reco │ │ │ -000a4a90: 7665 7250 6f73 6528 706f 696e 7473 312c verPose(points1, │ │ │ -000a4aa0: 2070 6f69 6e74 7332 2c20 6361 6d65 7261 points2, camera │ │ │ -000a4ab0: 4d61 7472 6978 312c 2064 6973 7443 6f65 Matrix1, distCoe │ │ │ -000a4ac0: 6666 7331 2c20 6361 6d65 7261 4d61 7472 ffs1, cameraMatr │ │ │ -000a4ad0: 6978 322c 2064 6973 7443 6f65 6666 7332 ix2, distCoeffs2 │ │ │ -000a4ae0: 2c20 452c 2052 2c20 742c 206d 6173 6b29 , E, R, t, mask) │ │ │ -000a4af0: 3b0a 3c2f 636f 6465 3e3c 2f64 643e 0a3c ;.
    .< │ │ │ -000a4b00: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ -000a4b10: 0a3c 6464 3e61 7574 6f6d 6174 6963 616c .
    automatical │ │ │ -000a4b20: 6c79 2067 656e 6572 6174 6564 3c2f 6464 ly generated
    .
    .
    .< │ │ │ -000a4b40: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ -000a4b50: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    │ │ │ -000a4c10: 7265 636f 7665 7250 6f73 653c 2f68 333e recoverPose

    │ │ │ -000a4c20: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ -000a4c40: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ -000a4c60: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ -000a4c70: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ -000a4c80: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ -000a4c90: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;int recoverPos │ │ │ -000a4ce0: 653c 2f73 7061 6e3e 3c77 6272 3e3c 7370 e(Mat  │ │ │ -000a4d50: 452c 0a20 3c61 2068 7265 663d 222e 2e2f E,. │ │ │ -000a4d90: 4d61 743c 2f61 3e26 6e62 7370 3b70 6f69 Mat poi │ │ │ -000a4da0: 6e74 7331 2c0a 203c 6120 6872 6566 3d22 nts1,. Mat  │ │ │ -000a4df0: 706f 696e 7473 322c 0a20 3c61 2068 7265 points2,. Mat&nb │ │ │ -000a4e40: 7370 3b63 616d 6572 614d 6174 7269 782c sp;cameraMatrix, │ │ │ -000a4e50: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000a4e90: 743c 2f61 3e26 6e62 7370 3b52 2c0a 203c t R,. < │ │ │ -000a4ea0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000a4eb0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000a4ec0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000a4ed0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat t,. Mat& │ │ │ -000a4f30: 6e62 7370 3b6d 6173 6b29 3c2f 7370 616e nbsp;mask)
    .
    Recov │ │ │ -000a4f60: 6572 7320 7468 6520 7265 6c61 7469 7665 ers the relative │ │ │ -000a4f70: 2063 616d 6572 6120 726f 7461 7469 6f6e camera rotation │ │ │ -000a4f80: 2061 6e64 2074 6865 2074 7261 6e73 6c61 and the transla │ │ │ -000a4f90: 7469 6f6e 2066 726f 6d20 616e 2065 7374 tion from an est │ │ │ -000a4fa0: 696d 6174 6564 2065 7373 656e 7469 616c imated essential │ │ │ -000a4fb0: 0a6d 6174 7269 7820 616e 6420 7468 6520 .matrix and the │ │ │ -000a4fc0: 636f 7272 6573 706f 6e64 696e 6720 706f corresponding po │ │ │ -000a4fd0: 696e 7473 2069 6e20 7477 6f20 696d 6167 ints in two imag │ │ │ -000a4fe0: 6573 2c20 7573 696e 6720 6368 6972 616c es, using chiral │ │ │ -000a4ff0: 6974 7920 6368 6563 6b2e 2052 6574 7572 ity check. Retur │ │ │ -000a5000: 6e73 2074 6865 206e 756d 6265 7220 6f66 ns the number of │ │ │ -000a5010: 0a69 6e6c 6965 7273 2074 6861 7420 7061 .inliers that pa │ │ │ -000a5020: 7373 2074 6865 2063 6865 636b 2e3c 2f64 ss the check..
    .
    Param │ │ │ -000a5050: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ -000a5060: 3c63 6f64 653e 453c 2f63 6f64 653e 202d E - │ │ │ -000a5070: 2054 6865 2069 6e70 7574 2065 7373 656e The input essen │ │ │ -000a5080: 7469 616c 206d 6174 7269 782e 3c2f 6464 tial matrix.
    .
    poin │ │ │ -000a50a0: 7473 313c 2f63 6f64 653e 202d 2041 7272 ts1 - Arr │ │ │ -000a50b0: 6179 206f 6620 4e20 3244 2070 6f69 6e74 ay of N 2D point │ │ │ -000a50c0: 7320 6672 6f6d 2074 6865 2066 6972 7374 s from the first │ │ │ -000a50d0: 2069 6d61 6765 2e20 5468 6520 706f 696e image. The poin │ │ │ -000a50e0: 7420 636f 6f72 6469 6e61 7465 7320 7368 t coordinates sh │ │ │ -000a50f0: 6f75 6c64 2062 650a 666c 6f61 7469 6e67 ould be.floating │ │ │ -000a5100: 2d70 6f69 6e74 2028 7369 6e67 6c65 206f -point (single o │ │ │ -000a5110: 7220 646f 7562 6c65 2070 7265 6369 7369 r double precisi │ │ │ -000a5120: 6f6e 292e 3c2f 6464 3e0a 3c64 643e 3c63 on).
    .
    points2 - Array of th │ │ │ -000a5150: 6520 7365 636f 6e64 2069 6d61 6765 2070 e second image p │ │ │ -000a5160: 6f69 6e74 7320 6f66 2074 6865 2073 616d oints of the sam │ │ │ -000a5170: 6520 7369 7a65 2061 6e64 2066 6f72 6d61 e size and forma │ │ │ -000a5180: 7420 6173 2070 6f69 6e74 7331 202e 3c2f t as points1 ..
    ca │ │ │ -000a51a0: 6d65 7261 4d61 7472 6978 3c2f 636f 6465 meraMatrix - Camera intri │ │ │ -000a51c0: 6e73 6963 206d 6174 7269 7820 5c28 5c63 nsic matrix \(\c │ │ │ -000a51d0: 616d 6572 616d 6174 7269 787b 417d 5c29 ameramatrix{A}\) │ │ │ -000a51e0: 202e 0a4e 6f74 6520 7468 6174 2074 6869 ..Note that thi │ │ │ -000a51f0: 7320 6675 6e63 7469 6f6e 2061 7373 756d s function assum │ │ │ -000a5200: 6573 2074 6861 7420 706f 696e 7473 3120 es that points1 │ │ │ -000a5210: 616e 6420 706f 696e 7473 3220 6172 6520 and points2 are │ │ │ -000a5220: 6665 6174 7572 6520 706f 696e 7473 2066 feature points f │ │ │ -000a5230: 726f 6d20 6361 6d65 7261 7320 7769 7468 rom cameras with │ │ │ -000a5240: 2074 6865 0a73 616d 6520 6361 6d65 7261 the.same camera │ │ │ -000a5250: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ -000a5260: 782e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 x.
    .
    R - Out │ │ │ -000a5280: 7075 7420 726f 7461 7469 6f6e 206d 6174 put rotation mat │ │ │ -000a5290: 7269 782e 2054 6f67 6574 6865 7220 7769 rix. Together wi │ │ │ -000a52a0: 7468 2074 6865 2074 7261 6e73 6c61 7469 th the translati │ │ │ -000a52b0: 6f6e 2076 6563 746f 722c 2074 6869 7320 on vector, this │ │ │ -000a52c0: 6d61 7472 6978 206d 616b 6573 2075 7020 matrix makes up │ │ │ -000a52d0: 6120 7475 706c 650a 7468 6174 2070 6572 a tuple.that per │ │ │ -000a52e0: 666f 726d 7320 6120 6368 616e 6765 206f forms a change o │ │ │ -000a52f0: 6620 6261 7369 7320 6672 6f6d 2074 6865 f basis from the │ │ │ -000a5300: 2066 6972 7374 2063 616d 6572 6127 7320 first camera's │ │ │ -000a5310: 636f 6f72 6469 6e61 7465 2073 7973 7465 coordinate syste │ │ │ -000a5320: 6d20 746f 2074 6865 2073 6563 6f6e 6420 m to the second │ │ │ -000a5330: 6361 6d65 7261 2773 0a63 6f6f 7264 696e camera's.coordin │ │ │ -000a5340: 6174 6520 7379 7374 656d 2e20 4e6f 7465 ate system. Note │ │ │ -000a5350: 2074 6861 742c 2069 6e20 6765 6e65 7261 that, in genera │ │ │ -000a5360: 6c2c 2074 2063 616e 206e 6f74 2062 6520 l, t can not be │ │ │ -000a5370: 7573 6564 2066 6f72 2074 6869 7320 7475 used for this tu │ │ │ -000a5380: 706c 652c 2073 6565 2074 6865 2070 6172 ple, see the par │ │ │ -000a5390: 616d 6574 6572 0a64 6573 6372 6962 6564 ameter.described │ │ │ -000a53a0: 2062 656c 6f77 2e3c 2f64 643e 0a3c 6464 below.
    .
    t │ │ │ -000a53c0: 2d20 4f75 7470 7574 2074 7261 6e73 6c61 - Output transla │ │ │ -000a53d0: 7469 6f6e 2076 6563 746f 722e 2054 6869 tion vector. Thi │ │ │ -000a53e0: 7320 7665 6374 6f72 2069 7320 6f62 7461 s vector is obta │ │ │ -000a53f0: 696e 6564 2062 7920 5245 463a 2064 6563 ined by REF: dec │ │ │ -000a5400: 6f6d 706f 7365 4573 7365 6e74 6961 6c4d omposeEssentialM │ │ │ -000a5410: 6174 2061 6e64 0a74 6865 7265 666f 7265 at and.therefore │ │ │ -000a5420: 2069 7320 6f6e 6c79 206b 6e6f 776e 2075 is only known u │ │ │ -000a5430: 7020 746f 2073 6361 6c65 2c20 692e 652e p to scale, i.e. │ │ │ -000a5440: 2074 2069 7320 7468 6520 6469 7265 6374 t is the direct │ │ │ -000a5450: 696f 6e20 6f66 2074 6865 2074 7261 6e73 ion of the trans │ │ │ -000a5460: 6c61 7469 6f6e 2076 6563 746f 7220 616e lation vector an │ │ │ -000a5470: 6420 6861 7320 756e 6974 0a6c 656e 6774 d has unit.lengt │ │ │ -000a5480: 682e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 h.
    .
    mask - │ │ │ -000a54a0: 496e 7075 742f 6f75 7470 7574 206d 6173 Input/output mas │ │ │ -000a54b0: 6b20 666f 7220 696e 6c69 6572 7320 696e k for inliers in │ │ │ -000a54c0: 2070 6f69 6e74 7331 2061 6e64 2070 6f69 points1 and poi │ │ │ -000a54d0: 6e74 7332 2e20 4966 2069 7420 6973 206e nts2. If it is n │ │ │ -000a54e0: 6f74 2065 6d70 7479 2c20 7468 656e 2069 ot empty, then i │ │ │ -000a54f0: 7420 6d61 726b 730a 696e 6c69 6572 7320 t marks.inliers │ │ │ -000a5500: 696e 2070 6f69 6e74 7331 2061 6e64 2070 in points1 and p │ │ │ -000a5510: 6f69 6e74 7332 2066 6f72 2074 6865 2067 oints2 for the g │ │ │ -000a5520: 6976 656e 2065 7373 656e 7469 616c 206d iven essential m │ │ │ -000a5530: 6174 7269 7820 452e 204f 6e6c 7920 7468 atrix E. Only th │ │ │ -000a5540: 6573 6520 696e 6c69 6572 7320 7769 6c6c ese inliers will │ │ │ -000a5550: 2062 6520 7573 6564 2074 6f0a 7265 636f be used to.reco │ │ │ -000a5560: 7665 7220 706f 7365 2e20 496e 2074 6865 ver pose. In the │ │ │ -000a5570: 206f 7574 7075 7420 6d61 736b 206f 6e6c output mask onl │ │ │ -000a5580: 7920 696e 6c69 6572 7320 7768 6963 6820 y inliers which │ │ │ -000a5590: 7061 7373 2074 6865 2063 6869 7261 6c69 pass the chirali │ │ │ -000a55a0: 7479 2063 6865 636b 2e0a 0a54 6869 7320 ty check...This │ │ │ -000a55b0: 6675 6e63 7469 6f6e 2064 6563 6f6d 706f function decompo │ │ │ -000a55c0: 7365 7320 616e 2065 7373 656e 7469 616c ses an essential │ │ │ -000a55d0: 206d 6174 7269 7820 7573 696e 6720 5245 matrix using RE │ │ │ -000a55e0: 463a 2064 6563 6f6d 706f 7365 4573 7365 F: decomposeEsse │ │ │ -000a55f0: 6e74 6961 6c4d 6174 2061 6e64 2074 6865 ntialMat and the │ │ │ -000a5600: 6e20 7665 7269 6669 6573 0a70 6f73 7369 n verifies.possi │ │ │ -000a5610: 626c 6520 706f 7365 2068 7970 6f74 6865 ble pose hypothe │ │ │ -000a5620: 7365 7320 6279 2064 6f69 6e67 2063 6869 ses by doing chi │ │ │ -000a5630: 7261 6c69 7479 2063 6865 636b 2e20 5468 rality check. Th │ │ │ -000a5640: 6520 6368 6972 616c 6974 7920 6368 6563 e chirality chec │ │ │ -000a5650: 6b20 6d65 616e 7320 7468 6174 2074 6865 k means that the │ │ │ -000a5660: 0a74 7269 616e 6775 6c61 7465 6420 3344 .triangulated 3D │ │ │ -000a5670: 2070 6f69 6e74 7320 7368 6f75 6c64 2068 points should h │ │ │ -000a5680: 6176 6520 706f 7369 7469 7665 2064 6570 ave positive dep │ │ │ -000a5690: 7468 2e20 536f 6d65 2064 6574 6169 6c73 th. Some details │ │ │ -000a56a0: 2063 616e 2062 6520 666f 756e 6420 696e can be found in │ │ │ -000a56b0: 2043 4954 453a 204e 6973 7465 7230 332e CITE: Nister03. │ │ │ -000a56c0: 0a0a 5468 6973 2066 756e 6374 696f 6e20 ..This function │ │ │ -000a56d0: 6361 6e20 6265 2075 7365 6420 746f 2070 can be used to p │ │ │ -000a56e0: 726f 6365 7373 2074 6865 206f 7574 7075 rocess the outpu │ │ │ -000a56f0: 7420 4520 616e 6420 6d61 736b 2066 726f t E and mask fro │ │ │ -000a5700: 6d20 5245 463a 2066 696e 6445 7373 656e m REF: findEssen │ │ │ -000a5710: 7469 616c 4d61 742e 2049 6e20 7468 6973 tialMat. In this │ │ │ -000a5720: 0a73 6365 6e61 7269 6f2c 2070 6f69 6e74 .scenario, point │ │ │ -000a5730: 7331 2061 6e64 2070 6f69 6e74 7332 2061 s1 and points2 a │ │ │ -000a5740: 7265 2074 6865 2073 616d 6520 696e 7075 re the same inpu │ │ │ -000a5750: 7420 666f 7220 2366 696e 6445 7373 656e t for #findEssen │ │ │ -000a5760: 7469 616c 4d61 7420 3a0a 3c63 6f64 653e tialMat :. │ │ │ -000a5770: 0a20 2020 202f 2f20 4578 616d 706c 652e . // Example. │ │ │ -000a5780: 2045 7374 696d 6174 696f 6e20 6f66 2066 Estimation of f │ │ │ -000a5790: 756e 6461 6d65 6e74 616c 206d 6174 7269 undamental matri │ │ │ -000a57a0: 7820 7573 696e 6720 7468 6520 5241 4e53 x using the RANS │ │ │ -000a57b0: 4143 2061 6c67 6f72 6974 686d 0a20 2020 AC algorithm. │ │ │ -000a57c0: 2069 6e74 2070 6f69 6e74 5f63 6f75 6e74 int point_count │ │ │ -000a57d0: 203d 2031 3030 3b0a 2020 2020 7665 6374 = 100;. vect │ │ │ -000a57e0: 6f72 266c 743b 506f 696e 7432 6626 6774 or<Point2f> │ │ │ -000a57f0: 3b20 706f 696e 7473 3128 706f 696e 745f ; points1(point_ │ │ │ -000a5800: 636f 756e 7429 3b0a 2020 2020 7665 6374 count);. vect │ │ │ -000a5810: 6f72 266c 743b 506f 696e 7432 6626 6774 or<Point2f> │ │ │ -000a5820: 3b20 706f 696e 7473 3228 706f 696e 745f ; points2(point_ │ │ │ -000a5830: 636f 756e 7429 3b0a 0a20 2020 202f 2f20 count);.. // │ │ │ -000a5840: 696e 6974 6961 6c69 7a65 2074 6865 2070 initialize the p │ │ │ -000a5850: 6f69 6e74 7320 6865 7265 202e 2e2e 0a20 oints here .... │ │ │ -000a5860: 2020 2066 6f72 2820 696e 7420 6920 3d20 for( int i = │ │ │ -000a5870: 303b 2069 2026 6c74 3b20 706f 696e 745f 0; i < point_ │ │ │ -000a5880: 636f 756e 743b 2069 2b2b 2029 0a20 2020 count; i++ ). │ │ │ -000a5890: 207b 0a20 2020 2020 2020 2070 6f69 6e74 {. point │ │ │ -000a58a0: 7331 5b69 5d20 3d20 2e2e 2e3b 0a20 2020 s1[i] = ...;. │ │ │ -000a58b0: 2020 2020 2070 6f69 6e74 7332 5b69 5d20 points2[i] │ │ │ -000a58c0: 3d20 2e2e 2e3b 0a20 2020 207d 0a0a 2020 = ...;. }.. │ │ │ -000a58d0: 2020 2f2f 2063 616d 6574 7261 206d 6174 // cametra mat │ │ │ -000a58e0: 7269 7820 7769 7468 2062 6f74 6820 666f rix with both fo │ │ │ -000a58f0: 6361 6c20 6c65 6e67 7468 7320 3d20 312c cal lengths = 1, │ │ │ -000a5900: 2061 6e64 2070 7269 6e63 6970 616c 2070 and principal p │ │ │ -000a5910: 6f69 6e74 203d 2028 302c 2030 290a 2020 oint = (0, 0). │ │ │ -000a5920: 2020 4d61 7420 6361 6d65 7261 4d61 7472 Mat cameraMatr │ │ │ -000a5930: 6978 203d 204d 6174 3a3a 6579 6528 332c ix = Mat::eye(3, │ │ │ -000a5940: 2033 2c20 4356 5f36 3446 293b 0a0a 2020 3, CV_64F);.. │ │ │ -000a5950: 2020 4d61 7420 452c 2052 2c20 742c 206d Mat E, R, t, m │ │ │ -000a5960: 6173 6b3b 0a0a 2020 2020 4520 3d20 6669 ask;.. E = fi │ │ │ -000a5970: 6e64 4573 7365 6e74 6961 6c4d 6174 2870 ndEssentialMat(p │ │ │ -000a5980: 6f69 6e74 7331 2c20 706f 696e 7473 322c oints1, points2, │ │ │ -000a5990: 2063 616d 6572 614d 6174 7269 782c 2052 cameraMatrix, R │ │ │ -000a59a0: 414e 5341 432c 2030 2e39 3939 2c20 312e ANSAC, 0.999, 1. │ │ │ -000a59b0: 302c 206d 6173 6b29 3b0a 2020 2020 7265 0, mask);. re │ │ │ -000a59c0: 636f 7665 7250 6f73 6528 452c 2070 6f69 coverPose(E, poi │ │ │ -000a59d0: 6e74 7331 2c20 706f 696e 7473 322c 2063 nts1, points2, c │ │ │ -000a59e0: 616d 6572 614d 6174 7269 782c 2052 2c20 ameraMatrix, R, │ │ │ -000a59f0: 742c 206d 6173 6b29 3b0a 3c2f 636f 6465 t, mask);.
    .
    Retur │ │ │ -000a5a10: 6e73 3a3c 2f64 743e 0a3c 6464 3e61 7574 ns:
    .
    aut │ │ │ -000a5a20: 6f6d 6174 6963 616c 6c79 2067 656e 6572 omatically gener │ │ │ -000a5a30: 6174 6564 3c2f 6464 3e0a 3c2f 646c 3e0a ated
    .
    . │ │ │ -000a5a40: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e
    .
    .
  • .
  • .. │ │ │ -000a5b00: 3c68 333e 7265 636f 7665 7250 6f73 653c

    recoverPose< │ │ │ -000a5b10: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -000a5b70: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -000a5b80: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;i │ │ │ -000a5ba0: 6e74 3c2f 7370 616e 3e26 6e62 7370 3b3c nt < │ │ │ -000a5bb0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ -000a5bc0: 656e 742d 6e61 6d65 223e 7265 636f 7665 ent-name">recove │ │ │ -000a5bd0: 7250 6f73 653c 2f73 7061 6e3e 3c77 6272 rPose(Mat&n │ │ │ -000a5c40: 6273 703b 452c 0a20 3c61 2068 7265 663d bsp;E,. Mat  │ │ │ -000a5c90: 3b70 6f69 6e74 7331 2c0a 203c 6120 6872 ;points1,. Mat&n │ │ │ -000a5ce0: 6273 703b 706f 696e 7473 322c 0a20 3c61 bsp;points2,. Mat cameraMat │ │ │ -000a5d40: 7269 782c 0a20 3c61 2068 7265 663d 222e rix,. Mat R │ │ │ -000a5d90: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000a5dd0: 6174 3c2f 613e 266e 6273 703b 7429 3c2f at t)
    .
    R │ │ │ -000a5e00: 6563 6f76 6572 7320 7468 6520 7265 6c61 ecovers the rela │ │ │ -000a5e10: 7469 7665 2063 616d 6572 6120 726f 7461 tive camera rota │ │ │ -000a5e20: 7469 6f6e 2061 6e64 2074 6865 2074 7261 tion and the tra │ │ │ -000a5e30: 6e73 6c61 7469 6f6e 2066 726f 6d20 616e nslation from an │ │ │ -000a5e40: 2065 7374 696d 6174 6564 2065 7373 656e estimated essen │ │ │ -000a5e50: 7469 616c 0a6d 6174 7269 7820 616e 6420 tial.matrix and │ │ │ -000a5e60: 7468 6520 636f 7272 6573 706f 6e64 696e the correspondin │ │ │ -000a5e70: 6720 706f 696e 7473 2069 6e20 7477 6f20 g points in two │ │ │ -000a5e80: 696d 6167 6573 2c20 7573 696e 6720 6368 images, using ch │ │ │ -000a5e90: 6972 616c 6974 7920 6368 6563 6b2e 2052 irality check. R │ │ │ -000a5ea0: 6574 7572 6e73 2074 6865 206e 756d 6265 eturns the numbe │ │ │ -000a5eb0: 7220 6f66 0a69 6e6c 6965 7273 2074 6861 r of.inliers tha │ │ │ -000a5ec0: 7420 7061 7373 2074 6865 2063 6865 636b t pass the check │ │ │ -000a5ed0: 2e3c 2f64 6976 3e0a 3c64 6c20 636c 6173 .
    .
    .
    P │ │ │ -000a5ef0: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ -000a5f00: 3c64 643e 3c63 6f64 653e 453c 2f63 6f64
    E - The input e │ │ │ -000a5f20: 7373 656e 7469 616c 206d 6174 7269 782e ssential matrix. │ │ │ -000a5f30: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000a5f40: 706f 696e 7473 313c 2f63 6f64 653e 202d points1 - │ │ │ -000a5f50: 2041 7272 6179 206f 6620 4e20 3244 2070 Array of N 2D p │ │ │ -000a5f60: 6f69 6e74 7320 6672 6f6d 2074 6865 2066 oints from the f │ │ │ -000a5f70: 6972 7374 2069 6d61 6765 2e20 5468 6520 irst image. The │ │ │ -000a5f80: 706f 696e 7420 636f 6f72 6469 6e61 7465 point coordinate │ │ │ -000a5f90: 7320 7368 6f75 6c64 2062 650a 666c 6f61 s should be.floa │ │ │ -000a5fa0: 7469 6e67 2d70 6f69 6e74 2028 7369 6e67 ting-point (sing │ │ │ -000a5fb0: 6c65 206f 7220 646f 7562 6c65 2070 7265 le or double pre │ │ │ -000a5fc0: 6369 7369 6f6e 292e 3c2f 6464 3e0a 3c64 cision).
    .points2< │ │ │ -000a5fe0: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ -000a5ff0: 6620 7468 6520 7365 636f 6e64 2069 6d61 f the second ima │ │ │ -000a6000: 6765 2070 6f69 6e74 7320 6f66 2074 6865 ge points of the │ │ │ -000a6010: 2073 616d 6520 7369 7a65 2061 6e64 2066 same size and f │ │ │ -000a6020: 6f72 6d61 7420 6173 2070 6f69 6e74 7331 ormat as points1 │ │ │ -000a6030: 202e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 ..
    cameraMatrix - Camera i │ │ │ -000a6060: 6e74 7269 6e73 6963 206d 6174 7269 7820 ntrinsic matrix │ │ │ -000a6070: 5c28 5c63 616d 6572 616d 6174 7269 787b \(\cameramatrix{ │ │ │ -000a6080: 417d 5c29 202e 0a4e 6f74 6520 7468 6174 A}\) ..Note that │ │ │ -000a6090: 2074 6869 7320 6675 6e63 7469 6f6e 2061 this function a │ │ │ -000a60a0: 7373 756d 6573 2074 6861 7420 706f 696e ssumes that poin │ │ │ -000a60b0: 7473 3120 616e 6420 706f 696e 7473 3220 ts1 and points2 │ │ │ -000a60c0: 6172 6520 6665 6174 7572 6520 706f 696e are feature poin │ │ │ -000a60d0: 7473 2066 726f 6d20 6361 6d65 7261 7320 ts from cameras │ │ │ -000a60e0: 7769 7468 2074 6865 0a73 616d 6520 6361 with the.same ca │ │ │ -000a60f0: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -000a6100: 6174 7269 782e 3c2f 6464 3e0a 3c64 643e atrix.
    .
    │ │ │ -000a6110: 3c63 6f64 653e 523c 2f63 6f64 653e 202d R - │ │ │ -000a6120: 204f 7574 7075 7420 726f 7461 7469 6f6e Output rotation │ │ │ -000a6130: 206d 6174 7269 782e 2054 6f67 6574 6865 matrix. Togethe │ │ │ -000a6140: 7220 7769 7468 2074 6865 2074 7261 6e73 r with the trans │ │ │ -000a6150: 6c61 7469 6f6e 2076 6563 746f 722c 2074 lation vector, t │ │ │ -000a6160: 6869 7320 6d61 7472 6978 206d 616b 6573 his matrix makes │ │ │ -000a6170: 2075 7020 6120 7475 706c 650a 7468 6174 up a tuple.that │ │ │ -000a6180: 2070 6572 666f 726d 7320 6120 6368 616e performs a chan │ │ │ -000a6190: 6765 206f 6620 6261 7369 7320 6672 6f6d ge of basis from │ │ │ -000a61a0: 2074 6865 2066 6972 7374 2063 616d 6572 the first camer │ │ │ -000a61b0: 6127 7320 636f 6f72 6469 6e61 7465 2073 a's coordinate s │ │ │ -000a61c0: 7973 7465 6d20 746f 2074 6865 2073 6563 ystem to the sec │ │ │ -000a61d0: 6f6e 6420 6361 6d65 7261 2773 0a63 6f6f ond camera's.coo │ │ │ -000a61e0: 7264 696e 6174 6520 7379 7374 656d 2e20 rdinate system. │ │ │ -000a61f0: 4e6f 7465 2074 6861 742c 2069 6e20 6765 Note that, in ge │ │ │ -000a6200: 6e65 7261 6c2c 2074 2063 616e 206e 6f74 neral, t can not │ │ │ -000a6210: 2062 6520 7573 6564 2066 6f72 2074 6869 be used for thi │ │ │ -000a6220: 7320 7475 706c 652c 2073 6565 2074 6865 s tuple, see the │ │ │ -000a6230: 2070 6172 616d 6574 6572 0a64 6573 6372 parameter.descr │ │ │ -000a6240: 6962 6564 2062 656c 6f77 2e3c 2f64 643e ibed below.
    │ │ │ -000a6250: 0a3c 6464 3e3c 636f 6465 3e74 3c2f 636f .
    t - Output tra │ │ │ -000a6270: 6e73 6c61 7469 6f6e 2076 6563 746f 722e nslation vector. │ │ │ -000a6280: 2054 6869 7320 7665 6374 6f72 2069 7320 This vector is │ │ │ -000a6290: 6f62 7461 696e 6564 2062 7920 5245 463a obtained by REF: │ │ │ -000a62a0: 2064 6563 6f6d 706f 7365 4573 7365 6e74 decomposeEssent │ │ │ -000a62b0: 6961 6c4d 6174 2061 6e64 0a74 6865 7265 ialMat and.there │ │ │ -000a62c0: 666f 7265 2069 7320 6f6e 6c79 206b 6e6f fore is only kno │ │ │ -000a62d0: 776e 2075 7020 746f 2073 6361 6c65 2c20 wn up to scale, │ │ │ -000a62e0: 692e 652e 2074 2069 7320 7468 6520 6469 i.e. t is the di │ │ │ -000a62f0: 7265 6374 696f 6e20 6f66 2074 6865 2074 rection of the t │ │ │ -000a6300: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ -000a6310: 7220 616e 6420 6861 7320 756e 6974 0a6c r and has unit.l │ │ │ -000a6320: 656e 6774 682e 0a69 6e6c 6965 7273 2069 ength..inliers i │ │ │ -000a6330: 6e20 706f 696e 7473 3120 616e 6420 706f n points1 and po │ │ │ -000a6340: 696e 7473 3220 666f 7220 7468 6520 6769 ints2 for the gi │ │ │ -000a6350: 7665 6e20 6573 7365 6e74 6961 6c20 6d61 ven essential ma │ │ │ -000a6360: 7472 6978 2045 2e20 4f6e 6c79 2074 6865 trix E. Only the │ │ │ -000a6370: 7365 2069 6e6c 6965 7273 2077 696c 6c20 se inliers will │ │ │ -000a6380: 6265 2075 7365 6420 746f 0a72 6563 6f76 be used to.recov │ │ │ -000a6390: 6572 2070 6f73 652e 2049 6e20 7468 6520 er pose. In the │ │ │ -000a63a0: 6f75 7470 7574 206d 6173 6b20 6f6e 6c79 output mask only │ │ │ -000a63b0: 2069 6e6c 6965 7273 2077 6869 6368 2070 inliers which p │ │ │ -000a63c0: 6173 7320 7468 6520 6368 6972 616c 6974 ass the chiralit │ │ │ -000a63d0: 7920 6368 6563 6b2e 0a0a 5468 6973 2066 y check...This f │ │ │ -000a63e0: 756e 6374 696f 6e20 6465 636f 6d70 6f73 unction decompos │ │ │ -000a63f0: 6573 2061 6e20 6573 7365 6e74 6961 6c20 es an essential │ │ │ -000a6400: 6d61 7472 6978 2075 7369 6e67 2052 4546 matrix using REF │ │ │ -000a6410: 3a20 6465 636f 6d70 6f73 6545 7373 656e : decomposeEssen │ │ │ -000a6420: 7469 616c 4d61 7420 616e 6420 7468 656e tialMat and then │ │ │ -000a6430: 2076 6572 6966 6965 730a 706f 7373 6962 verifies.possib │ │ │ -000a6440: 6c65 2070 6f73 6520 6879 706f 7468 6573 le pose hypothes │ │ │ -000a6450: 6573 2062 7920 646f 696e 6720 6368 6972 es by doing chir │ │ │ -000a6460: 616c 6974 7920 6368 6563 6b2e 2054 6865 ality check. The │ │ │ -000a6470: 2063 6869 7261 6c69 7479 2063 6865 636b chirality check │ │ │ -000a6480: 206d 6561 6e73 2074 6861 7420 7468 650a means that the. │ │ │ -000a6490: 7472 6961 6e67 756c 6174 6564 2033 4420 triangulated 3D │ │ │ -000a64a0: 706f 696e 7473 2073 686f 756c 6420 6861 points should ha │ │ │ -000a64b0: 7665 2070 6f73 6974 6976 6520 6465 7074 ve positive dept │ │ │ -000a64c0: 682e 2053 6f6d 6520 6465 7461 696c 7320 h. Some details │ │ │ -000a64d0: 6361 6e20 6265 2066 6f75 6e64 2069 6e20 can be found in │ │ │ -000a64e0: 4349 5445 3a20 4e69 7374 6572 3033 2e0a CITE: Nister03.. │ │ │ -000a64f0: 0a54 6869 7320 6675 6e63 7469 6f6e 2063 .This function c │ │ │ -000a6500: 616e 2062 6520 7573 6564 2074 6f20 7072 an be used to pr │ │ │ -000a6510: 6f63 6573 7320 7468 6520 6f75 7470 7574 ocess the output │ │ │ -000a6520: 2045 2061 6e64 206d 6173 6b20 6672 6f6d E and mask from │ │ │ -000a6530: 2052 4546 3a20 6669 6e64 4573 7365 6e74 REF: findEssent │ │ │ -000a6540: 6961 6c4d 6174 2e20 496e 2074 6869 730a ialMat. In this. │ │ │ -000a6550: 7363 656e 6172 696f 2c20 706f 696e 7473 scenario, points │ │ │ -000a6560: 3120 616e 6420 706f 696e 7473 3220 6172 1 and points2 ar │ │ │ -000a6570: 6520 7468 6520 7361 6d65 2069 6e70 7574 e the same input │ │ │ -000a6580: 2066 6f72 2023 6669 6e64 4573 7365 6e74 for #findEssent │ │ │ -000a6590: 6961 6c4d 6174 203a 0a3c 636f 6465 3e0a ialMat :.. │ │ │ -000a65a0: 2020 2020 2f2f 2045 7861 6d70 6c65 2e20 // Example. │ │ │ -000a65b0: 4573 7469 6d61 7469 6f6e 206f 6620 6675 Estimation of fu │ │ │ -000a65c0: 6e64 616d 656e 7461 6c20 6d61 7472 6978 ndamental matrix │ │ │ -000a65d0: 2075 7369 6e67 2074 6865 2052 414e 5341 using the RANSA │ │ │ -000a65e0: 4320 616c 676f 7269 7468 6d0a 2020 2020 C algorithm. │ │ │ -000a65f0: 696e 7420 706f 696e 745f 636f 756e 7420 int point_count │ │ │ -000a6600: 3d20 3130 303b 0a20 2020 2076 6563 746f = 100;. vecto │ │ │ -000a6610: 7226 6c74 3b50 6f69 6e74 3266 2667 743b r<Point2f> │ │ │ -000a6620: 2070 6f69 6e74 7331 2870 6f69 6e74 5f63 points1(point_c │ │ │ -000a6630: 6f75 6e74 293b 0a20 2020 2076 6563 746f ount);. vecto │ │ │ -000a6640: 7226 6c74 3b50 6f69 6e74 3266 2667 743b r<Point2f> │ │ │ -000a6650: 2070 6f69 6e74 7332 2870 6f69 6e74 5f63 points2(point_c │ │ │ -000a6660: 6f75 6e74 293b 0a0a 2020 2020 2f2f 2069 ount);.. // i │ │ │ -000a6670: 6e69 7469 616c 697a 6520 7468 6520 706f nitialize the po │ │ │ -000a6680: 696e 7473 2068 6572 6520 2e2e 2e0a 2020 ints here .... │ │ │ -000a6690: 2020 666f 7228 2069 6e74 2069 203d 2030 for( int i = 0 │ │ │ -000a66a0: 3b20 6920 266c 743b 2070 6f69 6e74 5f63 ; i < point_c │ │ │ -000a66b0: 6f75 6e74 3b20 692b 2b20 290a 2020 2020 ount; i++ ). │ │ │ -000a66c0: 7b0a 2020 2020 2020 2020 706f 696e 7473 {. points │ │ │ -000a66d0: 315b 695d 203d 202e 2e2e 3b0a 2020 2020 1[i] = ...;. │ │ │ -000a66e0: 2020 2020 706f 696e 7473 325b 695d 203d points2[i] = │ │ │ -000a66f0: 202e 2e2e 3b0a 2020 2020 7d0a 0a20 2020 ...;. }.. │ │ │ -000a6700: 202f 2f20 6361 6d65 7472 6120 6d61 7472 // cametra matr │ │ │ -000a6710: 6978 2077 6974 6820 626f 7468 2066 6f63 ix with both foc │ │ │ -000a6720: 616c 206c 656e 6774 6873 203d 2031 2c20 al lengths = 1, │ │ │ -000a6730: 616e 6420 7072 696e 6369 7061 6c20 706f and principal po │ │ │ -000a6740: 696e 7420 3d20 2830 2c20 3029 0a20 2020 int = (0, 0). │ │ │ -000a6750: 204d 6174 2063 616d 6572 614d 6174 7269 Mat cameraMatri │ │ │ -000a6760: 7820 3d20 4d61 743a 3a65 7965 2833 2c20 x = Mat::eye(3, │ │ │ -000a6770: 332c 2043 565f 3634 4629 3b0a 0a20 2020 3, CV_64F);.. │ │ │ -000a6780: 204d 6174 2045 2c20 522c 2074 2c20 6d61 Mat E, R, t, ma │ │ │ -000a6790: 736b 3b0a 0a20 2020 2045 203d 2066 696e sk;.. E = fin │ │ │ -000a67a0: 6445 7373 656e 7469 616c 4d61 7428 706f dEssentialMat(po │ │ │ -000a67b0: 696e 7473 312c 2070 6f69 6e74 7332 2c20 ints1, points2, │ │ │ -000a67c0: 6361 6d65 7261 4d61 7472 6978 2c20 5241 cameraMatrix, RA │ │ │ -000a67d0: 4e53 4143 2c20 302e 3939 392c 2031 2e30 NSAC, 0.999, 1.0 │ │ │ -000a67e0: 2c20 6d61 736b 293b 0a20 2020 2072 6563 , mask);. rec │ │ │ -000a67f0: 6f76 6572 506f 7365 2845 2c20 706f 696e overPose(E, poin │ │ │ -000a6800: 7473 312c 2070 6f69 6e74 7332 2c20 6361 ts1, points2, ca │ │ │ -000a6810: 6d65 7261 4d61 7472 6978 2c20 522c 2074 meraMatrix, R, t │ │ │ -000a6820: 2c20 6d61 736b 293b 0a3c 2f63 6f64 653e , mask);. │ │ │ -000a6830: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ -000a6840: 733a 3c2f 6474 3e0a 3c64 643e 6175 746f s:
    .
    auto │ │ │ -000a6850: 6d61 7469 6361 6c6c 7920 6765 6e65 7261 matically genera │ │ │ -000a6860: 7465 643c 2f64 643e 0a3c 2f64 6c3e 0a3c ted
    .
    .< │ │ │ -000a6870: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>. │ │ │ -000a6880: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .

  • .
  • ..

    │ │ │ -000a6950: 7265 636f 7665 7250 6f73 653c 2f68 333e recoverPose

    │ │ │ -000a6960: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ -000a6980: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ -000a69a0: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ -000a69b0: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ -000a69c0: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ -000a69d0: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;int recoverPos │ │ │ -000a6a20: 653c 2f73 7061 6e3e 3c77 6272 3e3c 7370 e(Mat  │ │ │ -000a6a90: 452c 0a20 3c61 2068 7265 663d 222e 2e2f E,. │ │ │ -000a6ad0: 4d61 743c 2f61 3e26 6e62 7370 3b70 6f69 Mat poi │ │ │ -000a6ae0: 6e74 7331 2c0a 203c 6120 6872 6566 3d22 nts1,. Mat  │ │ │ -000a6b30: 706f 696e 7473 322c 0a20 3c61 2068 7265 points2,. Mat&nb │ │ │ -000a6b80: 7370 3b52 2c0a 203c 6120 6872 6566 3d22 sp;R,. Mat  │ │ │ -000a6bd0: 742c 0a20 646f 7562 6c65 266e 6273 703b t,. double  │ │ │ -000a6be0: 666f 6361 6c2c 0a20 3c61 2068 7265 663d focal,. Point& │ │ │ -000a6c30: 6e62 7370 3b70 702c 0a20 3c61 2068 7265 nbsp;pp,. Mat&nb │ │ │ -000a6c80: 7370 3b6d 6173 6b29 3c2f 7370 616e 3e3c sp;mask)< │ │ │ -000a6c90: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ -000a6cb0: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .E │ │ │ -000a6cd0: 202d 2054 6865 2069 6e70 7574 2065 7373 - The input ess │ │ │ -000a6ce0: 656e 7469 616c 206d 6174 7269 782e 3c2f ential matrix..
    po │ │ │ -000a6d00: 696e 7473 313c 2f63 6f64 653e 202d 2041 ints1 - A │ │ │ -000a6d10: 7272 6179 206f 6620 4e20 3244 2070 6f69 rray of N 2D poi │ │ │ -000a6d20: 6e74 7320 6672 6f6d 2074 6865 2066 6972 nts from the fir │ │ │ -000a6d30: 7374 2069 6d61 6765 2e20 5468 6520 706f st image. The po │ │ │ -000a6d40: 696e 7420 636f 6f72 6469 6e61 7465 7320 int coordinates │ │ │ -000a6d50: 7368 6f75 6c64 2062 650a 666c 6f61 7469 should be.floati │ │ │ -000a6d60: 6e67 2d70 6f69 6e74 2028 7369 6e67 6c65 ng-point (single │ │ │ -000a6d70: 206f 7220 646f 7562 6c65 2070 7265 6369 or double preci │ │ │ -000a6d80: 7369 6f6e 292e 3c2f 6464 3e0a 3c64 643e sion).
    .
    │ │ │ -000a6d90: 3c63 6f64 653e 706f 696e 7473 323c 2f63 points2 - Array of │ │ │ -000a6db0: 7468 6520 7365 636f 6e64 2069 6d61 6765 the second image │ │ │ -000a6dc0: 2070 6f69 6e74 7320 6f66 2074 6865 2073 points of the s │ │ │ -000a6dd0: 616d 6520 7369 7a65 2061 6e64 2066 6f72 ame size and for │ │ │ -000a6de0: 6d61 7420 6173 2070 6f69 6e74 7331 202e mat as points1 . │ │ │ -000a6df0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000a6e00: 523c 2f63 6f64 653e 202d 204f 7574 7075 R - Outpu │ │ │ -000a6e10: 7420 726f 7461 7469 6f6e 206d 6174 7269 t rotation matri │ │ │ -000a6e20: 782e 2054 6f67 6574 6865 7220 7769 7468 x. Together with │ │ │ -000a6e30: 2074 6865 2074 7261 6e73 6c61 7469 6f6e the translation │ │ │ -000a6e40: 2076 6563 746f 722c 2074 6869 7320 6d61 vector, this ma │ │ │ -000a6e50: 7472 6978 206d 616b 6573 2075 7020 6120 trix makes up a │ │ │ -000a6e60: 7475 706c 650a 7468 6174 2070 6572 666f tuple.that perfo │ │ │ -000a6e70: 726d 7320 6120 6368 616e 6765 206f 6620 rms a change of │ │ │ -000a6e80: 6261 7369 7320 6672 6f6d 2074 6865 2066 basis from the f │ │ │ -000a6e90: 6972 7374 2063 616d 6572 6127 7320 636f irst camera's co │ │ │ -000a6ea0: 6f72 6469 6e61 7465 2073 7973 7465 6d20 ordinate system │ │ │ -000a6eb0: 746f 2074 6865 2073 6563 6f6e 6420 6361 to the second ca │ │ │ -000a6ec0: 6d65 7261 2773 0a63 6f6f 7264 696e 6174 mera's.coordinat │ │ │ -000a6ed0: 6520 7379 7374 656d 2e20 4e6f 7465 2074 e system. Note t │ │ │ -000a6ee0: 6861 742c 2069 6e20 6765 6e65 7261 6c2c hat, in general, │ │ │ -000a6ef0: 2074 2063 616e 206e 6f74 2062 6520 7573 t can not be us │ │ │ -000a6f00: 6564 2066 6f72 2074 6869 7320 7475 706c ed for this tupl │ │ │ -000a6f10: 652c 2073 6565 2074 6865 2070 6172 616d e, see the param │ │ │ -000a6f20: 6574 6572 0a64 6573 6372 6970 7469 6f6e eter.description │ │ │ -000a6f30: 2062 656c 6f77 2e3c 2f64 643e 0a3c 6464 below.
    .
    t │ │ │ -000a6f50: 2d20 4f75 7470 7574 2074 7261 6e73 6c61 - Output transla │ │ │ -000a6f60: 7469 6f6e 2076 6563 746f 722e 2054 6869 tion vector. Thi │ │ │ -000a6f70: 7320 7665 6374 6f72 2069 7320 6f62 7461 s vector is obta │ │ │ -000a6f80: 696e 6564 2062 7920 5245 463a 2064 6563 ined by REF: dec │ │ │ -000a6f90: 6f6d 706f 7365 4573 7365 6e74 6961 6c4d omposeEssentialM │ │ │ -000a6fa0: 6174 2061 6e64 0a74 6865 7265 666f 7265 at and.therefore │ │ │ -000a6fb0: 2069 7320 6f6e 6c79 206b 6e6f 776e 2075 is only known u │ │ │ -000a6fc0: 7020 746f 2073 6361 6c65 2c20 692e 652e p to scale, i.e. │ │ │ -000a6fd0: 2074 2069 7320 7468 6520 6469 7265 6374 t is the direct │ │ │ -000a6fe0: 696f 6e20 6f66 2074 6865 2074 7261 6e73 ion of the trans │ │ │ -000a6ff0: 6c61 7469 6f6e 2076 6563 746f 7220 616e lation vector an │ │ │ -000a7000: 6420 6861 7320 756e 6974 0a6c 656e 6774 d has unit.lengt │ │ │ -000a7010: 682e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 h.
    .
    focal - │ │ │ -000a7030: 2046 6f63 616c 206c 656e 6774 6820 6f66 Focal length of │ │ │ -000a7040: 2074 6865 2063 616d 6572 612e 204e 6f74 the camera. Not │ │ │ -000a7050: 6520 7468 6174 2074 6869 7320 6675 6e63 e that this func │ │ │ -000a7060: 7469 6f6e 2061 7373 756d 6573 2074 6861 tion assumes tha │ │ │ -000a7070: 7420 706f 696e 7473 3120 616e 6420 706f t points1 and po │ │ │ -000a7080: 696e 7473 320a 6172 6520 6665 6174 7572 ints2.are featur │ │ │ -000a7090: 6520 706f 696e 7473 2066 726f 6d20 6361 e points from ca │ │ │ -000a70a0: 6d65 7261 7320 7769 7468 2073 616d 6520 meras with same │ │ │ -000a70b0: 666f 6361 6c20 6c65 6e67 7468 2061 6e64 focal length and │ │ │ -000a70c0: 2070 7269 6e63 6970 616c 2070 6f69 6e74 principal point │ │ │ -000a70d0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    pp - pri │ │ │ -000a70f0: 6e63 6970 616c 2070 6f69 6e74 206f 6620 ncipal point of │ │ │ -000a7100: 7468 6520 6361 6d65 7261 2e3c 2f64 643e the camera.
    │ │ │ -000a7110: 0a3c 6464 3e3c 636f 6465 3e6d 6173 6b3c .
    mask< │ │ │ -000a7120: 2f63 6f64 653e 202d 2049 6e70 7574 2f6f /code> - Input/o │ │ │ -000a7130: 7574 7075 7420 6d61 736b 2066 6f72 2069 utput mask for i │ │ │ -000a7140: 6e6c 6965 7273 2069 6e20 706f 696e 7473 nliers in points │ │ │ -000a7150: 3120 616e 6420 706f 696e 7473 322e 2049 1 and points2. I │ │ │ -000a7160: 6620 6974 2069 7320 6e6f 7420 656d 7074 f it is not empt │ │ │ -000a7170: 792c 2074 6865 6e20 6974 206d 6172 6b73 y, then it marks │ │ │ -000a7180: 0a69 6e6c 6965 7273 2069 6e20 706f 696e .inliers in poin │ │ │ -000a7190: 7473 3120 616e 6420 706f 696e 7473 3220 ts1 and points2 │ │ │ -000a71a0: 666f 7220 7468 6520 6769 7665 6e20 6573 for the given es │ │ │ -000a71b0: 7365 6e74 6961 6c20 6d61 7472 6978 2045 sential matrix E │ │ │ -000a71c0: 2e20 4f6e 6c79 2074 6865 7365 2069 6e6c . Only these inl │ │ │ -000a71d0: 6965 7273 2077 696c 6c20 6265 2075 7365 iers will be use │ │ │ -000a71e0: 6420 746f 0a72 6563 6f76 6572 2070 6f73 d to.recover pos │ │ │ -000a71f0: 652e 2049 6e20 7468 6520 6f75 7470 7574 e. In the output │ │ │ -000a7200: 206d 6173 6b20 6f6e 6c79 2069 6e6c 6965 mask only inlie │ │ │ -000a7210: 7273 2077 6869 6368 2070 6173 7320 7468 rs which pass th │ │ │ -000a7220: 6520 6368 6972 616c 6974 7920 6368 6563 e chirality chec │ │ │ -000a7230: 6b2e 0a0a 5468 6973 2066 756e 6374 696f k...This functio │ │ │ -000a7240: 6e20 6469 6666 6572 7320 6672 6f6d 2074 n differs from t │ │ │ -000a7250: 6865 206f 6e65 2061 626f 7665 2074 6861 he one above tha │ │ │ -000a7260: 7420 6974 2063 6f6d 7075 7465 7320 6361 t it computes ca │ │ │ -000a7270: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -000a7280: 6174 7269 7820 6672 6f6d 2066 6f63 616c atrix from focal │ │ │ -000a7290: 206c 656e 6774 6820 616e 640a 7072 696e length and.prin │ │ │ -000a72a0: 6369 7061 6c20 706f 696e 743a 0a0a 5c28 cipal point:..\( │ │ │ -000a72b0: 4120 3d0a 5c62 6567 696e 7b62 6d61 7472 A =.\begin{bmatr │ │ │ -000a72c0: 6978 7d0a 6620 2661 6d70 3b20 3020 2661 ix}.f & 0 &a │ │ │ -000a72d0: 6d70 3b20 785f 7b70 707d 2020 5c5c 0a30 mp; x_{pp} \\.0 │ │ │ -000a72e0: 2026 616d 703b 2066 2026 616d 703b 2079 & f & y │ │ │ -000a72f0: 5f7b 7070 7d20 205c 5c0a 3020 2661 6d70 _{pp} \\.0 & │ │ │ -000a7300: 3b20 3020 2661 6d70 3b20 310a 5c65 6e64 ; 0 & 1.\end │ │ │ -000a7310: 7b62 6d61 7472 6978 7d5c 293c 2f64 643e {bmatrix}\)
    │ │ │ -000a7320: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    automatic │ │ │ -000a7340: 616c 6c79 2067 656e 6572 6174 6564 3c2f ally generated.
    .
    │ │ │ -000a7360: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 ..
  • .
  • .
    .

    recoverPo │ │ │ -000a7430: 7365 3c2f 6833 3e0a 3c64 6976 2063 6c61 se

    .
    .
    pu │ │ │ -000a7490: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static int&nbs │ │ │ -000a74d0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;rec │ │ │ -000a74f0: 6f76 6572 506f 7365 3c2f 7370 616e 3e3c overPose< │ │ │ -000a7500: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat E,. Mat&n │ │ │ -000a75b0: 6273 703b 706f 696e 7473 312c 0a20 3c61 bsp;points1,. Mat points2,. │ │ │ -000a7610: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000a7650: 3c2f 613e 266e 6273 703b 522c 0a20 3c61  R,. Mat t,. doubl │ │ │ -000a76b0: 6526 6e62 7370 3b66 6f63 616c 2c0a 203c e focal,. < │ │ │ -000a76c0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000a76d0: 506f 696e 742e 6874 6d6c 2220 7469 746c Point.html" titl │ │ │ -000a76e0: 653d 2263 6c61 7373 2069 6e20 6f72 672e e="class in org. │ │ │ -000a76f0: 6f70 656e 6376 2e63 6f72 6522 3e50 6f69 opencv.core">Poi │ │ │ -000a7700: 6e74 3c2f 613e 266e 6273 703b 7070 293c nt pp)< │ │ │ -000a7710: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 646c /span>
    .
    . │ │ │ -000a7730: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -000a7740: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e45 /dt>.
    E │ │ │ -000a7750: 3c2f 636f 6465 3e20 2d20 5468 6520 696e - The in │ │ │ -000a7760: 7075 7420 6573 7365 6e74 6961 6c20 6d61 put essential ma │ │ │ -000a7770: 7472 6978 2e3c 2f64 643e 0a3c 6464 3e3c trix.
    .
    < │ │ │ -000a7780: 636f 6465 3e70 6f69 6e74 7331 3c2f 636f code>points1 - Array of N │ │ │ -000a77a0: 2032 4420 706f 696e 7473 2066 726f 6d20 2D points from │ │ │ -000a77b0: 7468 6520 6669 7273 7420 696d 6167 652e the first image. │ │ │ -000a77c0: 2054 6865 2070 6f69 6e74 2063 6f6f 7264 The point coord │ │ │ -000a77d0: 696e 6174 6573 2073 686f 756c 6420 6265 inates should be │ │ │ -000a77e0: 0a66 6c6f 6174 696e 672d 706f 696e 7420 .floating-point │ │ │ -000a77f0: 2873 696e 676c 6520 6f72 2064 6f75 626c (single or doubl │ │ │ -000a7800: 6520 7072 6563 6973 696f 6e29 2e3c 2f64 e precision)..
    poi │ │ │ -000a7820: 6e74 7332 3c2f 636f 6465 3e20 2d20 4172 nts2 - Ar │ │ │ -000a7830: 7261 7920 6f66 2074 6865 2073 6563 6f6e ray of the secon │ │ │ -000a7840: 6420 696d 6167 6520 706f 696e 7473 206f d image points o │ │ │ -000a7850: 6620 7468 6520 7361 6d65 2073 697a 6520 f the same size │ │ │ -000a7860: 616e 6420 666f 726d 6174 2061 7320 706f and format as po │ │ │ -000a7870: 696e 7473 3120 2e3c 2f64 643e 0a3c 6464 ints1 .
    .
    R │ │ │ -000a7890: 2d20 4f75 7470 7574 2072 6f74 6174 696f - Output rotatio │ │ │ -000a78a0: 6e20 6d61 7472 6978 2e20 546f 6765 7468 n matrix. Togeth │ │ │ -000a78b0: 6572 2077 6974 6820 7468 6520 7472 616e er with the tran │ │ │ -000a78c0: 736c 6174 696f 6e20 7665 6374 6f72 2c20 slation vector, │ │ │ -000a78d0: 7468 6973 206d 6174 7269 7820 6d61 6b65 this matrix make │ │ │ -000a78e0: 7320 7570 2061 2074 7570 6c65 0a74 6861 s up a tuple.tha │ │ │ -000a78f0: 7420 7065 7266 6f72 6d73 2061 2063 6861 t performs a cha │ │ │ -000a7900: 6e67 6520 6f66 2062 6173 6973 2066 726f nge of basis fro │ │ │ -000a7910: 6d20 7468 6520 6669 7273 7420 6361 6d65 m the first came │ │ │ -000a7920: 7261 2773 2063 6f6f 7264 696e 6174 6520 ra's coordinate │ │ │ -000a7930: 7379 7374 656d 2074 6f20 7468 6520 7365 system to the se │ │ │ -000a7940: 636f 6e64 2063 616d 6572 6127 730a 636f cond camera's.co │ │ │ -000a7950: 6f72 6469 6e61 7465 2073 7973 7465 6d2e ordinate system. │ │ │ -000a7960: 204e 6f74 6520 7468 6174 2c20 696e 2067 Note that, in g │ │ │ -000a7970: 656e 6572 616c 2c20 7420 6361 6e20 6e6f eneral, t can no │ │ │ -000a7980: 7420 6265 2075 7365 6420 666f 7220 7468 t be used for th │ │ │ -000a7990: 6973 2074 7570 6c65 2c20 7365 6520 7468 is tuple, see th │ │ │ -000a79a0: 6520 7061 7261 6d65 7465 720a 6465 7363 e parameter.desc │ │ │ -000a79b0: 7269 7074 696f 6e20 6265 6c6f 772e 3c2f ription below..
    t< │ │ │ -000a79d0: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ -000a79e0: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ -000a79f0: 6f72 2e20 5468 6973 2076 6563 746f 7220 or. This vector │ │ │ -000a7a00: 6973 206f 6274 6169 6e65 6420 6279 2052 is obtained by R │ │ │ -000a7a10: 4546 3a20 6465 636f 6d70 6f73 6545 7373 EF: decomposeEss │ │ │ -000a7a20: 656e 7469 616c 4d61 7420 616e 640a 7468 entialMat and.th │ │ │ -000a7a30: 6572 6566 6f72 6520 6973 206f 6e6c 7920 erefore is only │ │ │ -000a7a40: 6b6e 6f77 6e20 7570 2074 6f20 7363 616c known up to scal │ │ │ -000a7a50: 652c 2069 2e65 2e20 7420 6973 2074 6865 e, i.e. t is the │ │ │ -000a7a60: 2064 6972 6563 7469 6f6e 206f 6620 7468 direction of th │ │ │ -000a7a70: 6520 7472 616e 736c 6174 696f 6e20 7665 e translation ve │ │ │ -000a7a80: 6374 6f72 2061 6e64 2068 6173 2075 6e69 ctor and has uni │ │ │ -000a7a90: 740a 6c65 6e67 7468 2e3c 2f64 643e 0a3c t.length.
    .< │ │ │ -000a7aa0: 6464 3e3c 636f 6465 3e66 6f63 616c 3c2f dd>focal - Focal le │ │ │ -000a7ac0: 6e67 7468 206f 6620 7468 6520 6361 6d65 ngth of the came │ │ │ -000a7ad0: 7261 2e20 4e6f 7465 2074 6861 7420 7468 ra. Note that th │ │ │ -000a7ae0: 6973 2066 756e 6374 696f 6e20 6173 7375 is function assu │ │ │ -000a7af0: 6d65 7320 7468 6174 2070 6f69 6e74 7331 mes that points1 │ │ │ -000a7b00: 2061 6e64 2070 6f69 6e74 7332 0a61 7265 and points2.are │ │ │ -000a7b10: 2066 6561 7475 7265 2070 6f69 6e74 7320 feature points │ │ │ -000a7b20: 6672 6f6d 2063 616d 6572 6173 2077 6974 from cameras wit │ │ │ -000a7b30: 6820 7361 6d65 2066 6f63 616c 206c 656e h same focal len │ │ │ -000a7b40: 6774 6820 616e 6420 7072 696e 6369 7061 gth and principa │ │ │ -000a7b50: 6c20 706f 696e 742e 3c2f 6464 3e0a 3c64 l point..pp - principal po │ │ │ -000a7b80: 696e 7420 6f66 2074 6865 2063 616d 6572 int of the camer │ │ │ -000a7b90: 612e 0a69 6e6c 6965 7273 2069 6e20 706f a..inliers in po │ │ │ -000a7ba0: 696e 7473 3120 616e 6420 706f 696e 7473 ints1 and points │ │ │ -000a7bb0: 3220 666f 7220 7468 6520 6769 7665 6e20 2 for the given │ │ │ -000a7bc0: 6573 7365 6e74 6961 6c20 6d61 7472 6978 essential matrix │ │ │ -000a7bd0: 2045 2e20 4f6e 6c79 2074 6865 7365 2069 E. Only these i │ │ │ -000a7be0: 6e6c 6965 7273 2077 696c 6c20 6265 2075 nliers will be u │ │ │ -000a7bf0: 7365 6420 746f 0a72 6563 6f76 6572 2070 sed to.recover p │ │ │ -000a7c00: 6f73 652e 2049 6e20 7468 6520 6f75 7470 ose. In the outp │ │ │ -000a7c10: 7574 206d 6173 6b20 6f6e 6c79 2069 6e6c ut mask only inl │ │ │ -000a7c20: 6965 7273 2077 6869 6368 2070 6173 7320 iers which pass │ │ │ -000a7c30: 7468 6520 6368 6972 616c 6974 7920 6368 the chirality ch │ │ │ -000a7c40: 6563 6b2e 0a0a 5468 6973 2066 756e 6374 eck...This funct │ │ │ -000a7c50: 696f 6e20 6469 6666 6572 7320 6672 6f6d ion differs from │ │ │ -000a7c60: 2074 6865 206f 6e65 2061 626f 7665 2074 the one above t │ │ │ -000a7c70: 6861 7420 6974 2063 6f6d 7075 7465 7320 hat it computes │ │ │ -000a7c80: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ -000a7c90: 206d 6174 7269 7820 6672 6f6d 2066 6f63 matrix from foc │ │ │ -000a7ca0: 616c 206c 656e 6774 6820 616e 640a 7072 al length and.pr │ │ │ -000a7cb0: 696e 6369 7061 6c20 706f 696e 743a 0a0a incipal point:.. │ │ │ -000a7cc0: 5c28 4120 3d0a 5c62 6567 696e 7b62 6d61 \(A =.\begin{bma │ │ │ -000a7cd0: 7472 6978 7d0a 6620 2661 6d70 3b20 3020 trix}.f & 0 │ │ │ -000a7ce0: 2661 6d70 3b20 785f 7b70 707d 2020 5c5c & x_{pp} \\ │ │ │ -000a7cf0: 0a30 2026 616d 703b 2066 2026 616d 703b .0 & f & │ │ │ -000a7d00: 2079 5f7b 7070 7d20 205c 5c0a 3020 2661 y_{pp} \\.0 &a │ │ │ -000a7d10: 6d70 3b20 3020 2661 6d70 3b20 310a 5c65 mp; 0 & 1.\e │ │ │ -000a7d20: 6e64 7b62 6d61 7472 6978 7d5c 293c 2f64 nd{bmatrix}\).
    Returns:< │ │ │ -000a7d40: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
    automat │ │ │ -000a7d50: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ -000a7d60: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ..
    ..
  • ..< │ │ │ -000a7e20: 6833 3e72 6563 6f76 6572 506f 7365 3c2f h3>recoverPose.
    .
    public │ │ │ -000a7e90: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ -000a7ea0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;in │ │ │ -000a7ec0: 743c 2f73 7061 6e3e 266e 6273 703b 3c73 t recover │ │ │ -000a7ef0: 506f 7365 3c2f 7370 616e 3e3c 7762 723e Pose │ │ │ -000a7f00: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ -000a7f60: 7370 3b45 2c0a 203c 6120 6872 6566 3d22 sp;E,. Mat  │ │ │ -000a7fb0: 706f 696e 7473 312c 0a20 3c61 2068 7265 points1,. Mat&nb │ │ │ -000a8000: 7370 3b70 6f69 6e74 7332 2c0a 203c 6120 sp;points2,. Mat │ │ │ -000a8050: 266e 6273 703b 522c 0a20 3c61 2068 7265  R,. Mat&nb │ │ │ -000a80a0: 7370 3b74 2c0a 2064 6f75 626c 6526 6e62 sp;t,. double&nb │ │ │ -000a80b0: 7370 3b66 6f63 616c 293c 2f73 7061 6e3e sp;focal) │ │ │ -000a80c0: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -000a80e0: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000a80f0: 6464 3e3c 636f 6465 3e45 3c2f 636f 6465 dd>E - The input es │ │ │ -000a8110: 7365 6e74 6961 6c20 6d61 7472 6978 2e3c sential matrix.< │ │ │ -000a8120: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e70 /dd>.
    p │ │ │ -000a8130: 6f69 6e74 7331 3c2f 636f 6465 3e20 2d20 oints1 - │ │ │ -000a8140: 4172 7261 7920 6f66 204e 2032 4420 706f Array of N 2D po │ │ │ -000a8150: 696e 7473 2066 726f 6d20 7468 6520 6669 ints from the fi │ │ │ -000a8160: 7273 7420 696d 6167 652e 2054 6865 2070 rst image. The p │ │ │ -000a8170: 6f69 6e74 2063 6f6f 7264 696e 6174 6573 oint coordinates │ │ │ -000a8180: 2073 686f 756c 6420 6265 0a66 6c6f 6174 should be.float │ │ │ -000a8190: 696e 672d 706f 696e 7420 2873 696e 676c ing-point (singl │ │ │ -000a81a0: 6520 6f72 2064 6f75 626c 6520 7072 6563 e or double prec │ │ │ -000a81b0: 6973 696f 6e29 2e3c 2f64 643e 0a3c 6464 ision).
    .
    points2 - Array of │ │ │ -000a81e0: 2074 6865 2073 6563 6f6e 6420 696d 6167 the second imag │ │ │ -000a81f0: 6520 706f 696e 7473 206f 6620 7468 6520 e points of the │ │ │ -000a8200: 7361 6d65 2073 697a 6520 616e 6420 666f same size and fo │ │ │ -000a8210: 726d 6174 2061 7320 706f 696e 7473 3120 rmat as points1 │ │ │ -000a8220: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    R - Outp │ │ │ -000a8240: 7574 2072 6f74 6174 696f 6e20 6d61 7472 ut rotation matr │ │ │ -000a8250: 6978 2e20 546f 6765 7468 6572 2077 6974 ix. Together wit │ │ │ -000a8260: 6820 7468 6520 7472 616e 736c 6174 696f h the translatio │ │ │ -000a8270: 6e20 7665 6374 6f72 2c20 7468 6973 206d n vector, this m │ │ │ -000a8280: 6174 7269 7820 6d61 6b65 7320 7570 2061 atrix makes up a │ │ │ -000a8290: 2074 7570 6c65 0a74 6861 7420 7065 7266 tuple.that perf │ │ │ -000a82a0: 6f72 6d73 2061 2063 6861 6e67 6520 6f66 orms a change of │ │ │ -000a82b0: 2062 6173 6973 2066 726f 6d20 7468 6520 basis from the │ │ │ -000a82c0: 6669 7273 7420 6361 6d65 7261 2773 2063 first camera's c │ │ │ -000a82d0: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ -000a82e0: 2074 6f20 7468 6520 7365 636f 6e64 2063 to the second c │ │ │ -000a82f0: 616d 6572 6127 730a 636f 6f72 6469 6e61 amera's.coordina │ │ │ -000a8300: 7465 2073 7973 7465 6d2e 204e 6f74 6520 te system. Note │ │ │ -000a8310: 7468 6174 2c20 696e 2067 656e 6572 616c that, in general │ │ │ -000a8320: 2c20 7420 6361 6e20 6e6f 7420 6265 2075 , t can not be u │ │ │ -000a8330: 7365 6420 666f 7220 7468 6973 2074 7570 sed for this tup │ │ │ -000a8340: 6c65 2c20 7365 6520 7468 6520 7061 7261 le, see the para │ │ │ -000a8350: 6d65 7465 720a 6465 7363 7269 7074 696f meter.descriptio │ │ │ -000a8360: 6e20 6265 6c6f 772e 3c2f 6464 3e0a 3c64 n below.
    .t │ │ │ -000a8380: 202d 204f 7574 7075 7420 7472 616e 736c - Output transl │ │ │ -000a8390: 6174 696f 6e20 7665 6374 6f72 2e20 5468 ation vector. Th │ │ │ -000a83a0: 6973 2076 6563 746f 7220 6973 206f 6274 is vector is obt │ │ │ -000a83b0: 6169 6e65 6420 6279 2052 4546 3a20 6465 ained by REF: de │ │ │ -000a83c0: 636f 6d70 6f73 6545 7373 656e 7469 616c composeEssential │ │ │ -000a83d0: 4d61 7420 616e 640a 7468 6572 6566 6f72 Mat and.therefor │ │ │ -000a83e0: 6520 6973 206f 6e6c 7920 6b6e 6f77 6e20 e is only known │ │ │ -000a83f0: 7570 2074 6f20 7363 616c 652c 2069 2e65 up to scale, i.e │ │ │ -000a8400: 2e20 7420 6973 2074 6865 2064 6972 6563 . t is the direc │ │ │ -000a8410: 7469 6f6e 206f 6620 7468 6520 7472 616e tion of the tran │ │ │ -000a8420: 736c 6174 696f 6e20 7665 6374 6f72 2061 slation vector a │ │ │ -000a8430: 6e64 2068 6173 2075 6e69 740a 6c65 6e67 nd has unit.leng │ │ │ -000a8440: 7468 2e3c 2f64 643e 0a3c 6464 3e3c 636f th..
    focal │ │ │ -000a8460: 2d20 466f 6361 6c20 6c65 6e67 7468 206f - Focal length o │ │ │ -000a8470: 6620 7468 6520 6361 6d65 7261 2e20 4e6f f the camera. No │ │ │ -000a8480: 7465 2074 6861 7420 7468 6973 2066 756e te that this fun │ │ │ -000a8490: 6374 696f 6e20 6173 7375 6d65 7320 7468 ction assumes th │ │ │ -000a84a0: 6174 2070 6f69 6e74 7331 2061 6e64 2070 at points1 and p │ │ │ -000a84b0: 6f69 6e74 7332 0a61 7265 2066 6561 7475 oints2.are featu │ │ │ -000a84c0: 7265 2070 6f69 6e74 7320 6672 6f6d 2063 re points from c │ │ │ -000a84d0: 616d 6572 6173 2077 6974 6820 7361 6d65 ameras with same │ │ │ -000a84e0: 2066 6f63 616c 206c 656e 6774 6820 616e focal length an │ │ │ -000a84f0: 6420 7072 696e 6369 7061 6c20 706f 696e d principal poin │ │ │ -000a8500: 742e 0a69 6e6c 6965 7273 2069 6e20 706f t..inliers in po │ │ │ -000a8510: 696e 7473 3120 616e 6420 706f 696e 7473 ints1 and points │ │ │ -000a8520: 3220 666f 7220 7468 6520 6769 7665 6e20 2 for the given │ │ │ -000a8530: 6573 7365 6e74 6961 6c20 6d61 7472 6978 essential matrix │ │ │ -000a8540: 2045 2e20 4f6e 6c79 2074 6865 7365 2069 E. Only these i │ │ │ -000a8550: 6e6c 6965 7273 2077 696c 6c20 6265 2075 nliers will be u │ │ │ -000a8560: 7365 6420 746f 0a72 6563 6f76 6572 2070 sed to.recover p │ │ │ -000a8570: 6f73 652e 2049 6e20 7468 6520 6f75 7470 ose. In the outp │ │ │ -000a8580: 7574 206d 6173 6b20 6f6e 6c79 2069 6e6c ut mask only inl │ │ │ -000a8590: 6965 7273 2077 6869 6368 2070 6173 7320 iers which pass │ │ │ -000a85a0: 7468 6520 6368 6972 616c 6974 7920 6368 the chirality ch │ │ │ -000a85b0: 6563 6b2e 0a0a 5468 6973 2066 756e 6374 eck...This funct │ │ │ -000a85c0: 696f 6e20 6469 6666 6572 7320 6672 6f6d ion differs from │ │ │ -000a85d0: 2074 6865 206f 6e65 2061 626f 7665 2074 the one above t │ │ │ -000a85e0: 6861 7420 6974 2063 6f6d 7075 7465 7320 hat it computes │ │ │ -000a85f0: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ -000a8600: 206d 6174 7269 7820 6672 6f6d 2066 6f63 matrix from foc │ │ │ -000a8610: 616c 206c 656e 6774 6820 616e 640a 7072 al length and.pr │ │ │ -000a8620: 696e 6369 7061 6c20 706f 696e 743a 0a0a incipal point:.. │ │ │ -000a8630: 5c28 4120 3d0a 5c62 6567 696e 7b62 6d61 \(A =.\begin{bma │ │ │ -000a8640: 7472 6978 7d0a 6620 2661 6d70 3b20 3020 trix}.f & 0 │ │ │ -000a8650: 2661 6d70 3b20 785f 7b70 707d 2020 5c5c & x_{pp} \\ │ │ │ -000a8660: 0a30 2026 616d 703b 2066 2026 616d 703b .0 & f & │ │ │ -000a8670: 2079 5f7b 7070 7d20 205c 5c0a 3020 2661 y_{pp} \\.0 &a │ │ │ -000a8680: 6d70 3b20 3020 2661 6d70 3b20 310a 5c65 mp; 0 & 1.\e │ │ │ -000a8690: 6e64 7b62 6d61 7472 6978 7d5c 293c 2f64 nd{bmatrix}\).
    Returns:< │ │ │ -000a86b0: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
    automat │ │ │ -000a86c0: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ -000a86d0: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ....
  • ..

    reco │ │ │ -000a8790: 7665 7250 6f73 653c 2f68 333e 0a3c 6469 verPose

    ..public static │ │ │ -000a8800: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  int recoverPose
    (M │ │ │ -000a88c0: 6174 3c2f 613e 266e 6273 703b 452c 0a20 at E,. │ │ │ -000a88d0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000a8910: 2f61 3e26 6e62 7370 3b70 6f69 6e74 7331 /a> points1 │ │ │ -000a8920: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000a8960: 6174 3c2f 613e 266e 6273 703b 706f 696e at poin │ │ │ -000a8970: 7473 322c 0a20 3c61 2068 7265 663d 222e ts2,. Mat R │ │ │ -000a89c0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000a8a00: 6174 3c2f 613e 266e 6273 703b 7429 3c2f at t).
    .< │ │ │ -000a8a30: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    E< │ │ │ -000a8a50: 2f63 6f64 653e 202d 2054 6865 2069 6e70 /code> - The inp │ │ │ -000a8a60: 7574 2065 7373 656e 7469 616c 206d 6174 ut essential mat │ │ │ -000a8a70: 7269 782e 3c2f 6464 3e0a 3c64 643e 3c63 rix.
    .
    points1 - Array of N │ │ │ -000a8aa0: 3244 2070 6f69 6e74 7320 6672 6f6d 2074 2D points from t │ │ │ -000a8ab0: 6865 2066 6972 7374 2069 6d61 6765 2e20 he first image. │ │ │ -000a8ac0: 5468 6520 706f 696e 7420 636f 6f72 6469 The point coordi │ │ │ -000a8ad0: 6e61 7465 7320 7368 6f75 6c64 2062 650a nates should be. │ │ │ -000a8ae0: 666c 6f61 7469 6e67 2d70 6f69 6e74 2028 floating-point ( │ │ │ -000a8af0: 7369 6e67 6c65 206f 7220 646f 7562 6c65 single or double │ │ │ -000a8b00: 2070 7265 6369 7369 6f6e 292e 3c2f 6464 precision).
    .
    poin │ │ │ -000a8b20: 7473 323c 2f63 6f64 653e 202d 2041 7272 ts2 - Arr │ │ │ -000a8b30: 6179 206f 6620 7468 6520 7365 636f 6e64 ay of the second │ │ │ -000a8b40: 2069 6d61 6765 2070 6f69 6e74 7320 6f66 image points of │ │ │ -000a8b50: 2074 6865 2073 616d 6520 7369 7a65 2061 the same size a │ │ │ -000a8b60: 6e64 2066 6f72 6d61 7420 6173 2070 6f69 nd format as poi │ │ │ -000a8b70: 6e74 7331 202e 3c2f 6464 3e0a 3c64 643e nts1 .
    .
    │ │ │ -000a8b80: 3c63 6f64 653e 523c 2f63 6f64 653e 202d R - │ │ │ -000a8b90: 204f 7574 7075 7420 726f 7461 7469 6f6e Output rotation │ │ │ -000a8ba0: 206d 6174 7269 782e 2054 6f67 6574 6865 matrix. Togethe │ │ │ -000a8bb0: 7220 7769 7468 2074 6865 2074 7261 6e73 r with the trans │ │ │ -000a8bc0: 6c61 7469 6f6e 2076 6563 746f 722c 2074 lation vector, t │ │ │ -000a8bd0: 6869 7320 6d61 7472 6978 206d 616b 6573 his matrix makes │ │ │ -000a8be0: 2075 7020 6120 7475 706c 650a 7468 6174 up a tuple.that │ │ │ -000a8bf0: 2070 6572 666f 726d 7320 6120 6368 616e performs a chan │ │ │ -000a8c00: 6765 206f 6620 6261 7369 7320 6672 6f6d ge of basis from │ │ │ -000a8c10: 2074 6865 2066 6972 7374 2063 616d 6572 the first camer │ │ │ -000a8c20: 6127 7320 636f 6f72 6469 6e61 7465 2073 a's coordinate s │ │ │ -000a8c30: 7973 7465 6d20 746f 2074 6865 2073 6563 ystem to the sec │ │ │ -000a8c40: 6f6e 6420 6361 6d65 7261 2773 0a63 6f6f ond camera's.coo │ │ │ -000a8c50: 7264 696e 6174 6520 7379 7374 656d 2e20 rdinate system. │ │ │ -000a8c60: 4e6f 7465 2074 6861 742c 2069 6e20 6765 Note that, in ge │ │ │ -000a8c70: 6e65 7261 6c2c 2074 2063 616e 206e 6f74 neral, t can not │ │ │ -000a8c80: 2062 6520 7573 6564 2066 6f72 2074 6869 be used for thi │ │ │ -000a8c90: 7320 7475 706c 652c 2073 6565 2074 6865 s tuple, see the │ │ │ -000a8ca0: 2070 6172 616d 6574 6572 0a64 6573 6372 parameter.descr │ │ │ -000a8cb0: 6970 7469 6f6e 2062 656c 6f77 2e3c 2f64 iption below..
    t - Output t │ │ │ -000a8ce0: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ -000a8cf0: 722e 2054 6869 7320 7665 6374 6f72 2069 r. This vector i │ │ │ -000a8d00: 7320 6f62 7461 696e 6564 2062 7920 5245 s obtained by RE │ │ │ -000a8d10: 463a 2064 6563 6f6d 706f 7365 4573 7365 F: decomposeEsse │ │ │ -000a8d20: 6e74 6961 6c4d 6174 2061 6e64 0a74 6865 ntialMat and.the │ │ │ -000a8d30: 7265 666f 7265 2069 7320 6f6e 6c79 206b refore is only k │ │ │ -000a8d40: 6e6f 776e 2075 7020 746f 2073 6361 6c65 nown up to scale │ │ │ -000a8d50: 2c20 692e 652e 2074 2069 7320 7468 6520 , i.e. t is the │ │ │ -000a8d60: 6469 7265 6374 696f 6e20 6f66 2074 6865 direction of the │ │ │ -000a8d70: 2074 7261 6e73 6c61 7469 6f6e 2076 6563 translation vec │ │ │ -000a8d80: 746f 7220 616e 6420 6861 7320 756e 6974 tor and has unit │ │ │ -000a8d90: 0a6c 656e 6774 682e 0a61 7265 2066 6561 .length..are fea │ │ │ -000a8da0: 7475 7265 2070 6f69 6e74 7320 6672 6f6d ture points from │ │ │ -000a8db0: 2063 616d 6572 6173 2077 6974 6820 7361 cameras with sa │ │ │ -000a8dc0: 6d65 2066 6f63 616c 206c 656e 6774 6820 me focal length │ │ │ -000a8dd0: 616e 6420 7072 696e 6369 7061 6c20 706f and principal po │ │ │ -000a8de0: 696e 742e 0a69 6e6c 6965 7273 2069 6e20 int..inliers in │ │ │ -000a8df0: 706f 696e 7473 3120 616e 6420 706f 696e points1 and poin │ │ │ -000a8e00: 7473 3220 666f 7220 7468 6520 6769 7665 ts2 for the give │ │ │ -000a8e10: 6e20 6573 7365 6e74 6961 6c20 6d61 7472 n essential matr │ │ │ -000a8e20: 6978 2045 2e20 4f6e 6c79 2074 6865 7365 ix E. Only these │ │ │ -000a8e30: 2069 6e6c 6965 7273 2077 696c 6c20 6265 inliers will be │ │ │ -000a8e40: 2075 7365 6420 746f 0a72 6563 6f76 6572 used to.recover │ │ │ -000a8e50: 2070 6f73 652e 2049 6e20 7468 6520 6f75 pose. In the ou │ │ │ -000a8e60: 7470 7574 206d 6173 6b20 6f6e 6c79 2069 tput mask only i │ │ │ -000a8e70: 6e6c 6965 7273 2077 6869 6368 2070 6173 nliers which pas │ │ │ -000a8e80: 7320 7468 6520 6368 6972 616c 6974 7920 s the chirality │ │ │ -000a8e90: 6368 6563 6b2e 0a0a 5468 6973 2066 756e check...This fun │ │ │ -000a8ea0: 6374 696f 6e20 6469 6666 6572 7320 6672 ction differs fr │ │ │ -000a8eb0: 6f6d 2074 6865 206f 6e65 2061 626f 7665 om the one above │ │ │ -000a8ec0: 2074 6861 7420 6974 2063 6f6d 7075 7465 that it compute │ │ │ -000a8ed0: 7320 6361 6d65 7261 2069 6e74 7269 6e73 s camera intrins │ │ │ -000a8ee0: 6963 206d 6174 7269 7820 6672 6f6d 2066 ic matrix from f │ │ │ -000a8ef0: 6f63 616c 206c 656e 6774 6820 616e 640a ocal length and. │ │ │ -000a8f00: 7072 696e 6369 7061 6c20 706f 696e 743a principal point: │ │ │ -000a8f10: 0a0a 5c28 4120 3d0a 5c62 6567 696e 7b62 ..\(A =.\begin{b │ │ │ -000a8f20: 6d61 7472 6978 7d0a 6620 2661 6d70 3b20 matrix}.f & │ │ │ -000a8f30: 3020 2661 6d70 3b20 785f 7b70 707d 2020 0 & x_{pp} │ │ │ -000a8f40: 5c5c 0a30 2026 616d 703b 2066 2026 616d \\.0 & f &am │ │ │ -000a8f50: 703b 2079 5f7b 7070 7d20 205c 5c0a 3020 p; y_{pp} \\.0 │ │ │ -000a8f60: 2661 6d70 3b20 3020 2661 6d70 3b20 310a & 0 & 1. │ │ │ -000a8f70: 5c65 6e64 7b62 6d61 7472 6978 7d5c 293c \end{bmatrix}\)< │ │ │ -000a8f80: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ -000a8f90: 3a3c 2f64 743e 0a3c 6464 3e61 7574 6f6d :
    .
    autom │ │ │ -000a8fa0: 6174 6963 616c 6c79 2067 656e 6572 6174 atically generat │ │ │ -000a8fb0: 6564 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f ed
    .
    ... │ │ │ -000a8fd0: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..

    recoverPose

    .
    .
    │ │ │ -000a9100: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -000a9120: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -000a9130: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;int< │ │ │ -000a9150: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> recoverPo │ │ │ -000a9180: 7365 3c2f 7370 616e 3e3c 7762 723e 3c73 se(Mat  │ │ │ -000a91f0: 3b45 2c0a 203c 6120 6872 6566 3d22 2e2e ;E,. Mat po │ │ │ -000a9240: 696e 7473 312c 0a20 3c61 2068 7265 663d ints1,. Mat  │ │ │ -000a9290: 3b70 6f69 6e74 7332 2c0a 203c 6120 6872 ;points2,. Mat&n │ │ │ -000a92e0: 6273 703b 6361 6d65 7261 4d61 7472 6978 bsp;cameraMatrix │ │ │ -000a92f0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000a9330: 6174 3c2f 613e 266e 6273 703b 522c 0a20 at R,. │ │ │ -000a9340: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000a9380: 2f61 3e26 6e62 7370 3b74 2c0a 2064 6f75 /a> t,. dou │ │ │ -000a9390: 626c 6526 6e62 7370 3b64 6973 7461 6e63 ble distanc │ │ │ -000a93a0: 6554 6872 6573 682c 0a20 3c61 2068 7265 eThresh,. Mat&nb │ │ │ -000a93f0: 7370 3b6d 6173 6b2c 0a20 3c61 2068 7265 sp;mask,. Mat&nb │ │ │ -000a9440: 7370 3b74 7269 616e 6775 6c61 7465 6450 sp;triangulatedP │ │ │ -000a9450: 6f69 6e74 7329 3c2f 7370 616e 3e3c 2f64 oints).
    .
    Param │ │ │ -000a9480: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ -000a9490: 3c63 6f64 653e 453c 2f63 6f64 653e 202d E - │ │ │ -000a94a0: 2054 6865 2069 6e70 7574 2065 7373 656e The input essen │ │ │ -000a94b0: 7469 616c 206d 6174 7269 782e 3c2f 6464 tial matrix.
    .
    poin │ │ │ -000a94d0: 7473 313c 2f63 6f64 653e 202d 2041 7272 ts1 - Arr │ │ │ -000a94e0: 6179 206f 6620 4e20 3244 2070 6f69 6e74 ay of N 2D point │ │ │ -000a94f0: 7320 6672 6f6d 2074 6865 2066 6972 7374 s from the first │ │ │ -000a9500: 2069 6d61 6765 2e20 5468 6520 706f 696e image. The poin │ │ │ -000a9510: 7420 636f 6f72 6469 6e61 7465 7320 7368 t coordinates sh │ │ │ -000a9520: 6f75 6c64 2062 650a 666c 6f61 7469 6e67 ould be.floating │ │ │ -000a9530: 2d70 6f69 6e74 2028 7369 6e67 6c65 206f -point (single o │ │ │ -000a9540: 7220 646f 7562 6c65 2070 7265 6369 7369 r double precisi │ │ │ -000a9550: 6f6e 292e 3c2f 6464 3e0a 3c64 643e 3c63 on).
    .
    points2 - Array of th │ │ │ -000a9580: 6520 7365 636f 6e64 2069 6d61 6765 2070 e second image p │ │ │ -000a9590: 6f69 6e74 7320 6f66 2074 6865 2073 616d oints of the sam │ │ │ -000a95a0: 6520 7369 7a65 2061 6e64 2066 6f72 6d61 e size and forma │ │ │ -000a95b0: 7420 6173 2070 6f69 6e74 7331 2e3c 2f64 t as points1..
    cam │ │ │ -000a95d0: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ -000a95e0: 202d 2043 616d 6572 6120 696e 7472 696e - Camera intrin │ │ │ -000a95f0: 7369 6320 6d61 7472 6978 205c 285c 6361 sic matrix \(\ca │ │ │ -000a9600: 6d65 7261 6d61 7472 6978 7b41 7d5c 2920 meramatrix{A}\) │ │ │ -000a9610: 2e0a 4e6f 7465 2074 6861 7420 7468 6973 ..Note that this │ │ │ -000a9620: 2066 756e 6374 696f 6e20 6173 7375 6d65 function assume │ │ │ -000a9630: 7320 7468 6174 2070 6f69 6e74 7331 2061 s that points1 a │ │ │ -000a9640: 6e64 2070 6f69 6e74 7332 2061 7265 2066 nd points2 are f │ │ │ -000a9650: 6561 7475 7265 2070 6f69 6e74 7320 6672 eature points fr │ │ │ -000a9660: 6f6d 2063 616d 6572 6173 2077 6974 6820 om cameras with │ │ │ -000a9670: 7468 650a 7361 6d65 2063 616d 6572 6120 the.same camera │ │ │ -000a9680: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ -000a9690: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    R - Outp │ │ │ -000a96b0: 7574 2072 6f74 6174 696f 6e20 6d61 7472 ut rotation matr │ │ │ -000a96c0: 6978 2e20 546f 6765 7468 6572 2077 6974 ix. Together wit │ │ │ -000a96d0: 6820 7468 6520 7472 616e 736c 6174 696f h the translatio │ │ │ -000a96e0: 6e20 7665 6374 6f72 2c20 7468 6973 206d n vector, this m │ │ │ -000a96f0: 6174 7269 7820 6d61 6b65 7320 7570 2061 atrix makes up a │ │ │ -000a9700: 2074 7570 6c65 0a74 6861 7420 7065 7266 tuple.that perf │ │ │ -000a9710: 6f72 6d73 2061 2063 6861 6e67 6520 6f66 orms a change of │ │ │ -000a9720: 2062 6173 6973 2066 726f 6d20 7468 6520 basis from the │ │ │ -000a9730: 6669 7273 7420 6361 6d65 7261 2773 2063 first camera's c │ │ │ -000a9740: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ -000a9750: 2074 6f20 7468 6520 7365 636f 6e64 2063 to the second c │ │ │ -000a9760: 616d 6572 6127 730a 636f 6f72 6469 6e61 amera's.coordina │ │ │ -000a9770: 7465 2073 7973 7465 6d2e 204e 6f74 6520 te system. Note │ │ │ -000a9780: 7468 6174 2c20 696e 2067 656e 6572 616c that, in general │ │ │ -000a9790: 2c20 7420 6361 6e20 6e6f 7420 6265 2075 , t can not be u │ │ │ -000a97a0: 7365 6420 666f 7220 7468 6973 2074 7570 sed for this tup │ │ │ -000a97b0: 6c65 2c20 7365 6520 7468 6520 7061 7261 le, see the para │ │ │ -000a97c0: 6d65 7465 720a 6465 7363 7269 7074 696f meter.descriptio │ │ │ -000a97d0: 6e20 6265 6c6f 772e 3c2f 6464 3e0a 3c64 n below.
    .t │ │ │ -000a97f0: 202d 204f 7574 7075 7420 7472 616e 736c - Output transl │ │ │ -000a9800: 6174 696f 6e20 7665 6374 6f72 2e20 5468 ation vector. Th │ │ │ -000a9810: 6973 2076 6563 746f 7220 6973 206f 6274 is vector is obt │ │ │ -000a9820: 6169 6e65 6420 6279 2052 4546 3a20 6465 ained by REF: de │ │ │ -000a9830: 636f 6d70 6f73 6545 7373 656e 7469 616c composeEssential │ │ │ -000a9840: 4d61 7420 616e 640a 7468 6572 6566 6f72 Mat and.therefor │ │ │ -000a9850: 6520 6973 206f 6e6c 7920 6b6e 6f77 6e20 e is only known │ │ │ -000a9860: 7570 2074 6f20 7363 616c 652c 2069 2e65 up to scale, i.e │ │ │ -000a9870: 2e20 7420 6973 2074 6865 2064 6972 6563 . t is the direc │ │ │ -000a9880: 7469 6f6e 206f 6620 7468 6520 7472 616e tion of the tran │ │ │ -000a9890: 736c 6174 696f 6e20 7665 6374 6f72 2061 slation vector a │ │ │ -000a98a0: 6e64 2068 6173 2075 6e69 740a 6c65 6e67 nd has unit.leng │ │ │ -000a98b0: 7468 2e3c 2f64 643e 0a3c 6464 3e3c 636f th..
    distanceThres │ │ │ -000a98d0: 683c 2f63 6f64 653e 202d 2074 6872 6573 h - thres │ │ │ -000a98e0: 686f 6c64 2064 6973 7461 6e63 6520 7768 hold distance wh │ │ │ -000a98f0: 6963 6820 6973 2075 7365 6420 746f 2066 ich is used to f │ │ │ -000a9900: 696c 7465 7220 6f75 7420 6661 7220 6177 ilter out far aw │ │ │ -000a9910: 6179 2070 6f69 6e74 7320 2869 2e65 2e20 ay points (i.e. │ │ │ -000a9920: 696e 6669 6e69 7465 0a70 6f69 6e74 7329 infinite.points) │ │ │ -000a9930: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    mask - I │ │ │ -000a9950: 6e70 7574 2f6f 7574 7075 7420 6d61 736b nput/output mask │ │ │ -000a9960: 2066 6f72 2069 6e6c 6965 7273 2069 6e20 for inliers in │ │ │ -000a9970: 706f 696e 7473 3120 616e 6420 706f 696e points1 and poin │ │ │ -000a9980: 7473 322e 2049 6620 6974 2069 7320 6e6f ts2. If it is no │ │ │ -000a9990: 7420 656d 7074 792c 2074 6865 6e20 6974 t empty, then it │ │ │ -000a99a0: 206d 6172 6b73 0a69 6e6c 6965 7273 2069 marks.inliers i │ │ │ -000a99b0: 6e20 706f 696e 7473 3120 616e 6420 706f n points1 and po │ │ │ -000a99c0: 696e 7473 3220 666f 7220 7468 6520 6769 ints2 for the gi │ │ │ -000a99d0: 7665 6e20 6573 7365 6e74 6961 6c20 6d61 ven essential ma │ │ │ -000a99e0: 7472 6978 2045 2e20 4f6e 6c79 2074 6865 trix E. Only the │ │ │ -000a99f0: 7365 2069 6e6c 6965 7273 2077 696c 6c20 se inliers will │ │ │ -000a9a00: 6265 2075 7365 6420 746f 0a72 6563 6f76 be used to.recov │ │ │ -000a9a10: 6572 2070 6f73 652e 2049 6e20 7468 6520 er pose. In the │ │ │ -000a9a20: 6f75 7470 7574 206d 6173 6b20 6f6e 6c79 output mask only │ │ │ -000a9a30: 2069 6e6c 6965 7273 2077 6869 6368 2070 inliers which p │ │ │ -000a9a40: 6173 7320 7468 6520 6368 6972 616c 6974 ass the chiralit │ │ │ -000a9a50: 7920 6368 6563 6b2e 3c2f 6464 3e0a 3c64 y check.
    .triangul │ │ │ -000a9a70: 6174 6564 506f 696e 7473 3c2f 636f 6465 atedPoints - 3D points wh │ │ │ -000a9a90: 6963 6820 7765 7265 2072 6563 6f6e 7374 ich were reconst │ │ │ -000a9aa0: 7275 6374 6564 2062 7920 7472 6961 6e67 ructed by triang │ │ │ -000a9ab0: 756c 6174 696f 6e2e 0a0a 5468 6973 2066 ulation...This f │ │ │ -000a9ac0: 756e 6374 696f 6e20 6469 6666 6572 7320 unction differs │ │ │ -000a9ad0: 6672 6f6d 2074 6865 206f 6e65 2061 626f from the one abo │ │ │ -000a9ae0: 7665 2074 6861 7420 6974 206f 7574 7075 ve that it outpu │ │ │ -000a9af0: 7473 2074 6865 2074 7269 616e 6775 6c61 ts the triangula │ │ │ -000a9b00: 7465 6420 3344 2070 6f69 6e74 2074 6861 ted 3D point tha │ │ │ -000a9b10: 7420 6172 6520 7573 6564 2066 6f72 0a74 t are used for.t │ │ │ -000a9b20: 6865 2063 6869 7261 6c69 7479 2063 6865 he chirality che │ │ │ -000a9b30: 636b 2e3c 2f64 643e 0a3c 6474 3e52 6574 ck..
    Ret │ │ │ -000a9b40: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e61 urns:
    .
    a │ │ │ -000a9b50: 7574 6f6d 6174 6963 616c 6c79 2067 656e utomatically gen │ │ │ -000a9b60: 6572 6174 6564 3c2f 6464 3e0a 3c2f 646c erated
    .
    .
    ..
  • .
  • .< │ │ │ -000a9b90: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ -000a9ba0: 6574 6169 6c22 2069 643d 2272 6563 6f76 etail" id="recov │ │ │ -000a9bb0: 6572 506f 7365 286f 7267 2e6f 7065 6e63 erPose(org.openc │ │ │ -000a9bc0: 762e 636f 7265 2e4d 6174 2c6f 7267 2e6f v.core.Mat,org.o │ │ │ -000a9bd0: 7065 6e63 762e 636f 7265 2e4d 6174 2c6f pencv.core.Mat,o │ │ │ -000a9be0: 7267 2e6f 7065 6e63 762e 636f 7265 2e4d rg.opencv.core.M │ │ │ -000a9bf0: 6174 2c6f 7267 2e6f 7065 6e63 762e 636f at,org.opencv.co │ │ │ -000a9c00: 7265 2e4d 6174 2c6f 7267 2e6f 7065 6e63 re.Mat,org.openc │ │ │ -000a9c10: 762e 636f 7265 2e4d 6174 2c6f 7267 2e6f v.core.Mat,org.o │ │ │ -000a9c20: 7065 6e63 762e 636f 7265 2e4d 6174 2c64 pencv.core.Mat,d │ │ │ -000a9c30: 6f75 626c 652c 6f72 672e 6f70 656e 6376 ouble,org.opencv │ │ │ -000a9c40: 2e63 6f72 652e 4d61 7429 223e 0a3c 6833 .core.Mat)">.

    recoverPose

    .
    .
    │ │ │ -000a9ca0: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -000a9cc0: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -000a9cd0: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;int< │ │ │ -000a9cf0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> recoverPo │ │ │ -000a9d20: 7365 3c2f 7370 616e 3e3c 7762 723e 3c73 se(Mat  │ │ │ -000a9d90: 3b45 2c0a 203c 6120 6872 6566 3d22 2e2e ;E,. Mat po │ │ │ -000a9de0: 696e 7473 312c 0a20 3c61 2068 7265 663d ints1,. Mat  │ │ │ -000a9e30: 3b70 6f69 6e74 7332 2c0a 203c 6120 6872 ;points2,. Mat&n │ │ │ -000a9e80: 6273 703b 6361 6d65 7261 4d61 7472 6978 bsp;cameraMatrix │ │ │ -000a9e90: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000a9ed0: 6174 3c2f 613e 266e 6273 703b 522c 0a20 at R,. │ │ │ -000a9ee0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000a9f20: 2f61 3e26 6e62 7370 3b74 2c0a 2064 6f75 /a> t,. dou │ │ │ -000a9f30: 626c 6526 6e62 7370 3b64 6973 7461 6e63 ble distanc │ │ │ -000a9f40: 6554 6872 6573 682c 0a20 3c61 2068 7265 eThresh,. Mat&nb │ │ │ -000a9f90: 7370 3b6d 6173 6b29 3c2f 7370 616e 3e3c sp;mask)< │ │ │ -000a9fa0: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ -000a9fc0: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .E │ │ │ -000a9fe0: 202d 2054 6865 2069 6e70 7574 2065 7373 - The input ess │ │ │ -000a9ff0: 656e 7469 616c 206d 6174 7269 782e 3c2f ential matrix..
    po │ │ │ -000aa010: 696e 7473 313c 2f63 6f64 653e 202d 2041 ints1 - A │ │ │ -000aa020: 7272 6179 206f 6620 4e20 3244 2070 6f69 rray of N 2D poi │ │ │ -000aa030: 6e74 7320 6672 6f6d 2074 6865 2066 6972 nts from the fir │ │ │ -000aa040: 7374 2069 6d61 6765 2e20 5468 6520 706f st image. The po │ │ │ -000aa050: 696e 7420 636f 6f72 6469 6e61 7465 7320 int coordinates │ │ │ -000aa060: 7368 6f75 6c64 2062 650a 666c 6f61 7469 should be.floati │ │ │ -000aa070: 6e67 2d70 6f69 6e74 2028 7369 6e67 6c65 ng-point (single │ │ │ -000aa080: 206f 7220 646f 7562 6c65 2070 7265 6369 or double preci │ │ │ -000aa090: 7369 6f6e 292e 3c2f 6464 3e0a 3c64 643e sion).
    .
    │ │ │ -000aa0a0: 3c63 6f64 653e 706f 696e 7473 323c 2f63 points2 - Array of │ │ │ -000aa0c0: 7468 6520 7365 636f 6e64 2069 6d61 6765 the second image │ │ │ -000aa0d0: 2070 6f69 6e74 7320 6f66 2074 6865 2073 points of the s │ │ │ -000aa0e0: 616d 6520 7369 7a65 2061 6e64 2066 6f72 ame size and for │ │ │ -000aa0f0: 6d61 7420 6173 2070 6f69 6e74 7331 2e3c mat as points1.< │ │ │ -000aa100: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ -000aa110: 616d 6572 614d 6174 7269 783c 2f63 6f64 ameraMatrix - Camera intr │ │ │ -000aa130: 696e 7369 6320 6d61 7472 6978 205c 285c insic matrix \(\ │ │ │ -000aa140: 6361 6d65 7261 6d61 7472 6978 7b41 7d5c cameramatrix{A}\ │ │ │ -000aa150: 2920 2e0a 4e6f 7465 2074 6861 7420 7468 ) ..Note that th │ │ │ -000aa160: 6973 2066 756e 6374 696f 6e20 6173 7375 is function assu │ │ │ -000aa170: 6d65 7320 7468 6174 2070 6f69 6e74 7331 mes that points1 │ │ │ -000aa180: 2061 6e64 2070 6f69 6e74 7332 2061 7265 and points2 are │ │ │ -000aa190: 2066 6561 7475 7265 2070 6f69 6e74 7320 feature points │ │ │ -000aa1a0: 6672 6f6d 2063 616d 6572 6173 2077 6974 from cameras wit │ │ │ -000aa1b0: 6820 7468 650a 7361 6d65 2063 616d 6572 h the.same camer │ │ │ -000aa1c0: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ -000aa1d0: 6978 2e3c 2f64 643e 0a3c 6464 3e3c 636f ix.
    .
    R - Ou │ │ │ -000aa1f0: 7470 7574 2072 6f74 6174 696f 6e20 6d61 tput rotation ma │ │ │ -000aa200: 7472 6978 2e20 546f 6765 7468 6572 2077 trix. Together w │ │ │ -000aa210: 6974 6820 7468 6520 7472 616e 736c 6174 ith the translat │ │ │ -000aa220: 696f 6e20 7665 6374 6f72 2c20 7468 6973 ion vector, this │ │ │ -000aa230: 206d 6174 7269 7820 6d61 6b65 7320 7570 matrix makes up │ │ │ -000aa240: 2061 2074 7570 6c65 0a74 6861 7420 7065 a tuple.that pe │ │ │ -000aa250: 7266 6f72 6d73 2061 2063 6861 6e67 6520 rforms a change │ │ │ -000aa260: 6f66 2062 6173 6973 2066 726f 6d20 7468 of basis from th │ │ │ -000aa270: 6520 6669 7273 7420 6361 6d65 7261 2773 e first camera's │ │ │ -000aa280: 2063 6f6f 7264 696e 6174 6520 7379 7374 coordinate syst │ │ │ -000aa290: 656d 2074 6f20 7468 6520 7365 636f 6e64 em to the second │ │ │ -000aa2a0: 2063 616d 6572 6127 730a 636f 6f72 6469 camera's.coordi │ │ │ -000aa2b0: 6e61 7465 2073 7973 7465 6d2e 204e 6f74 nate system. Not │ │ │ -000aa2c0: 6520 7468 6174 2c20 696e 2067 656e 6572 e that, in gener │ │ │ -000aa2d0: 616c 2c20 7420 6361 6e20 6e6f 7420 6265 al, t can not be │ │ │ -000aa2e0: 2075 7365 6420 666f 7220 7468 6973 2074 used for this t │ │ │ -000aa2f0: 7570 6c65 2c20 7365 6520 7468 6520 7061 uple, see the pa │ │ │ -000aa300: 7261 6d65 7465 720a 6465 7363 7269 7074 rameter.descript │ │ │ -000aa310: 696f 6e20 6265 6c6f 772e 3c2f 6464 3e0a ion below.
    . │ │ │ -000aa320: 3c64 643e 3c63 6f64 653e 743c 2f63 6f64
    t - Output tran │ │ │ -000aa340: 736c 6174 696f 6e20 7665 6374 6f72 2e20 slation vector. │ │ │ -000aa350: 5468 6973 2076 6563 746f 7220 6973 206f This vector is o │ │ │ -000aa360: 6274 6169 6e65 6420 6279 2052 4546 3a20 btained by REF: │ │ │ -000aa370: 6465 636f 6d70 6f73 6545 7373 656e 7469 decomposeEssenti │ │ │ -000aa380: 616c 4d61 7420 616e 640a 7468 6572 6566 alMat and.theref │ │ │ -000aa390: 6f72 6520 6973 206f 6e6c 7920 6b6e 6f77 ore is only know │ │ │ -000aa3a0: 6e20 7570 2074 6f20 7363 616c 652c 2069 n up to scale, i │ │ │ -000aa3b0: 2e65 2e20 7420 6973 2074 6865 2064 6972 .e. t is the dir │ │ │ -000aa3c0: 6563 7469 6f6e 206f 6620 7468 6520 7472 ection of the tr │ │ │ -000aa3d0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ -000aa3e0: 2061 6e64 2068 6173 2075 6e69 740a 6c65 and has unit.le │ │ │ -000aa3f0: 6e67 7468 2e3c 2f64 643e 0a3c 6464 3e3c ngth.
    .
    < │ │ │ -000aa400: 636f 6465 3e64 6973 7461 6e63 6554 6872 code>distanceThr │ │ │ -000aa410: 6573 683c 2f63 6f64 653e 202d 2074 6872 esh - thr │ │ │ -000aa420: 6573 686f 6c64 2064 6973 7461 6e63 6520 eshold distance │ │ │ -000aa430: 7768 6963 6820 6973 2075 7365 6420 746f which is used to │ │ │ -000aa440: 2066 696c 7465 7220 6f75 7420 6661 7220 filter out far │ │ │ -000aa450: 6177 6179 2070 6f69 6e74 7320 2869 2e65 away points (i.e │ │ │ -000aa460: 2e20 696e 6669 6e69 7465 0a70 6f69 6e74 . infinite.point │ │ │ -000aa470: 7329 2e3c 2f64 643e 0a3c 6464 3e3c 636f s).
    .
    mask - │ │ │ -000aa490: 2049 6e70 7574 2f6f 7574 7075 7420 6d61 Input/output ma │ │ │ -000aa4a0: 736b 2066 6f72 2069 6e6c 6965 7273 2069 sk for inliers i │ │ │ -000aa4b0: 6e20 706f 696e 7473 3120 616e 6420 706f n points1 and po │ │ │ -000aa4c0: 696e 7473 322e 2049 6620 6974 2069 7320 ints2. If it is │ │ │ -000aa4d0: 6e6f 7420 656d 7074 792c 2074 6865 6e20 not empty, then │ │ │ -000aa4e0: 6974 206d 6172 6b73 0a69 6e6c 6965 7273 it marks.inliers │ │ │ -000aa4f0: 2069 6e20 706f 696e 7473 3120 616e 6420 in points1 and │ │ │ -000aa500: 706f 696e 7473 3220 666f 7220 7468 6520 points2 for the │ │ │ -000aa510: 6769 7665 6e20 6573 7365 6e74 6961 6c20 given essential │ │ │ -000aa520: 6d61 7472 6978 2045 2e20 4f6e 6c79 2074 matrix E. Only t │ │ │ -000aa530: 6865 7365 2069 6e6c 6965 7273 2077 696c hese inliers wil │ │ │ -000aa540: 6c20 6265 2075 7365 6420 746f 0a72 6563 l be used to.rec │ │ │ -000aa550: 6f76 6572 2070 6f73 652e 2049 6e20 7468 over pose. In th │ │ │ -000aa560: 6520 6f75 7470 7574 206d 6173 6b20 6f6e e output mask on │ │ │ -000aa570: 6c79 2069 6e6c 6965 7273 2077 6869 6368 ly inliers which │ │ │ -000aa580: 2070 6173 7320 7468 6520 6368 6972 616c pass the chiral │ │ │ -000aa590: 6974 7920 6368 6563 6b2e 0a0a 5468 6973 ity check...This │ │ │ -000aa5a0: 2066 756e 6374 696f 6e20 6469 6666 6572 function differ │ │ │ -000aa5b0: 7320 6672 6f6d 2074 6865 206f 6e65 2061 s from the one a │ │ │ -000aa5c0: 626f 7665 2074 6861 7420 6974 206f 7574 bove that it out │ │ │ -000aa5d0: 7075 7473 2074 6865 2074 7269 616e 6775 puts the triangu │ │ │ -000aa5e0: 6c61 7465 6420 3344 2070 6f69 6e74 2074 lated 3D point t │ │ │ -000aa5f0: 6861 7420 6172 6520 7573 6564 2066 6f72 hat are used for │ │ │ -000aa600: 0a74 6865 2063 6869 7261 6c69 7479 2063 .the chirality c │ │ │ -000aa610: 6865 636b 2e3c 2f64 643e 0a3c 6474 3e52 heck.
    .
    R │ │ │ -000aa620: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    automatically g │ │ │ -000aa640: 656e 6572 6174 6564 3c2f 6464 3e0a 3c2f enerated
    ..
    ..
  • .
  • │ │ │ -000aa670: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    r │ │ │ -000aa720: 6563 6f76 6572 506f 7365 3c2f 6833 3e0a ecoverPose

    . │ │ │ -000aa730: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ -000aa750: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ -000aa790: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ -000aa7a0: 3c73 7061 6e20 636c 6173 733d 2272 6574 int recoverPose │ │ │ -000aa7f0: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat E │ │ │ -000aa860: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000aa8a0: 6174 3c2f 613e 266e 6273 703b 706f 696e at poin │ │ │ -000aa8b0: 7473 312c 0a20 3c61 2068 7265 663d 222e ts1,. Mat p │ │ │ -000aa900: 6f69 6e74 7332 2c0a 203c 6120 6872 6566 oints2,. Mat&nbs │ │ │ -000aa950: 703b 6361 6d65 7261 4d61 7472 6978 2c0a p;cameraMatrix,. │ │ │ -000aa960: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000aa9a0: 3c2f 613e 266e 6273 703b 522c 0a20 3c61  R,. Mat t,. doubl │ │ │ -000aaa00: 6526 6e62 7370 3b64 6973 7461 6e63 6554 e distanceT │ │ │ -000aaa10: 6872 6573 6829 3c2f 7370 616e 3e3c 2f64 hresh).
    .
    Param │ │ │ -000aaa40: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ -000aaa50: 3c63 6f64 653e 453c 2f63 6f64 653e 202d E - │ │ │ -000aaa60: 2054 6865 2069 6e70 7574 2065 7373 656e The input essen │ │ │ -000aaa70: 7469 616c 206d 6174 7269 782e 3c2f 6464 tial matrix.
    .
    poin │ │ │ -000aaa90: 7473 313c 2f63 6f64 653e 202d 2041 7272 ts1 - Arr │ │ │ -000aaaa0: 6179 206f 6620 4e20 3244 2070 6f69 6e74 ay of N 2D point │ │ │ -000aaab0: 7320 6672 6f6d 2074 6865 2066 6972 7374 s from the first │ │ │ -000aaac0: 2069 6d61 6765 2e20 5468 6520 706f 696e image. The poin │ │ │ -000aaad0: 7420 636f 6f72 6469 6e61 7465 7320 7368 t coordinates sh │ │ │ -000aaae0: 6f75 6c64 2062 650a 666c 6f61 7469 6e67 ould be.floating │ │ │ -000aaaf0: 2d70 6f69 6e74 2028 7369 6e67 6c65 206f -point (single o │ │ │ -000aab00: 7220 646f 7562 6c65 2070 7265 6369 7369 r double precisi │ │ │ -000aab10: 6f6e 292e 3c2f 6464 3e0a 3c64 643e 3c63 on).
    .
    points2 - Array of th │ │ │ -000aab40: 6520 7365 636f 6e64 2069 6d61 6765 2070 e second image p │ │ │ -000aab50: 6f69 6e74 7320 6f66 2074 6865 2073 616d oints of the sam │ │ │ -000aab60: 6520 7369 7a65 2061 6e64 2066 6f72 6d61 e size and forma │ │ │ -000aab70: 7420 6173 2070 6f69 6e74 7331 2e3c 2f64 t as points1..
    cam │ │ │ -000aab90: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ -000aaba0: 202d 2043 616d 6572 6120 696e 7472 696e - Camera intrin │ │ │ -000aabb0: 7369 6320 6d61 7472 6978 205c 285c 6361 sic matrix \(\ca │ │ │ -000aabc0: 6d65 7261 6d61 7472 6978 7b41 7d5c 2920 meramatrix{A}\) │ │ │ -000aabd0: 2e0a 4e6f 7465 2074 6861 7420 7468 6973 ..Note that this │ │ │ -000aabe0: 2066 756e 6374 696f 6e20 6173 7375 6d65 function assume │ │ │ -000aabf0: 7320 7468 6174 2070 6f69 6e74 7331 2061 s that points1 a │ │ │ -000aac00: 6e64 2070 6f69 6e74 7332 2061 7265 2066 nd points2 are f │ │ │ -000aac10: 6561 7475 7265 2070 6f69 6e74 7320 6672 eature points fr │ │ │ -000aac20: 6f6d 2063 616d 6572 6173 2077 6974 6820 om cameras with │ │ │ -000aac30: 7468 650a 7361 6d65 2063 616d 6572 6120 the.same camera │ │ │ -000aac40: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ -000aac50: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    R - Outp │ │ │ -000aac70: 7574 2072 6f74 6174 696f 6e20 6d61 7472 ut rotation matr │ │ │ -000aac80: 6978 2e20 546f 6765 7468 6572 2077 6974 ix. Together wit │ │ │ -000aac90: 6820 7468 6520 7472 616e 736c 6174 696f h the translatio │ │ │ -000aaca0: 6e20 7665 6374 6f72 2c20 7468 6973 206d n vector, this m │ │ │ -000aacb0: 6174 7269 7820 6d61 6b65 7320 7570 2061 atrix makes up a │ │ │ -000aacc0: 2074 7570 6c65 0a74 6861 7420 7065 7266 tuple.that perf │ │ │ -000aacd0: 6f72 6d73 2061 2063 6861 6e67 6520 6f66 orms a change of │ │ │ -000aace0: 2062 6173 6973 2066 726f 6d20 7468 6520 basis from the │ │ │ -000aacf0: 6669 7273 7420 6361 6d65 7261 2773 2063 first camera's c │ │ │ -000aad00: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ -000aad10: 2074 6f20 7468 6520 7365 636f 6e64 2063 to the second c │ │ │ -000aad20: 616d 6572 6127 730a 636f 6f72 6469 6e61 amera's.coordina │ │ │ -000aad30: 7465 2073 7973 7465 6d2e 204e 6f74 6520 te system. Note │ │ │ -000aad40: 7468 6174 2c20 696e 2067 656e 6572 616c that, in general │ │ │ -000aad50: 2c20 7420 6361 6e20 6e6f 7420 6265 2075 , t can not be u │ │ │ -000aad60: 7365 6420 666f 7220 7468 6973 2074 7570 sed for this tup │ │ │ -000aad70: 6c65 2c20 7365 6520 7468 6520 7061 7261 le, see the para │ │ │ -000aad80: 6d65 7465 720a 6465 7363 7269 7074 696f meter.descriptio │ │ │ -000aad90: 6e20 6265 6c6f 772e 3c2f 6464 3e0a 3c64 n below.
    .t │ │ │ -000aadb0: 202d 204f 7574 7075 7420 7472 616e 736c - Output transl │ │ │ -000aadc0: 6174 696f 6e20 7665 6374 6f72 2e20 5468 ation vector. Th │ │ │ -000aadd0: 6973 2076 6563 746f 7220 6973 206f 6274 is vector is obt │ │ │ -000aade0: 6169 6e65 6420 6279 2052 4546 3a20 6465 ained by REF: de │ │ │ -000aadf0: 636f 6d70 6f73 6545 7373 656e 7469 616c composeEssential │ │ │ -000aae00: 4d61 7420 616e 640a 7468 6572 6566 6f72 Mat and.therefor │ │ │ -000aae10: 6520 6973 206f 6e6c 7920 6b6e 6f77 6e20 e is only known │ │ │ -000aae20: 7570 2074 6f20 7363 616c 652c 2069 2e65 up to scale, i.e │ │ │ -000aae30: 2e20 7420 6973 2074 6865 2064 6972 6563 . t is the direc │ │ │ -000aae40: 7469 6f6e 206f 6620 7468 6520 7472 616e tion of the tran │ │ │ -000aae50: 736c 6174 696f 6e20 7665 6374 6f72 2061 slation vector a │ │ │ -000aae60: 6e64 2068 6173 2075 6e69 740a 6c65 6e67 nd has unit.leng │ │ │ -000aae70: 7468 2e3c 2f64 643e 0a3c 6464 3e3c 636f th..
    distanceThres │ │ │ -000aae90: 683c 2f63 6f64 653e 202d 2074 6872 6573 h - thres │ │ │ -000aaea0: 686f 6c64 2064 6973 7461 6e63 6520 7768 hold distance wh │ │ │ -000aaeb0: 6963 6820 6973 2075 7365 6420 746f 2066 ich is used to f │ │ │ -000aaec0: 696c 7465 7220 6f75 7420 6661 7220 6177 ilter out far aw │ │ │ -000aaed0: 6179 2070 6f69 6e74 7320 2869 2e65 2e20 ay points (i.e. │ │ │ -000aaee0: 696e 6669 6e69 7465 0a70 6f69 6e74 7329 infinite.points) │ │ │ -000aaef0: 2e0a 696e 6c69 6572 7320 696e 2070 6f69 ..inliers in poi │ │ │ -000aaf00: 6e74 7331 2061 6e64 2070 6f69 6e74 7332 nts1 and points2 │ │ │ -000aaf10: 2066 6f72 2074 6865 2067 6976 656e 2065 for the given e │ │ │ -000aaf20: 7373 656e 7469 616c 206d 6174 7269 7820 ssential matrix │ │ │ -000aaf30: 452e 204f 6e6c 7920 7468 6573 6520 696e E. Only these in │ │ │ -000aaf40: 6c69 6572 7320 7769 6c6c 2062 6520 7573 liers will be us │ │ │ -000aaf50: 6564 2074 6f0a 7265 636f 7665 7220 706f ed to.recover po │ │ │ -000aaf60: 7365 2e20 496e 2074 6865 206f 7574 7075 se. In the outpu │ │ │ -000aaf70: 7420 6d61 736b 206f 6e6c 7920 696e 6c69 t mask only inli │ │ │ -000aaf80: 6572 7320 7768 6963 6820 7061 7373 2074 ers which pass t │ │ │ -000aaf90: 6865 2063 6869 7261 6c69 7479 2063 6865 he chirality che │ │ │ -000aafa0: 636b 2e0a 0a54 6869 7320 6675 6e63 7469 ck...This functi │ │ │ -000aafb0: 6f6e 2064 6966 6665 7273 2066 726f 6d20 on differs from │ │ │ -000aafc0: 7468 6520 6f6e 6520 6162 6f76 6520 7468 the one above th │ │ │ -000aafd0: 6174 2069 7420 6f75 7470 7574 7320 7468 at it outputs th │ │ │ -000aafe0: 6520 7472 6961 6e67 756c 6174 6564 2033 e triangulated 3 │ │ │ -000aaff0: 4420 706f 696e 7420 7468 6174 2061 7265 D point that are │ │ │ -000ab000: 2075 7365 6420 666f 720a 7468 6520 6368 used for.the ch │ │ │ -000ab010: 6972 616c 6974 7920 6368 6563 6b2e 3c2f irality check..
    Returns: │ │ │ -000ab030: 3c2f 6474 3e0a 3c64 643e 6175 746f 6d61
    .
    automa │ │ │ -000ab040: 7469 6361 6c6c 7920 6765 6e65 7261 7465 tically generate │ │ │ -000ab050: 643c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 d
    .
    ..
    .< │ │ │ -000ab070: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    computeCo │ │ │ -000ab100: 7272 6573 706f 6e64 4570 696c 696e 6573 rrespondEpilines │ │ │ -000ab110: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ -000ab170: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -000ab180: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -000ab1a0: 766f 6964 3c2f 7370 616e 3e26 6e62 7370 void  │ │ │ -000ab1b0: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;comp │ │ │ -000ab1d0: 7574 6543 6f72 7265 7370 6f6e 6445 7069 uteCorrespondEpi │ │ │ -000ab1e0: 6c69 6e65 733c 2f73 7061 6e3e 3c77 6272 lines(Mat&n │ │ │ -000ab250: 6273 703b 706f 696e 7473 2c0a 2069 6e74 bsp;points,. int │ │ │ -000ab260: 266e 6273 703b 7768 6963 6849 6d61 6765  whichImage │ │ │ -000ab270: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000ab2b0: 6174 3c2f 613e 266e 6273 703b 462c 0a20 at F,. │ │ │ -000ab2c0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000ab300: 2f61 3e26 6e62 7370 3b6c 696e 6573 293c /a> lines)< │ │ │ -000ab310: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ -000ab330: 466f 7220 706f 696e 7473 2069 6e20 616e For points in an │ │ │ -000ab340: 2069 6d61 6765 206f 6620 6120 7374 6572 image of a ster │ │ │ -000ab350: 656f 2070 6169 722c 2063 6f6d 7075 7465 eo pair, compute │ │ │ -000ab360: 7320 7468 6520 636f 7272 6573 706f 6e64 s the correspond │ │ │ -000ab370: 696e 6720 6570 696c 696e 6573 2069 6e20 ing epilines in │ │ │ -000ab380: 7468 6520 6f74 6865 7220 696d 6167 652e the other image. │ │ │ -000ab390: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -000ab3b0: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000ab3c0: 6464 3e3c 636f 6465 3e70 6f69 6e74 733c dd>points< │ │ │ -000ab3d0: 2f63 6f64 653e 202d 2049 6e70 7574 2070 /code> - Input p │ │ │ -000ab3e0: 6f69 6e74 732e 205c 284e 205c 7469 6d65 oints. \(N \time │ │ │ -000ab3f0: 7320 315c 2920 6f72 205c 2831 205c 7469 s 1\) or \(1 \ti │ │ │ -000ab400: 6d65 7320 4e5c 2920 6d61 7472 6978 206f mes N\) matrix o │ │ │ -000ab410: 6620 7479 7065 2043 565f 3332 4643 3220 f type CV_32FC2 │ │ │ -000ab420: 6f72 0a76 6563 746f 7226 6c74 3b50 6f69 or.vector<Poi │ │ │ -000ab430: 6e74 3266 2667 743b 202e 3c2f 6464 3e0a nt2f> .. │ │ │ -000ab440: 3c64 643e 3c63 6f64 653e 7768 6963 6849
    whichI │ │ │ -000ab450: 6d61 6765 3c2f 636f 6465 3e20 2d20 496e mage - In │ │ │ -000ab460: 6465 7820 6f66 2074 6865 2069 6d61 6765 dex of the image │ │ │ -000ab470: 2028 3120 6f72 2032 2920 7468 6174 2063 (1 or 2) that c │ │ │ -000ab480: 6f6e 7461 696e 7320 7468 6520 706f 696e ontains the poin │ │ │ -000ab490: 7473 202e 3c2f 6464 3e0a 3c64 643e 3c63 ts .
    .
    F - F │ │ │ -000ab4b0: 756e 6461 6d65 6e74 616c 206d 6174 7269 undamental matri │ │ │ -000ab4c0: 7820 7468 6174 2063 616e 2062 6520 6573 x that can be es │ │ │ -000ab4d0: 7469 6d61 7465 6420 7573 696e 6720 2366 timated using #f │ │ │ -000ab4e0: 696e 6446 756e 6461 6d65 6e74 616c 4d61 indFundamentalMa │ │ │ -000ab4f0: 7420 6f72 2023 7374 6572 656f 5265 6374 t or #stereoRect │ │ │ -000ab500: 6966 7920 2e3c 2f64 643e 0a3c 6464 3e3c ify .
    .
    < │ │ │ -000ab510: 636f 6465 3e6c 696e 6573 3c2f 636f 6465 code>lines - Output vecto │ │ │ -000ab530: 7220 6f66 2074 6865 2065 7069 706f 6c61 r of the epipola │ │ │ -000ab540: 7220 6c69 6e65 7320 636f 7272 6573 706f r lines correspo │ │ │ -000ab550: 6e64 696e 6720 746f 2074 6865 2070 6f69 nding to the poi │ │ │ -000ab560: 6e74 7320 696e 2074 6865 206f 7468 6572 nts in the other │ │ │ -000ab570: 2069 6d61 6765 2e0a 4561 6368 206c 696e image..Each lin │ │ │ -000ab580: 6520 5c28 6178 202b 2062 7920 2b20 633d e \(ax + by + c= │ │ │ -000ab590: 305c 2920 6973 2065 6e63 6f64 6564 2062 0\) is encoded b │ │ │ -000ab5a0: 7920 3320 6e75 6d62 6572 7320 5c28 2861 y 3 numbers \((a │ │ │ -000ab5b0: 2c20 622c 2063 295c 2920 2e0a 0a46 6f72 , b, c)\) ...For │ │ │ -000ab5c0: 2065 7665 7279 2070 6f69 6e74 2069 6e20 every point in │ │ │ -000ab5d0: 6f6e 6520 6f66 2074 6865 2074 776f 2069 one of the two i │ │ │ -000ab5e0: 6d61 6765 7320 6f66 2061 2073 7465 7265 mages of a stere │ │ │ -000ab5f0: 6f20 7061 6972 2c20 7468 6520 6675 6e63 o pair, the func │ │ │ -000ab600: 7469 6f6e 2066 696e 6473 2074 6865 2065 tion finds the e │ │ │ -000ab610: 7175 6174 696f 6e20 6f66 2074 6865 0a63 quation of the.c │ │ │ -000ab620: 6f72 7265 7370 6f6e 6469 6e67 2065 7069 orresponding epi │ │ │ -000ab630: 706f 6c61 7220 6c69 6e65 2069 6e20 7468 polar line in th │ │ │ -000ab640: 6520 6f74 6865 7220 696d 6167 652e 0a0a e other image... │ │ │ -000ab650: 4672 6f6d 2074 6865 2066 756e 6461 6d65 From the fundame │ │ │ -000ab660: 6e74 616c 206d 6174 7269 7820 6465 6669 ntal matrix defi │ │ │ -000ab670: 6e69 7469 6f6e 2028 7365 6520 2366 696e nition (see #fin │ │ │ -000ab680: 6446 756e 6461 6d65 6e74 616c 4d61 7420 dFundamentalMat │ │ │ -000ab690: 292c 206c 696e 6520 5c28 6c5e 7b28 3229 ), line \(l^{(2) │ │ │ -000ab6a0: 7d5f 695c 2920 696e 2074 6865 2073 6563 }_i\) in the sec │ │ │ -000ab6b0: 6f6e 640a 696d 6167 6520 666f 7220 7468 ond.image for th │ │ │ -000ab6c0: 6520 706f 696e 7420 5c28 705e 7b28 3129 e point \(p^{(1) │ │ │ -000ab6d0: 7d5f 695c 2920 696e 2074 6865 2066 6972 }_i\) in the fir │ │ │ -000ab6e0: 7374 2069 6d61 6765 2028 7768 656e 2077 st image (when w │ │ │ -000ab6f0: 6869 6368 496d 6167 653d 3120 2920 6973 hichImage=1 ) is │ │ │ -000ab700: 2063 6f6d 7075 7465 6420 6173 3a0a 0a5c computed as:..\ │ │ │ -000ab710: 286c 5e7b 2832 297d 5f69 203d 2046 2070 (l^{(2)}_i = F p │ │ │ -000ab720: 5e7b 2831 297d 5f69 5c29 0a0a 416e 6420 ^{(1)}_i\)..And │ │ │ -000ab730: 7669 6365 2076 6572 7361 2c20 7768 656e vice versa, when │ │ │ -000ab740: 2077 6869 6368 496d 6167 653d 322c 205c whichImage=2, \ │ │ │ -000ab750: 286c 5e7b 2831 297d 5f69 5c29 2069 7320 (l^{(1)}_i\) is │ │ │ -000ab760: 636f 6d70 7574 6564 2066 726f 6d20 5c28 computed from \( │ │ │ -000ab770: 705e 7b28 3229 7d5f 695c 2920 6173 3a0a p^{(2)}_i\) as:. │ │ │ -000ab780: 0a5c 286c 5e7b 2831 297d 5f69 203d 2046 .\(l^{(1)}_i = F │ │ │ -000ab790: 5e54 2070 5e7b 2832 297d 5f69 5c29 0a0a ^T p^{(2)}_i\).. │ │ │ -000ab7a0: 4c69 6e65 2063 6f65 6666 6963 6965 6e74 Line coefficient │ │ │ -000ab7b0: 7320 6172 6520 6465 6669 6e65 6420 7570 s are defined up │ │ │ -000ab7c0: 2074 6f20 6120 7363 616c 652e 2054 6865 to a scale. The │ │ │ -000ab7d0: 7920 6172 6520 6e6f 726d 616c 697a 6564 y are normalized │ │ │ -000ab7e0: 2073 6f20 7468 6174 205c 2861 5f69 5e32 so that \(a_i^2 │ │ │ -000ab7f0: 2b62 5f69 5e32 3d31 5c29 202e 3c2f 6464 +b_i^2=1\) .
    .
    ..< │ │ │ -000ab810: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ -000ab820: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    tr │ │ │ -000ab8c0: 6961 6e67 756c 6174 6550 6f69 6e74 733c iangulatePoints< │ │ │ -000ab8d0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -000ab930: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -000ab940: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;v │ │ │ -000ab960: 6f69 643c 2f73 7061 6e3e 266e 6273 703b oid  │ │ │ -000ab970: 3c73 7061 6e20 636c 6173 733d 2265 6c65 trian │ │ │ -000ab990: 6775 6c61 7465 506f 696e 7473 3c2f 7370 gulatePoints(Ma │ │ │ -000aba00: 743c 2f61 3e26 6e62 7370 3b70 726f 6a4d t projM │ │ │ -000aba10: 6174 7231 2c0a 203c 6120 6872 6566 3d22 atr1,. Mat  │ │ │ -000aba60: 7072 6f6a 4d61 7472 322c 0a20 3c61 2068 projMatr2,. Mat& │ │ │ -000abab0: 6e62 7370 3b70 726f 6a50 6f69 6e74 7331 nbsp;projPoints1 │ │ │ -000abac0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000abb00: 6174 3c2f 613e 266e 6273 703b 7072 6f6a at proj │ │ │ -000abb10: 506f 696e 7473 322c 0a20 3c61 2068 7265 Points2,. Mat&nb │ │ │ -000abb60: 7370 3b70 6f69 6e74 7334 4429 3c2f 7370 sp;points4D)
    .
    Thi │ │ │ -000abb90: 7320 6675 6e63 7469 6f6e 2072 6563 6f6e s function recon │ │ │ -000abba0: 7374 7275 6374 7320 332d 6469 6d65 6e73 structs 3-dimens │ │ │ -000abbb0: 696f 6e61 6c20 706f 696e 7473 2028 696e ional points (in │ │ │ -000abbc0: 2068 6f6d 6f67 656e 656f 7573 2063 6f6f homogeneous coo │ │ │ -000abbd0: 7264 696e 6174 6573 2920 6279 2075 7369 rdinates) by usi │ │ │ -000abbe0: 6e67 0a74 6865 6972 206f 6273 6572 7661 ng.their observa │ │ │ -000abbf0: 7469 6f6e 7320 7769 7468 2061 2073 7465 tions with a ste │ │ │ -000abc00: 7265 6f20 6361 6d65 7261 2e3c 2f64 6976 reo camera.
    .
    .
    Paramet │ │ │ -000abc30: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    projMatr1 - 3x4 proje │ │ │ -000abc60: 6374 696f 6e20 6d61 7472 6978 206f 6620 ction matrix of │ │ │ -000abc70: 7468 6520 6669 7273 7420 6361 6d65 7261 the first camera │ │ │ -000abc80: 2c20 692e 652e 2074 6869 7320 6d61 7472 , i.e. this matr │ │ │ -000abc90: 6978 2070 726f 6a65 6374 7320 3344 2070 ix projects 3D p │ │ │ -000abca0: 6f69 6e74 730a 6769 7665 6e20 696e 2074 oints.given in t │ │ │ -000abcb0: 6865 2077 6f72 6c64 2773 2063 6f6f 7264 he world's coord │ │ │ -000abcc0: 696e 6174 6520 7379 7374 656d 2069 6e74 inate system int │ │ │ -000abcd0: 6f20 7468 6520 6669 7273 7420 696d 6167 o the first imag │ │ │ -000abce0: 652e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 e.
    .
    projMatr2 - 3x4 project │ │ │ -000abd10: 696f 6e20 6d61 7472 6978 206f 6620 7468 ion matrix of th │ │ │ -000abd20: 6520 7365 636f 6e64 2063 616d 6572 612c e second camera, │ │ │ -000abd30: 2069 2e65 2e20 7468 6973 206d 6174 7269 i.e. this matri │ │ │ -000abd40: 7820 7072 6f6a 6563 7473 2033 4420 706f x projects 3D po │ │ │ -000abd50: 696e 7473 0a67 6976 656e 2069 6e20 7468 ints.given in th │ │ │ -000abd60: 6520 776f 726c 6427 7320 636f 6f72 6469 e world's coordi │ │ │ -000abd70: 6e61 7465 2073 7973 7465 6d20 696e 746f nate system into │ │ │ -000abd80: 2074 6865 2073 6563 6f6e 6420 696d 6167 the second imag │ │ │ -000abd90: 652e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 e.
    .
    projPoints1 - 2xN array │ │ │ -000abdc0: 206f 6620 6665 6174 7572 6520 706f 696e of feature poin │ │ │ -000abdd0: 7473 2069 6e20 7468 6520 6669 7273 7420 ts in the first │ │ │ -000abde0: 696d 6167 652e 2049 6e20 7468 6520 6361 image. In the ca │ │ │ -000abdf0: 7365 206f 6620 7468 6520 632b 2b20 7665 se of the c++ ve │ │ │ -000abe00: 7273 696f 6e2c 0a69 7420 6361 6e20 6265 rsion,.it can be │ │ │ -000abe10: 2061 6c73 6f20 6120 7665 6374 6f72 206f also a vector o │ │ │ -000abe20: 6620 6665 6174 7572 6520 706f 696e 7473 f feature points │ │ │ -000abe30: 206f 7220 7477 6f2d 6368 616e 6e65 6c20 or two-channel │ │ │ -000abe40: 6d61 7472 6978 206f 6620 7369 7a65 2031 matrix of size 1 │ │ │ -000abe50: 784e 206f 7220 4e78 312e 3c2f 6464 3e0a xN or Nx1.
    . │ │ │ -000abe60: 3c64 643e 3c63 6f64 653e 7072 6f6a 506f
    projPo │ │ │ -000abe70: 696e 7473 323c 2f63 6f64 653e 202d 2032 ints2 - 2 │ │ │ -000abe80: 784e 2061 7272 6179 206f 6620 636f 7272 xN array of corr │ │ │ -000abe90: 6573 706f 6e64 696e 6720 706f 696e 7473 esponding points │ │ │ -000abea0: 2069 6e20 7468 6520 7365 636f 6e64 2069 in the second i │ │ │ -000abeb0: 6d61 6765 2e20 496e 2074 6865 2063 6173 mage. In the cas │ │ │ -000abec0: 6520 6f66 2074 6865 2063 2b2b 0a76 6572 e of the c++.ver │ │ │ -000abed0: 7369 6f6e 2c20 6974 2063 616e 2062 6520 sion, it can be │ │ │ -000abee0: 616c 736f 2061 2076 6563 746f 7220 6f66 also a vector of │ │ │ -000abef0: 2066 6561 7475 7265 2070 6f69 6e74 7320 feature points │ │ │ -000abf00: 6f72 2074 776f 2d63 6861 6e6e 656c 206d or two-channel m │ │ │ -000abf10: 6174 7269 7820 6f66 2073 697a 6520 3178 atrix of size 1x │ │ │ -000abf20: 4e20 6f72 204e 7831 2e3c 2f64 643e 0a3c N or Nx1.
    .< │ │ │ -000abf30: 6464 3e3c 636f 6465 3e70 6f69 6e74 7334 dd>points4 │ │ │ -000abf40: 443c 2f63 6f64 653e 202d 2034 784e 2061 D - 4xN a │ │ │ -000abf50: 7272 6179 206f 6620 7265 636f 6e73 7472 rray of reconstr │ │ │ -000abf60: 7563 7465 6420 706f 696e 7473 2069 6e20 ucted points in │ │ │ -000abf70: 686f 6d6f 6765 6e65 6f75 7320 636f 6f72 homogeneous coor │ │ │ -000abf80: 6469 6e61 7465 732e 2054 6865 7365 2070 dinates. These p │ │ │ -000abf90: 6f69 6e74 7320 6172 650a 7265 7475 726e oints are.return │ │ │ -000abfa0: 6564 2069 6e20 7468 6520 776f 726c 6427 ed in the world' │ │ │ -000abfb0: 7320 636f 6f72 6469 6e61 7465 2073 7973 s coordinate sys │ │ │ -000abfc0: 7465 6d2e 0a0a 3c62 3e4e 6f74 653a 3c2f tem...Note:. Keep in mi │ │ │ -000abfe0: 6e64 2074 6861 7420 616c 6c20 696e 7075 nd that all inpu │ │ │ -000abff0: 7420 6461 7461 2073 686f 756c 6420 6265 t data should be │ │ │ -000ac000: 206f 6620 666c 6f61 7420 7479 7065 2069 of float type i │ │ │ -000ac010: 6e20 6f72 6465 7220 666f 7220 7468 6973 n order for this │ │ │ -000ac020: 2066 756e 6374 696f 6e20 746f 2077 6f72 function to wor │ │ │ -000ac030: 6b2e 0a0a 3c62 3e4e 6f74 653a 3c2f 623e k...Note: │ │ │ -000ac040: 0a20 2020 4966 2074 6865 2070 726f 6a65 . If the proje │ │ │ -000ac050: 6374 696f 6e20 6d61 7472 6963 6573 2066 ction matrices f │ │ │ -000ac060: 726f 6d20 5245 463a 2073 7465 7265 6f52 rom REF: stereoR │ │ │ -000ac070: 6563 7469 6679 2061 7265 2075 7365 642c ectify are used, │ │ │ -000ac080: 2074 6865 6e20 7468 6520 7265 7475 726e then the return │ │ │ -000ac090: 6564 2070 6f69 6e74 7320 6172 650a 2020 ed points are. │ │ │ -000ac0a0: 2072 6570 7265 7365 6e74 6564 2069 6e20 represented in │ │ │ -000ac0b0: 7468 6520 6669 7273 7420 6361 6d65 7261 the first camera │ │ │ -000ac0c0: 2773 2072 6563 7469 6669 6564 2063 6f6f 's rectified coo │ │ │ -000ac0d0: 7264 696e 6174 6520 7379 7374 656d 2e0a rdinate system.. │ │ │ -000ac0e0: 0a53 4545 3a0a 2020 2072 6570 726f 6a65 .SEE:. reproje │ │ │ -000ac0f0: 6374 496d 6167 6554 6f33 443c 2f64 643e ctImageTo3D │ │ │ -000ac100: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    .
    ..

  • .< │ │ │ -000ac120: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
  • ..

    estim │ │ │ -000b7580: 6174 6541 6666 696e 6550 6172 7469 616c ateAffinePartial │ │ │ -000b7590: 3244 3c2f 6833 3e0a 3c64 6976 2063 6c61 2D

    .
    .
    pu │ │ │ -000b75f0: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static Ma │ │ │ -000b7660: 743c 2f61 3e3c 2f73 7061 6e3e 266e 6273 t&nbs │ │ │ -000b7670: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;est │ │ │ -000b7690: 696d 6174 6541 6666 696e 6550 6172 7469 imateAffineParti │ │ │ -000b76a0: 616c 3244 3c2f 7370 616e 3e3c 7762 723e al2D │ │ │ -000b76b0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ -000b7710: 7370 3b66 726f 6d2c 0a20 3c61 2068 7265 sp;from,. Mat&nb │ │ │ -000b7760: 7370 3b74 6f2c 0a20 3c61 2068 7265 663d sp;to,. Mat  │ │ │ -000b77b0: 3b69 6e6c 6965 7273 2c0a 2069 6e74 266e ;inliers,. int&n │ │ │ -000b77c0: 6273 703b 6d65 7468 6f64 2c0a 2064 6f75 bsp;method,. dou │ │ │ -000b77d0: 626c 6526 6e62 7370 3b72 616e 7361 6352 ble ransacR │ │ │ -000b77e0: 6570 726f 6a54 6872 6573 686f 6c64 2c0a eprojThreshold,. │ │ │ -000b77f0: 206c 6f6e 6726 6e62 7370 3b6d 6178 4974 long maxIt │ │ │ -000b7800: 6572 732c 0a20 646f 7562 6c65 266e 6273 ers,. double&nbs │ │ │ -000b7810: 703b 636f 6e66 6964 656e 6365 293c 2f73 p;confidence)
    .
    Co │ │ │ -000b7840: 6d70 7574 6573 2061 6e20 6f70 7469 6d61 mputes an optima │ │ │ -000b7850: 6c20 6c69 6d69 7465 6420 6166 6669 6e65 l limited affine │ │ │ -000b7860: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ -000b7870: 7769 7468 2034 2064 6567 7265 6573 206f with 4 degrees o │ │ │ -000b7880: 6620 6672 6565 646f 6d20 6265 7477 6565 f freedom betwee │ │ │ -000b7890: 6e0a 7477 6f20 3244 2070 6f69 6e74 2073 n.two 2D point s │ │ │ -000b78a0: 6574 732e 3c2f 6469 763e 0a3c 646c 2063 ets.
    .
    .Parameters:.
    fro │ │ │ -000b78e0: 6d3c 2f63 6f64 653e 202d 2046 6972 7374 m - First │ │ │ -000b78f0: 2069 6e70 7574 2032 4420 706f 696e 7420 input 2D point │ │ │ -000b7900: 7365 742e 3c2f 6464 3e0a 3c64 643e 3c63 set.
    .
    to - │ │ │ -000b7920: 5365 636f 6e64 2069 6e70 7574 2032 4420 Second input 2D │ │ │ -000b7930: 706f 696e 7420 7365 742e 3c2f 6464 3e0a point set.
    . │ │ │ -000b7940: 3c64 643e 3c63 6f64 653e 696e 6c69 6572
    inlier │ │ │ -000b7950: 733c 2f63 6f64 653e 202d 204f 7574 7075 s - Outpu │ │ │ -000b7960: 7420 7665 6374 6f72 2069 6e64 6963 6174 t vector indicat │ │ │ -000b7970: 696e 6720 7768 6963 6820 706f 696e 7473 ing which points │ │ │ -000b7980: 2061 7265 2069 6e6c 6965 7273 2e3c 2f64 are inliers..
    met │ │ │ -000b79a0: 686f 643c 2f63 6f64 653e 202d 2052 6f62 hod - Rob │ │ │ -000b79b0: 7573 7420 6d65 7468 6f64 2075 7365 6420 ust method used │ │ │ -000b79c0: 746f 2063 6f6d 7075 7465 2074 7261 6e73 to compute trans │ │ │ -000b79d0: 666f 726d 6174 696f 6e2e 2054 6865 2066 formation. The f │ │ │ -000b79e0: 6f6c 6c6f 7769 6e67 206d 6574 686f 6473 ollowing methods │ │ │ -000b79f0: 2061 7265 2070 6f73 7369 626c 653a 0a3c are possible:.< │ │ │ -000b7a00: 756c 3e0a 2020 3c6c 693e 0a20 2020 5245 ul>.
  • . RE │ │ │ -000b7a10: 463a 2052 414e 5341 4320 2d20 5241 4e53 F: RANSAC - RANS │ │ │ -000b7a20: 4143 2d62 6173 6564 2072 6f62 7573 7420 AC-based robust │ │ │ -000b7a30: 6d65 7468 6f64 0a20 203c 2f6c 693e 0a20 method.
  • . │ │ │ -000b7a40: 203c 6c69 3e0a 2020 2052 4546 3a20 4c4d
  • . REF: LM │ │ │ -000b7a50: 4544 5320 2d20 4c65 6173 742d 4d65 6469 EDS - Least-Medi │ │ │ -000b7a60: 616e 2072 6f62 7573 7420 6d65 7468 6f64 an robust method │ │ │ -000b7a70: 0a52 414e 5341 4320 6973 2074 6865 2064 .RANSAC is the d │ │ │ -000b7a80: 6566 6175 6c74 206d 6574 686f 642e 0a20 efault method.. │ │ │ -000b7a90: 203c 2f6c 693e 0a3c 2f75 6c3e 3c2f 6464
  • .
    .
    rans │ │ │ -000b7ab0: 6163 5265 7072 6f6a 5468 7265 7368 6f6c acReprojThreshol │ │ │ -000b7ac0: 643c 2f63 6f64 653e 202d 204d 6178 696d d - Maxim │ │ │ -000b7ad0: 756d 2072 6570 726f 6a65 6374 696f 6e20 um reprojection │ │ │ -000b7ae0: 6572 726f 7220 696e 2074 6865 2052 414e error in the RAN │ │ │ -000b7af0: 5341 4320 616c 676f 7269 7468 6d20 746f SAC algorithm to │ │ │ -000b7b00: 2063 6f6e 7369 6465 720a 6120 706f 696e consider.a poin │ │ │ -000b7b10: 7420 6173 2061 6e20 696e 6c69 6572 2e20 t as an inlier. │ │ │ -000b7b20: 4170 706c 6965 7320 6f6e 6c79 2074 6f20 Applies only to │ │ │ -000b7b30: 5241 4e53 4143 2e3c 2f64 643e 0a3c 6464 RANSAC.
    .
    maxIters< │ │ │ -000b7b50: 2f63 6f64 653e 202d 2054 6865 206d 6178 /code> - The max │ │ │ -000b7b60: 696d 756d 206e 756d 6265 7220 6f66 2072 imum number of r │ │ │ -000b7b70: 6f62 7573 7420 6d65 7468 6f64 2069 7465 obust method ite │ │ │ -000b7b80: 7261 7469 6f6e 732e 3c2f 6464 3e0a 3c64 rations.
    .confiden │ │ │ -000b7ba0: 6365 3c2f 636f 6465 3e20 2d20 436f 6e66 ce - Conf │ │ │ -000b7bb0: 6964 656e 6365 206c 6576 656c 2c20 6265 idence level, be │ │ │ -000b7bc0: 7477 6565 6e20 3020 616e 6420 312c 2066 tween 0 and 1, f │ │ │ -000b7bd0: 6f72 2074 6865 2065 7374 696d 6174 6564 or the estimated │ │ │ -000b7be0: 2074 7261 6e73 666f 726d 6174 696f 6e2e transformation. │ │ │ -000b7bf0: 2041 6e79 7468 696e 670a 6265 7477 6565 Anything.betwee │ │ │ -000b7c00: 6e20 302e 3935 2061 6e64 2030 2e39 3920 n 0.95 and 0.99 │ │ │ -000b7c10: 6973 2075 7375 616c 6c79 2067 6f6f 6420 is usually good │ │ │ -000b7c20: 656e 6f75 6768 2e20 5661 6c75 6573 2074 enough. Values t │ │ │ -000b7c30: 6f6f 2063 6c6f 7365 2074 6f20 3120 6361 oo close to 1 ca │ │ │ -000b7c40: 6e20 736c 6f77 2064 6f77 6e20 7468 6520 n slow down the │ │ │ -000b7c50: 6573 7469 6d61 7469 6f6e 0a73 6967 6e69 estimation.signi │ │ │ -000b7c60: 6669 6361 6e74 6c79 2e20 5661 6c75 6573 ficantly. Values │ │ │ -000b7c70: 206c 6f77 6572 2074 6861 6e20 302e 382d lower than 0.8- │ │ │ -000b7c80: 302e 3920 6361 6e20 7265 7375 6c74 2069 0.9 can result i │ │ │ -000b7c90: 6e20 616e 2069 6e63 6f72 7265 6374 6c79 n an incorrectly │ │ │ -000b7ca0: 2065 7374 696d 6174 6564 2074 7261 6e73 estimated trans │ │ │ -000b7cb0: 666f 726d 6174 696f 6e2e 0a50 6173 7369 formation..Passi │ │ │ -000b7cc0: 6e67 2030 2077 696c 6c20 6469 7361 626c ng 0 will disabl │ │ │ -000b7cd0: 6520 7265 6669 6e69 6e67 2c20 736f 2074 e refining, so t │ │ │ -000b7ce0: 6865 206f 7574 7075 7420 6d61 7472 6978 he output matrix │ │ │ -000b7cf0: 2077 696c 6c20 6265 206f 7574 7075 7420 will be output │ │ │ -000b7d00: 6f66 2072 6f62 7573 7420 6d65 7468 6f64 of robust method │ │ │ -000b7d10: 2e3c 2f64 643e 0a3c 6474 3e52 6574 7572 ..
    Retur │ │ │ -000b7d20: 6e73 3a3c 2f64 743e 0a3c 6464 3e4f 7574 ns:
    .
    Out │ │ │ -000b7d30: 7075 7420 3244 2061 6666 696e 6520 7472 put 2D affine tr │ │ │ -000b7d40: 616e 7366 6f72 6d61 7469 6f6e 2028 3420 ansformation (4 │ │ │ -000b7d50: 6465 6772 6565 7320 6f66 2066 7265 6564 degrees of freed │ │ │ -000b7d60: 6f6d 2920 6d61 7472 6978 205c 2832 205c om) matrix \(2 \ │ │ │ -000b7d70: 7469 6d65 7320 335c 2920 6f72 0a65 6d70 times 3\) or.emp │ │ │ -000b7d80: 7479 206d 6174 7269 7820 6966 2074 7261 ty matrix if tra │ │ │ -000b7d90: 6e73 666f 726d 6174 696f 6e20 636f 756c nsformation coul │ │ │ -000b7da0: 6420 6e6f 7420 6265 2065 7374 696d 6174 d not be estimat │ │ │ -000b7db0: 6564 2e0a 0a54 6865 2066 756e 6374 696f ed...The functio │ │ │ -000b7dc0: 6e20 6573 7469 6d61 7465 7320 616e 206f n estimates an o │ │ │ -000b7dd0: 7074 696d 616c 2032 4420 6166 6669 6e65 ptimal 2D affine │ │ │ -000b7de0: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ -000b7df0: 7769 7468 2034 2064 6567 7265 6573 206f with 4 degrees o │ │ │ -000b7e00: 6620 6672 6565 646f 6d20 6c69 6d69 7465 f freedom limite │ │ │ -000b7e10: 6420 746f 0a63 6f6d 6269 6e61 7469 6f6e d to.combination │ │ │ -000b7e20: 7320 6f66 2074 7261 6e73 6c61 7469 6f6e s of translation │ │ │ -000b7e30: 2c20 726f 7461 7469 6f6e 2c20 616e 6420 , rotation, and │ │ │ -000b7e40: 756e 6966 6f72 6d20 7363 616c 696e 672e uniform scaling. │ │ │ -000b7e50: 2055 7365 7320 7468 6520 7365 6c65 6374 Uses the select │ │ │ -000b7e60: 6564 2061 6c67 6f72 6974 686d 2066 6f72 ed algorithm for │ │ │ -000b7e70: 2072 6f62 7573 740a 6573 7469 6d61 7469 robust.estimati │ │ │ -000b7e80: 6f6e 2e0a 0a54 6865 2063 6f6d 7075 7465 on...The compute │ │ │ -000b7e90: 6420 7472 616e 7366 6f72 6d61 7469 6f6e d transformation │ │ │ -000b7ea0: 2069 7320 7468 656e 2072 6566 696e 6564 is then refined │ │ │ -000b7eb0: 2066 7572 7468 6572 2028 7573 696e 6720 further (using │ │ │ -000b7ec0: 6f6e 6c79 2069 6e6c 6965 7273 2920 7769 only inliers) wi │ │ │ -000b7ed0: 7468 2074 6865 0a4c 6576 656e 6265 7267 th the.Levenberg │ │ │ -000b7ee0: 2d4d 6172 7175 6172 6474 206d 6574 686f -Marquardt metho │ │ │ -000b7ef0: 6420 746f 2072 6564 7563 6520 7468 6520 d to reduce the │ │ │ -000b7f00: 7265 2d70 726f 6a65 6374 696f 6e20 6572 re-projection er │ │ │ -000b7f10: 726f 7220 6576 656e 206d 6f72 652e 0a0a ror even more... │ │ │ -000b7f20: 4573 7469 6d61 7465 6420 7472 616e 7366 Estimated transf │ │ │ -000b7f30: 6f72 6d61 7469 6f6e 206d 6174 7269 7820 ormation matrix │ │ │ -000b7f40: 6973 3a0a 5c28 205c 6265 6769 6e7b 626d is:.\( \begin{bm │ │ │ -000b7f50: 6174 7269 787d 205c 636f 7328 5c74 6865 atrix} \cos(\the │ │ │ -000b7f60: 7461 2920 5c63 646f 7420 7320 2661 6d70 ta) \cdot s & │ │ │ -000b7f70: 3b20 2d5c 7369 6e28 5c74 6865 7461 2920 ; -\sin(\theta) │ │ │ -000b7f80: 5c63 646f 7420 7320 2661 6d70 3b20 745f \cdot s & t_ │ │ │ -000b7f90: 7820 5c5c 0a20 2020 2020 2020 2020 2020 x \\. │ │ │ -000b7fa0: 2020 2020 205c 7369 6e28 5c74 6865 7461 \sin(\theta │ │ │ -000b7fb0: 2920 5c63 646f 7420 7320 2661 6d70 3b20 ) \cdot s & │ │ │ -000b7fc0: 5c63 6f73 285c 7468 6574 6129 205c 6364 \cos(\theta) \cd │ │ │ -000b7fd0: 6f74 2073 2026 616d 703b 2074 5f79 0a5c ot s & t_y.\ │ │ │ -000b7fe0: 656e 647b 626d 6174 7269 787d 205c 290a end{bmatrix} \). │ │ │ -000b7ff0: 5768 6572 6520 5c28 205c 7468 6574 6120 Where \( \theta │ │ │ -000b8000: 5c29 2069 7320 7468 6520 726f 7461 7469 \) is the rotati │ │ │ -000b8010: 6f6e 2061 6e67 6c65 2c20 5c28 2073 205c on angle, \( s \ │ │ │ -000b8020: 2920 7468 6520 7363 616c 696e 6720 6661 ) the scaling fa │ │ │ -000b8030: 6374 6f72 2061 6e64 205c 2820 745f 782c ctor and \( t_x, │ │ │ -000b8040: 2074 5f79 205c 2920 6172 650a 7472 616e t_y \) are.tran │ │ │ -000b8050: 736c 6174 696f 6e73 2069 6e20 5c28 2078 slations in \( x │ │ │ -000b8060: 2c20 7920 5c29 2061 7865 7320 7265 7370 , y \) axes resp │ │ │ -000b8070: 6563 7469 7665 6c79 2e0a 0a3c 623e 4e6f ectively...No │ │ │ -000b8080: 7465 3a3c 2f62 3e0a 5468 6520 5241 4e53 te:.The RANS │ │ │ -000b8090: 4143 206d 6574 686f 6420 6361 6e20 6861 AC method can ha │ │ │ -000b80a0: 6e64 6c65 2070 7261 6374 6963 616c 6c79 ndle practically │ │ │ -000b80b0: 2061 6e79 2072 6174 696f 206f 6620 6f75 any ratio of ou │ │ │ -000b80c0: 746c 6965 7273 2062 7574 206e 6565 6420 tliers but need │ │ │ -000b80d0: 6120 7468 7265 7368 6f6c 6420 746f 0a64 a threshold to.d │ │ │ -000b80e0: 6973 7469 6e67 7569 7368 2069 6e6c 6965 istinguish inlie │ │ │ -000b80f0: 7273 2066 726f 6d20 6f75 746c 6965 7273 rs from outliers │ │ │ -000b8100: 2e20 5468 6520 6d65 7468 6f64 204c 4d65 . The method LMe │ │ │ -000b8110: 4453 2064 6f65 7320 6e6f 7420 6e65 6564 DS does not need │ │ │ -000b8120: 2061 6e79 2074 6872 6573 686f 6c64 2062 any threshold b │ │ │ -000b8130: 7574 2069 7420 776f 726b 730a 636f 7272 ut it works.corr │ │ │ -000b8140: 6563 746c 7920 6f6e 6c79 2077 6865 6e20 ectly only when │ │ │ -000b8150: 7468 6572 6520 6172 6520 6d6f 7265 2074 there are more t │ │ │ -000b8160: 6861 6e20 3530 2520 6f66 2069 6e6c 6965 han 50% of inlie │ │ │ -000b8170: 7273 2e0a 0a53 4545 3a20 6573 7469 6d61 rs...SEE: estima │ │ │ -000b8180: 7465 4166 6669 6e65 3244 2c20 6765 7441 teAffine2D, getA │ │ │ -000b8190: 6666 696e 6554 7261 6e73 666f 726d 3c2f ffineTransform.
    .
    │ │ │ -000b81b0: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 ..
  • .
  • .
    .

    es │ │ │ -000b8250: 7469 6d61 7465 4166 6669 6e65 5061 7274 timateAffinePart │ │ │ -000b8260: 6961 6c32 443c 2f68 333e 0a3c 6469 7620 ial2D

    .
    .
    public static Mat& │ │ │ -000b8340: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -000b8360: 6573 7469 6d61 7465 4166 6669 6e65 5061 estimateAffinePa │ │ │ -000b8370: 7274 6961 6c32 443c 2f73 7061 6e3e 3c77 rtial2D(Mat │ │ │ -000b83e0: 266e 6273 703b 6672 6f6d 2c0a 203c 6120  from,. Mat │ │ │ -000b8430: 266e 6273 703b 746f 2c0a 203c 6120 6872  to,. Mat&n │ │ │ -000b8480: 6273 703b 696e 6c69 6572 732c 0a20 696e bsp;inliers,. in │ │ │ -000b8490: 7426 6e62 7370 3b6d 6574 686f 642c 0a20 t method,. │ │ │ -000b84a0: 646f 7562 6c65 266e 6273 703b 7261 6e73 double rans │ │ │ -000b84b0: 6163 5265 7072 6f6a 5468 7265 7368 6f6c acReprojThreshol │ │ │ -000b84c0: 642c 0a20 6c6f 6e67 266e 6273 703b 6d61 d,. long ma │ │ │ -000b84d0: 7849 7465 7273 293c 2f73 7061 6e3e 3c2f xIters).
    Computes │ │ │ -000b8500: 2061 6e20 6f70 7469 6d61 6c20 6c69 6d69 an optimal limi │ │ │ -000b8510: 7465 6420 6166 6669 6e65 2074 7261 6e73 ted affine trans │ │ │ -000b8520: 666f 726d 6174 696f 6e20 7769 7468 2034 formation with 4 │ │ │ -000b8530: 2064 6567 7265 6573 206f 6620 6672 6565 degrees of free │ │ │ -000b8540: 646f 6d20 6265 7477 6565 6e0a 7477 6f20 dom between.two │ │ │ -000b8550: 3244 2070 6f69 6e74 2073 6574 732e 3c2f 2D point sets..
    .
    Para │ │ │ -000b8580: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    from - First input │ │ │ -000b85b0: 2032 4420 706f 696e 7420 7365 742e 3c2f 2D point set..
    to │ │ │ -000b85d0: 3c2f 636f 6465 3e20 2d20 5365 636f 6e64 - Second │ │ │ -000b85e0: 2069 6e70 7574 2032 4420 706f 696e 7420 input 2D point │ │ │ -000b85f0: 7365 742e 3c2f 6464 3e0a 3c64 643e 3c63 set.
    .
    inliers - Output vect │ │ │ -000b8620: 6f72 2069 6e64 6963 6174 696e 6720 7768 or indicating wh │ │ │ -000b8630: 6963 6820 706f 696e 7473 2061 7265 2069 ich points are i │ │ │ -000b8640: 6e6c 6965 7273 2e3c 2f64 643e 0a3c 6464 nliers.
    .
    method - Robust me │ │ │ -000b8670: 7468 6f64 2075 7365 6420 746f 2063 6f6d thod used to com │ │ │ -000b8680: 7075 7465 2074 7261 6e73 666f 726d 6174 pute transformat │ │ │ -000b8690: 696f 6e2e 2054 6865 2066 6f6c 6c6f 7769 ion. The followi │ │ │ -000b86a0: 6e67 206d 6574 686f 6473 2061 7265 2070 ng methods are p │ │ │ -000b86b0: 6f73 7369 626c 653a 0a3c 756c 3e0a 2020 ossible:.
      . │ │ │ -000b86c0: 3c6c 693e 0a20 2020 5245 463a 2052 414e
    • . REF: RAN │ │ │ -000b86d0: 5341 4320 2d20 5241 4e53 4143 2d62 6173 SAC - RANSAC-bas │ │ │ -000b86e0: 6564 2072 6f62 7573 7420 6d65 7468 6f64 ed robust method │ │ │ -000b86f0: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ -000b8700: 2020 2052 4546 3a20 4c4d 4544 5320 2d20 REF: LMEDS - │ │ │ -000b8710: 4c65 6173 742d 4d65 6469 616e 2072 6f62 Least-Median rob │ │ │ -000b8720: 7573 7420 6d65 7468 6f64 0a52 414e 5341 ust method.RANSA │ │ │ -000b8730: 4320 6973 2074 6865 2064 6566 6175 6c74 C is the default │ │ │ -000b8740: 206d 6574 686f 642e 0a20 203c 2f6c 693e method..
    • │ │ │ -000b8750: 0a3c 2f75 6c3e 3c2f 6464 3e0a 3c64 643e .
    .
    │ │ │ -000b8760: 3c63 6f64 653e 7261 6e73 6163 5265 7072 ransacRepr │ │ │ -000b8770: 6f6a 5468 7265 7368 6f6c 643c 2f63 6f64 ojThreshold - Maximum rep │ │ │ -000b8790: 726f 6a65 6374 696f 6e20 6572 726f 7220 rojection error │ │ │ -000b87a0: 696e 2074 6865 2052 414e 5341 4320 616c in the RANSAC al │ │ │ -000b87b0: 676f 7269 7468 6d20 746f 2063 6f6e 7369 gorithm to consi │ │ │ -000b87c0: 6465 720a 6120 706f 696e 7420 6173 2061 der.a point as a │ │ │ -000b87d0: 6e20 696e 6c69 6572 2e20 4170 706c 6965 n inlier. Applie │ │ │ -000b87e0: 7320 6f6e 6c79 2074 6f20 5241 4e53 4143 s only to RANSAC │ │ │ -000b87f0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    maxIters │ │ │ -000b8810: 202d 2054 6865 206d 6178 696d 756d 206e - The maximum n │ │ │ -000b8820: 756d 6265 7220 6f66 2072 6f62 7573 7420 umber of robust │ │ │ -000b8830: 6d65 7468 6f64 2069 7465 7261 7469 6f6e method iteration │ │ │ -000b8840: 732e 0a62 6574 7765 656e 2030 2e39 3520 s..between 0.95 │ │ │ -000b8850: 616e 6420 302e 3939 2069 7320 7573 7561 and 0.99 is usua │ │ │ -000b8860: 6c6c 7920 676f 6f64 2065 6e6f 7567 682e lly good enough. │ │ │ -000b8870: 2056 616c 7565 7320 746f 6f20 636c 6f73 Values too clos │ │ │ -000b8880: 6520 746f 2031 2063 616e 2073 6c6f 7720 e to 1 can slow │ │ │ -000b8890: 646f 776e 2074 6865 2065 7374 696d 6174 down the estimat │ │ │ -000b88a0: 696f 6e0a 7369 676e 6966 6963 616e 746c ion.significantl │ │ │ -000b88b0: 792e 2056 616c 7565 7320 6c6f 7765 7220 y. Values lower │ │ │ -000b88c0: 7468 616e 2030 2e38 2d30 2e39 2063 616e than 0.8-0.9 can │ │ │ -000b88d0: 2072 6573 756c 7420 696e 2061 6e20 696e result in an in │ │ │ -000b88e0: 636f 7272 6563 746c 7920 6573 7469 6d61 correctly estima │ │ │ -000b88f0: 7465 6420 7472 616e 7366 6f72 6d61 7469 ted transformati │ │ │ -000b8900: 6f6e 2e0a 5061 7373 696e 6720 3020 7769 on..Passing 0 wi │ │ │ -000b8910: 6c6c 2064 6973 6162 6c65 2072 6566 696e ll disable refin │ │ │ -000b8920: 696e 672c 2073 6f20 7468 6520 6f75 7470 ing, so the outp │ │ │ -000b8930: 7574 206d 6174 7269 7820 7769 6c6c 2062 ut matrix will b │ │ │ -000b8940: 6520 6f75 7470 7574 206f 6620 726f 6275 e output of robu │ │ │ -000b8950: 7374 206d 6574 686f 642e 3c2f 6464 3e0a st method.
    . │ │ │ -000b8960: 3c64 743e 5265 7475 726e 733a 3c2f 6474
    Returns:
    .
    Output 2D │ │ │ -000b8980: 6166 6669 6e65 2074 7261 6e73 666f 726d affine transform │ │ │ -000b8990: 6174 696f 6e20 2834 2064 6567 7265 6573 ation (4 degrees │ │ │ -000b89a0: 206f 6620 6672 6565 646f 6d29 206d 6174 of freedom) mat │ │ │ -000b89b0: 7269 7820 5c28 3220 5c74 696d 6573 2033 rix \(2 \times 3 │ │ │ -000b89c0: 5c29 206f 720a 656d 7074 7920 6d61 7472 \) or.empty matr │ │ │ -000b89d0: 6978 2069 6620 7472 616e 7366 6f72 6d61 ix if transforma │ │ │ -000b89e0: 7469 6f6e 2063 6f75 6c64 206e 6f74 2062 tion could not b │ │ │ -000b89f0: 6520 6573 7469 6d61 7465 642e 0a0a 5468 e estimated...Th │ │ │ -000b8a00: 6520 6675 6e63 7469 6f6e 2065 7374 696d e function estim │ │ │ -000b8a10: 6174 6573 2061 6e20 6f70 7469 6d61 6c20 ates an optimal │ │ │ -000b8a20: 3244 2061 6666 696e 6520 7472 616e 7366 2D affine transf │ │ │ -000b8a30: 6f72 6d61 7469 6f6e 2077 6974 6820 3420 ormation with 4 │ │ │ -000b8a40: 6465 6772 6565 7320 6f66 2066 7265 6564 degrees of freed │ │ │ -000b8a50: 6f6d 206c 696d 6974 6564 2074 6f0a 636f om limited to.co │ │ │ -000b8a60: 6d62 696e 6174 696f 6e73 206f 6620 7472 mbinations of tr │ │ │ -000b8a70: 616e 736c 6174 696f 6e2c 2072 6f74 6174 anslation, rotat │ │ │ -000b8a80: 696f 6e2c 2061 6e64 2075 6e69 666f 726d ion, and uniform │ │ │ -000b8a90: 2073 6361 6c69 6e67 2e20 5573 6573 2074 scaling. Uses t │ │ │ -000b8aa0: 6865 2073 656c 6563 7465 6420 616c 676f he selected algo │ │ │ -000b8ab0: 7269 7468 6d20 666f 7220 726f 6275 7374 rithm for robust │ │ │ -000b8ac0: 0a65 7374 696d 6174 696f 6e2e 0a0a 5468 .estimation...Th │ │ │ -000b8ad0: 6520 636f 6d70 7574 6564 2074 7261 6e73 e computed trans │ │ │ -000b8ae0: 666f 726d 6174 696f 6e20 6973 2074 6865 formation is the │ │ │ -000b8af0: 6e20 7265 6669 6e65 6420 6675 7274 6865 n refined furthe │ │ │ -000b8b00: 7220 2875 7369 6e67 206f 6e6c 7920 696e r (using only in │ │ │ -000b8b10: 6c69 6572 7329 2077 6974 6820 7468 650a liers) with the. │ │ │ -000b8b20: 4c65 7665 6e62 6572 672d 4d61 7271 7561 Levenberg-Marqua │ │ │ -000b8b30: 7264 7420 6d65 7468 6f64 2074 6f20 7265 rdt method to re │ │ │ -000b8b40: 6475 6365 2074 6865 2072 652d 7072 6f6a duce the re-proj │ │ │ -000b8b50: 6563 7469 6f6e 2065 7272 6f72 2065 7665 ection error eve │ │ │ -000b8b60: 6e20 6d6f 7265 2e0a 0a45 7374 696d 6174 n more...Estimat │ │ │ -000b8b70: 6564 2074 7261 6e73 666f 726d 6174 696f ed transformatio │ │ │ -000b8b80: 6e20 6d61 7472 6978 2069 733a 0a5c 2820 n matrix is:.\( │ │ │ -000b8b90: 5c62 6567 696e 7b62 6d61 7472 6978 7d20 \begin{bmatrix} │ │ │ -000b8ba0: 5c63 6f73 285c 7468 6574 6129 205c 6364 \cos(\theta) \cd │ │ │ -000b8bb0: 6f74 2073 2026 616d 703b 202d 5c73 696e ot s & -\sin │ │ │ -000b8bc0: 285c 7468 6574 6129 205c 6364 6f74 2073 (\theta) \cdot s │ │ │ -000b8bd0: 2026 616d 703b 2074 5f78 205c 5c0a 2020 & t_x \\. │ │ │ -000b8be0: 2020 2020 2020 2020 2020 2020 2020 5c73 \s │ │ │ -000b8bf0: 696e 285c 7468 6574 6129 205c 6364 6f74 in(\theta) \cdot │ │ │ -000b8c00: 2073 2026 616d 703b 205c 636f 7328 5c74 s & \cos(\t │ │ │ -000b8c10: 6865 7461 2920 5c63 646f 7420 7320 2661 heta) \cdot s &a │ │ │ -000b8c20: 6d70 3b20 745f 790a 5c65 6e64 7b62 6d61 mp; t_y.\end{bma │ │ │ -000b8c30: 7472 6978 7d20 5c29 0a57 6865 7265 205c trix} \).Where \ │ │ │ -000b8c40: 2820 5c74 6865 7461 205c 2920 6973 2074 ( \theta \) is t │ │ │ -000b8c50: 6865 2072 6f74 6174 696f 6e20 616e 676c he rotation angl │ │ │ -000b8c60: 652c 205c 2820 7320 5c29 2074 6865 2073 e, \( s \) the s │ │ │ -000b8c70: 6361 6c69 6e67 2066 6163 746f 7220 616e caling factor an │ │ │ -000b8c80: 6420 5c28 2074 5f78 2c20 745f 7920 5c29 d \( t_x, t_y \) │ │ │ -000b8c90: 2061 7265 0a74 7261 6e73 6c61 7469 6f6e are.translation │ │ │ -000b8ca0: 7320 696e 205c 2820 782c 2079 205c 2920 s in \( x, y \) │ │ │ -000b8cb0: 6178 6573 2072 6573 7065 6374 6976 656c axes respectivel │ │ │ -000b8cc0: 792e 0a0a 3c62 3e4e 6f74 653a 3c2f 623e y...Note: │ │ │ -000b8cd0: 0a54 6865 2052 414e 5341 4320 6d65 7468 .The RANSAC meth │ │ │ -000b8ce0: 6f64 2063 616e 2068 616e 646c 6520 7072 od can handle pr │ │ │ -000b8cf0: 6163 7469 6361 6c6c 7920 616e 7920 7261 actically any ra │ │ │ -000b8d00: 7469 6f20 6f66 206f 7574 6c69 6572 7320 tio of outliers │ │ │ -000b8d10: 6275 7420 6e65 6564 2061 2074 6872 6573 but need a thres │ │ │ -000b8d20: 686f 6c64 2074 6f0a 6469 7374 696e 6775 hold to.distingu │ │ │ -000b8d30: 6973 6820 696e 6c69 6572 7320 6672 6f6d ish inliers from │ │ │ -000b8d40: 206f 7574 6c69 6572 732e 2054 6865 206d outliers. The m │ │ │ -000b8d50: 6574 686f 6420 4c4d 6544 5320 646f 6573 ethod LMeDS does │ │ │ -000b8d60: 206e 6f74 206e 6565 6420 616e 7920 7468 not need any th │ │ │ -000b8d70: 7265 7368 6f6c 6420 6275 7420 6974 2077 reshold but it w │ │ │ -000b8d80: 6f72 6b73 0a63 6f72 7265 6374 6c79 206f orks.correctly o │ │ │ -000b8d90: 6e6c 7920 7768 656e 2074 6865 7265 2061 nly when there a │ │ │ -000b8da0: 7265 206d 6f72 6520 7468 616e 2035 3025 re more than 50% │ │ │ -000b8db0: 206f 6620 696e 6c69 6572 732e 0a0a 5345 of inliers...SE │ │ │ -000b8dc0: 453a 2065 7374 696d 6174 6541 6666 696e E: estimateAffin │ │ │ -000b8dd0: 6532 442c 2067 6574 4166 6669 6e65 5472 e2D, getAffineTr │ │ │ -000b8de0: 616e 7366 6f72 6d3c 2f64 643e 0a3c 2f64 ansform
    ..
    ..
  • .
  • . │ │ │ -000b8e10: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .estimateAffine │ │ │ -000b8ea0: 5061 7274 6961 6c32 443c 2f68 333e 0a3c Partial2D.< │ │ │ -000b8eb0: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ -000b8ec0: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ -000b8ed0: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ -000b8ee0: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ -000b8f10: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ -000b8f20: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ -000b8f30: 726e 2d74 7970 6522 3e3c 6120 6872 6566 rn-type">Mat estimateAffi │ │ │ -000b8fb0: 6e65 5061 7274 6961 6c32 443c 2f73 7061 nePartial2D │ │ │ -000b8fe0: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ -000b9020: 3c2f 613e 266e 6273 703b 6672 6f6d 2c0a  from,. │ │ │ -000b9030: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000b9070: 3c2f 613e 266e 6273 703b 746f 2c0a 203c  to,. < │ │ │ -000b9080: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000b9090: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000b90a0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000b90b0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat inliers, │ │ │ -000b90d0: 0a20 696e 7426 6e62 7370 3b6d 6574 686f . int metho │ │ │ -000b90e0: 642c 0a20 646f 7562 6c65 266e 6273 703b d,. double  │ │ │ -000b90f0: 7261 6e73 6163 5265 7072 6f6a 5468 7265 ransacReprojThre │ │ │ -000b9100: 7368 6f6c 6429 3c2f 7370 616e 3e3c 2f64 shold).
    Computes │ │ │ -000b9130: 616e 206f 7074 696d 616c 206c 696d 6974 an optimal limit │ │ │ -000b9140: 6564 2061 6666 696e 6520 7472 616e 7366 ed affine transf │ │ │ -000b9150: 6f72 6d61 7469 6f6e 2077 6974 6820 3420 ormation with 4 │ │ │ -000b9160: 6465 6772 6565 7320 6f66 2066 7265 6564 degrees of freed │ │ │ -000b9170: 6f6d 2062 6574 7765 656e 0a74 776f 2032 om between.two 2 │ │ │ -000b9180: 4420 706f 696e 7420 7365 7473 2e3c 2f64 D point sets..
    .
    Param │ │ │ -000b91b0: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ -000b91c0: 3c63 6f64 653e 6672 6f6d 3c2f 636f 6465 from - First input │ │ │ -000b91e0: 3244 2070 6f69 6e74 2073 6574 2e3c 2f64 2D point set..
    to< │ │ │ -000b9200: 2f63 6f64 653e 202d 2053 6563 6f6e 6420 /code> - Second │ │ │ -000b9210: 696e 7075 7420 3244 2070 6f69 6e74 2073 input 2D point s │ │ │ -000b9220: 6574 2e3c 2f64 643e 0a3c 6464 3e3c 636f et.
    .
    inliers - Output vecto │ │ │ -000b9250: 7220 696e 6469 6361 7469 6e67 2077 6869 r indicating whi │ │ │ -000b9260: 6368 2070 6f69 6e74 7320 6172 6520 696e ch points are in │ │ │ -000b9270: 6c69 6572 732e 3c2f 6464 3e0a 3c64 643e liers.
    .
    │ │ │ -000b9280: 3c63 6f64 653e 6d65 7468 6f64 3c2f 636f method - Robust met │ │ │ -000b92a0: 686f 6420 7573 6564 2074 6f20 636f 6d70 hod used to comp │ │ │ -000b92b0: 7574 6520 7472 616e 7366 6f72 6d61 7469 ute transformati │ │ │ -000b92c0: 6f6e 2e20 5468 6520 666f 6c6c 6f77 696e on. The followin │ │ │ -000b92d0: 6720 6d65 7468 6f64 7320 6172 6520 706f g methods are po │ │ │ -000b92e0: 7373 6962 6c65 3a0a 3c75 6c3e 0a20 203c ssible:.
      . < │ │ │ -000b92f0: 6c69 3e0a 2020 2052 4546 3a20 5241 4e53 li>. REF: RANS │ │ │ -000b9300: 4143 202d 2052 414e 5341 432d 6261 7365 AC - RANSAC-base │ │ │ -000b9310: 6420 726f 6275 7374 206d 6574 686f 640a d robust method. │ │ │ -000b9320: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 .
    • . │ │ │ -000b9330: 2020 5245 463a 204c 4d45 4453 202d 204c REF: LMEDS - L │ │ │ -000b9340: 6561 7374 2d4d 6564 6961 6e20 726f 6275 east-Median robu │ │ │ -000b9350: 7374 206d 6574 686f 640a 5241 4e53 4143 st method.RANSAC │ │ │ -000b9360: 2069 7320 7468 6520 6465 6661 756c 7420 is the default │ │ │ -000b9370: 6d65 7468 6f64 2e0a 2020 3c2f 6c69 3e0a method..
    • . │ │ │ -000b9380: 3c2f 756c 3e3c 2f64 643e 0a3c 6464 3e3c
    .
    < │ │ │ -000b9390: 636f 6465 3e72 616e 7361 6352 6570 726f code>ransacRepro │ │ │ -000b93a0: 6a54 6872 6573 686f 6c64 3c2f 636f 6465 jThreshold - Maximum repr │ │ │ -000b93c0: 6f6a 6563 7469 6f6e 2065 7272 6f72 2069 ojection error i │ │ │ -000b93d0: 6e20 7468 6520 5241 4e53 4143 2061 6c67 n the RANSAC alg │ │ │ -000b93e0: 6f72 6974 686d 2074 6f20 636f 6e73 6964 orithm to consid │ │ │ -000b93f0: 6572 0a61 2070 6f69 6e74 2061 7320 616e er.a point as an │ │ │ -000b9400: 2069 6e6c 6965 722e 2041 7070 6c69 6573 inlier. Applies │ │ │ -000b9410: 206f 6e6c 7920 746f 2052 414e 5341 432e only to RANSAC. │ │ │ -000b9420: 0a62 6574 7765 656e 2030 2e39 3520 616e .between 0.95 an │ │ │ -000b9430: 6420 302e 3939 2069 7320 7573 7561 6c6c d 0.99 is usuall │ │ │ -000b9440: 7920 676f 6f64 2065 6e6f 7567 682e 2056 y good enough. V │ │ │ -000b9450: 616c 7565 7320 746f 6f20 636c 6f73 6520 alues too close │ │ │ -000b9460: 746f 2031 2063 616e 2073 6c6f 7720 646f to 1 can slow do │ │ │ -000b9470: 776e 2074 6865 2065 7374 696d 6174 696f wn the estimatio │ │ │ -000b9480: 6e0a 7369 676e 6966 6963 616e 746c 792e n.significantly. │ │ │ -000b9490: 2056 616c 7565 7320 6c6f 7765 7220 7468 Values lower th │ │ │ -000b94a0: 616e 2030 2e38 2d30 2e39 2063 616e 2072 an 0.8-0.9 can r │ │ │ -000b94b0: 6573 756c 7420 696e 2061 6e20 696e 636f esult in an inco │ │ │ -000b94c0: 7272 6563 746c 7920 6573 7469 6d61 7465 rrectly estimate │ │ │ -000b94d0: 6420 7472 616e 7366 6f72 6d61 7469 6f6e d transformation │ │ │ -000b94e0: 2e0a 5061 7373 696e 6720 3020 7769 6c6c ..Passing 0 will │ │ │ -000b94f0: 2064 6973 6162 6c65 2072 6566 696e 696e disable refinin │ │ │ -000b9500: 672c 2073 6f20 7468 6520 6f75 7470 7574 g, so the output │ │ │ -000b9510: 206d 6174 7269 7820 7769 6c6c 2062 6520 matrix will be │ │ │ -000b9520: 6f75 7470 7574 206f 6620 726f 6275 7374 output of robust │ │ │ -000b9530: 206d 6574 686f 642e 3c2f 6464 3e0a 3c64 method.
    .Returns:. │ │ │ -000b9550: 3c64 643e 4f75 7470 7574 2032 4420 6166
    Output 2D af │ │ │ -000b9560: 6669 6e65 2074 7261 6e73 666f 726d 6174 fine transformat │ │ │ -000b9570: 696f 6e20 2834 2064 6567 7265 6573 206f ion (4 degrees o │ │ │ -000b9580: 6620 6672 6565 646f 6d29 206d 6174 7269 f freedom) matri │ │ │ -000b9590: 7820 5c28 3220 5c74 696d 6573 2033 5c29 x \(2 \times 3\) │ │ │ -000b95a0: 206f 720a 656d 7074 7920 6d61 7472 6978 or.empty matrix │ │ │ -000b95b0: 2069 6620 7472 616e 7366 6f72 6d61 7469 if transformati │ │ │ -000b95c0: 6f6e 2063 6f75 6c64 206e 6f74 2062 6520 on could not be │ │ │ -000b95d0: 6573 7469 6d61 7465 642e 0a0a 5468 6520 estimated...The │ │ │ -000b95e0: 6675 6e63 7469 6f6e 2065 7374 696d 6174 function estimat │ │ │ -000b95f0: 6573 2061 6e20 6f70 7469 6d61 6c20 3244 es an optimal 2D │ │ │ -000b9600: 2061 6666 696e 6520 7472 616e 7366 6f72 affine transfor │ │ │ -000b9610: 6d61 7469 6f6e 2077 6974 6820 3420 6465 mation with 4 de │ │ │ -000b9620: 6772 6565 7320 6f66 2066 7265 6564 6f6d grees of freedom │ │ │ -000b9630: 206c 696d 6974 6564 2074 6f0a 636f 6d62 limited to.comb │ │ │ -000b9640: 696e 6174 696f 6e73 206f 6620 7472 616e inations of tran │ │ │ -000b9650: 736c 6174 696f 6e2c 2072 6f74 6174 696f slation, rotatio │ │ │ -000b9660: 6e2c 2061 6e64 2075 6e69 666f 726d 2073 n, and uniform s │ │ │ -000b9670: 6361 6c69 6e67 2e20 5573 6573 2074 6865 caling. Uses the │ │ │ -000b9680: 2073 656c 6563 7465 6420 616c 676f 7269 selected algori │ │ │ -000b9690: 7468 6d20 666f 7220 726f 6275 7374 0a65 thm for robust.e │ │ │ -000b96a0: 7374 696d 6174 696f 6e2e 0a0a 5468 6520 stimation...The │ │ │ -000b96b0: 636f 6d70 7574 6564 2074 7261 6e73 666f computed transfo │ │ │ -000b96c0: 726d 6174 696f 6e20 6973 2074 6865 6e20 rmation is then │ │ │ -000b96d0: 7265 6669 6e65 6420 6675 7274 6865 7220 refined further │ │ │ -000b96e0: 2875 7369 6e67 206f 6e6c 7920 696e 6c69 (using only inli │ │ │ -000b96f0: 6572 7329 2077 6974 6820 7468 650a 4c65 ers) with the.Le │ │ │ -000b9700: 7665 6e62 6572 672d 4d61 7271 7561 7264 venberg-Marquard │ │ │ -000b9710: 7420 6d65 7468 6f64 2074 6f20 7265 6475 t method to redu │ │ │ -000b9720: 6365 2074 6865 2072 652d 7072 6f6a 6563 ce the re-projec │ │ │ -000b9730: 7469 6f6e 2065 7272 6f72 2065 7665 6e20 tion error even │ │ │ -000b9740: 6d6f 7265 2e0a 0a45 7374 696d 6174 6564 more...Estimated │ │ │ -000b9750: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ -000b9760: 6d61 7472 6978 2069 733a 0a5c 2820 5c62 matrix is:.\( \b │ │ │ -000b9770: 6567 696e 7b62 6d61 7472 6978 7d20 5c63 egin{bmatrix} \c │ │ │ -000b9780: 6f73 285c 7468 6574 6129 205c 6364 6f74 os(\theta) \cdot │ │ │ -000b9790: 2073 2026 616d 703b 202d 5c73 696e 285c s & -\sin(\ │ │ │ -000b97a0: 7468 6574 6129 205c 6364 6f74 2073 2026 theta) \cdot s & │ │ │ -000b97b0: 616d 703b 2074 5f78 205c 5c0a 2020 2020 amp; t_x \\. │ │ │ -000b97c0: 2020 2020 2020 2020 2020 2020 5c73 696e \sin │ │ │ -000b97d0: 285c 7468 6574 6129 205c 6364 6f74 2073 (\theta) \cdot s │ │ │ -000b97e0: 2026 616d 703b 205c 636f 7328 5c74 6865 & \cos(\the │ │ │ -000b97f0: 7461 2920 5c63 646f 7420 7320 2661 6d70 ta) \cdot s & │ │ │ -000b9800: 3b20 745f 790a 5c65 6e64 7b62 6d61 7472 ; t_y.\end{bmatr │ │ │ -000b9810: 6978 7d20 5c29 0a57 6865 7265 205c 2820 ix} \).Where \( │ │ │ -000b9820: 5c74 6865 7461 205c 2920 6973 2074 6865 \theta \) is the │ │ │ -000b9830: 2072 6f74 6174 696f 6e20 616e 676c 652c rotation angle, │ │ │ -000b9840: 205c 2820 7320 5c29 2074 6865 2073 6361 \( s \) the sca │ │ │ -000b9850: 6c69 6e67 2066 6163 746f 7220 616e 6420 ling factor and │ │ │ -000b9860: 5c28 2074 5f78 2c20 745f 7920 5c29 2061 \( t_x, t_y \) a │ │ │ -000b9870: 7265 0a74 7261 6e73 6c61 7469 6f6e 7320 re.translations │ │ │ -000b9880: 696e 205c 2820 782c 2079 205c 2920 6178 in \( x, y \) ax │ │ │ -000b9890: 6573 2072 6573 7065 6374 6976 656c 792e es respectively. │ │ │ -000b98a0: 0a0a 3c62 3e4e 6f74 653a 3c2f 623e 0a54 ..Note:.T │ │ │ -000b98b0: 6865 2052 414e 5341 4320 6d65 7468 6f64 he RANSAC method │ │ │ -000b98c0: 2063 616e 2068 616e 646c 6520 7072 6163 can handle prac │ │ │ -000b98d0: 7469 6361 6c6c 7920 616e 7920 7261 7469 tically any rati │ │ │ -000b98e0: 6f20 6f66 206f 7574 6c69 6572 7320 6275 o of outliers bu │ │ │ -000b98f0: 7420 6e65 6564 2061 2074 6872 6573 686f t need a thresho │ │ │ -000b9900: 6c64 2074 6f0a 6469 7374 696e 6775 6973 ld to.distinguis │ │ │ -000b9910: 6820 696e 6c69 6572 7320 6672 6f6d 206f h inliers from o │ │ │ -000b9920: 7574 6c69 6572 732e 2054 6865 206d 6574 utliers. The met │ │ │ -000b9930: 686f 6420 4c4d 6544 5320 646f 6573 206e hod LMeDS does n │ │ │ -000b9940: 6f74 206e 6565 6420 616e 7920 7468 7265 ot need any thre │ │ │ -000b9950: 7368 6f6c 6420 6275 7420 6974 2077 6f72 shold but it wor │ │ │ -000b9960: 6b73 0a63 6f72 7265 6374 6c79 206f 6e6c ks.correctly onl │ │ │ -000b9970: 7920 7768 656e 2074 6865 7265 2061 7265 y when there are │ │ │ -000b9980: 206d 6f72 6520 7468 616e 2035 3025 206f more than 50% o │ │ │ -000b9990: 6620 696e 6c69 6572 732e 0a0a 5345 453a f inliers...SEE: │ │ │ -000b99a0: 2065 7374 696d 6174 6541 6666 696e 6532 estimateAffine2 │ │ │ -000b99b0: 442c 2067 6574 4166 6669 6e65 5472 616e D, getAffineTran │ │ │ -000b99c0: 7366 6f72 6d3c 2f64 643e 0a3c 2f64 6c3e sform
    .
    │ │ │ -000b99d0: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • ..

    estimat │ │ │ -000b9a70: 6541 6666 696e 6550 6172 7469 616c 3244 eAffinePartial2D │ │ │ -000b9a80: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ -000b9ae0: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -000b9af0: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -000b9b10: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000b9b50: 2f61 3e3c 2f73 7061 6e3e 266e 6273 703b /a>  │ │ │ -000b9b60: 3c73 7061 6e20 636c 6173 733d 2265 6c65 estim │ │ │ -000b9b80: 6174 6541 6666 696e 6550 6172 7469 616c ateAffinePartial │ │ │ -000b9b90: 3244 3c2f 7370 616e 3e3c 7762 723e 3c73 2D(Mat  │ │ │ -000b9c00: 3b66 726f 6d2c 0a20 3c61 2068 7265 663d ;from,. Mat  │ │ │ -000b9c50: 3b74 6f2c 0a20 3c61 2068 7265 663d 222e ;to,. Mat i │ │ │ -000b9ca0: 6e6c 6965 7273 2c0a 2069 6e74 266e 6273 nliers,. int&nbs │ │ │ -000b9cb0: 703b 6d65 7468 6f64 293c 2f73 7061 6e3e p;method) │ │ │ -000b9cc0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Comput │ │ │ -000b9ce0: 6573 2061 6e20 6f70 7469 6d61 6c20 6c69 es an optimal li │ │ │ -000b9cf0: 6d69 7465 6420 6166 6669 6e65 2074 7261 mited affine tra │ │ │ -000b9d00: 6e73 666f 726d 6174 696f 6e20 7769 7468 nsformation with │ │ │ -000b9d10: 2034 2064 6567 7265 6573 206f 6620 6672 4 degrees of fr │ │ │ -000b9d20: 6565 646f 6d20 6265 7477 6565 6e0a 7477 eedom between.tw │ │ │ -000b9d30: 6f20 3244 2070 6f69 6e74 2073 6574 732e o 2D point sets. │ │ │ -000b9d40: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -000b9d60: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000b9d70: 6464 3e3c 636f 6465 3e66 726f 6d3c 2f63 dd>from - First inp │ │ │ -000b9d90: 7574 2032 4420 706f 696e 7420 7365 742e ut 2D point set. │ │ │ -000b9da0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e .
    │ │ │ -000b9db0: 746f 3c2f 636f 6465 3e20 2d20 5365 636f to - Seco │ │ │ -000b9dc0: 6e64 2069 6e70 7574 2032 4420 706f 696e nd input 2D poin │ │ │ -000b9dd0: 7420 7365 742e 3c2f 6464 3e0a 3c64 643e t set.
    .
    │ │ │ -000b9de0: 3c63 6f64 653e 696e 6c69 6572 733c 2f63 inliers - Output ve │ │ │ -000b9e00: 6374 6f72 2069 6e64 6963 6174 696e 6720 ctor indicating │ │ │ -000b9e10: 7768 6963 6820 706f 696e 7473 2061 7265 which points are │ │ │ -000b9e20: 2069 6e6c 6965 7273 2e3c 2f64 643e 0a3c inliers.
    .< │ │ │ -000b9e30: 6464 3e3c 636f 6465 3e6d 6574 686f 643c dd>method< │ │ │ -000b9e40: 2f63 6f64 653e 202d 2052 6f62 7573 7420 /code> - Robust │ │ │ -000b9e50: 6d65 7468 6f64 2075 7365 6420 746f 2063 method used to c │ │ │ -000b9e60: 6f6d 7075 7465 2074 7261 6e73 666f 726d ompute transform │ │ │ -000b9e70: 6174 696f 6e2e 2054 6865 2066 6f6c 6c6f ation. The follo │ │ │ -000b9e80: 7769 6e67 206d 6574 686f 6473 2061 7265 wing methods are │ │ │ -000b9e90: 2070 6f73 7369 626c 653a 0a3c 756c 3e0a possible:.
      . │ │ │ -000b9ea0: 2020 3c6c 693e 0a20 2020 5245 463a 2052
    • . REF: R │ │ │ -000b9eb0: 414e 5341 4320 2d20 5241 4e53 4143 2d62 ANSAC - RANSAC-b │ │ │ -000b9ec0: 6173 6564 2072 6f62 7573 7420 6d65 7468 ased robust meth │ │ │ -000b9ed0: 6f64 0a20 203c 2f6c 693e 0a20 203c 6c69 od.
    • .
    • . REF: LMEDS │ │ │ -000b9ef0: 2d20 4c65 6173 742d 4d65 6469 616e 2072 - Least-Median r │ │ │ -000b9f00: 6f62 7573 7420 6d65 7468 6f64 0a52 414e obust method.RAN │ │ │ -000b9f10: 5341 4320 6973 2074 6865 2064 6566 6175 SAC is the defau │ │ │ -000b9f20: 6c74 206d 6574 686f 642e 0a20 203c 2f6c lt method.. .
    .a point │ │ │ -000b9f40: 2061 7320 616e 2069 6e6c 6965 722e 2041 as an inlier. A │ │ │ -000b9f50: 7070 6c69 6573 206f 6e6c 7920 746f 2052 pplies only to R │ │ │ -000b9f60: 414e 5341 432e 0a62 6574 7765 656e 2030 ANSAC..between 0 │ │ │ -000b9f70: 2e39 3520 616e 6420 302e 3939 2069 7320 .95 and 0.99 is │ │ │ -000b9f80: 7573 7561 6c6c 7920 676f 6f64 2065 6e6f usually good eno │ │ │ -000b9f90: 7567 682e 2056 616c 7565 7320 746f 6f20 ugh. Values too │ │ │ -000b9fa0: 636c 6f73 6520 746f 2031 2063 616e 2073 close to 1 can s │ │ │ -000b9fb0: 6c6f 7720 646f 776e 2074 6865 2065 7374 low down the est │ │ │ -000b9fc0: 696d 6174 696f 6e0a 7369 676e 6966 6963 imation.signific │ │ │ -000b9fd0: 616e 746c 792e 2056 616c 7565 7320 6c6f antly. Values lo │ │ │ -000b9fe0: 7765 7220 7468 616e 2030 2e38 2d30 2e39 wer than 0.8-0.9 │ │ │ -000b9ff0: 2063 616e 2072 6573 756c 7420 696e 2061 can result in a │ │ │ -000ba000: 6e20 696e 636f 7272 6563 746c 7920 6573 n incorrectly es │ │ │ -000ba010: 7469 6d61 7465 6420 7472 616e 7366 6f72 timated transfor │ │ │ -000ba020: 6d61 7469 6f6e 2e0a 5061 7373 696e 6720 mation..Passing │ │ │ -000ba030: 3020 7769 6c6c 2064 6973 6162 6c65 2072 0 will disable r │ │ │ -000ba040: 6566 696e 696e 672c 2073 6f20 7468 6520 efining, so the │ │ │ -000ba050: 6f75 7470 7574 206d 6174 7269 7820 7769 output matrix wi │ │ │ -000ba060: 6c6c 2062 6520 6f75 7470 7574 206f 6620 ll be output of │ │ │ -000ba070: 726f 6275 7374 206d 6574 686f 642e 3c2f robust method..
    Returns: │ │ │ -000ba090: 3c2f 6474 3e0a 3c64 643e 4f75 7470 7574
    .
    Output │ │ │ -000ba0a0: 2032 4420 6166 6669 6e65 2074 7261 6e73 2D affine trans │ │ │ -000ba0b0: 666f 726d 6174 696f 6e20 2834 2064 6567 formation (4 deg │ │ │ -000ba0c0: 7265 6573 206f 6620 6672 6565 646f 6d29 rees of freedom) │ │ │ -000ba0d0: 206d 6174 7269 7820 5c28 3220 5c74 696d matrix \(2 \tim │ │ │ -000ba0e0: 6573 2033 5c29 206f 720a 656d 7074 7920 es 3\) or.empty │ │ │ -000ba0f0: 6d61 7472 6978 2069 6620 7472 616e 7366 matrix if transf │ │ │ -000ba100: 6f72 6d61 7469 6f6e 2063 6f75 6c64 206e ormation could n │ │ │ -000ba110: 6f74 2062 6520 6573 7469 6d61 7465 642e ot be estimated. │ │ │ -000ba120: 0a0a 5468 6520 6675 6e63 7469 6f6e 2065 ..The function e │ │ │ -000ba130: 7374 696d 6174 6573 2061 6e20 6f70 7469 stimates an opti │ │ │ -000ba140: 6d61 6c20 3244 2061 6666 696e 6520 7472 mal 2D affine tr │ │ │ -000ba150: 616e 7366 6f72 6d61 7469 6f6e 2077 6974 ansformation wit │ │ │ -000ba160: 6820 3420 6465 6772 6565 7320 6f66 2066 h 4 degrees of f │ │ │ -000ba170: 7265 6564 6f6d 206c 696d 6974 6564 2074 reedom limited t │ │ │ -000ba180: 6f0a 636f 6d62 696e 6174 696f 6e73 206f o.combinations o │ │ │ -000ba190: 6620 7472 616e 736c 6174 696f 6e2c 2072 f translation, r │ │ │ -000ba1a0: 6f74 6174 696f 6e2c 2061 6e64 2075 6e69 otation, and uni │ │ │ -000ba1b0: 666f 726d 2073 6361 6c69 6e67 2e20 5573 form scaling. Us │ │ │ -000ba1c0: 6573 2074 6865 2073 656c 6563 7465 6420 es the selected │ │ │ -000ba1d0: 616c 676f 7269 7468 6d20 666f 7220 726f algorithm for ro │ │ │ -000ba1e0: 6275 7374 0a65 7374 696d 6174 696f 6e2e bust.estimation. │ │ │ -000ba1f0: 0a0a 5468 6520 636f 6d70 7574 6564 2074 ..The computed t │ │ │ -000ba200: 7261 6e73 666f 726d 6174 696f 6e20 6973 ransformation is │ │ │ -000ba210: 2074 6865 6e20 7265 6669 6e65 6420 6675 then refined fu │ │ │ -000ba220: 7274 6865 7220 2875 7369 6e67 206f 6e6c rther (using onl │ │ │ -000ba230: 7920 696e 6c69 6572 7329 2077 6974 6820 y inliers) with │ │ │ -000ba240: 7468 650a 4c65 7665 6e62 6572 672d 4d61 the.Levenberg-Ma │ │ │ -000ba250: 7271 7561 7264 7420 6d65 7468 6f64 2074 rquardt method t │ │ │ -000ba260: 6f20 7265 6475 6365 2074 6865 2072 652d o reduce the re- │ │ │ -000ba270: 7072 6f6a 6563 7469 6f6e 2065 7272 6f72 projection error │ │ │ -000ba280: 2065 7665 6e20 6d6f 7265 2e0a 0a45 7374 even more...Est │ │ │ -000ba290: 696d 6174 6564 2074 7261 6e73 666f 726d imated transform │ │ │ -000ba2a0: 6174 696f 6e20 6d61 7472 6978 2069 733a ation matrix is: │ │ │ -000ba2b0: 0a5c 2820 5c62 6567 696e 7b62 6d61 7472 .\( \begin{bmatr │ │ │ -000ba2c0: 6978 7d20 5c63 6f73 285c 7468 6574 6129 ix} \cos(\theta) │ │ │ -000ba2d0: 205c 6364 6f74 2073 2026 616d 703b 202d \cdot s & - │ │ │ -000ba2e0: 5c73 696e 285c 7468 6574 6129 205c 6364 \sin(\theta) \cd │ │ │ -000ba2f0: 6f74 2073 2026 616d 703b 2074 5f78 205c ot s & t_x \ │ │ │ -000ba300: 5c0a 2020 2020 2020 2020 2020 2020 2020 \. │ │ │ -000ba310: 2020 5c73 696e 285c 7468 6574 6129 205c \sin(\theta) \ │ │ │ -000ba320: 6364 6f74 2073 2026 616d 703b 205c 636f cdot s & \co │ │ │ -000ba330: 7328 5c74 6865 7461 2920 5c63 646f 7420 s(\theta) \cdot │ │ │ -000ba340: 7320 2661 6d70 3b20 745f 790a 5c65 6e64 s & t_y.\end │ │ │ -000ba350: 7b62 6d61 7472 6978 7d20 5c29 0a57 6865 {bmatrix} \).Whe │ │ │ -000ba360: 7265 205c 2820 5c74 6865 7461 205c 2920 re \( \theta \) │ │ │ -000ba370: 6973 2074 6865 2072 6f74 6174 696f 6e20 is the rotation │ │ │ -000ba380: 616e 676c 652c 205c 2820 7320 5c29 2074 angle, \( s \) t │ │ │ -000ba390: 6865 2073 6361 6c69 6e67 2066 6163 746f he scaling facto │ │ │ -000ba3a0: 7220 616e 6420 5c28 2074 5f78 2c20 745f r and \( t_x, t_ │ │ │ -000ba3b0: 7920 5c29 2061 7265 0a74 7261 6e73 6c61 y \) are.transla │ │ │ -000ba3c0: 7469 6f6e 7320 696e 205c 2820 782c 2079 tions in \( x, y │ │ │ -000ba3d0: 205c 2920 6178 6573 2072 6573 7065 6374 \) axes respect │ │ │ -000ba3e0: 6976 656c 792e 0a0a 3c62 3e4e 6f74 653a ively...Note: │ │ │ -000ba3f0: 3c2f 623e 0a54 6865 2052 414e 5341 4320 .The RANSAC │ │ │ -000ba400: 6d65 7468 6f64 2063 616e 2068 616e 646c method can handl │ │ │ -000ba410: 6520 7072 6163 7469 6361 6c6c 7920 616e e practically an │ │ │ -000ba420: 7920 7261 7469 6f20 6f66 206f 7574 6c69 y ratio of outli │ │ │ -000ba430: 6572 7320 6275 7420 6e65 6564 2061 2074 ers but need a t │ │ │ -000ba440: 6872 6573 686f 6c64 2074 6f0a 6469 7374 hreshold to.dist │ │ │ -000ba450: 696e 6775 6973 6820 696e 6c69 6572 7320 inguish inliers │ │ │ -000ba460: 6672 6f6d 206f 7574 6c69 6572 732e 2054 from outliers. T │ │ │ -000ba470: 6865 206d 6574 686f 6420 4c4d 6544 5320 he method LMeDS │ │ │ -000ba480: 646f 6573 206e 6f74 206e 6565 6420 616e does not need an │ │ │ -000ba490: 7920 7468 7265 7368 6f6c 6420 6275 7420 y threshold but │ │ │ -000ba4a0: 6974 2077 6f72 6b73 0a63 6f72 7265 6374 it works.correct │ │ │ -000ba4b0: 6c79 206f 6e6c 7920 7768 656e 2074 6865 ly only when the │ │ │ -000ba4c0: 7265 2061 7265 206d 6f72 6520 7468 616e re are more than │ │ │ -000ba4d0: 2035 3025 206f 6620 696e 6c69 6572 732e 50% of inliers. │ │ │ -000ba4e0: 0a0a 5345 453a 2065 7374 696d 6174 6541 ..SEE: estimateA │ │ │ -000ba4f0: 6666 696e 6532 442c 2067 6574 4166 6669 ffine2D, getAffi │ │ │ -000ba500: 6e65 5472 616e 7366 6f72 6d3c 2f64 643e neTransform
    │ │ │ -000ba510: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    .
    ..
  • .< │ │ │ -000ba530: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .

    recov │ │ │ +000b3930: 6572 506f 7365 3c2f 6833 3e0a 3c64 6976 erPose

    .
    .
    public static< │ │ │ +000b39a0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> int │ │ │ +000b39d0: 266e 6273 703b 3c73 7061 6e20 636c 6173  recoverPose(Ma │ │ │ +000b3a60: 743c 2f61 3e26 6e62 7370 3b45 2c0a 203c t E,. < │ │ │ +000b3a70: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000b3a80: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000b3a90: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000b3aa0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat points1, │ │ │ +000b3ac0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000b3b00: 743c 2f61 3e26 6e62 7370 3b70 6f69 6e74 t point │ │ │ +000b3b10: 7332 2c0a 203c 6120 6872 6566 3d22 2e2e s2,. Mat ca │ │ │ +000b3b60: 6d65 7261 4d61 7472 6978 2c0a 203c 6120 meraMatrix,. Mat │ │ │ +000b3bb0: 266e 6273 703b 522c 0a20 3c61 2068 7265  R,. Mat&nb │ │ │ +000b3c00: 7370 3b74 293c 2f73 7061 6e3e 3c2f 6469 sp;t).
    Recovers t │ │ │ +000b3c30: 6865 2072 656c 6174 6976 6520 6361 6d65 he relative came │ │ │ +000b3c40: 7261 2072 6f74 6174 696f 6e20 616e 6420 ra rotation and │ │ │ +000b3c50: 7468 6520 7472 616e 736c 6174 696f 6e20 the translation │ │ │ +000b3c60: 6672 6f6d 2061 6e20 6573 7469 6d61 7465 from an estimate │ │ │ +000b3c70: 6420 6573 7365 6e74 6961 6c0a 6d61 7472 d essential.matr │ │ │ +000b3c80: 6978 2061 6e64 2074 6865 2063 6f72 7265 ix and the corre │ │ │ +000b3c90: 7370 6f6e 6469 6e67 2070 6f69 6e74 7320 sponding points │ │ │ +000b3ca0: 696e 2074 776f 2069 6d61 6765 732c 2075 in two images, u │ │ │ +000b3cb0: 7369 6e67 2063 6869 7261 6c69 7479 2063 sing chirality c │ │ │ +000b3cc0: 6865 636b 2e20 5265 7475 726e 7320 7468 heck. Returns th │ │ │ +000b3cd0: 6520 6e75 6d62 6572 206f 660a 696e 6c69 e number of.inli │ │ │ +000b3ce0: 6572 7320 7468 6174 2070 6173 7320 7468 ers that pass th │ │ │ +000b3cf0: 6520 6368 6563 6b2e 3c2f 6469 763e 0a3c e check.
    .< │ │ │ +000b3d00: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ +000b3d10: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ +000b3d20: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    E - The │ │ │ +000b3d40: 696e 7075 7420 6573 7365 6e74 6961 6c20 input essential │ │ │ +000b3d50: 6d61 7472 6978 2e3c 2f64 643e 0a3c 6464 matrix.
    .
    points1 - Array of │ │ │ +000b3d80: 204e 2032 4420 706f 696e 7473 2066 726f N 2D points fro │ │ │ +000b3d90: 6d20 7468 6520 6669 7273 7420 696d 6167 m the first imag │ │ │ +000b3da0: 652e 2054 6865 2070 6f69 6e74 2063 6f6f e. The point coo │ │ │ +000b3db0: 7264 696e 6174 6573 2073 686f 756c 6420 rdinates should │ │ │ +000b3dc0: 6265 0a66 6c6f 6174 696e 672d 706f 696e be.floating-poin │ │ │ +000b3dd0: 7420 2873 696e 676c 6520 6f72 2064 6f75 t (single or dou │ │ │ +000b3de0: 626c 6520 7072 6563 6973 696f 6e29 2e3c ble precision).< │ │ │ +000b3df0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e70 /dd>.
    p │ │ │ +000b3e00: 6f69 6e74 7332 3c2f 636f 6465 3e20 2d20 oints2 - │ │ │ +000b3e10: 4172 7261 7920 6f66 2074 6865 2073 6563 Array of the sec │ │ │ +000b3e20: 6f6e 6420 696d 6167 6520 706f 696e 7473 ond image points │ │ │ +000b3e30: 206f 6620 7468 6520 7361 6d65 2073 697a of the same siz │ │ │ +000b3e40: 6520 616e 6420 666f 726d 6174 2061 7320 e and format as │ │ │ +000b3e50: 706f 696e 7473 3120 2e3c 2f64 643e 0a3c points1 .
    .< │ │ │ +000b3e60: 6464 3e3c 636f 6465 3e63 616d 6572 614d dd>cameraM │ │ │ +000b3e70: 6174 7269 783c 2f63 6f64 653e 202d 2043 atrix - C │ │ │ +000b3e80: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ +000b3e90: 6d61 7472 6978 205c 285c 6361 6d65 7261 matrix \(\camera │ │ │ +000b3ea0: 6d61 7472 6978 7b41 7d5c 2920 2e0a 4e6f matrix{A}\) ..No │ │ │ +000b3eb0: 7465 2074 6861 7420 7468 6973 2066 756e te that this fun │ │ │ +000b3ec0: 6374 696f 6e20 6173 7375 6d65 7320 7468 ction assumes th │ │ │ +000b3ed0: 6174 2070 6f69 6e74 7331 2061 6e64 2070 at points1 and p │ │ │ +000b3ee0: 6f69 6e74 7332 2061 7265 2066 6561 7475 oints2 are featu │ │ │ +000b3ef0: 7265 2070 6f69 6e74 7320 6672 6f6d 2063 re points from c │ │ │ +000b3f00: 616d 6572 6173 2077 6974 6820 7468 650a ameras with the. │ │ │ +000b3f10: 7361 6d65 2063 616d 6572 6120 696e 7472 same camera intr │ │ │ +000b3f20: 696e 7369 6320 6d61 7472 6978 2e3c 2f64 insic matrix..
    R - Output r │ │ │ +000b3f50: 6f74 6174 696f 6e20 6d61 7472 6978 2e20 otation matrix. │ │ │ +000b3f60: 546f 6765 7468 6572 2077 6974 6820 7468 Together with th │ │ │ +000b3f70: 6520 7472 616e 736c 6174 696f 6e20 7665 e translation ve │ │ │ +000b3f80: 6374 6f72 2c20 7468 6973 206d 6174 7269 ctor, this matri │ │ │ +000b3f90: 7820 6d61 6b65 7320 7570 2061 2074 7570 x makes up a tup │ │ │ +000b3fa0: 6c65 0a74 6861 7420 7065 7266 6f72 6d73 le.that performs │ │ │ +000b3fb0: 2061 2063 6861 6e67 6520 6f66 2062 6173 a change of bas │ │ │ +000b3fc0: 6973 2066 726f 6d20 7468 6520 6669 7273 is from the firs │ │ │ +000b3fd0: 7420 6361 6d65 7261 2773 2063 6f6f 7264 t camera's coord │ │ │ +000b3fe0: 696e 6174 6520 7379 7374 656d 2074 6f20 inate system to │ │ │ +000b3ff0: 7468 6520 7365 636f 6e64 2063 616d 6572 the second camer │ │ │ +000b4000: 6127 730a 636f 6f72 6469 6e61 7465 2073 a's.coordinate s │ │ │ +000b4010: 7973 7465 6d2e 204e 6f74 6520 7468 6174 ystem. Note that │ │ │ +000b4020: 2c20 696e 2067 656e 6572 616c 2c20 7420 , in general, t │ │ │ +000b4030: 6361 6e20 6e6f 7420 6265 2075 7365 6420 can not be used │ │ │ +000b4040: 666f 7220 7468 6973 2074 7570 6c65 2c20 for this tuple, │ │ │ +000b4050: 7365 6520 7468 6520 7061 7261 6d65 7465 see the paramete │ │ │ +000b4060: 720a 6465 7363 7269 6265 6420 6265 6c6f r.described belo │ │ │ +000b4070: 772e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 w.
    .
    t - Out │ │ │ +000b4090: 7075 7420 7472 616e 736c 6174 696f 6e20 put translation │ │ │ +000b40a0: 7665 6374 6f72 2e20 5468 6973 2076 6563 vector. This vec │ │ │ +000b40b0: 746f 7220 6973 206f 6274 6169 6e65 6420 tor is obtained │ │ │ +000b40c0: 6279 2052 4546 3a20 6465 636f 6d70 6f73 by REF: decompos │ │ │ +000b40d0: 6545 7373 656e 7469 616c 4d61 7420 616e eEssentialMat an │ │ │ +000b40e0: 640a 7468 6572 6566 6f72 6520 6973 206f d.therefore is o │ │ │ +000b40f0: 6e6c 7920 6b6e 6f77 6e20 7570 2074 6f20 nly known up to │ │ │ +000b4100: 7363 616c 652c 2069 2e65 2e20 7420 6973 scale, i.e. t is │ │ │ +000b4110: 2074 6865 2064 6972 6563 7469 6f6e 206f the direction o │ │ │ +000b4120: 6620 7468 6520 7472 616e 736c 6174 696f f the translatio │ │ │ +000b4130: 6e20 7665 6374 6f72 2061 6e64 2068 6173 n vector and has │ │ │ +000b4140: 2075 6e69 740a 6c65 6e67 7468 2e0a 696e unit.length..in │ │ │ +000b4150: 6c69 6572 7320 696e 2070 6f69 6e74 7331 liers in points1 │ │ │ +000b4160: 2061 6e64 2070 6f69 6e74 7332 2066 6f72 and points2 for │ │ │ +000b4170: 2074 6865 2067 6976 656e 2065 7373 656e the given essen │ │ │ +000b4180: 7469 616c 206d 6174 7269 7820 452e 204f tial matrix E. O │ │ │ +000b4190: 6e6c 7920 7468 6573 6520 696e 6c69 6572 nly these inlier │ │ │ +000b41a0: 7320 7769 6c6c 2062 6520 7573 6564 2074 s will be used t │ │ │ +000b41b0: 6f0a 7265 636f 7665 7220 706f 7365 2e20 o.recover pose. │ │ │ +000b41c0: 496e 2074 6865 206f 7574 7075 7420 6d61 In the output ma │ │ │ +000b41d0: 736b 206f 6e6c 7920 696e 6c69 6572 7320 sk only inliers │ │ │ +000b41e0: 7768 6963 6820 7061 7373 2074 6865 2063 which pass the c │ │ │ +000b41f0: 6869 7261 6c69 7479 2063 6865 636b 2e0a hirality check.. │ │ │ +000b4200: 0a54 6869 7320 6675 6e63 7469 6f6e 2064 .This function d │ │ │ +000b4210: 6563 6f6d 706f 7365 7320 616e 2065 7373 ecomposes an ess │ │ │ +000b4220: 656e 7469 616c 206d 6174 7269 7820 7573 ential matrix us │ │ │ +000b4230: 696e 6720 5245 463a 2064 6563 6f6d 706f ing REF: decompo │ │ │ +000b4240: 7365 4573 7365 6e74 6961 6c4d 6174 2061 seEssentialMat a │ │ │ +000b4250: 6e64 2074 6865 6e20 7665 7269 6669 6573 nd then verifies │ │ │ +000b4260: 0a70 6f73 7369 626c 6520 706f 7365 2068 .possible pose h │ │ │ +000b4270: 7970 6f74 6865 7365 7320 6279 2064 6f69 ypotheses by doi │ │ │ +000b4280: 6e67 2063 6869 7261 6c69 7479 2063 6865 ng chirality che │ │ │ +000b4290: 636b 2e20 5468 6520 6368 6972 616c 6974 ck. The chiralit │ │ │ +000b42a0: 7920 6368 6563 6b20 6d65 616e 7320 7468 y check means th │ │ │ +000b42b0: 6174 2074 6865 0a74 7269 616e 6775 6c61 at the.triangula │ │ │ +000b42c0: 7465 6420 3344 2070 6f69 6e74 7320 7368 ted 3D points sh │ │ │ +000b42d0: 6f75 6c64 2068 6176 6520 706f 7369 7469 ould have positi │ │ │ +000b42e0: 7665 2064 6570 7468 2e20 536f 6d65 2064 ve depth. Some d │ │ │ +000b42f0: 6574 6169 6c73 2063 616e 2062 6520 666f etails can be fo │ │ │ +000b4300: 756e 6420 696e 2043 4954 453a 204e 6973 und in CITE: Nis │ │ │ +000b4310: 7465 7230 332e 0a0a 5468 6973 2066 756e ter03...This fun │ │ │ +000b4320: 6374 696f 6e20 6361 6e20 6265 2075 7365 ction can be use │ │ │ +000b4330: 6420 746f 2070 726f 6365 7373 2074 6865 d to process the │ │ │ +000b4340: 206f 7574 7075 7420 4520 616e 6420 6d61 output E and ma │ │ │ +000b4350: 736b 2066 726f 6d20 5245 463a 2066 696e sk from REF: fin │ │ │ +000b4360: 6445 7373 656e 7469 616c 4d61 742e 2049 dEssentialMat. I │ │ │ +000b4370: 6e20 7468 6973 0a73 6365 6e61 7269 6f2c n this.scenario, │ │ │ +000b4380: 2070 6f69 6e74 7331 2061 6e64 2070 6f69 points1 and poi │ │ │ +000b4390: 6e74 7332 2061 7265 2074 6865 2073 616d nts2 are the sam │ │ │ +000b43a0: 6520 696e 7075 7420 666f 7220 2366 696e e input for #fin │ │ │ +000b43b0: 6445 7373 656e 7469 616c 4d61 7420 3a0a dEssentialMat :. │ │ │ +000b43c0: 3c63 6f64 653e 0a20 2020 202f 2f20 4578 . // Ex │ │ │ +000b43d0: 616d 706c 652e 2045 7374 696d 6174 696f ample. Estimatio │ │ │ +000b43e0: 6e20 6f66 2066 756e 6461 6d65 6e74 616c n of fundamental │ │ │ +000b43f0: 206d 6174 7269 7820 7573 696e 6720 7468 matrix using th │ │ │ +000b4400: 6520 5241 4e53 4143 2061 6c67 6f72 6974 e RANSAC algorit │ │ │ +000b4410: 686d 0a20 2020 2069 6e74 2070 6f69 6e74 hm. int point │ │ │ +000b4420: 5f63 6f75 6e74 203d 2031 3030 3b0a 2020 _count = 100;. │ │ │ +000b4430: 2020 7665 6374 6f72 266c 743b 506f 696e vector<Poin │ │ │ +000b4440: 7432 6626 6774 3b20 706f 696e 7473 3128 t2f> points1( │ │ │ +000b4450: 706f 696e 745f 636f 756e 7429 3b0a 2020 point_count);. │ │ │ +000b4460: 2020 7665 6374 6f72 266c 743b 506f 696e vector<Poin │ │ │ +000b4470: 7432 6626 6774 3b20 706f 696e 7473 3228 t2f> points2( │ │ │ +000b4480: 706f 696e 745f 636f 756e 7429 3b0a 0a20 point_count);.. │ │ │ +000b4490: 2020 202f 2f20 696e 6974 6961 6c69 7a65 // initialize │ │ │ +000b44a0: 2074 6865 2070 6f69 6e74 7320 6865 7265 the points here │ │ │ +000b44b0: 202e 2e2e 0a20 2020 2066 6f72 2820 696e .... for( in │ │ │ +000b44c0: 7420 6920 3d20 303b 2069 2026 6c74 3b20 t i = 0; i < │ │ │ +000b44d0: 706f 696e 745f 636f 756e 743b 2069 2b2b point_count; i++ │ │ │ +000b44e0: 2029 0a20 2020 207b 0a20 2020 2020 2020 ). {. │ │ │ +000b44f0: 2070 6f69 6e74 7331 5b69 5d20 3d20 2e2e points1[i] = .. │ │ │ +000b4500: 2e3b 0a20 2020 2020 2020 2070 6f69 6e74 .;. point │ │ │ +000b4510: 7332 5b69 5d20 3d20 2e2e 2e3b 0a20 2020 s2[i] = ...;. │ │ │ +000b4520: 207d 0a0a 2020 2020 2f2f 2063 616d 6574 }.. // camet │ │ │ +000b4530: 7261 206d 6174 7269 7820 7769 7468 2062 ra matrix with b │ │ │ +000b4540: 6f74 6820 666f 6361 6c20 6c65 6e67 7468 oth focal length │ │ │ +000b4550: 7320 3d20 312c 2061 6e64 2070 7269 6e63 s = 1, and princ │ │ │ +000b4560: 6970 616c 2070 6f69 6e74 203d 2028 302c ipal point = (0, │ │ │ +000b4570: 2030 290a 2020 2020 4d61 7420 6361 6d65 0). Mat came │ │ │ +000b4580: 7261 4d61 7472 6978 203d 204d 6174 3a3a raMatrix = Mat:: │ │ │ +000b4590: 6579 6528 332c 2033 2c20 4356 5f36 3446 eye(3, 3, CV_64F │ │ │ +000b45a0: 293b 0a0a 2020 2020 4d61 7420 452c 2052 );.. Mat E, R │ │ │ +000b45b0: 2c20 742c 206d 6173 6b3b 0a0a 2020 2020 , t, mask;.. │ │ │ +000b45c0: 4520 3d20 6669 6e64 4573 7365 6e74 6961 E = findEssentia │ │ │ +000b45d0: 6c4d 6174 2870 6f69 6e74 7331 2c20 706f lMat(points1, po │ │ │ +000b45e0: 696e 7473 322c 2063 616d 6572 614d 6174 ints2, cameraMat │ │ │ +000b45f0: 7269 782c 2052 414e 5341 432c 2030 2e39 rix, RANSAC, 0.9 │ │ │ +000b4600: 3939 2c20 312e 302c 206d 6173 6b29 3b0a 99, 1.0, mask);. │ │ │ +000b4610: 2020 2020 7265 636f 7665 7250 6f73 6528 recoverPose( │ │ │ +000b4620: 452c 2070 6f69 6e74 7331 2c20 706f 696e E, points1, poin │ │ │ +000b4630: 7473 322c 2063 616d 6572 614d 6174 7269 ts2, cameraMatri │ │ │ +000b4640: 782c 2052 2c20 742c 206d 6173 6b29 3b0a x, R, t, mask);. │ │ │ +000b4650: 3c2f 636f 6465 3e3c 2f64 643e 0a3c 6474
    .
    Returns:
    .< │ │ │ +000b4670: 6464 3e61 7574 6f6d 6174 6963 616c 6c79 dd>automatically │ │ │ +000b4680: 2067 656e 6572 6174 6564 3c2f 6464 3e0a generated. │ │ │ +000b4690: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73 .
    .
    ...
    .

    recoverPo │ │ │ +000b4780: 7365 3c2f 6833 3e0a 3c64 6976 2063 6c61 se

    .
    .
    pu │ │ │ +000b47e0: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static int&nbs │ │ │ +000b4820: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;rec │ │ │ +000b4840: 6f76 6572 506f 7365 3c2f 7370 616e 3e3c overPose< │ │ │ +000b4850: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat E,. Mat&n │ │ │ +000b4900: 6273 703b 706f 696e 7473 312c 0a20 3c61 bsp;points1,. Mat points2,. │ │ │ +000b4960: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000b49a0: 3c2f 613e 266e 6273 703b 522c 0a20 3c61  R,. Mat t,. doubl │ │ │ +000b4a00: 6526 6e62 7370 3b66 6f63 616c 2c0a 203c e focal,. < │ │ │ +000b4a10: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000b4a20: 506f 696e 742e 6874 6d6c 2220 7469 746c Point.html" titl │ │ │ +000b4a30: 653d 2263 6c61 7373 2069 6e20 6f72 672e e="class in org. │ │ │ +000b4a40: 6f70 656e 6376 2e63 6f72 6522 3e50 6f69 opencv.core">Poi │ │ │ +000b4a50: 6e74 3c2f 613e 266e 6273 703b 7070 2c0a nt pp,. │ │ │ +000b4a60: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000b4aa0: 3c2f 613e 266e 6273 703b 6d61 736b 293c  mask)< │ │ │ +000b4ab0: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 646c /span>
    .
    . │ │ │ +000b4ad0: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ +000b4ae0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e45 /dt>.
    E │ │ │ +000b4af0: 3c2f 636f 6465 3e20 2d20 5468 6520 696e - The in │ │ │ +000b4b00: 7075 7420 6573 7365 6e74 6961 6c20 6d61 put essential ma │ │ │ +000b4b10: 7472 6978 2e3c 2f64 643e 0a3c 6464 3e3c trix.
    .
    < │ │ │ +000b4b20: 636f 6465 3e70 6f69 6e74 7331 3c2f 636f code>points1 - Array of N │ │ │ +000b4b40: 2032 4420 706f 696e 7473 2066 726f 6d20 2D points from │ │ │ +000b4b50: 7468 6520 6669 7273 7420 696d 6167 652e the first image. │ │ │ +000b4b60: 2054 6865 2070 6f69 6e74 2063 6f6f 7264 The point coord │ │ │ +000b4b70: 696e 6174 6573 2073 686f 756c 6420 6265 inates should be │ │ │ +000b4b80: 0a66 6c6f 6174 696e 672d 706f 696e 7420 .floating-point │ │ │ +000b4b90: 2873 696e 676c 6520 6f72 2064 6f75 626c (single or doubl │ │ │ +000b4ba0: 6520 7072 6563 6973 696f 6e29 2e3c 2f64 e precision)..
    poi │ │ │ +000b4bc0: 6e74 7332 3c2f 636f 6465 3e20 2d20 4172 nts2 - Ar │ │ │ +000b4bd0: 7261 7920 6f66 2074 6865 2073 6563 6f6e ray of the secon │ │ │ +000b4be0: 6420 696d 6167 6520 706f 696e 7473 206f d image points o │ │ │ +000b4bf0: 6620 7468 6520 7361 6d65 2073 697a 6520 f the same size │ │ │ +000b4c00: 616e 6420 666f 726d 6174 2061 7320 706f and format as po │ │ │ +000b4c10: 696e 7473 3120 2e3c 2f64 643e 0a3c 6464 ints1 .
    .
    R │ │ │ +000b4c30: 2d20 4f75 7470 7574 2072 6f74 6174 696f - Output rotatio │ │ │ +000b4c40: 6e20 6d61 7472 6978 2e20 546f 6765 7468 n matrix. Togeth │ │ │ +000b4c50: 6572 2077 6974 6820 7468 6520 7472 616e er with the tran │ │ │ +000b4c60: 736c 6174 696f 6e20 7665 6374 6f72 2c20 slation vector, │ │ │ +000b4c70: 7468 6973 206d 6174 7269 7820 6d61 6b65 this matrix make │ │ │ +000b4c80: 7320 7570 2061 2074 7570 6c65 0a74 6861 s up a tuple.tha │ │ │ +000b4c90: 7420 7065 7266 6f72 6d73 2061 2063 6861 t performs a cha │ │ │ +000b4ca0: 6e67 6520 6f66 2062 6173 6973 2066 726f nge of basis fro │ │ │ +000b4cb0: 6d20 7468 6520 6669 7273 7420 6361 6d65 m the first came │ │ │ +000b4cc0: 7261 2773 2063 6f6f 7264 696e 6174 6520 ra's coordinate │ │ │ +000b4cd0: 7379 7374 656d 2074 6f20 7468 6520 7365 system to the se │ │ │ +000b4ce0: 636f 6e64 2063 616d 6572 6127 730a 636f cond camera's.co │ │ │ +000b4cf0: 6f72 6469 6e61 7465 2073 7973 7465 6d2e ordinate system. │ │ │ +000b4d00: 204e 6f74 6520 7468 6174 2c20 696e 2067 Note that, in g │ │ │ +000b4d10: 656e 6572 616c 2c20 7420 6361 6e20 6e6f eneral, t can no │ │ │ +000b4d20: 7420 6265 2075 7365 6420 666f 7220 7468 t be used for th │ │ │ +000b4d30: 6973 2074 7570 6c65 2c20 7365 6520 7468 is tuple, see th │ │ │ +000b4d40: 6520 7061 7261 6d65 7465 720a 6465 7363 e parameter.desc │ │ │ +000b4d50: 7269 7074 696f 6e20 6265 6c6f 772e 3c2f ription below..
    t< │ │ │ +000b4d70: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ +000b4d80: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ +000b4d90: 6f72 2e20 5468 6973 2076 6563 746f 7220 or. This vector │ │ │ +000b4da0: 6973 206f 6274 6169 6e65 6420 6279 2052 is obtained by R │ │ │ +000b4db0: 4546 3a20 6465 636f 6d70 6f73 6545 7373 EF: decomposeEss │ │ │ +000b4dc0: 656e 7469 616c 4d61 7420 616e 640a 7468 entialMat and.th │ │ │ +000b4dd0: 6572 6566 6f72 6520 6973 206f 6e6c 7920 erefore is only │ │ │ +000b4de0: 6b6e 6f77 6e20 7570 2074 6f20 7363 616c known up to scal │ │ │ +000b4df0: 652c 2069 2e65 2e20 7420 6973 2074 6865 e, i.e. t is the │ │ │ +000b4e00: 2064 6972 6563 7469 6f6e 206f 6620 7468 direction of th │ │ │ +000b4e10: 6520 7472 616e 736c 6174 696f 6e20 7665 e translation ve │ │ │ +000b4e20: 6374 6f72 2061 6e64 2068 6173 2075 6e69 ctor and has uni │ │ │ +000b4e30: 740a 6c65 6e67 7468 2e3c 2f64 643e 0a3c t.length.
    .< │ │ │ +000b4e40: 6464 3e3c 636f 6465 3e66 6f63 616c 3c2f dd>focal - Focal le │ │ │ +000b4e60: 6e67 7468 206f 6620 7468 6520 6361 6d65 ngth of the came │ │ │ +000b4e70: 7261 2e20 4e6f 7465 2074 6861 7420 7468 ra. Note that th │ │ │ +000b4e80: 6973 2066 756e 6374 696f 6e20 6173 7375 is function assu │ │ │ +000b4e90: 6d65 7320 7468 6174 2070 6f69 6e74 7331 mes that points1 │ │ │ +000b4ea0: 2061 6e64 2070 6f69 6e74 7332 0a61 7265 and points2.are │ │ │ +000b4eb0: 2066 6561 7475 7265 2070 6f69 6e74 7320 feature points │ │ │ +000b4ec0: 6672 6f6d 2063 616d 6572 6173 2077 6974 from cameras wit │ │ │ +000b4ed0: 6820 7361 6d65 2066 6f63 616c 206c 656e h same focal len │ │ │ +000b4ee0: 6774 6820 616e 6420 7072 696e 6369 7061 gth and principa │ │ │ +000b4ef0: 6c20 706f 696e 742e 3c2f 6464 3e0a 3c64 l point..pp - principal po │ │ │ +000b4f20: 696e 7420 6f66 2074 6865 2063 616d 6572 int of the camer │ │ │ +000b4f30: 612e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 a..
    mask - │ │ │ +000b4f50: 496e 7075 742f 6f75 7470 7574 206d 6173 Input/output mas │ │ │ +000b4f60: 6b20 666f 7220 696e 6c69 6572 7320 696e k for inliers in │ │ │ +000b4f70: 2070 6f69 6e74 7331 2061 6e64 2070 6f69 points1 and poi │ │ │ +000b4f80: 6e74 7332 2e20 4966 2069 7420 6973 206e nts2. If it is n │ │ │ +000b4f90: 6f74 2065 6d70 7479 2c20 7468 656e 2069 ot empty, then i │ │ │ +000b4fa0: 7420 6d61 726b 730a 696e 6c69 6572 7320 t marks.inliers │ │ │ +000b4fb0: 696e 2070 6f69 6e74 7331 2061 6e64 2070 in points1 and p │ │ │ +000b4fc0: 6f69 6e74 7332 2066 6f72 2074 6865 2067 oints2 for the g │ │ │ +000b4fd0: 6976 656e 2065 7373 656e 7469 616c 206d iven essential m │ │ │ +000b4fe0: 6174 7269 7820 452e 204f 6e6c 7920 7468 atrix E. Only th │ │ │ +000b4ff0: 6573 6520 696e 6c69 6572 7320 7769 6c6c ese inliers will │ │ │ +000b5000: 2062 6520 7573 6564 2074 6f0a 7265 636f be used to.reco │ │ │ +000b5010: 7665 7220 706f 7365 2e20 496e 2074 6865 ver pose. In the │ │ │ +000b5020: 206f 7574 7075 7420 6d61 736b 206f 6e6c output mask onl │ │ │ +000b5030: 7920 696e 6c69 6572 7320 7768 6963 6820 y inliers which │ │ │ +000b5040: 7061 7373 2074 6865 2063 6869 7261 6c69 pass the chirali │ │ │ +000b5050: 7479 2063 6865 636b 2e0a 0a54 6869 7320 ty check...This │ │ │ +000b5060: 6675 6e63 7469 6f6e 2064 6966 6665 7273 function differs │ │ │ +000b5070: 2066 726f 6d20 7468 6520 6f6e 6520 6162 from the one ab │ │ │ +000b5080: 6f76 6520 7468 6174 2069 7420 636f 6d70 ove that it comp │ │ │ +000b5090: 7574 6573 2063 616d 6572 6120 696e 7472 utes camera intr │ │ │ +000b50a0: 696e 7369 6320 6d61 7472 6978 2066 726f insic matrix fro │ │ │ +000b50b0: 6d20 666f 6361 6c20 6c65 6e67 7468 2061 m focal length a │ │ │ +000b50c0: 6e64 0a70 7269 6e63 6970 616c 2070 6f69 nd.principal poi │ │ │ +000b50d0: 6e74 3a0a 0a5c 2841 203d 0a5c 6265 6769 nt:..\(A =.\begi │ │ │ +000b50e0: 6e7b 626d 6174 7269 787d 0a66 2026 616d n{bmatrix}.f &am │ │ │ +000b50f0: 703b 2030 2026 616d 703b 2078 5f7b 7070 p; 0 & x_{pp │ │ │ +000b5100: 7d20 205c 5c0a 3020 2661 6d70 3b20 6620 } \\.0 & f │ │ │ +000b5110: 2661 6d70 3b20 795f 7b70 707d 2020 5c5c & y_{pp} \\ │ │ │ +000b5120: 0a30 2026 616d 703b 2030 2026 616d 703b .0 & 0 & │ │ │ +000b5130: 2031 0a5c 656e 647b 626d 6174 7269 787d 1.\end{bmatrix} │ │ │ +000b5140: 5c29 3c2f 6464 3e0a 3c64 743e 5265 7475 \)
    .
    Retu │ │ │ +000b5150: 726e 733a 3c2f 6474 3e0a 3c64 643e 6175 rns:
    .
    au │ │ │ +000b5160: 746f 6d61 7469 6361 6c6c 7920 6765 6e65 tomatically gene │ │ │ +000b5170: 7261 7465 643c 2f64 643e 0a3c 2f64 6c3e rated
    .
    │ │ │ +000b5180: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ...
  • ..

    re │ │ │ +000b5250: 636f 7665 7250 6f73 653c 2f68 333e 0a3c coverPose

    .< │ │ │ +000b5260: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +000b5270: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +000b5280: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +000b5290: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +000b52c0: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +000b52d0: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +000b52e0: 726e 2d74 7970 6522 3e69 6e74 3c2f 7370 rn-type">int recoverPose< │ │ │ +000b5320: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat E, │ │ │ +000b5390: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000b53d0: 743c 2f61 3e26 6e62 7370 3b70 6f69 6e74 t point │ │ │ +000b53e0: 7331 2c0a 203c 6120 6872 6566 3d22 2e2e s1,. Mat po │ │ │ +000b5430: 696e 7473 322c 0a20 3c61 2068 7265 663d ints2,. Mat  │ │ │ +000b5480: 3b52 2c0a 203c 6120 6872 6566 3d22 2e2e ;R,. Mat t, │ │ │ +000b54d0: 0a20 646f 7562 6c65 266e 6273 703b 666f . double fo │ │ │ +000b54e0: 6361 6c2c 0a20 3c61 2068 7265 663d 222e cal,. Point&nb │ │ │ +000b5530: 7370 3b70 7029 3c2f 7370 616e 3e3c 2f64 sp;pp).
    .
    Param │ │ │ +000b5560: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ +000b5570: 3c63 6f64 653e 453c 2f63 6f64 653e 202d E - │ │ │ +000b5580: 2054 6865 2069 6e70 7574 2065 7373 656e The input essen │ │ │ +000b5590: 7469 616c 206d 6174 7269 782e 3c2f 6464 tial matrix.
    .
    poin │ │ │ +000b55b0: 7473 313c 2f63 6f64 653e 202d 2041 7272 ts1 - Arr │ │ │ +000b55c0: 6179 206f 6620 4e20 3244 2070 6f69 6e74 ay of N 2D point │ │ │ +000b55d0: 7320 6672 6f6d 2074 6865 2066 6972 7374 s from the first │ │ │ +000b55e0: 2069 6d61 6765 2e20 5468 6520 706f 696e image. The poin │ │ │ +000b55f0: 7420 636f 6f72 6469 6e61 7465 7320 7368 t coordinates sh │ │ │ +000b5600: 6f75 6c64 2062 650a 666c 6f61 7469 6e67 ould be.floating │ │ │ +000b5610: 2d70 6f69 6e74 2028 7369 6e67 6c65 206f -point (single o │ │ │ +000b5620: 7220 646f 7562 6c65 2070 7265 6369 7369 r double precisi │ │ │ +000b5630: 6f6e 292e 3c2f 6464 3e0a 3c64 643e 3c63 on).
    .
    points2 - Array of th │ │ │ +000b5660: 6520 7365 636f 6e64 2069 6d61 6765 2070 e second image p │ │ │ +000b5670: 6f69 6e74 7320 6f66 2074 6865 2073 616d oints of the sam │ │ │ +000b5680: 6520 7369 7a65 2061 6e64 2066 6f72 6d61 e size and forma │ │ │ +000b5690: 7420 6173 2070 6f69 6e74 7331 202e 3c2f t as points1 ..
    R< │ │ │ +000b56b0: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ +000b56c0: 726f 7461 7469 6f6e 206d 6174 7269 782e rotation matrix. │ │ │ +000b56d0: 2054 6f67 6574 6865 7220 7769 7468 2074 Together with t │ │ │ +000b56e0: 6865 2074 7261 6e73 6c61 7469 6f6e 2076 he translation v │ │ │ +000b56f0: 6563 746f 722c 2074 6869 7320 6d61 7472 ector, this matr │ │ │ +000b5700: 6978 206d 616b 6573 2075 7020 6120 7475 ix makes up a tu │ │ │ +000b5710: 706c 650a 7468 6174 2070 6572 666f 726d ple.that perform │ │ │ +000b5720: 7320 6120 6368 616e 6765 206f 6620 6261 s a change of ba │ │ │ +000b5730: 7369 7320 6672 6f6d 2074 6865 2066 6972 sis from the fir │ │ │ +000b5740: 7374 2063 616d 6572 6127 7320 636f 6f72 st camera's coor │ │ │ +000b5750: 6469 6e61 7465 2073 7973 7465 6d20 746f dinate system to │ │ │ +000b5760: 2074 6865 2073 6563 6f6e 6420 6361 6d65 the second came │ │ │ +000b5770: 7261 2773 0a63 6f6f 7264 696e 6174 6520 ra's.coordinate │ │ │ +000b5780: 7379 7374 656d 2e20 4e6f 7465 2074 6861 system. Note tha │ │ │ +000b5790: 742c 2069 6e20 6765 6e65 7261 6c2c 2074 t, in general, t │ │ │ +000b57a0: 2063 616e 206e 6f74 2062 6520 7573 6564 can not be used │ │ │ +000b57b0: 2066 6f72 2074 6869 7320 7475 706c 652c for this tuple, │ │ │ +000b57c0: 2073 6565 2074 6865 2070 6172 616d 6574 see the paramet │ │ │ +000b57d0: 6572 0a64 6573 6372 6970 7469 6f6e 2062 er.description b │ │ │ +000b57e0: 656c 6f77 2e3c 2f64 643e 0a3c 6464 3e3c elow.
    .
    < │ │ │ +000b57f0: 636f 6465 3e74 3c2f 636f 6465 3e20 2d20 code>t - │ │ │ +000b5800: 4f75 7470 7574 2074 7261 6e73 6c61 7469 Output translati │ │ │ +000b5810: 6f6e 2076 6563 746f 722e 2054 6869 7320 on vector. This │ │ │ +000b5820: 7665 6374 6f72 2069 7320 6f62 7461 696e vector is obtain │ │ │ +000b5830: 6564 2062 7920 5245 463a 2064 6563 6f6d ed by REF: decom │ │ │ +000b5840: 706f 7365 4573 7365 6e74 6961 6c4d 6174 poseEssentialMat │ │ │ +000b5850: 2061 6e64 0a74 6865 7265 666f 7265 2069 and.therefore i │ │ │ +000b5860: 7320 6f6e 6c79 206b 6e6f 776e 2075 7020 s only known up │ │ │ +000b5870: 746f 2073 6361 6c65 2c20 692e 652e 2074 to scale, i.e. t │ │ │ +000b5880: 2069 7320 7468 6520 6469 7265 6374 696f is the directio │ │ │ +000b5890: 6e20 6f66 2074 6865 2074 7261 6e73 6c61 n of the transla │ │ │ +000b58a0: 7469 6f6e 2076 6563 746f 7220 616e 6420 tion vector and │ │ │ +000b58b0: 6861 7320 756e 6974 0a6c 656e 6774 682e has unit.length. │ │ │ +000b58c0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000b58d0: 666f 6361 6c3c 2f63 6f64 653e 202d 2046 focal - F │ │ │ +000b58e0: 6f63 616c 206c 656e 6774 6820 6f66 2074 ocal length of t │ │ │ +000b58f0: 6865 2063 616d 6572 612e 204e 6f74 6520 he camera. Note │ │ │ +000b5900: 7468 6174 2074 6869 7320 6675 6e63 7469 that this functi │ │ │ +000b5910: 6f6e 2061 7373 756d 6573 2074 6861 7420 on assumes that │ │ │ +000b5920: 706f 696e 7473 3120 616e 6420 706f 696e points1 and poin │ │ │ +000b5930: 7473 320a 6172 6520 6665 6174 7572 6520 ts2.are feature │ │ │ +000b5940: 706f 696e 7473 2066 726f 6d20 6361 6d65 points from came │ │ │ +000b5950: 7261 7320 7769 7468 2073 616d 6520 666f ras with same fo │ │ │ +000b5960: 6361 6c20 6c65 6e67 7468 2061 6e64 2070 cal length and p │ │ │ +000b5970: 7269 6e63 6970 616c 2070 6f69 6e74 2e3c rincipal point.< │ │ │ +000b5980: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e70 /dd>.
    p │ │ │ +000b5990: 703c 2f63 6f64 653e 202d 2070 7269 6e63 p - princ │ │ │ +000b59a0: 6970 616c 2070 6f69 6e74 206f 6620 7468 ipal point of th │ │ │ +000b59b0: 6520 6361 6d65 7261 2e0a 696e 6c69 6572 e camera..inlier │ │ │ +000b59c0: 7320 696e 2070 6f69 6e74 7331 2061 6e64 s in points1 and │ │ │ +000b59d0: 2070 6f69 6e74 7332 2066 6f72 2074 6865 points2 for the │ │ │ +000b59e0: 2067 6976 656e 2065 7373 656e 7469 616c given essential │ │ │ +000b59f0: 206d 6174 7269 7820 452e 204f 6e6c 7920 matrix E. Only │ │ │ +000b5a00: 7468 6573 6520 696e 6c69 6572 7320 7769 these inliers wi │ │ │ +000b5a10: 6c6c 2062 6520 7573 6564 2074 6f0a 7265 ll be used to.re │ │ │ +000b5a20: 636f 7665 7220 706f 7365 2e20 496e 2074 cover pose. In t │ │ │ +000b5a30: 6865 206f 7574 7075 7420 6d61 736b 206f he output mask o │ │ │ +000b5a40: 6e6c 7920 696e 6c69 6572 7320 7768 6963 nly inliers whic │ │ │ +000b5a50: 6820 7061 7373 2074 6865 2063 6869 7261 h pass the chira │ │ │ +000b5a60: 6c69 7479 2063 6865 636b 2e0a 0a54 6869 lity check...Thi │ │ │ +000b5a70: 7320 6675 6e63 7469 6f6e 2064 6966 6665 s function diffe │ │ │ +000b5a80: 7273 2066 726f 6d20 7468 6520 6f6e 6520 rs from the one │ │ │ +000b5a90: 6162 6f76 6520 7468 6174 2069 7420 636f above that it co │ │ │ +000b5aa0: 6d70 7574 6573 2063 616d 6572 6120 696e mputes camera in │ │ │ +000b5ab0: 7472 696e 7369 6320 6d61 7472 6978 2066 trinsic matrix f │ │ │ +000b5ac0: 726f 6d20 666f 6361 6c20 6c65 6e67 7468 rom focal length │ │ │ +000b5ad0: 2061 6e64 0a70 7269 6e63 6970 616c 2070 and.principal p │ │ │ +000b5ae0: 6f69 6e74 3a0a 0a5c 2841 203d 0a5c 6265 oint:..\(A =.\be │ │ │ +000b5af0: 6769 6e7b 626d 6174 7269 787d 0a66 2026 gin{bmatrix}.f & │ │ │ +000b5b00: 616d 703b 2030 2026 616d 703b 2078 5f7b amp; 0 & x_{ │ │ │ +000b5b10: 7070 7d20 205c 5c0a 3020 2661 6d70 3b20 pp} \\.0 & │ │ │ +000b5b20: 6620 2661 6d70 3b20 795f 7b70 707d 2020 f & y_{pp} │ │ │ +000b5b30: 5c5c 0a30 2026 616d 703b 2030 2026 616d \\.0 & 0 &am │ │ │ +000b5b40: 703b 2031 0a5c 656e 647b 626d 6174 7269 p; 1.\end{bmatri │ │ │ +000b5b50: 787d 5c29 3c2f 6464 3e0a 3c64 743e 5265 x}\)
    .
    Re │ │ │ +000b5b60: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ +000b5b70: 6175 746f 6d61 7469 6361 6c6c 7920 6765 automatically ge │ │ │ +000b5b80: 6e65 7261 7465 643c 2f64 643e 0a3c 2f64 nerated
    ..
  • ...
  • . │ │ │ +000b5bb0: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    recove │ │ │ +000b5c50: 7250 6f73 653c 2f68 333e 0a3c 6469 7620 rPose

    .
    .
    public static int& │ │ │ +000b5cf0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ +000b5d10: 7265 636f 7665 7250 6f73 653c 2f73 7061 recoverPose │ │ │ +000b5d40: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ +000b5d80: 3c2f 613e 266e 6273 703b 452c 0a20 3c61  E,. Mat points1,. │ │ │ +000b5de0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000b5e20: 3c2f 613e 266e 6273 703b 706f 696e 7473  points │ │ │ +000b5e30: 322c 0a20 3c61 2068 7265 663d 222e 2e2f 2,. │ │ │ +000b5e70: 4d61 743c 2f61 3e26 6e62 7370 3b52 2c0a Mat R,. │ │ │ +000b5e80: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000b5ec0: 3c2f 613e 266e 6273 703b 742c 0a20 646f  t,. do │ │ │ +000b5ed0: 7562 6c65 266e 6273 703b 666f 6361 6c29 uble focal) │ │ │ +000b5ee0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    . │ │ │ +000b5f00: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +000b5f10: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000b5f20: 453c 2f63 6f64 653e 202d 2054 6865 2069 E - The i │ │ │ +000b5f30: 6e70 7574 2065 7373 656e 7469 616c 206d nput essential m │ │ │ +000b5f40: 6174 7269 782e 3c2f 6464 3e0a 3c64 643e atrix.
    .
    │ │ │ +000b5f50: 3c63 6f64 653e 706f 696e 7473 313c 2f63 points1 - Array of │ │ │ +000b5f70: 4e20 3244 2070 6f69 6e74 7320 6672 6f6d N 2D points from │ │ │ +000b5f80: 2074 6865 2066 6972 7374 2069 6d61 6765 the first image │ │ │ +000b5f90: 2e20 5468 6520 706f 696e 7420 636f 6f72 . The point coor │ │ │ +000b5fa0: 6469 6e61 7465 7320 7368 6f75 6c64 2062 dinates should b │ │ │ +000b5fb0: 650a 666c 6f61 7469 6e67 2d70 6f69 6e74 e.floating-point │ │ │ +000b5fc0: 2028 7369 6e67 6c65 206f 7220 646f 7562 (single or doub │ │ │ +000b5fd0: 6c65 2070 7265 6369 7369 6f6e 292e 3c2f le precision)..
    po │ │ │ +000b5ff0: 696e 7473 323c 2f63 6f64 653e 202d 2041 ints2 - A │ │ │ +000b6000: 7272 6179 206f 6620 7468 6520 7365 636f rray of the seco │ │ │ +000b6010: 6e64 2069 6d61 6765 2070 6f69 6e74 7320 nd image points │ │ │ +000b6020: 6f66 2074 6865 2073 616d 6520 7369 7a65 of the same size │ │ │ +000b6030: 2061 6e64 2066 6f72 6d61 7420 6173 2070 and format as p │ │ │ +000b6040: 6f69 6e74 7331 202e 3c2f 6464 3e0a 3c64 oints1 .
    .R │ │ │ +000b6060: 202d 204f 7574 7075 7420 726f 7461 7469 - Output rotati │ │ │ +000b6070: 6f6e 206d 6174 7269 782e 2054 6f67 6574 on matrix. Toget │ │ │ +000b6080: 6865 7220 7769 7468 2074 6865 2074 7261 her with the tra │ │ │ +000b6090: 6e73 6c61 7469 6f6e 2076 6563 746f 722c nslation vector, │ │ │ +000b60a0: 2074 6869 7320 6d61 7472 6978 206d 616b this matrix mak │ │ │ +000b60b0: 6573 2075 7020 6120 7475 706c 650a 7468 es up a tuple.th │ │ │ +000b60c0: 6174 2070 6572 666f 726d 7320 6120 6368 at performs a ch │ │ │ +000b60d0: 616e 6765 206f 6620 6261 7369 7320 6672 ange of basis fr │ │ │ +000b60e0: 6f6d 2074 6865 2066 6972 7374 2063 616d om the first cam │ │ │ +000b60f0: 6572 6127 7320 636f 6f72 6469 6e61 7465 era's coordinate │ │ │ +000b6100: 2073 7973 7465 6d20 746f 2074 6865 2073 system to the s │ │ │ +000b6110: 6563 6f6e 6420 6361 6d65 7261 2773 0a63 econd camera's.c │ │ │ +000b6120: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ +000b6130: 2e20 4e6f 7465 2074 6861 742c 2069 6e20 . Note that, in │ │ │ +000b6140: 6765 6e65 7261 6c2c 2074 2063 616e 206e general, t can n │ │ │ +000b6150: 6f74 2062 6520 7573 6564 2066 6f72 2074 ot be used for t │ │ │ +000b6160: 6869 7320 7475 706c 652c 2073 6565 2074 his tuple, see t │ │ │ +000b6170: 6865 2070 6172 616d 6574 6572 0a64 6573 he parameter.des │ │ │ +000b6180: 6372 6970 7469 6f6e 2062 656c 6f77 2e3c cription below.< │ │ │ +000b6190: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ +000b61a0: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +000b61b0: 2074 7261 6e73 6c61 7469 6f6e 2076 6563 translation vec │ │ │ +000b61c0: 746f 722e 2054 6869 7320 7665 6374 6f72 tor. This vector │ │ │ +000b61d0: 2069 7320 6f62 7461 696e 6564 2062 7920 is obtained by │ │ │ +000b61e0: 5245 463a 2064 6563 6f6d 706f 7365 4573 REF: decomposeEs │ │ │ +000b61f0: 7365 6e74 6961 6c4d 6174 2061 6e64 0a74 sentialMat and.t │ │ │ +000b6200: 6865 7265 666f 7265 2069 7320 6f6e 6c79 herefore is only │ │ │ +000b6210: 206b 6e6f 776e 2075 7020 746f 2073 6361 known up to sca │ │ │ +000b6220: 6c65 2c20 692e 652e 2074 2069 7320 7468 le, i.e. t is th │ │ │ +000b6230: 6520 6469 7265 6374 696f 6e20 6f66 2074 e direction of t │ │ │ +000b6240: 6865 2074 7261 6e73 6c61 7469 6f6e 2076 he translation v │ │ │ +000b6250: 6563 746f 7220 616e 6420 6861 7320 756e ector and has un │ │ │ +000b6260: 6974 0a6c 656e 6774 682e 3c2f 6464 3e0a it.length.
    . │ │ │ +000b6270: 3c64 643e 3c63 6f64 653e 666f 6361 6c3c
    focal< │ │ │ +000b6280: 2f63 6f64 653e 202d 2046 6f63 616c 206c /code> - Focal l │ │ │ +000b6290: 656e 6774 6820 6f66 2074 6865 2063 616d ength of the cam │ │ │ +000b62a0: 6572 612e 204e 6f74 6520 7468 6174 2074 era. Note that t │ │ │ +000b62b0: 6869 7320 6675 6e63 7469 6f6e 2061 7373 his function ass │ │ │ +000b62c0: 756d 6573 2074 6861 7420 706f 696e 7473 umes that points │ │ │ +000b62d0: 3120 616e 6420 706f 696e 7473 320a 6172 1 and points2.ar │ │ │ +000b62e0: 6520 6665 6174 7572 6520 706f 696e 7473 e feature points │ │ │ +000b62f0: 2066 726f 6d20 6361 6d65 7261 7320 7769 from cameras wi │ │ │ +000b6300: 7468 2073 616d 6520 666f 6361 6c20 6c65 th same focal le │ │ │ +000b6310: 6e67 7468 2061 6e64 2070 7269 6e63 6970 ngth and princip │ │ │ +000b6320: 616c 2070 6f69 6e74 2e0a 696e 6c69 6572 al point..inlier │ │ │ +000b6330: 7320 696e 2070 6f69 6e74 7331 2061 6e64 s in points1 and │ │ │ +000b6340: 2070 6f69 6e74 7332 2066 6f72 2074 6865 points2 for the │ │ │ +000b6350: 2067 6976 656e 2065 7373 656e 7469 616c given essential │ │ │ +000b6360: 206d 6174 7269 7820 452e 204f 6e6c 7920 matrix E. Only │ │ │ +000b6370: 7468 6573 6520 696e 6c69 6572 7320 7769 these inliers wi │ │ │ +000b6380: 6c6c 2062 6520 7573 6564 2074 6f0a 7265 ll be used to.re │ │ │ +000b6390: 636f 7665 7220 706f 7365 2e20 496e 2074 cover pose. In t │ │ │ +000b63a0: 6865 206f 7574 7075 7420 6d61 736b 206f he output mask o │ │ │ +000b63b0: 6e6c 7920 696e 6c69 6572 7320 7768 6963 nly inliers whic │ │ │ +000b63c0: 6820 7061 7373 2074 6865 2063 6869 7261 h pass the chira │ │ │ +000b63d0: 6c69 7479 2063 6865 636b 2e0a 0a54 6869 lity check...Thi │ │ │ +000b63e0: 7320 6675 6e63 7469 6f6e 2064 6966 6665 s function diffe │ │ │ +000b63f0: 7273 2066 726f 6d20 7468 6520 6f6e 6520 rs from the one │ │ │ +000b6400: 6162 6f76 6520 7468 6174 2069 7420 636f above that it co │ │ │ +000b6410: 6d70 7574 6573 2063 616d 6572 6120 696e mputes camera in │ │ │ +000b6420: 7472 696e 7369 6320 6d61 7472 6978 2066 trinsic matrix f │ │ │ +000b6430: 726f 6d20 666f 6361 6c20 6c65 6e67 7468 rom focal length │ │ │ +000b6440: 2061 6e64 0a70 7269 6e63 6970 616c 2070 and.principal p │ │ │ +000b6450: 6f69 6e74 3a0a 0a5c 2841 203d 0a5c 6265 oint:..\(A =.\be │ │ │ +000b6460: 6769 6e7b 626d 6174 7269 787d 0a66 2026 gin{bmatrix}.f & │ │ │ +000b6470: 616d 703b 2030 2026 616d 703b 2078 5f7b amp; 0 & x_{ │ │ │ +000b6480: 7070 7d20 205c 5c0a 3020 2661 6d70 3b20 pp} \\.0 & │ │ │ +000b6490: 6620 2661 6d70 3b20 795f 7b70 707d 2020 f & y_{pp} │ │ │ +000b64a0: 5c5c 0a30 2026 616d 703b 2030 2026 616d \\.0 & 0 &am │ │ │ +000b64b0: 703b 2031 0a5c 656e 647b 626d 6174 7269 p; 1.\end{bmatri │ │ │ +000b64c0: 787d 5c29 3c2f 6464 3e0a 3c64 743e 5265 x}\)
    .
    Re │ │ │ +000b64d0: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ +000b64e0: 6175 746f 6d61 7469 6361 6c6c 7920 6765 automatically ge │ │ │ +000b64f0: 6e65 7261 7465 643c 2f64 643e 0a3c 2f64 nerated
    .
    .
    ..
  • .
  • . │ │ │ +000b6520: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .< │ │ │ +000b65b0: 6833 3e72 6563 6f76 6572 506f 7365 3c2f h3>recoverPose.
    .
    public │ │ │ +000b6620: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +000b6630: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;in │ │ │ +000b6650: 743c 2f73 7061 6e3e 266e 6273 703b 3c73 t recover │ │ │ +000b6680: 506f 7365 3c2f 7370 616e 3e3c 7762 723e Pose │ │ │ +000b6690: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +000b66f0: 7370 3b45 2c0a 203c 6120 6872 6566 3d22 sp;E,. Mat  │ │ │ +000b6740: 706f 696e 7473 312c 0a20 3c61 2068 7265 points1,. Mat&nb │ │ │ +000b6790: 7370 3b70 6f69 6e74 7332 2c0a 203c 6120 sp;points2,. Mat │ │ │ +000b67e0: 266e 6273 703b 522c 0a20 3c61 2068 7265  R,. Mat&nb │ │ │ +000b6830: 7370 3b74 293c 2f73 7061 6e3e 3c2f 6469 sp;t).
    .
    Parame │ │ │ +000b6860: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ +000b6870: 636f 6465 3e45 3c2f 636f 6465 3e20 2d20 code>E - │ │ │ +000b6880: 5468 6520 696e 7075 7420 6573 7365 6e74 The input essent │ │ │ +000b6890: 6961 6c20 6d61 7472 6978 2e3c 2f64 643e ial matrix.
    │ │ │ +000b68a0: 0a3c 6464 3e3c 636f 6465 3e70 6f69 6e74 .
    point │ │ │ +000b68b0: 7331 3c2f 636f 6465 3e20 2d20 4172 7261 s1 - Arra │ │ │ +000b68c0: 7920 6f66 204e 2032 4420 706f 696e 7473 y of N 2D points │ │ │ +000b68d0: 2066 726f 6d20 7468 6520 6669 7273 7420 from the first │ │ │ +000b68e0: 696d 6167 652e 2054 6865 2070 6f69 6e74 image. The point │ │ │ +000b68f0: 2063 6f6f 7264 696e 6174 6573 2073 686f coordinates sho │ │ │ +000b6900: 756c 6420 6265 0a66 6c6f 6174 696e 672d uld be.floating- │ │ │ +000b6910: 706f 696e 7420 2873 696e 676c 6520 6f72 point (single or │ │ │ +000b6920: 2064 6f75 626c 6520 7072 6563 6973 696f double precisio │ │ │ +000b6930: 6e29 2e3c 2f64 643e 0a3c 6464 3e3c 636f n).
    .
    points2 - Array of the │ │ │ +000b6960: 2073 6563 6f6e 6420 696d 6167 6520 706f second image po │ │ │ +000b6970: 696e 7473 206f 6620 7468 6520 7361 6d65 ints of the same │ │ │ +000b6980: 2073 697a 6520 616e 6420 666f 726d 6174 size and format │ │ │ +000b6990: 2061 7320 706f 696e 7473 3120 2e3c 2f64 as points1 ..
    R - Output r │ │ │ +000b69c0: 6f74 6174 696f 6e20 6d61 7472 6978 2e20 otation matrix. │ │ │ +000b69d0: 546f 6765 7468 6572 2077 6974 6820 7468 Together with th │ │ │ +000b69e0: 6520 7472 616e 736c 6174 696f 6e20 7665 e translation ve │ │ │ +000b69f0: 6374 6f72 2c20 7468 6973 206d 6174 7269 ctor, this matri │ │ │ +000b6a00: 7820 6d61 6b65 7320 7570 2061 2074 7570 x makes up a tup │ │ │ +000b6a10: 6c65 0a74 6861 7420 7065 7266 6f72 6d73 le.that performs │ │ │ +000b6a20: 2061 2063 6861 6e67 6520 6f66 2062 6173 a change of bas │ │ │ +000b6a30: 6973 2066 726f 6d20 7468 6520 6669 7273 is from the firs │ │ │ +000b6a40: 7420 6361 6d65 7261 2773 2063 6f6f 7264 t camera's coord │ │ │ +000b6a50: 696e 6174 6520 7379 7374 656d 2074 6f20 inate system to │ │ │ +000b6a60: 7468 6520 7365 636f 6e64 2063 616d 6572 the second camer │ │ │ +000b6a70: 6127 730a 636f 6f72 6469 6e61 7465 2073 a's.coordinate s │ │ │ +000b6a80: 7973 7465 6d2e 204e 6f74 6520 7468 6174 ystem. Note that │ │ │ +000b6a90: 2c20 696e 2067 656e 6572 616c 2c20 7420 , in general, t │ │ │ +000b6aa0: 6361 6e20 6e6f 7420 6265 2075 7365 6420 can not be used │ │ │ +000b6ab0: 666f 7220 7468 6973 2074 7570 6c65 2c20 for this tuple, │ │ │ +000b6ac0: 7365 6520 7468 6520 7061 7261 6d65 7465 see the paramete │ │ │ +000b6ad0: 720a 6465 7363 7269 7074 696f 6e20 6265 r.description be │ │ │ +000b6ae0: 6c6f 772e 3c2f 6464 3e0a 3c64 643e 3c63 low.
    .
    t - O │ │ │ +000b6b00: 7574 7075 7420 7472 616e 736c 6174 696f utput translatio │ │ │ +000b6b10: 6e20 7665 6374 6f72 2e20 5468 6973 2076 n vector. This v │ │ │ +000b6b20: 6563 746f 7220 6973 206f 6274 6169 6e65 ector is obtaine │ │ │ +000b6b30: 6420 6279 2052 4546 3a20 6465 636f 6d70 d by REF: decomp │ │ │ +000b6b40: 6f73 6545 7373 656e 7469 616c 4d61 7420 oseEssentialMat │ │ │ +000b6b50: 616e 640a 7468 6572 6566 6f72 6520 6973 and.therefore is │ │ │ +000b6b60: 206f 6e6c 7920 6b6e 6f77 6e20 7570 2074 only known up t │ │ │ +000b6b70: 6f20 7363 616c 652c 2069 2e65 2e20 7420 o scale, i.e. t │ │ │ +000b6b80: 6973 2074 6865 2064 6972 6563 7469 6f6e is the direction │ │ │ +000b6b90: 206f 6620 7468 6520 7472 616e 736c 6174 of the translat │ │ │ +000b6ba0: 696f 6e20 7665 6374 6f72 2061 6e64 2068 ion vector and h │ │ │ +000b6bb0: 6173 2075 6e69 740a 6c65 6e67 7468 2e0a as unit.length.. │ │ │ +000b6bc0: 6172 6520 6665 6174 7572 6520 706f 696e are feature poin │ │ │ +000b6bd0: 7473 2066 726f 6d20 6361 6d65 7261 7320 ts from cameras │ │ │ +000b6be0: 7769 7468 2073 616d 6520 666f 6361 6c20 with same focal │ │ │ +000b6bf0: 6c65 6e67 7468 2061 6e64 2070 7269 6e63 length and princ │ │ │ +000b6c00: 6970 616c 2070 6f69 6e74 2e0a 696e 6c69 ipal point..inli │ │ │ +000b6c10: 6572 7320 696e 2070 6f69 6e74 7331 2061 ers in points1 a │ │ │ +000b6c20: 6e64 2070 6f69 6e74 7332 2066 6f72 2074 nd points2 for t │ │ │ +000b6c30: 6865 2067 6976 656e 2065 7373 656e 7469 he given essenti │ │ │ +000b6c40: 616c 206d 6174 7269 7820 452e 204f 6e6c al matrix E. Onl │ │ │ +000b6c50: 7920 7468 6573 6520 696e 6c69 6572 7320 y these inliers │ │ │ +000b6c60: 7769 6c6c 2062 6520 7573 6564 2074 6f0a will be used to. │ │ │ +000b6c70: 7265 636f 7665 7220 706f 7365 2e20 496e recover pose. In │ │ │ +000b6c80: 2074 6865 206f 7574 7075 7420 6d61 736b the output mask │ │ │ +000b6c90: 206f 6e6c 7920 696e 6c69 6572 7320 7768 only inliers wh │ │ │ +000b6ca0: 6963 6820 7061 7373 2074 6865 2063 6869 ich pass the chi │ │ │ +000b6cb0: 7261 6c69 7479 2063 6865 636b 2e0a 0a54 rality check...T │ │ │ +000b6cc0: 6869 7320 6675 6e63 7469 6f6e 2064 6966 his function dif │ │ │ +000b6cd0: 6665 7273 2066 726f 6d20 7468 6520 6f6e fers from the on │ │ │ +000b6ce0: 6520 6162 6f76 6520 7468 6174 2069 7420 e above that it │ │ │ +000b6cf0: 636f 6d70 7574 6573 2063 616d 6572 6120 computes camera │ │ │ +000b6d00: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ +000b6d10: 2066 726f 6d20 666f 6361 6c20 6c65 6e67 from focal leng │ │ │ +000b6d20: 7468 2061 6e64 0a70 7269 6e63 6970 616c th and.principal │ │ │ +000b6d30: 2070 6f69 6e74 3a0a 0a5c 2841 203d 0a5c point:..\(A =.\ │ │ │ +000b6d40: 6265 6769 6e7b 626d 6174 7269 787d 0a66 begin{bmatrix}.f │ │ │ +000b6d50: 2026 616d 703b 2030 2026 616d 703b 2078 & 0 & x │ │ │ +000b6d60: 5f7b 7070 7d20 205c 5c0a 3020 2661 6d70 _{pp} \\.0 & │ │ │ +000b6d70: 3b20 6620 2661 6d70 3b20 795f 7b70 707d ; f & y_{pp} │ │ │ +000b6d80: 2020 5c5c 0a30 2026 616d 703b 2030 2026 \\.0 & 0 & │ │ │ +000b6d90: 616d 703b 2031 0a5c 656e 647b 626d 6174 amp; 1.\end{bmat │ │ │ +000b6da0: 7269 787d 5c29 3c2f 6464 3e0a 3c64 743e rix}\)
    .
    │ │ │ +000b6db0: 5265 7475 726e 733a 3c2f 6474 3e0a 3c64 Returns:
    .automatically │ │ │ +000b6dd0: 6765 6e65 7261 7465 643c 2f64 643e 0a3c generated.< │ │ │ +000b6de0: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ..
  • .
  • .
    .

    recoverP │ │ │ +000b6ee0: 6f73 653c 2f68 333e 0a3c 6469 7620 636c ose

    .
    .
    p │ │ │ +000b6f40: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static int&nb │ │ │ +000b6f80: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;re │ │ │ +000b6fa0: 636f 7665 7250 6f73 653c 2f73 7061 6e3e coverPose │ │ │ +000b6fb0: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ +000b6fd0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000b6fe0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000b6ff0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000b7000: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat E,. Mat& │ │ │ +000b7060: 6e62 7370 3b70 6f69 6e74 7331 2c0a 203c nbsp;points1,. < │ │ │ +000b7070: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000b7080: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000b7090: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000b70a0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat points2, │ │ │ +000b70c0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000b7100: 743c 2f61 3e26 6e62 7370 3b63 616d 6572 t camer │ │ │ +000b7110: 614d 6174 7269 782c 0a20 3c61 2068 7265 aMatrix,. Mat&nb │ │ │ +000b7160: 7370 3b52 2c0a 203c 6120 6872 6566 3d22 sp;R,. Mat  │ │ │ +000b71b0: 742c 0a20 646f 7562 6c65 266e 6273 703b t,. double  │ │ │ +000b71c0: 6469 7374 616e 6365 5468 7265 7368 2c0a distanceThresh,. │ │ │ +000b71d0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000b7210: 3c2f 613e 266e 6273 703b 6d61 736b 2c0a  mask,. │ │ │ +000b7220: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000b7260: 3c2f 613e 266e 6273 703b 7472 6961 6e67  triang │ │ │ +000b7270: 756c 6174 6564 506f 696e 7473 293c 2f73 ulatedPoints)
    .
    .Parameters:.
    E - The inpu │ │ │ +000b72d0: 7420 6573 7365 6e74 6961 6c20 6d61 7472 t essential matr │ │ │ +000b72e0: 6978 2e3c 2f64 643e 0a3c 6464 3e3c 636f ix.
    .
    points1 - Array of N 2 │ │ │ +000b7310: 4420 706f 696e 7473 2066 726f 6d20 7468 D points from th │ │ │ +000b7320: 6520 6669 7273 7420 696d 6167 652e 2054 e first image. T │ │ │ +000b7330: 6865 2070 6f69 6e74 2063 6f6f 7264 696e he point coordin │ │ │ +000b7340: 6174 6573 2073 686f 756c 6420 6265 0a66 ates should be.f │ │ │ +000b7350: 6c6f 6174 696e 672d 706f 696e 7420 2873 loating-point (s │ │ │ +000b7360: 696e 676c 6520 6f72 2064 6f75 626c 6520 ingle or double │ │ │ +000b7370: 7072 6563 6973 696f 6e29 2e3c 2f64 643e precision).
    │ │ │ +000b7380: 0a3c 6464 3e3c 636f 6465 3e70 6f69 6e74 .
    point │ │ │ +000b7390: 7332 3c2f 636f 6465 3e20 2d20 4172 7261 s2 - Arra │ │ │ +000b73a0: 7920 6f66 2074 6865 2073 6563 6f6e 6420 y of the second │ │ │ +000b73b0: 696d 6167 6520 706f 696e 7473 206f 6620 image points of │ │ │ +000b73c0: 7468 6520 7361 6d65 2073 697a 6520 616e the same size an │ │ │ +000b73d0: 6420 666f 726d 6174 2061 7320 706f 696e d format as poin │ │ │ +000b73e0: 7473 312e 3c2f 6464 3e0a 3c64 643e 3c63 ts1.
    .
    cameraMatrix │ │ │ +000b7400: 3c2f 636f 6465 3e20 2d20 4361 6d65 7261 - Camera │ │ │ +000b7410: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ +000b7420: 7820 5c28 5c63 616d 6572 616d 6174 7269 x \(\cameramatri │ │ │ +000b7430: 787b 417d 5c29 202e 0a4e 6f74 6520 7468 x{A}\) ..Note th │ │ │ +000b7440: 6174 2074 6869 7320 6675 6e63 7469 6f6e at this function │ │ │ +000b7450: 2061 7373 756d 6573 2074 6861 7420 706f assumes that po │ │ │ +000b7460: 696e 7473 3120 616e 6420 706f 696e 7473 ints1 and points │ │ │ +000b7470: 3220 6172 6520 6665 6174 7572 6520 706f 2 are feature po │ │ │ +000b7480: 696e 7473 2066 726f 6d20 6361 6d65 7261 ints from camera │ │ │ +000b7490: 7320 7769 7468 2074 6865 0a73 616d 6520 s with the.same │ │ │ +000b74a0: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ +000b74b0: 206d 6174 7269 782e 3c2f 6464 3e0a 3c64 matrix.
    .R │ │ │ +000b74d0: 202d 204f 7574 7075 7420 726f 7461 7469 - Output rotati │ │ │ +000b74e0: 6f6e 206d 6174 7269 782e 2054 6f67 6574 on matrix. Toget │ │ │ +000b74f0: 6865 7220 7769 7468 2074 6865 2074 7261 her with the tra │ │ │ +000b7500: 6e73 6c61 7469 6f6e 2076 6563 746f 722c nslation vector, │ │ │ +000b7510: 2074 6869 7320 6d61 7472 6978 206d 616b this matrix mak │ │ │ +000b7520: 6573 2075 7020 6120 7475 706c 650a 7468 es up a tuple.th │ │ │ +000b7530: 6174 2070 6572 666f 726d 7320 6120 6368 at performs a ch │ │ │ +000b7540: 616e 6765 206f 6620 6261 7369 7320 6672 ange of basis fr │ │ │ +000b7550: 6f6d 2074 6865 2066 6972 7374 2063 616d om the first cam │ │ │ +000b7560: 6572 6127 7320 636f 6f72 6469 6e61 7465 era's coordinate │ │ │ +000b7570: 2073 7973 7465 6d20 746f 2074 6865 2073 system to the s │ │ │ +000b7580: 6563 6f6e 6420 6361 6d65 7261 2773 0a63 econd camera's.c │ │ │ +000b7590: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ +000b75a0: 2e20 4e6f 7465 2074 6861 742c 2069 6e20 . Note that, in │ │ │ +000b75b0: 6765 6e65 7261 6c2c 2074 2063 616e 206e general, t can n │ │ │ +000b75c0: 6f74 2062 6520 7573 6564 2066 6f72 2074 ot be used for t │ │ │ +000b75d0: 6869 7320 7475 706c 652c 2073 6565 2074 his tuple, see t │ │ │ +000b75e0: 6865 2070 6172 616d 6574 6572 0a64 6573 he parameter.des │ │ │ +000b75f0: 6372 6970 7469 6f6e 2062 656c 6f77 2e3c cription below.< │ │ │ +000b7600: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ +000b7610: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +000b7620: 2074 7261 6e73 6c61 7469 6f6e 2076 6563 translation vec │ │ │ +000b7630: 746f 722e 2054 6869 7320 7665 6374 6f72 tor. This vector │ │ │ +000b7640: 2069 7320 6f62 7461 696e 6564 2062 7920 is obtained by │ │ │ +000b7650: 5245 463a 2064 6563 6f6d 706f 7365 4573 REF: decomposeEs │ │ │ +000b7660: 7365 6e74 6961 6c4d 6174 2061 6e64 0a74 sentialMat and.t │ │ │ +000b7670: 6865 7265 666f 7265 2069 7320 6f6e 6c79 herefore is only │ │ │ +000b7680: 206b 6e6f 776e 2075 7020 746f 2073 6361 known up to sca │ │ │ +000b7690: 6c65 2c20 692e 652e 2074 2069 7320 7468 le, i.e. t is th │ │ │ +000b76a0: 6520 6469 7265 6374 696f 6e20 6f66 2074 e direction of t │ │ │ +000b76b0: 6865 2074 7261 6e73 6c61 7469 6f6e 2076 he translation v │ │ │ +000b76c0: 6563 746f 7220 616e 6420 6861 7320 756e ector and has un │ │ │ +000b76d0: 6974 0a6c 656e 6774 682e 3c2f 6464 3e0a it.length.
    . │ │ │ +000b76e0: 3c64 643e 3c63 6f64 653e 6469 7374 616e
    distan │ │ │ +000b76f0: 6365 5468 7265 7368 3c2f 636f 6465 3e20 ceThresh │ │ │ +000b7700: 2d20 7468 7265 7368 6f6c 6420 6469 7374 - threshold dist │ │ │ +000b7710: 616e 6365 2077 6869 6368 2069 7320 7573 ance which is us │ │ │ +000b7720: 6564 2074 6f20 6669 6c74 6572 206f 7574 ed to filter out │ │ │ +000b7730: 2066 6172 2061 7761 7920 706f 696e 7473 far away points │ │ │ +000b7740: 2028 692e 652e 2069 6e66 696e 6974 650a (i.e. infinite. │ │ │ +000b7750: 706f 696e 7473 292e 3c2f 6464 3e0a 3c64 points).
    .mask - Input/outp │ │ │ +000b7780: 7574 206d 6173 6b20 666f 7220 696e 6c69 ut mask for inli │ │ │ +000b7790: 6572 7320 696e 2070 6f69 6e74 7331 2061 ers in points1 a │ │ │ +000b77a0: 6e64 2070 6f69 6e74 7332 2e20 4966 2069 nd points2. If i │ │ │ +000b77b0: 7420 6973 206e 6f74 2065 6d70 7479 2c20 t is not empty, │ │ │ +000b77c0: 7468 656e 2069 7420 6d61 726b 730a 696e then it marks.in │ │ │ +000b77d0: 6c69 6572 7320 696e 2070 6f69 6e74 7331 liers in points1 │ │ │ +000b77e0: 2061 6e64 2070 6f69 6e74 7332 2066 6f72 and points2 for │ │ │ +000b77f0: 2074 6865 2067 6976 656e 2065 7373 656e the given essen │ │ │ +000b7800: 7469 616c 206d 6174 7269 7820 452e 204f tial matrix E. O │ │ │ +000b7810: 6e6c 7920 7468 6573 6520 696e 6c69 6572 nly these inlier │ │ │ +000b7820: 7320 7769 6c6c 2062 6520 7573 6564 2074 s will be used t │ │ │ +000b7830: 6f0a 7265 636f 7665 7220 706f 7365 2e20 o.recover pose. │ │ │ +000b7840: 496e 2074 6865 206f 7574 7075 7420 6d61 In the output ma │ │ │ +000b7850: 736b 206f 6e6c 7920 696e 6c69 6572 7320 sk only inliers │ │ │ +000b7860: 7768 6963 6820 7061 7373 2074 6865 2063 which pass the c │ │ │ +000b7870: 6869 7261 6c69 7479 2063 6865 636b 2e3c hirality check.< │ │ │ +000b7880: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ +000b7890: 7269 616e 6775 6c61 7465 6450 6f69 6e74 riangulatedPoint │ │ │ +000b78a0: 733c 2f63 6f64 653e 202d 2033 4420 706f s - 3D po │ │ │ +000b78b0: 696e 7473 2077 6869 6368 2077 6572 6520 ints which were │ │ │ +000b78c0: 7265 636f 6e73 7472 7563 7465 6420 6279 reconstructed by │ │ │ +000b78d0: 2074 7269 616e 6775 6c61 7469 6f6e 2e0a triangulation.. │ │ │ +000b78e0: 0a54 6869 7320 6675 6e63 7469 6f6e 2064 .This function d │ │ │ +000b78f0: 6966 6665 7273 2066 726f 6d20 7468 6520 iffers from the │ │ │ +000b7900: 6f6e 6520 6162 6f76 6520 7468 6174 2069 one above that i │ │ │ +000b7910: 7420 6f75 7470 7574 7320 7468 6520 7472 t outputs the tr │ │ │ +000b7920: 6961 6e67 756c 6174 6564 2033 4420 706f iangulated 3D po │ │ │ +000b7930: 696e 7420 7468 6174 2061 7265 2075 7365 int that are use │ │ │ +000b7940: 6420 666f 720a 7468 6520 6368 6972 616c d for.the chiral │ │ │ +000b7950: 6974 7920 6368 6563 6b2e 3c2f 6464 3e0a ity check.
    . │ │ │ +000b7960: 3c64 743e 5265 7475 726e 733a 3c2f 6474
    Returns:
    .
    automatica │ │ │ +000b7980: 6c6c 7920 6765 6e65 7261 7465 643c 2f64 lly generated.
    .
    . │ │ │ +000b79a0: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e
    .
  • │ │ │ +000b79b0: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    recoverP │ │ │ +000b7a80: 6f73 653c 2f68 333e 0a3c 6469 7620 636c ose

    .
    .
    p │ │ │ +000b7ae0: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static int&nb │ │ │ +000b7b20: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;re │ │ │ +000b7b40: 636f 7665 7250 6f73 653c 2f73 7061 6e3e coverPose │ │ │ +000b7b50: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ +000b7b70: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000b7b80: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000b7b90: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000b7ba0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat E,. Mat& │ │ │ +000b7c00: 6e62 7370 3b70 6f69 6e74 7331 2c0a 203c nbsp;points1,. < │ │ │ +000b7c10: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000b7c20: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000b7c30: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000b7c40: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat points2, │ │ │ +000b7c60: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000b7ca0: 743c 2f61 3e26 6e62 7370 3b63 616d 6572 t camer │ │ │ +000b7cb0: 614d 6174 7269 782c 0a20 3c61 2068 7265 aMatrix,. Mat&nb │ │ │ +000b7d00: 7370 3b52 2c0a 203c 6120 6872 6566 3d22 sp;R,. Mat  │ │ │ +000b7d50: 742c 0a20 646f 7562 6c65 266e 6273 703b t,. double  │ │ │ +000b7d60: 6469 7374 616e 6365 5468 7265 7368 2c0a distanceThresh,. │ │ │ +000b7d70: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000b7db0: 3c2f 613e 266e 6273 703b 6d61 736b 293c  mask)< │ │ │ +000b7dc0: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 646c /span>
    .
    . │ │ │ +000b7de0: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ +000b7df0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e45 /dt>.
    E │ │ │ +000b7e00: 3c2f 636f 6465 3e20 2d20 5468 6520 696e - The in │ │ │ +000b7e10: 7075 7420 6573 7365 6e74 6961 6c20 6d61 put essential ma │ │ │ +000b7e20: 7472 6978 2e3c 2f64 643e 0a3c 6464 3e3c trix.
    .
    < │ │ │ +000b7e30: 636f 6465 3e70 6f69 6e74 7331 3c2f 636f code>points1 - Array of N │ │ │ +000b7e50: 2032 4420 706f 696e 7473 2066 726f 6d20 2D points from │ │ │ +000b7e60: 7468 6520 6669 7273 7420 696d 6167 652e the first image. │ │ │ +000b7e70: 2054 6865 2070 6f69 6e74 2063 6f6f 7264 The point coord │ │ │ +000b7e80: 696e 6174 6573 2073 686f 756c 6420 6265 inates should be │ │ │ +000b7e90: 0a66 6c6f 6174 696e 672d 706f 696e 7420 .floating-point │ │ │ +000b7ea0: 2873 696e 676c 6520 6f72 2064 6f75 626c (single or doubl │ │ │ +000b7eb0: 6520 7072 6563 6973 696f 6e29 2e3c 2f64 e precision)..
    poi │ │ │ +000b7ed0: 6e74 7332 3c2f 636f 6465 3e20 2d20 4172 nts2 - Ar │ │ │ +000b7ee0: 7261 7920 6f66 2074 6865 2073 6563 6f6e ray of the secon │ │ │ +000b7ef0: 6420 696d 6167 6520 706f 696e 7473 206f d image points o │ │ │ +000b7f00: 6620 7468 6520 7361 6d65 2073 697a 6520 f the same size │ │ │ +000b7f10: 616e 6420 666f 726d 6174 2061 7320 706f and format as po │ │ │ +000b7f20: 696e 7473 312e 3c2f 6464 3e0a 3c64 643e ints1.
    .
    │ │ │ +000b7f30: 3c63 6f64 653e 6361 6d65 7261 4d61 7472 cameraMatr │ │ │ +000b7f40: 6978 3c2f 636f 6465 3e20 2d20 4361 6d65 ix - Came │ │ │ +000b7f50: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ +000b7f60: 7269 7820 5c28 5c63 616d 6572 616d 6174 rix \(\cameramat │ │ │ +000b7f70: 7269 787b 417d 5c29 202e 0a4e 6f74 6520 rix{A}\) ..Note │ │ │ +000b7f80: 7468 6174 2074 6869 7320 6675 6e63 7469 that this functi │ │ │ +000b7f90: 6f6e 2061 7373 756d 6573 2074 6861 7420 on assumes that │ │ │ +000b7fa0: 706f 696e 7473 3120 616e 6420 706f 696e points1 and poin │ │ │ +000b7fb0: 7473 3220 6172 6520 6665 6174 7572 6520 ts2 are feature │ │ │ +000b7fc0: 706f 696e 7473 2066 726f 6d20 6361 6d65 points from came │ │ │ +000b7fd0: 7261 7320 7769 7468 2074 6865 0a73 616d ras with the.sam │ │ │ +000b7fe0: 6520 6361 6d65 7261 2069 6e74 7269 6e73 e camera intrins │ │ │ +000b7ff0: 6963 206d 6174 7269 782e 3c2f 6464 3e0a ic matrix.
    . │ │ │ +000b8000: 3c64 643e 3c63 6f64 653e 523c 2f63 6f64
    R - Output rota │ │ │ +000b8020: 7469 6f6e 206d 6174 7269 782e 2054 6f67 tion matrix. Tog │ │ │ +000b8030: 6574 6865 7220 7769 7468 2074 6865 2074 ether with the t │ │ │ +000b8040: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ +000b8050: 722c 2074 6869 7320 6d61 7472 6978 206d r, this matrix m │ │ │ +000b8060: 616b 6573 2075 7020 6120 7475 706c 650a akes up a tuple. │ │ │ +000b8070: 7468 6174 2070 6572 666f 726d 7320 6120 that performs a │ │ │ +000b8080: 6368 616e 6765 206f 6620 6261 7369 7320 change of basis │ │ │ +000b8090: 6672 6f6d 2074 6865 2066 6972 7374 2063 from the first c │ │ │ +000b80a0: 616d 6572 6127 7320 636f 6f72 6469 6e61 amera's coordina │ │ │ +000b80b0: 7465 2073 7973 7465 6d20 746f 2074 6865 te system to the │ │ │ +000b80c0: 2073 6563 6f6e 6420 6361 6d65 7261 2773 second camera's │ │ │ +000b80d0: 0a63 6f6f 7264 696e 6174 6520 7379 7374 .coordinate syst │ │ │ +000b80e0: 656d 2e20 4e6f 7465 2074 6861 742c 2069 em. Note that, i │ │ │ +000b80f0: 6e20 6765 6e65 7261 6c2c 2074 2063 616e n general, t can │ │ │ +000b8100: 206e 6f74 2062 6520 7573 6564 2066 6f72 not be used for │ │ │ +000b8110: 2074 6869 7320 7475 706c 652c 2073 6565 this tuple, see │ │ │ +000b8120: 2074 6865 2070 6172 616d 6574 6572 0a64 the parameter.d │ │ │ +000b8130: 6573 6372 6970 7469 6f6e 2062 656c 6f77 escription below │ │ │ +000b8140: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    t - Outp │ │ │ +000b8160: 7574 2074 7261 6e73 6c61 7469 6f6e 2076 ut translation v │ │ │ +000b8170: 6563 746f 722e 2054 6869 7320 7665 6374 ector. This vect │ │ │ +000b8180: 6f72 2069 7320 6f62 7461 696e 6564 2062 or is obtained b │ │ │ +000b8190: 7920 5245 463a 2064 6563 6f6d 706f 7365 y REF: decompose │ │ │ +000b81a0: 4573 7365 6e74 6961 6c4d 6174 2061 6e64 EssentialMat and │ │ │ +000b81b0: 0a74 6865 7265 666f 7265 2069 7320 6f6e .therefore is on │ │ │ +000b81c0: 6c79 206b 6e6f 776e 2075 7020 746f 2073 ly known up to s │ │ │ +000b81d0: 6361 6c65 2c20 692e 652e 2074 2069 7320 cale, i.e. t is │ │ │ +000b81e0: 7468 6520 6469 7265 6374 696f 6e20 6f66 the direction of │ │ │ +000b81f0: 2074 6865 2074 7261 6e73 6c61 7469 6f6e the translation │ │ │ +000b8200: 2076 6563 746f 7220 616e 6420 6861 7320 vector and has │ │ │ +000b8210: 756e 6974 0a6c 656e 6774 682e 3c2f 6464 unit.length.
    .
    dist │ │ │ +000b8230: 616e 6365 5468 7265 7368 3c2f 636f 6465 anceThresh - threshold di │ │ │ +000b8250: 7374 616e 6365 2077 6869 6368 2069 7320 stance which is │ │ │ +000b8260: 7573 6564 2074 6f20 6669 6c74 6572 206f used to filter o │ │ │ +000b8270: 7574 2066 6172 2061 7761 7920 706f 696e ut far away poin │ │ │ +000b8280: 7473 2028 692e 652e 2069 6e66 696e 6974 ts (i.e. infinit │ │ │ +000b8290: 650a 706f 696e 7473 292e 3c2f 6464 3e0a e.points).
    . │ │ │ +000b82a0: 3c64 643e 3c63 6f64 653e 6d61 736b 3c2f
    mask - Input/ou │ │ │ +000b82c0: 7470 7574 206d 6173 6b20 666f 7220 696e tput mask for in │ │ │ +000b82d0: 6c69 6572 7320 696e 2070 6f69 6e74 7331 liers in points1 │ │ │ +000b82e0: 2061 6e64 2070 6f69 6e74 7332 2e20 4966 and points2. If │ │ │ +000b82f0: 2069 7420 6973 206e 6f74 2065 6d70 7479 it is not empty │ │ │ +000b8300: 2c20 7468 656e 2069 7420 6d61 726b 730a , then it marks. │ │ │ +000b8310: 696e 6c69 6572 7320 696e 2070 6f69 6e74 inliers in point │ │ │ +000b8320: 7331 2061 6e64 2070 6f69 6e74 7332 2066 s1 and points2 f │ │ │ +000b8330: 6f72 2074 6865 2067 6976 656e 2065 7373 or the given ess │ │ │ +000b8340: 656e 7469 616c 206d 6174 7269 7820 452e ential matrix E. │ │ │ +000b8350: 204f 6e6c 7920 7468 6573 6520 696e 6c69 Only these inli │ │ │ +000b8360: 6572 7320 7769 6c6c 2062 6520 7573 6564 ers will be used │ │ │ +000b8370: 2074 6f0a 7265 636f 7665 7220 706f 7365 to.recover pose │ │ │ +000b8380: 2e20 496e 2074 6865 206f 7574 7075 7420 . In the output │ │ │ +000b8390: 6d61 736b 206f 6e6c 7920 696e 6c69 6572 mask only inlier │ │ │ +000b83a0: 7320 7768 6963 6820 7061 7373 2074 6865 s which pass the │ │ │ +000b83b0: 2063 6869 7261 6c69 7479 2063 6865 636b chirality check │ │ │ +000b83c0: 2e0a 0a54 6869 7320 6675 6e63 7469 6f6e ...This function │ │ │ +000b83d0: 2064 6966 6665 7273 2066 726f 6d20 7468 differs from th │ │ │ +000b83e0: 6520 6f6e 6520 6162 6f76 6520 7468 6174 e one above that │ │ │ +000b83f0: 2069 7420 6f75 7470 7574 7320 7468 6520 it outputs the │ │ │ +000b8400: 7472 6961 6e67 756c 6174 6564 2033 4420 triangulated 3D │ │ │ +000b8410: 706f 696e 7420 7468 6174 2061 7265 2075 point that are u │ │ │ +000b8420: 7365 6420 666f 720a 7468 6520 6368 6972 sed for.the chir │ │ │ +000b8430: 616c 6974 7920 6368 6563 6b2e 3c2f 6464 ality check.
    .
    Returns:.
    automati │ │ │ +000b8460: 6361 6c6c 7920 6765 6e65 7261 7465 643c cally generated< │ │ │ +000b8470: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .
    ..
  • .
    .

    recoverPos │ │ │ +000b8550: 653c 2f68 333e 0a3c 6469 7620 636c 6173 e

    .
    .
    pub │ │ │ +000b85b0: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static int  │ │ │ +000b85f0: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;reco │ │ │ +000b8610: 7665 7250 6f73 653c 2f73 7061 6e3e 3c77 verPose(Mat │ │ │ +000b8680: 266e 6273 703b 452c 0a20 3c61 2068 7265  E,. Mat&nb │ │ │ +000b86d0: 7370 3b70 6f69 6e74 7331 2c0a 203c 6120 sp;points1,. Mat │ │ │ +000b8720: 266e 6273 703b 706f 696e 7473 322c 0a20  points2,. │ │ │ +000b8730: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000b8770: 2f61 3e26 6e62 7370 3b63 616d 6572 614d /a> cameraM │ │ │ +000b8780: 6174 7269 782c 0a20 3c61 2068 7265 663d atrix,. Mat  │ │ │ +000b87d0: 3b52 2c0a 203c 6120 6872 6566 3d22 2e2e ;R,. Mat t, │ │ │ +000b8820: 0a20 646f 7562 6c65 266e 6273 703b 6469 . double di │ │ │ +000b8830: 7374 616e 6365 5468 7265 7368 293c 2f73 stanceThresh)
    .
    .Parameters:.
    E - The inpu │ │ │ +000b8890: 7420 6573 7365 6e74 6961 6c20 6d61 7472 t essential matr │ │ │ +000b88a0: 6978 2e3c 2f64 643e 0a3c 6464 3e3c 636f ix.
    .
    points1 - Array of N 2 │ │ │ +000b88d0: 4420 706f 696e 7473 2066 726f 6d20 7468 D points from th │ │ │ +000b88e0: 6520 6669 7273 7420 696d 6167 652e 2054 e first image. T │ │ │ +000b88f0: 6865 2070 6f69 6e74 2063 6f6f 7264 696e he point coordin │ │ │ +000b8900: 6174 6573 2073 686f 756c 6420 6265 0a66 ates should be.f │ │ │ +000b8910: 6c6f 6174 696e 672d 706f 696e 7420 2873 loating-point (s │ │ │ +000b8920: 696e 676c 6520 6f72 2064 6f75 626c 6520 ingle or double │ │ │ +000b8930: 7072 6563 6973 696f 6e29 2e3c 2f64 643e precision).
    │ │ │ +000b8940: 0a3c 6464 3e3c 636f 6465 3e70 6f69 6e74 .
    point │ │ │ +000b8950: 7332 3c2f 636f 6465 3e20 2d20 4172 7261 s2 - Arra │ │ │ +000b8960: 7920 6f66 2074 6865 2073 6563 6f6e 6420 y of the second │ │ │ +000b8970: 696d 6167 6520 706f 696e 7473 206f 6620 image points of │ │ │ +000b8980: 7468 6520 7361 6d65 2073 697a 6520 616e the same size an │ │ │ +000b8990: 6420 666f 726d 6174 2061 7320 706f 696e d format as poin │ │ │ +000b89a0: 7473 312e 3c2f 6464 3e0a 3c64 643e 3c63 ts1.
    .
    cameraMatrix │ │ │ +000b89c0: 3c2f 636f 6465 3e20 2d20 4361 6d65 7261 - Camera │ │ │ +000b89d0: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ +000b89e0: 7820 5c28 5c63 616d 6572 616d 6174 7269 x \(\cameramatri │ │ │ +000b89f0: 787b 417d 5c29 202e 0a4e 6f74 6520 7468 x{A}\) ..Note th │ │ │ +000b8a00: 6174 2074 6869 7320 6675 6e63 7469 6f6e at this function │ │ │ +000b8a10: 2061 7373 756d 6573 2074 6861 7420 706f assumes that po │ │ │ +000b8a20: 696e 7473 3120 616e 6420 706f 696e 7473 ints1 and points │ │ │ +000b8a30: 3220 6172 6520 6665 6174 7572 6520 706f 2 are feature po │ │ │ +000b8a40: 696e 7473 2066 726f 6d20 6361 6d65 7261 ints from camera │ │ │ +000b8a50: 7320 7769 7468 2074 6865 0a73 616d 6520 s with the.same │ │ │ +000b8a60: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ +000b8a70: 206d 6174 7269 782e 3c2f 6464 3e0a 3c64 matrix.
    .R │ │ │ +000b8a90: 202d 204f 7574 7075 7420 726f 7461 7469 - Output rotati │ │ │ +000b8aa0: 6f6e 206d 6174 7269 782e 2054 6f67 6574 on matrix. Toget │ │ │ +000b8ab0: 6865 7220 7769 7468 2074 6865 2074 7261 her with the tra │ │ │ +000b8ac0: 6e73 6c61 7469 6f6e 2076 6563 746f 722c nslation vector, │ │ │ +000b8ad0: 2074 6869 7320 6d61 7472 6978 206d 616b this matrix mak │ │ │ +000b8ae0: 6573 2075 7020 6120 7475 706c 650a 7468 es up a tuple.th │ │ │ +000b8af0: 6174 2070 6572 666f 726d 7320 6120 6368 at performs a ch │ │ │ +000b8b00: 616e 6765 206f 6620 6261 7369 7320 6672 ange of basis fr │ │ │ +000b8b10: 6f6d 2074 6865 2066 6972 7374 2063 616d om the first cam │ │ │ +000b8b20: 6572 6127 7320 636f 6f72 6469 6e61 7465 era's coordinate │ │ │ +000b8b30: 2073 7973 7465 6d20 746f 2074 6865 2073 system to the s │ │ │ +000b8b40: 6563 6f6e 6420 6361 6d65 7261 2773 0a63 econd camera's.c │ │ │ +000b8b50: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ +000b8b60: 2e20 4e6f 7465 2074 6861 742c 2069 6e20 . Note that, in │ │ │ +000b8b70: 6765 6e65 7261 6c2c 2074 2063 616e 206e general, t can n │ │ │ +000b8b80: 6f74 2062 6520 7573 6564 2066 6f72 2074 ot be used for t │ │ │ +000b8b90: 6869 7320 7475 706c 652c 2073 6565 2074 his tuple, see t │ │ │ +000b8ba0: 6865 2070 6172 616d 6574 6572 0a64 6573 he parameter.des │ │ │ +000b8bb0: 6372 6970 7469 6f6e 2062 656c 6f77 2e3c cription below.< │ │ │ +000b8bc0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ +000b8bd0: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +000b8be0: 2074 7261 6e73 6c61 7469 6f6e 2076 6563 translation vec │ │ │ +000b8bf0: 746f 722e 2054 6869 7320 7665 6374 6f72 tor. This vector │ │ │ +000b8c00: 2069 7320 6f62 7461 696e 6564 2062 7920 is obtained by │ │ │ +000b8c10: 5245 463a 2064 6563 6f6d 706f 7365 4573 REF: decomposeEs │ │ │ +000b8c20: 7365 6e74 6961 6c4d 6174 2061 6e64 0a74 sentialMat and.t │ │ │ +000b8c30: 6865 7265 666f 7265 2069 7320 6f6e 6c79 herefore is only │ │ │ +000b8c40: 206b 6e6f 776e 2075 7020 746f 2073 6361 known up to sca │ │ │ +000b8c50: 6c65 2c20 692e 652e 2074 2069 7320 7468 le, i.e. t is th │ │ │ +000b8c60: 6520 6469 7265 6374 696f 6e20 6f66 2074 e direction of t │ │ │ +000b8c70: 6865 2074 7261 6e73 6c61 7469 6f6e 2076 he translation v │ │ │ +000b8c80: 6563 746f 7220 616e 6420 6861 7320 756e ector and has un │ │ │ +000b8c90: 6974 0a6c 656e 6774 682e 3c2f 6464 3e0a it.length.
    . │ │ │ +000b8ca0: 3c64 643e 3c63 6f64 653e 6469 7374 616e
    distan │ │ │ +000b8cb0: 6365 5468 7265 7368 3c2f 636f 6465 3e20 ceThresh │ │ │ +000b8cc0: 2d20 7468 7265 7368 6f6c 6420 6469 7374 - threshold dist │ │ │ +000b8cd0: 616e 6365 2077 6869 6368 2069 7320 7573 ance which is us │ │ │ +000b8ce0: 6564 2074 6f20 6669 6c74 6572 206f 7574 ed to filter out │ │ │ +000b8cf0: 2066 6172 2061 7761 7920 706f 696e 7473 far away points │ │ │ +000b8d00: 2028 692e 652e 2069 6e66 696e 6974 650a (i.e. infinite. │ │ │ +000b8d10: 706f 696e 7473 292e 0a69 6e6c 6965 7273 points)..inliers │ │ │ +000b8d20: 2069 6e20 706f 696e 7473 3120 616e 6420 in points1 and │ │ │ +000b8d30: 706f 696e 7473 3220 666f 7220 7468 6520 points2 for the │ │ │ +000b8d40: 6769 7665 6e20 6573 7365 6e74 6961 6c20 given essential │ │ │ +000b8d50: 6d61 7472 6978 2045 2e20 4f6e 6c79 2074 matrix E. Only t │ │ │ +000b8d60: 6865 7365 2069 6e6c 6965 7273 2077 696c hese inliers wil │ │ │ +000b8d70: 6c20 6265 2075 7365 6420 746f 0a72 6563 l be used to.rec │ │ │ +000b8d80: 6f76 6572 2070 6f73 652e 2049 6e20 7468 over pose. In th │ │ │ +000b8d90: 6520 6f75 7470 7574 206d 6173 6b20 6f6e e output mask on │ │ │ +000b8da0: 6c79 2069 6e6c 6965 7273 2077 6869 6368 ly inliers which │ │ │ +000b8db0: 2070 6173 7320 7468 6520 6368 6972 616c pass the chiral │ │ │ +000b8dc0: 6974 7920 6368 6563 6b2e 0a0a 5468 6973 ity check...This │ │ │ +000b8dd0: 2066 756e 6374 696f 6e20 6469 6666 6572 function differ │ │ │ +000b8de0: 7320 6672 6f6d 2074 6865 206f 6e65 2061 s from the one a │ │ │ +000b8df0: 626f 7665 2074 6861 7420 6974 206f 7574 bove that it out │ │ │ +000b8e00: 7075 7473 2074 6865 2074 7269 616e 6775 puts the triangu │ │ │ +000b8e10: 6c61 7465 6420 3344 2070 6f69 6e74 2074 lated 3D point t │ │ │ +000b8e20: 6861 7420 6172 6520 7573 6564 2066 6f72 hat are used for │ │ │ +000b8e30: 0a74 6865 2063 6869 7261 6c69 7479 2063 .the chirality c │ │ │ +000b8e40: 6865 636b 2e3c 2f64 643e 0a3c 6474 3e52 heck.
    .
    R │ │ │ +000b8e50: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    automatically g │ │ │ +000b8e70: 656e 6572 6174 6564 3c2f 6464 3e0a 3c2f enerated
    ..
    ..
  • .
  • │ │ │ +000b8ea0: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    co │ │ │ +000b8f20: 6d70 7574 6543 6f72 7265 7370 6f6e 6445 mputeCorrespondE │ │ │ +000b8f30: 7069 6c69 6e65 733c 2f68 333e 0a3c 6469 pilines

    ..public static │ │ │ +000b8fa0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  void computeCorres │ │ │ +000b9000: 706f 6e64 4570 696c 696e 6573 3c2f 7370 pondEpilines(Ma │ │ │ +000b9070: 743c 2f61 3e26 6e62 7370 3b70 6f69 6e74 t point │ │ │ +000b9080: 732c 0a20 696e 7426 6e62 7370 3b77 6869 s,. int whi │ │ │ +000b9090: 6368 496d 6167 652c 0a20 3c61 2068 7265 chImage,. Mat&nb │ │ │ +000b90e0: 7370 3b46 2c0a 203c 6120 6872 6566 3d22 sp;F,. Mat  │ │ │ +000b9130: 6c69 6e65 7329 3c2f 7370 616e 3e3c 2f64 lines).
    For point │ │ │ +000b9160: 7320 696e 2061 6e20 696d 6167 6520 6f66 s in an image of │ │ │ +000b9170: 2061 2073 7465 7265 6f20 7061 6972 2c20 a stereo pair, │ │ │ +000b9180: 636f 6d70 7574 6573 2074 6865 2063 6f72 computes the cor │ │ │ +000b9190: 7265 7370 6f6e 6469 6e67 2065 7069 6c69 responding epili │ │ │ +000b91a0: 6e65 7320 696e 2074 6865 206f 7468 6572 nes in the other │ │ │ +000b91b0: 2069 6d61 6765 2e3c 2f64 6976 3e0a 3c64 image.
    . │ │ │ +000b91d0: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +000b91e0: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000b91f0: 706f 696e 7473 3c2f 636f 6465 3e20 2d20 points - │ │ │ +000b9200: 496e 7075 7420 706f 696e 7473 2e20 5c28 Input points. \( │ │ │ +000b9210: 4e20 5c74 696d 6573 2031 5c29 206f 7220 N \times 1\) or │ │ │ +000b9220: 5c28 3120 5c74 696d 6573 204e 5c29 206d \(1 \times N\) m │ │ │ +000b9230: 6174 7269 7820 6f66 2074 7970 6520 4356 atrix of type CV │ │ │ +000b9240: 5f33 3246 4332 206f 720a 7665 6374 6f72 _32FC2 or.vector │ │ │ +000b9250: 266c 743b 506f 696e 7432 6626 6774 3b20 <Point2f> │ │ │ +000b9260: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    whichImage - Index of th │ │ │ +000b9290: 6520 696d 6167 6520 2831 206f 7220 3229 e image (1 or 2) │ │ │ +000b92a0: 2074 6861 7420 636f 6e74 6169 6e73 2074 that contains t │ │ │ +000b92b0: 6865 2070 6f69 6e74 7320 2e3c 2f64 643e he points .
    │ │ │ +000b92c0: 0a3c 6464 3e3c 636f 6465 3e46 3c2f 636f .
    F - Fundamenta │ │ │ +000b92e0: 6c20 6d61 7472 6978 2074 6861 7420 6361 l matrix that ca │ │ │ +000b92f0: 6e20 6265 2065 7374 696d 6174 6564 2075 n be estimated u │ │ │ +000b9300: 7369 6e67 2023 6669 6e64 4675 6e64 616d sing #findFundam │ │ │ +000b9310: 656e 7461 6c4d 6174 206f 7220 2373 7465 entalMat or #ste │ │ │ +000b9320: 7265 6f52 6563 7469 6679 202e 3c2f 6464 reoRectify .
    .
    line │ │ │ +000b9340: 733c 2f63 6f64 653e 202d 204f 7574 7075 s - Outpu │ │ │ +000b9350: 7420 7665 6374 6f72 206f 6620 7468 6520 t vector of the │ │ │ +000b9360: 6570 6970 6f6c 6172 206c 696e 6573 2063 epipolar lines c │ │ │ +000b9370: 6f72 7265 7370 6f6e 6469 6e67 2074 6f20 orresponding to │ │ │ +000b9380: 7468 6520 706f 696e 7473 2069 6e20 7468 the points in th │ │ │ +000b9390: 6520 6f74 6865 7220 696d 6167 652e 0a45 e other image..E │ │ │ +000b93a0: 6163 6820 6c69 6e65 205c 2861 7820 2b20 ach line \(ax + │ │ │ +000b93b0: 6279 202b 2063 3d30 5c29 2069 7320 656e by + c=0\) is en │ │ │ +000b93c0: 636f 6465 6420 6279 2033 206e 756d 6265 coded by 3 numbe │ │ │ +000b93d0: 7273 205c 2828 612c 2062 2c20 6329 5c29 rs \((a, b, c)\) │ │ │ +000b93e0: 202e 0a0a 466f 7220 6576 6572 7920 706f ...For every po │ │ │ +000b93f0: 696e 7420 696e 206f 6e65 206f 6620 7468 int in one of th │ │ │ +000b9400: 6520 7477 6f20 696d 6167 6573 206f 6620 e two images of │ │ │ +000b9410: 6120 7374 6572 656f 2070 6169 722c 2074 a stereo pair, t │ │ │ +000b9420: 6865 2066 756e 6374 696f 6e20 6669 6e64 he function find │ │ │ +000b9430: 7320 7468 6520 6571 7561 7469 6f6e 206f s the equation o │ │ │ +000b9440: 6620 7468 650a 636f 7272 6573 706f 6e64 f the.correspond │ │ │ +000b9450: 696e 6720 6570 6970 6f6c 6172 206c 696e ing epipolar lin │ │ │ +000b9460: 6520 696e 2074 6865 206f 7468 6572 2069 e in the other i │ │ │ +000b9470: 6d61 6765 2e0a 0a46 726f 6d20 7468 6520 mage...From the │ │ │ +000b9480: 6675 6e64 616d 656e 7461 6c20 6d61 7472 fundamental matr │ │ │ +000b9490: 6978 2064 6566 696e 6974 696f 6e20 2873 ix definition (s │ │ │ +000b94a0: 6565 2023 6669 6e64 4675 6e64 616d 656e ee #findFundamen │ │ │ +000b94b0: 7461 6c4d 6174 2029 2c20 6c69 6e65 205c talMat ), line \ │ │ │ +000b94c0: 286c 5e7b 2832 297d 5f69 5c29 2069 6e20 (l^{(2)}_i\) in │ │ │ +000b94d0: 7468 6520 7365 636f 6e64 0a69 6d61 6765 the second.image │ │ │ +000b94e0: 2066 6f72 2074 6865 2070 6f69 6e74 205c for the point \ │ │ │ +000b94f0: 2870 5e7b 2831 297d 5f69 5c29 2069 6e20 (p^{(1)}_i\) in │ │ │ +000b9500: 7468 6520 6669 7273 7420 696d 6167 6520 the first image │ │ │ +000b9510: 2877 6865 6e20 7768 6963 6849 6d61 6765 (when whichImage │ │ │ +000b9520: 3d31 2029 2069 7320 636f 6d70 7574 6564 =1 ) is computed │ │ │ +000b9530: 2061 733a 0a0a 5c28 6c5e 7b28 3229 7d5f as:..\(l^{(2)}_ │ │ │ +000b9540: 6920 3d20 4620 705e 7b28 3129 7d5f 695c i = F p^{(1)}_i\ │ │ │ +000b9550: 290a 0a41 6e64 2076 6963 6520 7665 7273 )..And vice vers │ │ │ +000b9560: 612c 2077 6865 6e20 7768 6963 6849 6d61 a, when whichIma │ │ │ +000b9570: 6765 3d32 2c20 5c28 6c5e 7b28 3129 7d5f ge=2, \(l^{(1)}_ │ │ │ +000b9580: 695c 2920 6973 2063 6f6d 7075 7465 6420 i\) is computed │ │ │ +000b9590: 6672 6f6d 205c 2870 5e7b 2832 297d 5f69 from \(p^{(2)}_i │ │ │ +000b95a0: 5c29 2061 733a 0a0a 5c28 6c5e 7b28 3129 \) as:..\(l^{(1) │ │ │ +000b95b0: 7d5f 6920 3d20 465e 5420 705e 7b28 3229 }_i = F^T p^{(2) │ │ │ +000b95c0: 7d5f 695c 290a 0a4c 696e 6520 636f 6566 }_i\)..Line coef │ │ │ +000b95d0: 6669 6369 656e 7473 2061 7265 2064 6566 ficients are def │ │ │ +000b95e0: 696e 6564 2075 7020 746f 2061 2073 6361 ined up to a sca │ │ │ +000b95f0: 6c65 2e20 5468 6579 2061 7265 206e 6f72 le. They are nor │ │ │ +000b9600: 6d61 6c69 7a65 6420 736f 2074 6861 7420 malized so that │ │ │ +000b9610: 5c28 615f 695e 322b 625f 695e 323d 315c \(a_i^2+b_i^2=1\ │ │ │ +000b9620: 2920 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c ) .
    ..< │ │ │ +000b9630: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ +000b9640: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • . │ │ │ +000b96e0: 0a3c 6833 3e74 7269 616e 6775 6c61 7465 .

    triangulate │ │ │ +000b96f0: 506f 696e 7473 3c2f 6833 3e0a 3c64 6976 Points

    .
    .
    public static< │ │ │ +000b9760: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> void triangulatePoi │ │ │ +000b97c0: 6e74 733c 2f73 7061 6e3e 3c77 6272 3e3c nts< │ │ │ +000b97d0: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +000b97e0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ +000b9830: 703b 7072 6f6a 4d61 7472 312c 0a20 3c61 p;projMatr1,. Mat projMatr2 │ │ │ +000b9890: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000b98d0: 6174 3c2f 613e 266e 6273 703b 7072 6f6a at proj │ │ │ +000b98e0: 506f 696e 7473 312c 0a20 3c61 2068 7265 Points1,. Mat&nb │ │ │ +000b9930: 7370 3b70 726f 6a50 6f69 6e74 7332 2c0a sp;projPoints2,. │ │ │ +000b9940: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000b9980: 3c2f 613e 266e 6273 703b 706f 696e 7473  points │ │ │ +000b9990: 3444 293c 2f73 7061 6e3e 3c2f 6469 763e 4D)
    │ │ │ +000b99a0: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    This functio │ │ │ +000b99c0: 6e20 7265 636f 6e73 7472 7563 7473 2033 n reconstructs 3 │ │ │ +000b99d0: 2d64 696d 656e 7369 6f6e 616c 2070 6f69 -dimensional poi │ │ │ +000b99e0: 6e74 7320 2869 6e20 686f 6d6f 6765 6e65 nts (in homogene │ │ │ +000b99f0: 6f75 7320 636f 6f72 6469 6e61 7465 7329 ous coordinates) │ │ │ +000b9a00: 2062 7920 7573 696e 670a 7468 6569 7220 by using.their │ │ │ +000b9a10: 6f62 7365 7276 6174 696f 6e73 2077 6974 observations wit │ │ │ +000b9a20: 6820 6120 7374 6572 656f 2063 616d 6572 h a stereo camer │ │ │ +000b9a30: 612e 3c2f 6469 763e 0a3c 646c 2063 6c61 a.
    .
    .
    │ │ │ +000b9a50: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ +000b9a60: 0a3c 6464 3e3c 636f 6465 3e70 726f 6a4d .
    projM │ │ │ +000b9a70: 6174 7231 3c2f 636f 6465 3e20 2d20 3378 atr1 - 3x │ │ │ +000b9a80: 3420 7072 6f6a 6563 7469 6f6e 206d 6174 4 projection mat │ │ │ +000b9a90: 7269 7820 6f66 2074 6865 2066 6972 7374 rix of the first │ │ │ +000b9aa0: 2063 616d 6572 612c 2069 2e65 2e20 7468 camera, i.e. th │ │ │ +000b9ab0: 6973 206d 6174 7269 7820 7072 6f6a 6563 is matrix projec │ │ │ +000b9ac0: 7473 2033 4420 706f 696e 7473 0a67 6976 ts 3D points.giv │ │ │ +000b9ad0: 656e 2069 6e20 7468 6520 776f 726c 6427 en in the world' │ │ │ +000b9ae0: 7320 636f 6f72 6469 6e61 7465 2073 7973 s coordinate sys │ │ │ +000b9af0: 7465 6d20 696e 746f 2074 6865 2066 6972 tem into the fir │ │ │ +000b9b00: 7374 2069 6d61 6765 2e3c 2f64 643e 0a3c st image.
    .< │ │ │ +000b9b10: 6464 3e3c 636f 6465 3e70 726f 6a4d 6174 dd>projMat │ │ │ +000b9b20: 7232 3c2f 636f 6465 3e20 2d20 3378 3420 r2 - 3x4 │ │ │ +000b9b30: 7072 6f6a 6563 7469 6f6e 206d 6174 7269 projection matri │ │ │ +000b9b40: 7820 6f66 2074 6865 2073 6563 6f6e 6420 x of the second │ │ │ +000b9b50: 6361 6d65 7261 2c20 692e 652e 2074 6869 camera, i.e. thi │ │ │ +000b9b60: 7320 6d61 7472 6978 2070 726f 6a65 6374 s matrix project │ │ │ +000b9b70: 7320 3344 2070 6f69 6e74 730a 6769 7665 s 3D points.give │ │ │ +000b9b80: 6e20 696e 2074 6865 2077 6f72 6c64 2773 n in the world's │ │ │ +000b9b90: 2063 6f6f 7264 696e 6174 6520 7379 7374 coordinate syst │ │ │ +000b9ba0: 656d 2069 6e74 6f20 7468 6520 7365 636f em into the seco │ │ │ +000b9bb0: 6e64 2069 6d61 6765 2e3c 2f64 643e 0a3c nd image..< │ │ │ +000b9bc0: 6464 3e3c 636f 6465 3e70 726f 6a50 6f69 dd>projPoi │ │ │ +000b9bd0: 6e74 7331 3c2f 636f 6465 3e20 2d20 3278 nts1 - 2x │ │ │ +000b9be0: 4e20 6172 7261 7920 6f66 2066 6561 7475 N array of featu │ │ │ +000b9bf0: 7265 2070 6f69 6e74 7320 696e 2074 6865 re points in the │ │ │ +000b9c00: 2066 6972 7374 2069 6d61 6765 2e20 496e first image. In │ │ │ +000b9c10: 2074 6865 2063 6173 6520 6f66 2074 6865 the case of the │ │ │ +000b9c20: 2063 2b2b 2076 6572 7369 6f6e 2c0a 6974 c++ version,.it │ │ │ +000b9c30: 2063 616e 2062 6520 616c 736f 2061 2076 can be also a v │ │ │ +000b9c40: 6563 746f 7220 6f66 2066 6561 7475 7265 ector of feature │ │ │ +000b9c50: 2070 6f69 6e74 7320 6f72 2074 776f 2d63 points or two-c │ │ │ +000b9c60: 6861 6e6e 656c 206d 6174 7269 7820 6f66 hannel matrix of │ │ │ +000b9c70: 2073 697a 6520 3178 4e20 6f72 204e 7831 size 1xN or Nx1 │ │ │ +000b9c80: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 ..
    projPoints2 - 2xN array │ │ │ +000b9cb0: 6f66 2063 6f72 7265 7370 6f6e 6469 6e67 of corresponding │ │ │ +000b9cc0: 2070 6f69 6e74 7320 696e 2074 6865 2073 points in the s │ │ │ +000b9cd0: 6563 6f6e 6420 696d 6167 652e 2049 6e20 econd image. In │ │ │ +000b9ce0: 7468 6520 6361 7365 206f 6620 7468 6520 the case of the │ │ │ +000b9cf0: 632b 2b0a 7665 7273 696f 6e2c 2069 7420 c++.version, it │ │ │ +000b9d00: 6361 6e20 6265 2061 6c73 6f20 6120 7665 can be also a ve │ │ │ +000b9d10: 6374 6f72 206f 6620 6665 6174 7572 6520 ctor of feature │ │ │ +000b9d20: 706f 696e 7473 206f 7220 7477 6f2d 6368 points or two-ch │ │ │ +000b9d30: 616e 6e65 6c20 6d61 7472 6978 206f 6620 annel matrix of │ │ │ +000b9d40: 7369 7a65 2031 784e 206f 7220 4e78 312e size 1xN or Nx1. │ │ │ +000b9d50: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000b9d60: 706f 696e 7473 3444 3c2f 636f 6465 3e20 points4D │ │ │ +000b9d70: 2d20 3478 4e20 6172 7261 7920 6f66 2072 - 4xN array of r │ │ │ +000b9d80: 6563 6f6e 7374 7275 6374 6564 2070 6f69 econstructed poi │ │ │ +000b9d90: 6e74 7320 696e 2068 6f6d 6f67 656e 656f nts in homogeneo │ │ │ +000b9da0: 7573 2063 6f6f 7264 696e 6174 6573 2e20 us coordinates. │ │ │ +000b9db0: 5468 6573 6520 706f 696e 7473 2061 7265 These points are │ │ │ +000b9dc0: 0a72 6574 7572 6e65 6420 696e 2074 6865 .returned in the │ │ │ +000b9dd0: 2077 6f72 6c64 2773 2063 6f6f 7264 696e world's coordin │ │ │ +000b9de0: 6174 6520 7379 7374 656d 2e0a 0a3c 623e ate system... │ │ │ +000b9df0: 4e6f 7465 3a3c 2f62 3e0a 2020 204b 6565 Note:. Kee │ │ │ +000b9e00: 7020 696e 206d 696e 6420 7468 6174 2061 p in mind that a │ │ │ +000b9e10: 6c6c 2069 6e70 7574 2064 6174 6120 7368 ll input data sh │ │ │ +000b9e20: 6f75 6c64 2062 6520 6f66 2066 6c6f 6174 ould be of float │ │ │ +000b9e30: 2074 7970 6520 696e 206f 7264 6572 2066 type in order f │ │ │ +000b9e40: 6f72 2074 6869 7320 6675 6e63 7469 6f6e or this function │ │ │ +000b9e50: 2074 6f20 776f 726b 2e0a 0a3c 623e 4e6f to work...No │ │ │ +000b9e60: 7465 3a3c 2f62 3e0a 2020 2049 6620 7468 te:. If th │ │ │ +000b9e70: 6520 7072 6f6a 6563 7469 6f6e 206d 6174 e projection mat │ │ │ +000b9e80: 7269 6365 7320 6672 6f6d 2052 4546 3a20 rices from REF: │ │ │ +000b9e90: 7374 6572 656f 5265 6374 6966 7920 6172 stereoRectify ar │ │ │ +000b9ea0: 6520 7573 6564 2c20 7468 656e 2074 6865 e used, then the │ │ │ +000b9eb0: 2072 6574 7572 6e65 6420 706f 696e 7473 returned points │ │ │ +000b9ec0: 2061 7265 0a20 2020 7265 7072 6573 656e are. represen │ │ │ +000b9ed0: 7465 6420 696e 2074 6865 2066 6972 7374 ted in the first │ │ │ +000b9ee0: 2063 616d 6572 6127 7320 7265 6374 6966 camera's rectif │ │ │ +000b9ef0: 6965 6420 636f 6f72 6469 6e61 7465 2073 ied coordinate s │ │ │ +000b9f00: 7973 7465 6d2e 0a0a 5345 453a 0a20 2020 ystem...SEE:. │ │ │ +000b9f10: 7265 7072 6f6a 6563 7449 6d61 6765 546f reprojectImageTo │ │ │ +000b9f20: 3344 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 3D
    .
    ..
  • . │ │ │ +000b9f40: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374 .
  • ..

    correctMatches< │ │ │ +000b9ff0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +000ba050: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +000ba060: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;v │ │ │ +000ba080: 6f69 643c 2f73 7061 6e3e 266e 6273 703b oid  │ │ │ +000ba090: 3c73 7061 6e20 636c 6173 733d 2265 6c65 corre │ │ │ +000ba0b0: 6374 4d61 7463 6865 733c 2f73 7061 6e3e ctMatches │ │ │ +000ba0c0: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ +000ba0e0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000ba0f0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000ba100: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000ba110: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat F,. Mat& │ │ │ +000ba170: 6e62 7370 3b70 6f69 6e74 7331 2c0a 203c nbsp;points1,. < │ │ │ +000ba180: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000ba190: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000ba1a0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000ba1b0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat points2, │ │ │ +000ba1d0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000ba210: 743c 2f61 3e26 6e62 7370 3b6e 6577 506f t newPo │ │ │ +000ba220: 696e 7473 312c 0a20 3c61 2068 7265 663d ints1,. Mat  │ │ │ +000ba270: 3b6e 6577 506f 696e 7473 3229 3c2f 7370 ;newPoints2)
    .
    Ref │ │ │ +000ba2a0: 696e 6573 2063 6f6f 7264 696e 6174 6573 ines coordinates │ │ │ +000ba2b0: 206f 6620 636f 7272 6573 706f 6e64 696e of correspondin │ │ │ +000ba2c0: 6720 706f 696e 7473 2e3c 2f64 6976 3e0a g points.
    . │ │ │ +000ba2d0: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ +000ba2f0: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    F - 3x3 │ │ │ +000ba310: 2066 756e 6461 6d65 6e74 616c 206d 6174 fundamental mat │ │ │ +000ba320: 7269 782e 3c2f 6464 3e0a 3c64 643e 3c63 rix.
    .
    points1 - 1xN array c │ │ │ +000ba350: 6f6e 7461 696e 696e 6720 7468 6520 6669 ontaining the fi │ │ │ +000ba360: 7273 7420 7365 7420 6f66 2070 6f69 6e74 rst set of point │ │ │ +000ba370: 732e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 s.
    .
    points2 │ │ │ +000ba390: 202d 2031 784e 2061 7272 6179 2063 6f6e - 1xN array con │ │ │ +000ba3a0: 7461 696e 696e 6720 7468 6520 7365 636f taining the seco │ │ │ +000ba3b0: 6e64 2073 6574 206f 6620 706f 696e 7473 nd set of points │ │ │ +000ba3c0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    newPoints1 - The optimiz │ │ │ +000ba3f0: 6564 2070 6f69 6e74 7331 2e3c 2f64 643e ed points1.
    │ │ │ +000ba400: 0a3c 6464 3e3c 636f 6465 3e6e 6577 506f .
    newPo │ │ │ +000ba410: 696e 7473 323c 2f63 6f64 653e 202d 2054 ints2 - T │ │ │ +000ba420: 6865 206f 7074 696d 697a 6564 2070 6f69 he optimized poi │ │ │ +000ba430: 6e74 7332 2e0a 0a54 6865 2066 756e 6374 nts2...The funct │ │ │ +000ba440: 696f 6e20 696d 706c 656d 656e 7473 2074 ion implements t │ │ │ +000ba450: 6865 204f 7074 696d 616c 2054 7269 616e he Optimal Trian │ │ │ +000ba460: 6775 6c61 7469 6f6e 204d 6574 686f 6420 gulation Method │ │ │ +000ba470: 2873 6565 204d 756c 7469 706c 6520 5669 (see Multiple Vi │ │ │ +000ba480: 6577 2047 656f 6d65 7472 7920 4349 5445 ew Geometry CITE │ │ │ +000ba490: 3a20 4861 7274 6c65 795a 3030 2066 6f72 : HartleyZ00 for │ │ │ +000ba4a0: 2064 6574 6169 6c73 292e 0a46 6f72 2065 details)..For e │ │ │ +000ba4b0: 6163 6820 6769 7665 6e20 706f 696e 7420 ach given point │ │ │ +000ba4c0: 636f 7272 6573 706f 6e64 656e 6365 2070 correspondence p │ │ │ +000ba4d0: 6f69 6e74 7331 5b69 5d20 266c 743b 2d26 oints1[i] <-& │ │ │ +000ba4e0: 6774 3b20 706f 696e 7473 325b 695d 2c20 gt; points2[i], │ │ │ +000ba4f0: 616e 6420 6120 6675 6e64 616d 656e 7461 and a fundamenta │ │ │ +000ba500: 6c20 6d61 7472 6978 2046 2c20 6974 0a63 l matrix F, it.c │ │ │ +000ba510: 6f6d 7075 7465 7320 7468 6520 636f 7272 omputes the corr │ │ │ +000ba520: 6563 7465 6420 636f 7272 6573 706f 6e64 ected correspond │ │ │ +000ba530: 656e 6365 7320 6e65 7750 6f69 6e74 7331 ences newPoints1 │ │ │ +000ba540: 5b69 5d20 266c 743b 2d26 6774 3b20 6e65 [i] <-> ne │ │ │ +000ba550: 7750 6f69 6e74 7332 5b69 5d20 7468 6174 wPoints2[i] that │ │ │ +000ba560: 206d 696e 696d 697a 6520 7468 6520 6765 minimize the ge │ │ │ +000ba570: 6f6d 6574 7269 630a 6572 726f 7220 5c28 ometric.error \( │ │ │ +000ba580: 6428 706f 696e 7473 315b 695d 2c20 6e65 d(points1[i], ne │ │ │ +000ba590: 7750 6f69 6e74 7331 5b69 5d29 5e32 202b wPoints1[i])^2 + │ │ │ +000ba5a0: 2064 2870 6f69 6e74 7332 5b69 5d2c 6e65 d(points2[i],ne │ │ │ +000ba5b0: 7750 6f69 6e74 7332 5b69 5d29 5e32 5c29 wPoints2[i])^2\) │ │ │ +000ba5c0: 2028 7768 6572 6520 5c28 6428 612c 6229 (where \(d(a,b) │ │ │ +000ba5d0: 5c29 2069 7320 7468 650a 6765 6f6d 6574 \) is the.geomet │ │ │ +000ba5e0: 7269 6320 6469 7374 616e 6365 2062 6574 ric distance bet │ │ │ +000ba5f0: 7765 656e 2070 6f69 6e74 7320 5c28 615c ween points \(a\ │ │ │ +000ba600: 2920 616e 6420 5c28 625c 2920 2920 7375 ) and \(b\) ) su │ │ │ +000ba610: 626a 6563 7420 746f 2074 6865 2065 7069 bject to the epi │ │ │ +000ba620: 706f 6c61 7220 636f 6e73 7472 6169 6e74 polar constraint │ │ │ +000ba630: 0a5c 286e 6577 506f 696e 7473 325e 5420 .\(newPoints2^T │ │ │ +000ba640: 5c63 646f 7420 4620 5c63 646f 7420 6e65 \cdot F \cdot ne │ │ │ +000ba650: 7750 6f69 6e74 7331 203d 2030 5c29 202e wPoints1 = 0\) . │ │ │ +000ba660: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ....
  • ..

    sampsonD │ │ │ +000ba700: 6973 7461 6e63 653c 2f68 333e 0a3c 6469 istance

    ..public static │ │ │ +000ba770: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  double
     sampsonDist │ │ │ +000ba7d0: 616e 6365 3c2f 7370 616e 3e3c 7762 723e ance │ │ │ +000ba7e0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +000ba840: 7370 3b70 7431 2c0a 203c 6120 6872 6566 sp;pt1,. Mat&nbs │ │ │ +000ba890: 703b 7074 322c 0a20 3c61 2068 7265 663d p;pt2,. Mat  │ │ │ +000ba8e0: 3b46 293c 2f73 7061 6e3e 3c2f 6469 763e ;F)
  • │ │ │ +000ba8f0: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Calculates t │ │ │ +000ba910: 6865 2053 616d 7073 6f6e 2044 6973 7461 he Sampson Dista │ │ │ +000ba920: 6e63 6520 6265 7477 6565 6e20 7477 6f20 nce between two │ │ │ +000ba930: 706f 696e 7473 2e0a 0a54 6865 2066 756e points...The fun │ │ │ +000ba940: 6374 696f 6e20 6376 3a3a 7361 6d70 736f ction cv::sampso │ │ │ +000ba950: 6e44 6973 7461 6e63 6520 6361 6c63 756c nDistance calcul │ │ │ +000ba960: 6174 6573 2061 6e64 2072 6574 7572 6e73 ates and returns │ │ │ +000ba970: 2074 6865 2066 6972 7374 206f 7264 6572 the first order │ │ │ +000ba980: 2061 7070 726f 7869 6d61 7469 6f6e 206f approximation o │ │ │ +000ba990: 6620 7468 6520 6765 6f6d 6574 7269 6320 f the geometric │ │ │ +000ba9a0: 6572 726f 7220 6173 3a0a 5c28 0a73 6428 error as:.\(.sd( │ │ │ +000ba9b0: 205c 7465 7874 7474 7b70 7431 7d20 2c20 \texttt{pt1} , │ │ │ +000ba9c0: 5c74 6578 7474 747b 7074 327d 2029 3d0a \texttt{pt2} )=. │ │ │ +000ba9d0: 5c66 7261 637b 285c 7465 7874 7474 7b70 \frac{(\texttt{p │ │ │ +000ba9e0: 7432 7d5e 7420 5c63 646f 7420 5c74 6578 t2}^t \cdot \tex │ │ │ +000ba9f0: 7474 747b 467d 205c 6364 6f74 205c 7465 ttt{F} \cdot \te │ │ │ +000baa00: 7874 7474 7b70 7431 7d29 5e32 7d0a 7b28 xttt{pt1})^2}.{( │ │ │ +000baa10: 285c 7465 7874 7474 7b46 7d20 5c63 646f (\texttt{F} \cdo │ │ │ +000baa20: 7420 5c74 6578 7474 747b 7074 317d 2928 t \texttt{pt1})( │ │ │ +000baa30: 3029 295e 3220 2b0a 2828 5c74 6578 7474 0))^2 +.((\textt │ │ │ +000baa40: 747b 467d 205c 6364 6f74 205c 7465 7874 t{F} \cdot \text │ │ │ +000baa50: 7474 7b70 7431 7d29 2831 2929 5e32 202b tt{pt1})(1))^2 + │ │ │ +000baa60: 0a28 285c 7465 7874 7474 7b46 7d5e 7420 .((\texttt{F}^t │ │ │ +000baa70: 5c63 646f 7420 5c74 6578 7474 747b 7074 \cdot \texttt{pt │ │ │ +000baa80: 327d 2928 3029 295e 3220 2b0a 2828 5c74 2})(0))^2 +.((\t │ │ │ +000baa90: 6578 7474 747b 467d 5e74 205c 6364 6f74 exttt{F}^t \cdot │ │ │ +000baaa0: 205c 7465 7874 7474 7b70 7432 7d29 2831 \texttt{pt2})(1 │ │ │ +000baab0: 2929 5e32 7d0a 5c29 0a54 6865 2066 756e ))^2}.\).The fun │ │ │ +000baac0: 6461 6d65 6e74 616c 206d 6174 7269 7820 damental matrix │ │ │ +000baad0: 6d61 7920 6265 2063 616c 6375 6c61 7465 may be calculate │ │ │ +000baae0: 6420 7573 696e 6720 7468 6520 2366 696e d using the #fin │ │ │ +000baaf0: 6446 756e 6461 6d65 6e74 616c 4d61 7420 dFundamentalMat │ │ │ +000bab00: 6675 6e63 7469 6f6e 2e20 5365 6520 4349 function. See CI │ │ │ +000bab10: 5445 3a20 4861 7274 6c65 795a 3030 2031 TE: HartleyZ00 1 │ │ │ +000bab20: 312e 342e 3320 666f 7220 6465 7461 696c 1.4.3 for detail │ │ │ +000bab30: 732e 3c2f 6469 763e 0a3c 646c 2063 6c61 s.
    .
    .
    │ │ │ +000bab50: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ +000bab60: 0a3c 6464 3e3c 636f 6465 3e70 7431 3c2f .
    pt1 - first ho │ │ │ +000bab80: 6d6f 6765 6e65 6f75 7320 3264 2070 6f69 mogeneous 2d poi │ │ │ +000bab90: 6e74 3c2f 6464 3e0a 3c64 643e 3c63 6f64 nt
    .
    pt2 - s │ │ │ +000babb0: 6563 6f6e 6420 686f 6d6f 6765 6e65 6f75 econd homogeneou │ │ │ +000babc0: 7320 3264 2070 6f69 6e74 3c2f 6464 3e0a s 2d point
    . │ │ │ +000babd0: 3c64 643e 3c63 6f64 653e 463c 2f63 6f64
    F - fundamental │ │ │ +000babf0: 206d 6174 7269 783c 2f64 643e 0a3c 6474 matrix
    .
    Returns:
    .< │ │ │ +000bac10: 6464 3e54 6865 2063 6f6d 7075 7465 6420 dd>The computed │ │ │ +000bac20: 5361 6d70 736f 6e20 6469 7374 616e 6365 Sampson distance │ │ │ +000bac30: 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 ..
    ...< │ │ │ +000bac50: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    esti │ │ │ +000bacf0: 6d61 7465 4166 6669 6e65 3344 3c2f 6833 mateAffine3D

    .
    .
    │ │ │ +000bad40: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +000bad60: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +000bad70: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;bool │ │ │ +000bad90: 6561 6e3c 2f73 7061 6e3e 266e 6273 703b ean  │ │ │ +000bada0: 3c73 7061 6e20 636c 6173 733d 2265 6c65 estim │ │ │ +000badc0: 6174 6541 6666 696e 6533 443c 2f73 7061 ateAffine3D │ │ │ +000badf0: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ +000bae30: 3c2f 613e 266e 6273 703b 7372 632c 0a20  src,. │ │ │ +000bae40: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000bae80: 2f61 3e26 6e62 7370 3b64 7374 2c0a 203c /a> dst,. < │ │ │ +000bae90: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000baea0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000baeb0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000baec0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat out,. Mat inliers,. │ │ │ +000baf30: 2064 6f75 626c 6526 6e62 7370 3b72 616e double ran │ │ │ +000baf40: 7361 6354 6872 6573 686f 6c64 2c0a 2064 sacThreshold,. d │ │ │ +000baf50: 6f75 626c 6526 6e62 7370 3b63 6f6e 6669 ouble confi │ │ │ +000baf60: 6465 6e63 6529 3c2f 7370 616e 3e3c 2f64 dence).
    Computes │ │ │ +000baf90: 616e 206f 7074 696d 616c 2061 6666 696e an optimal affin │ │ │ +000bafa0: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ +000bafb0: 2062 6574 7765 656e 2074 776f 2033 4420 between two 3D │ │ │ +000bafc0: 706f 696e 7420 7365 7473 2e0a 0a49 7420 point sets...It │ │ │ +000bafd0: 636f 6d70 7574 6573 0a5c 280a 5c62 6567 computes.\(.\beg │ │ │ +000bafe0: 696e 7b62 6d61 7472 6978 7d0a 785c 5c0a in{bmatrix}.x\\. │ │ │ +000baff0: 795c 5c0a 7a5c 5c0a 5c65 6e64 7b62 6d61 y\\.z\\.\end{bma │ │ │ +000bb000: 7472 6978 7d0a 3d0a 5c62 6567 696e 7b62 trix}.=.\begin{b │ │ │ +000bb010: 6d61 7472 6978 7d0a 615f 7b31 317d 2026 matrix}.a_{11} & │ │ │ +000bb020: 616d 703b 2061 5f7b 3132 7d20 2661 6d70 amp; a_{12} & │ │ │ +000bb030: 3b20 615f 7b31 337d 5c5c 0a61 5f7b 3231 ; a_{13}\\.a_{21 │ │ │ +000bb040: 7d20 2661 6d70 3b20 615f 7b32 327d 2026 } & a_{22} & │ │ │ +000bb050: 616d 703b 2061 5f7b 3233 7d5c 5c0a 615f amp; a_{23}\\.a_ │ │ │ +000bb060: 7b33 317d 2026 616d 703b 2061 5f7b 3332 {31} & a_{32 │ │ │ +000bb070: 7d20 2661 6d70 3b20 615f 7b33 337d 5c5c } & a_{33}\\ │ │ │ +000bb080: 0a5c 656e 647b 626d 6174 7269 787d 0a5c .\end{bmatrix}.\ │ │ │ +000bb090: 6265 6769 6e7b 626d 6174 7269 787d 0a58 begin{bmatrix}.X │ │ │ +000bb0a0: 5c5c 0a59 5c5c 0a5a 5c5c 0a5c 656e 647b \\.Y\\.Z\\.\end{ │ │ │ +000bb0b0: 626d 6174 7269 787d 0a2b 0a5c 6265 6769 bmatrix}.+.\begi │ │ │ +000bb0c0: 6e7b 626d 6174 7269 787d 0a62 5f31 5c5c n{bmatrix}.b_1\\ │ │ │ +000bb0d0: 0a62 5f32 5c5c 0a62 5f33 5c5c 0a5c 656e .b_2\\.b_3\\.\en │ │ │ +000bb0e0: 647b 626d 6174 7269 787d 0a5c 293c 2f64 d{bmatrix}.\).
    .
    Param │ │ │ +000bb110: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ +000bb120: 3c63 6f64 653e 7372 633c 2f63 6f64 653e src │ │ │ +000bb130: 202d 2046 6972 7374 2069 6e70 7574 2033 - First input 3 │ │ │ +000bb140: 4420 706f 696e 7420 7365 7420 636f 6e74 D point set cont │ │ │ +000bb150: 6169 6e69 6e67 205c 2828 582c 592c 5a29 aining \((X,Y,Z) │ │ │ +000bb160: 5c29 2e3c 2f64 643e 0a3c 6464 3e3c 636f \).
    .
    dst - │ │ │ +000bb180: 5365 636f 6e64 2069 6e70 7574 2033 4420 Second input 3D │ │ │ +000bb190: 706f 696e 7420 7365 7420 636f 6e74 6169 point set contai │ │ │ +000bb1a0: 6e69 6e67 205c 2828 782c 792c 7a29 5c29 ning \((x,y,z)\) │ │ │ +000bb1b0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    out - Ou │ │ │ +000bb1d0: 7470 7574 2033 4420 6166 6669 6e65 2074 tput 3D affine t │ │ │ +000bb1e0: 7261 6e73 666f 726d 6174 696f 6e20 6d61 ransformation ma │ │ │ +000bb1f0: 7472 6978 205c 2833 205c 7469 6d65 7320 trix \(3 \times │ │ │ +000bb200: 345c 2920 6f66 2074 6865 2066 6f72 6d0a 4\) of the form. │ │ │ +000bb210: 5c28 0a5c 6265 6769 6e7b 626d 6174 7269 \(.\begin{bmatri │ │ │ +000bb220: 787d 0a61 5f7b 3131 7d20 2661 6d70 3b20 x}.a_{11} & │ │ │ +000bb230: 615f 7b31 327d 2026 616d 703b 2061 5f7b a_{12} & a_{ │ │ │ +000bb240: 3133 7d20 2661 6d70 3b20 625f 315c 5c0a 13} & b_1\\. │ │ │ +000bb250: 615f 7b32 317d 2026 616d 703b 2061 5f7b a_{21} & a_{ │ │ │ +000bb260: 3232 7d20 2661 6d70 3b20 615f 7b32 337d 22} & a_{23} │ │ │ +000bb270: 2026 616d 703b 2062 5f32 5c5c 0a61 5f7b & b_2\\.a_{ │ │ │ +000bb280: 3331 7d20 2661 6d70 3b20 615f 7b33 327d 31} & a_{32} │ │ │ +000bb290: 2026 616d 703b 2061 5f7b 3333 7d20 2661 & a_{33} &a │ │ │ +000bb2a0: 6d70 3b20 625f 335c 5c0a 5c65 6e64 7b62 mp; b_3\\.\end{b │ │ │ +000bb2b0: 6d61 7472 6978 7d0a 5c29 3c2f 6464 3e0a matrix}.\)
    . │ │ │ +000bb2c0: 3c64 643e 3c63 6f64 653e 696e 6c69 6572
    inlier │ │ │ +000bb2d0: 733c 2f63 6f64 653e 202d 204f 7574 7075 s - Outpu │ │ │ +000bb2e0: 7420 7665 6374 6f72 2069 6e64 6963 6174 t vector indicat │ │ │ +000bb2f0: 696e 6720 7768 6963 6820 706f 696e 7473 ing which points │ │ │ +000bb300: 2061 7265 2069 6e6c 6965 7273 2028 312d are inliers (1- │ │ │ +000bb310: 696e 6c69 6572 2c20 302d 6f75 746c 6965 inlier, 0-outlie │ │ │ +000bb320: 7229 2e3c 2f64 643e 0a3c 6464 3e3c 636f r).
    .
    ransacThresho │ │ │ +000bb340: 6c64 3c2f 636f 6465 3e20 2d20 4d61 7869 ld - Maxi │ │ │ +000bb350: 6d75 6d20 7265 7072 6f6a 6563 7469 6f6e mum reprojection │ │ │ +000bb360: 2065 7272 6f72 2069 6e20 7468 6520 5241 error in the RA │ │ │ +000bb370: 4e53 4143 2061 6c67 6f72 6974 686d 2074 NSAC algorithm t │ │ │ +000bb380: 6f20 636f 6e73 6964 6572 2061 2070 6f69 o consider a poi │ │ │ +000bb390: 6e74 2061 730a 616e 2069 6e6c 6965 722e nt as.an inlier. │ │ │ +000bb3a0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000bb3b0: 636f 6e66 6964 656e 6365 3c2f 636f 6465 confidence - Confidence l │ │ │ +000bb3d0: 6576 656c 2c20 6265 7477 6565 6e20 3020 evel, between 0 │ │ │ +000bb3e0: 616e 6420 312c 2066 6f72 2074 6865 2065 and 1, for the e │ │ │ +000bb3f0: 7374 696d 6174 6564 2074 7261 6e73 666f stimated transfo │ │ │ +000bb400: 726d 6174 696f 6e2e 2041 6e79 7468 696e rmation. Anythin │ │ │ +000bb410: 670a 6265 7477 6565 6e20 302e 3935 2061 g.between 0.95 a │ │ │ +000bb420: 6e64 2030 2e39 3920 6973 2075 7375 616c nd 0.99 is usual │ │ │ +000bb430: 6c79 2067 6f6f 6420 656e 6f75 6768 2e20 ly good enough. │ │ │ +000bb440: 5661 6c75 6573 2074 6f6f 2063 6c6f 7365 Values too close │ │ │ +000bb450: 2074 6f20 3120 6361 6e20 736c 6f77 2064 to 1 can slow d │ │ │ +000bb460: 6f77 6e20 7468 6520 6573 7469 6d61 7469 own the estimati │ │ │ +000bb470: 6f6e 0a73 6967 6e69 6669 6361 6e74 6c79 on.significantly │ │ │ +000bb480: 2e20 5661 6c75 6573 206c 6f77 6572 2074 . Values lower t │ │ │ +000bb490: 6861 6e20 302e 382d 302e 3920 6361 6e20 han 0.8-0.9 can │ │ │ +000bb4a0: 7265 7375 6c74 2069 6e20 616e 2069 6e63 result in an inc │ │ │ +000bb4b0: 6f72 7265 6374 6c79 2065 7374 696d 6174 orrectly estimat │ │ │ +000bb4c0: 6564 2074 7261 6e73 666f 726d 6174 696f ed transformatio │ │ │ +000bb4d0: 6e2e 3c2f 6464 3e0a 3c64 743e 5265 7475 n.
    .
    Retu │ │ │ +000bb4e0: 726e 733a 3c2f 6474 3e0a 3c64 643e 5768 rns:
    .
    Wh │ │ │ +000bb4f0: 6574 6865 7220 6120 736f 6c75 7469 6f6e ether a solution │ │ │ +000bb500: 2077 6173 2066 6f75 6e64 2e0a 0a54 6865 was found...The │ │ │ +000bb510: 2066 756e 6374 696f 6e20 6573 7469 6d61 function estima │ │ │ +000bb520: 7465 7320 616e 206f 7074 696d 616c 2033 tes an optimal 3 │ │ │ +000bb530: 4420 6166 6669 6e65 2074 7261 6e73 666f D affine transfo │ │ │ +000bb540: 726d 6174 696f 6e20 6265 7477 6565 6e20 rmation between │ │ │ +000bb550: 7477 6f20 3344 2070 6f69 6e74 2073 6574 two 3D point set │ │ │ +000bb560: 7320 7573 696e 6720 7468 650a 5241 4e53 s using the.RANS │ │ │ +000bb570: 4143 2061 6c67 6f72 6974 686d 2e3c 2f64 AC algorithm..
    .
    . │ │ │ +000bb590: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e .
  • │ │ │ +000bb5a0: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    estimateAffine3 │ │ │ +000bb640: 443c 2f68 333e 0a3c 6469 7620 636c 6173 D

    .
    .
    pub │ │ │ +000bb6a0: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static boolean& │ │ │ +000bb6e0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ +000bb700: 6573 7469 6d61 7465 4166 6669 6e65 3344 estimateAffine3D │ │ │ +000bb710: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat s │ │ │ +000bb780: 7263 2c0a 203c 6120 6872 6566 3d22 2e2e rc,. Mat ds │ │ │ +000bb7d0: 742c 0a20 3c61 2068 7265 663d 222e 2e2f t,. │ │ │ +000bb810: 4d61 743c 2f61 3e26 6e62 7370 3b6f 7574 Mat out │ │ │ +000bb820: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000bb860: 6174 3c2f 613e 266e 6273 703b 696e 6c69 at inli │ │ │ +000bb870: 6572 732c 0a20 646f 7562 6c65 266e 6273 ers,. double&nbs │ │ │ +000bb880: 703b 7261 6e73 6163 5468 7265 7368 6f6c p;ransacThreshol │ │ │ +000bb890: 6429 3c2f 7370 616e 3e3c 2f64 6976 3e0a d)
    . │ │ │ +000bb8a0: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Computes an o │ │ │ +000bb8c0: 7074 696d 616c 2061 6666 696e 6520 7472 ptimal affine tr │ │ │ +000bb8d0: 616e 7366 6f72 6d61 7469 6f6e 2062 6574 ansformation bet │ │ │ +000bb8e0: 7765 656e 2074 776f 2033 4420 706f 696e ween two 3D poin │ │ │ +000bb8f0: 7420 7365 7473 2e0a 0a49 7420 636f 6d70 t sets...It comp │ │ │ +000bb900: 7574 6573 0a5c 280a 5c62 6567 696e 7b62 utes.\(.\begin{b │ │ │ +000bb910: 6d61 7472 6978 7d0a 785c 5c0a 795c 5c0a matrix}.x\\.y\\. │ │ │ +000bb920: 7a5c 5c0a 5c65 6e64 7b62 6d61 7472 6978 z\\.\end{bmatrix │ │ │ +000bb930: 7d0a 3d0a 5c62 6567 696e 7b62 6d61 7472 }.=.\begin{bmatr │ │ │ +000bb940: 6978 7d0a 615f 7b31 317d 2026 616d 703b ix}.a_{11} & │ │ │ +000bb950: 2061 5f7b 3132 7d20 2661 6d70 3b20 615f a_{12} & a_ │ │ │ +000bb960: 7b31 337d 5c5c 0a61 5f7b 3231 7d20 2661 {13}\\.a_{21} &a │ │ │ +000bb970: 6d70 3b20 615f 7b32 327d 2026 616d 703b mp; a_{22} & │ │ │ +000bb980: 2061 5f7b 3233 7d5c 5c0a 615f 7b33 317d a_{23}\\.a_{31} │ │ │ +000bb990: 2026 616d 703b 2061 5f7b 3332 7d20 2661 & a_{32} &a │ │ │ +000bb9a0: 6d70 3b20 615f 7b33 337d 5c5c 0a5c 656e mp; a_{33}\\.\en │ │ │ +000bb9b0: 647b 626d 6174 7269 787d 0a5c 6265 6769 d{bmatrix}.\begi │ │ │ +000bb9c0: 6e7b 626d 6174 7269 787d 0a58 5c5c 0a59 n{bmatrix}.X\\.Y │ │ │ +000bb9d0: 5c5c 0a5a 5c5c 0a5c 656e 647b 626d 6174 \\.Z\\.\end{bmat │ │ │ +000bb9e0: 7269 787d 0a2b 0a5c 6265 6769 6e7b 626d rix}.+.\begin{bm │ │ │ +000bb9f0: 6174 7269 787d 0a62 5f31 5c5c 0a62 5f32 atrix}.b_1\\.b_2 │ │ │ +000bba00: 5c5c 0a62 5f33 5c5c 0a5c 656e 647b 626d \\.b_3\\.\end{bm │ │ │ +000bba10: 6174 7269 787d 0a5c 293c 2f64 6976 3e0a atrix}.\)
    . │ │ │ +000bba20: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ +000bba40: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    src - F │ │ │ +000bba60: 6972 7374 2069 6e70 7574 2033 4420 706f irst input 3D po │ │ │ +000bba70: 696e 7420 7365 7420 636f 6e74 6169 6e69 int set containi │ │ │ +000bba80: 6e67 205c 2828 582c 592c 5a29 5c29 2e3c ng \((X,Y,Z)\).< │ │ │ +000bba90: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ +000bbaa0: 7374 3c2f 636f 6465 3e20 2d20 5365 636f st - Seco │ │ │ +000bbab0: 6e64 2069 6e70 7574 2033 4420 706f 696e nd input 3D poin │ │ │ +000bbac0: 7420 7365 7420 636f 6e74 6169 6e69 6e67 t set containing │ │ │ +000bbad0: 205c 2828 782c 792c 7a29 5c29 2e3c 2f64 \((x,y,z)\)..
    out │ │ │ +000bbaf0: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +000bbb00: 2033 4420 6166 6669 6e65 2074 7261 6e73 3D affine trans │ │ │ +000bbb10: 666f 726d 6174 696f 6e20 6d61 7472 6978 formation matrix │ │ │ +000bbb20: 205c 2833 205c 7469 6d65 7320 345c 2920 \(3 \times 4\) │ │ │ +000bbb30: 6f66 2074 6865 2066 6f72 6d0a 5c28 0a5c of the form.\(.\ │ │ │ +000bbb40: 6265 6769 6e7b 626d 6174 7269 787d 0a61 begin{bmatrix}.a │ │ │ +000bbb50: 5f7b 3131 7d20 2661 6d70 3b20 615f 7b31 _{11} & a_{1 │ │ │ +000bbb60: 327d 2026 616d 703b 2061 5f7b 3133 7d20 2} & a_{13} │ │ │ +000bbb70: 2661 6d70 3b20 625f 315c 5c0a 615f 7b32 & b_1\\.a_{2 │ │ │ +000bbb80: 317d 2026 616d 703b 2061 5f7b 3232 7d20 1} & a_{22} │ │ │ +000bbb90: 2661 6d70 3b20 615f 7b32 337d 2026 616d & a_{23} &am │ │ │ +000bbba0: 703b 2062 5f32 5c5c 0a61 5f7b 3331 7d20 p; b_2\\.a_{31} │ │ │ +000bbbb0: 2661 6d70 3b20 615f 7b33 327d 2026 616d & a_{32} &am │ │ │ +000bbbc0: 703b 2061 5f7b 3333 7d20 2661 6d70 3b20 p; a_{33} & │ │ │ +000bbbd0: 625f 335c 5c0a 5c65 6e64 7b62 6d61 7472 b_3\\.\end{bmatr │ │ │ +000bbbe0: 6978 7d0a 5c29 3c2f 6464 3e0a 3c64 643e ix}.\)
    .
    │ │ │ +000bbbf0: 3c63 6f64 653e 696e 6c69 6572 733c 2f63 inliers - Output ve │ │ │ +000bbc10: 6374 6f72 2069 6e64 6963 6174 696e 6720 ctor indicating │ │ │ +000bbc20: 7768 6963 6820 706f 696e 7473 2061 7265 which points are │ │ │ +000bbc30: 2069 6e6c 6965 7273 2028 312d 696e 6c69 inliers (1-inli │ │ │ +000bbc40: 6572 2c20 302d 6f75 746c 6965 7229 2e3c er, 0-outlier).< │ │ │ +000bbc50: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e72 /dd>.
    r │ │ │ +000bbc60: 616e 7361 6354 6872 6573 686f 6c64 3c2f ansacThreshold - Maximum │ │ │ +000bbc80: 7265 7072 6f6a 6563 7469 6f6e 2065 7272 reprojection err │ │ │ +000bbc90: 6f72 2069 6e20 7468 6520 5241 4e53 4143 or in the RANSAC │ │ │ +000bbca0: 2061 6c67 6f72 6974 686d 2074 6f20 636f algorithm to co │ │ │ +000bbcb0: 6e73 6964 6572 2061 2070 6f69 6e74 2061 nsider a point a │ │ │ +000bbcc0: 730a 616e 2069 6e6c 6965 722e 0a62 6574 s.an inlier..bet │ │ │ +000bbcd0: 7765 656e 2030 2e39 3520 616e 6420 302e ween 0.95 and 0. │ │ │ +000bbce0: 3939 2069 7320 7573 7561 6c6c 7920 676f 99 is usually go │ │ │ +000bbcf0: 6f64 2065 6e6f 7567 682e 2056 616c 7565 od enough. Value │ │ │ +000bbd00: 7320 746f 6f20 636c 6f73 6520 746f 2031 s too close to 1 │ │ │ +000bbd10: 2063 616e 2073 6c6f 7720 646f 776e 2074 can slow down t │ │ │ +000bbd20: 6865 2065 7374 696d 6174 696f 6e0a 7369 he estimation.si │ │ │ +000bbd30: 676e 6966 6963 616e 746c 792e 2056 616c gnificantly. Val │ │ │ +000bbd40: 7565 7320 6c6f 7765 7220 7468 616e 2030 ues lower than 0 │ │ │ +000bbd50: 2e38 2d30 2e39 2063 616e 2072 6573 756c .8-0.9 can resul │ │ │ +000bbd60: 7420 696e 2061 6e20 696e 636f 7272 6563 t in an incorrec │ │ │ +000bbd70: 746c 7920 6573 7469 6d61 7465 6420 7472 tly estimated tr │ │ │ +000bbd80: 616e 7366 6f72 6d61 7469 6f6e 2e3c 2f64 ansformation..
    Returns:< │ │ │ +000bbda0: 2f64 743e 0a3c 6464 3e57 6865 7468 6572 /dt>.
    Whether │ │ │ +000bbdb0: 2061 2073 6f6c 7574 696f 6e20 7761 7320 a solution was │ │ │ +000bbdc0: 666f 756e 642e 0a0a 5468 6520 6675 6e63 found...The func │ │ │ +000bbdd0: 7469 6f6e 2065 7374 696d 6174 6573 2061 tion estimates a │ │ │ +000bbde0: 6e20 6f70 7469 6d61 6c20 3344 2061 6666 n optimal 3D aff │ │ │ +000bbdf0: 696e 6520 7472 616e 7366 6f72 6d61 7469 ine transformati │ │ │ +000bbe00: 6f6e 2062 6574 7765 656e 2074 776f 2033 on between two 3 │ │ │ +000bbe10: 4420 706f 696e 7420 7365 7473 2075 7369 D point sets usi │ │ │ +000bbe20: 6e67 2074 6865 0a52 414e 5341 4320 616c ng the.RANSAC al │ │ │ +000bbe30: 676f 7269 7468 6d2e 3c2f 6464 3e0a 3c2f gorithm.
    ..
    ..
  • .
  • │ │ │ +000bbe60: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    │ │ │ +000bbee0: 0a3c 6833 3e65 7374 696d 6174 6541 6666 .

    estimateAff │ │ │ +000bbef0: 696e 6533 443c 2f68 333e 0a3c 6469 7620 ine3D

    .
    .
    public static boolean estimateAffi │ │ │ +000bbfc0: 6e65 3344 3c2f 7370 616e 3e3c 7762 723e ne3D │ │ │ +000bbfd0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +000bc030: 7370 3b73 7263 2c0a 203c 6120 6872 6566 sp;src,. Mat&nbs │ │ │ +000bc080: 703b 6473 742c 0a20 3c61 2068 7265 663d p;dst,. Mat  │ │ │ +000bc0d0: 3b6f 7574 2c0a 203c 6120 6872 6566 3d22 ;out,. Mat  │ │ │ +000bc120: 696e 6c69 6572 7329 3c2f 7370 616e 3e3c inliers)< │ │ │ +000bc130: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Compute │ │ │ +000bc150: 7320 616e 206f 7074 696d 616c 2061 6666 s an optimal aff │ │ │ +000bc160: 696e 6520 7472 616e 7366 6f72 6d61 7469 ine transformati │ │ │ +000bc170: 6f6e 2062 6574 7765 656e 2074 776f 2033 on between two 3 │ │ │ +000bc180: 4420 706f 696e 7420 7365 7473 2e0a 0a49 D point sets...I │ │ │ +000bc190: 7420 636f 6d70 7574 6573 0a5c 280a 5c62 t computes.\(.\b │ │ │ +000bc1a0: 6567 696e 7b62 6d61 7472 6978 7d0a 785c egin{bmatrix}.x\ │ │ │ +000bc1b0: 5c0a 795c 5c0a 7a5c 5c0a 5c65 6e64 7b62 \.y\\.z\\.\end{b │ │ │ +000bc1c0: 6d61 7472 6978 7d0a 3d0a 5c62 6567 696e matrix}.=.\begin │ │ │ +000bc1d0: 7b62 6d61 7472 6978 7d0a 615f 7b31 317d {bmatrix}.a_{11} │ │ │ +000bc1e0: 2026 616d 703b 2061 5f7b 3132 7d20 2661 & a_{12} &a │ │ │ +000bc1f0: 6d70 3b20 615f 7b31 337d 5c5c 0a61 5f7b mp; a_{13}\\.a_{ │ │ │ +000bc200: 3231 7d20 2661 6d70 3b20 615f 7b32 327d 21} & a_{22} │ │ │ +000bc210: 2026 616d 703b 2061 5f7b 3233 7d5c 5c0a & a_{23}\\. │ │ │ +000bc220: 615f 7b33 317d 2026 616d 703b 2061 5f7b a_{31} & a_{ │ │ │ +000bc230: 3332 7d20 2661 6d70 3b20 615f 7b33 337d 32} & a_{33} │ │ │ +000bc240: 5c5c 0a5c 656e 647b 626d 6174 7269 787d \\.\end{bmatrix} │ │ │ +000bc250: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ +000bc260: 0a58 5c5c 0a59 5c5c 0a5a 5c5c 0a5c 656e .X\\.Y\\.Z\\.\en │ │ │ +000bc270: 647b 626d 6174 7269 787d 0a2b 0a5c 6265 d{bmatrix}.+.\be │ │ │ +000bc280: 6769 6e7b 626d 6174 7269 787d 0a62 5f31 gin{bmatrix}.b_1 │ │ │ +000bc290: 5c5c 0a62 5f32 5c5c 0a62 5f33 5c5c 0a5c \\.b_2\\.b_3\\.\ │ │ │ +000bc2a0: 656e 647b 626d 6174 7269 787d 0a5c 293c end{bmatrix}.\)< │ │ │ +000bc2b0: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ +000bc2d0: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .src - First input │ │ │ +000bc300: 2033 4420 706f 696e 7420 7365 7420 636f 3D point set co │ │ │ +000bc310: 6e74 6169 6e69 6e67 205c 2828 582c 592c ntaining \((X,Y, │ │ │ +000bc320: 5a29 5c29 2e3c 2f64 643e 0a3c 6464 3e3c Z)\)..
    < │ │ │ +000bc330: 636f 6465 3e64 7374 3c2f 636f 6465 3e20 code>dst │ │ │ +000bc340: 2d20 5365 636f 6e64 2069 6e70 7574 2033 - Second input 3 │ │ │ +000bc350: 4420 706f 696e 7420 7365 7420 636f 6e74 D point set cont │ │ │ +000bc360: 6169 6e69 6e67 205c 2828 782c 792c 7a29 aining \((x,y,z) │ │ │ +000bc370: 5c29 2e3c 2f64 643e 0a3c 6464 3e3c 636f \).
    .
    out - │ │ │ +000bc390: 4f75 7470 7574 2033 4420 6166 6669 6e65 Output 3D affine │ │ │ +000bc3a0: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ +000bc3b0: 6d61 7472 6978 205c 2833 205c 7469 6d65 matrix \(3 \time │ │ │ +000bc3c0: 7320 345c 2920 6f66 2074 6865 2066 6f72 s 4\) of the for │ │ │ +000bc3d0: 6d0a 5c28 0a5c 6265 6769 6e7b 626d 6174 m.\(.\begin{bmat │ │ │ +000bc3e0: 7269 787d 0a61 5f7b 3131 7d20 2661 6d70 rix}.a_{11} & │ │ │ +000bc3f0: 3b20 615f 7b31 327d 2026 616d 703b 2061 ; a_{12} & a │ │ │ +000bc400: 5f7b 3133 7d20 2661 6d70 3b20 625f 315c _{13} & b_1\ │ │ │ +000bc410: 5c0a 615f 7b32 317d 2026 616d 703b 2061 \.a_{21} & a │ │ │ +000bc420: 5f7b 3232 7d20 2661 6d70 3b20 615f 7b32 _{22} & a_{2 │ │ │ +000bc430: 337d 2026 616d 703b 2062 5f32 5c5c 0a61 3} & b_2\\.a │ │ │ +000bc440: 5f7b 3331 7d20 2661 6d70 3b20 615f 7b33 _{31} & a_{3 │ │ │ +000bc450: 327d 2026 616d 703b 2061 5f7b 3333 7d20 2} & a_{33} │ │ │ +000bc460: 2661 6d70 3b20 625f 335c 5c0a 5c65 6e64 & b_3\\.\end │ │ │ +000bc470: 7b62 6d61 7472 6978 7d0a 5c29 3c2f 6464 {bmatrix}.\)
    .
    inli │ │ │ +000bc490: 6572 733c 2f63 6f64 653e 202d 204f 7574 ers - Out │ │ │ +000bc4a0: 7075 7420 7665 6374 6f72 2069 6e64 6963 put vector indic │ │ │ +000bc4b0: 6174 696e 6720 7768 6963 6820 706f 696e ating which poin │ │ │ +000bc4c0: 7473 2061 7265 2069 6e6c 6965 7273 2028 ts are inliers ( │ │ │ +000bc4d0: 312d 696e 6c69 6572 2c20 302d 6f75 746c 1-inlier, 0-outl │ │ │ +000bc4e0: 6965 7229 2e0a 616e 2069 6e6c 6965 722e ier)..an inlier. │ │ │ +000bc4f0: 0a62 6574 7765 656e 2030 2e39 3520 616e .between 0.95 an │ │ │ +000bc500: 6420 302e 3939 2069 7320 7573 7561 6c6c d 0.99 is usuall │ │ │ +000bc510: 7920 676f 6f64 2065 6e6f 7567 682e 2056 y good enough. V │ │ │ +000bc520: 616c 7565 7320 746f 6f20 636c 6f73 6520 alues too close │ │ │ +000bc530: 746f 2031 2063 616e 2073 6c6f 7720 646f to 1 can slow do │ │ │ +000bc540: 776e 2074 6865 2065 7374 696d 6174 696f wn the estimatio │ │ │ +000bc550: 6e0a 7369 676e 6966 6963 616e 746c 792e n.significantly. │ │ │ +000bc560: 2056 616c 7565 7320 6c6f 7765 7220 7468 Values lower th │ │ │ +000bc570: 616e 2030 2e38 2d30 2e39 2063 616e 2072 an 0.8-0.9 can r │ │ │ +000bc580: 6573 756c 7420 696e 2061 6e20 696e 636f esult in an inco │ │ │ +000bc590: 7272 6563 746c 7920 6573 7469 6d61 7465 rrectly estimate │ │ │ +000bc5a0: 6420 7472 616e 7366 6f72 6d61 7469 6f6e d transformation │ │ │ +000bc5b0: 2e3c 2f64 643e 0a3c 6474 3e52 6574 7572 .
    .
    Retur │ │ │ +000bc5c0: 6e73 3a3c 2f64 743e 0a3c 6464 3e57 6865 ns:
    .
    Whe │ │ │ +000bc5d0: 7468 6572 2061 2073 6f6c 7574 696f 6e20 ther a solution │ │ │ +000bc5e0: 7761 7320 666f 756e 642e 0a0a 5468 6520 was found...The │ │ │ +000bc5f0: 6675 6e63 7469 6f6e 2065 7374 696d 6174 function estimat │ │ │ +000bc600: 6573 2061 6e20 6f70 7469 6d61 6c20 3344 es an optimal 3D │ │ │ +000bc610: 2061 6666 696e 6520 7472 616e 7366 6f72 affine transfor │ │ │ +000bc620: 6d61 7469 6f6e 2062 6574 7765 656e 2074 mation between t │ │ │ +000bc630: 776f 2033 4420 706f 696e 7420 7365 7473 wo 3D point sets │ │ │ +000bc640: 2075 7369 6e67 2074 6865 0a52 414e 5341 using the.RANSA │ │ │ +000bc650: 4320 616c 676f 7269 7468 6d2e 3c2f 6464 C algorithm.
    .
    .
    .< │ │ │ +000bc670: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ +000bc680: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .estimateAffine │ │ │ +000bc700: 3344 3c2f 6833 3e0a 3c64 6976 2063 6c61 3D
  • .
    .
    pu │ │ │ +000bc760: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static Ma │ │ │ +000bc7d0: 743c 2f61 3e3c 2f73 7061 6e3e 266e 6273 t&nbs │ │ │ +000bc7e0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;est │ │ │ +000bc800: 696d 6174 6541 6666 696e 6533 443c 2f73 imateAffine3D(M │ │ │ +000bc870: 6174 3c2f 613e 266e 6273 703b 7372 632c at src, │ │ │ +000bc880: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000bc8c0: 743c 2f61 3e26 6e62 7370 3b64 7374 2c0a t dst,. │ │ │ +000bc8d0: 2064 6f75 626c 655b 5d26 6e62 7370 3b73 double[] s │ │ │ +000bc8e0: 6361 6c65 2c0a 2062 6f6f 6c65 616e 266e cale,. boolean&n │ │ │ +000bc8f0: 6273 703b 666f 7263 655f 726f 7461 7469 bsp;force_rotati │ │ │ +000bc900: 6f6e 293c 2f73 7061 6e3e 3c2f 6469 763e on)
    │ │ │ +000bc910: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Computes an │ │ │ +000bc930: 6f70 7469 6d61 6c20 6166 6669 6e65 2074 optimal affine t │ │ │ +000bc940: 7261 6e73 666f 726d 6174 696f 6e20 6265 ransformation be │ │ │ +000bc950: 7477 6565 6e20 7477 6f20 3344 2070 6f69 tween two 3D poi │ │ │ +000bc960: 6e74 2073 6574 732e 0a0a 4974 2063 6f6d nt sets...It com │ │ │ +000bc970: 7075 7465 7320 5c28 522c 732c 745c 2920 putes \(R,s,t\) │ │ │ +000bc980: 6d69 6e69 6d69 7a69 6e67 205c 285c 7375 minimizing \(\su │ │ │ +000bc990: 6d7b 697d 2064 7374 5f69 202d 2063 205c m{i} dst_i - c \ │ │ │ +000bc9a0: 6364 6f74 2052 205c 6364 6f74 2073 7263 cdot R \cdot src │ │ │ +000bc9b0: 5f69 205c 290a 7768 6572 6520 5c28 525c _i \).where \(R\ │ │ │ +000bc9c0: 2920 6973 2061 2033 7833 2072 6f74 6174 ) is a 3x3 rotat │ │ │ +000bc9d0: 696f 6e20 6d61 7472 6978 2c20 5c28 745c ion matrix, \(t\ │ │ │ +000bc9e0: 2920 6973 2061 2033 7831 2074 7261 6e73 ) is a 3x1 trans │ │ │ +000bc9f0: 6c61 7469 6f6e 2076 6563 746f 7220 616e lation vector an │ │ │ +000bca00: 6420 5c28 735c 2920 6973 2061 0a73 6361 d \(s\) is a.sca │ │ │ +000bca10: 6c61 7220 7369 7a65 2076 616c 7565 2e20 lar size value. │ │ │ +000bca20: 5468 6973 2069 7320 616e 2069 6d70 6c65 This is an imple │ │ │ +000bca30: 6d65 6e74 6174 696f 6e20 6f66 2074 6865 mentation of the │ │ │ +000bca40: 2061 6c67 6f72 6974 686d 2062 7920 556d algorithm by Um │ │ │ +000bca50: 6579 616d 6120 5c63 6974 6520 756d 6579 eyama \cite umey │ │ │ +000bca60: 616d 6131 3939 316c 6561 7374 202e 0a54 ama1991least ..T │ │ │ +000bca70: 6865 2065 7374 696d 6174 6564 2061 6666 he estimated aff │ │ │ +000bca80: 696e 6520 7472 616e 7366 6f72 6d20 6861 ine transform ha │ │ │ +000bca90: 7320 6120 686f 6d6f 6765 6e65 6f75 7320 s a homogeneous │ │ │ +000bcaa0: 7363 616c 6520 7768 6963 6820 6973 2061 scale which is a │ │ │ +000bcab0: 2073 7562 636c 6173 7320 6f66 2061 6666 subclass of aff │ │ │ +000bcac0: 696e 650a 7472 616e 7366 6f72 6d61 7469 ine.transformati │ │ │ +000bcad0: 6f6e 7320 7769 7468 2037 2064 6567 7265 ons with 7 degre │ │ │ +000bcae0: 6573 206f 6620 6672 6565 646f 6d2e 2054 es of freedom. T │ │ │ +000bcaf0: 6865 2070 6169 7265 6420 706f 696e 7420 he paired point │ │ │ +000bcb00: 7365 7473 206e 6565 6420 746f 2063 6f6d sets need to com │ │ │ +000bcb10: 7072 6973 6520 6174 206c 6561 7374 2033 prise at least 3 │ │ │ +000bcb20: 0a70 6f69 6e74 7320 6561 6368 2e3c 2f64 .points each..
    .
    Param │ │ │ +000bcb50: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ +000bcb60: 3c63 6f64 653e 7372 633c 2f63 6f64 653e src │ │ │ +000bcb70: 202d 2046 6972 7374 2069 6e70 7574 2033 - First input 3 │ │ │ +000bcb80: 4420 706f 696e 7420 7365 742e 3c2f 6464 D point set.
    .
    dst< │ │ │ +000bcba0: 2f63 6f64 653e 202d 2053 6563 6f6e 6420 /code> - Second │ │ │ +000bcbb0: 696e 7075 7420 3344 2070 6f69 6e74 2073 input 3D point s │ │ │ +000bcbc0: 6574 2e3c 2f64 643e 0a3c 6464 3e3c 636f et.
    .
    scale │ │ │ +000bcbe0: 2d20 4966 206e 756c 6c20 6973 2070 6173 - If null is pas │ │ │ +000bcbf0: 7365 642c 2074 6865 2073 6361 6c65 2070 sed, the scale p │ │ │ +000bcc00: 6172 616d 6574 6572 2063 2077 696c 6c20 arameter c will │ │ │ +000bcc10: 6265 2061 7373 756d 6564 2074 6f20 6265 be assumed to be │ │ │ +000bcc20: 2031 2e30 2e0a 456c 7365 2074 6865 2070 1.0..Else the p │ │ │ +000bcc30: 6f69 6e74 6564 2d74 6f20 7661 7269 6162 ointed-to variab │ │ │ +000bcc40: 6c65 2077 696c 6c20 6265 2073 6574 2074 le will be set t │ │ │ +000bcc50: 6f20 7468 6520 6f70 7469 6d61 6c20 7363 o the optimal sc │ │ │ +000bcc60: 616c 652e 3c2f 6464 3e0a 3c64 643e 3c63 ale.
    .
    force_rotati │ │ │ +000bcc80: 6f6e 3c2f 636f 6465 3e20 2d20 4966 2074 on - If t │ │ │ +000bcc90: 7275 652c 2074 6865 2072 6574 7572 6e65 rue, the returne │ │ │ +000bcca0: 6420 726f 7461 7469 6f6e 2077 696c 6c20 d rotation will │ │ │ +000bccb0: 6e65 7665 7220 6265 2061 2072 6566 6c65 never be a refle │ │ │ +000bccc0: 6374 696f 6e2e 0a54 6869 7320 6d69 6768 ction..This migh │ │ │ +000bccd0: 7420 6265 2075 6e77 616e 7465 642c 2065 t be unwanted, e │ │ │ +000bcce0: 2e67 2e20 7768 656e 206f 7074 696d 697a .g. when optimiz │ │ │ +000bccf0: 696e 6720 6120 7472 616e 7366 6f72 6d20 ing a transform │ │ │ +000bcd00: 6265 7477 6565 6e20 6120 7269 6768 742d between a right- │ │ │ +000bcd10: 2061 6e64 2061 0a6c 6566 742d 6861 6e64 and a.left-hand │ │ │ +000bcd20: 6564 2063 6f6f 7264 696e 6174 6520 7379 ed coordinate sy │ │ │ +000bcd30: 7374 656d 2e3c 2f64 643e 0a3c 6474 3e52 stem.
    .
    R │ │ │ +000bcd40: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    3D affine trans │ │ │ +000bcd60: 666f 726d 6174 696f 6e20 6d61 7472 6978 formation matrix │ │ │ +000bcd70: 205c 2833 205c 7469 6d65 7320 345c 2920 \(3 \times 4\) │ │ │ +000bcd80: 6f66 2074 6865 2066 6f72 6d0a 5c28 5420 of the form.\(T │ │ │ +000bcd90: 3d0a 5c62 6567 696e 7b62 6d61 7472 6978 =.\begin{bmatrix │ │ │ +000bcda0: 7d0a 5220 2661 6d70 3b20 745c 5c0a 5c65 }.R & t\\.\e │ │ │ +000bcdb0: 6e64 7b62 6d61 7472 6978 7d0a 5c29 3c2f nd{bmatrix}.\).
    .
    │ │ │ +000bcdd0: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 ..
  • .
  • .
    .

    esti │ │ │ +000bce50: 6d61 7465 4166 6669 6e65 3344 3c2f 6833 mateAffine3D

    .
    .
    │ │ │ +000bcea0: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +000bcec0: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +000bced0: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;Mat< │ │ │ +000bcf30: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> estimateA │ │ │ +000bcf60: 6666 696e 6533 443c 2f73 7061 6e3e 3c77 ffine3D(Mat │ │ │ +000bcfd0: 266e 6273 703b 7372 632c 0a20 3c61 2068  src,. Mat& │ │ │ +000bd020: 6e62 7370 3b64 7374 2c0a 2064 6f75 626c nbsp;dst,. doubl │ │ │ +000bd030: 655b 5d26 6e62 7370 3b73 6361 6c65 293c e[] scale)< │ │ │ +000bd040: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ +000bd060: 436f 6d70 7574 6573 2061 6e20 6f70 7469 Computes an opti │ │ │ +000bd070: 6d61 6c20 6166 6669 6e65 2074 7261 6e73 mal affine trans │ │ │ +000bd080: 666f 726d 6174 696f 6e20 6265 7477 6565 formation betwee │ │ │ +000bd090: 6e20 7477 6f20 3344 2070 6f69 6e74 2073 n two 3D point s │ │ │ +000bd0a0: 6574 732e 0a0a 4974 2063 6f6d 7075 7465 ets...It compute │ │ │ +000bd0b0: 7320 5c28 522c 732c 745c 2920 6d69 6e69 s \(R,s,t\) mini │ │ │ +000bd0c0: 6d69 7a69 6e67 205c 285c 7375 6d7b 697d mizing \(\sum{i} │ │ │ +000bd0d0: 2064 7374 5f69 202d 2063 205c 6364 6f74 dst_i - c \cdot │ │ │ +000bd0e0: 2052 205c 6364 6f74 2073 7263 5f69 205c R \cdot src_i \ │ │ │ +000bd0f0: 290a 7768 6572 6520 5c28 525c 2920 6973 ).where \(R\) is │ │ │ +000bd100: 2061 2033 7833 2072 6f74 6174 696f 6e20 a 3x3 rotation │ │ │ +000bd110: 6d61 7472 6978 2c20 5c28 745c 2920 6973 matrix, \(t\) is │ │ │ +000bd120: 2061 2033 7831 2074 7261 6e73 6c61 7469 a 3x1 translati │ │ │ +000bd130: 6f6e 2076 6563 746f 7220 616e 6420 5c28 on vector and \( │ │ │ +000bd140: 735c 2920 6973 2061 0a73 6361 6c61 7220 s\) is a.scalar │ │ │ +000bd150: 7369 7a65 2076 616c 7565 2e20 5468 6973 size value. This │ │ │ +000bd160: 2069 7320 616e 2069 6d70 6c65 6d65 6e74 is an implement │ │ │ +000bd170: 6174 696f 6e20 6f66 2074 6865 2061 6c67 ation of the alg │ │ │ +000bd180: 6f72 6974 686d 2062 7920 556d 6579 616d orithm by Umeyam │ │ │ +000bd190: 6120 5c63 6974 6520 756d 6579 616d 6131 a \cite umeyama1 │ │ │ +000bd1a0: 3939 316c 6561 7374 202e 0a54 6865 2065 991least ..The e │ │ │ +000bd1b0: 7374 696d 6174 6564 2061 6666 696e 6520 stimated affine │ │ │ +000bd1c0: 7472 616e 7366 6f72 6d20 6861 7320 6120 transform has a │ │ │ +000bd1d0: 686f 6d6f 6765 6e65 6f75 7320 7363 616c homogeneous scal │ │ │ +000bd1e0: 6520 7768 6963 6820 6973 2061 2073 7562 e which is a sub │ │ │ +000bd1f0: 636c 6173 7320 6f66 2061 6666 696e 650a class of affine. │ │ │ +000bd200: 7472 616e 7366 6f72 6d61 7469 6f6e 7320 transformations │ │ │ +000bd210: 7769 7468 2037 2064 6567 7265 6573 206f with 7 degrees o │ │ │ +000bd220: 6620 6672 6565 646f 6d2e 2054 6865 2070 f freedom. The p │ │ │ +000bd230: 6169 7265 6420 706f 696e 7420 7365 7473 aired point sets │ │ │ +000bd240: 206e 6565 6420 746f 2063 6f6d 7072 6973 need to compris │ │ │ +000bd250: 6520 6174 206c 6561 7374 2033 0a70 6f69 e at least 3.poi │ │ │ +000bd260: 6e74 7320 6561 6368 2e3c 2f64 6976 3e0a nts each.
    . │ │ │ +000bd270: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ +000bd290: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    src - F │ │ │ +000bd2b0: 6972 7374 2069 6e70 7574 2033 4420 706f irst input 3D po │ │ │ +000bd2c0: 696e 7420 7365 742e 3c2f 6464 3e0a 3c64 int set.
    .dst - Second inpu │ │ │ +000bd2f0: 7420 3344 2070 6f69 6e74 2073 6574 2e3c t 3D point set.< │ │ │ +000bd300: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e73 /dd>.
    s │ │ │ +000bd310: 6361 6c65 3c2f 636f 6465 3e20 2d20 4966 cale - If │ │ │ +000bd320: 206e 756c 6c20 6973 2070 6173 7365 642c null is passed, │ │ │ +000bd330: 2074 6865 2073 6361 6c65 2070 6172 616d the scale param │ │ │ +000bd340: 6574 6572 2063 2077 696c 6c20 6265 2061 eter c will be a │ │ │ +000bd350: 7373 756d 6564 2074 6f20 6265 2031 2e30 ssumed to be 1.0 │ │ │ +000bd360: 2e0a 456c 7365 2074 6865 2070 6f69 6e74 ..Else the point │ │ │ +000bd370: 6564 2d74 6f20 7661 7269 6162 6c65 2077 ed-to variable w │ │ │ +000bd380: 696c 6c20 6265 2073 6574 2074 6f20 7468 ill be set to th │ │ │ +000bd390: 6520 6f70 7469 6d61 6c20 7363 616c 652e e optimal scale. │ │ │ +000bd3a0: 0a54 6869 7320 6d69 6768 7420 6265 2075 .This might be u │ │ │ +000bd3b0: 6e77 616e 7465 642c 2065 2e67 2e20 7768 nwanted, e.g. wh │ │ │ +000bd3c0: 656e 206f 7074 696d 697a 696e 6720 6120 en optimizing a │ │ │ +000bd3d0: 7472 616e 7366 6f72 6d20 6265 7477 6565 transform betwee │ │ │ +000bd3e0: 6e20 6120 7269 6768 742d 2061 6e64 2061 n a right- and a │ │ │ +000bd3f0: 0a6c 6566 742d 6861 6e64 6564 2063 6f6f .left-handed coo │ │ │ +000bd400: 7264 696e 6174 6520 7379 7374 656d 2e3c rdinate system.< │ │ │ +000bd410: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ +000bd420: 3a3c 2f64 743e 0a3c 6464 3e33 4420 6166 :
    .
    3D af │ │ │ +000bd430: 6669 6e65 2074 7261 6e73 666f 726d 6174 fine transformat │ │ │ +000bd440: 696f 6e20 6d61 7472 6978 205c 2833 205c ion matrix \(3 \ │ │ │ +000bd450: 7469 6d65 7320 345c 2920 6f66 2074 6865 times 4\) of the │ │ │ +000bd460: 2066 6f72 6d0a 5c28 5420 3d0a 5c62 6567 form.\(T =.\beg │ │ │ +000bd470: 696e 7b62 6d61 7472 6978 7d0a 5220 2661 in{bmatrix}.R &a │ │ │ +000bd480: 6d70 3b20 745c 5c0a 5c65 6e64 7b62 6d61 mp; t\\.\end{bma │ │ │ +000bd490: 7472 6978 7d0a 5c29 3c2f 6464 3e0a 3c2f trix}.\)
    ....
  • .
  • │ │ │ +000bd4c0: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    est │ │ │ +000bd520: 696d 6174 6541 6666 696e 6533 443c 2f68 imateAffine3D.
    .
    public │ │ │ +000bd590: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +000bd5a0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;Mat │ │ │ +000bd600: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  estimate │ │ │ +000bd630: 4166 6669 6e65 3344 3c2f 7370 616e 3e3c Affine3D< │ │ │ +000bd640: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat src,. Mat │ │ │ +000bd6f0: 266e 6273 703b 6473 7429 3c2f 7370 616e  dst)
    .
    Compu │ │ │ +000bd720: 7465 7320 616e 206f 7074 696d 616c 2061 tes an optimal a │ │ │ +000bd730: 6666 696e 6520 7472 616e 7366 6f72 6d61 ffine transforma │ │ │ +000bd740: 7469 6f6e 2062 6574 7765 656e 2074 776f tion between two │ │ │ +000bd750: 2033 4420 706f 696e 7420 7365 7473 2e0a 3D point sets.. │ │ │ +000bd760: 0a49 7420 636f 6d70 7574 6573 205c 2852 .It computes \(R │ │ │ +000bd770: 2c73 2c74 5c29 206d 696e 696d 697a 696e ,s,t\) minimizin │ │ │ +000bd780: 6720 5c28 5c73 756d 7b69 7d20 6473 745f g \(\sum{i} dst_ │ │ │ +000bd790: 6920 2d20 6320 5c63 646f 7420 5220 5c63 i - c \cdot R \c │ │ │ +000bd7a0: 646f 7420 7372 635f 6920 5c29 0a77 6865 dot src_i \).whe │ │ │ +000bd7b0: 7265 205c 2852 5c29 2069 7320 6120 3378 re \(R\) is a 3x │ │ │ +000bd7c0: 3320 726f 7461 7469 6f6e 206d 6174 7269 3 rotation matri │ │ │ +000bd7d0: 782c 205c 2874 5c29 2069 7320 6120 3378 x, \(t\) is a 3x │ │ │ +000bd7e0: 3120 7472 616e 736c 6174 696f 6e20 7665 1 translation ve │ │ │ +000bd7f0: 6374 6f72 2061 6e64 205c 2873 5c29 2069 ctor and \(s\) i │ │ │ +000bd800: 7320 610a 7363 616c 6172 2073 697a 6520 s a.scalar size │ │ │ +000bd810: 7661 6c75 652e 2054 6869 7320 6973 2061 value. This is a │ │ │ +000bd820: 6e20 696d 706c 656d 656e 7461 7469 6f6e n implementation │ │ │ +000bd830: 206f 6620 7468 6520 616c 676f 7269 7468 of the algorith │ │ │ +000bd840: 6d20 6279 2055 6d65 7961 6d61 205c 6369 m by Umeyama \ci │ │ │ +000bd850: 7465 2075 6d65 7961 6d61 3139 3931 6c65 te umeyama1991le │ │ │ +000bd860: 6173 7420 2e0a 5468 6520 6573 7469 6d61 ast ..The estima │ │ │ +000bd870: 7465 6420 6166 6669 6e65 2074 7261 6e73 ted affine trans │ │ │ +000bd880: 666f 726d 2068 6173 2061 2068 6f6d 6f67 form has a homog │ │ │ +000bd890: 656e 656f 7573 2073 6361 6c65 2077 6869 eneous scale whi │ │ │ +000bd8a0: 6368 2069 7320 6120 7375 6263 6c61 7373 ch is a subclass │ │ │ +000bd8b0: 206f 6620 6166 6669 6e65 0a74 7261 6e73 of affine.trans │ │ │ +000bd8c0: 666f 726d 6174 696f 6e73 2077 6974 6820 formations with │ │ │ +000bd8d0: 3720 6465 6772 6565 7320 6f66 2066 7265 7 degrees of fre │ │ │ +000bd8e0: 6564 6f6d 2e20 5468 6520 7061 6972 6564 edom. The paired │ │ │ +000bd8f0: 2070 6f69 6e74 2073 6574 7320 6e65 6564 point sets need │ │ │ +000bd900: 2074 6f20 636f 6d70 7269 7365 2061 7420 to comprise at │ │ │ +000bd910: 6c65 6173 7420 330a 706f 696e 7473 2065 least 3.points e │ │ │ +000bd920: 6163 682e 3c2f 6469 763e 0a3c 646c 2063 ach.
    .
    .Parameters:.
    src │ │ │ +000bd960: 3c2f 636f 6465 3e20 2d20 4669 7273 7420 - First │ │ │ +000bd970: 696e 7075 7420 3344 2070 6f69 6e74 2073 input 3D point s │ │ │ +000bd980: 6574 2e3c 2f64 643e 0a3c 6464 3e3c 636f et.
    .
    dst - │ │ │ +000bd9a0: 5365 636f 6e64 2069 6e70 7574 2033 4420 Second input 3D │ │ │ +000bd9b0: 706f 696e 7420 7365 742e 0a45 6c73 6520 point set..Else │ │ │ +000bd9c0: 7468 6520 706f 696e 7465 642d 746f 2076 the pointed-to v │ │ │ +000bd9d0: 6172 6961 626c 6520 7769 6c6c 2062 6520 ariable will be │ │ │ +000bd9e0: 7365 7420 746f 2074 6865 206f 7074 696d set to the optim │ │ │ +000bd9f0: 616c 2073 6361 6c65 2e0a 5468 6973 206d al scale..This m │ │ │ +000bda00: 6967 6874 2062 6520 756e 7761 6e74 6564 ight be unwanted │ │ │ +000bda10: 2c20 652e 672e 2077 6865 6e20 6f70 7469 , e.g. when opti │ │ │ +000bda20: 6d69 7a69 6e67 2061 2074 7261 6e73 666f mizing a transfo │ │ │ +000bda30: 726d 2062 6574 7765 656e 2061 2072 6967 rm between a rig │ │ │ +000bda40: 6874 2d20 616e 6420 610a 6c65 6674 2d68 ht- and a.left-h │ │ │ +000bda50: 616e 6465 6420 636f 6f72 6469 6e61 7465 anded coordinate │ │ │ +000bda60: 2073 7973 7465 6d2e 3c2f 6464 3e0a 3c64 system.
    .Returns:. │ │ │ +000bda80: 3c64 643e 3344 2061 6666 696e 6520 7472
    3D affine tr │ │ │ +000bda90: 616e 7366 6f72 6d61 7469 6f6e 206d 6174 ansformation mat │ │ │ +000bdaa0: 7269 7820 5c28 3320 5c74 696d 6573 2034 rix \(3 \times 4 │ │ │ +000bdab0: 5c29 206f 6620 7468 6520 666f 726d 0a5c \) of the form.\ │ │ │ +000bdac0: 2854 203d 0a5c 6265 6769 6e7b 626d 6174 (T =.\begin{bmat │ │ │ +000bdad0: 7269 787d 0a52 2026 616d 703b 2074 5c5c rix}.R & t\\ │ │ │ +000bdae0: 0a5c 656e 647b 626d 6174 7269 787d 0a5c .\end{bmatrix}.\ │ │ │ +000bdaf0: 293c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 )
    .
    ..

    .< │ │ │ +000bdb10: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    estimateTransla │ │ │ +000bdbc0: 7469 6f6e 3344 3c2f 6833 3e0a 3c64 6976 tion3D

    .
    .
    public static< │ │ │ +000bdc30: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> boolean estimateTra │ │ │ +000bdc90: 6e73 6c61 7469 6f6e 3344 3c2f 7370 616e nslation3D( │ │ │ +000bdcc0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000bdd00: 2f61 3e26 6e62 7370 3b73 7263 2c0a 203c /a> src,. < │ │ │ +000bdd10: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000bdd20: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000bdd30: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000bdd40: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dst,. Mat out,. Mat │ │ │ +000bddf0: 266e 6273 703b 696e 6c69 6572 732c 0a20  inliers,. │ │ │ +000bde00: 646f 7562 6c65 266e 6273 703b 7261 6e73 double rans │ │ │ +000bde10: 6163 5468 7265 7368 6f6c 642c 0a20 646f acThreshold,. do │ │ │ +000bde20: 7562 6c65 266e 6273 703b 636f 6e66 6964 uble confid │ │ │ +000bde30: 656e 6365 293c 2f73 7061 6e3e 3c2f 6469 ence).
    Computes a │ │ │ +000bde60: 6e20 6f70 7469 6d61 6c20 7472 616e 736c n optimal transl │ │ │ +000bde70: 6174 696f 6e20 6265 7477 6565 6e20 7477 ation between tw │ │ │ +000bde80: 6f20 3344 2070 6f69 6e74 2073 6574 732e o 3D point sets. │ │ │ +000bde90: 0a0a 4974 2063 6f6d 7075 7465 730a 5c28 ..It computes.\( │ │ │ +000bdea0: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ +000bdeb0: 0a78 5c5c 0a79 5c5c 0a7a 5c5c 0a5c 656e .x\\.y\\.z\\.\en │ │ │ +000bdec0: 647b 626d 6174 7269 787d 0a3d 0a5c 6265 d{bmatrix}.=.\be │ │ │ +000bded0: 6769 6e7b 626d 6174 7269 787d 0a58 5c5c gin{bmatrix}.X\\ │ │ │ +000bdee0: 0a59 5c5c 0a5a 5c5c 0a5c 656e 647b 626d .Y\\.Z\\.\end{bm │ │ │ +000bdef0: 6174 7269 787d 0a2b 0a5c 6265 6769 6e7b atrix}.+.\begin{ │ │ │ +000bdf00: 626d 6174 7269 787d 0a62 5f31 5c5c 0a62 bmatrix}.b_1\\.b │ │ │ +000bdf10: 5f32 5c5c 0a62 5f33 5c5c 0a5c 656e 647b _2\\.b_3\\.\end{ │ │ │ +000bdf20: 626d 6174 7269 787d 0a5c 293c 2f64 6976 bmatrix}.\)
    .
    .
    Paramet │ │ │ +000bdf50: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    src - │ │ │ +000bdf70: 2046 6972 7374 2069 6e70 7574 2033 4420 First input 3D │ │ │ +000bdf80: 706f 696e 7420 7365 7420 636f 6e74 6169 point set contai │ │ │ +000bdf90: 6e69 6e67 205c 2828 582c 592c 5a29 5c29 ning \((X,Y,Z)\) │ │ │ +000bdfa0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    dst - Se │ │ │ +000bdfc0: 636f 6e64 2069 6e70 7574 2033 4420 706f cond input 3D po │ │ │ +000bdfd0: 696e 7420 7365 7420 636f 6e74 6169 6e69 int set containi │ │ │ +000bdfe0: 6e67 205c 2828 782c 792c 7a29 5c29 2e3c ng \((x,y,z)\).< │ │ │ +000bdff0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e6f /dd>.
    o │ │ │ +000be000: 7574 3c2f 636f 6465 3e20 2d20 4f75 7470 ut - Outp │ │ │ +000be010: 7574 2033 4420 7472 616e 736c 6174 696f ut 3D translatio │ │ │ +000be020: 6e20 7665 6374 6f72 205c 2833 205c 7469 n vector \(3 \ti │ │ │ +000be030: 6d65 7320 315c 2920 6f66 2074 6865 2066 mes 1\) of the f │ │ │ +000be040: 6f72 6d0a 5c28 0a5c 6265 6769 6e7b 626d orm.\(.\begin{bm │ │ │ +000be050: 6174 7269 787d 0a62 5f31 205c 5c0a 625f atrix}.b_1 \\.b_ │ │ │ +000be060: 3220 5c5c 0a62 5f33 205c 5c0a 5c65 6e64 2 \\.b_3 \\.\end │ │ │ +000be070: 7b62 6d61 7472 6978 7d0a 5c29 3c2f 6464 {bmatrix}.\)
    .
    inli │ │ │ +000be090: 6572 733c 2f63 6f64 653e 202d 204f 7574 ers - Out │ │ │ +000be0a0: 7075 7420 7665 6374 6f72 2069 6e64 6963 put vector indic │ │ │ +000be0b0: 6174 696e 6720 7768 6963 6820 706f 696e ating which poin │ │ │ +000be0c0: 7473 2061 7265 2069 6e6c 6965 7273 2028 ts are inliers ( │ │ │ +000be0d0: 312d 696e 6c69 6572 2c20 302d 6f75 746c 1-inlier, 0-outl │ │ │ +000be0e0: 6965 7229 2e3c 2f64 643e 0a3c 6464 3e3c ier).
    .
    < │ │ │ +000be0f0: 636f 6465 3e72 616e 7361 6354 6872 6573 code>ransacThres │ │ │ +000be100: 686f 6c64 3c2f 636f 6465 3e20 2d20 4d61 hold - Ma │ │ │ +000be110: 7869 6d75 6d20 7265 7072 6f6a 6563 7469 ximum reprojecti │ │ │ +000be120: 6f6e 2065 7272 6f72 2069 6e20 7468 6520 on error in the │ │ │ +000be130: 5241 4e53 4143 2061 6c67 6f72 6974 686d RANSAC algorithm │ │ │ +000be140: 2074 6f20 636f 6e73 6964 6572 2061 2070 to consider a p │ │ │ +000be150: 6f69 6e74 2061 730a 616e 2069 6e6c 6965 oint as.an inlie │ │ │ +000be160: 722e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 r.
    .
    confidence - Confidence │ │ │ +000be190: 206c 6576 656c 2c20 6265 7477 6565 6e20 level, between │ │ │ +000be1a0: 3020 616e 6420 312c 2066 6f72 2074 6865 0 and 1, for the │ │ │ +000be1b0: 2065 7374 696d 6174 6564 2074 7261 6e73 estimated trans │ │ │ +000be1c0: 666f 726d 6174 696f 6e2e 2041 6e79 7468 formation. Anyth │ │ │ +000be1d0: 696e 670a 6265 7477 6565 6e20 302e 3935 ing.between 0.95 │ │ │ +000be1e0: 2061 6e64 2030 2e39 3920 6973 2075 7375 and 0.99 is usu │ │ │ +000be1f0: 616c 6c79 2067 6f6f 6420 656e 6f75 6768 ally good enough │ │ │ +000be200: 2e20 5661 6c75 6573 2074 6f6f 2063 6c6f . Values too clo │ │ │ +000be210: 7365 2074 6f20 3120 6361 6e20 736c 6f77 se to 1 can slow │ │ │ +000be220: 2064 6f77 6e20 7468 6520 6573 7469 6d61 down the estima │ │ │ +000be230: 7469 6f6e 0a73 6967 6e69 6669 6361 6e74 tion.significant │ │ │ +000be240: 6c79 2e20 5661 6c75 6573 206c 6f77 6572 ly. Values lower │ │ │ +000be250: 2074 6861 6e20 302e 382d 302e 3920 6361 than 0.8-0.9 ca │ │ │ +000be260: 6e20 7265 7375 6c74 2069 6e20 616e 2069 n result in an i │ │ │ +000be270: 6e63 6f72 7265 6374 6c79 2065 7374 696d ncorrectly estim │ │ │ +000be280: 6174 6564 2074 7261 6e73 666f 726d 6174 ated transformat │ │ │ +000be290: 696f 6e2e 3c2f 6464 3e0a 3c64 743e 5265 ion.
    .
    Re │ │ │ +000be2a0: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ +000be2b0: 5768 6574 6865 7220 6120 7472 616e 736c Whether a transl │ │ │ +000be2c0: 6174 696f 6e20 7761 7320 666f 756e 642e ation was found. │ │ │ +000be2d0: 0a0a 5468 6520 6675 6e63 7469 6f6e 2065 ..The function e │ │ │ +000be2e0: 7374 696d 6174 6573 2061 6e20 6f70 7469 stimates an opti │ │ │ +000be2f0: 6d61 6c20 3344 2074 7261 6e73 6c61 7469 mal 3D translati │ │ │ +000be300: 6f6e 2062 6574 7765 656e 2074 776f 2033 on between two 3 │ │ │ +000be310: 4420 706f 696e 7420 7365 7473 2075 7369 D point sets usi │ │ │ +000be320: 6e67 2074 6865 0a52 414e 5341 4320 616c ng the.RANSAC al │ │ │ +000be330: 676f 7269 7468 6d2e 3c2f 6464 3e0a 3c2f gorithm.
    ..
    ..
  • .
  • │ │ │ +000be360: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    estimateTransla │ │ │ +000be400: 7469 6f6e 3344 3c2f 6833 3e0a 3c64 6976 tion3D

    .
    .
    public static< │ │ │ +000be470: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> boolean estimateTra │ │ │ +000be4d0: 6e73 6c61 7469 6f6e 3344 3c2f 7370 616e nslation3D( │ │ │ +000be500: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000be540: 2f61 3e26 6e62 7370 3b73 7263 2c0a 203c /a> src,. < │ │ │ +000be550: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000be560: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000be570: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000be580: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat dst,. Mat out,. Mat │ │ │ +000be630: 266e 6273 703b 696e 6c69 6572 732c 0a20  inliers,. │ │ │ +000be640: 646f 7562 6c65 266e 6273 703b 7261 6e73 double rans │ │ │ +000be650: 6163 5468 7265 7368 6f6c 6429 3c2f 7370 acThreshold)
    .
    Com │ │ │ +000be680: 7075 7465 7320 616e 206f 7074 696d 616c putes an optimal │ │ │ +000be690: 2074 7261 6e73 6c61 7469 6f6e 2062 6574 translation bet │ │ │ +000be6a0: 7765 656e 2074 776f 2033 4420 706f 696e ween two 3D poin │ │ │ +000be6b0: 7420 7365 7473 2e0a 0a49 7420 636f 6d70 t sets...It comp │ │ │ +000be6c0: 7574 6573 0a5c 280a 5c62 6567 696e 7b62 utes.\(.\begin{b │ │ │ +000be6d0: 6d61 7472 6978 7d0a 785c 5c0a 795c 5c0a matrix}.x\\.y\\. │ │ │ +000be6e0: 7a5c 5c0a 5c65 6e64 7b62 6d61 7472 6978 z\\.\end{bmatrix │ │ │ +000be6f0: 7d0a 3d0a 5c62 6567 696e 7b62 6d61 7472 }.=.\begin{bmatr │ │ │ +000be700: 6978 7d0a 585c 5c0a 595c 5c0a 5a5c 5c0a ix}.X\\.Y\\.Z\\. │ │ │ +000be710: 5c65 6e64 7b62 6d61 7472 6978 7d0a 2b0a \end{bmatrix}.+. │ │ │ +000be720: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ +000be730: 625f 315c 5c0a 625f 325c 5c0a 625f 335c b_1\\.b_2\\.b_3\ │ │ │ +000be740: 5c0a 5c65 6e64 7b62 6d61 7472 6978 7d0a \.\end{bmatrix}. │ │ │ +000be750: 5c29 3c2f 6469 763e 0a3c 646c 2063 6c61 \)
    .
    .
    │ │ │ +000be770: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ +000be780: 0a3c 6464 3e3c 636f 6465 3e73 7263 3c2f .
    src - First in │ │ │ +000be7a0: 7075 7420 3344 2070 6f69 6e74 2073 6574 put 3D point set │ │ │ +000be7b0: 2063 6f6e 7461 696e 696e 6720 5c28 2858 containing \((X │ │ │ +000be7c0: 2c59 2c5a 295c 292e 3c2f 6464 3e0a 3c64 ,Y,Z)\).
    .dst - Second inpu │ │ │ +000be7f0: 7420 3344 2070 6f69 6e74 2073 6574 2063 t 3D point set c │ │ │ +000be800: 6f6e 7461 696e 696e 6720 5c28 2878 2c79 ontaining \((x,y │ │ │ +000be810: 2c7a 295c 292e 3c2f 6464 3e0a 3c64 643e ,z)\)..
    │ │ │ +000be820: 3c63 6f64 653e 6f75 743c 2f63 6f64 653e out │ │ │ +000be830: 202d 204f 7574 7075 7420 3344 2074 7261 - Output 3D tra │ │ │ +000be840: 6e73 6c61 7469 6f6e 2076 6563 746f 7220 nslation vector │ │ │ +000be850: 5c28 3320 5c74 696d 6573 2031 5c29 206f \(3 \times 1\) o │ │ │ +000be860: 6620 7468 6520 666f 726d 0a5c 280a 5c62 f the form.\(.\b │ │ │ +000be870: 6567 696e 7b62 6d61 7472 6978 7d0a 625f egin{bmatrix}.b_ │ │ │ +000be880: 3120 5c5c 0a62 5f32 205c 5c0a 625f 3320 1 \\.b_2 \\.b_3 │ │ │ +000be890: 5c5c 0a5c 656e 647b 626d 6174 7269 787d \\.\end{bmatrix} │ │ │ +000be8a0: 0a5c 293c 2f64 643e 0a3c 6464 3e3c 636f .\)
    .
    inliers - Output vecto │ │ │ +000be8d0: 7220 696e 6469 6361 7469 6e67 2077 6869 r indicating whi │ │ │ +000be8e0: 6368 2070 6f69 6e74 7320 6172 6520 696e ch points are in │ │ │ +000be8f0: 6c69 6572 7320 2831 2d69 6e6c 6965 722c liers (1-inlier, │ │ │ +000be900: 2030 2d6f 7574 6c69 6572 292e 3c2f 6464 0-outlier).
    .
    rans │ │ │ +000be920: 6163 5468 7265 7368 6f6c 643c 2f63 6f64 acThreshold - Maximum rep │ │ │ +000be940: 726f 6a65 6374 696f 6e20 6572 726f 7220 rojection error │ │ │ +000be950: 696e 2074 6865 2052 414e 5341 4320 616c in the RANSAC al │ │ │ +000be960: 676f 7269 7468 6d20 746f 2063 6f6e 7369 gorithm to consi │ │ │ +000be970: 6465 7220 6120 706f 696e 7420 6173 0a61 der a point as.a │ │ │ +000be980: 6e20 696e 6c69 6572 2e0a 6265 7477 6565 n inlier..betwee │ │ │ +000be990: 6e20 302e 3935 2061 6e64 2030 2e39 3920 n 0.95 and 0.99 │ │ │ +000be9a0: 6973 2075 7375 616c 6c79 2067 6f6f 6420 is usually good │ │ │ +000be9b0: 656e 6f75 6768 2e20 5661 6c75 6573 2074 enough. Values t │ │ │ +000be9c0: 6f6f 2063 6c6f 7365 2074 6f20 3120 6361 oo close to 1 ca │ │ │ +000be9d0: 6e20 736c 6f77 2064 6f77 6e20 7468 6520 n slow down the │ │ │ +000be9e0: 6573 7469 6d61 7469 6f6e 0a73 6967 6e69 estimation.signi │ │ │ +000be9f0: 6669 6361 6e74 6c79 2e20 5661 6c75 6573 ficantly. Values │ │ │ +000bea00: 206c 6f77 6572 2074 6861 6e20 302e 382d lower than 0.8- │ │ │ +000bea10: 302e 3920 6361 6e20 7265 7375 6c74 2069 0.9 can result i │ │ │ +000bea20: 6e20 616e 2069 6e63 6f72 7265 6374 6c79 n an incorrectly │ │ │ +000bea30: 2065 7374 696d 6174 6564 2074 7261 6e73 estimated trans │ │ │ +000bea40: 666f 726d 6174 696f 6e2e 3c2f 6464 3e0a formation.
    . │ │ │ +000bea50: 3c64 743e 5265 7475 726e 733a 3c2f 6474
    Returns:
    .
    Whether a │ │ │ +000bea70: 7472 616e 736c 6174 696f 6e20 7761 7320 translation was │ │ │ +000bea80: 666f 756e 642e 0a0a 5468 6520 6675 6e63 found...The func │ │ │ +000bea90: 7469 6f6e 2065 7374 696d 6174 6573 2061 tion estimates a │ │ │ +000beaa0: 6e20 6f70 7469 6d61 6c20 3344 2074 7261 n optimal 3D tra │ │ │ +000beab0: 6e73 6c61 7469 6f6e 2062 6574 7765 656e nslation between │ │ │ +000beac0: 2074 776f 2033 4420 706f 696e 7420 7365 two 3D point se │ │ │ +000bead0: 7473 2075 7369 6e67 2074 6865 0a52 414e ts using the.RAN │ │ │ +000beae0: 5341 4320 616c 676f 7269 7468 6d2e 3c2f SAC algorithm..
    .
    │ │ │ +000beb00: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
    .
  • .
  • .
    .

    │ │ │ +000beba0: 6573 7469 6d61 7465 5472 616e 736c 6174 estimateTranslat │ │ │ +000bebb0: 696f 6e33 443c 2f68 333e 0a3c 6469 7620 ion3D

    .
    .
    public static boolean estimateTran │ │ │ +000bec80: 736c 6174 696f 6e33 443c 2f73 7061 6e3e slation3D │ │ │ +000bec90: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ +000becb0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000becc0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000becd0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000bece0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat src,. Mat dst,. Mat │ │ │ +000bed90: 266e 6273 703b 6f75 742c 0a20 3c61 2068  out,. Mat& │ │ │ +000bede0: 6e62 7370 3b69 6e6c 6965 7273 293c 2f73 nbsp;inliers)
    .
    Co │ │ │ +000bee10: 6d70 7574 6573 2061 6e20 6f70 7469 6d61 mputes an optima │ │ │ +000bee20: 6c20 7472 616e 736c 6174 696f 6e20 6265 l translation be │ │ │ +000bee30: 7477 6565 6e20 7477 6f20 3344 2070 6f69 tween two 3D poi │ │ │ +000bee40: 6e74 2073 6574 732e 0a0a 4974 2063 6f6d nt sets...It com │ │ │ +000bee50: 7075 7465 730a 5c28 0a5c 6265 6769 6e7b putes.\(.\begin{ │ │ │ +000bee60: 626d 6174 7269 787d 0a78 5c5c 0a79 5c5c bmatrix}.x\\.y\\ │ │ │ +000bee70: 0a7a 5c5c 0a5c 656e 647b 626d 6174 7269 .z\\.\end{bmatri │ │ │ +000bee80: 787d 0a3d 0a5c 6265 6769 6e7b 626d 6174 x}.=.\begin{bmat │ │ │ +000bee90: 7269 787d 0a58 5c5c 0a59 5c5c 0a5a 5c5c rix}.X\\.Y\\.Z\\ │ │ │ +000beea0: 0a5c 656e 647b 626d 6174 7269 787d 0a2b .\end{bmatrix}.+ │ │ │ +000beeb0: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ +000beec0: 0a62 5f31 5c5c 0a62 5f32 5c5c 0a62 5f33 .b_1\\.b_2\\.b_3 │ │ │ +000beed0: 5c5c 0a5c 656e 647b 626d 6174 7269 787d \\.\end{bmatrix} │ │ │ +000beee0: 0a5c 293c 2f64 6976 3e0a 3c64 6c20 636c .\)
    .
    .
    Parameters:
    .
    src< │ │ │ +000bef20: 2f63 6f64 653e 202d 2046 6972 7374 2069 /code> - First i │ │ │ +000bef30: 6e70 7574 2033 4420 706f 696e 7420 7365 nput 3D point se │ │ │ +000bef40: 7420 636f 6e74 6169 6e69 6e67 205c 2828 t containing \(( │ │ │ +000bef50: 582c 592c 5a29 5c29 2e3c 2f64 643e 0a3c X,Y,Z)\).
    .< │ │ │ +000bef60: 6464 3e3c 636f 6465 3e64 7374 3c2f 636f dd>dst - Second inp │ │ │ +000bef80: 7574 2033 4420 706f 696e 7420 7365 7420 ut 3D point set │ │ │ +000bef90: 636f 6e74 6169 6e69 6e67 205c 2828 782c containing \((x, │ │ │ +000befa0: 792c 7a29 5c29 2e3c 2f64 643e 0a3c 6464 y,z)\)..
    out - Output 3D tr │ │ │ +000befd0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ +000befe0: 205c 2833 205c 7469 6d65 7320 315c 2920 \(3 \times 1\) │ │ │ +000beff0: 6f66 2074 6865 2066 6f72 6d0a 5c28 0a5c of the form.\(.\ │ │ │ +000bf000: 6265 6769 6e7b 626d 6174 7269 787d 0a62 begin{bmatrix}.b │ │ │ +000bf010: 5f31 205c 5c0a 625f 3220 5c5c 0a62 5f33 _1 \\.b_2 \\.b_3 │ │ │ +000bf020: 205c 5c0a 5c65 6e64 7b62 6d61 7472 6978 \\.\end{bmatrix │ │ │ +000bf030: 7d0a 5c29 3c2f 6464 3e0a 3c64 643e 3c63 }.\)
    .
    inliers - Output vect │ │ │ +000bf060: 6f72 2069 6e64 6963 6174 696e 6720 7768 or indicating wh │ │ │ +000bf070: 6963 6820 706f 696e 7473 2061 7265 2069 ich points are i │ │ │ +000bf080: 6e6c 6965 7273 2028 312d 696e 6c69 6572 nliers (1-inlier │ │ │ +000bf090: 2c20 302d 6f75 746c 6965 7229 2e0a 616e , 0-outlier)..an │ │ │ +000bf0a0: 2069 6e6c 6965 722e 0a62 6574 7765 656e inlier..between │ │ │ +000bf0b0: 2030 2e39 3520 616e 6420 302e 3939 2069 0.95 and 0.99 i │ │ │ +000bf0c0: 7320 7573 7561 6c6c 7920 676f 6f64 2065 s usually good e │ │ │ +000bf0d0: 6e6f 7567 682e 2056 616c 7565 7320 746f nough. Values to │ │ │ +000bf0e0: 6f20 636c 6f73 6520 746f 2031 2063 616e o close to 1 can │ │ │ +000bf0f0: 2073 6c6f 7720 646f 776e 2074 6865 2065 slow down the e │ │ │ +000bf100: 7374 696d 6174 696f 6e0a 7369 676e 6966 stimation.signif │ │ │ +000bf110: 6963 616e 746c 792e 2056 616c 7565 7320 icantly. Values │ │ │ +000bf120: 6c6f 7765 7220 7468 616e 2030 2e38 2d30 lower than 0.8-0 │ │ │ +000bf130: 2e39 2063 616e 2072 6573 756c 7420 696e .9 can result in │ │ │ +000bf140: 2061 6e20 696e 636f 7272 6563 746c 7920 an incorrectly │ │ │ +000bf150: 6573 7469 6d61 7465 6420 7472 616e 7366 estimated transf │ │ │ +000bf160: 6f72 6d61 7469 6f6e 2e3c 2f64 643e 0a3c ormation.
    .< │ │ │ +000bf170: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ +000bf180: 0a3c 6464 3e57 6865 7468 6572 2061 2074 .
    Whether a t │ │ │ +000bf190: 7261 6e73 6c61 7469 6f6e 2077 6173 2066 ranslation was f │ │ │ +000bf1a0: 6f75 6e64 2e0a 0a54 6865 2066 756e 6374 ound...The funct │ │ │ +000bf1b0: 696f 6e20 6573 7469 6d61 7465 7320 616e ion estimates an │ │ │ +000bf1c0: 206f 7074 696d 616c 2033 4420 7472 616e optimal 3D tran │ │ │ +000bf1d0: 736c 6174 696f 6e20 6265 7477 6565 6e20 slation between │ │ │ +000bf1e0: 7477 6f20 3344 2070 6f69 6e74 2073 6574 two 3D point set │ │ │ +000bf1f0: 7320 7573 696e 6720 7468 650a 5241 4e53 s using the.RANS │ │ │ +000bf200: 4143 2061 6c67 6f72 6974 686d 2e3c 2f64 AC algorithm..
    .
    . │ │ │ +000bf220: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e
    .
  • │ │ │ +000bf230: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .estimateAffine │ │ │ +000bf2d0: 3244 3c2f 6833 3e0a 3c64 6976 2063 6c61 2D.
    .
    pu │ │ │ +000bf330: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static Ma │ │ │ +000bf3a0: 743c 2f61 3e3c 2f73 7061 6e3e 266e 6273 t&nbs │ │ │ +000bf3b0: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;est │ │ │ +000bf3d0: 696d 6174 6541 6666 696e 6532 443c 2f73 imateAffine2D(M │ │ │ +000bf440: 6174 3c2f 613e 266e 6273 703b 6672 6f6d at from │ │ │ +000bf450: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000bf490: 6174 3c2f 613e 266e 6273 703b 746f 2c0a at to,. │ │ │ +000bf4a0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000bf4e0: 3c2f 613e 266e 6273 703b 696e 6c69 6572  inlier │ │ │ +000bf4f0: 732c 0a20 696e 7426 6e62 7370 3b6d 6574 s,. int met │ │ │ +000bf500: 686f 642c 0a20 646f 7562 6c65 266e 6273 hod,. double&nbs │ │ │ +000bf510: 703b 7261 6e73 6163 5265 7072 6f6a 5468 p;ransacReprojTh │ │ │ +000bf520: 7265 7368 6f6c 642c 0a20 6c6f 6e67 266e reshold,. long&n │ │ │ +000bf530: 6273 703b 6d61 7849 7465 7273 2c0a 2064 bsp;maxIters,. d │ │ │ +000bf540: 6f75 626c 6526 6e62 7370 3b63 6f6e 6669 ouble confi │ │ │ +000bf550: 6465 6e63 652c 0a20 6c6f 6e67 266e 6273 dence,. long&nbs │ │ │ +000bf560: 703b 7265 6669 6e65 4974 6572 7329 3c2f p;refineIters)
    .
    C │ │ │ +000bf590: 6f6d 7075 7465 7320 616e 206f 7074 696d omputes an optim │ │ │ +000bf5a0: 616c 2061 6666 696e 6520 7472 616e 7366 al affine transf │ │ │ +000bf5b0: 6f72 6d61 7469 6f6e 2062 6574 7765 656e ormation between │ │ │ +000bf5c0: 2074 776f 2032 4420 706f 696e 7420 7365 two 2D point se │ │ │ +000bf5d0: 7473 2e0a 0a49 7420 636f 6d70 7574 6573 ts...It computes │ │ │ +000bf5e0: 0a5c 280a 5c62 6567 696e 7b62 6d61 7472 .\(.\begin{bmatr │ │ │ +000bf5f0: 6978 7d0a 785c 5c0a 795c 5c0a 5c65 6e64 ix}.x\\.y\\.\end │ │ │ +000bf600: 7b62 6d61 7472 6978 7d0a 3d0a 5c62 6567 {bmatrix}.=.\beg │ │ │ +000bf610: 696e 7b62 6d61 7472 6978 7d0a 615f 7b31 in{bmatrix}.a_{1 │ │ │ +000bf620: 317d 2026 616d 703b 2061 5f7b 3132 7d5c 1} & a_{12}\ │ │ │ +000bf630: 5c0a 615f 7b32 317d 2026 616d 703b 2061 \.a_{21} & a │ │ │ +000bf640: 5f7b 3232 7d5c 5c0a 5c65 6e64 7b62 6d61 _{22}\\.\end{bma │ │ │ +000bf650: 7472 6978 7d0a 5c62 6567 696e 7b62 6d61 trix}.\begin{bma │ │ │ +000bf660: 7472 6978 7d0a 585c 5c0a 595c 5c0a 5c65 trix}.X\\.Y\\.\e │ │ │ +000bf670: 6e64 7b62 6d61 7472 6978 7d0a 2b0a 5c62 nd{bmatrix}.+.\b │ │ │ +000bf680: 6567 696e 7b62 6d61 7472 6978 7d0a 625f egin{bmatrix}.b_ │ │ │ +000bf690: 315c 5c0a 625f 325c 5c0a 5c65 6e64 7b62 1\\.b_2\\.\end{b │ │ │ +000bf6a0: 6d61 7472 6978 7d0a 5c29 3c2f 6469 763e matrix}.\)
    │ │ │ +000bf6b0: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ +000bf6d0: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    from - │ │ │ +000bf6f0: 2046 6972 7374 2069 6e70 7574 2032 4420 First input 2D │ │ │ +000bf700: 706f 696e 7420 7365 7420 636f 6e74 6169 point set contai │ │ │ +000bf710: 6e69 6e67 205c 2828 582c 5929 5c29 2e3c ning \((X,Y)\).< │ │ │ +000bf720: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ +000bf730: 6f3c 2f63 6f64 653e 202d 2053 6563 6f6e o - Secon │ │ │ +000bf740: 6420 696e 7075 7420 3244 2070 6f69 6e74 d input 2D point │ │ │ +000bf750: 2073 6574 2063 6f6e 7461 696e 696e 6720 set containing │ │ │ +000bf760: 5c28 2878 2c79 295c 292e 3c2f 6464 3e0a \((x,y)\).
    . │ │ │ +000bf770: 3c64 643e 3c63 6f64 653e 696e 6c69 6572
    inlier │ │ │ +000bf780: 733c 2f63 6f64 653e 202d 204f 7574 7075 s - Outpu │ │ │ +000bf790: 7420 7665 6374 6f72 2069 6e64 6963 6174 t vector indicat │ │ │ +000bf7a0: 696e 6720 7768 6963 6820 706f 696e 7473 ing which points │ │ │ +000bf7b0: 2061 7265 2069 6e6c 6965 7273 2028 312d are inliers (1- │ │ │ +000bf7c0: 696e 6c69 6572 2c20 302d 6f75 746c 6965 inlier, 0-outlie │ │ │ +000bf7d0: 7229 2e3c 2f64 643e 0a3c 6464 3e3c 636f r).
    .
    method │ │ │ +000bf7f0: 202d 2052 6f62 7573 7420 6d65 7468 6f64 - Robust method │ │ │ +000bf800: 2075 7365 6420 746f 2063 6f6d 7075 7465 used to compute │ │ │ +000bf810: 2074 7261 6e73 666f 726d 6174 696f 6e2e transformation. │ │ │ +000bf820: 2054 6865 2066 6f6c 6c6f 7769 6e67 206d The following m │ │ │ +000bf830: 6574 686f 6473 2061 7265 2070 6f73 7369 ethods are possi │ │ │ +000bf840: 626c 653a 0a3c 756c 3e0a 2020 3c6c 693e ble:.
      .
    • │ │ │ +000bf850: 0a20 2020 5245 463a 2052 414e 5341 4320 . REF: RANSAC │ │ │ +000bf860: 2d20 5241 4e53 4143 2d62 6173 6564 2072 - RANSAC-based r │ │ │ +000bf870: 6f62 7573 7420 6d65 7468 6f64 0a20 203c obust method. < │ │ │ +000bf880: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2052 /li>.
    • . R │ │ │ +000bf890: 4546 3a20 4c4d 4544 5320 2d20 4c65 6173 EF: LMEDS - Leas │ │ │ +000bf8a0: 742d 4d65 6469 616e 2072 6f62 7573 7420 t-Median robust │ │ │ +000bf8b0: 6d65 7468 6f64 0a52 414e 5341 4320 6973 method.RANSAC is │ │ │ +000bf8c0: 2074 6865 2064 6566 6175 6c74 206d 6574 the default met │ │ │ +000bf8d0: 686f 642e 0a20 203c 2f6c 693e 0a3c 2f75 hod..
    • .
    .
    ransacReprojTh │ │ │ +000bf900: 7265 7368 6f6c 643c 2f63 6f64 653e 202d reshold - │ │ │ +000bf910: 204d 6178 696d 756d 2072 6570 726f 6a65 Maximum reproje │ │ │ +000bf920: 6374 696f 6e20 6572 726f 7220 696e 2074 ction error in t │ │ │ +000bf930: 6865 2052 414e 5341 4320 616c 676f 7269 he RANSAC algori │ │ │ +000bf940: 7468 6d20 746f 2063 6f6e 7369 6465 720a thm to consider. │ │ │ +000bf950: 6120 706f 696e 7420 6173 2061 6e20 696e a point as an in │ │ │ +000bf960: 6c69 6572 2e20 4170 706c 6965 7320 6f6e lier. Applies on │ │ │ +000bf970: 6c79 2074 6f20 5241 4e53 4143 2e3c 2f64 ly to RANSAC..
    max │ │ │ +000bf990: 4974 6572 733c 2f63 6f64 653e 202d 2054 Iters - T │ │ │ +000bf9a0: 6865 206d 6178 696d 756d 206e 756d 6265 he maximum numbe │ │ │ +000bf9b0: 7220 6f66 2072 6f62 7573 7420 6d65 7468 r of robust meth │ │ │ +000bf9c0: 6f64 2069 7465 7261 7469 6f6e 732e 3c2f od iterations..
    co │ │ │ +000bf9e0: 6e66 6964 656e 6365 3c2f 636f 6465 3e20 nfidence │ │ │ +000bf9f0: 2d20 436f 6e66 6964 656e 6365 206c 6576 - Confidence lev │ │ │ +000bfa00: 656c 2c20 6265 7477 6565 6e20 3020 616e el, between 0 an │ │ │ +000bfa10: 6420 312c 2066 6f72 2074 6865 2065 7374 d 1, for the est │ │ │ +000bfa20: 696d 6174 6564 2074 7261 6e73 666f 726d imated transform │ │ │ +000bfa30: 6174 696f 6e2e 2041 6e79 7468 696e 670a ation. Anything. │ │ │ +000bfa40: 6265 7477 6565 6e20 302e 3935 2061 6e64 between 0.95 and │ │ │ +000bfa50: 2030 2e39 3920 6973 2075 7375 616c 6c79 0.99 is usually │ │ │ +000bfa60: 2067 6f6f 6420 656e 6f75 6768 2e20 5661 good enough. Va │ │ │ +000bfa70: 6c75 6573 2074 6f6f 2063 6c6f 7365 2074 lues too close t │ │ │ +000bfa80: 6f20 3120 6361 6e20 736c 6f77 2064 6f77 o 1 can slow dow │ │ │ +000bfa90: 6e20 7468 6520 6573 7469 6d61 7469 6f6e n the estimation │ │ │ +000bfaa0: 0a73 6967 6e69 6669 6361 6e74 6c79 2e20 .significantly. │ │ │ +000bfab0: 5661 6c75 6573 206c 6f77 6572 2074 6861 Values lower tha │ │ │ +000bfac0: 6e20 302e 382d 302e 3920 6361 6e20 7265 n 0.8-0.9 can re │ │ │ +000bfad0: 7375 6c74 2069 6e20 616e 2069 6e63 6f72 sult in an incor │ │ │ +000bfae0: 7265 6374 6c79 2065 7374 696d 6174 6564 rectly estimated │ │ │ +000bfaf0: 2074 7261 6e73 666f 726d 6174 696f 6e2e transformation. │ │ │ +000bfb00: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000bfb10: 7265 6669 6e65 4974 6572 733c 2f63 6f64 refineIters - Maximum num │ │ │ +000bfb30: 6265 7220 6f66 2069 7465 7261 7469 6f6e ber of iteration │ │ │ +000bfb40: 7320 6f66 2072 6566 696e 696e 6720 616c s of refining al │ │ │ +000bfb50: 676f 7269 7468 6d20 284c 6576 656e 6265 gorithm (Levenbe │ │ │ +000bfb60: 7267 2d4d 6172 7175 6172 6474 292e 0a50 rg-Marquardt)..P │ │ │ +000bfb70: 6173 7369 6e67 2030 2077 696c 6c20 6469 assing 0 will di │ │ │ +000bfb80: 7361 626c 6520 7265 6669 6e69 6e67 2c20 sable refining, │ │ │ +000bfb90: 736f 2074 6865 206f 7574 7075 7420 6d61 so the output ma │ │ │ +000bfba0: 7472 6978 2077 696c 6c20 6265 206f 7574 trix will be out │ │ │ +000bfbb0: 7075 7420 6f66 2072 6f62 7573 7420 6d65 put of robust me │ │ │ +000bfbc0: 7468 6f64 2e3c 2f64 643e 0a3c 6474 3e52 thod.
    .
    R │ │ │ +000bfbd0: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    Output 2D affin │ │ │ +000bfbf0: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ +000bfc00: 206d 6174 7269 7820 5c28 3220 5c74 696d matrix \(2 \tim │ │ │ +000bfc10: 6573 2033 5c29 206f 7220 656d 7074 7920 es 3\) or empty │ │ │ +000bfc20: 6d61 7472 6978 2069 6620 7472 616e 7366 matrix if transf │ │ │ +000bfc30: 6f72 6d61 7469 6f6e 0a63 6f75 6c64 206e ormation.could n │ │ │ +000bfc40: 6f74 2062 6520 6573 7469 6d61 7465 642e ot be estimated. │ │ │ +000bfc50: 2054 6865 2072 6574 7572 6e65 6420 6d61 The returned ma │ │ │ +000bfc60: 7472 6978 2068 6173 2074 6865 2066 6f6c trix has the fol │ │ │ +000bfc70: 6c6f 7769 6e67 2066 6f72 6d3a 0a5c 280a lowing form:.\(. │ │ │ +000bfc80: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ +000bfc90: 615f 7b31 317d 2026 616d 703b 2061 5f7b a_{11} & a_{ │ │ │ +000bfca0: 3132 7d20 2661 6d70 3b20 625f 315c 5c0a 12} & b_1\\. │ │ │ +000bfcb0: 615f 7b32 317d 2026 616d 703b 2061 5f7b a_{21} & a_{ │ │ │ +000bfcc0: 3232 7d20 2661 6d70 3b20 625f 325c 5c0a 22} & b_2\\. │ │ │ +000bfcd0: 5c65 6e64 7b62 6d61 7472 6978 7d0a 5c29 \end{bmatrix}.\) │ │ │ +000bfce0: 0a0a 5468 6520 6675 6e63 7469 6f6e 2065 ..The function e │ │ │ +000bfcf0: 7374 696d 6174 6573 2061 6e20 6f70 7469 stimates an opti │ │ │ +000bfd00: 6d61 6c20 3244 2061 6666 696e 6520 7472 mal 2D affine tr │ │ │ +000bfd10: 616e 7366 6f72 6d61 7469 6f6e 2062 6574 ansformation bet │ │ │ +000bfd20: 7765 656e 2074 776f 2032 4420 706f 696e ween two 2D poin │ │ │ +000bfd30: 7420 7365 7473 2075 7369 6e67 2074 6865 t sets using the │ │ │ +000bfd40: 0a73 656c 6563 7465 6420 726f 6275 7374 .selected robust │ │ │ +000bfd50: 2061 6c67 6f72 6974 686d 2e0a 0a54 6865 algorithm...The │ │ │ +000bfd60: 2063 6f6d 7075 7465 6420 7472 616e 7366 computed transf │ │ │ +000bfd70: 6f72 6d61 7469 6f6e 2069 7320 7468 656e ormation is then │ │ │ +000bfd80: 2072 6566 696e 6564 2066 7572 7468 6572 refined further │ │ │ +000bfd90: 2028 7573 696e 6720 6f6e 6c79 2069 6e6c (using only inl │ │ │ +000bfda0: 6965 7273 2920 7769 7468 2074 6865 0a4c iers) with the.L │ │ │ +000bfdb0: 6576 656e 6265 7267 2d4d 6172 7175 6172 evenberg-Marquar │ │ │ +000bfdc0: 6474 206d 6574 686f 6420 746f 2072 6564 dt method to red │ │ │ +000bfdd0: 7563 6520 7468 6520 7265 2d70 726f 6a65 uce the re-proje │ │ │ +000bfde0: 6374 696f 6e20 6572 726f 7220 6576 656e ction error even │ │ │ +000bfdf0: 206d 6f72 652e 0a0a 3c62 3e4e 6f74 653a more...Note: │ │ │ +000bfe00: 3c2f 623e 0a54 6865 2052 414e 5341 4320 .The RANSAC │ │ │ +000bfe10: 6d65 7468 6f64 2063 616e 2068 616e 646c method can handl │ │ │ +000bfe20: 6520 7072 6163 7469 6361 6c6c 7920 616e e practically an │ │ │ +000bfe30: 7920 7261 7469 6f20 6f66 206f 7574 6c69 y ratio of outli │ │ │ +000bfe40: 6572 7320 6275 7420 6e65 6564 7320 6120 ers but needs a │ │ │ +000bfe50: 7468 7265 7368 6f6c 6420 746f 0a64 6973 threshold to.dis │ │ │ +000bfe60: 7469 6e67 7569 7368 2069 6e6c 6965 7273 tinguish inliers │ │ │ +000bfe70: 2066 726f 6d20 6f75 746c 6965 7273 2e20 from outliers. │ │ │ +000bfe80: 5468 6520 6d65 7468 6f64 204c 4d65 4453 The method LMeDS │ │ │ +000bfe90: 2064 6f65 7320 6e6f 7420 6e65 6564 2061 does not need a │ │ │ +000bfea0: 6e79 2074 6872 6573 686f 6c64 2062 7574 ny threshold but │ │ │ +000bfeb0: 2069 7420 776f 726b 730a 636f 7272 6563 it works.correc │ │ │ +000bfec0: 746c 7920 6f6e 6c79 2077 6865 6e20 7468 tly only when th │ │ │ +000bfed0: 6572 6520 6172 6520 6d6f 7265 2074 6861 ere are more tha │ │ │ +000bfee0: 6e20 3530 2520 6f66 2069 6e6c 6965 7273 n 50% of inliers │ │ │ +000bfef0: 2e0a 0a53 4545 3a20 6573 7469 6d61 7465 ...SEE: estimate │ │ │ +000bff00: 4166 6669 6e65 5061 7274 6961 6c32 442c AffinePartial2D, │ │ │ +000bff10: 2067 6574 4166 6669 6e65 5472 616e 7366 getAffineTransf │ │ │ +000bff20: 6f72 6d3c 2f64 643e 0a3c 2f64 6c3e 0a3c orm
    .
    .< │ │ │ +000bff30: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ +000bff40: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..< │ │ │ +000bffd0: 6833 3e65 7374 696d 6174 6541 6666 696e h3>estimateAffin │ │ │ +000bffe0: 6532 443c 2f68 333e 0a3c 6469 7620 636c e2D.
    .
    p │ │ │ +000c0040: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static M │ │ │ +000c00b0: 6174 3c2f 613e 3c2f 7370 616e 3e26 6e62 at&nb │ │ │ +000c00c0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;es │ │ │ +000c00e0: 7469 6d61 7465 4166 6669 6e65 3244 3c2f timateAffine2D( │ │ │ +000c0150: 4d61 743c 2f61 3e26 6e62 7370 3b66 726f Mat fro │ │ │ +000c0160: 6d2c 0a20 3c61 2068 7265 663d 222e 2e2f m,. │ │ │ +000c01a0: 4d61 743c 2f61 3e26 6e62 7370 3b74 6f2c Mat to, │ │ │ +000c01b0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000c01f0: 743c 2f61 3e26 6e62 7370 3b69 6e6c 6965 t inlie │ │ │ +000c0200: 7273 2c0a 2069 6e74 266e 6273 703b 6d65 rs,. int me │ │ │ +000c0210: 7468 6f64 2c0a 2064 6f75 626c 6526 6e62 thod,. double&nb │ │ │ +000c0220: 7370 3b72 616e 7361 6352 6570 726f 6a54 sp;ransacReprojT │ │ │ +000c0230: 6872 6573 686f 6c64 2c0a 206c 6f6e 6726 hreshold,. long& │ │ │ +000c0240: 6e62 7370 3b6d 6178 4974 6572 732c 0a20 nbsp;maxIters,. │ │ │ +000c0250: 646f 7562 6c65 266e 6273 703b 636f 6e66 double conf │ │ │ +000c0260: 6964 656e 6365 293c 2f73 7061 6e3e 3c2f idence).
    Computes │ │ │ +000c0290: 2061 6e20 6f70 7469 6d61 6c20 6166 6669 an optimal affi │ │ │ +000c02a0: 6e65 2074 7261 6e73 666f 726d 6174 696f ne transformatio │ │ │ +000c02b0: 6e20 6265 7477 6565 6e20 7477 6f20 3244 n between two 2D │ │ │ +000c02c0: 2070 6f69 6e74 2073 6574 732e 0a0a 4974 point sets...It │ │ │ +000c02d0: 2063 6f6d 7075 7465 730a 5c28 0a5c 6265 computes.\(.\be │ │ │ +000c02e0: 6769 6e7b 626d 6174 7269 787d 0a78 5c5c gin{bmatrix}.x\\ │ │ │ +000c02f0: 0a79 5c5c 0a5c 656e 647b 626d 6174 7269 .y\\.\end{bmatri │ │ │ +000c0300: 787d 0a3d 0a5c 6265 6769 6e7b 626d 6174 x}.=.\begin{bmat │ │ │ +000c0310: 7269 787d 0a61 5f7b 3131 7d20 2661 6d70 rix}.a_{11} & │ │ │ +000c0320: 3b20 615f 7b31 327d 5c5c 0a61 5f7b 3231 ; a_{12}\\.a_{21 │ │ │ +000c0330: 7d20 2661 6d70 3b20 615f 7b32 327d 5c5c } & a_{22}\\ │ │ │ +000c0340: 0a5c 656e 647b 626d 6174 7269 787d 0a5c .\end{bmatrix}.\ │ │ │ +000c0350: 6265 6769 6e7b 626d 6174 7269 787d 0a58 begin{bmatrix}.X │ │ │ +000c0360: 5c5c 0a59 5c5c 0a5c 656e 647b 626d 6174 \\.Y\\.\end{bmat │ │ │ +000c0370: 7269 787d 0a2b 0a5c 6265 6769 6e7b 626d rix}.+.\begin{bm │ │ │ +000c0380: 6174 7269 787d 0a62 5f31 5c5c 0a62 5f32 atrix}.b_1\\.b_2 │ │ │ +000c0390: 5c5c 0a5c 656e 647b 626d 6174 7269 787d \\.\end{bmatrix} │ │ │ +000c03a0: 0a5c 293c 2f64 6976 3e0a 3c64 6c20 636c .\)
    .
    .
    Parameters:
    .
    from │ │ │ +000c03e0: 3c2f 636f 6465 3e20 2d20 4669 7273 7420 - First │ │ │ +000c03f0: 696e 7075 7420 3244 2070 6f69 6e74 2073 input 2D point s │ │ │ +000c0400: 6574 2063 6f6e 7461 696e 696e 6720 5c28 et containing \( │ │ │ +000c0410: 2858 2c59 295c 292e 3c2f 6464 3e0a 3c64 (X,Y)\).
    .to - Second input │ │ │ +000c0440: 2032 4420 706f 696e 7420 7365 7420 636f 2D point set co │ │ │ +000c0450: 6e74 6169 6e69 6e67 205c 2828 782c 7929 ntaining \((x,y) │ │ │ +000c0460: 5c29 2e3c 2f64 643e 0a3c 6464 3e3c 636f \)..
    inliers - Output vecto │ │ │ +000c0490: 7220 696e 6469 6361 7469 6e67 2077 6869 r indicating whi │ │ │ +000c04a0: 6368 2070 6f69 6e74 7320 6172 6520 696e ch points are in │ │ │ +000c04b0: 6c69 6572 7320 2831 2d69 6e6c 6965 722c liers (1-inlier, │ │ │ +000c04c0: 2030 2d6f 7574 6c69 6572 292e 3c2f 6464 0-outlier).
    .
    meth │ │ │ +000c04e0: 6f64 3c2f 636f 6465 3e20 2d20 526f 6275 od - Robu │ │ │ +000c04f0: 7374 206d 6574 686f 6420 7573 6564 2074 st method used t │ │ │ +000c0500: 6f20 636f 6d70 7574 6520 7472 616e 7366 o compute transf │ │ │ +000c0510: 6f72 6d61 7469 6f6e 2e20 5468 6520 666f ormation. The fo │ │ │ +000c0520: 6c6c 6f77 696e 6720 6d65 7468 6f64 7320 llowing methods │ │ │ +000c0530: 6172 6520 706f 7373 6962 6c65 3a0a 3c75 are possible:..
  • . REF │ │ │ +000c0550: 3a20 5241 4e53 4143 202d 2052 414e 5341 : RANSAC - RANSA │ │ │ +000c0560: 432d 6261 7365 6420 726f 6275 7374 206d C-based robust m │ │ │ +000c0570: 6574 686f 640a 2020 3c2f 6c69 3e0a 2020 ethod.
  • . │ │ │ +000c0580: 3c6c 693e 0a20 2020 5245 463a 204c 4d45
  • . REF: LME │ │ │ +000c0590: 4453 202d 204c 6561 7374 2d4d 6564 6961 DS - Least-Media │ │ │ +000c05a0: 6e20 726f 6275 7374 206d 6574 686f 640a n robust method. │ │ │ +000c05b0: 5241 4e53 4143 2069 7320 7468 6520 6465 RANSAC is the de │ │ │ +000c05c0: 6661 756c 7420 6d65 7468 6f64 2e0a 2020 fault method.. │ │ │ +000c05d0: 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64 643e
  • .
    │ │ │ +000c05e0: 0a3c 6464 3e3c 636f 6465 3e72 616e 7361 .
    ransa │ │ │ +000c05f0: 6352 6570 726f 6a54 6872 6573 686f 6c64 cReprojThreshold │ │ │ +000c0600: 3c2f 636f 6465 3e20 2d20 4d61 7869 6d75 - Maximu │ │ │ +000c0610: 6d20 7265 7072 6f6a 6563 7469 6f6e 2065 m reprojection e │ │ │ +000c0620: 7272 6f72 2069 6e20 7468 6520 5241 4e53 rror in the RANS │ │ │ +000c0630: 4143 2061 6c67 6f72 6974 686d 2074 6f20 AC algorithm to │ │ │ +000c0640: 636f 6e73 6964 6572 0a61 2070 6f69 6e74 consider.a point │ │ │ +000c0650: 2061 7320 616e 2069 6e6c 6965 722e 2041 as an inlier. A │ │ │ +000c0660: 7070 6c69 6573 206f 6e6c 7920 746f 2052 pplies only to R │ │ │ +000c0670: 414e 5341 432e 3c2f 6464 3e0a 3c64 643e ANSAC.
    .
    │ │ │ +000c0680: 3c63 6f64 653e 6d61 7849 7465 7273 3c2f maxIters - The maxi │ │ │ +000c06a0: 6d75 6d20 6e75 6d62 6572 206f 6620 726f mum number of ro │ │ │ +000c06b0: 6275 7374 206d 6574 686f 6420 6974 6572 bust method iter │ │ │ +000c06c0: 6174 696f 6e73 2e3c 2f64 643e 0a3c 6464 ations.
    .
    confidenc │ │ │ +000c06e0: 653c 2f63 6f64 653e 202d 2043 6f6e 6669 e - Confi │ │ │ +000c06f0: 6465 6e63 6520 6c65 7665 6c2c 2062 6574 dence level, bet │ │ │ +000c0700: 7765 656e 2030 2061 6e64 2031 2c20 666f ween 0 and 1, fo │ │ │ +000c0710: 7220 7468 6520 6573 7469 6d61 7465 6420 r the estimated │ │ │ +000c0720: 7472 616e 7366 6f72 6d61 7469 6f6e 2e20 transformation. │ │ │ +000c0730: 416e 7974 6869 6e67 0a62 6574 7765 656e Anything.between │ │ │ +000c0740: 2030 2e39 3520 616e 6420 302e 3939 2069 0.95 and 0.99 i │ │ │ +000c0750: 7320 7573 7561 6c6c 7920 676f 6f64 2065 s usually good e │ │ │ +000c0760: 6e6f 7567 682e 2056 616c 7565 7320 746f nough. Values to │ │ │ +000c0770: 6f20 636c 6f73 6520 746f 2031 2063 616e o close to 1 can │ │ │ +000c0780: 2073 6c6f 7720 646f 776e 2074 6865 2065 slow down the e │ │ │ +000c0790: 7374 696d 6174 696f 6e0a 7369 676e 6966 stimation.signif │ │ │ +000c07a0: 6963 616e 746c 792e 2056 616c 7565 7320 icantly. Values │ │ │ +000c07b0: 6c6f 7765 7220 7468 616e 2030 2e38 2d30 lower than 0.8-0 │ │ │ +000c07c0: 2e39 2063 616e 2072 6573 756c 7420 696e .9 can result in │ │ │ +000c07d0: 2061 6e20 696e 636f 7272 6563 746c 7920 an incorrectly │ │ │ +000c07e0: 6573 7469 6d61 7465 6420 7472 616e 7366 estimated transf │ │ │ +000c07f0: 6f72 6d61 7469 6f6e 2e0a 5061 7373 696e ormation..Passin │ │ │ +000c0800: 6720 3020 7769 6c6c 2064 6973 6162 6c65 g 0 will disable │ │ │ +000c0810: 2072 6566 696e 696e 672c 2073 6f20 7468 refining, so th │ │ │ +000c0820: 6520 6f75 7470 7574 206d 6174 7269 7820 e output matrix │ │ │ +000c0830: 7769 6c6c 2062 6520 6f75 7470 7574 206f will be output o │ │ │ +000c0840: 6620 726f 6275 7374 206d 6574 686f 642e f robust method. │ │ │ +000c0850: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ +000c0860: 733a 3c2f 6474 3e0a 3c64 643e 4f75 7470 s:
    .
    Outp │ │ │ +000c0870: 7574 2032 4420 6166 6669 6e65 2074 7261 ut 2D affine tra │ │ │ +000c0880: 6e73 666f 726d 6174 696f 6e20 6d61 7472 nsformation matr │ │ │ +000c0890: 6978 205c 2832 205c 7469 6d65 7320 335c ix \(2 \times 3\ │ │ │ +000c08a0: 2920 6f72 2065 6d70 7479 206d 6174 7269 ) or empty matri │ │ │ +000c08b0: 7820 6966 2074 7261 6e73 666f 726d 6174 x if transformat │ │ │ +000c08c0: 696f 6e0a 636f 756c 6420 6e6f 7420 6265 ion.could not be │ │ │ +000c08d0: 2065 7374 696d 6174 6564 2e20 5468 6520 estimated. The │ │ │ +000c08e0: 7265 7475 726e 6564 206d 6174 7269 7820 returned matrix │ │ │ +000c08f0: 6861 7320 7468 6520 666f 6c6c 6f77 696e has the followin │ │ │ +000c0900: 6720 666f 726d 3a0a 5c28 0a5c 6265 6769 g form:.\(.\begi │ │ │ +000c0910: 6e7b 626d 6174 7269 787d 0a61 5f7b 3131 n{bmatrix}.a_{11 │ │ │ +000c0920: 7d20 2661 6d70 3b20 615f 7b31 327d 2026 } & a_{12} & │ │ │ +000c0930: 616d 703b 2062 5f31 5c5c 0a61 5f7b 3231 amp; b_1\\.a_{21 │ │ │ +000c0940: 7d20 2661 6d70 3b20 615f 7b32 327d 2026 } & a_{22} & │ │ │ +000c0950: 616d 703b 2062 5f32 5c5c 0a5c 656e 647b amp; b_2\\.\end{ │ │ │ +000c0960: 626d 6174 7269 787d 0a5c 290a 0a54 6865 bmatrix}.\)..The │ │ │ +000c0970: 2066 756e 6374 696f 6e20 6573 7469 6d61 function estima │ │ │ +000c0980: 7465 7320 616e 206f 7074 696d 616c 2032 tes an optimal 2 │ │ │ +000c0990: 4420 6166 6669 6e65 2074 7261 6e73 666f D affine transfo │ │ │ +000c09a0: 726d 6174 696f 6e20 6265 7477 6565 6e20 rmation between │ │ │ +000c09b0: 7477 6f20 3244 2070 6f69 6e74 2073 6574 two 2D point set │ │ │ +000c09c0: 7320 7573 696e 6720 7468 650a 7365 6c65 s using the.sele │ │ │ +000c09d0: 6374 6564 2072 6f62 7573 7420 616c 676f cted robust algo │ │ │ +000c09e0: 7269 7468 6d2e 0a0a 5468 6520 636f 6d70 rithm...The comp │ │ │ +000c09f0: 7574 6564 2074 7261 6e73 666f 726d 6174 uted transformat │ │ │ +000c0a00: 696f 6e20 6973 2074 6865 6e20 7265 6669 ion is then refi │ │ │ +000c0a10: 6e65 6420 6675 7274 6865 7220 2875 7369 ned further (usi │ │ │ +000c0a20: 6e67 206f 6e6c 7920 696e 6c69 6572 7329 ng only inliers) │ │ │ +000c0a30: 2077 6974 6820 7468 650a 4c65 7665 6e62 with the.Levenb │ │ │ +000c0a40: 6572 672d 4d61 7271 7561 7264 7420 6d65 erg-Marquardt me │ │ │ +000c0a50: 7468 6f64 2074 6f20 7265 6475 6365 2074 thod to reduce t │ │ │ +000c0a60: 6865 2072 652d 7072 6f6a 6563 7469 6f6e he re-projection │ │ │ +000c0a70: 2065 7272 6f72 2065 7665 6e20 6d6f 7265 error even more │ │ │ +000c0a80: 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a ...Note:. │ │ │ +000c0a90: 5468 6520 5241 4e53 4143 206d 6574 686f The RANSAC metho │ │ │ +000c0aa0: 6420 6361 6e20 6861 6e64 6c65 2070 7261 d can handle pra │ │ │ +000c0ab0: 6374 6963 616c 6c79 2061 6e79 2072 6174 ctically any rat │ │ │ +000c0ac0: 696f 206f 6620 6f75 746c 6965 7273 2062 io of outliers b │ │ │ +000c0ad0: 7574 206e 6565 6473 2061 2074 6872 6573 ut needs a thres │ │ │ +000c0ae0: 686f 6c64 2074 6f0a 6469 7374 696e 6775 hold to.distingu │ │ │ +000c0af0: 6973 6820 696e 6c69 6572 7320 6672 6f6d ish inliers from │ │ │ +000c0b00: 206f 7574 6c69 6572 732e 2054 6865 206d outliers. The m │ │ │ +000c0b10: 6574 686f 6420 4c4d 6544 5320 646f 6573 ethod LMeDS does │ │ │ +000c0b20: 206e 6f74 206e 6565 6420 616e 7920 7468 not need any th │ │ │ +000c0b30: 7265 7368 6f6c 6420 6275 7420 6974 2077 reshold but it w │ │ │ +000c0b40: 6f72 6b73 0a63 6f72 7265 6374 6c79 206f orks.correctly o │ │ │ +000c0b50: 6e6c 7920 7768 656e 2074 6865 7265 2061 nly when there a │ │ │ +000c0b60: 7265 206d 6f72 6520 7468 616e 2035 3025 re more than 50% │ │ │ +000c0b70: 206f 6620 696e 6c69 6572 732e 0a0a 5345 of inliers...SE │ │ │ +000c0b80: 453a 2065 7374 696d 6174 6541 6666 696e E: estimateAffin │ │ │ +000c0b90: 6550 6172 7469 616c 3244 2c20 6765 7441 ePartial2D, getA │ │ │ +000c0ba0: 6666 696e 6554 7261 6e73 666f 726d 3c2f ffineTransform.
    .
    │ │ │ +000c0bc0: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 ..
  • .
  • .
    .

    estimateA │ │ │ +000c0c60: 6666 696e 6532 443c 2f68 333e 0a3c 6469 ffine2D

    ..public static │ │ │ +000c0cd0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  Mat estimateAffine │ │ │ +000c0d70: 3244 3c2f 7370 616e 3e3c 7762 723e 3c73 2D(Mat  │ │ │ +000c0de0: 3b66 726f 6d2c 0a20 3c61 2068 7265 663d ;from,. Mat  │ │ │ +000c0e30: 3b74 6f2c 0a20 3c61 2068 7265 663d 222e ;to,. Mat K │ │ │ -000c0e80: 2c0a 203c 6120 6872 6566 3d22 6874 7470 ,. List │ │ │ -000c0f20: 3c2f 613e 266c 743b 3c61 2068 7265 663d <Mat>& │ │ │ -000c0f70: 6e62 7370 3b72 6f74 6174 696f 6e73 2c0a nbsp;rotations,. │ │ │ -000c0f80: 203c 6120 6872 6566 3d22 6874 7470 733a List<Mat>&nb │ │ │ -000c1070: 7370 3b74 7261 6e73 6c61 7469 6f6e 732c sp;translations, │ │ │ -000c1080: 0a20 3c61 2068 7265 663d 2268 7474 7073 . List< │ │ │ -000c1120: 2f61 3e26 6c74 3b3c 6120 6872 6566 3d22 /a><Mat>&n │ │ │ -000c1170: 6273 703b 6e6f 726d 616c 7329 3c2f 7370 bsp;normals).
    Dec │ │ │ -000c11a0: 6f6d 706f 7365 2061 2068 6f6d 6f67 7261 ompose a homogra │ │ │ -000c11b0: 7068 7920 6d61 7472 6978 2074 6f20 726f phy matrix to ro │ │ │ -000c11c0: 7461 7469 6f6e 2873 292c 2074 7261 6e73 tation(s), trans │ │ │ -000c11d0: 6c61 7469 6f6e 2873 2920 616e 6420 706c lation(s) and pl │ │ │ -000c11e0: 616e 6520 6e6f 726d 616c 2873 292e 3c2f ane normal(s)..
    .
    Para │ │ │ -000c1210: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    H │ │ │ -000c1230: 2d20 5468 6520 696e 7075 7420 686f 6d6f - The input homo │ │ │ -000c1240: 6772 6170 6879 206d 6174 7269 7820 6265 graphy matrix be │ │ │ -000c1250: 7477 6565 6e20 7477 6f20 696d 6167 6573 tween two images │ │ │ -000c1260: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    K - The │ │ │ -000c1280: 696e 7075 7420 6361 6d65 7261 2069 6e74 input camera int │ │ │ -000c1290: 7269 6e73 6963 206d 6174 7269 782e 3c2f rinsic matrix..
    ro │ │ │ -000c12b0: 7461 7469 6f6e 733c 2f63 6f64 653e 202d tations - │ │ │ -000c12c0: 2041 7272 6179 206f 6620 726f 7461 7469 Array of rotati │ │ │ -000c12d0: 6f6e 206d 6174 7269 6365 732e 3c2f 6464 on matrices.
    .
    tran │ │ │ -000c12f0: 736c 6174 696f 6e73 3c2f 636f 6465 3e20 slations │ │ │ -000c1300: 2d20 4172 7261 7920 6f66 2074 7261 6e73 - Array of trans │ │ │ -000c1310: 6c61 7469 6f6e 206d 6174 7269 6365 732e lation matrices. │ │ │ -000c1320: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000c1330: 6e6f 726d 616c 733c 2f63 6f64 653e 202d normals - │ │ │ -000c1340: 2041 7272 6179 206f 6620 706c 616e 6520 Array of plane │ │ │ -000c1350: 6e6f 726d 616c 206d 6174 7269 6365 732e normal matrices. │ │ │ -000c1360: 0a0a 5468 6973 2066 756e 6374 696f 6e20 ..This function │ │ │ -000c1370: 6578 7472 6163 7473 2072 656c 6174 6976 extracts relativ │ │ │ -000c1380: 6520 6361 6d65 7261 206d 6f74 696f 6e20 e camera motion │ │ │ -000c1390: 6265 7477 6565 6e20 7477 6f20 7669 6577 between two view │ │ │ -000c13a0: 7320 6f66 2061 2070 6c61 6e61 7220 6f62 s of a planar ob │ │ │ -000c13b0: 6a65 6374 2061 6e64 2072 6574 7572 6e73 ject and returns │ │ │ -000c13c0: 2075 7020 746f 0a66 6f75 7220 6d61 7468 up to.four math │ │ │ -000c13d0: 656d 6174 6963 616c 2073 6f6c 7574 696f ematical solutio │ │ │ -000c13e0: 6e20 7475 706c 6573 206f 6620 726f 7461 n tuples of rota │ │ │ -000c13f0: 7469 6f6e 2c20 7472 616e 736c 6174 696f tion, translatio │ │ │ -000c1400: 6e2c 2061 6e64 2070 6c61 6e65 206e 6f72 n, and plane nor │ │ │ -000c1410: 6d61 6c2e 2054 6865 2064 6563 6f6d 706f mal. The decompo │ │ │ -000c1420: 7369 7469 6f6e 206f 660a 7468 6520 686f sition of.the ho │ │ │ -000c1430: 6d6f 6772 6170 6879 206d 6174 7269 7820 mography matrix │ │ │ -000c1440: 4820 6973 2064 6573 6372 6962 6564 2069 H is described i │ │ │ -000c1450: 6e20 6465 7461 696c 2069 6e20 4349 5445 n detail in CITE │ │ │ -000c1460: 3a20 4d61 6c69 7332 3030 372e 0a0a 4966 : Malis2007...If │ │ │ -000c1470: 2074 6865 2068 6f6d 6f67 7261 7068 7920 the homography │ │ │ -000c1480: 482c 2069 6e64 7563 6564 2062 7920 7468 H, induced by th │ │ │ -000c1490: 6520 706c 616e 652c 2067 6976 6573 2074 e plane, gives t │ │ │ -000c14a0: 6865 2063 6f6e 7374 7261 696e 740a 5c28 he constraint.\( │ │ │ -000c14b0: 735f 6920 5c76 6563 7468 7265 657b 7827 s_i \vecthree{x' │ │ │ -000c14c0: 5f69 7d7b 7927 5f69 7d7b 317d 205c 7369 _i}{y'_i}{1} \si │ │ │ -000c14d0: 6d20 4820 5c76 6563 7468 7265 657b 785f m H \vecthree{x_ │ │ │ -000c14e0: 697d 7b79 5f69 7d7b 317d 5c29 206f 6e20 i}{y_i}{1}\) on │ │ │ -000c14f0: 7468 6520 736f 7572 6365 2069 6d61 6765 the source image │ │ │ -000c1500: 2070 6f69 6e74 730a 5c28 705f 695c 2920 points.\(p_i\) │ │ │ -000c1510: 616e 6420 7468 6520 6465 7374 696e 6174 and the destinat │ │ │ -000c1520: 696f 6e20 696d 6167 6520 706f 696e 7473 ion image points │ │ │ -000c1530: 205c 2870 275f 695c 292c 2074 6865 6e20 \(p'_i\), then │ │ │ -000c1540: 7468 6520 7475 706c 6520 6f66 2072 6f74 the tuple of rot │ │ │ -000c1550: 6174 696f 6e73 5b6b 5d20 616e 640a 7472 ations[k] and.tr │ │ │ -000c1560: 616e 736c 6174 696f 6e73 5b6b 5d20 6973 anslations[k] is │ │ │ -000c1570: 2061 2063 6861 6e67 6520 6f66 2062 6173 a change of bas │ │ │ -000c1580: 6973 2066 726f 6d20 7468 6520 736f 7572 is from the sour │ │ │ -000c1590: 6365 2063 616d 6572 6127 7320 636f 6f72 ce camera's coor │ │ │ -000c15a0: 6469 6e61 7465 2073 7973 7465 6d20 746f dinate system to │ │ │ -000c15b0: 2074 6865 2064 6573 7469 6e61 7469 6f6e the destination │ │ │ -000c15c0: 0a63 616d 6572 6127 7320 636f 6f72 6469 .camera's coordi │ │ │ -000c15d0: 6e61 7465 2073 7973 7465 6d2e 2048 6f77 nate system. How │ │ │ -000c15e0: 6576 6572 2c20 6279 2064 6563 6f6d 706f ever, by decompo │ │ │ -000c15f0: 7369 6e67 2048 2c20 6f6e 6520 6361 6e20 sing H, one can │ │ │ -000c1600: 6f6e 6c79 2067 6574 2074 6865 2074 7261 only get the tra │ │ │ -000c1610: 6e73 6c61 7469 6f6e 206e 6f72 6d61 6c69 nslation normali │ │ │ -000c1620: 7a65 640a 6279 2074 6865 2028 7479 7069 zed.by the (typi │ │ │ -000c1630: 6361 6c6c 7920 756e 6b6e 6f77 6e29 2064 cally unknown) d │ │ │ -000c1640: 6570 7468 206f 6620 7468 6520 7363 656e epth of the scen │ │ │ -000c1650: 652c 2069 2e65 2e20 6974 7320 6469 7265 e, i.e. its dire │ │ │ -000c1660: 6374 696f 6e20 6275 7420 7769 7468 206e ction but with n │ │ │ -000c1670: 6f72 6d61 6c69 7a65 6420 6c65 6e67 7468 ormalized length │ │ │ -000c1680: 2e0a 0a49 6620 706f 696e 7420 636f 7272 ...If point corr │ │ │ -000c1690: 6573 706f 6e64 656e 6365 7320 6172 6520 espondences are │ │ │ -000c16a0: 6176 6169 6c61 626c 652c 2061 7420 6c65 available, at le │ │ │ -000c16b0: 6173 7420 7477 6f20 736f 6c75 7469 6f6e ast two solution │ │ │ -000c16c0: 7320 6d61 7920 6675 7274 6865 7220 6265 s may further be │ │ │ -000c16d0: 2069 6e76 616c 6964 6174 6564 2c20 6279 invalidated, by │ │ │ -000c16e0: 0a61 7070 6c79 696e 6720 706f 7369 7469 .applying positi │ │ │ -000c16f0: 7665 2064 6570 7468 2063 6f6e 7374 7261 ve depth constra │ │ │ -000c1700: 696e 742c 2069 2e65 2e20 616c 6c20 706f int, i.e. all po │ │ │ -000c1710: 696e 7473 206d 7573 7420 6265 2069 6e20 ints must be in │ │ │ -000c1720: 6672 6f6e 7420 6f66 2074 6865 2063 616d front of the cam │ │ │ -000c1730: 6572 612e 3c2f 6464 3e0a 3c64 743e 5265 era.
    .
    Re │ │ │ -000c1740: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ -000c1750: 6175 746f 6d61 7469 6361 6c6c 7920 6765 automatically ge │ │ │ -000c1760: 6e65 7261 7465 643c 2f64 643e 0a3c 2f64 nerated
    ..
    ..
  • .
  • . │ │ │ -000c1790: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    filter │ │ │ -000c1850: 486f 6d6f 6772 6170 6879 4465 636f 6d70 HomographyDecomp │ │ │ -000c1860: 4279 5669 7369 626c 6552 6566 706f 696e ByVisibleRefpoin │ │ │ -000c1870: 7473 3c2f 6833 3e0a 3c64 6976 2063 6c61 ts

    .
    .
    pu │ │ │ -000c18d0: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static void&nb │ │ │ -000c1910: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;fi │ │ │ -000c1930: 6c74 6572 486f 6d6f 6772 6170 6879 4465 lterHomographyDe │ │ │ -000c1940: 636f 6d70 4279 5669 7369 626c 6552 6566 compByVisibleRef │ │ │ -000c1950: 706f 696e 7473 3c2f 7370 616e 3e3c 7762 points(List< │ │ │ -000c1a20: 3b3c 6120 6872 6566 3d22 2e2e 2f63 6f72 ;Mat │ │ │ -000c1a60: 3c2f 613e 2667 743b 266e 6273 703b 726f > ro │ │ │ -000c1a70: 7461 7469 6f6e 732c 0a20 3c61 2068 7265 tations,. List<< │ │ │ -000c1b20: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000c1b30: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000c1b40: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000c1b50: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat> norm │ │ │ -000c1b70: 616c 732c 0a20 3c61 2068 7265 663d 222e als,. Mat b │ │ │ -000c1bc0: 6566 6f72 6550 6f69 6e74 732c 0a20 3c61 eforePoints,. Mat afterPoin │ │ │ -000c1c20: 7473 2c0a 203c 6120 6872 6566 3d22 2e2e ts,. Mat po │ │ │ -000c1c70: 7373 6962 6c65 536f 6c75 7469 6f6e 732c ssibleSolutions, │ │ │ -000c1c80: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000c1cc0: 743c 2f61 3e26 6e62 7370 3b70 6f69 6e74 t point │ │ │ -000c1cd0: 734d 6173 6b29 3c2f 7370 616e 3e3c 2f64 sMask).
    Filters h │ │ │ -000c1d00: 6f6d 6f67 7261 7068 7920 6465 636f 6d70 omography decomp │ │ │ -000c1d10: 6f73 6974 696f 6e73 2062 6173 6564 206f ositions based o │ │ │ -000c1d20: 6e20 6164 6469 7469 6f6e 616c 2069 6e66 n additional inf │ │ │ -000c1d30: 6f72 6d61 7469 6f6e 2e3c 2f64 6976 3e0a ormation.
    . │ │ │ -000c1d40: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ -000c1d60: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    rotations - Vector of r │ │ │ -000c1d90: 6f74 6174 696f 6e20 6d61 7472 6963 6573 otation matrices │ │ │ -000c1da0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    normals │ │ │ -000c1dc0: 2d20 5665 6374 6f72 206f 6620 706c 616e - Vector of plan │ │ │ -000c1dd0: 6520 6e6f 726d 616c 206d 6174 7269 6365 e normal matrice │ │ │ -000c1de0: 732e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 s.
    .
    beforePoints - Vector o │ │ │ -000c1e10: 6620 2872 6563 7469 6669 6564 2920 7669 f (rectified) vi │ │ │ -000c1e20: 7369 626c 6520 7265 6665 7265 6e63 6520 sible reference │ │ │ -000c1e30: 706f 696e 7473 2062 6566 6f72 6520 7468 points before th │ │ │ -000c1e40: 6520 686f 6d6f 6772 6170 6879 2069 7320 e homography is │ │ │ -000c1e50: 6170 706c 6965 643c 2f64 643e 0a3c 6464 applied
    .
    afterPoin │ │ │ -000c1e70: 7473 3c2f 636f 6465 3e20 2d20 5665 6374 ts - Vect │ │ │ -000c1e80: 6f72 206f 6620 2872 6563 7469 6669 6564 or of (rectified │ │ │ -000c1e90: 2920 7669 7369 626c 6520 7265 6665 7265 ) visible refere │ │ │ -000c1ea0: 6e63 6520 706f 696e 7473 2061 6674 6572 nce points after │ │ │ -000c1eb0: 2074 6865 2068 6f6d 6f67 7261 7068 7920 the homography │ │ │ -000c1ec0: 6973 2061 7070 6c69 6564 3c2f 6464 3e0a is applied
    . │ │ │ -000c1ed0: 3c64 643e 3c63 6f64 653e 706f 7373 6962
    possib │ │ │ -000c1ee0: 6c65 536f 6c75 7469 6f6e 733c 2f63 6f64 leSolutions - Vector of i │ │ │ -000c1f00: 6e74 2069 6e64 6963 6573 2072 6570 7265 nt indices repre │ │ │ -000c1f10: 7365 6e74 696e 6720 7468 6520 7669 6162 senting the viab │ │ │ -000c1f20: 6c65 2073 6f6c 7574 696f 6e20 7365 7420 le solution set │ │ │ -000c1f30: 6166 7465 7220 6669 6c74 6572 696e 673c after filtering< │ │ │ -000c1f40: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e70 /dd>.
    p │ │ │ -000c1f50: 6f69 6e74 734d 6173 6b3c 2f63 6f64 653e ointsMask │ │ │ -000c1f60: 202d 206f 7074 696f 6e61 6c20 4d61 742f - optional Mat/ │ │ │ -000c1f70: 5665 6374 6f72 206f 6620 4356 5f38 552c Vector of CV_8U, │ │ │ -000c1f80: 2043 565f 3853 206f 7220 4356 5f42 6f6f CV_8S or CV_Boo │ │ │ -000c1f90: 6c20 7479 7065 2072 6570 7265 7365 6e74 l type represent │ │ │ -000c1fa0: 696e 6720 7468 6520 6d61 736b 2066 6f72 ing the mask for │ │ │ -000c1fb0: 2074 6865 2069 6e6c 6965 7273 0a61 7320 the inliers.as │ │ │ -000c1fc0: 6769 7665 6e20 6279 2074 6865 2023 6669 given by the #fi │ │ │ -000c1fd0: 6e64 486f 6d6f 6772 6170 6879 2066 756e ndHomography fun │ │ │ -000c1fe0: 6374 696f 6e0a 0a54 6869 7320 6675 6e63 ction..This func │ │ │ -000c1ff0: 7469 6f6e 2069 7320 696e 7465 6e64 6564 tion is intended │ │ │ -000c2000: 2074 6f20 6669 6c74 6572 2074 6865 206f to filter the o │ │ │ -000c2010: 7574 7075 7420 6f66 2074 6865 2023 6465 utput of the #de │ │ │ -000c2020: 636f 6d70 6f73 6548 6f6d 6f67 7261 7068 composeHomograph │ │ │ -000c2030: 794d 6174 2062 6173 6564 206f 6e20 6164 yMat based on ad │ │ │ -000c2040: 6469 7469 6f6e 616c 0a69 6e66 6f72 6d61 ditional.informa │ │ │ -000c2050: 7469 6f6e 2061 7320 6465 7363 7269 6265 tion as describe │ │ │ -000c2060: 6420 696e 2043 4954 453a 204d 616c 6973 d in CITE: Malis │ │ │ -000c2070: 3230 3037 202e 2054 6865 2073 756d 6d61 2007 . The summa │ │ │ -000c2080: 7279 206f 6620 7468 6520 6d65 7468 6f64 ry of the method │ │ │ -000c2090: 3a20 7468 6520 2364 6563 6f6d 706f 7365 : the #decompose │ │ │ -000c20a0: 486f 6d6f 6772 6170 6879 4d61 7420 6675 HomographyMat fu │ │ │ -000c20b0: 6e63 7469 6f6e 0a72 6574 7572 6e73 2032 nction.returns 2 │ │ │ -000c20c0: 2075 6e69 7175 6520 736f 6c75 7469 6f6e unique solution │ │ │ -000c20d0: 7320 616e 6420 7468 6569 7220 226f 7070 s and their "opp │ │ │ -000c20e0: 6f73 6974 6573 2220 666f 7220 6120 746f osites" for a to │ │ │ -000c20f0: 7461 6c20 6f66 2034 2073 6f6c 7574 696f tal of 4 solutio │ │ │ -000c2100: 6e73 2e20 4966 2077 6520 6861 7665 2061 ns. If we have a │ │ │ -000c2110: 6363 6573 7320 746f 2074 6865 0a73 6574 ccess to the.set │ │ │ -000c2120: 7320 6f66 2070 6f69 6e74 7320 7669 7369 s of points visi │ │ │ -000c2130: 626c 6520 696e 2074 6865 2063 616d 6572 ble in the camer │ │ │ -000c2140: 6120 6672 616d 6520 6265 666f 7265 2061 a frame before a │ │ │ -000c2150: 6e64 2061 6674 6572 2074 6865 2068 6f6d nd after the hom │ │ │ -000c2160: 6f67 7261 7068 7920 7472 616e 7366 6f72 ography transfor │ │ │ -000c2170: 6d61 7469 6f6e 2069 7320 6170 706c 6965 mation is applie │ │ │ -000c2180: 642c 0a77 6520 6361 6e20 6465 7465 726d d,.we can determ │ │ │ -000c2190: 696e 6520 7768 6963 6820 6172 6520 7468 ine which are th │ │ │ -000c21a0: 6520 7472 7565 2070 6f74 656e 7469 616c e true potential │ │ │ -000c21b0: 2073 6f6c 7574 696f 6e73 2061 6e64 2077 solutions and w │ │ │ -000c21c0: 6869 6368 2061 7265 2074 6865 206f 7070 hich are the opp │ │ │ -000c21d0: 6f73 6974 6573 2062 7920 7665 7269 6679 osites by verify │ │ │ -000c21e0: 696e 6720 7768 6963 680a 686f 6d6f 6772 ing which.homogr │ │ │ -000c21f0: 6170 6869 6573 2061 7265 2063 6f6e 7369 aphies are consi │ │ │ -000c2200: 7374 656e 7420 7769 7468 2061 6c6c 2076 stent with all v │ │ │ -000c2210: 6973 6962 6c65 2072 6566 6572 656e 6365 isible reference │ │ │ -000c2220: 2070 6f69 6e74 7320 6265 696e 6720 696e points being in │ │ │ -000c2230: 2066 726f 6e74 206f 6620 7468 6520 6361 front of the ca │ │ │ -000c2240: 6d65 7261 2e20 5468 6520 696e 7075 7473 mera. The inputs │ │ │ -000c2250: 0a61 7265 206c 6566 7420 756e 6368 616e .are left unchan │ │ │ -000c2260: 6765 643b 2074 6865 2066 696c 7465 7265 ged; the filtere │ │ │ -000c2270: 6420 736f 6c75 7469 6f6e 2073 6574 2069 d solution set i │ │ │ -000c2280: 7320 7265 7475 726e 6564 2061 7320 696e s returned as in │ │ │ -000c2290: 6469 6365 7320 696e 746f 2074 6865 2065 dices into the e │ │ │ -000c22a0: 7869 7374 696e 6720 6f6e 652e 3c2f 6464 xisting one.
    .
    .
    .< │ │ │ -000c22c0: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ -000c22d0: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    filte │ │ │ -000c2380: 7248 6f6d 6f67 7261 7068 7944 6563 6f6d rHomographyDecom │ │ │ -000c2390: 7042 7956 6973 6962 6c65 5265 6670 6f69 pByVisibleRefpoi │ │ │ -000c23a0: 6e74 733c 2f68 333e 0a3c 6469 7620 636c nts

    .
    .
    p │ │ │ -000c2400: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static void&n │ │ │ -000c2440: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;f │ │ │ -000c2460: 696c 7465 7248 6f6d 6f67 7261 7068 7944 ilterHomographyD │ │ │ -000c2470: 6563 6f6d 7042 7956 6973 6962 6c65 5265 ecompByVisibleRe │ │ │ -000c2480: 6670 6f69 6e74 733c 2f73 7061 6e3e 3c77 fpoints(List&l │ │ │ -000c2550: 743b 3c61 2068 7265 663d 222e 2e2f 636f t;Ma │ │ │ -000c2590: 743c 2f61 3e26 6774 3b26 6e62 7370 3b72 t> r │ │ │ -000c25a0: 6f74 6174 696f 6e73 2c0a 203c 6120 6872 otations,. List< │ │ │ -000c2650: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000c2690: 2f61 3e26 6774 3b26 6e62 7370 3b6e 6f72 /a>> nor │ │ │ -000c26a0: 6d61 6c73 2c0a 203c 6120 6872 6566 3d22 mals,. Mat  │ │ │ -000c26f0: 6265 666f 7265 506f 696e 7473 2c0a 203c beforePoints,. < │ │ │ -000c2700: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000c2710: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000c2720: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000c2730: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat afterPoi │ │ │ -000c2750: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. Mat p │ │ │ -000c27a0: 6f73 7369 626c 6553 6f6c 7574 696f 6e73 ossibleSolutions │ │ │ -000c27b0: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ -000c27c0: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -000c27d0: 223e 4669 6c74 6572 7320 686f 6d6f 6772 ">Filters homogr │ │ │ -000c27e0: 6170 6879 2064 6563 6f6d 706f 7369 7469 aphy decompositi │ │ │ -000c27f0: 6f6e 7320 6261 7365 6420 6f6e 2061 6464 ons based on add │ │ │ -000c2800: 6974 696f 6e61 6c20 696e 666f 726d 6174 itional informat │ │ │ -000c2810: 696f 6e2e 3c2f 6469 763e 0a3c 646c 2063 ion.
    .
    .Parameters:.
    rot │ │ │ -000c2850: 6174 696f 6e73 3c2f 636f 6465 3e20 2d20 ations - │ │ │ -000c2860: 5665 6374 6f72 206f 6620 726f 7461 7469 Vector of rotati │ │ │ -000c2870: 6f6e 206d 6174 7269 6365 732e 3c2f 6464 on matrices.
    .
    norm │ │ │ -000c2890: 616c 733c 2f63 6f64 653e 202d 2056 6563 als - Vec │ │ │ -000c28a0: 746f 7220 6f66 2070 6c61 6e65 206e 6f72 tor of plane nor │ │ │ -000c28b0: 6d61 6c20 6d61 7472 6963 6573 2e3c 2f64 mal matrices..
    bef │ │ │ -000c28d0: 6f72 6550 6f69 6e74 733c 2f63 6f64 653e orePoints │ │ │ -000c28e0: 202d 2056 6563 746f 7220 6f66 2028 7265 - Vector of (re │ │ │ -000c28f0: 6374 6966 6965 6429 2076 6973 6962 6c65 ctified) visible │ │ │ -000c2900: 2072 6566 6572 656e 6365 2070 6f69 6e74 reference point │ │ │ -000c2910: 7320 6265 666f 7265 2074 6865 2068 6f6d s before the hom │ │ │ -000c2920: 6f67 7261 7068 7920 6973 2061 7070 6c69 ography is appli │ │ │ -000c2930: 6564 3c2f 6464 3e0a 3c64 643e 3c63 6f64 ed
    .
    afterPoints - Vector of │ │ │ -000c2960: 2028 7265 6374 6966 6965 6429 2076 6973 (rectified) vis │ │ │ -000c2970: 6962 6c65 2072 6566 6572 656e 6365 2070 ible reference p │ │ │ -000c2980: 6f69 6e74 7320 6166 7465 7220 7468 6520 oints after the │ │ │ -000c2990: 686f 6d6f 6772 6170 6879 2069 7320 6170 homography is ap │ │ │ -000c29a0: 706c 6965 643c 2f64 643e 0a3c 6464 3e3c plied
    .
    < │ │ │ -000c29b0: 636f 6465 3e70 6f73 7369 626c 6553 6f6c code>possibleSol │ │ │ -000c29c0: 7574 696f 6e73 3c2f 636f 6465 3e20 2d20 utions - │ │ │ -000c29d0: 5665 6374 6f72 206f 6620 696e 7420 696e Vector of int in │ │ │ -000c29e0: 6469 6365 7320 7265 7072 6573 656e 7469 dices representi │ │ │ -000c29f0: 6e67 2074 6865 2076 6961 626c 6520 736f ng the viable so │ │ │ -000c2a00: 6c75 7469 6f6e 2073 6574 2061 6674 6572 lution set after │ │ │ -000c2a10: 2066 696c 7465 7269 6e67 0a61 7320 6769 filtering.as gi │ │ │ -000c2a20: 7665 6e20 6279 2074 6865 2023 6669 6e64 ven by the #find │ │ │ -000c2a30: 486f 6d6f 6772 6170 6879 2066 756e 6374 Homography funct │ │ │ -000c2a40: 696f 6e0a 0a54 6869 7320 6675 6e63 7469 ion..This functi │ │ │ -000c2a50: 6f6e 2069 7320 696e 7465 6e64 6564 2074 on is intended t │ │ │ -000c2a60: 6f20 6669 6c74 6572 2074 6865 206f 7574 o filter the out │ │ │ -000c2a70: 7075 7420 6f66 2074 6865 2023 6465 636f put of the #deco │ │ │ -000c2a80: 6d70 6f73 6548 6f6d 6f67 7261 7068 794d mposeHomographyM │ │ │ -000c2a90: 6174 2062 6173 6564 206f 6e20 6164 6469 at based on addi │ │ │ -000c2aa0: 7469 6f6e 616c 0a69 6e66 6f72 6d61 7469 tional.informati │ │ │ -000c2ab0: 6f6e 2061 7320 6465 7363 7269 6265 6420 on as described │ │ │ -000c2ac0: 696e 2043 4954 453a 204d 616c 6973 3230 in CITE: Malis20 │ │ │ -000c2ad0: 3037 202e 2054 6865 2073 756d 6d61 7279 07 . The summary │ │ │ -000c2ae0: 206f 6620 7468 6520 6d65 7468 6f64 3a20 of the method: │ │ │ -000c2af0: 7468 6520 2364 6563 6f6d 706f 7365 486f the #decomposeHo │ │ │ -000c2b00: 6d6f 6772 6170 6879 4d61 7420 6675 6e63 mographyMat func │ │ │ -000c2b10: 7469 6f6e 0a72 6574 7572 6e73 2032 2075 tion.returns 2 u │ │ │ -000c2b20: 6e69 7175 6520 736f 6c75 7469 6f6e 7320 nique solutions │ │ │ -000c2b30: 616e 6420 7468 6569 7220 226f 7070 6f73 and their "oppos │ │ │ -000c2b40: 6974 6573 2220 666f 7220 6120 746f 7461 ites" for a tota │ │ │ -000c2b50: 6c20 6f66 2034 2073 6f6c 7574 696f 6e73 l of 4 solutions │ │ │ -000c2b60: 2e20 4966 2077 6520 6861 7665 2061 6363 . If we have acc │ │ │ -000c2b70: 6573 7320 746f 2074 6865 0a73 6574 7320 ess to the.sets │ │ │ -000c2b80: 6f66 2070 6f69 6e74 7320 7669 7369 626c of points visibl │ │ │ -000c2b90: 6520 696e 2074 6865 2063 616d 6572 6120 e in the camera │ │ │ -000c2ba0: 6672 616d 6520 6265 666f 7265 2061 6e64 frame before and │ │ │ -000c2bb0: 2061 6674 6572 2074 6865 2068 6f6d 6f67 after the homog │ │ │ -000c2bc0: 7261 7068 7920 7472 616e 7366 6f72 6d61 raphy transforma │ │ │ -000c2bd0: 7469 6f6e 2069 7320 6170 706c 6965 642c tion is applied, │ │ │ -000c2be0: 0a77 6520 6361 6e20 6465 7465 726d 696e .we can determin │ │ │ -000c2bf0: 6520 7768 6963 6820 6172 6520 7468 6520 e which are the │ │ │ -000c2c00: 7472 7565 2070 6f74 656e 7469 616c 2073 true potential s │ │ │ -000c2c10: 6f6c 7574 696f 6e73 2061 6e64 2077 6869 olutions and whi │ │ │ -000c2c20: 6368 2061 7265 2074 6865 206f 7070 6f73 ch are the oppos │ │ │ -000c2c30: 6974 6573 2062 7920 7665 7269 6679 696e ites by verifyin │ │ │ -000c2c40: 6720 7768 6963 680a 686f 6d6f 6772 6170 g which.homograp │ │ │ -000c2c50: 6869 6573 2061 7265 2063 6f6e 7369 7374 hies are consist │ │ │ -000c2c60: 656e 7420 7769 7468 2061 6c6c 2076 6973 ent with all vis │ │ │ -000c2c70: 6962 6c65 2072 6566 6572 656e 6365 2070 ible reference p │ │ │ -000c2c80: 6f69 6e74 7320 6265 696e 6720 696e 2066 oints being in f │ │ │ -000c2c90: 726f 6e74 206f 6620 7468 6520 6361 6d65 ront of the came │ │ │ -000c2ca0: 7261 2e20 5468 6520 696e 7075 7473 0a61 ra. The inputs.a │ │ │ -000c2cb0: 7265 206c 6566 7420 756e 6368 616e 6765 re left unchange │ │ │ -000c2cc0: 643b 2074 6865 2066 696c 7465 7265 6420 d; the filtered │ │ │ -000c2cd0: 736f 6c75 7469 6f6e 2073 6574 2069 7320 solution set is │ │ │ -000c2ce0: 7265 7475 726e 6564 2061 7320 696e 6469 returned as indi │ │ │ -000c2cf0: 6365 7320 696e 746f 2074 6865 2065 7869 ces into the exi │ │ │ -000c2d00: 7374 696e 6720 6f6e 652e 3c2f 6464 3e0a sting one.
    . │ │ │ -000c2d10: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    ..
    .
  • ..
    .

    c │ │ │ -000c2de0: 616c 6962 7261 7469 6f6e 4d61 7472 6978 alibrationMatrix │ │ │ -000c2df0: 5661 6c75 6573 3c2f 6833 3e0a 3c64 6976 Values

    .
    .
    public static< │ │ │ -000c2e60: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> void calibrationMat │ │ │ -000c2ec0: 7269 7856 616c 7565 733c 2f73 7061 6e3e rixValues │ │ │ -000c2ed0: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ -000c2ef0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000c2f00: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000c2f10: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000c2f20: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ -000c2f40: 7472 6978 2c0a 203c 6120 6872 6566 3d22 trix,. Size&nbs │ │ │ -000c2f90: 703b 696d 6167 6553 697a 652c 0a20 646f p;imageSize,. do │ │ │ -000c2fa0: 7562 6c65 266e 6273 703b 6170 6572 7475 uble apertu │ │ │ -000c2fb0: 7265 5769 6474 682c 0a20 646f 7562 6c65 reWidth,. double │ │ │ -000c2fc0: 266e 6273 703b 6170 6572 7475 7265 4865  apertureHe │ │ │ -000c2fd0: 6967 6874 2c0a 2064 6f75 626c 655b 5d26 ight,. double[]& │ │ │ -000c2fe0: 6e62 7370 3b66 6f76 782c 0a20 646f 7562 nbsp;fovx,. doub │ │ │ -000c2ff0: 6c65 5b5d 266e 6273 703b 666f 7679 2c0a le[] fovy,. │ │ │ -000c3000: 2064 6f75 626c 655b 5d26 6e62 7370 3b66 double[] f │ │ │ -000c3010: 6f63 616c 4c65 6e67 7468 2c0a 203c 6120 ocalLength,. Point │ │ │ -000c3060: 3c2f 613e 266e 6273 703b 7072 696e 6369  princi │ │ │ -000c3070: 7061 6c50 6f69 6e74 2c0a 2064 6f75 626c palPoint,. doubl │ │ │ -000c3080: 655b 5d26 6e62 7370 3b61 7370 6563 7452 e[] aspectR │ │ │ -000c3090: 6174 696f 293c 2f73 7061 6e3e 3c2f 6469 atio).
    Computes u │ │ │ -000c30c0: 7365 6675 6c20 6361 6d65 7261 2063 6861 seful camera cha │ │ │ -000c30d0: 7261 6374 6572 6973 7469 6373 2066 726f racteristics fro │ │ │ -000c30e0: 6d20 7468 6520 6361 6d65 7261 2069 6e74 m the camera int │ │ │ -000c30f0: 7269 6e73 6963 206d 6174 7269 782e 3c2f rinsic matrix..
    .
    Para │ │ │ -000c3120: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    cameraMat │ │ │ -000c3140: 7269 783c 2f63 6f64 653e 202d 2049 6e70 rix - Inp │ │ │ -000c3150: 7574 2063 616d 6572 6120 696e 7472 696e ut camera intrin │ │ │ -000c3160: 7369 6320 6d61 7472 6978 2074 6861 7420 sic matrix that │ │ │ -000c3170: 6361 6e20 6265 2065 7374 696d 6174 6564 can be estimated │ │ │ -000c3180: 2062 7920 2363 616c 6962 7261 7465 4361 by #calibrateCa │ │ │ -000c3190: 6d65 7261 206f 720a 2373 7465 7265 6f43 mera or.#stereoC │ │ │ -000c31a0: 616c 6962 7261 7465 202e 3c2f 6464 3e0a alibrate .
    . │ │ │ -000c31b0: 3c64 643e 3c63 6f64 653e 696d 6167 6553
    imageS │ │ │ -000c31c0: 697a 653c 2f63 6f64 653e 202d 2049 6e70 ize - Inp │ │ │ -000c31d0: 7574 2069 6d61 6765 2073 697a 6520 696e ut image size in │ │ │ -000c31e0: 2070 6978 656c 732e 3c2f 6464 3e0a 3c64 pixels.
    .aperture │ │ │ -000c3200: 5769 6474 683c 2f63 6f64 653e 202d 2050 Width - P │ │ │ -000c3210: 6879 7369 6361 6c20 7769 6474 6820 696e hysical width in │ │ │ -000c3220: 206d 6d20 6f66 2074 6865 2073 656e 736f mm of the senso │ │ │ -000c3230: 722e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 r..
    apertureHeight │ │ │ -000c3250: 3c2f 636f 6465 3e20 2d20 5068 7973 6963 - Physic │ │ │ -000c3260: 616c 2068 6569 6768 7420 696e 206d 6d20 al height in mm │ │ │ -000c3270: 6f66 2074 6865 2073 656e 736f 722e 3c2f of the sensor..
    fo │ │ │ -000c3290: 7678 3c2f 636f 6465 3e20 2d20 4f75 7470 vx - Outp │ │ │ -000c32a0: 7574 2066 6965 6c64 206f 6620 7669 6577 ut field of view │ │ │ -000c32b0: 2069 6e20 6465 6772 6565 7320 616c 6f6e in degrees alon │ │ │ -000c32c0: 6720 7468 6520 686f 7269 7a6f 6e74 616c g the horizontal │ │ │ -000c32d0: 2073 656e 736f 7220 6178 6973 2e3c 2f64 sensor axis..
    fov │ │ │ -000c32f0: 793c 2f63 6f64 653e 202d 204f 7574 7075 y - Outpu │ │ │ -000c3300: 7420 6669 656c 6420 6f66 2076 6965 7720 t field of view │ │ │ -000c3310: 696e 2064 6567 7265 6573 2061 6c6f 6e67 in degrees along │ │ │ -000c3320: 2074 6865 2076 6572 7469 6361 6c20 7365 the vertical se │ │ │ -000c3330: 6e73 6f72 2061 7869 732e 3c2f 6464 3e0a nsor axis.
    . │ │ │ -000c3340: 3c64 643e 3c63 6f64 653e 666f 6361 6c4c
    focalL │ │ │ -000c3350: 656e 6774 683c 2f63 6f64 653e 202d 2046 ength - F │ │ │ -000c3360: 6f63 616c 206c 656e 6774 6820 6f66 2074 ocal length of t │ │ │ -000c3370: 6865 206c 656e 7320 696e 206d 6d2e 3c2f he lens in mm..
    pr │ │ │ -000c3390: 696e 6369 7061 6c50 6f69 6e74 3c2f 636f incipalPoint - Principal │ │ │ -000c33b0: 706f 696e 7420 696e 206d 6d2e 3c2f 6464 point in mm.
    .
    aspe │ │ │ -000c33d0: 6374 5261 7469 6f3c 2f63 6f64 653e 202d ctRatio - │ │ │ -000c33e0: 205c 2866 5f79 2f66 5f78 5c29 0a0a 5468 \(f_y/f_x\)..Th │ │ │ -000c33f0: 6520 6675 6e63 7469 6f6e 2063 6f6d 7075 e function compu │ │ │ -000c3400: 7465 7320 7661 7269 6f75 7320 7573 6566 tes various usef │ │ │ -000c3410: 756c 2063 616d 6572 6120 6368 6172 6163 ul camera charac │ │ │ -000c3420: 7465 7269 7374 6963 7320 6672 6f6d 2074 teristics from t │ │ │ -000c3430: 6865 2070 7265 7669 6f75 736c 7920 6573 he previously es │ │ │ -000c3440: 7469 6d61 7465 6420 6361 6d65 7261 0a6d timated camera.m │ │ │ -000c3450: 6174 7269 782e 0a0a 3c62 3e4e 6f74 653a atrix...Note: │ │ │ -000c3460: 3c2f 623e 0a44 6f20 6b65 6570 2069 6e20 .Do keep in │ │ │ -000c3470: 6d69 6e64 2074 6861 7420 7468 6520 756e mind that the un │ │ │ -000c3480: 6974 7920 6d65 6173 7572 6520 276d 6d27 ity measure 'mm' │ │ │ -000c3490: 2073 7461 6e64 7320 666f 7220 7768 6174 stands for what │ │ │ -000c34a0: 6576 6572 2075 6e69 7420 6f66 206d 6561 ever unit of mea │ │ │ -000c34b0: 7375 7265 206f 6e65 2063 686f 6f73 6573 sure one chooses │ │ │ -000c34c0: 2066 6f72 0a74 6865 2063 6865 7373 626f for.the chessbo │ │ │ -000c34d0: 6172 6420 7069 7463 6820 2869 7420 6361 ard pitch (it ca │ │ │ -000c34e0: 6e20 7468 7573 2062 6520 616e 7920 7661 n thus be any va │ │ │ -000c34f0: 6c75 6529 2e3c 2f64 643e 0a3c 2f64 6c3e lue).
    .
    │ │ │ -000c3500: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ...
  • ..

    getD │ │ │ -000c3590: 6566 6175 6c74 4e65 7743 616d 6572 614d efaultNewCameraM │ │ │ -000c35a0: 6174 7269 783c 2f68 333e 0a3c 6469 7620 atrix

    .
    .
    public static Mat& │ │ │ -000c3680: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -000c36a0: 6765 7444 6566 6175 6c74 4e65 7743 616d getDefaultNewCam │ │ │ -000c36b0: 6572 614d 6174 7269 783c 2f73 7061 6e3e eraMatrix │ │ │ -000c36c0: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ -000c36e0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000c36f0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000c3700: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000c3710: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ -000c3730: 7472 6978 2c0a 203c 6120 6872 6566 3d22 trix,. Size&nbs │ │ │ -000c3780: 703b 696d 6773 697a 652c 0a20 626f 6f6c p;imgsize,. bool │ │ │ -000c3790: 6561 6e26 6e62 7370 3b63 656e 7465 7250 ean centerP │ │ │ -000c37a0: 7269 6e63 6970 616c 506f 696e 7429 3c2f rincipalPoint)
    .
    R │ │ │ -000c37d0: 6574 7572 6e73 2074 6865 2064 6566 6175 eturns the defau │ │ │ -000c37e0: 6c74 206e 6577 2063 616d 6572 6120 6d61 lt new camera ma │ │ │ -000c37f0: 7472 6978 2e0a 0a54 6865 2066 756e 6374 trix...The funct │ │ │ -000c3800: 696f 6e20 7265 7475 726e 7320 7468 6520 ion returns the │ │ │ -000c3810: 6361 6d65 7261 206d 6174 7269 7820 7468 camera matrix th │ │ │ -000c3820: 6174 2069 7320 6569 7468 6572 2061 6e20 at is either an │ │ │ -000c3830: 6578 6163 7420 636f 7079 206f 6620 7468 exact copy of th │ │ │ -000c3840: 6520 696e 7075 7420 6361 6d65 7261 4d61 e input cameraMa │ │ │ -000c3850: 7472 6978 2028 7768 656e 0a63 656e 7465 trix (when.cente │ │ │ -000c3860: 7250 7269 6e69 6369 7061 6c50 6f69 6e74 rPrinicipalPoint │ │ │ -000c3870: 3d66 616c 7365 2029 2c20 6f72 2074 6865 =false ), or the │ │ │ -000c3880: 206d 6f64 6966 6965 6420 6f6e 6520 2877 modified one (w │ │ │ -000c3890: 6865 6e20 6365 6e74 6572 5072 696e 6369 hen centerPrinci │ │ │ -000c38a0: 7061 6c50 6f69 6e74 3d74 7275 6529 2e0a palPoint=true).. │ │ │ -000c38b0: 0a49 6e20 7468 6520 6c61 7474 6572 2063 .In the latter c │ │ │ -000c38c0: 6173 652c 2074 6865 206e 6577 2063 616d ase, the new cam │ │ │ -000c38d0: 6572 6120 6d61 7472 6978 2077 696c 6c20 era matrix will │ │ │ -000c38e0: 6265 3a0a 0a5c 285c 6265 6769 6e7b 626d be:..\(\begin{bm │ │ │ -000c38f0: 6174 7269 787d 2066 5f78 2026 616d 703b atrix} f_x & │ │ │ -000c3900: 2661 6d70 3b20 3020 2661 6d70 3b26 616d & 0 &&am │ │ │ -000c3910: 703b 2028 205c 7465 7874 7474 7b69 6d67 p; ( \texttt{img │ │ │ -000c3920: 5369 7a65 2e77 6964 7468 7d20 2d31 292a Size.width} -1)* │ │ │ -000c3930: 302e 3520 205c 5c20 3020 2661 6d70 3b26 0.5 \\ 0 && │ │ │ -000c3940: 616d 703b 2066 5f79 2026 616d 703b 2661 amp; f_y &&a │ │ │ -000c3950: 6d70 3b20 2820 5c74 6578 7474 747b 696d mp; ( \texttt{im │ │ │ -000c3960: 6753 697a 652e 6865 6967 6874 7d20 2d31 gSize.height} -1 │ │ │ -000c3970: 292a 302e 3520 205c 5c20 3020 2661 6d70 )*0.5 \\ 0 & │ │ │ -000c3980: 3b26 616d 703b 2030 2026 616d 703b 2661 ;& 0 &&a │ │ │ -000c3990: 6d70 3b20 3120 5c65 6e64 7b62 6d61 7472 mp; 1 \end{bmatr │ │ │ -000c39a0: 6978 7d20 2c5c 290a 0a77 6865 7265 205c ix} ,\)..where \ │ │ │ -000c39b0: 2866 5f78 5c29 2061 6e64 205c 2866 5f79 (f_x\) and \(f_y │ │ │ -000c39c0: 5c29 2061 7265 205c 2828 302c 3029 5c29 \) are \((0,0)\) │ │ │ -000c39d0: 2061 6e64 205c 2828 312c 3129 5c29 2065 and \((1,1)\) e │ │ │ -000c39e0: 6c65 6d65 6e74 7320 6f66 2063 616d 6572 lements of camer │ │ │ -000c39f0: 614d 6174 7269 782c 2072 6573 7065 6374 aMatrix, respect │ │ │ -000c3a00: 6976 656c 792e 0a0a 4279 2064 6566 6175 ively...By defau │ │ │ -000c3a10: 6c74 2c20 7468 6520 756e 6469 7374 6f72 lt, the undistor │ │ │ -000c3a20: 7469 6f6e 2066 756e 6374 696f 6e73 2069 tion functions i │ │ │ -000c3a30: 6e20 4f70 656e 4356 2028 7365 6520 2369 n OpenCV (see #i │ │ │ -000c3a40: 6e69 7455 6e64 6973 746f 7274 5265 6374 nitUndistortRect │ │ │ -000c3a50: 6966 794d 6170 2c20 2375 6e64 6973 746f ifyMap, #undisto │ │ │ -000c3a60: 7274 2920 646f 206e 6f74 0a6d 6f76 6520 rt) do not.move │ │ │ -000c3a70: 7468 6520 7072 696e 6369 7061 6c20 706f the principal po │ │ │ -000c3a80: 696e 742e 2048 6f77 6576 6572 2c20 7768 int. However, wh │ │ │ -000c3a90: 656e 2079 6f75 2077 6f72 6b20 7769 7468 en you work with │ │ │ -000c3aa0: 2073 7465 7265 6f2c 2069 7420 6973 2069 stereo, it is i │ │ │ -000c3ab0: 6d70 6f72 7461 6e74 2074 6f20 6d6f 7665 mportant to move │ │ │ -000c3ac0: 2074 6865 2070 7269 6e63 6970 616c 0a70 the principal.p │ │ │ -000c3ad0: 6f69 6e74 7320 696e 2062 6f74 6820 7669 oints in both vi │ │ │ -000c3ae0: 6577 7320 746f 2074 6865 2073 616d 6520 ews to the same │ │ │ -000c3af0: 792d 636f 6f72 6469 6e61 7465 2028 7768 y-coordinate (wh │ │ │ -000c3b00: 6963 6820 6973 2072 6571 7569 7265 6420 ich is required │ │ │ -000c3b10: 6279 206d 6f73 7420 6f66 2073 7465 7265 by most of stere │ │ │ -000c3b20: 6f20 636f 7272 6573 706f 6e64 656e 6365 o correspondence │ │ │ -000c3b30: 0a61 6c67 6f72 6974 686d 7329 2c20 616e .algorithms), an │ │ │ -000c3b40: 6420 6d61 7920 6265 2074 6f20 7468 6520 d may be to the │ │ │ -000c3b50: 7361 6d65 2078 2d63 6f6f 7264 696e 6174 same x-coordinat │ │ │ -000c3b60: 6520 746f 6f2e 2053 6f2c 2079 6f75 2063 e too. So, you c │ │ │ -000c3b70: 616e 2066 6f72 6d20 7468 6520 6e65 7720 an form the new │ │ │ -000c3b80: 6361 6d65 7261 206d 6174 7269 7820 666f camera matrix fo │ │ │ -000c3b90: 720a 6561 6368 2076 6965 7720 7768 6572 r.each view wher │ │ │ -000c3ba0: 6520 7468 6520 7072 696e 6369 7061 6c20 e the principal │ │ │ -000c3bb0: 706f 696e 7473 2061 7265 206c 6f63 6174 points are locat │ │ │ -000c3bc0: 6564 2061 7420 7468 6520 6365 6e74 6572 ed at the center │ │ │ -000c3bd0: 2e3c 2f64 6976 3e0a 3c64 6c20 636c 6173 .
    .
    .
    P │ │ │ -000c3bf0: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ -000c3c00: 3c64 643e 3c63 6f64 653e 6361 6d65 7261
    camera │ │ │ -000c3c10: 4d61 7472 6978 3c2f 636f 6465 3e20 2d20 Matrix - │ │ │ -000c3c20: 496e 7075 7420 6361 6d65 7261 206d 6174 Input camera mat │ │ │ -000c3c30: 7269 782e 3c2f 6464 3e0a 3c64 643e 3c63 rix.
    .
    imgsize - Camera view │ │ │ -000c3c60: 2069 6d61 6765 2073 697a 6520 696e 2070 image size in p │ │ │ -000c3c70: 6978 656c 732e 3c2f 6464 3e0a 3c64 643e ixels.
    .
    │ │ │ -000c3c80: 3c63 6f64 653e 6365 6e74 6572 5072 696e centerPrin │ │ │ -000c3c90: 6369 7061 6c50 6f69 6e74 3c2f 636f 6465 cipalPoint - Location of │ │ │ -000c3cb0: 7468 6520 7072 696e 6369 7061 6c20 706f the principal po │ │ │ -000c3cc0: 696e 7420 696e 2074 6865 206e 6577 2063 int in the new c │ │ │ -000c3cd0: 616d 6572 6120 6d61 7472 6978 2e20 5468 amera matrix. Th │ │ │ -000c3ce0: 650a 7061 7261 6d65 7465 7220 696e 6469 e.parameter indi │ │ │ -000c3cf0: 6361 7465 7320 7768 6574 6865 7220 7468 cates whether th │ │ │ -000c3d00: 6973 206c 6f63 6174 696f 6e20 7368 6f75 is location shou │ │ │ -000c3d10: 6c64 2062 6520 6174 2074 6865 2069 6d61 ld be at the ima │ │ │ -000c3d20: 6765 2063 656e 7465 7220 6f72 206e 6f74 ge center or not │ │ │ -000c3d30: 2e3c 2f64 643e 0a3c 6474 3e52 6574 7572 .
    .
    Retur │ │ │ -000c3d40: 6e73 3a3c 2f64 743e 0a3c 6464 3e61 7574 ns:
    .
    aut │ │ │ -000c3d50: 6f6d 6174 6963 616c 6c79 2067 656e 6572 omatically gener │ │ │ -000c3d60: 6174 6564 3c2f 6464 3e0a 3c2f 646c 3e0a ated
    .
    . │ │ │ -000c3d70: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e
    .
  • ..
  • ..< │ │ │ -000c3df0: 6833 3e67 6574 4465 6661 756c 744e 6577 h3>getDefaultNew │ │ │ -000c3e00: 4361 6d65 7261 4d61 7472 6978 3c2f 6833 CameraMatrix.
    .
    │ │ │ -000c3e50: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -000c3e70: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -000c3e80: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;Mat< │ │ │ -000c3ee0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> getDefaul │ │ │ -000c3f10: 744e 6577 4361 6d65 7261 4d61 7472 6978 tNewCameraMatrix │ │ │ -000c3f20: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat c │ │ │ -000c3f90: 616d 6572 614d 6174 7269 782c 0a20 3c61 ameraMatrix,. Size< │ │ │ -000c3fe0: 2f61 3e26 6e62 7370 3b69 6d67 7369 7a65 /a> imgsize │ │ │ -000c3ff0: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ -000c4000: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -000c4010: 223e 5265 7475 726e 7320 7468 6520 6465 ">Returns the de │ │ │ -000c4020: 6661 756c 7420 6e65 7720 6361 6d65 7261 fault new camera │ │ │ -000c4030: 206d 6174 7269 782e 0a0a 5468 6520 6675 matrix...The fu │ │ │ -000c4040: 6e63 7469 6f6e 2072 6574 7572 6e73 2074 nction returns t │ │ │ -000c4050: 6865 2063 616d 6572 6120 6d61 7472 6978 he camera matrix │ │ │ -000c4060: 2074 6861 7420 6973 2065 6974 6865 7220 that is either │ │ │ -000c4070: 616e 2065 7861 6374 2063 6f70 7920 6f66 an exact copy of │ │ │ -000c4080: 2074 6865 2069 6e70 7574 2063 616d 6572 the input camer │ │ │ -000c4090: 614d 6174 7269 7820 2877 6865 6e0a 6365 aMatrix (when.ce │ │ │ -000c40a0: 6e74 6572 5072 696e 6963 6970 616c 506f nterPrinicipalPo │ │ │ -000c40b0: 696e 743d 6661 6c73 6520 292c 206f 7220 int=false ), or │ │ │ -000c40c0: 7468 6520 6d6f 6469 6669 6564 206f 6e65 the modified one │ │ │ -000c40d0: 2028 7768 656e 2063 656e 7465 7250 7269 (when centerPri │ │ │ -000c40e0: 6e63 6970 616c 506f 696e 743d 7472 7565 ncipalPoint=true │ │ │ -000c40f0: 292e 0a0a 496e 2074 6865 206c 6174 7465 )...In the latte │ │ │ -000c4100: 7220 6361 7365 2c20 7468 6520 6e65 7720 r case, the new │ │ │ -000c4110: 6361 6d65 7261 206d 6174 7269 7820 7769 camera matrix wi │ │ │ -000c4120: 6c6c 2062 653a 0a0a 5c28 5c62 6567 696e ll be:..\(\begin │ │ │ -000c4130: 7b62 6d61 7472 6978 7d20 665f 7820 2661 {bmatrix} f_x &a │ │ │ -000c4140: 6d70 3b26 616d 703b 2030 2026 616d 703b mp;& 0 & │ │ │ -000c4150: 2661 6d70 3b20 2820 5c74 6578 7474 747b & ( \texttt{ │ │ │ -000c4160: 696d 6753 697a 652e 7769 6474 687d 202d imgSize.width} - │ │ │ -000c4170: 3129 2a30 2e35 2020 5c5c 2030 2026 616d 1)*0.5 \\ 0 &am │ │ │ -000c4180: 703b 2661 6d70 3b20 665f 7920 2661 6d70 p;& f_y & │ │ │ -000c4190: 3b26 616d 703b 2028 205c 7465 7874 7474 ;& ( \texttt │ │ │ -000c41a0: 7b69 6d67 5369 7a65 2e68 6569 6768 747d {imgSize.height} │ │ │ -000c41b0: 202d 3129 2a30 2e35 2020 5c5c 2030 2026 -1)*0.5 \\ 0 & │ │ │ -000c41c0: 616d 703b 2661 6d70 3b20 3020 2661 6d70 amp;& 0 & │ │ │ -000c41d0: 3b26 616d 703b 2031 205c 656e 647b 626d ;& 1 \end{bm │ │ │ -000c41e0: 6174 7269 787d 202c 5c29 0a0a 7768 6572 atrix} ,\)..wher │ │ │ -000c41f0: 6520 5c28 665f 785c 2920 616e 6420 5c28 e \(f_x\) and \( │ │ │ -000c4200: 665f 795c 2920 6172 6520 5c28 2830 2c30 f_y\) are \((0,0 │ │ │ -000c4210: 295c 2920 616e 6420 5c28 2831 2c31 295c )\) and \((1,1)\ │ │ │ -000c4220: 2920 656c 656d 656e 7473 206f 6620 6361 ) elements of ca │ │ │ -000c4230: 6d65 7261 4d61 7472 6978 2c20 7265 7370 meraMatrix, resp │ │ │ -000c4240: 6563 7469 7665 6c79 2e0a 0a42 7920 6465 ectively...By de │ │ │ -000c4250: 6661 756c 742c 2074 6865 2075 6e64 6973 fault, the undis │ │ │ -000c4260: 746f 7274 696f 6e20 6675 6e63 7469 6f6e tortion function │ │ │ -000c4270: 7320 696e 204f 7065 6e43 5620 2873 6565 s in OpenCV (see │ │ │ -000c4280: 2023 696e 6974 556e 6469 7374 6f72 7452 #initUndistortR │ │ │ -000c4290: 6563 7469 6679 4d61 702c 2023 756e 6469 ectifyMap, #undi │ │ │ -000c42a0: 7374 6f72 7429 2064 6f20 6e6f 740a 6d6f stort) do not.mo │ │ │ -000c42b0: 7665 2074 6865 2070 7269 6e63 6970 616c ve the principal │ │ │ -000c42c0: 2070 6f69 6e74 2e20 486f 7765 7665 722c point. However, │ │ │ -000c42d0: 2077 6865 6e20 796f 7520 776f 726b 2077 when you work w │ │ │ -000c42e0: 6974 6820 7374 6572 656f 2c20 6974 2069 ith stereo, it i │ │ │ -000c42f0: 7320 696d 706f 7274 616e 7420 746f 206d s important to m │ │ │ -000c4300: 6f76 6520 7468 6520 7072 696e 6369 7061 ove the principa │ │ │ -000c4310: 6c0a 706f 696e 7473 2069 6e20 626f 7468 l.points in both │ │ │ -000c4320: 2076 6965 7773 2074 6f20 7468 6520 7361 views to the sa │ │ │ -000c4330: 6d65 2079 2d63 6f6f 7264 696e 6174 6520 me y-coordinate │ │ │ -000c4340: 2877 6869 6368 2069 7320 7265 7175 6972 (which is requir │ │ │ -000c4350: 6564 2062 7920 6d6f 7374 206f 6620 7374 ed by most of st │ │ │ -000c4360: 6572 656f 2063 6f72 7265 7370 6f6e 6465 ereo corresponde │ │ │ -000c4370: 6e63 650a 616c 676f 7269 7468 6d73 292c nce.algorithms), │ │ │ -000c4380: 2061 6e64 206d 6179 2062 6520 746f 2074 and may be to t │ │ │ -000c4390: 6865 2073 616d 6520 782d 636f 6f72 6469 he same x-coordi │ │ │ -000c43a0: 6e61 7465 2074 6f6f 2e20 536f 2c20 796f nate too. So, yo │ │ │ -000c43b0: 7520 6361 6e20 666f 726d 2074 6865 206e u can form the n │ │ │ -000c43c0: 6577 2063 616d 6572 6120 6d61 7472 6978 ew camera matrix │ │ │ -000c43d0: 2066 6f72 0a65 6163 6820 7669 6577 2077 for.each view w │ │ │ -000c43e0: 6865 7265 2074 6865 2070 7269 6e63 6970 here the princip │ │ │ -000c43f0: 616c 2070 6f69 6e74 7320 6172 6520 6c6f al points are lo │ │ │ -000c4400: 6361 7465 6420 6174 2074 6865 2063 656e cated at the cen │ │ │ -000c4410: 7465 722e 3c2f 6469 763e 0a3c 646c 2063 ter.
    .
    .Parameters:.
    cam │ │ │ -000c4450: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ -000c4460: 202d 2049 6e70 7574 2063 616d 6572 6120 - Input camera │ │ │ -000c4470: 6d61 7472 6978 2e3c 2f64 643e 0a3c 6464 matrix.
    .
    imgsize - Camera v │ │ │ -000c44a0: 6965 7720 696d 6167 6520 7369 7a65 2069 iew image size i │ │ │ -000c44b0: 6e20 7069 7865 6c73 2e0a 7061 7261 6d65 n pixels..parame │ │ │ -000c44c0: 7465 7220 696e 6469 6361 7465 7320 7768 ter indicates wh │ │ │ -000c44d0: 6574 6865 7220 7468 6973 206c 6f63 6174 ether this locat │ │ │ -000c44e0: 696f 6e20 7368 6f75 6c64 2062 6520 6174 ion should be at │ │ │ -000c44f0: 2074 6865 2069 6d61 6765 2063 656e 7465 the image cente │ │ │ -000c4500: 7220 6f72 206e 6f74 2e3c 2f64 643e 0a3c r or not.
    .< │ │ │ -000c4510: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ -000c4520: 0a3c 6464 3e61 7574 6f6d 6174 6963 616c .
    automatical │ │ │ -000c4530: 6c79 2067 656e 6572 6174 6564 3c2f 6464 ly generated
    .
    ..< │ │ │ -000c4550: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ -000c4560: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    getDefault │ │ │ -000c45c0: 4e65 7743 616d 6572 614d 6174 7269 783c NewCameraMatrix< │ │ │ -000c45d0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .. │ │ │ -000c4780: 5265 7475 726e 7320 7468 6520 6465 6661 Returns the defa │ │ │ -000c4790: 756c 7420 6e65 7720 6361 6d65 7261 206d ult new camera m │ │ │ -000c47a0: 6174 7269 782e 0a0a 5468 6520 6675 6e63 atrix...The func │ │ │ -000c47b0: 7469 6f6e 2072 6574 7572 6e73 2074 6865 tion returns the │ │ │ -000c47c0: 2063 616d 6572 6120 6d61 7472 6978 2074 camera matrix t │ │ │ -000c47d0: 6861 7420 6973 2065 6974 6865 7220 616e hat is either an │ │ │ -000c47e0: 2065 7861 6374 2063 6f70 7920 6f66 2074 exact copy of t │ │ │ -000c47f0: 6865 2069 6e70 7574 2063 616d 6572 614d he input cameraM │ │ │ -000c4800: 6174 7269 7820 2877 6865 6e0a 6365 6e74 atrix (when.cent │ │ │ -000c4810: 6572 5072 696e 6963 6970 616c 506f 696e erPrinicipalPoin │ │ │ -000c4820: 743d 6661 6c73 6520 292c 206f 7220 7468 t=false ), or th │ │ │ -000c4830: 6520 6d6f 6469 6669 6564 206f 6e65 2028 e modified one ( │ │ │ -000c4840: 7768 656e 2063 656e 7465 7250 7269 6e63 when centerPrinc │ │ │ -000c4850: 6970 616c 506f 696e 743d 7472 7565 292e ipalPoint=true). │ │ │ -000c4860: 0a0a 496e 2074 6865 206c 6174 7465 7220 ..In the latter │ │ │ -000c4870: 6361 7365 2c20 7468 6520 6e65 7720 6361 case, the new ca │ │ │ -000c4880: 6d65 7261 206d 6174 7269 7820 7769 6c6c mera matrix will │ │ │ -000c4890: 2062 653a 0a0a 5c28 5c62 6567 696e 7b62 be:..\(\begin{b │ │ │ -000c48a0: 6d61 7472 6978 7d20 665f 7820 2661 6d70 matrix} f_x & │ │ │ -000c48b0: 3b26 616d 703b 2030 2026 616d 703b 2661 ;& 0 &&a │ │ │ -000c48c0: 6d70 3b20 2820 5c74 6578 7474 747b 696d mp; ( \texttt{im │ │ │ -000c48d0: 6753 697a 652e 7769 6474 687d 202d 3129 gSize.width} -1) │ │ │ -000c48e0: 2a30 2e35 2020 5c5c 2030 2026 616d 703b *0.5 \\ 0 & │ │ │ -000c48f0: 2661 6d70 3b20 665f 7920 2661 6d70 3b26 & f_y && │ │ │ -000c4900: 616d 703b 2028 205c 7465 7874 7474 7b69 amp; ( \texttt{i │ │ │ -000c4910: 6d67 5369 7a65 2e68 6569 6768 747d 202d mgSize.height} - │ │ │ -000c4920: 3129 2a30 2e35 2020 5c5c 2030 2026 616d 1)*0.5 \\ 0 &am │ │ │ -000c4930: 703b 2661 6d70 3b20 3020 2661 6d70 3b26 p;& 0 && │ │ │ -000c4940: 616d 703b 2031 205c 656e 647b 626d 6174 amp; 1 \end{bmat │ │ │ -000c4950: 7269 787d 202c 5c29 0a0a 7768 6572 6520 rix} ,\)..where │ │ │ -000c4960: 5c28 665f 785c 2920 616e 6420 5c28 665f \(f_x\) and \(f_ │ │ │ -000c4970: 795c 2920 6172 6520 5c28 2830 2c30 295c y\) are \((0,0)\ │ │ │ -000c4980: 2920 616e 6420 5c28 2831 2c31 295c 2920 ) and \((1,1)\) │ │ │ -000c4990: 656c 656d 656e 7473 206f 6620 6361 6d65 elements of came │ │ │ -000c49a0: 7261 4d61 7472 6978 2c20 7265 7370 6563 raMatrix, respec │ │ │ -000c49b0: 7469 7665 6c79 2e0a 0a42 7920 6465 6661 tively...By defa │ │ │ -000c49c0: 756c 742c 2074 6865 2075 6e64 6973 746f ult, the undisto │ │ │ -000c49d0: 7274 696f 6e20 6675 6e63 7469 6f6e 7320 rtion functions │ │ │ -000c49e0: 696e 204f 7065 6e43 5620 2873 6565 2023 in OpenCV (see # │ │ │ -000c49f0: 696e 6974 556e 6469 7374 6f72 7452 6563 initUndistortRec │ │ │ -000c4a00: 7469 6679 4d61 702c 2023 756e 6469 7374 tifyMap, #undist │ │ │ -000c4a10: 6f72 7429 2064 6f20 6e6f 740a 6d6f 7665 ort) do not.move │ │ │ -000c4a20: 2074 6865 2070 7269 6e63 6970 616c 2070 the principal p │ │ │ -000c4a30: 6f69 6e74 2e20 486f 7765 7665 722c 2077 oint. However, w │ │ │ -000c4a40: 6865 6e20 796f 7520 776f 726b 2077 6974 hen you work wit │ │ │ -000c4a50: 6820 7374 6572 656f 2c20 6974 2069 7320 h stereo, it is │ │ │ -000c4a60: 696d 706f 7274 616e 7420 746f 206d 6f76 important to mov │ │ │ -000c4a70: 6520 7468 6520 7072 696e 6369 7061 6c0a e the principal. │ │ │ -000c4a80: 706f 696e 7473 2069 6e20 626f 7468 2076 points in both v │ │ │ -000c4a90: 6965 7773 2074 6f20 7468 6520 7361 6d65 iews to the same │ │ │ -000c4aa0: 2079 2d63 6f6f 7264 696e 6174 6520 2877 y-coordinate (w │ │ │ -000c4ab0: 6869 6368 2069 7320 7265 7175 6972 6564 hich is required │ │ │ -000c4ac0: 2062 7920 6d6f 7374 206f 6620 7374 6572 by most of ster │ │ │ -000c4ad0: 656f 2063 6f72 7265 7370 6f6e 6465 6e63 eo correspondenc │ │ │ -000c4ae0: 650a 616c 676f 7269 7468 6d73 292c 2061 e.algorithms), a │ │ │ -000c4af0: 6e64 206d 6179 2062 6520 746f 2074 6865 nd may be to the │ │ │ -000c4b00: 2073 616d 6520 782d 636f 6f72 6469 6e61 same x-coordina │ │ │ -000c4b10: 7465 2074 6f6f 2e20 536f 2c20 796f 7520 te too. So, you │ │ │ -000c4b20: 6361 6e20 666f 726d 2074 6865 206e 6577 can form the new │ │ │ -000c4b30: 2063 616d 6572 6120 6d61 7472 6978 2066 camera matrix f │ │ │ -000c4b40: 6f72 0a65 6163 6820 7669 6577 2077 6865 or.each view whe │ │ │ -000c4b50: 7265 2074 6865 2070 7269 6e63 6970 616c re the principal │ │ │ -000c4b60: 2070 6f69 6e74 7320 6172 6520 6c6f 6361 points are loca │ │ │ -000c4b70: 7465 6420 6174 2074 6865 2063 656e 7465 ted at the cente │ │ │ -000c4b80: 722e 3c2f 6469 763e 0a3c 646c 2063 6c61 r.
    .
    .
    │ │ │ -000c4ba0: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ -000c4bb0: 0a3c 6464 3e3c 636f 6465 3e63 616d 6572 .
    camer │ │ │ -000c4bc0: 614d 6174 7269 783c 2f63 6f64 653e 202d aMatrix - │ │ │ -000c4bd0: 2049 6e70 7574 2063 616d 6572 6120 6d61 Input camera ma │ │ │ -000c4be0: 7472 6978 2e0a 7061 7261 6d65 7465 7220 trix..parameter │ │ │ -000c4bf0: 696e 6469 6361 7465 7320 7768 6574 6865 indicates whethe │ │ │ -000c4c00: 7220 7468 6973 206c 6f63 6174 696f 6e20 r this location │ │ │ -000c4c10: 7368 6f75 6c64 2062 6520 6174 2074 6865 should be at the │ │ │ -000c4c20: 2069 6d61 6765 2063 656e 7465 7220 6f72 image center or │ │ │ -000c4c30: 206e 6f74 2e3c 2f64 643e 0a3c 6474 3e52 not.
    .
    R │ │ │ -000c4c40: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    automatically g │ │ │ -000c4c60: 656e 6572 6174 6564 3c2f 6464 3e0a 3c2f enerated
    ....

  • .
  • │ │ │ -000c4c90: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    . │ │ │ -000c4d40: 3c68 333e 6765 744f 7074 696d 616c 4e65

    getOptimalNe │ │ │ -000c4d50: 7743 616d 6572 614d 6174 7269 783c 2f68 wCameraMatrix.
    .
    public │ │ │ -000c4dc0: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ -000c4dd0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;Mat │ │ │ -000c4e30: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  getOptim │ │ │ -000c4e60: 616c 4e65 7743 616d 6572 614d 6174 7269 alNewCameraMatri │ │ │ -000c4e70: 783c 2f73 7061 6e3e 3c77 6272 3e3c 7370 x(Mat  │ │ │ -000c4ee0: 6361 6d65 7261 4d61 7472 6978 2c0a 203c cameraMatrix,. < │ │ │ -000c4ef0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000c4f00: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000c4f10: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000c4f20: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat distCoef │ │ │ -000c4f40: 6673 2c0a 203c 6120 6872 6566 3d22 2e2e fs,. Size  │ │ │ -000c4f90: 696d 6167 6553 697a 652c 0a20 646f 7562 imageSize,. doub │ │ │ -000c4fa0: 6c65 266e 6273 703b 616c 7068 612c 0a20 le alpha,. │ │ │ -000c4fb0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Siz │ │ │ -000c4ff0: 653c 2f61 3e26 6e62 7370 3b6e 6577 496d e newIm │ │ │ -000c5000: 6753 697a 652c 0a20 3c61 2068 7265 663d gSize,. Rect&nb │ │ │ -000c5050: 7370 3b76 616c 6964 5069 7852 4f49 2c0a sp;validPixROI,. │ │ │ -000c5060: 2062 6f6f 6c65 616e 266e 6273 703b 6365 boolean ce │ │ │ -000c5070: 6e74 6572 5072 696e 6369 7061 6c50 6f69 nterPrincipalPoi │ │ │ -000c5080: 6e74 293c 2f73 7061 6e3e 3c2f 6469 763e nt)
    │ │ │ -000c5090: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Returns the │ │ │ -000c50b0: 6e65 7720 6361 6d65 7261 2069 6e74 7269 new camera intri │ │ │ -000c50c0: 6e73 6963 206d 6174 7269 7820 6261 7365 nsic matrix base │ │ │ -000c50d0: 6420 6f6e 2074 6865 2066 7265 6520 7363 d on the free sc │ │ │ -000c50e0: 616c 696e 6720 7061 7261 6d65 7465 722e aling parameter. │ │ │ -000c50f0: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -000c5110: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000c5120: 6464 3e3c 636f 6465 3e63 616d 6572 614d dd>cameraM │ │ │ -000c5130: 6174 7269 783c 2f63 6f64 653e 202d 2049 atrix - I │ │ │ -000c5140: 6e70 7574 2063 616d 6572 6120 696e 7472 nput camera intr │ │ │ -000c5150: 696e 7369 6320 6d61 7472 6978 2e3c 2f64 insic matrix..
    dis │ │ │ -000c5170: 7443 6f65 6666 733c 2f63 6f64 653e 202d tCoeffs - │ │ │ -000c5180: 2049 6e70 7574 2076 6563 746f 7220 6f66 Input vector of │ │ │ -000c5190: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ -000c51a0: 6669 6369 656e 7473 0a5c 285c 6469 7374 ficients.\(\dist │ │ │ -000c51b0: 636f 6566 6673 5c29 2e20 4966 2074 6865 coeffs\). If the │ │ │ -000c51c0: 2076 6563 746f 7220 6973 204e 554c 4c2f vector is NULL/ │ │ │ -000c51d0: 656d 7074 792c 2074 6865 207a 6572 6f20 empty, the zero │ │ │ -000c51e0: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ -000c51f0: 6963 6965 6e74 7320 6172 650a 6173 7375 icients are.assu │ │ │ -000c5200: 6d65 642e 3c2f 6464 3e0a 3c64 643e 3c63 med.
    .
    imageSize - Original │ │ │ -000c5230: 696d 6167 6520 7369 7a65 2e3c 2f64 643e image size.
    │ │ │ -000c5240: 0a3c 6464 3e3c 636f 6465 3e61 6c70 6861 .
    alpha │ │ │ -000c5250: 3c2f 636f 6465 3e20 2d20 4672 6565 2073 - Free s │ │ │ -000c5260: 6361 6c69 6e67 2070 6172 616d 6574 6572 caling parameter │ │ │ -000c5270: 2062 6574 7765 656e 2030 2028 7768 656e between 0 (when │ │ │ -000c5280: 2061 6c6c 2074 6865 2070 6978 656c 7320 all the pixels │ │ │ -000c5290: 696e 2074 6865 2075 6e64 6973 746f 7274 in the undistort │ │ │ -000c52a0: 6564 2069 6d61 6765 2061 7265 0a76 616c ed image are.val │ │ │ -000c52b0: 6964 2920 616e 6420 3120 2877 6865 6e20 id) and 1 (when │ │ │ -000c52c0: 616c 6c20 7468 6520 736f 7572 6365 2069 all the source i │ │ │ -000c52d0: 6d61 6765 2070 6978 656c 7320 6172 6520 mage pixels are │ │ │ -000c52e0: 7265 7461 696e 6564 2069 6e20 7468 6520 retained in the │ │ │ -000c52f0: 756e 6469 7374 6f72 7465 6420 696d 6167 undistorted imag │ │ │ -000c5300: 6529 2e20 5365 650a 2373 7465 7265 6f52 e). See.#stereoR │ │ │ -000c5310: 6563 7469 6679 2066 6f72 2064 6574 6169 ectify for detai │ │ │ -000c5320: 6c73 2e3c 2f64 643e 0a3c 6464 3e3c 636f ls.
    .
    newImgSize - Image siz │ │ │ -000c5350: 6520 6166 7465 7220 7265 6374 6966 6963 e after rectific │ │ │ -000c5360: 6174 696f 6e2e 2042 7920 6465 6661 756c ation. By defaul │ │ │ -000c5370: 742c 2069 7420 6973 2073 6574 2074 6f20 t, it is set to │ │ │ -000c5380: 696d 6167 6553 697a 6520 2e3c 2f64 643e imageSize .
    │ │ │ -000c5390: 0a3c 6464 3e3c 636f 6465 3e76 616c 6964 .
    valid │ │ │ -000c53a0: 5069 7852 4f49 3c2f 636f 6465 3e20 2d20 PixROI - │ │ │ -000c53b0: 4f70 7469 6f6e 616c 206f 7574 7075 7420 Optional output │ │ │ -000c53c0: 7265 6374 616e 676c 6520 7468 6174 206f rectangle that o │ │ │ -000c53d0: 7574 6c69 6e65 7320 616c 6c2d 676f 6f64 utlines all-good │ │ │ -000c53e0: 2d70 6978 656c 7320 7265 6769 6f6e 2069 -pixels region i │ │ │ -000c53f0: 6e20 7468 650a 756e 6469 7374 6f72 7465 n the.undistorte │ │ │ -000c5400: 6420 696d 6167 652e 2053 6565 2072 6f69 d image. See roi │ │ │ -000c5410: 312c 2072 6f69 3220 6465 7363 7269 7074 1, roi2 descript │ │ │ -000c5420: 696f 6e20 696e 2023 7374 6572 656f 5265 ion in #stereoRe │ │ │ -000c5430: 6374 6966 7920 2e3c 2f64 643e 0a3c 6464 ctify .
    .
    centerPri │ │ │ -000c5450: 6e63 6970 616c 506f 696e 743c 2f63 6f64 ncipalPoint - Optional fl │ │ │ -000c5470: 6167 2074 6861 7420 696e 6469 6361 7465 ag that indicate │ │ │ -000c5480: 7320 7768 6574 6865 7220 696e 2074 6865 s whether in the │ │ │ -000c5490: 206e 6577 2063 616d 6572 6120 696e 7472 new camera intr │ │ │ -000c54a0: 696e 7369 6320 6d61 7472 6978 2074 6865 insic matrix the │ │ │ -000c54b0: 0a70 7269 6e63 6970 616c 2070 6f69 6e74 .principal point │ │ │ -000c54c0: 2073 686f 756c 6420 6265 2061 7420 7468 should be at th │ │ │ -000c54d0: 6520 696d 6167 6520 6365 6e74 6572 206f e image center o │ │ │ -000c54e0: 7220 6e6f 742e 2042 7920 6465 6661 756c r not. By defaul │ │ │ -000c54f0: 742c 2074 6865 2070 7269 6e63 6970 616c t, the principal │ │ │ -000c5500: 2070 6f69 6e74 2069 7320 6368 6f73 656e point is chosen │ │ │ -000c5510: 2074 6f0a 6265 7374 2066 6974 2061 2073 to.best fit a s │ │ │ -000c5520: 7562 7365 7420 6f66 2074 6865 2073 6f75 ubset of the sou │ │ │ -000c5530: 7263 6520 696d 6167 6520 2864 6574 6572 rce image (deter │ │ │ -000c5540: 6d69 6e65 6420 6279 2061 6c70 6861 2920 mined by alpha) │ │ │ -000c5550: 746f 2074 6865 2063 6f72 7265 6374 6564 to the corrected │ │ │ -000c5560: 2069 6d61 6765 2e3c 2f64 643e 0a3c 6474 image.
    .
    Returns:
    .< │ │ │ -000c5580: 6464 3e6e 6577 5f63 616d 6572 615f 6d61 dd>new_camera_ma │ │ │ -000c5590: 7472 6978 204f 7574 7075 7420 6e65 7720 trix Output new │ │ │ -000c55a0: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ -000c55b0: 206d 6174 7269 782e 0a0a 5468 6520 6675 matrix...The fu │ │ │ -000c55c0: 6e63 7469 6f6e 2063 6f6d 7075 7465 7320 nction computes │ │ │ -000c55d0: 616e 6420 7265 7475 726e 7320 7468 6520 and returns the │ │ │ -000c55e0: 6f70 7469 6d61 6c20 6e65 7720 6361 6d65 optimal new came │ │ │ -000c55f0: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ -000c5600: 7269 7820 6261 7365 6420 6f6e 2074 6865 rix based on the │ │ │ -000c5610: 2066 7265 6520 7363 616c 696e 6720 7061 free scaling pa │ │ │ -000c5620: 7261 6d65 7465 722e 0a42 7920 7661 7279 rameter..By vary │ │ │ -000c5630: 696e 6720 7468 6973 2070 6172 616d 6574 ing this paramet │ │ │ -000c5640: 6572 2c20 796f 7520 6d61 7920 7265 7472 er, you may retr │ │ │ -000c5650: 6965 7665 206f 6e6c 7920 7365 6e73 6962 ieve only sensib │ │ │ -000c5660: 6c65 2070 6978 656c 7320 616c 7068 613d le pixels alpha= │ │ │ -000c5670: 3020 2c20 6b65 6570 2061 6c6c 2074 6865 0 , keep all the │ │ │ -000c5680: 206f 7269 6769 6e61 6c0a 696d 6167 6520 original.image │ │ │ -000c5690: 7069 7865 6c73 2069 6620 7468 6572 6520 pixels if there │ │ │ -000c56a0: 6973 2076 616c 7561 626c 6520 696e 666f is valuable info │ │ │ -000c56b0: 726d 6174 696f 6e20 696e 2074 6865 2063 rmation in the c │ │ │ -000c56c0: 6f72 6e65 7273 2061 6c70 6861 3d31 202c orners alpha=1 , │ │ │ -000c56d0: 206f 7220 6765 7420 736f 6d65 7468 696e or get somethin │ │ │ -000c56e0: 6720 696e 2062 6574 7765 656e 2e0a 5768 g in between..Wh │ │ │ -000c56f0: 656e 2061 6c70 6861 2667 743b 3020 2c20 en alpha>0 , │ │ │ -000c5700: 7468 6520 756e 6469 7374 6f72 7465 6420 the undistorted │ │ │ -000c5710: 7265 7375 6c74 2069 7320 6c69 6b65 6c79 result is likely │ │ │ -000c5720: 2074 6f20 6861 7665 2073 6f6d 6520 626c to have some bl │ │ │ -000c5730: 6163 6b20 7069 7865 6c73 2063 6f72 7265 ack pixels corre │ │ │ -000c5740: 7370 6f6e 6469 6e67 2074 6f0a 2276 6972 sponding to."vir │ │ │ -000c5750: 7475 616c 2220 7069 7865 6c73 206f 7574 tual" pixels out │ │ │ -000c5760: 7369 6465 206f 6620 7468 6520 6361 7074 side of the capt │ │ │ -000c5770: 7572 6564 2064 6973 746f 7274 6564 2069 ured distorted i │ │ │ -000c5780: 6d61 6765 2e20 5468 6520 6f72 6967 696e mage. The origin │ │ │ -000c5790: 616c 2063 616d 6572 6120 696e 7472 696e al camera intrin │ │ │ -000c57a0: 7369 6320 6d61 7472 6978 2c20 6469 7374 sic matrix, dist │ │ │ -000c57b0: 6f72 7469 6f6e 0a63 6f65 6666 6963 6965 ortion.coefficie │ │ │ -000c57c0: 6e74 732c 2074 6865 2063 6f6d 7075 7465 nts, the compute │ │ │ -000c57d0: 6420 6e65 7720 6361 6d65 7261 2069 6e74 d new camera int │ │ │ -000c57e0: 7269 6e73 6963 206d 6174 7269 782c 2061 rinsic matrix, a │ │ │ -000c57f0: 6e64 206e 6577 496d 6167 6553 697a 6520 nd newImageSize │ │ │ -000c5800: 7368 6f75 6c64 2062 6520 7061 7373 6564 should be passed │ │ │ -000c5810: 2074 6f0a 2369 6e69 7455 6e64 6973 746f to.#initUndisto │ │ │ -000c5820: 7274 5265 6374 6966 794d 6170 2074 6f20 rtRectifyMap to │ │ │ -000c5830: 7072 6f64 7563 6520 7468 6520 6d61 7073 produce the maps │ │ │ -000c5840: 2066 6f72 2023 7265 6d61 7020 2e3c 2f64 for #remap ..
    .
    . │ │ │ -000c5860: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e

    .
  • │ │ │ -000c5870: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    getOptimalNewCa │ │ │ -000c5930: 6d65 7261 4d61 7472 6978 3c2f 6833 3e0a meraMatrix

    . │ │ │ -000c5940: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ -000c5960: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ -000c59a0: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ -000c59b0: 3c73 7061 6e20 636c 6173 733d 2272 6574 Mat getOptimalN │ │ │ -000c5a40: 6577 4361 6d65 7261 4d61 7472 6978 3c2f ewCameraMatrix( │ │ │ -000c5ab0: 4d61 743c 2f61 3e26 6e62 7370 3b63 616d Mat cam │ │ │ -000c5ac0: 6572 614d 6174 7269 782c 0a20 3c61 2068 eraMatrix,. Mat& │ │ │ -000c5b10: 6e62 7370 3b64 6973 7443 6f65 6666 732c nbsp;distCoeffs, │ │ │ -000c5b20: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . S │ │ │ -000c5b60: 697a 653c 2f61 3e26 6e62 7370 3b69 6d61 ize ima │ │ │ -000c5b70: 6765 5369 7a65 2c0a 2064 6f75 626c 6526 geSize,. double& │ │ │ -000c5b80: 6e62 7370 3b61 6c70 6861 2c0a 203c 6120 nbsp;alpha,. Size newImgSi │ │ │ -000c5be0: 7a65 2c0a 203c 6120 6872 6566 3d22 2e2e ze,. Rect  │ │ │ -000c5c30: 7661 6c69 6450 6978 524f 4929 3c2f 7370 validPixROI)
    .
    Ret │ │ │ -000c5c60: 7572 6e73 2074 6865 206e 6577 2063 616d urns the new cam │ │ │ -000c5c70: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ -000c5c80: 7472 6978 2062 6173 6564 206f 6e20 7468 trix based on th │ │ │ -000c5c90: 6520 6672 6565 2073 6361 6c69 6e67 2070 e free scaling p │ │ │ -000c5ca0: 6172 616d 6574 6572 2e3c 2f64 6976 3e0a arameter.
    . │ │ │ -000c5cb0: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ -000c5cd0: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    cameraMatrix - Input ca │ │ │ -000c5d00: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -000c5d10: 6174 7269 782e 3c2f 6464 3e0a 3c64 643e atrix.
    .
    │ │ │ -000c5d20: 3c63 6f64 653e 6469 7374 436f 6566 6673 distCoeffs │ │ │ -000c5d30: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ -000c5d40: 7665 6374 6f72 206f 6620 6469 7374 6f72 vector of distor │ │ │ -000c5d50: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ -000c5d60: 730a 5c28 5c64 6973 7463 6f65 6666 735c s.\(\distcoeffs\ │ │ │ -000c5d70: 292e 2049 6620 7468 6520 7665 6374 6f72 ). If the vector │ │ │ -000c5d80: 2069 7320 4e55 4c4c 2f65 6d70 7479 2c20 is NULL/empty, │ │ │ -000c5d90: 7468 6520 7a65 726f 2064 6973 746f 7274 the zero distort │ │ │ -000c5da0: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ -000c5db0: 2061 7265 0a61 7373 756d 6564 2e3c 2f64 are.assumed..
    ima │ │ │ -000c5dd0: 6765 5369 7a65 3c2f 636f 6465 3e20 2d20 geSize - │ │ │ -000c5de0: 4f72 6967 696e 616c 2069 6d61 6765 2073 Original image s │ │ │ -000c5df0: 697a 652e 3c2f 6464 3e0a 3c64 643e 3c63 ize.
    .
    alpha │ │ │ -000c5e10: 202d 2046 7265 6520 7363 616c 696e 6720 - Free scaling │ │ │ -000c5e20: 7061 7261 6d65 7465 7220 6265 7477 6565 parameter betwee │ │ │ -000c5e30: 6e20 3020 2877 6865 6e20 616c 6c20 7468 n 0 (when all th │ │ │ -000c5e40: 6520 7069 7865 6c73 2069 6e20 7468 6520 e pixels in the │ │ │ -000c5e50: 756e 6469 7374 6f72 7465 6420 696d 6167 undistorted imag │ │ │ -000c5e60: 6520 6172 650a 7661 6c69 6429 2061 6e64 e are.valid) and │ │ │ -000c5e70: 2031 2028 7768 656e 2061 6c6c 2074 6865 1 (when all the │ │ │ -000c5e80: 2073 6f75 7263 6520 696d 6167 6520 7069 source image pi │ │ │ -000c5e90: 7865 6c73 2061 7265 2072 6574 6169 6e65 xels are retaine │ │ │ -000c5ea0: 6420 696e 2074 6865 2075 6e64 6973 746f d in the undisto │ │ │ -000c5eb0: 7274 6564 2069 6d61 6765 292e 2053 6565 rted image). See │ │ │ -000c5ec0: 0a23 7374 6572 656f 5265 6374 6966 7920 .#stereoRectify │ │ │ -000c5ed0: 666f 7220 6465 7461 696c 732e 3c2f 6464 for details.
    .
    newI │ │ │ -000c5ef0: 6d67 5369 7a65 3c2f 636f 6465 3e20 2d20 mgSize - │ │ │ -000c5f00: 496d 6167 6520 7369 7a65 2061 6674 6572 Image size after │ │ │ -000c5f10: 2072 6563 7469 6669 6361 7469 6f6e 2e20 rectification. │ │ │ -000c5f20: 4279 2064 6566 6175 6c74 2c20 6974 2069 By default, it i │ │ │ -000c5f30: 7320 7365 7420 746f 2069 6d61 6765 5369 s set to imageSi │ │ │ -000c5f40: 7a65 202e 3c2f 6464 3e0a 3c64 643e 3c63 ze .
    .
    validPixROI< │ │ │ -000c5f60: 2f63 6f64 653e 202d 204f 7074 696f 6e61 /code> - Optiona │ │ │ -000c5f70: 6c20 6f75 7470 7574 2072 6563 7461 6e67 l output rectang │ │ │ -000c5f80: 6c65 2074 6861 7420 6f75 746c 696e 6573 le that outlines │ │ │ -000c5f90: 2061 6c6c 2d67 6f6f 642d 7069 7865 6c73 all-good-pixels │ │ │ -000c5fa0: 2072 6567 696f 6e20 696e 2074 6865 0a75 region in the.u │ │ │ -000c5fb0: 6e64 6973 746f 7274 6564 2069 6d61 6765 ndistorted image │ │ │ -000c5fc0: 2e20 5365 6520 726f 6931 2c20 726f 6932 . See roi1, roi2 │ │ │ -000c5fd0: 2064 6573 6372 6970 7469 6f6e 2069 6e20 description in │ │ │ -000c5fe0: 2373 7465 7265 6f52 6563 7469 6679 202e #stereoRectify . │ │ │ -000c5ff0: 0a70 7269 6e63 6970 616c 2070 6f69 6e74 .principal point │ │ │ -000c6000: 2073 686f 756c 6420 6265 2061 7420 7468 should be at th │ │ │ -000c6010: 6520 696d 6167 6520 6365 6e74 6572 206f e image center o │ │ │ -000c6020: 7220 6e6f 742e 2042 7920 6465 6661 756c r not. By defaul │ │ │ -000c6030: 742c 2074 6865 2070 7269 6e63 6970 616c t, the principal │ │ │ -000c6040: 2070 6f69 6e74 2069 7320 6368 6f73 656e point is chosen │ │ │ -000c6050: 2074 6f0a 6265 7374 2066 6974 2061 2073 to.best fit a s │ │ │ -000c6060: 7562 7365 7420 6f66 2074 6865 2073 6f75 ubset of the sou │ │ │ -000c6070: 7263 6520 696d 6167 6520 2864 6574 6572 rce image (deter │ │ │ -000c6080: 6d69 6e65 6420 6279 2061 6c70 6861 2920 mined by alpha) │ │ │ -000c6090: 746f 2074 6865 2063 6f72 7265 6374 6564 to the corrected │ │ │ -000c60a0: 2069 6d61 6765 2e3c 2f64 643e 0a3c 6474 image.
    .
    Returns:
    .< │ │ │ -000c60c0: 6464 3e6e 6577 5f63 616d 6572 615f 6d61 dd>new_camera_ma │ │ │ -000c60d0: 7472 6978 204f 7574 7075 7420 6e65 7720 trix Output new │ │ │ -000c60e0: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ -000c60f0: 206d 6174 7269 782e 0a0a 5468 6520 6675 matrix...The fu │ │ │ -000c6100: 6e63 7469 6f6e 2063 6f6d 7075 7465 7320 nction computes │ │ │ -000c6110: 616e 6420 7265 7475 726e 7320 7468 6520 and returns the │ │ │ -000c6120: 6f70 7469 6d61 6c20 6e65 7720 6361 6d65 optimal new came │ │ │ -000c6130: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ -000c6140: 7269 7820 6261 7365 6420 6f6e 2074 6865 rix based on the │ │ │ -000c6150: 2066 7265 6520 7363 616c 696e 6720 7061 free scaling pa │ │ │ -000c6160: 7261 6d65 7465 722e 0a42 7920 7661 7279 rameter..By vary │ │ │ -000c6170: 696e 6720 7468 6973 2070 6172 616d 6574 ing this paramet │ │ │ -000c6180: 6572 2c20 796f 7520 6d61 7920 7265 7472 er, you may retr │ │ │ -000c6190: 6965 7665 206f 6e6c 7920 7365 6e73 6962 ieve only sensib │ │ │ -000c61a0: 6c65 2070 6978 656c 7320 616c 7068 613d le pixels alpha= │ │ │ -000c61b0: 3020 2c20 6b65 6570 2061 6c6c 2074 6865 0 , keep all the │ │ │ -000c61c0: 206f 7269 6769 6e61 6c0a 696d 6167 6520 original.image │ │ │ -000c61d0: 7069 7865 6c73 2069 6620 7468 6572 6520 pixels if there │ │ │ -000c61e0: 6973 2076 616c 7561 626c 6520 696e 666f is valuable info │ │ │ -000c61f0: 726d 6174 696f 6e20 696e 2074 6865 2063 rmation in the c │ │ │ -000c6200: 6f72 6e65 7273 2061 6c70 6861 3d31 202c orners alpha=1 , │ │ │ -000c6210: 206f 7220 6765 7420 736f 6d65 7468 696e or get somethin │ │ │ -000c6220: 6720 696e 2062 6574 7765 656e 2e0a 5768 g in between..Wh │ │ │ -000c6230: 656e 2061 6c70 6861 2667 743b 3020 2c20 en alpha>0 , │ │ │ -000c6240: 7468 6520 756e 6469 7374 6f72 7465 6420 the undistorted │ │ │ -000c6250: 7265 7375 6c74 2069 7320 6c69 6b65 6c79 result is likely │ │ │ -000c6260: 2074 6f20 6861 7665 2073 6f6d 6520 626c to have some bl │ │ │ -000c6270: 6163 6b20 7069 7865 6c73 2063 6f72 7265 ack pixels corre │ │ │ -000c6280: 7370 6f6e 6469 6e67 2074 6f0a 2276 6972 sponding to."vir │ │ │ -000c6290: 7475 616c 2220 7069 7865 6c73 206f 7574 tual" pixels out │ │ │ -000c62a0: 7369 6465 206f 6620 7468 6520 6361 7074 side of the capt │ │ │ -000c62b0: 7572 6564 2064 6973 746f 7274 6564 2069 ured distorted i │ │ │ -000c62c0: 6d61 6765 2e20 5468 6520 6f72 6967 696e mage. The origin │ │ │ -000c62d0: 616c 2063 616d 6572 6120 696e 7472 696e al camera intrin │ │ │ -000c62e0: 7369 6320 6d61 7472 6978 2c20 6469 7374 sic matrix, dist │ │ │ -000c62f0: 6f72 7469 6f6e 0a63 6f65 6666 6963 6965 ortion.coefficie │ │ │ -000c6300: 6e74 732c 2074 6865 2063 6f6d 7075 7465 nts, the compute │ │ │ -000c6310: 6420 6e65 7720 6361 6d65 7261 2069 6e74 d new camera int │ │ │ -000c6320: 7269 6e73 6963 206d 6174 7269 782c 2061 rinsic matrix, a │ │ │ -000c6330: 6e64 206e 6577 496d 6167 6553 697a 6520 nd newImageSize │ │ │ -000c6340: 7368 6f75 6c64 2062 6520 7061 7373 6564 should be passed │ │ │ -000c6350: 2074 6f0a 2369 6e69 7455 6e64 6973 746f to.#initUndisto │ │ │ -000c6360: 7274 5265 6374 6966 794d 6170 2074 6f20 rtRectifyMap to │ │ │ -000c6370: 7072 6f64 7563 6520 7468 6520 6d61 7073 produce the maps │ │ │ -000c6380: 2066 6f72 2023 7265 6d61 7020 2e3c 2f64 for #remap ..
    .
    . │ │ │ -000c63a0: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e
    .
  • │ │ │ -000c63b0: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    getO │ │ │ -000c6450: 7074 696d 616c 4e65 7743 616d 6572 614d ptimalNewCameraM │ │ │ -000c6460: 6174 7269 783c 2f68 333e 0a3c 6469 7620 atrix

    .
    .
    public static Mat& │ │ │ -000c6540: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -000c6560: 6765 744f 7074 696d 616c 4e65 7743 616d getOptimalNewCam │ │ │ -000c6570: 6572 614d 6174 7269 783c 2f73 7061 6e3e eraMatrix │ │ │ -000c6580: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ -000c65a0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000c65b0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000c65c0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000c65d0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ -000c65f0: 7472 6978 2c0a 203c 6120 6872 6566 3d22 trix,. Mat  │ │ │ -000c6640: 6469 7374 436f 6566 6673 2c0a 203c 6120 distCoeffs,. Size imageSiz │ │ │ -000c66a0: 652c 0a20 646f 7562 6c65 266e 6273 703b e,. double  │ │ │ -000c66b0: 616c 7068 612c 0a20 3c61 2068 7265 663d alpha,. Size&nb │ │ │ -000c6700: 7370 3b6e 6577 496d 6753 697a 6529 3c2f sp;newImgSize)
    .
    R │ │ │ -000c6730: 6574 7572 6e73 2074 6865 206e 6577 2063 eturns the new c │ │ │ -000c6740: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ -000c6750: 6d61 7472 6978 2062 6173 6564 206f 6e20 matrix based on │ │ │ -000c6760: 7468 6520 6672 6565 2073 6361 6c69 6e67 the free scaling │ │ │ -000c6770: 2070 6172 616d 6574 6572 2e3c 2f64 6976 parameter.
    .
    .
    Paramet │ │ │ -000c67a0: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    cameraMatrix │ │ │ -000c67c0: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ -000c67d0: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ -000c67e0: 206d 6174 7269 782e 3c2f 6464 3e0a 3c64 matrix.
    .distCoef │ │ │ -000c6800: 6673 3c2f 636f 6465 3e20 2d20 496e 7075 fs - Inpu │ │ │ -000c6810: 7420 7665 6374 6f72 206f 6620 6469 7374 t vector of dist │ │ │ -000c6820: 6f72 7469 6f6e 2063 6f65 6666 6963 6965 ortion coefficie │ │ │ -000c6830: 6e74 730a 5c28 5c64 6973 7463 6f65 6666 nts.\(\distcoeff │ │ │ -000c6840: 735c 292e 2049 6620 7468 6520 7665 6374 s\). If the vect │ │ │ -000c6850: 6f72 2069 7320 4e55 4c4c 2f65 6d70 7479 or is NULL/empty │ │ │ -000c6860: 2c20 7468 6520 7a65 726f 2064 6973 746f , the zero disto │ │ │ -000c6870: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ -000c6880: 7473 2061 7265 0a61 7373 756d 6564 2e3c ts are.assumed.< │ │ │ -000c6890: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e69 /dd>.
    i │ │ │ -000c68a0: 6d61 6765 5369 7a65 3c2f 636f 6465 3e20 mageSize │ │ │ -000c68b0: 2d20 4f72 6967 696e 616c 2069 6d61 6765 - Original image │ │ │ -000c68c0: 2073 697a 652e 3c2f 6464 3e0a 3c64 643e size.
    .
    │ │ │ -000c68d0: 3c63 6f64 653e 616c 7068 613c 2f63 6f64 alpha - Free scalin │ │ │ -000c68f0: 6720 7061 7261 6d65 7465 7220 6265 7477 g parameter betw │ │ │ -000c6900: 6565 6e20 3020 2877 6865 6e20 616c 6c20 een 0 (when all │ │ │ -000c6910: 7468 6520 7069 7865 6c73 2069 6e20 7468 the pixels in th │ │ │ -000c6920: 6520 756e 6469 7374 6f72 7465 6420 696d e undistorted im │ │ │ -000c6930: 6167 6520 6172 650a 7661 6c69 6429 2061 age are.valid) a │ │ │ -000c6940: 6e64 2031 2028 7768 656e 2061 6c6c 2074 nd 1 (when all t │ │ │ -000c6950: 6865 2073 6f75 7263 6520 696d 6167 6520 he source image │ │ │ -000c6960: 7069 7865 6c73 2061 7265 2072 6574 6169 pixels are retai │ │ │ -000c6970: 6e65 6420 696e 2074 6865 2075 6e64 6973 ned in the undis │ │ │ -000c6980: 746f 7274 6564 2069 6d61 6765 292e 2053 torted image). S │ │ │ -000c6990: 6565 0a23 7374 6572 656f 5265 6374 6966 ee.#stereoRectif │ │ │ -000c69a0: 7920 666f 7220 6465 7461 696c 732e 3c2f y for details..
    ne │ │ │ -000c69c0: 7749 6d67 5369 7a65 3c2f 636f 6465 3e20 wImgSize │ │ │ -000c69d0: 2d20 496d 6167 6520 7369 7a65 2061 6674 - Image size aft │ │ │ -000c69e0: 6572 2072 6563 7469 6669 6361 7469 6f6e er rectification │ │ │ -000c69f0: 2e20 4279 2064 6566 6175 6c74 2c20 6974 . By default, it │ │ │ -000c6a00: 2069 7320 7365 7420 746f 2069 6d61 6765 is set to image │ │ │ -000c6a10: 5369 7a65 202e 0a75 6e64 6973 746f 7274 Size ..undistort │ │ │ -000c6a20: 6564 2069 6d61 6765 2e20 5365 6520 726f ed image. See ro │ │ │ -000c6a30: 6931 2c20 726f 6932 2064 6573 6372 6970 i1, roi2 descrip │ │ │ -000c6a40: 7469 6f6e 2069 6e20 2373 7465 7265 6f52 tion in #stereoR │ │ │ -000c6a50: 6563 7469 6679 202e 0a70 7269 6e63 6970 ectify ..princip │ │ │ -000c6a60: 616c 2070 6f69 6e74 2073 686f 756c 6420 al point should │ │ │ -000c6a70: 6265 2061 7420 7468 6520 696d 6167 6520 be at the image │ │ │ -000c6a80: 6365 6e74 6572 206f 7220 6e6f 742e 2042 center or not. B │ │ │ -000c6a90: 7920 6465 6661 756c 742c 2074 6865 2070 y default, the p │ │ │ -000c6aa0: 7269 6e63 6970 616c 2070 6f69 6e74 2069 rincipal point i │ │ │ -000c6ab0: 7320 6368 6f73 656e 2074 6f0a 6265 7374 s chosen to.best │ │ │ -000c6ac0: 2066 6974 2061 2073 7562 7365 7420 6f66 fit a subset of │ │ │ -000c6ad0: 2074 6865 2073 6f75 7263 6520 696d 6167 the source imag │ │ │ -000c6ae0: 6520 2864 6574 6572 6d69 6e65 6420 6279 e (determined by │ │ │ -000c6af0: 2061 6c70 6861 2920 746f 2074 6865 2063 alpha) to the c │ │ │ -000c6b00: 6f72 7265 6374 6564 2069 6d61 6765 2e3c orrected image.< │ │ │ -000c6b10: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ -000c6b20: 3a3c 2f64 743e 0a3c 6464 3e6e 6577 5f63 :
    .
    new_c │ │ │ -000c6b30: 616d 6572 615f 6d61 7472 6978 204f 7574 amera_matrix Out │ │ │ -000c6b40: 7075 7420 6e65 7720 6361 6d65 7261 2069 put new camera i │ │ │ -000c6b50: 6e74 7269 6e73 6963 206d 6174 7269 782e ntrinsic matrix. │ │ │ -000c6b60: 0a0a 5468 6520 6675 6e63 7469 6f6e 2063 ..The function c │ │ │ -000c6b70: 6f6d 7075 7465 7320 616e 6420 7265 7475 omputes and retu │ │ │ -000c6b80: 726e 7320 7468 6520 6f70 7469 6d61 6c20 rns the optimal │ │ │ -000c6b90: 6e65 7720 6361 6d65 7261 2069 6e74 7269 new camera intri │ │ │ -000c6ba0: 6e73 6963 206d 6174 7269 7820 6261 7365 nsic matrix base │ │ │ -000c6bb0: 6420 6f6e 2074 6865 2066 7265 6520 7363 d on the free sc │ │ │ -000c6bc0: 616c 696e 6720 7061 7261 6d65 7465 722e aling parameter. │ │ │ -000c6bd0: 0a42 7920 7661 7279 696e 6720 7468 6973 .By varying this │ │ │ -000c6be0: 2070 6172 616d 6574 6572 2c20 796f 7520 parameter, you │ │ │ -000c6bf0: 6d61 7920 7265 7472 6965 7665 206f 6e6c may retrieve onl │ │ │ -000c6c00: 7920 7365 6e73 6962 6c65 2070 6978 656c y sensible pixel │ │ │ -000c6c10: 7320 616c 7068 613d 3020 2c20 6b65 6570 s alpha=0 , keep │ │ │ -000c6c20: 2061 6c6c 2074 6865 206f 7269 6769 6e61 all the origina │ │ │ -000c6c30: 6c0a 696d 6167 6520 7069 7865 6c73 2069 l.image pixels i │ │ │ -000c6c40: 6620 7468 6572 6520 6973 2076 616c 7561 f there is valua │ │ │ -000c6c50: 626c 6520 696e 666f 726d 6174 696f 6e20 ble information │ │ │ -000c6c60: 696e 2074 6865 2063 6f72 6e65 7273 2061 in the corners a │ │ │ -000c6c70: 6c70 6861 3d31 202c 206f 7220 6765 7420 lpha=1 , or get │ │ │ -000c6c80: 736f 6d65 7468 696e 6720 696e 2062 6574 something in bet │ │ │ -000c6c90: 7765 656e 2e0a 5768 656e 2061 6c70 6861 ween..When alpha │ │ │ -000c6ca0: 2667 743b 3020 2c20 7468 6520 756e 6469 >0 , the undi │ │ │ -000c6cb0: 7374 6f72 7465 6420 7265 7375 6c74 2069 storted result i │ │ │ -000c6cc0: 7320 6c69 6b65 6c79 2074 6f20 6861 7665 s likely to have │ │ │ -000c6cd0: 2073 6f6d 6520 626c 6163 6b20 7069 7865 some black pixe │ │ │ -000c6ce0: 6c73 2063 6f72 7265 7370 6f6e 6469 6e67 ls corresponding │ │ │ -000c6cf0: 2074 6f0a 2276 6972 7475 616c 2220 7069 to."virtual" pi │ │ │ -000c6d00: 7865 6c73 206f 7574 7369 6465 206f 6620 xels outside of │ │ │ -000c6d10: 7468 6520 6361 7074 7572 6564 2064 6973 the captured dis │ │ │ -000c6d20: 746f 7274 6564 2069 6d61 6765 2e20 5468 torted image. Th │ │ │ -000c6d30: 6520 6f72 6967 696e 616c 2063 616d 6572 e original camer │ │ │ -000c6d40: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ -000c6d50: 6978 2c20 6469 7374 6f72 7469 6f6e 0a63 ix, distortion.c │ │ │ -000c6d60: 6f65 6666 6963 6965 6e74 732c 2074 6865 oefficients, the │ │ │ -000c6d70: 2063 6f6d 7075 7465 6420 6e65 7720 6361 computed new ca │ │ │ -000c6d80: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -000c6d90: 6174 7269 782c 2061 6e64 206e 6577 496d atrix, and newIm │ │ │ -000c6da0: 6167 6553 697a 6520 7368 6f75 6c64 2062 ageSize should b │ │ │ -000c6db0: 6520 7061 7373 6564 2074 6f0a 2369 6e69 e passed to.#ini │ │ │ -000c6dc0: 7455 6e64 6973 746f 7274 5265 6374 6966 tUndistortRectif │ │ │ -000c6dd0: 794d 6170 2074 6f20 7072 6f64 7563 6520 yMap to produce │ │ │ -000c6de0: 7468 6520 6d61 7073 2066 6f72 2023 7265 the maps for #re │ │ │ -000c6df0: 6d61 7020 2e3c 2f64 643e 0a3c 2f64 6c3e map .
    .
    │ │ │ -000c6e00: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • ..

    g │ │ │ -000c6ea0: 6574 4f70 7469 6d61 6c4e 6577 4361 6d65 etOptimalNewCame │ │ │ -000c6eb0: 7261 4d61 7472 6978 3c2f 6833 3e0a 3c64 raMatrix

    ..public stati │ │ │ -000c6f20: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c Mat getOptimalNew │ │ │ -000c6fc0: 4361 6d65 7261 4d61 7472 6978 3c2f 7370 CameraMatrix(Ma │ │ │ -000c7030: 743c 2f61 3e26 6e62 7370 3b63 616d 6572 t camer │ │ │ -000c7040: 614d 6174 7269 782c 0a20 3c61 2068 7265 aMatrix,. Mat&nb │ │ │ -000c7090: 7370 3b64 6973 7443 6f65 6666 732c 0a20 sp;distCoeffs,. │ │ │ -000c70a0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Siz │ │ │ -000c70e0: 653c 2f61 3e26 6e62 7370 3b69 6d61 6765 e image │ │ │ -000c70f0: 5369 7a65 2c0a 2064 6f75 626c 6526 6e62 Size,. double&nb │ │ │ -000c7100: 7370 3b61 6c70 6861 293c 2f73 7061 6e3e sp;alpha) │ │ │ -000c7110: 3c2f 6469 763e 0a3c 6469 7620 636c 6173 .
    Return │ │ │ -000c7130: 7320 7468 6520 6e65 7720 6361 6d65 7261 s the new camera │ │ │ -000c7140: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ -000c7150: 7820 6261 7365 6420 6f6e 2074 6865 2066 x based on the f │ │ │ -000c7160: 7265 6520 7363 616c 696e 6720 7061 7261 ree scaling para │ │ │ -000c7170: 6d65 7465 722e 3c2f 6469 763e 0a3c 646c meter.
    .
    . │ │ │ -000c7190: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -000c71a0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e63 /dt>.
    c │ │ │ -000c71b0: 616d 6572 614d 6174 7269 783c 2f63 6f64 ameraMatrix - Input camer │ │ │ -000c71d0: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ -000c71e0: 6978 2e3c 2f64 643e 0a3c 6464 3e3c 636f ix.
    .
    distCoeffs - Input vec │ │ │ -000c7210: 746f 7220 6f66 2064 6973 746f 7274 696f tor of distortio │ │ │ -000c7220: 6e20 636f 6566 6669 6369 656e 7473 0a5c n coefficients.\ │ │ │ -000c7230: 285c 6469 7374 636f 6566 6673 5c29 2e20 (\distcoeffs\). │ │ │ -000c7240: 4966 2074 6865 2076 6563 746f 7220 6973 If the vector is │ │ │ -000c7250: 204e 554c 4c2f 656d 7074 792c 2074 6865 NULL/empty, the │ │ │ -000c7260: 207a 6572 6f20 6469 7374 6f72 7469 6f6e zero distortion │ │ │ -000c7270: 2063 6f65 6666 6963 6965 6e74 7320 6172 coefficients ar │ │ │ -000c7280: 650a 6173 7375 6d65 642e 3c2f 6464 3e0a e.assumed.
    . │ │ │ -000c7290: 3c64 643e 3c63 6f64 653e 696d 6167 6553
    imageS │ │ │ -000c72a0: 697a 653c 2f63 6f64 653e 202d 204f 7269 ize - Ori │ │ │ -000c72b0: 6769 6e61 6c20 696d 6167 6520 7369 7a65 ginal image size │ │ │ -000c72c0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    alpha - │ │ │ -000c72e0: 4672 6565 2073 6361 6c69 6e67 2070 6172 Free scaling par │ │ │ -000c72f0: 616d 6574 6572 2062 6574 7765 656e 2030 ameter between 0 │ │ │ -000c7300: 2028 7768 656e 2061 6c6c 2074 6865 2070 (when all the p │ │ │ -000c7310: 6978 656c 7320 696e 2074 6865 2075 6e64 ixels in the und │ │ │ -000c7320: 6973 746f 7274 6564 2069 6d61 6765 2061 istorted image a │ │ │ -000c7330: 7265 0a76 616c 6964 2920 616e 6420 3120 re.valid) and 1 │ │ │ -000c7340: 2877 6865 6e20 616c 6c20 7468 6520 736f (when all the so │ │ │ -000c7350: 7572 6365 2069 6d61 6765 2070 6978 656c urce image pixel │ │ │ -000c7360: 7320 6172 6520 7265 7461 696e 6564 2069 s are retained i │ │ │ -000c7370: 6e20 7468 6520 756e 6469 7374 6f72 7465 n the undistorte │ │ │ -000c7380: 6420 696d 6167 6529 2e20 5365 650a 2373 d image). See.#s │ │ │ -000c7390: 7465 7265 6f52 6563 7469 6679 2066 6f72 tereoRectify for │ │ │ -000c73a0: 2064 6574 6169 6c73 2e0a 756e 6469 7374 details..undist │ │ │ -000c73b0: 6f72 7465 6420 696d 6167 652e 2053 6565 orted image. See │ │ │ -000c73c0: 2072 6f69 312c 2072 6f69 3220 6465 7363 roi1, roi2 desc │ │ │ -000c73d0: 7269 7074 696f 6e20 696e 2023 7374 6572 ription in #ster │ │ │ -000c73e0: 656f 5265 6374 6966 7920 2e0a 7072 696e eoRectify ..prin │ │ │ -000c73f0: 6369 7061 6c20 706f 696e 7420 7368 6f75 cipal point shou │ │ │ -000c7400: 6c64 2062 6520 6174 2074 6865 2069 6d61 ld be at the ima │ │ │ -000c7410: 6765 2063 656e 7465 7220 6f72 206e 6f74 ge center or not │ │ │ -000c7420: 2e20 4279 2064 6566 6175 6c74 2c20 7468 . By default, th │ │ │ -000c7430: 6520 7072 696e 6369 7061 6c20 706f 696e e principal poin │ │ │ -000c7440: 7420 6973 2063 686f 7365 6e20 746f 0a62 t is chosen to.b │ │ │ -000c7450: 6573 7420 6669 7420 6120 7375 6273 6574 est fit a subset │ │ │ -000c7460: 206f 6620 7468 6520 736f 7572 6365 2069 of the source i │ │ │ -000c7470: 6d61 6765 2028 6465 7465 726d 696e 6564 mage (determined │ │ │ -000c7480: 2062 7920 616c 7068 6129 2074 6f20 7468 by alpha) to th │ │ │ -000c7490: 6520 636f 7272 6563 7465 6420 696d 6167 e corrected imag │ │ │ -000c74a0: 652e 3c2f 6464 3e0a 3c64 743e 5265 7475 e.
    .
    Retu │ │ │ -000c74b0: 726e 733a 3c2f 6474 3e0a 3c64 643e 6e65 rns:
    .
    ne │ │ │ -000c74c0: 775f 6361 6d65 7261 5f6d 6174 7269 7820 w_camera_matrix │ │ │ -000c74d0: 4f75 7470 7574 206e 6577 2063 616d 6572 Output new camer │ │ │ -000c74e0: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ -000c74f0: 6978 2e0a 0a54 6865 2066 756e 6374 696f ix...The functio │ │ │ -000c7500: 6e20 636f 6d70 7574 6573 2061 6e64 2072 n computes and r │ │ │ -000c7510: 6574 7572 6e73 2074 6865 206f 7074 696d eturns the optim │ │ │ -000c7520: 616c 206e 6577 2063 616d 6572 6120 696e al new camera in │ │ │ -000c7530: 7472 696e 7369 6320 6d61 7472 6978 2062 trinsic matrix b │ │ │ -000c7540: 6173 6564 206f 6e20 7468 6520 6672 6565 ased on the free │ │ │ -000c7550: 2073 6361 6c69 6e67 2070 6172 616d 6574 scaling paramet │ │ │ -000c7560: 6572 2e0a 4279 2076 6172 7969 6e67 2074 er..By varying t │ │ │ -000c7570: 6869 7320 7061 7261 6d65 7465 722c 2079 his parameter, y │ │ │ -000c7580: 6f75 206d 6179 2072 6574 7269 6576 6520 ou may retrieve │ │ │ -000c7590: 6f6e 6c79 2073 656e 7369 626c 6520 7069 only sensible pi │ │ │ -000c75a0: 7865 6c73 2061 6c70 6861 3d30 202c 206b xels alpha=0 , k │ │ │ -000c75b0: 6565 7020 616c 6c20 7468 6520 6f72 6967 eep all the orig │ │ │ -000c75c0: 696e 616c 0a69 6d61 6765 2070 6978 656c inal.image pixel │ │ │ -000c75d0: 7320 6966 2074 6865 7265 2069 7320 7661 s if there is va │ │ │ -000c75e0: 6c75 6162 6c65 2069 6e66 6f72 6d61 7469 luable informati │ │ │ -000c75f0: 6f6e 2069 6e20 7468 6520 636f 726e 6572 on in the corner │ │ │ -000c7600: 7320 616c 7068 613d 3120 2c20 6f72 2067 s alpha=1 , or g │ │ │ -000c7610: 6574 2073 6f6d 6574 6869 6e67 2069 6e20 et something in │ │ │ -000c7620: 6265 7477 6565 6e2e 0a57 6865 6e20 616c between..When al │ │ │ -000c7630: 7068 6126 6774 3b30 202c 2074 6865 2075 pha>0 , the u │ │ │ -000c7640: 6e64 6973 746f 7274 6564 2072 6573 756c ndistorted resul │ │ │ -000c7650: 7420 6973 206c 696b 656c 7920 746f 2068 t is likely to h │ │ │ -000c7660: 6176 6520 736f 6d65 2062 6c61 636b 2070 ave some black p │ │ │ -000c7670: 6978 656c 7320 636f 7272 6573 706f 6e64 ixels correspond │ │ │ -000c7680: 696e 6720 746f 0a22 7669 7274 7561 6c22 ing to."virtual" │ │ │ -000c7690: 2070 6978 656c 7320 6f75 7473 6964 6520 pixels outside │ │ │ -000c76a0: 6f66 2074 6865 2063 6170 7475 7265 6420 of the captured │ │ │ -000c76b0: 6469 7374 6f72 7465 6420 696d 6167 652e distorted image. │ │ │ -000c76c0: 2054 6865 206f 7269 6769 6e61 6c20 6361 The original ca │ │ │ -000c76d0: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -000c76e0: 6174 7269 782c 2064 6973 746f 7274 696f atrix, distortio │ │ │ -000c76f0: 6e0a 636f 6566 6669 6369 656e 7473 2c20 n.coefficients, │ │ │ -000c7700: 7468 6520 636f 6d70 7574 6564 206e 6577 the computed new │ │ │ -000c7710: 2063 616d 6572 6120 696e 7472 696e 7369 camera intrinsi │ │ │ -000c7720: 6320 6d61 7472 6978 2c20 616e 6420 6e65 c matrix, and ne │ │ │ -000c7730: 7749 6d61 6765 5369 7a65 2073 686f 756c wImageSize shoul │ │ │ -000c7740: 6420 6265 2070 6173 7365 6420 746f 0a23 d be passed to.# │ │ │ -000c7750: 696e 6974 556e 6469 7374 6f72 7452 6563 initUndistortRec │ │ │ -000c7760: 7469 6679 4d61 7020 746f 2070 726f 6475 tifyMap to produ │ │ │ -000c7770: 6365 2074 6865 206d 6170 7320 666f 7220 ce the maps for │ │ │ -000c7780: 2372 656d 6170 202e 3c2f 6464 3e0a 3c2f #remap .
    ....
  • .
  • │ │ │ -000c77b0: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    undis │ │ │ -000c7890: 746f 7274 506f 696e 7473 3c2f 6833 3e0a tortPoints

    . │ │ │ -000c78a0: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ -000c78c0: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ -000c7900: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ -000c7910: 3c73 7061 6e20 636c 6173 733d 2272 6574 void undistortP │ │ │ -000c7960: 6f69 6e74 733c 2f73 7061 6e3e 3c77 6272 oints( │ │ │ -000c79d0: 4d61 744f 6650 6f69 6e74 3266 3c2f 613e MatOfPoint2f │ │ │ -000c79e0: 266e 6273 703b 7372 632c 0a20 3c61 2068  src,. MatOfPoint2f dst,. Mat │ │ │ -000c7a90: 266e 6273 703b 6361 6d65 7261 4d61 7472  cameraMatr │ │ │ -000c7aa0: 6978 2c0a 203c 6120 6872 6566 3d22 2e2e ix,. Mat di │ │ │ -000c7af0: 7374 436f 6566 6673 2c0a 203c 6120 6872 stCoeffs,. Mat&n │ │ │ -000c7b40: 6273 703b 522c 0a20 3c61 2068 7265 663d bsp;R,. Mat  │ │ │ -000c7b90: 3b50 2c0a 203c 6120 6872 6566 3d22 2e2e ;P,. TermCr │ │ │ -000c7be0: 6974 6572 6961 3c2f 613e 266e 6273 703b iteria  │ │ │ -000c7bf0: 6372 6974 6572 6961 293c 2f73 7061 6e3e criteria) │ │ │ -000c7c00: 3c2f 6469 763e 0a3c 6469 7620 636c 6173
    .
    Comput │ │ │ -000c7c20: 6573 2074 6865 2069 6465 616c 2070 6f69 es the ideal poi │ │ │ -000c7c30: 6e74 2063 6f6f 7264 696e 6174 6573 2066 nt coordinates f │ │ │ -000c7c40: 726f 6d20 7468 6520 6f62 7365 7276 6564 rom the observed │ │ │ -000c7c50: 2070 6f69 6e74 2063 6f6f 7264 696e 6174 point coordinat │ │ │ -000c7c60: 6573 2e0a 0a54 6865 2066 756e 6374 696f es...The functio │ │ │ -000c7c70: 6e20 6973 2073 696d 696c 6172 2074 6f20 n is similar to │ │ │ -000c7c80: 2375 6e64 6973 746f 7274 2061 6e64 2023 #undistort and # │ │ │ -000c7c90: 696e 6974 556e 6469 7374 6f72 7452 6563 initUndistortRec │ │ │ -000c7ca0: 7469 6679 4d61 7020 6275 7420 6974 206f tifyMap but it o │ │ │ -000c7cb0: 7065 7261 7465 7320 6f6e 2061 0a73 7061 perates on a.spa │ │ │ -000c7cc0: 7273 6520 7365 7420 6f66 2070 6f69 6e74 rse set of point │ │ │ -000c7cd0: 7320 696e 7374 6561 6420 6f66 2061 2072 s instead of a r │ │ │ -000c7ce0: 6173 7465 7220 696d 6167 652e 2041 6c73 aster image. Als │ │ │ -000c7cf0: 6f20 7468 6520 6675 6e63 7469 6f6e 2070 o the function p │ │ │ -000c7d00: 6572 666f 726d 7320 6120 7265 7665 7273 erforms a revers │ │ │ -000c7d10: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ -000c7d20: 0a74 6f20 2023 7072 6f6a 6563 7450 6f69 .to #projectPoi │ │ │ -000c7d30: 6e74 732e 2049 6e20 6361 7365 206f 6620 nts. In case of │ │ │ -000c7d40: 6120 3344 206f 626a 6563 742c 2069 7420 a 3D object, it │ │ │ -000c7d50: 646f 6573 206e 6f74 2072 6563 6f6e 7374 does not reconst │ │ │ -000c7d60: 7275 6374 2069 7473 2033 4420 636f 6f72 ruct its 3D coor │ │ │ -000c7d70: 6469 6e61 7465 732c 2062 7574 2066 6f72 dinates, but for │ │ │ -000c7d80: 2061 0a70 6c61 6e61 7220 6f62 6a65 6374 a.planar object │ │ │ -000c7d90: 2c20 6974 2064 6f65 732c 2075 7020 746f , it does, up to │ │ │ -000c7da0: 2061 2074 7261 6e73 6c61 7469 6f6e 2076 a translation v │ │ │ -000c7db0: 6563 746f 722c 2069 6620 7468 6520 7072 ector, if the pr │ │ │ -000c7dc0: 6f70 6572 2052 2069 7320 7370 6563 6966 oper R is specif │ │ │ -000c7dd0: 6965 642e 0a0a 466f 7220 6561 6368 206f ied...For each o │ │ │ -000c7de0: 6273 6572 7665 6420 706f 696e 7420 636f bserved point co │ │ │ -000c7df0: 6f72 6469 6e61 7465 205c 2828 752c 2076 ordinate \((u, v │ │ │ -000c7e00: 295c 2920 7468 6520 6675 6e63 7469 6f6e )\) the function │ │ │ -000c7e10: 2063 6f6d 7075 7465 733a 0a5c 280a 5c62 computes:.\(.\b │ │ │ -000c7e20: 6567 696e 7b61 7272 6179 7d7b 6c7d 0a78 egin{array}{l}.x │ │ │ -000c7e30: 5e7b 227d 2020 5c6c 6566 7461 7272 6f77 ^{"} \leftarrow │ │ │ -000c7e40: 2028 7520 2d20 635f 7829 2f66 5f78 2020 (u - c_x)/f_x │ │ │ -000c7e50: 5c5c 0a79 5e7b 227d 2020 5c6c 6566 7461 \\.y^{"} \lefta │ │ │ -000c7e60: 7272 6f77 2028 7620 2d20 635f 7929 2f66 rrow (v - c_y)/f │ │ │ -000c7e70: 5f79 2020 5c5c 0a28 7827 2c79 2729 203d _y \\.(x',y') = │ │ │ -000c7e80: 2075 6e64 6973 746f 7274 2878 5e7b 227d undistort(x^{"} │ │ │ -000c7e90: 2c79 5e7b 227d 2c20 5c74 6578 7474 747b ,y^{"}, \texttt{ │ │ │ -000c7ea0: 6469 7374 436f 6566 6673 7d29 205c 5c0a distCoeffs}) \\. │ │ │ -000c7eb0: 7b5b 585c 2c59 5c2c 575d 7d20 5e54 2020 {[X\,Y\,W]} ^T │ │ │ -000c7ec0: 5c6c 6566 7461 7272 6f77 2052 2a5b 7827 \leftarrow R*[x' │ │ │ -000c7ed0: 205c 2c20 7927 205c 2c20 315d 5e54 2020 \, y' \, 1]^T │ │ │ -000c7ee0: 5c5c 0a78 2020 5c6c 6566 7461 7272 6f77 \\.x \leftarrow │ │ │ -000c7ef0: 2058 2f57 2020 5c5c 0a79 2020 5c6c 6566 X/W \\.y \lef │ │ │ -000c7f00: 7461 7272 6f77 2059 2f57 2020 5c5c 0a5c tarrow Y/W \\.\ │ │ │ -000c7f10: 7465 7874 7b6f 6e6c 7920 7065 7266 6f72 text{only perfor │ │ │ -000c7f20: 6d65 6420 6966 2050 2069 7320 7370 6563 med if P is spec │ │ │ -000c7f30: 6966 6965 643a 7d20 5c5c 0a75 2720 205c ified:} \\.u' \ │ │ │ -000c7f40: 6c65 6674 6172 726f 7720 7820 7b66 277d leftarrow x {f'} │ │ │ -000c7f50: 5f78 202b 207b 6327 7d5f 7820 205c 5c0a _x + {c'}_x \\. │ │ │ -000c7f60: 7627 2020 5c6c 6566 7461 7272 6f77 2079 v' \leftarrow y │ │ │ -000c7f70: 207b 6627 7d5f 7920 2b20 7b63 277d 5f79 {f'}_y + {c'}_y │ │ │ -000c7f80: 0a5c 656e 647b 6172 7261 797d 0a5c 290a .\end{array}.\). │ │ │ -000c7f90: 0a77 6865 7265 202a 756e 6469 7374 6f72 .where *undistor │ │ │ -000c7fa0: 742a 2069 7320 616e 2061 7070 726f 7869 t* is an approxi │ │ │ -000c7fb0: 6d61 7465 2069 7465 7261 7469 7665 2061 mate iterative a │ │ │ -000c7fc0: 6c67 6f72 6974 686d 2074 6861 7420 6573 lgorithm that es │ │ │ -000c7fd0: 7469 6d61 7465 7320 7468 6520 6e6f 726d timates the norm │ │ │ -000c7fe0: 616c 697a 6564 206f 7269 6769 6e61 6c0a alized original. │ │ │ -000c7ff0: 706f 696e 7420 636f 6f72 6469 6e61 7465 point coordinate │ │ │ -000c8000: 7320 6f75 7420 6f66 2074 6865 206e 6f72 s out of the nor │ │ │ -000c8010: 6d61 6c69 7a65 6420 6469 7374 6f72 7465 malized distorte │ │ │ -000c8020: 6420 706f 696e 7420 636f 6f72 6469 6e61 d point coordina │ │ │ -000c8030: 7465 7320 2822 6e6f 726d 616c 697a 6564 tes ("normalized │ │ │ -000c8040: 2220 6d65 616e 7320 7468 6174 2074 6865 " means that the │ │ │ -000c8050: 0a63 6f6f 7264 696e 6174 6573 2064 6f20 .coordinates do │ │ │ -000c8060: 6e6f 7420 6465 7065 6e64 206f 6e20 7468 not depend on th │ │ │ -000c8070: 6520 6361 6d65 7261 206d 6174 7269 7829 e camera matrix) │ │ │ -000c8080: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ -000c8090: 6361 6e20 6265 2075 7365 6420 666f 7220 can be used for │ │ │ -000c80a0: 626f 7468 2061 2073 7465 7265 6f20 6361 both a stereo ca │ │ │ -000c80b0: 6d65 7261 2068 6561 6420 6f72 2061 206d mera head or a m │ │ │ -000c80c0: 6f6e 6f63 756c 6172 2063 616d 6572 6120 onocular camera │ │ │ -000c80d0: 2877 6865 6e20 5220 6973 2065 6d70 7479 (when R is empty │ │ │ -000c80e0: 292e 0a0a 3c62 3e4e 6f74 653a 3c2f 623e )...Note: │ │ │ -000c80f0: 203c 623e 436f 6f72 6469 6e61 7465 2053 Coordinate S │ │ │ -000c8100: 7973 7465 6d73 3a3c 2f62 3e0a 3c75 6c3e ystems:.
      │ │ │ -000c8110: 0a20 203c 6c69 3e0a 203c 623e 496e 7075 .
    • . Inpu │ │ │ -000c8120: 7420 283c 636f 6465 3e73 7263 3c2f 636f t (src): Points │ │ │ -000c8140: 2061 7265 2065 7870 6563 7465 6420 696e are expected in │ │ │ -000c8150: 203c 623e 7069 7865 6c20 636f 6f72 6469 pixel coordi │ │ │ -000c8160: 6e61 7465 733c 2f62 3e20 6f66 2074 6865 nates of the │ │ │ -000c8170: 2064 6973 746f 7274 6564 2069 6d61 6765 distorted image │ │ │ -000c8180: 2c20 692e 652e 2c0a 2020 636f 6f72 6469 , i.e.,. coordi │ │ │ -000c8190: 6e61 7465 7320 5c28 2875 2c20 7629 5c29 nates \((u, v)\) │ │ │ -000c81a0: 206d 6561 7375 7265 6420 696e 2070 6978 measured in pix │ │ │ -000c81b0: 656c 7320 6672 6f6d 2074 6865 2074 6f70 els from the top │ │ │ -000c81c0: 2d6c 6566 7420 636f 726e 6572 206f 6620 -left corner of │ │ │ -000c81d0: 7468 6520 696d 6167 652e 0a20 203c 2f6c the image.. .
    • . Ou │ │ │ -000c81f0: 7470 7574 2028 3c63 6f64 653e 6473 743c tput (dst< │ │ │ -000c8200: 2f63 6f64 653e 293c 2f62 3e3a 2054 6865 /code>): The │ │ │ -000c8210: 2063 6f6f 7264 696e 6174 6520 7379 7374 coordinate syst │ │ │ -000c8220: 656d 206f 6620 6f75 7470 7574 2070 6f69 em of output poi │ │ │ -000c8230: 6e74 7320 6465 7065 6e64 7320 6f6e 2070 nts depends on p │ │ │ -000c8240: 6172 616d 6574 6572 203c 636f 6465 3e50 arameter P │ │ │ -000c8250: 3c2f 636f 6465 3e3a 0a20 203c 756c 3e0a :.
        . │ │ │ -000c8260: 2020 2020 3c6c 693e 0a20 2020 4966 203c
      • . If < │ │ │ -000c8270: 636f 6465 3e50 3c2f 636f 6465 3e20 6973 code>P is │ │ │ -000c8280: 2070 726f 7669 6465 6420 286e 6f74 2065 provided (not e │ │ │ -000c8290: 6d70 7479 293a 204f 7574 7075 7420 706f mpty): Output po │ │ │ -000c82a0: 696e 7473 2061 7265 2069 6e20 3c62 3e70 ints are in p │ │ │ -000c82b0: 6978 656c 2063 6f6f 7264 696e 6174 6573 ixel coordinates │ │ │ -000c82c0: 3c2f 623e 206f 6620 7468 6520 7265 6374 of the rect │ │ │ -000c82d0: 6966 6965 642f 756e 6469 7374 6f72 7465 ified/undistorte │ │ │ -000c82e0: 6420 696d 6167 6520 706c 616e 652c 2075 d image plane, u │ │ │ -000c82f0: 7369 6e67 2074 6865 2063 616d 6572 6120 sing the camera │ │ │ -000c8300: 6d61 7472 6978 203c 636f 6465 3e50 3c2f matrix P..
      • │ │ │ -000c8320: 0a20 2020 203c 6c69 3e0a 2020 2049 6620 .
      • . If │ │ │ -000c8330: 3c63 6f64 653e 503c 2f63 6f64 653e 2069 P i │ │ │ -000c8340: 7320 656d 7074 7920 6f72 2069 6465 6e74 s empty or ident │ │ │ -000c8350: 6974 793a 204f 7574 7075 7420 706f 696e ity: Output poin │ │ │ -000c8360: 7473 2061 7265 2069 6e20 3c62 3e6e 6f72 ts are in nor │ │ │ -000c8370: 6d61 6c69 7a65 6420 6361 6d65 7261 2063 malized camera c │ │ │ -000c8380: 6f6f 7264 696e 6174 6573 3c2f 623e 2028 oordinates ( │ │ │ -000c8390: 616c 736f 2063 616c 6c65 6420 226e 6f72 also called "nor │ │ │ -000c83a0: 6d61 6c69 7a65 6420 696d 6167 6520 636f malized image co │ │ │ -000c83b0: 6f72 6469 6e61 7465 7322 292c 0a20 2020 ordinates"),. │ │ │ -000c83c0: 2077 6869 6368 2061 7265 2064 696d 656e which are dimen │ │ │ -000c83d0: 7369 6f6e 6c65 7373 2063 6f6f 7264 696e sionless coordin │ │ │ -000c83e0: 6174 6573 205c 2828 782c 2079 295c 2920 ates \((x, y)\) │ │ │ -000c83f0: 696e 2074 6865 2063 616d 6572 6127 7320 in the camera's │ │ │ -000c8400: 666f 6361 6c20 706c 616e 652c 2072 656c focal plane, rel │ │ │ -000c8410: 6174 6564 2074 6f20 7069 7865 6c20 636f ated to pixel co │ │ │ -000c8420: 6f72 6469 6e61 7465 7320 6279 3a0a 2020 ordinates by:. │ │ │ -000c8430: 2020 5c28 7820 3d20 2875 202d 2063 5f78 \(x = (u - c_x │ │ │ -000c8440: 2920 2f20 665f 785c 2920 616e 6420 5c28 ) / f_x\) and \( │ │ │ -000c8450: 7920 3d20 2876 202d 2063 5f79 2920 2f20 y = (v - c_y) / │ │ │ -000c8460: 665f 795c 292e 2054 6865 7365 206e 6f72 f_y\). These nor │ │ │ -000c8470: 6d61 6c69 7a65 6420 636f 6f72 6469 6e61 malized coordina │ │ │ -000c8480: 7465 7320 6172 6520 696e 6465 7065 6e64 tes are independ │ │ │ -000c8490: 656e 7420 6f66 2074 6865 2063 616d 6572 ent of the camer │ │ │ -000c84a0: 6127 7320 696e 7472 696e 7369 6320 7061 a's intrinsic pa │ │ │ -000c84b0: 7261 6d65 7465 7273 2061 6e64 2061 7265 rameters and are │ │ │ -000c84c0: 2075 7365 6675 6c20 666f 7220 3344 2072 useful for 3D r │ │ │ -000c84d0: 6563 6f6e 7374 7275 6374 696f 6e20 6f72 econstruction or │ │ │ -000c84e0: 2065 7069 706f 6c61 7220 6765 6f6d 6574 epipolar geomet │ │ │ -000c84f0: 7279 2e0a 2020 2020 3c2f 6c69 3e0a 2020 ry..
      • . │ │ │ -000c8500: 3c2f 756c 3e0a 0a20 203c 2f6c 693e 0a3c
      ..
    • .< │ │ │ -000c8510: 2f75 6c3e 3c2f 6469 763e 0a3c 646c 2063 /ul>
    .
    .Parameters:.
    src │ │ │ -000c8550: 3c2f 636f 6465 3e20 2d20 4f62 7365 7276 - Observ │ │ │ -000c8560: 6564 2070 6f69 6e74 2063 6f6f 7264 696e ed point coordin │ │ │ -000c8570: 6174 6573 2069 6e20 3c62 3e70 6978 656c ates in pixel │ │ │ -000c8580: 2063 6f6f 7264 696e 6174 6573 3c2f 623e coordinates │ │ │ -000c8590: 206f 6620 7468 6520 6469 7374 6f72 7465 of the distorte │ │ │ -000c85a0: 6420 696d 6167 652c 2032 784e 2f4e 7832 d image, 2xN/Nx2 │ │ │ -000c85b0: 2031 2d63 6861 6e6e 656c 206f 7220 3178 1-channel or 1x │ │ │ -000c85c0: 4e2f 4e78 3120 322d 6368 616e 6e65 6c20 N/Nx1 2-channel │ │ │ -000c85d0: 2843 565f 3332 4643 3220 6f72 2043 565f (CV_32FC2 or CV_ │ │ │ -000c85e0: 3634 4643 3229 2028 6f72 0a76 6563 746f 64FC2) (or.vecto │ │ │ -000c85f0: 7226 6c74 3b50 6f69 6e74 3266 2667 743b r<Point2f> │ │ │ -000c8600: 2029 2e3c 2f64 643e 0a3c 6464 3e3c 636f ).
    .
    dst - │ │ │ -000c8620: 4f75 7470 7574 2069 6465 616c 2070 6f69 Output ideal poi │ │ │ -000c8630: 6e74 2063 6f6f 7264 696e 6174 6573 2028 nt coordinates ( │ │ │ -000c8640: 3178 4e2f 4e78 3120 322d 6368 616e 6e65 1xN/Nx1 2-channe │ │ │ -000c8650: 6c20 6f72 2076 6563 746f 7226 6c74 3b50 l or vector<P │ │ │ -000c8660: 6f69 6e74 3266 2667 743b 2029 2061 6674 oint2f> ) aft │ │ │ -000c8670: 6572 2075 6e64 6973 746f 7274 696f 6e20 er undistortion │ │ │ -000c8680: 616e 6420 7265 7665 7273 6520 7065 7273 and reverse pers │ │ │ -000c8690: 7065 6374 6976 650a 7472 616e 7366 6f72 pective.transfor │ │ │ -000c86a0: 6d61 7469 6f6e 2e20 4966 206d 6174 7269 mation. If matri │ │ │ -000c86b0: 7820 5020 6973 2069 6465 6e74 6974 7920 x P is identity │ │ │ -000c86c0: 6f72 206f 6d69 7474 6564 2c20 6473 7420 or omitted, dst │ │ │ -000c86d0: 7769 6c6c 2063 6f6e 7461 696e 206e 6f72 will contain nor │ │ │ -000c86e0: 6d61 6c69 7a65 6420 706f 696e 7420 636f malized point co │ │ │ -000c86f0: 6f72 6469 6e61 7465 732e 3c2f 6464 3e0a ordinates.
    . │ │ │ -000c8700: 3c64 643e 3c63 6f64 653e 6361 6d65 7261
    camera │ │ │ -000c8710: 4d61 7472 6978 3c2f 636f 6465 3e20 2d20 Matrix - │ │ │ -000c8720: 4361 6d65 7261 206d 6174 7269 7820 5c28 Camera matrix \( │ │ │ -000c8730: 5c76 6563 7468 7265 6574 6872 6565 7b66 \vecthreethree{f │ │ │ -000c8740: 5f78 7d7b 307d 7b63 5f78 7d7b 307d 7b66 _x}{0}{c_x}{0}{f │ │ │ -000c8750: 5f79 7d7b 635f 797d 7b30 7d7b 307d 7b31 _y}{c_y}{0}{0}{1 │ │ │ -000c8760: 7d5c 2920 2e3c 2f64 643e 0a3c 6464 3e3c }\) .
    .
    < │ │ │ -000c8770: 636f 6465 3e64 6973 7443 6f65 6666 733c code>distCoeffs< │ │ │ -000c8780: 2f63 6f64 653e 202d 2049 6e70 7574 2076 /code> - Input v │ │ │ -000c8790: 6563 746f 7220 6f66 2064 6973 746f 7274 ector of distort │ │ │ -000c87a0: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ -000c87b0: 0a5c 2828 6b5f 312c 206b 5f32 2c20 705f .\((k_1, k_2, p_ │ │ │ -000c87c0: 312c 2070 5f32 5b2c 206b 5f33 5b2c 206b 1, p_2[, k_3[, k │ │ │ -000c87d0: 5f34 2c20 6b5f 352c 206b 5f36 5b2c 2073 _4, k_5, k_6[, s │ │ │ -000c87e0: 5f31 2c20 735f 322c 2073 5f33 2c20 735f _1, s_2, s_3, s_ │ │ │ -000c87f0: 345b 2c20 5c74 6175 5f78 2c20 5c74 6175 4[, \tau_x, \tau │ │ │ -000c8800: 5f79 5d5d 5d5d 295c 290a 6f66 2034 2c20 _y]]]])\).of 4, │ │ │ -000c8810: 352c 2038 2c20 3132 206f 7220 3134 2065 5, 8, 12 or 14 e │ │ │ -000c8820: 6c65 6d65 6e74 732e 2049 6620 7468 6520 lements. If the │ │ │ -000c8830: 7665 6374 6f72 2069 7320 4e55 4c4c 2f65 vector is NULL/e │ │ │ -000c8840: 6d70 7479 2c20 7468 6520 7a65 726f 2064 mpty, the zero d │ │ │ -000c8850: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ -000c8860: 6369 656e 7473 2061 7265 2061 7373 756d cients are assum │ │ │ -000c8870: 6564 2e3c 2f64 643e 0a3c 6464 3e3c 636f ed.
    .
    R - Re │ │ │ -000c8890: 6374 6966 6963 6174 696f 6e20 7472 616e ctification tran │ │ │ -000c88a0: 7366 6f72 6d61 7469 6f6e 2069 6e20 7468 sformation in th │ │ │ -000c88b0: 6520 6f62 6a65 6374 2073 7061 6365 2028 e object space ( │ │ │ -000c88c0: 3378 3320 6d61 7472 6978 292e 2052 3120 3x3 matrix). R1 │ │ │ -000c88d0: 6f72 2052 3220 636f 6d70 7574 6564 2062 or R2 computed b │ │ │ -000c88e0: 790a 2373 7465 7265 6f52 6563 7469 6679 y.#stereoRectify │ │ │ -000c88f0: 2063 616e 2062 6520 7061 7373 6564 2068 can be passed h │ │ │ -000c8900: 6572 652e 2049 6620 7468 6520 6d61 7472 ere. If the matr │ │ │ -000c8910: 6978 2069 7320 656d 7074 792c 2074 6865 ix is empty, the │ │ │ -000c8920: 2069 6465 6e74 6974 7920 7472 616e 7366 identity transf │ │ │ -000c8930: 6f72 6d61 7469 6f6e 2069 7320 7573 6564 ormation is used │ │ │ -000c8940: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    P - New │ │ │ -000c8960: 6361 6d65 7261 206d 6174 7269 7820 2833 camera matrix (3 │ │ │ -000c8970: 7833 2920 6f72 206e 6577 2070 726f 6a65 x3) or new proje │ │ │ -000c8980: 6374 696f 6e20 6d61 7472 6978 2028 3378 ction matrix (3x │ │ │ -000c8990: 3429 205c 285c 6265 6769 6e7b 626d 6174 4) \(\begin{bmat │ │ │ -000c89a0: 7269 787d 207b 6627 7d5f 7820 2661 6d70 rix} {f'}_x & │ │ │ -000c89b0: 3b20 3020 2661 6d70 3b20 7b63 277d 5f78 ; 0 & {c'}_x │ │ │ -000c89c0: 2026 616d 703b 2074 5f78 205c 5c20 3020 & t_x \\ 0 │ │ │ -000c89d0: 2661 6d70 3b20 7b66 277d 5f79 2026 616d & {f'}_y &am │ │ │ -000c89e0: 703b 207b 6327 7d5f 7920 2661 6d70 3b20 p; {c'}_y & │ │ │ -000c89f0: 745f 7920 5c5c 2030 2026 616d 703b 2030 t_y \\ 0 & 0 │ │ │ -000c8a00: 2026 616d 703b 2031 2026 616d 703b 2074 & 1 & t │ │ │ -000c8a10: 5f7a 205c 656e 647b 626d 6174 7269 787d _z \end{bmatrix} │ │ │ -000c8a20: 5c29 2e20 5031 206f 7220 5032 2063 6f6d \). P1 or P2 com │ │ │ -000c8a30: 7075 7465 6420 6279 0a23 7374 6572 656f puted by.#stereo │ │ │ -000c8a40: 5265 6374 6966 7920 6361 6e20 6265 2070 Rectify can be p │ │ │ -000c8a50: 6173 7365 6420 6865 7265 2e20 4966 2074 assed here. If t │ │ │ -000c8a60: 6865 206d 6174 7269 7820 6973 2065 6d70 he matrix is emp │ │ │ -000c8a70: 7479 2c20 7468 6520 6964 656e 7469 7479 ty, the identity │ │ │ -000c8a80: 206e 6577 2063 616d 6572 6120 6d61 7472 new camera matr │ │ │ -000c8a90: 6978 2069 7320 7573 6564 2061 6e64 206f ix is used and o │ │ │ -000c8aa0: 7574 7075 7420 7769 6c6c 2062 6520 696e utput will be in │ │ │ -000c8ab0: 206e 6f72 6d61 6c69 7a65 6420 636f 6f72 normalized coor │ │ │ -000c8ac0: 6469 6e61 7465 732e 3c2f 6464 3e0a 3c64 dinates.
    .criteria │ │ │ -000c8ae0: 3c2f 636f 6465 3e20 2d20 7465 726d 696e - termin │ │ │ -000c8af0: 6174 696f 6e20 6372 6974 6572 6961 2066 ation criteria f │ │ │ -000c8b00: 6f72 2074 6865 2069 7465 7261 7469 7665 or the iterative │ │ │ -000c8b10: 2070 6f69 6e74 2075 6e64 6973 746f 7274 point undistort │ │ │ -000c8b20: 696f 6e20 616c 676f 7269 7468 6d3c 2f64 ion algorithm.
    .
    . │ │ │ -000c8b40: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e
    .
  • │ │ │ -000c8b50: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .< │ │ │ -000c8c10: 6833 3e75 6e64 6973 746f 7274 506f 696e h3>undistortPoin │ │ │ -000c8c20: 7473 3c2f 6833 3e0a 3c64 6976 2063 6c61 ts.
    .
    pu │ │ │ -000c8c80: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static void&nb │ │ │ -000c8cc0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;un │ │ │ -000c8ce0: 6469 7374 6f72 7450 6f69 6e74 733c 2f73 distortPoints(MatOfPoi │ │ │ -000c8d60: 6e74 3266 3c2f 613e 266e 6273 703b 7372 nt2f sr │ │ │ -000c8d70: 632c 0a20 3c61 2068 7265 663d 222e 2e2f c,. MatOfPo │ │ │ -000c8dc0: 696e 7432 663c 2f61 3e26 6e62 7370 3b64 int2f d │ │ │ -000c8dd0: 7374 2c0a 203c 6120 6872 6566 3d22 2e2e st,. Mat ca │ │ │ -000c8e20: 6d65 7261 4d61 7472 6978 2c0a 203c 6120 meraMatrix,. Mat │ │ │ -000c8e70: 266e 6273 703b 6469 7374 436f 6566 6673  distCoeffs │ │ │ -000c8e80: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000c8ec0: 6174 3c2f 613e 266e 6273 703b 522c 0a20 at R,. │ │ │ -000c8ed0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000c8f10: 2f61 3e26 6e62 7370 3b50 293c 2f73 7061 /a> P)
    .
    Comp │ │ │ -000c8f40: 7574 6573 2074 6865 2069 6465 616c 2070 utes the ideal p │ │ │ -000c8f50: 6f69 6e74 2063 6f6f 7264 696e 6174 6573 oint coordinates │ │ │ -000c8f60: 2066 726f 6d20 7468 6520 6f62 7365 7276 from the observ │ │ │ -000c8f70: 6564 2070 6f69 6e74 2063 6f6f 7264 696e ed point coordin │ │ │ -000c8f80: 6174 6573 2e0a 0a54 6865 2066 756e 6374 ates...The funct │ │ │ -000c8f90: 696f 6e20 6973 2073 696d 696c 6172 2074 ion is similar t │ │ │ -000c8fa0: 6f20 2375 6e64 6973 746f 7274 2061 6e64 o #undistort and │ │ │ -000c8fb0: 2023 696e 6974 556e 6469 7374 6f72 7452 #initUndistortR │ │ │ -000c8fc0: 6563 7469 6679 4d61 7020 6275 7420 6974 ectifyMap but it │ │ │ -000c8fd0: 206f 7065 7261 7465 7320 6f6e 2061 0a73 operates on a.s │ │ │ -000c8fe0: 7061 7273 6520 7365 7420 6f66 2070 6f69 parse set of poi │ │ │ -000c8ff0: 6e74 7320 696e 7374 6561 6420 6f66 2061 nts instead of a │ │ │ -000c9000: 2072 6173 7465 7220 696d 6167 652e 2041 raster image. A │ │ │ -000c9010: 6c73 6f20 7468 6520 6675 6e63 7469 6f6e lso the function │ │ │ -000c9020: 2070 6572 666f 726d 7320 6120 7265 7665 performs a reve │ │ │ -000c9030: 7273 6520 7472 616e 7366 6f72 6d61 7469 rse transformati │ │ │ -000c9040: 6f6e 0a74 6f20 2023 7072 6f6a 6563 7450 on.to #projectP │ │ │ -000c9050: 6f69 6e74 732e 2049 6e20 6361 7365 206f oints. In case o │ │ │ -000c9060: 6620 6120 3344 206f 626a 6563 742c 2069 f a 3D object, i │ │ │ -000c9070: 7420 646f 6573 206e 6f74 2072 6563 6f6e t does not recon │ │ │ -000c9080: 7374 7275 6374 2069 7473 2033 4420 636f struct its 3D co │ │ │ -000c9090: 6f72 6469 6e61 7465 732c 2062 7574 2066 ordinates, but f │ │ │ -000c90a0: 6f72 2061 0a70 6c61 6e61 7220 6f62 6a65 or a.planar obje │ │ │ -000c90b0: 6374 2c20 6974 2064 6f65 732c 2075 7020 ct, it does, up │ │ │ -000c90c0: 746f 2061 2074 7261 6e73 6c61 7469 6f6e to a translation │ │ │ -000c90d0: 2076 6563 746f 722c 2069 6620 7468 6520 vector, if the │ │ │ -000c90e0: 7072 6f70 6572 2052 2069 7320 7370 6563 proper R is spec │ │ │ -000c90f0: 6966 6965 642e 0a0a 466f 7220 6561 6368 ified...For each │ │ │ -000c9100: 206f 6273 6572 7665 6420 706f 696e 7420 observed point │ │ │ -000c9110: 636f 6f72 6469 6e61 7465 205c 2828 752c coordinate \((u, │ │ │ -000c9120: 2076 295c 2920 7468 6520 6675 6e63 7469 v)\) the functi │ │ │ -000c9130: 6f6e 2063 6f6d 7075 7465 733a 0a5c 280a on computes:.\(. │ │ │ -000c9140: 5c62 6567 696e 7b61 7272 6179 7d7b 6c7d \begin{array}{l} │ │ │ -000c9150: 0a78 5e7b 227d 2020 5c6c 6566 7461 7272 .x^{"} \leftarr │ │ │ -000c9160: 6f77 2028 7520 2d20 635f 7829 2f66 5f78 ow (u - c_x)/f_x │ │ │ -000c9170: 2020 5c5c 0a79 5e7b 227d 2020 5c6c 6566 \\.y^{"} \lef │ │ │ -000c9180: 7461 7272 6f77 2028 7620 2d20 635f 7929 tarrow (v - c_y) │ │ │ -000c9190: 2f66 5f79 2020 5c5c 0a28 7827 2c79 2729 /f_y \\.(x',y') │ │ │ -000c91a0: 203d 2075 6e64 6973 746f 7274 2878 5e7b = undistort(x^{ │ │ │ -000c91b0: 227d 2c79 5e7b 227d 2c20 5c74 6578 7474 "},y^{"}, \textt │ │ │ -000c91c0: 747b 6469 7374 436f 6566 6673 7d29 205c t{distCoeffs}) \ │ │ │ -000c91d0: 5c0a 7b5b 585c 2c59 5c2c 575d 7d20 5e54 \.{[X\,Y\,W]} ^T │ │ │ -000c91e0: 2020 5c6c 6566 7461 7272 6f77 2052 2a5b \leftarrow R*[ │ │ │ -000c91f0: 7827 205c 2c20 7927 205c 2c20 315d 5e54 x' \, y' \, 1]^T │ │ │ -000c9200: 2020 5c5c 0a78 2020 5c6c 6566 7461 7272 \\.x \leftarr │ │ │ -000c9210: 6f77 2058 2f57 2020 5c5c 0a79 2020 5c6c ow X/W \\.y \l │ │ │ -000c9220: 6566 7461 7272 6f77 2059 2f57 2020 5c5c eftarrow Y/W \\ │ │ │ -000c9230: 0a5c 7465 7874 7b6f 6e6c 7920 7065 7266 .\text{only perf │ │ │ -000c9240: 6f72 6d65 6420 6966 2050 2069 7320 7370 ormed if P is sp │ │ │ -000c9250: 6563 6966 6965 643a 7d20 5c5c 0a75 2720 ecified:} \\.u' │ │ │ -000c9260: 205c 6c65 6674 6172 726f 7720 7820 7b66 \leftarrow x {f │ │ │ -000c9270: 277d 5f78 202b 207b 6327 7d5f 7820 205c '}_x + {c'}_x \ │ │ │ -000c9280: 5c0a 7627 2020 5c6c 6566 7461 7272 6f77 \.v' \leftarrow │ │ │ -000c9290: 2079 207b 6627 7d5f 7920 2b20 7b63 277d y {f'}_y + {c'} │ │ │ -000c92a0: 5f79 0a5c 656e 647b 6172 7261 797d 0a5c _y.\end{array}.\ │ │ │ -000c92b0: 290a 0a77 6865 7265 202a 756e 6469 7374 )..where *undist │ │ │ -000c92c0: 6f72 742a 2069 7320 616e 2061 7070 726f ort* is an appro │ │ │ -000c92d0: 7869 6d61 7465 2069 7465 7261 7469 7665 ximate iterative │ │ │ -000c92e0: 2061 6c67 6f72 6974 686d 2074 6861 7420 algorithm that │ │ │ -000c92f0: 6573 7469 6d61 7465 7320 7468 6520 6e6f estimates the no │ │ │ -000c9300: 726d 616c 697a 6564 206f 7269 6769 6e61 rmalized origina │ │ │ -000c9310: 6c0a 706f 696e 7420 636f 6f72 6469 6e61 l.point coordina │ │ │ -000c9320: 7465 7320 6f75 7420 6f66 2074 6865 206e tes out of the n │ │ │ -000c9330: 6f72 6d61 6c69 7a65 6420 6469 7374 6f72 ormalized distor │ │ │ -000c9340: 7465 6420 706f 696e 7420 636f 6f72 6469 ted point coordi │ │ │ -000c9350: 6e61 7465 7320 2822 6e6f 726d 616c 697a nates ("normaliz │ │ │ -000c9360: 6564 2220 6d65 616e 7320 7468 6174 2074 ed" means that t │ │ │ -000c9370: 6865 0a63 6f6f 7264 696e 6174 6573 2064 he.coordinates d │ │ │ -000c9380: 6f20 6e6f 7420 6465 7065 6e64 206f 6e20 o not depend on │ │ │ -000c9390: 7468 6520 6361 6d65 7261 206d 6174 7269 the camera matri │ │ │ -000c93a0: 7829 2e0a 0a54 6865 2066 756e 6374 696f x)...The functio │ │ │ -000c93b0: 6e20 6361 6e20 6265 2075 7365 6420 666f n can be used fo │ │ │ -000c93c0: 7220 626f 7468 2061 2073 7465 7265 6f20 r both a stereo │ │ │ -000c93d0: 6361 6d65 7261 2068 6561 6420 6f72 2061 camera head or a │ │ │ -000c93e0: 206d 6f6e 6f63 756c 6172 2063 616d 6572 monocular camer │ │ │ -000c93f0: 6120 2877 6865 6e20 5220 6973 2065 6d70 a (when R is emp │ │ │ -000c9400: 7479 292e 0a0a 3c62 3e4e 6f74 653a 3c2f ty)...Note: Coordinate │ │ │ -000c9420: 2053 7973 7465 6d73 3a3c 2f62 3e0a 3c75 Systems:..
  • . In │ │ │ -000c9440: 7075 7420 283c 636f 6465 3e73 7263 3c2f put (src): Poin │ │ │ -000c9460: 7473 2061 7265 2065 7870 6563 7465 6420 ts are expected │ │ │ -000c9470: 696e 203c 623e 7069 7865 6c20 636f 6f72 in pixel coor │ │ │ -000c9480: 6469 6e61 7465 733c 2f62 3e20 6f66 2074 dinates of t │ │ │ -000c9490: 6865 2064 6973 746f 7274 6564 2069 6d61 he distorted ima │ │ │ -000c94a0: 6765 2c20 692e 652e 2c0a 2020 636f 6f72 ge, i.e.,. coor │ │ │ -000c94b0: 6469 6e61 7465 7320 5c28 2875 2c20 7629 dinates \((u, v) │ │ │ -000c94c0: 5c29 206d 6561 7375 7265 6420 696e 2070 \) measured in p │ │ │ -000c94d0: 6978 656c 7320 6672 6f6d 2074 6865 2074 ixels from the t │ │ │ -000c94e0: 6f70 2d6c 6566 7420 636f 726e 6572 206f op-left corner o │ │ │ -000c94f0: 6620 7468 6520 696d 6167 652e 0a20 203c f the image.. < │ │ │ -000c9500: 2f6c 693e 0a20 203c 6c69 3e0a 203c 623e /li>.
  • . │ │ │ -000c9510: 4f75 7470 7574 2028 3c63 6f64 653e 6473 Output (ds │ │ │ -000c9520: 743c 2f63 6f64 653e 293c 2f62 3e3a 2054 t): T │ │ │ -000c9530: 6865 2063 6f6f 7264 696e 6174 6520 7379 he coordinate sy │ │ │ -000c9540: 7374 656d 206f 6620 6f75 7470 7574 2070 stem of output p │ │ │ -000c9550: 6f69 6e74 7320 6465 7065 6e64 7320 6f6e oints depends on │ │ │ -000c9560: 2070 6172 616d 6574 6572 203c 636f 6465 parameter P:.
      .
    • . If │ │ │ -000c9590: 203c 636f 6465 3e50 3c2f 636f 6465 3e20 P │ │ │ -000c95a0: 6973 2070 726f 7669 6465 6420 286e 6f74 is provided (not │ │ │ -000c95b0: 2065 6d70 7479 293a 204f 7574 7075 7420 empty): Output │ │ │ -000c95c0: 706f 696e 7473 2061 7265 2069 6e20 3c62 points are in pixel coordinat │ │ │ -000c95e0: 6573 3c2f 623e 206f 6620 7468 6520 7265 es of the re │ │ │ -000c95f0: 6374 6966 6965 642f 756e 6469 7374 6f72 ctified/undistor │ │ │ -000c9600: 7465 6420 696d 6167 6520 706c 616e 652c ted image plane, │ │ │ -000c9610: 2075 7369 6e67 2074 6865 2063 616d 6572 using the camer │ │ │ -000c9620: 6120 6d61 7472 6978 203c 636f 6465 3e50 a matrix P │ │ │ -000c9630: 3c2f 636f 6465 3e2e 0a20 2020 203c 2f6c .. .
    • . I │ │ │ -000c9650: 6620 3c63 6f64 653e 503c 2f63 6f64 653e f P │ │ │ -000c9660: 2069 7320 656d 7074 7920 6f72 2069 6465 is empty or ide │ │ │ -000c9670: 6e74 6974 793a 204f 7574 7075 7420 706f ntity: Output po │ │ │ -000c9680: 696e 7473 2061 7265 2069 6e20 3c62 3e6e ints are in n │ │ │ -000c9690: 6f72 6d61 6c69 7a65 6420 6361 6d65 7261 ormalized camera │ │ │ -000c96a0: 2063 6f6f 7264 696e 6174 6573 3c2f 623e coordinates │ │ │ -000c96b0: 2028 616c 736f 2063 616c 6c65 6420 226e (also called "n │ │ │ -000c96c0: 6f72 6d61 6c69 7a65 6420 696d 6167 6520 ormalized image │ │ │ -000c96d0: 636f 6f72 6469 6e61 7465 7322 292c 0a20 coordinates"),. │ │ │ -000c96e0: 2020 2077 6869 6368 2061 7265 2064 696d which are dim │ │ │ -000c96f0: 656e 7369 6f6e 6c65 7373 2063 6f6f 7264 ensionless coord │ │ │ -000c9700: 696e 6174 6573 205c 2828 782c 2079 295c inates \((x, y)\ │ │ │ -000c9710: 2920 696e 2074 6865 2063 616d 6572 6127 ) in the camera' │ │ │ -000c9720: 7320 666f 6361 6c20 706c 616e 652c 2072 s focal plane, r │ │ │ -000c9730: 656c 6174 6564 2074 6f20 7069 7865 6c20 elated to pixel │ │ │ -000c9740: 636f 6f72 6469 6e61 7465 7320 6279 3a0a coordinates by:. │ │ │ -000c9750: 2020 2020 5c28 7820 3d20 2875 202d 2063 \(x = (u - c │ │ │ -000c9760: 5f78 2920 2f20 665f 785c 2920 616e 6420 _x) / f_x\) and │ │ │ -000c9770: 5c28 7920 3d20 2876 202d 2063 5f79 2920 \(y = (v - c_y) │ │ │ -000c9780: 2f20 665f 795c 292e 2054 6865 7365 206e / f_y\). These n │ │ │ -000c9790: 6f72 6d61 6c69 7a65 6420 636f 6f72 6469 ormalized coordi │ │ │ -000c97a0: 6e61 7465 7320 6172 6520 696e 6465 7065 nates are indepe │ │ │ -000c97b0: 6e64 656e 7420 6f66 2074 6865 2063 616d ndent of the cam │ │ │ -000c97c0: 6572 6127 7320 696e 7472 696e 7369 6320 era's intrinsic │ │ │ -000c97d0: 7061 7261 6d65 7465 7273 2061 6e64 2061 parameters and a │ │ │ -000c97e0: 7265 2075 7365 6675 6c20 666f 7220 3344 re useful for 3D │ │ │ -000c97f0: 2072 6563 6f6e 7374 7275 6374 696f 6e20 reconstruction │ │ │ -000c9800: 6f72 2065 7069 706f 6c61 7220 6765 6f6d or epipolar geom │ │ │ -000c9810: 6574 7279 2e0a 2020 2020 3c2f 6c69 3e0a etry..
    • . │ │ │ -000c9820: 2020 3c2f 756c 3e0a 0a20 203c 2f6c 693e
    ..
  • │ │ │ -000c9830: 0a3c 2f75 6c3e 3c2f 6469 763e 0a3c 646c .
    .
    . │ │ │ -000c9850: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -000c9860: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e73 /dt>.
    s │ │ │ -000c9870: 7263 3c2f 636f 6465 3e20 2d20 4f62 7365 rc - Obse │ │ │ -000c9880: 7276 6564 2070 6f69 6e74 2063 6f6f 7264 rved point coord │ │ │ -000c9890: 696e 6174 6573 2069 6e20 3c62 3e70 6978 inates in pix │ │ │ -000c98a0: 656c 2063 6f6f 7264 696e 6174 6573 3c2f el coordinates of the distor │ │ │ -000c98c0: 7465 6420 696d 6167 652c 2032 784e 2f4e ted image, 2xN/N │ │ │ -000c98d0: 7832 2031 2d63 6861 6e6e 656c 206f 7220 x2 1-channel or │ │ │ -000c98e0: 3178 4e2f 4e78 3120 322d 6368 616e 6e65 1xN/Nx1 2-channe │ │ │ -000c98f0: 6c20 2843 565f 3332 4643 3220 6f72 2043 l (CV_32FC2 or C │ │ │ -000c9900: 565f 3634 4643 3229 2028 6f72 0a76 6563 V_64FC2) (or.vec │ │ │ -000c9910: 746f 7226 6c74 3b50 6f69 6e74 3266 2667 tor<Point2f&g │ │ │ -000c9920: 743b 2029 2e3c 2f64 643e 0a3c 6464 3e3c t; ).
    .
    < │ │ │ -000c9930: 636f 6465 3e64 7374 3c2f 636f 6465 3e20 code>dst │ │ │ -000c9940: 2d20 4f75 7470 7574 2069 6465 616c 2070 - Output ideal p │ │ │ -000c9950: 6f69 6e74 2063 6f6f 7264 696e 6174 6573 oint coordinates │ │ │ -000c9960: 2028 3178 4e2f 4e78 3120 322d 6368 616e (1xN/Nx1 2-chan │ │ │ -000c9970: 6e65 6c20 6f72 2076 6563 746f 7226 6c74 nel or vector< │ │ │ -000c9980: 3b50 6f69 6e74 3266 2667 743b 2029 2061 ;Point2f> ) a │ │ │ -000c9990: 6674 6572 2075 6e64 6973 746f 7274 696f fter undistortio │ │ │ -000c99a0: 6e20 616e 6420 7265 7665 7273 6520 7065 n and reverse pe │ │ │ -000c99b0: 7273 7065 6374 6976 650a 7472 616e 7366 rspective.transf │ │ │ -000c99c0: 6f72 6d61 7469 6f6e 2e20 4966 206d 6174 ormation. If mat │ │ │ -000c99d0: 7269 7820 5020 6973 2069 6465 6e74 6974 rix P is identit │ │ │ -000c99e0: 7920 6f72 206f 6d69 7474 6564 2c20 6473 y or omitted, ds │ │ │ -000c99f0: 7420 7769 6c6c 2063 6f6e 7461 696e 206e t will contain n │ │ │ -000c9a00: 6f72 6d61 6c69 7a65 6420 706f 696e 7420 ormalized point │ │ │ -000c9a10: 636f 6f72 6469 6e61 7465 732e 3c2f 6464 coordinates.
    .
    came │ │ │ -000c9a30: 7261 4d61 7472 6978 3c2f 636f 6465 3e20 raMatrix │ │ │ -000c9a40: 2d20 4361 6d65 7261 206d 6174 7269 7820 - Camera matrix │ │ │ -000c9a50: 5c28 5c76 6563 7468 7265 6574 6872 6565 \(\vecthreethree │ │ │ -000c9a60: 7b66 5f78 7d7b 307d 7b63 5f78 7d7b 307d {f_x}{0}{c_x}{0} │ │ │ -000c9a70: 7b66 5f79 7d7b 635f 797d 7b30 7d7b 307d {f_y}{c_y}{0}{0} │ │ │ -000c9a80: 7b31 7d5c 2920 2e3c 2f64 643e 0a3c 6464 {1}\) .
    .
    distCoeff │ │ │ -000c9aa0: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ -000c9ab0: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ -000c9ac0: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ -000c9ad0: 7473 0a5c 2828 6b5f 312c 206b 5f32 2c20 ts.\((k_1, k_2, │ │ │ -000c9ae0: 705f 312c 2070 5f32 5b2c 206b 5f33 5b2c p_1, p_2[, k_3[, │ │ │ -000c9af0: 206b 5f34 2c20 6b5f 352c 206b 5f36 5b2c k_4, k_5, k_6[, │ │ │ -000c9b00: 2073 5f31 2c20 735f 322c 2073 5f33 2c20 s_1, s_2, s_3, │ │ │ -000c9b10: 735f 345b 2c20 5c74 6175 5f78 2c20 5c74 s_4[, \tau_x, \t │ │ │ -000c9b20: 6175 5f79 5d5d 5d5d 295c 290a 6f66 2034 au_y]]]])\).of 4 │ │ │ -000c9b30: 2c20 352c 2038 2c20 3132 206f 7220 3134 , 5, 8, 12 or 14 │ │ │ -000c9b40: 2065 6c65 6d65 6e74 732e 2049 6620 7468 elements. If th │ │ │ -000c9b50: 6520 7665 6374 6f72 2069 7320 4e55 4c4c e vector is NULL │ │ │ -000c9b60: 2f65 6d70 7479 2c20 7468 6520 7a65 726f /empty, the zero │ │ │ -000c9b70: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ -000c9b80: 6669 6369 656e 7473 2061 7265 2061 7373 ficients are ass │ │ │ -000c9b90: 756d 6564 2e3c 2f64 643e 0a3c 6464 3e3c umed.
    .
    < │ │ │ -000c9ba0: 636f 6465 3e52 3c2f 636f 6465 3e20 2d20 code>R - │ │ │ -000c9bb0: 5265 6374 6966 6963 6174 696f 6e20 7472 Rectification tr │ │ │ -000c9bc0: 616e 7366 6f72 6d61 7469 6f6e 2069 6e20 ansformation in │ │ │ -000c9bd0: 7468 6520 6f62 6a65 6374 2073 7061 6365 the object space │ │ │ -000c9be0: 2028 3378 3320 6d61 7472 6978 292e 2052 (3x3 matrix). R │ │ │ -000c9bf0: 3120 6f72 2052 3220 636f 6d70 7574 6564 1 or R2 computed │ │ │ -000c9c00: 2062 790a 2373 7465 7265 6f52 6563 7469 by.#stereoRecti │ │ │ -000c9c10: 6679 2063 616e 2062 6520 7061 7373 6564 fy can be passed │ │ │ -000c9c20: 2068 6572 652e 2049 6620 7468 6520 6d61 here. If the ma │ │ │ -000c9c30: 7472 6978 2069 7320 656d 7074 792c 2074 trix is empty, t │ │ │ -000c9c40: 6865 2069 6465 6e74 6974 7920 7472 616e he identity tran │ │ │ -000c9c50: 7366 6f72 6d61 7469 6f6e 2069 7320 7573 sformation is us │ │ │ -000c9c60: 6564 2e3c 2f64 643e 0a3c 6464 3e3c 636f ed.
    .
    P - Ne │ │ │ -000c9c80: 7720 6361 6d65 7261 206d 6174 7269 7820 w camera matrix │ │ │ -000c9c90: 2833 7833 2920 6f72 206e 6577 2070 726f (3x3) or new pro │ │ │ -000c9ca0: 6a65 6374 696f 6e20 6d61 7472 6978 2028 jection matrix ( │ │ │ -000c9cb0: 3378 3429 205c 285c 6265 6769 6e7b 626d 3x4) \(\begin{bm │ │ │ -000c9cc0: 6174 7269 787d 207b 6627 7d5f 7820 2661 atrix} {f'}_x &a │ │ │ -000c9cd0: 6d70 3b20 3020 2661 6d70 3b20 7b63 277d mp; 0 & {c'} │ │ │ -000c9ce0: 5f78 2026 616d 703b 2074 5f78 205c 5c20 _x & t_x \\ │ │ │ -000c9cf0: 3020 2661 6d70 3b20 7b66 277d 5f79 2026 0 & {f'}_y & │ │ │ -000c9d00: 616d 703b 207b 6327 7d5f 7920 2661 6d70 amp; {c'}_y & │ │ │ -000c9d10: 3b20 745f 7920 5c5c 2030 2026 616d 703b ; t_y \\ 0 & │ │ │ -000c9d20: 2030 2026 616d 703b 2031 2026 616d 703b 0 & 1 & │ │ │ -000c9d30: 2074 5f7a 205c 656e 647b 626d 6174 7269 t_z \end{bmatri │ │ │ -000c9d40: 787d 5c29 2e20 5031 206f 7220 5032 2063 x}\). P1 or P2 c │ │ │ -000c9d50: 6f6d 7075 7465 6420 6279 0a23 7374 6572 omputed by.#ster │ │ │ -000c9d60: 656f 5265 6374 6966 7920 6361 6e20 6265 eoRectify can be │ │ │ -000c9d70: 2070 6173 7365 6420 6865 7265 2e20 4966 passed here. If │ │ │ -000c9d80: 2074 6865 206d 6174 7269 7820 6973 2065 the matrix is e │ │ │ -000c9d90: 6d70 7479 2c20 7468 6520 6964 656e 7469 mpty, the identi │ │ │ -000c9da0: 7479 206e 6577 2063 616d 6572 6120 6d61 ty new camera ma │ │ │ -000c9db0: 7472 6978 2069 7320 7573 6564 2061 6e64 trix is used and │ │ │ -000c9dc0: 206f 7574 7075 7420 7769 6c6c 2062 6520 output will be │ │ │ -000c9dd0: 696e 206e 6f72 6d61 6c69 7a65 6420 636f in normalized co │ │ │ -000c9de0: 6f72 6469 6e61 7465 732e 3c2f 6464 3e0a ordinates.
    . │ │ │ -000c9df0: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    .
    .
  • ..
    .

    undi │ │ │ -000c9ec0: 7374 6f72 7450 6f69 6e74 733c 2f68 333e stortPoints

    │ │ │ -000c9ed0: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ -000c9ef0: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ -000c9f10: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ -000c9f20: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ -000c9f30: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ -000c9f40: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;void< │ │ │ -000c9f60: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> undistort │ │ │ -000c9f90: 506f 696e 7473 3c2f 7370 616e 3e3c 7762 Points(MatOfPoint2f src,. MatOfPoint2f dst,. Mat cameraMat │ │ │ -000ca0d0: 7269 782c 0a20 3c61 2068 7265 663d 222e rix,. Mat d │ │ │ -000ca120: 6973 7443 6f65 6666 732c 0a20 3c61 2068 istCoeffs,. Mat& │ │ │ -000ca170: 6e62 7370 3b52 293c 2f73 7061 6e3e 3c2f nbsp;R).
    Computes │ │ │ -000ca1a0: 2074 6865 2069 6465 616c 2070 6f69 6e74 the ideal point │ │ │ -000ca1b0: 2063 6f6f 7264 696e 6174 6573 2066 726f coordinates fro │ │ │ -000ca1c0: 6d20 7468 6520 6f62 7365 7276 6564 2070 m the observed p │ │ │ -000ca1d0: 6f69 6e74 2063 6f6f 7264 696e 6174 6573 oint coordinates │ │ │ -000ca1e0: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ -000ca1f0: 6973 2073 696d 696c 6172 2074 6f20 2375 is similar to #u │ │ │ -000ca200: 6e64 6973 746f 7274 2061 6e64 2023 696e ndistort and #in │ │ │ -000ca210: 6974 556e 6469 7374 6f72 7452 6563 7469 itUndistortRecti │ │ │ -000ca220: 6679 4d61 7020 6275 7420 6974 206f 7065 fyMap but it ope │ │ │ -000ca230: 7261 7465 7320 6f6e 2061 0a73 7061 7273 rates on a.spars │ │ │ -000ca240: 6520 7365 7420 6f66 2070 6f69 6e74 7320 e set of points │ │ │ -000ca250: 696e 7374 6561 6420 6f66 2061 2072 6173 instead of a ras │ │ │ -000ca260: 7465 7220 696d 6167 652e 2041 6c73 6f20 ter image. Also │ │ │ -000ca270: 7468 6520 6675 6e63 7469 6f6e 2070 6572 the function per │ │ │ -000ca280: 666f 726d 7320 6120 7265 7665 7273 6520 forms a reverse │ │ │ -000ca290: 7472 616e 7366 6f72 6d61 7469 6f6e 0a74 transformation.t │ │ │ -000ca2a0: 6f20 2023 7072 6f6a 6563 7450 6f69 6e74 o #projectPoint │ │ │ -000ca2b0: 732e 2049 6e20 6361 7365 206f 6620 6120 s. In case of a │ │ │ -000ca2c0: 3344 206f 626a 6563 742c 2069 7420 646f 3D object, it do │ │ │ -000ca2d0: 6573 206e 6f74 2072 6563 6f6e 7374 7275 es not reconstru │ │ │ -000ca2e0: 6374 2069 7473 2033 4420 636f 6f72 6469 ct its 3D coordi │ │ │ -000ca2f0: 6e61 7465 732c 2062 7574 2066 6f72 2061 nates, but for a │ │ │ -000ca300: 0a70 6c61 6e61 7220 6f62 6a65 6374 2c20 .planar object, │ │ │ -000ca310: 6974 2064 6f65 732c 2075 7020 746f 2061 it does, up to a │ │ │ -000ca320: 2074 7261 6e73 6c61 7469 6f6e 2076 6563 translation vec │ │ │ -000ca330: 746f 722c 2069 6620 7468 6520 7072 6f70 tor, if the prop │ │ │ -000ca340: 6572 2052 2069 7320 7370 6563 6966 6965 er R is specifie │ │ │ -000ca350: 642e 0a0a 466f 7220 6561 6368 206f 6273 d...For each obs │ │ │ -000ca360: 6572 7665 6420 706f 696e 7420 636f 6f72 erved point coor │ │ │ -000ca370: 6469 6e61 7465 205c 2828 752c 2076 295c dinate \((u, v)\ │ │ │ -000ca380: 2920 7468 6520 6675 6e63 7469 6f6e 2063 ) the function c │ │ │ -000ca390: 6f6d 7075 7465 733a 0a5c 280a 5c62 6567 omputes:.\(.\beg │ │ │ -000ca3a0: 696e 7b61 7272 6179 7d7b 6c7d 0a78 5e7b in{array}{l}.x^{ │ │ │ -000ca3b0: 227d 2020 5c6c 6566 7461 7272 6f77 2028 "} \leftarrow ( │ │ │ -000ca3c0: 7520 2d20 635f 7829 2f66 5f78 2020 5c5c u - c_x)/f_x \\ │ │ │ -000ca3d0: 0a79 5e7b 227d 2020 5c6c 6566 7461 7272 .y^{"} \leftarr │ │ │ -000ca3e0: 6f77 2028 7620 2d20 635f 7929 2f66 5f79 ow (v - c_y)/f_y │ │ │ -000ca3f0: 2020 5c5c 0a28 7827 2c79 2729 203d 2075 \\.(x',y') = u │ │ │ -000ca400: 6e64 6973 746f 7274 2878 5e7b 227d 2c79 ndistort(x^{"},y │ │ │ -000ca410: 5e7b 227d 2c20 5c74 6578 7474 747b 6469 ^{"}, \texttt{di │ │ │ -000ca420: 7374 436f 6566 6673 7d29 205c 5c0a 7b5b stCoeffs}) \\.{[ │ │ │ -000ca430: 585c 2c59 5c2c 575d 7d20 5e54 2020 5c6c X\,Y\,W]} ^T \l │ │ │ -000ca440: 6566 7461 7272 6f77 2052 2a5b 7827 205c eftarrow R*[x' \ │ │ │ -000ca450: 2c20 7927 205c 2c20 315d 5e54 2020 5c5c , y' \, 1]^T \\ │ │ │ -000ca460: 0a78 2020 5c6c 6566 7461 7272 6f77 2058 .x \leftarrow X │ │ │ -000ca470: 2f57 2020 5c5c 0a79 2020 5c6c 6566 7461 /W \\.y \lefta │ │ │ -000ca480: 7272 6f77 2059 2f57 2020 5c5c 0a5c 7465 rrow Y/W \\.\te │ │ │ -000ca490: 7874 7b6f 6e6c 7920 7065 7266 6f72 6d65 xt{only performe │ │ │ -000ca4a0: 6420 6966 2050 2069 7320 7370 6563 6966 d if P is specif │ │ │ -000ca4b0: 6965 643a 7d20 5c5c 0a75 2720 205c 6c65 ied:} \\.u' \le │ │ │ -000ca4c0: 6674 6172 726f 7720 7820 7b66 277d 5f78 ftarrow x {f'}_x │ │ │ -000ca4d0: 202b 207b 6327 7d5f 7820 205c 5c0a 7627 + {c'}_x \\.v' │ │ │ -000ca4e0: 2020 5c6c 6566 7461 7272 6f77 2079 207b \leftarrow y { │ │ │ -000ca4f0: 6627 7d5f 7920 2b20 7b63 277d 5f79 0a5c f'}_y + {c'}_y.\ │ │ │ -000ca500: 656e 647b 6172 7261 797d 0a5c 290a 0a77 end{array}.\)..w │ │ │ -000ca510: 6865 7265 202a 756e 6469 7374 6f72 742a here *undistort* │ │ │ -000ca520: 2069 7320 616e 2061 7070 726f 7869 6d61 is an approxima │ │ │ -000ca530: 7465 2069 7465 7261 7469 7665 2061 6c67 te iterative alg │ │ │ -000ca540: 6f72 6974 686d 2074 6861 7420 6573 7469 orithm that esti │ │ │ -000ca550: 6d61 7465 7320 7468 6520 6e6f 726d 616c mates the normal │ │ │ -000ca560: 697a 6564 206f 7269 6769 6e61 6c0a 706f ized original.po │ │ │ -000ca570: 696e 7420 636f 6f72 6469 6e61 7465 7320 int coordinates │ │ │ -000ca580: 6f75 7420 6f66 2074 6865 206e 6f72 6d61 out of the norma │ │ │ -000ca590: 6c69 7a65 6420 6469 7374 6f72 7465 6420 lized distorted │ │ │ -000ca5a0: 706f 696e 7420 636f 6f72 6469 6e61 7465 point coordinate │ │ │ -000ca5b0: 7320 2822 6e6f 726d 616c 697a 6564 2220 s ("normalized" │ │ │ -000ca5c0: 6d65 616e 7320 7468 6174 2074 6865 0a63 means that the.c │ │ │ -000ca5d0: 6f6f 7264 696e 6174 6573 2064 6f20 6e6f oordinates do no │ │ │ -000ca5e0: 7420 6465 7065 6e64 206f 6e20 7468 6520 t depend on the │ │ │ -000ca5f0: 6361 6d65 7261 206d 6174 7269 7829 2e0a camera matrix).. │ │ │ -000ca600: 0a54 6865 2066 756e 6374 696f 6e20 6361 .The function ca │ │ │ -000ca610: 6e20 6265 2075 7365 6420 666f 7220 626f n be used for bo │ │ │ -000ca620: 7468 2061 2073 7465 7265 6f20 6361 6d65 th a stereo came │ │ │ -000ca630: 7261 2068 6561 6420 6f72 2061 206d 6f6e ra head or a mon │ │ │ -000ca640: 6f63 756c 6172 2063 616d 6572 6120 2877 ocular camera (w │ │ │ -000ca650: 6865 6e20 5220 6973 2065 6d70 7479 292e hen R is empty). │ │ │ -000ca660: 0a0a 3c62 3e4e 6f74 653a 3c2f 623e 203c ..Note: < │ │ │ -000ca670: 623e 436f 6f72 6469 6e61 7465 2053 7973 b>Coordinate Sys │ │ │ -000ca680: 7465 6d73 3a3c 2f62 3e0a 3c75 6c3e 0a20 tems:.
      . │ │ │ -000ca690: 203c 6c69 3e0a 203c 623e 496e 7075 7420
    • . Input │ │ │ -000ca6a0: 283c 636f 6465 3e73 7263 3c2f 636f 6465 (src): Points a │ │ │ -000ca6c0: 7265 2065 7870 6563 7465 6420 696e 203c re expected in < │ │ │ -000ca6d0: 623e 7069 7865 6c20 636f 6f72 6469 6e61 b>pixel coordina │ │ │ -000ca6e0: 7465 733c 2f62 3e20 6f66 2074 6865 2064 tes of the d │ │ │ -000ca6f0: 6973 746f 7274 6564 2069 6d61 6765 2c20 istorted image, │ │ │ -000ca700: 692e 652e 2c0a 2020 636f 6f72 6469 6e61 i.e.,. coordina │ │ │ -000ca710: 7465 7320 5c28 2875 2c20 7629 5c29 206d tes \((u, v)\) m │ │ │ -000ca720: 6561 7375 7265 6420 696e 2070 6978 656c easured in pixel │ │ │ -000ca730: 7320 6672 6f6d 2074 6865 2074 6f70 2d6c s from the top-l │ │ │ -000ca740: 6566 7420 636f 726e 6572 206f 6620 7468 eft corner of th │ │ │ -000ca750: 6520 696d 6167 652e 0a20 203c 2f6c 693e e image..
    • │ │ │ -000ca760: 0a20 203c 6c69 3e0a 203c 623e 4f75 7470 .
    • . Outp │ │ │ -000ca770: 7574 2028 3c63 6f64 653e 6473 743c 2f63 ut (dst): The c │ │ │ -000ca790: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ -000ca7a0: 206f 6620 6f75 7470 7574 2070 6f69 6e74 of output point │ │ │ -000ca7b0: 7320 6465 7065 6e64 7320 6f6e 2070 6172 s depends on par │ │ │ -000ca7c0: 616d 6574 6572 203c 636f 6465 3e50 3c2f ameter P:.
        . │ │ │ -000ca7e0: 2020 3c6c 693e 0a20 2020 4966 203c 636f
      • . If P is p │ │ │ -000ca800: 726f 7669 6465 6420 286e 6f74 2065 6d70 rovided (not emp │ │ │ -000ca810: 7479 293a 204f 7574 7075 7420 706f 696e ty): Output poin │ │ │ -000ca820: 7473 2061 7265 2069 6e20 3c62 3e70 6978 ts are in pix │ │ │ -000ca830: 656c 2063 6f6f 7264 696e 6174 6573 3c2f el coordinates of the rectif │ │ │ -000ca850: 6965 642f 756e 6469 7374 6f72 7465 6420 ied/undistorted │ │ │ -000ca860: 696d 6167 6520 706c 616e 652c 2075 7369 image plane, usi │ │ │ -000ca870: 6e67 2074 6865 2063 616d 6572 6120 6d61 ng the camera ma │ │ │ -000ca880: 7472 6978 203c 636f 6465 3e50 3c2f 636f trix P..
      • . │ │ │ -000ca8a0: 2020 203c 6c69 3e0a 2020 2049 6620 3c63
      • . If P is │ │ │ -000ca8c0: 656d 7074 7920 6f72 2069 6465 6e74 6974 empty or identit │ │ │ -000ca8d0: 793a 204f 7574 7075 7420 706f 696e 7473 y: Output points │ │ │ -000ca8e0: 2061 7265 2069 6e20 3c62 3e6e 6f72 6d61 are in norma │ │ │ -000ca8f0: 6c69 7a65 6420 6361 6d65 7261 2063 6f6f lized camera coo │ │ │ -000ca900: 7264 696e 6174 6573 3c2f 623e 2028 616c rdinates (al │ │ │ -000ca910: 736f 2063 616c 6c65 6420 226e 6f72 6d61 so called "norma │ │ │ -000ca920: 6c69 7a65 6420 696d 6167 6520 636f 6f72 lized image coor │ │ │ -000ca930: 6469 6e61 7465 7322 292c 0a20 2020 2077 dinates"),. w │ │ │ -000ca940: 6869 6368 2061 7265 2064 696d 656e 7369 hich are dimensi │ │ │ -000ca950: 6f6e 6c65 7373 2063 6f6f 7264 696e 6174 onless coordinat │ │ │ -000ca960: 6573 205c 2828 782c 2079 295c 2920 696e es \((x, y)\) in │ │ │ -000ca970: 2074 6865 2063 616d 6572 6127 7320 666f the camera's fo │ │ │ -000ca980: 6361 6c20 706c 616e 652c 2072 656c 6174 cal plane, relat │ │ │ -000ca990: 6564 2074 6f20 7069 7865 6c20 636f 6f72 ed to pixel coor │ │ │ -000ca9a0: 6469 6e61 7465 7320 6279 3a0a 2020 2020 dinates by:. │ │ │ -000ca9b0: 5c28 7820 3d20 2875 202d 2063 5f78 2920 \(x = (u - c_x) │ │ │ -000ca9c0: 2f20 665f 785c 2920 616e 6420 5c28 7920 / f_x\) and \(y │ │ │ -000ca9d0: 3d20 2876 202d 2063 5f79 2920 2f20 665f = (v - c_y) / f_ │ │ │ -000ca9e0: 795c 292e 2054 6865 7365 206e 6f72 6d61 y\). These norma │ │ │ -000ca9f0: 6c69 7a65 6420 636f 6f72 6469 6e61 7465 lized coordinate │ │ │ -000caa00: 7320 6172 6520 696e 6465 7065 6e64 656e s are independen │ │ │ -000caa10: 7420 6f66 2074 6865 2063 616d 6572 6127 t of the camera' │ │ │ -000caa20: 7320 696e 7472 696e 7369 6320 7061 7261 s intrinsic para │ │ │ -000caa30: 6d65 7465 7273 2061 6e64 2061 7265 2075 meters and are u │ │ │ -000caa40: 7365 6675 6c20 666f 7220 3344 2072 6563 seful for 3D rec │ │ │ -000caa50: 6f6e 7374 7275 6374 696f 6e20 6f72 2065 onstruction or e │ │ │ -000caa60: 7069 706f 6c61 7220 6765 6f6d 6574 7279 pipolar geometry │ │ │ -000caa70: 2e0a 2020 2020 3c2f 6c69 3e0a 2020 3c2f ..
      • . .. .
    .
    .
    │ │ │ -000caab0: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ -000caac0: 0a3c 6464 3e3c 636f 6465 3e73 7263 3c2f .
    src - Observed │ │ │ -000caae0: 2070 6f69 6e74 2063 6f6f 7264 696e 6174 point coordinat │ │ │ -000caaf0: 6573 2069 6e20 3c62 3e70 6978 656c 2063 es in pixel c │ │ │ -000cab00: 6f6f 7264 696e 6174 6573 3c2f 623e 206f oordinates o │ │ │ -000cab10: 6620 7468 6520 6469 7374 6f72 7465 6420 f the distorted │ │ │ -000cab20: 696d 6167 652c 2032 784e 2f4e 7832 2031 image, 2xN/Nx2 1 │ │ │ -000cab30: 2d63 6861 6e6e 656c 206f 7220 3178 4e2f -channel or 1xN/ │ │ │ -000cab40: 4e78 3120 322d 6368 616e 6e65 6c20 2843 Nx1 2-channel (C │ │ │ -000cab50: 565f 3332 4643 3220 6f72 2043 565f 3634 V_32FC2 or CV_64 │ │ │ -000cab60: 4643 3229 2028 6f72 0a76 6563 746f 7226 FC2) (or.vector& │ │ │ -000cab70: 6c74 3b50 6f69 6e74 3266 2667 743b 2029 lt;Point2f> ) │ │ │ -000cab80: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    dst - Ou │ │ │ -000caba0: 7470 7574 2069 6465 616c 2070 6f69 6e74 tput ideal point │ │ │ -000cabb0: 2063 6f6f 7264 696e 6174 6573 2028 3178 coordinates (1x │ │ │ -000cabc0: 4e2f 4e78 3120 322d 6368 616e 6e65 6c20 N/Nx1 2-channel │ │ │ -000cabd0: 6f72 2076 6563 746f 7226 6c74 3b50 6f69 or vector<Poi │ │ │ -000cabe0: 6e74 3266 2667 743b 2029 2061 6674 6572 nt2f> ) after │ │ │ -000cabf0: 2075 6e64 6973 746f 7274 696f 6e20 616e undistortion an │ │ │ -000cac00: 6420 7265 7665 7273 6520 7065 7273 7065 d reverse perspe │ │ │ -000cac10: 6374 6976 650a 7472 616e 7366 6f72 6d61 ctive.transforma │ │ │ -000cac20: 7469 6f6e 2e20 4966 206d 6174 7269 7820 tion. If matrix │ │ │ -000cac30: 5020 6973 2069 6465 6e74 6974 7920 6f72 P is identity or │ │ │ -000cac40: 206f 6d69 7474 6564 2c20 6473 7420 7769 omitted, dst wi │ │ │ -000cac50: 6c6c 2063 6f6e 7461 696e 206e 6f72 6d61 ll contain norma │ │ │ -000cac60: 6c69 7a65 6420 706f 696e 7420 636f 6f72 lized point coor │ │ │ -000cac70: 6469 6e61 7465 732e 3c2f 6464 3e0a 3c64 dinates.
    .cameraMa │ │ │ -000cac90: 7472 6978 3c2f 636f 6465 3e20 2d20 4361 trix - Ca │ │ │ -000caca0: 6d65 7261 206d 6174 7269 7820 5c28 5c76 mera matrix \(\v │ │ │ -000cacb0: 6563 7468 7265 6574 6872 6565 7b66 5f78 ecthreethree{f_x │ │ │ -000cacc0: 7d7b 307d 7b63 5f78 7d7b 307d 7b66 5f79 }{0}{c_x}{0}{f_y │ │ │ -000cacd0: 7d7b 635f 797d 7b30 7d7b 307d 7b31 7d5c }{c_y}{0}{0}{1}\ │ │ │ -000cace0: 2920 2e3c 2f64 643e 0a3c 6464 3e3c 636f ) ..
    distCoeffs - Input vec │ │ │ -000cad10: 746f 7220 6f66 2064 6973 746f 7274 696f tor of distortio │ │ │ -000cad20: 6e20 636f 6566 6669 6369 656e 7473 0a5c n coefficients.\ │ │ │ -000cad30: 2828 6b5f 312c 206b 5f32 2c20 705f 312c ((k_1, k_2, p_1, │ │ │ -000cad40: 2070 5f32 5b2c 206b 5f33 5b2c 206b 5f34 p_2[, k_3[, k_4 │ │ │ -000cad50: 2c20 6b5f 352c 206b 5f36 5b2c 2073 5f31 , k_5, k_6[, s_1 │ │ │ -000cad60: 2c20 735f 322c 2073 5f33 2c20 735f 345b , s_2, s_3, s_4[ │ │ │ -000cad70: 2c20 5c74 6175 5f78 2c20 5c74 6175 5f79 , \tau_x, \tau_y │ │ │ -000cad80: 5d5d 5d5d 295c 290a 6f66 2034 2c20 352c ]]]])\).of 4, 5, │ │ │ -000cad90: 2038 2c20 3132 206f 7220 3134 2065 6c65 8, 12 or 14 ele │ │ │ -000cada0: 6d65 6e74 732e 2049 6620 7468 6520 7665 ments. If the ve │ │ │ -000cadb0: 6374 6f72 2069 7320 4e55 4c4c 2f65 6d70 ctor is NULL/emp │ │ │ -000cadc0: 7479 2c20 7468 6520 7a65 726f 2064 6973 ty, the zero dis │ │ │ -000cadd0: 746f 7274 696f 6e20 636f 6566 6669 6369 tortion coeffici │ │ │ -000cade0: 656e 7473 2061 7265 2061 7373 756d 6564 ents are assumed │ │ │ -000cadf0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    R - Rect │ │ │ -000cae10: 6966 6963 6174 696f 6e20 7472 616e 7366 ification transf │ │ │ -000cae20: 6f72 6d61 7469 6f6e 2069 6e20 7468 6520 ormation in the │ │ │ -000cae30: 6f62 6a65 6374 2073 7061 6365 2028 3378 object space (3x │ │ │ -000cae40: 3320 6d61 7472 6978 292e 2052 3120 6f72 3 matrix). R1 or │ │ │ -000cae50: 2052 3220 636f 6d70 7574 6564 2062 790a R2 computed by. │ │ │ -000cae60: 2373 7465 7265 6f52 6563 7469 6679 2063 #stereoRectify c │ │ │ -000cae70: 616e 2062 6520 7061 7373 6564 2068 6572 an be passed her │ │ │ -000cae80: 652e 2049 6620 7468 6520 6d61 7472 6978 e. If the matrix │ │ │ -000cae90: 2069 7320 656d 7074 792c 2074 6865 2069 is empty, the i │ │ │ -000caea0: 6465 6e74 6974 7920 7472 616e 7366 6f72 dentity transfor │ │ │ -000caeb0: 6d61 7469 6f6e 2069 7320 7573 6564 2e0a mation is used.. │ │ │ -000caec0: 2373 7465 7265 6f52 6563 7469 6679 2063 #stereoRectify c │ │ │ -000caed0: 616e 2062 6520 7061 7373 6564 2068 6572 an be passed her │ │ │ -000caee0: 652e 2049 6620 7468 6520 6d61 7472 6978 e. If the matrix │ │ │ -000caef0: 2069 7320 656d 7074 792c 2074 6865 2069 is empty, the i │ │ │ -000caf00: 6465 6e74 6974 7920 6e65 7720 6361 6d65 dentity new came │ │ │ -000caf10: 7261 206d 6174 7269 7820 6973 2075 7365 ra matrix is use │ │ │ -000caf20: 6420 616e 6420 6f75 7470 7574 2077 696c d and output wil │ │ │ -000caf30: 6c20 6265 2069 6e20 6e6f 726d 616c 697a l be in normaliz │ │ │ -000caf40: 6564 2063 6f6f 7264 696e 6174 6573 2e3c ed coordinates.< │ │ │ -000caf50: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .
    ..
  • .
    .

    und │ │ │ -000cb010: 6973 746f 7274 506f 696e 7473 3c2f 6833 istortPoints

    .
    .
    │ │ │ -000cb060: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -000cb080: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -000cb090: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;void │ │ │ -000cb0b0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  undistor │ │ │ -000cb0e0: 7450 6f69 6e74 733c 2f73 7061 6e3e 3c77 tPoints(MatOfPoint2f src,. MatOfPoint2f< │ │ │ -000cb1c0: 2f61 3e26 6e62 7370 3b64 7374 2c0a 203c /a> dst,. < │ │ │ -000cb1d0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000cb1e0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000cb1f0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000cb200: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ -000cb220: 7472 6978 2c0a 203c 6120 6872 6566 3d22 trix,. Mat  │ │ │ -000cb270: 6469 7374 436f 6566 6673 293c 2f73 7061 distCoeffs)
    .
    Comp │ │ │ -000cb2a0: 7574 6573 2074 6865 2069 6465 616c 2070 utes the ideal p │ │ │ -000cb2b0: 6f69 6e74 2063 6f6f 7264 696e 6174 6573 oint coordinates │ │ │ -000cb2c0: 2066 726f 6d20 7468 6520 6f62 7365 7276 from the observ │ │ │ -000cb2d0: 6564 2070 6f69 6e74 2063 6f6f 7264 696e ed point coordin │ │ │ -000cb2e0: 6174 6573 2e0a 0a54 6865 2066 756e 6374 ates...The funct │ │ │ -000cb2f0: 696f 6e20 6973 2073 696d 696c 6172 2074 ion is similar t │ │ │ -000cb300: 6f20 2375 6e64 6973 746f 7274 2061 6e64 o #undistort and │ │ │ -000cb310: 2023 696e 6974 556e 6469 7374 6f72 7452 #initUndistortR │ │ │ -000cb320: 6563 7469 6679 4d61 7020 6275 7420 6974 ectifyMap but it │ │ │ -000cb330: 206f 7065 7261 7465 7320 6f6e 2061 0a73 operates on a.s │ │ │ -000cb340: 7061 7273 6520 7365 7420 6f66 2070 6f69 parse set of poi │ │ │ -000cb350: 6e74 7320 696e 7374 6561 6420 6f66 2061 nts instead of a │ │ │ -000cb360: 2072 6173 7465 7220 696d 6167 652e 2041 raster image. A │ │ │ -000cb370: 6c73 6f20 7468 6520 6675 6e63 7469 6f6e lso the function │ │ │ -000cb380: 2070 6572 666f 726d 7320 6120 7265 7665 performs a reve │ │ │ -000cb390: 7273 6520 7472 616e 7366 6f72 6d61 7469 rse transformati │ │ │ -000cb3a0: 6f6e 0a74 6f20 2023 7072 6f6a 6563 7450 on.to #projectP │ │ │ -000cb3b0: 6f69 6e74 732e 2049 6e20 6361 7365 206f oints. In case o │ │ │ -000cb3c0: 6620 6120 3344 206f 626a 6563 742c 2069 f a 3D object, i │ │ │ -000cb3d0: 7420 646f 6573 206e 6f74 2072 6563 6f6e t does not recon │ │ │ -000cb3e0: 7374 7275 6374 2069 7473 2033 4420 636f struct its 3D co │ │ │ -000cb3f0: 6f72 6469 6e61 7465 732c 2062 7574 2066 ordinates, but f │ │ │ -000cb400: 6f72 2061 0a70 6c61 6e61 7220 6f62 6a65 or a.planar obje │ │ │ -000cb410: 6374 2c20 6974 2064 6f65 732c 2075 7020 ct, it does, up │ │ │ -000cb420: 746f 2061 2074 7261 6e73 6c61 7469 6f6e to a translation │ │ │ -000cb430: 2076 6563 746f 722c 2069 6620 7468 6520 vector, if the │ │ │ -000cb440: 7072 6f70 6572 2052 2069 7320 7370 6563 proper R is spec │ │ │ -000cb450: 6966 6965 642e 0a0a 466f 7220 6561 6368 ified...For each │ │ │ -000cb460: 206f 6273 6572 7665 6420 706f 696e 7420 observed point │ │ │ -000cb470: 636f 6f72 6469 6e61 7465 205c 2828 752c coordinate \((u, │ │ │ -000cb480: 2076 295c 2920 7468 6520 6675 6e63 7469 v)\) the functi │ │ │ -000cb490: 6f6e 2063 6f6d 7075 7465 733a 0a5c 280a on computes:.\(. │ │ │ -000cb4a0: 5c62 6567 696e 7b61 7272 6179 7d7b 6c7d \begin{array}{l} │ │ │ -000cb4b0: 0a78 5e7b 227d 2020 5c6c 6566 7461 7272 .x^{"} \leftarr │ │ │ -000cb4c0: 6f77 2028 7520 2d20 635f 7829 2f66 5f78 ow (u - c_x)/f_x │ │ │ -000cb4d0: 2020 5c5c 0a79 5e7b 227d 2020 5c6c 6566 \\.y^{"} \lef │ │ │ -000cb4e0: 7461 7272 6f77 2028 7620 2d20 635f 7929 tarrow (v - c_y) │ │ │ -000cb4f0: 2f66 5f79 2020 5c5c 0a28 7827 2c79 2729 /f_y \\.(x',y') │ │ │ -000cb500: 203d 2075 6e64 6973 746f 7274 2878 5e7b = undistort(x^{ │ │ │ -000cb510: 227d 2c79 5e7b 227d 2c20 5c74 6578 7474 "},y^{"}, \textt │ │ │ -000cb520: 747b 6469 7374 436f 6566 6673 7d29 205c t{distCoeffs}) \ │ │ │ -000cb530: 5c0a 7b5b 585c 2c59 5c2c 575d 7d20 5e54 \.{[X\,Y\,W]} ^T │ │ │ -000cb540: 2020 5c6c 6566 7461 7272 6f77 2052 2a5b \leftarrow R*[ │ │ │ -000cb550: 7827 205c 2c20 7927 205c 2c20 315d 5e54 x' \, y' \, 1]^T │ │ │ -000cb560: 2020 5c5c 0a78 2020 5c6c 6566 7461 7272 \\.x \leftarr │ │ │ -000cb570: 6f77 2058 2f57 2020 5c5c 0a79 2020 5c6c ow X/W \\.y \l │ │ │ -000cb580: 6566 7461 7272 6f77 2059 2f57 2020 5c5c eftarrow Y/W \\ │ │ │ -000cb590: 0a5c 7465 7874 7b6f 6e6c 7920 7065 7266 .\text{only perf │ │ │ -000cb5a0: 6f72 6d65 6420 6966 2050 2069 7320 7370 ormed if P is sp │ │ │ -000cb5b0: 6563 6966 6965 643a 7d20 5c5c 0a75 2720 ecified:} \\.u' │ │ │ -000cb5c0: 205c 6c65 6674 6172 726f 7720 7820 7b66 \leftarrow x {f │ │ │ -000cb5d0: 277d 5f78 202b 207b 6327 7d5f 7820 205c '}_x + {c'}_x \ │ │ │ -000cb5e0: 5c0a 7627 2020 5c6c 6566 7461 7272 6f77 \.v' \leftarrow │ │ │ -000cb5f0: 2079 207b 6627 7d5f 7920 2b20 7b63 277d y {f'}_y + {c'} │ │ │ -000cb600: 5f79 0a5c 656e 647b 6172 7261 797d 0a5c _y.\end{array}.\ │ │ │ -000cb610: 290a 0a77 6865 7265 202a 756e 6469 7374 )..where *undist │ │ │ -000cb620: 6f72 742a 2069 7320 616e 2061 7070 726f ort* is an appro │ │ │ -000cb630: 7869 6d61 7465 2069 7465 7261 7469 7665 ximate iterative │ │ │ -000cb640: 2061 6c67 6f72 6974 686d 2074 6861 7420 algorithm that │ │ │ -000cb650: 6573 7469 6d61 7465 7320 7468 6520 6e6f estimates the no │ │ │ -000cb660: 726d 616c 697a 6564 206f 7269 6769 6e61 rmalized origina │ │ │ -000cb670: 6c0a 706f 696e 7420 636f 6f72 6469 6e61 l.point coordina │ │ │ -000cb680: 7465 7320 6f75 7420 6f66 2074 6865 206e tes out of the n │ │ │ -000cb690: 6f72 6d61 6c69 7a65 6420 6469 7374 6f72 ormalized distor │ │ │ -000cb6a0: 7465 6420 706f 696e 7420 636f 6f72 6469 ted point coordi │ │ │ -000cb6b0: 6e61 7465 7320 2822 6e6f 726d 616c 697a nates ("normaliz │ │ │ -000cb6c0: 6564 2220 6d65 616e 7320 7468 6174 2074 ed" means that t │ │ │ -000cb6d0: 6865 0a63 6f6f 7264 696e 6174 6573 2064 he.coordinates d │ │ │ -000cb6e0: 6f20 6e6f 7420 6465 7065 6e64 206f 6e20 o not depend on │ │ │ -000cb6f0: 7468 6520 6361 6d65 7261 206d 6174 7269 the camera matri │ │ │ -000cb700: 7829 2e0a 0a54 6865 2066 756e 6374 696f x)...The functio │ │ │ -000cb710: 6e20 6361 6e20 6265 2075 7365 6420 666f n can be used fo │ │ │ -000cb720: 7220 626f 7468 2061 2073 7465 7265 6f20 r both a stereo │ │ │ -000cb730: 6361 6d65 7261 2068 6561 6420 6f72 2061 camera head or a │ │ │ -000cb740: 206d 6f6e 6f63 756c 6172 2063 616d 6572 monocular camer │ │ │ -000cb750: 6120 2877 6865 6e20 5220 6973 2065 6d70 a (when R is emp │ │ │ -000cb760: 7479 292e 0a0a 3c62 3e4e 6f74 653a 3c2f ty)...Note: Coordinate │ │ │ -000cb780: 2053 7973 7465 6d73 3a3c 2f62 3e0a 3c75 Systems:..
  • . In │ │ │ -000cb7a0: 7075 7420 283c 636f 6465 3e73 7263 3c2f put (src): Poin │ │ │ -000cb7c0: 7473 2061 7265 2065 7870 6563 7465 6420 ts are expected │ │ │ -000cb7d0: 696e 203c 623e 7069 7865 6c20 636f 6f72 in pixel coor │ │ │ -000cb7e0: 6469 6e61 7465 733c 2f62 3e20 6f66 2074 dinates of t │ │ │ -000cb7f0: 6865 2064 6973 746f 7274 6564 2069 6d61 he distorted ima │ │ │ -000cb800: 6765 2c20 692e 652e 2c0a 2020 636f 6f72 ge, i.e.,. coor │ │ │ -000cb810: 6469 6e61 7465 7320 5c28 2875 2c20 7629 dinates \((u, v) │ │ │ -000cb820: 5c29 206d 6561 7375 7265 6420 696e 2070 \) measured in p │ │ │ -000cb830: 6978 656c 7320 6672 6f6d 2074 6865 2074 ixels from the t │ │ │ -000cb840: 6f70 2d6c 6566 7420 636f 726e 6572 206f op-left corner o │ │ │ -000cb850: 6620 7468 6520 696d 6167 652e 0a20 203c f the image.. < │ │ │ -000cb860: 2f6c 693e 0a20 203c 6c69 3e0a 203c 623e /li>.
  • . │ │ │ -000cb870: 4f75 7470 7574 2028 3c63 6f64 653e 6473 Output (ds │ │ │ -000cb880: 743c 2f63 6f64 653e 293c 2f62 3e3a 2054 t): T │ │ │ -000cb890: 6865 2063 6f6f 7264 696e 6174 6520 7379 he coordinate sy │ │ │ -000cb8a0: 7374 656d 206f 6620 6f75 7470 7574 2070 stem of output p │ │ │ -000cb8b0: 6f69 6e74 7320 6465 7065 6e64 7320 6f6e oints depends on │ │ │ -000cb8c0: 2070 6172 616d 6574 6572 203c 636f 6465 parameter P:.
      .
    • . If │ │ │ -000cb8f0: 203c 636f 6465 3e50 3c2f 636f 6465 3e20 P │ │ │ -000cb900: 6973 2070 726f 7669 6465 6420 286e 6f74 is provided (not │ │ │ -000cb910: 2065 6d70 7479 293a 204f 7574 7075 7420 empty): Output │ │ │ -000cb920: 706f 696e 7473 2061 7265 2069 6e20 3c62 points are in pixel coordinat │ │ │ -000cb940: 6573 3c2f 623e 206f 6620 7468 6520 7265 es of the re │ │ │ -000cb950: 6374 6966 6965 642f 756e 6469 7374 6f72 ctified/undistor │ │ │ -000cb960: 7465 6420 696d 6167 6520 706c 616e 652c ted image plane, │ │ │ -000cb970: 2075 7369 6e67 2074 6865 2063 616d 6572 using the camer │ │ │ -000cb980: 6120 6d61 7472 6978 203c 636f 6465 3e50 a matrix P │ │ │ -000cb990: 3c2f 636f 6465 3e2e 0a20 2020 203c 2f6c .. .
    • . I │ │ │ -000cb9b0: 6620 3c63 6f64 653e 503c 2f63 6f64 653e f P │ │ │ -000cb9c0: 2069 7320 656d 7074 7920 6f72 2069 6465 is empty or ide │ │ │ -000cb9d0: 6e74 6974 793a 204f 7574 7075 7420 706f ntity: Output po │ │ │ -000cb9e0: 696e 7473 2061 7265 2069 6e20 3c62 3e6e ints are in n │ │ │ -000cb9f0: 6f72 6d61 6c69 7a65 6420 6361 6d65 7261 ormalized camera │ │ │ -000cba00: 2063 6f6f 7264 696e 6174 6573 3c2f 623e coordinates │ │ │ -000cba10: 2028 616c 736f 2063 616c 6c65 6420 226e (also called "n │ │ │ -000cba20: 6f72 6d61 6c69 7a65 6420 696d 6167 6520 ormalized image │ │ │ -000cba30: 636f 6f72 6469 6e61 7465 7322 292c 0a20 coordinates"),. │ │ │ -000cba40: 2020 2077 6869 6368 2061 7265 2064 696d which are dim │ │ │ -000cba50: 656e 7369 6f6e 6c65 7373 2063 6f6f 7264 ensionless coord │ │ │ -000cba60: 696e 6174 6573 205c 2828 782c 2079 295c inates \((x, y)\ │ │ │ -000cba70: 2920 696e 2074 6865 2063 616d 6572 6127 ) in the camera' │ │ │ -000cba80: 7320 666f 6361 6c20 706c 616e 652c 2072 s focal plane, r │ │ │ -000cba90: 656c 6174 6564 2074 6f20 7069 7865 6c20 elated to pixel │ │ │ -000cbaa0: 636f 6f72 6469 6e61 7465 7320 6279 3a0a coordinates by:. │ │ │ -000cbab0: 2020 2020 5c28 7820 3d20 2875 202d 2063 \(x = (u - c │ │ │ -000cbac0: 5f78 2920 2f20 665f 785c 2920 616e 6420 _x) / f_x\) and │ │ │ -000cbad0: 5c28 7920 3d20 2876 202d 2063 5f79 2920 \(y = (v - c_y) │ │ │ -000cbae0: 2f20 665f 795c 292e 2054 6865 7365 206e / f_y\). These n │ │ │ -000cbaf0: 6f72 6d61 6c69 7a65 6420 636f 6f72 6469 ormalized coordi │ │ │ -000cbb00: 6e61 7465 7320 6172 6520 696e 6465 7065 nates are indepe │ │ │ -000cbb10: 6e64 656e 7420 6f66 2074 6865 2063 616d ndent of the cam │ │ │ -000cbb20: 6572 6127 7320 696e 7472 696e 7369 6320 era's intrinsic │ │ │ -000cbb30: 7061 7261 6d65 7465 7273 2061 6e64 2061 parameters and a │ │ │ -000cbb40: 7265 2075 7365 6675 6c20 666f 7220 3344 re useful for 3D │ │ │ -000cbb50: 2072 6563 6f6e 7374 7275 6374 696f 6e20 reconstruction │ │ │ -000cbb60: 6f72 2065 7069 706f 6c61 7220 6765 6f6d or epipolar geom │ │ │ -000cbb70: 6574 7279 2e0a 2020 2020 3c2f 6c69 3e0a etry..
    • . │ │ │ -000cbb80: 2020 3c2f 756c 3e0a 0a20 203c 2f6c 693e
    ..
  • │ │ │ -000cbb90: 0a3c 2f75 6c3e 3c2f 6469 763e 0a3c 646c .
    .
    . │ │ │ -000cbbb0: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -000cbbc0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e73 /dt>.
    s │ │ │ -000cbbd0: 7263 3c2f 636f 6465 3e20 2d20 4f62 7365 rc - Obse │ │ │ -000cbbe0: 7276 6564 2070 6f69 6e74 2063 6f6f 7264 rved point coord │ │ │ -000cbbf0: 696e 6174 6573 2069 6e20 3c62 3e70 6978 inates in pix │ │ │ -000cbc00: 656c 2063 6f6f 7264 696e 6174 6573 3c2f el coordinates of the distor │ │ │ -000cbc20: 7465 6420 696d 6167 652c 2032 784e 2f4e ted image, 2xN/N │ │ │ -000cbc30: 7832 2031 2d63 6861 6e6e 656c 206f 7220 x2 1-channel or │ │ │ -000cbc40: 3178 4e2f 4e78 3120 322d 6368 616e 6e65 1xN/Nx1 2-channe │ │ │ -000cbc50: 6c20 2843 565f 3332 4643 3220 6f72 2043 l (CV_32FC2 or C │ │ │ -000cbc60: 565f 3634 4643 3229 2028 6f72 0a76 6563 V_64FC2) (or.vec │ │ │ -000cbc70: 746f 7226 6c74 3b50 6f69 6e74 3266 2667 tor<Point2f&g │ │ │ -000cbc80: 743b 2029 2e3c 2f64 643e 0a3c 6464 3e3c t; ).
    .
    < │ │ │ -000cbc90: 636f 6465 3e64 7374 3c2f 636f 6465 3e20 code>dst │ │ │ -000cbca0: 2d20 4f75 7470 7574 2069 6465 616c 2070 - Output ideal p │ │ │ -000cbcb0: 6f69 6e74 2063 6f6f 7264 696e 6174 6573 oint coordinates │ │ │ -000cbcc0: 2028 3178 4e2f 4e78 3120 322d 6368 616e (1xN/Nx1 2-chan │ │ │ -000cbcd0: 6e65 6c20 6f72 2076 6563 746f 7226 6c74 nel or vector< │ │ │ -000cbce0: 3b50 6f69 6e74 3266 2667 743b 2029 2061 ;Point2f> ) a │ │ │ -000cbcf0: 6674 6572 2075 6e64 6973 746f 7274 696f fter undistortio │ │ │ -000cbd00: 6e20 616e 6420 7265 7665 7273 6520 7065 n and reverse pe │ │ │ -000cbd10: 7273 7065 6374 6976 650a 7472 616e 7366 rspective.transf │ │ │ -000cbd20: 6f72 6d61 7469 6f6e 2e20 4966 206d 6174 ormation. If mat │ │ │ -000cbd30: 7269 7820 5020 6973 2069 6465 6e74 6974 rix P is identit │ │ │ -000cbd40: 7920 6f72 206f 6d69 7474 6564 2c20 6473 y or omitted, ds │ │ │ -000cbd50: 7420 7769 6c6c 2063 6f6e 7461 696e 206e t will contain n │ │ │ -000cbd60: 6f72 6d61 6c69 7a65 6420 706f 696e 7420 ormalized point │ │ │ -000cbd70: 636f 6f72 6469 6e61 7465 732e 3c2f 6464 coordinates.
    .
    came │ │ │ -000cbd90: 7261 4d61 7472 6978 3c2f 636f 6465 3e20 raMatrix │ │ │ -000cbda0: 2d20 4361 6d65 7261 206d 6174 7269 7820 - Camera matrix │ │ │ -000cbdb0: 5c28 5c76 6563 7468 7265 6574 6872 6565 \(\vecthreethree │ │ │ -000cbdc0: 7b66 5f78 7d7b 307d 7b63 5f78 7d7b 307d {f_x}{0}{c_x}{0} │ │ │ -000cbdd0: 7b66 5f79 7d7b 635f 797d 7b30 7d7b 307d {f_y}{c_y}{0}{0} │ │ │ -000cbde0: 7b31 7d5c 2920 2e3c 2f64 643e 0a3c 6464 {1}\) .
    .
    distCoeff │ │ │ -000cbe00: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ -000cbe10: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ -000cbe20: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ -000cbe30: 7473 0a5c 2828 6b5f 312c 206b 5f32 2c20 ts.\((k_1, k_2, │ │ │ -000cbe40: 705f 312c 2070 5f32 5b2c 206b 5f33 5b2c p_1, p_2[, k_3[, │ │ │ -000cbe50: 206b 5f34 2c20 6b5f 352c 206b 5f36 5b2c k_4, k_5, k_6[, │ │ │ -000cbe60: 2073 5f31 2c20 735f 322c 2073 5f33 2c20 s_1, s_2, s_3, │ │ │ -000cbe70: 735f 345b 2c20 5c74 6175 5f78 2c20 5c74 s_4[, \tau_x, \t │ │ │ -000cbe80: 6175 5f79 5d5d 5d5d 295c 290a 6f66 2034 au_y]]]])\).of 4 │ │ │ -000cbe90: 2c20 352c 2038 2c20 3132 206f 7220 3134 , 5, 8, 12 or 14 │ │ │ -000cbea0: 2065 6c65 6d65 6e74 732e 2049 6620 7468 elements. If th │ │ │ -000cbeb0: 6520 7665 6374 6f72 2069 7320 4e55 4c4c e vector is NULL │ │ │ -000cbec0: 2f65 6d70 7479 2c20 7468 6520 7a65 726f /empty, the zero │ │ │ -000cbed0: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ -000cbee0: 6669 6369 656e 7473 2061 7265 2061 7373 ficients are ass │ │ │ -000cbef0: 756d 6564 2e0a 2373 7465 7265 6f52 6563 umed..#stereoRec │ │ │ -000cbf00: 7469 6679 2063 616e 2062 6520 7061 7373 tify can be pass │ │ │ -000cbf10: 6564 2068 6572 652e 2049 6620 7468 6520 ed here. If the │ │ │ -000cbf20: 6d61 7472 6978 2069 7320 656d 7074 792c matrix is empty, │ │ │ -000cbf30: 2074 6865 2069 6465 6e74 6974 7920 7472 the identity tr │ │ │ -000cbf40: 616e 7366 6f72 6d61 7469 6f6e 2069 7320 ansformation is │ │ │ -000cbf50: 7573 6564 2e0a 2373 7465 7265 6f52 6563 used..#stereoRec │ │ │ -000cbf60: 7469 6679 2063 616e 2062 6520 7061 7373 tify can be pass │ │ │ -000cbf70: 6564 2068 6572 652e 2049 6620 7468 6520 ed here. If the │ │ │ -000cbf80: 6d61 7472 6978 2069 7320 656d 7074 792c matrix is empty, │ │ │ -000cbf90: 2074 6865 2069 6465 6e74 6974 7920 6e65 the identity ne │ │ │ -000cbfa0: 7720 6361 6d65 7261 206d 6174 7269 7820 w camera matrix │ │ │ -000cbfb0: 6973 2075 7365 6420 616e 6420 6f75 7470 is used and outp │ │ │ -000cbfc0: 7574 2077 696c 6c20 6265 2069 6e20 6e6f ut will be in no │ │ │ -000cbfd0: 726d 616c 697a 6564 2063 6f6f 7264 696e rmalized coordin │ │ │ -000cbfe0: 6174 6573 2e3c 2f64 643e 0a3c 2f64 6c3e ates.
    .
    │ │ │ -000cbff0: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • ..< │ │ │ -000cc0b0: 6833 3e75 6e64 6973 746f 7274 496d 6167 h3>undistortImag │ │ │ -000cc0c0: 6550 6f69 6e74 733c 2f68 333e 0a3c 6469 ePoints..public static │ │ │ -000cc130: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  void undistortImag │ │ │ -000cc190: 6550 6f69 6e74 733c 2f73 7061 6e3e 3c77 ePoints(Mat │ │ │ -000cc200: 266e 6273 703b 7372 632c 0a20 3c61 2068  src,. Mat& │ │ │ -000cc250: 6e62 7370 3b64 7374 2c0a 203c 6120 6872 nbsp;dst,. Mat&n │ │ │ -000cc2a0: 6273 703b 6361 6d65 7261 4d61 7472 6978 bsp;cameraMatrix │ │ │ -000cc2b0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000cc2f0: 6174 3c2f 613e 266e 6273 703b 6469 7374 at dist │ │ │ -000cc300: 436f 6566 6673 2c0a 203c 6120 6872 6566 Coeffs,. Te │ │ │ -000cc350: 726d 4372 6974 6572 6961 3c2f 613e 266e rmCriteria&n │ │ │ -000cc360: 6273 703b 6172 6731 293c 2f73 7061 6e3e bsp;arg1) │ │ │ -000cc370: 3c2f 6469 763e 0a3c 6469 7620 636c 6173 .
    Comput │ │ │ -000cc390: 6520 756e 6469 7374 6f72 7465 6420 696d e undistorted im │ │ │ -000cc3a0: 6167 6520 706f 696e 7473 2070 6f73 6974 age points posit │ │ │ -000cc3b0: 696f 6e3c 2f64 6976 3e0a 3c64 6c20 636c ion
    .
    .
    Parameters:
    .
    src< │ │ │ -000cc3f0: 2f63 6f64 653e 202d 204f 6273 6572 7665 /code> - Observe │ │ │ -000cc400: 6420 706f 696e 7473 2070 6f73 6974 696f d points positio │ │ │ -000cc410: 6e2c 2032 784e 2f4e 7832 2031 2d63 6861 n, 2xN/Nx2 1-cha │ │ │ -000cc420: 6e6e 656c 206f 7220 3178 4e2f 4e78 3120 nnel or 1xN/Nx1 │ │ │ -000cc430: 322d 6368 616e 6e65 6c20 2843 565f 3332 2-channel (CV_32 │ │ │ -000cc440: 4643 3220 6f72 2043 565f 3634 4643 3229 FC2 or CV_64FC2) │ │ │ -000cc450: 2028 6f72 2076 6563 746f 7226 6c74 3b50 (or vector<P │ │ │ -000cc460: 6f69 6e74 3266 2667 743b 2029 2e3c 2f64 oint2f> )..
    dst │ │ │ -000cc480: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ -000cc490: 2075 6e64 6973 746f 7274 6564 2070 6f69 undistorted poi │ │ │ -000cc4a0: 6e74 7320 706f 7369 7469 6f6e 2028 3178 nts position (1x │ │ │ -000cc4b0: 4e2f 4e78 3120 322d 6368 616e 6e65 6c20 N/Nx1 2-channel │ │ │ -000cc4c0: 6f72 2076 6563 746f 7226 6c74 3b50 6f69 or vector<Poi │ │ │ -000cc4d0: 6e74 3266 2667 743b 2029 2e3c 2f64 643e nt2f> ).
    │ │ │ -000cc4e0: 0a3c 6464 3e3c 636f 6465 3e63 616d 6572 .
    camer │ │ │ -000cc4f0: 614d 6174 7269 783c 2f63 6f64 653e 202d aMatrix - │ │ │ -000cc500: 2043 616d 6572 6120 6d61 7472 6978 205c Camera matrix \ │ │ │ -000cc510: 285c 7665 6374 6872 6565 7468 7265 657b (\vecthreethree{ │ │ │ -000cc520: 665f 787d 7b30 7d7b 635f 787d 7b30 7d7b f_x}{0}{c_x}{0}{ │ │ │ -000cc530: 665f 797d 7b63 5f79 7d7b 307d 7b30 7d7b f_y}{c_y}{0}{0}{ │ │ │ -000cc540: 317d 5c29 202e 3c2f 6464 3e0a 3c64 643e 1}\) .
    .
    │ │ │ -000cc550: 3c63 6f64 653e 6469 7374 436f 6566 6673 distCoeffs │ │ │ -000cc560: 3c2f 636f 6465 3e20 2d20 4469 7374 6f72 - Distor │ │ │ -000cc570: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ -000cc580: 733c 2f64 643e 0a3c 6464 3e3c 636f 6465 s
    .
    arg1 - a │ │ │ -000cc5a0: 7574 6f6d 6174 6963 616c 6c79 2067 656e utomatically gen │ │ │ -000cc5b0: 6572 6174 6564 3c2f 6464 3e0a 3c2f 646c erated
    .
    ...
  • .
  • .< │ │ │ -000cc5e0: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ -000cc5f0: 6574 6169 6c22 2069 643d 2275 6e64 6973 etail" id="undis │ │ │ -000cc600: 746f 7274 496d 6167 6550 6f69 6e74 7328 tortImagePoints( │ │ │ -000cc610: 6f72 672e 6f70 656e 6376 2e63 6f72 652e org.opencv.core. │ │ │ -000cc620: 4d61 742c 6f72 672e 6f70 656e 6376 2e63 Mat,org.opencv.c │ │ │ -000cc630: 6f72 652e 4d61 742c 6f72 672e 6f70 656e ore.Mat,org.open │ │ │ -000cc640: 6376 2e63 6f72 652e 4d61 742c 6f72 672e cv.core.Mat,org. │ │ │ -000cc650: 6f70 656e 6376 2e63 6f72 652e 4d61 7429 opencv.core.Mat) │ │ │ -000cc660: 223e 0a3c 6833 3e75 6e64 6973 746f 7274 ">.

    undistort │ │ │ -000cc670: 496d 6167 6550 6f69 6e74 733c 2f68 333e ImagePoints

    │ │ │ -000cc680: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ -000cc6a0: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ -000cc6c0: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ -000cc6d0: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ -000cc6e0: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ -000cc6f0: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;void< │ │ │ -000cc710: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> undistort │ │ │ -000cc740: 496d 6167 6550 6f69 6e74 733c 2f73 7061 ImagePoints │ │ │ -000cc770: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ -000cc7b0: 3c2f 613e 266e 6273 703b 7372 632c 0a20  src,. │ │ │ -000cc7c0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000cc800: 2f61 3e26 6e62 7370 3b64 7374 2c0a 203c /a> dst,. < │ │ │ -000cc810: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000cc820: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000cc830: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000cc840: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ -000cc860: 7472 6978 2c0a 203c 6120 6872 6566 3d22 trix,. Mat  │ │ │ -000cc8b0: 6469 7374 436f 6566 6673 293c 2f73 7061 distCoeffs)
    .
    Comp │ │ │ -000cc8e0: 7574 6520 756e 6469 7374 6f72 7465 6420 ute undistorted │ │ │ -000cc8f0: 696d 6167 6520 706f 696e 7473 2070 6f73 image points pos │ │ │ -000cc900: 6974 696f 6e3c 2f64 6976 3e0a 3c64 6c20 ition
    .
    .< │ │ │ -000cc920: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    sr │ │ │ -000cc940: 633c 2f63 6f64 653e 202d 204f 6273 6572 c - Obser │ │ │ -000cc950: 7665 6420 706f 696e 7473 2070 6f73 6974 ved points posit │ │ │ -000cc960: 696f 6e2c 2032 784e 2f4e 7832 2031 2d63 ion, 2xN/Nx2 1-c │ │ │ -000cc970: 6861 6e6e 656c 206f 7220 3178 4e2f 4e78 hannel or 1xN/Nx │ │ │ -000cc980: 3120 322d 6368 616e 6e65 6c20 2843 565f 1 2-channel (CV_ │ │ │ -000cc990: 3332 4643 3220 6f72 2043 565f 3634 4643 32FC2 or CV_64FC │ │ │ -000cc9a0: 3229 2028 6f72 2076 6563 746f 7226 6c74 2) (or vector< │ │ │ -000cc9b0: 3b50 6f69 6e74 3266 2667 743b 2029 2e3c ;Point2f> ).< │ │ │ -000cc9c0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -000cc9d0: 7374 3c2f 636f 6465 3e20 2d20 4f75 7470 st - Outp │ │ │ -000cc9e0: 7574 2075 6e64 6973 746f 7274 6564 2070 ut undistorted p │ │ │ -000cc9f0: 6f69 6e74 7320 706f 7369 7469 6f6e 2028 oints position ( │ │ │ -000cca00: 3178 4e2f 4e78 3120 322d 6368 616e 6e65 1xN/Nx1 2-channe │ │ │ -000cca10: 6c20 6f72 2076 6563 746f 7226 6c74 3b50 l or vector<P │ │ │ -000cca20: 6f69 6e74 3266 2667 743b 2029 2e3c 2f64 oint2f> )..
    cam │ │ │ -000cca40: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ -000cca50: 202d 2043 616d 6572 6120 6d61 7472 6978 - Camera matrix │ │ │ -000cca60: 205c 285c 7665 6374 6872 6565 7468 7265 \(\vecthreethre │ │ │ -000cca70: 657b 665f 787d 7b30 7d7b 635f 787d 7b30 e{f_x}{0}{c_x}{0 │ │ │ -000cca80: 7d7b 665f 797d 7b63 5f79 7d7b 307d 7b30 }{f_y}{c_y}{0}{0 │ │ │ -000cca90: 7d7b 317d 5c29 202e 3c2f 6464 3e0a 3c64 }{1}\) .
    .distCoef │ │ │ -000ccab0: 6673 3c2f 636f 6465 3e20 2d20 4469 7374 fs - Dist │ │ │ -000ccac0: 6f72 7469 6f6e 2063 6f65 6666 6963 6965 ortion coefficie │ │ │ -000ccad0: 6e74 733c 2f64 643e 0a3c 2f64 6c3e 0a3c nts.
    .< │ │ │ -000ccae0: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>. │ │ │ -000ccaf0: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    fisheye_ │ │ │ -000ccbd0: 7072 6f6a 6563 7450 6f69 6e74 733c 2f68 projectPoints.
    .
    public │ │ │ -000ccc40: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ -000ccc50: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;voi │ │ │ -000ccc70: 643c 2f73 7061 6e3e 266e 6273 703b 3c73 d fisheye │ │ │ -000ccca0: 5f70 726f 6a65 6374 506f 696e 7473 3c2f _projectPoints( │ │ │ -000ccd10: 4d61 743c 2f61 3e26 6e62 7370 3b6f 626a Mat obj │ │ │ -000ccd20: 6563 7450 6f69 6e74 732c 0a20 3c61 2068 ectPoints,. Mat& │ │ │ -000ccd70: 6e62 7370 3b69 6d61 6765 506f 696e 7473 nbsp;imagePoints │ │ │ -000ccd80: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000ccdc0: 6174 3c2f 613e 266e 6273 703b 7276 6563 at rvec │ │ │ -000ccdd0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000cce10: 6174 3c2f 613e 266e 6273 703b 7476 6563 at tvec │ │ │ -000cce20: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000cce60: 6174 3c2f 613e 266e 6273 703b 4b2c 0a20 at K,. │ │ │ -000cce70: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000cceb0: 2f61 3e26 6e62 7370 3b44 2c0a 2064 6f75 /a> D,. dou │ │ │ -000ccec0: 626c 6526 6e62 7370 3b61 6c70 6861 2c0a ble alpha,. │ │ │ -000cced0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000ccf10: 3c2f 613e 266e 6273 703b 6a61 636f 6269  jacobi │ │ │ -000ccf20: 616e 293c 2f73 7061 6e3e 3c2f 6469 763e an)
    │ │ │ -000ccf30: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..

  • .
  • ..

    fisheye_pr │ │ │ -000cd010: 6f6a 6563 7450 6f69 6e74 733c 2f68 333e ojectPoints

    │ │ │ -000cd020: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ -000cd040: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ -000cd060: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ -000cd070: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ -000cd080: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ -000cd090: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;void< │ │ │ -000cd0b0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> fisheye_p │ │ │ -000cd0e0: 726f 6a65 6374 506f 696e 7473 3c2f 7370 rojectPoints(Ma │ │ │ -000cd150: 743c 2f61 3e26 6e62 7370 3b6f 626a 6563 t objec │ │ │ -000cd160: 7450 6f69 6e74 732c 0a20 3c61 2068 7265 tPoints,. Mat&nb │ │ │ -000cd1b0: 7370 3b69 6d61 6765 506f 696e 7473 2c0a sp;imagePoints,. │ │ │ -000cd1c0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000cd200: 3c2f 613e 266e 6273 703b 7276 6563 2c0a  rvec,. │ │ │ -000cd210: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000cd250: 3c2f 613e 266e 6273 703b 7476 6563 2c0a  tvec,. │ │ │ -000cd260: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000cd2a0: 3c2f 613e 266e 6273 703b 4b2c 0a20 3c61  K,. Mat D,. doubl │ │ │ -000cd300: 6526 6e62 7370 3b61 6c70 6861 293c 2f73 e alpha)
    .
    ...
  • .
    .

    fisheye │ │ │ -000cd3f0: 5f70 726f 6a65 6374 506f 696e 7473 3c2f _projectPoints.
    .
    public │ │ │ -000cd460: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ -000cd470: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;vo │ │ │ -000cd490: 6964 3c2f 7370 616e 3e26 6e62 7370 3b3c id < │ │ │ -000cd4a0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ -000cd4b0: 656e 742d 6e61 6d65 223e 6669 7368 6579 ent-name">fishey │ │ │ -000cd4c0: 655f 7072 6f6a 6563 7450 6f69 6e74 733c e_projectPoints< │ │ │ -000cd4d0: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat ob │ │ │ -000cd540: 6a65 6374 506f 696e 7473 2c0a 203c 6120 jectPoints,. Mat │ │ │ -000cd590: 266e 6273 703b 696d 6167 6550 6f69 6e74  imagePoint │ │ │ -000cd5a0: 732c 0a20 3c61 2068 7265 663d 222e 2e2f s,. │ │ │ -000cd5e0: 4d61 743c 2f61 3e26 6e62 7370 3b72 7665 Mat rve │ │ │ -000cd5f0: 632c 0a20 3c61 2068 7265 663d 222e 2e2f c,. │ │ │ -000cd630: 4d61 743c 2f61 3e26 6e62 7370 3b74 7665 Mat tve │ │ │ -000cd640: 632c 0a20 3c61 2068 7265 663d 222e 2e2f c,. │ │ │ -000cd680: 4d61 743c 2f61 3e26 6e62 7370 3b4b 2c0a Mat K,. │ │ │ -000cd690: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000cd6d0: 3c2f 613e 266e 6273 703b 4429 3c2f 7370  D)
    .
    │ │ │ -000cd6f0: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .

    .
  • .
  • .
    .

    fisheye_d │ │ │ -000cd7a0: 6973 746f 7274 506f 696e 7473 3c2f 6833 istortPoints

    .
    .
    │ │ │ -000cd7f0: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -000cd810: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -000cd820: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;void │ │ │ -000cd840: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  fisheye_ │ │ │ -000cd870: 6469 7374 6f72 7450 6f69 6e74 733c 2f73 distortPoints(M │ │ │ -000cd8e0: 6174 3c2f 613e 266e 6273 703b 756e 6469 at undi │ │ │ -000cd8f0: 7374 6f72 7465 642c 0a20 3c61 2068 7265 storted,. Mat&nb │ │ │ -000cd940: 7370 3b64 6973 746f 7274 6564 2c0a 203c sp;distorted,. < │ │ │ -000cd950: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000cd960: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000cd970: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000cd980: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat K,. Mat& │ │ │ -000cd9e0: 6e62 7370 3b44 2c0a 2064 6f75 626c 6526 nbsp;D,. double& │ │ │ -000cd9f0: 6e62 7370 3b61 6c70 6861 293c 2f73 7061 nbsp;alpha)
    .
    Dist │ │ │ -000cda20: 6f72 7473 2032 4420 706f 696e 7473 2075 orts 2D points u │ │ │ -000cda30: 7369 6e67 2066 6973 6865 7965 206d 6f64 sing fisheye mod │ │ │ -000cda40: 656c 2e3c 2f64 6976 3e0a 3c64 6c20 636c el.
    .
    .
    Parameters:
    .
    undi │ │ │ -000cda80: 7374 6f72 7465 643c 2f63 6f64 653e 202d storted - │ │ │ -000cda90: 2041 7272 6179 206f 6620 6f62 6a65 6374 Array of object │ │ │ -000cdaa0: 2070 6f69 6e74 732c 2031 784e 2f4e 7831 points, 1xN/Nx1 │ │ │ -000cdab0: 2032 2d63 6861 6e6e 656c 2028 6f72 2076 2-channel (or v │ │ │ -000cdac0: 6563 746f 7226 6c74 3b50 6f69 6e74 3266 ector<Point2f │ │ │ -000cdad0: 2667 743b 2029 2c20 7768 6572 6520 4e20 > ), where N │ │ │ -000cdae0: 6973 0a74 6865 206e 756d 6265 7220 6f66 is.the number of │ │ │ -000cdaf0: 2070 6f69 6e74 7320 696e 2074 6865 2076 points in the v │ │ │ -000cdb00: 6965 772e 3c2f 6464 3e0a 3c64 643e 3c63 iew.
    .
    distorted - Output ar │ │ │ -000cdb30: 7261 7920 6f66 2069 6d61 6765 2070 6f69 ray of image poi │ │ │ -000cdb40: 6e74 732c 2031 784e 2f4e 7831 2032 2d63 nts, 1xN/Nx1 2-c │ │ │ -000cdb50: 6861 6e6e 656c 2c20 6f72 2076 6563 746f hannel, or vecto │ │ │ -000cdb60: 7226 6c74 3b50 6f69 6e74 3266 2667 743b r<Point2f> │ │ │ -000cdb70: 202e 0a0a 4e6f 7465 2074 6861 7420 7468 ...Note that th │ │ │ -000cdb80: 6520 6675 6e63 7469 6f6e 2061 7373 756d e function assum │ │ │ -000cdb90: 6573 2074 6865 2063 616d 6572 6120 696e es the camera in │ │ │ -000cdba0: 7472 696e 7369 6320 6d61 7472 6978 206f trinsic matrix o │ │ │ -000cdbb0: 6620 7468 6520 756e 6469 7374 6f72 7465 f the undistorte │ │ │ -000cdbc0: 6420 706f 696e 7473 2074 6f20 6265 2069 d points to be i │ │ │ -000cdbd0: 6465 6e74 6974 792e 0a54 6869 7320 6d65 dentity..This me │ │ │ -000cdbe0: 616e 7320 6966 2079 6f75 2077 616e 7420 ans if you want │ │ │ -000cdbf0: 746f 2064 6973 746f 7274 2069 6d61 6765 to distort image │ │ │ -000cdc00: 2070 6f69 6e74 7320 796f 7520 6861 7665 points you have │ │ │ -000cdc10: 2074 6f20 6d75 6c74 6970 6c79 2074 6865 to multiply the │ │ │ -000cdc20: 6d20 7769 7468 205c 284b 5e7b 2d31 7d5c m with \(K^{-1}\ │ │ │ -000cdc30: 2920 6f72 0a75 7365 2061 6e6f 7468 6572 ) or.use another │ │ │ -000cdc40: 2066 756e 6374 696f 6e20 6f76 6572 6c6f function overlo │ │ │ -000cdc50: 6164 2e3c 2f64 643e 0a3c 6464 3e3c 636f ad.
    .
    K - Ca │ │ │ -000cdc70: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ -000cdc80: 6174 7269 7820 5c28 6361 6d65 7261 6d61 atrix \(camerama │ │ │ -000cdc90: 7472 6978 7b4b 7d5c 292e 3c2f 6464 3e0a trix{K}\).
    . │ │ │ -000cdca0: 3c64 643e 3c63 6f64 653e 443c 2f63 6f64
    D - Input vecto │ │ │ -000cdcc0: 7220 6f66 2064 6973 746f 7274 696f 6e20 r of distortion │ │ │ -000cdcd0: 636f 6566 6669 6369 656e 7473 205c 285c coefficients \(\ │ │ │ -000cdce0: 6469 7374 636f 6566 6673 6669 7368 6579 distcoeffsfishey │ │ │ -000cdcf0: 655c 292e 3c2f 6464 3e0a 3c64 643e 3c63 e\).
    .
    alpha │ │ │ -000cdd10: 202d 2054 6865 2073 6b65 7720 636f 6566 - The skew coef │ │ │ -000cdd20: 6669 6369 656e 742e 3c2f 6464 3e0a 3c2f ficient.
    ..
    ..
  • .
  • │ │ │ -000cdd50: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    fishey │ │ │ -000cdde0: 655f 6469 7374 6f72 7450 6f69 6e74 733c e_distortPoints< │ │ │ -000cddf0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -000cde50: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -000cde60: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;v │ │ │ -000cde80: 6f69 643c 2f73 7061 6e3e 266e 6273 703b oid  │ │ │ -000cde90: 3c73 7061 6e20 636c 6173 733d 2265 6c65 fishe │ │ │ -000cdeb0: 7965 5f64 6973 746f 7274 506f 696e 7473 ye_distortPoints │ │ │ -000cdec0: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat u │ │ │ -000cdf30: 6e64 6973 746f 7274 6564 2c0a 203c 6120 ndistorted,. Mat │ │ │ -000cdf80: 266e 6273 703b 6469 7374 6f72 7465 642c  distorted, │ │ │ -000cdf90: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000cdfd0: 743c 2f61 3e26 6e62 7370 3b4b 2c0a 203c t K,. < │ │ │ -000cdfe0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000cdff0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000ce000: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000ce010: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat D)
    .
    Disto │ │ │ -000ce050: 7274 7320 3244 2070 6f69 6e74 7320 7573 rts 2D points us │ │ │ -000ce060: 696e 6720 6669 7368 6579 6520 6d6f 6465 ing fisheye mode │ │ │ -000ce070: 6c2e 3c2f 6469 763e 0a3c 646c 2063 6c61 l.
    .
    .
    │ │ │ -000ce090: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ -000ce0a0: 0a3c 6464 3e3c 636f 6465 3e75 6e64 6973 .
    undis │ │ │ -000ce0b0: 746f 7274 6564 3c2f 636f 6465 3e20 2d20 torted - │ │ │ -000ce0c0: 4172 7261 7920 6f66 206f 626a 6563 7420 Array of object │ │ │ -000ce0d0: 706f 696e 7473 2c20 3178 4e2f 4e78 3120 points, 1xN/Nx1 │ │ │ -000ce0e0: 322d 6368 616e 6e65 6c20 286f 7220 7665 2-channel (or ve │ │ │ -000ce0f0: 6374 6f72 266c 743b 506f 696e 7432 6626 ctor<Point2f& │ │ │ -000ce100: 6774 3b20 292c 2077 6865 7265 204e 2069 gt; ), where N i │ │ │ -000ce110: 730a 7468 6520 6e75 6d62 6572 206f 6620 s.the number of │ │ │ -000ce120: 706f 696e 7473 2069 6e20 7468 6520 7669 points in the vi │ │ │ -000ce130: 6577 2e3c 2f64 643e 0a3c 6464 3e3c 636f ew.
    .
    distorted - Output arr │ │ │ -000ce160: 6179 206f 6620 696d 6167 6520 706f 696e ay of image poin │ │ │ -000ce170: 7473 2c20 3178 4e2f 4e78 3120 322d 6368 ts, 1xN/Nx1 2-ch │ │ │ -000ce180: 616e 6e65 6c2c 206f 7220 7665 6374 6f72 annel, or vector │ │ │ -000ce190: 266c 743b 506f 696e 7432 6626 6774 3b20 <Point2f> │ │ │ -000ce1a0: 2e0a 0a4e 6f74 6520 7468 6174 2074 6865 ...Note that the │ │ │ -000ce1b0: 2066 756e 6374 696f 6e20 6173 7375 6d65 function assume │ │ │ -000ce1c0: 7320 7468 6520 6361 6d65 7261 2069 6e74 s the camera int │ │ │ -000ce1d0: 7269 6e73 6963 206d 6174 7269 7820 6f66 rinsic matrix of │ │ │ -000ce1e0: 2074 6865 2075 6e64 6973 746f 7274 6564 the undistorted │ │ │ -000ce1f0: 2070 6f69 6e74 7320 746f 2062 6520 6964 points to be id │ │ │ -000ce200: 656e 7469 7479 2e0a 5468 6973 206d 6561 entity..This mea │ │ │ -000ce210: 6e73 2069 6620 796f 7520 7761 6e74 2074 ns if you want t │ │ │ -000ce220: 6f20 6469 7374 6f72 7420 696d 6167 6520 o distort image │ │ │ -000ce230: 706f 696e 7473 2079 6f75 2068 6176 6520 points you have │ │ │ -000ce240: 746f 206d 756c 7469 706c 7920 7468 656d to multiply them │ │ │ -000ce250: 2077 6974 6820 5c28 4b5e 7b2d 317d 5c29 with \(K^{-1}\) │ │ │ -000ce260: 206f 720a 7573 6520 616e 6f74 6865 7220 or.use another │ │ │ -000ce270: 6675 6e63 7469 6f6e 206f 7665 726c 6f61 function overloa │ │ │ -000ce280: 642e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 d.
    .
    K - Cam │ │ │ -000ce2a0: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ -000ce2b0: 7472 6978 205c 2863 616d 6572 616d 6174 trix \(cameramat │ │ │ -000ce2c0: 7269 787b 4b7d 5c29 2e3c 2f64 643e 0a3c rix{K}\).
    .< │ │ │ -000ce2d0: 6464 3e3c 636f 6465 3e44 3c2f 636f 6465 dd>D - Input vector │ │ │ -000ce2f0: 206f 6620 6469 7374 6f72 7469 6f6e 2063 of distortion c │ │ │ -000ce300: 6f65 6666 6963 6965 6e74 7320 5c28 5c64 oefficients \(\d │ │ │ -000ce310: 6973 7463 6f65 6666 7366 6973 6865 7965 istcoeffsfisheye │ │ │ -000ce320: 5c29 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c \)..
    .< │ │ │ -000ce330: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.

    │ │ │ -000ce340: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    │ │ │ -000ce3f0: 6669 7368 6579 655f 6469 7374 6f72 7450 fisheye_distortP │ │ │ -000ce400: 6f69 6e74 733c 2f68 333e 0a3c 6469 7620 oints

    .
    .
    public static void │ │ │ -000ce4a0: 266e 6273 703b 3c73 7061 6e20 636c 6173  fisheye_distort │ │ │ -000ce4d0: 506f 696e 7473 3c2f 7370 616e 3e3c 7762 Points(Mat& │ │ │ -000ce540: 6e62 7370 3b75 6e64 6973 746f 7274 6564 nbsp;undistorted │ │ │ -000ce550: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000ce590: 6174 3c2f 613e 266e 6273 703b 6469 7374 at dist │ │ │ -000ce5a0: 6f72 7465 642c 0a20 3c61 2068 7265 663d orted,. Mat  │ │ │ -000ce5f0: 3b4b 756e 6469 7374 6f72 7465 642c 0a20 ;Kundistorted,. │ │ │ -000ce600: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000ce640: 2f61 3e26 6e62 7370 3b4b 2c0a 203c 6120 /a> K,. Mat │ │ │ -000ce690: 266e 6273 703b 442c 0a20 646f 7562 6c65  D,. double │ │ │ -000ce6a0: 266e 6273 703b 616c 7068 6129 3c2f 7370  alpha)
    .
    Ove │ │ │ -000ce6d0: 726c 6f61 6420 6f66 2064 6973 746f 7274 rload of distort │ │ │ -000ce6e0: 506f 696e 7473 2066 756e 6374 696f 6e20 Points function │ │ │ -000ce6f0: 746f 2068 616e 646c 6520 6361 7365 7320 to handle cases │ │ │ -000ce700: 7768 656e 2075 6e64 6973 746f 7274 6564 when undistorted │ │ │ -000ce710: 2070 6f69 6e74 7320 6172 6520 676f 7420 points are got │ │ │ -000ce720: 7769 7468 206e 6f6e 2d69 6465 6e74 6974 with non-identit │ │ │ -000ce730: 790a 6361 6d65 7261 206d 6174 7269 782c y.camera matrix, │ │ │ -000ce740: 2065 2e67 2e20 6f75 7470 7574 206f 6620 e.g. output of │ │ │ -000ce750: 2365 7374 696d 6174 654e 6577 4361 6d65 #estimateNewCame │ │ │ -000ce760: 7261 4d61 7472 6978 466f 7255 6e64 6973 raMatrixForUndis │ │ │ -000ce770: 746f 7274 5265 6374 6966 792e 3c2f 6469 tortRectify..
    .
    Parame │ │ │ -000ce7a0: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ -000ce7b0: 636f 6465 3e75 6e64 6973 746f 7274 6564 code>undistorted │ │ │ -000ce7c0: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ -000ce7d0: 6f66 206f 626a 6563 7420 706f 696e 7473 of object points │ │ │ -000ce7e0: 2c20 3178 4e2f 4e78 3120 322d 6368 616e , 1xN/Nx1 2-chan │ │ │ -000ce7f0: 6e65 6c20 286f 7220 7665 6374 6f72 266c nel (or vector&l │ │ │ -000ce800: 743b 506f 696e 7432 6626 6774 3b20 292c t;Point2f> ), │ │ │ -000ce810: 2077 6865 7265 204e 2069 730a 7468 6520 where N is.the │ │ │ -000ce820: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ -000ce830: 2069 6e20 7468 6520 7669 6577 2e3c 2f64 in the view..
    dis │ │ │ -000ce850: 746f 7274 6564 3c2f 636f 6465 3e20 2d20 torted - │ │ │ -000ce860: 4f75 7470 7574 2061 7272 6179 206f 6620 Output array of │ │ │ -000ce870: 696d 6167 6520 706f 696e 7473 2c20 3178 image points, 1x │ │ │ -000ce880: 4e2f 4e78 3120 322d 6368 616e 6e65 6c2c N/Nx1 2-channel, │ │ │ -000ce890: 206f 7220 7665 6374 6f72 266c 743b 506f or vector<Po │ │ │ -000ce8a0: 696e 7432 6626 6774 3b20 2e0a 5345 453a int2f> ..SEE: │ │ │ -000ce8b0: 2065 7374 696d 6174 654e 6577 4361 6d65 estimateNewCame │ │ │ -000ce8c0: 7261 4d61 7472 6978 466f 7255 6e64 6973 raMatrixForUndis │ │ │ -000ce8d0: 746f 7274 5265 6374 6966 793c 2f64 643e tortRectify
    │ │ │ -000ce8e0: 0a3c 6464 3e3c 636f 6465 3e4b 756e 6469 .
    Kundi │ │ │ -000ce8f0: 7374 6f72 7465 643c 2f63 6f64 653e 202d storted - │ │ │ -000ce900: 2043 616d 6572 6120 696e 7472 696e 7369 Camera intrinsi │ │ │ -000ce910: 6320 6d61 7472 6978 2075 7365 6420 6173 c matrix used as │ │ │ -000ce920: 206e 6577 2063 616d 6572 6120 6d61 7472 new camera matr │ │ │ -000ce930: 6978 2066 6f72 2075 6e64 6973 746f 7274 ix for undistort │ │ │ -000ce940: 696f 6e2e 3c2f 6464 3e0a 3c64 643e 3c63 ion.
    .
    K - C │ │ │ -000ce960: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ -000ce970: 6d61 7472 6978 205c 2863 616d 6572 616d matrix \(cameram │ │ │ -000ce980: 6174 7269 787b 4b7d 5c29 2e3c 2f64 643e atrix{K}\).
    │ │ │ -000ce990: 0a3c 6464 3e3c 636f 6465 3e44 3c2f 636f .
    D - Input vect │ │ │ -000ce9b0: 6f72 206f 6620 6469 7374 6f72 7469 6f6e or of distortion │ │ │ -000ce9c0: 2063 6f65 6666 6963 6965 6e74 7320 5c28 coefficients \( │ │ │ -000ce9d0: 5c64 6973 7463 6f65 6666 7366 6973 6865 \distcoeffsfishe │ │ │ -000ce9e0: 7965 5c29 2e3c 2f64 643e 0a3c 6464 3e3c ye\).
    .
    < │ │ │ -000ce9f0: 636f 6465 3e61 6c70 6861 3c2f 636f 6465 code>alpha - The skew coe │ │ │ -000cea10: 6666 6963 6965 6e74 2e3c 2f64 643e 0a3c fficient.
    .< │ │ │ -000cea20: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ..
  • .
  • .
    .

    f │ │ │ -000ceae0: 6973 6865 7965 5f64 6973 746f 7274 506f isheye_distortPo │ │ │ -000ceaf0: 696e 7473 3c2f 6833 3e0a 3c64 6976 2063 ints

    .
    .
    │ │ │ -000ceb50: 7075 626c 6963 2073 7461 7469 633c 2f73 public static void& │ │ │ -000ceb90: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -000cebb0: 6669 7368 6579 655f 6469 7374 6f72 7450 fisheye_distortP │ │ │ -000cebc0: 6f69 6e74 733c 2f73 7061 6e3e 3c77 6272 oints(Mat&n │ │ │ -000cec30: 6273 703b 756e 6469 7374 6f72 7465 642c bsp;undistorted, │ │ │ -000cec40: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000cec80: 743c 2f61 3e26 6e62 7370 3b64 6973 746f t disto │ │ │ -000cec90: 7274 6564 2c0a 203c 6120 6872 6566 3d22 rted,. Mat  │ │ │ -000cece0: 4b75 6e64 6973 746f 7274 6564 2c0a 203c Kundistorted,. < │ │ │ -000cecf0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000ced00: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000ced10: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000ced20: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat K,. Mat& │ │ │ -000ced80: 6e62 7370 3b44 293c 2f73 7061 6e3e 3c2f nbsp;D).
    Overload │ │ │ -000cedb0: 206f 6620 6469 7374 6f72 7450 6f69 6e74 of distortPoint │ │ │ -000cedc0: 7320 6675 6e63 7469 6f6e 2074 6f20 6861 s function to ha │ │ │ -000cedd0: 6e64 6c65 2063 6173 6573 2077 6865 6e20 ndle cases when │ │ │ -000cede0: 756e 6469 7374 6f72 7465 6420 706f 696e undistorted poin │ │ │ -000cedf0: 7473 2061 7265 2067 6f74 2077 6974 6820 ts are got with │ │ │ -000cee00: 6e6f 6e2d 6964 656e 7469 7479 0a63 616d non-identity.cam │ │ │ -000cee10: 6572 6120 6d61 7472 6978 2c20 652e 672e era matrix, e.g. │ │ │ -000cee20: 206f 7574 7075 7420 6f66 2023 6573 7469 output of #esti │ │ │ -000cee30: 6d61 7465 4e65 7743 616d 6572 614d 6174 mateNewCameraMat │ │ │ -000cee40: 7269 7846 6f72 556e 6469 7374 6f72 7452 rixForUndistortR │ │ │ -000cee50: 6563 7469 6679 2e3c 2f64 6976 3e0a 3c64 ectify.
    . │ │ │ -000cee70: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ -000cee80: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000cee90: 756e 6469 7374 6f72 7465 643c 2f63 6f64 undistorted - Array of ob │ │ │ -000ceeb0: 6a65 6374 2070 6f69 6e74 732c 2031 784e ject points, 1xN │ │ │ -000ceec0: 2f4e 7831 2032 2d63 6861 6e6e 656c 2028 /Nx1 2-channel ( │ │ │ -000ceed0: 6f72 2076 6563 746f 7226 6c74 3b50 6f69 or vector<Poi │ │ │ -000ceee0: 6e74 3266 2667 743b 2029 2c20 7768 6572 nt2f> ), wher │ │ │ -000ceef0: 6520 4e20 6973 0a74 6865 206e 756d 6265 e N is.the numbe │ │ │ -000cef00: 7220 6f66 2070 6f69 6e74 7320 696e 2074 r of points in t │ │ │ -000cef10: 6865 2076 6965 772e 3c2f 6464 3e0a 3c64 he view.
    .distorte │ │ │ -000cef30: 643c 2f63 6f64 653e 202d 204f 7574 7075 d - Outpu │ │ │ -000cef40: 7420 6172 7261 7920 6f66 2069 6d61 6765 t array of image │ │ │ -000cef50: 2070 6f69 6e74 732c 2031 784e 2f4e 7831 points, 1xN/Nx1 │ │ │ -000cef60: 2032 2d63 6861 6e6e 656c 2c20 6f72 2076 2-channel, or v │ │ │ -000cef70: 6563 746f 7226 6c74 3b50 6f69 6e74 3266 ector<Point2f │ │ │ -000cef80: 2667 743b 202e 0a53 4545 3a20 6573 7469 > ..SEE: esti │ │ │ -000cef90: 6d61 7465 4e65 7743 616d 6572 614d 6174 mateNewCameraMat │ │ │ -000cefa0: 7269 7846 6f72 556e 6469 7374 6f72 7452 rixForUndistortR │ │ │ -000cefb0: 6563 7469 6679 3c2f 6464 3e0a 3c64 643e ectify.
    │ │ │ -000cefc0: 3c63 6f64 653e 4b75 6e64 6973 746f 7274 Kundistort │ │ │ -000cefd0: 6564 3c2f 636f 6465 3e20 2d20 4361 6d65 ed - Came │ │ │ -000cefe0: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ -000ceff0: 7269 7820 7573 6564 2061 7320 6e65 7720 rix used as new │ │ │ -000cf000: 6361 6d65 7261 206d 6174 7269 7820 666f camera matrix fo │ │ │ -000cf010: 7220 756e 6469 7374 6f72 7469 6f6e 2e3c r undistortion.< │ │ │ -000cf020: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e4b /dd>.
    K │ │ │ -000cf030: 3c2f 636f 6465 3e20 2d20 4361 6d65 7261 - Camera │ │ │ -000cf040: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ -000cf050: 7820 5c28 6361 6d65 7261 6d61 7472 6978 x \(cameramatrix │ │ │ -000cf060: 7b4b 7d5c 292e 3c2f 6464 3e0a 3c64 643e {K}\).
    .
    │ │ │ -000cf070: 3c63 6f64 653e 443c 2f63 6f64 653e 202d D - │ │ │ -000cf080: 2049 6e70 7574 2076 6563 746f 7220 6f66 Input vector of │ │ │ -000cf090: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ -000cf0a0: 6669 6369 656e 7473 205c 285c 6469 7374 ficients \(\dist │ │ │ -000cf0b0: 636f 6566 6673 6669 7368 6579 655c 292e coeffsfisheye\). │ │ │ -000cf0c0: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    ...
    ..
  • .

    fisheye_u │ │ │ -000d00e0: 6e64 6973 746f 7274 506f 696e 7473 3c2f ndistortPoints.
    .
    public │ │ │ -000d0150: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ -000d0160: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;vo │ │ │ -000d0180: 6964 3c2f 7370 616e 3e26 6e62 7370 3b3c id < │ │ │ -000d0190: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ -000d01a0: 656e 742d 6e61 6d65 223e 6669 7368 6579 ent-name">fishey │ │ │ -000d01b0: 655f 756e 6469 7374 6f72 7450 6f69 6e74 e_undistortPoint │ │ │ -000d01c0: 733c 2f73 7061 6e3e 3c77 6272 3e3c 7370 s(Mat  │ │ │ -000d0230: 6469 7374 6f72 7465 642c 0a20 3c61 2068 distorted,. Mat& │ │ │ -000d0280: 6e62 7370 3b75 6e64 6973 746f 7274 6564 nbsp;undistorted │ │ │ -000d0290: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000d02d0: 6174 3c2f 613e 266e 6273 703b 4b2c 0a20 at K,. │ │ │ -000d02e0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000d0320: 2f61 3e26 6e62 7370 3b44 2c0a 203c 6120 /a> D,. Mat │ │ │ -000d0370: 266e 6273 703b 522c 0a20 3c61 2068 7265  R,. Mat&nb │ │ │ -000d03c0: 7370 3b50 293c 2f73 7061 6e3e 3c2f 6469 sp;P).
    Undistorts │ │ │ -000d03f0: 2032 4420 706f 696e 7473 2075 7369 6e67 2D points using │ │ │ -000d0400: 2066 6973 6865 7965 2063 616d 6572 6120 fisheye camera │ │ │ -000d0410: 6d6f 6465 6c0a 0a54 6869 7320 6675 6e63 model..This func │ │ │ -000d0420: 7469 6f6e 2070 6572 666f 726d 7320 756e tion performs un │ │ │ -000d0430: 6469 7374 6f72 7469 6f6e 2066 6f72 2066 distortion for f │ │ │ -000d0440: 6973 6865 7965 2063 616d 6572 6120 6d6f isheye camera mo │ │ │ -000d0450: 6465 6c73 2c20 7768 6963 6820 7573 6520 dels, which use │ │ │ -000d0460: 6120 6469 6666 6572 656e 7420 6469 7374 a different dist │ │ │ -000d0470: 6f72 7469 6f6e 206d 6f64 656c 0a63 6f6d ortion model.com │ │ │ -000d0480: 7061 7265 6420 746f 2074 6865 2073 7461 pared to the sta │ │ │ -000d0490: 6e64 6172 6420 7069 6e68 6f6c 6520 6361 ndard pinhole ca │ │ │ -000d04a0: 6d65 7261 206d 6f64 656c 2075 7365 6420 mera model used │ │ │ -000d04b0: 6279 2023 756e 6469 7374 6f72 7450 6f69 by #undistortPoi │ │ │ -000d04c0: 6e74 732e 2054 6865 2066 6973 6865 7965 nts. The fisheye │ │ │ -000d04d0: 206d 6f64 656c 2069 7320 7375 6974 6162 model is suitab │ │ │ -000d04e0: 6c65 0a66 6f72 2077 6964 652d 616e 676c le.for wide-angl │ │ │ -000d04f0: 6520 6361 6d65 7261 732e 0a0a 5468 6520 e cameras...The │ │ │ -000d0500: 6675 6e63 7469 6f6e 2074 7261 6e73 666f function transfo │ │ │ -000d0510: 726d 7320 706f 696e 7473 2066 726f 6d20 rms points from │ │ │ -000d0520: 7468 6520 6469 7374 6f72 7465 6420 6669 the distorted fi │ │ │ -000d0530: 7368 6579 6520 696d 6167 6520 746f 2075 sheye image to u │ │ │ -000d0540: 6e64 6973 746f 7274 6564 2063 6f6f 7264 ndistorted coord │ │ │ -000d0550: 696e 6174 6573 2c20 6f70 7469 6f6e 616c inates, optional │ │ │ -000d0560: 6c79 0a61 7070 6c79 696e 6720 6120 7265 ly.applying a re │ │ │ -000d0570: 6374 6966 6963 6174 696f 6e20 7472 616e ctification tran │ │ │ -000d0580: 7366 6f72 6d61 7469 6f6e 2028 5229 2061 sformation (R) a │ │ │ -000d0590: 6e64 2070 726f 6a65 6374 696e 6720 746f nd projecting to │ │ │ -000d05a0: 2061 206e 6577 2069 6d61 6765 2070 6c61 a new image pla │ │ │ -000d05b0: 6e65 2028 5029 2e0a 0a3c 623e 4e6f 7465 ne (P)...Note │ │ │ -000d05c0: 3a3c 2f62 3e20 3c62 3e43 6f6f 7264 696e : Coordin │ │ │ -000d05d0: 6174 6520 5379 7374 656d 733a 3c2f 623e ate Systems: │ │ │ -000d05e0: 0a3c 756c 3e0a 2020 3c6c 693e 0a20 3c62 .
      .
    • . Input (di │ │ │ -000d0600: 7374 6f72 7465 643c 2f63 6f64 653e 293c storted)< │ │ │ -000d0610: 2f62 3e3a 2050 6f69 6e74 7320 6172 6520 /b>: Points are │ │ │ -000d0620: 6578 7065 6374 6564 2069 6e20 3c62 3e70 expected in p │ │ │ -000d0630: 6978 656c 2063 6f6f 7264 696e 6174 6573 ixel coordinates │ │ │ -000d0640: 3c2f 623e 206f 6620 7468 6520 6469 7374 of the dist │ │ │ -000d0650: 6f72 7465 6420 6669 7368 6579 6520 696d orted fisheye im │ │ │ -000d0660: 6167 652c 0a20 2020 2069 2e65 2e2c 2063 age,. i.e., c │ │ │ -000d0670: 6f6f 7264 696e 6174 6573 206d 6561 7375 oordinates measu │ │ │ -000d0680: 7265 6420 696e 2070 6978 656c 7320 6672 red in pixels fr │ │ │ -000d0690: 6f6d 2074 6865 2074 6f70 2d6c 6566 7420 om the top-left │ │ │ -000d06a0: 636f 726e 6572 206f 6620 7468 6520 696d corner of the im │ │ │ -000d06b0: 6167 652e 0a20 203c 2f6c 693e 0a20 203c age..
    • . < │ │ │ -000d06c0: 6c69 3e0a 203c 623e 4f75 7470 7574 2028 li>. Output ( │ │ │ -000d06d0: 3c63 6f64 653e 756e 6469 7374 6f72 7465 undistorte │ │ │ -000d06e0: 643c 2f63 6f64 653e 293c 2f62 3e3a 2054 d): T │ │ │ -000d06f0: 6865 2063 6f6f 7264 696e 6174 6520 7379 he coordinate sy │ │ │ -000d0700: 7374 656d 2064 6570 656e 6473 206f 6e20 stem depends on │ │ │ -000d0710: 7061 7261 6d65 7465 7220 3c63 6f64 653e parameter │ │ │ -000d0720: 503c 2f63 6f64 653e 3a0a 2020 3c75 6c3e P:.
        │ │ │ -000d0730: 0a20 2020 203c 6c69 3e0a 2020 2020 2049 .
      • . I │ │ │ -000d0740: 6620 3c63 6f64 653e 503c 2f63 6f64 653e f P │ │ │ -000d0750: 2069 7320 7072 6f76 6964 6564 2028 6e6f is provided (no │ │ │ -000d0760: 7420 656d 7074 7929 3a20 4f75 7470 7574 t empty): Output │ │ │ -000d0770: 2070 6f69 6e74 7320 6172 6520 696e 203c points are in < │ │ │ -000d0780: 623e 7069 7865 6c20 636f 6f72 6469 6e61 b>pixel coordina │ │ │ -000d0790: 7465 733c 2f62 3e20 6f66 2074 6865 2072 tes of the r │ │ │ -000d07a0: 6563 7469 6669 6564 2f75 6e64 6973 746f ectified/undisto │ │ │ -000d07b0: 7274 6564 0a20 2020 2069 6d61 6765 2070 rted. image p │ │ │ -000d07c0: 6c61 6e65 2c20 7573 696e 6720 7468 6520 lane, using the │ │ │ -000d07d0: 6361 6d65 7261 206d 6174 7269 7820 3c63 camera matrix P.. │ │ │ -000d07f0: 2020 3c2f 6c69 3e0a 2020 2020 3c6c 693e
      • .
      • │ │ │ -000d0800: 0a20 2020 2020 4966 203c 636f 6465 3e50 . If P │ │ │ -000d0810: 3c2f 636f 6465 3e20 6973 2065 6d70 7479 is empty │ │ │ -000d0820: 206f 7220 6964 656e 7469 7479 3a20 4f75 or identity: Ou │ │ │ -000d0830: 7470 7574 2070 6f69 6e74 7320 6172 6520 tput points are │ │ │ -000d0840: 696e 203c 623e 6e6f 726d 616c 697a 6564 in normalized │ │ │ -000d0850: 2063 616d 6572 6120 636f 6f72 6469 6e61 camera coordina │ │ │ -000d0860: 7465 733c 2f62 3e20 286e 6f72 6d61 6c69 tes (normali │ │ │ -000d0870: 7a65 6420 696d 6167 6520 636f 6f72 6469 zed image coordi │ │ │ -000d0880: 6e61 7465 7329 2c0a 2020 2020 7768 6963 nates),. whic │ │ │ -000d0890: 6820 6172 6520 6469 6d65 6e73 696f 6e6c h are dimensionl │ │ │ -000d08a0: 6573 7320 636f 6f72 6469 6e61 7465 7320 ess coordinates │ │ │ -000d08b0: 696e 2074 6865 2063 616d 6572 6127 7320 in the camera's │ │ │ -000d08c0: 666f 6361 6c20 706c 616e 652c 2069 6e64 focal plane, ind │ │ │ -000d08d0: 6570 656e 6465 6e74 206f 6620 696e 7472 ependent of intr │ │ │ -000d08e0: 696e 7369 6320 7061 7261 6d65 7465 7273 insic parameters │ │ │ -000d08f0: 2e0a 2020 2020 3c2f 6c69 3e0a 2020 3c2f ..
      • . .. .
        .Note: │ │ │ -000d0920: 3c62 3e46 6973 6865 7965 2076 732e 2053 Fisheye vs. S │ │ │ -000d0930: 7461 6e64 6172 6420 4d6f 6465 6c3a 3c2f tandard Model:.Use this func │ │ │ -000d0950: 7469 6f6e 2028 2363 763a 3a66 6973 6865 tion (#cv::fishe │ │ │ -000d0960: 7965 3a3a 756e 6469 7374 6f72 7450 6f69 ye::undistortPoi │ │ │ -000d0970: 6e74 7329 2066 6f72 2066 6973 6865 7965 nts) for fisheye │ │ │ -000d0980: 2063 616d 6572 6173 2028 7769 6465 2d61 cameras (wide-a │ │ │ -000d0990: 6e67 6c65 206c 656e 7365 7329 2e0a 466f ngle lenses)..Fo │ │ │ -000d09a0: 7220 7374 616e 6461 7264 2070 696e 686f r standard pinho │ │ │ -000d09b0: 6c65 2063 616d 6572 6173 2c20 7573 6520 le cameras, use │ │ │ -000d09c0: 2375 6e64 6973 746f 7274 506f 696e 7473 #undistortPoints │ │ │ -000d09d0: 2069 6e73 7465 6164 2e20 5468 6520 6669 instead. The fi │ │ │ -000d09e0: 7368 6579 6520 6d6f 6465 6c20 7573 6573 sheye model uses │ │ │ -000d09f0: 2061 2064 6966 6665 7265 6e74 2064 6973 a different dis │ │ │ -000d0a00: 746f 7274 696f 6e0a 7061 7261 6d65 7465 tortion.paramete │ │ │ -000d0a10: 7269 7a61 7469 6f6e 2028 3420 636f 6566 rization (4 coef │ │ │ -000d0a20: 6669 6369 656e 7473 2920 636f 6d70 6172 ficients) compar │ │ │ -000d0a30: 6564 2074 6f20 7468 6520 7374 616e 6461 ed to the standa │ │ │ -000d0a40: 7264 206d 6f64 656c 2028 342d 3134 2063 rd model (4-14 c │ │ │ -000d0a50: 6f65 6666 6963 6965 6e74 7329 2e3c 2f64 oefficients)..
        .
        Param │ │ │ -000d0a80: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
        .
        │ │ │ -000d0a90: 3c63 6f64 653e 6469 7374 6f72 7465 643c distorted< │ │ │ -000d0aa0: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ -000d0ab0: 6620 6469 7374 6f72 7465 6420 706f 696e f distorted poin │ │ │ -000d0ac0: 7420 636f 6f72 6469 6e61 7465 7320 696e t coordinates in │ │ │ -000d0ad0: 203c 623e 7069 7865 6c20 636f 6f72 6469 pixel coordi │ │ │ -000d0ae0: 6e61 7465 733c 2f62 3e20 6f66 2074 6865 nates of the │ │ │ -000d0af0: 2066 6973 6865 7965 2069 6d61 6765 2c0a fisheye image,. │ │ │ -000d0b00: 3178 4e2f 4e78 3120 322d 6368 616e 6e65 1xN/Nx1 2-channe │ │ │ -000d0b10: 6c20 286f 7220 7665 6374 6f72 266c 743b l (or vector< │ │ │ -000d0b20: 506f 696e 7432 6626 6774 3b20 292c 2077 Point2f> ), w │ │ │ -000d0b30: 6865 7265 204e 2069 7320 7468 6520 6e75 here N is the nu │ │ │ -000d0b40: 6d62 6572 206f 6620 706f 696e 7473 2069 mber of points i │ │ │ -000d0b50: 6e20 7468 6520 7669 6577 2e3c 2f64 643e n the view.
        │ │ │ -000d0b60: 0a3c 6464 3e3c 636f 6465 3e75 6e64 6973 .
        undis │ │ │ -000d0b70: 746f 7274 6564 3c2f 636f 6465 3e20 2d20 torted - │ │ │ -000d0b80: 4f75 7470 7574 2061 7272 6179 206f 6620 Output array of │ │ │ -000d0b90: 756e 6469 7374 6f72 7465 6420 696d 6167 undistorted imag │ │ │ -000d0ba0: 6520 706f 696e 7473 2c20 3178 4e2f 4e78 e points, 1xN/Nx │ │ │ -000d0bb0: 3120 322d 6368 616e 6e65 6c2c 206f 7220 1 2-channel, or │ │ │ -000d0bc0: 7665 6374 6f72 266c 743b 506f 696e 7432 vector<Point2 │ │ │ -000d0bd0: 6626 6774 3b20 2e0a 5468 6520 636f 6f72 f> ..The coor │ │ │ -000d0be0: 6469 6e61 7465 2073 7973 7465 6d20 6465 dinate system de │ │ │ -000d0bf0: 7065 6e64 7320 6f6e 2070 6172 616d 6574 pends on paramet │ │ │ -000d0c00: 6572 2050 2028 7365 6520 6162 6f76 6529 er P (see above) │ │ │ -000d0c10: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
        .
        K - Came │ │ │ -000d0c30: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ -000d0c40: 7269 7820 5c28 5c63 616d 6572 616d 6174 rix \(\cameramat │ │ │ -000d0c50: 7269 787b 4b7d 5c29 206f 6620 7468 6520 rix{K}\) of the │ │ │ -000d0c60: 6669 7368 6579 6520 6361 6d65 7261 2e3c fisheye camera.< │ │ │ -000d0c70: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e44 /dd>.
        D │ │ │ -000d0c80: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ -000d0c90: 7665 6374 6f72 206f 6620 6669 7368 6579 vector of fishey │ │ │ -000d0ca0: 6520 6469 7374 6f72 7469 6f6e 2063 6f65 e distortion coe │ │ │ -000d0cb0: 6666 6963 6965 6e74 7320 5c28 5c64 6973 fficients \(\dis │ │ │ -000d0cc0: 7463 6f65 6666 7366 6973 6865 7965 5c29 tcoeffsfisheye\) │ │ │ -000d0cd0: 2028 6d75 7374 2063 6f6e 7461 696e 2065 (must contain e │ │ │ -000d0ce0: 7861 6374 6c79 2034 2063 6f65 6666 6963 xactly 4 coeffic │ │ │ -000d0cf0: 6965 6e74 7329 2e3c 2f64 643e 0a3c 6464 ients).
        .
        R │ │ │ -000d0d10: 2d20 5265 6374 6966 6963 6174 696f 6e20 - Rectification │ │ │ -000d0d20: 7472 616e 7366 6f72 6d61 7469 6f6e 2069 transformation i │ │ │ -000d0d30: 6e20 7468 6520 6f62 6a65 6374 2073 7061 n the object spa │ │ │ -000d0d40: 6365 3a20 3378 3320 312d 6368 616e 6e65 ce: 3x3 1-channe │ │ │ -000d0d50: 6c2c 206f 7220 7665 6374 6f72 3a20 3378 l, or vector: 3x │ │ │ -000d0d60: 312f 3178 330a 312d 6368 616e 6e65 6c20 1/1x3.1-channel │ │ │ -000d0d70: 6f72 2031 7831 2033 2d63 6861 6e6e 656c or 1x1 3-channel │ │ │ -000d0d80: 2e20 4966 2065 6d70 7479 2c20 7468 6520 . If empty, the │ │ │ -000d0d90: 6964 656e 7469 7479 2074 7261 6e73 666f identity transfo │ │ │ -000d0da0: 726d 6174 696f 6e20 6973 2075 7365 642e rmation is used. │ │ │ -000d0db0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
        .
        │ │ │ -000d0dc0: 503c 2f63 6f64 653e 202d 204e 6577 2063 P - New c │ │ │ -000d0dd0: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ -000d0de0: 6d61 7472 6978 2028 3378 3329 206f 7220 matrix (3x3) or │ │ │ -000d0df0: 6e65 7720 7072 6f6a 6563 7469 6f6e 206d new projection m │ │ │ -000d0e00: 6174 7269 7820 2833 7834 292e 2049 6620 atrix (3x4). If │ │ │ -000d0e10: 656d 7074 7920 6f72 2069 6465 6e74 6974 empty or identit │ │ │ -000d0e20: 792c 0a6f 7574 7075 7420 7769 6c6c 2062 y,.output will b │ │ │ -000d0e30: 6520 696e 206e 6f72 6d61 6c69 7a65 6420 e in normalized │ │ │ -000d0e40: 6361 6d65 7261 2063 6f6f 7264 696e 6174 camera coordinat │ │ │ -000d0e50: 6573 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c es.
        .
        .< │ │ │ -000d0e60: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.

    │ │ │ -000d0e70: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 ..
  • ..

    fishe │ │ │ -000d0f20: 7965 5f75 6e64 6973 746f 7274 506f 696e ye_undistortPoin │ │ │ -000d0f30: 7473 3c2f 6833 3e0a 3c64 6976 2063 6c61 ts

    .
    .
    pu │ │ │ -000d0f90: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static void&nb │ │ │ -000d0fd0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;fi │ │ │ -000d0ff0: 7368 6579 655f 756e 6469 7374 6f72 7450 sheye_undistortP │ │ │ -000d1000: 6f69 6e74 733c 2f73 7061 6e3e 3c77 6272 oints(Mat&n │ │ │ -000d1070: 6273 703b 6469 7374 6f72 7465 642c 0a20 bsp;distorted,. │ │ │ -000d1080: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000d10c0: 2f61 3e26 6e62 7370 3b75 6e64 6973 746f /a> undisto │ │ │ -000d10d0: 7274 6564 2c0a 203c 6120 6872 6566 3d22 rted,. Mat  │ │ │ -000d1120: 4b2c 0a20 3c61 2068 7265 663d 222e 2e2f K,. │ │ │ -000d1160: 4d61 743c 2f61 3e26 6e62 7370 3b44 2c0a Mat D,. │ │ │ -000d1170: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000d11b0: 3c2f 613e 266e 6273 703b 5229 3c2f 7370  R)
    .
    Und │ │ │ -000d11e0: 6973 746f 7274 7320 3244 2070 6f69 6e74 istorts 2D point │ │ │ -000d11f0: 7320 7573 696e 6720 6669 7368 6579 6520 s using fisheye │ │ │ -000d1200: 6361 6d65 7261 206d 6f64 656c 0a0a 5468 camera model..Th │ │ │ -000d1210: 6973 2066 756e 6374 696f 6e20 7065 7266 is function perf │ │ │ -000d1220: 6f72 6d73 2075 6e64 6973 746f 7274 696f orms undistortio │ │ │ -000d1230: 6e20 666f 7220 6669 7368 6579 6520 6361 n for fisheye ca │ │ │ -000d1240: 6d65 7261 206d 6f64 656c 732c 2077 6869 mera models, whi │ │ │ -000d1250: 6368 2075 7365 2061 2064 6966 6665 7265 ch use a differe │ │ │ -000d1260: 6e74 2064 6973 746f 7274 696f 6e20 6d6f nt distortion mo │ │ │ -000d1270: 6465 6c0a 636f 6d70 6172 6564 2074 6f20 del.compared to │ │ │ -000d1280: 7468 6520 7374 616e 6461 7264 2070 696e the standard pin │ │ │ -000d1290: 686f 6c65 2063 616d 6572 6120 6d6f 6465 hole camera mode │ │ │ -000d12a0: 6c20 7573 6564 2062 7920 2375 6e64 6973 l used by #undis │ │ │ -000d12b0: 746f 7274 506f 696e 7473 2e20 5468 6520 tortPoints. The │ │ │ -000d12c0: 6669 7368 6579 6520 6d6f 6465 6c20 6973 fisheye model is │ │ │ -000d12d0: 2073 7569 7461 626c 650a 666f 7220 7769 suitable.for wi │ │ │ -000d12e0: 6465 2d61 6e67 6c65 2063 616d 6572 6173 de-angle cameras │ │ │ -000d12f0: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ -000d1300: 7472 616e 7366 6f72 6d73 2070 6f69 6e74 transforms point │ │ │ -000d1310: 7320 6672 6f6d 2074 6865 2064 6973 746f s from the disto │ │ │ -000d1320: 7274 6564 2066 6973 6865 7965 2069 6d61 rted fisheye ima │ │ │ -000d1330: 6765 2074 6f20 756e 6469 7374 6f72 7465 ge to undistorte │ │ │ -000d1340: 6420 636f 6f72 6469 6e61 7465 732c 206f d coordinates, o │ │ │ -000d1350: 7074 696f 6e61 6c6c 790a 6170 706c 7969 ptionally.applyi │ │ │ -000d1360: 6e67 2061 2072 6563 7469 6669 6361 7469 ng a rectificati │ │ │ -000d1370: 6f6e 2074 7261 6e73 666f 726d 6174 696f on transformatio │ │ │ -000d1380: 6e20 2852 2920 616e 6420 7072 6f6a 6563 n (R) and projec │ │ │ -000d1390: 7469 6e67 2074 6f20 6120 6e65 7720 696d ting to a new im │ │ │ -000d13a0: 6167 6520 706c 616e 6520 2850 292e 0a0a age plane (P)... │ │ │ -000d13b0: 3c62 3e4e 6f74 653a 3c2f 623e 203c 623e Note: │ │ │ -000d13c0: 436f 6f72 6469 6e61 7465 2053 7973 7465 Coordinate Syste │ │ │ -000d13d0: 6d73 3a3c 2f62 3e0a 3c75 6c3e 0a20 203c ms:.
      . < │ │ │ -000d13e0: 6c69 3e0a 203c 623e 496e 7075 7420 283c li>. Input (< │ │ │ -000d13f0: 636f 6465 3e64 6973 746f 7274 6564 3c2f code>distorted): Poin │ │ │ -000d1410: 7473 2061 7265 2065 7870 6563 7465 6420 ts are expected │ │ │ -000d1420: 696e 203c 623e 7069 7865 6c20 636f 6f72 in pixel coor │ │ │ -000d1430: 6469 6e61 7465 733c 2f62 3e20 6f66 2074 dinates of t │ │ │ -000d1440: 6865 2064 6973 746f 7274 6564 2066 6973 he distorted fis │ │ │ -000d1450: 6865 7965 2069 6d61 6765 2c0a 2020 2020 heye image,. │ │ │ -000d1460: 692e 652e 2c20 636f 6f72 6469 6e61 7465 i.e., coordinate │ │ │ -000d1470: 7320 6d65 6173 7572 6564 2069 6e20 7069 s measured in pi │ │ │ -000d1480: 7865 6c73 2066 726f 6d20 7468 6520 746f xels from the to │ │ │ -000d1490: 702d 6c65 6674 2063 6f72 6e65 7220 6f66 p-left corner of │ │ │ -000d14a0: 2074 6865 2069 6d61 6765 2e0a 2020 3c2f the image.. .
    • . O │ │ │ -000d14c0: 7574 7075 7420 283c 636f 6465 3e75 6e64 utput (und │ │ │ -000d14d0: 6973 746f 7274 6564 3c2f 636f 6465 3e29 istorted) │ │ │ -000d14e0: 3c2f 623e 3a20 5468 6520 636f 6f72 6469 : The coordi │ │ │ -000d14f0: 6e61 7465 2073 7973 7465 6d20 6465 7065 nate system depe │ │ │ -000d1500: 6e64 7320 6f6e 2070 6172 616d 6574 6572 nds on parameter │ │ │ -000d1510: 203c 636f 6465 3e50 3c2f 636f 6465 3e3a P: │ │ │ -000d1520: 0a20 203c 756c 3e0a 2020 2020 3c6c 693e .
        .
      • │ │ │ -000d1530: 0a20 2020 2020 4966 203c 636f 6465 3e50 . If P │ │ │ -000d1540: 3c2f 636f 6465 3e20 6973 2070 726f 7669 is provi │ │ │ -000d1550: 6465 6420 286e 6f74 2065 6d70 7479 293a ded (not empty): │ │ │ -000d1560: 204f 7574 7075 7420 706f 696e 7473 2061 Output points a │ │ │ -000d1570: 7265 2069 6e20 3c62 3e70 6978 656c 2063 re in pixel c │ │ │ -000d1580: 6f6f 7264 696e 6174 6573 3c2f 623e 206f oordinates o │ │ │ -000d1590: 6620 7468 6520 7265 6374 6966 6965 642f f the rectified/ │ │ │ -000d15a0: 756e 6469 7374 6f72 7465 640a 2020 2020 undistorted. │ │ │ -000d15b0: 696d 6167 6520 706c 616e 652c 2075 7369 image plane, usi │ │ │ -000d15c0: 6e67 2074 6865 2063 616d 6572 6120 6d61 ng the camera ma │ │ │ -000d15d0: 7472 6978 203c 636f 6465 3e50 3c2f 636f trix P..
      • . │ │ │ -000d15f0: 2020 203c 6c69 3e0a 2020 2020 2049 6620
      • . If │ │ │ -000d1600: 3c63 6f64 653e 503c 2f63 6f64 653e 2069 P i │ │ │ -000d1610: 7320 656d 7074 7920 6f72 2069 6465 6e74 s empty or ident │ │ │ -000d1620: 6974 793a 204f 7574 7075 7420 706f 696e ity: Output poin │ │ │ -000d1630: 7473 2061 7265 2069 6e20 3c62 3e6e 6f72 ts are in nor │ │ │ -000d1640: 6d61 6c69 7a65 6420 6361 6d65 7261 2063 malized camera c │ │ │ -000d1650: 6f6f 7264 696e 6174 6573 3c2f 623e 2028 oordinates ( │ │ │ -000d1660: 6e6f 726d 616c 697a 6564 2069 6d61 6765 normalized image │ │ │ -000d1670: 2063 6f6f 7264 696e 6174 6573 292c 0a20 coordinates),. │ │ │ -000d1680: 2020 2077 6869 6368 2061 7265 2064 696d which are dim │ │ │ -000d1690: 656e 7369 6f6e 6c65 7373 2063 6f6f 7264 ensionless coord │ │ │ -000d16a0: 696e 6174 6573 2069 6e20 7468 6520 6361 inates in the ca │ │ │ -000d16b0: 6d65 7261 2773 2066 6f63 616c 2070 6c61 mera's focal pla │ │ │ -000d16c0: 6e65 2c20 696e 6465 7065 6e64 656e 7420 ne, independent │ │ │ -000d16d0: 6f66 2069 6e74 7269 6e73 6963 2070 6172 of intrinsic par │ │ │ -000d16e0: 616d 6574 6572 732e 0a20 2020 203c 2f6c ameters.. .
      .. .
    .Not │ │ │ -000d1710: 653a 3c2f 623e 203c 623e 4669 7368 6579 e: Fishey │ │ │ -000d1720: 6520 7673 2e20 5374 616e 6461 7264 204d e vs. Standard M │ │ │ -000d1730: 6f64 656c 3a3c 2f62 3e0a 5573 6520 7468 odel:.Use th │ │ │ -000d1740: 6973 2066 756e 6374 696f 6e20 2823 6376 is function (#cv │ │ │ -000d1750: 3a3a 6669 7368 6579 653a 3a75 6e64 6973 ::fisheye::undis │ │ │ -000d1760: 746f 7274 506f 696e 7473 2920 666f 7220 tortPoints) for │ │ │ -000d1770: 6669 7368 6579 6520 6361 6d65 7261 7320 fisheye cameras │ │ │ -000d1780: 2877 6964 652d 616e 676c 6520 6c65 6e73 (wide-angle lens │ │ │ -000d1790: 6573 292e 0a46 6f72 2073 7461 6e64 6172 es)..For standar │ │ │ -000d17a0: 6420 7069 6e68 6f6c 6520 6361 6d65 7261 d pinhole camera │ │ │ -000d17b0: 732c 2075 7365 2023 756e 6469 7374 6f72 s, use #undistor │ │ │ -000d17c0: 7450 6f69 6e74 7320 696e 7374 6561 642e tPoints instead. │ │ │ -000d17d0: 2054 6865 2066 6973 6865 7965 206d 6f64 The fisheye mod │ │ │ -000d17e0: 656c 2075 7365 7320 6120 6469 6666 6572 el uses a differ │ │ │ -000d17f0: 656e 7420 6469 7374 6f72 7469 6f6e 0a70 ent distortion.p │ │ │ -000d1800: 6172 616d 6574 6572 697a 6174 696f 6e20 arameterization │ │ │ -000d1810: 2834 2063 6f65 6666 6963 6965 6e74 7329 (4 coefficients) │ │ │ -000d1820: 2063 6f6d 7061 7265 6420 746f 2074 6865 compared to the │ │ │ -000d1830: 2073 7461 6e64 6172 6420 6d6f 6465 6c20 standard model │ │ │ -000d1840: 2834 2d31 3420 636f 6566 6669 6369 656e (4-14 coefficien │ │ │ -000d1850: 7473 292e 3c2f 6469 763e 0a3c 646c 2063 ts).
    .
    .Parameters:.
    dis │ │ │ -000d1890: 746f 7274 6564 3c2f 636f 6465 3e20 2d20 torted - │ │ │ -000d18a0: 4172 7261 7920 6f66 2064 6973 746f 7274 Array of distort │ │ │ -000d18b0: 6564 2070 6f69 6e74 2063 6f6f 7264 696e ed point coordin │ │ │ -000d18c0: 6174 6573 2069 6e20 3c62 3e70 6978 656c ates in pixel │ │ │ -000d18d0: 2063 6f6f 7264 696e 6174 6573 3c2f 623e coordinates │ │ │ -000d18e0: 206f 6620 7468 6520 6669 7368 6579 6520 of the fisheye │ │ │ -000d18f0: 696d 6167 652c 0a31 784e 2f4e 7831 2032 image,.1xN/Nx1 2 │ │ │ -000d1900: 2d63 6861 6e6e 656c 2028 6f72 2076 6563 -channel (or vec │ │ │ -000d1910: 746f 7226 6c74 3b50 6f69 6e74 3266 2667 tor<Point2f&g │ │ │ -000d1920: 743b 2029 2c20 7768 6572 6520 4e20 6973 t; ), where N is │ │ │ -000d1930: 2074 6865 206e 756d 6265 7220 6f66 2070 the number of p │ │ │ -000d1940: 6f69 6e74 7320 696e 2074 6865 2076 6965 oints in the vie │ │ │ -000d1950: 772e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 w.
    .
    undistorted - Output ar │ │ │ -000d1980: 7261 7920 6f66 2075 6e64 6973 746f 7274 ray of undistort │ │ │ -000d1990: 6564 2069 6d61 6765 2070 6f69 6e74 732c ed image points, │ │ │ -000d19a0: 2031 784e 2f4e 7831 2032 2d63 6861 6e6e 1xN/Nx1 2-chann │ │ │ -000d19b0: 656c 2c20 6f72 2076 6563 746f 7226 6c74 el, or vector< │ │ │ -000d19c0: 3b50 6f69 6e74 3266 2667 743b 202e 0a54 ;Point2f> ..T │ │ │ -000d19d0: 6865 2063 6f6f 7264 696e 6174 6520 7379 he coordinate sy │ │ │ -000d19e0: 7374 656d 2064 6570 656e 6473 206f 6e20 stem depends on │ │ │ -000d19f0: 7061 7261 6d65 7465 7220 5020 2873 6565 parameter P (see │ │ │ -000d1a00: 2061 626f 7665 292e 3c2f 6464 3e0a 3c64 above).
    .K │ │ │ -000d1a20: 202d 2043 616d 6572 6120 696e 7472 696e - Camera intrin │ │ │ -000d1a30: 7369 6320 6d61 7472 6978 205c 285c 6361 sic matrix \(\ca │ │ │ -000d1a40: 6d65 7261 6d61 7472 6978 7b4b 7d5c 2920 meramatrix{K}\) │ │ │ -000d1a50: 6f66 2074 6865 2066 6973 6865 7965 2063 of the fisheye c │ │ │ -000d1a60: 616d 6572 612e 3c2f 6464 3e0a 3c64 643e amera..
    │ │ │ -000d1a70: 3c63 6f64 653e 443c 2f63 6f64 653e 202d D - │ │ │ -000d1a80: 2049 6e70 7574 2076 6563 746f 7220 6f66 Input vector of │ │ │ -000d1a90: 2066 6973 6865 7965 2064 6973 746f 7274 fisheye distort │ │ │ -000d1aa0: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ -000d1ab0: 205c 285c 6469 7374 636f 6566 6673 6669 \(\distcoeffsfi │ │ │ -000d1ac0: 7368 6579 655c 2920 286d 7573 7420 636f sheye\) (must co │ │ │ -000d1ad0: 6e74 6169 6e20 6578 6163 746c 7920 3420 ntain exactly 4 │ │ │ -000d1ae0: 636f 6566 6669 6369 656e 7473 292e 3c2f coefficients)..
    R< │ │ │ -000d1b00: 2f63 6f64 653e 202d 2052 6563 7469 6669 /code> - Rectifi │ │ │ -000d1b10: 6361 7469 6f6e 2074 7261 6e73 666f 726d cation transform │ │ │ -000d1b20: 6174 696f 6e20 696e 2074 6865 206f 626a ation in the obj │ │ │ -000d1b30: 6563 7420 7370 6163 653a 2033 7833 2031 ect space: 3x3 1 │ │ │ -000d1b40: 2d63 6861 6e6e 656c 2c20 6f72 2076 6563 -channel, or vec │ │ │ -000d1b50: 746f 723a 2033 7831 2f31 7833 0a31 2d63 tor: 3x1/1x3.1-c │ │ │ -000d1b60: 6861 6e6e 656c 206f 7220 3178 3120 332d hannel or 1x1 3- │ │ │ -000d1b70: 6368 616e 6e65 6c2e 2049 6620 656d 7074 channel. If empt │ │ │ -000d1b80: 792c 2074 6865 2069 6465 6e74 6974 7920 y, the identity │ │ │ -000d1b90: 7472 616e 7366 6f72 6d61 7469 6f6e 2069 transformation i │ │ │ -000d1ba0: 7320 7573 6564 2e0a 6f75 7470 7574 2077 s used..output w │ │ │ -000d1bb0: 696c 6c20 6265 2069 6e20 6e6f 726d 616c ill be in normal │ │ │ -000d1bc0: 697a 6564 2063 616d 6572 6120 636f 6f72 ized camera coor │ │ │ -000d1bd0: 6469 6e61 7465 732e 3c2f 6464 3e0a 3c2f dinates.
    ..
    .
    .
  • .
  • │ │ │ -000d1c00: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    fish │ │ │ -000d1c90: 6579 655f 756e 6469 7374 6f72 7450 6f69 eye_undistortPoi │ │ │ -000d1ca0: 6e74 733c 2f68 333e 0a3c 6469 7620 636c nts

    .
    .
    p │ │ │ -000d1d00: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static void&n │ │ │ -000d1d40: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;f │ │ │ -000d1d60: 6973 6865 7965 5f75 6e64 6973 746f 7274 isheye_undistort │ │ │ -000d1d70: 506f 696e 7473 3c2f 7370 616e 3e3c 7762 Points(Mat& │ │ │ -000d1de0: 6e62 7370 3b64 6973 746f 7274 6564 2c0a nbsp;distorted,. │ │ │ -000d1df0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000d1e30: 3c2f 613e 266e 6273 703b 756e 6469 7374  undist │ │ │ -000d1e40: 6f72 7465 642c 0a20 3c61 2068 7265 663d orted,. Mat  │ │ │ -000d1e90: 3b4b 2c0a 203c 6120 6872 6566 3d22 2e2e ;K,. Mat D) │ │ │ -000d1ee0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Undistorts 2D p │ │ │ -000d1f10: 6f69 6e74 7320 7573 696e 6720 6669 7368 oints using fish │ │ │ -000d1f20: 6579 6520 6361 6d65 7261 206d 6f64 656c eye camera model │ │ │ -000d1f30: 0a0a 5468 6973 2066 756e 6374 696f 6e20 ..This function │ │ │ -000d1f40: 7065 7266 6f72 6d73 2075 6e64 6973 746f performs undisto │ │ │ -000d1f50: 7274 696f 6e20 666f 7220 6669 7368 6579 rtion for fishey │ │ │ -000d1f60: 6520 6361 6d65 7261 206d 6f64 656c 732c e camera models, │ │ │ -000d1f70: 2077 6869 6368 2075 7365 2061 2064 6966 which use a dif │ │ │ -000d1f80: 6665 7265 6e74 2064 6973 746f 7274 696f ferent distortio │ │ │ -000d1f90: 6e20 6d6f 6465 6c0a 636f 6d70 6172 6564 n model.compared │ │ │ -000d1fa0: 2074 6f20 7468 6520 7374 616e 6461 7264 to the standard │ │ │ -000d1fb0: 2070 696e 686f 6c65 2063 616d 6572 6120 pinhole camera │ │ │ -000d1fc0: 6d6f 6465 6c20 7573 6564 2062 7920 2375 model used by #u │ │ │ -000d1fd0: 6e64 6973 746f 7274 506f 696e 7473 2e20 ndistortPoints. │ │ │ -000d1fe0: 5468 6520 6669 7368 6579 6520 6d6f 6465 The fisheye mode │ │ │ -000d1ff0: 6c20 6973 2073 7569 7461 626c 650a 666f l is suitable.fo │ │ │ -000d2000: 7220 7769 6465 2d61 6e67 6c65 2063 616d r wide-angle cam │ │ │ -000d2010: 6572 6173 2e0a 0a54 6865 2066 756e 6374 eras...The funct │ │ │ -000d2020: 696f 6e20 7472 616e 7366 6f72 6d73 2070 ion transforms p │ │ │ -000d2030: 6f69 6e74 7320 6672 6f6d 2074 6865 2064 oints from the d │ │ │ -000d2040: 6973 746f 7274 6564 2066 6973 6865 7965 istorted fisheye │ │ │ -000d2050: 2069 6d61 6765 2074 6f20 756e 6469 7374 image to undist │ │ │ -000d2060: 6f72 7465 6420 636f 6f72 6469 6e61 7465 orted coordinate │ │ │ -000d2070: 732c 206f 7074 696f 6e61 6c6c 790a 6170 s, optionally.ap │ │ │ -000d2080: 706c 7969 6e67 2061 2072 6563 7469 6669 plying a rectifi │ │ │ -000d2090: 6361 7469 6f6e 2074 7261 6e73 666f 726d cation transform │ │ │ -000d20a0: 6174 696f 6e20 2852 2920 616e 6420 7072 ation (R) and pr │ │ │ -000d20b0: 6f6a 6563 7469 6e67 2074 6f20 6120 6e65 ojecting to a ne │ │ │ -000d20c0: 7720 696d 6167 6520 706c 616e 6520 2850 w image plane (P │ │ │ -000d20d0: 292e 0a0a 3c62 3e4e 6f74 653a 3c2f 623e )...Note: │ │ │ -000d20e0: 203c 623e 436f 6f72 6469 6e61 7465 2053 Coordinate S │ │ │ -000d20f0: 7973 7465 6d73 3a3c 2f62 3e0a 3c75 6c3e ystems:.
      │ │ │ -000d2100: 0a20 203c 6c69 3e0a 203c 623e 496e 7075 .
    • . Inpu │ │ │ -000d2110: 7420 283c 636f 6465 3e64 6973 746f 7274 t (distort │ │ │ -000d2120: 6564 3c2f 636f 6465 3e29 3c2f 623e 3a20 ed): │ │ │ -000d2130: 506f 696e 7473 2061 7265 2065 7870 6563 Points are expec │ │ │ -000d2140: 7465 6420 696e 203c 623e 7069 7865 6c20 ted in pixel │ │ │ -000d2150: 636f 6f72 6469 6e61 7465 733c 2f62 3e20 coordinates │ │ │ -000d2160: 6f66 2074 6865 2064 6973 746f 7274 6564 of the distorted │ │ │ -000d2170: 2066 6973 6865 7965 2069 6d61 6765 2c0a fisheye image,. │ │ │ -000d2180: 2020 2020 692e 652e 2c20 636f 6f72 6469 i.e., coordi │ │ │ -000d2190: 6e61 7465 7320 6d65 6173 7572 6564 2069 nates measured i │ │ │ -000d21a0: 6e20 7069 7865 6c73 2066 726f 6d20 7468 n pixels from th │ │ │ -000d21b0: 6520 746f 702d 6c65 6674 2063 6f72 6e65 e top-left corne │ │ │ -000d21c0: 7220 6f66 2074 6865 2069 6d61 6765 2e0a r of the image.. │ │ │ -000d21d0: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ -000d21e0: 3c62 3e4f 7574 7075 7420 283c 636f 6465 Output (undistorted): The co │ │ │ -000d2210: 6f72 6469 6e61 7465 2073 7973 7465 6d20 ordinate system │ │ │ -000d2220: 6465 7065 6e64 7320 6f6e 2070 6172 616d depends on param │ │ │ -000d2230: 6574 6572 203c 636f 6465 3e50 3c2f 636f eter P:.
        . │ │ │ -000d2250: 3c6c 693e 0a20 2020 2020 4966 203c 636f
      • . If P is p │ │ │ -000d2270: 726f 7669 6465 6420 286e 6f74 2065 6d70 rovided (not emp │ │ │ -000d2280: 7479 293a 204f 7574 7075 7420 706f 696e ty): Output poin │ │ │ -000d2290: 7473 2061 7265 2069 6e20 3c62 3e70 6978 ts are in pix │ │ │ -000d22a0: 656c 2063 6f6f 7264 696e 6174 6573 3c2f el coordinates of the rectif │ │ │ -000d22c0: 6965 642f 756e 6469 7374 6f72 7465 640a ied/undistorted. │ │ │ -000d22d0: 2020 2020 696d 6167 6520 706c 616e 652c image plane, │ │ │ -000d22e0: 2075 7369 6e67 2074 6865 2063 616d 6572 using the camer │ │ │ -000d22f0: 6120 6d61 7472 6978 203c 636f 6465 3e50 a matrix P │ │ │ -000d2300: 3c2f 636f 6465 3e2e 0a20 2020 203c 2f6c .. .
      • . │ │ │ -000d2320: 2049 6620 3c63 6f64 653e 503c 2f63 6f64 If P is empty or i │ │ │ -000d2340: 6465 6e74 6974 793a 204f 7574 7075 7420 dentity: Output │ │ │ -000d2350: 706f 696e 7473 2061 7265 2069 6e20 3c62 points are in normalized came │ │ │ -000d2370: 7261 2063 6f6f 7264 696e 6174 6573 3c2f ra coordinates (normalized i │ │ │ -000d2390: 6d61 6765 2063 6f6f 7264 696e 6174 6573 mage coordinates │ │ │ -000d23a0: 292c 0a20 2020 2077 6869 6368 2061 7265 ),. which are │ │ │ -000d23b0: 2064 696d 656e 7369 6f6e 6c65 7373 2063 dimensionless c │ │ │ -000d23c0: 6f6f 7264 696e 6174 6573 2069 6e20 7468 oordinates in th │ │ │ -000d23d0: 6520 6361 6d65 7261 2773 2066 6f63 616c e camera's focal │ │ │ -000d23e0: 2070 6c61 6e65 2c20 696e 6465 7065 6e64 plane, independ │ │ │ -000d23f0: 656e 7420 6f66 2069 6e74 7269 6e73 6963 ent of intrinsic │ │ │ -000d2400: 2070 6172 616d 6574 6572 732e 0a20 2020 parameters.. │ │ │ -000d2410: 203c 2f6c 693e 0a20 203c 2f75 6c3e 0a0a
      • .
      .. │ │ │ -000d2420: 2020 3c2f 6c69 3e0a 3c2f 756c 3e0a 3c62
    • .
    .Note: Fi │ │ │ -000d2440: 7368 6579 6520 7673 2e20 5374 616e 6461 sheye vs. Standa │ │ │ -000d2450: 7264 204d 6f64 656c 3a3c 2f62 3e0a 5573 rd Model:.Us │ │ │ -000d2460: 6520 7468 6973 2066 756e 6374 696f 6e20 e this function │ │ │ -000d2470: 2823 6376 3a3a 6669 7368 6579 653a 3a75 (#cv::fisheye::u │ │ │ -000d2480: 6e64 6973 746f 7274 506f 696e 7473 2920 ndistortPoints) │ │ │ -000d2490: 666f 7220 6669 7368 6579 6520 6361 6d65 for fisheye came │ │ │ -000d24a0: 7261 7320 2877 6964 652d 616e 676c 6520 ras (wide-angle │ │ │ -000d24b0: 6c65 6e73 6573 292e 0a46 6f72 2073 7461 lenses)..For sta │ │ │ -000d24c0: 6e64 6172 6420 7069 6e68 6f6c 6520 6361 ndard pinhole ca │ │ │ -000d24d0: 6d65 7261 732c 2075 7365 2023 756e 6469 meras, use #undi │ │ │ -000d24e0: 7374 6f72 7450 6f69 6e74 7320 696e 7374 stortPoints inst │ │ │ -000d24f0: 6561 642e 2054 6865 2066 6973 6865 7965 ead. The fisheye │ │ │ -000d2500: 206d 6f64 656c 2075 7365 7320 6120 6469 model uses a di │ │ │ -000d2510: 6666 6572 656e 7420 6469 7374 6f72 7469 fferent distorti │ │ │ -000d2520: 6f6e 0a70 6172 616d 6574 6572 697a 6174 on.parameterizat │ │ │ -000d2530: 696f 6e20 2834 2063 6f65 6666 6963 6965 ion (4 coefficie │ │ │ -000d2540: 6e74 7329 2063 6f6d 7061 7265 6420 746f nts) compared to │ │ │ -000d2550: 2074 6865 2073 7461 6e64 6172 6420 6d6f the standard mo │ │ │ -000d2560: 6465 6c20 2834 2d31 3420 636f 6566 6669 del (4-14 coeffi │ │ │ -000d2570: 6369 656e 7473 292e 3c2f 6469 763e 0a3c cients).
    .< │ │ │ -000d2580: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ -000d2590: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ -000d25a0: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    distorted - Array of dis │ │ │ -000d25d0: 746f 7274 6564 2070 6f69 6e74 2063 6f6f torted point coo │ │ │ -000d25e0: 7264 696e 6174 6573 2069 6e20 3c62 3e70 rdinates in p │ │ │ -000d25f0: 6978 656c 2063 6f6f 7264 696e 6174 6573 ixel coordinates │ │ │ -000d2600: 3c2f 623e 206f 6620 7468 6520 6669 7368 of the fish │ │ │ -000d2610: 6579 6520 696d 6167 652c 0a31 784e 2f4e eye image,.1xN/N │ │ │ -000d2620: 7831 2032 2d63 6861 6e6e 656c 2028 6f72 x1 2-channel (or │ │ │ -000d2630: 2076 6563 746f 7226 6c74 3b50 6f69 6e74 vector<Point │ │ │ -000d2640: 3266 2667 743b 2029 2c20 7768 6572 6520 2f> ), where │ │ │ -000d2650: 4e20 6973 2074 6865 206e 756d 6265 7220 N is the number │ │ │ -000d2660: 6f66 2070 6f69 6e74 7320 696e 2074 6865 of points in the │ │ │ -000d2670: 2076 6965 772e 3c2f 6464 3e0a 3c64 643e view.
    .
    │ │ │ -000d2680: 3c63 6f64 653e 756e 6469 7374 6f72 7465 undistorte │ │ │ -000d2690: 643c 2f63 6f64 653e 202d 204f 7574 7075 d - Outpu │ │ │ -000d26a0: 7420 6172 7261 7920 6f66 2075 6e64 6973 t array of undis │ │ │ -000d26b0: 746f 7274 6564 2069 6d61 6765 2070 6f69 torted image poi │ │ │ -000d26c0: 6e74 732c 2031 784e 2f4e 7831 2032 2d63 nts, 1xN/Nx1 2-c │ │ │ -000d26d0: 6861 6e6e 656c 2c20 6f72 2076 6563 746f hannel, or vecto │ │ │ -000d26e0: 7226 6c74 3b50 6f69 6e74 3266 2667 743b r<Point2f> │ │ │ -000d26f0: 202e 0a54 6865 2063 6f6f 7264 696e 6174 ..The coordinat │ │ │ -000d2700: 6520 7379 7374 656d 2064 6570 656e 6473 e system depends │ │ │ -000d2710: 206f 6e20 7061 7261 6d65 7465 7220 5020 on parameter P │ │ │ -000d2720: 2873 6565 2061 626f 7665 292e 3c2f 6464 (see above).
    .
    K - Camera in │ │ │ -000d2750: 7472 696e 7369 6320 6d61 7472 6978 205c trinsic matrix \ │ │ │ -000d2760: 285c 6361 6d65 7261 6d61 7472 6978 7b4b (\cameramatrix{K │ │ │ -000d2770: 7d5c 2920 6f66 2074 6865 2066 6973 6865 }\) of the fishe │ │ │ -000d2780: 7965 2063 616d 6572 612e 3c2f 6464 3e0a ye camera.
    . │ │ │ -000d2790: 3c64 643e 3c63 6f64 653e 443c 2f63 6f64
    D - Input vecto │ │ │ -000d27b0: 7220 6f66 2066 6973 6865 7965 2064 6973 r of fisheye dis │ │ │ -000d27c0: 746f 7274 696f 6e20 636f 6566 6669 6369 tortion coeffici │ │ │ -000d27d0: 656e 7473 205c 285c 6469 7374 636f 6566 ents \(\distcoef │ │ │ -000d27e0: 6673 6669 7368 6579 655c 2920 286d 7573 fsfisheye\) (mus │ │ │ -000d27f0: 7420 636f 6e74 6169 6e20 6578 6163 746c t contain exactl │ │ │ -000d2800: 7920 3420 636f 6566 6669 6369 656e 7473 y 4 coefficients │ │ │ -000d2810: 292e 0a31 2d63 6861 6e6e 656c 206f 7220 )..1-channel or │ │ │ -000d2820: 3178 3120 332d 6368 616e 6e65 6c2e 2049 1x1 3-channel. I │ │ │ -000d2830: 6620 656d 7074 792c 2074 6865 2069 6465 f empty, the ide │ │ │ -000d2840: 6e74 6974 7920 7472 616e 7366 6f72 6d61 ntity transforma │ │ │ -000d2850: 7469 6f6e 2069 7320 7573 6564 2e0a 6f75 tion is used..ou │ │ │ -000d2860: 7470 7574 2077 696c 6c20 6265 2069 6e20 tput will be in │ │ │ -000d2870: 6e6f 726d 616c 697a 6564 2063 616d 6572 normalized camer │ │ │ -000d2880: 6120 636f 6f72 6469 6e61 7465 732e 3c2f a coordinates... │ │ │ -000d28a0: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
    .
  • .
  • .
    │ │ │ -000d2990: 0a3c 6833 3e66 6973 6865 7965 5f65 7374 .

    fisheye_est │ │ │ -000d29a0: 696d 6174 654e 6577 4361 6d65 7261 4d61 imateNewCameraMa │ │ │ -000d29b0: 7472 6978 466f 7255 6e64 6973 746f 7274 trixForUndistort │ │ │ -000d29c0: 5265 6374 6966 793c 2f68 333e 0a3c 6469 Rectify

    ..public static │ │ │ -000d2a30: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  void fisheye_estim │ │ │ -000d2a90: 6174 654e 6577 4361 6d65 7261 4d61 7472 ateNewCameraMatr │ │ │ -000d2aa0: 6978 466f 7255 6e64 6973 746f 7274 5265 ixForUndistortRe │ │ │ -000d2ab0: 6374 6966 793c 2f73 7061 6e3e 3c77 6272 ctify(Mat&n │ │ │ -000d2b20: 6273 703b 4b2c 0a20 3c61 2068 7265 663d bsp;K,. Mat  │ │ │ -000d2b70: 3b44 2c0a 203c 6120 6872 6566 3d22 2e2e ;D,. Size  │ │ │ -000d2bc0: 696d 6167 655f 7369 7a65 2c0a 203c 6120 image_size,. Mat │ │ │ -000d2c10: 266e 6273 703b 522c 0a20 3c61 2068 7265  R,. Mat&nb │ │ │ -000d2c60: 7370 3b50 2c0a 2064 6f75 626c 6526 6e62 sp;P,. double&nb │ │ │ -000d2c70: 7370 3b62 616c 616e 6365 2c0a 203c 6120 sp;balance,. Size new_size │ │ │ -000d2cd0: 2c0a 2064 6f75 626c 6526 6e62 7370 3b66 ,. double f │ │ │ -000d2ce0: 6f76 5f73 6361 6c65 293c 2f73 7061 6e3e ov_scale) │ │ │ -000d2cf0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173 .
    Estima │ │ │ -000d2d10: 7465 7320 6e65 7720 6361 6d65 7261 2069 tes new camera i │ │ │ -000d2d20: 6e74 7269 6e73 6963 206d 6174 7269 7820 ntrinsic matrix │ │ │ -000d2d30: 666f 7220 756e 6469 7374 6f72 7469 6f6e for undistortion │ │ │ -000d2d40: 206f 7220 7265 6374 6966 6963 6174 696f or rectificatio │ │ │ -000d2d50: 6e2e 3c2f 6469 763e 0a3c 646c 2063 6c61 n.
    .
    .
    │ │ │ -000d2d70: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ -000d2d80: 0a3c 6464 3e3c 636f 6465 3e4b 3c2f 636f .
    K - Camera int │ │ │ -000d2da0: 7269 6e73 6963 206d 6174 7269 7820 5c28 rinsic matrix \( │ │ │ -000d2db0: 6361 6d65 7261 6d61 7472 6978 7b4b 7d5c cameramatrix{K}\ │ │ │ -000d2dc0: 292e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 ).
    .
    D - Inp │ │ │ -000d2de0: 7574 2076 6563 746f 7220 6f66 2064 6973 ut vector of dis │ │ │ -000d2df0: 746f 7274 696f 6e20 636f 6566 6669 6369 tortion coeffici │ │ │ -000d2e00: 656e 7473 205c 285c 6469 7374 636f 6566 ents \(\distcoef │ │ │ -000d2e10: 6673 6669 7368 6579 655c 292e 3c2f 6464 fsfisheye\).
    .
    imag │ │ │ -000d2e30: 655f 7369 7a65 3c2f 636f 6465 3e20 2d20 e_size - │ │ │ -000d2e40: 5369 7a65 206f 6620 7468 6520 696d 6167 Size of the imag │ │ │ -000d2e50: 653c 2f64 643e 0a3c 6464 3e3c 636f 6465 e
    .
    R - Rect │ │ │ -000d2e70: 6966 6963 6174 696f 6e20 7472 616e 7366 ification transf │ │ │ -000d2e80: 6f72 6d61 7469 6f6e 2069 6e20 7468 6520 ormation in the │ │ │ -000d2e90: 6f62 6a65 6374 2073 7061 6365 3a20 3378 object space: 3x │ │ │ -000d2ea0: 3320 312d 6368 616e 6e65 6c2c 206f 7220 3 1-channel, or │ │ │ -000d2eb0: 7665 6374 6f72 3a20 3378 312f 3178 330a vector: 3x1/1x3. │ │ │ -000d2ec0: 312d 6368 616e 6e65 6c20 6f72 2031 7831 1-channel or 1x1 │ │ │ -000d2ed0: 2033 2d63 6861 6e6e 656c 3c2f 6464 3e0a 3-channel
    . │ │ │ -000d2ee0: 3c64 643e 3c63 6f64 653e 503c 2f63 6f64
    P - New camera │ │ │ -000d2f00: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ -000d2f10: 2028 3378 3329 206f 7220 6e65 7720 7072 (3x3) or new pr │ │ │ -000d2f20: 6f6a 6563 7469 6f6e 206d 6174 7269 7820 ojection matrix │ │ │ -000d2f30: 2833 7834 293c 2f64 643e 0a3c 6464 3e3c (3x4)
    .
    < │ │ │ -000d2f40: 636f 6465 3e62 616c 616e 6365 3c2f 636f code>balance - Sets the n │ │ │ -000d2f60: 6577 2066 6f63 616c 206c 656e 6774 6820 ew focal length │ │ │ -000d2f70: 696e 2072 616e 6765 2062 6574 7765 656e in range between │ │ │ -000d2f80: 2074 6865 206d 696e 2066 6f63 616c 206c the min focal l │ │ │ -000d2f90: 656e 6774 6820 616e 6420 7468 6520 6d61 ength and the ma │ │ │ -000d2fa0: 7820 666f 6361 6c0a 6c65 6e67 7468 2e20 x focal.length. │ │ │ -000d2fb0: 4261 6c61 6e63 6520 6973 2069 6e20 7261 Balance is in ra │ │ │ -000d2fc0: 6e67 6520 6f66 205b 302c 2031 5d2e 3c2f nge of [0, 1]..
    ne │ │ │ -000d2fe0: 775f 7369 7a65 3c2f 636f 6465 3e20 2d20 w_size - │ │ │ -000d2ff0: 7468 6520 6e65 7720 7369 7a65 3c2f 6464 the new size
    .
    fov_ │ │ │ -000d3010: 7363 616c 653c 2f63 6f64 653e 202d 2044 scale - D │ │ │ -000d3020: 6976 6973 6f72 2066 6f72 206e 6577 2066 ivisor for new f │ │ │ -000d3030: 6f63 616c 206c 656e 6774 682e 3c2f 6464 ocal length.
    .
    ..< │ │ │ -000d3050: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ -000d3060: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    fish │ │ │ -000d3140: 6579 655f 6573 7469 6d61 7465 4e65 7743 eye_estimateNewC │ │ │ -000d3150: 616d 6572 614d 6174 7269 7846 6f72 556e ameraMatrixForUn │ │ │ -000d3160: 6469 7374 6f72 7452 6563 7469 6679 3c2f distortRectify.
    .
    public │ │ │ -000d31d0: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ -000d31e0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;vo │ │ │ -000d3200: 6964 3c2f 7370 616e 3e26 6e62 7370 3b3c id < │ │ │ -000d3210: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ -000d3220: 656e 742d 6e61 6d65 223e 6669 7368 6579 ent-name">fishey │ │ │ -000d3230: 655f 6573 7469 6d61 7465 4e65 7743 616d e_estimateNewCam │ │ │ -000d3240: 6572 614d 6174 7269 7846 6f72 556e 6469 eraMatrixForUndi │ │ │ -000d3250: 7374 6f72 7452 6563 7469 6679 3c2f 7370 stortRectify(Ma │ │ │ -000d32c0: 743c 2f61 3e26 6e62 7370 3b4b 2c0a 203c t K,. < │ │ │ -000d32d0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000d32e0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000d32f0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000d3300: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat D,. Size image_siz │ │ │ -000d3370: 652c 0a20 3c61 2068 7265 663d 222e 2e2f e,. │ │ │ -000d33b0: 4d61 743c 2f61 3e26 6e62 7370 3b52 2c0a Mat R,. │ │ │ -000d33c0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000d3400: 3c2f 613e 266e 6273 703b 502c 0a20 646f  P,. do │ │ │ -000d3410: 7562 6c65 266e 6273 703b 6261 6c61 6e63 uble balanc │ │ │ -000d3420: 652c 0a20 3c61 2068 7265 663d 222e 2e2f e,. Size n │ │ │ -000d3470: 6577 5f73 697a 6529 3c2f 7370 616e 3e3c ew_size)< │ │ │ -000d3480: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Estimat │ │ │ -000d34a0: 6573 206e 6577 2063 616d 6572 6120 696e es new camera in │ │ │ -000d34b0: 7472 696e 7369 6320 6d61 7472 6978 2066 trinsic matrix f │ │ │ -000d34c0: 6f72 2075 6e64 6973 746f 7274 696f 6e20 or undistortion │ │ │ -000d34d0: 6f72 2072 6563 7469 6669 6361 7469 6f6e or rectification │ │ │ -000d34e0: 2e3c 2f64 6976 3e0a 3c64 6c20 636c 6173 .
    .
    .
    P │ │ │ -000d3500: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ -000d3510: 3c64 643e 3c63 6f64 653e 4b3c 2f63 6f64
    K - Camera intr │ │ │ -000d3530: 696e 7369 6320 6d61 7472 6978 205c 2863 insic matrix \(c │ │ │ -000d3540: 616d 6572 616d 6174 7269 787b 4b7d 5c29 ameramatrix{K}\) │ │ │ -000d3550: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    D - Inpu │ │ │ -000d3570: 7420 7665 6374 6f72 206f 6620 6469 7374 t vector of dist │ │ │ -000d3580: 6f72 7469 6f6e 2063 6f65 6666 6963 6965 ortion coefficie │ │ │ -000d3590: 6e74 7320 5c28 5c64 6973 7463 6f65 6666 nts \(\distcoeff │ │ │ -000d35a0: 7366 6973 6865 7965 5c29 2e3c 2f64 643e sfisheye\).
    │ │ │ -000d35b0: 0a3c 6464 3e3c 636f 6465 3e69 6d61 6765 .
    image │ │ │ -000d35c0: 5f73 697a 653c 2f63 6f64 653e 202d 2053 _size - S │ │ │ -000d35d0: 697a 6520 6f66 2074 6865 2069 6d61 6765 ize of the image │ │ │ -000d35e0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000d35f0: 523c 2f63 6f64 653e 202d 2052 6563 7469 R - Recti │ │ │ -000d3600: 6669 6361 7469 6f6e 2074 7261 6e73 666f fication transfo │ │ │ -000d3610: 726d 6174 696f 6e20 696e 2074 6865 206f rmation in the o │ │ │ -000d3620: 626a 6563 7420 7370 6163 653a 2033 7833 bject space: 3x3 │ │ │ -000d3630: 2031 2d63 6861 6e6e 656c 2c20 6f72 2076 1-channel, or v │ │ │ -000d3640: 6563 746f 723a 2033 7831 2f31 7833 0a31 ector: 3x1/1x3.1 │ │ │ -000d3650: 2d63 6861 6e6e 656c 206f 7220 3178 3120 -channel or 1x1 │ │ │ -000d3660: 332d 6368 616e 6e65 6c3c 2f64 643e 0a3c 3-channel
    .< │ │ │ -000d3670: 6464 3e3c 636f 6465 3e50 3c2f 636f 6465 dd>P - New camera i │ │ │ -000d3690: 6e74 7269 6e73 6963 206d 6174 7269 7820 ntrinsic matrix │ │ │ -000d36a0: 2833 7833 2920 6f72 206e 6577 2070 726f (3x3) or new pro │ │ │ -000d36b0: 6a65 6374 696f 6e20 6d61 7472 6978 2028 jection matrix ( │ │ │ -000d36c0: 3378 3429 3c2f 6464 3e0a 3c64 643e 3c63 3x4).
    balance - Sets the ne │ │ │ -000d36f0: 7720 666f 6361 6c20 6c65 6e67 7468 2069 w focal length i │ │ │ -000d3700: 6e20 7261 6e67 6520 6265 7477 6565 6e20 n range between │ │ │ -000d3710: 7468 6520 6d69 6e20 666f 6361 6c20 6c65 the min focal le │ │ │ -000d3720: 6e67 7468 2061 6e64 2074 6865 206d 6178 ngth and the max │ │ │ -000d3730: 2066 6f63 616c 0a6c 656e 6774 682e 2042 focal.length. B │ │ │ -000d3740: 616c 616e 6365 2069 7320 696e 2072 616e alance is in ran │ │ │ -000d3750: 6765 206f 6620 5b30 2c20 315d 2e3c 2f64 ge of [0, 1]..
    new │ │ │ -000d3770: 5f73 697a 653c 2f63 6f64 653e 202d 2074 _size - t │ │ │ -000d3780: 6865 206e 6577 2073 697a 653c 2f64 643e he new size
    │ │ │ -000d3790: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    .
    ..

  • .< │ │ │ -000d37b0: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .

    fisheye_es │ │ │ -000d3880: 7469 6d61 7465 4e65 7743 616d 6572 614d timateNewCameraM │ │ │ -000d3890: 6174 7269 7846 6f72 556e 6469 7374 6f72 atrixForUndistor │ │ │ -000d38a0: 7452 6563 7469 6679 3c2f 6833 3e0a 3c64 tRectify

    ..public stati │ │ │ -000d3910: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void fisheye_esti │ │ │ -000d3970: 6d61 7465 4e65 7743 616d 6572 614d 6174 mateNewCameraMat │ │ │ -000d3980: 7269 7846 6f72 556e 6469 7374 6f72 7452 rixForUndistortR │ │ │ -000d3990: 6563 7469 6679 3c2f 7370 616e 3e3c 7762 ectify(Mat& │ │ │ -000d3a00: 6e62 7370 3b4b 2c0a 203c 6120 6872 6566 nbsp;K,. Mat&nbs │ │ │ -000d3a50: 703b 442c 0a20 3c61 2068 7265 663d 222e p;D,. Size  │ │ │ -000d3aa0: 3b69 6d61 6765 5f73 697a 652c 0a20 3c61 ;image_size,. Mat R,. Mat&n │ │ │ -000d3b40: 6273 703b 502c 0a20 646f 7562 6c65 266e bsp;P,. double&n │ │ │ -000d3b50: 6273 703b 6261 6c61 6e63 6529 3c2f 7370 bsp;balance).
    Est │ │ │ -000d3b80: 696d 6174 6573 206e 6577 2063 616d 6572 imates new camer │ │ │ -000d3b90: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ -000d3ba0: 6978 2066 6f72 2075 6e64 6973 746f 7274 ix for undistort │ │ │ -000d3bb0: 696f 6e20 6f72 2072 6563 7469 6669 6361 ion or rectifica │ │ │ -000d3bc0: 7469 6f6e 2e3c 2f64 6976 3e0a 3c64 6c20 tion.
    .
    .< │ │ │ -000d3be0: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    K< │ │ │ -000d3c00: 2f63 6f64 653e 202d 2043 616d 6572 6120 /code> - Camera │ │ │ -000d3c10: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ -000d3c20: 205c 2863 616d 6572 616d 6174 7269 787b \(cameramatrix{ │ │ │ -000d3c30: 4b7d 5c29 2e3c 2f64 643e 0a3c 6464 3e3c K}\).
    .
    < │ │ │ -000d3c40: 636f 6465 3e44 3c2f 636f 6465 3e20 2d20 code>D - │ │ │ -000d3c50: 496e 7075 7420 7665 6374 6f72 206f 6620 Input vector of │ │ │ -000d3c60: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ -000d3c70: 6963 6965 6e74 7320 5c28 5c64 6973 7463 icients \(\distc │ │ │ -000d3c80: 6f65 6666 7366 6973 6865 7965 5c29 2e3c oeffsfisheye\).< │ │ │ -000d3c90: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e69 /dd>.
    i │ │ │ -000d3ca0: 6d61 6765 5f73 697a 653c 2f63 6f64 653e mage_size │ │ │ -000d3cb0: 202d 2053 697a 6520 6f66 2074 6865 2069 - Size of the i │ │ │ -000d3cc0: 6d61 6765 3c2f 6464 3e0a 3c64 643e 3c63 mage
    .
    R - R │ │ │ -000d3ce0: 6563 7469 6669 6361 7469 6f6e 2074 7261 ectification tra │ │ │ -000d3cf0: 6e73 666f 726d 6174 696f 6e20 696e 2074 nsformation in t │ │ │ -000d3d00: 6865 206f 626a 6563 7420 7370 6163 653a he object space: │ │ │ -000d3d10: 2033 7833 2031 2d63 6861 6e6e 656c 2c20 3x3 1-channel, │ │ │ -000d3d20: 6f72 2076 6563 746f 723a 2033 7831 2f31 or vector: 3x1/1 │ │ │ -000d3d30: 7833 0a31 2d63 6861 6e6e 656c 206f 7220 x3.1-channel or │ │ │ -000d3d40: 3178 3120 332d 6368 616e 6e65 6c3c 2f64 1x1 3-channel.
    P - New came │ │ │ -000d3d70: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ -000d3d80: 7269 7820 2833 7833 2920 6f72 206e 6577 rix (3x3) or new │ │ │ -000d3d90: 2070 726f 6a65 6374 696f 6e20 6d61 7472 projection matr │ │ │ -000d3da0: 6978 2028 3378 3429 3c2f 6464 3e0a 3c64 ix (3x4)
    .balance< │ │ │ -000d3dc0: 2f63 6f64 653e 202d 2053 6574 7320 7468 /code> - Sets th │ │ │ -000d3dd0: 6520 6e65 7720 666f 6361 6c20 6c65 6e67 e new focal leng │ │ │ -000d3de0: 7468 2069 6e20 7261 6e67 6520 6265 7477 th in range betw │ │ │ -000d3df0: 6565 6e20 7468 6520 6d69 6e20 666f 6361 een the min foca │ │ │ -000d3e00: 6c20 6c65 6e67 7468 2061 6e64 2074 6865 l length and the │ │ │ -000d3e10: 206d 6178 2066 6f63 616c 0a6c 656e 6774 max focal.lengt │ │ │ -000d3e20: 682e 2042 616c 616e 6365 2069 7320 696e h. Balance is in │ │ │ -000d3e30: 2072 616e 6765 206f 6620 5b30 2c20 315d range of [0, 1] │ │ │ -000d3e40: 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 ..
    ..
    .< │ │ │ -000d3e60: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • . │ │ │ -000d3f20: 0a3c 6833 3e66 6973 6865 7965 5f65 7374 .

    fisheye_est │ │ │ -000d3f30: 696d 6174 654e 6577 4361 6d65 7261 4d61 imateNewCameraMa │ │ │ -000d3f40: 7472 6978 466f 7255 6e64 6973 746f 7274 trixForUndistort │ │ │ -000d3f50: 5265 6374 6966 793c 2f68 333e 0a3c 6469 Rectify

    ..public static │ │ │ -000d3fc0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  void fisheye_estim │ │ │ -000d4020: 6174 654e 6577 4361 6d65 7261 4d61 7472 ateNewCameraMatr │ │ │ -000d4030: 6978 466f 7255 6e64 6973 746f 7274 5265 ixForUndistortRe │ │ │ -000d4040: 6374 6966 793c 2f73 7061 6e3e 3c77 6272 ctify(Mat&n │ │ │ -000d40b0: 6273 703b 4b2c 0a20 3c61 2068 7265 663d bsp;K,. Mat  │ │ │ -000d4100: 3b44 2c0a 203c 6120 6872 6566 3d22 2e2e ;D,. Size  │ │ │ -000d4150: 696d 6167 655f 7369 7a65 2c0a 203c 6120 image_size,. Mat │ │ │ -000d41a0: 266e 6273 703b 522c 0a20 3c61 2068 7265  R,. Mat&nb │ │ │ -000d41f0: 7370 3b50 293c 2f73 7061 6e3e 3c2f 6469 sp;P).
    Estimates │ │ │ -000d4220: 6e65 7720 6361 6d65 7261 2069 6e74 7269 new camera intri │ │ │ -000d4230: 6e73 6963 206d 6174 7269 7820 666f 7220 nsic matrix for │ │ │ -000d4240: 756e 6469 7374 6f72 7469 6f6e 206f 7220 undistortion or │ │ │ -000d4250: 7265 6374 6966 6963 6174 696f 6e2e 3c2f rectification..
    .
    Para │ │ │ -000d4280: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    K │ │ │ -000d42a0: 2d20 4361 6d65 7261 2069 6e74 7269 6e73 - Camera intrins │ │ │ -000d42b0: 6963 206d 6174 7269 7820 5c28 6361 6d65 ic matrix \(came │ │ │ -000d42c0: 7261 6d61 7472 6978 7b4b 7d5c 292e 3c2f ramatrix{K}\)..
    D< │ │ │ -000d42e0: 2f63 6f64 653e 202d 2049 6e70 7574 2076 /code> - Input v │ │ │ -000d42f0: 6563 746f 7220 6f66 2064 6973 746f 7274 ector of distort │ │ │ -000d4300: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ -000d4310: 205c 285c 6469 7374 636f 6566 6673 6669 \(\distcoeffsfi │ │ │ -000d4320: 7368 6579 655c 292e 3c2f 6464 3e0a 3c64 sheye\).
    .image_si │ │ │ -000d4340: 7a65 3c2f 636f 6465 3e20 2d20 5369 7a65 ze - Size │ │ │ -000d4350: 206f 6620 7468 6520 696d 6167 653c 2f64 of the image.
    R - Rectific │ │ │ -000d4380: 6174 696f 6e20 7472 616e 7366 6f72 6d61 ation transforma │ │ │ -000d4390: 7469 6f6e 2069 6e20 7468 6520 6f62 6a65 tion in the obje │ │ │ -000d43a0: 6374 2073 7061 6365 3a20 3378 3320 312d ct space: 3x3 1- │ │ │ -000d43b0: 6368 616e 6e65 6c2c 206f 7220 7665 6374 channel, or vect │ │ │ -000d43c0: 6f72 3a20 3378 312f 3178 330a 312d 6368 or: 3x1/1x3.1-ch │ │ │ -000d43d0: 616e 6e65 6c20 6f72 2031 7831 2033 2d63 annel or 1x1 3-c │ │ │ -000d43e0: 6861 6e6e 656c 3c2f 6464 3e0a 3c64 643e hannel
    .
    │ │ │ -000d43f0: 3c63 6f64 653e 503c 2f63 6f64 653e 202d P - │ │ │ -000d4400: 204e 6577 2063 616d 6572 6120 696e 7472 New camera intr │ │ │ -000d4410: 696e 7369 6320 6d61 7472 6978 2028 3378 insic matrix (3x │ │ │ -000d4420: 3329 206f 7220 6e65 7720 7072 6f6a 6563 3) or new projec │ │ │ -000d4430: 7469 6f6e 206d 6174 7269 7820 2833 7834 tion matrix (3x4 │ │ │ -000d4440: 290a 6c65 6e67 7468 2e20 4261 6c61 6e63 ).length. Balanc │ │ │ -000d4450: 6520 6973 2069 6e20 7261 6e67 6520 6f66 e is in range of │ │ │ -000d4460: 205b 302c 2031 5d2e 3c2f 6464 3e0a 3c2f [0, 1].
    ..
    ..
  • .
  • │ │ │ -000d4490: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    fisheye_so │ │ │ -000d4570: 6c76 6550 6e50 3c2f 6833 3e0a 3c64 6976 lvePnP

    .
    .
    public static< │ │ │ -000d45e0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> boolean fisheye_sol │ │ │ -000d4640: 7665 506e 503c 2f73 7061 6e3e 3c77 6272 vePnP(Mat&n │ │ │ -000d46b0: 6273 703b 6f62 6a65 6374 506f 696e 7473 bsp;objectPoints │ │ │ -000d46c0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000d4700: 6174 3c2f 613e 266e 6273 703b 696d 6167 at imag │ │ │ -000d4710: 6550 6f69 6e74 732c 0a20 3c61 2068 7265 ePoints,. Mat&nb │ │ │ -000d4760: 7370 3b63 616d 6572 614d 6174 7269 782c sp;cameraMatrix, │ │ │ -000d4770: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000d47b0: 743c 2f61 3e26 6e62 7370 3b64 6973 7443 t distC │ │ │ -000d47c0: 6f65 6666 732c 0a20 3c61 2068 7265 663d oeffs,. Mat  │ │ │ -000d4810: 3b72 7665 632c 0a20 3c61 2068 7265 663d ;rvec,. Mat  │ │ │ -000d4860: 3b74 7665 632c 0a20 626f 6f6c 6561 6e26 ;tvec,. boolean& │ │ │ -000d4870: 6e62 7370 3b75 7365 4578 7472 696e 7369 nbsp;useExtrinsi │ │ │ -000d4880: 6347 7565 7373 2c0a 2069 6e74 266e 6273 cGuess,. int&nbs │ │ │ -000d4890: 703b 666c 6167 732c 0a20 3c61 2068 7265 p;flags,. T │ │ │ -000d48e0: 6572 6d43 7269 7465 7269 613c 2f61 3e26 ermCriteria& │ │ │ -000d48f0: 6e62 7370 3b63 7269 7465 7269 6129 3c2f nbsp;criteria)
    .
    F │ │ │ -000d4920: 696e 6473 2061 6e20 6f62 6a65 6374 2070 inds an object p │ │ │ -000d4930: 6f73 6520 6672 6f6d 2033 442d 3244 2070 ose from 3D-2D p │ │ │ -000d4940: 6f69 6e74 2063 6f72 7265 7370 6f6e 6465 oint corresponde │ │ │ -000d4950: 6e63 6573 2066 6f72 2066 6973 6865 7965 nces for fisheye │ │ │ -000d4960: 2063 616d 6572 6120 6d6f 6465 6c2e 3c2f camera model..
    .
    Para │ │ │ -000d4990: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    objectPoi │ │ │ -000d49b0: 6e74 733c 2f63 6f64 653e 202d 2041 7272 nts - Arr │ │ │ -000d49c0: 6179 206f 6620 6f62 6a65 6374 2070 6f69 ay of object poi │ │ │ -000d49d0: 6e74 7320 696e 2074 6865 206f 626a 6563 nts in the objec │ │ │ -000d49e0: 7420 636f 6f72 6469 6e61 7465 2073 7061 t coordinate spa │ │ │ -000d49f0: 6365 2c20 4e78 3320 312d 6368 616e 6e65 ce, Nx3 1-channe │ │ │ -000d4a00: 6c20 6f72 0a31 784e 2f4e 7831 2033 2d63 l or.1xN/Nx1 3-c │ │ │ -000d4a10: 6861 6e6e 656c 2c20 7768 6572 6520 4e20 hannel, where N │ │ │ -000d4a20: 6973 2074 6865 206e 756d 6265 7220 6f66 is the number of │ │ │ -000d4a30: 2070 6f69 6e74 732e 2076 6563 746f 7226 points. vector& │ │ │ -000d4a40: 6c74 3b50 6f69 6e74 3364 2667 743b 2063 lt;Point3d> c │ │ │ -000d4a50: 616e 2061 6c73 6f20 6265 2070 6173 7365 an also be passe │ │ │ -000d4a60: 6420 6865 7265 2e3c 2f64 643e 0a3c 6464 d here.
    .
    imagePoin │ │ │ -000d4a80: 7473 3c2f 636f 6465 3e20 2d20 4172 7261 ts - Arra │ │ │ -000d4a90: 7920 6f66 2063 6f72 7265 7370 6f6e 6469 y of correspondi │ │ │ -000d4aa0: 6e67 2069 6d61 6765 2070 6f69 6e74 732c ng image points, │ │ │ -000d4ab0: 204e 7832 2031 2d63 6861 6e6e 656c 206f Nx2 1-channel o │ │ │ -000d4ac0: 7220 3178 4e2f 4e78 3120 322d 6368 616e r 1xN/Nx1 2-chan │ │ │ -000d4ad0: 6e65 6c2c 0a77 6865 7265 204e 2069 7320 nel,.where N is │ │ │ -000d4ae0: 7468 6520 6e75 6d62 6572 206f 6620 706f the number of po │ │ │ -000d4af0: 696e 7473 2e20 7665 6374 6f72 266c 743b ints. vector< │ │ │ -000d4b00: 506f 696e 7432 6426 6774 3b20 6361 6e20 Point2d> can │ │ │ -000d4b10: 616c 736f 2062 6520 7061 7373 6564 2068 also be passed h │ │ │ -000d4b20: 6572 652e 3c2f 6464 3e0a 3c64 643e 3c63 ere.
    .
    cameraMatrix │ │ │ -000d4b40: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ -000d4b50: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ -000d4b60: 206d 6174 7269 7820 5c28 5c63 616d 6572 matrix \(\camer │ │ │ -000d4b70: 616d 6174 7269 787b 417d 5c29 202e 3c2f amatrix{A}\) ..
    di │ │ │ -000d4b90: 7374 436f 6566 6673 3c2f 636f 6465 3e20 stCoeffs │ │ │ -000d4ba0: 2d20 496e 7075 7420 7665 6374 6f72 206f - Input vector o │ │ │ -000d4bb0: 6620 6469 7374 6f72 7469 6f6e 2063 6f65 f distortion coe │ │ │ -000d4bc0: 6666 6963 6965 6e74 7320 2834 7831 2f31 fficients (4x1/1 │ │ │ -000d4bd0: 7834 292e 3c2f 6464 3e0a 3c64 643e 3c63 x4).
    .
    rvec │ │ │ -000d4bf0: 2d20 4f75 7470 7574 2072 6f74 6174 696f - Output rotatio │ │ │ -000d4c00: 6e20 7665 6374 6f72 2028 7365 6520 5245 n vector (see RE │ │ │ -000d4c10: 463a 2052 6f64 7269 6775 6573 2029 2074 F: Rodrigues ) t │ │ │ -000d4c20: 6861 742c 2074 6f67 6574 6865 7220 7769 hat, together wi │ │ │ -000d4c30: 7468 2074 7665 632c 2062 7269 6e67 7320 th tvec, brings │ │ │ -000d4c40: 706f 696e 7473 2066 726f 6d0a 7468 6520 points from.the │ │ │ -000d4c50: 6d6f 6465 6c20 636f 6f72 6469 6e61 7465 model coordinate │ │ │ -000d4c60: 2073 7973 7465 6d20 746f 2074 6865 2063 system to the c │ │ │ -000d4c70: 616d 6572 6120 636f 6f72 6469 6e61 7465 amera coordinate │ │ │ -000d4c80: 2073 7973 7465 6d2e 3c2f 6464 3e0a 3c64 system.
    .tvec - Output tra │ │ │ -000d4cb0: 6e73 6c61 7469 6f6e 2076 6563 746f 722e nslation vector. │ │ │ -000d4cc0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e .
    │ │ │ -000d4cd0: 7573 6545 7874 7269 6e73 6963 4775 6573 useExtrinsicGues │ │ │ -000d4ce0: 733c 2f63 6f64 653e 202d 2050 6172 616d s - Param │ │ │ -000d4cf0: 6574 6572 2075 7365 6420 666f 7220 2353 eter used for #S │ │ │ -000d4d00: 4f4c 5645 504e 505f 4954 4552 4154 4956 OLVEPNP_ITERATIV │ │ │ -000d4d10: 452e 2049 6620 7472 7565 2028 3129 2c20 E. If true (1), │ │ │ -000d4d20: 7468 6520 6675 6e63 7469 6f6e 2075 7365 the function use │ │ │ -000d4d30: 730a 7468 6520 7072 6f76 6964 6564 2072 s.the provided r │ │ │ -000d4d40: 7665 6320 616e 6420 7476 6563 2076 616c vec and tvec val │ │ │ -000d4d50: 7565 7320 6173 2069 6e69 7469 616c 2061 ues as initial a │ │ │ -000d4d60: 7070 726f 7869 6d61 7469 6f6e 7320 6f66 pproximations of │ │ │ -000d4d70: 2074 6865 2072 6f74 6174 696f 6e20 616e the rotation an │ │ │ -000d4d80: 6420 7472 616e 736c 6174 696f 6e0a 7665 d translation.ve │ │ │ -000d4d90: 6374 6f72 732c 2072 6573 7065 6374 6976 ctors, respectiv │ │ │ -000d4da0: 656c 792c 2061 6e64 2066 7572 7468 6572 ely, and further │ │ │ -000d4db0: 206f 7074 696d 697a 6573 2074 6865 6d2e optimizes them. │ │ │ -000d4dc0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000d4dd0: 666c 6167 733c 2f63 6f64 653e 202d 204d flags - M │ │ │ -000d4de0: 6574 686f 6420 666f 7220 736f 6c76 696e ethod for solvin │ │ │ -000d4df0: 6720 6120 506e 5020 7072 6f62 6c65 6d3a g a PnP problem: │ │ │ -000d4e00: 2073 6565 2052 4546 3a20 6361 6c69 6233 see REF: calib3 │ │ │ -000d4e10: 645f 736f 6c76 6550 6e50 5f66 6c61 6773 d_solvePnP_flags │ │ │ -000d4e20: 0a54 6869 7320 6675 6e63 7469 6f6e 2072 .This function r │ │ │ -000d4e30: 6574 7572 6e73 2074 6865 2072 6f74 6174 eturns the rotat │ │ │ -000d4e40: 696f 6e20 616e 6420 7468 6520 7472 616e ion and the tran │ │ │ -000d4e50: 736c 6174 696f 6e20 7665 6374 6f72 7320 slation vectors │ │ │ -000d4e60: 7468 6174 2074 7261 6e73 666f 726d 2061 that transform a │ │ │ -000d4e70: 2033 4420 706f 696e 7420 6578 7072 6573 3D point expres │ │ │ -000d4e80: 7365 6420 696e 2074 6865 206f 626a 6563 sed in the objec │ │ │ -000d4e90: 740a 636f 6f72 6469 6e61 7465 2066 7261 t.coordinate fra │ │ │ -000d4ea0: 6d65 2074 6f20 7468 6520 6361 6d65 7261 me to the camera │ │ │ -000d4eb0: 2063 6f6f 7264 696e 6174 6520 6672 616d coordinate fram │ │ │ -000d4ec0: 652c 2075 7369 6e67 2064 6966 6665 7265 e, using differe │ │ │ -000d4ed0: 6e74 206d 6574 686f 6473 3a0a 3c75 6c3e nt methods:.
      │ │ │ -000d4ee0: 0a20 203c 6c69 3e0a 2050 3350 206d 6574 .
    • . P3P met │ │ │ -000d4ef0: 686f 6473 2028 5245 463a 2053 4f4c 5645 hods (REF: SOLVE │ │ │ -000d4f00: 504e 505f 5033 502c 2052 4546 3a20 534f PNP_P3P, REF: SO │ │ │ -000d4f10: 4c56 4550 4e50 5f41 5033 5029 3a20 6e65 LVEPNP_AP3P): ne │ │ │ -000d4f20: 6564 2034 2069 6e70 7574 2070 6f69 6e74 ed 4 input point │ │ │ -000d4f30: 7320 746f 2072 6574 7572 6e20 6120 756e s to return a un │ │ │ -000d4f40: 6971 7565 2073 6f6c 7574 696f 6e2e 0a20 ique solution.. │ │ │ -000d4f50: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2052
    • .
    • . R │ │ │ -000d4f60: 4546 3a20 534f 4c56 4550 4e50 5f49 5050 EF: SOLVEPNP_IPP │ │ │ -000d4f70: 4520 496e 7075 7420 706f 696e 7473 206d E Input points m │ │ │ -000d4f80: 7573 7420 6265 2026 6774 3b3d 2034 2061 ust be >= 4 a │ │ │ -000d4f90: 6e64 206f 626a 6563 7420 706f 696e 7473 nd object points │ │ │ -000d4fa0: 206d 7573 7420 6265 2063 6f70 6c61 6e61 must be coplana │ │ │ -000d4fb0: 722e 0a20 203c 2f6c 693e 0a20 203c 6c69 r..
    • .
    • . REF: SOLVEPNP │ │ │ -000d4fd0: 5f49 5050 455f 5351 5541 5245 2053 7065 _IPPE_SQUARE Spe │ │ │ -000d4fe0: 6369 616c 2063 6173 6520 7375 6974 6162 cial case suitab │ │ │ -000d4ff0: 6c65 2066 6f72 206d 6172 6b65 7220 706f le for marker po │ │ │ -000d5000: 7365 2065 7374 696d 6174 696f 6e2e 0a4e se estimation..N │ │ │ -000d5010: 756d 6265 7220 6f66 2069 6e70 7574 2070 umber of input p │ │ │ -000d5020: 6f69 6e74 7320 6d75 7374 2062 6520 342e oints must be 4. │ │ │ -000d5030: 204f 626a 6563 7420 706f 696e 7473 206d Object points m │ │ │ -000d5040: 7573 7420 6265 2064 6566 696e 6564 2069 ust be defined i │ │ │ -000d5050: 6e20 7468 6520 666f 6c6c 6f77 696e 6720 n the following │ │ │ -000d5060: 6f72 6465 723a 0a20 203c 2f6c 693e 0a20 order:.
    • . │ │ │ -000d5070: 203c 6c69 3e0a 2070 6f69 6e74 2030 3a20
    • . point 0: │ │ │ -000d5080: 5b2d 7371 7561 7265 4c65 6e67 7468 202f [-squareLength / │ │ │ -000d5090: 2032 2c20 2073 7175 6172 654c 656e 6774 2, squareLengt │ │ │ -000d50a0: 6820 2f20 322c 2030 5d0a 2020 3c2f 6c69 h / 2, 0].
    • .
    • . point │ │ │ -000d50c0: 313a 205b 2073 7175 6172 654c 656e 6774 1: [ squareLengt │ │ │ -000d50d0: 6820 2f20 322c 2020 7371 7561 7265 4c65 h / 2, squareLe │ │ │ -000d50e0: 6e67 7468 202f 2032 2c20 305d 0a20 203c ngth / 2, 0]. < │ │ │ -000d50f0: 2f6c 693e 0a20 203c 6c69 3e0a 2070 6f69 /li>.
    • . poi │ │ │ -000d5100: 6e74 2032 3a20 5b20 7371 7561 7265 4c65 nt 2: [ squareLe │ │ │ -000d5110: 6e67 7468 202f 2032 2c20 2d73 7175 6172 ngth / 2, -squar │ │ │ -000d5120: 654c 656e 6774 6820 2f20 322c 2030 5d0a eLength / 2, 0]. │ │ │ -000d5130: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ -000d5140: 706f 696e 7420 333a 205b 2d73 7175 6172 point 3: [-squar │ │ │ -000d5150: 654c 656e 6774 6820 2f20 322c 202d 7371 eLength / 2, -sq │ │ │ -000d5160: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ -000d5170: 305d 0a20 203c 2f6c 693e 0a20 203c 6c69 0].
    • .
    • . for all the o │ │ │ -000d5190: 7468 6572 2066 6c61 6773 2c20 6e75 6d62 ther flags, numb │ │ │ -000d51a0: 6572 206f 6620 696e 7075 7420 706f 696e er of input poin │ │ │ -000d51b0: 7473 206d 7573 7420 6265 2026 6774 3b3d ts must be >= │ │ │ -000d51c0: 2034 2061 6e64 206f 626a 6563 7420 706f 4 and object po │ │ │ -000d51d0: 696e 7473 2063 616e 2062 6520 696e 2061 ints can be in a │ │ │ -000d51e0: 6e79 2063 6f6e 6669 6775 7261 7469 6f6e ny configuration │ │ │ -000d51f0: 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c ..
    • .
    < │ │ │ -000d5200: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ -000d5210: 7269 7465 7269 613c 2f63 6f64 653e 202d riteria - │ │ │ -000d5220: 2054 6572 6d69 6e61 7469 6f6e 2063 7269 Termination cri │ │ │ -000d5230: 7465 7269 6120 666f 7220 696e 7465 726e teria for intern │ │ │ -000d5240: 616c 2075 6e64 6973 746f 7274 506f 696e al undistortPoin │ │ │ -000d5250: 7473 2063 616c 6c2e 0a54 6865 2066 756e ts call..The fun │ │ │ -000d5260: 6374 696f 6e20 696e 7465 726e 616c 6c79 ction internally │ │ │ -000d5270: 2075 6e64 6973 746f 7274 7320 706f 696e undistorts poin │ │ │ -000d5280: 7473 2077 6974 6820 5245 463a 2075 6e64 ts with REF: und │ │ │ -000d5290: 6973 746f 7274 506f 696e 7473 2061 6e64 istortPoints and │ │ │ -000d52a0: 2063 616c 6c20 5245 463a 2063 763a 3a73 call REF: cv::s │ │ │ -000d52b0: 6f6c 7665 506e 502c 0a74 6875 7320 7468 olvePnP,.thus th │ │ │ -000d52c0: 6520 696e 7075 7420 6172 6520 7665 7279 e input are very │ │ │ -000d52d0: 2073 696d 696c 6172 2e20 4368 6563 6b20 similar. Check │ │ │ -000d52e0: 7468 6572 6520 616e 6420 5065 7273 7065 there and Perspe │ │ │ -000d52f0: 6374 6976 652d 6e2d 506f 696e 7473 2069 ctive-n-Points i │ │ │ -000d5300: 7320 6465 7363 7269 6265 6420 696e 2052 s described in R │ │ │ -000d5310: 4546 3a20 6361 6c69 6233 645f 736f 6c76 EF: calib3d_solv │ │ │ -000d5320: 6550 6e50 0a66 6f72 206d 6f72 6520 696e ePnP.for more in │ │ │ -000d5330: 666f 726d 6174 696f 6e2e 3c2f 6464 3e0a formation.
    . │ │ │ -000d5340: 3c64 743e 5265 7475 726e 733a 3c2f 6474
    Returns:
    .
    automatica │ │ │ -000d5360: 6c6c 7920 6765 6e65 7261 7465 643c 2f64 lly generated.
    .
    . │ │ │ -000d5380: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e
    .
  • │ │ │ -000d5390: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    fi │ │ │ -000d5450: 7368 6579 655f 736f 6c76 6550 6e50 3c2f sheye_solvePnP.
    .
    public │ │ │ -000d54c0: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ -000d54d0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;bo │ │ │ -000d54f0: 6f6c 6561 6e3c 2f73 7061 6e3e 266e 6273 olean&nbs │ │ │ -000d5500: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;fis │ │ │ -000d5520: 6865 7965 5f73 6f6c 7665 506e 503c 2f73 heye_solvePnP(M │ │ │ -000d5590: 6174 3c2f 613e 266e 6273 703b 6f62 6a65 at obje │ │ │ -000d55a0: 6374 506f 696e 7473 2c0a 203c 6120 6872 ctPoints,. Mat&n │ │ │ -000d55f0: 6273 703b 696d 6167 6550 6f69 6e74 732c bsp;imagePoints, │ │ │ -000d5600: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000d5640: 743c 2f61 3e26 6e62 7370 3b63 616d 6572 t camer │ │ │ -000d5650: 614d 6174 7269 782c 0a20 3c61 2068 7265 aMatrix,. Mat&nb │ │ │ -000d56a0: 7370 3b64 6973 7443 6f65 6666 732c 0a20 sp;distCoeffs,. │ │ │ -000d56b0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000d56f0: 2f61 3e26 6e62 7370 3b72 7665 632c 0a20 /a> rvec,. │ │ │ -000d5700: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000d5740: 2f61 3e26 6e62 7370 3b74 7665 632c 0a20 /a> tvec,. │ │ │ -000d5750: 626f 6f6c 6561 6e26 6e62 7370 3b75 7365 boolean use │ │ │ -000d5760: 4578 7472 696e 7369 6347 7565 7373 2c0a ExtrinsicGuess,. │ │ │ -000d5770: 2069 6e74 266e 6273 703b 666c 6167 7329 int flags) │ │ │ -000d5780: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Finds an object │ │ │ -000d57b0: 2070 6f73 6520 6672 6f6d 2033 442d 3244 pose from 3D-2D │ │ │ -000d57c0: 2070 6f69 6e74 2063 6f72 7265 7370 6f6e point correspon │ │ │ -000d57d0: 6465 6e63 6573 2066 6f72 2066 6973 6865 dences for fishe │ │ │ -000d57e0: 7965 2063 616d 6572 6120 6d6f 6465 6c2e ye camera model. │ │ │ -000d57f0: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -000d5810: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000d5820: 6464 3e3c 636f 6465 3e6f 626a 6563 7450 dd>objectP │ │ │ -000d5830: 6f69 6e74 733c 2f63 6f64 653e 202d 2041 oints - A │ │ │ -000d5840: 7272 6179 206f 6620 6f62 6a65 6374 2070 rray of object p │ │ │ -000d5850: 6f69 6e74 7320 696e 2074 6865 206f 626a oints in the obj │ │ │ -000d5860: 6563 7420 636f 6f72 6469 6e61 7465 2073 ect coordinate s │ │ │ -000d5870: 7061 6365 2c20 4e78 3320 312d 6368 616e pace, Nx3 1-chan │ │ │ -000d5880: 6e65 6c20 6f72 0a31 784e 2f4e 7831 2033 nel or.1xN/Nx1 3 │ │ │ -000d5890: 2d63 6861 6e6e 656c 2c20 7768 6572 6520 -channel, where │ │ │ -000d58a0: 4e20 6973 2074 6865 206e 756d 6265 7220 N is the number │ │ │ -000d58b0: 6f66 2070 6f69 6e74 732e 2076 6563 746f of points. vecto │ │ │ -000d58c0: 7226 6c74 3b50 6f69 6e74 3364 2667 743b r<Point3d> │ │ │ -000d58d0: 2063 616e 2061 6c73 6f20 6265 2070 6173 can also be pas │ │ │ -000d58e0: 7365 6420 6865 7265 2e3c 2f64 643e 0a3c sed here..< │ │ │ -000d58f0: 6464 3e3c 636f 6465 3e69 6d61 6765 506f dd>imagePo │ │ │ -000d5900: 696e 7473 3c2f 636f 6465 3e20 2d20 4172 ints - Ar │ │ │ -000d5910: 7261 7920 6f66 2063 6f72 7265 7370 6f6e ray of correspon │ │ │ -000d5920: 6469 6e67 2069 6d61 6765 2070 6f69 6e74 ding image point │ │ │ -000d5930: 732c 204e 7832 2031 2d63 6861 6e6e 656c s, Nx2 1-channel │ │ │ -000d5940: 206f 7220 3178 4e2f 4e78 3120 322d 6368 or 1xN/Nx1 2-ch │ │ │ -000d5950: 616e 6e65 6c2c 0a77 6865 7265 204e 2069 annel,.where N i │ │ │ -000d5960: 7320 7468 6520 6e75 6d62 6572 206f 6620 s the number of │ │ │ -000d5970: 706f 696e 7473 2e20 7665 6374 6f72 266c points. vector&l │ │ │ -000d5980: 743b 506f 696e 7432 6426 6774 3b20 6361 t;Point2d> ca │ │ │ -000d5990: 6e20 616c 736f 2062 6520 7061 7373 6564 n also be passed │ │ │ -000d59a0: 2068 6572 652e 3c2f 6464 3e0a 3c64 643e here..
    │ │ │ -000d59b0: 3c63 6f64 653e 6361 6d65 7261 4d61 7472 cameraMatr │ │ │ -000d59c0: 6978 3c2f 636f 6465 3e20 2d20 496e 7075 ix - Inpu │ │ │ -000d59d0: 7420 6361 6d65 7261 2069 6e74 7269 6e73 t camera intrins │ │ │ -000d59e0: 6963 206d 6174 7269 7820 5c28 5c63 616d ic matrix \(\cam │ │ │ -000d59f0: 6572 616d 6174 7269 787b 417d 5c29 202e eramatrix{A}\) . │ │ │ -000d5a00: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000d5a10: 6469 7374 436f 6566 6673 3c2f 636f 6465 distCoeffs - Input vector │ │ │ -000d5a30: 206f 6620 6469 7374 6f72 7469 6f6e 2063 of distortion c │ │ │ -000d5a40: 6f65 6666 6963 6965 6e74 7320 2834 7831 oefficients (4x1 │ │ │ -000d5a50: 2f31 7834 292e 3c2f 6464 3e0a 3c64 643e /1x4).
    .
    │ │ │ -000d5a60: 3c63 6f64 653e 7276 6563 3c2f 636f 6465 rvec - Output rotat │ │ │ -000d5a80: 696f 6e20 7665 6374 6f72 2028 7365 6520 ion vector (see │ │ │ -000d5a90: 5245 463a 2052 6f64 7269 6775 6573 2029 REF: Rodrigues ) │ │ │ -000d5aa0: 2074 6861 742c 2074 6f67 6574 6865 7220 that, together │ │ │ -000d5ab0: 7769 7468 2074 7665 632c 2062 7269 6e67 with tvec, bring │ │ │ -000d5ac0: 7320 706f 696e 7473 2066 726f 6d0a 7468 s points from.th │ │ │ -000d5ad0: 6520 6d6f 6465 6c20 636f 6f72 6469 6e61 e model coordina │ │ │ -000d5ae0: 7465 2073 7973 7465 6d20 746f 2074 6865 te system to the │ │ │ -000d5af0: 2063 616d 6572 6120 636f 6f72 6469 6e61 camera coordina │ │ │ -000d5b00: 7465 2073 7973 7465 6d2e 3c2f 6464 3e0a te system.
    . │ │ │ -000d5b10: 3c64 643e 3c63 6f64 653e 7476 6563 3c2f
    tvec - Output t │ │ │ -000d5b30: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ -000d5b40: 722e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 r.
    .
    useExtrinsicGu │ │ │ -000d5b60: 6573 733c 2f63 6f64 653e 202d 2050 6172 ess - Par │ │ │ -000d5b70: 616d 6574 6572 2075 7365 6420 666f 7220 ameter used for │ │ │ -000d5b80: 2353 4f4c 5645 504e 505f 4954 4552 4154 #SOLVEPNP_ITERAT │ │ │ -000d5b90: 4956 452e 2049 6620 7472 7565 2028 3129 IVE. If true (1) │ │ │ -000d5ba0: 2c20 7468 6520 6675 6e63 7469 6f6e 2075 , the function u │ │ │ -000d5bb0: 7365 730a 7468 6520 7072 6f76 6964 6564 ses.the provided │ │ │ -000d5bc0: 2072 7665 6320 616e 6420 7476 6563 2076 rvec and tvec v │ │ │ -000d5bd0: 616c 7565 7320 6173 2069 6e69 7469 616c alues as initial │ │ │ -000d5be0: 2061 7070 726f 7869 6d61 7469 6f6e 7320 approximations │ │ │ -000d5bf0: 6f66 2074 6865 2072 6f74 6174 696f 6e20 of the rotation │ │ │ -000d5c00: 616e 6420 7472 616e 736c 6174 696f 6e0a and translation. │ │ │ -000d5c10: 7665 6374 6f72 732c 2072 6573 7065 6374 vectors, respect │ │ │ -000d5c20: 6976 656c 792c 2061 6e64 2066 7572 7468 ively, and furth │ │ │ -000d5c30: 6572 206f 7074 696d 697a 6573 2074 6865 er optimizes the │ │ │ -000d5c40: 6d2e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 m.
    .
    flags - │ │ │ -000d5c60: 204d 6574 686f 6420 666f 7220 736f 6c76 Method for solv │ │ │ -000d5c70: 696e 6720 6120 506e 5020 7072 6f62 6c65 ing a PnP proble │ │ │ -000d5c80: 6d3a 2073 6565 2052 4546 3a20 6361 6c69 m: see REF: cali │ │ │ -000d5c90: 6233 645f 736f 6c76 6550 6e50 5f66 6c61 b3d_solvePnP_fla │ │ │ -000d5ca0: 6773 0a54 6869 7320 6675 6e63 7469 6f6e gs.This function │ │ │ -000d5cb0: 2072 6574 7572 6e73 2074 6865 2072 6f74 returns the rot │ │ │ -000d5cc0: 6174 696f 6e20 616e 6420 7468 6520 7472 ation and the tr │ │ │ -000d5cd0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ -000d5ce0: 7320 7468 6174 2074 7261 6e73 666f 726d s that transform │ │ │ -000d5cf0: 2061 2033 4420 706f 696e 7420 6578 7072 a 3D point expr │ │ │ -000d5d00: 6573 7365 6420 696e 2074 6865 206f 626a essed in the obj │ │ │ -000d5d10: 6563 740a 636f 6f72 6469 6e61 7465 2066 ect.coordinate f │ │ │ -000d5d20: 7261 6d65 2074 6f20 7468 6520 6361 6d65 rame to the came │ │ │ -000d5d30: 7261 2063 6f6f 7264 696e 6174 6520 6672 ra coordinate fr │ │ │ -000d5d40: 616d 652c 2075 7369 6e67 2064 6966 6665 ame, using diffe │ │ │ -000d5d50: 7265 6e74 206d 6574 686f 6473 3a0a 3c75 rent methods:..
  • . P3P m │ │ │ -000d5d70: 6574 686f 6473 2028 5245 463a 2053 4f4c ethods (REF: SOL │ │ │ -000d5d80: 5645 504e 505f 5033 502c 2052 4546 3a20 VEPNP_P3P, REF: │ │ │ -000d5d90: 534f 4c56 4550 4e50 5f41 5033 5029 3a20 SOLVEPNP_AP3P): │ │ │ -000d5da0: 6e65 6564 2034 2069 6e70 7574 2070 6f69 need 4 input poi │ │ │ -000d5db0: 6e74 7320 746f 2072 6574 7572 6e20 6120 nts to return a │ │ │ -000d5dc0: 756e 6971 7565 2073 6f6c 7574 696f 6e2e unique solution. │ │ │ -000d5dd0: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
  • .
  • . │ │ │ -000d5de0: 2052 4546 3a20 534f 4c56 4550 4e50 5f49 REF: SOLVEPNP_I │ │ │ -000d5df0: 5050 4520 496e 7075 7420 706f 696e 7473 PPE Input points │ │ │ -000d5e00: 206d 7573 7420 6265 2026 6774 3b3d 2034 must be >= 4 │ │ │ -000d5e10: 2061 6e64 206f 626a 6563 7420 706f 696e and object poin │ │ │ -000d5e20: 7473 206d 7573 7420 6265 2063 6f70 6c61 ts must be copla │ │ │ -000d5e30: 6e61 722e 0a20 203c 2f6c 693e 0a20 203c nar..
  • . < │ │ │ -000d5e40: 6c69 3e0a 2052 4546 3a20 534f 4c56 4550 li>. REF: SOLVEP │ │ │ -000d5e50: 4e50 5f49 5050 455f 5351 5541 5245 2053 NP_IPPE_SQUARE S │ │ │ -000d5e60: 7065 6369 616c 2063 6173 6520 7375 6974 pecial case suit │ │ │ -000d5e70: 6162 6c65 2066 6f72 206d 6172 6b65 7220 able for marker │ │ │ -000d5e80: 706f 7365 2065 7374 696d 6174 696f 6e2e pose estimation. │ │ │ -000d5e90: 0a4e 756d 6265 7220 6f66 2069 6e70 7574 .Number of input │ │ │ -000d5ea0: 2070 6f69 6e74 7320 6d75 7374 2062 6520 points must be │ │ │ -000d5eb0: 342e 204f 626a 6563 7420 706f 696e 7473 4. Object points │ │ │ -000d5ec0: 206d 7573 7420 6265 2064 6566 696e 6564 must be defined │ │ │ -000d5ed0: 2069 6e20 7468 6520 666f 6c6c 6f77 696e in the followin │ │ │ -000d5ee0: 6720 6f72 6465 723a 0a20 203c 2f6c 693e g order:.

  • │ │ │ -000d5ef0: 0a20 203c 6c69 3e0a 2070 6f69 6e74 2030 .
  • . point 0 │ │ │ -000d5f00: 3a20 5b2d 7371 7561 7265 4c65 6e67 7468 : [-squareLength │ │ │ -000d5f10: 202f 2032 2c20 2073 7175 6172 654c 656e / 2, squareLen │ │ │ -000d5f20: 6774 6820 2f20 322c 2030 5d0a 2020 3c2f gth / 2, 0]. .
  • . poin │ │ │ -000d5f40: 7420 313a 205b 2073 7175 6172 654c 656e t 1: [ squareLen │ │ │ -000d5f50: 6774 6820 2f20 322c 2020 7371 7561 7265 gth / 2, square │ │ │ -000d5f60: 4c65 6e67 7468 202f 2032 2c20 305d 0a20 Length / 2, 0]. │ │ │ -000d5f70: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2070
  • .
  • . p │ │ │ -000d5f80: 6f69 6e74 2032 3a20 5b20 7371 7561 7265 oint 2: [ square │ │ │ -000d5f90: 4c65 6e67 7468 202f 2032 2c20 2d73 7175 Length / 2, -squ │ │ │ -000d5fa0: 6172 654c 656e 6774 6820 2f20 322c 2030 areLength / 2, 0 │ │ │ -000d5fb0: 5d0a 2020 3c2f 6c69 3e0a 2020 3c6c 693e ].
  • .
  • │ │ │ -000d5fc0: 0a20 706f 696e 7420 333a 205b 2d73 7175 . point 3: [-squ │ │ │ -000d5fd0: 6172 654c 656e 6774 6820 2f20 322c 202d areLength / 2, - │ │ │ -000d5fe0: 7371 7561 7265 4c65 6e67 7468 202f 2032 squareLength / 2 │ │ │ -000d5ff0: 2c20 305d 0a20 203c 2f6c 693e 0a20 203c , 0].
  • . < │ │ │ -000d6000: 6c69 3e0a 2066 6f72 2061 6c6c 2074 6865 li>. for all the │ │ │ -000d6010: 206f 7468 6572 2066 6c61 6773 2c20 6e75 other flags, nu │ │ │ -000d6020: 6d62 6572 206f 6620 696e 7075 7420 706f mber of input po │ │ │ -000d6030: 696e 7473 206d 7573 7420 6265 2026 6774 ints must be > │ │ │ -000d6040: 3b3d 2034 2061 6e64 206f 626a 6563 7420 ;= 4 and object │ │ │ -000d6050: 706f 696e 7473 2063 616e 2062 6520 696e points can be in │ │ │ -000d6060: 2061 6e79 2063 6f6e 6669 6775 7261 7469 any configurati │ │ │ -000d6070: 6f6e 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c on.. ..The function i │ │ │ -000d6090: 6e74 6572 6e61 6c6c 7920 756e 6469 7374 nternally undist │ │ │ -000d60a0: 6f72 7473 2070 6f69 6e74 7320 7769 7468 orts points with │ │ │ -000d60b0: 2052 4546 3a20 756e 6469 7374 6f72 7450 REF: undistortP │ │ │ -000d60c0: 6f69 6e74 7320 616e 6420 6361 6c6c 2052 oints and call R │ │ │ -000d60d0: 4546 3a20 6376 3a3a 736f 6c76 6550 6e50 EF: cv::solvePnP │ │ │ -000d60e0: 2c0a 7468 7573 2074 6865 2069 6e70 7574 ,.thus the input │ │ │ -000d60f0: 2061 7265 2076 6572 7920 7369 6d69 6c61 are very simila │ │ │ -000d6100: 722e 2043 6865 636b 2074 6865 7265 2061 r. Check there a │ │ │ -000d6110: 6e64 2050 6572 7370 6563 7469 7665 2d6e nd Perspective-n │ │ │ -000d6120: 2d50 6f69 6e74 7320 6973 2064 6573 6372 -Points is descr │ │ │ -000d6130: 6962 6564 2069 6e20 5245 463a 2063 616c ibed in REF: cal │ │ │ -000d6140: 6962 3364 5f73 6f6c 7665 506e 500a 666f ib3d_solvePnP.fo │ │ │ -000d6150: 7220 6d6f 7265 2069 6e66 6f72 6d61 7469 r more informati │ │ │ -000d6160: 6f6e 2e3c 2f64 643e 0a3c 6474 3e52 6574 on..
    Ret │ │ │ -000d6170: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e61 urns:
    .
    a │ │ │ -000d6180: 7574 6f6d 6174 6963 616c 6c79 2067 656e utomatically gen │ │ │ -000d6190: 6572 6174 6564 3c2f 6464 3e0a 3c2f 646c erated
    .....
  • .< │ │ │ -000d61c0: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ -000d61d0: 6574 6169 6c22 2069 643d 2266 6973 6865 etail" id="fishe │ │ │ -000d61e0: 7965 5f73 6f6c 7665 506e 5028 6f72 672e ye_solvePnP(org. │ │ │ -000d61f0: 6f70 656e 6376 2e63 6f72 652e 4d61 742c opencv.core.Mat, │ │ │ -000d6200: 6f72 672e 6f70 656e 6376 2e63 6f72 652e org.opencv.core. │ │ │ -000d6210: 4d61 742c 6f72 672e 6f70 656e 6376 2e63 Mat,org.opencv.c │ │ │ -000d6220: 6f72 652e 4d61 742c 6f72 672e 6f70 656e ore.Mat,org.open │ │ │ -000d6230: 6376 2e63 6f72 652e 4d61 742c 6f72 672e cv.core.Mat,org. │ │ │ -000d6240: 6f70 656e 6376 2e63 6f72 652e 4d61 742c opencv.core.Mat, │ │ │ -000d6250: 6f72 672e 6f70 656e 6376 2e63 6f72 652e org.opencv.core. │ │ │ -000d6260: 4d61 742c 626f 6f6c 6561 6e29 223e 0a3c Mat,boolean)">.< │ │ │ -000d6270: 6833 3e66 6973 6865 7965 5f73 6f6c 7665 h3>fisheye_solve │ │ │ -000d6280: 506e 503c 2f68 333e 0a3c 6469 7620 636c PnP.
    .
    p │ │ │ -000d62e0: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static boolean fisheye_solveP │ │ │ -000d6350: 6e50 3c2f 7370 616e 3e3c 7762 723e 3c73 nP(Mat  │ │ │ -000d63c0: 3b6f 626a 6563 7450 6f69 6e74 732c 0a20 ;objectPoints,. │ │ │ -000d63d0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000d6410: 2f61 3e26 6e62 7370 3b69 6d61 6765 506f /a> imagePo │ │ │ -000d6420: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. Mat  │ │ │ -000d6470: 6361 6d65 7261 4d61 7472 6978 2c0a 203c cameraMatrix,. < │ │ │ -000d6480: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000d6490: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000d64a0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000d64b0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat distCoef │ │ │ -000d64d0: 6673 2c0a 203c 6120 6872 6566 3d22 2e2e fs,. Mat rv │ │ │ -000d6520: 6563 2c0a 203c 6120 6872 6566 3d22 2e2e ec,. Mat tv │ │ │ -000d6570: 6563 2c0a 2062 6f6f 6c65 616e 266e 6273 ec,. boolean&nbs │ │ │ -000d6580: 703b 7573 6545 7874 7269 6e73 6963 4775 p;useExtrinsicGu │ │ │ -000d6590: 6573 7329 3c2f 7370 616e 3e3c 2f64 6976 ess)
    .
    Finds an ob │ │ │ -000d65c0: 6a65 6374 2070 6f73 6520 6672 6f6d 2033 ject pose from 3 │ │ │ -000d65d0: 442d 3244 2070 6f69 6e74 2063 6f72 7265 D-2D point corre │ │ │ -000d65e0: 7370 6f6e 6465 6e63 6573 2066 6f72 2066 spondences for f │ │ │ -000d65f0: 6973 6865 7965 2063 616d 6572 6120 6d6f isheye camera mo │ │ │ -000d6600: 6465 6c2e 3c2f 6469 763e 0a3c 646c 2063 del.
    .
    .Parameters:.
    obj │ │ │ -000d6640: 6563 7450 6f69 6e74 733c 2f63 6f64 653e ectPoints │ │ │ -000d6650: 202d 2041 7272 6179 206f 6620 6f62 6a65 - Array of obje │ │ │ -000d6660: 6374 2070 6f69 6e74 7320 696e 2074 6865 ct points in the │ │ │ -000d6670: 206f 626a 6563 7420 636f 6f72 6469 6e61 object coordina │ │ │ -000d6680: 7465 2073 7061 6365 2c20 4e78 3320 312d te space, Nx3 1- │ │ │ -000d6690: 6368 616e 6e65 6c20 6f72 0a31 784e 2f4e channel or.1xN/N │ │ │ -000d66a0: 7831 2033 2d63 6861 6e6e 656c 2c20 7768 x1 3-channel, wh │ │ │ -000d66b0: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ -000d66c0: 6265 7220 6f66 2070 6f69 6e74 732e 2076 ber of points. v │ │ │ -000d66d0: 6563 746f 7226 6c74 3b50 6f69 6e74 3364 ector<Point3d │ │ │ -000d66e0: 2667 743b 2063 616e 2061 6c73 6f20 6265 > can also be │ │ │ -000d66f0: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    ima │ │ │ -000d6710: 6765 506f 696e 7473 3c2f 636f 6465 3e20 gePoints │ │ │ -000d6720: 2d20 4172 7261 7920 6f66 2063 6f72 7265 - Array of corre │ │ │ -000d6730: 7370 6f6e 6469 6e67 2069 6d61 6765 2070 sponding image p │ │ │ -000d6740: 6f69 6e74 732c 204e 7832 2031 2d63 6861 oints, Nx2 1-cha │ │ │ -000d6750: 6e6e 656c 206f 7220 3178 4e2f 4e78 3120 nnel or 1xN/Nx1 │ │ │ -000d6760: 322d 6368 616e 6e65 6c2c 0a77 6865 7265 2-channel,.where │ │ │ -000d6770: 204e 2069 7320 7468 6520 6e75 6d62 6572 N is the number │ │ │ -000d6780: 206f 6620 706f 696e 7473 2e20 7665 6374 of points. vect │ │ │ -000d6790: 6f72 266c 743b 506f 696e 7432 6426 6774 or<Point2d> │ │ │ -000d67a0: 3b20 6361 6e20 616c 736f 2062 6520 7061 ; can also be pa │ │ │ -000d67b0: 7373 6564 2068 6572 652e 3c2f 6464 3e0a ssed here.
    . │ │ │ -000d67c0: 3c64 643e 3c63 6f64 653e 6361 6d65 7261
    camera │ │ │ -000d67d0: 4d61 7472 6978 3c2f 636f 6465 3e20 2d20 Matrix - │ │ │ -000d67e0: 496e 7075 7420 6361 6d65 7261 2069 6e74 Input camera int │ │ │ -000d67f0: 7269 6e73 6963 206d 6174 7269 7820 5c28 rinsic matrix \( │ │ │ -000d6800: 5c63 616d 6572 616d 6174 7269 787b 417d \cameramatrix{A} │ │ │ -000d6810: 5c29 202e 3c2f 6464 3e0a 3c64 643e 3c63 \) .
    .
    distCoeffs - Input ve │ │ │ -000d6840: 6374 6f72 206f 6620 6469 7374 6f72 7469 ctor of distorti │ │ │ -000d6850: 6f6e 2063 6f65 6666 6963 6965 6e74 7320 on coefficients │ │ │ -000d6860: 2834 7831 2f31 7834 292e 3c2f 6464 3e0a (4x1/1x4).
    . │ │ │ -000d6870: 3c64 643e 3c63 6f64 653e 7276 6563 3c2f
    rvec - Output r │ │ │ -000d6890: 6f74 6174 696f 6e20 7665 6374 6f72 2028 otation vector ( │ │ │ -000d68a0: 7365 6520 5245 463a 2052 6f64 7269 6775 see REF: Rodrigu │ │ │ -000d68b0: 6573 2029 2074 6861 742c 2074 6f67 6574 es ) that, toget │ │ │ -000d68c0: 6865 7220 7769 7468 2074 7665 632c 2062 her with tvec, b │ │ │ -000d68d0: 7269 6e67 7320 706f 696e 7473 2066 726f rings points fro │ │ │ -000d68e0: 6d0a 7468 6520 6d6f 6465 6c20 636f 6f72 m.the model coor │ │ │ -000d68f0: 6469 6e61 7465 2073 7973 7465 6d20 746f dinate system to │ │ │ -000d6900: 2074 6865 2063 616d 6572 6120 636f 6f72 the camera coor │ │ │ -000d6910: 6469 6e61 7465 2073 7973 7465 6d2e 3c2f dinate system..
    tv │ │ │ -000d6930: 6563 3c2f 636f 6465 3e20 2d20 4f75 7470 ec - Outp │ │ │ -000d6940: 7574 2074 7261 6e73 6c61 7469 6f6e 2076 ut translation v │ │ │ -000d6950: 6563 746f 722e 3c2f 6464 3e0a 3c64 643e ector.
    .
    │ │ │ -000d6960: 3c63 6f64 653e 7573 6545 7874 7269 6e73 useExtrins │ │ │ -000d6970: 6963 4775 6573 733c 2f63 6f64 653e 202d icGuess - │ │ │ -000d6980: 2050 6172 616d 6574 6572 2075 7365 6420 Parameter used │ │ │ -000d6990: 666f 7220 2353 4f4c 5645 504e 505f 4954 for #SOLVEPNP_IT │ │ │ -000d69a0: 4552 4154 4956 452e 2049 6620 7472 7565 ERATIVE. If true │ │ │ -000d69b0: 2028 3129 2c20 7468 6520 6675 6e63 7469 (1), the functi │ │ │ -000d69c0: 6f6e 2075 7365 730a 7468 6520 7072 6f76 on uses.the prov │ │ │ -000d69d0: 6964 6564 2072 7665 6320 616e 6420 7476 ided rvec and tv │ │ │ -000d69e0: 6563 2076 616c 7565 7320 6173 2069 6e69 ec values as ini │ │ │ -000d69f0: 7469 616c 2061 7070 726f 7869 6d61 7469 tial approximati │ │ │ -000d6a00: 6f6e 7320 6f66 2074 6865 2072 6f74 6174 ons of the rotat │ │ │ -000d6a10: 696f 6e20 616e 6420 7472 616e 736c 6174 ion and translat │ │ │ -000d6a20: 696f 6e0a 7665 6374 6f72 732c 2072 6573 ion.vectors, res │ │ │ -000d6a30: 7065 6374 6976 656c 792c 2061 6e64 2066 pectively, and f │ │ │ -000d6a40: 7572 7468 6572 206f 7074 696d 697a 6573 urther optimizes │ │ │ -000d6a50: 2074 6865 6d2e 0a54 6869 7320 6675 6e63 them..This func │ │ │ -000d6a60: 7469 6f6e 2072 6574 7572 6e73 2074 6865 tion returns the │ │ │ -000d6a70: 2072 6f74 6174 696f 6e20 616e 6420 7468 rotation and th │ │ │ -000d6a80: 6520 7472 616e 736c 6174 696f 6e20 7665 e translation ve │ │ │ -000d6a90: 6374 6f72 7320 7468 6174 2074 7261 6e73 ctors that trans │ │ │ -000d6aa0: 666f 726d 2061 2033 4420 706f 696e 7420 form a 3D point │ │ │ -000d6ab0: 6578 7072 6573 7365 6420 696e 2074 6865 expressed in the │ │ │ -000d6ac0: 206f 626a 6563 740a 636f 6f72 6469 6e61 object.coordina │ │ │ -000d6ad0: 7465 2066 7261 6d65 2074 6f20 7468 6520 te frame to the │ │ │ -000d6ae0: 6361 6d65 7261 2063 6f6f 7264 696e 6174 camera coordinat │ │ │ -000d6af0: 6520 6672 616d 652c 2075 7369 6e67 2064 e frame, using d │ │ │ -000d6b00: 6966 6665 7265 6e74 206d 6574 686f 6473 ifferent methods │ │ │ -000d6b10: 3a0a 3c75 6c3e 0a20 203c 6c69 3e0a 2050 :.
      .
    • . P │ │ │ -000d6b20: 3350 206d 6574 686f 6473 2028 5245 463a 3P methods (REF: │ │ │ -000d6b30: 2053 4f4c 5645 504e 505f 5033 502c 2052 SOLVEPNP_P3P, R │ │ │ -000d6b40: 4546 3a20 534f 4c56 4550 4e50 5f41 5033 EF: SOLVEPNP_AP3 │ │ │ -000d6b50: 5029 3a20 6e65 6564 2034 2069 6e70 7574 P): need 4 input │ │ │ -000d6b60: 2070 6f69 6e74 7320 746f 2072 6574 7572 points to retur │ │ │ -000d6b70: 6e20 6120 756e 6971 7565 2073 6f6c 7574 n a unique solut │ │ │ -000d6b80: 696f 6e2e 0a20 203c 2f6c 693e 0a20 203c ion..
    • . < │ │ │ -000d6b90: 6c69 3e0a 2052 4546 3a20 534f 4c56 4550 li>. REF: SOLVEP │ │ │ -000d6ba0: 4e50 5f49 5050 4520 496e 7075 7420 706f NP_IPPE Input po │ │ │ -000d6bb0: 696e 7473 206d 7573 7420 6265 2026 6774 ints must be > │ │ │ -000d6bc0: 3b3d 2034 2061 6e64 206f 626a 6563 7420 ;= 4 and object │ │ │ -000d6bd0: 706f 696e 7473 206d 7573 7420 6265 2063 points must be c │ │ │ -000d6be0: 6f70 6c61 6e61 722e 0a20 203c 2f6c 693e oplanar.. │ │ │ -000d6bf0: 0a20 203c 6c69 3e0a 2052 4546 3a20 534f .
    • . REF: SO │ │ │ -000d6c00: 4c56 4550 4e50 5f49 5050 455f 5351 5541 LVEPNP_IPPE_SQUA │ │ │ -000d6c10: 5245 2053 7065 6369 616c 2063 6173 6520 RE Special case │ │ │ -000d6c20: 7375 6974 6162 6c65 2066 6f72 206d 6172 suitable for mar │ │ │ -000d6c30: 6b65 7220 706f 7365 2065 7374 696d 6174 ker pose estimat │ │ │ -000d6c40: 696f 6e2e 0a4e 756d 6265 7220 6f66 2069 ion..Number of i │ │ │ -000d6c50: 6e70 7574 2070 6f69 6e74 7320 6d75 7374 nput points must │ │ │ -000d6c60: 2062 6520 342e 204f 626a 6563 7420 706f be 4. Object po │ │ │ -000d6c70: 696e 7473 206d 7573 7420 6265 2064 6566 ints must be def │ │ │ -000d6c80: 696e 6564 2069 6e20 7468 6520 666f 6c6c ined in the foll │ │ │ -000d6c90: 6f77 696e 6720 6f72 6465 723a 0a20 203c owing order:. < │ │ │ -000d6ca0: 2f6c 693e 0a20 203c 6c69 3e0a 2070 6f69 /li>.
    • . poi │ │ │ -000d6cb0: 6e74 2030 3a20 5b2d 7371 7561 7265 4c65 nt 0: [-squareLe │ │ │ -000d6cc0: 6e67 7468 202f 2032 2c20 2073 7175 6172 ngth / 2, squar │ │ │ -000d6cd0: 654c 656e 6774 6820 2f20 322c 2030 5d0a eLength / 2, 0]. │ │ │ -000d6ce0: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ -000d6cf0: 706f 696e 7420 313a 205b 2073 7175 6172 point 1: [ squar │ │ │ -000d6d00: 654c 656e 6774 6820 2f20 322c 2020 7371 eLength / 2, sq │ │ │ -000d6d10: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ -000d6d20: 305d 0a20 203c 2f6c 693e 0a20 203c 6c69 0].
    • .
    • . point 2: [ sq │ │ │ -000d6d40: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ -000d6d50: 2d73 7175 6172 654c 656e 6774 6820 2f20 -squareLength / │ │ │ -000d6d60: 322c 2030 5d0a 2020 3c2f 6c69 3e0a 2020 2, 0].
    • . │ │ │ -000d6d70: 3c6c 693e 0a20 706f 696e 7420 333a 205b
    • . point 3: [ │ │ │ -000d6d80: 2d73 7175 6172 654c 656e 6774 6820 2f20 -squareLength / │ │ │ -000d6d90: 322c 202d 7371 7561 7265 4c65 6e67 7468 2, -squareLength │ │ │ -000d6da0: 202f 2032 2c20 305d 0a20 203c 2f6c 693e / 2, 0].
    • │ │ │ -000d6db0: 0a20 203c 6c69 3e0a 2066 6f72 2061 6c6c .
    • . for all │ │ │ -000d6dc0: 2074 6865 206f 7468 6572 2066 6c61 6773 the other flags │ │ │ -000d6dd0: 2c20 6e75 6d62 6572 206f 6620 696e 7075 , number of inpu │ │ │ -000d6de0: 7420 706f 696e 7473 206d 7573 7420 6265 t points must be │ │ │ -000d6df0: 2026 6774 3b3d 2034 2061 6e64 206f 626a >= 4 and obj │ │ │ -000d6e00: 6563 7420 706f 696e 7473 2063 616e 2062 ect points can b │ │ │ -000d6e10: 6520 696e 2061 6e79 2063 6f6e 6669 6775 e in any configu │ │ │ -000d6e20: 7261 7469 6f6e 2e0a 2020 3c2f 6c69 3e0a ration..
    • . │ │ │ -000d6e30: 3c2f 756c 3e0a 5468 6520 6675 6e63 7469
    .The functi │ │ │ -000d6e40: 6f6e 2069 6e74 6572 6e61 6c6c 7920 756e on internally un │ │ │ -000d6e50: 6469 7374 6f72 7473 2070 6f69 6e74 7320 distorts points │ │ │ -000d6e60: 7769 7468 2052 4546 3a20 756e 6469 7374 with REF: undist │ │ │ -000d6e70: 6f72 7450 6f69 6e74 7320 616e 6420 6361 ortPoints and ca │ │ │ -000d6e80: 6c6c 2052 4546 3a20 6376 3a3a 736f 6c76 ll REF: cv::solv │ │ │ -000d6e90: 6550 6e50 2c0a 7468 7573 2074 6865 2069 ePnP,.thus the i │ │ │ -000d6ea0: 6e70 7574 2061 7265 2076 6572 7920 7369 nput are very si │ │ │ -000d6eb0: 6d69 6c61 722e 2043 6865 636b 2074 6865 milar. Check the │ │ │ -000d6ec0: 7265 2061 6e64 2050 6572 7370 6563 7469 re and Perspecti │ │ │ -000d6ed0: 7665 2d6e 2d50 6f69 6e74 7320 6973 2064 ve-n-Points is d │ │ │ -000d6ee0: 6573 6372 6962 6564 2069 6e20 5245 463a escribed in REF: │ │ │ -000d6ef0: 2063 616c 6962 3364 5f73 6f6c 7665 506e calib3d_solvePn │ │ │ -000d6f00: 500a 666f 7220 6d6f 7265 2069 6e66 6f72 P.for more infor │ │ │ -000d6f10: 6d61 7469 6f6e 2e3c 2f64 643e 0a3c 6474 mation.
    .
    Returns:
    .< │ │ │ -000d6f30: 6464 3e61 7574 6f6d 6174 6963 616c 6c79 dd>automatically │ │ │ -000d6f40: 2067 656e 6572 6174 6564 3c2f 6464 3e0a generated. │ │ │ -000d6f50: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    ..
  • ..
    .

    f │ │ │ -000d7020: 6973 6865 7965 5f73 6f6c 7665 506e 503c isheye_solvePnP< │ │ │ -000d7030: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -000d7090: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -000d70a0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;b │ │ │ -000d70c0: 6f6f 6c65 616e 3c2f 7370 616e 3e26 6e62 oolean&nb │ │ │ -000d70d0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;fi │ │ │ -000d70f0: 7368 6579 655f 736f 6c76 6550 6e50 3c2f sheye_solvePnP( │ │ │ -000d7160: 4d61 743c 2f61 3e26 6e62 7370 3b6f 626a Mat obj │ │ │ -000d7170: 6563 7450 6f69 6e74 732c 0a20 3c61 2068 ectPoints,. Mat& │ │ │ -000d71c0: 6e62 7370 3b69 6d61 6765 506f 696e 7473 nbsp;imagePoints │ │ │ -000d71d0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000d7210: 6174 3c2f 613e 266e 6273 703b 6361 6d65 at came │ │ │ -000d7220: 7261 4d61 7472 6978 2c0a 203c 6120 6872 raMatrix,. Mat&n │ │ │ -000d7270: 6273 703b 6469 7374 436f 6566 6673 2c0a bsp;distCoeffs,. │ │ │ -000d7280: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000d72c0: 3c2f 613e 266e 6273 703b 7276 6563 2c0a  rvec,. │ │ │ -000d72d0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000d7310: 3c2f 613e 266e 6273 703b 7476 6563 293c  tvec)< │ │ │ -000d7320: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ -000d7340: 4669 6e64 7320 616e 206f 626a 6563 7420 Finds an object │ │ │ -000d7350: 706f 7365 2066 726f 6d20 3344 2d32 4420 pose from 3D-2D │ │ │ -000d7360: 706f 696e 7420 636f 7272 6573 706f 6e64 point correspond │ │ │ -000d7370: 656e 6365 7320 666f 7220 6669 7368 6579 ences for fishey │ │ │ -000d7380: 6520 6361 6d65 7261 206d 6f64 656c 2e3c e camera model.< │ │ │ -000d7390: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ -000d73b0: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .objectPo │ │ │ -000d73d0: 696e 7473 3c2f 636f 6465 3e20 2d20 4172 ints - Ar │ │ │ -000d73e0: 7261 7920 6f66 206f 626a 6563 7420 706f ray of object po │ │ │ -000d73f0: 696e 7473 2069 6e20 7468 6520 6f62 6a65 ints in the obje │ │ │ -000d7400: 6374 2063 6f6f 7264 696e 6174 6520 7370 ct coordinate sp │ │ │ -000d7410: 6163 652c 204e 7833 2031 2d63 6861 6e6e ace, Nx3 1-chann │ │ │ -000d7420: 656c 206f 720a 3178 4e2f 4e78 3120 332d el or.1xN/Nx1 3- │ │ │ -000d7430: 6368 616e 6e65 6c2c 2077 6865 7265 204e channel, where N │ │ │ -000d7440: 2069 7320 7468 6520 6e75 6d62 6572 206f is the number o │ │ │ -000d7450: 6620 706f 696e 7473 2e20 7665 6374 6f72 f points. vector │ │ │ -000d7460: 266c 743b 506f 696e 7433 6426 6774 3b20 <Point3d> │ │ │ -000d7470: 6361 6e20 616c 736f 2062 6520 7061 7373 can also be pass │ │ │ -000d7480: 6564 2068 6572 652e 3c2f 6464 3e0a 3c64 ed here..imagePoi │ │ │ -000d74a0: 6e74 733c 2f63 6f64 653e 202d 2041 7272 nts - Arr │ │ │ -000d74b0: 6179 206f 6620 636f 7272 6573 706f 6e64 ay of correspond │ │ │ -000d74c0: 696e 6720 696d 6167 6520 706f 696e 7473 ing image points │ │ │ -000d74d0: 2c20 4e78 3220 312d 6368 616e 6e65 6c20 , Nx2 1-channel │ │ │ -000d74e0: 6f72 2031 784e 2f4e 7831 2032 2d63 6861 or 1xN/Nx1 2-cha │ │ │ -000d74f0: 6e6e 656c 2c0a 7768 6572 6520 4e20 6973 nnel,.where N is │ │ │ -000d7500: 2074 6865 206e 756d 6265 7220 6f66 2070 the number of p │ │ │ -000d7510: 6f69 6e74 732e 2076 6563 746f 7226 6c74 oints. vector< │ │ │ -000d7520: 3b50 6f69 6e74 3264 2667 743b 2063 616e ;Point2d> can │ │ │ -000d7530: 2061 6c73 6f20 6265 2070 6173 7365 6420 also be passed │ │ │ -000d7540: 6865 7265 2e3c 2f64 643e 0a3c 6464 3e3c here..
    < │ │ │ -000d7550: 636f 6465 3e63 616d 6572 614d 6174 7269 code>cameraMatri │ │ │ -000d7560: 783c 2f63 6f64 653e 202d 2049 6e70 7574 x - Input │ │ │ -000d7570: 2063 616d 6572 6120 696e 7472 696e 7369 camera intrinsi │ │ │ -000d7580: 6320 6d61 7472 6978 205c 285c 6361 6d65 c matrix \(\came │ │ │ -000d7590: 7261 6d61 7472 6978 7b41 7d5c 2920 2e3c ramatrix{A}\) .< │ │ │ -000d75a0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -000d75b0: 6973 7443 6f65 6666 733c 2f63 6f64 653e istCoeffs │ │ │ -000d75c0: 202d 2049 6e70 7574 2076 6563 746f 7220 - Input vector │ │ │ -000d75d0: 6f66 2064 6973 746f 7274 696f 6e20 636f of distortion co │ │ │ -000d75e0: 6566 6669 6369 656e 7473 2028 3478 312f efficients (4x1/ │ │ │ -000d75f0: 3178 3429 2e3c 2f64 643e 0a3c 6464 3e3c 1x4).
    .
    < │ │ │ -000d7600: 636f 6465 3e72 7665 633c 2f63 6f64 653e code>rvec │ │ │ -000d7610: 202d 204f 7574 7075 7420 726f 7461 7469 - Output rotati │ │ │ -000d7620: 6f6e 2076 6563 746f 7220 2873 6565 2052 on vector (see R │ │ │ -000d7630: 4546 3a20 526f 6472 6967 7565 7320 2920 EF: Rodrigues ) │ │ │ -000d7640: 7468 6174 2c20 746f 6765 7468 6572 2077 that, together w │ │ │ -000d7650: 6974 6820 7476 6563 2c20 6272 696e 6773 ith tvec, brings │ │ │ -000d7660: 2070 6f69 6e74 7320 6672 6f6d 0a74 6865 points from.the │ │ │ -000d7670: 206d 6f64 656c 2063 6f6f 7264 696e 6174 model coordinat │ │ │ -000d7680: 6520 7379 7374 656d 2074 6f20 7468 6520 e system to the │ │ │ -000d7690: 6361 6d65 7261 2063 6f6f 7264 696e 6174 camera coordinat │ │ │ -000d76a0: 6520 7379 7374 656d 2e3c 2f64 643e 0a3c e system.
    .< │ │ │ -000d76b0: 6464 3e3c 636f 6465 3e74 7665 633c 2f63 dd>tvec - Output tr │ │ │ -000d76d0: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ -000d76e0: 2e0a 7468 6520 7072 6f76 6964 6564 2072 ..the provided r │ │ │ -000d76f0: 7665 6320 616e 6420 7476 6563 2076 616c vec and tvec val │ │ │ -000d7700: 7565 7320 6173 2069 6e69 7469 616c 2061 ues as initial a │ │ │ -000d7710: 7070 726f 7869 6d61 7469 6f6e 7320 6f66 pproximations of │ │ │ -000d7720: 2074 6865 2072 6f74 6174 696f 6e20 616e the rotation an │ │ │ -000d7730: 6420 7472 616e 736c 6174 696f 6e0a 7665 d translation.ve │ │ │ -000d7740: 6374 6f72 732c 2072 6573 7065 6374 6976 ctors, respectiv │ │ │ -000d7750: 656c 792c 2061 6e64 2066 7572 7468 6572 ely, and further │ │ │ -000d7760: 206f 7074 696d 697a 6573 2074 6865 6d2e optimizes them. │ │ │ -000d7770: 0a54 6869 7320 6675 6e63 7469 6f6e 2072 .This function r │ │ │ -000d7780: 6574 7572 6e73 2074 6865 2072 6f74 6174 eturns the rotat │ │ │ -000d7790: 696f 6e20 616e 6420 7468 6520 7472 616e ion and the tran │ │ │ -000d77a0: 736c 6174 696f 6e20 7665 6374 6f72 7320 slation vectors │ │ │ -000d77b0: 7468 6174 2074 7261 6e73 666f 726d 2061 that transform a │ │ │ -000d77c0: 2033 4420 706f 696e 7420 6578 7072 6573 3D point expres │ │ │ -000d77d0: 7365 6420 696e 2074 6865 206f 626a 6563 sed in the objec │ │ │ -000d77e0: 740a 636f 6f72 6469 6e61 7465 2066 7261 t.coordinate fra │ │ │ -000d77f0: 6d65 2074 6f20 7468 6520 6361 6d65 7261 me to the camera │ │ │ -000d7800: 2063 6f6f 7264 696e 6174 6520 6672 616d coordinate fram │ │ │ -000d7810: 652c 2075 7369 6e67 2064 6966 6665 7265 e, using differe │ │ │ -000d7820: 6e74 206d 6574 686f 6473 3a0a 3c75 6c3e nt methods:.
      │ │ │ -000d7830: 0a20 203c 6c69 3e0a 2050 3350 206d 6574 .
    • . P3P met │ │ │ -000d7840: 686f 6473 2028 5245 463a 2053 4f4c 5645 hods (REF: SOLVE │ │ │ -000d7850: 504e 505f 5033 502c 2052 4546 3a20 534f PNP_P3P, REF: SO │ │ │ -000d7860: 4c56 4550 4e50 5f41 5033 5029 3a20 6e65 LVEPNP_AP3P): ne │ │ │ -000d7870: 6564 2034 2069 6e70 7574 2070 6f69 6e74 ed 4 input point │ │ │ -000d7880: 7320 746f 2072 6574 7572 6e20 6120 756e s to return a un │ │ │ -000d7890: 6971 7565 2073 6f6c 7574 696f 6e2e 0a20 ique solution.. │ │ │ -000d78a0: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2052
    • .
    • . R │ │ │ -000d78b0: 4546 3a20 534f 4c56 4550 4e50 5f49 5050 EF: SOLVEPNP_IPP │ │ │ -000d78c0: 4520 496e 7075 7420 706f 696e 7473 206d E Input points m │ │ │ -000d78d0: 7573 7420 6265 2026 6774 3b3d 2034 2061 ust be >= 4 a │ │ │ -000d78e0: 6e64 206f 626a 6563 7420 706f 696e 7473 nd object points │ │ │ -000d78f0: 206d 7573 7420 6265 2063 6f70 6c61 6e61 must be coplana │ │ │ -000d7900: 722e 0a20 203c 2f6c 693e 0a20 203c 6c69 r..
    • .
    • . REF: SOLVEPNP │ │ │ -000d7920: 5f49 5050 455f 5351 5541 5245 2053 7065 _IPPE_SQUARE Spe │ │ │ -000d7930: 6369 616c 2063 6173 6520 7375 6974 6162 cial case suitab │ │ │ -000d7940: 6c65 2066 6f72 206d 6172 6b65 7220 706f le for marker po │ │ │ -000d7950: 7365 2065 7374 696d 6174 696f 6e2e 0a4e se estimation..N │ │ │ -000d7960: 756d 6265 7220 6f66 2069 6e70 7574 2070 umber of input p │ │ │ -000d7970: 6f69 6e74 7320 6d75 7374 2062 6520 342e oints must be 4. │ │ │ -000d7980: 204f 626a 6563 7420 706f 696e 7473 206d Object points m │ │ │ -000d7990: 7573 7420 6265 2064 6566 696e 6564 2069 ust be defined i │ │ │ -000d79a0: 6e20 7468 6520 666f 6c6c 6f77 696e 6720 n the following │ │ │ -000d79b0: 6f72 6465 723a 0a20 203c 2f6c 693e 0a20 order:.
    • . │ │ │ -000d79c0: 203c 6c69 3e0a 2070 6f69 6e74 2030 3a20
    • . point 0: │ │ │ -000d79d0: 5b2d 7371 7561 7265 4c65 6e67 7468 202f [-squareLength / │ │ │ -000d79e0: 2032 2c20 2073 7175 6172 654c 656e 6774 2, squareLengt │ │ │ -000d79f0: 6820 2f20 322c 2030 5d0a 2020 3c2f 6c69 h / 2, 0].
    • .
    • . point │ │ │ -000d7a10: 313a 205b 2073 7175 6172 654c 656e 6774 1: [ squareLengt │ │ │ -000d7a20: 6820 2f20 322c 2020 7371 7561 7265 4c65 h / 2, squareLe │ │ │ -000d7a30: 6e67 7468 202f 2032 2c20 305d 0a20 203c ngth / 2, 0]. < │ │ │ -000d7a40: 2f6c 693e 0a20 203c 6c69 3e0a 2070 6f69 /li>.
    • . poi │ │ │ -000d7a50: 6e74 2032 3a20 5b20 7371 7561 7265 4c65 nt 2: [ squareLe │ │ │ -000d7a60: 6e67 7468 202f 2032 2c20 2d73 7175 6172 ngth / 2, -squar │ │ │ -000d7a70: 654c 656e 6774 6820 2f20 322c 2030 5d0a eLength / 2, 0]. │ │ │ -000d7a80: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ -000d7a90: 706f 696e 7420 333a 205b 2d73 7175 6172 point 3: [-squar │ │ │ -000d7aa0: 654c 656e 6774 6820 2f20 322c 202d 7371 eLength / 2, -sq │ │ │ -000d7ab0: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ -000d7ac0: 305d 0a20 203c 2f6c 693e 0a20 203c 6c69 0].
    • .
    • . for all the o │ │ │ -000d7ae0: 7468 6572 2066 6c61 6773 2c20 6e75 6d62 ther flags, numb │ │ │ -000d7af0: 6572 206f 6620 696e 7075 7420 706f 696e er of input poin │ │ │ -000d7b00: 7473 206d 7573 7420 6265 2026 6774 3b3d ts must be >= │ │ │ -000d7b10: 2034 2061 6e64 206f 626a 6563 7420 706f 4 and object po │ │ │ -000d7b20: 696e 7473 2063 616e 2062 6520 696e 2061 ints can be in a │ │ │ -000d7b30: 6e79 2063 6f6e 6669 6775 7261 7469 6f6e ny configuration │ │ │ -000d7b40: 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c 3e0a ..
    • .
    . │ │ │ -000d7b50: 5468 6520 6675 6e63 7469 6f6e 2069 6e74 The function int │ │ │ -000d7b60: 6572 6e61 6c6c 7920 756e 6469 7374 6f72 ernally undistor │ │ │ -000d7b70: 7473 2070 6f69 6e74 7320 7769 7468 2052 ts points with R │ │ │ -000d7b80: 4546 3a20 756e 6469 7374 6f72 7450 6f69 EF: undistortPoi │ │ │ -000d7b90: 6e74 7320 616e 6420 6361 6c6c 2052 4546 nts and call REF │ │ │ -000d7ba0: 3a20 6376 3a3a 736f 6c76 6550 6e50 2c0a : cv::solvePnP,. │ │ │ -000d7bb0: 7468 7573 2074 6865 2069 6e70 7574 2061 thus the input a │ │ │ -000d7bc0: 7265 2076 6572 7920 7369 6d69 6c61 722e re very similar. │ │ │ -000d7bd0: 2043 6865 636b 2074 6865 7265 2061 6e64 Check there and │ │ │ -000d7be0: 2050 6572 7370 6563 7469 7665 2d6e 2d50 Perspective-n-P │ │ │ -000d7bf0: 6f69 6e74 7320 6973 2064 6573 6372 6962 oints is describ │ │ │ -000d7c00: 6564 2069 6e20 5245 463a 2063 616c 6962 ed in REF: calib │ │ │ -000d7c10: 3364 5f73 6f6c 7665 506e 500a 666f 7220 3d_solvePnP.for │ │ │ -000d7c20: 6d6f 7265 2069 6e66 6f72 6d61 7469 6f6e more information │ │ │ -000d7c30: 2e3c 2f64 643e 0a3c 6474 3e52 6574 7572 ..
    Retur │ │ │ -000d7c40: 6e73 3a3c 2f64 743e 0a3c 6464 3e61 7574 ns:
    .
    aut │ │ │ -000d7c50: 6f6d 6174 6963 616c 6c79 2067 656e 6572 omatically gener │ │ │ -000d7c60: 6174 6564 3c2f 6464 3e0a 3c2f 646c 3e0a ated
    .
    . │ │ │ -000d7c70: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e
    .

    ..
  • ..

    fis │ │ │ -000d7d90: 6865 7965 5f73 6f6c 7665 506e 5052 616e heye_solvePnPRan │ │ │ -000d7da0: 7361 633c 2f68 333e 0a3c 6469 7620 636c sac

    .
    .
    p │ │ │ -000d7e00: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static boolean fisheye_solveP │ │ │ -000d7e70: 6e50 5261 6e73 6163 3c2f 7370 616e 3e3c nPRansac< │ │ │ -000d7e80: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat objectPoi │ │ │ -000d7ef0: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. Mat i │ │ │ -000d7f40: 6d61 6765 506f 696e 7473 2c0a 203c 6120 magePoints,. Mat │ │ │ -000d7f90: 266e 6273 703b 6361 6d65 7261 4d61 7472  cameraMatr │ │ │ -000d7fa0: 6978 2c0a 203c 6120 6872 6566 3d22 2e2e ix,. Mat di │ │ │ -000d7ff0: 7374 436f 6566 6673 2c0a 203c 6120 6872 stCoeffs,. Mat&n │ │ │ -000d8040: 6273 703b 7276 6563 2c0a 203c 6120 6872 bsp;rvec,. Mat&n │ │ │ -000d8090: 6273 703b 7476 6563 2c0a 2062 6f6f 6c65 bsp;tvec,. boole │ │ │ -000d80a0: 616e 266e 6273 703b 7573 6545 7874 7269 an useExtri │ │ │ -000d80b0: 6e73 6963 4775 6573 732c 0a20 696e 7426 nsicGuess,. int& │ │ │ -000d80c0: 6e62 7370 3b69 7465 7261 7469 6f6e 7343 nbsp;iterationsC │ │ │ -000d80d0: 6f75 6e74 2c0a 2066 6c6f 6174 266e 6273 ount,. float&nbs │ │ │ -000d80e0: 703b 7265 7072 6f6a 6563 7469 6f6e 4572 p;reprojectionEr │ │ │ -000d80f0: 726f 722c 0a20 646f 7562 6c65 266e 6273 ror,. double&nbs │ │ │ -000d8100: 703b 636f 6e66 6964 656e 6365 2c0a 203c p;confidence,. < │ │ │ -000d8110: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000d8120: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000d8130: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000d8140: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat inliers, │ │ │ -000d8160: 0a20 696e 7426 6e62 7370 3b66 6c61 6773 . int flags │ │ │ -000d8170: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. TermCrit │ │ │ -000d81c0: 6572 6961 3c2f 613e 266e 6273 703b 6372 eria cr │ │ │ -000d81d0: 6974 6572 6961 293c 2f73 7061 6e3e 3c2f iteria).
    Finds an │ │ │ -000d8200: 206f 626a 6563 7420 706f 7365 2066 726f object pose fro │ │ │ -000d8210: 6d20 3344 2d32 4420 706f 696e 7420 636f m 3D-2D point co │ │ │ -000d8220: 7272 6573 706f 6e64 656e 6365 7320 7573 rrespondences us │ │ │ -000d8230: 696e 6720 7468 6520 5241 4e53 4143 2073 ing the RANSAC s │ │ │ -000d8240: 6368 656d 6520 666f 7220 6669 7368 6579 cheme for fishey │ │ │ -000d8250: 6520 6361 6d65 7261 206d 6f6f 6465 6c2e e camera moodel. │ │ │ -000d8260: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -000d8280: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000d8290: 6464 3e3c 636f 6465 3e6f 626a 6563 7450 dd>objectP │ │ │ -000d82a0: 6f69 6e74 733c 2f63 6f64 653e 202d 2041 oints - A │ │ │ -000d82b0: 7272 6179 206f 6620 6f62 6a65 6374 2070 rray of object p │ │ │ -000d82c0: 6f69 6e74 7320 696e 2074 6865 206f 626a oints in the obj │ │ │ -000d82d0: 6563 7420 636f 6f72 6469 6e61 7465 2073 ect coordinate s │ │ │ -000d82e0: 7061 6365 2c20 4e78 3320 312d 6368 616e pace, Nx3 1-chan │ │ │ -000d82f0: 6e65 6c20 6f72 0a31 784e 2f4e 7831 2033 nel or.1xN/Nx1 3 │ │ │ -000d8300: 2d63 6861 6e6e 656c 2c20 7768 6572 6520 -channel, where │ │ │ -000d8310: 4e20 6973 2074 6865 206e 756d 6265 7220 N is the number │ │ │ -000d8320: 6f66 2070 6f69 6e74 732e 2076 6563 746f of points. vecto │ │ │ -000d8330: 7226 6c74 3b50 6f69 6e74 3364 2667 743b r<Point3d> │ │ │ -000d8340: 2063 616e 2062 6520 616c 736f 2070 6173 can be also pas │ │ │ -000d8350: 7365 6420 6865 7265 2e3c 2f64 643e 0a3c sed here..< │ │ │ -000d8360: 6464 3e3c 636f 6465 3e69 6d61 6765 506f dd>imagePo │ │ │ -000d8370: 696e 7473 3c2f 636f 6465 3e20 2d20 4172 ints - Ar │ │ │ -000d8380: 7261 7920 6f66 2063 6f72 7265 7370 6f6e ray of correspon │ │ │ -000d8390: 6469 6e67 2069 6d61 6765 2070 6f69 6e74 ding image point │ │ │ -000d83a0: 732c 204e 7832 2031 2d63 6861 6e6e 656c s, Nx2 1-channel │ │ │ -000d83b0: 206f 7220 3178 4e2f 4e78 3120 322d 6368 or 1xN/Nx1 2-ch │ │ │ -000d83c0: 616e 6e65 6c2c 0a77 6865 7265 204e 2069 annel,.where N i │ │ │ -000d83d0: 7320 7468 6520 6e75 6d62 6572 206f 6620 s the number of │ │ │ -000d83e0: 706f 696e 7473 2e20 7665 6374 6f72 266c points. vector&l │ │ │ -000d83f0: 743b 506f 696e 7432 6426 6774 3b20 6361 t;Point2d> ca │ │ │ -000d8400: 6e20 6265 2061 6c73 6f20 7061 7373 6564 n be also passed │ │ │ -000d8410: 2068 6572 652e 3c2f 6464 3e0a 3c64 643e here..
    │ │ │ -000d8420: 3c63 6f64 653e 6361 6d65 7261 4d61 7472 cameraMatr │ │ │ -000d8430: 6978 3c2f 636f 6465 3e20 2d20 496e 7075 ix - Inpu │ │ │ -000d8440: 7420 6361 6d65 7261 2069 6e74 7269 6e73 t camera intrins │ │ │ -000d8450: 6963 206d 6174 7269 7820 5c28 5c63 616d ic matrix \(\cam │ │ │ -000d8460: 6572 616d 6174 7269 787b 417d 5c29 202e eramatrix{A}\) . │ │ │ -000d8470: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000d8480: 6469 7374 436f 6566 6673 3c2f 636f 6465 distCoeffs - Input vector │ │ │ -000d84a0: 206f 6620 6469 7374 6f72 7469 6f6e 2063 of distortion c │ │ │ -000d84b0: 6f65 6666 6963 6965 6e74 7320 2834 7831 oefficients (4x1 │ │ │ -000d84c0: 2f31 7834 292e 3c2f 6464 3e0a 3c64 643e /1x4).
    .
    │ │ │ -000d84d0: 3c63 6f64 653e 7276 6563 3c2f 636f 6465 rvec - Output rotat │ │ │ -000d84f0: 696f 6e20 7665 6374 6f72 2028 7365 6520 ion vector (see │ │ │ -000d8500: 5245 463a 2052 6f64 7269 6775 6573 2029 REF: Rodrigues ) │ │ │ -000d8510: 2074 6861 742c 2074 6f67 6574 6865 7220 that, together │ │ │ -000d8520: 7769 7468 2074 7665 632c 2062 7269 6e67 with tvec, bring │ │ │ -000d8530: 7320 706f 696e 7473 2066 726f 6d0a 7468 s points from.th │ │ │ -000d8540: 6520 6d6f 6465 6c20 636f 6f72 6469 6e61 e model coordina │ │ │ -000d8550: 7465 2073 7973 7465 6d20 746f 2074 6865 te system to the │ │ │ -000d8560: 2063 616d 6572 6120 636f 6f72 6469 6e61 camera coordina │ │ │ -000d8570: 7465 2073 7973 7465 6d2e 3c2f 6464 3e0a te system.
    . │ │ │ -000d8580: 3c64 643e 3c63 6f64 653e 7476 6563 3c2f
    tvec - Output t │ │ │ -000d85a0: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ -000d85b0: 722e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 r.
    .
    useExtrinsicGu │ │ │ -000d85d0: 6573 733c 2f63 6f64 653e 202d 2050 6172 ess - Par │ │ │ -000d85e0: 616d 6574 6572 2075 7365 6420 666f 7220 ameter used for │ │ │ -000d85f0: 2353 4f4c 5645 504e 505f 4954 4552 4154 #SOLVEPNP_ITERAT │ │ │ -000d8600: 4956 452e 2049 6620 7472 7565 2028 3129 IVE. If true (1) │ │ │ -000d8610: 2c20 7468 6520 6675 6e63 7469 6f6e 2075 , the function u │ │ │ -000d8620: 7365 730a 7468 6520 7072 6f76 6964 6564 ses.the provided │ │ │ -000d8630: 2072 7665 6320 616e 6420 7476 6563 2076 rvec and tvec v │ │ │ -000d8640: 616c 7565 7320 6173 2069 6e69 7469 616c alues as initial │ │ │ -000d8650: 2061 7070 726f 7869 6d61 7469 6f6e 7320 approximations │ │ │ -000d8660: 6f66 2074 6865 2072 6f74 6174 696f 6e20 of the rotation │ │ │ -000d8670: 616e 6420 7472 616e 736c 6174 696f 6e0a and translation. │ │ │ -000d8680: 7665 6374 6f72 732c 2072 6573 7065 6374 vectors, respect │ │ │ -000d8690: 6976 656c 792c 2061 6e64 2066 7572 7468 ively, and furth │ │ │ -000d86a0: 6572 206f 7074 696d 697a 6573 2074 6865 er optimizes the │ │ │ -000d86b0: 6d2e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 m.
    .
    iterationsCoun │ │ │ -000d86d0: 743c 2f63 6f64 653e 202d 204e 756d 6265 t - Numbe │ │ │ -000d86e0: 7220 6f66 2069 7465 7261 7469 6f6e 732e r of iterations. │ │ │ -000d86f0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000d8700: 7265 7072 6f6a 6563 7469 6f6e 4572 726f reprojectionErro │ │ │ -000d8710: 723c 2f63 6f64 653e 202d 2049 6e6c 6965 r - Inlie │ │ │ -000d8720: 7220 7468 7265 7368 6f6c 6420 7661 6c75 r threshold valu │ │ │ -000d8730: 6520 7573 6564 2062 7920 7468 6520 5241 e used by the RA │ │ │ -000d8740: 4e53 4143 2070 726f 6365 6475 7265 2e20 NSAC procedure. │ │ │ -000d8750: 5468 6520 7061 7261 6d65 7465 7220 7661 The parameter va │ │ │ -000d8760: 6c75 650a 6973 2074 6865 206d 6178 696d lue.is the maxim │ │ │ -000d8770: 756d 2061 6c6c 6f77 6564 2064 6973 7461 um allowed dista │ │ │ -000d8780: 6e63 6520 6265 7477 6565 6e20 7468 6520 nce between the │ │ │ -000d8790: 6f62 7365 7276 6564 2061 6e64 2063 6f6d observed and com │ │ │ -000d87a0: 7075 7465 6420 706f 696e 7420 7072 6f6a puted point proj │ │ │ -000d87b0: 6563 7469 6f6e 7320 746f 2063 6f6e 7369 ections to consi │ │ │ -000d87c0: 6465 7220 6974 0a61 6e20 696e 6c69 6572 der it.an inlier │ │ │ -000d87d0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    confidence - The probabi │ │ │ -000d8800: 6c69 7479 2074 6861 7420 7468 6520 616c lity that the al │ │ │ -000d8810: 676f 7269 7468 6d20 7072 6f64 7563 6573 gorithm produces │ │ │ -000d8820: 2061 2075 7365 6675 6c20 7265 7375 6c74 a useful result │ │ │ -000d8830: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    inliers │ │ │ -000d8850: 2d20 4f75 7470 7574 2076 6563 746f 7220 - Output vector │ │ │ -000d8860: 7468 6174 2063 6f6e 7461 696e 7320 696e that contains in │ │ │ -000d8870: 6469 6365 7320 6f66 2069 6e6c 6965 7273 dices of inliers │ │ │ -000d8880: 2069 6e20 6f62 6a65 6374 506f 696e 7473 in objectPoints │ │ │ -000d8890: 2061 6e64 2069 6d61 6765 506f 696e 7473 and imagePoints │ │ │ -000d88a0: 202e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 .
    .
    flags - │ │ │ -000d88c0: 204d 6574 686f 6420 666f 7220 736f 6c76 Method for solv │ │ │ -000d88d0: 696e 6720 6120 506e 5020 7072 6f62 6c65 ing a PnP proble │ │ │ -000d88e0: 6d3a 2073 6565 2052 4546 3a20 6361 6c69 m: see REF: cali │ │ │ -000d88f0: 6233 645f 736f 6c76 6550 6e50 5f66 6c61 b3d_solvePnP_fla │ │ │ -000d8900: 6773 3c2f 6464 3e0a 3c64 643e 3c63 6f64 gs
    .
    criteria - Termination │ │ │ -000d8930: 6372 6974 6572 6961 2066 6f72 2069 6e74 criteria for int │ │ │ -000d8940: 6572 6e61 6c20 756e 6469 7374 6f72 7450 ernal undistortP │ │ │ -000d8950: 6f69 6e74 7320 6361 6c6c 2e0a 5468 6520 oints call..The │ │ │ -000d8960: 6675 6e63 7469 6f6e 2069 6e74 6572 616c function interal │ │ │ -000d8970: 6c79 2075 6e64 6973 746f 7274 7320 706f ly undistorts po │ │ │ -000d8980: 696e 7473 2077 6974 6820 5245 463a 2075 ints with REF: u │ │ │ -000d8990: 6e64 6973 746f 7274 506f 696e 7473 2061 ndistortPoints a │ │ │ -000d89a0: 6e64 2063 616c 6c20 5245 463a 2063 763a nd call REF: cv: │ │ │ -000d89b0: 3a73 6f6c 7665 506e 502c 0a74 6875 7320 :solvePnP,.thus │ │ │ -000d89c0: 7468 6520 696e 7075 7420 6172 6520 7665 the input are ve │ │ │ -000d89d0: 7279 2073 696d 696c 6172 2e20 4d6f 7265 ry similar. More │ │ │ -000d89e0: 2069 6e66 6f72 6d61 7469 6f6e 2061 626f information abo │ │ │ -000d89f0: 7574 2050 6572 7370 6563 7469 7665 2d6e ut Perspective-n │ │ │ -000d8a00: 2d50 6f69 6e74 7320 6973 2064 6573 6372 -Points is descr │ │ │ -000d8a10: 6962 6564 2069 6e20 5245 463a 2063 616c ibed in REF: cal │ │ │ -000d8a20: 6962 3364 5f73 6f6c 7665 506e 500a 666f ib3d_solvePnP.fo │ │ │ -000d8a30: 7220 6d6f 7265 2069 6e66 6f72 6d61 7469 r more informati │ │ │ -000d8a40: 6f6e 2e3c 2f64 643e 0a3c 6474 3e52 6574 on.
    .
    Ret │ │ │ -000d8a50: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e61 urns:
    .
    a │ │ │ -000d8a60: 7574 6f6d 6174 6963 616c 6c79 2067 656e utomatically gen │ │ │ -000d8a70: 6572 6174 6564 3c2f 6464 3e0a 3c2f 646c erated
    .
    .
    ..
  • .
  • .< │ │ │ -000d8aa0: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ -000d8ab0: 6574 6169 6c22 2069 643d 2266 6973 6865 etail" id="fishe │ │ │ -000d8ac0: 7965 5f73 6f6c 7665 506e 5052 616e 7361 ye_solvePnPRansa │ │ │ -000d8ad0: 6328 6f72 672e 6f70 656e 6376 2e63 6f72 c(org.opencv.cor │ │ │ -000d8ae0: 652e 4d61 742c 6f72 672e 6f70 656e 6376 e.Mat,org.opencv │ │ │ -000d8af0: 2e63 6f72 652e 4d61 742c 6f72 672e 6f70 .core.Mat,org.op │ │ │ -000d8b00: 656e 6376 2e63 6f72 652e 4d61 742c 6f72 encv.core.Mat,or │ │ │ -000d8b10: 672e 6f70 656e 6376 2e63 6f72 652e 4d61 g.opencv.core.Ma │ │ │ -000d8b20: 742c 6f72 672e 6f70 656e 6376 2e63 6f72 t,org.opencv.cor │ │ │ -000d8b30: 652e 4d61 742c 6f72 672e 6f70 656e 6376 e.Mat,org.opencv │ │ │ -000d8b40: 2e63 6f72 652e 4d61 742c 626f 6f6c 6561 .core.Mat,boolea │ │ │ -000d8b50: 6e2c 696e 742c 666c 6f61 742c 646f 7562 n,int,float,doub │ │ │ -000d8b60: 6c65 2c6f 7267 2e6f 7065 6e63 762e 636f le,org.opencv.co │ │ │ -000d8b70: 7265 2e4d 6174 2c69 6e74 2922 3e0a 3c68 re.Mat,int)">.fisheye_solveP │ │ │ -000d8b90: 6e50 5261 6e73 6163 3c2f 6833 3e0a 3c64 nPRansac..public stati │ │ │ -000d8c00: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c boolean< │ │ │ -000d8c30: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> fisheye_s │ │ │ -000d8c60: 6f6c 7665 506e 5052 616e 7361 633c 2f73 olvePnPRansac(M │ │ │ -000d8cd0: 6174 3c2f 613e 266e 6273 703b 6f62 6a65 at obje │ │ │ -000d8ce0: 6374 506f 696e 7473 2c0a 203c 6120 6872 ctPoints,. Mat&n │ │ │ -000d8d30: 6273 703b 696d 6167 6550 6f69 6e74 732c bsp;imagePoints, │ │ │ -000d8d40: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000d8d80: 743c 2f61 3e26 6e62 7370 3b63 616d 6572 t camer │ │ │ -000d8d90: 614d 6174 7269 782c 0a20 3c61 2068 7265 aMatrix,. Mat&nb │ │ │ -000d8de0: 7370 3b64 6973 7443 6f65 6666 732c 0a20 sp;distCoeffs,. │ │ │ -000d8df0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000d8e30: 2f61 3e26 6e62 7370 3b72 7665 632c 0a20 /a> rvec,. │ │ │ -000d8e40: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000d8e80: 2f61 3e26 6e62 7370 3b74 7665 632c 0a20 /a> tvec,. │ │ │ -000d8e90: 626f 6f6c 6561 6e26 6e62 7370 3b75 7365 boolean use │ │ │ -000d8ea0: 4578 7472 696e 7369 6347 7565 7373 2c0a ExtrinsicGuess,. │ │ │ -000d8eb0: 2069 6e74 266e 6273 703b 6974 6572 6174 int iterat │ │ │ -000d8ec0: 696f 6e73 436f 756e 742c 0a20 666c 6f61 ionsCount,. floa │ │ │ -000d8ed0: 7426 6e62 7370 3b72 6570 726f 6a65 6374 t reproject │ │ │ -000d8ee0: 696f 6e45 7272 6f72 2c0a 2064 6f75 626c ionError,. doubl │ │ │ -000d8ef0: 6526 6e62 7370 3b63 6f6e 6669 6465 6e63 e confidenc │ │ │ -000d8f00: 652c 0a20 3c61 2068 7265 663d 222e 2e2f e,. │ │ │ -000d8f40: 4d61 743c 2f61 3e26 6e62 7370 3b69 6e6c Mat inl │ │ │ -000d8f50: 6965 7273 2c0a 2069 6e74 266e 6273 703b iers,. int  │ │ │ -000d8f60: 666c 6167 7329 3c2f 7370 616e 3e3c 2f64 flags).
    Finds an │ │ │ -000d8f90: 6f62 6a65 6374 2070 6f73 6520 6672 6f6d object pose from │ │ │ -000d8fa0: 2033 442d 3244 2070 6f69 6e74 2063 6f72 3D-2D point cor │ │ │ -000d8fb0: 7265 7370 6f6e 6465 6e63 6573 2075 7369 respondences usi │ │ │ -000d8fc0: 6e67 2074 6865 2052 414e 5341 4320 7363 ng the RANSAC sc │ │ │ -000d8fd0: 6865 6d65 2066 6f72 2066 6973 6865 7965 heme for fisheye │ │ │ -000d8fe0: 2063 616d 6572 6120 6d6f 6f64 656c 2e3c camera moodel.< │ │ │ -000d8ff0: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ -000d9010: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .objectPo │ │ │ -000d9030: 696e 7473 3c2f 636f 6465 3e20 2d20 4172 ints - Ar │ │ │ -000d9040: 7261 7920 6f66 206f 626a 6563 7420 706f ray of object po │ │ │ -000d9050: 696e 7473 2069 6e20 7468 6520 6f62 6a65 ints in the obje │ │ │ -000d9060: 6374 2063 6f6f 7264 696e 6174 6520 7370 ct coordinate sp │ │ │ -000d9070: 6163 652c 204e 7833 2031 2d63 6861 6e6e ace, Nx3 1-chann │ │ │ -000d9080: 656c 206f 720a 3178 4e2f 4e78 3120 332d el or.1xN/Nx1 3- │ │ │ -000d9090: 6368 616e 6e65 6c2c 2077 6865 7265 204e channel, where N │ │ │ -000d90a0: 2069 7320 7468 6520 6e75 6d62 6572 206f is the number o │ │ │ -000d90b0: 6620 706f 696e 7473 2e20 7665 6374 6f72 f points. vector │ │ │ -000d90c0: 266c 743b 506f 696e 7433 6426 6774 3b20 <Point3d> │ │ │ -000d90d0: 6361 6e20 6265 2061 6c73 6f20 7061 7373 can be also pass │ │ │ -000d90e0: 6564 2068 6572 652e 3c2f 6464 3e0a 3c64 ed here..imagePoi │ │ │ -000d9100: 6e74 733c 2f63 6f64 653e 202d 2041 7272 nts - Arr │ │ │ -000d9110: 6179 206f 6620 636f 7272 6573 706f 6e64 ay of correspond │ │ │ -000d9120: 696e 6720 696d 6167 6520 706f 696e 7473 ing image points │ │ │ -000d9130: 2c20 4e78 3220 312d 6368 616e 6e65 6c20 , Nx2 1-channel │ │ │ -000d9140: 6f72 2031 784e 2f4e 7831 2032 2d63 6861 or 1xN/Nx1 2-cha │ │ │ -000d9150: 6e6e 656c 2c0a 7768 6572 6520 4e20 6973 nnel,.where N is │ │ │ -000d9160: 2074 6865 206e 756d 6265 7220 6f66 2070 the number of p │ │ │ -000d9170: 6f69 6e74 732e 2076 6563 746f 7226 6c74 oints. vector< │ │ │ -000d9180: 3b50 6f69 6e74 3264 2667 743b 2063 616e ;Point2d> can │ │ │ -000d9190: 2062 6520 616c 736f 2070 6173 7365 6420 be also passed │ │ │ -000d91a0: 6865 7265 2e3c 2f64 643e 0a3c 6464 3e3c here..
    < │ │ │ -000d91b0: 636f 6465 3e63 616d 6572 614d 6174 7269 code>cameraMatri │ │ │ -000d91c0: 783c 2f63 6f64 653e 202d 2049 6e70 7574 x - Input │ │ │ -000d91d0: 2063 616d 6572 6120 696e 7472 696e 7369 camera intrinsi │ │ │ -000d91e0: 6320 6d61 7472 6978 205c 285c 6361 6d65 c matrix \(\came │ │ │ -000d91f0: 7261 6d61 7472 6978 7b41 7d5c 2920 2e3c ramatrix{A}\) .< │ │ │ -000d9200: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ -000d9210: 6973 7443 6f65 6666 733c 2f63 6f64 653e istCoeffs │ │ │ -000d9220: 202d 2049 6e70 7574 2076 6563 746f 7220 - Input vector │ │ │ -000d9230: 6f66 2064 6973 746f 7274 696f 6e20 636f of distortion co │ │ │ -000d9240: 6566 6669 6369 656e 7473 2028 3478 312f efficients (4x1/ │ │ │ -000d9250: 3178 3429 2e3c 2f64 643e 0a3c 6464 3e3c 1x4).
    .
    < │ │ │ -000d9260: 636f 6465 3e72 7665 633c 2f63 6f64 653e code>rvec │ │ │ -000d9270: 202d 204f 7574 7075 7420 726f 7461 7469 - Output rotati │ │ │ -000d9280: 6f6e 2076 6563 746f 7220 2873 6565 2052 on vector (see R │ │ │ -000d9290: 4546 3a20 526f 6472 6967 7565 7320 2920 EF: Rodrigues ) │ │ │ -000d92a0: 7468 6174 2c20 746f 6765 7468 6572 2077 that, together w │ │ │ -000d92b0: 6974 6820 7476 6563 2c20 6272 696e 6773 ith tvec, brings │ │ │ -000d92c0: 2070 6f69 6e74 7320 6672 6f6d 0a74 6865 points from.the │ │ │ -000d92d0: 206d 6f64 656c 2063 6f6f 7264 696e 6174 model coordinat │ │ │ -000d92e0: 6520 7379 7374 656d 2074 6f20 7468 6520 e system to the │ │ │ -000d92f0: 6361 6d65 7261 2063 6f6f 7264 696e 6174 camera coordinat │ │ │ -000d9300: 6520 7379 7374 656d 2e3c 2f64 643e 0a3c e system.
    .< │ │ │ -000d9310: 6464 3e3c 636f 6465 3e74 7665 633c 2f63 dd>tvec - Output tr │ │ │ -000d9330: 616e 736c 6174 696f 6e20 7665 6374 6f72 anslation vector │ │ │ -000d9340: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 ..
    useExtrinsicGue │ │ │ -000d9360: 7373 3c2f 636f 6465 3e20 2d20 5061 7261 ss - Para │ │ │ -000d9370: 6d65 7465 7220 7573 6564 2066 6f72 2023 meter used for # │ │ │ -000d9380: 534f 4c56 4550 4e50 5f49 5445 5241 5449 SOLVEPNP_ITERATI │ │ │ -000d9390: 5645 2e20 4966 2074 7275 6520 2831 292c VE. If true (1), │ │ │ -000d93a0: 2074 6865 2066 756e 6374 696f 6e20 7573 the function us │ │ │ -000d93b0: 6573 0a74 6865 2070 726f 7669 6465 6420 es.the provided │ │ │ -000d93c0: 7276 6563 2061 6e64 2074 7665 6320 7661 rvec and tvec va │ │ │ -000d93d0: 6c75 6573 2061 7320 696e 6974 6961 6c20 lues as initial │ │ │ -000d93e0: 6170 7072 6f78 696d 6174 696f 6e73 206f approximations o │ │ │ -000d93f0: 6620 7468 6520 726f 7461 7469 6f6e 2061 f the rotation a │ │ │ -000d9400: 6e64 2074 7261 6e73 6c61 7469 6f6e 0a76 nd translation.v │ │ │ -000d9410: 6563 746f 7273 2c20 7265 7370 6563 7469 ectors, respecti │ │ │ -000d9420: 7665 6c79 2c20 616e 6420 6675 7274 6865 vely, and furthe │ │ │ -000d9430: 7220 6f70 7469 6d69 7a65 7320 7468 656d r optimizes them │ │ │ -000d9440: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    iterationsCount │ │ │ -000d9460: 3c2f 636f 6465 3e20 2d20 4e75 6d62 6572 - Number │ │ │ -000d9470: 206f 6620 6974 6572 6174 696f 6e73 2e3c of iterations.< │ │ │ -000d9480: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e72 /dd>.
    r │ │ │ -000d9490: 6570 726f 6a65 6374 696f 6e45 7272 6f72 eprojectionError │ │ │ -000d94a0: 3c2f 636f 6465 3e20 2d20 496e 6c69 6572 - Inlier │ │ │ -000d94b0: 2074 6872 6573 686f 6c64 2076 616c 7565 threshold value │ │ │ -000d94c0: 2075 7365 6420 6279 2074 6865 2052 414e used by the RAN │ │ │ -000d94d0: 5341 4320 7072 6f63 6564 7572 652e 2054 SAC procedure. T │ │ │ -000d94e0: 6865 2070 6172 616d 6574 6572 2076 616c he parameter val │ │ │ -000d94f0: 7565 0a69 7320 7468 6520 6d61 7869 6d75 ue.is the maximu │ │ │ -000d9500: 6d20 616c 6c6f 7765 6420 6469 7374 616e m allowed distan │ │ │ -000d9510: 6365 2062 6574 7765 656e 2074 6865 206f ce between the o │ │ │ -000d9520: 6273 6572 7665 6420 616e 6420 636f 6d70 bserved and comp │ │ │ -000d9530: 7574 6564 2070 6f69 6e74 2070 726f 6a65 uted point proje │ │ │ -000d9540: 6374 696f 6e73 2074 6f20 636f 6e73 6964 ctions to consid │ │ │ -000d9550: 6572 2069 740a 616e 2069 6e6c 6965 722e er it.an inlier. │ │ │ -000d9560: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000d9570: 636f 6e66 6964 656e 6365 3c2f 636f 6465 confidence - The probabil │ │ │ -000d9590: 6974 7920 7468 6174 2074 6865 2061 6c67 ity that the alg │ │ │ -000d95a0: 6f72 6974 686d 2070 726f 6475 6365 7320 orithm produces │ │ │ -000d95b0: 6120 7573 6566 756c 2072 6573 756c 742e a useful result. │ │ │ -000d95c0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000d95d0: 696e 6c69 6572 733c 2f63 6f64 653e 202d inliers - │ │ │ -000d95e0: 204f 7574 7075 7420 7665 6374 6f72 2074 Output vector t │ │ │ -000d95f0: 6861 7420 636f 6e74 6169 6e73 2069 6e64 hat contains ind │ │ │ -000d9600: 6963 6573 206f 6620 696e 6c69 6572 7320 ices of inliers │ │ │ -000d9610: 696e 206f 626a 6563 7450 6f69 6e74 7320 in objectPoints │ │ │ -000d9620: 616e 6420 696d 6167 6550 6f69 6e74 7320 and imagePoints │ │ │ -000d9630: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    flags - │ │ │ -000d9650: 4d65 7468 6f64 2066 6f72 2073 6f6c 7669 Method for solvi │ │ │ -000d9660: 6e67 2061 2050 6e50 2070 726f 626c 656d ng a PnP problem │ │ │ -000d9670: 3a20 7365 6520 5245 463a 2063 616c 6962 : see REF: calib │ │ │ -000d9680: 3364 5f73 6f6c 7665 506e 505f 666c 6167 3d_solvePnP_flag │ │ │ -000d9690: 730a 5468 6520 6675 6e63 7469 6f6e 2069 s.The function i │ │ │ -000d96a0: 6e74 6572 616c 6c79 2075 6e64 6973 746f nterally undisto │ │ │ -000d96b0: 7274 7320 706f 696e 7473 2077 6974 6820 rts points with │ │ │ -000d96c0: 5245 463a 2075 6e64 6973 746f 7274 506f REF: undistortPo │ │ │ -000d96d0: 696e 7473 2061 6e64 2063 616c 6c20 5245 ints and call RE │ │ │ -000d96e0: 463a 2063 763a 3a73 6f6c 7665 506e 502c F: cv::solvePnP, │ │ │ -000d96f0: 0a74 6875 7320 7468 6520 696e 7075 7420 .thus the input │ │ │ -000d9700: 6172 6520 7665 7279 2073 696d 696c 6172 are very similar │ │ │ -000d9710: 2e20 4d6f 7265 2069 6e66 6f72 6d61 7469 . More informati │ │ │ -000d9720: 6f6e 2061 626f 7574 2050 6572 7370 6563 on about Perspec │ │ │ -000d9730: 7469 7665 2d6e 2d50 6f69 6e74 7320 6973 tive-n-Points is │ │ │ -000d9740: 2064 6573 6372 6962 6564 2069 6e20 5245 described in RE │ │ │ -000d9750: 463a 2063 616c 6962 3364 5f73 6f6c 7665 F: calib3d_solve │ │ │ -000d9760: 506e 500a 666f 7220 6d6f 7265 2069 6e66 PnP.for more inf │ │ │ -000d9770: 6f72 6d61 7469 6f6e 2e3c 2f64 643e 0a3c ormation.
    .< │ │ │ -000d9780: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ -000d9790: 0a3c 6464 3e61 7574 6f6d 6174 6963 616c .
    automatical │ │ │ -000d97a0: 6c79 2067 656e 6572 6174 6564 3c2f 6464 ly generated
    .
    .
    .< │ │ │ -000d97c0: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ -000d97d0: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    . │ │ │ -000d98b0: 3c68 333e 6669 7368 6579 655f 736f 6c76

    fisheye_solv │ │ │ -000d98c0: 6550 6e50 5261 6e73 6163 3c2f 6833 3e0a ePnPRansac

    . │ │ │ -000d98d0: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ -000d98f0: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ -000d9930: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ -000d9940: 3c73 7061 6e20 636c 6173 733d 2272 6574 boolea │ │ │ -000d9960: 6e3c 2f73 7061 6e3e 266e 6273 703b 3c73 n fisheye │ │ │ -000d9990: 5f73 6f6c 7665 506e 5052 616e 7361 633c _solvePnPRansac< │ │ │ -000d99a0: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat ob │ │ │ -000d9a10: 6a65 6374 506f 696e 7473 2c0a 203c 6120 jectPoints,. Mat │ │ │ -000d9a60: 266e 6273 703b 696d 6167 6550 6f69 6e74  imagePoint │ │ │ -000d9a70: 732c 0a20 3c61 2068 7265 663d 222e 2e2f s,. │ │ │ -000d9ab0: 4d61 743c 2f61 3e26 6e62 7370 3b63 616d Mat cam │ │ │ -000d9ac0: 6572 614d 6174 7269 782c 0a20 3c61 2068 eraMatrix,. Mat& │ │ │ -000d9b10: 6e62 7370 3b64 6973 7443 6f65 6666 732c nbsp;distCoeffs, │ │ │ -000d9b20: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000d9b60: 743c 2f61 3e26 6e62 7370 3b72 7665 632c t rvec, │ │ │ -000d9b70: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000d9bb0: 743c 2f61 3e26 6e62 7370 3b74 7665 632c t tvec, │ │ │ -000d9bc0: 0a20 626f 6f6c 6561 6e26 6e62 7370 3b75 . boolean u │ │ │ -000d9bd0: 7365 4578 7472 696e 7369 6347 7565 7373 seExtrinsicGuess │ │ │ -000d9be0: 2c0a 2069 6e74 266e 6273 703b 6974 6572 ,. int iter │ │ │ -000d9bf0: 6174 696f 6e73 436f 756e 742c 0a20 666c ationsCount,. fl │ │ │ -000d9c00: 6f61 7426 6e62 7370 3b72 6570 726f 6a65 oat reproje │ │ │ -000d9c10: 6374 696f 6e45 7272 6f72 2c0a 2064 6f75 ctionError,. dou │ │ │ -000d9c20: 626c 6526 6e62 7370 3b63 6f6e 6669 6465 ble confide │ │ │ -000d9c30: 6e63 652c 0a20 3c61 2068 7265 663d 222e nce,. Mat i │ │ │ -000d9c80: 6e6c 6965 7273 293c 2f73 7061 6e3e 3c2f nliers).
    Finds an │ │ │ -000d9cb0: 206f 626a 6563 7420 706f 7365 2066 726f object pose fro │ │ │ -000d9cc0: 6d20 3344 2d32 4420 706f 696e 7420 636f m 3D-2D point co │ │ │ -000d9cd0: 7272 6573 706f 6e64 656e 6365 7320 7573 rrespondences us │ │ │ -000d9ce0: 696e 6720 7468 6520 5241 4e53 4143 2073 ing the RANSAC s │ │ │ -000d9cf0: 6368 656d 6520 666f 7220 6669 7368 6579 cheme for fishey │ │ │ -000d9d00: 6520 6361 6d65 7261 206d 6f6f 6465 6c2e e camera moodel. │ │ │ -000d9d10: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -000d9d30: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000d9d40: 6464 3e3c 636f 6465 3e6f 626a 6563 7450 dd>objectP │ │ │ -000d9d50: 6f69 6e74 733c 2f63 6f64 653e 202d 2041 oints - A │ │ │ -000d9d60: 7272 6179 206f 6620 6f62 6a65 6374 2070 rray of object p │ │ │ -000d9d70: 6f69 6e74 7320 696e 2074 6865 206f 626a oints in the obj │ │ │ -000d9d80: 6563 7420 636f 6f72 6469 6e61 7465 2073 ect coordinate s │ │ │ -000d9d90: 7061 6365 2c20 4e78 3320 312d 6368 616e pace, Nx3 1-chan │ │ │ -000d9da0: 6e65 6c20 6f72 0a31 784e 2f4e 7831 2033 nel or.1xN/Nx1 3 │ │ │ -000d9db0: 2d63 6861 6e6e 656c 2c20 7768 6572 6520 -channel, where │ │ │ -000d9dc0: 4e20 6973 2074 6865 206e 756d 6265 7220 N is the number │ │ │ -000d9dd0: 6f66 2070 6f69 6e74 732e 2076 6563 746f of points. vecto │ │ │ -000d9de0: 7226 6c74 3b50 6f69 6e74 3364 2667 743b r<Point3d> │ │ │ -000d9df0: 2063 616e 2062 6520 616c 736f 2070 6173 can be also pas │ │ │ -000d9e00: 7365 6420 6865 7265 2e3c 2f64 643e 0a3c sed here..< │ │ │ -000d9e10: 6464 3e3c 636f 6465 3e69 6d61 6765 506f dd>imagePo │ │ │ -000d9e20: 696e 7473 3c2f 636f 6465 3e20 2d20 4172 ints - Ar │ │ │ -000d9e30: 7261 7920 6f66 2063 6f72 7265 7370 6f6e ray of correspon │ │ │ -000d9e40: 6469 6e67 2069 6d61 6765 2070 6f69 6e74 ding image point │ │ │ -000d9e50: 732c 204e 7832 2031 2d63 6861 6e6e 656c s, Nx2 1-channel │ │ │ -000d9e60: 206f 7220 3178 4e2f 4e78 3120 322d 6368 or 1xN/Nx1 2-ch │ │ │ -000d9e70: 616e 6e65 6c2c 0a77 6865 7265 204e 2069 annel,.where N i │ │ │ -000d9e80: 7320 7468 6520 6e75 6d62 6572 206f 6620 s the number of │ │ │ -000d9e90: 706f 696e 7473 2e20 7665 6374 6f72 266c points. vector&l │ │ │ -000d9ea0: 743b 506f 696e 7432 6426 6774 3b20 6361 t;Point2d> ca │ │ │ -000d9eb0: 6e20 6265 2061 6c73 6f20 7061 7373 6564 n be also passed │ │ │ -000d9ec0: 2068 6572 652e 3c2f 6464 3e0a 3c64 643e here..
    │ │ │ -000d9ed0: 3c63 6f64 653e 6361 6d65 7261 4d61 7472 cameraMatr │ │ │ -000d9ee0: 6978 3c2f 636f 6465 3e20 2d20 496e 7075 ix - Inpu │ │ │ -000d9ef0: 7420 6361 6d65 7261 2069 6e74 7269 6e73 t camera intrins │ │ │ -000d9f00: 6963 206d 6174 7269 7820 5c28 5c63 616d ic matrix \(\cam │ │ │ -000d9f10: 6572 616d 6174 7269 787b 417d 5c29 202e eramatrix{A}\) . │ │ │ -000d9f20: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000d9f30: 6469 7374 436f 6566 6673 3c2f 636f 6465 distCoeffs - Input vector │ │ │ -000d9f50: 206f 6620 6469 7374 6f72 7469 6f6e 2063 of distortion c │ │ │ -000d9f60: 6f65 6666 6963 6965 6e74 7320 2834 7831 oefficients (4x1 │ │ │ -000d9f70: 2f31 7834 292e 3c2f 6464 3e0a 3c64 643e /1x4).
    .
    │ │ │ -000d9f80: 3c63 6f64 653e 7276 6563 3c2f 636f 6465 rvec - Output rotat │ │ │ -000d9fa0: 696f 6e20 7665 6374 6f72 2028 7365 6520 ion vector (see │ │ │ -000d9fb0: 5245 463a 2052 6f64 7269 6775 6573 2029 REF: Rodrigues ) │ │ │ -000d9fc0: 2074 6861 742c 2074 6f67 6574 6865 7220 that, together │ │ │ -000d9fd0: 7769 7468 2074 7665 632c 2062 7269 6e67 with tvec, bring │ │ │ -000d9fe0: 7320 706f 696e 7473 2066 726f 6d0a 7468 s points from.th │ │ │ -000d9ff0: 6520 6d6f 6465 6c20 636f 6f72 6469 6e61 e model coordina │ │ │ -000da000: 7465 2073 7973 7465 6d20 746f 2074 6865 te system to the │ │ │ -000da010: 2063 616d 6572 6120 636f 6f72 6469 6e61 camera coordina │ │ │ -000da020: 7465 2073 7973 7465 6d2e 3c2f 6464 3e0a te system.
    . │ │ │ -000da030: 3c64 643e 3c63 6f64 653e 7476 6563 3c2f
    tvec - Output t │ │ │ -000da050: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ -000da060: 722e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 r.
    .
    useExtrinsicGu │ │ │ -000da080: 6573 733c 2f63 6f64 653e 202d 2050 6172 ess - Par │ │ │ -000da090: 616d 6574 6572 2075 7365 6420 666f 7220 ameter used for │ │ │ -000da0a0: 2353 4f4c 5645 504e 505f 4954 4552 4154 #SOLVEPNP_ITERAT │ │ │ -000da0b0: 4956 452e 2049 6620 7472 7565 2028 3129 IVE. If true (1) │ │ │ -000da0c0: 2c20 7468 6520 6675 6e63 7469 6f6e 2075 , the function u │ │ │ -000da0d0: 7365 730a 7468 6520 7072 6f76 6964 6564 ses.the provided │ │ │ -000da0e0: 2072 7665 6320 616e 6420 7476 6563 2076 rvec and tvec v │ │ │ -000da0f0: 616c 7565 7320 6173 2069 6e69 7469 616c alues as initial │ │ │ -000da100: 2061 7070 726f 7869 6d61 7469 6f6e 7320 approximations │ │ │ -000da110: 6f66 2074 6865 2072 6f74 6174 696f 6e20 of the rotation │ │ │ -000da120: 616e 6420 7472 616e 736c 6174 696f 6e0a and translation. │ │ │ -000da130: 7665 6374 6f72 732c 2072 6573 7065 6374 vectors, respect │ │ │ -000da140: 6976 656c 792c 2061 6e64 2066 7572 7468 ively, and furth │ │ │ -000da150: 6572 206f 7074 696d 697a 6573 2074 6865 er optimizes the │ │ │ -000da160: 6d2e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 m.
    .
    iterationsCoun │ │ │ -000da180: 743c 2f63 6f64 653e 202d 204e 756d 6265 t - Numbe │ │ │ -000da190: 7220 6f66 2069 7465 7261 7469 6f6e 732e r of iterations. │ │ │ -000da1a0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000da1b0: 7265 7072 6f6a 6563 7469 6f6e 4572 726f reprojectionErro │ │ │ -000da1c0: 723c 2f63 6f64 653e 202d 2049 6e6c 6965 r - Inlie │ │ │ -000da1d0: 7220 7468 7265 7368 6f6c 6420 7661 6c75 r threshold valu │ │ │ -000da1e0: 6520 7573 6564 2062 7920 7468 6520 5241 e used by the RA │ │ │ -000da1f0: 4e53 4143 2070 726f 6365 6475 7265 2e20 NSAC procedure. │ │ │ -000da200: 5468 6520 7061 7261 6d65 7465 7220 7661 The parameter va │ │ │ -000da210: 6c75 650a 6973 2074 6865 206d 6178 696d lue.is the maxim │ │ │ -000da220: 756d 2061 6c6c 6f77 6564 2064 6973 7461 um allowed dista │ │ │ -000da230: 6e63 6520 6265 7477 6565 6e20 7468 6520 nce between the │ │ │ -000da240: 6f62 7365 7276 6564 2061 6e64 2063 6f6d observed and com │ │ │ -000da250: 7075 7465 6420 706f 696e 7420 7072 6f6a puted point proj │ │ │ -000da260: 6563 7469 6f6e 7320 746f 2063 6f6e 7369 ections to consi │ │ │ -000da270: 6465 7220 6974 0a61 6e20 696e 6c69 6572 der it.an inlier │ │ │ -000da280: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    confidence - The probabi │ │ │ -000da2b0: 6c69 7479 2074 6861 7420 7468 6520 616c lity that the al │ │ │ -000da2c0: 676f 7269 7468 6d20 7072 6f64 7563 6573 gorithm produces │ │ │ -000da2d0: 2061 2075 7365 6675 6c20 7265 7375 6c74 a useful result │ │ │ -000da2e0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    inliers │ │ │ -000da300: 2d20 4f75 7470 7574 2076 6563 746f 7220 - Output vector │ │ │ -000da310: 7468 6174 2063 6f6e 7461 696e 7320 696e that contains in │ │ │ -000da320: 6469 6365 7320 6f66 2069 6e6c 6965 7273 dices of inliers │ │ │ -000da330: 2069 6e20 6f62 6a65 6374 506f 696e 7473 in objectPoints │ │ │ -000da340: 2061 6e64 2069 6d61 6765 506f 696e 7473 and imagePoints │ │ │ -000da350: 202e 0a54 6865 2066 756e 6374 696f 6e20 ..The function │ │ │ -000da360: 696e 7465 7261 6c6c 7920 756e 6469 7374 interally undist │ │ │ -000da370: 6f72 7473 2070 6f69 6e74 7320 7769 7468 orts points with │ │ │ -000da380: 2052 4546 3a20 756e 6469 7374 6f72 7450 REF: undistortP │ │ │ -000da390: 6f69 6e74 7320 616e 6420 6361 6c6c 2052 oints and call R │ │ │ -000da3a0: 4546 3a20 6376 3a3a 736f 6c76 6550 6e50 EF: cv::solvePnP │ │ │ -000da3b0: 2c0a 7468 7573 2074 6865 2069 6e70 7574 ,.thus the input │ │ │ -000da3c0: 2061 7265 2076 6572 7920 7369 6d69 6c61 are very simila │ │ │ -000da3d0: 722e 204d 6f72 6520 696e 666f 726d 6174 r. More informat │ │ │ -000da3e0: 696f 6e20 6162 6f75 7420 5065 7273 7065 ion about Perspe │ │ │ -000da3f0: 6374 6976 652d 6e2d 506f 696e 7473 2069 ctive-n-Points i │ │ │ -000da400: 7320 6465 7363 7269 6265 6420 696e 2052 s described in R │ │ │ -000da410: 4546 3a20 6361 6c69 6233 645f 736f 6c76 EF: calib3d_solv │ │ │ -000da420: 6550 6e50 0a66 6f72 206d 6f72 6520 696e ePnP.for more in │ │ │ -000da430: 666f 726d 6174 696f 6e2e 3c2f 6464 3e0a formation.
    . │ │ │ -000da440: 3c64 743e 5265 7475 726e 733a 3c2f 6474
    Returns:
    .
    automatica │ │ │ -000da460: 6c6c 7920 6765 6e65 7261 7465 643c 2f64 lly generated.
    .
    . │ │ │ -000da480: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e
    .
  • │ │ │ -000da490: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    fisheye_solvePn │ │ │ -000da570: 5052 616e 7361 633c 2f68 333e 0a3c 6469 PRansac

    ..public static │ │ │ -000da5e0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  boolean fisheye_so │ │ │ -000da640: 6c76 6550 6e50 5261 6e73 6163 3c2f 7370 lvePnPRansac(Ma │ │ │ -000da6b0: 743c 2f61 3e26 6e62 7370 3b6f 626a 6563 t objec │ │ │ -000da6c0: 7450 6f69 6e74 732c 0a20 3c61 2068 7265 tPoints,. Mat&nb │ │ │ -000da710: 7370 3b69 6d61 6765 506f 696e 7473 2c0a sp;imagePoints,. │ │ │ -000da720: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000da760: 3c2f 613e 266e 6273 703b 6361 6d65 7261  camera │ │ │ -000da770: 4d61 7472 6978 2c0a 203c 6120 6872 6566 Matrix,. Mat&nbs │ │ │ -000da7c0: 703b 6469 7374 436f 6566 6673 2c0a 203c p;distCoeffs,. < │ │ │ -000da7d0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000da7e0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000da7f0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000da800: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat rvec,. < │ │ │ -000da820: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000da830: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000da840: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000da850: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat tvec,. b │ │ │ -000da870: 6f6f 6c65 616e 266e 6273 703b 7573 6545 oolean useE │ │ │ -000da880: 7874 7269 6e73 6963 4775 6573 732c 0a20 xtrinsicGuess,. │ │ │ -000da890: 696e 7426 6e62 7370 3b69 7465 7261 7469 int iterati │ │ │ -000da8a0: 6f6e 7343 6f75 6e74 2c0a 2066 6c6f 6174 onsCount,. float │ │ │ -000da8b0: 266e 6273 703b 7265 7072 6f6a 6563 7469  reprojecti │ │ │ -000da8c0: 6f6e 4572 726f 722c 0a20 646f 7562 6c65 onError,. double │ │ │ -000da8d0: 266e 6273 703b 636f 6e66 6964 656e 6365  confidence │ │ │ -000da8e0: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c ).< │ │ │ -000da8f0: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -000da900: 223e 4669 6e64 7320 616e 206f 626a 6563 ">Finds an objec │ │ │ -000da910: 7420 706f 7365 2066 726f 6d20 3344 2d32 t pose from 3D-2 │ │ │ -000da920: 4420 706f 696e 7420 636f 7272 6573 706f D point correspo │ │ │ -000da930: 6e64 656e 6365 7320 7573 696e 6720 7468 ndences using th │ │ │ -000da940: 6520 5241 4e53 4143 2073 6368 656d 6520 e RANSAC scheme │ │ │ -000da950: 666f 7220 6669 7368 6579 6520 6361 6d65 for fisheye came │ │ │ -000da960: 7261 206d 6f6f 6465 6c2e 3c2f 6469 763e ra moodel. │ │ │ -000da970: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ -000da990: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    objectPoints< │ │ │ -000da9b0: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ -000da9c0: 6620 6f62 6a65 6374 2070 6f69 6e74 7320 f object points │ │ │ -000da9d0: 696e 2074 6865 206f 626a 6563 7420 636f in the object co │ │ │ -000da9e0: 6f72 6469 6e61 7465 2073 7061 6365 2c20 ordinate space, │ │ │ -000da9f0: 4e78 3320 312d 6368 616e 6e65 6c20 6f72 Nx3 1-channel or │ │ │ -000daa00: 0a31 784e 2f4e 7831 2033 2d63 6861 6e6e .1xN/Nx1 3-chann │ │ │ -000daa10: 656c 2c20 7768 6572 6520 4e20 6973 2074 el, where N is t │ │ │ -000daa20: 6865 206e 756d 6265 7220 6f66 2070 6f69 he number of poi │ │ │ -000daa30: 6e74 732e 2076 6563 746f 7226 6c74 3b50 nts. vector<P │ │ │ -000daa40: 6f69 6e74 3364 2667 743b 2063 616e 2062 oint3d> can b │ │ │ -000daa50: 6520 616c 736f 2070 6173 7365 6420 6865 e also passed he │ │ │ -000daa60: 7265 2e3c 2f64 643e 0a3c 6464 3e3c 636f re.
    .
    imagePoints - Array of │ │ │ -000daa90: 2063 6f72 7265 7370 6f6e 6469 6e67 2069 corresponding i │ │ │ -000daaa0: 6d61 6765 2070 6f69 6e74 732c 204e 7832 mage points, Nx2 │ │ │ -000daab0: 2031 2d63 6861 6e6e 656c 206f 7220 3178 1-channel or 1x │ │ │ -000daac0: 4e2f 4e78 3120 322d 6368 616e 6e65 6c2c N/Nx1 2-channel, │ │ │ -000daad0: 0a77 6865 7265 204e 2069 7320 7468 6520 .where N is the │ │ │ -000daae0: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ -000daaf0: 2e20 7665 6374 6f72 266c 743b 506f 696e . vector<Poin │ │ │ -000dab00: 7432 6426 6774 3b20 6361 6e20 6265 2061 t2d> can be a │ │ │ -000dab10: 6c73 6f20 7061 7373 6564 2068 6572 652e lso passed here. │ │ │ -000dab20: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000dab30: 6361 6d65 7261 4d61 7472 6978 3c2f 636f cameraMatrix - Input came │ │ │ -000dab50: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ -000dab60: 7269 7820 5c28 5c63 616d 6572 616d 6174 rix \(\cameramat │ │ │ -000dab70: 7269 787b 417d 5c29 202e 3c2f 6464 3e0a rix{A}\) .
    . │ │ │ -000dab80: 3c64 643e 3c63 6f64 653e 6469 7374 436f
    distCo │ │ │ -000dab90: 6566 6673 3c2f 636f 6465 3e20 2d20 496e effs - In │ │ │ -000daba0: 7075 7420 7665 6374 6f72 206f 6620 6469 put vector of di │ │ │ -000dabb0: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ -000dabc0: 6965 6e74 7320 2834 7831 2f31 7834 292e ients (4x1/1x4). │ │ │ -000dabd0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000dabe0: 7276 6563 3c2f 636f 6465 3e20 2d20 4f75 rvec - Ou │ │ │ -000dabf0: 7470 7574 2072 6f74 6174 696f 6e20 7665 tput rotation ve │ │ │ -000dac00: 6374 6f72 2028 7365 6520 5245 463a 2052 ctor (see REF: R │ │ │ -000dac10: 6f64 7269 6775 6573 2029 2074 6861 742c odrigues ) that, │ │ │ -000dac20: 2074 6f67 6574 6865 7220 7769 7468 2074 together with t │ │ │ -000dac30: 7665 632c 2062 7269 6e67 7320 706f 696e vec, brings poin │ │ │ -000dac40: 7473 2066 726f 6d0a 7468 6520 6d6f 6465 ts from.the mode │ │ │ -000dac50: 6c20 636f 6f72 6469 6e61 7465 2073 7973 l coordinate sys │ │ │ -000dac60: 7465 6d20 746f 2074 6865 2063 616d 6572 tem to the camer │ │ │ -000dac70: 6120 636f 6f72 6469 6e61 7465 2073 7973 a coordinate sys │ │ │ -000dac80: 7465 6d2e 3c2f 6464 3e0a 3c64 643e 3c63 tem.
    .
    tvec │ │ │ -000daca0: 2d20 4f75 7470 7574 2074 7261 6e73 6c61 - Output transla │ │ │ -000dacb0: 7469 6f6e 2076 6563 746f 722e 3c2f 6464 tion vector.
    .
    useE │ │ │ -000dacd0: 7874 7269 6e73 6963 4775 6573 733c 2f63 xtrinsicGuess - Parameter │ │ │ -000dacf0: 2075 7365 6420 666f 7220 2353 4f4c 5645 used for #SOLVE │ │ │ -000dad00: 504e 505f 4954 4552 4154 4956 452e 2049 PNP_ITERATIVE. I │ │ │ -000dad10: 6620 7472 7565 2028 3129 2c20 7468 6520 f true (1), the │ │ │ -000dad20: 6675 6e63 7469 6f6e 2075 7365 730a 7468 function uses.th │ │ │ -000dad30: 6520 7072 6f76 6964 6564 2072 7665 6320 e provided rvec │ │ │ -000dad40: 616e 6420 7476 6563 2076 616c 7565 7320 and tvec values │ │ │ -000dad50: 6173 2069 6e69 7469 616c 2061 7070 726f as initial appro │ │ │ -000dad60: 7869 6d61 7469 6f6e 7320 6f66 2074 6865 ximations of the │ │ │ -000dad70: 2072 6f74 6174 696f 6e20 616e 6420 7472 rotation and tr │ │ │ -000dad80: 616e 736c 6174 696f 6e0a 7665 6374 6f72 anslation.vector │ │ │ -000dad90: 732c 2072 6573 7065 6374 6976 656c 792c s, respectively, │ │ │ -000dada0: 2061 6e64 2066 7572 7468 6572 206f 7074 and further opt │ │ │ -000dadb0: 696d 697a 6573 2074 6865 6d2e 3c2f 6464 imizes them.
    .
    iter │ │ │ -000dadd0: 6174 696f 6e73 436f 756e 743c 2f63 6f64 ationsCount - Number of i │ │ │ -000dadf0: 7465 7261 7469 6f6e 732e 3c2f 6464 3e0a terations.
    . │ │ │ -000dae00: 3c64 643e 3c63 6f64 653e 7265 7072 6f6a
    reproj │ │ │ -000dae10: 6563 7469 6f6e 4572 726f 723c 2f63 6f64 ectionError - Inlier thre │ │ │ -000dae30: 7368 6f6c 6420 7661 6c75 6520 7573 6564 shold value used │ │ │ -000dae40: 2062 7920 7468 6520 5241 4e53 4143 2070 by the RANSAC p │ │ │ -000dae50: 726f 6365 6475 7265 2e20 5468 6520 7061 rocedure. The pa │ │ │ -000dae60: 7261 6d65 7465 7220 7661 6c75 650a 6973 rameter value.is │ │ │ -000dae70: 2074 6865 206d 6178 696d 756d 2061 6c6c the maximum all │ │ │ -000dae80: 6f77 6564 2064 6973 7461 6e63 6520 6265 owed distance be │ │ │ -000dae90: 7477 6565 6e20 7468 6520 6f62 7365 7276 tween the observ │ │ │ -000daea0: 6564 2061 6e64 2063 6f6d 7075 7465 6420 ed and computed │ │ │ -000daeb0: 706f 696e 7420 7072 6f6a 6563 7469 6f6e point projection │ │ │ -000daec0: 7320 746f 2063 6f6e 7369 6465 7220 6974 s to consider it │ │ │ -000daed0: 0a61 6e20 696e 6c69 6572 2e3c 2f64 643e .an inlier.
    │ │ │ -000daee0: 0a3c 6464 3e3c 636f 6465 3e63 6f6e 6669 .
    confi │ │ │ -000daef0: 6465 6e63 653c 2f63 6f64 653e 202d 2054 dence - T │ │ │ -000daf00: 6865 2070 726f 6261 6269 6c69 7479 2074 he probability t │ │ │ -000daf10: 6861 7420 7468 6520 616c 676f 7269 7468 hat the algorith │ │ │ -000daf20: 6d20 7072 6f64 7563 6573 2061 2075 7365 m produces a use │ │ │ -000daf30: 6675 6c20 7265 7375 6c74 2e0a 5468 6520 ful result..The │ │ │ -000daf40: 6675 6e63 7469 6f6e 2069 6e74 6572 616c function interal │ │ │ -000daf50: 6c79 2075 6e64 6973 746f 7274 7320 706f ly undistorts po │ │ │ -000daf60: 696e 7473 2077 6974 6820 5245 463a 2075 ints with REF: u │ │ │ -000daf70: 6e64 6973 746f 7274 506f 696e 7473 2061 ndistortPoints a │ │ │ -000daf80: 6e64 2063 616c 6c20 5245 463a 2063 763a nd call REF: cv: │ │ │ -000daf90: 3a73 6f6c 7665 506e 502c 0a74 6875 7320 :solvePnP,.thus │ │ │ -000dafa0: 7468 6520 696e 7075 7420 6172 6520 7665 the input are ve │ │ │ -000dafb0: 7279 2073 696d 696c 6172 2e20 4d6f 7265 ry similar. More │ │ │ -000dafc0: 2069 6e66 6f72 6d61 7469 6f6e 2061 626f information abo │ │ │ -000dafd0: 7574 2050 6572 7370 6563 7469 7665 2d6e ut Perspective-n │ │ │ -000dafe0: 2d50 6f69 6e74 7320 6973 2064 6573 6372 -Points is descr │ │ │ -000daff0: 6962 6564 2069 6e20 5245 463a 2063 616c ibed in REF: cal │ │ │ -000db000: 6962 3364 5f73 6f6c 7665 506e 500a 666f ib3d_solvePnP.fo │ │ │ -000db010: 7220 6d6f 7265 2069 6e66 6f72 6d61 7469 r more informati │ │ │ -000db020: 6f6e 2e3c 2f64 643e 0a3c 6474 3e52 6574 on.
    .
    Ret │ │ │ -000db030: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e61 urns:
    .
    a │ │ │ -000db040: 7574 6f6d 6174 6963 616c 6c79 2067 656e utomatically gen │ │ │ -000db050: 6572 6174 6564 3c2f 6464 3e0a 3c2f 646c erated
    .
    ...
  • .
  • .< │ │ │ -000db080: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ -000db090: 6574 6169 6c22 2069 643d 2266 6973 6865 etail" id="fishe │ │ │ -000db0a0: 7965 5f73 6f6c 7665 506e 5052 616e 7361 ye_solvePnPRansa │ │ │ -000db0b0: 6328 6f72 672e 6f70 656e 6376 2e63 6f72 c(org.opencv.cor │ │ │ -000db0c0: 652e 4d61 742c 6f72 672e 6f70 656e 6376 e.Mat,org.opencv │ │ │ -000db0d0: 2e63 6f72 652e 4d61 742c 6f72 672e 6f70 .core.Mat,org.op │ │ │ -000db0e0: 656e 6376 2e63 6f72 652e 4d61 742c 6f72 encv.core.Mat,or │ │ │ -000db0f0: 672e 6f70 656e 6376 2e63 6f72 652e 4d61 g.opencv.core.Ma │ │ │ -000db100: 742c 6f72 672e 6f70 656e 6376 2e63 6f72 t,org.opencv.cor │ │ │ -000db110: 652e 4d61 742c 6f72 672e 6f70 656e 6376 e.Mat,org.opencv │ │ │ -000db120: 2e63 6f72 652e 4d61 742c 626f 6f6c 6561 .core.Mat,boolea │ │ │ -000db130: 6e2c 696e 742c 666c 6f61 7429 223e 0a3c n,int,float)">.< │ │ │ -000db140: 6833 3e66 6973 6865 7965 5f73 6f6c 7665 h3>fisheye_solve │ │ │ -000db150: 506e 5052 616e 7361 633c 2f68 333e 0a3c PnPRansac.< │ │ │ -000db160: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ -000db170: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ -000db180: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ -000db190: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ -000db1c0: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ -000db1d0: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ -000db1e0: 726e 2d74 7970 6522 3e62 6f6f 6c65 616e rn-type">boolean │ │ │ -000db1f0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  fisheye_ │ │ │ -000db220: 736f 6c76 6550 6e50 5261 6e73 6163 3c2f solvePnPRansac( │ │ │ -000db290: 4d61 743c 2f61 3e26 6e62 7370 3b6f 626a Mat obj │ │ │ -000db2a0: 6563 7450 6f69 6e74 732c 0a20 3c61 2068 ectPoints,. Mat& │ │ │ -000db2f0: 6e62 7370 3b69 6d61 6765 506f 696e 7473 nbsp;imagePoints │ │ │ -000db300: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000db340: 6174 3c2f 613e 266e 6273 703b 6361 6d65 at came │ │ │ -000db350: 7261 4d61 7472 6978 2c0a 203c 6120 6872 raMatrix,. Mat&n │ │ │ -000db3a0: 6273 703b 6469 7374 436f 6566 6673 2c0a bsp;distCoeffs,. │ │ │ -000db3b0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000db3f0: 3c2f 613e 266e 6273 703b 7276 6563 2c0a  rvec,. │ │ │ -000db400: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000db440: 3c2f 613e 266e 6273 703b 7476 6563 2c0a  tvec,. │ │ │ -000db450: 2062 6f6f 6c65 616e 266e 6273 703b 7573 boolean us │ │ │ -000db460: 6545 7874 7269 6e73 6963 4775 6573 732c eExtrinsicGuess, │ │ │ -000db470: 0a20 696e 7426 6e62 7370 3b69 7465 7261 . int itera │ │ │ -000db480: 7469 6f6e 7343 6f75 6e74 2c0a 2066 6c6f tionsCount,. flo │ │ │ -000db490: 6174 266e 6273 703b 7265 7072 6f6a 6563 at reprojec │ │ │ -000db4a0: 7469 6f6e 4572 726f 7229 3c2f 7370 616e tionError).
    Finds │ │ │ -000db4d0: 2061 6e20 6f62 6a65 6374 2070 6f73 6520 an object pose │ │ │ -000db4e0: 6672 6f6d 2033 442d 3244 2070 6f69 6e74 from 3D-2D point │ │ │ -000db4f0: 2063 6f72 7265 7370 6f6e 6465 6e63 6573 correspondences │ │ │ -000db500: 2075 7369 6e67 2074 6865 2052 414e 5341 using the RANSA │ │ │ -000db510: 4320 7363 6865 6d65 2066 6f72 2066 6973 C scheme for fis │ │ │ -000db520: 6865 7965 2063 616d 6572 6120 6d6f 6f64 heye camera mood │ │ │ -000db530: 656c 2e3c 2f64 6976 3e0a 3c64 6c20 636c el.
    .
    .
    Parameters:
    .
    obje │ │ │ -000db570: 6374 506f 696e 7473 3c2f 636f 6465 3e20 ctPoints │ │ │ -000db580: 2d20 4172 7261 7920 6f66 206f 626a 6563 - Array of objec │ │ │ -000db590: 7420 706f 696e 7473 2069 6e20 7468 6520 t points in the │ │ │ -000db5a0: 6f62 6a65 6374 2063 6f6f 7264 696e 6174 object coordinat │ │ │ -000db5b0: 6520 7370 6163 652c 204e 7833 2031 2d63 e space, Nx3 1-c │ │ │ -000db5c0: 6861 6e6e 656c 206f 720a 3178 4e2f 4e78 hannel or.1xN/Nx │ │ │ -000db5d0: 3120 332d 6368 616e 6e65 6c2c 2077 6865 1 3-channel, whe │ │ │ -000db5e0: 7265 204e 2069 7320 7468 6520 6e75 6d62 re N is the numb │ │ │ -000db5f0: 6572 206f 6620 706f 696e 7473 2e20 7665 er of points. ve │ │ │ -000db600: 6374 6f72 266c 743b 506f 696e 7433 6426 ctor<Point3d& │ │ │ -000db610: 6774 3b20 6361 6e20 6265 2061 6c73 6f20 gt; can be also │ │ │ -000db620: 7061 7373 6564 2068 6572 652e 3c2f 6464 passed here.
    .
    imag │ │ │ -000db640: 6550 6f69 6e74 733c 2f63 6f64 653e 202d ePoints - │ │ │ -000db650: 2041 7272 6179 206f 6620 636f 7272 6573 Array of corres │ │ │ -000db660: 706f 6e64 696e 6720 696d 6167 6520 706f ponding image po │ │ │ -000db670: 696e 7473 2c20 4e78 3220 312d 6368 616e ints, Nx2 1-chan │ │ │ -000db680: 6e65 6c20 6f72 2031 784e 2f4e 7831 2032 nel or 1xN/Nx1 2 │ │ │ -000db690: 2d63 6861 6e6e 656c 2c0a 7768 6572 6520 -channel,.where │ │ │ -000db6a0: 4e20 6973 2074 6865 206e 756d 6265 7220 N is the number │ │ │ -000db6b0: 6f66 2070 6f69 6e74 732e 2076 6563 746f of points. vecto │ │ │ -000db6c0: 7226 6c74 3b50 6f69 6e74 3264 2667 743b r<Point2d> │ │ │ -000db6d0: 2063 616e 2062 6520 616c 736f 2070 6173 can be also pas │ │ │ -000db6e0: 7365 6420 6865 7265 2e3c 2f64 643e 0a3c sed here.
    .< │ │ │ -000db6f0: 6464 3e3c 636f 6465 3e63 616d 6572 614d dd>cameraM │ │ │ -000db700: 6174 7269 783c 2f63 6f64 653e 202d 2049 atrix - I │ │ │ -000db710: 6e70 7574 2063 616d 6572 6120 696e 7472 nput camera intr │ │ │ -000db720: 696e 7369 6320 6d61 7472 6978 205c 285c insic matrix \(\ │ │ │ -000db730: 6361 6d65 7261 6d61 7472 6978 7b41 7d5c cameramatrix{A}\ │ │ │ -000db740: 2920 2e3c 2f64 643e 0a3c 6464 3e3c 636f ) ..
    distCoeffs - Input vec │ │ │ -000db770: 746f 7220 6f66 2064 6973 746f 7274 696f tor of distortio │ │ │ -000db780: 6e20 636f 6566 6669 6369 656e 7473 2028 n coefficients ( │ │ │ -000db790: 3478 312f 3178 3429 2e3c 2f64 643e 0a3c 4x1/1x4).
    .< │ │ │ -000db7a0: 6464 3e3c 636f 6465 3e72 7665 633c 2f63 dd>rvec - Output ro │ │ │ -000db7c0: 7461 7469 6f6e 2076 6563 746f 7220 2873 tation vector (s │ │ │ -000db7d0: 6565 2052 4546 3a20 526f 6472 6967 7565 ee REF: Rodrigue │ │ │ -000db7e0: 7320 2920 7468 6174 2c20 746f 6765 7468 s ) that, togeth │ │ │ -000db7f0: 6572 2077 6974 6820 7476 6563 2c20 6272 er with tvec, br │ │ │ -000db800: 696e 6773 2070 6f69 6e74 7320 6672 6f6d ings points from │ │ │ -000db810: 0a74 6865 206d 6f64 656c 2063 6f6f 7264 .the model coord │ │ │ -000db820: 696e 6174 6520 7379 7374 656d 2074 6f20 inate system to │ │ │ -000db830: 7468 6520 6361 6d65 7261 2063 6f6f 7264 the camera coord │ │ │ -000db840: 696e 6174 6520 7379 7374 656d 2e3c 2f64 inate system..
    tve │ │ │ -000db860: 633c 2f63 6f64 653e 202d 204f 7574 7075 c - Outpu │ │ │ -000db870: 7420 7472 616e 736c 6174 696f 6e20 7665 t translation ve │ │ │ -000db880: 6374 6f72 2e3c 2f64 643e 0a3c 6464 3e3c ctor.
    .
    < │ │ │ -000db890: 636f 6465 3e75 7365 4578 7472 696e 7369 code>useExtrinsi │ │ │ -000db8a0: 6347 7565 7373 3c2f 636f 6465 3e20 2d20 cGuess - │ │ │ -000db8b0: 5061 7261 6d65 7465 7220 7573 6564 2066 Parameter used f │ │ │ -000db8c0: 6f72 2023 534f 4c56 4550 4e50 5f49 5445 or #SOLVEPNP_ITE │ │ │ -000db8d0: 5241 5449 5645 2e20 4966 2074 7275 6520 RATIVE. If true │ │ │ -000db8e0: 2831 292c 2074 6865 2066 756e 6374 696f (1), the functio │ │ │ -000db8f0: 6e20 7573 6573 0a74 6865 2070 726f 7669 n uses.the provi │ │ │ -000db900: 6465 6420 7276 6563 2061 6e64 2074 7665 ded rvec and tve │ │ │ -000db910: 6320 7661 6c75 6573 2061 7320 696e 6974 c values as init │ │ │ -000db920: 6961 6c20 6170 7072 6f78 696d 6174 696f ial approximatio │ │ │ -000db930: 6e73 206f 6620 7468 6520 726f 7461 7469 ns of the rotati │ │ │ -000db940: 6f6e 2061 6e64 2074 7261 6e73 6c61 7469 on and translati │ │ │ -000db950: 6f6e 0a76 6563 746f 7273 2c20 7265 7370 on.vectors, resp │ │ │ -000db960: 6563 7469 7665 6c79 2c20 616e 6420 6675 ectively, and fu │ │ │ -000db970: 7274 6865 7220 6f70 7469 6d69 7a65 7320 rther optimizes │ │ │ -000db980: 7468 656d 2e3c 2f64 643e 0a3c 6464 3e3c them.
    .
    < │ │ │ -000db990: 636f 6465 3e69 7465 7261 7469 6f6e 7343 code>iterationsC │ │ │ -000db9a0: 6f75 6e74 3c2f 636f 6465 3e20 2d20 4e75 ount - Nu │ │ │ -000db9b0: 6d62 6572 206f 6620 6974 6572 6174 696f mber of iteratio │ │ │ -000db9c0: 6e73 2e3c 2f64 643e 0a3c 6464 3e3c 636f ns.
    .
    reprojectionE │ │ │ -000db9e0: 7272 6f72 3c2f 636f 6465 3e20 2d20 496e rror - In │ │ │ -000db9f0: 6c69 6572 2074 6872 6573 686f 6c64 2076 lier threshold v │ │ │ -000dba00: 616c 7565 2075 7365 6420 6279 2074 6865 alue used by the │ │ │ -000dba10: 2052 414e 5341 4320 7072 6f63 6564 7572 RANSAC procedur │ │ │ -000dba20: 652e 2054 6865 2070 6172 616d 6574 6572 e. The parameter │ │ │ -000dba30: 2076 616c 7565 0a69 7320 7468 6520 6d61 value.is the ma │ │ │ -000dba40: 7869 6d75 6d20 616c 6c6f 7765 6420 6469 ximum allowed di │ │ │ -000dba50: 7374 616e 6365 2062 6574 7765 656e 2074 stance between t │ │ │ -000dba60: 6865 206f 6273 6572 7665 6420 616e 6420 he observed and │ │ │ -000dba70: 636f 6d70 7574 6564 2070 6f69 6e74 2070 computed point p │ │ │ -000dba80: 726f 6a65 6374 696f 6e73 2074 6f20 636f rojections to co │ │ │ -000dba90: 6e73 6964 6572 2069 740a 616e 2069 6e6c nsider it.an inl │ │ │ -000dbaa0: 6965 722e 0a54 6865 2066 756e 6374 696f ier..The functio │ │ │ -000dbab0: 6e20 696e 7465 7261 6c6c 7920 756e 6469 n interally undi │ │ │ -000dbac0: 7374 6f72 7473 2070 6f69 6e74 7320 7769 storts points wi │ │ │ -000dbad0: 7468 2052 4546 3a20 756e 6469 7374 6f72 th REF: undistor │ │ │ -000dbae0: 7450 6f69 6e74 7320 616e 6420 6361 6c6c tPoints and call │ │ │ -000dbaf0: 2052 4546 3a20 6376 3a3a 736f 6c76 6550 REF: cv::solveP │ │ │ -000dbb00: 6e50 2c0a 7468 7573 2074 6865 2069 6e70 nP,.thus the inp │ │ │ -000dbb10: 7574 2061 7265 2076 6572 7920 7369 6d69 ut are very simi │ │ │ -000dbb20: 6c61 722e 204d 6f72 6520 696e 666f 726d lar. More inform │ │ │ -000dbb30: 6174 696f 6e20 6162 6f75 7420 5065 7273 ation about Pers │ │ │ -000dbb40: 7065 6374 6976 652d 6e2d 506f 696e 7473 pective-n-Points │ │ │ -000dbb50: 2069 7320 6465 7363 7269 6265 6420 696e is described in │ │ │ -000dbb60: 2052 4546 3a20 6361 6c69 6233 645f 736f REF: calib3d_so │ │ │ -000dbb70: 6c76 6550 6e50 0a66 6f72 206d 6f72 6520 lvePnP.for more │ │ │ -000dbb80: 696e 666f 726d 6174 696f 6e2e 3c2f 6464 information.
    .
    Returns:.
    automati │ │ │ -000dbbb0: 6361 6c6c 7920 6765 6e65 7261 7465 643c cally generated< │ │ │ -000dbbc0: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    ....
  • .
    .

    fisheye_so │ │ │ -000dbcb0: 6c76 6550 6e50 5261 6e73 6163 3c2f 6833 lvePnPRansac

    .
    .
    │ │ │ -000dbd00: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -000dbd20: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -000dbd30: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;bool │ │ │ -000dbd50: 6561 6e3c 2f73 7061 6e3e 266e 6273 703b ean  │ │ │ -000dbd60: 3c73 7061 6e20 636c 6173 733d 2265 6c65 fishe │ │ │ -000dbd80: 7965 5f73 6f6c 7665 506e 5052 616e 7361 ye_solvePnPRansa │ │ │ -000dbd90: 633c 2f73 7061 6e3e 3c77 6272 3e3c 7370 c(Mat  │ │ │ -000dbe00: 6f62 6a65 6374 506f 696e 7473 2c0a 203c objectPoints,. < │ │ │ -000dbe10: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000dbe20: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000dbe30: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000dbe40: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat imagePoi │ │ │ -000dbe60: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. Mat c │ │ │ -000dbeb0: 616d 6572 614d 6174 7269 782c 0a20 3c61 ameraMatrix,. Mat distCoeff │ │ │ -000dbf10: 732c 0a20 3c61 2068 7265 663d 222e 2e2f s,. │ │ │ -000dbf50: 4d61 743c 2f61 3e26 6e62 7370 3b72 7665 Mat rve │ │ │ -000dbf60: 632c 0a20 3c61 2068 7265 663d 222e 2e2f c,. │ │ │ -000dbfa0: 4d61 743c 2f61 3e26 6e62 7370 3b74 7665 Mat tve │ │ │ -000dbfb0: 632c 0a20 626f 6f6c 6561 6e26 6e62 7370 c,. boolean  │ │ │ -000dbfc0: 3b75 7365 4578 7472 696e 7369 6347 7565 ;useExtrinsicGue │ │ │ -000dbfd0: 7373 2c0a 2069 6e74 266e 6273 703b 6974 ss,. int it │ │ │ -000dbfe0: 6572 6174 696f 6e73 436f 756e 7429 3c2f erationsCount)
    .
    F │ │ │ -000dc010: 696e 6473 2061 6e20 6f62 6a65 6374 2070 inds an object p │ │ │ -000dc020: 6f73 6520 6672 6f6d 2033 442d 3244 2070 ose from 3D-2D p │ │ │ -000dc030: 6f69 6e74 2063 6f72 7265 7370 6f6e 6465 oint corresponde │ │ │ -000dc040: 6e63 6573 2075 7369 6e67 2074 6865 2052 nces using the R │ │ │ -000dc050: 414e 5341 4320 7363 6865 6d65 2066 6f72 ANSAC scheme for │ │ │ -000dc060: 2066 6973 6865 7965 2063 616d 6572 6120 fisheye camera │ │ │ -000dc070: 6d6f 6f64 656c 2e3c 2f64 6976 3e0a 3c64 moodel.
    . │ │ │ -000dc090: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ -000dc0a0: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000dc0b0: 6f62 6a65 6374 506f 696e 7473 3c2f 636f objectPoints - Array of o │ │ │ -000dc0d0: 626a 6563 7420 706f 696e 7473 2069 6e20 bject points in │ │ │ -000dc0e0: 7468 6520 6f62 6a65 6374 2063 6f6f 7264 the object coord │ │ │ -000dc0f0: 696e 6174 6520 7370 6163 652c 204e 7833 inate space, Nx3 │ │ │ -000dc100: 2031 2d63 6861 6e6e 656c 206f 720a 3178 1-channel or.1x │ │ │ -000dc110: 4e2f 4e78 3120 332d 6368 616e 6e65 6c2c N/Nx1 3-channel, │ │ │ -000dc120: 2077 6865 7265 204e 2069 7320 7468 6520 where N is the │ │ │ -000dc130: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ -000dc140: 2e20 7665 6374 6f72 266c 743b 506f 696e . vector<Poin │ │ │ -000dc150: 7433 6426 6774 3b20 6361 6e20 6265 2061 t3d> can be a │ │ │ -000dc160: 6c73 6f20 7061 7373 6564 2068 6572 652e lso passed here. │ │ │ -000dc170: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000dc180: 696d 6167 6550 6f69 6e74 733c 2f63 6f64 imagePoints - Array of co │ │ │ -000dc1a0: 7272 6573 706f 6e64 696e 6720 696d 6167 rresponding imag │ │ │ -000dc1b0: 6520 706f 696e 7473 2c20 4e78 3220 312d e points, Nx2 1- │ │ │ -000dc1c0: 6368 616e 6e65 6c20 6f72 2031 784e 2f4e channel or 1xN/N │ │ │ -000dc1d0: 7831 2032 2d63 6861 6e6e 656c 2c0a 7768 x1 2-channel,.wh │ │ │ -000dc1e0: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ -000dc1f0: 6265 7220 6f66 2070 6f69 6e74 732e 2076 ber of points. v │ │ │ -000dc200: 6563 746f 7226 6c74 3b50 6f69 6e74 3264 ector<Point2d │ │ │ -000dc210: 2667 743b 2063 616e 2062 6520 616c 736f > can be also │ │ │ -000dc220: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    cam │ │ │ -000dc240: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ -000dc250: 202d 2049 6e70 7574 2063 616d 6572 6120 - Input camera │ │ │ -000dc260: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ -000dc270: 205c 285c 6361 6d65 7261 6d61 7472 6978 \(\cameramatrix │ │ │ -000dc280: 7b41 7d5c 2920 2e3c 2f64 643e 0a3c 6464 {A}\) .
    .
    distCoeff │ │ │ -000dc2a0: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ -000dc2b0: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ -000dc2c0: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ -000dc2d0: 7473 2028 3478 312f 3178 3429 2e3c 2f64 ts (4x1/1x4)..
    rve │ │ │ -000dc2f0: 633c 2f63 6f64 653e 202d 204f 7574 7075 c - Outpu │ │ │ -000dc300: 7420 726f 7461 7469 6f6e 2076 6563 746f t rotation vecto │ │ │ -000dc310: 7220 2873 6565 2052 4546 3a20 526f 6472 r (see REF: Rodr │ │ │ -000dc320: 6967 7565 7320 2920 7468 6174 2c20 746f igues ) that, to │ │ │ -000dc330: 6765 7468 6572 2077 6974 6820 7476 6563 gether with tvec │ │ │ -000dc340: 2c20 6272 696e 6773 2070 6f69 6e74 7320 , brings points │ │ │ -000dc350: 6672 6f6d 0a74 6865 206d 6f64 656c 2063 from.the model c │ │ │ -000dc360: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ -000dc370: 2074 6f20 7468 6520 6361 6d65 7261 2063 to the camera c │ │ │ -000dc380: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ -000dc390: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    tvec - O │ │ │ -000dc3b0: 7574 7075 7420 7472 616e 736c 6174 696f utput translatio │ │ │ -000dc3c0: 6e20 7665 6374 6f72 2e3c 2f64 643e 0a3c n vector.
    .< │ │ │ -000dc3d0: 6464 3e3c 636f 6465 3e75 7365 4578 7472 dd>useExtr │ │ │ -000dc3e0: 696e 7369 6347 7565 7373 3c2f 636f 6465 insicGuess - Parameter us │ │ │ -000dc400: 6564 2066 6f72 2023 534f 4c56 4550 4e50 ed for #SOLVEPNP │ │ │ -000dc410: 5f49 5445 5241 5449 5645 2e20 4966 2074 _ITERATIVE. If t │ │ │ -000dc420: 7275 6520 2831 292c 2074 6865 2066 756e rue (1), the fun │ │ │ -000dc430: 6374 696f 6e20 7573 6573 0a74 6865 2070 ction uses.the p │ │ │ -000dc440: 726f 7669 6465 6420 7276 6563 2061 6e64 rovided rvec and │ │ │ -000dc450: 2074 7665 6320 7661 6c75 6573 2061 7320 tvec values as │ │ │ -000dc460: 696e 6974 6961 6c20 6170 7072 6f78 696d initial approxim │ │ │ -000dc470: 6174 696f 6e73 206f 6620 7468 6520 726f ations of the ro │ │ │ -000dc480: 7461 7469 6f6e 2061 6e64 2074 7261 6e73 tation and trans │ │ │ -000dc490: 6c61 7469 6f6e 0a76 6563 746f 7273 2c20 lation.vectors, │ │ │ -000dc4a0: 7265 7370 6563 7469 7665 6c79 2c20 616e respectively, an │ │ │ -000dc4b0: 6420 6675 7274 6865 7220 6f70 7469 6d69 d further optimi │ │ │ -000dc4c0: 7a65 7320 7468 656d 2e3c 2f64 643e 0a3c zes them..< │ │ │ -000dc4d0: 6464 3e3c 636f 6465 3e69 7465 7261 7469 dd>iterati │ │ │ -000dc4e0: 6f6e 7343 6f75 6e74 3c2f 636f 6465 3e20 onsCount │ │ │ -000dc4f0: 2d20 4e75 6d62 6572 206f 6620 6974 6572 - Number of iter │ │ │ -000dc500: 6174 696f 6e73 2e0a 6973 2074 6865 206d ations..is the m │ │ │ -000dc510: 6178 696d 756d 2061 6c6c 6f77 6564 2064 aximum allowed d │ │ │ -000dc520: 6973 7461 6e63 6520 6265 7477 6565 6e20 istance between │ │ │ -000dc530: 7468 6520 6f62 7365 7276 6564 2061 6e64 the observed and │ │ │ -000dc540: 2063 6f6d 7075 7465 6420 706f 696e 7420 computed point │ │ │ -000dc550: 7072 6f6a 6563 7469 6f6e 7320 746f 2063 projections to c │ │ │ -000dc560: 6f6e 7369 6465 7220 6974 0a61 6e20 696e onsider it.an in │ │ │ -000dc570: 6c69 6572 2e0a 5468 6520 6675 6e63 7469 lier..The functi │ │ │ -000dc580: 6f6e 2069 6e74 6572 616c 6c79 2075 6e64 on interally und │ │ │ -000dc590: 6973 746f 7274 7320 706f 696e 7473 2077 istorts points w │ │ │ -000dc5a0: 6974 6820 5245 463a 2075 6e64 6973 746f ith REF: undisto │ │ │ -000dc5b0: 7274 506f 696e 7473 2061 6e64 2063 616c rtPoints and cal │ │ │ -000dc5c0: 6c20 5245 463a 2063 763a 3a73 6f6c 7665 l REF: cv::solve │ │ │ -000dc5d0: 506e 502c 0a74 6875 7320 7468 6520 696e PnP,.thus the in │ │ │ -000dc5e0: 7075 7420 6172 6520 7665 7279 2073 696d put are very sim │ │ │ -000dc5f0: 696c 6172 2e20 4d6f 7265 2069 6e66 6f72 ilar. More infor │ │ │ -000dc600: 6d61 7469 6f6e 2061 626f 7574 2050 6572 mation about Per │ │ │ -000dc610: 7370 6563 7469 7665 2d6e 2d50 6f69 6e74 spective-n-Point │ │ │ -000dc620: 7320 6973 2064 6573 6372 6962 6564 2069 s is described i │ │ │ -000dc630: 6e20 5245 463a 2063 616c 6962 3364 5f73 n REF: calib3d_s │ │ │ -000dc640: 6f6c 7665 506e 500a 666f 7220 6d6f 7265 olvePnP.for more │ │ │ -000dc650: 2069 6e66 6f72 6d61 7469 6f6e 2e3c 2f64 information.
    .
    Returns:< │ │ │ -000dc670: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
    automat │ │ │ -000dc680: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ -000dc690: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    ...
    ..
  • ..< │ │ │ -000dc770: 6833 3e66 6973 6865 7965 5f73 6f6c 7665 h3>fisheye_solve │ │ │ -000dc780: 506e 5052 616e 7361 633c 2f68 333e 0a3c PnPRansac.< │ │ │ -000dc790: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ -000dc7a0: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ -000dc7b0: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ -000dc7c0: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ -000dc7f0: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ -000dc800: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ -000dc810: 726e 2d74 7970 6522 3e62 6f6f 6c65 616e rn-type">boolean │ │ │ -000dc820: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  fisheye_ │ │ │ -000dc850: 736f 6c76 6550 6e50 5261 6e73 6163 3c2f solvePnPRansac( │ │ │ -000dc8c0: 4d61 743c 2f61 3e26 6e62 7370 3b6f 626a Mat obj │ │ │ -000dc8d0: 6563 7450 6f69 6e74 732c 0a20 3c61 2068 ectPoints,. Mat& │ │ │ -000dc920: 6e62 7370 3b69 6d61 6765 506f 696e 7473 nbsp;imagePoints │ │ │ -000dc930: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000dc970: 6174 3c2f 613e 266e 6273 703b 6361 6d65 at came │ │ │ -000dc980: 7261 4d61 7472 6978 2c0a 203c 6120 6872 raMatrix,. Mat&n │ │ │ -000dc9d0: 6273 703b 6469 7374 436f 6566 6673 2c0a bsp;distCoeffs,. │ │ │ -000dc9e0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000dca20: 3c2f 613e 266e 6273 703b 7276 6563 2c0a  rvec,. │ │ │ -000dca30: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000dca70: 3c2f 613e 266e 6273 703b 7476 6563 2c0a  tvec,. │ │ │ -000dca80: 2062 6f6f 6c65 616e 266e 6273 703b 7573 boolean us │ │ │ -000dca90: 6545 7874 7269 6e73 6963 4775 6573 7329 eExtrinsicGuess) │ │ │ -000dcaa0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64 .Finds an object │ │ │ -000dcad0: 2070 6f73 6520 6672 6f6d 2033 442d 3244 pose from 3D-2D │ │ │ -000dcae0: 2070 6f69 6e74 2063 6f72 7265 7370 6f6e point correspon │ │ │ -000dcaf0: 6465 6e63 6573 2075 7369 6e67 2074 6865 dences using the │ │ │ -000dcb00: 2052 414e 5341 4320 7363 6865 6d65 2066 RANSAC scheme f │ │ │ -000dcb10: 6f72 2066 6973 6865 7965 2063 616d 6572 or fisheye camer │ │ │ -000dcb20: 6120 6d6f 6f64 656c 2e3c 2f64 6976 3e0a a moodel.. │ │ │ -000dcb30: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ -000dcb50: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    objectPoints - Array of │ │ │ -000dcb80: 206f 626a 6563 7420 706f 696e 7473 2069 object points i │ │ │ -000dcb90: 6e20 7468 6520 6f62 6a65 6374 2063 6f6f n the object coo │ │ │ -000dcba0: 7264 696e 6174 6520 7370 6163 652c 204e rdinate space, N │ │ │ -000dcbb0: 7833 2031 2d63 6861 6e6e 656c 206f 720a x3 1-channel or. │ │ │ -000dcbc0: 3178 4e2f 4e78 3120 332d 6368 616e 6e65 1xN/Nx1 3-channe │ │ │ -000dcbd0: 6c2c 2077 6865 7265 204e 2069 7320 7468 l, where N is th │ │ │ -000dcbe0: 6520 6e75 6d62 6572 206f 6620 706f 696e e number of poin │ │ │ -000dcbf0: 7473 2e20 7665 6374 6f72 266c 743b 506f ts. vector<Po │ │ │ -000dcc00: 696e 7433 6426 6774 3b20 6361 6e20 6265 int3d> can be │ │ │ -000dcc10: 2061 6c73 6f20 7061 7373 6564 2068 6572 also passed her │ │ │ -000dcc20: 652e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 e.
    .
    imagePoints - Array of │ │ │ -000dcc50: 636f 7272 6573 706f 6e64 696e 6720 696d corresponding im │ │ │ -000dcc60: 6167 6520 706f 696e 7473 2c20 4e78 3220 age points, Nx2 │ │ │ -000dcc70: 312d 6368 616e 6e65 6c20 6f72 2031 784e 1-channel or 1xN │ │ │ -000dcc80: 2f4e 7831 2032 2d63 6861 6e6e 656c 2c0a /Nx1 2-channel,. │ │ │ -000dcc90: 7768 6572 6520 4e20 6973 2074 6865 206e where N is the n │ │ │ -000dcca0: 756d 6265 7220 6f66 2070 6f69 6e74 732e umber of points. │ │ │ -000dccb0: 2076 6563 746f 7226 6c74 3b50 6f69 6e74 vector<Point │ │ │ -000dccc0: 3264 2667 743b 2063 616e 2062 6520 616c 2d> can be al │ │ │ -000dccd0: 736f 2070 6173 7365 6420 6865 7265 2e3c so passed here.< │ │ │ -000dcce0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ -000dccf0: 616d 6572 614d 6174 7269 783c 2f63 6f64 ameraMatrix - Input camer │ │ │ -000dcd10: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ -000dcd20: 6978 205c 285c 6361 6d65 7261 6d61 7472 ix \(\cameramatr │ │ │ -000dcd30: 6978 7b41 7d5c 2920 2e3c 2f64 643e 0a3c ix{A}\) .
    .< │ │ │ -000dcd40: 6464 3e3c 636f 6465 3e64 6973 7443 6f65 dd>distCoe │ │ │ -000dcd50: 6666 733c 2f63 6f64 653e 202d 2049 6e70 ffs - Inp │ │ │ -000dcd60: 7574 2076 6563 746f 7220 6f66 2064 6973 ut vector of dis │ │ │ -000dcd70: 746f 7274 696f 6e20 636f 6566 6669 6369 tortion coeffici │ │ │ -000dcd80: 656e 7473 2028 3478 312f 3178 3429 2e3c ents (4x1/1x4).< │ │ │ -000dcd90: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e72 /dd>.
    r │ │ │ -000dcda0: 7665 633c 2f63 6f64 653e 202d 204f 7574 vec - Out │ │ │ -000dcdb0: 7075 7420 726f 7461 7469 6f6e 2076 6563 put rotation vec │ │ │ -000dcdc0: 746f 7220 2873 6565 2052 4546 3a20 526f tor (see REF: Ro │ │ │ -000dcdd0: 6472 6967 7565 7320 2920 7468 6174 2c20 drigues ) that, │ │ │ -000dcde0: 746f 6765 7468 6572 2077 6974 6820 7476 together with tv │ │ │ -000dcdf0: 6563 2c20 6272 696e 6773 2070 6f69 6e74 ec, brings point │ │ │ -000dce00: 7320 6672 6f6d 0a74 6865 206d 6f64 656c s from.the model │ │ │ -000dce10: 2063 6f6f 7264 696e 6174 6520 7379 7374 coordinate syst │ │ │ -000dce20: 656d 2074 6f20 7468 6520 6361 6d65 7261 em to the camera │ │ │ -000dce30: 2063 6f6f 7264 696e 6174 6520 7379 7374 coordinate syst │ │ │ -000dce40: 656d 2e3c 2f64 643e 0a3c 6464 3e3c 636f em.
    .
    tvec - │ │ │ -000dce60: 204f 7574 7075 7420 7472 616e 736c 6174 Output translat │ │ │ -000dce70: 696f 6e20 7665 6374 6f72 2e3c 2f64 643e ion vector.
    │ │ │ -000dce80: 0a3c 6464 3e3c 636f 6465 3e75 7365 4578 .
    useEx │ │ │ -000dce90: 7472 696e 7369 6347 7565 7373 3c2f 636f trinsicGuess - Parameter │ │ │ -000dceb0: 7573 6564 2066 6f72 2023 534f 4c56 4550 used for #SOLVEP │ │ │ -000dcec0: 4e50 5f49 5445 5241 5449 5645 2e20 4966 NP_ITERATIVE. If │ │ │ -000dced0: 2074 7275 6520 2831 292c 2074 6865 2066 true (1), the f │ │ │ -000dcee0: 756e 6374 696f 6e20 7573 6573 0a74 6865 unction uses.the │ │ │ -000dcef0: 2070 726f 7669 6465 6420 7276 6563 2061 provided rvec a │ │ │ -000dcf00: 6e64 2074 7665 6320 7661 6c75 6573 2061 nd tvec values a │ │ │ -000dcf10: 7320 696e 6974 6961 6c20 6170 7072 6f78 s initial approx │ │ │ -000dcf20: 696d 6174 696f 6e73 206f 6620 7468 6520 imations of the │ │ │ -000dcf30: 726f 7461 7469 6f6e 2061 6e64 2074 7261 rotation and tra │ │ │ -000dcf40: 6e73 6c61 7469 6f6e 0a76 6563 746f 7273 nslation.vectors │ │ │ -000dcf50: 2c20 7265 7370 6563 7469 7665 6c79 2c20 , respectively, │ │ │ -000dcf60: 616e 6420 6675 7274 6865 7220 6f70 7469 and further opti │ │ │ -000dcf70: 6d69 7a65 7320 7468 656d 2e0a 6973 2074 mizes them..is t │ │ │ -000dcf80: 6865 206d 6178 696d 756d 2061 6c6c 6f77 he maximum allow │ │ │ -000dcf90: 6564 2064 6973 7461 6e63 6520 6265 7477 ed distance betw │ │ │ -000dcfa0: 6565 6e20 7468 6520 6f62 7365 7276 6564 een the observed │ │ │ -000dcfb0: 2061 6e64 2063 6f6d 7075 7465 6420 706f and computed po │ │ │ -000dcfc0: 696e 7420 7072 6f6a 6563 7469 6f6e 7320 int projections │ │ │ -000dcfd0: 746f 2063 6f6e 7369 6465 7220 6974 0a61 to consider it.a │ │ │ -000dcfe0: 6e20 696e 6c69 6572 2e0a 5468 6520 6675 n inlier..The fu │ │ │ -000dcff0: 6e63 7469 6f6e 2069 6e74 6572 616c 6c79 nction interally │ │ │ -000dd000: 2075 6e64 6973 746f 7274 7320 706f 696e undistorts poin │ │ │ -000dd010: 7473 2077 6974 6820 5245 463a 2075 6e64 ts with REF: und │ │ │ -000dd020: 6973 746f 7274 506f 696e 7473 2061 6e64 istortPoints and │ │ │ -000dd030: 2063 616c 6c20 5245 463a 2063 763a 3a73 call REF: cv::s │ │ │ -000dd040: 6f6c 7665 506e 502c 0a74 6875 7320 7468 olvePnP,.thus th │ │ │ -000dd050: 6520 696e 7075 7420 6172 6520 7665 7279 e input are very │ │ │ -000dd060: 2073 696d 696c 6172 2e20 4d6f 7265 2069 similar. More i │ │ │ -000dd070: 6e66 6f72 6d61 7469 6f6e 2061 626f 7574 nformation about │ │ │ -000dd080: 2050 6572 7370 6563 7469 7665 2d6e 2d50 Perspective-n-P │ │ │ -000dd090: 6f69 6e74 7320 6973 2064 6573 6372 6962 oints is describ │ │ │ -000dd0a0: 6564 2069 6e20 5245 463a 2063 616c 6962 ed in REF: calib │ │ │ -000dd0b0: 3364 5f73 6f6c 7665 506e 500a 666f 7220 3d_solvePnP.for │ │ │ -000dd0c0: 6d6f 7265 2069 6e66 6f72 6d61 7469 6f6e more information │ │ │ -000dd0d0: 2e3c 2f64 643e 0a3c 6474 3e52 6574 7572 .
    .
    Retur │ │ │ -000dd0e0: 6e73 3a3c 2f64 743e 0a3c 6464 3e61 7574 ns:
    .
    aut │ │ │ -000dd0f0: 6f6d 6174 6963 616c 6c79 2067 656e 6572 omatically gener │ │ │ -000dd100: 6174 6564 3c2f 6464 3e0a 3c2f 646c 3e0a ated
    .
    . │ │ │ -000dd110: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e ..
  • .
  • ..

    f │ │ │ -000dd1e0: 6973 6865 7965 5f73 6f6c 7665 506e 5052 isheye_solvePnPR │ │ │ -000dd1f0: 616e 7361 633c 2f68 333e 0a3c 6469 7620 ansac

    .
    .
    public static boolean fisheye_solv │ │ │ -000dd2c0: 6550 6e50 5261 6e73 6163 3c2f 7370 616e ePnPRansac( │ │ │ -000dd2f0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000dd330: 2f61 3e26 6e62 7370 3b6f 626a 6563 7450 /a> objectP │ │ │ -000dd340: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ -000dd390: 3b69 6d61 6765 506f 696e 7473 2c0a 203c ;imagePoints,. < │ │ │ -000dd3a0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000dd3b0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000dd3c0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000dd3d0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat cameraMa │ │ │ -000dd3f0: 7472 6978 2c0a 203c 6120 6872 6566 3d22 trix,. Mat  │ │ │ -000dd440: 6469 7374 436f 6566 6673 2c0a 203c 6120 distCoeffs,. Mat │ │ │ -000dd490: 266e 6273 703b 7276 6563 2c0a 203c 6120  rvec,. Mat │ │ │ -000dd4e0: 266e 6273 703b 7476 6563 293c 2f73 7061  tvec)
    .
    Find │ │ │ -000dd510: 7320 616e 206f 626a 6563 7420 706f 7365 s an object pose │ │ │ -000dd520: 2066 726f 6d20 3344 2d32 4420 706f 696e from 3D-2D poin │ │ │ -000dd530: 7420 636f 7272 6573 706f 6e64 656e 6365 t correspondence │ │ │ -000dd540: 7320 7573 696e 6720 7468 6520 5241 4e53 s using the RANS │ │ │ -000dd550: 4143 2073 6368 656d 6520 666f 7220 6669 AC scheme for fi │ │ │ -000dd560: 7368 6579 6520 6361 6d65 7261 206d 6f6f sheye camera moo │ │ │ -000dd570: 6465 6c2e 3c2f 6469 763e 0a3c 646c 2063 del.
    .
    .Parameters:.
    obj │ │ │ -000dd5b0: 6563 7450 6f69 6e74 733c 2f63 6f64 653e ectPoints │ │ │ -000dd5c0: 202d 2041 7272 6179 206f 6620 6f62 6a65 - Array of obje │ │ │ -000dd5d0: 6374 2070 6f69 6e74 7320 696e 2074 6865 ct points in the │ │ │ -000dd5e0: 206f 626a 6563 7420 636f 6f72 6469 6e61 object coordina │ │ │ -000dd5f0: 7465 2073 7061 6365 2c20 4e78 3320 312d te space, Nx3 1- │ │ │ -000dd600: 6368 616e 6e65 6c20 6f72 0a31 784e 2f4e channel or.1xN/N │ │ │ -000dd610: 7831 2033 2d63 6861 6e6e 656c 2c20 7768 x1 3-channel, wh │ │ │ -000dd620: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ -000dd630: 6265 7220 6f66 2070 6f69 6e74 732e 2076 ber of points. v │ │ │ -000dd640: 6563 746f 7226 6c74 3b50 6f69 6e74 3364 ector<Point3d │ │ │ -000dd650: 2667 743b 2063 616e 2062 6520 616c 736f > can be also │ │ │ -000dd660: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    ima │ │ │ -000dd680: 6765 506f 696e 7473 3c2f 636f 6465 3e20 gePoints │ │ │ -000dd690: 2d20 4172 7261 7920 6f66 2063 6f72 7265 - Array of corre │ │ │ -000dd6a0: 7370 6f6e 6469 6e67 2069 6d61 6765 2070 sponding image p │ │ │ -000dd6b0: 6f69 6e74 732c 204e 7832 2031 2d63 6861 oints, Nx2 1-cha │ │ │ -000dd6c0: 6e6e 656c 206f 7220 3178 4e2f 4e78 3120 nnel or 1xN/Nx1 │ │ │ -000dd6d0: 322d 6368 616e 6e65 6c2c 0a77 6865 7265 2-channel,.where │ │ │ -000dd6e0: 204e 2069 7320 7468 6520 6e75 6d62 6572 N is the number │ │ │ -000dd6f0: 206f 6620 706f 696e 7473 2e20 7665 6374 of points. vect │ │ │ -000dd700: 6f72 266c 743b 506f 696e 7432 6426 6774 or<Point2d> │ │ │ -000dd710: 3b20 6361 6e20 6265 2061 6c73 6f20 7061 ; can be also pa │ │ │ -000dd720: 7373 6564 2068 6572 652e 3c2f 6464 3e0a ssed here.
    . │ │ │ -000dd730: 3c64 643e 3c63 6f64 653e 6361 6d65 7261
    camera │ │ │ -000dd740: 4d61 7472 6978 3c2f 636f 6465 3e20 2d20 Matrix - │ │ │ -000dd750: 496e 7075 7420 6361 6d65 7261 2069 6e74 Input camera int │ │ │ -000dd760: 7269 6e73 6963 206d 6174 7269 7820 5c28 rinsic matrix \( │ │ │ -000dd770: 5c63 616d 6572 616d 6174 7269 787b 417d \cameramatrix{A} │ │ │ -000dd780: 5c29 202e 3c2f 6464 3e0a 3c64 643e 3c63 \) .
    .
    distCoeffs - Input ve │ │ │ -000dd7b0: 6374 6f72 206f 6620 6469 7374 6f72 7469 ctor of distorti │ │ │ -000dd7c0: 6f6e 2063 6f65 6666 6963 6965 6e74 7320 on coefficients │ │ │ -000dd7d0: 2834 7831 2f31 7834 292e 3c2f 6464 3e0a (4x1/1x4).
    . │ │ │ -000dd7e0: 3c64 643e 3c63 6f64 653e 7276 6563 3c2f
    rvec - Output r │ │ │ -000dd800: 6f74 6174 696f 6e20 7665 6374 6f72 2028 otation vector ( │ │ │ -000dd810: 7365 6520 5245 463a 2052 6f64 7269 6775 see REF: Rodrigu │ │ │ -000dd820: 6573 2029 2074 6861 742c 2074 6f67 6574 es ) that, toget │ │ │ -000dd830: 6865 7220 7769 7468 2074 7665 632c 2062 her with tvec, b │ │ │ -000dd840: 7269 6e67 7320 706f 696e 7473 2066 726f rings points fro │ │ │ -000dd850: 6d0a 7468 6520 6d6f 6465 6c20 636f 6f72 m.the model coor │ │ │ -000dd860: 6469 6e61 7465 2073 7973 7465 6d20 746f dinate system to │ │ │ -000dd870: 2074 6865 2063 616d 6572 6120 636f 6f72 the camera coor │ │ │ -000dd880: 6469 6e61 7465 2073 7973 7465 6d2e 3c2f dinate system..
    tv │ │ │ -000dd8a0: 6563 3c2f 636f 6465 3e20 2d20 4f75 7470 ec - Outp │ │ │ -000dd8b0: 7574 2074 7261 6e73 6c61 7469 6f6e 2076 ut translation v │ │ │ -000dd8c0: 6563 746f 722e 0a74 6865 2070 726f 7669 ector..the provi │ │ │ -000dd8d0: 6465 6420 7276 6563 2061 6e64 2074 7665 ded rvec and tve │ │ │ -000dd8e0: 6320 7661 6c75 6573 2061 7320 696e 6974 c values as init │ │ │ -000dd8f0: 6961 6c20 6170 7072 6f78 696d 6174 696f ial approximatio │ │ │ -000dd900: 6e73 206f 6620 7468 6520 726f 7461 7469 ns of the rotati │ │ │ -000dd910: 6f6e 2061 6e64 2074 7261 6e73 6c61 7469 on and translati │ │ │ -000dd920: 6f6e 0a76 6563 746f 7273 2c20 7265 7370 on.vectors, resp │ │ │ -000dd930: 6563 7469 7665 6c79 2c20 616e 6420 6675 ectively, and fu │ │ │ -000dd940: 7274 6865 7220 6f70 7469 6d69 7a65 7320 rther optimizes │ │ │ -000dd950: 7468 656d 2e0a 6973 2074 6865 206d 6178 them..is the max │ │ │ -000dd960: 696d 756d 2061 6c6c 6f77 6564 2064 6973 imum allowed dis │ │ │ -000dd970: 7461 6e63 6520 6265 7477 6565 6e20 7468 tance between th │ │ │ -000dd980: 6520 6f62 7365 7276 6564 2061 6e64 2063 e observed and c │ │ │ -000dd990: 6f6d 7075 7465 6420 706f 696e 7420 7072 omputed point pr │ │ │ -000dd9a0: 6f6a 6563 7469 6f6e 7320 746f 2063 6f6e ojections to con │ │ │ -000dd9b0: 7369 6465 7220 6974 0a61 6e20 696e 6c69 sider it.an inli │ │ │ -000dd9c0: 6572 2e0a 5468 6520 6675 6e63 7469 6f6e er..The function │ │ │ -000dd9d0: 2069 6e74 6572 616c 6c79 2075 6e64 6973 interally undis │ │ │ -000dd9e0: 746f 7274 7320 706f 696e 7473 2077 6974 torts points wit │ │ │ -000dd9f0: 6820 5245 463a 2075 6e64 6973 746f 7274 h REF: undistort │ │ │ -000dda00: 506f 696e 7473 2061 6e64 2063 616c 6c20 Points and call │ │ │ -000dda10: 5245 463a 2063 763a 3a73 6f6c 7665 506e REF: cv::solvePn │ │ │ -000dda20: 502c 0a74 6875 7320 7468 6520 696e 7075 P,.thus the inpu │ │ │ -000dda30: 7420 6172 6520 7665 7279 2073 696d 696c t are very simil │ │ │ -000dda40: 6172 2e20 4d6f 7265 2069 6e66 6f72 6d61 ar. More informa │ │ │ -000dda50: 7469 6f6e 2061 626f 7574 2050 6572 7370 tion about Persp │ │ │ -000dda60: 6563 7469 7665 2d6e 2d50 6f69 6e74 7320 ective-n-Points │ │ │ -000dda70: 6973 2064 6573 6372 6962 6564 2069 6e20 is described in │ │ │ -000dda80: 5245 463a 2063 616c 6962 3364 5f73 6f6c REF: calib3d_sol │ │ │ -000dda90: 7665 506e 500a 666f 7220 6d6f 7265 2069 vePnP.for more i │ │ │ -000ddaa0: 6e66 6f72 6d61 7469 6f6e 2e3c 2f64 643e nformation.
    │ │ │ -000ddab0: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    automatic │ │ │ -000ddad0: 616c 6c79 2067 656e 6572 6174 6564 3c2f ally generated.
    .
    │ │ │ -000ddaf0: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 ..
  • .
  • .
    .

    │ │ │ -000ddb80: 6170 7072 6f78 506f 6c79 4450 3c2f 6833 approxPolyDP

    .
    .
    │ │ │ -000ddbd0: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -000ddbf0: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -000ddc00: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;void │ │ │ -000ddc20: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  approxPo │ │ │ -000ddc50: 6c79 4450 3c2f 7370 616e 3e3c 7762 723e lyDP │ │ │ -000ddc60: 3c73 7061 6e20 636c 6173 733d 2270 6172 (M │ │ │ -000ddcc0: 6174 4f66 506f 696e 7432 663c 2f61 3e26 atOfPoint2f& │ │ │ -000ddcd0: 6e62 7370 3b63 7572 7665 2c0a 203c 6120 nbsp;curve,. MatOfPoint2f approxCu │ │ │ -000ddd40: 7276 652c 0a20 646f 7562 6c65 266e 6273 rve,. double&nbs │ │ │ -000ddd50: 703b 6570 7369 6c6f 6e2c 0a20 626f 6f6c p;epsilon,. bool │ │ │ -000ddd60: 6561 6e26 6e62 7370 3b63 6c6f 7365 6429 ean closed) │ │ │ -000ddd70: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Approximates a │ │ │ -000ddda0: 706f 6c79 676f 6e61 6c20 6375 7276 6528 polygonal curve( │ │ │ -000dddb0: 7329 2077 6974 6820 7468 6520 7370 6563 s) with the spec │ │ │ -000dddc0: 6966 6965 6420 7072 6563 6973 696f 6e2e ified precision. │ │ │ -000dddd0: 0a0a 2054 2068 6520 6675 6e63 7469 6f6e .. T he function │ │ │ -000ddde0: 2063 763a 3a61 7070 726f 7850 6f6c 7944 cv::approxPolyD │ │ │ -000dddf0: 5020 6170 7072 6f78 696d 6174 6573 2061 P approximates a │ │ │ -000dde00: 2063 7572 7665 206f 7220 6120 702a 6f6c curve or a p*ol │ │ │ -000dde10: 7967 6f6e 2077 6974 6820 616e 6f74 6865 ygon with anothe │ │ │ -000dde20: 7220 6375 7276 652f 706f 6c79 676f 6e20 r curve/polygon │ │ │ -000dde30: 7769 7468 206c 6573 730a 2076 6572 7469 with less. verti │ │ │ -000dde40: 6365 7320 736f 2074 6861 7420 7468 6520 ces so that the │ │ │ -000dde50: 6469 7374 616e 6365 2062 6574 7765 656e distance between │ │ │ -000dde60: 2074 6865 6d20 6973 206c 6573 7320 6f72 them is less or │ │ │ -000dde70: 2065 7175 616c 2074 6f20 7468 6520 7370 equal to the sp │ │ │ -000dde80: 6563 6966 6965 6420 7072 6563 6973 696f ecified precisio │ │ │ -000dde90: 6e2e 2049 7420 7573 6573 2074 6865 0a20 n. It uses the. │ │ │ -000ddea0: 446f 7567 6c61 732d 5065 7563 6b65 7220 Douglas-Peucker │ │ │ -000ddeb0: 616c 676f 7269 7468 6d20 266c 743b 6874 algorithm <ht │ │ │ -000ddec0: 7470 733a 2f2f 656e 2e77 696b 6970 6564 tps://en.wikiped │ │ │ -000dded0: 6961 2e6f 7267 2f77 696b 692f 5261 6d65 ia.org/wiki/Rame │ │ │ -000ddee0: 722d 446f 7567 6c61 732d 5065 7563 6b65 r-Douglas-Peucke │ │ │ -000ddef0: 725f 616c 676f 7269 7468 6d26 6774 3b3c r_algorithm>< │ │ │ -000ddf00: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ -000ddf20: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .curve - Input vec │ │ │ -000ddf50: 746f 7220 6f66 2061 2032 4420 706f 696e tor of a 2D poin │ │ │ -000ddf60: 7420 7374 6f72 6564 2069 6e20 7374 643a t stored in std: │ │ │ -000ddf70: 3a76 6563 746f 7220 6f72 204d 6174 3c2f :vector or Mat.
    ap │ │ │ -000ddf90: 7072 6f78 4375 7276 653c 2f63 6f64 653e proxCurve │ │ │ -000ddfa0: 202d 2052 6573 756c 7420 6f66 2074 6865 - Result of the │ │ │ -000ddfb0: 2061 7070 726f 7869 6d61 7469 6f6e 2e20 approximation. │ │ │ -000ddfc0: 5468 6520 7479 7065 2073 686f 756c 6420 The type should │ │ │ -000ddfd0: 6d61 7463 6820 7468 6520 7479 7065 206f match the type o │ │ │ -000ddfe0: 6620 7468 6520 696e 7075 7420 6375 7276 f the input curv │ │ │ -000ddff0: 652e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 e.
    .
    epsilon │ │ │ -000de010: 202d 2050 6172 616d 6574 6572 2073 7065 - Parameter spe │ │ │ -000de020: 6369 6679 696e 6720 7468 6520 6170 7072 cifying the appr │ │ │ -000de030: 6f78 696d 6174 696f 6e20 6163 6375 7261 oximation accura │ │ │ -000de040: 6379 2e20 5468 6973 2069 7320 7468 6520 cy. This is the │ │ │ -000de050: 6d61 7869 6d75 6d20 6469 7374 616e 6365 maximum distance │ │ │ -000de060: 0a20 6265 7477 6565 6e20 7468 6520 6f72 . between the or │ │ │ -000de070: 6967 696e 616c 2063 7572 7665 2061 6e64 iginal curve and │ │ │ -000de080: 2069 7473 2061 7070 726f 7869 6d61 7469 its approximati │ │ │ -000de090: 6f6e 2e3c 2f64 643e 0a3c 6464 3e3c 636f on.
    .
    closed │ │ │ -000de0b0: 202d 2049 6620 7472 7565 2c20 7468 6520 - If true, the │ │ │ -000de0c0: 6170 7072 6f78 696d 6174 6564 2063 7572 approximated cur │ │ │ -000de0d0: 7665 2069 7320 636c 6f73 6564 2028 6974 ve is closed (it │ │ │ -000de0e0: 7320 6669 7273 7420 616e 6420 6c61 7374 s first and last │ │ │ -000de0f0: 2076 6572 7469 6365 7320 6172 650a 2063 vertices are. c │ │ │ -000de100: 6f6e 6e65 6374 6564 292e 204f 7468 6572 onnected). Other │ │ │ -000de110: 7769 7365 2c20 6974 2069 7320 6e6f 7420 wise, it is not │ │ │ -000de120: 636c 6f73 6564 2e3c 2f64 643e 0a3c 2f64 closed.
    ..
    ..
  • .
  • . │ │ │ -000de150: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    approxP │ │ │ -000de1c0: 6f6c 794e 3c2f 6833 3e0a 3c64 6976 2063 olyN

    .
    .
    │ │ │ -000de220: 7075 626c 6963 2073 7461 7469 633c 2f73 public static void& │ │ │ -000de260: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -000de280: 6170 7072 6f78 506f 6c79 4e3c 2f73 7061 approxPolyN │ │ │ -000de2b0: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ -000de2f0: 3c2f 613e 266e 6273 703b 6375 7276 652c  curve, │ │ │ -000de300: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000de340: 743c 2f61 3e26 6e62 7370 3b61 7070 726f t appro │ │ │ -000de350: 7843 7572 7665 2c0a 2069 6e74 266e 6273 xCurve,. int&nbs │ │ │ -000de360: 703b 6e73 6964 6573 2c0a 2066 6c6f 6174 p;nsides,. float │ │ │ -000de370: 266e 6273 703b 6570 7369 6c6f 6e5f 7065  epsilon_pe │ │ │ -000de380: 7263 656e 7461 6765 2c0a 2062 6f6f 6c65 rcentage,. boole │ │ │ -000de390: 616e 266e 6273 703b 656e 7375 7265 5f63 an ensure_c │ │ │ -000de3a0: 6f6e 7665 7829 3c2f 7370 616e 3e3c 2f64 onvex).
    Approxima │ │ │ -000de3d0: 7465 7320 6120 706f 6c79 676f 6e20 7769 tes a polygon wi │ │ │ -000de3e0: 7468 2061 2063 6f6e 7665 7820 6875 6c6c th a convex hull │ │ │ -000de3f0: 2077 6974 6820 6120 7370 6563 6966 6965 with a specifie │ │ │ -000de400: 6420 6163 6375 7261 6379 2061 6e64 206e d accuracy and n │ │ │ -000de410: 756d 6265 7220 6f66 2073 6964 6573 2e0a umber of sides.. │ │ │ -000de420: 0a20 5420 6865 2063 763a 3a61 7070 726f . T he cv::appro │ │ │ -000de430: 7850 6f6c 794e 2066 756e 6374 696f 6e20 xPolyN function │ │ │ -000de440: 6170 7072 6f78 696d 6174 6573 2061 2070 approximates a p │ │ │ -000de450: 6f6c 7967 6f6e 2077 6974 6820 2a61 2063 olygon with *a c │ │ │ -000de460: 6f6e 7665 7820 6875 6c6c 0a20 736f 2074 onvex hull. so t │ │ │ -000de470: 6861 7420 7468 6520 6469 6666 6572 656e hat the differen │ │ │ -000de480: 6365 2062 6574 7765 656e 2074 6865 2063 ce between the c │ │ │ -000de490: 6f6e 746f 7572 2061 7265 6120 6f66 2074 ontour area of t │ │ │ -000de4a0: 6865 206f 7269 6769 6e61 6c20 636f 6e74 he original cont │ │ │ -000de4b0: 6f75 7220 616e 6420 7468 6520 6e65 7720 our and the new │ │ │ -000de4c0: 706f 6c79 676f 6e20 6973 206d 696e 696d polygon is minim │ │ │ -000de4d0: 616c 2e0a 2049 7420 7573 6573 2061 2067 al.. It uses a g │ │ │ -000de4e0: 7265 6564 7920 616c 676f 7269 7468 6d20 reedy algorithm │ │ │ -000de4f0: 666f 7220 636f 6e74 7261 6374 696e 6720 for contracting │ │ │ -000de500: 7477 6f20 7665 7274 6963 6573 2069 6e74 two vertices int │ │ │ -000de510: 6f20 6f6e 6520 696e 2073 7563 6820 6120 o one in such a │ │ │ -000de520: 7761 7920 7468 6174 2074 6865 2061 6464 way that the add │ │ │ -000de530: 6974 696f 6e61 6c20 6172 6561 2069 7320 itional area is │ │ │ -000de540: 6d69 6e69 6d61 6c2e 0a20 5374 7261 6967 minimal.. Straig │ │ │ -000de550: 6874 206c 696e 6573 2066 6f72 6d65 6420 ht lines formed │ │ │ -000de560: 6279 2065 6163 6820 6564 6765 206f 6620 by each edge of │ │ │ -000de570: 7468 6520 636f 6e76 6578 2063 6f6e 746f the convex conto │ │ │ -000de580: 7572 2061 7265 2064 7261 776e 2061 6e64 ur are drawn and │ │ │ -000de590: 2074 6865 2061 7265 6173 206f 6620 7468 the areas of th │ │ │ -000de5a0: 6520 7265 7375 6c74 696e 6720 7472 6961 e resulting tria │ │ │ -000de5b0: 6e67 6c65 7320 6172 6520 636f 6e73 6964 ngles are consid │ │ │ -000de5c0: 6572 6564 2e0a 2045 6163 6820 7665 7274 ered.. Each vert │ │ │ -000de5d0: 6578 2077 696c 6c20 6c69 6520 6569 7468 ex will lie eith │ │ │ -000de5e0: 6572 206f 6e20 7468 6520 6f72 6967 696e er on the origin │ │ │ -000de5f0: 616c 2063 6f6e 746f 7572 206f 7220 6f75 al contour or ou │ │ │ -000de600: 7473 6964 6520 6974 2e0a 0a20 5468 6520 tside it... The │ │ │ -000de610: 616c 676f 7269 7468 6d20 6261 7365 6420 algorithm based │ │ │ -000de620: 6f6e 2074 6865 2070 6170 6572 2043 4954 on the paper CIT │ │ │ -000de630: 453a 204c 6f77 496c 6965 3230 3033 202e E: LowIlie2003 . │ │ │ -000de640: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -000de660: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000de670: 6464 3e3c 636f 6465 3e63 7572 7665 3c2f dd>curve - Input ve │ │ │ -000de690: 6374 6f72 206f 6620 6120 3244 2070 6f69 ctor of a 2D poi │ │ │ -000de6a0: 6e74 7320 7374 6f72 6564 2069 6e20 7374 nts stored in st │ │ │ -000de6b0: 643a 3a76 6563 746f 7220 6f72 204d 6174 d::vector or Mat │ │ │ -000de6c0: 2c20 706f 696e 7473 206d 7573 7420 6265 , points must be │ │ │ -000de6d0: 2066 6c6f 6174 206f 7220 696e 7465 6765 float or intege │ │ │ -000de6e0: 722e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 r..
    approxCurve - Result of │ │ │ -000de710: 2074 6865 2061 7070 726f 7869 6d61 7469 the approximati │ │ │ -000de720: 6f6e 2e20 5468 6520 7479 7065 2069 7320 on. The type is │ │ │ -000de730: 7665 6374 6f72 206f 6620 6120 3244 2070 vector of a 2D p │ │ │ -000de740: 6f69 6e74 2028 506f 696e 7432 6620 6f72 oint (Point2f or │ │ │ -000de750: 2050 6f69 6e74 2920 696e 2073 7464 3a3a Point) in std:: │ │ │ -000de760: 7665 6374 6f72 206f 7220 4d61 742e 3c2f vector or Mat..
    ns │ │ │ -000de780: 6964 6573 3c2f 636f 6465 3e20 2d20 5468 ides - Th │ │ │ -000de790: 6520 7061 7261 6d65 7465 7220 6465 6669 e parameter defi │ │ │ -000de7a0: 6e65 7320 7468 6520 6e75 6d62 6572 206f nes the number o │ │ │ -000de7b0: 6620 7369 6465 7320 6f66 2074 6865 2072 f sides of the r │ │ │ -000de7c0: 6573 756c 7420 706f 6c79 676f 6e2e 3c2f esult polygon..
    ep │ │ │ -000de7e0: 7369 6c6f 6e5f 7065 7263 656e 7461 6765 silon_percentage │ │ │ -000de7f0: 3c2f 636f 6465 3e20 2d20 6465 6669 6e65 - define │ │ │ -000de800: 7320 7468 6520 7065 7263 656e 7461 6765 s the percentage │ │ │ -000de810: 206f 6620 7468 6520 6d61 7869 6d75 6d20 of the maximum │ │ │ -000de820: 6f66 2061 6464 6974 696f 6e61 6c20 6172 of additional ar │ │ │ -000de830: 6561 2e0a 2049 6620 6974 2065 7175 616c ea.. If it equal │ │ │ -000de840: 7320 2d31 2c20 6974 2069 7320 6e6f 7420 s -1, it is not │ │ │ -000de850: 7573 6564 2e20 4f74 6865 7277 6973 6520 used. Otherwise │ │ │ -000de860: 616c 676f 7269 7468 6d20 7374 6f70 7320 algorithm stops │ │ │ -000de870: 6966 2061 6464 6974 696f 6e61 6c20 6172 if additional ar │ │ │ -000de880: 6561 2069 7320 6772 6561 7465 7220 7468 ea is greater th │ │ │ -000de890: 616e 2063 6f6e 746f 7572 4172 6561 285f an contourArea(_ │ │ │ -000de8a0: 6375 7276 6529 202a 2070 6572 6365 6e74 curve) * percent │ │ │ -000de8b0: 6167 652e 0a20 4966 2061 6464 6974 696f age.. If additio │ │ │ -000de8c0: 6e61 6c20 6172 6561 2065 7863 6565 6473 nal area exceeds │ │ │ -000de8d0: 2074 6865 206c 696d 6974 2c20 616c 676f the limit, algo │ │ │ -000de8e0: 7269 7468 6d20 7265 7475 726e 7320 6173 rithm returns as │ │ │ -000de8f0: 206d 616e 7920 7665 7274 6963 6573 2061 many vertices a │ │ │ -000de900: 7320 7468 6572 6520 7765 7265 2061 7420 s there were at │ │ │ -000de910: 7468 6520 6d6f 6d65 6e74 2074 6865 206c the moment the l │ │ │ -000de920: 696d 6974 2077 6173 2065 7863 6565 6465 imit was exceede │ │ │ -000de930: 642e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 d.
    .
    ensure_convex< │ │ │ -000de950: 2f63 6f64 653e 202d 2049 6620 6974 2069 /code> - If it i │ │ │ -000de960: 7320 7472 7565 2c20 616c 676f 7269 7468 s true, algorith │ │ │ -000de970: 6d20 6372 6561 7465 7320 6120 636f 6e76 m creates a conv │ │ │ -000de980: 6578 2068 756c 6c20 6f66 2069 6e70 7574 ex hull of input │ │ │ -000de990: 2063 6f6e 746f 7572 2e20 4f74 6865 7277 contour. Otherw │ │ │ -000de9a0: 6973 6520 696e 7075 7420 7665 6374 6f72 ise input vector │ │ │ -000de9b0: 2073 686f 756c 6420 6265 2063 6f6e 7665 should be conve │ │ │ -000de9c0: 782e 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f x.
    .
    ..
    . │ │ │ -000de9e0: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..

    appr │ │ │ -000dea50: 6f78 506f 6c79 4e3c 2f68 333e 0a3c 6469 oxPolyN

    ..public static │ │ │ -000deac0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  void approxPolyN( │ │ │ -000deb80: 4d61 743c 2f61 3e26 6e62 7370 3b63 7572 Mat cur │ │ │ -000deb90: 7665 2c0a 203c 6120 6872 6566 3d22 2e2e ve,. Mat ap │ │ │ -000debe0: 7072 6f78 4375 7276 652c 0a20 696e 7426 proxCurve,. int& │ │ │ -000debf0: 6e62 7370 3b6e 7369 6465 732c 0a20 666c nbsp;nsides,. fl │ │ │ -000dec00: 6f61 7426 6e62 7370 3b65 7073 696c 6f6e oat epsilon │ │ │ -000dec10: 5f70 6572 6365 6e74 6167 6529 3c2f 7370 _percentage).
    App │ │ │ -000dec40: 726f 7869 6d61 7465 7320 6120 706f 6c79 roximates a poly │ │ │ -000dec50: 676f 6e20 7769 7468 2061 2063 6f6e 7665 gon with a conve │ │ │ -000dec60: 7820 6875 6c6c 2077 6974 6820 6120 7370 x hull with a sp │ │ │ -000dec70: 6563 6966 6965 6420 6163 6375 7261 6379 ecified accuracy │ │ │ -000dec80: 2061 6e64 206e 756d 6265 7220 6f66 2073 and number of s │ │ │ -000dec90: 6964 6573 2e0a 0a20 5420 6865 2063 763a ides... T he cv: │ │ │ -000deca0: 3a61 7070 726f 7850 6f6c 794e 2066 756e :approxPolyN fun │ │ │ -000decb0: 6374 696f 6e20 6170 7072 6f78 696d 6174 ction approximat │ │ │ -000decc0: 6573 2061 2070 6f6c 7967 6f6e 2077 6974 es a polygon wit │ │ │ -000decd0: 6820 2a61 2063 6f6e 7665 7820 6875 6c6c h *a convex hull │ │ │ -000dece0: 0a20 736f 2074 6861 7420 7468 6520 6469 . so that the di │ │ │ -000decf0: 6666 6572 656e 6365 2062 6574 7765 656e fference between │ │ │ -000ded00: 2074 6865 2063 6f6e 746f 7572 2061 7265 the contour are │ │ │ -000ded10: 6120 6f66 2074 6865 206f 7269 6769 6e61 a of the origina │ │ │ -000ded20: 6c20 636f 6e74 6f75 7220 616e 6420 7468 l contour and th │ │ │ -000ded30: 6520 6e65 7720 706f 6c79 676f 6e20 6973 e new polygon is │ │ │ -000ded40: 206d 696e 696d 616c 2e0a 2049 7420 7573 minimal.. It us │ │ │ -000ded50: 6573 2061 2067 7265 6564 7920 616c 676f es a greedy algo │ │ │ -000ded60: 7269 7468 6d20 666f 7220 636f 6e74 7261 rithm for contra │ │ │ -000ded70: 6374 696e 6720 7477 6f20 7665 7274 6963 cting two vertic │ │ │ -000ded80: 6573 2069 6e74 6f20 6f6e 6520 696e 2073 es into one in s │ │ │ -000ded90: 7563 6820 6120 7761 7920 7468 6174 2074 uch a way that t │ │ │ -000deda0: 6865 2061 6464 6974 696f 6e61 6c20 6172 he additional ar │ │ │ -000dedb0: 6561 2069 7320 6d69 6e69 6d61 6c2e 0a20 ea is minimal.. │ │ │ -000dedc0: 5374 7261 6967 6874 206c 696e 6573 2066 Straight lines f │ │ │ -000dedd0: 6f72 6d65 6420 6279 2065 6163 6820 6564 ormed by each ed │ │ │ -000dede0: 6765 206f 6620 7468 6520 636f 6e76 6578 ge of the convex │ │ │ -000dedf0: 2063 6f6e 746f 7572 2061 7265 2064 7261 contour are dra │ │ │ -000dee00: 776e 2061 6e64 2074 6865 2061 7265 6173 wn and the areas │ │ │ -000dee10: 206f 6620 7468 6520 7265 7375 6c74 696e of the resultin │ │ │ -000dee20: 6720 7472 6961 6e67 6c65 7320 6172 6520 g triangles are │ │ │ -000dee30: 636f 6e73 6964 6572 6564 2e0a 2045 6163 considered.. Eac │ │ │ -000dee40: 6820 7665 7274 6578 2077 696c 6c20 6c69 h vertex will li │ │ │ -000dee50: 6520 6569 7468 6572 206f 6e20 7468 6520 e either on the │ │ │ -000dee60: 6f72 6967 696e 616c 2063 6f6e 746f 7572 original contour │ │ │ -000dee70: 206f 7220 6f75 7473 6964 6520 6974 2e0a or outside it.. │ │ │ -000dee80: 0a20 5468 6520 616c 676f 7269 7468 6d20 . The algorithm │ │ │ -000dee90: 6261 7365 6420 6f6e 2074 6865 2070 6170 based on the pap │ │ │ -000deea0: 6572 2043 4954 453a 204c 6f77 496c 6965 er CITE: LowIlie │ │ │ -000deeb0: 3230 3033 202e 3c2f 6469 763e 0a3c 646c 2003 .
    .
    . │ │ │ -000deed0: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -000deee0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e63 /dt>.
    c │ │ │ -000deef0: 7572 7665 3c2f 636f 6465 3e20 2d20 496e urve - In │ │ │ -000def00: 7075 7420 7665 6374 6f72 206f 6620 6120 put vector of a │ │ │ -000def10: 3244 2070 6f69 6e74 7320 7374 6f72 6564 2D points stored │ │ │ -000def20: 2069 6e20 7374 643a 3a76 6563 746f 7220 in std::vector │ │ │ -000def30: 6f72 204d 6174 2c20 706f 696e 7473 206d or Mat, points m │ │ │ -000def40: 7573 7420 6265 2066 6c6f 6174 206f 7220 ust be float or │ │ │ -000def50: 696e 7465 6765 722e 3c2f 6464 3e0a 3c64 integer.
    .approxCu │ │ │ -000def70: 7276 653c 2f63 6f64 653e 202d 2052 6573 rve - Res │ │ │ -000def80: 756c 7420 6f66 2074 6865 2061 7070 726f ult of the appro │ │ │ -000def90: 7869 6d61 7469 6f6e 2e20 5468 6520 7479 ximation. The ty │ │ │ -000defa0: 7065 2069 7320 7665 6374 6f72 206f 6620 pe is vector of │ │ │ -000defb0: 6120 3244 2070 6f69 6e74 2028 506f 696e a 2D point (Poin │ │ │ -000defc0: 7432 6620 6f72 2050 6f69 6e74 2920 696e t2f or Point) in │ │ │ -000defd0: 2073 7464 3a3a 7665 6374 6f72 206f 7220 std::vector or │ │ │ -000defe0: 4d61 742e 3c2f 6464 3e0a 3c64 643e 3c63 Mat..
    nsides - The paramete │ │ │ -000df010: 7220 6465 6669 6e65 7320 7468 6520 6e75 r defines the nu │ │ │ -000df020: 6d62 6572 206f 6620 7369 6465 7320 6f66 mber of sides of │ │ │ -000df030: 2074 6865 2072 6573 756c 7420 706f 6c79 the result poly │ │ │ -000df040: 676f 6e2e 3c2f 6464 3e0a 3c64 643e 3c63 gon.
    .
    epsilon_perc │ │ │ -000df060: 656e 7461 6765 3c2f 636f 6465 3e20 2d20 entage - │ │ │ -000df070: 6465 6669 6e65 7320 7468 6520 7065 7263 defines the perc │ │ │ -000df080: 656e 7461 6765 206f 6620 7468 6520 6d61 entage of the ma │ │ │ -000df090: 7869 6d75 6d20 6f66 2061 6464 6974 696f ximum of additio │ │ │ -000df0a0: 6e61 6c20 6172 6561 2e0a 2049 6620 6974 nal area.. If it │ │ │ -000df0b0: 2065 7175 616c 7320 2d31 2c20 6974 2069 equals -1, it i │ │ │ -000df0c0: 7320 6e6f 7420 7573 6564 2e20 4f74 6865 s not used. Othe │ │ │ -000df0d0: 7277 6973 6520 616c 676f 7269 7468 6d20 rwise algorithm │ │ │ -000df0e0: 7374 6f70 7320 6966 2061 6464 6974 696f stops if additio │ │ │ -000df0f0: 6e61 6c20 6172 6561 2069 7320 6772 6561 nal area is grea │ │ │ -000df100: 7465 7220 7468 616e 2063 6f6e 746f 7572 ter than contour │ │ │ -000df110: 4172 6561 285f 6375 7276 6529 202a 2070 Area(_curve) * p │ │ │ -000df120: 6572 6365 6e74 6167 652e 0a20 4966 2061 ercentage.. If a │ │ │ -000df130: 6464 6974 696f 6e61 6c20 6172 6561 2065 dditional area e │ │ │ -000df140: 7863 6565 6473 2074 6865 206c 696d 6974 xceeds the limit │ │ │ -000df150: 2c20 616c 676f 7269 7468 6d20 7265 7475 , algorithm retu │ │ │ -000df160: 726e 7320 6173 206d 616e 7920 7665 7274 rns as many vert │ │ │ -000df170: 6963 6573 2061 7320 7468 6572 6520 7765 ices as there we │ │ │ -000df180: 7265 2061 7420 7468 6520 6d6f 6d65 6e74 re at the moment │ │ │ -000df190: 2074 6865 206c 696d 6974 2077 6173 2065 the limit was e │ │ │ -000df1a0: 7863 6565 6465 642e 3c2f 6464 3e0a 3c2f xceeded.
    ....
  • .
  • │ │ │ -000df1d0: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    appr │ │ │ -000df230: 6f78 506f 6c79 4e3c 2f68 333e 0a3c 6469 oxPolyN

    ..public static │ │ │ -000df2a0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  void approxPolyN( │ │ │ -000df360: 4d61 743c 2f61 3e26 6e62 7370 3b63 7572 Mat cur │ │ │ -000df370: 7665 2c0a 203c 6120 6872 6566 3d22 2e2e ve,. Mat ap │ │ │ -000df3c0: 7072 6f78 4375 7276 652c 0a20 696e 7426 proxCurve,. int& │ │ │ -000df3d0: 6e62 7370 3b6e 7369 6465 7329 3c2f 7370 nbsp;nsides).
    App │ │ │ -000df400: 726f 7869 6d61 7465 7320 6120 706f 6c79 roximates a poly │ │ │ -000df410: 676f 6e20 7769 7468 2061 2063 6f6e 7665 gon with a conve │ │ │ -000df420: 7820 6875 6c6c 2077 6974 6820 6120 7370 x hull with a sp │ │ │ -000df430: 6563 6966 6965 6420 6163 6375 7261 6379 ecified accuracy │ │ │ -000df440: 2061 6e64 206e 756d 6265 7220 6f66 2073 and number of s │ │ │ -000df450: 6964 6573 2e0a 0a20 5420 6865 2063 763a ides... T he cv: │ │ │ -000df460: 3a61 7070 726f 7850 6f6c 794e 2066 756e :approxPolyN fun │ │ │ -000df470: 6374 696f 6e20 6170 7072 6f78 696d 6174 ction approximat │ │ │ -000df480: 6573 2061 2070 6f6c 7967 6f6e 2077 6974 es a polygon wit │ │ │ -000df490: 6820 2a61 2063 6f6e 7665 7820 6875 6c6c h *a convex hull │ │ │ -000df4a0: 0a20 736f 2074 6861 7420 7468 6520 6469 . so that the di │ │ │ -000df4b0: 6666 6572 656e 6365 2062 6574 7765 656e fference between │ │ │ -000df4c0: 2074 6865 2063 6f6e 746f 7572 2061 7265 the contour are │ │ │ -000df4d0: 6120 6f66 2074 6865 206f 7269 6769 6e61 a of the origina │ │ │ -000df4e0: 6c20 636f 6e74 6f75 7220 616e 6420 7468 l contour and th │ │ │ -000df4f0: 6520 6e65 7720 706f 6c79 676f 6e20 6973 e new polygon is │ │ │ -000df500: 206d 696e 696d 616c 2e0a 2049 7420 7573 minimal.. It us │ │ │ -000df510: 6573 2061 2067 7265 6564 7920 616c 676f es a greedy algo │ │ │ -000df520: 7269 7468 6d20 666f 7220 636f 6e74 7261 rithm for contra │ │ │ -000df530: 6374 696e 6720 7477 6f20 7665 7274 6963 cting two vertic │ │ │ -000df540: 6573 2069 6e74 6f20 6f6e 6520 696e 2073 es into one in s │ │ │ -000df550: 7563 6820 6120 7761 7920 7468 6174 2074 uch a way that t │ │ │ -000df560: 6865 2061 6464 6974 696f 6e61 6c20 6172 he additional ar │ │ │ -000df570: 6561 2069 7320 6d69 6e69 6d61 6c2e 0a20 ea is minimal.. │ │ │ -000df580: 5374 7261 6967 6874 206c 696e 6573 2066 Straight lines f │ │ │ -000df590: 6f72 6d65 6420 6279 2065 6163 6820 6564 ormed by each ed │ │ │ -000df5a0: 6765 206f 6620 7468 6520 636f 6e76 6578 ge of the convex │ │ │ -000df5b0: 2063 6f6e 746f 7572 2061 7265 2064 7261 contour are dra │ │ │ -000df5c0: 776e 2061 6e64 2074 6865 2061 7265 6173 wn and the areas │ │ │ -000df5d0: 206f 6620 7468 6520 7265 7375 6c74 696e of the resultin │ │ │ -000df5e0: 6720 7472 6961 6e67 6c65 7320 6172 6520 g triangles are │ │ │ -000df5f0: 636f 6e73 6964 6572 6564 2e0a 2045 6163 considered.. Eac │ │ │ -000df600: 6820 7665 7274 6578 2077 696c 6c20 6c69 h vertex will li │ │ │ -000df610: 6520 6569 7468 6572 206f 6e20 7468 6520 e either on the │ │ │ -000df620: 6f72 6967 696e 616c 2063 6f6e 746f 7572 original contour │ │ │ -000df630: 206f 7220 6f75 7473 6964 6520 6974 2e0a or outside it.. │ │ │ -000df640: 0a20 5468 6520 616c 676f 7269 7468 6d20 . The algorithm │ │ │ -000df650: 6261 7365 6420 6f6e 2074 6865 2070 6170 based on the pap │ │ │ -000df660: 6572 2043 4954 453a 204c 6f77 496c 6965 er CITE: LowIlie │ │ │ -000df670: 3230 3033 202e 3c2f 6469 763e 0a3c 646c 2003 .
    .
    . │ │ │ -000df690: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -000df6a0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e63 /dt>.
    c │ │ │ -000df6b0: 7572 7665 3c2f 636f 6465 3e20 2d20 496e urve - In │ │ │ -000df6c0: 7075 7420 7665 6374 6f72 206f 6620 6120 put vector of a │ │ │ -000df6d0: 3244 2070 6f69 6e74 7320 7374 6f72 6564 2D points stored │ │ │ -000df6e0: 2069 6e20 7374 643a 3a76 6563 746f 7220 in std::vector │ │ │ -000df6f0: 6f72 204d 6174 2c20 706f 696e 7473 206d or Mat, points m │ │ │ -000df700: 7573 7420 6265 2066 6c6f 6174 206f 7220 ust be float or │ │ │ -000df710: 696e 7465 6765 722e 3c2f 6464 3e0a 3c64 integer.
    .approxCu │ │ │ -000df730: 7276 653c 2f63 6f64 653e 202d 2052 6573 rve - Res │ │ │ -000df740: 756c 7420 6f66 2074 6865 2061 7070 726f ult of the appro │ │ │ -000df750: 7869 6d61 7469 6f6e 2e20 5468 6520 7479 ximation. The ty │ │ │ -000df760: 7065 2069 7320 7665 6374 6f72 206f 6620 pe is vector of │ │ │ -000df770: 6120 3244 2070 6f69 6e74 2028 506f 696e a 2D point (Poin │ │ │ -000df780: 7432 6620 6f72 2050 6f69 6e74 2920 696e t2f or Point) in │ │ │ -000df790: 2073 7464 3a3a 7665 6374 6f72 206f 7220 std::vector or │ │ │ -000df7a0: 4d61 742e 3c2f 6464 3e0a 3c64 643e 3c63 Mat..
    nsides - The paramete │ │ │ -000df7d0: 7220 6465 6669 6e65 7320 7468 6520 6e75 r defines the nu │ │ │ -000df7e0: 6d62 6572 206f 6620 7369 6465 7320 6f66 mber of sides of │ │ │ -000df7f0: 2074 6865 2072 6573 756c 7420 706f 6c79 the result poly │ │ │ -000df800: 676f 6e2e 0a20 4966 2069 7420 6571 7561 gon.. If it equa │ │ │ -000df810: 6c73 202d 312c 2069 7420 6973 206e 6f74 ls -1, it is not │ │ │ -000df820: 2075 7365 642e 204f 7468 6572 7769 7365 used. Otherwise │ │ │ -000df830: 2061 6c67 6f72 6974 686d 2073 746f 7073 algorithm stops │ │ │ -000df840: 2069 6620 6164 6469 7469 6f6e 616c 2061 if additional a │ │ │ -000df850: 7265 6120 6973 2067 7265 6174 6572 2074 rea is greater t │ │ │ -000df860: 6861 6e20 636f 6e74 6f75 7241 7265 6128 han contourArea( │ │ │ -000df870: 5f63 7572 7665 2920 2a20 7065 7263 656e _curve) * percen │ │ │ -000df880: 7461 6765 2e0a 2049 6620 6164 6469 7469 tage.. If additi │ │ │ -000df890: 6f6e 616c 2061 7265 6120 6578 6365 6564 onal area exceed │ │ │ -000df8a0: 7320 7468 6520 6c69 6d69 742c 2061 6c67 s the limit, alg │ │ │ -000df8b0: 6f72 6974 686d 2072 6574 7572 6e73 2061 orithm returns a │ │ │ -000df8c0: 7320 6d61 6e79 2076 6572 7469 6365 7320 s many vertices │ │ │ -000df8d0: 6173 2074 6865 7265 2077 6572 6520 6174 as there were at │ │ │ -000df8e0: 2074 6865 206d 6f6d 656e 7420 7468 6520 the moment the │ │ │ -000df8f0: 6c69 6d69 7420 7761 7320 6578 6365 6564 limit was exceed │ │ │ -000df900: 6564 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c ed.
    .
    .< │ │ │ -000df910: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ -000df920: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    minAreaR │ │ │ -000df980: 6563 743c 2f68 333e 0a3c 6469 7620 636c ect

    .
    .
    p │ │ │ -000df9e0: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static RotatedRe │ │ │ -000dfa60: 6374 3c2f 613e 3c2f 7370 616e 3e26 6e62 ct&nb │ │ │ -000dfa70: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;mi │ │ │ -000dfa90: 6e41 7265 6152 6563 743c 2f73 7061 6e3e nAreaRect │ │ │ -000dfaa0: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ -000dfac0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000dfad0: 4d61 744f 6650 6f69 6e74 3266 2e68 746d MatOfPoint2f.htm │ │ │ -000dfae0: 6c22 2074 6974 6c65 3d22 636c 6173 7320 l" title="class │ │ │ -000dfaf0: 696e 206f 7267 2e6f 7065 6e63 762e 636f in org.opencv.co │ │ │ -000dfb00: 7265 223e 4d61 744f 6650 6f69 6e74 3266 re">MatOfPoint2f │ │ │ -000dfb10: 3c2f 613e 266e 6273 703b 706f 696e 7473  points │ │ │ -000dfb20: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ -000dfb30: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -000dfb40: 223e 4669 6e64 7320 6120 726f 7461 7465 ">Finds a rotate │ │ │ -000dfb50: 6420 7265 6374 616e 676c 6520 6f66 2074 d rectangle of t │ │ │ -000dfb60: 6865 206d 696e 696d 756d 2061 7265 6120 he minimum area │ │ │ -000dfb70: 656e 636c 6f73 696e 6720 7468 6520 696e enclosing the in │ │ │ -000dfb80: 7075 7420 3244 2070 6f69 6e74 2073 6574 put 2D point set │ │ │ -000dfb90: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ -000dfba0: 6361 6c63 756c 6174 6573 2061 6e64 2072 calculates and r │ │ │ -000dfbb0: 6574 7572 6e73 2074 6865 206d 696e 696d eturns the minim │ │ │ -000dfbc0: 756d 2d61 7265 6120 626f 756e 6469 6e67 um-area bounding │ │ │ -000dfbd0: 2072 6563 7461 6e67 6c65 2028 706f 7373 rectangle (poss │ │ │ -000dfbe0: 6962 6c79 2072 6f74 6174 6564 2920 666f ibly rotated) fo │ │ │ -000dfbf0: 7220 610a 7370 6563 6966 6965 6420 706f r a.specified po │ │ │ -000dfc00: 696e 7420 7365 742e 2054 6865 2061 6e67 int set. The ang │ │ │ -000dfc10: 6c65 206f 6620 726f 7461 7469 6f6e 2072 le of rotation r │ │ │ -000dfc20: 6570 7265 7365 6e74 7320 7468 6520 616e epresents the an │ │ │ -000dfc30: 676c 6520 6265 7477 6565 6e20 7468 6520 gle between the │ │ │ -000dfc40: 6c69 6e65 2063 6f6e 6e65 6374 696e 6720 line connecting │ │ │ -000dfc50: 7468 6520 7374 6172 7469 6e67 0a61 6e64 the starting.and │ │ │ -000dfc60: 2065 6e64 696e 6720 706f 696e 7473 2028 ending points ( │ │ │ -000dfc70: 6261 7365 6420 6f6e 2074 6865 2063 6c6f based on the clo │ │ │ -000dfc80: 636b 7769 7365 206f 7264 6572 2077 6974 ckwise order wit │ │ │ -000dfc90: 6820 6772 6561 7465 7374 2069 6e64 6578 h greatest index │ │ │ -000dfca0: 2066 6f72 2074 6865 2063 6f72 6e65 7220 for the corner │ │ │ -000dfcb0: 7769 7468 2067 7265 6174 6573 7420 5c28 with greatest \( │ │ │ -000dfcc0: 795c 2929 0a61 6e64 2074 6865 2068 6f72 y\)).and the hor │ │ │ -000dfcd0: 697a 6f6e 7461 6c20 6178 6973 2e20 5468 izontal axis. Th │ │ │ -000dfce0: 6973 2061 6e67 6c65 2061 6c77 6179 7320 is angle always │ │ │ -000dfcf0: 6661 6c6c 7320 6265 7477 6565 6e20 5c28 falls between \( │ │ │ -000dfd00: 5b2d 3930 2c20 3029 5c29 2062 6563 6175 [-90, 0)\) becau │ │ │ -000dfd10: 7365 2c20 6966 2074 6865 206f 626a 6563 se, if the objec │ │ │ -000dfd20: 740a 726f 7461 7465 7320 6d6f 7265 2074 t.rotates more t │ │ │ -000dfd30: 6861 6e20 6120 7265 6374 2061 6e67 6c65 han a rect angle │ │ │ -000dfd40: 2c20 7468 6520 6e65 7874 2065 6467 6520 , the next edge │ │ │ -000dfd50: 6973 2075 7365 6420 746f 206d 6561 7375 is used to measu │ │ │ -000dfd60: 7265 2074 6865 2061 6e67 6c65 2e20 5468 re the angle. Th │ │ │ -000dfd70: 6520 7374 6172 7469 6e67 2061 6e64 2065 e starting and e │ │ │ -000dfd80: 6e64 696e 6720 706f 696e 7473 2063 6861 nding points cha │ │ │ -000dfd90: 6e67 650a 6173 2074 6865 206f 626a 6563 nge.as the objec │ │ │ -000dfda0: 7420 726f 7461 7465 732e 4465 7665 6c6f t rotates.Develo │ │ │ -000dfdb0: 7065 7220 7368 6f75 6c64 206b 6565 7020 per should keep │ │ │ -000dfdc0: 696e 206d 696e 6420 7468 6174 2074 6865 in mind that the │ │ │ -000dfdd0: 2072 6574 7572 6e65 6420 526f 7461 7465 returned Rotate │ │ │ -000dfde0: 6452 6563 7420 6361 6e20 636f 6e74 6169 dRect can contai │ │ │ -000dfdf0: 6e20 6e65 6761 7469 7665 0a69 6e64 6963 n negative.indic │ │ │ -000dfe00: 6573 2077 6865 6e20 6461 7461 2069 7320 es when data is │ │ │ -000dfe10: 636c 6f73 6520 746f 2074 6865 2063 6f6e close to the con │ │ │ -000dfe20: 7461 696e 696e 6720 4d61 7420 656c 656d taining Mat elem │ │ │ -000dfe30: 656e 7420 626f 756e 6461 7279 2e3c 2f64 ent boundary..
    .
    Param │ │ │ -000dfe60: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ -000dfe70: 3c63 6f64 653e 706f 696e 7473 3c2f 636f points - Input vect │ │ │ -000dfe90: 6f72 206f 6620 3244 2070 6f69 6e74 732c or of 2D points, │ │ │ -000dfea0: 2073 746f 7265 6420 696e 2073 7464 3a3a stored in std:: │ │ │ -000dfeb0: 7665 6374 6f72 266c 743b 2667 743b 206f vector<> o │ │ │ -000dfec0: 7220 4d61 743c 2f64 643e 0a3c 6474 3e52 r Mat
    .
    R │ │ │ -000dfed0: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    automatically g │ │ │ -000dfef0: 656e 6572 6174 6564 3c2f 6464 3e0a 3c2f enerated
    ..
    .
    .
  • .
  • │ │ │ -000dff20: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    bo │ │ │ -000dff80: 7850 6f69 6e74 733c 2f68 333e 0a3c 6469 xPoints

    ..public static │ │ │ -000dfff0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  void boxPoints(RotatedRec │ │ │ -000e00c0: 743c 2f61 3e26 6e62 7370 3b62 6f78 2c0a t box,. │ │ │ -000e00d0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000e0110: 3c2f 613e 266e 6273 703b 706f 696e 7473  points │ │ │ -000e0120: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c ).< │ │ │ -000e0130: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -000e0140: 223e 4669 6e64 7320 7468 6520 666f 7572 ">Finds the four │ │ │ -000e0150: 2076 6572 7469 6365 7320 6f66 2061 2072 vertices of a r │ │ │ -000e0160: 6f74 6174 6564 2072 6563 742e 2055 7365 otated rect. Use │ │ │ -000e0170: 6675 6c20 746f 2064 7261 7720 7468 6520 ful to draw the │ │ │ -000e0180: 726f 7461 7465 6420 7265 6374 616e 676c rotated rectangl │ │ │ -000e0190: 652e 0a0a 5468 6520 6675 6e63 7469 6f6e e...The function │ │ │ -000e01a0: 2066 696e 6473 2074 6865 2066 6f75 7220 finds the four │ │ │ -000e01b0: 7665 7274 6963 6573 206f 6620 6120 726f vertices of a ro │ │ │ -000e01c0: 7461 7465 6420 7265 6374 616e 676c 652e tated rectangle. │ │ │ -000e01d0: 2054 6865 2066 6f75 7220 7665 7274 6963 The four vertic │ │ │ -000e01e0: 6573 2061 7265 2072 6574 7572 6e65 640a es are returned. │ │ │ -000e01f0: 696e 2063 6c6f 636b 7769 7365 206f 7264 in clockwise ord │ │ │ -000e0200: 6572 2073 7461 7274 696e 6720 6672 6f6d er starting from │ │ │ -000e0210: 2074 6865 2070 6f69 6e74 2077 6974 6820 the point with │ │ │ -000e0220: 6772 6561 7465 7374 205c 2879 5c29 2e20 greatest \(y\). │ │ │ -000e0230: 4966 2074 776f 2070 6f69 6e74 7320 6861 If two points ha │ │ │ -000e0240: 7665 2074 6865 0a73 616d 6520 5c28 795c ve the.same \(y\ │ │ │ -000e0250: 2920 636f 6f72 6469 6e61 7465 2074 6865 ) coordinate the │ │ │ -000e0260: 2072 6967 6874 6d6f 7374 2069 7320 7468 rightmost is th │ │ │ -000e0270: 6520 7374 6172 7469 6e67 2070 6f69 6e74 e starting point │ │ │ -000e0280: 2e20 5468 6973 2066 756e 6374 696f 6e20 . This function │ │ │ -000e0290: 6973 2075 7365 6675 6c20 746f 2064 7261 is useful to dra │ │ │ -000e02a0: 7720 7468 650a 7265 6374 616e 676c 652e w the.rectangle. │ │ │ -000e02b0: 2049 6e20 432b 2b2c 2069 6e73 7465 6164 In C++, instead │ │ │ -000e02c0: 206f 6620 7573 696e 6720 7468 6973 2066 of using this f │ │ │ -000e02d0: 756e 6374 696f 6e2c 2079 6f75 2063 616e unction, you can │ │ │ -000e02e0: 2064 6972 6563 746c 7920 7573 6520 526f directly use Ro │ │ │ -000e02f0: 7461 7465 6452 6563 743a 3a70 6f69 6e74 tatedRect::point │ │ │ -000e0300: 7320 6d65 7468 6f64 2e20 506c 6561 7365 s method. Please │ │ │ -000e0310: 0a76 6973 6974 2074 6865 2052 4546 3a20 .visit the REF: │ │ │ -000e0320: 7475 746f 7269 616c 5f62 6f75 6e64 696e tutorial_boundin │ │ │ -000e0330: 675f 726f 7461 7465 645f 656c 6c69 7073 g_rotated_ellips │ │ │ -000e0340: 6573 2022 7475 746f 7269 616c 206f 6e20 es "tutorial on │ │ │ -000e0350: 4372 6561 7469 6e67 2042 6f75 6e64 696e Creating Boundin │ │ │ -000e0360: 6720 726f 7461 7465 6420 626f 7865 7320 g rotated boxes │ │ │ -000e0370: 616e 6420 656c 6c69 7073 6573 0a66 6f72 and ellipses.for │ │ │ -000e0380: 2063 6f6e 746f 7572 7322 2066 6f72 206d contours" for m │ │ │ -000e0390: 6f72 6520 696e 666f 726d 6174 696f 6e2e ore information. │ │ │ -000e03a0: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373 .
    .
    Pa │ │ │ -000e03c0: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000e03d0: 6464 3e3c 636f 6465 3e62 6f78 3c2f 636f dd>box - The input │ │ │ -000e03f0: 726f 7461 7465 6420 7265 6374 616e 676c rotated rectangl │ │ │ -000e0400: 652e 2049 7420 6d61 7920 6265 2074 6865 e. It may be the │ │ │ -000e0410: 206f 7574 7075 7420 6f66 2052 4546 3a20 output of REF: │ │ │ -000e0420: 6d69 6e41 7265 6152 6563 742e 3c2f 6464 minAreaRect..
    poin │ │ │ -000e0440: 7473 3c2f 636f 6465 3e20 2d20 5468 6520 ts - The │ │ │ -000e0450: 6f75 7470 7574 2061 7272 6179 206f 6620 output array of │ │ │ -000e0460: 666f 7572 2076 6572 7469 6365 7320 6f66 four vertices of │ │ │ -000e0470: 2072 6563 7461 6e67 6c65 732e 3c2f 6464 rectangles.
    .
    ..< │ │ │ -000e0490: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ -000e04a0: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    minEnclosi │ │ │ -000e0520: 6e67 4369 7263 6c65 3c2f 6833 3e0a 3c64 ngCircle

    ..public stati │ │ │ -000e0590: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void minEnclosing │ │ │ -000e05f0: 4369 7263 6c65 3c2f 7370 616e 3e3c 7762 Circle(MatOfPoint2f points,. │ │ │ -000e0680: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Po │ │ │ -000e06c0: 696e 743c 2f61 3e26 6e62 7370 3b63 656e int cen │ │ │ -000e06d0: 7465 722c 0a20 666c 6f61 745b 5d26 6e62 ter,. float[]&nb │ │ │ -000e06e0: 7370 3b72 6164 6975 7329 3c2f 7370 616e sp;radius).
    Finds │ │ │ -000e0710: 2061 2063 6972 636c 6520 6f66 2074 6865 a circle of the │ │ │ -000e0720: 206d 696e 696d 756d 2061 7265 6120 656e minimum area en │ │ │ -000e0730: 636c 6f73 696e 6720 6120 3244 2070 6f69 closing a 2D poi │ │ │ -000e0740: 6e74 2073 6574 2e0a 0a54 6865 2066 756e nt set...The fun │ │ │ -000e0750: 6374 696f 6e20 6669 6e64 7320 7468 6520 ction finds the │ │ │ -000e0760: 6d69 6e69 6d61 6c20 656e 636c 6f73 696e minimal enclosin │ │ │ -000e0770: 6720 6369 7263 6c65 206f 6620 6120 3244 g circle of a 2D │ │ │ -000e0780: 2070 6f69 6e74 2073 6574 2075 7369 6e67 point set using │ │ │ -000e0790: 2061 6e20 6974 6572 6174 6976 6520 616c an iterative al │ │ │ -000e07a0: 676f 7269 7468 6d2e 3c2f 6469 763e 0a3c gorithm.
    .< │ │ │ -000e07b0: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ -000e07c0: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ -000e07d0: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    points - │ │ │ -000e07f0: 2049 6e70 7574 2076 6563 746f 7220 6f66 Input vector of │ │ │ -000e0800: 2032 4420 706f 696e 7473 2c20 7374 6f72 2D points, stor │ │ │ -000e0810: 6564 2069 6e20 7374 643a 3a76 6563 746f ed in std::vecto │ │ │ -000e0820: 7226 6c74 3b26 6774 3b20 6f72 204d 6174 r<> or Mat │ │ │ -000e0830: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000e0840: 6365 6e74 6572 3c2f 636f 6465 3e20 2d20 center - │ │ │ -000e0850: 4f75 7470 7574 2063 656e 7465 7220 6f66 Output center of │ │ │ -000e0860: 2074 6865 2063 6972 636c 652e 3c2f 6464 the circle.
    .
    radi │ │ │ -000e0880: 7573 3c2f 636f 6465 3e20 2d20 4f75 7470 us - Outp │ │ │ -000e0890: 7574 2072 6164 6975 7320 6f66 2074 6865 ut radius of the │ │ │ -000e08a0: 2063 6972 636c 652e 3c2f 6464 3e0a 3c2f circle.
    ....
  • .
  • │ │ │ -000e08d0: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    minEnclosingTri │ │ │ -000e0940: 616e 676c 653c 2f68 333e 0a3c 6469 7620 angle

    .
    .
    public static double minEnclosingT │ │ │ -000e0a10: 7269 616e 676c 653c 2f73 7061 6e3e 3c77 riangle(Mat │ │ │ -000e0a80: 266e 6273 703b 706f 696e 7473 2c0a 203c  points,. < │ │ │ -000e0a90: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000e0aa0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000e0ab0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000e0ac0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat triangle │ │ │ -000e0ae0: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ -000e0af0: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -000e0b00: 223e 4669 6e64 7320 6120 7472 6961 6e67 ">Finds a triang │ │ │ -000e0b10: 6c65 206f 6620 6d69 6e69 6d75 6d20 6172 le of minimum ar │ │ │ -000e0b20: 6561 2065 6e63 6c6f 7369 6e67 2061 2032 ea enclosing a 2 │ │ │ -000e0b30: 4420 706f 696e 7420 7365 7420 616e 6420 D point set and │ │ │ -000e0b40: 7265 7475 726e 7320 6974 7320 6172 6561 returns its area │ │ │ -000e0b50: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ -000e0b60: 6669 6e64 7320 6120 7472 6961 6e67 6c65 finds a triangle │ │ │ -000e0b70: 206f 6620 6d69 6e69 6d75 6d20 6172 6561 of minimum area │ │ │ -000e0b80: 2065 6e63 6c6f 7369 6e67 2074 6865 2067 enclosing the g │ │ │ -000e0b90: 6976 656e 2073 6574 206f 6620 3244 2070 iven set of 2D p │ │ │ -000e0ba0: 6f69 6e74 7320 616e 6420 7265 7475 726e oints and return │ │ │ -000e0bb0: 7320 6974 730a 6172 6561 2e20 5468 6520 s its.area. The │ │ │ -000e0bc0: 6f75 7470 7574 2066 6f72 2061 2067 6976 output for a giv │ │ │ -000e0bd0: 656e 2032 4420 706f 696e 7420 7365 7420 en 2D point set │ │ │ -000e0be0: 6973 2073 686f 776e 2069 6e20 7468 6520 is shown in the │ │ │ -000e0bf0: 696d 6167 6520 6265 6c6f 772e 2032 4420 image below. 2D │ │ │ -000e0c00: 706f 696e 7473 2061 7265 2064 6570 6963 points are depic │ │ │ -000e0c10: 7465 6420 696e 0a72 6564 2a20 616e 6420 ted in.red* and │ │ │ -000e0c20: 7468 6520 656e 636c 6f73 696e 6720 7472 the enclosing tr │ │ │ -000e0c30: 6961 6e67 6c65 2069 6e20 2a79 656c 6c6f iangle in *yello │ │ │ -000e0c40: 772a 2e0a 0a21 5b53 616d 706c 6520 6f75 w*...![Sample ou │ │ │ -000e0c50: 7470 7574 206f 6620 7468 6520 6d69 6e69 tput of the mini │ │ │ -000e0c60: 6d75 6d20 656e 636c 6f73 696e 6720 7472 mum enclosing tr │ │ │ -000e0c70: 6961 6e67 6c65 2066 756e 6374 696f 6e5d iangle function] │ │ │ -000e0c80: 2870 6963 732f 6d69 6e65 6e63 6c6f 7369 (pics/minenclosi │ │ │ -000e0c90: 6e67 7472 6961 6e67 6c65 2e70 6e67 290a ngtriangle.png). │ │ │ -000e0ca0: 0a54 6865 2069 6d70 6c65 6d65 6e74 6174 .The implementat │ │ │ -000e0cb0: 696f 6e20 6f66 2074 6865 2061 6c67 6f72 ion of the algor │ │ │ -000e0cc0: 6974 686d 2069 7320 6261 7365 6420 6f6e ithm is based on │ │ │ -000e0cd0: 204f 2752 6f75 726b 6527 7320 4349 5445 O'Rourke's CITE │ │ │ -000e0ce0: 3a20 4f52 6f75 726b 6538 3620 616e 6420 : ORourke86 and │ │ │ -000e0cf0: 4b6c 6565 2061 6e64 204c 6173 6b6f 7773 Klee and Laskows │ │ │ -000e0d00: 6b69 2773 0a43 4954 453a 204b 6c65 654c ki's.CITE: KleeL │ │ │ -000e0d10: 6173 6b6f 7773 6b69 3835 2070 6170 6572 askowski85 paper │ │ │ -000e0d20: 732e 204f 2752 6f75 726b 6520 7072 6f76 s. O'Rourke prov │ │ │ -000e0d30: 6964 6573 2061 205c 285c 7468 6574 6128 ides a \(\theta( │ │ │ -000e0d40: 6e29 5c29 2061 6c67 6f72 6974 686d 2066 n)\) algorithm f │ │ │ -000e0d50: 6f72 2066 696e 6469 6e67 2074 6865 206d or finding the m │ │ │ -000e0d60: 696e 696d 616c 0a65 6e63 6c6f 7369 6e67 inimal.enclosing │ │ │ -000e0d70: 2074 7269 616e 676c 6520 6f66 2061 2032 triangle of a 2 │ │ │ -000e0d80: 4420 636f 6e76 6578 2070 6f6c 7967 6f6e D convex polygon │ │ │ -000e0d90: 2077 6974 6820 6e20 7665 7274 6963 6573 with n vertices │ │ │ -000e0da0: 2e20 5369 6e63 6520 7468 6520 236d 696e . Since the #min │ │ │ -000e0db0: 456e 636c 6f73 696e 6754 7269 616e 676c EnclosingTriangl │ │ │ -000e0dc0: 6520 6675 6e63 7469 6f6e 0a74 616b 6573 e function.takes │ │ │ -000e0dd0: 2061 2032 4420 706f 696e 7420 7365 7420 a 2D point set │ │ │ -000e0de0: 6173 2069 6e70 7574 2061 6e20 6164 6469 as input an addi │ │ │ -000e0df0: 7469 6f6e 616c 2070 7265 7072 6f63 6573 tional preproces │ │ │ -000e0e00: 7369 6e67 2073 7465 7020 6f66 2063 6f6d sing step of com │ │ │ -000e0e10: 7075 7469 6e67 2074 6865 2063 6f6e 7665 puting the conve │ │ │ -000e0e20: 7820 6875 6c6c 206f 6620 7468 650a 3244 x hull of the.2D │ │ │ -000e0e30: 2070 6f69 6e74 2073 6574 2069 7320 7265 point set is re │ │ │ -000e0e40: 7175 6972 6564 2e20 5468 6520 636f 6d70 quired. The comp │ │ │ -000e0e50: 6c65 7869 7479 206f 6620 7468 6520 2363 lexity of the #c │ │ │ -000e0e60: 6f6e 7665 7848 756c 6c20 6675 6e63 7469 onvexHull functi │ │ │ -000e0e70: 6f6e 2069 7320 5c28 4f28 6e20 6c6f 6728 on is \(O(n log( │ │ │ -000e0e80: 6e29 295c 2920 7768 6963 6820 6973 2068 n))\) which is h │ │ │ -000e0e90: 6967 6865 720a 7468 616e 205c 285c 7468 igher.than \(\th │ │ │ -000e0ea0: 6574 6128 6e29 5c29 2e20 5468 7573 2074 eta(n)\). Thus t │ │ │ -000e0eb0: 6865 206f 7665 7261 6c6c 2063 6f6d 706c he overall compl │ │ │ -000e0ec0: 6578 6974 7920 6f66 2074 6865 2066 756e exity of the fun │ │ │ -000e0ed0: 6374 696f 6e20 6973 205c 284f 286e 206c ction is \(O(n l │ │ │ -000e0ee0: 6f67 286e 2929 5c29 2e3c 2f64 6976 3e0a og(n))\).
    . │ │ │ -000e0ef0: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ -000e0f10: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    points │ │ │ -000e0f30: 2d20 496e 7075 7420 7665 6374 6f72 206f - Input vector o │ │ │ -000e0f40: 6620 3244 2070 6f69 6e74 7320 7769 7468 f 2D points with │ │ │ -000e0f50: 2064 6570 7468 2043 565f 3332 5320 6f72 depth CV_32S or │ │ │ -000e0f60: 2043 565f 3332 462c 2073 746f 7265 6420 CV_32F, stored │ │ │ -000e0f70: 696e 2073 7464 3a3a 7665 6374 6f72 266c in std::vector&l │ │ │ -000e0f80: 743b 2667 743b 206f 7220 4d61 743c 2f64 t;> or Mat.
    tri │ │ │ -000e0fa0: 616e 676c 653c 2f63 6f64 653e 202d 204f angle - O │ │ │ -000e0fb0: 7574 7075 7420 7665 6374 6f72 206f 6620 utput vector of │ │ │ -000e0fc0: 7468 7265 6520 3244 2070 6f69 6e74 7320 three 2D points │ │ │ -000e0fd0: 6465 6669 6e69 6e67 2074 6865 2076 6572 defining the ver │ │ │ -000e0fe0: 7469 6365 7320 6f66 2074 6865 2074 7269 tices of the tri │ │ │ -000e0ff0: 616e 676c 652e 2054 6865 2064 6570 7468 angle. The depth │ │ │ -000e1000: 0a6f 6620 7468 6520 4f75 7470 7574 4172 .of the OutputAr │ │ │ -000e1010: 7261 7920 6d75 7374 2062 6520 4356 5f33 ray must be CV_3 │ │ │ -000e1020: 3246 2e3c 2f64 643e 0a3c 6474 3e52 6574 2F.
    .
    Ret │ │ │ -000e1030: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e61 urns:
    .
    a │ │ │ -000e1040: 7574 6f6d 6174 6963 616c 6c79 2067 656e utomatically gen │ │ │ -000e1050: 6572 6174 6564 3c2f 6464 3e0a 3c2f 646c erated
    .
    ...
  • .
  • .< │ │ │ -000e1080: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ -000e1090: 6574 6169 6c22 2069 643d 226d 696e 456e etail" id="minEn │ │ │ -000e10a0: 636c 6f73 696e 6743 6f6e 7665 7850 6f6c closingConvexPol │ │ │ -000e10b0: 7967 6f6e 286f 7267 2e6f 7065 6e63 762e ygon(org.opencv. │ │ │ -000e10c0: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ -000e10d0: 6e63 762e 636f 7265 2e4d 6174 2c69 6e74 ncv.core.Mat,int │ │ │ -000e10e0: 2922 3e0a 3c68 333e 6d69 6e45 6e63 6c6f )">.

    minEnclo │ │ │ -000e10f0: 7369 6e67 436f 6e76 6578 506f 6c79 676f singConvexPolygo │ │ │ -000e1100: 6e3c 2f68 333e 0a3c 6469 7620 636c 6173 n

    .
    .
    pub │ │ │ -000e1160: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static double&n │ │ │ -000e11a0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;m │ │ │ -000e11c0: 696e 456e 636c 6f73 696e 6743 6f6e 7665 inEnclosingConve │ │ │ -000e11d0: 7850 6f6c 7967 6f6e 3c2f 7370 616e 3e3c xPolygon< │ │ │ -000e11e0: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat points,. │ │ │ -000e1250: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000e1290: 2f61 3e26 6e62 7370 3b70 6f6c 7967 6f6e /a> polygon │ │ │ -000e12a0: 2c0a 2069 6e74 266e 6273 703b 6b29 3c2f ,. int k)
    .
    F │ │ │ -000e12d0: 696e 6473 2061 2063 6f6e 7665 7820 706f inds a convex po │ │ │ -000e12e0: 6c79 676f 6e20 6f66 206d 696e 696d 756d lygon of minimum │ │ │ -000e12f0: 2061 7265 6120 656e 636c 6f73 696e 6720 area enclosing │ │ │ -000e1300: 6120 3244 2070 6f69 6e74 2073 6574 2061 a 2D point set a │ │ │ -000e1310: 6e64 2072 6574 7572 6e73 2069 7473 2061 nd returns its a │ │ │ -000e1320: 7265 612e 0a0a 5468 6973 2066 756e 6374 rea...This funct │ │ │ -000e1330: 696f 6e20 7461 6b65 7320 6120 6769 7665 ion takes a give │ │ │ -000e1340: 6e20 7365 7420 6f66 2032 4420 706f 696e n set of 2D poin │ │ │ -000e1350: 7473 2061 6e64 2066 696e 6473 2074 6865 ts and finds the │ │ │ -000e1360: 2065 6e63 6c6f 7369 6e67 2070 6f6c 7967 enclosing polyg │ │ │ -000e1370: 6f6e 2077 6974 6820 6b20 7665 7274 6963 on with k vertic │ │ │ -000e1380: 6573 2061 6e64 206d 696e 696d 616c 0a61 es and minimal.a │ │ │ -000e1390: 7265 612e 2049 7420 7461 6b65 7320 7468 rea. It takes th │ │ │ -000e13a0: 6520 7365 7420 6f66 2070 6f69 6e74 7320 e set of points │ │ │ -000e13b0: 616e 6420 7468 6520 7061 7261 6d65 7465 and the paramete │ │ │ -000e13c0: 7220 6b20 6173 2069 6e70 7574 2061 6e64 r k as input and │ │ │ -000e13d0: 2072 6574 7572 6e73 2074 6865 2061 7265 returns the are │ │ │ -000e13e0: 6120 6f66 2074 6865 206d 696e 696d 616c a of the minimal │ │ │ -000e13f0: 0a65 6e63 6c6f 7369 6e67 2070 6f6c 7967 .enclosing polyg │ │ │ -000e1400: 6f6e 2e0a 0a54 6865 2049 6d70 6c65 6d65 on...The Impleme │ │ │ -000e1410: 6e74 6174 696f 6e20 6973 2062 6173 6564 ntation is based │ │ │ -000e1420: 206f 6e20 6120 7061 7065 7220 6279 2041 on a paper by A │ │ │ -000e1430: 6767 6172 7761 6c2c 2043 6861 6e67 2061 ggarwal, Chang a │ │ │ -000e1440: 6e64 2059 6170 2043 4954 453a 2041 6767 nd Yap CITE: Agg │ │ │ -000e1450: 6172 7761 6c31 3938 352e 2054 6865 790a arwal1985. They. │ │ │ -000e1460: 7072 6f76 6964 6520 6120 5c28 5c74 6865 provide a \(\the │ │ │ -000e1470: 7461 286e c2b2 6c6f 6728 6e29 6c6f 6728 ta(n..log(n)log( │ │ │ -000e1480: 6b29 295c 2920 616c 676f 7269 7468 6d20 k))\) algorithm │ │ │ -000e1490: 666f 7220 6669 6e64 696e 6720 7468 6520 for finding the │ │ │ -000e14a0: 6d69 6e69 6d61 6c20 636f 6e76 6578 2070 minimal convex p │ │ │ -000e14b0: 6f6c 7967 6f6e 2077 6974 6820 6b0a 7665 olygon with k.ve │ │ │ -000e14c0: 7274 6963 6573 2065 6e63 6c6f 7369 6e67 rtices enclosing │ │ │ -000e14d0: 2061 2032 4420 636f 6e76 6578 2070 6f6c a 2D convex pol │ │ │ -000e14e0: 7967 6f6e 2077 6974 6820 6e20 7665 7274 ygon with n vert │ │ │ -000e14f0: 6963 6573 2028 6b20 266c 743b 206e 292e ices (k < n). │ │ │ -000e1500: 2053 696e 6365 2074 6865 2023 6d69 6e45 Since the #minE │ │ │ -000e1510: 6e63 6c6f 7369 6e67 436f 6e76 6578 506f nclosingConvexPo │ │ │ -000e1520: 6c79 676f 6e0a 6675 6e63 7469 6f6e 2074 lygon.function t │ │ │ -000e1530: 616b 6573 2061 2032 4420 706f 696e 7420 akes a 2D point │ │ │ -000e1540: 7365 7420 6173 2069 6e70 7574 2c20 616e set as input, an │ │ │ -000e1550: 2061 6464 6974 696f 6e61 6c20 7072 6570 additional prep │ │ │ -000e1560: 726f 6365 7373 696e 6720 7374 6570 206f rocessing step o │ │ │ -000e1570: 6620 636f 6d70 7574 696e 6720 7468 6520 f computing the │ │ │ -000e1580: 636f 6e76 6578 2068 756c 6c0a 6f66 2074 convex hull.of t │ │ │ -000e1590: 6865 2032 4420 706f 696e 7420 7365 7420 he 2D point set │ │ │ -000e15a0: 6973 2072 6571 7569 7265 642e 2054 6865 is required. The │ │ │ -000e15b0: 2063 6f6d 706c 6578 6974 7920 6f66 2074 complexity of t │ │ │ -000e15c0: 6865 2023 636f 6e76 6578 4875 6c6c 2066 he #convexHull f │ │ │ -000e15d0: 756e 6374 696f 6e20 6973 205c 284f 286e unction is \(O(n │ │ │ -000e15e0: 206c 6f67 286e 2929 5c29 2077 6869 6368 log(n))\) which │ │ │ -000e15f0: 0a69 7320 6c6f 7765 7220 7468 616e 205c .is lower than \ │ │ │ -000e1600: 285c 7468 6574 6128 6ec2 b26c 6f67 286e (\theta(n..log(n │ │ │ -000e1610: 296c 6f67 286b 2929 5c29 2e20 5468 7573 )log(k))\). Thus │ │ │ -000e1620: 2074 6865 206f 7665 7261 6c6c 2063 6f6d the overall com │ │ │ -000e1630: 706c 6578 6974 7920 6f66 2074 6865 2066 plexity of the f │ │ │ -000e1640: 756e 6374 696f 6e20 6973 0a5c 284f 286e unction is.\(O(n │ │ │ -000e1650: c2b2 6c6f 6728 6e29 6c6f 6728 6b29 295c ..log(n)log(k))\ │ │ │ -000e1660: 292e 3c2f 6469 763e 0a3c 646c 2063 6c61 ).
    .
    .
    │ │ │ -000e1680: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ -000e1690: 0a3c 6464 3e3c 636f 6465 3e70 6f69 6e74 .
    point │ │ │ -000e16a0: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ -000e16b0: 2076 6563 746f 7220 6f66 2032 4420 706f vector of 2D po │ │ │ -000e16c0: 696e 7473 2c20 7374 6f72 6564 2069 6e20 ints, stored in │ │ │ -000e16d0: 7374 643a 3a76 6563 746f 7226 6c74 3b26 std::vector<& │ │ │ -000e16e0: 6774 3b20 6f72 204d 6174 3c2f 6464 3e0a gt; or Mat
    . │ │ │ -000e16f0: 3c64 643e 3c63 6f64 653e 706f 6c79 676f
    polygo │ │ │ -000e1700: 6e3c 2f63 6f64 653e 202d 204f 7574 7075 n - Outpu │ │ │ -000e1710: 7420 7665 6374 6f72 206f 6620 3244 2070 t vector of 2D p │ │ │ -000e1720: 6f69 6e74 7320 6465 6669 6e69 6e67 2074 oints defining t │ │ │ -000e1730: 6865 2076 6572 7469 6365 7320 6f66 2074 he vertices of t │ │ │ -000e1740: 6865 2065 6e63 6c6f 7369 6e67 2070 6f6c he enclosing pol │ │ │ -000e1750: 7967 6f6e 3c2f 6464 3e0a 3c64 643e 3c63 ygon
    .
    k - N │ │ │ -000e1770: 756d 6265 7220 6f66 2076 6572 7469 6365 umber of vertice │ │ │ -000e1780: 7320 6f66 2074 6865 206f 7574 7075 7420 s of the output │ │ │ -000e1790: 706f 6c79 676f 6e3c 2f64 643e 0a3c 6474 polygon
    .
    Returns:
    .< │ │ │ -000e17b0: 6464 3e61 7574 6f6d 6174 6963 616c 6c79 dd>automatically │ │ │ -000e17c0: 2067 656e 6572 6174 6564 3c2f 6464 3e0a generated. │ │ │ -000e17d0: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    .
    .
  • ..
    .

    moment │ │ │ -000e1840: 733c 2f68 333e 0a3c 6469 7620 636c 6173 s

    .
    .
    pub │ │ │ -000e18a0: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static Mom │ │ │ -000e1910: 656e 7473 3c2f 613e 3c2f 7370 616e 3e26 ents& │ │ │ -000e1920: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -000e1940: 6d6f 6d65 6e74 733c 2f73 7061 6e3e 3c77 moments(Mat │ │ │ -000e19b0: 266e 6273 703b 6172 7261 792c 0a20 626f  array,. bo │ │ │ -000e19c0: 6f6c 6561 6e26 6e62 7370 3b62 696e 6172 olean binar │ │ │ -000e19d0: 7949 6d61 6765 293c 2f73 7061 6e3e 3c2f yImage).
    Calculat │ │ │ -000e1a00: 6573 2061 6c6c 206f 6620 7468 6520 6d6f es all of the mo │ │ │ -000e1a10: 6d65 6e74 7320 7570 2074 6f20 7468 6520 ments up to the │ │ │ -000e1a20: 7468 6972 6420 6f72 6465 7220 6f66 2061 third order of a │ │ │ -000e1a30: 2070 6f6c 7967 6f6e 206f 7220 7261 7374 polygon or rast │ │ │ -000e1a40: 6572 697a 6564 2073 6861 7065 2e0a 0a54 erized shape...T │ │ │ -000e1a50: 6865 2066 756e 6374 696f 6e20 636f 6d70 he function comp │ │ │ -000e1a60: 7574 6573 206d 6f6d 656e 7473 2c20 7570 utes moments, up │ │ │ -000e1a70: 2074 6f20 7468 6520 3372 6420 6f72 6465 to the 3rd orde │ │ │ -000e1a80: 722c 206f 6620 6120 7665 6374 6f72 2073 r, of a vector s │ │ │ -000e1a90: 6861 7065 206f 7220 6120 7261 7374 6572 hape or a raster │ │ │ -000e1aa0: 697a 6564 2073 6861 7065 2e20 5468 650a ized shape. The. │ │ │ -000e1ab0: 7265 7375 6c74 7320 6172 6520 7265 7475 results are retu │ │ │ -000e1ac0: 726e 6564 2069 6e20 7468 6520 7374 7275 rned in the stru │ │ │ -000e1ad0: 6374 7572 6520 6376 3a3a 4d6f 6d65 6e74 cture cv::Moment │ │ │ -000e1ae0: 732e 3c2f 6469 763e 0a3c 646c 2063 6c61 s.
    .
    .
    │ │ │ -000e1b00: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ -000e1b10: 0a3c 6464 3e3c 636f 6465 3e61 7272 6179 .
    array │ │ │ -000e1b20: 3c2f 636f 6465 3e20 2d20 5369 6e67 6c65 - Single │ │ │ -000e1b30: 2063 6861 6e6e 656c 2072 6173 7465 7220 channel raster │ │ │ -000e1b40: 696d 6167 6520 2843 565f 3855 2c20 4356 image (CV_8U, CV │ │ │ -000e1b50: 5f31 3655 2c20 4356 5f31 3653 2c20 4356 _16U, CV_16S, CV │ │ │ -000e1b60: 5f33 3246 2c20 4356 5f36 3446 2920 6f72 _32F, CV_64F) or │ │ │ -000e1b70: 2061 6e20 6172 7261 7920 280a 5c28 3120 an array (.\(1 │ │ │ -000e1b80: 5c74 696d 6573 204e 5c29 206f 7220 5c28 \times N\) or \( │ │ │ -000e1b90: 4e20 5c74 696d 6573 2031 5c29 2029 206f N \times 1\) ) o │ │ │ -000e1ba0: 6620 3244 2070 6f69 6e74 7320 2850 6f69 f 2D points (Poi │ │ │ -000e1bb0: 6e74 206f 7220 506f 696e 7432 6629 2e3c nt or Point2f).< │ │ │ -000e1bc0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e62 /dd>.
    b │ │ │ -000e1bd0: 696e 6172 7949 6d61 6765 3c2f 636f 6465 inaryImage - If it is tru │ │ │ -000e1bf0: 652c 2061 6c6c 206e 6f6e 2d7a 6572 6f20 e, all non-zero │ │ │ -000e1c00: 696d 6167 6520 7069 7865 6c73 2061 7265 image pixels are │ │ │ -000e1c10: 2074 7265 6174 6564 2061 7320 3127 732e treated as 1's. │ │ │ -000e1c20: 2054 6865 2070 6172 616d 6574 6572 2069 The parameter i │ │ │ -000e1c30: 730a 7573 6564 2066 6f72 2069 6d61 6765 s.used for image │ │ │ -000e1c40: 7320 6f6e 6c79 2e3c 2f64 643e 0a3c 6474 s only.
    .
    Returns:
    .< │ │ │ -000e1c60: 6464 3e6d 6f6d 656e 7473 2e0a 0a3c 623e dd>moments... │ │ │ -000e1c70: 4e6f 7465 3a3c 2f62 3e20 4f6e 6c79 2061 Note: Only a │ │ │ -000e1c80: 7070 6c69 6361 626c 6520 746f 2063 6f6e pplicable to con │ │ │ -000e1c90: 746f 7572 206d 6f6d 656e 7473 2063 616c tour moments cal │ │ │ -000e1ca0: 6375 6c61 7469 6f6e 7320 6672 6f6d 2050 culations from P │ │ │ -000e1cb0: 7974 686f 6e20 6269 6e64 696e 6773 3a20 ython bindings: │ │ │ -000e1cc0: 4e6f 7465 2074 6861 7420 7468 6520 6e75 Note that the nu │ │ │ -000e1cd0: 6d70 790a 7479 7065 2066 6f72 2074 6865 mpy.type for the │ │ │ -000e1ce0: 2069 6e70 7574 2061 7272 6179 2073 686f input array sho │ │ │ -000e1cf0: 756c 6420 6265 2065 6974 6865 7220 6e70 uld be either np │ │ │ -000e1d00: 2e69 6e74 3332 206f 7220 6e70 2e66 6c6f .int32 or np.flo │ │ │ -000e1d10: 6174 3332 2e0a 0a3c 623e 4e6f 7465 3a3c at32...Note:< │ │ │ -000e1d20: 2f62 3e20 466f 7220 636f 6e74 6f75 722d /b> For contour- │ │ │ -000e1d30: 6261 7365 6420 6d6f 6d65 6e74 732c 2074 based moments, t │ │ │ -000e1d40: 6865 207a 6572 6f74 682d 6f72 6465 7220 he zeroth-order │ │ │ -000e1d50: 6d6f 6d65 6e74 205c 6320 6d30 3020 7265 moment \c m00 re │ │ │ -000e1d60: 7072 6573 656e 7473 0a74 6865 2063 6f6e presents.the con │ │ │ -000e1d70: 746f 7572 2061 7265 612e 0a0a 4966 2074 tour area...If t │ │ │ -000e1d80: 6865 2069 6e70 7574 2063 6f6e 746f 7572 he input contour │ │ │ -000e1d90: 2069 7320 6465 6765 6e65 7261 7465 2028 is degenerate ( │ │ │ -000e1da0: 666f 7220 6578 616d 706c 652c 2061 2073 for example, a s │ │ │ -000e1db0: 696e 676c 6520 706f 696e 7420 6f72 2061 ingle point or a │ │ │ -000e1dc0: 6c6c 2070 6f69 6e74 730a 6172 6520 636f ll points.are co │ │ │ -000e1dd0: 6c6c 696e 6561 7229 2c20 7468 6520 6172 llinear), the ar │ │ │ -000e1de0: 6561 2069 7320 7a65 726f 2061 6e64 2074 ea is zero and t │ │ │ -000e1df0: 6865 7265 666f 7265 205c 6320 6d30 3020 herefore \c m00 │ │ │ -000e1e00: 3d3d 2030 2e0a 0a49 6e20 7468 6973 2063 == 0...In this c │ │ │ -000e1e10: 6173 652c 2074 6865 2063 656e 7472 6f69 ase, the centroi │ │ │ -000e1e20: 6420 636f 6f72 6469 6e61 7465 7320 285c d coordinates (\ │ │ │ -000e1e30: 6320 6d31 302f 6d30 302c 205c 6320 6d30 c m10/m00, \c m0 │ │ │ -000e1e40: 312f 6d30 3029 2061 7265 2075 6e64 6566 1/m00) are undef │ │ │ -000e1e50: 696e 6564 0a61 6e64 206d 7573 7420 6265 ined.and must be │ │ │ -000e1e60: 2068 616e 646c 6564 2065 7870 6c69 6369 handled explici │ │ │ -000e1e70: 746c 7920 6279 2074 6865 2063 616c 6c65 tly by the calle │ │ │ -000e1e80: 722e 0a0a 4120 636f 6d6d 6f6e 2077 6f72 r...A common wor │ │ │ -000e1e90: 6b61 726f 756e 6420 6973 2074 6f20 636f karound is to co │ │ │ -000e1ea0: 6d70 7574 6520 7468 6520 6365 6e74 6572 mpute the center │ │ │ -000e1eb0: 2075 7369 6e67 2063 763a 3a62 6f75 6e64 using cv::bound │ │ │ -000e1ec0: 696e 6752 6563 7428 2920 6f72 2062 790a ingRect() or by. │ │ │ -000e1ed0: 6176 6572 6167 696e 6720 7468 6520 696e averaging the in │ │ │ -000e1ee0: 7075 7420 706f 696e 7473 2e0a 0a53 4545 put points...SEE │ │ │ -000e1ef0: 3a20 2063 6f6e 746f 7572 4172 6561 2c20 : contourArea, │ │ │ -000e1f00: 6172 634c 656e 6774 683c 2f64 643e 0a3c arcLength.< │ │ │ -000e1f10: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ...
  • .
    .

    moments

    ..public stati │ │ │ -000e1fe0: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c Moments< │ │ │ -000e2050: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> moments( │ │ │ -000e20e0: 4d61 743c 2f61 3e26 6e62 7370 3b61 7272 Mat arr │ │ │ -000e20f0: 6179 293c 2f73 7061 6e3e 3c2f 6469 763e ay)
  • │ │ │ -000e2100: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Calculates a │ │ │ -000e2120: 6c6c 206f 6620 7468 6520 6d6f 6d65 6e74 ll of the moment │ │ │ -000e2130: 7320 7570 2074 6f20 7468 6520 7468 6972 s up to the thir │ │ │ -000e2140: 6420 6f72 6465 7220 6f66 2061 2070 6f6c d order of a pol │ │ │ -000e2150: 7967 6f6e 206f 7220 7261 7374 6572 697a ygon or rasteriz │ │ │ -000e2160: 6564 2073 6861 7065 2e0a 0a54 6865 2066 ed shape...The f │ │ │ -000e2170: 756e 6374 696f 6e20 636f 6d70 7574 6573 unction computes │ │ │ -000e2180: 206d 6f6d 656e 7473 2c20 7570 2074 6f20 moments, up to │ │ │ -000e2190: 7468 6520 3372 6420 6f72 6465 722c 206f the 3rd order, o │ │ │ -000e21a0: 6620 6120 7665 6374 6f72 2073 6861 7065 f a vector shape │ │ │ -000e21b0: 206f 7220 6120 7261 7374 6572 697a 6564 or a rasterized │ │ │ -000e21c0: 2073 6861 7065 2e20 5468 650a 7265 7375 shape. The.resu │ │ │ -000e21d0: 6c74 7320 6172 6520 7265 7475 726e 6564 lts are returned │ │ │ -000e21e0: 2069 6e20 7468 6520 7374 7275 6374 7572 in the structur │ │ │ -000e21f0: 6520 6376 3a3a 4d6f 6d65 6e74 732e 3c2f e cv::Moments..
    .
    Para │ │ │ -000e2220: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    array - Single cha │ │ │ -000e2250: 6e6e 656c 2072 6173 7465 7220 696d 6167 nnel raster imag │ │ │ -000e2260: 6520 2843 565f 3855 2c20 4356 5f31 3655 e (CV_8U, CV_16U │ │ │ -000e2270: 2c20 4356 5f31 3653 2c20 4356 5f33 3246 , CV_16S, CV_32F │ │ │ -000e2280: 2c20 4356 5f36 3446 2920 6f72 2061 6e20 , CV_64F) or an │ │ │ -000e2290: 6172 7261 7920 280a 5c28 3120 5c74 696d array (.\(1 \tim │ │ │ -000e22a0: 6573 204e 5c29 206f 7220 5c28 4e20 5c74 es N\) or \(N \t │ │ │ -000e22b0: 696d 6573 2031 5c29 2029 206f 6620 3244 imes 1\) ) of 2D │ │ │ -000e22c0: 2070 6f69 6e74 7320 2850 6f69 6e74 206f points (Point o │ │ │ -000e22d0: 7220 506f 696e 7432 6629 2e0a 7573 6564 r Point2f)..used │ │ │ -000e22e0: 2066 6f72 2069 6d61 6765 7320 6f6e 6c79 for images only │ │ │ -000e22f0: 2e3c 2f64 643e 0a3c 6474 3e52 6574 7572 .
    .
    Retur │ │ │ -000e2300: 6e73 3a3c 2f64 743e 0a3c 6464 3e6d 6f6d ns:
    .
    mom │ │ │ -000e2310: 656e 7473 2e0a 0a3c 623e 4e6f 7465 3a3c ents...Note:< │ │ │ -000e2320: 2f62 3e20 4f6e 6c79 2061 7070 6c69 6361 /b> Only applica │ │ │ -000e2330: 626c 6520 746f 2063 6f6e 746f 7572 206d ble to contour m │ │ │ -000e2340: 6f6d 656e 7473 2063 616c 6375 6c61 7469 oments calculati │ │ │ -000e2350: 6f6e 7320 6672 6f6d 2050 7974 686f 6e20 ons from Python │ │ │ -000e2360: 6269 6e64 696e 6773 3a20 4e6f 7465 2074 bindings: Note t │ │ │ -000e2370: 6861 7420 7468 6520 6e75 6d70 790a 7479 hat the numpy.ty │ │ │ -000e2380: 7065 2066 6f72 2074 6865 2069 6e70 7574 pe for the input │ │ │ -000e2390: 2061 7272 6179 2073 686f 756c 6420 6265 array should be │ │ │ -000e23a0: 2065 6974 6865 7220 6e70 2e69 6e74 3332 either np.int32 │ │ │ -000e23b0: 206f 7220 6e70 2e66 6c6f 6174 3332 2e0a or np.float32.. │ │ │ -000e23c0: 0a3c 623e 4e6f 7465 3a3c 2f62 3e20 466f .Note: Fo │ │ │ -000e23d0: 7220 636f 6e74 6f75 722d 6261 7365 6420 r contour-based │ │ │ -000e23e0: 6d6f 6d65 6e74 732c 2074 6865 207a 6572 moments, the zer │ │ │ -000e23f0: 6f74 682d 6f72 6465 7220 6d6f 6d65 6e74 oth-order moment │ │ │ -000e2400: 205c 6320 6d30 3020 7265 7072 6573 656e \c m00 represen │ │ │ -000e2410: 7473 0a74 6865 2063 6f6e 746f 7572 2061 ts.the contour a │ │ │ -000e2420: 7265 612e 0a0a 4966 2074 6865 2069 6e70 rea...If the inp │ │ │ -000e2430: 7574 2063 6f6e 746f 7572 2069 7320 6465 ut contour is de │ │ │ -000e2440: 6765 6e65 7261 7465 2028 666f 7220 6578 generate (for ex │ │ │ -000e2450: 616d 706c 652c 2061 2073 696e 676c 6520 ample, a single │ │ │ -000e2460: 706f 696e 7420 6f72 2061 6c6c 2070 6f69 point or all poi │ │ │ -000e2470: 6e74 730a 6172 6520 636f 6c6c 696e 6561 nts.are collinea │ │ │ -000e2480: 7229 2c20 7468 6520 6172 6561 2069 7320 r), the area is │ │ │ -000e2490: 7a65 726f 2061 6e64 2074 6865 7265 666f zero and therefo │ │ │ -000e24a0: 7265 205c 6320 6d30 3020 3d3d 2030 2e0a re \c m00 == 0.. │ │ │ -000e24b0: 0a49 6e20 7468 6973 2063 6173 652c 2074 .In this case, t │ │ │ -000e24c0: 6865 2063 656e 7472 6f69 6420 636f 6f72 he centroid coor │ │ │ -000e24d0: 6469 6e61 7465 7320 285c 6320 6d31 302f dinates (\c m10/ │ │ │ -000e24e0: 6d30 302c 205c 6320 6d30 312f 6d30 3029 m00, \c m01/m00) │ │ │ -000e24f0: 2061 7265 2075 6e64 6566 696e 6564 0a61 are undefined.a │ │ │ -000e2500: 6e64 206d 7573 7420 6265 2068 616e 646c nd must be handl │ │ │ -000e2510: 6564 2065 7870 6c69 6369 746c 7920 6279 ed explicitly by │ │ │ -000e2520: 2074 6865 2063 616c 6c65 722e 0a0a 4120 the caller...A │ │ │ -000e2530: 636f 6d6d 6f6e 2077 6f72 6b61 726f 756e common workaroun │ │ │ -000e2540: 6420 6973 2074 6f20 636f 6d70 7574 6520 d is to compute │ │ │ -000e2550: 7468 6520 6365 6e74 6572 2075 7369 6e67 the center using │ │ │ -000e2560: 2063 763a 3a62 6f75 6e64 696e 6752 6563 cv::boundingRec │ │ │ -000e2570: 7428 2920 6f72 2062 790a 6176 6572 6167 t() or by.averag │ │ │ -000e2580: 696e 6720 7468 6520 696e 7075 7420 706f ing the input po │ │ │ -000e2590: 696e 7473 2e0a 0a53 4545 3a20 2063 6f6e ints...SEE: con │ │ │ -000e25a0: 746f 7572 4172 6561 2c20 6172 634c 656e tourArea, arcLen │ │ │ -000e25b0: 6774 683c 2f64 643e 0a3c 2f64 6c3e 0a3c gth
    .
    .< │ │ │ -000e25c0: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ -000e25d0: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 ..
  • ..

    HuMomen │ │ │ -000e2640: 7473 3c2f 6833 3e0a 3c64 6976 2063 6c61 ts

    .
    .
    pu │ │ │ -000e26a0: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static void&nb │ │ │ -000e26e0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;Hu │ │ │ -000e2700: 4d6f 6d65 6e74 733c 2f73 7061 6e3e 3c77 Moments(Moments │ │ │ -000e2770: 3c2f 613e 266e 6273 703b 6d2c 0a20 3c61  m,. Mat hu)
    .
    .< │ │ │ -000e27e0: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ -000e27f0: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    matchShap │ │ │ -000e2860: 6573 3c2f 6833 3e0a 3c64 6976 2063 6c61 es

    .
    .
    pu │ │ │ -000e28c0: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static double& │ │ │ -000e2900: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -000e2920: 6d61 7463 6853 6861 7065 733c 2f73 7061 matchShapes │ │ │ -000e2950: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ -000e2990: 3c2f 613e 266e 6273 703b 636f 6e74 6f75  contou │ │ │ -000e29a0: 7231 2c0a 203c 6120 6872 6566 3d22 2e2e r1,. Mat co │ │ │ -000e29f0: 6e74 6f75 7232 2c0a 2069 6e74 266e 6273 ntour2,. int&nbs │ │ │ -000e2a00: 703b 6d65 7468 6f64 2c0a 2064 6f75 626c p;method,. doubl │ │ │ -000e2a10: 6526 6e62 7370 3b70 6172 616d 6574 6572 e parameter │ │ │ -000e2a20: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ -000e2a30: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ -000e2a40: 223e 436f 6d70 6172 6573 2074 776f 2073 ">Compares two s │ │ │ -000e2a50: 6861 7065 732e 0a0a 5468 6520 6675 6e63 hapes...The func │ │ │ -000e2a60: 7469 6f6e 2063 6f6d 7061 7265 7320 7477 tion compares tw │ │ │ -000e2a70: 6f20 7368 6170 6573 2e20 416c 6c20 7468 o shapes. All th │ │ │ -000e2a80: 7265 6520 696d 706c 656d 656e 7465 6420 ree implemented │ │ │ -000e2a90: 6d65 7468 6f64 7320 7573 6520 7468 6520 methods use the │ │ │ -000e2aa0: 4875 2069 6e76 6172 6961 6e74 7320 2873 Hu invariants (s │ │ │ -000e2ab0: 6565 2023 4875 4d6f 6d65 6e74 7329 3c2f ee #HuMoments).
    .
    Para │ │ │ -000e2ae0: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    contour1< │ │ │ -000e2b00: 2f63 6f64 653e 202d 2046 6972 7374 2063 /code> - First c │ │ │ -000e2b10: 6f6e 746f 7572 206f 7220 6772 6179 7363 ontour or graysc │ │ │ -000e2b20: 616c 6520 696d 6167 652e 3c2f 6464 3e0a ale image.
    . │ │ │ -000e2b30: 3c64 643e 3c63 6f64 653e 636f 6e74 6f75
    contou │ │ │ -000e2b40: 7232 3c2f 636f 6465 3e20 2d20 5365 636f r2 - Seco │ │ │ -000e2b50: 6e64 2063 6f6e 746f 7572 206f 7220 6772 nd contour or gr │ │ │ -000e2b60: 6179 7363 616c 6520 696d 6167 652e 3c2f ayscale image..
    me │ │ │ -000e2b80: 7468 6f64 3c2f 636f 6465 3e20 2d20 436f thod - Co │ │ │ -000e2b90: 6d70 6172 6973 6f6e 206d 6574 686f 642c mparison method, │ │ │ -000e2ba0: 2073 6565 2023 5368 6170 654d 6174 6368 see #ShapeMatch │ │ │ -000e2bb0: 4d6f 6465 733c 2f64 643e 0a3c 6464 3e3c Modes
    .
    < │ │ │ -000e2bc0: 636f 6465 3e70 6172 616d 6574 6572 3c2f code>parameter - Method-s │ │ │ -000e2be0: 7065 6369 6669 6320 7061 7261 6d65 7465 pecific paramete │ │ │ -000e2bf0: 7220 286e 6f74 2073 7570 706f 7274 6564 r (not supported │ │ │ -000e2c00: 206e 6f77 292e 3c2f 6464 3e0a 3c64 743e now).
    .
    │ │ │ -000e2c10: 5265 7475 726e 733a 3c2f 6474 3e0a 3c64 Returns:
    .automatically │ │ │ -000e2c30: 6765 6e65 7261 7465 643c 2f64 643e 0a3c generated.< │ │ │ -000e2c40: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ..
  • .
  • .
    .

    conv │ │ │ -000e2cd0: 6578 4875 6c6c 3c2f 6833 3e0a 3c64 6976 exHull

    .
    .
    public static< │ │ │ -000e2d40: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> void convexHull(MatOfPoint< │ │ │ -000e2e10: 2f61 3e26 6e62 7370 3b70 6f69 6e74 732c /a> points, │ │ │ -000e2e20: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . MatOfInt& │ │ │ -000e2e70: 6e62 7370 3b68 756c 6c2c 0a20 626f 6f6c nbsp;hull,. bool │ │ │ -000e2e80: 6561 6e26 6e62 7370 3b63 6c6f 636b 7769 ean clockwi │ │ │ -000e2e90: 7365 293c 2f73 7061 6e3e 3c2f 6469 763e se)
    │ │ │ -000e2ea0: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Finds the co │ │ │ -000e2ec0: 6e76 6578 2068 756c 6c20 6f66 2061 2070 nvex hull of a p │ │ │ -000e2ed0: 6f69 6e74 2073 6574 2e0a 0a54 6865 2066 oint set...The f │ │ │ -000e2ee0: 756e 6374 696f 6e20 6376 3a3a 636f 6e76 unction cv::conv │ │ │ -000e2ef0: 6578 4875 6c6c 2066 696e 6473 2074 6865 exHull finds the │ │ │ -000e2f00: 2063 6f6e 7665 7820 6875 6c6c 206f 6620 convex hull of │ │ │ -000e2f10: 6120 3244 2070 6f69 6e74 2073 6574 2075 a 2D point set u │ │ │ -000e2f20: 7369 6e67 2074 6865 2053 6b6c 616e 736b sing the Sklansk │ │ │ -000e2f30: 7927 7320 616c 676f 7269 7468 6d20 4349 y's algorithm CI │ │ │ -000e2f40: 5445 3a20 536b 6c61 6e73 6b79 3832 0a74 TE: Sklansky82.t │ │ │ -000e2f50: 6861 7420 6861 7320 2a4f 284e 206c 6f67 hat has *O(N log │ │ │ -000e2f60: 4e29 2a20 636f 6d70 6c65 7869 7479 2069 N)* complexity i │ │ │ -000e2f70: 6e20 7468 6520 6375 7272 656e 7420 696d n the current im │ │ │ -000e2f80: 706c 656d 656e 7461 7469 6f6e 2e3c 2f64 plementation..
    .
    Param │ │ │ -000e2fb0: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ -000e2fc0: 3c63 6f64 653e 706f 696e 7473 3c2f 636f points - Input 2D p │ │ │ -000e2fe0: 6f69 6e74 2073 6574 2c20 7374 6f72 6564 oint set, stored │ │ │ -000e2ff0: 2069 6e20 7374 643a 3a76 6563 746f 7220 in std::vector │ │ │ -000e3000: 6f72 204d 6174 2e3c 2f64 643e 0a3c 6464 or Mat.
    .
    hull - Output conv │ │ │ -000e3030: 6578 2068 756c 6c2e 2049 7420 6973 2065 ex hull. It is e │ │ │ -000e3040: 6974 6865 7220 616e 2069 6e74 6567 6572 ither an integer │ │ │ -000e3050: 2076 6563 746f 7220 6f66 2069 6e64 6963 vector of indic │ │ │ -000e3060: 6573 206f 7220 7665 6374 6f72 206f 6620 es or vector of │ │ │ -000e3070: 706f 696e 7473 2e20 496e 0a74 6865 2066 points. In.the f │ │ │ -000e3080: 6972 7374 2063 6173 652c 2074 6865 2068 irst case, the h │ │ │ -000e3090: 756c 6c20 656c 656d 656e 7473 2061 7265 ull elements are │ │ │ -000e30a0: 2030 2d62 6173 6564 2069 6e64 6963 6573 0-based indices │ │ │ -000e30b0: 206f 6620 7468 6520 636f 6e76 6578 2068 of the convex h │ │ │ -000e30c0: 756c 6c20 706f 696e 7473 2069 6e20 7468 ull points in th │ │ │ -000e30d0: 6520 6f72 6967 696e 616c 0a61 7272 6179 e original.array │ │ │ -000e30e0: 2028 7369 6e63 6520 7468 6520 7365 7420 (since the set │ │ │ -000e30f0: 6f66 2063 6f6e 7665 7820 6875 6c6c 2070 of convex hull p │ │ │ -000e3100: 6f69 6e74 7320 6973 2061 2073 7562 7365 oints is a subse │ │ │ -000e3110: 7420 6f66 2074 6865 206f 7269 6769 6e61 t of the origina │ │ │ -000e3120: 6c20 706f 696e 7420 7365 7429 2e20 496e l point set). In │ │ │ -000e3130: 2074 6865 2073 6563 6f6e 640a 6361 7365 the second.case │ │ │ -000e3140: 2c20 6875 6c6c 2065 6c65 6d65 6e74 7320 , hull elements │ │ │ -000e3150: 6172 6520 7468 6520 636f 6e76 6578 2068 are the convex h │ │ │ -000e3160: 756c 6c20 706f 696e 7473 2074 6865 6d73 ull points thems │ │ │ -000e3170: 656c 7665 732e 3c2f 6464 3e0a 3c64 643e elves.
    .
    │ │ │ -000e3180: 3c63 6f64 653e 636c 6f63 6b77 6973 653c clockwise< │ │ │ -000e3190: 2f63 6f64 653e 202d 204f 7269 656e 7461 /code> - Orienta │ │ │ -000e31a0: 7469 6f6e 2066 6c61 672e 2049 6620 6974 tion flag. If it │ │ │ -000e31b0: 2069 7320 7472 7565 2c20 7468 6520 6f75 is true, the ou │ │ │ -000e31c0: 7470 7574 2063 6f6e 7665 7820 6875 6c6c tput convex hull │ │ │ -000e31d0: 2069 7320 6f72 6965 6e74 6564 2063 6c6f is oriented clo │ │ │ -000e31e0: 636b 7769 7365 2e0a 4f74 6865 7277 6973 ckwise..Otherwis │ │ │ -000e31f0: 652c 2069 7420 6973 206f 7269 656e 7465 e, it is oriente │ │ │ -000e3200: 6420 636f 756e 7465 722d 636c 6f63 6b77 d counter-clockw │ │ │ -000e3210: 6973 652e 2054 6865 2061 7373 756d 6564 ise. The assumed │ │ │ -000e3220: 2063 6f6f 7264 696e 6174 6520 7379 7374 coordinate syst │ │ │ -000e3230: 656d 2068 6173 2069 7473 2058 2061 7869 em has its X axi │ │ │ -000e3240: 7320 706f 696e 7469 6e67 0a74 6f20 7468 s pointing.to th │ │ │ -000e3250: 6520 7269 6768 742c 2061 6e64 2069 7473 e right, and its │ │ │ -000e3260: 2059 2061 7869 7320 706f 696e 7469 6e67 Y axis pointing │ │ │ -000e3270: 2075 7077 6172 6473 2e0a 7265 7475 726e upwards..return │ │ │ -000e3280: 7320 636f 6e76 6578 2068 756c 6c20 706f s convex hull po │ │ │ -000e3290: 696e 7473 2e20 4f74 6865 7277 6973 652c ints. Otherwise, │ │ │ -000e32a0: 2069 7420 7265 7475 726e 7320 696e 6469 it returns indi │ │ │ -000e32b0: 6365 7320 6f66 2074 6865 2063 6f6e 7665 ces of the conve │ │ │ -000e32c0: 7820 6875 6c6c 2070 6f69 6e74 732e 2057 x hull points. W │ │ │ -000e32d0: 6865 6e20 7468 650a 6f75 7470 7574 2061 hen the.output a │ │ │ -000e32e0: 7272 6179 2069 7320 7374 643a 3a76 6563 rray is std::vec │ │ │ -000e32f0: 746f 722c 2074 6865 2066 6c61 6720 6973 tor, the flag is │ │ │ -000e3300: 2069 676e 6f72 6564 2c20 616e 6420 7468 ignored, and th │ │ │ -000e3310: 6520 6f75 7470 7574 2064 6570 656e 6473 e output depends │ │ │ -000e3320: 206f 6e20 7468 6520 7479 7065 206f 6620 on the type of │ │ │ -000e3330: 7468 650a 7665 6374 6f72 3a20 7374 643a the.vector: std: │ │ │ -000e3340: 3a76 6563 746f 7226 6c74 3b69 6e74 2667 :vector<int&g │ │ │ -000e3350: 743b 2069 6d70 6c69 6573 2072 6574 7572 t; implies retur │ │ │ -000e3360: 6e50 6f69 6e74 733d 6661 6c73 652c 2073 nPoints=false, s │ │ │ -000e3370: 7464 3a3a 7665 6374 6f72 266c 743b 506f td::vector<Po │ │ │ -000e3380: 696e 7426 6774 3b20 696d 706c 6965 730a int> implies. │ │ │ -000e3390: 7265 7475 726e 506f 696e 7473 3d74 7275 returnPoints=tru │ │ │ -000e33a0: 652e 0a0a 3c62 3e4e 6f74 653a 3c2f 623e e...Note: │ │ │ -000e33b0: 203c 636f 6465 3e70 6f69 6e74 733c 2f63 points and h │ │ │ -000e33d0: 756c 6c3c 2f63 6f64 653e 2073 686f 756c ull shoul │ │ │ -000e33e0: 6420 6265 2064 6966 6665 7265 6e74 2061 d be different a │ │ │ -000e33f0: 7272 6179 732c 2069 6e70 6c61 6365 2070 rrays, inplace p │ │ │ -000e3400: 726f 6365 7373 696e 6720 6973 6e27 7420 rocessing isn't │ │ │ -000e3410: 7375 7070 6f72 7465 642e 0a0a 4368 6563 supported...Chec │ │ │ -000e3420: 6b20 5245 463a 2074 7574 6f72 6961 6c5f k REF: tutorial_ │ │ │ -000e3430: 6875 6c6c 2022 7468 6520 636f 7272 6573 hull "the corres │ │ │ -000e3440: 706f 6e64 696e 6720 7475 746f 7269 616c ponding tutorial │ │ │ -000e3450: 2220 666f 7220 6d6f 7265 2064 6574 6169 " for more detai │ │ │ -000e3460: 6c73 2e0a 0a75 7365 6675 6c20 6c69 6e6b ls...useful link │ │ │ -000e3470: 733a 0a0a 6874 7470 733a 2f2f 7777 772e s:..https://www. │ │ │ -000e3480: 6c65 6172 6e6f 7065 6e63 762e 636f 6d2f learnopencv.com/ │ │ │ -000e3490: 636f 6e76 6578 2d68 756c 6c2d 7573 696e convex-hull-usin │ │ │ -000e34a0: 672d 6f70 656e 6376 2d69 6e2d 7079 7468 g-opencv-in-pyth │ │ │ -000e34b0: 6f6e 2d61 6e64 2d63 2f3c 2f64 643e 0a3c on-and-c/
    .< │ │ │ -000e34c0: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ..
  • .
  • .
    . │ │ │ -000e3540: 3c68 333e 636f 6e76 6578 4875 6c6c 3c2f

    convexHull.
    .
    public │ │ │ -000e35b0: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ -000e35c0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;vo │ │ │ -000e35e0: 6964 3c2f 7370 616e 3e26 6e62 7370 3b3c id < │ │ │ -000e35f0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ -000e3600: 656e 742d 6e61 6d65 223e 636f 6e76 6578 ent-name">convex │ │ │ -000e3610: 4875 6c6c 3c2f 7370 616e 3e3c 7762 723e Hull │ │ │ -000e3620: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat │ │ │ -000e3680: 4f66 506f 696e 743c 2f61 3e26 6e62 7370 OfPoint  │ │ │ -000e3690: 3b70 6f69 6e74 732c 0a20 3c61 2068 7265 ;points,. MatOf │ │ │ -000e36e0: 496e 743c 2f61 3e26 6e62 7370 3b68 756c Int hul │ │ │ -000e36f0: 6c29 3c2f 7370 616e 3e3c 2f64 6976 3e0a l)
    . │ │ │ -000e3700: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Finds the con │ │ │ -000e3720: 7665 7820 6875 6c6c 206f 6620 6120 706f vex hull of a po │ │ │ -000e3730: 696e 7420 7365 742e 0a0a 5468 6520 6675 int set...The fu │ │ │ -000e3740: 6e63 7469 6f6e 2063 763a 3a63 6f6e 7665 nction cv::conve │ │ │ -000e3750: 7848 756c 6c20 6669 6e64 7320 7468 6520 xHull finds the │ │ │ -000e3760: 636f 6e76 6578 2068 756c 6c20 6f66 2061 convex hull of a │ │ │ -000e3770: 2032 4420 706f 696e 7420 7365 7420 7573 2D point set us │ │ │ -000e3780: 696e 6720 7468 6520 536b 6c61 6e73 6b79 ing the Sklansky │ │ │ -000e3790: 2773 2061 6c67 6f72 6974 686d 2043 4954 's algorithm CIT │ │ │ -000e37a0: 453a 2053 6b6c 616e 736b 7938 320a 7468 E: Sklansky82.th │ │ │ -000e37b0: 6174 2068 6173 202a 4f28 4e20 6c6f 674e at has *O(N logN │ │ │ -000e37c0: 292a 2063 6f6d 706c 6578 6974 7920 696e )* complexity in │ │ │ -000e37d0: 2074 6865 2063 7572 7265 6e74 2069 6d70 the current imp │ │ │ -000e37e0: 6c65 6d65 6e74 6174 696f 6e2e 3c2f 6469 lementation..
    .
    Parame │ │ │ -000e3810: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ -000e3820: 636f 6465 3e70 6f69 6e74 733c 2f63 6f64 code>points - Input 2D po │ │ │ -000e3840: 696e 7420 7365 742c 2073 746f 7265 6420 int set, stored │ │ │ -000e3850: 696e 2073 7464 3a3a 7665 6374 6f72 206f in std::vector o │ │ │ -000e3860: 7220 4d61 742e 3c2f 6464 3e0a 3c64 643e r Mat.
    .
    │ │ │ -000e3870: 3c63 6f64 653e 6875 6c6c 3c2f 636f 6465 hull - Output conve │ │ │ -000e3890: 7820 6875 6c6c 2e20 4974 2069 7320 6569 x hull. It is ei │ │ │ -000e38a0: 7468 6572 2061 6e20 696e 7465 6765 7220 ther an integer │ │ │ -000e38b0: 7665 6374 6f72 206f 6620 696e 6469 6365 vector of indice │ │ │ -000e38c0: 7320 6f72 2076 6563 746f 7220 6f66 2070 s or vector of p │ │ │ -000e38d0: 6f69 6e74 732e 2049 6e0a 7468 6520 6669 oints. In.the fi │ │ │ -000e38e0: 7273 7420 6361 7365 2c20 7468 6520 6875 rst case, the hu │ │ │ -000e38f0: 6c6c 2065 6c65 6d65 6e74 7320 6172 6520 ll elements are │ │ │ -000e3900: 302d 6261 7365 6420 696e 6469 6365 7320 0-based indices │ │ │ -000e3910: 6f66 2074 6865 2063 6f6e 7665 7820 6875 of the convex hu │ │ │ -000e3920: 6c6c 2070 6f69 6e74 7320 696e 2074 6865 ll points in the │ │ │ -000e3930: 206f 7269 6769 6e61 6c0a 6172 7261 7920 original.array │ │ │ -000e3940: 2873 696e 6365 2074 6865 2073 6574 206f (since the set o │ │ │ -000e3950: 6620 636f 6e76 6578 2068 756c 6c20 706f f convex hull po │ │ │ -000e3960: 696e 7473 2069 7320 6120 7375 6273 6574 ints is a subset │ │ │ -000e3970: 206f 6620 7468 6520 6f72 6967 696e 616c of the original │ │ │ -000e3980: 2070 6f69 6e74 2073 6574 292e 2049 6e20 point set). In │ │ │ -000e3990: 7468 6520 7365 636f 6e64 0a63 6173 652c the second.case, │ │ │ -000e39a0: 2068 756c 6c20 656c 656d 656e 7473 2061 hull elements a │ │ │ -000e39b0: 7265 2074 6865 2063 6f6e 7665 7820 6875 re the convex hu │ │ │ -000e39c0: 6c6c 2070 6f69 6e74 7320 7468 656d 7365 ll points themse │ │ │ -000e39d0: 6c76 6573 2e0a 4f74 6865 7277 6973 652c lves..Otherwise, │ │ │ -000e39e0: 2069 7420 6973 206f 7269 656e 7465 6420 it is oriented │ │ │ -000e39f0: 636f 756e 7465 722d 636c 6f63 6b77 6973 counter-clockwis │ │ │ -000e3a00: 652e 2054 6865 2061 7373 756d 6564 2063 e. The assumed c │ │ │ -000e3a10: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ -000e3a20: 2068 6173 2069 7473 2058 2061 7869 7320 has its X axis │ │ │ -000e3a30: 706f 696e 7469 6e67 0a74 6f20 7468 6520 pointing.to the │ │ │ -000e3a40: 7269 6768 742c 2061 6e64 2069 7473 2059 right, and its Y │ │ │ -000e3a50: 2061 7869 7320 706f 696e 7469 6e67 2075 axis pointing u │ │ │ -000e3a60: 7077 6172 6473 2e0a 7265 7475 726e 7320 pwards..returns │ │ │ -000e3a70: 636f 6e76 6578 2068 756c 6c20 706f 696e convex hull poin │ │ │ -000e3a80: 7473 2e20 4f74 6865 7277 6973 652c 2069 ts. Otherwise, i │ │ │ -000e3a90: 7420 7265 7475 726e 7320 696e 6469 6365 t returns indice │ │ │ -000e3aa0: 7320 6f66 2074 6865 2063 6f6e 7665 7820 s of the convex │ │ │ -000e3ab0: 6875 6c6c 2070 6f69 6e74 732e 2057 6865 hull points. Whe │ │ │ -000e3ac0: 6e20 7468 650a 6f75 7470 7574 2061 7272 n the.output arr │ │ │ -000e3ad0: 6179 2069 7320 7374 643a 3a76 6563 746f ay is std::vecto │ │ │ -000e3ae0: 722c 2074 6865 2066 6c61 6720 6973 2069 r, the flag is i │ │ │ -000e3af0: 676e 6f72 6564 2c20 616e 6420 7468 6520 gnored, and the │ │ │ -000e3b00: 6f75 7470 7574 2064 6570 656e 6473 206f output depends o │ │ │ -000e3b10: 6e20 7468 6520 7479 7065 206f 6620 7468 n the type of th │ │ │ -000e3b20: 650a 7665 6374 6f72 3a20 7374 643a 3a76 e.vector: std::v │ │ │ -000e3b30: 6563 746f 7226 6c74 3b69 6e74 2667 743b ector<int> │ │ │ -000e3b40: 2069 6d70 6c69 6573 2072 6574 7572 6e50 implies returnP │ │ │ -000e3b50: 6f69 6e74 733d 6661 6c73 652c 2073 7464 oints=false, std │ │ │ -000e3b60: 3a3a 7665 6374 6f72 266c 743b 506f 696e ::vector<Poin │ │ │ -000e3b70: 7426 6774 3b20 696d 706c 6965 730a 7265 t> implies.re │ │ │ -000e3b80: 7475 726e 506f 696e 7473 3d74 7275 652e turnPoints=true. │ │ │ -000e3b90: 0a0a 3c62 3e4e 6f74 653a 3c2f 623e 203c ..Note: < │ │ │ -000e3ba0: 636f 6465 3e70 6f69 6e74 733c 2f63 6f64 code>points and hul │ │ │ -000e3bc0: 6c3c 2f63 6f64 653e 2073 686f 756c 6420 l should │ │ │ -000e3bd0: 6265 2064 6966 6665 7265 6e74 2061 7272 be different arr │ │ │ -000e3be0: 6179 732c 2069 6e70 6c61 6365 2070 726f ays, inplace pro │ │ │ -000e3bf0: 6365 7373 696e 6720 6973 6e27 7420 7375 cessing isn't su │ │ │ -000e3c00: 7070 6f72 7465 642e 0a0a 4368 6563 6b20 pported...Check │ │ │ -000e3c10: 5245 463a 2074 7574 6f72 6961 6c5f 6875 REF: tutorial_hu │ │ │ -000e3c20: 6c6c 2022 7468 6520 636f 7272 6573 706f ll "the correspo │ │ │ -000e3c30: 6e64 696e 6720 7475 746f 7269 616c 2220 nding tutorial" │ │ │ -000e3c40: 666f 7220 6d6f 7265 2064 6574 6169 6c73 for more details │ │ │ -000e3c50: 2e0a 0a75 7365 6675 6c20 6c69 6e6b 733a ...useful links: │ │ │ -000e3c60: 0a0a 6874 7470 733a 2f2f 7777 772e 6c65 ..https://www.le │ │ │ -000e3c70: 6172 6e6f 7065 6e63 762e 636f 6d2f 636f arnopencv.com/co │ │ │ -000e3c80: 6e76 6578 2d68 756c 6c2d 7573 696e 672d nvex-hull-using- │ │ │ -000e3c90: 6f70 656e 6376 2d69 6e2d 7079 7468 6f6e opencv-in-python │ │ │ -000e3ca0: 2d61 6e64 2d63 2f3c 2f64 643e 0a3c 2f64 -and-c/
    ..
    ..

  • .
  • . │ │ │ -000e3cd0: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .convexityDefec │ │ │ -000e3d60: 7473 3c2f 6833 3e0a 3c64 6976 2063 6c61 ts.
    .
    pu │ │ │ -000e3dc0: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static void&nb │ │ │ -000e3e00: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;co │ │ │ -000e3e20: 6e76 6578 6974 7944 6566 6563 7473 3c2f nvexityDefects(MatOfPoin │ │ │ -000e3ea0: 743c 2f61 3e26 6e62 7370 3b63 6f6e 746f t conto │ │ │ -000e3eb0: 7572 2c0a 203c 6120 6872 6566 3d22 2e2e ur,. MatOfInt convexhu │ │ │ -000e3f10: 6c6c 2c0a 203c 6120 6872 6566 3d22 2e2e ll,. MatOfInt4 │ │ │ -000e3f60: 3c2f 613e 266e 6273 703b 636f 6e76 6578  convex │ │ │ -000e3f70: 6974 7944 6566 6563 7473 293c 2f73 7061 ityDefects)
    .
    Find │ │ │ -000e3fa0: 7320 7468 6520 636f 6e76 6578 6974 7920 s the convexity │ │ │ -000e3fb0: 6465 6665 6374 7320 6f66 2061 2063 6f6e defects of a con │ │ │ -000e3fc0: 746f 7572 2e0a 0a54 6865 2066 6967 7572 tour...The figur │ │ │ -000e3fd0: 6520 6265 6c6f 7720 6469 7370 6c61 7973 e below displays │ │ │ -000e3fe0: 2063 6f6e 7665 7869 7479 2064 6566 6563 convexity defec │ │ │ -000e3ff0: 7473 206f 6620 6120 6861 6e64 2063 6f6e ts of a hand con │ │ │ -000e4000: 746f 7572 3a0a 0a21 5b69 6d61 6765 5d28 tour:..![image]( │ │ │ -000e4010: 7069 6373 2f64 6566 6563 7473 2e70 6e67 pics/defects.png │ │ │ -000e4020: 293c 2f64 6976 3e0a 3c64 6c20 636c 6173 )
    .
    .
    P │ │ │ -000e4040: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ -000e4050: 3c64 643e 3c63 6f64 653e 636f 6e74 6f75
    contou │ │ │ -000e4060: 723c 2f63 6f64 653e 202d 2049 6e70 7574 r - Input │ │ │ -000e4070: 2063 6f6e 746f 7572 2e3c 2f64 643e 0a3c contour.
    .< │ │ │ -000e4080: 6464 3e3c 636f 6465 3e63 6f6e 7665 7868 dd>convexh │ │ │ -000e4090: 756c 6c3c 2f63 6f64 653e 202d 2043 6f6e ull - Con │ │ │ -000e40a0: 7665 7820 6875 6c6c 206f 6274 6169 6e65 vex hull obtaine │ │ │ -000e40b0: 6420 7573 696e 6720 636f 6e76 6578 4875 d using convexHu │ │ │ -000e40c0: 6c6c 2074 6861 7420 7368 6f75 6c64 2063 ll that should c │ │ │ -000e40d0: 6f6e 7461 696e 2069 6e64 6963 6573 206f ontain indices o │ │ │ -000e40e0: 6620 7468 6520 636f 6e74 6f75 720a 706f f the contour.po │ │ │ -000e40f0: 696e 7473 2074 6861 7420 6d61 6b65 2074 ints that make t │ │ │ -000e4100: 6865 2068 756c 6c2e 3c2f 6464 3e0a 3c64 he hull..convexit │ │ │ -000e4120: 7944 6566 6563 7473 3c2f 636f 6465 3e20 yDefects │ │ │ -000e4130: 2d20 5468 6520 6f75 7470 7574 2076 6563 - The output vec │ │ │ -000e4140: 746f 7220 6f66 2063 6f6e 7665 7869 7479 tor of convexity │ │ │ -000e4150: 2064 6566 6563 7473 2e20 496e 2043 2b2b defects. In C++ │ │ │ -000e4160: 2061 6e64 2074 6865 206e 6577 2050 7974 and the new Pyt │ │ │ -000e4170: 686f 6e2f 4a61 7661 0a69 6e74 6572 6661 hon/Java.interfa │ │ │ -000e4180: 6365 2065 6163 6820 636f 6e76 6578 6974 ce each convexit │ │ │ -000e4190: 7920 6465 6665 6374 2069 7320 7265 7072 y defect is repr │ │ │ -000e41a0: 6573 656e 7465 6420 6173 2034 2d65 6c65 esented as 4-ele │ │ │ -000e41b0: 6d65 6e74 2069 6e74 6567 6572 2076 6563 ment integer vec │ │ │ -000e41c0: 746f 7220 2861 2e6b 2e61 2e20 2356 6563 tor (a.k.a. #Vec │ │ │ -000e41d0: 3469 293a 0a28 7374 6172 745f 696e 6465 4i):.(start_inde │ │ │ -000e41e0: 782c 2065 6e64 5f69 6e64 6578 2c20 6661 x, end_index, fa │ │ │ -000e41f0: 7274 6865 7374 5f70 745f 696e 6465 782c rthest_pt_index, │ │ │ -000e4200: 2066 6978 7074 5f64 6570 7468 292c 2077 fixpt_depth), w │ │ │ -000e4210: 6865 7265 2069 6e64 6963 6573 2061 7265 here indices are │ │ │ -000e4220: 2030 2d62 6173 6564 2069 6e64 6963 6573 0-based indices │ │ │ -000e4230: 0a69 6e20 7468 6520 6f72 6967 696e 616c .in the original │ │ │ -000e4240: 2063 6f6e 746f 7572 206f 6620 7468 6520 contour of the │ │ │ -000e4250: 636f 6e76 6578 6974 7920 6465 6665 6374 convexity defect │ │ │ -000e4260: 2062 6567 696e 6e69 6e67 2c20 656e 6420 beginning, end │ │ │ -000e4270: 616e 6420 7468 6520 6661 7274 6865 7374 and the farthest │ │ │ -000e4280: 2070 6f69 6e74 2c20 616e 640a 6669 7870 point, and.fixp │ │ │ -000e4290: 745f 6465 7074 6820 6973 2066 6978 6564 t_depth is fixed │ │ │ -000e42a0: 2d70 6f69 6e74 2061 7070 726f 7869 6d61 -point approxima │ │ │ -000e42b0: 7469 6f6e 2028 7769 7468 2038 2066 7261 tion (with 8 fra │ │ │ -000e42c0: 6374 696f 6e61 6c20 6269 7473 2920 6f66 ctional bits) of │ │ │ -000e42d0: 2074 6865 2064 6973 7461 6e63 6520 6265 the distance be │ │ │ -000e42e0: 7477 6565 6e20 7468 650a 6661 7274 6865 tween the.farthe │ │ │ -000e42f0: 7374 2063 6f6e 746f 7572 2070 6f69 6e74 st contour point │ │ │ -000e4300: 2061 6e64 2074 6865 2068 756c 6c2e 2054 and the hull. T │ │ │ -000e4310: 6861 7420 6973 2c20 746f 2067 6574 2074 hat is, to get t │ │ │ -000e4320: 6865 2066 6c6f 6174 696e 672d 706f 696e he floating-poin │ │ │ -000e4330: 7420 7661 6c75 6520 6f66 2074 6865 2064 t value of the d │ │ │ -000e4340: 6570 7468 2077 696c 6c20 6265 0a66 6978 epth will be.fix │ │ │ -000e4350: 7074 5f64 6570 7468 2f32 3536 2e30 2e3c pt_depth/256.0.< │ │ │ -000e4360: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .
    ..
  • .
    .

    isContourC │ │ │ -000e43e0: 6f6e 7665 783c 2f68 333e 0a3c 6469 7620 onvex

    .
    .
    public static boolean isContourCon │ │ │ -000e44b0: 7665 783c 2f73 7061 6e3e 3c77 6272 3e3c vex< │ │ │ -000e44c0: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ -000e44d0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(MatO │ │ │ -000e4520: 6650 6f69 6e74 3c2f 613e 266e 6273 703b fPoint  │ │ │ -000e4530: 636f 6e74 6f75 7229 3c2f 7370 616e 3e3c contour)< │ │ │ -000e4540: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Tests a │ │ │ -000e4560: 2063 6f6e 746f 7572 2063 6f6e 7665 7869 contour convexi │ │ │ -000e4570: 7479 2e0a 0a54 6865 2066 756e 6374 696f ty...The functio │ │ │ -000e4580: 6e20 7465 7374 7320 7768 6574 6865 7220 n tests whether │ │ │ -000e4590: 7468 6520 696e 7075 7420 636f 6e74 6f75 the input contou │ │ │ -000e45a0: 7220 6973 2063 6f6e 7665 7820 6f72 206e r is convex or n │ │ │ -000e45b0: 6f74 2e20 5468 6520 636f 6e74 6f75 7220 ot. The contour │ │ │ -000e45c0: 6d75 7374 2062 6520 7369 6d70 6c65 2c20 must be simple, │ │ │ -000e45d0: 7468 6174 2069 732c 0a77 6974 686f 7574 that is,.without │ │ │ -000e45e0: 2073 656c 662d 696e 7465 7273 6563 7469 self-intersecti │ │ │ -000e45f0: 6f6e 732e 204f 7468 6572 7769 7365 2c20 ons. Otherwise, │ │ │ -000e4600: 7468 6520 6675 6e63 7469 6f6e 206f 7574 the function out │ │ │ -000e4610: 7075 7420 6973 2075 6e64 6566 696e 6564 put is undefined │ │ │ -000e4620: 2e3c 2f64 6976 3e0a 3c64 6c20 636c 6173 .
    .
    .
    P │ │ │ -000e4640: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ -000e4650: 3c64 643e 3c63 6f64 653e 636f 6e74 6f75
    contou │ │ │ -000e4660: 723c 2f63 6f64 653e 202d 2049 6e70 7574 r - Input │ │ │ -000e4670: 2076 6563 746f 7220 6f66 2032 4420 706f vector of 2D po │ │ │ -000e4680: 696e 7473 2c20 7374 6f72 6564 2069 6e20 ints, stored in │ │ │ -000e4690: 7374 643a 3a76 6563 746f 7226 6c74 3b26 std::vector<& │ │ │ -000e46a0: 6774 3b20 6f72 204d 6174 3c2f 6464 3e0a gt; or Mat
    . │ │ │ -000e46b0: 3c64 743e 5265 7475 726e 733a 3c2f 6474
    Returns:
    .
    automatica │ │ │ -000e46d0: 6c6c 7920 6765 6e65 7261 7465 643c 2f64 lly generated.
    .
    . │ │ │ -000e46f0: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e
    .
  • │ │ │ -000e4700: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .< │ │ │ -000e4780: 6833 3e69 6e74 6572 7365 6374 436f 6e76 h3>intersectConv │ │ │ -000e4790: 6578 436f 6e76 6578 3c2f 6833 3e0a 3c64 exConvex..public stati │ │ │ -000e4800: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c float intersectCo │ │ │ -000e4860: 6e76 6578 436f 6e76 6578 3c2f 7370 616e nvexConvex( │ │ │ -000e4890: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000e48d0: 2f61 3e26 6e62 7370 3b70 312c 0a20 3c61 /a> p1,. Mat p2,. Mat& │ │ │ -000e4970: 6e62 7370 3b70 3132 2c0a 2062 6f6f 6c65 nbsp;p12,. boole │ │ │ -000e4980: 616e 266e 6273 703b 6861 6e64 6c65 4e65 an handleNe │ │ │ -000e4990: 7374 6564 293c 2f73 7061 6e3e 3c2f 6469 sted).
    Finds inte │ │ │ -000e49c0: 7273 6563 7469 6f6e 206f 6620 7477 6f20 rsection of two │ │ │ -000e49d0: 636f 6e76 6578 2070 6f6c 7967 6f6e 733c convex polygons< │ │ │ -000e49e0: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ -000e4a00: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .p1 - First polygo │ │ │ -000e4a30: 6e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 n.
    p2 - Sec │ │ │ -000e4a50: 6f6e 6420 706f 6c79 676f 6e3c 2f64 643e ond polygon
    │ │ │ -000e4a60: 0a3c 6464 3e3c 636f 6465 3e70 3132 3c2f .
    p12 - Output p │ │ │ -000e4a80: 6f6c 7967 6f6e 2064 6573 6372 6962 696e olygon describin │ │ │ -000e4a90: 6720 7468 6520 696e 7465 7273 6563 7469 g the intersecti │ │ │ -000e4aa0: 6e67 2061 7265 613c 2f64 643e 0a3c 6464 ng area
    .
    handleNes │ │ │ -000e4ac0: 7465 643c 2f63 6f64 653e 202d 2057 6865 ted - Whe │ │ │ -000e4ad0: 6e20 7472 7565 2c20 616e 2069 6e74 6572 n true, an inter │ │ │ -000e4ae0: 7365 6374 696f 6e20 6973 2066 6f75 6e64 section is found │ │ │ -000e4af0: 2069 6620 6f6e 6520 6f66 2074 6865 2070 if one of the p │ │ │ -000e4b00: 6f6c 7967 6f6e 7320 6973 2066 756c 6c79 olygons is fully │ │ │ -000e4b10: 2065 6e63 6c6f 7365 6420 696e 2074 6865 enclosed in the │ │ │ -000e4b20: 206f 7468 6572 2e0a 5768 656e 2066 616c other..When fal │ │ │ -000e4b30: 7365 2c20 6e6f 2069 6e74 6572 7365 6374 se, no intersect │ │ │ -000e4b40: 696f 6e20 6973 2066 6f75 6e64 2e20 4966 ion is found. If │ │ │ -000e4b50: 2074 6865 2070 6f6c 7967 6f6e 7320 7368 the polygons sh │ │ │ -000e4b60: 6172 6520 6120 7369 6465 206f 7220 7468 are a side or th │ │ │ -000e4b70: 6520 7665 7274 6578 206f 6620 6f6e 6520 e vertex of one │ │ │ -000e4b80: 706f 6c79 676f 6e20 6c69 6573 206f 6e20 polygon lies on │ │ │ -000e4b90: 616e 2065 6467 650a 6f66 2074 6865 206f an edge.of the o │ │ │ -000e4ba0: 7468 6572 2c20 7468 6579 2061 7265 206e ther, they are n │ │ │ -000e4bb0: 6f74 2063 6f6e 7369 6465 7265 6420 6e65 ot considered ne │ │ │ -000e4bc0: 7374 6564 2061 6e64 2061 6e20 696e 7465 sted and an inte │ │ │ -000e4bd0: 7273 6563 7469 6f6e 2077 696c 6c20 6265 rsection will be │ │ │ -000e4be0: 2066 6f75 6e64 2072 6567 6172 646c 6573 found regardles │ │ │ -000e4bf0: 7320 6f66 2074 6865 2076 616c 7565 206f s of the value o │ │ │ -000e4c00: 6620 6861 6e64 6c65 4e65 7374 6564 2e3c f handleNested.< │ │ │ -000e4c10: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ -000e4c20: 3a3c 2f64 743e 0a3c 6464 3e41 7265 6120 :
    .
    Area │ │ │ -000e4c30: 6f66 2069 6e74 6572 7365 6374 696e 6720 of intersecting │ │ │ -000e4c40: 706f 6c79 676f 6e2e 204d 6179 2062 6520 polygon. May be │ │ │ -000e4c50: 6e65 6761 7469 7665 2c20 6966 2061 6c67 negative, if alg │ │ │ -000e4c60: 6f72 6974 686d 2068 6173 206e 6f74 2063 orithm has not c │ │ │ -000e4c70: 6f6e 7665 7267 6564 2c20 652e 672e 206e onverged, e.g. n │ │ │ -000e4c80: 6f6e 2d63 6f6e 7665 7820 696e 7075 742e on-convex input. │ │ │ -000e4c90: 0a0a 3c62 3e4e 6f74 653a 3c2f 623e 2069 ..Note: i │ │ │ -000e4ca0: 6e74 6572 7365 6374 436f 6e76 6578 436f ntersectConvexCo │ │ │ -000e4cb0: 6e76 6578 2064 6f65 736e 2774 2063 6f6e nvex doesn't con │ │ │ -000e4cc0: 6669 726d 2074 6861 7420 626f 7468 2070 firm that both p │ │ │ -000e4cd0: 6f6c 7967 6f6e 7320 6172 6520 636f 6e76 olygons are conv │ │ │ -000e4ce0: 6578 2061 6e64 2077 696c 6c20 7265 7475 ex and will retu │ │ │ -000e4cf0: 726e 2069 6e76 616c 6964 2072 6573 756c rn invalid resul │ │ │ -000e4d00: 7473 2069 6620 7468 6579 2061 7265 6e27 ts if they aren' │ │ │ -000e4d10: 742e 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f t.
    .
    ..
    . │ │ │ -000e4d30: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..

    │ │ │ -000e4db0: 696e 7465 7273 6563 7443 6f6e 7665 7843 intersectConvexC │ │ │ -000e4dc0: 6f6e 7665 783c 2f68 333e 0a3c 6469 7620 onvex

    .
    .
    public static float intersectConve │ │ │ -000e4e90: 7843 6f6e 7665 783c 2f73 7061 6e3e 3c77 xConvex(Mat │ │ │ -000e4f00: 266e 6273 703b 7031 2c0a 203c 6120 6872  p1,. Mat&n │ │ │ -000e4f50: 6273 703b 7032 2c0a 203c 6120 6872 6566 bsp;p2,. Mat&nbs │ │ │ -000e4fa0: 703b 7031 3229 3c2f 7370 616e 3e3c 2f64 p;p12).
    Finds int │ │ │ -000e4fd0: 6572 7365 6374 696f 6e20 6f66 2074 776f ersection of two │ │ │ -000e4fe0: 2063 6f6e 7665 7820 706f 6c79 676f 6e73 convex polygons │ │ │ -000e4ff0: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -000e5010: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000e5020: 6464 3e3c 636f 6465 3e70 313c 2f63 6f64 dd>p1 - First polyg │ │ │ -000e5040: 6f6e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 on.
    p2 - Se │ │ │ -000e5060: 636f 6e64 2070 6f6c 7967 6f6e 3c2f 6464 cond polygon
    .
    p12< │ │ │ -000e5080: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ -000e5090: 706f 6c79 676f 6e20 6465 7363 7269 6269 polygon describi │ │ │ -000e50a0: 6e67 2074 6865 2069 6e74 6572 7365 6374 ng the intersect │ │ │ -000e50b0: 696e 6720 6172 6561 0a57 6865 6e20 6661 ing area.When fa │ │ │ -000e50c0: 6c73 652c 206e 6f20 696e 7465 7273 6563 lse, no intersec │ │ │ -000e50d0: 7469 6f6e 2069 7320 666f 756e 642e 2049 tion is found. I │ │ │ -000e50e0: 6620 7468 6520 706f 6c79 676f 6e73 2073 f the polygons s │ │ │ -000e50f0: 6861 7265 2061 2073 6964 6520 6f72 2074 hare a side or t │ │ │ -000e5100: 6865 2076 6572 7465 7820 6f66 206f 6e65 he vertex of one │ │ │ -000e5110: 2070 6f6c 7967 6f6e 206c 6965 7320 6f6e polygon lies on │ │ │ -000e5120: 2061 6e20 6564 6765 0a6f 6620 7468 6520 an edge.of the │ │ │ -000e5130: 6f74 6865 722c 2074 6865 7920 6172 6520 other, they are │ │ │ -000e5140: 6e6f 7420 636f 6e73 6964 6572 6564 206e not considered n │ │ │ -000e5150: 6573 7465 6420 616e 6420 616e 2069 6e74 ested and an int │ │ │ -000e5160: 6572 7365 6374 696f 6e20 7769 6c6c 2062 ersection will b │ │ │ -000e5170: 6520 666f 756e 6420 7265 6761 7264 6c65 e found regardle │ │ │ -000e5180: 7373 206f 6620 7468 6520 7661 6c75 6520 ss of the value │ │ │ -000e5190: 6f66 2068 616e 646c 654e 6573 7465 642e of handleNested. │ │ │ -000e51a0: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ -000e51b0: 733a 3c2f 6474 3e0a 3c64 643e 4172 6561 s:
    .
    Area │ │ │ -000e51c0: 206f 6620 696e 7465 7273 6563 7469 6e67 of intersecting │ │ │ -000e51d0: 2070 6f6c 7967 6f6e 2e20 4d61 7920 6265 polygon. May be │ │ │ -000e51e0: 206e 6567 6174 6976 652c 2069 6620 616c negative, if al │ │ │ -000e51f0: 676f 7269 7468 6d20 6861 7320 6e6f 7420 gorithm has not │ │ │ -000e5200: 636f 6e76 6572 6765 642c 2065 2e67 2e20 converged, e.g. │ │ │ -000e5210: 6e6f 6e2d 636f 6e76 6578 2069 6e70 7574 non-convex input │ │ │ -000e5220: 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 3e20 ...Note: │ │ │ -000e5230: 696e 7465 7273 6563 7443 6f6e 7665 7843 intersectConvexC │ │ │ -000e5240: 6f6e 7665 7820 646f 6573 6e27 7420 636f onvex doesn't co │ │ │ -000e5250: 6e66 6972 6d20 7468 6174 2062 6f74 6820 nfirm that both │ │ │ -000e5260: 706f 6c79 676f 6e73 2061 7265 2063 6f6e polygons are con │ │ │ -000e5270: 7665 7820 616e 6420 7769 6c6c 2072 6574 vex and will ret │ │ │ -000e5280: 7572 6e20 696e 7661 6c69 6420 7265 7375 urn invalid resu │ │ │ -000e5290: 6c74 7320 6966 2074 6865 7920 6172 656e lts if they aren │ │ │ -000e52a0: 2774 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c 't.
    .
    .< │ │ │ -000e52b0: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>. │ │ │ -000e52c0: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    fitEllips │ │ │ -000e5320: 653c 2f68 333e 0a3c 6469 7620 636c 6173 e

    .
    .
    pub │ │ │ -000e5380: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static RotatedRect │ │ │ -000e5400: 3c2f 613e 3c2f 7370 616e 3e26 6e62 7370   │ │ │ -000e5410: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;fitE │ │ │ -000e5430: 6c6c 6970 7365 3c2f 7370 616e 3e3c 7762 llipse(MatOfPoint2f points)
    .
    F │ │ │ -000e54e0: 6974 7320 616e 2065 6c6c 6970 7365 2061 its an ellipse a │ │ │ -000e54f0: 726f 756e 6420 6120 7365 7420 6f66 2032 round a set of 2 │ │ │ -000e5500: 4420 706f 696e 7473 2e0a 0a54 6865 2066 D points...The f │ │ │ -000e5510: 756e 6374 696f 6e20 6361 6c63 756c 6174 unction calculat │ │ │ -000e5520: 6573 2074 6865 2065 6c6c 6970 7365 2074 es the ellipse t │ │ │ -000e5530: 6861 7420 6669 7473 2028 696e 2061 206c hat fits (in a l │ │ │ -000e5540: 6561 7374 2d73 7175 6172 6573 2073 656e east-squares sen │ │ │ -000e5550: 7365 2920 6120 7365 7420 6f66 2032 4420 se) a set of 2D │ │ │ -000e5560: 706f 696e 7473 2062 6573 7420 6f66 0a61 points best of.a │ │ │ -000e5570: 6c6c 2e20 4974 2072 6574 7572 6e73 2074 ll. It returns t │ │ │ -000e5580: 6865 2072 6f74 6174 6564 2072 6563 7461 he rotated recta │ │ │ -000e5590: 6e67 6c65 2069 6e20 7768 6963 6820 7468 ngle in which th │ │ │ -000e55a0: 6520 656c 6c69 7073 6520 6973 2069 6e73 e ellipse is ins │ │ │ -000e55b0: 6372 6962 6564 2e20 5468 6520 6669 7273 cribed. The firs │ │ │ -000e55c0: 7420 616c 676f 7269 7468 6d20 6465 7363 t algorithm desc │ │ │ -000e55d0: 7269 6265 6420 6279 2043 4954 453a 2046 ribed by CITE: F │ │ │ -000e55e0: 6974 7a67 6962 626f 6e39 350a 6973 2075 itzgibbon95.is u │ │ │ -000e55f0: 7365 642e 2044 6576 656c 6f70 6572 2073 sed. Developer s │ │ │ -000e5600: 686f 756c 6420 6b65 6570 2069 6e20 6d69 hould keep in mi │ │ │ -000e5610: 6e64 2074 6861 7420 6974 2069 7320 706f nd that it is po │ │ │ -000e5620: 7373 6962 6c65 2074 6861 7420 7468 6520 ssible that the │ │ │ -000e5630: 7265 7475 726e 6564 0a65 6c6c 6970 7365 returned.ellipse │ │ │ -000e5640: 2f72 6f74 6174 6564 5265 6374 2064 6174 /rotatedRect dat │ │ │ -000e5650: 6120 636f 6e74 6169 6e73 206e 6567 6174 a contains negat │ │ │ -000e5660: 6976 6520 696e 6469 6365 732c 2064 7565 ive indices, due │ │ │ -000e5670: 2074 6f20 7468 6520 6461 7461 2070 6f69 to the data poi │ │ │ -000e5680: 6e74 7320 6265 696e 6720 636c 6f73 6520 nts being close │ │ │ -000e5690: 746f 2074 6865 0a62 6f72 6465 7220 6f66 to the.border of │ │ │ -000e56a0: 2074 6865 2063 6f6e 7461 696e 696e 6720 the containing │ │ │ -000e56b0: 4d61 7420 656c 656d 656e 742e 3c2f 6469 Mat element..
    .
    Parame │ │ │ -000e56e0: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ -000e56f0: 636f 6465 3e70 6f69 6e74 733c 2f63 6f64 code>points - Input 2D po │ │ │ -000e5710: 696e 7420 7365 742c 2073 746f 7265 6420 int set, stored │ │ │ -000e5720: 696e 2073 7464 3a3a 7665 6374 6f72 266c in std::vector&l │ │ │ -000e5730: 743b 2667 743b 206f 7220 4d61 740a 0a3c t;> or Mat..< │ │ │ -000e5740: 623e 4e6f 7465 3a3c 2f62 3e20 496e 7075 b>Note: Inpu │ │ │ -000e5750: 7420 706f 696e 7420 7479 7065 7320 6172 t point types ar │ │ │ -000e5760: 6520 5245 463a 2050 6f69 6e74 3269 206f e REF: Point2i o │ │ │ -000e5770: 7220 5245 463a 2050 6f69 6e74 3266 2061 r REF: Point2f a │ │ │ -000e5780: 6e64 2061 7420 6c65 6173 7420 3520 706f nd at least 5 po │ │ │ -000e5790: 696e 7473 2061 7265 2072 6571 7569 7265 ints are require │ │ │ -000e57a0: 642e 0a3c 623e 4e6f 7465 3a3c 2f62 3e20 d..Note: │ │ │ -000e57b0: 5245 463a 2067 6574 436c 6f73 6573 7445 REF: getClosestE │ │ │ -000e57c0: 6c6c 6970 7365 506f 696e 7473 2066 756e llipsePoints fun │ │ │ -000e57d0: 6374 696f 6e20 6361 6e20 6265 2075 7365 ction can be use │ │ │ -000e57e0: 6420 746f 2063 6f6d 7075 7465 2074 6865 d to compute the │ │ │ -000e57f0: 2065 6c6c 6970 7365 2066 6974 7469 6e67 ellipse fitting │ │ │ -000e5800: 2065 7272 6f72 2e3c 2f64 643e 0a3c 6474 error.
    .
    Returns:
    .< │ │ │ -000e5820: 6464 3e61 7574 6f6d 6174 6963 616c 6c79 dd>automatically │ │ │ -000e5830: 2067 656e 6572 6174 6564 3c2f 6464 3e0a generated. │ │ │ -000e5840: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    .
    .
  • ..
    .

    fitEllip │ │ │ -000e58b0: 7365 414d 533c 2f68 333e 0a3c 6469 7620 seAMS

    .
    .
    public static Rotated │ │ │ -000e5990: 5265 6374 3c2f 613e 3c2f 7370 616e 3e26 Rect& │ │ │ -000e59a0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -000e59c0: 6669 7445 6c6c 6970 7365 414d 533c 2f73 fitEllipseAMS(M │ │ │ -000e5a30: 6174 3c2f 613e 266e 6273 703b 706f 696e at poin │ │ │ -000e5a40: 7473 293c 2f73 7061 6e3e 3c2f 6469 763e ts)
    │ │ │ -000e5a50: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Fits an elli │ │ │ -000e5a70: 7073 6520 6172 6f75 6e64 2061 2073 6574 pse around a set │ │ │ -000e5a80: 206f 6620 3244 2070 6f69 6e74 732e 0a0a of 2D points... │ │ │ -000e5a90: 5468 6520 6675 6e63 7469 6f6e 2063 616c The function cal │ │ │ -000e5aa0: 6375 6c61 7465 7320 7468 6520 656c 6c69 culates the elli │ │ │ -000e5ab0: 7073 6520 7468 6174 2066 6974 7320 6120 pse that fits a │ │ │ -000e5ac0: 7365 7420 6f66 2032 4420 706f 696e 7473 set of 2D points │ │ │ -000e5ad0: 2e0a 4974 2072 6574 7572 6e73 2074 6865 ..It returns the │ │ │ -000e5ae0: 2072 6f74 6174 6564 2072 6563 7461 6e67 rotated rectang │ │ │ -000e5af0: 6c65 2069 6e20 7768 6963 6820 7468 6520 le in which the │ │ │ -000e5b00: 656c 6c69 7073 6520 6973 2069 6e73 6372 ellipse is inscr │ │ │ -000e5b10: 6962 6564 2e0a 5468 6520 4170 7072 6f78 ibed..The Approx │ │ │ -000e5b20: 696d 6174 6520 4d65 616e 2053 7175 6172 imate Mean Squar │ │ │ -000e5b30: 6520 2841 4d53 2920 7072 6f70 6f73 6564 e (AMS) proposed │ │ │ -000e5b40: 2062 7920 4349 5445 3a20 5461 7562 696e by CITE: Taubin │ │ │ -000e5b50: 3139 3931 2069 7320 7573 6564 2e0a 0a46 1991 is used...F │ │ │ -000e5b60: 6f72 2061 6e20 656c 6c69 7073 652c 2074 or an ellipse, t │ │ │ -000e5b70: 6869 7320 6261 7369 7320 7365 7420 6973 his basis set is │ │ │ -000e5b80: 205c 2820 5c63 6869 3d20 5c6c 6566 7428 \( \chi= \left( │ │ │ -000e5b90: 785e 322c 2078 2079 2c20 795e 322c 2078 x^2, x y, y^2, x │ │ │ -000e5ba0: 2c20 792c 2031 5c72 6967 6874 2920 5c29 , y, 1\right) \) │ │ │ -000e5bb0: 2c0a 7768 6963 6820 6973 2061 2073 6574 ,.which is a set │ │ │ -000e5bc0: 206f 6620 7369 7820 6672 6565 2063 6f65 of six free coe │ │ │ -000e5bd0: 6666 6963 6965 6e74 7320 5c28 2041 5e54 fficients \( A^T │ │ │ -000e5be0: 3d5c 6c65 6674 5c7b 415f 7b5c 7465 7874 =\left\{A_{\text │ │ │ -000e5bf0: 7b78 787d 7d2c 415f 7b5c 7465 7874 7b78 {xx}},A_{\text{x │ │ │ -000e5c00: 797d 7d2c 415f 7b5c 7465 7874 7b79 797d y}},A_{\text{yy} │ │ │ -000e5c10: 7d2c 415f 782c 415f 792c 415f 305c 7269 },A_x,A_y,A_0\ri │ │ │ -000e5c20: 6768 745c 7d20 5c29 2e0a 486f 7765 7665 ght\} \)..Howeve │ │ │ -000e5c30: 722c 2074 6f20 7370 6563 6966 7920 616e r, to specify an │ │ │ -000e5c40: 2065 6c6c 6970 7365 2c20 616c 6c20 7468 ellipse, all th │ │ │ -000e5c50: 6174 2069 7320 6e65 6564 6564 2069 7320 at is needed is │ │ │ -000e5c60: 6669 7665 206e 756d 6265 7273 3b20 7468 five numbers; th │ │ │ -000e5c70: 6520 6d61 6a6f 7220 616e 6420 6d69 6e6f e major and mino │ │ │ -000e5c80: 7220 6178 6573 206c 656e 6774 6873 205c r axes lengths \ │ │ │ -000e5c90: 2820 2861 2c62 2920 5c29 2c0a 7468 6520 ( (a,b) \),.the │ │ │ -000e5ca0: 706f 7369 7469 6f6e 205c 2820 2878 5f30 position \( (x_0 │ │ │ -000e5cb0: 2c79 5f30 2920 5c29 2c20 616e 6420 7468 ,y_0) \), and th │ │ │ -000e5cc0: 6520 6f72 6965 6e74 6174 696f 6e20 5c28 e orientation \( │ │ │ -000e5cd0: 205c 7468 6574 6120 5c29 2e20 5468 6973 \theta \). This │ │ │ -000e5ce0: 2069 7320 6265 6361 7573 6520 7468 6520 is because the │ │ │ -000e5cf0: 6261 7369 7320 7365 7420 696e 636c 7564 basis set includ │ │ │ -000e5d00: 6573 206c 696e 6573 2c0a 7175 6164 7261 es lines,.quadra │ │ │ -000e5d10: 7469 6373 2c20 7061 7261 626f 6c69 6320 tics, parabolic │ │ │ -000e5d20: 616e 6420 6879 7065 7262 6f6c 6963 2066 and hyperbolic f │ │ │ -000e5d30: 756e 6374 696f 6e73 2061 7320 7765 6c6c unctions as well │ │ │ -000e5d40: 2061 7320 656c 6c69 7074 6963 616c 2066 as elliptical f │ │ │ -000e5d50: 756e 6374 696f 6e73 2061 7320 706f 7373 unctions as poss │ │ │ -000e5d60: 6962 6c65 2066 6974 732e 0a49 6620 7468 ible fits..If th │ │ │ -000e5d70: 6520 6669 7420 6973 2066 6f75 6e64 2074 e fit is found t │ │ │ -000e5d80: 6f20 6265 2061 2070 6172 6162 6f6c 6963 o be a parabolic │ │ │ -000e5d90: 206f 7220 6879 7065 7262 6f6c 6963 2066 or hyperbolic f │ │ │ -000e5da0: 756e 6374 696f 6e20 7468 656e 2074 6865 unction then the │ │ │ -000e5db0: 2073 7461 6e64 6172 6420 2366 6974 456c standard #fitEl │ │ │ -000e5dc0: 6c69 7073 6520 6d65 7468 6f64 2069 7320 lipse method is │ │ │ -000e5dd0: 7573 6564 2e0a 5468 6520 414d 5320 6d65 used..The AMS me │ │ │ -000e5de0: 7468 6f64 2072 6573 7472 6963 7473 2074 thod restricts t │ │ │ -000e5df0: 6865 2066 6974 2074 6f20 7061 7261 626f he fit to parabo │ │ │ -000e5e00: 6c69 632c 2068 7970 6572 626f 6c69 6320 lic, hyperbolic │ │ │ -000e5e10: 616e 6420 656c 6c69 7074 6963 616c 2063 and elliptical c │ │ │ -000e5e20: 7572 7665 730a 6279 2069 6d70 6f73 696e urves.by imposin │ │ │ -000e5e30: 6720 7468 6520 636f 6e64 6974 696f 6e20 g the condition │ │ │ -000e5e40: 7468 6174 205c 2820 415e 5420 2820 445f that \( A^T ( D_ │ │ │ -000e5e50: 785e 5420 445f 7820 202b 2020 2044 5f79 x^T D_x + D_y │ │ │ -000e5e60: 5e54 2044 5f79 2920 4120 3d20 3120 5c29 ^T D_y) A = 1 \) │ │ │ -000e5e70: 2077 6865 7265 0a74 6865 206d 6174 7269 where.the matri │ │ │ -000e5e80: 6365 7320 5c28 2044 7820 5c29 2061 6e64 ces \( Dx \) and │ │ │ -000e5e90: 205c 2820 4479 205c 2920 6172 6520 7468 \( Dy \) are th │ │ │ -000e5ea0: 6520 7061 7274 6961 6c20 6465 7269 7661 e partial deriva │ │ │ -000e5eb0: 7469 7665 7320 6f66 2074 6865 2064 6573 tives of the des │ │ │ -000e5ec0: 6967 6e20 6d61 7472 6978 205c 2820 4420 ign matrix \( D │ │ │ -000e5ed0: 5c29 2077 6974 680a 7265 7370 6563 7420 \) with.respect │ │ │ -000e5ee0: 746f 2078 2061 6e64 2079 2e20 5468 6520 to x and y. The │ │ │ -000e5ef0: 6d61 7472 6963 6573 2061 7265 2066 6f72 matrices are for │ │ │ -000e5f00: 6d65 6420 726f 7720 6279 2072 6f77 2061 med row by row a │ │ │ -000e5f10: 7070 6c79 696e 6720 7468 6520 666f 6c6c pplying the foll │ │ │ -000e5f20: 6f77 696e 6720 746f 0a65 6163 6820 6f66 owing to.each of │ │ │ -000e5f30: 2074 6865 2070 6f69 6e74 7320 696e 2074 the points in t │ │ │ -000e5f40: 6865 2073 6574 3a0a 5c28 616c 6967 6e2a he set:.\(align* │ │ │ -000e5f50: 7d7b 0a44 2869 2c3a 2926 616d 703b 3d5c }{.D(i,:)&=\ │ │ │ -000e5f60: 6c65 6674 5c7b 785f 695e 322c 2078 5f69 left\{x_i^2, x_i │ │ │ -000e5f70: 2079 5f69 2c20 795f 695e 322c 2078 5f69 y_i, y_i^2, x_i │ │ │ -000e5f80: 2c20 795f 692c 2031 5c72 6967 6874 5c7d , y_i, 1\right\} │ │ │ -000e5f90: 2026 616d 703b 0a44 5f78 2869 2c3a 2926 &.D_x(i,:)& │ │ │ -000e5fa0: 616d 703b 3d5c 6c65 6674 5c7b 3220 785f amp;=\left\{2 x_ │ │ │ -000e5fb0: 692c 795f 692c 302c 312c 302c 305c 7269 i,y_i,0,1,0,0\ri │ │ │ -000e5fc0: 6768 745c 7d20 2661 6d70 3b0a 445f 7928 ght\} &.D_y( │ │ │ -000e5fd0: 692c 3a29 2661 6d70 3b3d 5c6c 6566 745c i,:)&=\left\ │ │ │ -000e5fe0: 7b30 2c78 5f69 2c32 2079 5f69 2c30 2c31 {0,x_i,2 y_i,0,1 │ │ │ -000e5ff0: 2c30 5c72 6967 6874 5c7d 0a5c 290a 5468 ,0\right\}.\).Th │ │ │ -000e6000: 6520 414d 5320 6d65 7468 6f64 206d 696e e AMS method min │ │ │ -000e6010: 696d 697a 6573 2074 6865 2063 6f73 7420 imizes the cost │ │ │ -000e6020: 6675 6e63 7469 6f6e 0a5c 2865 7175 6174 function.\(equat │ │ │ -000e6030: 696f 6e2a 7d7b 0a5c 6570 7369 6c6f 6e20 ion*}{.\epsilon │ │ │ -000e6040: 5e32 3d5c 6672 6163 7b20 415e 5420 445e ^2=\frac{ A^T D^ │ │ │ -000e6050: 5420 4420 4120 7d7b 2041 5e54 2028 445f T D A }{ A^T (D_ │ │ │ -000e6060: 785e 5420 445f 7820 2b20 2044 5f79 5e54 x^T D_x + D_y^T │ │ │ -000e6070: 2044 5f79 2920 415e 5420 7d0a 5c29 0a0a D_y) A^T }.\).. │ │ │ -000e6080: 5468 6520 6d69 6e69 6d75 6d20 636f 7374 The minimum cost │ │ │ -000e6090: 2069 7320 666f 756e 6420 6279 2073 6f6c is found by sol │ │ │ -000e60a0: 7669 6e67 2074 6865 2067 656e 6572 616c ving the general │ │ │ -000e60b0: 697a 6564 2065 6967 656e 7661 6c75 6520 ized eigenvalue │ │ │ -000e60c0: 7072 6f62 6c65 6d2e 0a0a 5c28 6571 7561 problem...\(equa │ │ │ -000e60d0: 7469 6f6e 2a7d 7b0a 445e 5420 4420 4120 tion*}{.D^T D A │ │ │ -000e60e0: 3d20 5c6c 616d 6264 6120 205c 6c65 6674 = \lambda \left │ │ │ -000e60f0: 2820 445f 785e 5420 445f 7820 2b20 2044 ( D_x^T D_x + D │ │ │ -000e6100: 5f79 5e54 2044 5f79 5c72 6967 6874 2920 _y^T D_y\right) │ │ │ -000e6110: 410a 5c29 3c2f 6469 763e 0a3c 646c 2063 A.\)
    .
    .Parameters:.
    poi │ │ │ -000e6150: 6e74 733c 2f63 6f64 653e 202d 2049 6e70 nts - Inp │ │ │ -000e6160: 7574 2032 4420 706f 696e 7420 7365 742c ut 2D point set, │ │ │ -000e6170: 2073 746f 7265 6420 696e 2073 7464 3a3a stored in std:: │ │ │ -000e6180: 7665 6374 6f72 266c 743b 2667 743b 206f vector<> o │ │ │ -000e6190: 7220 4d61 740a 0a3c 623e 4e6f 7465 3a3c r Mat..Note:< │ │ │ -000e61a0: 2f62 3e20 496e 7075 7420 706f 696e 7420 /b> Input point │ │ │ -000e61b0: 7479 7065 7320 6172 6520 5245 463a 2050 types are REF: P │ │ │ -000e61c0: 6f69 6e74 3269 206f 7220 5245 463a 2050 oint2i or REF: P │ │ │ -000e61d0: 6f69 6e74 3266 2061 6e64 2061 7420 6c65 oint2f and at le │ │ │ -000e61e0: 6173 7420 3520 706f 696e 7473 2061 7265 ast 5 points are │ │ │ -000e61f0: 2072 6571 7569 7265 642e 0a3c 623e 4e6f required..No │ │ │ -000e6200: 7465 3a3c 2f62 3e20 5245 463a 2067 6574 te: REF: get │ │ │ -000e6210: 436c 6f73 6573 7445 6c6c 6970 7365 506f ClosestEllipsePo │ │ │ -000e6220: 696e 7473 2066 756e 6374 696f 6e20 6361 ints function ca │ │ │ -000e6230: 6e20 6265 2075 7365 6420 746f 2063 6f6d n be used to com │ │ │ -000e6240: 7075 7465 2074 6865 2065 6c6c 6970 7365 pute the ellipse │ │ │ -000e6250: 2066 6974 7469 6e67 2065 7272 6f72 2e3c fitting error.< │ │ │ -000e6260: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ -000e6270: 3a3c 2f64 743e 0a3c 6464 3e61 7574 6f6d :
    .
    autom │ │ │ -000e6280: 6174 6963 616c 6c79 2067 656e 6572 6174 atically generat │ │ │ -000e6290: 6564 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f ed
    .
    ..
    . │ │ │ -000e62b0: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374 .
  • ..< │ │ │ -000e6300: 6833 3e66 6974 456c 6c69 7073 6544 6972 h3>fitEllipseDir │ │ │ -000e6310: 6563 743c 2f68 333e 0a3c 6469 7620 636c ect.
    .
    p │ │ │ -000e6370: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static RotatedRe │ │ │ -000e63f0: 6374 3c2f 613e 3c2f 7370 616e 3e26 6e62 ct&nb │ │ │ -000e6400: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;fi │ │ │ -000e6420: 7445 6c6c 6970 7365 4469 7265 6374 3c2f tEllipseDirect( │ │ │ -000e6490: 4d61 743c 2f61 3e26 6e62 7370 3b70 6f69 Mat poi │ │ │ -000e64a0: 6e74 7329 3c2f 7370 616e 3e3c 2f64 6976 nts)
    .
    Fits an ell │ │ │ -000e64d0: 6970 7365 2061 726f 756e 6420 6120 7365 ipse around a se │ │ │ -000e64e0: 7420 6f66 2032 4420 706f 696e 7473 2e0a t of 2D points.. │ │ │ -000e64f0: 0a54 6865 2066 756e 6374 696f 6e20 6361 .The function ca │ │ │ -000e6500: 6c63 756c 6174 6573 2074 6865 2065 6c6c lculates the ell │ │ │ -000e6510: 6970 7365 2074 6861 7420 6669 7473 2061 ipse that fits a │ │ │ -000e6520: 2073 6574 206f 6620 3244 2070 6f69 6e74 set of 2D point │ │ │ -000e6530: 732e 0a49 7420 7265 7475 726e 7320 7468 s..It returns th │ │ │ -000e6540: 6520 726f 7461 7465 6420 7265 6374 616e e rotated rectan │ │ │ -000e6550: 676c 6520 696e 2077 6869 6368 2074 6865 gle in which the │ │ │ -000e6560: 2065 6c6c 6970 7365 2069 7320 696e 7363 ellipse is insc │ │ │ -000e6570: 7269 6265 642e 0a54 6865 2044 6972 6563 ribed..The Direc │ │ │ -000e6580: 7420 6c65 6173 7420 7371 7561 7265 2028 t least square ( │ │ │ -000e6590: 4469 7265 6374 2920 6d65 7468 6f64 2062 Direct) method b │ │ │ -000e65a0: 7920 4349 5445 3a20 6f79 3139 3938 4e75 y CITE: oy1998Nu │ │ │ -000e65b0: 6d65 7269 6361 6c6c 7953 4420 6973 2075 mericallySD is u │ │ │ -000e65c0: 7365 642e 0a0a 466f 7220 616e 2065 6c6c sed...For an ell │ │ │ -000e65d0: 6970 7365 2c20 7468 6973 2062 6173 6973 ipse, this basis │ │ │ -000e65e0: 2073 6574 2069 7320 5c28 205c 6368 693d set is \( \chi= │ │ │ -000e65f0: 205c 6c65 6674 2878 5e32 2c20 7820 792c \left(x^2, x y, │ │ │ -000e6600: 2079 5e32 2c20 782c 2079 2c20 315c 7269 y^2, x, y, 1\ri │ │ │ -000e6610: 6768 7429 205c 292c 0a77 6869 6368 2069 ght) \),.which i │ │ │ -000e6620: 7320 6120 7365 7420 6f66 2073 6978 2066 s a set of six f │ │ │ -000e6630: 7265 6520 636f 6566 6669 6369 656e 7473 ree coefficients │ │ │ -000e6640: 205c 2820 415e 543d 5c6c 6566 745c 7b41 \( A^T=\left\{A │ │ │ -000e6650: 5f7b 5c74 6578 747b 7878 7d7d 2c41 5f7b _{\text{xx}},A_{ │ │ │ -000e6660: 5c74 6578 747b 7879 7d7d 2c41 5f7b 5c74 \text{xy}},A_{\t │ │ │ -000e6670: 6578 747b 7979 7d7d 2c41 5f78 2c41 5f79 ext{yy}},A_x,A_y │ │ │ -000e6680: 2c41 5f30 5c72 6967 6874 5c7d 205c 292e ,A_0\right\} \). │ │ │ -000e6690: 0a48 6f77 6576 6572 2c20 746f 2073 7065 .However, to spe │ │ │ -000e66a0: 6369 6679 2061 6e20 656c 6c69 7073 652c cify an ellipse, │ │ │ -000e66b0: 2061 6c6c 2074 6861 7420 6973 206e 6565 all that is nee │ │ │ -000e66c0: 6465 6420 6973 2066 6976 6520 6e75 6d62 ded is five numb │ │ │ -000e66d0: 6572 733b 2074 6865 206d 616a 6f72 2061 ers; the major a │ │ │ -000e66e0: 6e64 206d 696e 6f72 2061 7865 7320 6c65 nd minor axes le │ │ │ -000e66f0: 6e67 7468 7320 5c28 2028 612c 6229 205c ngths \( (a,b) \ │ │ │ -000e6700: 292c 0a74 6865 2070 6f73 6974 696f 6e20 ),.the position │ │ │ -000e6710: 5c28 2028 785f 302c 795f 3029 205c 292c \( (x_0,y_0) \), │ │ │ -000e6720: 2061 6e64 2074 6865 206f 7269 656e 7461 and the orienta │ │ │ -000e6730: 7469 6f6e 205c 2820 5c74 6865 7461 205c tion \( \theta \ │ │ │ -000e6740: 292e 2054 6869 7320 6973 2062 6563 6175 ). This is becau │ │ │ -000e6750: 7365 2074 6865 2062 6173 6973 2073 6574 se the basis set │ │ │ -000e6760: 2069 6e63 6c75 6465 7320 6c69 6e65 732c includes lines, │ │ │ -000e6770: 0a71 7561 6472 6174 6963 732c 2070 6172 .quadratics, par │ │ │ -000e6780: 6162 6f6c 6963 2061 6e64 2068 7970 6572 abolic and hyper │ │ │ -000e6790: 626f 6c69 6320 6675 6e63 7469 6f6e 7320 bolic functions │ │ │ -000e67a0: 6173 2077 656c 6c20 6173 2065 6c6c 6970 as well as ellip │ │ │ -000e67b0: 7469 6361 6c20 6675 6e63 7469 6f6e 7320 tical functions │ │ │ -000e67c0: 6173 2070 6f73 7369 626c 6520 6669 7473 as possible fits │ │ │ -000e67d0: 2e0a 5468 6520 4469 7265 6374 206d 6574 ..The Direct met │ │ │ -000e67e0: 686f 6420 636f 6e66 696e 6573 2074 6865 hod confines the │ │ │ -000e67f0: 2066 6974 2074 6f20 656c 6c69 7073 6573 fit to ellipses │ │ │ -000e6800: 2062 7920 656e 7375 7269 6e67 2074 6861 by ensuring tha │ │ │ -000e6810: 7420 5c28 2034 2041 5f7b 7878 7d20 415f t \( 4 A_{xx} A_ │ │ │ -000e6820: 7b79 797d 2d20 415f 7b78 797d 5e32 2026 {yy}- A_{xy}^2 & │ │ │ -000e6830: 6774 3b20 3020 5c29 2e0a 5468 6520 636f gt; 0 \)..The co │ │ │ -000e6840: 6e64 6974 696f 6e20 696d 706f 7365 6420 ndition imposed │ │ │ -000e6850: 6973 2074 6861 7420 5c28 2034 2041 5f7b is that \( 4 A_{ │ │ │ -000e6860: 7878 7d20 415f 7b79 797d 2d20 415f 7b78 xx} A_{yy}- A_{x │ │ │ -000e6870: 797d 5e32 3d31 205c 2920 7768 6963 6820 y}^2=1 \) which │ │ │ -000e6880: 7361 7469 7366 6965 7320 7468 6520 696e satisfies the in │ │ │ -000e6890: 6571 7561 6c69 7479 0a61 6e64 2061 7320 equality.and as │ │ │ -000e68a0: 7468 6520 636f 6566 6669 6369 656e 7473 the coefficients │ │ │ -000e68b0: 2063 616e 2062 6520 6172 6269 7472 6172 can be arbitrar │ │ │ -000e68c0: 696c 7920 7363 616c 6564 2069 7320 6e6f ily scaled is no │ │ │ -000e68d0: 7420 6f76 6572 6c79 2072 6573 7472 6963 t overly restric │ │ │ -000e68e0: 7469 7665 2e0a 0a5c 2865 7175 6174 696f tive...\(equatio │ │ │ -000e68f0: 6e2a 7d7b 0a5c 6570 7369 6c6f 6e20 5e32 n*}{.\epsilon ^2 │ │ │ -000e6900: 3d20 415e 5420 445e 5420 4420 4120 5c71 = A^T D^T D A \q │ │ │ -000e6910: 7561 6420 5c74 6578 747b 7769 7468 7d20 uad \text{with} │ │ │ -000e6920: 5c71 7561 6420 415e 5420 4320 4120 3d31 \quad A^T C A =1 │ │ │ -000e6930: 205c 7175 6164 205c 7465 7874 7b61 6e64 \quad \text{and │ │ │ -000e6940: 7d20 5c71 7561 6420 433d 5c6c 6566 7428 } \quad C=\left( │ │ │ -000e6950: 5c62 6567 696e 7b6d 6174 7269 787d 0a30 \begin{matrix}.0 │ │ │ -000e6960: 2026 616d 703b 2030 2020 2661 6d70 3b20 & 0 & │ │ │ -000e6970: 3220 2026 616d 703b 2030 2020 2661 6d70 2 & 0 & │ │ │ -000e6980: 3b20 3020 2026 616d 703b 2020 3020 205c ; 0 & 0 \ │ │ │ -000e6990: 5c0a 3020 2661 6d70 3b20 2d31 2020 2661 \.0 & -1 &a │ │ │ -000e69a0: 6d70 3b20 3020 2026 616d 703b 2030 2020 mp; 0 & 0 │ │ │ -000e69b0: 2661 6d70 3b20 3020 2026 616d 703b 2020 & 0 & │ │ │ -000e69c0: 3020 5c5c 0a32 2026 616d 703b 2030 2020 0 \\.2 & 0 │ │ │ -000e69d0: 2661 6d70 3b20 3020 2026 616d 703b 2030 & 0 & 0 │ │ │ -000e69e0: 2020 2661 6d70 3b20 3020 2026 616d 703b & 0 & │ │ │ -000e69f0: 2020 3020 5c5c 0a30 2026 616d 703b 2030 0 \\.0 & 0 │ │ │ -000e6a00: 2020 2661 6d70 3b20 3020 2026 616d 703b & 0 & │ │ │ -000e6a10: 2030 2020 2661 6d70 3b20 3020 2026 616d 0 & 0 &am │ │ │ -000e6a20: 703b 2020 3020 5c5c 0a30 2026 616d 703b p; 0 \\.0 & │ │ │ -000e6a30: 2030 2020 2661 6d70 3b20 3020 2026 616d 0 & 0 &am │ │ │ -000e6a40: 703b 2030 2020 2661 6d70 3b20 3020 2026 p; 0 & 0 & │ │ │ -000e6a50: 616d 703b 2020 3020 5c5c 0a30 2026 616d amp; 0 \\.0 &am │ │ │ -000e6a60: 703b 2030 2020 2661 6d70 3b20 3020 2026 p; 0 & 0 & │ │ │ -000e6a70: 616d 703b 2030 2020 2661 6d70 3b20 3020 amp; 0 & 0 │ │ │ -000e6a80: 2026 616d 703b 2020 300a 5c65 6e64 7b6d & 0.\end{m │ │ │ -000e6a90: 6174 7269 787d 205c 7269 6768 7429 0a5c atrix} \right).\ │ │ │ -000e6aa0: 290a 0a54 6865 206d 696e 696d 756d 2063 )..The minimum c │ │ │ -000e6ab0: 6f73 7420 6973 2066 6f75 6e64 2062 7920 ost is found by │ │ │ -000e6ac0: 736f 6c76 696e 6720 7468 6520 6765 6e65 solving the gene │ │ │ -000e6ad0: 7261 6c69 7a65 6420 6569 6765 6e76 616c ralized eigenval │ │ │ -000e6ae0: 7565 2070 726f 626c 656d 2e0a 0a5c 2865 ue problem...\(e │ │ │ -000e6af0: 7175 6174 696f 6e2a 7d7b 0a44 5e54 2044 quation*}{.D^T D │ │ │ -000e6b00: 2041 203d 205c 6c61 6d62 6461 2020 5c6c A = \lambda \l │ │ │ -000e6b10: 6566 7428 2043 5c72 6967 6874 2920 410a eft( C\right) A. │ │ │ -000e6b20: 5c29 0a0a 5468 6520 7379 7374 656d 2070 \)..The system p │ │ │ -000e6b30: 726f 6475 6365 7320 6f6e 6c79 206f 6e65 roduces only one │ │ │ -000e6b40: 2070 6f73 6974 6976 6520 6569 6765 6e76 positive eigenv │ │ │ -000e6b50: 616c 7565 205c 2820 5c6c 616d 6264 615c alue \( \lambda\ │ │ │ -000e6b60: 2920 7768 6963 6820 6973 2063 686f 7365 ) which is chose │ │ │ -000e6b70: 6e20 6173 2074 6865 2073 6f6c 7574 696f n as the solutio │ │ │ -000e6b80: 6e0a 7769 7468 2069 7473 2065 6967 656e n.with its eigen │ │ │ -000e6b90: 7665 6374 6f72 205c 285c 6d61 7468 6266 vector \(\mathbf │ │ │ -000e6ba0: 7b75 7d5c 292e 2054 6865 7365 2061 7265 {u}\). These are │ │ │ -000e6bb0: 2075 7365 6420 746f 2066 696e 6420 7468 used to find th │ │ │ -000e6bc0: 6520 636f 6566 6669 6369 656e 7473 0a0a e coefficients.. │ │ │ -000e6bd0: 5c28 6571 7561 7469 6f6e 2a7d 7b0a 4120 \(equation*}{.A │ │ │ -000e6be0: 3d20 5c73 7172 747b 5c66 7261 637b 317d = \sqrt{\frac{1} │ │ │ -000e6bf0: 7b5c 6d61 7468 6266 7b75 7d5e 5420 4320 {\mathbf{u}^T C │ │ │ -000e6c00: 5c6d 6174 6862 667b 757d 7d7d 2020 5c6d \mathbf{u}}} \m │ │ │ -000e6c10: 6174 6862 667b 757d 0a5c 290a 5468 6520 athbf{u}.\).The │ │ │ -000e6c20: 7363 616c 696e 6720 6661 6374 6f72 2067 scaling factor g │ │ │ -000e6c30: 7561 7261 6e74 6565 7320 7468 6174 2020 uarantees that │ │ │ -000e6c40: 5c28 415e 5420 4320 4120 3d31 5c29 2e3c \(A^T C A =1\).< │ │ │ -000e6c50: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ -000e6c70: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .points - Input 2D │ │ │ -000e6ca0: 2070 6f69 6e74 2073 6574 2c20 7374 6f72 point set, stor │ │ │ -000e6cb0: 6564 2069 6e20 7374 643a 3a76 6563 746f ed in std::vecto │ │ │ -000e6cc0: 7226 6c74 3b26 6774 3b20 6f72 204d 6174 r<> or Mat │ │ │ -000e6cd0: 0a0a 3c62 3e4e 6f74 653a 3c2f 623e 2049 ..Note: I │ │ │ -000e6ce0: 6e70 7574 2070 6f69 6e74 2074 7970 6573 nput point types │ │ │ -000e6cf0: 2061 7265 2052 4546 3a20 506f 696e 7432 are REF: Point2 │ │ │ -000e6d00: 6920 6f72 2052 4546 3a20 506f 696e 7432 i or REF: Point2 │ │ │ -000e6d10: 6620 616e 6420 6174 206c 6561 7374 2035 f and at least 5 │ │ │ -000e6d20: 2070 6f69 6e74 7320 6172 6520 7265 7175 points are requ │ │ │ -000e6d30: 6972 6564 2e0a 3c62 3e4e 6f74 653a 3c2f ired..Note: REF: getClose │ │ │ -000e6d50: 7374 456c 6c69 7073 6550 6f69 6e74 7320 stEllipsePoints │ │ │ -000e6d60: 6675 6e63 7469 6f6e 2063 616e 2062 6520 function can be │ │ │ -000e6d70: 7573 6564 2074 6f20 636f 6d70 7574 6520 used to compute │ │ │ -000e6d80: 7468 6520 656c 6c69 7073 6520 6669 7474 the ellipse fitt │ │ │ -000e6d90: 696e 6720 6572 726f 722e 3c2f 6464 3e0a ing error.. │ │ │ -000e6da0: 3c64 743e 5265 7475 726e 733a 3c2f 6474
    Returns:
    .
    automatica │ │ │ -000e6dc0: 6c6c 7920 6765 6e65 7261 7465 643c 2f64 lly generated.
    .
    . │ │ │ -000e6de0: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e .
  • │ │ │ -000e6df0: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    │ │ │ -000e6e70: 0a3c 6833 3e67 6574 436c 6f73 6573 7445 .

    getClosestE │ │ │ -000e6e80: 6c6c 6970 7365 506f 696e 7473 3c2f 6833 llipsePoints

    .
    .
    │ │ │ -000e6ed0: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -000e6ef0: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -000e6f00: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;void │ │ │ -000e6f20: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  getClose │ │ │ -000e6f50: 7374 456c 6c69 7073 6550 6f69 6e74 733c stEllipsePoints< │ │ │ -000e6f60: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Rotated │ │ │ -000e6fd0: 5265 6374 3c2f 613e 266e 6273 703b 656c Rect el │ │ │ -000e6fe0: 6c69 7073 655f 7061 7261 6d73 2c0a 203c lipse_params,. < │ │ │ -000e6ff0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000e7000: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000e7010: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000e7020: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat points,. │ │ │ -000e7040: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ -000e7080: 3c2f 613e 266e 6273 703b 636c 6f73 6573  closes │ │ │ -000e7090: 745f 7074 7329 3c2f 7370 616e 3e3c 2f64 t_pts).
    Compute f │ │ │ -000e70c0: 6f72 2065 6163 6820 3264 2070 6f69 6e74 or each 2d point │ │ │ -000e70d0: 2074 6865 206e 6561 7265 7374 2032 6420 the nearest 2d │ │ │ -000e70e0: 706f 696e 7420 6c6f 6361 7465 6420 6f6e point located on │ │ │ -000e70f0: 2061 2067 6976 656e 2065 6c6c 6970 7365 a given ellipse │ │ │ -000e7100: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ -000e7110: 636f 6d70 7574 6573 2074 6865 206e 6561 computes the nea │ │ │ -000e7120: 7265 7374 2032 6420 6c6f 6361 7469 6f6e rest 2d location │ │ │ -000e7130: 206f 6e20 6120 6769 7665 6e20 656c 6c69 on a given elli │ │ │ -000e7140: 7073 6520 666f 7220 6120 7665 6374 6f72 pse for a vector │ │ │ -000e7150: 206f 6620 3264 2070 6f69 6e74 7320 616e of 2d points an │ │ │ -000e7160: 6420 6973 2062 6173 6564 206f 6e20 4349 d is based on CI │ │ │ -000e7170: 5445 3a20 4368 6174 6669 656c 6432 3031 TE: Chatfield201 │ │ │ -000e7180: 3720 636f 6465 2e0a 5468 6973 2066 756e 7 code..This fun │ │ │ -000e7190: 6374 696f 6e20 6361 6e20 6265 2075 7365 ction can be use │ │ │ -000e71a0: 6420 746f 2063 6f6d 7075 7465 2066 6f72 d to compute for │ │ │ -000e71b0: 2069 6e73 7461 6e63 6520 7468 6520 656c instance the el │ │ │ -000e71c0: 6c69 7073 6520 6669 7474 696e 6720 6572 lipse fitting er │ │ │ -000e71d0: 726f 722e 3c2f 6469 763e 0a3c 646c 2063 ror.
    .
    .Parameters:.
    ell │ │ │ -000e7210: 6970 7365 5f70 6172 616d 733c 2f63 6f64 ipse_params - Ellipse par │ │ │ -000e7230: 616d 6574 6572 733c 2f64 643e 0a3c 6464 ameters
    .
    points - Input 2d │ │ │ -000e7260: 706f 696e 7473 3c2f 6464 3e0a 3c64 643e points
    .
    │ │ │ -000e7270: 3c63 6f64 653e 636c 6f73 6573 745f 7074 closest_pt │ │ │ -000e7280: 733c 2f63 6f64 653e 202d 2046 6f72 2065 s - For e │ │ │ -000e7290: 6163 6820 3264 2070 6f69 6e74 2c20 7468 ach 2d point, th │ │ │ -000e72a0: 6569 7220 636f 7272 6573 706f 6e64 696e eir correspondin │ │ │ -000e72b0: 6720 636c 6f73 6573 7420 3264 2070 6f69 g closest 2d poi │ │ │ -000e72c0: 6e74 206c 6f63 6174 6564 206f 6e20 6120 nt located on a │ │ │ -000e72d0: 6769 7665 6e20 656c 6c69 7073 650a 0a3c given ellipse..< │ │ │ -000e72e0: 623e 4e6f 7465 3a3c 2f62 3e20 496e 7075 b>Note: Inpu │ │ │ -000e72f0: 7420 706f 696e 7420 7479 7065 7320 6172 t point types ar │ │ │ -000e7300: 6520 5245 463a 2050 6f69 6e74 3269 206f e REF: Point2i o │ │ │ -000e7310: 7220 5245 463a 2050 6f69 6e74 3266 0a53 r REF: Point2f.S │ │ │ -000e7320: 4545 3a20 6669 7445 6c6c 6970 7365 2c20 EE: fitEllipse, │ │ │ -000e7330: 6669 7445 6c6c 6970 7365 414d 532c 2066 fitEllipseAMS, f │ │ │ -000e7340: 6974 456c 6c69 7073 6544 6972 6563 743c itEllipseDirect< │ │ │ -000e7350: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .
    ..
  • .
    . │ │ │ -000e73e0: 3c68 333e 6669 744c 696e 653c 2f68 333e

    fitLine

    │ │ │ -000e73f0: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ -000e7410: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ -000e7430: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ -000e7440: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ -000e7450: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ -000e7460: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;void< │ │ │ -000e7480: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> fitLine( │ │ │ -000e7510: 4d61 743c 2f61 3e26 6e62 7370 3b70 6f69 Mat poi │ │ │ -000e7520: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. Mat l │ │ │ -000e7570: 696e 652c 0a20 696e 7426 6e62 7370 3b64 ine,. int d │ │ │ -000e7580: 6973 7454 7970 652c 0a20 646f 7562 6c65 istType,. double │ │ │ -000e7590: 266e 6273 703b 7061 7261 6d2c 0a20 646f  param,. do │ │ │ -000e75a0: 7562 6c65 266e 6273 703b 7265 7073 2c0a uble reps,. │ │ │ -000e75b0: 2064 6f75 626c 6526 6e62 7370 3b61 6570 double aep │ │ │ -000e75c0: 7329 3c2f 7370 616e 3e3c 2f64 6976 3e0a s)
    . │ │ │ -000e75d0: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Fits a line t │ │ │ -000e75f0: 6f20 6120 3244 206f 7220 3344 2070 6f69 o a 2D or 3D poi │ │ │ -000e7600: 6e74 2073 6574 2e0a 0a54 6865 2066 756e nt set...The fun │ │ │ -000e7610: 6374 696f 6e20 6669 744c 696e 6520 6669 ction fitLine fi │ │ │ -000e7620: 7473 2061 206c 696e 6520 746f 2061 2032 ts a line to a 2 │ │ │ -000e7630: 4420 6f72 2033 4420 706f 696e 7420 7365 D or 3D point se │ │ │ -000e7640: 7420 6279 206d 696e 696d 697a 696e 6720 t by minimizing │ │ │ -000e7650: 5c28 5c73 756d 5f69 205c 7268 6f28 725f \(\sum_i \rho(r_ │ │ │ -000e7660: 6929 5c29 2077 6865 7265 0a5c 2872 5f69 i)\) where.\(r_i │ │ │ -000e7670: 5c29 2069 7320 6120 6469 7374 616e 6365 \) is a distance │ │ │ -000e7680: 2062 6574 7765 656e 2074 6865 205c 2869 between the \(i │ │ │ -000e7690: 5e7b 7468 7d5c 2920 706f 696e 742c 2074 ^{th}\) point, t │ │ │ -000e76a0: 6865 206c 696e 6520 616e 6420 5c28 5c72 he line and \(\r │ │ │ -000e76b0: 686f 2872 295c 2920 6973 2061 2064 6973 ho(r)\) is a dis │ │ │ -000e76c0: 7461 6e63 6520 6675 6e63 7469 6f6e 2c20 tance function, │ │ │ -000e76d0: 6f6e 650a 6f66 2074 6865 2066 6f6c 6c6f one.of the follo │ │ │ -000e76e0: 7769 6e67 3a0a 2d20 2044 4953 545f 4c32 wing:.- DIST_L2 │ │ │ -000e76f0: 0a5c 285c 7268 6f20 2872 2920 3d20 725e .\(\rho (r) = r^ │ │ │ -000e7700: 322f 3220 205c 7175 6164 205c 7465 7874 2/2 \quad \text │ │ │ -000e7710: 7b28 7468 6520 7369 6d70 6c65 7374 2061 {(the simplest a │ │ │ -000e7720: 6e64 2074 6865 2066 6173 7465 7374 206c nd the fastest l │ │ │ -000e7730: 6561 7374 2d73 7175 6172 6573 206d 6574 east-squares met │ │ │ -000e7740: 686f 6429 7d5c 290a 2d20 4449 5354 5f4c hod)}\).- DIST_L │ │ │ -000e7750: 310a 5c28 5c72 686f 2028 7229 203d 2072 1.\(\rho (r) = r │ │ │ -000e7760: 5c29 0a2d 2044 4953 545f 4c31 320a 5c28 \).- DIST_L12.\( │ │ │ -000e7770: 5c72 686f 2028 7229 203d 2032 2020 5c63 \rho (r) = 2 \c │ │ │ -000e7780: 646f 7420 2820 5c73 7172 747b 3120 2b20 dot ( \sqrt{1 + │ │ │ -000e7790: 5c66 7261 637b 725e 327d 7b32 7d7d 202d \frac{r^2}{2}} - │ │ │ -000e77a0: 2031 295c 290a 2d20 4449 5354 5f46 4149 1)\).- DIST_FAI │ │ │ -000e77b0: 520a 5c28 5c72 686f 205c 6c65 6674 2028 R.\(\rho \left ( │ │ │ -000e77c0: 7220 5c72 6967 6874 2029 203d 2043 5e32 r \right ) = C^2 │ │ │ -000e77d0: 2020 5c63 646f 7420 5c6c 6566 7420 2820 \cdot \left ( │ │ │ -000e77e0: 205c 6672 6163 7b72 7d7b 437d 202d 2020 \frac{r}{C} - │ │ │ -000e77f0: 5c6c 6f67 7b5c 6c65 6674 2831 202b 205c \log{\left(1 + \ │ │ │ -000e7800: 6672 6163 7b72 7d7b 437d 5c72 6967 6874 frac{r}{C}\right │ │ │ -000e7810: 297d 205c 7269 6768 7420 2920 205c 7175 )} \right ) \qu │ │ │ -000e7820: 6164 205c 7465 7874 7b77 6865 7265 7d20 ad \text{where} │ │ │ -000e7830: 5c71 7561 6420 433d 312e 3339 3938 5c29 \quad C=1.3998\) │ │ │ -000e7840: 0a2d 2044 4953 545f 5745 4c53 4348 0a5c .- DIST_WELSCH.\ │ │ │ -000e7850: 285c 7268 6f20 5c6c 6566 7420 2872 205c (\rho \left (r \ │ │ │ -000e7860: 7269 6768 7420 2920 3d20 205c 6672 6163 right ) = \frac │ │ │ -000e7870: 7b43 5e32 7d7b 327d 205c 6364 6f74 205c {C^2}{2} \cdot \ │ │ │ -000e7880: 6c65 6674 2028 2031 202d 2020 5c65 7870 left ( 1 - \exp │ │ │ -000e7890: 7b5c 6c65 6674 282d 5c6c 6566 7428 5c66 {\left(-\left(\f │ │ │ -000e78a0: 7261 637b 727d 7b43 7d5c 7269 6768 7429 rac{r}{C}\right) │ │ │ -000e78b0: 5e32 5c72 6967 6874 297d 205c 7269 6768 ^2\right)} \righ │ │ │ -000e78c0: 7420 2920 205c 7175 6164 205c 7465 7874 t ) \quad \text │ │ │ -000e78d0: 7b77 6865 7265 7d20 5c71 7561 6420 433d {where} \quad C= │ │ │ -000e78e0: 322e 3938 3436 5c29 0a2d 2044 4953 545f 2.9846\).- DIST_ │ │ │ -000e78f0: 4855 4245 520a 5c28 5c72 686f 2028 7229 HUBER.\(\rho (r) │ │ │ -000e7900: 203d 2020 5c66 6f72 6b7b 725e 322f 327d = \fork{r^2/2} │ │ │ -000e7910: 7b69 6620 5c28 7220 266c 743b 2043 5c29 {if \(r < C\) │ │ │ -000e7920: 7d7b 4320 5c63 646f 7420 2872 2d43 2f32 }{C \cdot (r-C/2 │ │ │ -000e7930: 297d 7b6f 7468 6572 7769 7365 7d20 5c71 )}{otherwise} \q │ │ │ -000e7940: 7561 6420 5c74 6578 747b 7768 6572 657d uad \text{where} │ │ │ -000e7950: 205c 7175 6164 2043 3d31 2e33 3435 5c29 \quad C=1.345\) │ │ │ -000e7960: 0a0a 5468 6520 616c 676f 7269 7468 6d20 ..The algorithm │ │ │ -000e7970: 6973 2062 6173 6564 206f 6e20 7468 6520 is based on the │ │ │ -000e7980: 4d2d 6573 7469 6d61 746f 7220 2820 266c M-estimator ( &l │ │ │ -000e7990: 743b 6874 7470 733a 2f2f 656e 2e77 696b t;https://en.wik │ │ │ -000e79a0: 6970 6564 6961 2e6f 7267 2f77 696b 692f ipedia.org/wiki/ │ │ │ -000e79b0: 4d2d 6573 7469 6d61 746f 7226 6774 3b20 M-estimator> │ │ │ -000e79c0: 2920 7465 6368 6e69 7175 650a 7468 6174 ) technique.that │ │ │ -000e79d0: 2069 7465 7261 7469 7665 6c79 2066 6974 iteratively fit │ │ │ -000e79e0: 7320 7468 6520 6c69 6e65 2075 7369 6e67 s the line using │ │ │ -000e79f0: 2074 6865 2077 6569 6768 7465 6420 6c65 the weighted le │ │ │ -000e7a00: 6173 742d 7371 7561 7265 7320 616c 676f ast-squares algo │ │ │ -000e7a10: 7269 7468 6d2e 2041 6674 6572 2065 6163 rithm. After eac │ │ │ -000e7a20: 6820 6974 6572 6174 696f 6e20 7468 650a h iteration the. │ │ │ -000e7a30: 7765 6967 6874 7320 5c28 775f 695c 2920 weights \(w_i\) │ │ │ -000e7a40: 6172 6520 6164 6a75 7374 6564 2074 6f20 are adjusted to │ │ │ -000e7a50: 6265 2069 6e76 6572 7365 6c79 2070 726f be inversely pro │ │ │ -000e7a60: 706f 7274 696f 6e61 6c20 746f 205c 285c portional to \(\ │ │ │ -000e7a70: 7268 6f28 725f 6929 5c29 202e 3c2f 6469 rho(r_i)\) ..
    .
    Parame │ │ │ -000e7aa0: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ -000e7ab0: 636f 6465 3e70 6f69 6e74 733c 2f63 6f64 code>points - Input vecto │ │ │ -000e7ad0: 7220 6f66 2032 4420 6f72 2033 4420 706f r of 2D or 3D po │ │ │ -000e7ae0: 696e 7473 2c20 7374 6f72 6564 2069 6e20 ints, stored in │ │ │ -000e7af0: 7374 643a 3a76 6563 746f 7226 6c74 3b26 std::vector<& │ │ │ -000e7b00: 6774 3b20 6f72 204d 6174 2e3c 2f64 643e gt; or Mat.
    │ │ │ -000e7b10: 0a3c 6464 3e3c 636f 6465 3e6c 696e 653c .
    line< │ │ │ -000e7b20: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ -000e7b30: 6c69 6e65 2070 6172 616d 6574 6572 732e line parameters. │ │ │ -000e7b40: 2049 6e20 6361 7365 206f 6620 3244 2066 In case of 2D f │ │ │ -000e7b50: 6974 7469 6e67 2c20 6974 2073 686f 756c itting, it shoul │ │ │ -000e7b60: 6420 6265 2061 2076 6563 746f 7220 6f66 d be a vector of │ │ │ -000e7b70: 2034 2065 6c65 6d65 6e74 730a 286c 696b 4 elements.(lik │ │ │ -000e7b80: 6520 5665 6334 6629 202d 2028 7678 2c20 e Vec4f) - (vx, │ │ │ -000e7b90: 7679 2c20 7830 2c20 7930 292c 2077 6865 vy, x0, y0), whe │ │ │ -000e7ba0: 7265 2028 7678 2c20 7679 2920 6973 2061 re (vx, vy) is a │ │ │ -000e7bb0: 206e 6f72 6d61 6c69 7a65 6420 7665 6374 normalized vect │ │ │ -000e7bc0: 6f72 2063 6f6c 6c69 6e65 6172 2074 6f20 or collinear to │ │ │ -000e7bd0: 7468 6520 6c69 6e65 2061 6e64 0a28 7830 the line and.(x0 │ │ │ -000e7be0: 2c20 7930 2920 6973 2061 2070 6f69 6e74 , y0) is a point │ │ │ -000e7bf0: 206f 6e20 7468 6520 6c69 6e65 2e20 496e on the line. In │ │ │ -000e7c00: 2063 6173 6520 6f66 2033 4420 6669 7474 case of 3D fitt │ │ │ -000e7c10: 696e 672c 2069 7420 7368 6f75 6c64 2062 ing, it should b │ │ │ -000e7c20: 6520 6120 7665 6374 6f72 206f 6620 3620 e a vector of 6 │ │ │ -000e7c30: 656c 656d 656e 7473 2028 6c69 6b65 0a56 elements (like.V │ │ │ -000e7c40: 6563 3666 2920 2d20 2876 782c 2076 792c ec6f) - (vx, vy, │ │ │ -000e7c50: 2076 7a2c 2078 302c 2079 302c 207a 3029 vz, x0, y0, z0) │ │ │ -000e7c60: 2c20 7768 6572 6520 2876 782c 2076 792c , where (vx, vy, │ │ │ -000e7c70: 2076 7a29 2069 7320 6120 6e6f 726d 616c vz) is a normal │ │ │ -000e7c80: 697a 6564 2076 6563 746f 7220 636f 6c6c ized vector coll │ │ │ -000e7c90: 696e 6561 7220 746f 2074 6865 206c 696e inear to the lin │ │ │ -000e7ca0: 650a 616e 6420 2878 302c 2079 302c 207a e.and (x0, y0, z │ │ │ -000e7cb0: 3029 2069 7320 6120 706f 696e 7420 6f6e 0) is a point on │ │ │ -000e7cc0: 2074 6865 206c 696e 652e 3c2f 6464 3e0a the line.
    . │ │ │ -000e7cd0: 3c64 643e 3c63 6f64 653e 6469 7374 5479
    distTy │ │ │ -000e7ce0: 7065 3c2f 636f 6465 3e20 2d20 4469 7374 pe - Dist │ │ │ -000e7cf0: 616e 6365 2075 7365 6420 6279 2074 6865 ance used by the │ │ │ -000e7d00: 204d 2d65 7374 696d 6174 6f72 2c20 7365 M-estimator, se │ │ │ -000e7d10: 6520 2344 6973 7461 6e63 6554 7970 6573 e #DistanceTypes │ │ │ -000e7d20: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000e7d30: 7061 7261 6d3c 2f63 6f64 653e 202d 204e param - N │ │ │ -000e7d40: 756d 6572 6963 616c 2070 6172 616d 6574 umerical paramet │ │ │ -000e7d50: 6572 2028 2043 2029 2066 6f72 2073 6f6d er ( C ) for som │ │ │ -000e7d60: 6520 7479 7065 7320 6f66 2064 6973 7461 e types of dista │ │ │ -000e7d70: 6e63 6573 2e20 4966 2069 7420 6973 2030 nces. If it is 0 │ │ │ -000e7d80: 2c20 616e 206f 7074 696d 616c 2076 616c , an optimal val │ │ │ -000e7d90: 7565 0a69 7320 6368 6f73 656e 2e3c 2f64 ue.is chosen..
    rep │ │ │ -000e7db0: 733c 2f63 6f64 653e 202d 2053 7566 6669 s - Suffi │ │ │ -000e7dc0: 6369 656e 7420 6163 6375 7261 6379 2066 cient accuracy f │ │ │ -000e7dd0: 6f72 2074 6865 2072 6164 6975 7320 2864 or the radius (d │ │ │ -000e7de0: 6973 7461 6e63 6520 6265 7477 6565 6e20 istance between │ │ │ -000e7df0: 7468 6520 636f 6f72 6469 6e61 7465 206f the coordinate o │ │ │ -000e7e00: 7269 6769 6e20 616e 6420 7468 6520 6c69 rigin and the li │ │ │ -000e7e10: 6e65 292e 3c2f 6464 3e0a 3c64 643e 3c63 ne).
    .
    aeps │ │ │ -000e7e30: 2d20 5375 6666 6963 6965 6e74 2061 6363 - Sufficient acc │ │ │ -000e7e40: 7572 6163 7920 666f 7220 7468 6520 616e uracy for the an │ │ │ -000e7e50: 676c 652e 2030 2e30 3120 776f 756c 6420 gle. 0.01 would │ │ │ -000e7e60: 6265 2061 2067 6f6f 6420 6465 6661 756c be a good defaul │ │ │ -000e7e70: 7420 7661 6c75 6520 666f 7220 7265 7073 t value for reps │ │ │ -000e7e80: 2061 6e64 2061 6570 732e 3c2f 6464 3e0a and aeps.
    . │ │ │ -000e7e90: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    ..
  • ..
    .pointPolygonTe │ │ │ -000e7f30: 7374 3c2f 6833 3e0a 3c64 6976 2063 6c61 st.
    .
    pu │ │ │ -000e7f90: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static double& │ │ │ -000e7fd0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ -000e7ff0: 706f 696e 7450 6f6c 7967 6f6e 5465 7374 pointPolygonTest │ │ │ -000e8000: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (MatOf │ │ │ -000e8070: 506f 696e 7432 663c 2f61 3e26 6e62 7370 Point2f  │ │ │ -000e8080: 3b63 6f6e 746f 7572 2c0a 203c 6120 6872 ;contour,. Point pt,. boo │ │ │ -000e80e0: 6c65 616e 266e 6273 703b 6d65 6173 7572 lean measur │ │ │ -000e80f0: 6544 6973 7429 3c2f 7370 616e 3e3c 2f64 eDist).
    Performs │ │ │ -000e8120: 6120 706f 696e 742d 696e 2d63 6f6e 746f a point-in-conto │ │ │ -000e8130: 7572 2074 6573 742e 0a0a 5468 6520 6675 ur test...The fu │ │ │ -000e8140: 6e63 7469 6f6e 2064 6574 6572 6d69 6e65 nction determine │ │ │ -000e8150: 7320 7768 6574 6865 7220 7468 6520 706f s whether the po │ │ │ -000e8160: 696e 7420 6973 2069 6e73 6964 6520 6120 int is inside a │ │ │ -000e8170: 636f 6e74 6f75 722c 206f 7574 7369 6465 contour, outside │ │ │ -000e8180: 2c20 6f72 206c 6965 7320 6f6e 2061 6e20 , or lies on an │ │ │ -000e8190: 6564 6765 2028 6f72 0a63 6f69 6e63 6964 edge (or.coincid │ │ │ -000e81a0: 6573 2077 6974 6820 6120 7665 7274 6578 es with a vertex │ │ │ -000e81b0: 292e 2049 7420 7265 7475 726e 7320 706f ). It returns po │ │ │ -000e81c0: 7369 7469 7665 2028 696e 7369 6465 292c sitive (inside), │ │ │ -000e81d0: 206e 6567 6174 6976 6520 286f 7574 7369 negative (outsi │ │ │ -000e81e0: 6465 292c 206f 7220 7a65 726f 2028 6f6e de), or zero (on │ │ │ -000e81f0: 2061 6e20 6564 6765 290a 7661 6c75 652c an edge).value, │ │ │ -000e8200: 2063 6f72 7265 7370 6f6e 6469 6e67 6c79 correspondingly │ │ │ -000e8210: 2e20 5768 656e 206d 6561 7375 7265 4469 . When measureDi │ │ │ -000e8220: 7374 3d66 616c 7365 202c 2074 6865 2072 st=false , the r │ │ │ -000e8230: 6574 7572 6e20 7661 6c75 6520 6973 202b eturn value is + │ │ │ -000e8240: 312c 202d 312c 2061 6e64 2030 2c20 7265 1, -1, and 0, re │ │ │ -000e8250: 7370 6563 7469 7665 6c79 2e0a 4f74 6865 spectively..Othe │ │ │ -000e8260: 7277 6973 652c 2074 6865 2072 6574 7572 rwise, the retur │ │ │ -000e8270: 6e20 7661 6c75 6520 6973 2061 2073 6967 n value is a sig │ │ │ -000e8280: 6e65 6420 6469 7374 616e 6365 2062 6574 ned distance bet │ │ │ -000e8290: 7765 656e 2074 6865 2070 6f69 6e74 2061 ween the point a │ │ │ -000e82a0: 6e64 2074 6865 206e 6561 7265 7374 2063 nd the nearest c │ │ │ -000e82b0: 6f6e 746f 7572 2065 6467 652e 0a0a 5365 ontour edge...Se │ │ │ -000e82c0: 6520 6265 6c6f 7720 6120 7361 6d70 6c65 e below a sample │ │ │ -000e82d0: 206f 7574 7075 7420 6f66 2074 6865 2066 output of the f │ │ │ -000e82e0: 756e 6374 696f 6e20 7768 6572 6520 6561 unction where ea │ │ │ -000e82f0: 6368 2069 6d61 6765 2070 6978 656c 2069 ch image pixel i │ │ │ -000e8300: 7320 7465 7374 6564 2061 6761 696e 7374 s tested against │ │ │ -000e8310: 2074 6865 2063 6f6e 746f 7572 3a0a 0a21 the contour:..! │ │ │ -000e8320: 5b73 616d 706c 6520 6f75 7470 7574 5d28 [sample output]( │ │ │ -000e8330: 7069 6373 2f70 6f69 6e74 706f 6c79 676f pics/pointpolygo │ │ │ -000e8340: 6e2e 706e 6729 3c2f 6469 763e 0a3c 646c n.png)
    .
    . │ │ │ -000e8360: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ -000e8370: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e63 /dt>.
    c │ │ │ -000e8380: 6f6e 746f 7572 3c2f 636f 6465 3e20 2d20 ontour - │ │ │ -000e8390: 496e 7075 7420 636f 6e74 6f75 722e 3c2f Input contour..
    pt │ │ │ -000e83b0: 3c2f 636f 6465 3e20 2d20 506f 696e 7420 - Point │ │ │ -000e83c0: 7465 7374 6564 2061 6761 696e 7374 2074 tested against t │ │ │ -000e83d0: 6865 2063 6f6e 746f 7572 2e3c 2f64 643e he contour.
    │ │ │ -000e83e0: 0a3c 6464 3e3c 636f 6465 3e6d 6561 7375 .
    measu │ │ │ -000e83f0: 7265 4469 7374 3c2f 636f 6465 3e20 2d20 reDist - │ │ │ -000e8400: 4966 2074 7275 652c 2074 6865 2066 756e If true, the fun │ │ │ -000e8410: 6374 696f 6e20 6573 7469 6d61 7465 7320 ction estimates │ │ │ -000e8420: 7468 6520 7369 676e 6564 2064 6973 7461 the signed dista │ │ │ -000e8430: 6e63 6520 6672 6f6d 2074 6865 2070 6f69 nce from the poi │ │ │ -000e8440: 6e74 2074 6f20 7468 650a 6e65 6172 6573 nt to the.neares │ │ │ -000e8450: 7420 636f 6e74 6f75 7220 6564 6765 2e20 t contour edge. │ │ │ -000e8460: 4f74 6865 7277 6973 652c 2074 6865 2066 Otherwise, the f │ │ │ -000e8470: 756e 6374 696f 6e20 6f6e 6c79 2063 6865 unction only che │ │ │ -000e8480: 636b 7320 6966 2074 6865 2070 6f69 6e74 cks if the point │ │ │ -000e8490: 2069 7320 696e 7369 6465 2061 2063 6f6e is inside a con │ │ │ -000e84a0: 746f 7572 206f 7220 6e6f 742e 3c2f 6464 tour or not.
    .
    Returns:.
    automati │ │ │ -000e84d0: 6361 6c6c 7920 6765 6e65 7261 7465 643c cally generated< │ │ │ -000e84e0: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .
    .
    .
  • .
    . │ │ │ -000e8590: 3c68 333e 726f 7461 7465 6452 6563 7461

    rotatedRecta │ │ │ -000e85a0: 6e67 6c65 496e 7465 7273 6563 7469 6f6e ngleIntersection │ │ │ -000e85b0: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ -000e8610: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -000e8620: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -000e8640: 696e 743c 2f73 7061 6e3e 266e 6273 703b int  │ │ │ -000e8650: 3c73 7061 6e20 636c 6173 733d 2265 6c65 rotat │ │ │ -000e8670: 6564 5265 6374 616e 676c 6549 6e74 6572 edRectangleInter │ │ │ -000e8680: 7365 6374 696f 6e3c 2f73 7061 6e3e 3c77 section(RotatedRect │ │ │ -000e8700: 266e 6273 703b 7265 6374 312c 0a20 3c61  rect1,. RotatedRect rect2,. < │ │ │ -000e8770: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000e8780: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000e8790: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000e87a0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat intersec │ │ │ -000e87c0: 7469 6e67 5265 6769 6f6e 293c 2f73 7061 tingRegion)
    .
    Find │ │ │ -000e87f0: 7320 6f75 7420 6966 2074 6865 7265 2069 s out if there i │ │ │ -000e8800: 7320 616e 7920 696e 7465 7273 6563 7469 s any intersecti │ │ │ -000e8810: 6f6e 2062 6574 7765 656e 2074 776f 2072 on between two r │ │ │ -000e8820: 6f74 6174 6564 2072 6563 7461 6e67 6c65 otated rectangle │ │ │ -000e8830: 732e 0a0a 4966 2074 6865 7265 2069 7320 s...If there is │ │ │ -000e8840: 7468 656e 2074 6865 2076 6572 7469 6365 then the vertice │ │ │ -000e8850: 7320 6f66 2074 6865 2069 6e74 6572 7365 s of the interse │ │ │ -000e8860: 6374 696e 6720 7265 6769 6f6e 2061 7265 cting region are │ │ │ -000e8870: 2072 6574 7572 6e65 6420 6173 2077 656c returned as wel │ │ │ -000e8880: 6c2e 0a0a 4265 6c6f 7720 6172 6520 736f l...Below are so │ │ │ -000e8890: 6d65 2065 7861 6d70 6c65 7320 6f66 2069 me examples of i │ │ │ -000e88a0: 6e74 6572 7365 6374 696f 6e20 636f 6e66 ntersection conf │ │ │ -000e88b0: 6967 7572 6174 696f 6e73 2e20 5468 6520 igurations. The │ │ │ -000e88c0: 6861 7463 6865 6420 7061 7474 6572 6e20 hatched pattern │ │ │ -000e88d0: 696e 6469 6361 7465 7320 7468 650a 696e indicates the.in │ │ │ -000e88e0: 7465 7273 6563 7469 6e67 2072 6567 696f tersecting regio │ │ │ -000e88f0: 6e20 616e 6420 7468 6520 7265 6420 7665 n and the red ve │ │ │ -000e8900: 7274 6963 6573 2061 7265 2072 6574 7572 rtices are retur │ │ │ -000e8910: 6e65 6420 6279 2074 6865 2066 756e 6374 ned by the funct │ │ │ -000e8920: 696f 6e2e 0a0a 215b 696e 7465 7273 6563 ion...![intersec │ │ │ -000e8930: 7469 6f6e 2065 7861 6d70 6c65 735d 2870 tion examples](p │ │ │ -000e8940: 6963 732f 696e 7465 7273 6563 7469 6f6e ics/intersection │ │ │ -000e8950: 2e70 6e67 293c 2f64 6976 3e0a 3c64 6c20 .png)
    .
    .< │ │ │ -000e8970: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    re │ │ │ -000e8990: 6374 313c 2f63 6f64 653e 202d 2046 6972 ct1 - Fir │ │ │ -000e89a0: 7374 2072 6563 7461 6e67 6c65 3c2f 6464 st rectangle
    .
    rect │ │ │ -000e89c0: 323c 2f63 6f64 653e 202d 2053 6563 6f6e 2 - Secon │ │ │ -000e89d0: 6420 7265 6374 616e 676c 653c 2f64 643e d rectangle
    │ │ │ -000e89e0: 0a3c 6464 3e3c 636f 6465 3e69 6e74 6572 .
    inter │ │ │ -000e89f0: 7365 6374 696e 6752 6567 696f 6e3c 2f63 sectingRegion - The outpu │ │ │ -000e8a10: 7420 6172 7261 7920 6f66 2074 6865 2076 t array of the v │ │ │ -000e8a20: 6572 7469 6365 7320 6f66 2074 6865 2069 ertices of the i │ │ │ -000e8a30: 6e74 6572 7365 6374 696e 6720 7265 6769 ntersecting regi │ │ │ -000e8a40: 6f6e 2e20 4974 2072 6574 7572 6e73 0a61 on. It returns.a │ │ │ -000e8a50: 7420 6d6f 7374 2038 2076 6572 7469 6365 t most 8 vertice │ │ │ -000e8a60: 732e 2053 746f 7265 6420 6173 2073 7464 s. Stored as std │ │ │ -000e8a70: 3a3a 7665 6374 6f72 266c 743b 6376 3a3a ::vector<cv:: │ │ │ -000e8a80: 506f 696e 7432 6626 6774 3b20 6f72 2063 Point2f> or c │ │ │ -000e8a90: 763a 3a4d 6174 2061 7320 4d78 3120 6f66 v::Mat as Mx1 of │ │ │ -000e8aa0: 2074 7970 6520 4356 5f33 3246 4332 2e3c type CV_32FC2.< │ │ │ -000e8ab0: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ -000e8ac0: 3a3c 2f64 743e 0a3c 6464 3e4f 6e65 206f :
    .
    One o │ │ │ -000e8ad0: 6620 2352 6563 7461 6e67 6c65 7349 6e74 f #RectanglesInt │ │ │ -000e8ae0: 6572 7365 6374 5479 7065 733c 2f64 643e ersectTypes
    │ │ │ -000e8af0: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    .
    ..
  • .< │ │ │ -000e8b10: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .

    arcLength< │ │ │ -000e8b70: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -000e8bd0: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -000e8be0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;d │ │ │ -000e8c00: 6f75 626c 653c 2f73 7061 6e3e 266e 6273 ouble&nbs │ │ │ -000e8c10: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;arc │ │ │ -000e8c30: 4c65 6e67 7468 3c2f 7370 616e 3e3c 7762 Length(MatOfPoint2f curve,. b │ │ │ -000e8cc0: 6f6f 6c65 616e 266e 6273 703b 636c 6f73 oolean clos │ │ │ -000e8cd0: 6564 293c 2f73 7061 6e3e 3c2f 6469 763e ed)
    │ │ │ -000e8ce0: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Calculates a │ │ │ -000e8d00: 2063 6f6e 746f 7572 2070 6572 696d 6574 contour perimet │ │ │ -000e8d10: 6572 206f 7220 6120 6375 7276 6520 6c65 er or a curve le │ │ │ -000e8d20: 6e67 7468 2e0a 0a54 6865 2066 756e 6374 ngth...The funct │ │ │ -000e8d30: 696f 6e20 636f 6d70 7574 6573 2061 2063 ion computes a c │ │ │ -000e8d40: 7572 7665 206c 656e 6774 6820 6f72 2061 urve length or a │ │ │ -000e8d50: 2063 6c6f 7365 6420 636f 6e74 6f75 7220 closed contour │ │ │ -000e8d60: 7065 7269 6d65 7465 722e 3c2f 6469 763e perimeter.
    │ │ │ -000e8d70: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ -000e8d90: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    curve │ │ │ -000e8db0: 2d20 496e 7075 7420 7665 6374 6f72 206f - Input vector o │ │ │ -000e8dc0: 6620 3244 2070 6f69 6e74 732c 2073 746f f 2D points, sto │ │ │ -000e8dd0: 7265 6420 696e 2073 7464 3a3a 7665 6374 red in std::vect │ │ │ -000e8de0: 6f72 206f 7220 4d61 742e 3c2f 6464 3e0a or or Mat.
    . │ │ │ -000e8df0: 3c64 643e 3c63 6f64 653e 636c 6f73 6564
    closed │ │ │ -000e8e00: 3c2f 636f 6465 3e20 2d20 466c 6167 2069 - Flag i │ │ │ -000e8e10: 6e64 6963 6174 696e 6720 7768 6574 6865 ndicating whethe │ │ │ -000e8e20: 7220 7468 6520 6375 7276 6520 6973 2063 r the curve is c │ │ │ -000e8e30: 6c6f 7365 6420 6f72 206e 6f74 2e3c 2f64 losed or not..
    Returns:< │ │ │ -000e8e50: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
    automat │ │ │ -000e8e60: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ -000e8e70: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ..

    ..
  • .. │ │ │ -000e8ee0: 3c68 333e 636f 6e74 6f75 7241 7265 613c

    contourArea< │ │ │ -000e8ef0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -000e8f50: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -000e8f60: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;d │ │ │ -000e8f80: 6f75 626c 653c 2f73 7061 6e3e 266e 6273 ouble&nbs │ │ │ -000e8f90: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;con │ │ │ -000e8fb0: 746f 7572 4172 6561 3c2f 7370 616e 3e3c tourArea< │ │ │ -000e8fc0: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat contour,. │ │ │ -000e9030: 2062 6f6f 6c65 616e 266e 6273 703b 6f72 boolean or │ │ │ -000e9040: 6965 6e74 6564 293c 2f73 7061 6e3e 3c2f iented).
    Calculat │ │ │ -000e9070: 6573 2061 2063 6f6e 746f 7572 2061 7265 es a contour are │ │ │ -000e9080: 612e 0a0a 5468 6520 6675 6e63 7469 6f6e a...The function │ │ │ -000e9090: 2063 6f6d 7075 7465 7320 6120 636f 6e74 computes a cont │ │ │ -000e90a0: 6f75 7220 6172 6561 2e20 5369 6d69 6c61 our area. Simila │ │ │ -000e90b0: 726c 7920 746f 206d 6f6d 656e 7473 202c rly to moments , │ │ │ -000e90c0: 2074 6865 2061 7265 6120 6973 2063 6f6d the area is com │ │ │ -000e90d0: 7075 7465 6420 7573 696e 6720 7468 6520 puted using the │ │ │ -000e90e0: 4772 6565 6e0a 666f 726d 756c 612e 2054 Green.formula. T │ │ │ -000e90f0: 6875 732c 2074 6865 2072 6574 7572 6e65 hus, the returne │ │ │ -000e9100: 6420 6172 6561 2061 6e64 2074 6865 206e d area and the n │ │ │ -000e9110: 756d 6265 7220 6f66 206e 6f6e 2d7a 6572 umber of non-zer │ │ │ -000e9120: 6f20 7069 7865 6c73 2c20 6966 2079 6f75 o pixels, if you │ │ │ -000e9130: 2064 7261 7720 7468 6520 636f 6e74 6f75 draw the contou │ │ │ -000e9140: 7220 7573 696e 670a 2364 7261 7743 6f6e r using.#drawCon │ │ │ -000e9150: 746f 7572 7320 6f72 2023 6669 6c6c 506f tours or #fillPo │ │ │ -000e9160: 6c79 202c 2063 616e 2062 6520 6469 6666 ly , can be diff │ │ │ -000e9170: 6572 656e 742e 2041 6c73 6f2c 2074 6865 erent. Also, the │ │ │ -000e9180: 2066 756e 6374 696f 6e20 7769 6c6c 206d function will m │ │ │ -000e9190: 6f73 7420 6365 7274 6169 6e6c 7920 6769 ost certainly gi │ │ │ -000e91a0: 7665 2061 2077 726f 6e67 0a72 6573 756c ve a wrong.resul │ │ │ -000e91b0: 7473 2066 6f72 2063 6f6e 746f 7572 7320 ts for contours │ │ │ -000e91c0: 7769 7468 2073 656c 662d 696e 7465 7273 with self-inters │ │ │ -000e91d0: 6563 7469 6f6e 732e 0a0a 4578 616d 706c ections...Exampl │ │ │ -000e91e0: 653a 0a3c 636f 6465 3e0a 7665 6374 6f72 e:..vector │ │ │ -000e91f0: 266c 743b 506f 696e 7426 6774 3b20 636f <Point> co │ │ │ -000e9200: 6e74 6f75 723b 0a63 6f6e 746f 7572 2e70 ntour;.contour.p │ │ │ -000e9210: 7573 685f 6261 636b 2850 6f69 6e74 3266 ush_back(Point2f │ │ │ -000e9220: 2830 2c20 3029 293b 0a63 6f6e 746f 7572 (0, 0));.contour │ │ │ -000e9230: 2e70 7573 685f 6261 636b 2850 6f69 6e74 .push_back(Point │ │ │ -000e9240: 3266 2831 302c 2030 2929 3b0a 636f 6e74 2f(10, 0));.cont │ │ │ -000e9250: 6f75 722e 7075 7368 5f62 6163 6b28 506f our.push_back(Po │ │ │ -000e9260: 696e 7432 6628 3130 2c20 3130 2929 3b0a int2f(10, 10));. │ │ │ -000e9270: 636f 6e74 6f75 722e 7075 7368 5f62 6163 contour.push_bac │ │ │ -000e9280: 6b28 506f 696e 7432 6628 352c 2034 2929 k(Point2f(5, 4)) │ │ │ -000e9290: 3b0a 0a64 6f75 626c 6520 6172 6561 3020 ;..double area0 │ │ │ -000e92a0: 3d20 636f 6e74 6f75 7241 7265 6128 636f = contourArea(co │ │ │ -000e92b0: 6e74 6f75 7229 3b0a 7665 6374 6f72 266c ntour);.vector&l │ │ │ -000e92c0: 743b 506f 696e 7426 6774 3b20 6170 7072 t;Point> appr │ │ │ -000e92d0: 6f78 3b0a 6170 7072 6f78 506f 6c79 4450 ox;.approxPolyDP │ │ │ -000e92e0: 2863 6f6e 746f 7572 2c20 6170 7072 6f78 (contour, approx │ │ │ -000e92f0: 2c20 352c 2074 7275 6529 3b0a 646f 7562 , 5, true);.doub │ │ │ -000e9300: 6c65 2061 7265 6131 203d 2063 6f6e 746f le area1 = conto │ │ │ -000e9310: 7572 4172 6561 2861 7070 726f 7829 3b0a urArea(approx);. │ │ │ -000e9320: 0a63 6f75 7420 266c 743b 266c 743b 2022 .cout << " │ │ │ -000e9330: 6172 6561 3020 3d22 2026 6c74 3b26 6c74 area0 =" << │ │ │ -000e9340: 3b20 6172 6561 3020 266c 743b 266c 743b ; area0 << │ │ │ -000e9350: 2065 6e64 6c20 266c 743b 266c 743b 0a22 endl <<." │ │ │ -000e9360: 6172 6561 3120 3d22 2026 6c74 3b26 6c74 area1 =" << │ │ │ -000e9370: 3b20 6172 6561 3120 266c 743b 266c 743b ; area1 << │ │ │ -000e9380: 2065 6e64 6c20 266c 743b 266c 743b 0a22 endl <<." │ │ │ -000e9390: 6170 7072 6f78 2070 6f6c 7920 7665 7274 approx poly vert │ │ │ -000e93a0: 6963 6573 2220 266c 743b 266c 743b 2061 ices" << a │ │ │ -000e93b0: 7070 726f 782e 7369 7a65 2829 2026 6c74 pprox.size() < │ │ │ -000e93c0: 3b26 6c74 3b20 656e 646c 3b0a 3c2f 636f ;< endl;.
    .
    .
    Parameters:
    .
    cont │ │ │ -000e9410: 6f75 723c 2f63 6f64 653e 202d 2049 6e70 our - Inp │ │ │ -000e9420: 7574 2076 6563 746f 7220 6f66 2032 4420 ut vector of 2D │ │ │ -000e9430: 706f 696e 7473 2028 636f 6e74 6f75 7220 points (contour │ │ │ -000e9440: 7665 7274 6963 6573 292c 2073 746f 7265 vertices), store │ │ │ -000e9450: 6420 696e 2073 7464 3a3a 7665 6374 6f72 d in std::vector │ │ │ -000e9460: 206f 7220 4d61 742e 3c2f 6464 3e0a 3c64 or Mat.
    .oriented │ │ │ -000e9480: 3c2f 636f 6465 3e20 2d20 4f72 6965 6e74 - Orient │ │ │ -000e9490: 6564 2061 7265 6120 666c 6167 2e20 4966 ed area flag. If │ │ │ -000e94a0: 2069 7420 6973 2074 7275 652c 2074 6865 it is true, the │ │ │ -000e94b0: 2066 756e 6374 696f 6e20 7265 7475 726e function return │ │ │ -000e94c0: 7320 6120 7369 676e 6564 2061 7265 6120 s a signed area │ │ │ -000e94d0: 7661 6c75 652c 0a64 6570 656e 6469 6e67 value,.depending │ │ │ -000e94e0: 206f 6e20 7468 6520 636f 6e74 6f75 7220 on the contour │ │ │ -000e94f0: 6f72 6965 6e74 6174 696f 6e20 2863 6c6f orientation (clo │ │ │ -000e9500: 636b 7769 7365 206f 7220 636f 756e 7465 ckwise or counte │ │ │ -000e9510: 722d 636c 6f63 6b77 6973 6529 2e20 5573 r-clockwise). Us │ │ │ -000e9520: 696e 6720 7468 6973 2066 6561 7475 7265 ing this feature │ │ │ -000e9530: 2079 6f75 2063 616e 0a64 6574 6572 6d69 you can.determi │ │ │ -000e9540: 6e65 206f 7269 656e 7461 7469 6f6e 206f ne orientation o │ │ │ -000e9550: 6620 6120 636f 6e74 6f75 7220 6279 2074 f a contour by t │ │ │ -000e9560: 616b 696e 6720 7468 6520 7369 676e 206f aking the sign o │ │ │ -000e9570: 6620 616e 2061 7265 612e 2042 7920 6465 f an area. By de │ │ │ -000e9580: 6661 756c 742c 2074 6865 2070 6172 616d fault, the param │ │ │ -000e9590: 6574 6572 2069 730a 6661 6c73 652c 2077 eter is.false, w │ │ │ -000e95a0: 6869 6368 206d 6561 6e73 2074 6861 7420 hich means that │ │ │ -000e95b0: 7468 6520 6162 736f 6c75 7465 2076 616c the absolute val │ │ │ -000e95c0: 7565 2069 7320 7265 7475 726e 6564 2e3c ue is returned.< │ │ │ -000e95d0: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ -000e95e0: 3a3c 2f64 743e 0a3c 6464 3e61 7574 6f6d :
    .
    autom │ │ │ -000e95f0: 6174 6963 616c 6c79 2067 656e 6572 6174 atically generat │ │ │ -000e9600: 6564 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f ed
    .
    ... │ │ │ -000e9620: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374

  • .
  • ..

    co │ │ │ -000e9670: 6e74 6f75 7241 7265 613c 2f68 333e 0a3c ntourArea

    .< │ │ │ -000e9680: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ -000e9690: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ -000e96a0: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ -000e96b0: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ -000e96e0: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ -000e96f0: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ -000e9700: 726e 2d74 7970 6522 3e64 6f75 626c 653c rn-type">double< │ │ │ -000e9710: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> contourAr │ │ │ -000e9740: 6561 3c2f 7370 616e 3e3c 7762 723e 3c73 ea(Mat  │ │ │ -000e97b0: 3b63 6f6e 746f 7572 293c 2f73 7061 6e3e ;contour) │ │ │ -000e97c0: 3c2f 6469 763e 0a3c 6469 7620 636c 6173 .
    Calcul │ │ │ -000e97e0: 6174 6573 2061 2063 6f6e 746f 7572 2061 ates a contour a │ │ │ -000e97f0: 7265 612e 0a0a 5468 6520 6675 6e63 7469 rea...The functi │ │ │ -000e9800: 6f6e 2063 6f6d 7075 7465 7320 6120 636f on computes a co │ │ │ -000e9810: 6e74 6f75 7220 6172 6561 2e20 5369 6d69 ntour area. Simi │ │ │ -000e9820: 6c61 726c 7920 746f 206d 6f6d 656e 7473 larly to moments │ │ │ -000e9830: 202c 2074 6865 2061 7265 6120 6973 2063 , the area is c │ │ │ -000e9840: 6f6d 7075 7465 6420 7573 696e 6720 7468 omputed using th │ │ │ -000e9850: 6520 4772 6565 6e0a 666f 726d 756c 612e e Green.formula. │ │ │ -000e9860: 2054 6875 732c 2074 6865 2072 6574 7572 Thus, the retur │ │ │ -000e9870: 6e65 6420 6172 6561 2061 6e64 2074 6865 ned area and the │ │ │ -000e9880: 206e 756d 6265 7220 6f66 206e 6f6e 2d7a number of non-z │ │ │ -000e9890: 6572 6f20 7069 7865 6c73 2c20 6966 2079 ero pixels, if y │ │ │ -000e98a0: 6f75 2064 7261 7720 7468 6520 636f 6e74 ou draw the cont │ │ │ -000e98b0: 6f75 7220 7573 696e 670a 2364 7261 7743 our using.#drawC │ │ │ -000e98c0: 6f6e 746f 7572 7320 6f72 2023 6669 6c6c ontours or #fill │ │ │ -000e98d0: 506f 6c79 202c 2063 616e 2062 6520 6469 Poly , can be di │ │ │ -000e98e0: 6666 6572 656e 742e 2041 6c73 6f2c 2074 fferent. Also, t │ │ │ -000e98f0: 6865 2066 756e 6374 696f 6e20 7769 6c6c he function will │ │ │ -000e9900: 206d 6f73 7420 6365 7274 6169 6e6c 7920 most certainly │ │ │ -000e9910: 6769 7665 2061 2077 726f 6e67 0a72 6573 give a wrong.res │ │ │ -000e9920: 756c 7473 2066 6f72 2063 6f6e 746f 7572 ults for contour │ │ │ -000e9930: 7320 7769 7468 2073 656c 662d 696e 7465 s with self-inte │ │ │ -000e9940: 7273 6563 7469 6f6e 732e 0a0a 4578 616d rsections...Exam │ │ │ -000e9950: 706c 653a 0a3c 636f 6465 3e0a 7665 6374 ple:..vect │ │ │ -000e9960: 6f72 266c 743b 506f 696e 7426 6774 3b20 or<Point> │ │ │ -000e9970: 636f 6e74 6f75 723b 0a63 6f6e 746f 7572 contour;.contour │ │ │ -000e9980: 2e70 7573 685f 6261 636b 2850 6f69 6e74 .push_back(Point │ │ │ -000e9990: 3266 2830 2c20 3029 293b 0a63 6f6e 746f 2f(0, 0));.conto │ │ │ -000e99a0: 7572 2e70 7573 685f 6261 636b 2850 6f69 ur.push_back(Poi │ │ │ -000e99b0: 6e74 3266 2831 302c 2030 2929 3b0a 636f nt2f(10, 0));.co │ │ │ -000e99c0: 6e74 6f75 722e 7075 7368 5f62 6163 6b28 ntour.push_back( │ │ │ -000e99d0: 506f 696e 7432 6628 3130 2c20 3130 2929 Point2f(10, 10)) │ │ │ -000e99e0: 3b0a 636f 6e74 6f75 722e 7075 7368 5f62 ;.contour.push_b │ │ │ -000e99f0: 6163 6b28 506f 696e 7432 6628 352c 2034 ack(Point2f(5, 4 │ │ │ -000e9a00: 2929 3b0a 0a64 6f75 626c 6520 6172 6561 ));..double area │ │ │ -000e9a10: 3020 3d20 636f 6e74 6f75 7241 7265 6128 0 = contourArea( │ │ │ -000e9a20: 636f 6e74 6f75 7229 3b0a 7665 6374 6f72 contour);.vector │ │ │ -000e9a30: 266c 743b 506f 696e 7426 6774 3b20 6170 <Point> ap │ │ │ -000e9a40: 7072 6f78 3b0a 6170 7072 6f78 506f 6c79 prox;.approxPoly │ │ │ -000e9a50: 4450 2863 6f6e 746f 7572 2c20 6170 7072 DP(contour, appr │ │ │ -000e9a60: 6f78 2c20 352c 2074 7275 6529 3b0a 646f ox, 5, true);.do │ │ │ -000e9a70: 7562 6c65 2061 7265 6131 203d 2063 6f6e uble area1 = con │ │ │ -000e9a80: 746f 7572 4172 6561 2861 7070 726f 7829 tourArea(approx) │ │ │ -000e9a90: 3b0a 0a63 6f75 7420 266c 743b 266c 743b ;..cout << │ │ │ -000e9aa0: 2022 6172 6561 3020 3d22 2026 6c74 3b26 "area0 =" <& │ │ │ -000e9ab0: 6c74 3b20 6172 6561 3020 266c 743b 266c lt; area0 <&l │ │ │ -000e9ac0: 743b 2065 6e64 6c20 266c 743b 266c 743b t; endl << │ │ │ -000e9ad0: 0a22 6172 6561 3120 3d22 2026 6c74 3b26 ."area1 =" <& │ │ │ -000e9ae0: 6c74 3b20 6172 6561 3120 266c 743b 266c lt; area1 <&l │ │ │ -000e9af0: 743b 2065 6e64 6c20 266c 743b 266c 743b t; endl << │ │ │ -000e9b00: 0a22 6170 7072 6f78 2070 6f6c 7920 7665 ."approx poly ve │ │ │ -000e9b10: 7274 6963 6573 2220 266c 743b 266c 743b rtices" << │ │ │ -000e9b20: 2061 7070 726f 782e 7369 7a65 2829 2026 approx.size() & │ │ │ -000e9b30: 6c74 3b26 6c74 3b20 656e 646c 3b0a 3c2f lt;< endl;.
    .
    .< │ │ │ -000e9b60: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    co │ │ │ -000e9b80: 6e74 6f75 723c 2f63 6f64 653e 202d 2049 ntour - I │ │ │ -000e9b90: 6e70 7574 2076 6563 746f 7220 6f66 2032 nput vector of 2 │ │ │ -000e9ba0: 4420 706f 696e 7473 2028 636f 6e74 6f75 D points (contou │ │ │ -000e9bb0: 7220 7665 7274 6963 6573 292c 2073 746f r vertices), sto │ │ │ -000e9bc0: 7265 6420 696e 2073 7464 3a3a 7665 6374 red in std::vect │ │ │ -000e9bd0: 6f72 206f 7220 4d61 742e 0a64 6570 656e or or Mat..depen │ │ │ -000e9be0: 6469 6e67 206f 6e20 7468 6520 636f 6e74 ding on the cont │ │ │ -000e9bf0: 6f75 7220 6f72 6965 6e74 6174 696f 6e20 our orientation │ │ │ -000e9c00: 2863 6c6f 636b 7769 7365 206f 7220 636f (clockwise or co │ │ │ -000e9c10: 756e 7465 722d 636c 6f63 6b77 6973 6529 unter-clockwise) │ │ │ -000e9c20: 2e20 5573 696e 6720 7468 6973 2066 6561 . Using this fea │ │ │ -000e9c30: 7475 7265 2079 6f75 2063 616e 0a64 6574 ture you can.det │ │ │ -000e9c40: 6572 6d69 6e65 206f 7269 656e 7461 7469 ermine orientati │ │ │ -000e9c50: 6f6e 206f 6620 6120 636f 6e74 6f75 7220 on of a contour │ │ │ -000e9c60: 6279 2074 616b 696e 6720 7468 6520 7369 by taking the si │ │ │ -000e9c70: 676e 206f 6620 616e 2061 7265 612e 2042 gn of an area. B │ │ │ -000e9c80: 7920 6465 6661 756c 742c 2074 6865 2070 y default, the p │ │ │ -000e9c90: 6172 616d 6574 6572 2069 730a 6661 6c73 arameter is.fals │ │ │ -000e9ca0: 652c 2077 6869 6368 206d 6561 6e73 2074 e, which means t │ │ │ -000e9cb0: 6861 7420 7468 6520 6162 736f 6c75 7465 hat the absolute │ │ │ -000e9cc0: 2076 616c 7565 2069 7320 7265 7475 726e value is return │ │ │ -000e9cd0: 6564 2e3c 2f64 643e 0a3c 6474 3e52 6574 ed.
    .
    Ret │ │ │ -000e9ce0: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e61 urns:
    .
    a │ │ │ -000e9cf0: 7574 6f6d 6174 6963 616c 6c79 2067 656e utomatically gen │ │ │ -000e9d00: 6572 6174 6564 3c2f 6464 3e0a 3c2f 646c erated
    .
    ...
  • .
  • .< │ │ │ -000e9d30: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ -000e9d40: 6574 6169 6c22 2069 643d 2262 6f75 6e64 etail" id="bound │ │ │ -000e9d50: 696e 6752 6563 7428 6f72 672e 6f70 656e ingRect(org.open │ │ │ -000e9d60: 6376 2e63 6f72 652e 4d61 7429 223e 0a3c cv.core.Mat)">.< │ │ │ -000e9d70: 6833 3e62 6f75 6e64 696e 6752 6563 743c h3>boundingRect< │ │ │ -000e9d80: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ -000e9de0: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ -000e9df0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;< │ │ │ -000e9e10: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000e9e20: 5265 6374 2e68 746d 6c22 2074 6974 6c65 Rect.html" title │ │ │ -000e9e30: 3d22 636c 6173 7320 696e 206f 7267 2e6f ="class in org.o │ │ │ -000e9e40: 7065 6e63 762e 636f 7265 223e 5265 6374 pencv.core">Rect │ │ │ -000e9e50: 3c2f 613e 3c2f 7370 616e 3e26 6e62 7370   │ │ │ -000e9e60: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;boun │ │ │ -000e9e80: 6469 6e67 5265 6374 3c2f 7370 616e 3e3c dingRect< │ │ │ -000e9e90: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat array)
    .
    Ca │ │ │ -000e9f20: 6c63 756c 6174 6573 2074 6865 2075 702d lculates the up- │ │ │ -000e9f30: 7269 6768 7420 626f 756e 6469 6e67 2072 right bounding r │ │ │ -000e9f40: 6563 7461 6e67 6c65 206f 6620 6120 706f ectangle of a po │ │ │ -000e9f50: 696e 7420 7365 7420 6f72 206e 6f6e 2d7a int set or non-z │ │ │ -000e9f60: 6572 6f20 7069 7865 6c73 206f 6620 6772 ero pixels of gr │ │ │ -000e9f70: 6179 2d73 6361 6c65 2069 6d61 6765 2e0a ay-scale image.. │ │ │ -000e9f80: 0a54 6865 2066 756e 6374 696f 6e20 6361 .The function ca │ │ │ -000e9f90: 6c63 756c 6174 6573 2061 6e64 2072 6574 lculates and ret │ │ │ -000e9fa0: 7572 6e73 2074 6865 206d 696e 696d 616c urns the minimal │ │ │ -000e9fb0: 2075 702d 7269 6768 7420 626f 756e 6469 up-right boundi │ │ │ -000e9fc0: 6e67 2072 6563 7461 6e67 6c65 2066 6f72 ng rectangle for │ │ │ -000e9fd0: 2074 6865 2073 7065 6369 6669 6564 2070 the specified p │ │ │ -000e9fe0: 6f69 6e74 2073 6574 206f 720a 6e6f 6e2d oint set or.non- │ │ │ -000e9ff0: 7a65 726f 2070 6978 656c 7320 6f66 2067 zero pixels of g │ │ │ -000ea000: 7261 792d 7363 616c 6520 696d 6167 652e ray-scale image. │ │ │ -000ea010: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -000ea030: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000ea040: 6464 3e3c 636f 6465 3e61 7272 6179 3c2f dd>array - Input gr │ │ │ -000ea060: 6179 2d73 6361 6c65 2069 6d61 6765 206f ay-scale image o │ │ │ -000ea070: 7220 3244 2070 6f69 6e74 2073 6574 2c20 r 2D point set, │ │ │ -000ea080: 7374 6f72 6564 2069 6e20 7374 643a 3a76 stored in std::v │ │ │ -000ea090: 6563 746f 7220 6f72 204d 6174 2e3c 2f64 ector or Mat..
    Returns:< │ │ │ -000ea0b0: 2f64 743e 0a3c 6464 3e61 7574 6f6d 6174 /dt>.
    automat │ │ │ -000ea0c0: 6963 616c 6c79 2067 656e 6572 6174 6564 ically generated │ │ │ -000ea0d0: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ....
  • .. │ │ │ -000ea150: 3c68 333e 6765 7452 6f74 6174 696f 6e4d

    getRotationM │ │ │ -000ea160: 6174 7269 7832 443c 2f68 333e 0a3c 6469 atrix2D

    ..public static │ │ │ -000ea1d0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  Mat getRotationMat │ │ │ -000ea270: 7269 7832 443c 2f73 7061 6e3e 3c77 6272 rix2D(Point center,. │ │ │ -000ea2f0: 2064 6f75 626c 6526 6e62 7370 3b61 6e67 double ang │ │ │ -000ea300: 6c65 2c0a 2064 6f75 626c 6526 6e62 7370 le,. double  │ │ │ -000ea310: 3b73 6361 6c65 293c 2f73 7061 6e3e 3c2f ;scale).
    Calculat │ │ │ -000ea340: 6573 2061 6e20 6166 6669 6e65 206d 6174 es an affine mat │ │ │ -000ea350: 7269 7820 6f66 2032 4420 726f 7461 7469 rix of 2D rotati │ │ │ -000ea360: 6f6e 2e0a 0a54 6865 2066 756e 6374 696f on...The functio │ │ │ -000ea370: 6e20 6361 6c63 756c 6174 6573 2074 6865 n calculates the │ │ │ -000ea380: 2066 6f6c 6c6f 7769 6e67 206d 6174 7269 following matri │ │ │ -000ea390: 783a 0a0a 5c28 5c62 6567 696e 7b62 6d61 x:..\(\begin{bma │ │ │ -000ea3a0: 7472 6978 7d20 5c61 6c70 6861 2026 616d trix} \alpha &am │ │ │ -000ea3b0: 703b 2020 5c62 6574 6120 2661 6d70 3b20 p; \beta & │ │ │ -000ea3c0: 2831 2d20 5c61 6c70 6861 2029 2020 5c63 (1- \alpha ) \c │ │ │ -000ea3d0: 646f 7420 5c74 6578 7474 747b 6365 6e74 dot \texttt{cent │ │ │ -000ea3e0: 6572 2e78 7d20 2d20 205c 6265 7461 205c er.x} - \beta \ │ │ │ -000ea3f0: 6364 6f74 205c 7465 7874 7474 7b63 656e cdot \texttt{cen │ │ │ -000ea400: 7465 722e 797d 205c 5c20 2d20 5c62 6574 ter.y} \\ - \bet │ │ │ -000ea410: 6120 2661 6d70 3b20 205c 616c 7068 6120 a & \alpha │ │ │ -000ea420: 2661 6d70 3b20 205c 6265 7461 205c 6364 & \beta \cd │ │ │ -000ea430: 6f74 205c 7465 7874 7474 7b63 656e 7465 ot \texttt{cente │ │ │ -000ea440: 722e 787d 202b 2028 312d 205c 616c 7068 r.x} + (1- \alph │ │ │ -000ea450: 6120 2920 205c 6364 6f74 205c 7465 7874 a ) \cdot \text │ │ │ -000ea460: 7474 7b63 656e 7465 722e 797d 205c 656e tt{center.y} \en │ │ │ -000ea470: 647b 626d 6174 7269 787d 5c29 0a0a 7768 d{bmatrix}\)..wh │ │ │ -000ea480: 6572 650a 0a5c 285c 6265 6769 6e7b 6172 ere..\(\begin{ar │ │ │ -000ea490: 7261 797d 7b6c 7d20 5c61 6c70 6861 203d ray}{l} \alpha = │ │ │ -000ea4a0: 2020 5c74 6578 7474 747b 7363 616c 657d \texttt{scale} │ │ │ -000ea4b0: 205c 6364 6f74 205c 636f 7320 5c74 6578 \cdot \cos \tex │ │ │ -000ea4c0: 7474 747b 616e 676c 657d 202c 205c 5c20 ttt{angle} , \\ │ │ │ -000ea4d0: 5c62 6574 6120 3d20 205c 7465 7874 7474 \beta = \texttt │ │ │ -000ea4e0: 7b73 6361 6c65 7d20 5c63 646f 7420 5c73 {scale} \cdot \s │ │ │ -000ea4f0: 696e 205c 7465 7874 7474 7b61 6e67 6c65 in \texttt{angle │ │ │ -000ea500: 7d20 5c65 6e64 7b61 7272 6179 7d5c 290a } \end{array}\). │ │ │ -000ea510: 0a54 6865 2074 7261 6e73 666f 726d 6174 .The transformat │ │ │ -000ea520: 696f 6e20 6d61 7073 2074 6865 2072 6f74 ion maps the rot │ │ │ -000ea530: 6174 696f 6e20 6365 6e74 6572 2074 6f20 ation center to │ │ │ -000ea540: 6974 7365 6c66 2e20 4966 2074 6869 7320 itself. If this │ │ │ -000ea550: 6973 206e 6f74 2074 6865 2074 6172 6765 is not the targe │ │ │ -000ea560: 742c 2061 646a 7573 7420 7468 6520 7368 t, adjust the sh │ │ │ -000ea570: 6966 742e 3c2f 6469 763e 0a3c 646c 2063 ift.
    .
    .Parameters:.
    cen │ │ │ -000ea5b0: 7465 723c 2f63 6f64 653e 202d 2043 656e ter - Cen │ │ │ -000ea5c0: 7465 7220 6f66 2074 6865 2072 6f74 6174 ter of the rotat │ │ │ -000ea5d0: 696f 6e20 696e 2074 6865 2073 6f75 7263 ion in the sourc │ │ │ -000ea5e0: 6520 696d 6167 652e 3c2f 6464 3e0a 3c64 e image.
    .angle - Rotation │ │ │ -000ea610: 616e 676c 6520 696e 2064 6567 7265 6573 angle in degrees │ │ │ -000ea620: 2e20 506f 7369 7469 7665 2076 616c 7565 . Positive value │ │ │ -000ea630: 7320 6d65 616e 2063 6f75 6e74 6572 2d63 s mean counter-c │ │ │ -000ea640: 6c6f 636b 7769 7365 2072 6f74 6174 696f lockwise rotatio │ │ │ -000ea650: 6e20 2874 6865 0a63 6f6f 7264 696e 6174 n (the.coordinat │ │ │ -000ea660: 6520 6f72 6967 696e 2069 7320 6173 7375 e origin is assu │ │ │ -000ea670: 6d65 6420 746f 2062 6520 7468 6520 746f med to be the to │ │ │ -000ea680: 702d 6c65 6674 2063 6f72 6e65 7229 2e3c p-left corner).< │ │ │ -000ea690: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e73 /dd>.
    s │ │ │ -000ea6a0: 6361 6c65 3c2f 636f 6465 3e20 2d20 4973 cale - Is │ │ │ -000ea6b0: 6f74 726f 7069 6320 7363 616c 6520 6661 otropic scale fa │ │ │ -000ea6c0: 6374 6f72 2e0a 0a53 4545 3a20 2067 6574 ctor...SEE: get │ │ │ -000ea6d0: 4166 6669 6e65 5472 616e 7366 6f72 6d2c AffineTransform, │ │ │ -000ea6e0: 2077 6172 7041 6666 696e 652c 2074 7261 warpAffine, tra │ │ │ -000ea6f0: 6e73 666f 726d 3c2f 6464 3e0a 3c64 743e nsform
    .
    │ │ │ -000ea700: 5265 7475 726e 733a 3c2f 6474 3e0a 3c64 Returns:
    .automatically │ │ │ -000ea720: 6765 6e65 7261 7465 643c 2f64 643e 0a3c generated.< │ │ │ -000ea730: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>...
  • .
  • .
    .< │ │ │ -000ea7b0: 6833 3e69 6e76 6572 7441 6666 696e 6554 h3>invertAffineT │ │ │ -000ea7c0: 7261 6e73 666f 726d 3c2f 6833 3e0a 3c64 ransform..public stati │ │ │ -000ea830: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c void invertAffine │ │ │ -000ea890: 5472 616e 7366 6f72 6d3c 2f73 7061 6e3e Transform │ │ │ -000ea8a0: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ -000ea8c0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000ea8d0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000ea8e0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000ea8f0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat M,. Mat& │ │ │ -000ea950: 6e62 7370 3b69 4d29 3c2f 7370 616e 3e3c nbsp;iM)< │ │ │ -000ea960: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Inverts │ │ │ -000ea980: 2061 6e20 6166 6669 6e65 2074 7261 6e73 an affine trans │ │ │ -000ea990: 666f 726d 6174 696f 6e2e 0a0a 5468 6520 formation...The │ │ │ -000ea9a0: 6675 6e63 7469 6f6e 2063 6f6d 7075 7465 function compute │ │ │ -000ea9b0: 7320 616e 2069 6e76 6572 7365 2061 6666 s an inverse aff │ │ │ -000ea9c0: 696e 6520 7472 616e 7366 6f72 6d61 7469 ine transformati │ │ │ -000ea9d0: 6f6e 2072 6570 7265 7365 6e74 6564 2062 on represented b │ │ │ -000ea9e0: 7920 5c28 3220 5c74 696d 6573 2033 5c29 y \(2 \times 3\) │ │ │ -000ea9f0: 206d 6174 7269 7820 4d3a 0a0a 5c28 5c62 matrix M:..\(\b │ │ │ -000eaa00: 6567 696e 7b62 6d61 7472 6978 7d20 615f egin{bmatrix} a_ │ │ │ -000eaa10: 7b31 317d 2026 616d 703b 2061 5f7b 3132 {11} & a_{12 │ │ │ -000eaa20: 7d20 2661 6d70 3b20 625f 3120 205c 5c20 } & b_1 \\ │ │ │ -000eaa30: 615f 7b32 317d 2026 616d 703b 2061 5f7b a_{21} & a_{ │ │ │ -000eaa40: 3232 7d20 2661 6d70 3b20 625f 3220 5c65 22} & b_2 \e │ │ │ -000eaa50: 6e64 7b62 6d61 7472 6978 7d5c 290a 0a54 nd{bmatrix}\)..T │ │ │ -000eaa60: 6865 2072 6573 756c 7420 6973 2061 6c73 he result is als │ │ │ -000eaa70: 6f20 6120 5c28 3220 5c74 696d 6573 2033 o a \(2 \times 3 │ │ │ -000eaa80: 5c29 206d 6174 7269 7820 6f66 2074 6865 \) matrix of the │ │ │ -000eaa90: 2073 616d 6520 7479 7065 2061 7320 4d2e same type as M. │ │ │ -000eaaa0: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ -000eaac0: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ -000eaad0: 6464 3e3c 636f 6465 3e4d 3c2f 636f 6465 dd>M - Original aff │ │ │ -000eaaf0: 696e 6520 7472 616e 7366 6f72 6d61 7469 ine transformati │ │ │ -000eab00: 6f6e 2e3c 2f64 643e 0a3c 6464 3e3c 636f on..
    iM - O │ │ │ -000eab20: 7574 7075 7420 7265 7665 7273 6520 6166 utput reverse af │ │ │ -000eab30: 6669 6e65 2074 7261 6e73 666f 726d 6174 fine transformat │ │ │ -000eab40: 696f 6e2e 3c2f 6464 3e0a 3c2f 646c 3e0a ion.
    .
    . │ │ │ -000eab50: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e .
    .
  • .
  • .. │ │ │ -000eabd0: 3c68 333e 6765 7450 6572 7370 6563 7469

    getPerspecti │ │ │ -000eabe0: 7665 5472 616e 7366 6f72 6d3c 2f68 333e veTransform

    │ │ │ -000eabf0: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ -000eac10: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ -000eac30: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ -000eac40: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ -000eac50: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ -000eac60: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;Mat getPerspec │ │ │ -000eacf0: 7469 7665 5472 616e 7366 6f72 6d3c 2f73 tiveTransform(M │ │ │ -000ead60: 6174 3c2f 613e 266e 6273 703b 7372 632c at src, │ │ │ -000ead70: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000eadb0: 743c 2f61 3e26 6e62 7370 3b64 7374 2c0a t dst,. │ │ │ -000eadc0: 2069 6e74 266e 6273 703b 736f 6c76 654d int solveM │ │ │ -000eadd0: 6574 686f 6429 3c2f 7370 616e 3e3c 2f64 ethod).
    Calculate │ │ │ -000eae00: 7320 6120 7065 7273 7065 6374 6976 6520 s a perspective │ │ │ -000eae10: 7472 616e 7366 6f72 6d20 6672 6f6d 2066 transform from f │ │ │ -000eae20: 6f75 7220 7061 6972 7320 6f66 2074 6865 our pairs of the │ │ │ -000eae30: 2063 6f72 7265 7370 6f6e 6469 6e67 2070 corresponding p │ │ │ -000eae40: 6f69 6e74 732e 0a0a 5468 6520 6675 6e63 oints...The func │ │ │ -000eae50: 7469 6f6e 2063 616c 6375 6c61 7465 7320 tion calculates │ │ │ -000eae60: 7468 6520 5c28 3320 5c74 696d 6573 2033 the \(3 \times 3 │ │ │ -000eae70: 5c29 206d 6174 7269 7820 6f66 2061 2070 \) matrix of a p │ │ │ -000eae80: 6572 7370 6563 7469 7665 2074 7261 6e73 erspective trans │ │ │ -000eae90: 666f 726d 2073 6f20 7468 6174 3a0a 0a5c form so that:..\ │ │ │ -000eaea0: 285c 6265 6769 6e7b 626d 6174 7269 787d (\begin{bmatrix} │ │ │ -000eaeb0: 2074 5f69 2078 275f 6920 5c5c 2074 5f69 t_i x'_i \\ t_i │ │ │ -000eaec0: 2079 275f 6920 5c5c 2074 5f69 205c 656e y'_i \\ t_i \en │ │ │ -000eaed0: 647b 626d 6174 7269 787d 203d 205c 7465 d{bmatrix} = \te │ │ │ -000eaee0: 7874 7474 7b6d 6170 5f6d 6174 7269 787d xttt{map_matrix} │ │ │ -000eaef0: 205c 6364 6f74 205c 6265 6769 6e7b 626d \cdot \begin{bm │ │ │ -000eaf00: 6174 7269 787d 2078 5f69 205c 5c20 795f atrix} x_i \\ y_ │ │ │ -000eaf10: 6920 5c5c 2031 205c 656e 647b 626d 6174 i \\ 1 \end{bmat │ │ │ -000eaf20: 7269 787d 5c29 0a0a 7768 6572 650a 0a5c rix}\)..where..\ │ │ │ -000eaf30: 2864 7374 2869 293d 2878 275f 692c 7927 (dst(i)=(x'_i,y' │ │ │ -000eaf40: 5f69 292c 2073 7263 2869 293d 2878 5f69 _i), src(i)=(x_i │ │ │ -000eaf50: 2c20 795f 6929 2c20 693d 302c 312c 322c , y_i), i=0,1,2, │ │ │ -000eaf60: 335c 293c 2f64 6976 3e0a 3c64 6c20 636c 3\)
    .
    .
    Parameters:
    .
    src< │ │ │ -000eafa0: 2f63 6f64 653e 202d 2043 6f6f 7264 696e /code> - Coordin │ │ │ -000eafb0: 6174 6573 206f 6620 7175 6164 7261 6e67 ates of quadrang │ │ │ -000eafc0: 6c65 2076 6572 7469 6365 7320 696e 2074 le vertices in t │ │ │ -000eafd0: 6865 2073 6f75 7263 6520 696d 6167 652e he source image. │ │ │ -000eafe0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ -000eaff0: 6473 743c 2f63 6f64 653e 202d 2043 6f6f dst - Coo │ │ │ -000eb000: 7264 696e 6174 6573 206f 6620 7468 6520 rdinates of the │ │ │ -000eb010: 636f 7272 6573 706f 6e64 696e 6720 7175 corresponding qu │ │ │ -000eb020: 6164 7261 6e67 6c65 2076 6572 7469 6365 adrangle vertice │ │ │ -000eb030: 7320 696e 2074 6865 2064 6573 7469 6e61 s in the destina │ │ │ -000eb040: 7469 6f6e 2069 6d61 6765 2e3c 2f64 643e tion image.
    │ │ │ -000eb050: 0a3c 6464 3e3c 636f 6465 3e73 6f6c 7665 .
    solve │ │ │ -000eb060: 4d65 7468 6f64 3c2f 636f 6465 3e20 2d20 Method - │ │ │ -000eb070: 6d65 7468 6f64 2070 6173 7365 6420 746f method passed to │ │ │ -000eb080: 2063 763a 3a73 6f6c 7665 2028 2344 6563 cv::solve (#Dec │ │ │ -000eb090: 6f6d 7054 7970 6573 290a 0a53 4545 3a20 ompTypes)..SEE: │ │ │ -000eb0a0: 2066 696e 6448 6f6d 6f67 7261 7068 792c findHomography, │ │ │ -000eb0b0: 2077 6172 7050 6572 7370 6563 7469 7665 warpPerspective │ │ │ -000eb0c0: 2c20 7065 7273 7065 6374 6976 6554 7261 , perspectiveTra │ │ │ -000eb0d0: 6e73 666f 726d 3c2f 6464 3e0a 3c64 743e nsform
    .
    │ │ │ -000eb0e0: 5265 7475 726e 733a 3c2f 6474 3e0a 3c64 Returns:
    .automatically │ │ │ -000eb100: 6765 6e65 7261 7465 643c 2f64 643e 0a3c generated.< │ │ │ -000eb110: 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f 7365 /dl>.
    ..
  • .
  • .
    │ │ │ -000eb190: 0a3c 6833 3e67 6574 5065 7273 7065 6374 .

    getPerspect │ │ │ -000eb1a0: 6976 6554 7261 6e73 666f 726d 3c2f 6833 iveTransform

    .
    .
    │ │ │ -000eb1f0: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ -000eb210: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ -000eb220: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;Mat< │ │ │ -000eb280: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> getPerspe │ │ │ -000eb2b0: 6374 6976 6554 7261 6e73 666f 726d 3c2f ctiveTransform( │ │ │ -000eb320: 4d61 743c 2f61 3e26 6e62 7370 3b73 7263 Mat src │ │ │ -000eb330: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ -000eb370: 6174 3c2f 613e 266e 6273 703b 6473 7429 at dst) │ │ │ -000eb380: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Calculates a pe │ │ │ -000eb3b0: 7273 7065 6374 6976 6520 7472 616e 7366 rspective transf │ │ │ -000eb3c0: 6f72 6d20 6672 6f6d 2066 6f75 7220 7061 orm from four pa │ │ │ -000eb3d0: 6972 7320 6f66 2074 6865 2063 6f72 7265 irs of the corre │ │ │ -000eb3e0: 7370 6f6e 6469 6e67 2070 6f69 6e74 732e sponding points. │ │ │ -000eb3f0: 0a0a 5468 6520 6675 6e63 7469 6f6e 2063 ..The function c │ │ │ -000eb400: 616c 6375 6c61 7465 7320 7468 6520 5c28 alculates the \( │ │ │ -000eb410: 3320 5c74 696d 6573 2033 5c29 206d 6174 3 \times 3\) mat │ │ │ -000eb420: 7269 7820 6f66 2061 2070 6572 7370 6563 rix of a perspec │ │ │ -000eb430: 7469 7665 2074 7261 6e73 666f 726d 2073 tive transform s │ │ │ -000eb440: 6f20 7468 6174 3a0a 0a5c 285c 6265 6769 o that:..\(\begi │ │ │ -000eb450: 6e7b 626d 6174 7269 787d 2074 5f69 2078 n{bmatrix} t_i x │ │ │ -000eb460: 275f 6920 5c5c 2074 5f69 2079 275f 6920 '_i \\ t_i y'_i │ │ │ -000eb470: 5c5c 2074 5f69 205c 656e 647b 626d 6174 \\ t_i \end{bmat │ │ │ -000eb480: 7269 787d 203d 205c 7465 7874 7474 7b6d rix} = \texttt{m │ │ │ -000eb490: 6170 5f6d 6174 7269 787d 205c 6364 6f74 ap_matrix} \cdot │ │ │ -000eb4a0: 205c 6265 6769 6e7b 626d 6174 7269 787d \begin{bmatrix} │ │ │ -000eb4b0: 2078 5f69 205c 5c20 795f 6920 5c5c 2031 x_i \\ y_i \\ 1 │ │ │ -000eb4c0: 205c 656e 647b 626d 6174 7269 787d 5c29 \end{bmatrix}\) │ │ │ -000eb4d0: 0a0a 7768 6572 650a 0a5c 2864 7374 2869 ..where..\(dst(i │ │ │ -000eb4e0: 293d 2878 275f 692c 7927 5f69 292c 2073 )=(x'_i,y'_i), s │ │ │ -000eb4f0: 7263 2869 293d 2878 5f69 2c20 795f 6929 rc(i)=(x_i, y_i) │ │ │ -000eb500: 2c20 693d 302c 312c 322c 335c 293c 2f64 , i=0,1,2,3\).
    .
    Param │ │ │ -000eb530: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ -000eb540: 3c63 6f64 653e 7372 633c 2f63 6f64 653e src │ │ │ -000eb550: 202d 2043 6f6f 7264 696e 6174 6573 206f - Coordinates o │ │ │ -000eb560: 6620 7175 6164 7261 6e67 6c65 2076 6572 f quadrangle ver │ │ │ -000eb570: 7469 6365 7320 696e 2074 6865 2073 6f75 tices in the sou │ │ │ -000eb580: 7263 6520 696d 6167 652e 3c2f 6464 3e0a rce image.
    . │ │ │ -000eb590: 3c64 643e 3c63 6f64 653e 6473 743c 2f63
    dst - Coordinat │ │ │ -000eb5b0: 6573 206f 6620 7468 6520 636f 7272 6573 es of the corres │ │ │ -000eb5c0: 706f 6e64 696e 6720 7175 6164 7261 6e67 ponding quadrang │ │ │ -000eb5d0: 6c65 2076 6572 7469 6365 7320 696e 2074 le vertices in t │ │ │ -000eb5e0: 6865 2064 6573 7469 6e61 7469 6f6e 2069 he destination i │ │ │ -000eb5f0: 6d61 6765 2e0a 0a53 4545 3a20 2066 696e mage...SEE: fin │ │ │ -000eb600: 6448 6f6d 6f67 7261 7068 792c 2077 6172 dHomography, war │ │ │ -000eb610: 7050 6572 7370 6563 7469 7665 2c20 7065 pPerspective, pe │ │ │ -000eb620: 7273 7065 6374 6976 6554 7261 6e73 666f rspectiveTransfo │ │ │ -000eb630: 726d 3c2f 6464 3e0a 3c64 743e 5265 7475 rm
    .
    Retu │ │ │ -000eb640: 726e 733a 3c2f 6474 3e0a 3c64 643e 6175 rns:
    .
    au │ │ │ -000eb650: 746f 6d61 7469 6361 6c6c 7920 6765 6e65 tomatically gene │ │ │ -000eb660: 7261 7465 643c 2f64 643e 0a3c 2f64 6c3e rated
    .
    │ │ │ -000eb670: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • ..

    ge │ │ │ -000eb700: 7441 6666 696e 6554 7261 6e73 666f 726d tAffineTransform │ │ │ -000eb710: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ -000eb770: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -000eb780: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -000eb7a0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ -000eb7e0: 2f61 3e3c 2f73 7061 6e3e 266e 6273 703b /a>  │ │ │ -000eb7f0: 3c73 7061 6e20 636c 6173 733d 2265 6c65 getAf │ │ │ -000eb810: 6669 6e65 5472 616e 7366 6f72 6d3c 2f73 fineTransform(MatOfPoi │ │ │ -000eb890: 6e74 3266 3c2f 613e 266e 6273 703b 7372 nt2f sr │ │ │ -000eb8a0: 632c 0a20 3c61 2068 7265 663d 222e 2e2f c,. MatOfPo │ │ │ -000eb8f0: 696e 7432 663c 2f61 3e26 6e62 7370 3b64 int2f d │ │ │ -000eb900: 7374 293c 2f73 7061 6e3e 3c2f 6469 763e st)
    │ │ │ +000c0e70: 223e 4d61 743c 2f61 3e26 6e62 7370 3b69 ">Mat i │ │ │ +000c0e80: 6e6c 6965 7273 2c0a 2069 6e74 266e 6273 nliers,. int&nbs │ │ │ +000c0e90: 703b 6d65 7468 6f64 2c0a 2064 6f75 626c p;method,. doubl │ │ │ +000c0ea0: 6526 6e62 7370 3b72 616e 7361 6352 6570 e ransacRep │ │ │ +000c0eb0: 726f 6a54 6872 6573 686f 6c64 2c0a 206c rojThreshold,. l │ │ │ +000c0ec0: 6f6e 6726 6e62 7370 3b6d 6178 4974 6572 ong maxIter │ │ │ +000c0ed0: 7329 3c2f 7370 616e 3e3c 2f64 6976 3e0a s)
    . │ │ │ +000c0ee0: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Computes an o │ │ │ +000c0f00: 7074 696d 616c 2061 6666 696e 6520 7472 ptimal affine tr │ │ │ +000c0f10: 616e 7366 6f72 6d61 7469 6f6e 2062 6574 ansformation bet │ │ │ +000c0f20: 7765 656e 2074 776f 2032 4420 706f 696e ween two 2D poin │ │ │ +000c0f30: 7420 7365 7473 2e0a 0a49 7420 636f 6d70 t sets...It comp │ │ │ +000c0f40: 7574 6573 0a5c 280a 5c62 6567 696e 7b62 utes.\(.\begin{b │ │ │ +000c0f50: 6d61 7472 6978 7d0a 785c 5c0a 795c 5c0a matrix}.x\\.y\\. │ │ │ +000c0f60: 5c65 6e64 7b62 6d61 7472 6978 7d0a 3d0a \end{bmatrix}.=. │ │ │ +000c0f70: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ +000c0f80: 615f 7b31 317d 2026 616d 703b 2061 5f7b a_{11} & a_{ │ │ │ +000c0f90: 3132 7d5c 5c0a 615f 7b32 317d 2026 616d 12}\\.a_{21} &am │ │ │ +000c0fa0: 703b 2061 5f7b 3232 7d5c 5c0a 5c65 6e64 p; a_{22}\\.\end │ │ │ +000c0fb0: 7b62 6d61 7472 6978 7d0a 5c62 6567 696e {bmatrix}.\begin │ │ │ +000c0fc0: 7b62 6d61 7472 6978 7d0a 585c 5c0a 595c {bmatrix}.X\\.Y\ │ │ │ +000c0fd0: 5c0a 5c65 6e64 7b62 6d61 7472 6978 7d0a \.\end{bmatrix}. │ │ │ +000c0fe0: 2b0a 5c62 6567 696e 7b62 6d61 7472 6978 +.\begin{bmatrix │ │ │ +000c0ff0: 7d0a 625f 315c 5c0a 625f 325c 5c0a 5c65 }.b_1\\.b_2\\.\e │ │ │ +000c1000: 6e64 7b62 6d61 7472 6978 7d0a 5c29 3c2f nd{bmatrix}.\).
    .
    Para │ │ │ +000c1030: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    from - First input │ │ │ +000c1060: 2032 4420 706f 696e 7420 7365 7420 636f 2D point set co │ │ │ +000c1070: 6e74 6169 6e69 6e67 205c 2828 582c 5929 ntaining \((X,Y) │ │ │ +000c1080: 5c29 2e3c 2f64 643e 0a3c 6464 3e3c 636f \).
    .
    to - S │ │ │ +000c10a0: 6563 6f6e 6420 696e 7075 7420 3244 2070 econd input 2D p │ │ │ +000c10b0: 6f69 6e74 2073 6574 2063 6f6e 7461 696e oint set contain │ │ │ +000c10c0: 696e 6720 5c28 2878 2c79 295c 292e 3c2f ing \((x,y)\)..
    in │ │ │ +000c10e0: 6c69 6572 733c 2f63 6f64 653e 202d 204f liers - O │ │ │ +000c10f0: 7574 7075 7420 7665 6374 6f72 2069 6e64 utput vector ind │ │ │ +000c1100: 6963 6174 696e 6720 7768 6963 6820 706f icating which po │ │ │ +000c1110: 696e 7473 2061 7265 2069 6e6c 6965 7273 ints are inliers │ │ │ +000c1120: 2028 312d 696e 6c69 6572 2c20 302d 6f75 (1-inlier, 0-ou │ │ │ +000c1130: 746c 6965 7229 2e3c 2f64 643e 0a3c 6464 tlier).
    .
    method - Robust me │ │ │ +000c1160: 7468 6f64 2075 7365 6420 746f 2063 6f6d thod used to com │ │ │ +000c1170: 7075 7465 2074 7261 6e73 666f 726d 6174 pute transformat │ │ │ +000c1180: 696f 6e2e 2054 6865 2066 6f6c 6c6f 7769 ion. The followi │ │ │ +000c1190: 6e67 206d 6574 686f 6473 2061 7265 2070 ng methods are p │ │ │ +000c11a0: 6f73 7369 626c 653a 0a3c 756c 3e0a 2020 ossible:.
      . │ │ │ +000c11b0: 3c6c 693e 0a20 2020 5245 463a 2052 414e
    • . REF: RAN │ │ │ +000c11c0: 5341 4320 2d20 5241 4e53 4143 2d62 6173 SAC - RANSAC-bas │ │ │ +000c11d0: 6564 2072 6f62 7573 7420 6d65 7468 6f64 ed robust method │ │ │ +000c11e0: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ +000c11f0: 2020 2052 4546 3a20 4c4d 4544 5320 2d20 REF: LMEDS - │ │ │ +000c1200: 4c65 6173 742d 4d65 6469 616e 2072 6f62 Least-Median rob │ │ │ +000c1210: 7573 7420 6d65 7468 6f64 0a52 414e 5341 ust method.RANSA │ │ │ +000c1220: 4320 6973 2074 6865 2064 6566 6175 6c74 C is the default │ │ │ +000c1230: 206d 6574 686f 642e 0a20 203c 2f6c 693e method..
    • │ │ │ +000c1240: 0a3c 2f75 6c3e 3c2f 6464 3e0a 3c64 643e .
    .
    │ │ │ +000c1250: 3c63 6f64 653e 7261 6e73 6163 5265 7072 ransacRepr │ │ │ +000c1260: 6f6a 5468 7265 7368 6f6c 643c 2f63 6f64 ojThreshold - Maximum rep │ │ │ +000c1280: 726f 6a65 6374 696f 6e20 6572 726f 7220 rojection error │ │ │ +000c1290: 696e 2074 6865 2052 414e 5341 4320 616c in the RANSAC al │ │ │ +000c12a0: 676f 7269 7468 6d20 746f 2063 6f6e 7369 gorithm to consi │ │ │ +000c12b0: 6465 720a 6120 706f 696e 7420 6173 2061 der.a point as a │ │ │ +000c12c0: 6e20 696e 6c69 6572 2e20 4170 706c 6965 n inlier. Applie │ │ │ +000c12d0: 7320 6f6e 6c79 2074 6f20 5241 4e53 4143 s only to RANSAC │ │ │ +000c12e0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    maxIters │ │ │ +000c1300: 202d 2054 6865 206d 6178 696d 756d 206e - The maximum n │ │ │ +000c1310: 756d 6265 7220 6f66 2072 6f62 7573 7420 umber of robust │ │ │ +000c1320: 6d65 7468 6f64 2069 7465 7261 7469 6f6e method iteration │ │ │ +000c1330: 732e 0a62 6574 7765 656e 2030 2e39 3520 s..between 0.95 │ │ │ +000c1340: 616e 6420 302e 3939 2069 7320 7573 7561 and 0.99 is usua │ │ │ +000c1350: 6c6c 7920 676f 6f64 2065 6e6f 7567 682e lly good enough. │ │ │ +000c1360: 2056 616c 7565 7320 746f 6f20 636c 6f73 Values too clos │ │ │ +000c1370: 6520 746f 2031 2063 616e 2073 6c6f 7720 e to 1 can slow │ │ │ +000c1380: 646f 776e 2074 6865 2065 7374 696d 6174 down the estimat │ │ │ +000c1390: 696f 6e0a 7369 676e 6966 6963 616e 746c ion.significantl │ │ │ +000c13a0: 792e 2056 616c 7565 7320 6c6f 7765 7220 y. Values lower │ │ │ +000c13b0: 7468 616e 2030 2e38 2d30 2e39 2063 616e than 0.8-0.9 can │ │ │ +000c13c0: 2072 6573 756c 7420 696e 2061 6e20 696e result in an in │ │ │ +000c13d0: 636f 7272 6563 746c 7920 6573 7469 6d61 correctly estima │ │ │ +000c13e0: 7465 6420 7472 616e 7366 6f72 6d61 7469 ted transformati │ │ │ +000c13f0: 6f6e 2e0a 5061 7373 696e 6720 3020 7769 on..Passing 0 wi │ │ │ +000c1400: 6c6c 2064 6973 6162 6c65 2072 6566 696e ll disable refin │ │ │ +000c1410: 696e 672c 2073 6f20 7468 6520 6f75 7470 ing, so the outp │ │ │ +000c1420: 7574 206d 6174 7269 7820 7769 6c6c 2062 ut matrix will b │ │ │ +000c1430: 6520 6f75 7470 7574 206f 6620 726f 6275 e output of robu │ │ │ +000c1440: 7374 206d 6574 686f 642e 3c2f 6464 3e0a st method.
    . │ │ │ +000c1450: 3c64 743e 5265 7475 726e 733a 3c2f 6474
    Returns:
    .
    Output 2D │ │ │ +000c1470: 6166 6669 6e65 2074 7261 6e73 666f 726d affine transform │ │ │ +000c1480: 6174 696f 6e20 6d61 7472 6978 205c 2832 ation matrix \(2 │ │ │ +000c1490: 205c 7469 6d65 7320 335c 2920 6f72 2065 \times 3\) or e │ │ │ +000c14a0: 6d70 7479 206d 6174 7269 7820 6966 2074 mpty matrix if t │ │ │ +000c14b0: 7261 6e73 666f 726d 6174 696f 6e0a 636f ransformation.co │ │ │ +000c14c0: 756c 6420 6e6f 7420 6265 2065 7374 696d uld not be estim │ │ │ +000c14d0: 6174 6564 2e20 5468 6520 7265 7475 726e ated. The return │ │ │ +000c14e0: 6564 206d 6174 7269 7820 6861 7320 7468 ed matrix has th │ │ │ +000c14f0: 6520 666f 6c6c 6f77 696e 6720 666f 726d e following form │ │ │ +000c1500: 3a0a 5c28 0a5c 6265 6769 6e7b 626d 6174 :.\(.\begin{bmat │ │ │ +000c1510: 7269 787d 0a61 5f7b 3131 7d20 2661 6d70 rix}.a_{11} & │ │ │ +000c1520: 3b20 615f 7b31 327d 2026 616d 703b 2062 ; a_{12} & b │ │ │ +000c1530: 5f31 5c5c 0a61 5f7b 3231 7d20 2661 6d70 _1\\.a_{21} & │ │ │ +000c1540: 3b20 615f 7b32 327d 2026 616d 703b 2062 ; a_{22} & b │ │ │ +000c1550: 5f32 5c5c 0a5c 656e 647b 626d 6174 7269 _2\\.\end{bmatri │ │ │ +000c1560: 787d 0a5c 290a 0a54 6865 2066 756e 6374 x}.\)..The funct │ │ │ +000c1570: 696f 6e20 6573 7469 6d61 7465 7320 616e ion estimates an │ │ │ +000c1580: 206f 7074 696d 616c 2032 4420 6166 6669 optimal 2D affi │ │ │ +000c1590: 6e65 2074 7261 6e73 666f 726d 6174 696f ne transformatio │ │ │ +000c15a0: 6e20 6265 7477 6565 6e20 7477 6f20 3244 n between two 2D │ │ │ +000c15b0: 2070 6f69 6e74 2073 6574 7320 7573 696e point sets usin │ │ │ +000c15c0: 6720 7468 650a 7365 6c65 6374 6564 2072 g the.selected r │ │ │ +000c15d0: 6f62 7573 7420 616c 676f 7269 7468 6d2e obust algorithm. │ │ │ +000c15e0: 0a0a 5468 6520 636f 6d70 7574 6564 2074 ..The computed t │ │ │ +000c15f0: 7261 6e73 666f 726d 6174 696f 6e20 6973 ransformation is │ │ │ +000c1600: 2074 6865 6e20 7265 6669 6e65 6420 6675 then refined fu │ │ │ +000c1610: 7274 6865 7220 2875 7369 6e67 206f 6e6c rther (using onl │ │ │ +000c1620: 7920 696e 6c69 6572 7329 2077 6974 6820 y inliers) with │ │ │ +000c1630: 7468 650a 4c65 7665 6e62 6572 672d 4d61 the.Levenberg-Ma │ │ │ +000c1640: 7271 7561 7264 7420 6d65 7468 6f64 2074 rquardt method t │ │ │ +000c1650: 6f20 7265 6475 6365 2074 6865 2072 652d o reduce the re- │ │ │ +000c1660: 7072 6f6a 6563 7469 6f6e 2065 7272 6f72 projection error │ │ │ +000c1670: 2065 7665 6e20 6d6f 7265 2e0a 0a3c 623e even more... │ │ │ +000c1680: 4e6f 7465 3a3c 2f62 3e0a 5468 6520 5241 Note:.The RA │ │ │ +000c1690: 4e53 4143 206d 6574 686f 6420 6361 6e20 NSAC method can │ │ │ +000c16a0: 6861 6e64 6c65 2070 7261 6374 6963 616c handle practical │ │ │ +000c16b0: 6c79 2061 6e79 2072 6174 696f 206f 6620 ly any ratio of │ │ │ +000c16c0: 6f75 746c 6965 7273 2062 7574 206e 6565 outliers but nee │ │ │ +000c16d0: 6473 2061 2074 6872 6573 686f 6c64 2074 ds a threshold t │ │ │ +000c16e0: 6f0a 6469 7374 696e 6775 6973 6820 696e o.distinguish in │ │ │ +000c16f0: 6c69 6572 7320 6672 6f6d 206f 7574 6c69 liers from outli │ │ │ +000c1700: 6572 732e 2054 6865 206d 6574 686f 6420 ers. The method │ │ │ +000c1710: 4c4d 6544 5320 646f 6573 206e 6f74 206e LMeDS does not n │ │ │ +000c1720: 6565 6420 616e 7920 7468 7265 7368 6f6c eed any threshol │ │ │ +000c1730: 6420 6275 7420 6974 2077 6f72 6b73 0a63 d but it works.c │ │ │ +000c1740: 6f72 7265 6374 6c79 206f 6e6c 7920 7768 orrectly only wh │ │ │ +000c1750: 656e 2074 6865 7265 2061 7265 206d 6f72 en there are mor │ │ │ +000c1760: 6520 7468 616e 2035 3025 206f 6620 696e e than 50% of in │ │ │ +000c1770: 6c69 6572 732e 0a0a 5345 453a 2065 7374 liers...SEE: est │ │ │ +000c1780: 696d 6174 6541 6666 696e 6550 6172 7469 imateAffineParti │ │ │ +000c1790: 616c 3244 2c20 6765 7441 6666 696e 6554 al2D, getAffineT │ │ │ +000c17a0: 7261 6e73 666f 726d 3c2f 6464 3e0a 3c2f ransform
    ..
    ..
  • .
  • │ │ │ +000c17d0: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    esti │ │ │ +000c1850: 6d61 7465 4166 6669 6e65 3244 3c2f 6833 mateAffine2D

    .
    .
    │ │ │ +000c18a0: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +000c18c0: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +000c18d0: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;Mat< │ │ │ +000c1930: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> estimateA │ │ │ +000c1960: 6666 696e 6532 443c 2f73 7061 6e3e 3c77 ffine2D(Mat │ │ │ +000c19d0: 266e 6273 703b 6672 6f6d 2c0a 203c 6120  from,. Mat │ │ │ +000c1a20: 266e 6273 703b 746f 2c0a 203c 6120 6872  to,. Mat&n │ │ │ +000c1a70: 6273 703b 696e 6c69 6572 732c 0a20 696e bsp;inliers,. in │ │ │ +000c1a80: 7426 6e62 7370 3b6d 6574 686f 642c 0a20 t method,. │ │ │ +000c1a90: 646f 7562 6c65 266e 6273 703b 7261 6e73 double rans │ │ │ +000c1aa0: 6163 5265 7072 6f6a 5468 7265 7368 6f6c acReprojThreshol │ │ │ +000c1ab0: 6429 3c2f 7370 616e 3e3c 2f64 6976 3e0a d)
    . │ │ │ +000c1ac0: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Computes an o │ │ │ +000c1ae0: 7074 696d 616c 2061 6666 696e 6520 7472 ptimal affine tr │ │ │ +000c1af0: 616e 7366 6f72 6d61 7469 6f6e 2062 6574 ansformation bet │ │ │ +000c1b00: 7765 656e 2074 776f 2032 4420 706f 696e ween two 2D poin │ │ │ +000c1b10: 7420 7365 7473 2e0a 0a49 7420 636f 6d70 t sets...It comp │ │ │ +000c1b20: 7574 6573 0a5c 280a 5c62 6567 696e 7b62 utes.\(.\begin{b │ │ │ +000c1b30: 6d61 7472 6978 7d0a 785c 5c0a 795c 5c0a matrix}.x\\.y\\. │ │ │ +000c1b40: 5c65 6e64 7b62 6d61 7472 6978 7d0a 3d0a \end{bmatrix}.=. │ │ │ +000c1b50: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ +000c1b60: 615f 7b31 317d 2026 616d 703b 2061 5f7b a_{11} & a_{ │ │ │ +000c1b70: 3132 7d5c 5c0a 615f 7b32 317d 2026 616d 12}\\.a_{21} &am │ │ │ +000c1b80: 703b 2061 5f7b 3232 7d5c 5c0a 5c65 6e64 p; a_{22}\\.\end │ │ │ +000c1b90: 7b62 6d61 7472 6978 7d0a 5c62 6567 696e {bmatrix}.\begin │ │ │ +000c1ba0: 7b62 6d61 7472 6978 7d0a 585c 5c0a 595c {bmatrix}.X\\.Y\ │ │ │ +000c1bb0: 5c0a 5c65 6e64 7b62 6d61 7472 6978 7d0a \.\end{bmatrix}. │ │ │ +000c1bc0: 2b0a 5c62 6567 696e 7b62 6d61 7472 6978 +.\begin{bmatrix │ │ │ +000c1bd0: 7d0a 625f 315c 5c0a 625f 325c 5c0a 5c65 }.b_1\\.b_2\\.\e │ │ │ +000c1be0: 6e64 7b62 6d61 7472 6978 7d0a 5c29 3c2f nd{bmatrix}.\).
    .
    Para │ │ │ +000c1c10: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    from - First input │ │ │ +000c1c40: 2032 4420 706f 696e 7420 7365 7420 636f 2D point set co │ │ │ +000c1c50: 6e74 6169 6e69 6e67 205c 2828 582c 5929 ntaining \((X,Y) │ │ │ +000c1c60: 5c29 2e3c 2f64 643e 0a3c 6464 3e3c 636f \).
    .
    to - S │ │ │ +000c1c80: 6563 6f6e 6420 696e 7075 7420 3244 2070 econd input 2D p │ │ │ +000c1c90: 6f69 6e74 2073 6574 2063 6f6e 7461 696e oint set contain │ │ │ +000c1ca0: 696e 6720 5c28 2878 2c79 295c 292e 3c2f ing \((x,y)\)..
    in │ │ │ +000c1cc0: 6c69 6572 733c 2f63 6f64 653e 202d 204f liers - O │ │ │ +000c1cd0: 7574 7075 7420 7665 6374 6f72 2069 6e64 utput vector ind │ │ │ +000c1ce0: 6963 6174 696e 6720 7768 6963 6820 706f icating which po │ │ │ +000c1cf0: 696e 7473 2061 7265 2069 6e6c 6965 7273 ints are inliers │ │ │ +000c1d00: 2028 312d 696e 6c69 6572 2c20 302d 6f75 (1-inlier, 0-ou │ │ │ +000c1d10: 746c 6965 7229 2e3c 2f64 643e 0a3c 6464 tlier).
    .
    method - Robust me │ │ │ +000c1d40: 7468 6f64 2075 7365 6420 746f 2063 6f6d thod used to com │ │ │ +000c1d50: 7075 7465 2074 7261 6e73 666f 726d 6174 pute transformat │ │ │ +000c1d60: 696f 6e2e 2054 6865 2066 6f6c 6c6f 7769 ion. The followi │ │ │ +000c1d70: 6e67 206d 6574 686f 6473 2061 7265 2070 ng methods are p │ │ │ +000c1d80: 6f73 7369 626c 653a 0a3c 756c 3e0a 2020 ossible:.
      . │ │ │ +000c1d90: 3c6c 693e 0a20 2020 5245 463a 2052 414e
    • . REF: RAN │ │ │ +000c1da0: 5341 4320 2d20 5241 4e53 4143 2d62 6173 SAC - RANSAC-bas │ │ │ +000c1db0: 6564 2072 6f62 7573 7420 6d65 7468 6f64 ed robust method │ │ │ +000c1dc0: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ +000c1dd0: 2020 2052 4546 3a20 4c4d 4544 5320 2d20 REF: LMEDS - │ │ │ +000c1de0: 4c65 6173 742d 4d65 6469 616e 2072 6f62 Least-Median rob │ │ │ +000c1df0: 7573 7420 6d65 7468 6f64 0a52 414e 5341 ust method.RANSA │ │ │ +000c1e00: 4320 6973 2074 6865 2064 6566 6175 6c74 C is the default │ │ │ +000c1e10: 206d 6574 686f 642e 0a20 203c 2f6c 693e method..
    • │ │ │ +000c1e20: 0a3c 2f75 6c3e 3c2f 6464 3e0a 3c64 643e .
    .
    │ │ │ +000c1e30: 3c63 6f64 653e 7261 6e73 6163 5265 7072 ransacRepr │ │ │ +000c1e40: 6f6a 5468 7265 7368 6f6c 643c 2f63 6f64 ojThreshold - Maximum rep │ │ │ +000c1e60: 726f 6a65 6374 696f 6e20 6572 726f 7220 rojection error │ │ │ +000c1e70: 696e 2074 6865 2052 414e 5341 4320 616c in the RANSAC al │ │ │ +000c1e80: 676f 7269 7468 6d20 746f 2063 6f6e 7369 gorithm to consi │ │ │ +000c1e90: 6465 720a 6120 706f 696e 7420 6173 2061 der.a point as a │ │ │ +000c1ea0: 6e20 696e 6c69 6572 2e20 4170 706c 6965 n inlier. Applie │ │ │ +000c1eb0: 7320 6f6e 6c79 2074 6f20 5241 4e53 4143 s only to RANSAC │ │ │ +000c1ec0: 2e0a 6265 7477 6565 6e20 302e 3935 2061 ..between 0.95 a │ │ │ +000c1ed0: 6e64 2030 2e39 3920 6973 2075 7375 616c nd 0.99 is usual │ │ │ +000c1ee0: 6c79 2067 6f6f 6420 656e 6f75 6768 2e20 ly good enough. │ │ │ +000c1ef0: 5661 6c75 6573 2074 6f6f 2063 6c6f 7365 Values too close │ │ │ +000c1f00: 2074 6f20 3120 6361 6e20 736c 6f77 2064 to 1 can slow d │ │ │ +000c1f10: 6f77 6e20 7468 6520 6573 7469 6d61 7469 own the estimati │ │ │ +000c1f20: 6f6e 0a73 6967 6e69 6669 6361 6e74 6c79 on.significantly │ │ │ +000c1f30: 2e20 5661 6c75 6573 206c 6f77 6572 2074 . Values lower t │ │ │ +000c1f40: 6861 6e20 302e 382d 302e 3920 6361 6e20 han 0.8-0.9 can │ │ │ +000c1f50: 7265 7375 6c74 2069 6e20 616e 2069 6e63 result in an inc │ │ │ +000c1f60: 6f72 7265 6374 6c79 2065 7374 696d 6174 orrectly estimat │ │ │ +000c1f70: 6564 2074 7261 6e73 666f 726d 6174 696f ed transformatio │ │ │ +000c1f80: 6e2e 0a50 6173 7369 6e67 2030 2077 696c n..Passing 0 wil │ │ │ +000c1f90: 6c20 6469 7361 626c 6520 7265 6669 6e69 l disable refini │ │ │ +000c1fa0: 6e67 2c20 736f 2074 6865 206f 7574 7075 ng, so the outpu │ │ │ +000c1fb0: 7420 6d61 7472 6978 2077 696c 6c20 6265 t matrix will be │ │ │ +000c1fc0: 206f 7574 7075 7420 6f66 2072 6f62 7573 output of robus │ │ │ +000c1fd0: 7420 6d65 7468 6f64 2e3c 2f64 643e 0a3c t method.
    .< │ │ │ +000c1fe0: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ +000c1ff0: 0a3c 6464 3e4f 7574 7075 7420 3244 2061 .
    Output 2D a │ │ │ +000c2000: 6666 696e 6520 7472 616e 7366 6f72 6d61 ffine transforma │ │ │ +000c2010: 7469 6f6e 206d 6174 7269 7820 5c28 3220 tion matrix \(2 │ │ │ +000c2020: 5c74 696d 6573 2033 5c29 206f 7220 656d \times 3\) or em │ │ │ +000c2030: 7074 7920 6d61 7472 6978 2069 6620 7472 pty matrix if tr │ │ │ +000c2040: 616e 7366 6f72 6d61 7469 6f6e 0a63 6f75 ansformation.cou │ │ │ +000c2050: 6c64 206e 6f74 2062 6520 6573 7469 6d61 ld not be estima │ │ │ +000c2060: 7465 642e 2054 6865 2072 6574 7572 6e65 ted. The returne │ │ │ +000c2070: 6420 6d61 7472 6978 2068 6173 2074 6865 d matrix has the │ │ │ +000c2080: 2066 6f6c 6c6f 7769 6e67 2066 6f72 6d3a following form: │ │ │ +000c2090: 0a5c 280a 5c62 6567 696e 7b62 6d61 7472 .\(.\begin{bmatr │ │ │ +000c20a0: 6978 7d0a 615f 7b31 317d 2026 616d 703b ix}.a_{11} & │ │ │ +000c20b0: 2061 5f7b 3132 7d20 2661 6d70 3b20 625f a_{12} & b_ │ │ │ +000c20c0: 315c 5c0a 615f 7b32 317d 2026 616d 703b 1\\.a_{21} & │ │ │ +000c20d0: 2061 5f7b 3232 7d20 2661 6d70 3b20 625f a_{22} & b_ │ │ │ +000c20e0: 325c 5c0a 5c65 6e64 7b62 6d61 7472 6978 2\\.\end{bmatrix │ │ │ +000c20f0: 7d0a 5c29 0a0a 5468 6520 6675 6e63 7469 }.\)..The functi │ │ │ +000c2100: 6f6e 2065 7374 696d 6174 6573 2061 6e20 on estimates an │ │ │ +000c2110: 6f70 7469 6d61 6c20 3244 2061 6666 696e optimal 2D affin │ │ │ +000c2120: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ +000c2130: 2062 6574 7765 656e 2074 776f 2032 4420 between two 2D │ │ │ +000c2140: 706f 696e 7420 7365 7473 2075 7369 6e67 point sets using │ │ │ +000c2150: 2074 6865 0a73 656c 6563 7465 6420 726f the.selected ro │ │ │ +000c2160: 6275 7374 2061 6c67 6f72 6974 686d 2e0a bust algorithm.. │ │ │ +000c2170: 0a54 6865 2063 6f6d 7075 7465 6420 7472 .The computed tr │ │ │ +000c2180: 616e 7366 6f72 6d61 7469 6f6e 2069 7320 ansformation is │ │ │ +000c2190: 7468 656e 2072 6566 696e 6564 2066 7572 then refined fur │ │ │ +000c21a0: 7468 6572 2028 7573 696e 6720 6f6e 6c79 ther (using only │ │ │ +000c21b0: 2069 6e6c 6965 7273 2920 7769 7468 2074 inliers) with t │ │ │ +000c21c0: 6865 0a4c 6576 656e 6265 7267 2d4d 6172 he.Levenberg-Mar │ │ │ +000c21d0: 7175 6172 6474 206d 6574 686f 6420 746f quardt method to │ │ │ +000c21e0: 2072 6564 7563 6520 7468 6520 7265 2d70 reduce the re-p │ │ │ +000c21f0: 726f 6a65 6374 696f 6e20 6572 726f 7220 rojection error │ │ │ +000c2200: 6576 656e 206d 6f72 652e 0a0a 3c62 3e4e even more...N │ │ │ +000c2210: 6f74 653a 3c2f 623e 0a54 6865 2052 414e ote:.The RAN │ │ │ +000c2220: 5341 4320 6d65 7468 6f64 2063 616e 2068 SAC method can h │ │ │ +000c2230: 616e 646c 6520 7072 6163 7469 6361 6c6c andle practicall │ │ │ +000c2240: 7920 616e 7920 7261 7469 6f20 6f66 206f y any ratio of o │ │ │ +000c2250: 7574 6c69 6572 7320 6275 7420 6e65 6564 utliers but need │ │ │ +000c2260: 7320 6120 7468 7265 7368 6f6c 6420 746f s a threshold to │ │ │ +000c2270: 0a64 6973 7469 6e67 7569 7368 2069 6e6c .distinguish inl │ │ │ +000c2280: 6965 7273 2066 726f 6d20 6f75 746c 6965 iers from outlie │ │ │ +000c2290: 7273 2e20 5468 6520 6d65 7468 6f64 204c rs. The method L │ │ │ +000c22a0: 4d65 4453 2064 6f65 7320 6e6f 7420 6e65 MeDS does not ne │ │ │ +000c22b0: 6564 2061 6e79 2074 6872 6573 686f 6c64 ed any threshold │ │ │ +000c22c0: 2062 7574 2069 7420 776f 726b 730a 636f but it works.co │ │ │ +000c22d0: 7272 6563 746c 7920 6f6e 6c79 2077 6865 rrectly only whe │ │ │ +000c22e0: 6e20 7468 6572 6520 6172 6520 6d6f 7265 n there are more │ │ │ +000c22f0: 2074 6861 6e20 3530 2520 6f66 2069 6e6c than 50% of inl │ │ │ +000c2300: 6965 7273 2e0a 0a53 4545 3a20 6573 7469 iers...SEE: esti │ │ │ +000c2310: 6d61 7465 4166 6669 6e65 5061 7274 6961 mateAffinePartia │ │ │ +000c2320: 6c32 442c 2067 6574 4166 6669 6e65 5472 l2D, getAffineTr │ │ │ +000c2330: 616e 7366 6f72 6d3c 2f64 643e 0a3c 2f64 ansform
    ..
    ..
  • .
  • . │ │ │ +000c2360: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    . │ │ │ +000c23d0: 3c68 333e 6573 7469 6d61 7465 4166 6669

    estimateAffi │ │ │ +000c23e0: 6e65 3244 3c2f 6833 3e0a 3c64 6976 2063 ne2D

    .
    .
    │ │ │ +000c2440: 7075 626c 6963 2073 7461 7469 633c 2f73 public static  │ │ │ +000c24b0: 4d61 743c 2f61 3e3c 2f73 7061 6e3e 266e Mat&n │ │ │ +000c24c0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;e │ │ │ +000c24e0: 7374 696d 6174 6541 6666 696e 6532 443c stimateAffine2D< │ │ │ +000c24f0: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat fr │ │ │ +000c2560: 6f6d 2c0a 203c 6120 6872 6566 3d22 2e2e om,. Mat to │ │ │ +000c25b0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000c25f0: 6174 3c2f 613e 266e 6273 703b 696e 6c69 at inli │ │ │ +000c2600: 6572 732c 0a20 696e 7426 6e62 7370 3b6d ers,. int m │ │ │ +000c2610: 6574 686f 6429 3c2f 7370 616e 3e3c 2f64 ethod).
    Computes │ │ │ +000c2640: 616e 206f 7074 696d 616c 2061 6666 696e an optimal affin │ │ │ +000c2650: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ +000c2660: 2062 6574 7765 656e 2074 776f 2032 4420 between two 2D │ │ │ +000c2670: 706f 696e 7420 7365 7473 2e0a 0a49 7420 point sets...It │ │ │ +000c2680: 636f 6d70 7574 6573 0a5c 280a 5c62 6567 computes.\(.\beg │ │ │ +000c2690: 696e 7b62 6d61 7472 6978 7d0a 785c 5c0a in{bmatrix}.x\\. │ │ │ +000c26a0: 795c 5c0a 5c65 6e64 7b62 6d61 7472 6978 y\\.\end{bmatrix │ │ │ +000c26b0: 7d0a 3d0a 5c62 6567 696e 7b62 6d61 7472 }.=.\begin{bmatr │ │ │ +000c26c0: 6978 7d0a 615f 7b31 317d 2026 616d 703b ix}.a_{11} & │ │ │ +000c26d0: 2061 5f7b 3132 7d5c 5c0a 615f 7b32 317d a_{12}\\.a_{21} │ │ │ +000c26e0: 2026 616d 703b 2061 5f7b 3232 7d5c 5c0a & a_{22}\\. │ │ │ +000c26f0: 5c65 6e64 7b62 6d61 7472 6978 7d0a 5c62 \end{bmatrix}.\b │ │ │ +000c2700: 6567 696e 7b62 6d61 7472 6978 7d0a 585c egin{bmatrix}.X\ │ │ │ +000c2710: 5c0a 595c 5c0a 5c65 6e64 7b62 6d61 7472 \.Y\\.\end{bmatr │ │ │ +000c2720: 6978 7d0a 2b0a 5c62 6567 696e 7b62 6d61 ix}.+.\begin{bma │ │ │ +000c2730: 7472 6978 7d0a 625f 315c 5c0a 625f 325c trix}.b_1\\.b_2\ │ │ │ +000c2740: 5c0a 5c65 6e64 7b62 6d61 7472 6978 7d0a \.\end{bmatrix}. │ │ │ +000c2750: 5c29 3c2f 6469 763e 0a3c 646c 2063 6c61 \)
    .
    .
    │ │ │ +000c2770: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ +000c2780: 0a3c 6464 3e3c 636f 6465 3e66 726f 6d3c .
    from< │ │ │ +000c2790: 2f63 6f64 653e 202d 2046 6972 7374 2069 /code> - First i │ │ │ +000c27a0: 6e70 7574 2032 4420 706f 696e 7420 7365 nput 2D point se │ │ │ +000c27b0: 7420 636f 6e74 6169 6e69 6e67 205c 2828 t containing \(( │ │ │ +000c27c0: 582c 5929 5c29 2e3c 2f64 643e 0a3c 6464 X,Y)\).
    .
    to │ │ │ +000c27e0: 202d 2053 6563 6f6e 6420 696e 7075 7420 - Second input │ │ │ +000c27f0: 3244 2070 6f69 6e74 2073 6574 2063 6f6e 2D point set con │ │ │ +000c2800: 7461 696e 696e 6720 5c28 2878 2c79 295c taining \((x,y)\ │ │ │ +000c2810: 292e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 ).
    .
    inliers │ │ │ +000c2830: 202d 204f 7574 7075 7420 7665 6374 6f72 - Output vector │ │ │ +000c2840: 2069 6e64 6963 6174 696e 6720 7768 6963 indicating whic │ │ │ +000c2850: 6820 706f 696e 7473 2061 7265 2069 6e6c h points are inl │ │ │ +000c2860: 6965 7273 2028 312d 696e 6c69 6572 2c20 iers (1-inlier, │ │ │ +000c2870: 302d 6f75 746c 6965 7229 2e3c 2f64 643e 0-outlier).
    │ │ │ +000c2880: 0a3c 6464 3e3c 636f 6465 3e6d 6574 686f .
    metho │ │ │ +000c2890: 643c 2f63 6f64 653e 202d 2052 6f62 7573 d - Robus │ │ │ +000c28a0: 7420 6d65 7468 6f64 2075 7365 6420 746f t method used to │ │ │ +000c28b0: 2063 6f6d 7075 7465 2074 7261 6e73 666f compute transfo │ │ │ +000c28c0: 726d 6174 696f 6e2e 2054 6865 2066 6f6c rmation. The fol │ │ │ +000c28d0: 6c6f 7769 6e67 206d 6574 686f 6473 2061 lowing methods a │ │ │ +000c28e0: 7265 2070 6f73 7369 626c 653a 0a3c 756c re possible:.
      .
    • . REF: │ │ │ +000c2900: 2052 414e 5341 4320 2d20 5241 4e53 4143 RANSAC - RANSAC │ │ │ +000c2910: 2d62 6173 6564 2072 6f62 7573 7420 6d65 -based robust me │ │ │ +000c2920: 7468 6f64 0a20 203c 2f6c 693e 0a20 203c thod.
    • . < │ │ │ +000c2930: 6c69 3e0a 2020 2052 4546 3a20 4c4d 4544 li>. REF: LMED │ │ │ +000c2940: 5320 2d20 4c65 6173 742d 4d65 6469 616e S - Least-Median │ │ │ +000c2950: 2072 6f62 7573 7420 6d65 7468 6f64 0a52 robust method.R │ │ │ +000c2960: 414e 5341 4320 6973 2074 6865 2064 6566 ANSAC is the def │ │ │ +000c2970: 6175 6c74 206d 6574 686f 642e 0a20 203c ault method.. < │ │ │ +000c2980: 2f6c 693e 0a3c 2f75 6c3e 0a61 2070 6f69 /li>.
    .a poi │ │ │ +000c2990: 6e74 2061 7320 616e 2069 6e6c 6965 722e nt as an inlier. │ │ │ +000c29a0: 2041 7070 6c69 6573 206f 6e6c 7920 746f Applies only to │ │ │ +000c29b0: 2052 414e 5341 432e 0a62 6574 7765 656e RANSAC..between │ │ │ +000c29c0: 2030 2e39 3520 616e 6420 302e 3939 2069 0.95 and 0.99 i │ │ │ +000c29d0: 7320 7573 7561 6c6c 7920 676f 6f64 2065 s usually good e │ │ │ +000c29e0: 6e6f 7567 682e 2056 616c 7565 7320 746f nough. Values to │ │ │ +000c29f0: 6f20 636c 6f73 6520 746f 2031 2063 616e o close to 1 can │ │ │ +000c2a00: 2073 6c6f 7720 646f 776e 2074 6865 2065 slow down the e │ │ │ +000c2a10: 7374 696d 6174 696f 6e0a 7369 676e 6966 stimation.signif │ │ │ +000c2a20: 6963 616e 746c 792e 2056 616c 7565 7320 icantly. Values │ │ │ +000c2a30: 6c6f 7765 7220 7468 616e 2030 2e38 2d30 lower than 0.8-0 │ │ │ +000c2a40: 2e39 2063 616e 2072 6573 756c 7420 696e .9 can result in │ │ │ +000c2a50: 2061 6e20 696e 636f 7272 6563 746c 7920 an incorrectly │ │ │ +000c2a60: 6573 7469 6d61 7465 6420 7472 616e 7366 estimated transf │ │ │ +000c2a70: 6f72 6d61 7469 6f6e 2e0a 5061 7373 696e ormation..Passin │ │ │ +000c2a80: 6720 3020 7769 6c6c 2064 6973 6162 6c65 g 0 will disable │ │ │ +000c2a90: 2072 6566 696e 696e 672c 2073 6f20 7468 refining, so th │ │ │ +000c2aa0: 6520 6f75 7470 7574 206d 6174 7269 7820 e output matrix │ │ │ +000c2ab0: 7769 6c6c 2062 6520 6f75 7470 7574 206f will be output o │ │ │ +000c2ac0: 6620 726f 6275 7374 206d 6574 686f 642e f robust method. │ │ │ +000c2ad0: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ +000c2ae0: 733a 3c2f 6474 3e0a 3c64 643e 4f75 7470 s:
    .
    Outp │ │ │ +000c2af0: 7574 2032 4420 6166 6669 6e65 2074 7261 ut 2D affine tra │ │ │ +000c2b00: 6e73 666f 726d 6174 696f 6e20 6d61 7472 nsformation matr │ │ │ +000c2b10: 6978 205c 2832 205c 7469 6d65 7320 335c ix \(2 \times 3\ │ │ │ +000c2b20: 2920 6f72 2065 6d70 7479 206d 6174 7269 ) or empty matri │ │ │ +000c2b30: 7820 6966 2074 7261 6e73 666f 726d 6174 x if transformat │ │ │ +000c2b40: 696f 6e0a 636f 756c 6420 6e6f 7420 6265 ion.could not be │ │ │ +000c2b50: 2065 7374 696d 6174 6564 2e20 5468 6520 estimated. The │ │ │ +000c2b60: 7265 7475 726e 6564 206d 6174 7269 7820 returned matrix │ │ │ +000c2b70: 6861 7320 7468 6520 666f 6c6c 6f77 696e has the followin │ │ │ +000c2b80: 6720 666f 726d 3a0a 5c28 0a5c 6265 6769 g form:.\(.\begi │ │ │ +000c2b90: 6e7b 626d 6174 7269 787d 0a61 5f7b 3131 n{bmatrix}.a_{11 │ │ │ +000c2ba0: 7d20 2661 6d70 3b20 615f 7b31 327d 2026 } & a_{12} & │ │ │ +000c2bb0: 616d 703b 2062 5f31 5c5c 0a61 5f7b 3231 amp; b_1\\.a_{21 │ │ │ +000c2bc0: 7d20 2661 6d70 3b20 615f 7b32 327d 2026 } & a_{22} & │ │ │ +000c2bd0: 616d 703b 2062 5f32 5c5c 0a5c 656e 647b amp; b_2\\.\end{ │ │ │ +000c2be0: 626d 6174 7269 787d 0a5c 290a 0a54 6865 bmatrix}.\)..The │ │ │ +000c2bf0: 2066 756e 6374 696f 6e20 6573 7469 6d61 function estima │ │ │ +000c2c00: 7465 7320 616e 206f 7074 696d 616c 2032 tes an optimal 2 │ │ │ +000c2c10: 4420 6166 6669 6e65 2074 7261 6e73 666f D affine transfo │ │ │ +000c2c20: 726d 6174 696f 6e20 6265 7477 6565 6e20 rmation between │ │ │ +000c2c30: 7477 6f20 3244 2070 6f69 6e74 2073 6574 two 2D point set │ │ │ +000c2c40: 7320 7573 696e 6720 7468 650a 7365 6c65 s using the.sele │ │ │ +000c2c50: 6374 6564 2072 6f62 7573 7420 616c 676f cted robust algo │ │ │ +000c2c60: 7269 7468 6d2e 0a0a 5468 6520 636f 6d70 rithm...The comp │ │ │ +000c2c70: 7574 6564 2074 7261 6e73 666f 726d 6174 uted transformat │ │ │ +000c2c80: 696f 6e20 6973 2074 6865 6e20 7265 6669 ion is then refi │ │ │ +000c2c90: 6e65 6420 6675 7274 6865 7220 2875 7369 ned further (usi │ │ │ +000c2ca0: 6e67 206f 6e6c 7920 696e 6c69 6572 7329 ng only inliers) │ │ │ +000c2cb0: 2077 6974 6820 7468 650a 4c65 7665 6e62 with the.Levenb │ │ │ +000c2cc0: 6572 672d 4d61 7271 7561 7264 7420 6d65 erg-Marquardt me │ │ │ +000c2cd0: 7468 6f64 2074 6f20 7265 6475 6365 2074 thod to reduce t │ │ │ +000c2ce0: 6865 2072 652d 7072 6f6a 6563 7469 6f6e he re-projection │ │ │ +000c2cf0: 2065 7272 6f72 2065 7665 6e20 6d6f 7265 error even more │ │ │ +000c2d00: 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a ...Note:. │ │ │ +000c2d10: 5468 6520 5241 4e53 4143 206d 6574 686f The RANSAC metho │ │ │ +000c2d20: 6420 6361 6e20 6861 6e64 6c65 2070 7261 d can handle pra │ │ │ +000c2d30: 6374 6963 616c 6c79 2061 6e79 2072 6174 ctically any rat │ │ │ +000c2d40: 696f 206f 6620 6f75 746c 6965 7273 2062 io of outliers b │ │ │ +000c2d50: 7574 206e 6565 6473 2061 2074 6872 6573 ut needs a thres │ │ │ +000c2d60: 686f 6c64 2074 6f0a 6469 7374 696e 6775 hold to.distingu │ │ │ +000c2d70: 6973 6820 696e 6c69 6572 7320 6672 6f6d ish inliers from │ │ │ +000c2d80: 206f 7574 6c69 6572 732e 2054 6865 206d outliers. The m │ │ │ +000c2d90: 6574 686f 6420 4c4d 6544 5320 646f 6573 ethod LMeDS does │ │ │ +000c2da0: 206e 6f74 206e 6565 6420 616e 7920 7468 not need any th │ │ │ +000c2db0: 7265 7368 6f6c 6420 6275 7420 6974 2077 reshold but it w │ │ │ +000c2dc0: 6f72 6b73 0a63 6f72 7265 6374 6c79 206f orks.correctly o │ │ │ +000c2dd0: 6e6c 7920 7768 656e 2074 6865 7265 2061 nly when there a │ │ │ +000c2de0: 7265 206d 6f72 6520 7468 616e 2035 3025 re more than 50% │ │ │ +000c2df0: 206f 6620 696e 6c69 6572 732e 0a0a 5345 of inliers...SE │ │ │ +000c2e00: 453a 2065 7374 696d 6174 6541 6666 696e E: estimateAffin │ │ │ +000c2e10: 6550 6172 7469 616c 3244 2c20 6765 7441 ePartial2D, getA │ │ │ +000c2e20: 6666 696e 6554 7261 6e73 666f 726d 3c2f ffineTransform.
    .
    │ │ │ +000c2e40: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
    .
  • .
  • .
    .

    estimateA │ │ │ +000c2ed0: 6666 696e 6532 443c 2f68 333e 0a3c 6469 ffine2D

    ..public static │ │ │ +000c2f40: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  Mat estimateAffine │ │ │ +000c2fe0: 3244 3c2f 7370 616e 3e3c 7762 723e 3c73 2D(Mat  │ │ │ +000c3050: 3b66 726f 6d2c 0a20 3c61 2068 7265 663d ;from,. Mat  │ │ │ +000c30a0: 3b74 6f2c 0a20 3c61 2068 7265 663d 222e ;to,. Mat i │ │ │ +000c30f0: 6e6c 6965 7273 293c 2f73 7061 6e3e 3c2f nliers).
    Computes │ │ │ +000c3120: 2061 6e20 6f70 7469 6d61 6c20 6166 6669 an optimal affi │ │ │ +000c3130: 6e65 2074 7261 6e73 666f 726d 6174 696f ne transformatio │ │ │ +000c3140: 6e20 6265 7477 6565 6e20 7477 6f20 3244 n between two 2D │ │ │ +000c3150: 2070 6f69 6e74 2073 6574 732e 0a0a 4974 point sets...It │ │ │ +000c3160: 2063 6f6d 7075 7465 730a 5c28 0a5c 6265 computes.\(.\be │ │ │ +000c3170: 6769 6e7b 626d 6174 7269 787d 0a78 5c5c gin{bmatrix}.x\\ │ │ │ +000c3180: 0a79 5c5c 0a5c 656e 647b 626d 6174 7269 .y\\.\end{bmatri │ │ │ +000c3190: 787d 0a3d 0a5c 6265 6769 6e7b 626d 6174 x}.=.\begin{bmat │ │ │ +000c31a0: 7269 787d 0a61 5f7b 3131 7d20 2661 6d70 rix}.a_{11} & │ │ │ +000c31b0: 3b20 615f 7b31 327d 5c5c 0a61 5f7b 3231 ; a_{12}\\.a_{21 │ │ │ +000c31c0: 7d20 2661 6d70 3b20 615f 7b32 327d 5c5c } & a_{22}\\ │ │ │ +000c31d0: 0a5c 656e 647b 626d 6174 7269 787d 0a5c .\end{bmatrix}.\ │ │ │ +000c31e0: 6265 6769 6e7b 626d 6174 7269 787d 0a58 begin{bmatrix}.X │ │ │ +000c31f0: 5c5c 0a59 5c5c 0a5c 656e 647b 626d 6174 \\.Y\\.\end{bmat │ │ │ +000c3200: 7269 787d 0a2b 0a5c 6265 6769 6e7b 626d rix}.+.\begin{bm │ │ │ +000c3210: 6174 7269 787d 0a62 5f31 5c5c 0a62 5f32 atrix}.b_1\\.b_2 │ │ │ +000c3220: 5c5c 0a5c 656e 647b 626d 6174 7269 787d \\.\end{bmatrix} │ │ │ +000c3230: 0a5c 293c 2f64 6976 3e0a 3c64 6c20 636c .\)
    .
    .
    Parameters:
    .
    from │ │ │ +000c3270: 3c2f 636f 6465 3e20 2d20 4669 7273 7420 - First │ │ │ +000c3280: 696e 7075 7420 3244 2070 6f69 6e74 2073 input 2D point s │ │ │ +000c3290: 6574 2063 6f6e 7461 696e 696e 6720 5c28 et containing \( │ │ │ +000c32a0: 2858 2c59 295c 292e 3c2f 6464 3e0a 3c64 (X,Y)\).
    .to - Second input │ │ │ +000c32d0: 2032 4420 706f 696e 7420 7365 7420 636f 2D point set co │ │ │ +000c32e0: 6e74 6169 6e69 6e67 205c 2828 782c 7929 ntaining \((x,y) │ │ │ +000c32f0: 5c29 2e3c 2f64 643e 0a3c 6464 3e3c 636f \)..
    inliers - Output vecto │ │ │ +000c3320: 7220 696e 6469 6361 7469 6e67 2077 6869 r indicating whi │ │ │ +000c3330: 6368 2070 6f69 6e74 7320 6172 6520 696e ch points are in │ │ │ +000c3340: 6c69 6572 7320 2831 2d69 6e6c 6965 722c liers (1-inlier, │ │ │ +000c3350: 2030 2d6f 7574 6c69 6572 292e 0a3c 756c 0-outlier)..
      .
    • . REF: │ │ │ +000c3370: 2052 414e 5341 4320 2d20 5241 4e53 4143 RANSAC - RANSAC │ │ │ +000c3380: 2d62 6173 6564 2072 6f62 7573 7420 6d65 -based robust me │ │ │ +000c3390: 7468 6f64 0a20 203c 2f6c 693e 0a20 203c thod.
    • . < │ │ │ +000c33a0: 6c69 3e0a 2020 2052 4546 3a20 4c4d 4544 li>. REF: LMED │ │ │ +000c33b0: 5320 2d20 4c65 6173 742d 4d65 6469 616e S - Least-Median │ │ │ +000c33c0: 2072 6f62 7573 7420 6d65 7468 6f64 0a52 robust method.R │ │ │ +000c33d0: 414e 5341 4320 6973 2074 6865 2064 6566 ANSAC is the def │ │ │ +000c33e0: 6175 6c74 206d 6574 686f 642e 0a20 203c ault method.. < │ │ │ +000c33f0: 2f6c 693e 0a3c 2f75 6c3e 0a61 2070 6f69 /li>.
    .a poi │ │ │ +000c3400: 6e74 2061 7320 616e 2069 6e6c 6965 722e nt as an inlier. │ │ │ +000c3410: 2041 7070 6c69 6573 206f 6e6c 7920 746f Applies only to │ │ │ +000c3420: 2052 414e 5341 432e 0a62 6574 7765 656e RANSAC..between │ │ │ +000c3430: 2030 2e39 3520 616e 6420 302e 3939 2069 0.95 and 0.99 i │ │ │ +000c3440: 7320 7573 7561 6c6c 7920 676f 6f64 2065 s usually good e │ │ │ +000c3450: 6e6f 7567 682e 2056 616c 7565 7320 746f nough. Values to │ │ │ +000c3460: 6f20 636c 6f73 6520 746f 2031 2063 616e o close to 1 can │ │ │ +000c3470: 2073 6c6f 7720 646f 776e 2074 6865 2065 slow down the e │ │ │ +000c3480: 7374 696d 6174 696f 6e0a 7369 676e 6966 stimation.signif │ │ │ +000c3490: 6963 616e 746c 792e 2056 616c 7565 7320 icantly. Values │ │ │ +000c34a0: 6c6f 7765 7220 7468 616e 2030 2e38 2d30 lower than 0.8-0 │ │ │ +000c34b0: 2e39 2063 616e 2072 6573 756c 7420 696e .9 can result in │ │ │ +000c34c0: 2061 6e20 696e 636f 7272 6563 746c 7920 an incorrectly │ │ │ +000c34d0: 6573 7469 6d61 7465 6420 7472 616e 7366 estimated transf │ │ │ +000c34e0: 6f72 6d61 7469 6f6e 2e0a 5061 7373 696e ormation..Passin │ │ │ +000c34f0: 6720 3020 7769 6c6c 2064 6973 6162 6c65 g 0 will disable │ │ │ +000c3500: 2072 6566 696e 696e 672c 2073 6f20 7468 refining, so th │ │ │ +000c3510: 6520 6f75 7470 7574 206d 6174 7269 7820 e output matrix │ │ │ +000c3520: 7769 6c6c 2062 6520 6f75 7470 7574 206f will be output o │ │ │ +000c3530: 6620 726f 6275 7374 206d 6574 686f 642e f robust method. │ │ │ +000c3540: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ +000c3550: 733a 3c2f 6474 3e0a 3c64 643e 4f75 7470 s:
    .
    Outp │ │ │ +000c3560: 7574 2032 4420 6166 6669 6e65 2074 7261 ut 2D affine tra │ │ │ +000c3570: 6e73 666f 726d 6174 696f 6e20 6d61 7472 nsformation matr │ │ │ +000c3580: 6978 205c 2832 205c 7469 6d65 7320 335c ix \(2 \times 3\ │ │ │ +000c3590: 2920 6f72 2065 6d70 7479 206d 6174 7269 ) or empty matri │ │ │ +000c35a0: 7820 6966 2074 7261 6e73 666f 726d 6174 x if transformat │ │ │ +000c35b0: 696f 6e0a 636f 756c 6420 6e6f 7420 6265 ion.could not be │ │ │ +000c35c0: 2065 7374 696d 6174 6564 2e20 5468 6520 estimated. The │ │ │ +000c35d0: 7265 7475 726e 6564 206d 6174 7269 7820 returned matrix │ │ │ +000c35e0: 6861 7320 7468 6520 666f 6c6c 6f77 696e has the followin │ │ │ +000c35f0: 6720 666f 726d 3a0a 5c28 0a5c 6265 6769 g form:.\(.\begi │ │ │ +000c3600: 6e7b 626d 6174 7269 787d 0a61 5f7b 3131 n{bmatrix}.a_{11 │ │ │ +000c3610: 7d20 2661 6d70 3b20 615f 7b31 327d 2026 } & a_{12} & │ │ │ +000c3620: 616d 703b 2062 5f31 5c5c 0a61 5f7b 3231 amp; b_1\\.a_{21 │ │ │ +000c3630: 7d20 2661 6d70 3b20 615f 7b32 327d 2026 } & a_{22} & │ │ │ +000c3640: 616d 703b 2062 5f32 5c5c 0a5c 656e 647b amp; b_2\\.\end{ │ │ │ +000c3650: 626d 6174 7269 787d 0a5c 290a 0a54 6865 bmatrix}.\)..The │ │ │ +000c3660: 2066 756e 6374 696f 6e20 6573 7469 6d61 function estima │ │ │ +000c3670: 7465 7320 616e 206f 7074 696d 616c 2032 tes an optimal 2 │ │ │ +000c3680: 4420 6166 6669 6e65 2074 7261 6e73 666f D affine transfo │ │ │ +000c3690: 726d 6174 696f 6e20 6265 7477 6565 6e20 rmation between │ │ │ +000c36a0: 7477 6f20 3244 2070 6f69 6e74 2073 6574 two 2D point set │ │ │ +000c36b0: 7320 7573 696e 6720 7468 650a 7365 6c65 s using the.sele │ │ │ +000c36c0: 6374 6564 2072 6f62 7573 7420 616c 676f cted robust algo │ │ │ +000c36d0: 7269 7468 6d2e 0a0a 5468 6520 636f 6d70 rithm...The comp │ │ │ +000c36e0: 7574 6564 2074 7261 6e73 666f 726d 6174 uted transformat │ │ │ +000c36f0: 696f 6e20 6973 2074 6865 6e20 7265 6669 ion is then refi │ │ │ +000c3700: 6e65 6420 6675 7274 6865 7220 2875 7369 ned further (usi │ │ │ +000c3710: 6e67 206f 6e6c 7920 696e 6c69 6572 7329 ng only inliers) │ │ │ +000c3720: 2077 6974 6820 7468 650a 4c65 7665 6e62 with the.Levenb │ │ │ +000c3730: 6572 672d 4d61 7271 7561 7264 7420 6d65 erg-Marquardt me │ │ │ +000c3740: 7468 6f64 2074 6f20 7265 6475 6365 2074 thod to reduce t │ │ │ +000c3750: 6865 2072 652d 7072 6f6a 6563 7469 6f6e he re-projection │ │ │ +000c3760: 2065 7272 6f72 2065 7665 6e20 6d6f 7265 error even more │ │ │ +000c3770: 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a ...Note:. │ │ │ +000c3780: 5468 6520 5241 4e53 4143 206d 6574 686f The RANSAC metho │ │ │ +000c3790: 6420 6361 6e20 6861 6e64 6c65 2070 7261 d can handle pra │ │ │ +000c37a0: 6374 6963 616c 6c79 2061 6e79 2072 6174 ctically any rat │ │ │ +000c37b0: 696f 206f 6620 6f75 746c 6965 7273 2062 io of outliers b │ │ │ +000c37c0: 7574 206e 6565 6473 2061 2074 6872 6573 ut needs a thres │ │ │ +000c37d0: 686f 6c64 2074 6f0a 6469 7374 696e 6775 hold to.distingu │ │ │ +000c37e0: 6973 6820 696e 6c69 6572 7320 6672 6f6d ish inliers from │ │ │ +000c37f0: 206f 7574 6c69 6572 732e 2054 6865 206d outliers. The m │ │ │ +000c3800: 6574 686f 6420 4c4d 6544 5320 646f 6573 ethod LMeDS does │ │ │ +000c3810: 206e 6f74 206e 6565 6420 616e 7920 7468 not need any th │ │ │ +000c3820: 7265 7368 6f6c 6420 6275 7420 6974 2077 reshold but it w │ │ │ +000c3830: 6f72 6b73 0a63 6f72 7265 6374 6c79 206f orks.correctly o │ │ │ +000c3840: 6e6c 7920 7768 656e 2074 6865 7265 2061 nly when there a │ │ │ +000c3850: 7265 206d 6f72 6520 7468 616e 2035 3025 re more than 50% │ │ │ +000c3860: 206f 6620 696e 6c69 6572 732e 0a0a 5345 of inliers...SE │ │ │ +000c3870: 453a 2065 7374 696d 6174 6541 6666 696e E: estimateAffin │ │ │ +000c3880: 6550 6172 7469 616c 3244 2c20 6765 7441 ePartial2D, getA │ │ │ +000c3890: 6666 696e 6554 7261 6e73 666f 726d 3c2f ffineTransform.
    . │ │ │ +000c38b0: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
    .
  • .
  • .
    .< │ │ │ +000c3920: 6833 3e65 7374 696d 6174 6541 6666 696e h3>estimateAffin │ │ │ +000c3930: 6532 443c 2f68 333e 0a3c 6469 7620 636c e2D.
    .
    p │ │ │ +000c3990: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static M │ │ │ +000c3a00: 6174 3c2f 613e 3c2f 7370 616e 3e26 6e62 at&nb │ │ │ +000c3a10: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;es │ │ │ +000c3a30: 7469 6d61 7465 4166 6669 6e65 3244 3c2f timateAffine2D( │ │ │ +000c3aa0: 4d61 743c 2f61 3e26 6e62 7370 3b66 726f Mat fro │ │ │ +000c3ab0: 6d2c 0a20 3c61 2068 7265 663d 222e 2e2f m,. │ │ │ +000c3af0: 4d61 743c 2f61 3e26 6e62 7370 3b74 6f29 Mat to) │ │ │ +000c3b00: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Computes an opt │ │ │ +000c3b30: 696d 616c 2061 6666 696e 6520 7472 616e imal affine tran │ │ │ +000c3b40: 7366 6f72 6d61 7469 6f6e 2062 6574 7765 sformation betwe │ │ │ +000c3b50: 656e 2074 776f 2032 4420 706f 696e 7420 en two 2D point │ │ │ +000c3b60: 7365 7473 2e0a 0a49 7420 636f 6d70 7574 sets...It comput │ │ │ +000c3b70: 6573 0a5c 280a 5c62 6567 696e 7b62 6d61 es.\(.\begin{bma │ │ │ +000c3b80: 7472 6978 7d0a 785c 5c0a 795c 5c0a 5c65 trix}.x\\.y\\.\e │ │ │ +000c3b90: 6e64 7b62 6d61 7472 6978 7d0a 3d0a 5c62 nd{bmatrix}.=.\b │ │ │ +000c3ba0: 6567 696e 7b62 6d61 7472 6978 7d0a 615f egin{bmatrix}.a_ │ │ │ +000c3bb0: 7b31 317d 2026 616d 703b 2061 5f7b 3132 {11} & a_{12 │ │ │ +000c3bc0: 7d5c 5c0a 615f 7b32 317d 2026 616d 703b }\\.a_{21} & │ │ │ +000c3bd0: 2061 5f7b 3232 7d5c 5c0a 5c65 6e64 7b62 a_{22}\\.\end{b │ │ │ +000c3be0: 6d61 7472 6978 7d0a 5c62 6567 696e 7b62 matrix}.\begin{b │ │ │ +000c3bf0: 6d61 7472 6978 7d0a 585c 5c0a 595c 5c0a matrix}.X\\.Y\\. │ │ │ +000c3c00: 5c65 6e64 7b62 6d61 7472 6978 7d0a 2b0a \end{bmatrix}.+. │ │ │ +000c3c10: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ +000c3c20: 625f 315c 5c0a 625f 325c 5c0a 5c65 6e64 b_1\\.b_2\\.\end │ │ │ +000c3c30: 7b62 6d61 7472 6978 7d0a 5c29 3c2f 6469 {bmatrix}.\).
    .
    Parame │ │ │ +000c3c60: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ +000c3c70: 636f 6465 3e66 726f 6d3c 2f63 6f64 653e code>from │ │ │ +000c3c80: 202d 2046 6972 7374 2069 6e70 7574 2032 - First input 2 │ │ │ +000c3c90: 4420 706f 696e 7420 7365 7420 636f 6e74 D point set cont │ │ │ +000c3ca0: 6169 6e69 6e67 205c 2828 582c 5929 5c29 aining \((X,Y)\) │ │ │ +000c3cb0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    to - Sec │ │ │ +000c3cd0: 6f6e 6420 696e 7075 7420 3244 2070 6f69 ond input 2D poi │ │ │ +000c3ce0: 6e74 2073 6574 2063 6f6e 7461 696e 696e nt set containin │ │ │ +000c3cf0: 6720 5c28 2878 2c79 295c 292e 0a3c 756c g \((x,y)\)..
      .
    • . REF: │ │ │ +000c3d10: 2052 414e 5341 4320 2d20 5241 4e53 4143 RANSAC - RANSAC │ │ │ +000c3d20: 2d62 6173 6564 2072 6f62 7573 7420 6d65 -based robust me │ │ │ +000c3d30: 7468 6f64 0a20 203c 2f6c 693e 0a20 203c thod.
    • . < │ │ │ +000c3d40: 6c69 3e0a 2020 2052 4546 3a20 4c4d 4544 li>. REF: LMED │ │ │ +000c3d50: 5320 2d20 4c65 6173 742d 4d65 6469 616e S - Least-Median │ │ │ +000c3d60: 2072 6f62 7573 7420 6d65 7468 6f64 0a52 robust method.R │ │ │ +000c3d70: 414e 5341 4320 6973 2074 6865 2064 6566 ANSAC is the def │ │ │ +000c3d80: 6175 6c74 206d 6574 686f 642e 0a20 203c ault method.. < │ │ │ +000c3d90: 2f6c 693e 0a3c 2f75 6c3e 0a61 2070 6f69 /li>.
    .a poi │ │ │ +000c3da0: 6e74 2061 7320 616e 2069 6e6c 6965 722e nt as an inlier. │ │ │ +000c3db0: 2041 7070 6c69 6573 206f 6e6c 7920 746f Applies only to │ │ │ +000c3dc0: 2052 414e 5341 432e 0a62 6574 7765 656e RANSAC..between │ │ │ +000c3dd0: 2030 2e39 3520 616e 6420 302e 3939 2069 0.95 and 0.99 i │ │ │ +000c3de0: 7320 7573 7561 6c6c 7920 676f 6f64 2065 s usually good e │ │ │ +000c3df0: 6e6f 7567 682e 2056 616c 7565 7320 746f nough. Values to │ │ │ +000c3e00: 6f20 636c 6f73 6520 746f 2031 2063 616e o close to 1 can │ │ │ +000c3e10: 2073 6c6f 7720 646f 776e 2074 6865 2065 slow down the e │ │ │ +000c3e20: 7374 696d 6174 696f 6e0a 7369 676e 6966 stimation.signif │ │ │ +000c3e30: 6963 616e 746c 792e 2056 616c 7565 7320 icantly. Values │ │ │ +000c3e40: 6c6f 7765 7220 7468 616e 2030 2e38 2d30 lower than 0.8-0 │ │ │ +000c3e50: 2e39 2063 616e 2072 6573 756c 7420 696e .9 can result in │ │ │ +000c3e60: 2061 6e20 696e 636f 7272 6563 746c 7920 an incorrectly │ │ │ +000c3e70: 6573 7469 6d61 7465 6420 7472 616e 7366 estimated transf │ │ │ +000c3e80: 6f72 6d61 7469 6f6e 2e0a 5061 7373 696e ormation..Passin │ │ │ +000c3e90: 6720 3020 7769 6c6c 2064 6973 6162 6c65 g 0 will disable │ │ │ +000c3ea0: 2072 6566 696e 696e 672c 2073 6f20 7468 refining, so th │ │ │ +000c3eb0: 6520 6f75 7470 7574 206d 6174 7269 7820 e output matrix │ │ │ +000c3ec0: 7769 6c6c 2062 6520 6f75 7470 7574 206f will be output o │ │ │ +000c3ed0: 6620 726f 6275 7374 206d 6574 686f 642e f robust method. │ │ │ +000c3ee0: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ +000c3ef0: 733a 3c2f 6474 3e0a 3c64 643e 4f75 7470 s:
    .
    Outp │ │ │ +000c3f00: 7574 2032 4420 6166 6669 6e65 2074 7261 ut 2D affine tra │ │ │ +000c3f10: 6e73 666f 726d 6174 696f 6e20 6d61 7472 nsformation matr │ │ │ +000c3f20: 6978 205c 2832 205c 7469 6d65 7320 335c ix \(2 \times 3\ │ │ │ +000c3f30: 2920 6f72 2065 6d70 7479 206d 6174 7269 ) or empty matri │ │ │ +000c3f40: 7820 6966 2074 7261 6e73 666f 726d 6174 x if transformat │ │ │ +000c3f50: 696f 6e0a 636f 756c 6420 6e6f 7420 6265 ion.could not be │ │ │ +000c3f60: 2065 7374 696d 6174 6564 2e20 5468 6520 estimated. The │ │ │ +000c3f70: 7265 7475 726e 6564 206d 6174 7269 7820 returned matrix │ │ │ +000c3f80: 6861 7320 7468 6520 666f 6c6c 6f77 696e has the followin │ │ │ +000c3f90: 6720 666f 726d 3a0a 5c28 0a5c 6265 6769 g form:.\(.\begi │ │ │ +000c3fa0: 6e7b 626d 6174 7269 787d 0a61 5f7b 3131 n{bmatrix}.a_{11 │ │ │ +000c3fb0: 7d20 2661 6d70 3b20 615f 7b31 327d 2026 } & a_{12} & │ │ │ +000c3fc0: 616d 703b 2062 5f31 5c5c 0a61 5f7b 3231 amp; b_1\\.a_{21 │ │ │ +000c3fd0: 7d20 2661 6d70 3b20 615f 7b32 327d 2026 } & a_{22} & │ │ │ +000c3fe0: 616d 703b 2062 5f32 5c5c 0a5c 656e 647b amp; b_2\\.\end{ │ │ │ +000c3ff0: 626d 6174 7269 787d 0a5c 290a 0a54 6865 bmatrix}.\)..The │ │ │ +000c4000: 2066 756e 6374 696f 6e20 6573 7469 6d61 function estima │ │ │ +000c4010: 7465 7320 616e 206f 7074 696d 616c 2032 tes an optimal 2 │ │ │ +000c4020: 4420 6166 6669 6e65 2074 7261 6e73 666f D affine transfo │ │ │ +000c4030: 726d 6174 696f 6e20 6265 7477 6565 6e20 rmation between │ │ │ +000c4040: 7477 6f20 3244 2070 6f69 6e74 2073 6574 two 2D point set │ │ │ +000c4050: 7320 7573 696e 6720 7468 650a 7365 6c65 s using the.sele │ │ │ +000c4060: 6374 6564 2072 6f62 7573 7420 616c 676f cted robust algo │ │ │ +000c4070: 7269 7468 6d2e 0a0a 5468 6520 636f 6d70 rithm...The comp │ │ │ +000c4080: 7574 6564 2074 7261 6e73 666f 726d 6174 uted transformat │ │ │ +000c4090: 696f 6e20 6973 2074 6865 6e20 7265 6669 ion is then refi │ │ │ +000c40a0: 6e65 6420 6675 7274 6865 7220 2875 7369 ned further (usi │ │ │ +000c40b0: 6e67 206f 6e6c 7920 696e 6c69 6572 7329 ng only inliers) │ │ │ +000c40c0: 2077 6974 6820 7468 650a 4c65 7665 6e62 with the.Levenb │ │ │ +000c40d0: 6572 672d 4d61 7271 7561 7264 7420 6d65 erg-Marquardt me │ │ │ +000c40e0: 7468 6f64 2074 6f20 7265 6475 6365 2074 thod to reduce t │ │ │ +000c40f0: 6865 2072 652d 7072 6f6a 6563 7469 6f6e he re-projection │ │ │ +000c4100: 2065 7272 6f72 2065 7665 6e20 6d6f 7265 error even more │ │ │ +000c4110: 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a ...Note:. │ │ │ +000c4120: 5468 6520 5241 4e53 4143 206d 6574 686f The RANSAC metho │ │ │ +000c4130: 6420 6361 6e20 6861 6e64 6c65 2070 7261 d can handle pra │ │ │ +000c4140: 6374 6963 616c 6c79 2061 6e79 2072 6174 ctically any rat │ │ │ +000c4150: 696f 206f 6620 6f75 746c 6965 7273 2062 io of outliers b │ │ │ +000c4160: 7574 206e 6565 6473 2061 2074 6872 6573 ut needs a thres │ │ │ +000c4170: 686f 6c64 2074 6f0a 6469 7374 696e 6775 hold to.distingu │ │ │ +000c4180: 6973 6820 696e 6c69 6572 7320 6672 6f6d ish inliers from │ │ │ +000c4190: 206f 7574 6c69 6572 732e 2054 6865 206d outliers. The m │ │ │ +000c41a0: 6574 686f 6420 4c4d 6544 5320 646f 6573 ethod LMeDS does │ │ │ +000c41b0: 206e 6f74 206e 6565 6420 616e 7920 7468 not need any th │ │ │ +000c41c0: 7265 7368 6f6c 6420 6275 7420 6974 2077 reshold but it w │ │ │ +000c41d0: 6f72 6b73 0a63 6f72 7265 6374 6c79 206f orks.correctly o │ │ │ +000c41e0: 6e6c 7920 7768 656e 2074 6865 7265 2061 nly when there a │ │ │ +000c41f0: 7265 206d 6f72 6520 7468 616e 2035 3025 re more than 50% │ │ │ +000c4200: 206f 6620 696e 6c69 6572 732e 0a0a 5345 of inliers...SE │ │ │ +000c4210: 453a 2065 7374 696d 6174 6541 6666 696e E: estimateAffin │ │ │ +000c4220: 6550 6172 7469 616c 3244 2c20 6765 7441 ePartial2D, getA │ │ │ +000c4230: 6666 696e 6554 7261 6e73 666f 726d 3c2f ffineTransform.
    .
    │ │ │ +000c4250: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
    .
  • .
  • .
    .

    estimateAf │ │ │ +000c4300: 6669 6e65 3244 3c2f 6833 3e0a 3c64 6976 fine2D

    .
    .
    public static< │ │ │ +000c4370: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> Mat │ │ │ +000c43e0: 266e 6273 703b 3c73 7061 6e20 636c 6173  estimateAffine2 │ │ │ +000c4410: 443c 2f73 7061 6e3e 3c77 6272 3e3c 7370 D(Mat  │ │ │ +000c4480: 7074 7331 2c0a 203c 6120 6872 6566 3d22 pts1,. Mat  │ │ │ +000c44d0: 7074 7332 2c0a 203c 6120 6872 6566 3d22 pts2,. Mat  │ │ │ +000c4520: 696e 6c69 6572 732c 0a20 3c61 2068 7265 inliers,. UsacPar │ │ │ +000c4570: 616d 733c 2f61 3e26 6e62 7370 3b70 6172 ams par │ │ │ +000c4580: 616d 7329 3c2f 7370 616e 3e3c 2f64 6976 ams)
    .
    ..
  • .
  • .< │ │ │ +000c45b0: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +000c45c0: 6574 6169 6c22 2069 643d 2265 7374 696d etail" id="estim │ │ │ +000c45d0: 6174 6541 6666 696e 6550 6172 7469 616c ateAffinePartial │ │ │ +000c45e0: 3244 286f 7267 2e6f 7065 6e63 762e 636f 2D(org.opencv.co │ │ │ +000c45f0: 7265 2e4d 6174 2c6f 7267 2e6f 7065 6e63 re.Mat,org.openc │ │ │ +000c4600: 762e 636f 7265 2e4d 6174 2c6f 7267 2e6f v.core.Mat,org.o │ │ │ +000c4610: 7065 6e63 762e 636f 7265 2e4d 6174 2c69 pencv.core.Mat,i │ │ │ +000c4620: 6e74 2c64 6f75 626c 652c 6c6f 6e67 2c64 nt,double,long,d │ │ │ +000c4630: 6f75 626c 652c 6c6f 6e67 2922 3e0a 3c68 ouble,long)">.estimateAffine │ │ │ +000c4650: 5061 7274 6961 6c32 443c 2f68 333e 0a3c Partial2D.< │ │ │ +000c4660: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +000c4670: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +000c4680: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +000c4690: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +000c46c0: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +000c46d0: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +000c46e0: 726e 2d74 7970 6522 3e3c 6120 6872 6566 rn-type">Mat estimateAffi │ │ │ +000c4760: 6e65 5061 7274 6961 6c32 443c 2f73 7061 nePartial2D │ │ │ +000c4790: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ +000c47d0: 3c2f 613e 266e 6273 703b 6672 6f6d 2c0a  from,. │ │ │ +000c47e0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000c4820: 3c2f 613e 266e 6273 703b 746f 2c0a 203c  to,. < │ │ │ +000c4830: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000c4840: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000c4850: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000c4860: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat inliers, │ │ │ +000c4880: 0a20 696e 7426 6e62 7370 3b6d 6574 686f . int metho │ │ │ +000c4890: 642c 0a20 646f 7562 6c65 266e 6273 703b d,. double  │ │ │ +000c48a0: 7261 6e73 6163 5265 7072 6f6a 5468 7265 ransacReprojThre │ │ │ +000c48b0: 7368 6f6c 642c 0a20 6c6f 6e67 266e 6273 shold,. long&nbs │ │ │ +000c48c0: 703b 6d61 7849 7465 7273 2c0a 2064 6f75 p;maxIters,. dou │ │ │ +000c48d0: 626c 6526 6e62 7370 3b63 6f6e 6669 6465 ble confide │ │ │ +000c48e0: 6e63 652c 0a20 6c6f 6e67 266e 6273 703b nce,. long  │ │ │ +000c48f0: 7265 6669 6e65 4974 6572 7329 3c2f 7370 refineIters).
    Com │ │ │ +000c4920: 7075 7465 7320 616e 206f 7074 696d 616c putes an optimal │ │ │ +000c4930: 206c 696d 6974 6564 2061 6666 696e 6520 limited affine │ │ │ +000c4940: 7472 616e 7366 6f72 6d61 7469 6f6e 2077 transformation w │ │ │ +000c4950: 6974 6820 3420 6465 6772 6565 7320 6f66 ith 4 degrees of │ │ │ +000c4960: 2066 7265 6564 6f6d 2062 6574 7765 656e freedom between │ │ │ +000c4970: 0a74 776f 2032 4420 706f 696e 7420 7365 .two 2D point se │ │ │ +000c4980: 7473 2e3c 2f64 6976 3e0a 3c64 6c20 636c ts.
    .
    .
    Parameters:
    .
    from │ │ │ +000c49c0: 3c2f 636f 6465 3e20 2d20 4669 7273 7420 - First │ │ │ +000c49d0: 696e 7075 7420 3244 2070 6f69 6e74 2073 input 2D point s │ │ │ +000c49e0: 6574 2e3c 2f64 643e 0a3c 6464 3e3c 636f et.
    .
    to - S │ │ │ +000c4a00: 6563 6f6e 6420 696e 7075 7420 3244 2070 econd input 2D p │ │ │ +000c4a10: 6f69 6e74 2073 6574 2e3c 2f64 643e 0a3c oint set.
    .< │ │ │ +000c4a20: 6464 3e3c 636f 6465 3e69 6e6c 6965 7273 dd>inliers │ │ │ +000c4a30: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +000c4a40: 2076 6563 746f 7220 696e 6469 6361 7469 vector indicati │ │ │ +000c4a50: 6e67 2077 6869 6368 2070 6f69 6e74 7320 ng which points │ │ │ +000c4a60: 6172 6520 696e 6c69 6572 732e 3c2f 6464 are inliers..
    meth │ │ │ +000c4a80: 6f64 3c2f 636f 6465 3e20 2d20 526f 6275 od - Robu │ │ │ +000c4a90: 7374 206d 6574 686f 6420 7573 6564 2074 st method used t │ │ │ +000c4aa0: 6f20 636f 6d70 7574 6520 7472 616e 7366 o compute transf │ │ │ +000c4ab0: 6f72 6d61 7469 6f6e 2e20 5468 6520 666f ormation. The fo │ │ │ +000c4ac0: 6c6c 6f77 696e 6720 6d65 7468 6f64 7320 llowing methods │ │ │ +000c4ad0: 6172 6520 706f 7373 6962 6c65 3a0a 3c75 are possible:..
  • . REF │ │ │ +000c4af0: 3a20 5241 4e53 4143 202d 2052 414e 5341 : RANSAC - RANSA │ │ │ +000c4b00: 432d 6261 7365 6420 726f 6275 7374 206d C-based robust m │ │ │ +000c4b10: 6574 686f 640a 2020 3c2f 6c69 3e0a 2020 ethod.
  • . │ │ │ +000c4b20: 3c6c 693e 0a20 2020 5245 463a 204c 4d45
  • . REF: LME │ │ │ +000c4b30: 4453 202d 204c 6561 7374 2d4d 6564 6961 DS - Least-Media │ │ │ +000c4b40: 6e20 726f 6275 7374 206d 6574 686f 640a n robust method. │ │ │ +000c4b50: 5241 4e53 4143 2069 7320 7468 6520 6465 RANSAC is the de │ │ │ +000c4b60: 6661 756c 7420 6d65 7468 6f64 2e0a 2020 fault method.. │ │ │ +000c4b70: 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64 643e
  • .
    │ │ │ +000c4b80: 0a3c 6464 3e3c 636f 6465 3e72 616e 7361 .
    ransa │ │ │ +000c4b90: 6352 6570 726f 6a54 6872 6573 686f 6c64 cReprojThreshold │ │ │ +000c4ba0: 3c2f 636f 6465 3e20 2d20 4d61 7869 6d75 - Maximu │ │ │ +000c4bb0: 6d20 7265 7072 6f6a 6563 7469 6f6e 2065 m reprojection e │ │ │ +000c4bc0: 7272 6f72 2069 6e20 7468 6520 5241 4e53 rror in the RANS │ │ │ +000c4bd0: 4143 2061 6c67 6f72 6974 686d 2074 6f20 AC algorithm to │ │ │ +000c4be0: 636f 6e73 6964 6572 0a61 2070 6f69 6e74 consider.a point │ │ │ +000c4bf0: 2061 7320 616e 2069 6e6c 6965 722e 2041 as an inlier. A │ │ │ +000c4c00: 7070 6c69 6573 206f 6e6c 7920 746f 2052 pplies only to R │ │ │ +000c4c10: 414e 5341 432e 3c2f 6464 3e0a 3c64 643e ANSAC.
    .
    │ │ │ +000c4c20: 3c63 6f64 653e 6d61 7849 7465 7273 3c2f maxIters - The maxi │ │ │ +000c4c40: 6d75 6d20 6e75 6d62 6572 206f 6620 726f mum number of ro │ │ │ +000c4c50: 6275 7374 206d 6574 686f 6420 6974 6572 bust method iter │ │ │ +000c4c60: 6174 696f 6e73 2e3c 2f64 643e 0a3c 6464 ations.
    .
    confidenc │ │ │ +000c4c80: 653c 2f63 6f64 653e 202d 2043 6f6e 6669 e - Confi │ │ │ +000c4c90: 6465 6e63 6520 6c65 7665 6c2c 2062 6574 dence level, bet │ │ │ +000c4ca0: 7765 656e 2030 2061 6e64 2031 2c20 666f ween 0 and 1, fo │ │ │ +000c4cb0: 7220 7468 6520 6573 7469 6d61 7465 6420 r the estimated │ │ │ +000c4cc0: 7472 616e 7366 6f72 6d61 7469 6f6e 2e20 transformation. │ │ │ +000c4cd0: 416e 7974 6869 6e67 0a62 6574 7765 656e Anything.between │ │ │ +000c4ce0: 2030 2e39 3520 616e 6420 302e 3939 2069 0.95 and 0.99 i │ │ │ +000c4cf0: 7320 7573 7561 6c6c 7920 676f 6f64 2065 s usually good e │ │ │ +000c4d00: 6e6f 7567 682e 2056 616c 7565 7320 746f nough. Values to │ │ │ +000c4d10: 6f20 636c 6f73 6520 746f 2031 2063 616e o close to 1 can │ │ │ +000c4d20: 2073 6c6f 7720 646f 776e 2074 6865 2065 slow down the e │ │ │ +000c4d30: 7374 696d 6174 696f 6e0a 7369 676e 6966 stimation.signif │ │ │ +000c4d40: 6963 616e 746c 792e 2056 616c 7565 7320 icantly. Values │ │ │ +000c4d50: 6c6f 7765 7220 7468 616e 2030 2e38 2d30 lower than 0.8-0 │ │ │ +000c4d60: 2e39 2063 616e 2072 6573 756c 7420 696e .9 can result in │ │ │ +000c4d70: 2061 6e20 696e 636f 7272 6563 746c 7920 an incorrectly │ │ │ +000c4d80: 6573 7469 6d61 7465 6420 7472 616e 7366 estimated transf │ │ │ +000c4d90: 6f72 6d61 7469 6f6e 2e3c 2f64 643e 0a3c ormation.
    .< │ │ │ +000c4da0: 6464 3e3c 636f 6465 3e72 6566 696e 6549 dd>refineI │ │ │ +000c4db0: 7465 7273 3c2f 636f 6465 3e20 2d20 4d61 ters - Ma │ │ │ +000c4dc0: 7869 6d75 6d20 6e75 6d62 6572 206f 6620 ximum number of │ │ │ +000c4dd0: 6974 6572 6174 696f 6e73 206f 6620 7265 iterations of re │ │ │ +000c4de0: 6669 6e69 6e67 2061 6c67 6f72 6974 686d fining algorithm │ │ │ +000c4df0: 2028 4c65 7665 6e62 6572 672d 4d61 7271 (Levenberg-Marq │ │ │ +000c4e00: 7561 7264 7429 2e0a 5061 7373 696e 6720 uardt)..Passing │ │ │ +000c4e10: 3020 7769 6c6c 2064 6973 6162 6c65 2072 0 will disable r │ │ │ +000c4e20: 6566 696e 696e 672c 2073 6f20 7468 6520 efining, so the │ │ │ +000c4e30: 6f75 7470 7574 206d 6174 7269 7820 7769 output matrix wi │ │ │ +000c4e40: 6c6c 2062 6520 6f75 7470 7574 206f 6620 ll be output of │ │ │ +000c4e50: 726f 6275 7374 206d 6574 686f 642e 3c2f robust method..
    Returns: │ │ │ +000c4e70: 3c2f 6474 3e0a 3c64 643e 4f75 7470 7574
    .
    Output │ │ │ +000c4e80: 2032 4420 6166 6669 6e65 2074 7261 6e73 2D affine trans │ │ │ +000c4e90: 666f 726d 6174 696f 6e20 2834 2064 6567 formation (4 deg │ │ │ +000c4ea0: 7265 6573 206f 6620 6672 6565 646f 6d29 rees of freedom) │ │ │ +000c4eb0: 206d 6174 7269 7820 5c28 3220 5c74 696d matrix \(2 \tim │ │ │ +000c4ec0: 6573 2033 5c29 206f 720a 656d 7074 7920 es 3\) or.empty │ │ │ +000c4ed0: 6d61 7472 6978 2069 6620 7472 616e 7366 matrix if transf │ │ │ +000c4ee0: 6f72 6d61 7469 6f6e 2063 6f75 6c64 206e ormation could n │ │ │ +000c4ef0: 6f74 2062 6520 6573 7469 6d61 7465 642e ot be estimated. │ │ │ +000c4f00: 0a0a 5468 6520 6675 6e63 7469 6f6e 2065 ..The function e │ │ │ +000c4f10: 7374 696d 6174 6573 2061 6e20 6f70 7469 stimates an opti │ │ │ +000c4f20: 6d61 6c20 3244 2061 6666 696e 6520 7472 mal 2D affine tr │ │ │ +000c4f30: 616e 7366 6f72 6d61 7469 6f6e 2077 6974 ansformation wit │ │ │ +000c4f40: 6820 3420 6465 6772 6565 7320 6f66 2066 h 4 degrees of f │ │ │ +000c4f50: 7265 6564 6f6d 206c 696d 6974 6564 2074 reedom limited t │ │ │ +000c4f60: 6f0a 636f 6d62 696e 6174 696f 6e73 206f o.combinations o │ │ │ +000c4f70: 6620 7472 616e 736c 6174 696f 6e2c 2072 f translation, r │ │ │ +000c4f80: 6f74 6174 696f 6e2c 2061 6e64 2075 6e69 otation, and uni │ │ │ +000c4f90: 666f 726d 2073 6361 6c69 6e67 2e20 5573 form scaling. Us │ │ │ +000c4fa0: 6573 2074 6865 2073 656c 6563 7465 6420 es the selected │ │ │ +000c4fb0: 616c 676f 7269 7468 6d20 666f 7220 726f algorithm for ro │ │ │ +000c4fc0: 6275 7374 0a65 7374 696d 6174 696f 6e2e bust.estimation. │ │ │ +000c4fd0: 0a0a 5468 6520 636f 6d70 7574 6564 2074 ..The computed t │ │ │ +000c4fe0: 7261 6e73 666f 726d 6174 696f 6e20 6973 ransformation is │ │ │ +000c4ff0: 2074 6865 6e20 7265 6669 6e65 6420 6675 then refined fu │ │ │ +000c5000: 7274 6865 7220 2875 7369 6e67 206f 6e6c rther (using onl │ │ │ +000c5010: 7920 696e 6c69 6572 7329 2077 6974 6820 y inliers) with │ │ │ +000c5020: 7468 650a 4c65 7665 6e62 6572 672d 4d61 the.Levenberg-Ma │ │ │ +000c5030: 7271 7561 7264 7420 6d65 7468 6f64 2074 rquardt method t │ │ │ +000c5040: 6f20 7265 6475 6365 2074 6865 2072 652d o reduce the re- │ │ │ +000c5050: 7072 6f6a 6563 7469 6f6e 2065 7272 6f72 projection error │ │ │ +000c5060: 2065 7665 6e20 6d6f 7265 2e0a 0a45 7374 even more...Est │ │ │ +000c5070: 696d 6174 6564 2074 7261 6e73 666f 726d imated transform │ │ │ +000c5080: 6174 696f 6e20 6d61 7472 6978 2069 733a ation matrix is: │ │ │ +000c5090: 0a5c 2820 5c62 6567 696e 7b62 6d61 7472 .\( \begin{bmatr │ │ │ +000c50a0: 6978 7d20 5c63 6f73 285c 7468 6574 6129 ix} \cos(\theta) │ │ │ +000c50b0: 205c 6364 6f74 2073 2026 616d 703b 202d \cdot s & - │ │ │ +000c50c0: 5c73 696e 285c 7468 6574 6129 205c 6364 \sin(\theta) \cd │ │ │ +000c50d0: 6f74 2073 2026 616d 703b 2074 5f78 205c ot s & t_x \ │ │ │ +000c50e0: 5c0a 2020 2020 2020 2020 2020 2020 2020 \. │ │ │ +000c50f0: 2020 5c73 696e 285c 7468 6574 6129 205c \sin(\theta) \ │ │ │ +000c5100: 6364 6f74 2073 2026 616d 703b 205c 636f cdot s & \co │ │ │ +000c5110: 7328 5c74 6865 7461 2920 5c63 646f 7420 s(\theta) \cdot │ │ │ +000c5120: 7320 2661 6d70 3b20 745f 790a 5c65 6e64 s & t_y.\end │ │ │ +000c5130: 7b62 6d61 7472 6978 7d20 5c29 0a57 6865 {bmatrix} \).Whe │ │ │ +000c5140: 7265 205c 2820 5c74 6865 7461 205c 2920 re \( \theta \) │ │ │ +000c5150: 6973 2074 6865 2072 6f74 6174 696f 6e20 is the rotation │ │ │ +000c5160: 616e 676c 652c 205c 2820 7320 5c29 2074 angle, \( s \) t │ │ │ +000c5170: 6865 2073 6361 6c69 6e67 2066 6163 746f he scaling facto │ │ │ +000c5180: 7220 616e 6420 5c28 2074 5f78 2c20 745f r and \( t_x, t_ │ │ │ +000c5190: 7920 5c29 2061 7265 0a74 7261 6e73 6c61 y \) are.transla │ │ │ +000c51a0: 7469 6f6e 7320 696e 205c 2820 782c 2079 tions in \( x, y │ │ │ +000c51b0: 205c 2920 6178 6573 2072 6573 7065 6374 \) axes respect │ │ │ +000c51c0: 6976 656c 792e 0a0a 3c62 3e4e 6f74 653a ively...Note: │ │ │ +000c51d0: 3c2f 623e 0a54 6865 2052 414e 5341 4320 .The RANSAC │ │ │ +000c51e0: 6d65 7468 6f64 2063 616e 2068 616e 646c method can handl │ │ │ +000c51f0: 6520 7072 6163 7469 6361 6c6c 7920 616e e practically an │ │ │ +000c5200: 7920 7261 7469 6f20 6f66 206f 7574 6c69 y ratio of outli │ │ │ +000c5210: 6572 7320 6275 7420 6e65 6564 2061 2074 ers but need a t │ │ │ +000c5220: 6872 6573 686f 6c64 2074 6f0a 6469 7374 hreshold to.dist │ │ │ +000c5230: 696e 6775 6973 6820 696e 6c69 6572 7320 inguish inliers │ │ │ +000c5240: 6672 6f6d 206f 7574 6c69 6572 732e 2054 from outliers. T │ │ │ +000c5250: 6865 206d 6574 686f 6420 4c4d 6544 5320 he method LMeDS │ │ │ +000c5260: 646f 6573 206e 6f74 206e 6565 6420 616e does not need an │ │ │ +000c5270: 7920 7468 7265 7368 6f6c 6420 6275 7420 y threshold but │ │ │ +000c5280: 6974 2077 6f72 6b73 0a63 6f72 7265 6374 it works.correct │ │ │ +000c5290: 6c79 206f 6e6c 7920 7768 656e 2074 6865 ly only when the │ │ │ +000c52a0: 7265 2061 7265 206d 6f72 6520 7468 616e re are more than │ │ │ +000c52b0: 2035 3025 206f 6620 696e 6c69 6572 732e 50% of inliers. │ │ │ +000c52c0: 0a0a 5345 453a 2065 7374 696d 6174 6541 ..SEE: estimateA │ │ │ +000c52d0: 6666 696e 6532 442c 2067 6574 4166 6669 ffine2D, getAffi │ │ │ +000c52e0: 6e65 5472 616e 7366 6f72 6d3c 2f64 643e neTransform
    │ │ │ +000c52f0: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    ...
  • .< │ │ │ +000c5310: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .estimateAffine │ │ │ +000c53b0: 5061 7274 6961 6c32 443c 2f68 333e 0a3c Partial2D.< │ │ │ +000c53c0: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +000c53d0: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +000c53e0: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +000c53f0: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +000c5420: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +000c5430: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +000c5440: 726e 2d74 7970 6522 3e3c 6120 6872 6566 rn-type">Mat estimateAffi │ │ │ +000c54c0: 6e65 5061 7274 6961 6c32 443c 2f73 7061 nePartial2D │ │ │ +000c54f0: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ +000c5530: 3c2f 613e 266e 6273 703b 6672 6f6d 2c0a  from,. │ │ │ +000c5540: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000c5580: 3c2f 613e 266e 6273 703b 746f 2c0a 203c  to,. < │ │ │ +000c5590: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000c55a0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000c55b0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000c55c0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat inliers, │ │ │ +000c55e0: 0a20 696e 7426 6e62 7370 3b6d 6574 686f . int metho │ │ │ +000c55f0: 642c 0a20 646f 7562 6c65 266e 6273 703b d,. double  │ │ │ +000c5600: 7261 6e73 6163 5265 7072 6f6a 5468 7265 ransacReprojThre │ │ │ +000c5610: 7368 6f6c 642c 0a20 6c6f 6e67 266e 6273 shold,. long&nbs │ │ │ +000c5620: 703b 6d61 7849 7465 7273 2c0a 2064 6f75 p;maxIters,. dou │ │ │ +000c5630: 626c 6526 6e62 7370 3b63 6f6e 6669 6465 ble confide │ │ │ +000c5640: 6e63 6529 3c2f 7370 616e 3e3c 2f64 6976 nce).
    Computes an │ │ │ +000c5670: 206f 7074 696d 616c 206c 696d 6974 6564 optimal limited │ │ │ +000c5680: 2061 6666 696e 6520 7472 616e 7366 6f72 affine transfor │ │ │ +000c5690: 6d61 7469 6f6e 2077 6974 6820 3420 6465 mation with 4 de │ │ │ +000c56a0: 6772 6565 7320 6f66 2066 7265 6564 6f6d grees of freedom │ │ │ +000c56b0: 2062 6574 7765 656e 0a74 776f 2032 4420 between.two 2D │ │ │ +000c56c0: 706f 696e 7420 7365 7473 2e3c 2f64 6976 point sets.
    .
    .
    Paramet │ │ │ +000c56f0: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    from │ │ │ +000c5710: 2d20 4669 7273 7420 696e 7075 7420 3244 - First input 2D │ │ │ +000c5720: 2070 6f69 6e74 2073 6574 2e3c 2f64 643e point set.
    │ │ │ +000c5730: 0a3c 6464 3e3c 636f 6465 3e74 6f3c 2f63 .
    to - Second in │ │ │ +000c5750: 7075 7420 3244 2070 6f69 6e74 2073 6574 put 2D point set │ │ │ +000c5760: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    inliers │ │ │ +000c5780: 2d20 4f75 7470 7574 2076 6563 746f 7220 - Output vector │ │ │ +000c5790: 696e 6469 6361 7469 6e67 2077 6869 6368 indicating which │ │ │ +000c57a0: 2070 6f69 6e74 7320 6172 6520 696e 6c69 points are inli │ │ │ +000c57b0: 6572 732e 3c2f 6464 3e0a 3c64 643e 3c63 ers.
    .
    method - Robust metho │ │ │ +000c57e0: 6420 7573 6564 2074 6f20 636f 6d70 7574 d used to comput │ │ │ +000c57f0: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ +000c5800: 2e20 5468 6520 666f 6c6c 6f77 696e 6720 . The following │ │ │ +000c5810: 6d65 7468 6f64 7320 6172 6520 706f 7373 methods are poss │ │ │ +000c5820: 6962 6c65 3a0a 3c75 6c3e 0a20 203c 6c69 ible:.
      .
    • . REF: RANSAC │ │ │ +000c5840: 202d 2052 414e 5341 432d 6261 7365 6420 - RANSAC-based │ │ │ +000c5850: 726f 6275 7374 206d 6574 686f 640a 2020 robust method. │ │ │ +000c5860: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020
    • .
    • . │ │ │ +000c5870: 5245 463a 204c 4d45 4453 202d 204c 6561 REF: LMEDS - Lea │ │ │ +000c5880: 7374 2d4d 6564 6961 6e20 726f 6275 7374 st-Median robust │ │ │ +000c5890: 206d 6574 686f 640a 5241 4e53 4143 2069 method.RANSAC i │ │ │ +000c58a0: 7320 7468 6520 6465 6661 756c 7420 6d65 s the default me │ │ │ +000c58b0: 7468 6f64 2e0a 2020 3c2f 6c69 3e0a 3c2f thod..
    • .
    .
    ransacReprojT │ │ │ +000c58e0: 6872 6573 686f 6c64 3c2f 636f 6465 3e20 hreshold │ │ │ +000c58f0: 2d20 4d61 7869 6d75 6d20 7265 7072 6f6a - Maximum reproj │ │ │ +000c5900: 6563 7469 6f6e 2065 7272 6f72 2069 6e20 ection error in │ │ │ +000c5910: 7468 6520 5241 4e53 4143 2061 6c67 6f72 the RANSAC algor │ │ │ +000c5920: 6974 686d 2074 6f20 636f 6e73 6964 6572 ithm to consider │ │ │ +000c5930: 0a61 2070 6f69 6e74 2061 7320 616e 2069 .a point as an i │ │ │ +000c5940: 6e6c 6965 722e 2041 7070 6c69 6573 206f nlier. Applies o │ │ │ +000c5950: 6e6c 7920 746f 2052 414e 5341 432e 3c2f nly to RANSAC..
    ma │ │ │ +000c5970: 7849 7465 7273 3c2f 636f 6465 3e20 2d20 xIters - │ │ │ +000c5980: 5468 6520 6d61 7869 6d75 6d20 6e75 6d62 The maximum numb │ │ │ +000c5990: 6572 206f 6620 726f 6275 7374 206d 6574 er of robust met │ │ │ +000c59a0: 686f 6420 6974 6572 6174 696f 6e73 2e3c hod iterations.< │ │ │ +000c59b0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ +000c59c0: 6f6e 6669 6465 6e63 653c 2f63 6f64 653e onfidence │ │ │ +000c59d0: 202d 2043 6f6e 6669 6465 6e63 6520 6c65 - Confidence le │ │ │ +000c59e0: 7665 6c2c 2062 6574 7765 656e 2030 2061 vel, between 0 a │ │ │ +000c59f0: 6e64 2031 2c20 666f 7220 7468 6520 6573 nd 1, for the es │ │ │ +000c5a00: 7469 6d61 7465 6420 7472 616e 7366 6f72 timated transfor │ │ │ +000c5a10: 6d61 7469 6f6e 2e20 416e 7974 6869 6e67 mation. Anything │ │ │ +000c5a20: 0a62 6574 7765 656e 2030 2e39 3520 616e .between 0.95 an │ │ │ +000c5a30: 6420 302e 3939 2069 7320 7573 7561 6c6c d 0.99 is usuall │ │ │ +000c5a40: 7920 676f 6f64 2065 6e6f 7567 682e 2056 y good enough. V │ │ │ +000c5a50: 616c 7565 7320 746f 6f20 636c 6f73 6520 alues too close │ │ │ +000c5a60: 746f 2031 2063 616e 2073 6c6f 7720 646f to 1 can slow do │ │ │ +000c5a70: 776e 2074 6865 2065 7374 696d 6174 696f wn the estimatio │ │ │ +000c5a80: 6e0a 7369 676e 6966 6963 616e 746c 792e n.significantly. │ │ │ +000c5a90: 2056 616c 7565 7320 6c6f 7765 7220 7468 Values lower th │ │ │ +000c5aa0: 616e 2030 2e38 2d30 2e39 2063 616e 2072 an 0.8-0.9 can r │ │ │ +000c5ab0: 6573 756c 7420 696e 2061 6e20 696e 636f esult in an inco │ │ │ +000c5ac0: 7272 6563 746c 7920 6573 7469 6d61 7465 rrectly estimate │ │ │ +000c5ad0: 6420 7472 616e 7366 6f72 6d61 7469 6f6e d transformation │ │ │ +000c5ae0: 2e0a 5061 7373 696e 6720 3020 7769 6c6c ..Passing 0 will │ │ │ +000c5af0: 2064 6973 6162 6c65 2072 6566 696e 696e disable refinin │ │ │ +000c5b00: 672c 2073 6f20 7468 6520 6f75 7470 7574 g, so the output │ │ │ +000c5b10: 206d 6174 7269 7820 7769 6c6c 2062 6520 matrix will be │ │ │ +000c5b20: 6f75 7470 7574 206f 6620 726f 6275 7374 output of robust │ │ │ +000c5b30: 206d 6574 686f 642e 3c2f 6464 3e0a 3c64 method.
    .Returns:. │ │ │ +000c5b50: 3c64 643e 4f75 7470 7574 2032 4420 6166
    Output 2D af │ │ │ +000c5b60: 6669 6e65 2074 7261 6e73 666f 726d 6174 fine transformat │ │ │ +000c5b70: 696f 6e20 2834 2064 6567 7265 6573 206f ion (4 degrees o │ │ │ +000c5b80: 6620 6672 6565 646f 6d29 206d 6174 7269 f freedom) matri │ │ │ +000c5b90: 7820 5c28 3220 5c74 696d 6573 2033 5c29 x \(2 \times 3\) │ │ │ +000c5ba0: 206f 720a 656d 7074 7920 6d61 7472 6978 or.empty matrix │ │ │ +000c5bb0: 2069 6620 7472 616e 7366 6f72 6d61 7469 if transformati │ │ │ +000c5bc0: 6f6e 2063 6f75 6c64 206e 6f74 2062 6520 on could not be │ │ │ +000c5bd0: 6573 7469 6d61 7465 642e 0a0a 5468 6520 estimated...The │ │ │ +000c5be0: 6675 6e63 7469 6f6e 2065 7374 696d 6174 function estimat │ │ │ +000c5bf0: 6573 2061 6e20 6f70 7469 6d61 6c20 3244 es an optimal 2D │ │ │ +000c5c00: 2061 6666 696e 6520 7472 616e 7366 6f72 affine transfor │ │ │ +000c5c10: 6d61 7469 6f6e 2077 6974 6820 3420 6465 mation with 4 de │ │ │ +000c5c20: 6772 6565 7320 6f66 2066 7265 6564 6f6d grees of freedom │ │ │ +000c5c30: 206c 696d 6974 6564 2074 6f0a 636f 6d62 limited to.comb │ │ │ +000c5c40: 696e 6174 696f 6e73 206f 6620 7472 616e inations of tran │ │ │ +000c5c50: 736c 6174 696f 6e2c 2072 6f74 6174 696f slation, rotatio │ │ │ +000c5c60: 6e2c 2061 6e64 2075 6e69 666f 726d 2073 n, and uniform s │ │ │ +000c5c70: 6361 6c69 6e67 2e20 5573 6573 2074 6865 caling. Uses the │ │ │ +000c5c80: 2073 656c 6563 7465 6420 616c 676f 7269 selected algori │ │ │ +000c5c90: 7468 6d20 666f 7220 726f 6275 7374 0a65 thm for robust.e │ │ │ +000c5ca0: 7374 696d 6174 696f 6e2e 0a0a 5468 6520 stimation...The │ │ │ +000c5cb0: 636f 6d70 7574 6564 2074 7261 6e73 666f computed transfo │ │ │ +000c5cc0: 726d 6174 696f 6e20 6973 2074 6865 6e20 rmation is then │ │ │ +000c5cd0: 7265 6669 6e65 6420 6675 7274 6865 7220 refined further │ │ │ +000c5ce0: 2875 7369 6e67 206f 6e6c 7920 696e 6c69 (using only inli │ │ │ +000c5cf0: 6572 7329 2077 6974 6820 7468 650a 4c65 ers) with the.Le │ │ │ +000c5d00: 7665 6e62 6572 672d 4d61 7271 7561 7264 venberg-Marquard │ │ │ +000c5d10: 7420 6d65 7468 6f64 2074 6f20 7265 6475 t method to redu │ │ │ +000c5d20: 6365 2074 6865 2072 652d 7072 6f6a 6563 ce the re-projec │ │ │ +000c5d30: 7469 6f6e 2065 7272 6f72 2065 7665 6e20 tion error even │ │ │ +000c5d40: 6d6f 7265 2e0a 0a45 7374 696d 6174 6564 more...Estimated │ │ │ +000c5d50: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ +000c5d60: 6d61 7472 6978 2069 733a 0a5c 2820 5c62 matrix is:.\( \b │ │ │ +000c5d70: 6567 696e 7b62 6d61 7472 6978 7d20 5c63 egin{bmatrix} \c │ │ │ +000c5d80: 6f73 285c 7468 6574 6129 205c 6364 6f74 os(\theta) \cdot │ │ │ +000c5d90: 2073 2026 616d 703b 202d 5c73 696e 285c s & -\sin(\ │ │ │ +000c5da0: 7468 6574 6129 205c 6364 6f74 2073 2026 theta) \cdot s & │ │ │ +000c5db0: 616d 703b 2074 5f78 205c 5c0a 2020 2020 amp; t_x \\. │ │ │ +000c5dc0: 2020 2020 2020 2020 2020 2020 5c73 696e \sin │ │ │ +000c5dd0: 285c 7468 6574 6129 205c 6364 6f74 2073 (\theta) \cdot s │ │ │ +000c5de0: 2026 616d 703b 205c 636f 7328 5c74 6865 & \cos(\the │ │ │ +000c5df0: 7461 2920 5c63 646f 7420 7320 2661 6d70 ta) \cdot s & │ │ │ +000c5e00: 3b20 745f 790a 5c65 6e64 7b62 6d61 7472 ; t_y.\end{bmatr │ │ │ +000c5e10: 6978 7d20 5c29 0a57 6865 7265 205c 2820 ix} \).Where \( │ │ │ +000c5e20: 5c74 6865 7461 205c 2920 6973 2074 6865 \theta \) is the │ │ │ +000c5e30: 2072 6f74 6174 696f 6e20 616e 676c 652c rotation angle, │ │ │ +000c5e40: 205c 2820 7320 5c29 2074 6865 2073 6361 \( s \) the sca │ │ │ +000c5e50: 6c69 6e67 2066 6163 746f 7220 616e 6420 ling factor and │ │ │ +000c5e60: 5c28 2074 5f78 2c20 745f 7920 5c29 2061 \( t_x, t_y \) a │ │ │ +000c5e70: 7265 0a74 7261 6e73 6c61 7469 6f6e 7320 re.translations │ │ │ +000c5e80: 696e 205c 2820 782c 2079 205c 2920 6178 in \( x, y \) ax │ │ │ +000c5e90: 6573 2072 6573 7065 6374 6976 656c 792e es respectively. │ │ │ +000c5ea0: 0a0a 3c62 3e4e 6f74 653a 3c2f 623e 0a54 ..Note:.T │ │ │ +000c5eb0: 6865 2052 414e 5341 4320 6d65 7468 6f64 he RANSAC method │ │ │ +000c5ec0: 2063 616e 2068 616e 646c 6520 7072 6163 can handle prac │ │ │ +000c5ed0: 7469 6361 6c6c 7920 616e 7920 7261 7469 tically any rati │ │ │ +000c5ee0: 6f20 6f66 206f 7574 6c69 6572 7320 6275 o of outliers bu │ │ │ +000c5ef0: 7420 6e65 6564 2061 2074 6872 6573 686f t need a thresho │ │ │ +000c5f00: 6c64 2074 6f0a 6469 7374 696e 6775 6973 ld to.distinguis │ │ │ +000c5f10: 6820 696e 6c69 6572 7320 6672 6f6d 206f h inliers from o │ │ │ +000c5f20: 7574 6c69 6572 732e 2054 6865 206d 6574 utliers. The met │ │ │ +000c5f30: 686f 6420 4c4d 6544 5320 646f 6573 206e hod LMeDS does n │ │ │ +000c5f40: 6f74 206e 6565 6420 616e 7920 7468 7265 ot need any thre │ │ │ +000c5f50: 7368 6f6c 6420 6275 7420 6974 2077 6f72 shold but it wor │ │ │ +000c5f60: 6b73 0a63 6f72 7265 6374 6c79 206f 6e6c ks.correctly onl │ │ │ +000c5f70: 7920 7768 656e 2074 6865 7265 2061 7265 y when there are │ │ │ +000c5f80: 206d 6f72 6520 7468 616e 2035 3025 206f more than 50% o │ │ │ +000c5f90: 6620 696e 6c69 6572 732e 0a0a 5345 453a f inliers...SEE: │ │ │ +000c5fa0: 2065 7374 696d 6174 6541 6666 696e 6532 estimateAffine2 │ │ │ +000c5fb0: 442c 2067 6574 4166 6669 6e65 5472 616e D, getAffineTran │ │ │ +000c5fc0: 7366 6f72 6d3c 2f64 643e 0a3c 2f64 6c3e sform
    .
    │ │ │ +000c5fd0: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f ....
  • . │ │ │ +000c6070: 0a3c 6833 3e65 7374 696d 6174 6541 6666 .

    estimateAff │ │ │ +000c6080: 696e 6550 6172 7469 616c 3244 3c2f 6833 inePartial2D

    .
    .
    │ │ │ +000c60d0: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +000c60f0: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +000c6100: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;Mat< │ │ │ +000c6160: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> estimateA │ │ │ +000c6190: 6666 696e 6550 6172 7469 616c 3244 3c2f ffinePartial2D( │ │ │ +000c6200: 4d61 743c 2f61 3e26 6e62 7370 3b66 726f Mat fro │ │ │ +000c6210: 6d2c 0a20 3c61 2068 7265 663d 222e 2e2f m,. │ │ │ +000c6250: 4d61 743c 2f61 3e26 6e62 7370 3b74 6f2c Mat to, │ │ │ +000c6260: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000c62a0: 743c 2f61 3e26 6e62 7370 3b69 6e6c 6965 t inlie │ │ │ +000c62b0: 7273 2c0a 2069 6e74 266e 6273 703b 6d65 rs,. int me │ │ │ +000c62c0: 7468 6f64 2c0a 2064 6f75 626c 6526 6e62 thod,. double&nb │ │ │ +000c62d0: 7370 3b72 616e 7361 6352 6570 726f 6a54 sp;ransacReprojT │ │ │ +000c62e0: 6872 6573 686f 6c64 2c0a 206c 6f6e 6726 hreshold,. long& │ │ │ +000c62f0: 6e62 7370 3b6d 6178 4974 6572 7329 3c2f nbsp;maxIters)
    .
    C │ │ │ +000c6320: 6f6d 7075 7465 7320 616e 206f 7074 696d omputes an optim │ │ │ +000c6330: 616c 206c 696d 6974 6564 2061 6666 696e al limited affin │ │ │ +000c6340: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ +000c6350: 2077 6974 6820 3420 6465 6772 6565 7320 with 4 degrees │ │ │ +000c6360: 6f66 2066 7265 6564 6f6d 2062 6574 7765 of freedom betwe │ │ │ +000c6370: 656e 0a74 776f 2032 4420 706f 696e 7420 en.two 2D point │ │ │ +000c6380: 7365 7473 2e3c 2f64 6976 3e0a 3c64 6c20 sets.
    .
    .< │ │ │ +000c63a0: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    fr │ │ │ +000c63c0: 6f6d 3c2f 636f 6465 3e20 2d20 4669 7273 om - Firs │ │ │ +000c63d0: 7420 696e 7075 7420 3244 2070 6f69 6e74 t input 2D point │ │ │ +000c63e0: 2073 6574 2e3c 2f64 643e 0a3c 6464 3e3c set.
    .
    < │ │ │ +000c63f0: 636f 6465 3e74 6f3c 2f63 6f64 653e 202d code>to - │ │ │ +000c6400: 2053 6563 6f6e 6420 696e 7075 7420 3244 Second input 2D │ │ │ +000c6410: 2070 6f69 6e74 2073 6574 2e3c 2f64 643e point set.
    │ │ │ +000c6420: 0a3c 6464 3e3c 636f 6465 3e69 6e6c 6965 .
    inlie │ │ │ +000c6430: 7273 3c2f 636f 6465 3e20 2d20 4f75 7470 rs - Outp │ │ │ +000c6440: 7574 2076 6563 746f 7220 696e 6469 6361 ut vector indica │ │ │ +000c6450: 7469 6e67 2077 6869 6368 2070 6f69 6e74 ting which point │ │ │ +000c6460: 7320 6172 6520 696e 6c69 6572 732e 3c2f s are inliers..
    me │ │ │ +000c6480: 7468 6f64 3c2f 636f 6465 3e20 2d20 526f thod - Ro │ │ │ +000c6490: 6275 7374 206d 6574 686f 6420 7573 6564 bust method used │ │ │ +000c64a0: 2074 6f20 636f 6d70 7574 6520 7472 616e to compute tran │ │ │ +000c64b0: 7366 6f72 6d61 7469 6f6e 2e20 5468 6520 sformation. The │ │ │ +000c64c0: 666f 6c6c 6f77 696e 6720 6d65 7468 6f64 following method │ │ │ +000c64d0: 7320 6172 6520 706f 7373 6962 6c65 3a0a s are possible:. │ │ │ +000c64e0: 3c75 6c3e 0a20 203c 6c69 3e0a 2020 2052
      .
    • . R │ │ │ +000c64f0: 4546 3a20 5241 4e53 4143 202d 2052 414e EF: RANSAC - RAN │ │ │ +000c6500: 5341 432d 6261 7365 6420 726f 6275 7374 SAC-based robust │ │ │ +000c6510: 206d 6574 686f 640a 2020 3c2f 6c69 3e0a method.
    • . │ │ │ +000c6520: 2020 3c6c 693e 0a20 2020 5245 463a 204c
    • . REF: L │ │ │ +000c6530: 4d45 4453 202d 204c 6561 7374 2d4d 6564 MEDS - Least-Med │ │ │ +000c6540: 6961 6e20 726f 6275 7374 206d 6574 686f ian robust metho │ │ │ +000c6550: 640a 5241 4e53 4143 2069 7320 7468 6520 d.RANSAC is the │ │ │ +000c6560: 6465 6661 756c 7420 6d65 7468 6f64 2e0a default method.. │ │ │ +000c6570: 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64
    • .
    .
    ran │ │ │ +000c6590: 7361 6352 6570 726f 6a54 6872 6573 686f sacReprojThresho │ │ │ +000c65a0: 6c64 3c2f 636f 6465 3e20 2d20 4d61 7869 ld - Maxi │ │ │ +000c65b0: 6d75 6d20 7265 7072 6f6a 6563 7469 6f6e mum reprojection │ │ │ +000c65c0: 2065 7272 6f72 2069 6e20 7468 6520 5241 error in the RA │ │ │ +000c65d0: 4e53 4143 2061 6c67 6f72 6974 686d 2074 NSAC algorithm t │ │ │ +000c65e0: 6f20 636f 6e73 6964 6572 0a61 2070 6f69 o consider.a poi │ │ │ +000c65f0: 6e74 2061 7320 616e 2069 6e6c 6965 722e nt as an inlier. │ │ │ +000c6600: 2041 7070 6c69 6573 206f 6e6c 7920 746f Applies only to │ │ │ +000c6610: 2052 414e 5341 432e 3c2f 6464 3e0a 3c64 RANSAC.
    .maxIters │ │ │ +000c6630: 3c2f 636f 6465 3e20 2d20 5468 6520 6d61 - The ma │ │ │ +000c6640: 7869 6d75 6d20 6e75 6d62 6572 206f 6620 ximum number of │ │ │ +000c6650: 726f 6275 7374 206d 6574 686f 6420 6974 robust method it │ │ │ +000c6660: 6572 6174 696f 6e73 2e0a 6265 7477 6565 erations..betwee │ │ │ +000c6670: 6e20 302e 3935 2061 6e64 2030 2e39 3920 n 0.95 and 0.99 │ │ │ +000c6680: 6973 2075 7375 616c 6c79 2067 6f6f 6420 is usually good │ │ │ +000c6690: 656e 6f75 6768 2e20 5661 6c75 6573 2074 enough. Values t │ │ │ +000c66a0: 6f6f 2063 6c6f 7365 2074 6f20 3120 6361 oo close to 1 ca │ │ │ +000c66b0: 6e20 736c 6f77 2064 6f77 6e20 7468 6520 n slow down the │ │ │ +000c66c0: 6573 7469 6d61 7469 6f6e 0a73 6967 6e69 estimation.signi │ │ │ +000c66d0: 6669 6361 6e74 6c79 2e20 5661 6c75 6573 ficantly. Values │ │ │ +000c66e0: 206c 6f77 6572 2074 6861 6e20 302e 382d lower than 0.8- │ │ │ +000c66f0: 302e 3920 6361 6e20 7265 7375 6c74 2069 0.9 can result i │ │ │ +000c6700: 6e20 616e 2069 6e63 6f72 7265 6374 6c79 n an incorrectly │ │ │ +000c6710: 2065 7374 696d 6174 6564 2074 7261 6e73 estimated trans │ │ │ +000c6720: 666f 726d 6174 696f 6e2e 0a50 6173 7369 formation..Passi │ │ │ +000c6730: 6e67 2030 2077 696c 6c20 6469 7361 626c ng 0 will disabl │ │ │ +000c6740: 6520 7265 6669 6e69 6e67 2c20 736f 2074 e refining, so t │ │ │ +000c6750: 6865 206f 7574 7075 7420 6d61 7472 6978 he output matrix │ │ │ +000c6760: 2077 696c 6c20 6265 206f 7574 7075 7420 will be output │ │ │ +000c6770: 6f66 2072 6f62 7573 7420 6d65 7468 6f64 of robust method │ │ │ +000c6780: 2e3c 2f64 643e 0a3c 6474 3e52 6574 7572 ..
    Retur │ │ │ +000c6790: 6e73 3a3c 2f64 743e 0a3c 6464 3e4f 7574 ns:
    .
    Out │ │ │ +000c67a0: 7075 7420 3244 2061 6666 696e 6520 7472 put 2D affine tr │ │ │ +000c67b0: 616e 7366 6f72 6d61 7469 6f6e 2028 3420 ansformation (4 │ │ │ +000c67c0: 6465 6772 6565 7320 6f66 2066 7265 6564 degrees of freed │ │ │ +000c67d0: 6f6d 2920 6d61 7472 6978 205c 2832 205c om) matrix \(2 \ │ │ │ +000c67e0: 7469 6d65 7320 335c 2920 6f72 0a65 6d70 times 3\) or.emp │ │ │ +000c67f0: 7479 206d 6174 7269 7820 6966 2074 7261 ty matrix if tra │ │ │ +000c6800: 6e73 666f 726d 6174 696f 6e20 636f 756c nsformation coul │ │ │ +000c6810: 6420 6e6f 7420 6265 2065 7374 696d 6174 d not be estimat │ │ │ +000c6820: 6564 2e0a 0a54 6865 2066 756e 6374 696f ed...The functio │ │ │ +000c6830: 6e20 6573 7469 6d61 7465 7320 616e 206f n estimates an o │ │ │ +000c6840: 7074 696d 616c 2032 4420 6166 6669 6e65 ptimal 2D affine │ │ │ +000c6850: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ +000c6860: 7769 7468 2034 2064 6567 7265 6573 206f with 4 degrees o │ │ │ +000c6870: 6620 6672 6565 646f 6d20 6c69 6d69 7465 f freedom limite │ │ │ +000c6880: 6420 746f 0a63 6f6d 6269 6e61 7469 6f6e d to.combination │ │ │ +000c6890: 7320 6f66 2074 7261 6e73 6c61 7469 6f6e s of translation │ │ │ +000c68a0: 2c20 726f 7461 7469 6f6e 2c20 616e 6420 , rotation, and │ │ │ +000c68b0: 756e 6966 6f72 6d20 7363 616c 696e 672e uniform scaling. │ │ │ +000c68c0: 2055 7365 7320 7468 6520 7365 6c65 6374 Uses the select │ │ │ +000c68d0: 6564 2061 6c67 6f72 6974 686d 2066 6f72 ed algorithm for │ │ │ +000c68e0: 2072 6f62 7573 740a 6573 7469 6d61 7469 robust.estimati │ │ │ +000c68f0: 6f6e 2e0a 0a54 6865 2063 6f6d 7075 7465 on...The compute │ │ │ +000c6900: 6420 7472 616e 7366 6f72 6d61 7469 6f6e d transformation │ │ │ +000c6910: 2069 7320 7468 656e 2072 6566 696e 6564 is then refined │ │ │ +000c6920: 2066 7572 7468 6572 2028 7573 696e 6720 further (using │ │ │ +000c6930: 6f6e 6c79 2069 6e6c 6965 7273 2920 7769 only inliers) wi │ │ │ +000c6940: 7468 2074 6865 0a4c 6576 656e 6265 7267 th the.Levenberg │ │ │ +000c6950: 2d4d 6172 7175 6172 6474 206d 6574 686f -Marquardt metho │ │ │ +000c6960: 6420 746f 2072 6564 7563 6520 7468 6520 d to reduce the │ │ │ +000c6970: 7265 2d70 726f 6a65 6374 696f 6e20 6572 re-projection er │ │ │ +000c6980: 726f 7220 6576 656e 206d 6f72 652e 0a0a ror even more... │ │ │ +000c6990: 4573 7469 6d61 7465 6420 7472 616e 7366 Estimated transf │ │ │ +000c69a0: 6f72 6d61 7469 6f6e 206d 6174 7269 7820 ormation matrix │ │ │ +000c69b0: 6973 3a0a 5c28 205c 6265 6769 6e7b 626d is:.\( \begin{bm │ │ │ +000c69c0: 6174 7269 787d 205c 636f 7328 5c74 6865 atrix} \cos(\the │ │ │ +000c69d0: 7461 2920 5c63 646f 7420 7320 2661 6d70 ta) \cdot s & │ │ │ +000c69e0: 3b20 2d5c 7369 6e28 5c74 6865 7461 2920 ; -\sin(\theta) │ │ │ +000c69f0: 5c63 646f 7420 7320 2661 6d70 3b20 745f \cdot s & t_ │ │ │ +000c6a00: 7820 5c5c 0a20 2020 2020 2020 2020 2020 x \\. │ │ │ +000c6a10: 2020 2020 205c 7369 6e28 5c74 6865 7461 \sin(\theta │ │ │ +000c6a20: 2920 5c63 646f 7420 7320 2661 6d70 3b20 ) \cdot s & │ │ │ +000c6a30: 5c63 6f73 285c 7468 6574 6129 205c 6364 \cos(\theta) \cd │ │ │ +000c6a40: 6f74 2073 2026 616d 703b 2074 5f79 0a5c ot s & t_y.\ │ │ │ +000c6a50: 656e 647b 626d 6174 7269 787d 205c 290a end{bmatrix} \). │ │ │ +000c6a60: 5768 6572 6520 5c28 205c 7468 6574 6120 Where \( \theta │ │ │ +000c6a70: 5c29 2069 7320 7468 6520 726f 7461 7469 \) is the rotati │ │ │ +000c6a80: 6f6e 2061 6e67 6c65 2c20 5c28 2073 205c on angle, \( s \ │ │ │ +000c6a90: 2920 7468 6520 7363 616c 696e 6720 6661 ) the scaling fa │ │ │ +000c6aa0: 6374 6f72 2061 6e64 205c 2820 745f 782c ctor and \( t_x, │ │ │ +000c6ab0: 2074 5f79 205c 2920 6172 650a 7472 616e t_y \) are.tran │ │ │ +000c6ac0: 736c 6174 696f 6e73 2069 6e20 5c28 2078 slations in \( x │ │ │ +000c6ad0: 2c20 7920 5c29 2061 7865 7320 7265 7370 , y \) axes resp │ │ │ +000c6ae0: 6563 7469 7665 6c79 2e0a 0a3c 623e 4e6f ectively...No │ │ │ +000c6af0: 7465 3a3c 2f62 3e0a 5468 6520 5241 4e53 te:.The RANS │ │ │ +000c6b00: 4143 206d 6574 686f 6420 6361 6e20 6861 AC method can ha │ │ │ +000c6b10: 6e64 6c65 2070 7261 6374 6963 616c 6c79 ndle practically │ │ │ +000c6b20: 2061 6e79 2072 6174 696f 206f 6620 6f75 any ratio of ou │ │ │ +000c6b30: 746c 6965 7273 2062 7574 206e 6565 6420 tliers but need │ │ │ +000c6b40: 6120 7468 7265 7368 6f6c 6420 746f 0a64 a threshold to.d │ │ │ +000c6b50: 6973 7469 6e67 7569 7368 2069 6e6c 6965 istinguish inlie │ │ │ +000c6b60: 7273 2066 726f 6d20 6f75 746c 6965 7273 rs from outliers │ │ │ +000c6b70: 2e20 5468 6520 6d65 7468 6f64 204c 4d65 . The method LMe │ │ │ +000c6b80: 4453 2064 6f65 7320 6e6f 7420 6e65 6564 DS does not need │ │ │ +000c6b90: 2061 6e79 2074 6872 6573 686f 6c64 2062 any threshold b │ │ │ +000c6ba0: 7574 2069 7420 776f 726b 730a 636f 7272 ut it works.corr │ │ │ +000c6bb0: 6563 746c 7920 6f6e 6c79 2077 6865 6e20 ectly only when │ │ │ +000c6bc0: 7468 6572 6520 6172 6520 6d6f 7265 2074 there are more t │ │ │ +000c6bd0: 6861 6e20 3530 2520 6f66 2069 6e6c 6965 han 50% of inlie │ │ │ +000c6be0: 7273 2e0a 0a53 4545 3a20 6573 7469 6d61 rs...SEE: estima │ │ │ +000c6bf0: 7465 4166 6669 6e65 3244 2c20 6765 7441 teAffine2D, getA │ │ │ +000c6c00: 6666 696e 6554 7261 6e73 666f 726d 3c2f ffineTransform.
    .
    │ │ │ +000c6c20: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
  • ..
  • .
    .

    estimat │ │ │ +000c6cc0: 6541 6666 696e 6550 6172 7469 616c 3244 eAffinePartial2D │ │ │ +000c6cd0: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ +000c6d30: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ +000c6d40: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ +000c6d60: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000c6da0: 2f61 3e3c 2f73 7061 6e3e 266e 6273 703b /a>  │ │ │ +000c6db0: 3c73 7061 6e20 636c 6173 733d 2265 6c65 estim │ │ │ +000c6dd0: 6174 6541 6666 696e 6550 6172 7469 616c ateAffinePartial │ │ │ +000c6de0: 3244 3c2f 7370 616e 3e3c 7762 723e 3c73 2D(Mat  │ │ │ +000c6e50: 3b66 726f 6d2c 0a20 3c61 2068 7265 663d ;from,. Mat  │ │ │ +000c6ea0: 3b74 6f2c 0a20 3c61 2068 7265 663d 222e ;to,. Mat i │ │ │ +000c6ef0: 6e6c 6965 7273 2c0a 2069 6e74 266e 6273 nliers,. int&nbs │ │ │ +000c6f00: 703b 6d65 7468 6f64 2c0a 2064 6f75 626c p;method,. doubl │ │ │ +000c6f10: 6526 6e62 7370 3b72 616e 7361 6352 6570 e ransacRep │ │ │ +000c6f20: 726f 6a54 6872 6573 686f 6c64 293c 2f73 rojThreshold)
    .
    Co │ │ │ +000c6f50: 6d70 7574 6573 2061 6e20 6f70 7469 6d61 mputes an optima │ │ │ +000c6f60: 6c20 6c69 6d69 7465 6420 6166 6669 6e65 l limited affine │ │ │ +000c6f70: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ +000c6f80: 7769 7468 2034 2064 6567 7265 6573 206f with 4 degrees o │ │ │ +000c6f90: 6620 6672 6565 646f 6d20 6265 7477 6565 f freedom betwee │ │ │ +000c6fa0: 6e0a 7477 6f20 3244 2070 6f69 6e74 2073 n.two 2D point s │ │ │ +000c6fb0: 6574 732e 3c2f 6469 763e 0a3c 646c 2063 ets.
    .
    .Parameters:.
    fro │ │ │ +000c6ff0: 6d3c 2f63 6f64 653e 202d 2046 6972 7374 m - First │ │ │ +000c7000: 2069 6e70 7574 2032 4420 706f 696e 7420 input 2D point │ │ │ +000c7010: 7365 742e 3c2f 6464 3e0a 3c64 643e 3c63 set.
    .
    to - │ │ │ +000c7030: 5365 636f 6e64 2069 6e70 7574 2032 4420 Second input 2D │ │ │ +000c7040: 706f 696e 7420 7365 742e 3c2f 6464 3e0a point set.
    . │ │ │ +000c7050: 3c64 643e 3c63 6f64 653e 696e 6c69 6572
    inlier │ │ │ +000c7060: 733c 2f63 6f64 653e 202d 204f 7574 7075 s - Outpu │ │ │ +000c7070: 7420 7665 6374 6f72 2069 6e64 6963 6174 t vector indicat │ │ │ +000c7080: 696e 6720 7768 6963 6820 706f 696e 7473 ing which points │ │ │ +000c7090: 2061 7265 2069 6e6c 6965 7273 2e3c 2f64 are inliers..
    met │ │ │ +000c70b0: 686f 643c 2f63 6f64 653e 202d 2052 6f62 hod - Rob │ │ │ +000c70c0: 7573 7420 6d65 7468 6f64 2075 7365 6420 ust method used │ │ │ +000c70d0: 746f 2063 6f6d 7075 7465 2074 7261 6e73 to compute trans │ │ │ +000c70e0: 666f 726d 6174 696f 6e2e 2054 6865 2066 formation. The f │ │ │ +000c70f0: 6f6c 6c6f 7769 6e67 206d 6574 686f 6473 ollowing methods │ │ │ +000c7100: 2061 7265 2070 6f73 7369 626c 653a 0a3c are possible:.< │ │ │ +000c7110: 756c 3e0a 2020 3c6c 693e 0a20 2020 5245 ul>.
  • . RE │ │ │ +000c7120: 463a 2052 414e 5341 4320 2d20 5241 4e53 F: RANSAC - RANS │ │ │ +000c7130: 4143 2d62 6173 6564 2072 6f62 7573 7420 AC-based robust │ │ │ +000c7140: 6d65 7468 6f64 0a20 203c 2f6c 693e 0a20 method.
  • . │ │ │ +000c7150: 203c 6c69 3e0a 2020 2052 4546 3a20 4c4d
  • . REF: LM │ │ │ +000c7160: 4544 5320 2d20 4c65 6173 742d 4d65 6469 EDS - Least-Medi │ │ │ +000c7170: 616e 2072 6f62 7573 7420 6d65 7468 6f64 an robust method │ │ │ +000c7180: 0a52 414e 5341 4320 6973 2074 6865 2064 .RANSAC is the d │ │ │ +000c7190: 6566 6175 6c74 206d 6574 686f 642e 0a20 efault method.. │ │ │ +000c71a0: 203c 2f6c 693e 0a3c 2f75 6c3e 3c2f 6464
  • .
    .
    rans │ │ │ +000c71c0: 6163 5265 7072 6f6a 5468 7265 7368 6f6c acReprojThreshol │ │ │ +000c71d0: 643c 2f63 6f64 653e 202d 204d 6178 696d d - Maxim │ │ │ +000c71e0: 756d 2072 6570 726f 6a65 6374 696f 6e20 um reprojection │ │ │ +000c71f0: 6572 726f 7220 696e 2074 6865 2052 414e error in the RAN │ │ │ +000c7200: 5341 4320 616c 676f 7269 7468 6d20 746f SAC algorithm to │ │ │ +000c7210: 2063 6f6e 7369 6465 720a 6120 706f 696e consider.a poin │ │ │ +000c7220: 7420 6173 2061 6e20 696e 6c69 6572 2e20 t as an inlier. │ │ │ +000c7230: 4170 706c 6965 7320 6f6e 6c79 2074 6f20 Applies only to │ │ │ +000c7240: 5241 4e53 4143 2e0a 6265 7477 6565 6e20 RANSAC..between │ │ │ +000c7250: 302e 3935 2061 6e64 2030 2e39 3920 6973 0.95 and 0.99 is │ │ │ +000c7260: 2075 7375 616c 6c79 2067 6f6f 6420 656e usually good en │ │ │ +000c7270: 6f75 6768 2e20 5661 6c75 6573 2074 6f6f ough. Values too │ │ │ +000c7280: 2063 6c6f 7365 2074 6f20 3120 6361 6e20 close to 1 can │ │ │ +000c7290: 736c 6f77 2064 6f77 6e20 7468 6520 6573 slow down the es │ │ │ +000c72a0: 7469 6d61 7469 6f6e 0a73 6967 6e69 6669 timation.signifi │ │ │ +000c72b0: 6361 6e74 6c79 2e20 5661 6c75 6573 206c cantly. Values l │ │ │ +000c72c0: 6f77 6572 2074 6861 6e20 302e 382d 302e ower than 0.8-0. │ │ │ +000c72d0: 3920 6361 6e20 7265 7375 6c74 2069 6e20 9 can result in │ │ │ +000c72e0: 616e 2069 6e63 6f72 7265 6374 6c79 2065 an incorrectly e │ │ │ +000c72f0: 7374 696d 6174 6564 2074 7261 6e73 666f stimated transfo │ │ │ +000c7300: 726d 6174 696f 6e2e 0a50 6173 7369 6e67 rmation..Passing │ │ │ +000c7310: 2030 2077 696c 6c20 6469 7361 626c 6520 0 will disable │ │ │ +000c7320: 7265 6669 6e69 6e67 2c20 736f 2074 6865 refining, so the │ │ │ +000c7330: 206f 7574 7075 7420 6d61 7472 6978 2077 output matrix w │ │ │ +000c7340: 696c 6c20 6265 206f 7574 7075 7420 6f66 ill be output of │ │ │ +000c7350: 2072 6f62 7573 7420 6d65 7468 6f64 2e3c robust method.< │ │ │ +000c7360: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
    Returns │ │ │ +000c7370: 3a3c 2f64 743e 0a3c 6464 3e4f 7574 7075 :
    .
    Outpu │ │ │ +000c7380: 7420 3244 2061 6666 696e 6520 7472 616e t 2D affine tran │ │ │ +000c7390: 7366 6f72 6d61 7469 6f6e 2028 3420 6465 sformation (4 de │ │ │ +000c73a0: 6772 6565 7320 6f66 2066 7265 6564 6f6d grees of freedom │ │ │ +000c73b0: 2920 6d61 7472 6978 205c 2832 205c 7469 ) matrix \(2 \ti │ │ │ +000c73c0: 6d65 7320 335c 2920 6f72 0a65 6d70 7479 mes 3\) or.empty │ │ │ +000c73d0: 206d 6174 7269 7820 6966 2074 7261 6e73 matrix if trans │ │ │ +000c73e0: 666f 726d 6174 696f 6e20 636f 756c 6420 formation could │ │ │ +000c73f0: 6e6f 7420 6265 2065 7374 696d 6174 6564 not be estimated │ │ │ +000c7400: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ +000c7410: 6573 7469 6d61 7465 7320 616e 206f 7074 estimates an opt │ │ │ +000c7420: 696d 616c 2032 4420 6166 6669 6e65 2074 imal 2D affine t │ │ │ +000c7430: 7261 6e73 666f 726d 6174 696f 6e20 7769 ransformation wi │ │ │ +000c7440: 7468 2034 2064 6567 7265 6573 206f 6620 th 4 degrees of │ │ │ +000c7450: 6672 6565 646f 6d20 6c69 6d69 7465 6420 freedom limited │ │ │ +000c7460: 746f 0a63 6f6d 6269 6e61 7469 6f6e 7320 to.combinations │ │ │ +000c7470: 6f66 2074 7261 6e73 6c61 7469 6f6e 2c20 of translation, │ │ │ +000c7480: 726f 7461 7469 6f6e 2c20 616e 6420 756e rotation, and un │ │ │ +000c7490: 6966 6f72 6d20 7363 616c 696e 672e 2055 iform scaling. U │ │ │ +000c74a0: 7365 7320 7468 6520 7365 6c65 6374 6564 ses the selected │ │ │ +000c74b0: 2061 6c67 6f72 6974 686d 2066 6f72 2072 algorithm for r │ │ │ +000c74c0: 6f62 7573 740a 6573 7469 6d61 7469 6f6e obust.estimation │ │ │ +000c74d0: 2e0a 0a54 6865 2063 6f6d 7075 7465 6420 ...The computed │ │ │ +000c74e0: 7472 616e 7366 6f72 6d61 7469 6f6e 2069 transformation i │ │ │ +000c74f0: 7320 7468 656e 2072 6566 696e 6564 2066 s then refined f │ │ │ +000c7500: 7572 7468 6572 2028 7573 696e 6720 6f6e urther (using on │ │ │ +000c7510: 6c79 2069 6e6c 6965 7273 2920 7769 7468 ly inliers) with │ │ │ +000c7520: 2074 6865 0a4c 6576 656e 6265 7267 2d4d the.Levenberg-M │ │ │ +000c7530: 6172 7175 6172 6474 206d 6574 686f 6420 arquardt method │ │ │ +000c7540: 746f 2072 6564 7563 6520 7468 6520 7265 to reduce the re │ │ │ +000c7550: 2d70 726f 6a65 6374 696f 6e20 6572 726f -projection erro │ │ │ +000c7560: 7220 6576 656e 206d 6f72 652e 0a0a 4573 r even more...Es │ │ │ +000c7570: 7469 6d61 7465 6420 7472 616e 7366 6f72 timated transfor │ │ │ +000c7580: 6d61 7469 6f6e 206d 6174 7269 7820 6973 mation matrix is │ │ │ +000c7590: 3a0a 5c28 205c 6265 6769 6e7b 626d 6174 :.\( \begin{bmat │ │ │ +000c75a0: 7269 787d 205c 636f 7328 5c74 6865 7461 rix} \cos(\theta │ │ │ +000c75b0: 2920 5c63 646f 7420 7320 2661 6d70 3b20 ) \cdot s & │ │ │ +000c75c0: 2d5c 7369 6e28 5c74 6865 7461 2920 5c63 -\sin(\theta) \c │ │ │ +000c75d0: 646f 7420 7320 2661 6d70 3b20 745f 7820 dot s & t_x │ │ │ +000c75e0: 5c5c 0a20 2020 2020 2020 2020 2020 2020 \\. │ │ │ +000c75f0: 2020 205c 7369 6e28 5c74 6865 7461 2920 \sin(\theta) │ │ │ +000c7600: 5c63 646f 7420 7320 2661 6d70 3b20 5c63 \cdot s & \c │ │ │ +000c7610: 6f73 285c 7468 6574 6129 205c 6364 6f74 os(\theta) \cdot │ │ │ +000c7620: 2073 2026 616d 703b 2074 5f79 0a5c 656e s & t_y.\en │ │ │ +000c7630: 647b 626d 6174 7269 787d 205c 290a 5768 d{bmatrix} \).Wh │ │ │ +000c7640: 6572 6520 5c28 205c 7468 6574 6120 5c29 ere \( \theta \) │ │ │ +000c7650: 2069 7320 7468 6520 726f 7461 7469 6f6e is the rotation │ │ │ +000c7660: 2061 6e67 6c65 2c20 5c28 2073 205c 2920 angle, \( s \) │ │ │ +000c7670: 7468 6520 7363 616c 696e 6720 6661 6374 the scaling fact │ │ │ +000c7680: 6f72 2061 6e64 205c 2820 745f 782c 2074 or and \( t_x, t │ │ │ +000c7690: 5f79 205c 2920 6172 650a 7472 616e 736c _y \) are.transl │ │ │ +000c76a0: 6174 696f 6e73 2069 6e20 5c28 2078 2c20 ations in \( x, │ │ │ +000c76b0: 7920 5c29 2061 7865 7320 7265 7370 6563 y \) axes respec │ │ │ +000c76c0: 7469 7665 6c79 2e0a 0a3c 623e 4e6f 7465 tively...Note │ │ │ +000c76d0: 3a3c 2f62 3e0a 5468 6520 5241 4e53 4143 :.The RANSAC │ │ │ +000c76e0: 206d 6574 686f 6420 6361 6e20 6861 6e64 method can hand │ │ │ +000c76f0: 6c65 2070 7261 6374 6963 616c 6c79 2061 le practically a │ │ │ +000c7700: 6e79 2072 6174 696f 206f 6620 6f75 746c ny ratio of outl │ │ │ +000c7710: 6965 7273 2062 7574 206e 6565 6420 6120 iers but need a │ │ │ +000c7720: 7468 7265 7368 6f6c 6420 746f 0a64 6973 threshold to.dis │ │ │ +000c7730: 7469 6e67 7569 7368 2069 6e6c 6965 7273 tinguish inliers │ │ │ +000c7740: 2066 726f 6d20 6f75 746c 6965 7273 2e20 from outliers. │ │ │ +000c7750: 5468 6520 6d65 7468 6f64 204c 4d65 4453 The method LMeDS │ │ │ +000c7760: 2064 6f65 7320 6e6f 7420 6e65 6564 2061 does not need a │ │ │ +000c7770: 6e79 2074 6872 6573 686f 6c64 2062 7574 ny threshold but │ │ │ +000c7780: 2069 7420 776f 726b 730a 636f 7272 6563 it works.correc │ │ │ +000c7790: 746c 7920 6f6e 6c79 2077 6865 6e20 7468 tly only when th │ │ │ +000c77a0: 6572 6520 6172 6520 6d6f 7265 2074 6861 ere are more tha │ │ │ +000c77b0: 6e20 3530 2520 6f66 2069 6e6c 6965 7273 n 50% of inliers │ │ │ +000c77c0: 2e0a 0a53 4545 3a20 6573 7469 6d61 7465 ...SEE: estimate │ │ │ +000c77d0: 4166 6669 6e65 3244 2c20 6765 7441 6666 Affine2D, getAff │ │ │ +000c77e0: 696e 6554 7261 6e73 666f 726d 3c2f 6464 ineTransform
    .
    .
    .< │ │ │ +000c7800: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ +000c7810: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    │ │ │ +000c7890: 6573 7469 6d61 7465 4166 6669 6e65 5061 estimateAffinePa │ │ │ +000c78a0: 7274 6961 6c32 443c 2f68 333e 0a3c 6469 rtial2D

    ..public static │ │ │ +000c7910: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  Mat estimateAffine │ │ │ +000c79b0: 5061 7274 6961 6c32 443c 2f73 7061 6e3e Partial2D │ │ │ +000c79c0: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ +000c79e0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000c79f0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000c7a00: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000c7a10: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat from,. < │ │ │ +000c7a30: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000c7a40: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000c7a50: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000c7a60: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat to,. Mat │ │ │ +000c7ac0: 266e 6273 703b 696e 6c69 6572 732c 0a20  inliers,. │ │ │ +000c7ad0: 696e 7426 6e62 7370 3b6d 6574 686f 6429 int method) │ │ │ +000c7ae0: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64 .Computes an opt │ │ │ +000c7b10: 696d 616c 206c 696d 6974 6564 2061 6666 imal limited aff │ │ │ +000c7b20: 696e 6520 7472 616e 7366 6f72 6d61 7469 ine transformati │ │ │ +000c7b30: 6f6e 2077 6974 6820 3420 6465 6772 6565 on with 4 degree │ │ │ +000c7b40: 7320 6f66 2066 7265 6564 6f6d 2062 6574 s of freedom bet │ │ │ +000c7b50: 7765 656e 0a74 776f 2032 4420 706f 696e ween.two 2D poin │ │ │ +000c7b60: 7420 7365 7473 2e3c 2f64 6976 3e0a 3c64 t sets.. │ │ │ +000c7b80: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +000c7b90: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000c7ba0: 6672 6f6d 3c2f 636f 6465 3e20 2d20 4669 from - Fi │ │ │ +000c7bb0: 7273 7420 696e 7075 7420 3244 2070 6f69 rst input 2D poi │ │ │ +000c7bc0: 6e74 2073 6574 2e3c 2f64 643e 0a3c 6464 nt set.
    .
    to │ │ │ +000c7be0: 202d 2053 6563 6f6e 6420 696e 7075 7420 - Second input │ │ │ +000c7bf0: 3244 2070 6f69 6e74 2073 6574 2e3c 2f64 2D point set..
    inl │ │ │ +000c7c10: 6965 7273 3c2f 636f 6465 3e20 2d20 4f75 iers - Ou │ │ │ +000c7c20: 7470 7574 2076 6563 746f 7220 696e 6469 tput vector indi │ │ │ +000c7c30: 6361 7469 6e67 2077 6869 6368 2070 6f69 cating which poi │ │ │ +000c7c40: 6e74 7320 6172 6520 696e 6c69 6572 732e nts are inliers. │ │ │ +000c7c50: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000c7c60: 6d65 7468 6f64 3c2f 636f 6465 3e20 2d20 method - │ │ │ +000c7c70: 526f 6275 7374 206d 6574 686f 6420 7573 Robust method us │ │ │ +000c7c80: 6564 2074 6f20 636f 6d70 7574 6520 7472 ed to compute tr │ │ │ +000c7c90: 616e 7366 6f72 6d61 7469 6f6e 2e20 5468 ansformation. Th │ │ │ +000c7ca0: 6520 666f 6c6c 6f77 696e 6720 6d65 7468 e following meth │ │ │ +000c7cb0: 6f64 7320 6172 6520 706f 7373 6962 6c65 ods are possible │ │ │ +000c7cc0: 3a0a 3c75 6c3e 0a20 203c 6c69 3e0a 2020 :.
      .
    • . │ │ │ +000c7cd0: 2052 4546 3a20 5241 4e53 4143 202d 2052 REF: RANSAC - R │ │ │ +000c7ce0: 414e 5341 432d 6261 7365 6420 726f 6275 ANSAC-based robu │ │ │ +000c7cf0: 7374 206d 6574 686f 640a 2020 3c2f 6c69 st method.
    • .
    • . REF: │ │ │ +000c7d10: 204c 4d45 4453 202d 204c 6561 7374 2d4d LMEDS - Least-M │ │ │ +000c7d20: 6564 6961 6e20 726f 6275 7374 206d 6574 edian robust met │ │ │ +000c7d30: 686f 640a 5241 4e53 4143 2069 7320 7468 hod.RANSAC is th │ │ │ +000c7d40: 6520 6465 6661 756c 7420 6d65 7468 6f64 e default method │ │ │ +000c7d50: 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c 3e0a ..
    • .
    . │ │ │ +000c7d60: 6120 706f 696e 7420 6173 2061 6e20 696e a point as an in │ │ │ +000c7d70: 6c69 6572 2e20 4170 706c 6965 7320 6f6e lier. Applies on │ │ │ +000c7d80: 6c79 2074 6f20 5241 4e53 4143 2e0a 6265 ly to RANSAC..be │ │ │ +000c7d90: 7477 6565 6e20 302e 3935 2061 6e64 2030 tween 0.95 and 0 │ │ │ +000c7da0: 2e39 3920 6973 2075 7375 616c 6c79 2067 .99 is usually g │ │ │ +000c7db0: 6f6f 6420 656e 6f75 6768 2e20 5661 6c75 ood enough. Valu │ │ │ +000c7dc0: 6573 2074 6f6f 2063 6c6f 7365 2074 6f20 es too close to │ │ │ +000c7dd0: 3120 6361 6e20 736c 6f77 2064 6f77 6e20 1 can slow down │ │ │ +000c7de0: 7468 6520 6573 7469 6d61 7469 6f6e 0a73 the estimation.s │ │ │ +000c7df0: 6967 6e69 6669 6361 6e74 6c79 2e20 5661 ignificantly. Va │ │ │ +000c7e00: 6c75 6573 206c 6f77 6572 2074 6861 6e20 lues lower than │ │ │ +000c7e10: 302e 382d 302e 3920 6361 6e20 7265 7375 0.8-0.9 can resu │ │ │ +000c7e20: 6c74 2069 6e20 616e 2069 6e63 6f72 7265 lt in an incorre │ │ │ +000c7e30: 6374 6c79 2065 7374 696d 6174 6564 2074 ctly estimated t │ │ │ +000c7e40: 7261 6e73 666f 726d 6174 696f 6e2e 0a50 ransformation..P │ │ │ +000c7e50: 6173 7369 6e67 2030 2077 696c 6c20 6469 assing 0 will di │ │ │ +000c7e60: 7361 626c 6520 7265 6669 6e69 6e67 2c20 sable refining, │ │ │ +000c7e70: 736f 2074 6865 206f 7574 7075 7420 6d61 so the output ma │ │ │ +000c7e80: 7472 6978 2077 696c 6c20 6265 206f 7574 trix will be out │ │ │ +000c7e90: 7075 7420 6f66 2072 6f62 7573 7420 6d65 put of robust me │ │ │ +000c7ea0: 7468 6f64 2e3c 2f64 643e 0a3c 6474 3e52 thod.
    .
    R │ │ │ +000c7eb0: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    Output 2D affin │ │ │ +000c7ed0: 6520 7472 616e 7366 6f72 6d61 7469 6f6e e transformation │ │ │ +000c7ee0: 2028 3420 6465 6772 6565 7320 6f66 2066 (4 degrees of f │ │ │ +000c7ef0: 7265 6564 6f6d 2920 6d61 7472 6978 205c reedom) matrix \ │ │ │ +000c7f00: 2832 205c 7469 6d65 7320 335c 2920 6f72 (2 \times 3\) or │ │ │ +000c7f10: 0a65 6d70 7479 206d 6174 7269 7820 6966 .empty matrix if │ │ │ +000c7f20: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ +000c7f30: 636f 756c 6420 6e6f 7420 6265 2065 7374 could not be est │ │ │ +000c7f40: 696d 6174 6564 2e0a 0a54 6865 2066 756e imated...The fun │ │ │ +000c7f50: 6374 696f 6e20 6573 7469 6d61 7465 7320 ction estimates │ │ │ +000c7f60: 616e 206f 7074 696d 616c 2032 4420 6166 an optimal 2D af │ │ │ +000c7f70: 6669 6e65 2074 7261 6e73 666f 726d 6174 fine transformat │ │ │ +000c7f80: 696f 6e20 7769 7468 2034 2064 6567 7265 ion with 4 degre │ │ │ +000c7f90: 6573 206f 6620 6672 6565 646f 6d20 6c69 es of freedom li │ │ │ +000c7fa0: 6d69 7465 6420 746f 0a63 6f6d 6269 6e61 mited to.combina │ │ │ +000c7fb0: 7469 6f6e 7320 6f66 2074 7261 6e73 6c61 tions of transla │ │ │ +000c7fc0: 7469 6f6e 2c20 726f 7461 7469 6f6e 2c20 tion, rotation, │ │ │ +000c7fd0: 616e 6420 756e 6966 6f72 6d20 7363 616c and uniform scal │ │ │ +000c7fe0: 696e 672e 2055 7365 7320 7468 6520 7365 ing. Uses the se │ │ │ +000c7ff0: 6c65 6374 6564 2061 6c67 6f72 6974 686d lected algorithm │ │ │ +000c8000: 2066 6f72 2072 6f62 7573 740a 6573 7469 for robust.esti │ │ │ +000c8010: 6d61 7469 6f6e 2e0a 0a54 6865 2063 6f6d mation...The com │ │ │ +000c8020: 7075 7465 6420 7472 616e 7366 6f72 6d61 puted transforma │ │ │ +000c8030: 7469 6f6e 2069 7320 7468 656e 2072 6566 tion is then ref │ │ │ +000c8040: 696e 6564 2066 7572 7468 6572 2028 7573 ined further (us │ │ │ +000c8050: 696e 6720 6f6e 6c79 2069 6e6c 6965 7273 ing only inliers │ │ │ +000c8060: 2920 7769 7468 2074 6865 0a4c 6576 656e ) with the.Leven │ │ │ +000c8070: 6265 7267 2d4d 6172 7175 6172 6474 206d berg-Marquardt m │ │ │ +000c8080: 6574 686f 6420 746f 2072 6564 7563 6520 ethod to reduce │ │ │ +000c8090: 7468 6520 7265 2d70 726f 6a65 6374 696f the re-projectio │ │ │ +000c80a0: 6e20 6572 726f 7220 6576 656e 206d 6f72 n error even mor │ │ │ +000c80b0: 652e 0a0a 4573 7469 6d61 7465 6420 7472 e...Estimated tr │ │ │ +000c80c0: 616e 7366 6f72 6d61 7469 6f6e 206d 6174 ansformation mat │ │ │ +000c80d0: 7269 7820 6973 3a0a 5c28 205c 6265 6769 rix is:.\( \begi │ │ │ +000c80e0: 6e7b 626d 6174 7269 787d 205c 636f 7328 n{bmatrix} \cos( │ │ │ +000c80f0: 5c74 6865 7461 2920 5c63 646f 7420 7320 \theta) \cdot s │ │ │ +000c8100: 2661 6d70 3b20 2d5c 7369 6e28 5c74 6865 & -\sin(\the │ │ │ +000c8110: 7461 2920 5c63 646f 7420 7320 2661 6d70 ta) \cdot s & │ │ │ +000c8120: 3b20 745f 7820 5c5c 0a20 2020 2020 2020 ; t_x \\. │ │ │ +000c8130: 2020 2020 2020 2020 205c 7369 6e28 5c74 \sin(\t │ │ │ +000c8140: 6865 7461 2920 5c63 646f 7420 7320 2661 heta) \cdot s &a │ │ │ +000c8150: 6d70 3b20 5c63 6f73 285c 7468 6574 6129 mp; \cos(\theta) │ │ │ +000c8160: 205c 6364 6f74 2073 2026 616d 703b 2074 \cdot s & t │ │ │ +000c8170: 5f79 0a5c 656e 647b 626d 6174 7269 787d _y.\end{bmatrix} │ │ │ +000c8180: 205c 290a 5768 6572 6520 5c28 205c 7468 \).Where \( \th │ │ │ +000c8190: 6574 6120 5c29 2069 7320 7468 6520 726f eta \) is the ro │ │ │ +000c81a0: 7461 7469 6f6e 2061 6e67 6c65 2c20 5c28 tation angle, \( │ │ │ +000c81b0: 2073 205c 2920 7468 6520 7363 616c 696e s \) the scalin │ │ │ +000c81c0: 6720 6661 6374 6f72 2061 6e64 205c 2820 g factor and \( │ │ │ +000c81d0: 745f 782c 2074 5f79 205c 2920 6172 650a t_x, t_y \) are. │ │ │ +000c81e0: 7472 616e 736c 6174 696f 6e73 2069 6e20 translations in │ │ │ +000c81f0: 5c28 2078 2c20 7920 5c29 2061 7865 7320 \( x, y \) axes │ │ │ +000c8200: 7265 7370 6563 7469 7665 6c79 2e0a 0a3c respectively...< │ │ │ +000c8210: 623e 4e6f 7465 3a3c 2f62 3e0a 5468 6520 b>Note:.The │ │ │ +000c8220: 5241 4e53 4143 206d 6574 686f 6420 6361 RANSAC method ca │ │ │ +000c8230: 6e20 6861 6e64 6c65 2070 7261 6374 6963 n handle practic │ │ │ +000c8240: 616c 6c79 2061 6e79 2072 6174 696f 206f ally any ratio o │ │ │ +000c8250: 6620 6f75 746c 6965 7273 2062 7574 206e f outliers but n │ │ │ +000c8260: 6565 6420 6120 7468 7265 7368 6f6c 6420 eed a threshold │ │ │ +000c8270: 746f 0a64 6973 7469 6e67 7569 7368 2069 to.distinguish i │ │ │ +000c8280: 6e6c 6965 7273 2066 726f 6d20 6f75 746c nliers from outl │ │ │ +000c8290: 6965 7273 2e20 5468 6520 6d65 7468 6f64 iers. The method │ │ │ +000c82a0: 204c 4d65 4453 2064 6f65 7320 6e6f 7420 LMeDS does not │ │ │ +000c82b0: 6e65 6564 2061 6e79 2074 6872 6573 686f need any thresho │ │ │ +000c82c0: 6c64 2062 7574 2069 7420 776f 726b 730a ld but it works. │ │ │ +000c82d0: 636f 7272 6563 746c 7920 6f6e 6c79 2077 correctly only w │ │ │ +000c82e0: 6865 6e20 7468 6572 6520 6172 6520 6d6f hen there are mo │ │ │ +000c82f0: 7265 2074 6861 6e20 3530 2520 6f66 2069 re than 50% of i │ │ │ +000c8300: 6e6c 6965 7273 2e0a 0a53 4545 3a20 6573 nliers...SEE: es │ │ │ +000c8310: 7469 6d61 7465 4166 6669 6e65 3244 2c20 timateAffine2D, │ │ │ +000c8320: 6765 7441 6666 696e 6554 7261 6e73 666f getAffineTransfo │ │ │ +000c8330: 726d 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f rm
    ...
    . │ │ │ +000c8350: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..estimateAffine │ │ │ +000c83e0: 5061 7274 6961 6c32 443c 2f68 333e 0a3c Partial2D.< │ │ │ +000c83f0: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +000c8400: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +000c8410: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +000c8420: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +000c8450: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +000c8460: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +000c8470: 726e 2d74 7970 6522 3e3c 6120 6872 6566 rn-type">Mat estimateAffi │ │ │ +000c84f0: 6e65 5061 7274 6961 6c32 443c 2f73 7061 nePartial2D │ │ │ +000c8520: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ +000c8560: 3c2f 613e 266e 6273 703b 6672 6f6d 2c0a  from,. │ │ │ +000c8570: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000c85b0: 3c2f 613e 266e 6273 703b 746f 2c0a 203c  to,. < │ │ │ +000c85c0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000c85d0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000c85e0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000c85f0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat inliers) │ │ │ +000c8610: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64 .Computes an opt │ │ │ +000c8640: 696d 616c 206c 696d 6974 6564 2061 6666 imal limited aff │ │ │ +000c8650: 696e 6520 7472 616e 7366 6f72 6d61 7469 ine transformati │ │ │ +000c8660: 6f6e 2077 6974 6820 3420 6465 6772 6565 on with 4 degree │ │ │ +000c8670: 7320 6f66 2066 7265 6564 6f6d 2062 6574 s of freedom bet │ │ │ +000c8680: 7765 656e 0a74 776f 2032 4420 706f 696e ween.two 2D poin │ │ │ +000c8690: 7420 7365 7473 2e3c 2f64 6976 3e0a 3c64 t sets.. │ │ │ +000c86b0: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +000c86c0: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000c86d0: 6672 6f6d 3c2f 636f 6465 3e20 2d20 4669 from - Fi │ │ │ +000c86e0: 7273 7420 696e 7075 7420 3244 2070 6f69 rst input 2D poi │ │ │ +000c86f0: 6e74 2073 6574 2e3c 2f64 643e 0a3c 6464 nt set.
    .
    to │ │ │ +000c8710: 202d 2053 6563 6f6e 6420 696e 7075 7420 - Second input │ │ │ +000c8720: 3244 2070 6f69 6e74 2073 6574 2e3c 2f64 2D point set..
    inl │ │ │ +000c8740: 6965 7273 3c2f 636f 6465 3e20 2d20 4f75 iers - Ou │ │ │ +000c8750: 7470 7574 2076 6563 746f 7220 696e 6469 tput vector indi │ │ │ +000c8760: 6361 7469 6e67 2077 6869 6368 2070 6f69 cating which poi │ │ │ +000c8770: 6e74 7320 6172 6520 696e 6c69 6572 732e nts are inliers. │ │ │ +000c8780: 0a3c 756c 3e0a 2020 3c6c 693e 0a20 2020 .
      .
    • . │ │ │ +000c8790: 5245 463a 2052 414e 5341 4320 2d20 5241 REF: RANSAC - RA │ │ │ +000c87a0: 4e53 4143 2d62 6173 6564 2072 6f62 7573 NSAC-based robus │ │ │ +000c87b0: 7420 6d65 7468 6f64 0a20 203c 2f6c 693e t method.
    • │ │ │ +000c87c0: 0a20 203c 6c69 3e0a 2020 2052 4546 3a20 .
    • . REF: │ │ │ +000c87d0: 4c4d 4544 5320 2d20 4c65 6173 742d 4d65 LMEDS - Least-Me │ │ │ +000c87e0: 6469 616e 2072 6f62 7573 7420 6d65 7468 dian robust meth │ │ │ +000c87f0: 6f64 0a52 414e 5341 4320 6973 2074 6865 od.RANSAC is the │ │ │ +000c8800: 2064 6566 6175 6c74 206d 6574 686f 642e default method. │ │ │ +000c8810: 0a20 203c 2f6c 693e 0a3c 2f75 6c3e 0a61 .
    • .
    .a │ │ │ +000c8820: 2070 6f69 6e74 2061 7320 616e 2069 6e6c point as an inl │ │ │ +000c8830: 6965 722e 2041 7070 6c69 6573 206f 6e6c ier. Applies onl │ │ │ +000c8840: 7920 746f 2052 414e 5341 432e 0a62 6574 y to RANSAC..bet │ │ │ +000c8850: 7765 656e 2030 2e39 3520 616e 6420 302e ween 0.95 and 0. │ │ │ +000c8860: 3939 2069 7320 7573 7561 6c6c 7920 676f 99 is usually go │ │ │ +000c8870: 6f64 2065 6e6f 7567 682e 2056 616c 7565 od enough. Value │ │ │ +000c8880: 7320 746f 6f20 636c 6f73 6520 746f 2031 s too close to 1 │ │ │ +000c8890: 2063 616e 2073 6c6f 7720 646f 776e 2074 can slow down t │ │ │ +000c88a0: 6865 2065 7374 696d 6174 696f 6e0a 7369 he estimation.si │ │ │ +000c88b0: 676e 6966 6963 616e 746c 792e 2056 616c gnificantly. Val │ │ │ +000c88c0: 7565 7320 6c6f 7765 7220 7468 616e 2030 ues lower than 0 │ │ │ +000c88d0: 2e38 2d30 2e39 2063 616e 2072 6573 756c .8-0.9 can resul │ │ │ +000c88e0: 7420 696e 2061 6e20 696e 636f 7272 6563 t in an incorrec │ │ │ +000c88f0: 746c 7920 6573 7469 6d61 7465 6420 7472 tly estimated tr │ │ │ +000c8900: 616e 7366 6f72 6d61 7469 6f6e 2e0a 5061 ansformation..Pa │ │ │ +000c8910: 7373 696e 6720 3020 7769 6c6c 2064 6973 ssing 0 will dis │ │ │ +000c8920: 6162 6c65 2072 6566 696e 696e 672c 2073 able refining, s │ │ │ +000c8930: 6f20 7468 6520 6f75 7470 7574 206d 6174 o the output mat │ │ │ +000c8940: 7269 7820 7769 6c6c 2062 6520 6f75 7470 rix will be outp │ │ │ +000c8950: 7574 206f 6620 726f 6275 7374 206d 6574 ut of robust met │ │ │ +000c8960: 686f 642e 3c2f 6464 3e0a 3c64 743e 5265 hod.
    .
    Re │ │ │ +000c8970: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ +000c8980: 4f75 7470 7574 2032 4420 6166 6669 6e65 Output 2D affine │ │ │ +000c8990: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ +000c89a0: 2834 2064 6567 7265 6573 206f 6620 6672 (4 degrees of fr │ │ │ +000c89b0: 6565 646f 6d29 206d 6174 7269 7820 5c28 eedom) matrix \( │ │ │ +000c89c0: 3220 5c74 696d 6573 2033 5c29 206f 720a 2 \times 3\) or. │ │ │ +000c89d0: 656d 7074 7920 6d61 7472 6978 2069 6620 empty matrix if │ │ │ +000c89e0: 7472 616e 7366 6f72 6d61 7469 6f6e 2063 transformation c │ │ │ +000c89f0: 6f75 6c64 206e 6f74 2062 6520 6573 7469 ould not be esti │ │ │ +000c8a00: 6d61 7465 642e 0a0a 5468 6520 6675 6e63 mated...The func │ │ │ +000c8a10: 7469 6f6e 2065 7374 696d 6174 6573 2061 tion estimates a │ │ │ +000c8a20: 6e20 6f70 7469 6d61 6c20 3244 2061 6666 n optimal 2D aff │ │ │ +000c8a30: 696e 6520 7472 616e 7366 6f72 6d61 7469 ine transformati │ │ │ +000c8a40: 6f6e 2077 6974 6820 3420 6465 6772 6565 on with 4 degree │ │ │ +000c8a50: 7320 6f66 2066 7265 6564 6f6d 206c 696d s of freedom lim │ │ │ +000c8a60: 6974 6564 2074 6f0a 636f 6d62 696e 6174 ited to.combinat │ │ │ +000c8a70: 696f 6e73 206f 6620 7472 616e 736c 6174 ions of translat │ │ │ +000c8a80: 696f 6e2c 2072 6f74 6174 696f 6e2c 2061 ion, rotation, a │ │ │ +000c8a90: 6e64 2075 6e69 666f 726d 2073 6361 6c69 nd uniform scali │ │ │ +000c8aa0: 6e67 2e20 5573 6573 2074 6865 2073 656c ng. Uses the sel │ │ │ +000c8ab0: 6563 7465 6420 616c 676f 7269 7468 6d20 ected algorithm │ │ │ +000c8ac0: 666f 7220 726f 6275 7374 0a65 7374 696d for robust.estim │ │ │ +000c8ad0: 6174 696f 6e2e 0a0a 5468 6520 636f 6d70 ation...The comp │ │ │ +000c8ae0: 7574 6564 2074 7261 6e73 666f 726d 6174 uted transformat │ │ │ +000c8af0: 696f 6e20 6973 2074 6865 6e20 7265 6669 ion is then refi │ │ │ +000c8b00: 6e65 6420 6675 7274 6865 7220 2875 7369 ned further (usi │ │ │ +000c8b10: 6e67 206f 6e6c 7920 696e 6c69 6572 7329 ng only inliers) │ │ │ +000c8b20: 2077 6974 6820 7468 650a 4c65 7665 6e62 with the.Levenb │ │ │ +000c8b30: 6572 672d 4d61 7271 7561 7264 7420 6d65 erg-Marquardt me │ │ │ +000c8b40: 7468 6f64 2074 6f20 7265 6475 6365 2074 thod to reduce t │ │ │ +000c8b50: 6865 2072 652d 7072 6f6a 6563 7469 6f6e he re-projection │ │ │ +000c8b60: 2065 7272 6f72 2065 7665 6e20 6d6f 7265 error even more │ │ │ +000c8b70: 2e0a 0a45 7374 696d 6174 6564 2074 7261 ...Estimated tra │ │ │ +000c8b80: 6e73 666f 726d 6174 696f 6e20 6d61 7472 nsformation matr │ │ │ +000c8b90: 6978 2069 733a 0a5c 2820 5c62 6567 696e ix is:.\( \begin │ │ │ +000c8ba0: 7b62 6d61 7472 6978 7d20 5c63 6f73 285c {bmatrix} \cos(\ │ │ │ +000c8bb0: 7468 6574 6129 205c 6364 6f74 2073 2026 theta) \cdot s & │ │ │ +000c8bc0: 616d 703b 202d 5c73 696e 285c 7468 6574 amp; -\sin(\thet │ │ │ +000c8bd0: 6129 205c 6364 6f74 2073 2026 616d 703b a) \cdot s & │ │ │ +000c8be0: 2074 5f78 205c 5c0a 2020 2020 2020 2020 t_x \\. │ │ │ +000c8bf0: 2020 2020 2020 2020 5c73 696e 285c 7468 \sin(\th │ │ │ +000c8c00: 6574 6129 205c 6364 6f74 2073 2026 616d eta) \cdot s &am │ │ │ +000c8c10: 703b 205c 636f 7328 5c74 6865 7461 2920 p; \cos(\theta) │ │ │ +000c8c20: 5c63 646f 7420 7320 2661 6d70 3b20 745f \cdot s & t_ │ │ │ +000c8c30: 790a 5c65 6e64 7b62 6d61 7472 6978 7d20 y.\end{bmatrix} │ │ │ +000c8c40: 5c29 0a57 6865 7265 205c 2820 5c74 6865 \).Where \( \the │ │ │ +000c8c50: 7461 205c 2920 6973 2074 6865 2072 6f74 ta \) is the rot │ │ │ +000c8c60: 6174 696f 6e20 616e 676c 652c 205c 2820 ation angle, \( │ │ │ +000c8c70: 7320 5c29 2074 6865 2073 6361 6c69 6e67 s \) the scaling │ │ │ +000c8c80: 2066 6163 746f 7220 616e 6420 5c28 2074 factor and \( t │ │ │ +000c8c90: 5f78 2c20 745f 7920 5c29 2061 7265 0a74 _x, t_y \) are.t │ │ │ +000c8ca0: 7261 6e73 6c61 7469 6f6e 7320 696e 205c ranslations in \ │ │ │ +000c8cb0: 2820 782c 2079 205c 2920 6178 6573 2072 ( x, y \) axes r │ │ │ +000c8cc0: 6573 7065 6374 6976 656c 792e 0a0a 3c62 espectively...Note:.The R │ │ │ +000c8ce0: 414e 5341 4320 6d65 7468 6f64 2063 616e ANSAC method can │ │ │ +000c8cf0: 2068 616e 646c 6520 7072 6163 7469 6361 handle practica │ │ │ +000c8d00: 6c6c 7920 616e 7920 7261 7469 6f20 6f66 lly any ratio of │ │ │ +000c8d10: 206f 7574 6c69 6572 7320 6275 7420 6e65 outliers but ne │ │ │ +000c8d20: 6564 2061 2074 6872 6573 686f 6c64 2074 ed a threshold t │ │ │ +000c8d30: 6f0a 6469 7374 696e 6775 6973 6820 696e o.distinguish in │ │ │ +000c8d40: 6c69 6572 7320 6672 6f6d 206f 7574 6c69 liers from outli │ │ │ +000c8d50: 6572 732e 2054 6865 206d 6574 686f 6420 ers. The method │ │ │ +000c8d60: 4c4d 6544 5320 646f 6573 206e 6f74 206e LMeDS does not n │ │ │ +000c8d70: 6565 6420 616e 7920 7468 7265 7368 6f6c eed any threshol │ │ │ +000c8d80: 6420 6275 7420 6974 2077 6f72 6b73 0a63 d but it works.c │ │ │ +000c8d90: 6f72 7265 6374 6c79 206f 6e6c 7920 7768 orrectly only wh │ │ │ +000c8da0: 656e 2074 6865 7265 2061 7265 206d 6f72 en there are mor │ │ │ +000c8db0: 6520 7468 616e 2035 3025 206f 6620 696e e than 50% of in │ │ │ +000c8dc0: 6c69 6572 732e 0a0a 5345 453a 2065 7374 liers...SEE: est │ │ │ +000c8dd0: 696d 6174 6541 6666 696e 6532 442c 2067 imateAffine2D, g │ │ │ +000c8de0: 6574 4166 6669 6e65 5472 616e 7366 6f72 etAffineTransfor │ │ │ +000c8df0: 6d3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 m
    ..
    ..< │ │ │ +000c8e10: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    est │ │ │ +000c8e80: 696d 6174 6541 6666 696e 6550 6172 7469 imateAffineParti │ │ │ +000c8e90: 616c 3244 3c2f 6833 3e0a 3c64 6976 2063 al2D

    .
    .
    │ │ │ +000c8ef0: 7075 626c 6963 2073 7461 7469 633c 2f73 public static  │ │ │ +000c8f60: 4d61 743c 2f61 3e3c 2f73 7061 6e3e 266e Mat&n │ │ │ +000c8f70: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;e │ │ │ +000c8f90: 7374 696d 6174 6541 6666 696e 6550 6172 stimateAffinePar │ │ │ +000c8fa0: 7469 616c 3244 3c2f 7370 616e 3e3c 7762 tial2D(Mat& │ │ │ +000c9010: 6e62 7370 3b66 726f 6d2c 0a20 3c61 2068 nbsp;from,. Mat& │ │ │ +000c9060: 6e62 7370 3b74 6f29 3c2f 7370 616e 3e3c nbsp;to)< │ │ │ +000c9070: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Compute │ │ │ +000c9090: 7320 616e 206f 7074 696d 616c 206c 696d s an optimal lim │ │ │ +000c90a0: 6974 6564 2061 6666 696e 6520 7472 616e ited affine tran │ │ │ +000c90b0: 7366 6f72 6d61 7469 6f6e 2077 6974 6820 sformation with │ │ │ +000c90c0: 3420 6465 6772 6565 7320 6f66 2066 7265 4 degrees of fre │ │ │ +000c90d0: 6564 6f6d 2062 6574 7765 656e 0a74 776f edom between.two │ │ │ +000c90e0: 2032 4420 706f 696e 7420 7365 7473 2e3c 2D point sets.< │ │ │ +000c90f0: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ +000c9110: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .from - First inpu │ │ │ +000c9140: 7420 3244 2070 6f69 6e74 2073 6574 2e3c t 2D point set.< │ │ │ +000c9150: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ +000c9160: 6f3c 2f63 6f64 653e 202d 2053 6563 6f6e o - Secon │ │ │ +000c9170: 6420 696e 7075 7420 3244 2070 6f69 6e74 d input 2D point │ │ │ +000c9180: 2073 6574 2e0a 3c75 6c3e 0a20 203c 6c69 set..
      .
    • . REF: RANSAC │ │ │ +000c91a0: 202d 2052 414e 5341 432d 6261 7365 6420 - RANSAC-based │ │ │ +000c91b0: 726f 6275 7374 206d 6574 686f 640a 2020 robust method. │ │ │ +000c91c0: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 2020
    • .
    • . │ │ │ +000c91d0: 5245 463a 204c 4d45 4453 202d 204c 6561 REF: LMEDS - Lea │ │ │ +000c91e0: 7374 2d4d 6564 6961 6e20 726f 6275 7374 st-Median robust │ │ │ +000c91f0: 206d 6574 686f 640a 5241 4e53 4143 2069 method.RANSAC i │ │ │ +000c9200: 7320 7468 6520 6465 6661 756c 7420 6d65 s the default me │ │ │ +000c9210: 7468 6f64 2e0a 2020 3c2f 6c69 3e0a 3c2f thod..
    • ..a point as a │ │ │ +000c9230: 6e20 696e 6c69 6572 2e20 4170 706c 6965 n inlier. Applie │ │ │ +000c9240: 7320 6f6e 6c79 2074 6f20 5241 4e53 4143 s only to RANSAC │ │ │ +000c9250: 2e0a 6265 7477 6565 6e20 302e 3935 2061 ..between 0.95 a │ │ │ +000c9260: 6e64 2030 2e39 3920 6973 2075 7375 616c nd 0.99 is usual │ │ │ +000c9270: 6c79 2067 6f6f 6420 656e 6f75 6768 2e20 ly good enough. │ │ │ +000c9280: 5661 6c75 6573 2074 6f6f 2063 6c6f 7365 Values too close │ │ │ +000c9290: 2074 6f20 3120 6361 6e20 736c 6f77 2064 to 1 can slow d │ │ │ +000c92a0: 6f77 6e20 7468 6520 6573 7469 6d61 7469 own the estimati │ │ │ +000c92b0: 6f6e 0a73 6967 6e69 6669 6361 6e74 6c79 on.significantly │ │ │ +000c92c0: 2e20 5661 6c75 6573 206c 6f77 6572 2074 . Values lower t │ │ │ +000c92d0: 6861 6e20 302e 382d 302e 3920 6361 6e20 han 0.8-0.9 can │ │ │ +000c92e0: 7265 7375 6c74 2069 6e20 616e 2069 6e63 result in an inc │ │ │ +000c92f0: 6f72 7265 6374 6c79 2065 7374 696d 6174 orrectly estimat │ │ │ +000c9300: 6564 2074 7261 6e73 666f 726d 6174 696f ed transformatio │ │ │ +000c9310: 6e2e 0a50 6173 7369 6e67 2030 2077 696c n..Passing 0 wil │ │ │ +000c9320: 6c20 6469 7361 626c 6520 7265 6669 6e69 l disable refini │ │ │ +000c9330: 6e67 2c20 736f 2074 6865 206f 7574 7075 ng, so the outpu │ │ │ +000c9340: 7420 6d61 7472 6978 2077 696c 6c20 6265 t matrix will be │ │ │ +000c9350: 206f 7574 7075 7420 6f66 2072 6f62 7573 output of robus │ │ │ +000c9360: 7420 6d65 7468 6f64 2e3c 2f64 643e 0a3c t method.
    .< │ │ │ +000c9370: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ +000c9380: 0a3c 6464 3e4f 7574 7075 7420 3244 2061 .
    Output 2D a │ │ │ +000c9390: 6666 696e 6520 7472 616e 7366 6f72 6d61 ffine transforma │ │ │ +000c93a0: 7469 6f6e 2028 3420 6465 6772 6565 7320 tion (4 degrees │ │ │ +000c93b0: 6f66 2066 7265 6564 6f6d 2920 6d61 7472 of freedom) matr │ │ │ +000c93c0: 6978 205c 2832 205c 7469 6d65 7320 335c ix \(2 \times 3\ │ │ │ +000c93d0: 2920 6f72 0a65 6d70 7479 206d 6174 7269 ) or.empty matri │ │ │ +000c93e0: 7820 6966 2074 7261 6e73 666f 726d 6174 x if transformat │ │ │ +000c93f0: 696f 6e20 636f 756c 6420 6e6f 7420 6265 ion could not be │ │ │ +000c9400: 2065 7374 696d 6174 6564 2e0a 0a54 6865 estimated...The │ │ │ +000c9410: 2066 756e 6374 696f 6e20 6573 7469 6d61 function estima │ │ │ +000c9420: 7465 7320 616e 206f 7074 696d 616c 2032 tes an optimal 2 │ │ │ +000c9430: 4420 6166 6669 6e65 2074 7261 6e73 666f D affine transfo │ │ │ +000c9440: 726d 6174 696f 6e20 7769 7468 2034 2064 rmation with 4 d │ │ │ +000c9450: 6567 7265 6573 206f 6620 6672 6565 646f egrees of freedo │ │ │ +000c9460: 6d20 6c69 6d69 7465 6420 746f 0a63 6f6d m limited to.com │ │ │ +000c9470: 6269 6e61 7469 6f6e 7320 6f66 2074 7261 binations of tra │ │ │ +000c9480: 6e73 6c61 7469 6f6e 2c20 726f 7461 7469 nslation, rotati │ │ │ +000c9490: 6f6e 2c20 616e 6420 756e 6966 6f72 6d20 on, and uniform │ │ │ +000c94a0: 7363 616c 696e 672e 2055 7365 7320 7468 scaling. Uses th │ │ │ +000c94b0: 6520 7365 6c65 6374 6564 2061 6c67 6f72 e selected algor │ │ │ +000c94c0: 6974 686d 2066 6f72 2072 6f62 7573 740a ithm for robust. │ │ │ +000c94d0: 6573 7469 6d61 7469 6f6e 2e0a 0a54 6865 estimation...The │ │ │ +000c94e0: 2063 6f6d 7075 7465 6420 7472 616e 7366 computed transf │ │ │ +000c94f0: 6f72 6d61 7469 6f6e 2069 7320 7468 656e ormation is then │ │ │ +000c9500: 2072 6566 696e 6564 2066 7572 7468 6572 refined further │ │ │ +000c9510: 2028 7573 696e 6720 6f6e 6c79 2069 6e6c (using only inl │ │ │ +000c9520: 6965 7273 2920 7769 7468 2074 6865 0a4c iers) with the.L │ │ │ +000c9530: 6576 656e 6265 7267 2d4d 6172 7175 6172 evenberg-Marquar │ │ │ +000c9540: 6474 206d 6574 686f 6420 746f 2072 6564 dt method to red │ │ │ +000c9550: 7563 6520 7468 6520 7265 2d70 726f 6a65 uce the re-proje │ │ │ +000c9560: 6374 696f 6e20 6572 726f 7220 6576 656e ction error even │ │ │ +000c9570: 206d 6f72 652e 0a0a 4573 7469 6d61 7465 more...Estimate │ │ │ +000c9580: 6420 7472 616e 7366 6f72 6d61 7469 6f6e d transformation │ │ │ +000c9590: 206d 6174 7269 7820 6973 3a0a 5c28 205c matrix is:.\( \ │ │ │ +000c95a0: 6265 6769 6e7b 626d 6174 7269 787d 205c begin{bmatrix} \ │ │ │ +000c95b0: 636f 7328 5c74 6865 7461 2920 5c63 646f cos(\theta) \cdo │ │ │ +000c95c0: 7420 7320 2661 6d70 3b20 2d5c 7369 6e28 t s & -\sin( │ │ │ +000c95d0: 5c74 6865 7461 2920 5c63 646f 7420 7320 \theta) \cdot s │ │ │ +000c95e0: 2661 6d70 3b20 745f 7820 5c5c 0a20 2020 & t_x \\. │ │ │ +000c95f0: 2020 2020 2020 2020 2020 2020 205c 7369 \si │ │ │ +000c9600: 6e28 5c74 6865 7461 2920 5c63 646f 7420 n(\theta) \cdot │ │ │ +000c9610: 7320 2661 6d70 3b20 5c63 6f73 285c 7468 s & \cos(\th │ │ │ +000c9620: 6574 6129 205c 6364 6f74 2073 2026 616d eta) \cdot s &am │ │ │ +000c9630: 703b 2074 5f79 0a5c 656e 647b 626d 6174 p; t_y.\end{bmat │ │ │ +000c9640: 7269 787d 205c 290a 5768 6572 6520 5c28 rix} \).Where \( │ │ │ +000c9650: 205c 7468 6574 6120 5c29 2069 7320 7468 \theta \) is th │ │ │ +000c9660: 6520 726f 7461 7469 6f6e 2061 6e67 6c65 e rotation angle │ │ │ +000c9670: 2c20 5c28 2073 205c 2920 7468 6520 7363 , \( s \) the sc │ │ │ +000c9680: 616c 696e 6720 6661 6374 6f72 2061 6e64 aling factor and │ │ │ +000c9690: 205c 2820 745f 782c 2074 5f79 205c 2920 \( t_x, t_y \) │ │ │ +000c96a0: 6172 650a 7472 616e 736c 6174 696f 6e73 are.translations │ │ │ +000c96b0: 2069 6e20 5c28 2078 2c20 7920 5c29 2061 in \( x, y \) a │ │ │ +000c96c0: 7865 7320 7265 7370 6563 7469 7665 6c79 xes respectively │ │ │ +000c96d0: 2e0a 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a ...Note:. │ │ │ +000c96e0: 5468 6520 5241 4e53 4143 206d 6574 686f The RANSAC metho │ │ │ +000c96f0: 6420 6361 6e20 6861 6e64 6c65 2070 7261 d can handle pra │ │ │ +000c9700: 6374 6963 616c 6c79 2061 6e79 2072 6174 ctically any rat │ │ │ +000c9710: 696f 206f 6620 6f75 746c 6965 7273 2062 io of outliers b │ │ │ +000c9720: 7574 206e 6565 6420 6120 7468 7265 7368 ut need a thresh │ │ │ +000c9730: 6f6c 6420 746f 0a64 6973 7469 6e67 7569 old to.distingui │ │ │ +000c9740: 7368 2069 6e6c 6965 7273 2066 726f 6d20 sh inliers from │ │ │ +000c9750: 6f75 746c 6965 7273 2e20 5468 6520 6d65 outliers. The me │ │ │ +000c9760: 7468 6f64 204c 4d65 4453 2064 6f65 7320 thod LMeDS does │ │ │ +000c9770: 6e6f 7420 6e65 6564 2061 6e79 2074 6872 not need any thr │ │ │ +000c9780: 6573 686f 6c64 2062 7574 2069 7420 776f eshold but it wo │ │ │ +000c9790: 726b 730a 636f 7272 6563 746c 7920 6f6e rks.correctly on │ │ │ +000c97a0: 6c79 2077 6865 6e20 7468 6572 6520 6172 ly when there ar │ │ │ +000c97b0: 6520 6d6f 7265 2074 6861 6e20 3530 2520 e more than 50% │ │ │ +000c97c0: 6f66 2069 6e6c 6965 7273 2e0a 0a53 4545 of inliers...SEE │ │ │ +000c97d0: 3a20 6573 7469 6d61 7465 4166 6669 6e65 : estimateAffine │ │ │ +000c97e0: 3244 2c20 6765 7441 6666 696e 6554 7261 2D, getAffineTra │ │ │ +000c97f0: 6e73 666f 726d 3c2f 6464 3e0a 3c2f 646c nsform
    .
    .
    ..
  • .
  • .< │ │ │ +000c9820: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +000c9830: 6574 6169 6c22 2069 643d 2265 7374 696d etail" id="estim │ │ │ +000c9840: 6174 6554 7261 6e73 6c61 7469 6f6e 3244 ateTranslation2D │ │ │ +000c9850: 286f 7267 2e6f 7065 6e63 762e 636f 7265 (org.opencv.core │ │ │ +000c9860: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ +000c9870: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ +000c9880: 6e63 762e 636f 7265 2e4d 6174 2c69 6e74 ncv.core.Mat,int │ │ │ +000c9890: 2c64 6f75 626c 652c 6c6f 6e67 2c64 6f75 ,double,long,dou │ │ │ +000c98a0: 626c 652c 6c6f 6e67 2922 3e0a 3c68 333e ble,long)">.

    │ │ │ +000c98b0: 6573 7469 6d61 7465 5472 616e 736c 6174 estimateTranslat │ │ │ +000c98c0: 696f 6e32 443c 2f68 333e 0a3c 6469 7620 ion2D

    .
    .
    public static double[] estimateTra │ │ │ +000c9990: 6e73 6c61 7469 6f6e 3244 3c2f 7370 616e nslation2D( │ │ │ +000c99c0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000c9a00: 2f61 3e26 6e62 7370 3b66 726f 6d2c 0a20 /a> from,. │ │ │ +000c9a10: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000c9a50: 2f61 3e26 6e62 7370 3b74 6f2c 0a20 3c61 /a> to,. Mat inliers,. │ │ │ +000c9ab0: 2069 6e74 266e 6273 703b 6d65 7468 6f64 int method │ │ │ +000c9ac0: 2c0a 2064 6f75 626c 6526 6e62 7370 3b72 ,. double r │ │ │ +000c9ad0: 616e 7361 6352 6570 726f 6a54 6872 6573 ansacReprojThres │ │ │ +000c9ae0: 686f 6c64 2c0a 206c 6f6e 6726 6e62 7370 hold,. long  │ │ │ +000c9af0: 3b6d 6178 4974 6572 732c 0a20 646f 7562 ;maxIters,. doub │ │ │ +000c9b00: 6c65 266e 6273 703b 636f 6e66 6964 656e le confiden │ │ │ +000c9b10: 6365 2c0a 206c 6f6e 6726 6e62 7370 3b72 ce,. long r │ │ │ +000c9b20: 6566 696e 6549 7465 7273 293c 2f73 7061 efineIters)
    .
    Comp │ │ │ +000c9b50: 7574 6573 2061 2070 7572 6520 3244 2074 utes a pure 2D t │ │ │ +000c9b60: 7261 6e73 6c61 7469 6f6e 2062 6574 7765 ranslation betwe │ │ │ +000c9b70: 656e 2074 776f 2032 4420 706f 696e 7420 en two 2D point │ │ │ +000c9b80: 7365 7473 2e0a 0a49 7420 636f 6d70 7574 sets...It comput │ │ │ +000c9b90: 6573 0a5c 280a 5c62 6567 696e 7b62 6d61 es.\(.\begin{bma │ │ │ +000c9ba0: 7472 6978 7d0a 785c 5c0a 790a 5c65 6e64 trix}.x\\.y.\end │ │ │ +000c9bb0: 7b62 6d61 7472 6978 7d0a 3d0a 5c62 6567 {bmatrix}.=.\beg │ │ │ +000c9bc0: 696e 7b62 6d61 7472 6978 7d0a 3120 2661 in{bmatrix}.1 &a │ │ │ +000c9bd0: 6d70 3b20 305c 5c0a 3020 2661 6d70 3b20 mp; 0\\.0 & │ │ │ +000c9be0: 310a 5c65 6e64 7b62 6d61 7472 6978 7d0a 1.\end{bmatrix}. │ │ │ +000c9bf0: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ +000c9c00: 585c 5c0a 590a 5c65 6e64 7b62 6d61 7472 X\\.Y.\end{bmatr │ │ │ +000c9c10: 6978 7d0a 2b0a 5c62 6567 696e 7b62 6d61 ix}.+.\begin{bma │ │ │ +000c9c20: 7472 6978 7d0a 745f 785c 5c0a 745f 790a trix}.t_x\\.t_y. │ │ │ +000c9c30: 5c65 6e64 7b62 6d61 7472 6978 7d2e 0a5c \end{bmatrix}..\ │ │ │ +000c9c40: 293c 2f64 6976 3e0a 3c64 6c20 636c 6173 )
    .
    .
    P │ │ │ +000c9c60: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ +000c9c70: 3c64 643e 3c63 6f64 653e 6672 6f6d 3c2f
    from - First in │ │ │ +000c9c90: 7075 7420 3244 2070 6f69 6e74 2073 6574 put 2D point set │ │ │ +000c9ca0: 2063 6f6e 7461 696e 696e 6720 5c28 2858 containing \((X │ │ │ +000c9cb0: 2c59 295c 292e 3c2f 6464 3e0a 3c64 643e ,Y)\).
    .
    │ │ │ +000c9cc0: 3c63 6f64 653e 746f 3c2f 636f 6465 3e20 to │ │ │ +000c9cd0: 2d20 5365 636f 6e64 2069 6e70 7574 2032 - Second input 2 │ │ │ +000c9ce0: 4420 706f 696e 7420 7365 7420 636f 6e74 D point set cont │ │ │ +000c9cf0: 6169 6e69 6e67 205c 2828 782c 7929 5c29 aining \((x,y)\) │ │ │ +000c9d00: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    inliers │ │ │ +000c9d20: 2d20 4f75 7470 7574 2076 6563 746f 7220 - Output vector │ │ │ +000c9d30: 696e 6469 6361 7469 6e67 2077 6869 6368 indicating which │ │ │ +000c9d40: 2070 6f69 6e74 7320 6172 6520 696e 6c69 points are inli │ │ │ +000c9d50: 6572 7320 2831 2d69 6e6c 6965 722c 2030 ers (1-inlier, 0 │ │ │ +000c9d60: 2d6f 7574 6c69 6572 292e 3c2f 6464 3e0a -outlier).
    . │ │ │ +000c9d70: 3c64 643e 3c63 6f64 653e 6d65 7468 6f64
    method │ │ │ +000c9d80: 3c2f 636f 6465 3e20 2d20 526f 6275 7374 - Robust │ │ │ +000c9d90: 206d 6574 686f 6420 7573 6564 2074 6f20 method used to │ │ │ +000c9da0: 636f 6d70 7574 6520 7468 6520 7472 616e compute the tran │ │ │ +000c9db0: 7366 6f72 6d61 7469 6f6e 2e20 5468 6520 sformation. The │ │ │ +000c9dc0: 666f 6c6c 6f77 696e 6720 6d65 7468 6f64 following method │ │ │ +000c9dd0: 7320 6172 6520 706f 7373 6962 6c65 3a0a s are possible:. │ │ │ +000c9de0: 3c75 6c3e 0a20 203c 6c69 3e0a 2020 2052
      .
    • . R │ │ │ +000c9df0: 4546 3a20 5241 4e53 4143 202d 2052 414e EF: RANSAC - RAN │ │ │ +000c9e00: 5341 432d 6261 7365 6420 726f 6275 7374 SAC-based robust │ │ │ +000c9e10: 206d 6574 686f 640a 2020 3c2f 6c69 3e0a method.
    • . │ │ │ +000c9e20: 2020 3c6c 693e 0a20 2020 5245 463a 204c
    • . REF: L │ │ │ +000c9e30: 4d45 4453 202d 204c 6561 7374 2d4d 6564 MEDS - Least-Med │ │ │ +000c9e40: 6961 6e20 726f 6275 7374 206d 6574 686f ian robust metho │ │ │ +000c9e50: 640a 5241 4e53 4143 2069 7320 7468 6520 d.RANSAC is the │ │ │ +000c9e60: 6465 6661 756c 7420 6d65 7468 6f64 2e0a default method.. │ │ │ +000c9e70: 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64
    • .
    .
    ran │ │ │ +000c9e90: 7361 6352 6570 726f 6a54 6872 6573 686f sacReprojThresho │ │ │ +000c9ea0: 6c64 3c2f 636f 6465 3e20 2d20 4d61 7869 ld - Maxi │ │ │ +000c9eb0: 6d75 6d20 7265 7072 6f6a 6563 7469 6f6e mum reprojection │ │ │ +000c9ec0: 2065 7272 6f72 2069 6e20 7468 6520 5241 error in the RA │ │ │ +000c9ed0: 4e53 4143 2061 6c67 6f72 6974 686d 2074 NSAC algorithm t │ │ │ +000c9ee0: 6f20 636f 6e73 6964 6572 0a61 2070 6f69 o consider.a poi │ │ │ +000c9ef0: 6e74 2061 7320 616e 2069 6e6c 6965 722e nt as an inlier. │ │ │ +000c9f00: 2041 7070 6c69 6573 206f 6e6c 7920 746f Applies only to │ │ │ +000c9f10: 2052 414e 5341 432e 3c2f 6464 3e0a 3c64 RANSAC.
    .maxIters │ │ │ +000c9f30: 3c2f 636f 6465 3e20 2d20 5468 6520 6d61 - The ma │ │ │ +000c9f40: 7869 6d75 6d20 6e75 6d62 6572 206f 6620 ximum number of │ │ │ +000c9f50: 726f 6275 7374 206d 6574 686f 6420 6974 robust method it │ │ │ +000c9f60: 6572 6174 696f 6e73 2e3c 2f64 643e 0a3c erations..< │ │ │ +000c9f70: 6464 3e3c 636f 6465 3e63 6f6e 6669 6465 dd>confide │ │ │ +000c9f80: 6e63 653c 2f63 6f64 653e 202d 2043 6f6e nce - Con │ │ │ +000c9f90: 6669 6465 6e63 6520 6c65 7665 6c2c 2062 fidence level, b │ │ │ +000c9fa0: 6574 7765 656e 2030 2061 6e64 2031 2c20 etween 0 and 1, │ │ │ +000c9fb0: 666f 7220 7468 6520 6573 7469 6d61 7465 for the estimate │ │ │ +000c9fc0: 6420 7472 616e 7366 6f72 6d61 7469 6f6e d transformation │ │ │ +000c9fd0: 2e20 416e 7974 6869 6e67 0a62 6574 7765 . Anything.betwe │ │ │ +000c9fe0: 656e 2030 2e39 3520 616e 6420 302e 3939 en 0.95 and 0.99 │ │ │ +000c9ff0: 2069 7320 7573 7561 6c6c 7920 676f 6f64 is usually good │ │ │ +000ca000: 2065 6e6f 7567 682e 2056 616c 7565 7320 enough. Values │ │ │ +000ca010: 746f 6f20 636c 6f73 6520 746f 2031 2063 too close to 1 c │ │ │ +000ca020: 616e 2073 6c6f 7720 646f 776e 2074 6865 an slow down the │ │ │ +000ca030: 2065 7374 696d 6174 696f 6e0a 7369 676e estimation.sign │ │ │ +000ca040: 6966 6963 616e 746c 792e 2056 616c 7565 ificantly. Value │ │ │ +000ca050: 7320 6c6f 7765 7220 7468 616e 2030 2e38 s lower than 0.8 │ │ │ +000ca060: e280 9330 2e39 2063 616e 2072 6573 756c ...0.9 can resul │ │ │ +000ca070: 7420 696e 2061 6e20 696e 636f 7272 6563 t in an incorrec │ │ │ +000ca080: 746c 7920 6573 7469 6d61 7465 6420 7472 tly estimated tr │ │ │ +000ca090: 616e 7366 6f72 6d61 7469 6f6e 2e3c 2f64 ansformation..
    ref │ │ │ +000ca0b0: 696e 6549 7465 7273 3c2f 636f 6465 3e20 ineIters │ │ │ +000ca0c0: 2d20 4d61 7869 6d75 6d20 6e75 6d62 6572 - Maximum number │ │ │ +000ca0d0: 206f 6620 6974 6572 6174 696f 6e73 206f of iterations o │ │ │ +000ca0e0: 6620 7468 6520 7265 6669 6e69 6e67 2061 f the refining a │ │ │ +000ca0f0: 6c67 6f72 6974 686d 2e20 466f 7220 7075 lgorithm. For pu │ │ │ +000ca100: 7265 2074 7261 6e73 6c61 7469 6f6e 0a74 re translation.t │ │ │ +000ca110: 6865 206c 6561 7374 2d73 7175 6172 6573 he least-squares │ │ │ +000ca120: 2073 6f6c 7574 696f 6e20 6f6e 2069 6e6c solution on inl │ │ │ +000ca130: 6965 7273 2069 7320 636c 6f73 6564 2d66 iers is closed-f │ │ │ +000ca140: 6f72 6d2c 2073 6f20 7061 7373 696e 6720 orm, so passing │ │ │ +000ca150: 3020 6973 2072 6563 6f6d 6d65 6e64 6564 0 is recommended │ │ │ +000ca160: 2028 6e6f 2061 6464 6974 696f 6e61 6c20 (no additional │ │ │ +000ca170: 7265 6669 6e65 292e 3c2f 6464 3e0a 3c64 refine).
    .Returns:. │ │ │ +000ca190: 3c64 643e 4120 3244 2074 7261 6e73 6c61
    A 2D transla │ │ │ +000ca1a0: 7469 6f6e 2076 6563 746f 7220 5c28 5b74 tion vector \([t │ │ │ +000ca1b0: 5f78 2c20 745f 795d 5e54 5c29 2061 7320 _x, t_y]^T\) as │ │ │ +000ca1c0: 3c63 6f64 653e 6376 3a3a 5665 6332 643c cv::Vec2d< │ │ │ +000ca1d0: 2f63 6f64 653e 2e20 4966 2074 6865 2074 /code>. If the t │ │ │ +000ca1e0: 7261 6e73 6c61 7469 6f6e 2063 6f75 6c64 ranslation could │ │ │ +000ca1f0: 206e 6f74 2062 650a 6573 7469 6d61 7465 not be.estimate │ │ │ +000ca200: 642c 2062 6f74 6820 636f 6d70 6f6e 656e d, both componen │ │ │ +000ca210: 7473 2061 7265 2073 6574 2074 6f20 4e61 ts are set to Na │ │ │ +000ca220: 4e20 616e 642c 2069 6620 3c63 6f64 653e N and, if │ │ │ +000ca230: 696e 6c69 6572 733c 2f63 6f64 653e 2069 inliers i │ │ │ +000ca240: 7320 7072 6f76 6964 6564 2c20 7468 6520 s provided, the │ │ │ +000ca250: 6d61 736b 2069 7320 6669 6c6c 6564 2077 mask is filled w │ │ │ +000ca260: 6974 6820 7a65 726f 732e 0a0a 5c70 6172 ith zeros...\par │ │ │ +000ca270: 2043 6f6e 7665 7274 696e 6720 746f 2061 Converting to a │ │ │ +000ca280: 2032 7833 2074 7261 6e73 666f 726d 6174 2x3 transformat │ │ │ +000ca290: 696f 6e20 6d61 7472 6978 3a0a 5c28 0a5c ion matrix:.\(.\ │ │ │ +000ca2a0: 6265 6769 6e7b 626d 6174 7269 787d 0a31 begin{bmatrix}.1 │ │ │ +000ca2b0: 2026 616d 703b 2030 2026 616d 703b 2074 & 0 & t │ │ │ +000ca2c0: 5f78 5c5c 0a30 2026 616d 703b 2031 2026 _x\\.0 & 1 & │ │ │ +000ca2d0: 616d 703b 2074 5f79 0a5c 656e 647b 626d amp; t_y.\end{bm │ │ │ +000ca2e0: 6174 7269 787d 0a5c 290a 0a3c 636f 6465 atrix}.\)...cv::Vec2d t = │ │ │ +000ca300: 6376 3a3a 6573 7469 6d61 7465 5472 616e cv::estimateTran │ │ │ +000ca310: 736c 6174 696f 6e32 4428 6672 6f6d 2c20 slation2D(from, │ │ │ +000ca320: 746f 2c20 696e 6c69 6572 7329 3b0a 6376 to, inliers);.cv │ │ │ +000ca330: 3a3a 4d61 7420 5420 3d20 2863 763a 3a4d ::Mat T = (cv::M │ │ │ +000ca340: 6174 5f26 6c74 3b64 6f75 626c 6526 6774 at_<double> │ │ │ +000ca350: 3b28 322c 3329 2026 6c74 3b26 6c74 3b20 ;(2,3) << │ │ │ +000ca360: 312c 302c 745b 305d 2c20 302c 312c 745b 1,0,t[0], 0,1,t[ │ │ │ +000ca370: 315d 293b 0a3c 2f63 6f64 653e 0a0a 5468 1]);...Th │ │ │ +000ca380: 6520 6675 6e63 7469 6f6e 2065 7374 696d e function estim │ │ │ +000ca390: 6174 6573 2061 2070 7572 6520 3244 2074 ates a pure 2D t │ │ │ +000ca3a0: 7261 6e73 6c61 7469 6f6e 2062 6574 7765 ranslation betwe │ │ │ +000ca3b0: 656e 2074 776f 2032 4420 706f 696e 7420 en two 2D point │ │ │ +000ca3c0: 7365 7473 2075 7369 6e67 2074 6865 2073 sets using the s │ │ │ +000ca3d0: 656c 6563 7465 6420 726f 6275 7374 0a61 elected robust.a │ │ │ +000ca3e0: 6c67 6f72 6974 686d 2e20 496e 6c69 6572 lgorithm. Inlier │ │ │ +000ca3f0: 7320 6172 6520 6465 7465 726d 696e 6564 s are determined │ │ │ +000ca400: 2062 7920 7468 6520 7265 7072 6f6a 6563 by the reprojec │ │ │ +000ca410: 7469 6f6e 2065 7272 6f72 2074 6872 6573 tion error thres │ │ │ +000ca420: 686f 6c64 2e0a 0a3c 623e 4e6f 7465 3a3c hold...Note:< │ │ │ +000ca430: 2f62 3e0a 5468 6520 5241 4e53 4143 206d /b>.The RANSAC m │ │ │ +000ca440: 6574 686f 6420 6361 6e20 6861 6e64 6c65 ethod can handle │ │ │ +000ca450: 2070 7261 6374 6963 616c 6c79 2061 6e79 practically any │ │ │ +000ca460: 2072 6174 696f 206f 6620 6f75 746c 6965 ratio of outlie │ │ │ +000ca470: 7273 2062 7574 206e 6565 6473 2061 2074 rs but needs a t │ │ │ +000ca480: 6872 6573 686f 6c64 2074 6f0a 6469 7374 hreshold to.dist │ │ │ +000ca490: 696e 6775 6973 6820 696e 6c69 6572 7320 inguish inliers │ │ │ +000ca4a0: 6672 6f6d 206f 7574 6c69 6572 732e 2054 from outliers. T │ │ │ +000ca4b0: 6865 206d 6574 686f 6420 4c4d 6544 5320 he method LMeDS │ │ │ +000ca4c0: 646f 6573 206e 6f74 206e 6565 6420 616e does not need an │ │ │ +000ca4d0: 7920 7468 7265 7368 6f6c 6420 6275 7420 y threshold but │ │ │ +000ca4e0: 776f 726b 730a 636f 7272 6563 746c 7920 works.correctly │ │ │ +000ca4f0: 6f6e 6c79 2077 6865 6e20 7468 6572 6520 only when there │ │ │ +000ca500: 6172 6520 6d6f 7265 2074 6861 6e20 3530 are more than 50 │ │ │ +000ca510: 2520 696e 6c69 6572 732e 0a0a 5345 453a % inliers...SEE: │ │ │ +000ca520: 2065 7374 696d 6174 6541 6666 696e 6532 estimateAffine2 │ │ │ +000ca530: 442c 2065 7374 696d 6174 6541 6666 696e D, estimateAffin │ │ │ +000ca540: 6550 6172 7469 616c 3244 2c20 6765 7441 ePartial2D, getA │ │ │ +000ca550: 6666 696e 6554 7261 6e73 666f 726d 3c2f ffineTransform.
    .
    │ │ │ +000ca570: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 ..
  • .
  • .
    .< │ │ │ +000ca610: 6833 3e65 7374 696d 6174 6554 7261 6e73 h3>estimateTrans │ │ │ +000ca620: 6c61 7469 6f6e 3244 3c2f 6833 3e0a 3c64 lation2D..public stati │ │ │ +000ca690: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c double[] │ │ │ +000ca6c0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  estimate │ │ │ +000ca6f0: 5472 616e 736c 6174 696f 6e32 443c 2f73 Translation2D(M │ │ │ +000ca760: 6174 3c2f 613e 266e 6273 703b 6672 6f6d at from │ │ │ +000ca770: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000ca7b0: 6174 3c2f 613e 266e 6273 703b 746f 2c0a at to,. │ │ │ +000ca7c0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000ca800: 3c2f 613e 266e 6273 703b 696e 6c69 6572  inlier │ │ │ +000ca810: 732c 0a20 696e 7426 6e62 7370 3b6d 6574 s,. int met │ │ │ +000ca820: 686f 642c 0a20 646f 7562 6c65 266e 6273 hod,. double&nbs │ │ │ +000ca830: 703b 7261 6e73 6163 5265 7072 6f6a 5468 p;ransacReprojTh │ │ │ +000ca840: 7265 7368 6f6c 642c 0a20 6c6f 6e67 266e reshold,. long&n │ │ │ +000ca850: 6273 703b 6d61 7849 7465 7273 2c0a 2064 bsp;maxIters,. d │ │ │ +000ca860: 6f75 626c 6526 6e62 7370 3b63 6f6e 6669 ouble confi │ │ │ +000ca870: 6465 6e63 6529 3c2f 7370 616e 3e3c 2f64 dence).
    Computes │ │ │ +000ca8a0: 6120 7075 7265 2032 4420 7472 616e 736c a pure 2D transl │ │ │ +000ca8b0: 6174 696f 6e20 6265 7477 6565 6e20 7477 ation between tw │ │ │ +000ca8c0: 6f20 3244 2070 6f69 6e74 2073 6574 732e o 2D point sets. │ │ │ +000ca8d0: 0a0a 4974 2063 6f6d 7075 7465 730a 5c28 ..It computes.\( │ │ │ +000ca8e0: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ +000ca8f0: 0a78 5c5c 0a79 0a5c 656e 647b 626d 6174 .x\\.y.\end{bmat │ │ │ +000ca900: 7269 787d 0a3d 0a5c 6265 6769 6e7b 626d rix}.=.\begin{bm │ │ │ +000ca910: 6174 7269 787d 0a31 2026 616d 703b 2030 atrix}.1 & 0 │ │ │ +000ca920: 5c5c 0a30 2026 616d 703b 2031 0a5c 656e \\.0 & 1.\en │ │ │ +000ca930: 647b 626d 6174 7269 787d 0a5c 6265 6769 d{bmatrix}.\begi │ │ │ +000ca940: 6e7b 626d 6174 7269 787d 0a58 5c5c 0a59 n{bmatrix}.X\\.Y │ │ │ +000ca950: 0a5c 656e 647b 626d 6174 7269 787d 0a2b .\end{bmatrix}.+ │ │ │ +000ca960: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ +000ca970: 0a74 5f78 5c5c 0a74 5f79 0a5c 656e 647b .t_x\\.t_y.\end{ │ │ │ +000ca980: 626d 6174 7269 787d 2e0a 5c29 3c2f 6469 bmatrix}..\).
    .
    Parame │ │ │ +000ca9b0: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ +000ca9c0: 636f 6465 3e66 726f 6d3c 2f63 6f64 653e code>from │ │ │ +000ca9d0: 202d 2046 6972 7374 2069 6e70 7574 2032 - First input 2 │ │ │ +000ca9e0: 4420 706f 696e 7420 7365 7420 636f 6e74 D point set cont │ │ │ +000ca9f0: 6169 6e69 6e67 205c 2828 582c 5929 5c29 aining \((X,Y)\) │ │ │ +000caa00: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    to - Sec │ │ │ +000caa20: 6f6e 6420 696e 7075 7420 3244 2070 6f69 ond input 2D poi │ │ │ +000caa30: 6e74 2073 6574 2063 6f6e 7461 696e 696e nt set containin │ │ │ +000caa40: 6720 5c28 2878 2c79 295c 292e 3c2f 6464 g \((x,y)\).
    .
    inli │ │ │ +000caa60: 6572 733c 2f63 6f64 653e 202d 204f 7574 ers - Out │ │ │ +000caa70: 7075 7420 7665 6374 6f72 2069 6e64 6963 put vector indic │ │ │ +000caa80: 6174 696e 6720 7768 6963 6820 706f 696e ating which poin │ │ │ +000caa90: 7473 2061 7265 2069 6e6c 6965 7273 2028 ts are inliers ( │ │ │ +000caaa0: 312d 696e 6c69 6572 2c20 302d 6f75 746c 1-inlier, 0-outl │ │ │ +000caab0: 6965 7229 2e3c 2f64 643e 0a3c 6464 3e3c ier).
    .
    < │ │ │ +000caac0: 636f 6465 3e6d 6574 686f 643c 2f63 6f64 code>method - Robust meth │ │ │ +000caae0: 6f64 2075 7365 6420 746f 2063 6f6d 7075 od used to compu │ │ │ +000caaf0: 7465 2074 6865 2074 7261 6e73 666f 726d te the transform │ │ │ +000cab00: 6174 696f 6e2e 2054 6865 2066 6f6c 6c6f ation. The follo │ │ │ +000cab10: 7769 6e67 206d 6574 686f 6473 2061 7265 wing methods are │ │ │ +000cab20: 2070 6f73 7369 626c 653a 0a3c 756c 3e0a possible:.
      . │ │ │ +000cab30: 2020 3c6c 693e 0a20 2020 5245 463a 2052
    • . REF: R │ │ │ +000cab40: 414e 5341 4320 2d20 5241 4e53 4143 2d62 ANSAC - RANSAC-b │ │ │ +000cab50: 6173 6564 2072 6f62 7573 7420 6d65 7468 ased robust meth │ │ │ +000cab60: 6f64 0a20 203c 2f6c 693e 0a20 203c 6c69 od.
    • .
    • . REF: LMEDS │ │ │ +000cab80: 2d20 4c65 6173 742d 4d65 6469 616e 2072 - Least-Median r │ │ │ +000cab90: 6f62 7573 7420 6d65 7468 6f64 0a52 414e obust method.RAN │ │ │ +000caba0: 5341 4320 6973 2074 6865 2064 6566 6175 SAC is the defau │ │ │ +000cabb0: 6c74 206d 6574 686f 642e 0a20 203c 2f6c lt method.. .
    .ransacRe │ │ │ +000cabe0: 7072 6f6a 5468 7265 7368 6f6c 643c 2f63 projThreshold - Maximum r │ │ │ +000cac00: 6570 726f 6a65 6374 696f 6e20 6572 726f eprojection erro │ │ │ +000cac10: 7220 696e 2074 6865 2052 414e 5341 4320 r in the RANSAC │ │ │ +000cac20: 616c 676f 7269 7468 6d20 746f 2063 6f6e algorithm to con │ │ │ +000cac30: 7369 6465 720a 6120 706f 696e 7420 6173 sider.a point as │ │ │ +000cac40: 2061 6e20 696e 6c69 6572 2e20 4170 706c an inlier. Appl │ │ │ +000cac50: 6965 7320 6f6e 6c79 2074 6f20 5241 4e53 ies only to RANS │ │ │ +000cac60: 4143 2e3c 2f64 643e 0a3c 6464 3e3c 636f AC..
    maxIters - The maximum │ │ │ +000cac90: 206e 756d 6265 7220 6f66 2072 6f62 7573 number of robus │ │ │ +000caca0: 7420 6d65 7468 6f64 2069 7465 7261 7469 t method iterati │ │ │ +000cacb0: 6f6e 732e 3c2f 6464 3e0a 3c64 643e 3c63 ons.
    .
    confidence - Confiden │ │ │ +000cace0: 6365 206c 6576 656c 2c20 6265 7477 6565 ce level, betwee │ │ │ +000cacf0: 6e20 3020 616e 6420 312c 2066 6f72 2074 n 0 and 1, for t │ │ │ +000cad00: 6865 2065 7374 696d 6174 6564 2074 7261 he estimated tra │ │ │ +000cad10: 6e73 666f 726d 6174 696f 6e2e 2041 6e79 nsformation. Any │ │ │ +000cad20: 7468 696e 670a 6265 7477 6565 6e20 302e thing.between 0. │ │ │ +000cad30: 3935 2061 6e64 2030 2e39 3920 6973 2075 95 and 0.99 is u │ │ │ +000cad40: 7375 616c 6c79 2067 6f6f 6420 656e 6f75 sually good enou │ │ │ +000cad50: 6768 2e20 5661 6c75 6573 2074 6f6f 2063 gh. Values too c │ │ │ +000cad60: 6c6f 7365 2074 6f20 3120 6361 6e20 736c lose to 1 can sl │ │ │ +000cad70: 6f77 2064 6f77 6e20 7468 6520 6573 7469 ow down the esti │ │ │ +000cad80: 6d61 7469 6f6e 0a73 6967 6e69 6669 6361 mation.significa │ │ │ +000cad90: 6e74 6c79 2e20 5661 6c75 6573 206c 6f77 ntly. Values low │ │ │ +000cada0: 6572 2074 6861 6e20 302e 38e2 8093 302e er than 0.8...0. │ │ │ +000cadb0: 3920 6361 6e20 7265 7375 6c74 2069 6e20 9 can result in │ │ │ +000cadc0: 616e 2069 6e63 6f72 7265 6374 6c79 2065 an incorrectly e │ │ │ +000cadd0: 7374 696d 6174 6564 2074 7261 6e73 666f stimated transfo │ │ │ +000cade0: 726d 6174 696f 6e2e 0a74 6865 206c 6561 rmation..the lea │ │ │ +000cadf0: 7374 2d73 7175 6172 6573 2073 6f6c 7574 st-squares solut │ │ │ +000cae00: 696f 6e20 6f6e 2069 6e6c 6965 7273 2069 ion on inliers i │ │ │ +000cae10: 7320 636c 6f73 6564 2d66 6f72 6d2c 2073 s closed-form, s │ │ │ +000cae20: 6f20 7061 7373 696e 6720 3020 6973 2072 o passing 0 is r │ │ │ +000cae30: 6563 6f6d 6d65 6e64 6564 2028 6e6f 2061 ecommended (no a │ │ │ +000cae40: 6464 6974 696f 6e61 6c20 7265 6669 6e65 dditional refine │ │ │ +000cae50: 292e 3c2f 6464 3e0a 3c64 743e 5265 7475 ).
    .
    Retu │ │ │ +000cae60: 726e 733a 3c2f 6474 3e0a 3c64 643e 4120 rns:
    .
    A │ │ │ +000cae70: 3244 2074 7261 6e73 6c61 7469 6f6e 2076 2D translation v │ │ │ +000cae80: 6563 746f 7220 5c28 5b74 5f78 2c20 745f ector \([t_x, t_ │ │ │ +000cae90: 795d 5e54 5c29 2061 7320 3c63 6f64 653e y]^T\) as │ │ │ +000caea0: 6376 3a3a 5665 6332 643c 2f63 6f64 653e cv::Vec2d │ │ │ +000caeb0: 2e20 4966 2074 6865 2074 7261 6e73 6c61 . If the transla │ │ │ +000caec0: 7469 6f6e 2063 6f75 6c64 206e 6f74 2062 tion could not b │ │ │ +000caed0: 650a 6573 7469 6d61 7465 642c 2062 6f74 e.estimated, bot │ │ │ +000caee0: 6820 636f 6d70 6f6e 656e 7473 2061 7265 h components are │ │ │ +000caef0: 2073 6574 2074 6f20 4e61 4e20 616e 642c set to NaN and, │ │ │ +000caf00: 2069 6620 3c63 6f64 653e 696e 6c69 6572 if inlier │ │ │ +000caf10: 733c 2f63 6f64 653e 2069 7320 7072 6f76 s is prov │ │ │ +000caf20: 6964 6564 2c20 7468 6520 6d61 736b 2069 ided, the mask i │ │ │ +000caf30: 7320 6669 6c6c 6564 2077 6974 6820 7a65 s filled with ze │ │ │ +000caf40: 726f 732e 0a0a 5c70 6172 2043 6f6e 7665 ros...\par Conve │ │ │ +000caf50: 7274 696e 6720 746f 2061 2032 7833 2074 rting to a 2x3 t │ │ │ +000caf60: 7261 6e73 666f 726d 6174 696f 6e20 6d61 ransformation ma │ │ │ +000caf70: 7472 6978 3a0a 5c28 0a5c 6265 6769 6e7b trix:.\(.\begin{ │ │ │ +000caf80: 626d 6174 7269 787d 0a31 2026 616d 703b bmatrix}.1 & │ │ │ +000caf90: 2030 2026 616d 703b 2074 5f78 5c5c 0a30 0 & t_x\\.0 │ │ │ +000cafa0: 2026 616d 703b 2031 2026 616d 703b 2074 & 1 & t │ │ │ +000cafb0: 5f79 0a5c 656e 647b 626d 6174 7269 787d _y.\end{bmatrix} │ │ │ +000cafc0: 0a5c 290a 0a3c 636f 6465 3e0a 6376 3a3a .\)...cv:: │ │ │ +000cafd0: 5665 6332 6420 7420 3d20 6376 3a3a 6573 Vec2d t = cv::es │ │ │ +000cafe0: 7469 6d61 7465 5472 616e 736c 6174 696f timateTranslatio │ │ │ +000caff0: 6e32 4428 6672 6f6d 2c20 746f 2c20 696e n2D(from, to, in │ │ │ +000cb000: 6c69 6572 7329 3b0a 6376 3a3a 4d61 7420 liers);.cv::Mat │ │ │ +000cb010: 5420 3d20 2863 763a 3a4d 6174 5f26 6c74 T = (cv::Mat_< │ │ │ +000cb020: 3b64 6f75 626c 6526 6774 3b28 322c 3329 ;double>(2,3) │ │ │ +000cb030: 2026 6c74 3b26 6c74 3b20 312c 302c 745b << 1,0,t[ │ │ │ +000cb040: 305d 2c20 302c 312c 745b 315d 293b 0a3c 0], 0,1,t[1]);.< │ │ │ +000cb050: 2f63 6f64 653e 0a0a 5468 6520 6675 6e63 /code>..The func │ │ │ +000cb060: 7469 6f6e 2065 7374 696d 6174 6573 2061 tion estimates a │ │ │ +000cb070: 2070 7572 6520 3244 2074 7261 6e73 6c61 pure 2D transla │ │ │ +000cb080: 7469 6f6e 2062 6574 7765 656e 2074 776f tion between two │ │ │ +000cb090: 2032 4420 706f 696e 7420 7365 7473 2075 2D point sets u │ │ │ +000cb0a0: 7369 6e67 2074 6865 2073 656c 6563 7465 sing the selecte │ │ │ +000cb0b0: 6420 726f 6275 7374 0a61 6c67 6f72 6974 d robust.algorit │ │ │ +000cb0c0: 686d 2e20 496e 6c69 6572 7320 6172 6520 hm. Inliers are │ │ │ +000cb0d0: 6465 7465 726d 696e 6564 2062 7920 7468 determined by th │ │ │ +000cb0e0: 6520 7265 7072 6f6a 6563 7469 6f6e 2065 e reprojection e │ │ │ +000cb0f0: 7272 6f72 2074 6872 6573 686f 6c64 2e0a rror threshold.. │ │ │ +000cb100: 0a3c 623e 4e6f 7465 3a3c 2f62 3e0a 5468 .Note:.Th │ │ │ +000cb110: 6520 5241 4e53 4143 206d 6574 686f 6420 e RANSAC method │ │ │ +000cb120: 6361 6e20 6861 6e64 6c65 2070 7261 6374 can handle pract │ │ │ +000cb130: 6963 616c 6c79 2061 6e79 2072 6174 696f ically any ratio │ │ │ +000cb140: 206f 6620 6f75 746c 6965 7273 2062 7574 of outliers but │ │ │ +000cb150: 206e 6565 6473 2061 2074 6872 6573 686f needs a thresho │ │ │ +000cb160: 6c64 2074 6f0a 6469 7374 696e 6775 6973 ld to.distinguis │ │ │ +000cb170: 6820 696e 6c69 6572 7320 6672 6f6d 206f h inliers from o │ │ │ +000cb180: 7574 6c69 6572 732e 2054 6865 206d 6574 utliers. The met │ │ │ +000cb190: 686f 6420 4c4d 6544 5320 646f 6573 206e hod LMeDS does n │ │ │ +000cb1a0: 6f74 206e 6565 6420 616e 7920 7468 7265 ot need any thre │ │ │ +000cb1b0: 7368 6f6c 6420 6275 7420 776f 726b 730a shold but works. │ │ │ +000cb1c0: 636f 7272 6563 746c 7920 6f6e 6c79 2077 correctly only w │ │ │ +000cb1d0: 6865 6e20 7468 6572 6520 6172 6520 6d6f hen there are mo │ │ │ +000cb1e0: 7265 2074 6861 6e20 3530 2520 696e 6c69 re than 50% inli │ │ │ +000cb1f0: 6572 732e 0a0a 5345 453a 2065 7374 696d ers...SEE: estim │ │ │ +000cb200: 6174 6541 6666 696e 6532 442c 2065 7374 ateAffine2D, est │ │ │ +000cb210: 696d 6174 6541 6666 696e 6550 6172 7469 imateAffineParti │ │ │ +000cb220: 616c 3244 2c20 6765 7441 6666 696e 6554 al2D, getAffineT │ │ │ +000cb230: 7261 6e73 666f 726d 3c2f 6464 3e0a 3c2f ransform
    ..
    ..
  • .
  • │ │ │ +000cb260: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    estimateTr │ │ │ +000cb2f0: 616e 736c 6174 696f 6e32 443c 2f68 333e anslation2D

    │ │ │ +000cb300: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ +000cb320: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ +000cb340: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ +000cb350: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ +000cb360: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ +000cb370: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;doubl │ │ │ +000cb390: 655b 5d3c 2f73 7061 6e3e 266e 6273 703b e[]  │ │ │ +000cb3a0: 3c73 7061 6e20 636c 6173 733d 2265 6c65 estim │ │ │ +000cb3c0: 6174 6554 7261 6e73 6c61 7469 6f6e 3244 ateTranslation2D │ │ │ +000cb3d0: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat f │ │ │ +000cb440: 726f 6d2c 0a20 3c61 2068 7265 663d 222e rom,. Mat t │ │ │ +000cb490: 6f2c 0a20 3c61 2068 7265 663d 222e 2e2f o,. │ │ │ +000cb4d0: 4d61 743c 2f61 3e26 6e62 7370 3b69 6e6c Mat inl │ │ │ +000cb4e0: 6965 7273 2c0a 2069 6e74 266e 6273 703b iers,. int  │ │ │ +000cb4f0: 6d65 7468 6f64 2c0a 2064 6f75 626c 6526 method,. double& │ │ │ +000cb500: 6e62 7370 3b72 616e 7361 6352 6570 726f nbsp;ransacRepro │ │ │ +000cb510: 6a54 6872 6573 686f 6c64 2c0a 206c 6f6e jThreshold,. lon │ │ │ +000cb520: 6726 6e62 7370 3b6d 6178 4974 6572 7329 g maxIters) │ │ │ +000cb530: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Computes a pure │ │ │ +000cb560: 2032 4420 7472 616e 736c 6174 696f 6e20 2D translation │ │ │ +000cb570: 6265 7477 6565 6e20 7477 6f20 3244 2070 between two 2D p │ │ │ +000cb580: 6f69 6e74 2073 6574 732e 0a0a 4974 2063 oint sets...It c │ │ │ +000cb590: 6f6d 7075 7465 730a 5c28 0a5c 6265 6769 omputes.\(.\begi │ │ │ +000cb5a0: 6e7b 626d 6174 7269 787d 0a78 5c5c 0a79 n{bmatrix}.x\\.y │ │ │ +000cb5b0: 0a5c 656e 647b 626d 6174 7269 787d 0a3d .\end{bmatrix}.= │ │ │ +000cb5c0: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ +000cb5d0: 0a31 2026 616d 703b 2030 5c5c 0a30 2026 .1 & 0\\.0 & │ │ │ +000cb5e0: 616d 703b 2031 0a5c 656e 647b 626d 6174 amp; 1.\end{bmat │ │ │ +000cb5f0: 7269 787d 0a5c 6265 6769 6e7b 626d 6174 rix}.\begin{bmat │ │ │ +000cb600: 7269 787d 0a58 5c5c 0a59 0a5c 656e 647b rix}.X\\.Y.\end{ │ │ │ +000cb610: 626d 6174 7269 787d 0a2b 0a5c 6265 6769 bmatrix}.+.\begi │ │ │ +000cb620: 6e7b 626d 6174 7269 787d 0a74 5f78 5c5c n{bmatrix}.t_x\\ │ │ │ +000cb630: 0a74 5f79 0a5c 656e 647b 626d 6174 7269 .t_y.\end{bmatri │ │ │ +000cb640: 787d 2e0a 5c29 3c2f 6469 763e 0a3c 646c x}..\)
    .
    . │ │ │ +000cb660: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ +000cb670: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e66 /dt>.
    f │ │ │ +000cb680: 726f 6d3c 2f63 6f64 653e 202d 2046 6972 rom - Fir │ │ │ +000cb690: 7374 2069 6e70 7574 2032 4420 706f 696e st input 2D poin │ │ │ +000cb6a0: 7420 7365 7420 636f 6e74 6169 6e69 6e67 t set containing │ │ │ +000cb6b0: 205c 2828 582c 5929 5c29 2e3c 2f64 643e \((X,Y)\).
    │ │ │ +000cb6c0: 0a3c 6464 3e3c 636f 6465 3e74 6f3c 2f63 .
    to - Second in │ │ │ +000cb6e0: 7075 7420 3244 2070 6f69 6e74 2073 6574 put 2D point set │ │ │ +000cb6f0: 2063 6f6e 7461 696e 696e 6720 5c28 2878 containing \((x │ │ │ +000cb700: 2c79 295c 292e 3c2f 6464 3e0a 3c64 643e ,y)\).
    .
    │ │ │ +000cb710: 3c63 6f64 653e 696e 6c69 6572 733c 2f63 inliers - Output ve │ │ │ +000cb730: 6374 6f72 2069 6e64 6963 6174 696e 6720 ctor indicating │ │ │ +000cb740: 7768 6963 6820 706f 696e 7473 2061 7265 which points are │ │ │ +000cb750: 2069 6e6c 6965 7273 2028 312d 696e 6c69 inliers (1-inli │ │ │ +000cb760: 6572 2c20 302d 6f75 746c 6965 7229 2e3c er, 0-outlier).< │ │ │ +000cb770: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e6d /dd>.
    m │ │ │ +000cb780: 6574 686f 643c 2f63 6f64 653e 202d 2052 ethod - R │ │ │ +000cb790: 6f62 7573 7420 6d65 7468 6f64 2075 7365 obust method use │ │ │ +000cb7a0: 6420 746f 2063 6f6d 7075 7465 2074 6865 d to compute the │ │ │ +000cb7b0: 2074 7261 6e73 666f 726d 6174 696f 6e2e transformation. │ │ │ +000cb7c0: 2054 6865 2066 6f6c 6c6f 7769 6e67 206d The following m │ │ │ +000cb7d0: 6574 686f 6473 2061 7265 2070 6f73 7369 ethods are possi │ │ │ +000cb7e0: 626c 653a 0a3c 756c 3e0a 2020 3c6c 693e ble:.
      .
    • │ │ │ +000cb7f0: 0a20 2020 5245 463a 2052 414e 5341 4320 . REF: RANSAC │ │ │ +000cb800: 2d20 5241 4e53 4143 2d62 6173 6564 2072 - RANSAC-based r │ │ │ +000cb810: 6f62 7573 7420 6d65 7468 6f64 0a20 203c obust method. < │ │ │ +000cb820: 2f6c 693e 0a20 203c 6c69 3e0a 2020 2052 /li>.
    • . R │ │ │ +000cb830: 4546 3a20 4c4d 4544 5320 2d20 4c65 6173 EF: LMEDS - Leas │ │ │ +000cb840: 742d 4d65 6469 616e 2072 6f62 7573 7420 t-Median robust │ │ │ +000cb850: 6d65 7468 6f64 0a52 414e 5341 4320 6973 method.RANSAC is │ │ │ +000cb860: 2074 6865 2064 6566 6175 6c74 206d 6574 the default met │ │ │ +000cb870: 686f 642e 0a20 203c 2f6c 693e 0a3c 2f75 hod..
    • .
    .
    ransacReprojTh │ │ │ +000cb8a0: 7265 7368 6f6c 643c 2f63 6f64 653e 202d reshold - │ │ │ +000cb8b0: 204d 6178 696d 756d 2072 6570 726f 6a65 Maximum reproje │ │ │ +000cb8c0: 6374 696f 6e20 6572 726f 7220 696e 2074 ction error in t │ │ │ +000cb8d0: 6865 2052 414e 5341 4320 616c 676f 7269 he RANSAC algori │ │ │ +000cb8e0: 7468 6d20 746f 2063 6f6e 7369 6465 720a thm to consider. │ │ │ +000cb8f0: 6120 706f 696e 7420 6173 2061 6e20 696e a point as an in │ │ │ +000cb900: 6c69 6572 2e20 4170 706c 6965 7320 6f6e lier. Applies on │ │ │ +000cb910: 6c79 2074 6f20 5241 4e53 4143 2e3c 2f64 ly to RANSAC..
    max │ │ │ +000cb930: 4974 6572 733c 2f63 6f64 653e 202d 2054 Iters - T │ │ │ +000cb940: 6865 206d 6178 696d 756d 206e 756d 6265 he maximum numbe │ │ │ +000cb950: 7220 6f66 2072 6f62 7573 7420 6d65 7468 r of robust meth │ │ │ +000cb960: 6f64 2069 7465 7261 7469 6f6e 732e 0a62 od iterations..b │ │ │ +000cb970: 6574 7765 656e 2030 2e39 3520 616e 6420 etween 0.95 and │ │ │ +000cb980: 302e 3939 2069 7320 7573 7561 6c6c 7920 0.99 is usually │ │ │ +000cb990: 676f 6f64 2065 6e6f 7567 682e 2056 616c good enough. Val │ │ │ +000cb9a0: 7565 7320 746f 6f20 636c 6f73 6520 746f ues too close to │ │ │ +000cb9b0: 2031 2063 616e 2073 6c6f 7720 646f 776e 1 can slow down │ │ │ +000cb9c0: 2074 6865 2065 7374 696d 6174 696f 6e0a the estimation. │ │ │ +000cb9d0: 7369 676e 6966 6963 616e 746c 792e 2056 significantly. V │ │ │ +000cb9e0: 616c 7565 7320 6c6f 7765 7220 7468 616e alues lower than │ │ │ +000cb9f0: 2030 2e38 e280 9330 2e39 2063 616e 2072 0.8...0.9 can r │ │ │ +000cba00: 6573 756c 7420 696e 2061 6e20 696e 636f esult in an inco │ │ │ +000cba10: 7272 6563 746c 7920 6573 7469 6d61 7465 rrectly estimate │ │ │ +000cba20: 6420 7472 616e 7366 6f72 6d61 7469 6f6e d transformation │ │ │ +000cba30: 2e0a 7468 6520 6c65 6173 742d 7371 7561 ..the least-squa │ │ │ +000cba40: 7265 7320 736f 6c75 7469 6f6e 206f 6e20 res solution on │ │ │ +000cba50: 696e 6c69 6572 7320 6973 2063 6c6f 7365 inliers is close │ │ │ +000cba60: 642d 666f 726d 2c20 736f 2070 6173 7369 d-form, so passi │ │ │ +000cba70: 6e67 2030 2069 7320 7265 636f 6d6d 656e ng 0 is recommen │ │ │ +000cba80: 6465 6420 286e 6f20 6164 6469 7469 6f6e ded (no addition │ │ │ +000cba90: 616c 2072 6566 696e 6529 2e3c 2f64 643e al refine).
    │ │ │ +000cbaa0: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    A 2D tran │ │ │ +000cbac0: 736c 6174 696f 6e20 7665 6374 6f72 205c slation vector \ │ │ │ +000cbad0: 285b 745f 782c 2074 5f79 5d5e 545c 2920 ([t_x, t_y]^T\) │ │ │ +000cbae0: 6173 203c 636f 6465 3e63 763a 3a56 6563 as cv::Vec │ │ │ +000cbaf0: 3264 3c2f 636f 6465 3e2e 2049 6620 7468 2d. If th │ │ │ +000cbb00: 6520 7472 616e 736c 6174 696f 6e20 636f e translation co │ │ │ +000cbb10: 756c 6420 6e6f 7420 6265 0a65 7374 696d uld not be.estim │ │ │ +000cbb20: 6174 6564 2c20 626f 7468 2063 6f6d 706f ated, both compo │ │ │ +000cbb30: 6e65 6e74 7320 6172 6520 7365 7420 746f nents are set to │ │ │ +000cbb40: 204e 614e 2061 6e64 2c20 6966 203c 636f NaN and, if inliers is provided, t │ │ │ +000cbb70: 6865 206d 6173 6b20 6973 2066 696c 6c65 he mask is fille │ │ │ +000cbb80: 6420 7769 7468 207a 6572 6f73 2e0a 0a5c d with zeros...\ │ │ │ +000cbb90: 7061 7220 436f 6e76 6572 7469 6e67 2074 par Converting t │ │ │ +000cbba0: 6f20 6120 3278 3320 7472 616e 7366 6f72 o a 2x3 transfor │ │ │ +000cbbb0: 6d61 7469 6f6e 206d 6174 7269 783a 0a5c mation matrix:.\ │ │ │ +000cbbc0: 280a 5c62 6567 696e 7b62 6d61 7472 6978 (.\begin{bmatrix │ │ │ +000cbbd0: 7d0a 3120 2661 6d70 3b20 3020 2661 6d70 }.1 & 0 & │ │ │ +000cbbe0: 3b20 745f 785c 5c0a 3020 2661 6d70 3b20 ; t_x\\.0 & │ │ │ +000cbbf0: 3120 2661 6d70 3b20 745f 790a 5c65 6e64 1 & t_y.\end │ │ │ +000cbc00: 7b62 6d61 7472 6978 7d0a 5c29 0a0a 3c63 {bmatrix}.\)...cv::Vec2d t │ │ │ +000cbc20: 203d 2063 763a 3a65 7374 696d 6174 6554 = cv::estimateT │ │ │ +000cbc30: 7261 6e73 6c61 7469 6f6e 3244 2866 726f ranslation2D(fro │ │ │ +000cbc40: 6d2c 2074 6f2c 2069 6e6c 6965 7273 293b m, to, inliers); │ │ │ +000cbc50: 0a63 763a 3a4d 6174 2054 203d 2028 6376 .cv::Mat T = (cv │ │ │ +000cbc60: 3a3a 4d61 745f 266c 743b 646f 7562 6c65 ::Mat_<double │ │ │ +000cbc70: 2667 743b 2832 2c33 2920 266c 743b 266c >(2,3) <&l │ │ │ +000cbc80: 743b 2031 2c30 2c74 5b30 5d2c 2030 2c31 t; 1,0,t[0], 0,1 │ │ │ +000cbc90: 2c74 5b31 5d29 3b0a 3c2f 636f 6465 3e0a ,t[1]);.. │ │ │ +000cbca0: 0a54 6865 2066 756e 6374 696f 6e20 6573 .The function es │ │ │ +000cbcb0: 7469 6d61 7465 7320 6120 7075 7265 2032 timates a pure 2 │ │ │ +000cbcc0: 4420 7472 616e 736c 6174 696f 6e20 6265 D translation be │ │ │ +000cbcd0: 7477 6565 6e20 7477 6f20 3244 2070 6f69 tween two 2D poi │ │ │ +000cbce0: 6e74 2073 6574 7320 7573 696e 6720 7468 nt sets using th │ │ │ +000cbcf0: 6520 7365 6c65 6374 6564 2072 6f62 7573 e selected robus │ │ │ +000cbd00: 740a 616c 676f 7269 7468 6d2e 2049 6e6c t.algorithm. Inl │ │ │ +000cbd10: 6965 7273 2061 7265 2064 6574 6572 6d69 iers are determi │ │ │ +000cbd20: 6e65 6420 6279 2074 6865 2072 6570 726f ned by the repro │ │ │ +000cbd30: 6a65 6374 696f 6e20 6572 726f 7220 7468 jection error th │ │ │ +000cbd40: 7265 7368 6f6c 642e 0a0a 3c62 3e4e 6f74 reshold...Not │ │ │ +000cbd50: 653a 3c2f 623e 0a54 6865 2052 414e 5341 e:.The RANSA │ │ │ +000cbd60: 4320 6d65 7468 6f64 2063 616e 2068 616e C method can han │ │ │ +000cbd70: 646c 6520 7072 6163 7469 6361 6c6c 7920 dle practically │ │ │ +000cbd80: 616e 7920 7261 7469 6f20 6f66 206f 7574 any ratio of out │ │ │ +000cbd90: 6c69 6572 7320 6275 7420 6e65 6564 7320 liers but needs │ │ │ +000cbda0: 6120 7468 7265 7368 6f6c 6420 746f 0a64 a threshold to.d │ │ │ +000cbdb0: 6973 7469 6e67 7569 7368 2069 6e6c 6965 istinguish inlie │ │ │ +000cbdc0: 7273 2066 726f 6d20 6f75 746c 6965 7273 rs from outliers │ │ │ +000cbdd0: 2e20 5468 6520 6d65 7468 6f64 204c 4d65 . The method LMe │ │ │ +000cbde0: 4453 2064 6f65 7320 6e6f 7420 6e65 6564 DS does not need │ │ │ +000cbdf0: 2061 6e79 2074 6872 6573 686f 6c64 2062 any threshold b │ │ │ +000cbe00: 7574 2077 6f72 6b73 0a63 6f72 7265 6374 ut works.correct │ │ │ +000cbe10: 6c79 206f 6e6c 7920 7768 656e 2074 6865 ly only when the │ │ │ +000cbe20: 7265 2061 7265 206d 6f72 6520 7468 616e re are more than │ │ │ +000cbe30: 2035 3025 2069 6e6c 6965 7273 2e0a 0a53 50% inliers...S │ │ │ +000cbe40: 4545 3a20 6573 7469 6d61 7465 4166 6669 EE: estimateAffi │ │ │ +000cbe50: 6e65 3244 2c20 6573 7469 6d61 7465 4166 ne2D, estimateAf │ │ │ +000cbe60: 6669 6e65 5061 7274 6961 6c32 442c 2067 finePartial2D, g │ │ │ +000cbe70: 6574 4166 6669 6e65 5472 616e 7366 6f72 etAffineTransfor │ │ │ +000cbe80: 6d3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 m
    .
    ..
    .< │ │ │ +000cbea0: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    estima │ │ │ +000cbf30: 7465 5472 616e 736c 6174 696f 6e32 443c teTranslation2D< │ │ │ +000cbf40: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +000cbfa0: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +000cbfb0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;d │ │ │ +000cbfd0: 6f75 626c 655b 5d3c 2f73 7061 6e3e 266e ouble[]&n │ │ │ +000cbfe0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;e │ │ │ +000cc000: 7374 696d 6174 6554 7261 6e73 6c61 7469 stimateTranslati │ │ │ +000cc010: 6f6e 3244 3c2f 7370 616e 3e3c 7762 723e on2D │ │ │ +000cc020: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +000cc080: 7370 3b66 726f 6d2c 0a20 3c61 2068 7265 sp;from,. Mat&nb │ │ │ +000cc0d0: 7370 3b74 6f2c 0a20 3c61 2068 7265 663d sp;to,. Mat  │ │ │ +000cc120: 3b69 6e6c 6965 7273 2c0a 2069 6e74 266e ;inliers,. int&n │ │ │ +000cc130: 6273 703b 6d65 7468 6f64 2c0a 2064 6f75 bsp;method,. dou │ │ │ +000cc140: 626c 6526 6e62 7370 3b72 616e 7361 6352 ble ransacR │ │ │ +000cc150: 6570 726f 6a54 6872 6573 686f 6c64 293c eprojThreshold)< │ │ │ +000cc160: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ +000cc180: 436f 6d70 7574 6573 2061 2070 7572 6520 Computes a pure │ │ │ +000cc190: 3244 2074 7261 6e73 6c61 7469 6f6e 2062 2D translation b │ │ │ +000cc1a0: 6574 7765 656e 2074 776f 2032 4420 706f etween two 2D po │ │ │ +000cc1b0: 696e 7420 7365 7473 2e0a 0a49 7420 636f int sets...It co │ │ │ +000cc1c0: 6d70 7574 6573 0a5c 280a 5c62 6567 696e mputes.\(.\begin │ │ │ +000cc1d0: 7b62 6d61 7472 6978 7d0a 785c 5c0a 790a {bmatrix}.x\\.y. │ │ │ +000cc1e0: 5c65 6e64 7b62 6d61 7472 6978 7d0a 3d0a \end{bmatrix}.=. │ │ │ +000cc1f0: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ +000cc200: 3120 2661 6d70 3b20 305c 5c0a 3020 2661 1 & 0\\.0 &a │ │ │ +000cc210: 6d70 3b20 310a 5c65 6e64 7b62 6d61 7472 mp; 1.\end{bmatr │ │ │ +000cc220: 6978 7d0a 5c62 6567 696e 7b62 6d61 7472 ix}.\begin{bmatr │ │ │ +000cc230: 6978 7d0a 585c 5c0a 590a 5c65 6e64 7b62 ix}.X\\.Y.\end{b │ │ │ +000cc240: 6d61 7472 6978 7d0a 2b0a 5c62 6567 696e matrix}.+.\begin │ │ │ +000cc250: 7b62 6d61 7472 6978 7d0a 745f 785c 5c0a {bmatrix}.t_x\\. │ │ │ +000cc260: 745f 790a 5c65 6e64 7b62 6d61 7472 6978 t_y.\end{bmatrix │ │ │ +000cc270: 7d2e 0a5c 293c 2f64 6976 3e0a 3c64 6c20 }..\)
    .
    .< │ │ │ +000cc290: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    fr │ │ │ +000cc2b0: 6f6d 3c2f 636f 6465 3e20 2d20 4669 7273 om - Firs │ │ │ +000cc2c0: 7420 696e 7075 7420 3244 2070 6f69 6e74 t input 2D point │ │ │ +000cc2d0: 2073 6574 2063 6f6e 7461 696e 696e 6720 set containing │ │ │ +000cc2e0: 5c28 2858 2c59 295c 292e 3c2f 6464 3e0a \((X,Y)\).
    . │ │ │ +000cc2f0: 3c64 643e 3c63 6f64 653e 746f 3c2f 636f
    to - Second inp │ │ │ +000cc310: 7574 2032 4420 706f 696e 7420 7365 7420 ut 2D point set │ │ │ +000cc320: 636f 6e74 6169 6e69 6e67 205c 2828 782c containing \((x, │ │ │ +000cc330: 7929 5c29 2e3c 2f64 643e 0a3c 6464 3e3c y)\).
    .
    < │ │ │ +000cc340: 636f 6465 3e69 6e6c 6965 7273 3c2f 636f code>inliers - Output vec │ │ │ +000cc360: 746f 7220 696e 6469 6361 7469 6e67 2077 tor indicating w │ │ │ +000cc370: 6869 6368 2070 6f69 6e74 7320 6172 6520 hich points are │ │ │ +000cc380: 696e 6c69 6572 7320 2831 2d69 6e6c 6965 inliers (1-inlie │ │ │ +000cc390: 722c 2030 2d6f 7574 6c69 6572 292e 3c2f r, 0-outlier)..
    me │ │ │ +000cc3b0: 7468 6f64 3c2f 636f 6465 3e20 2d20 526f thod - Ro │ │ │ +000cc3c0: 6275 7374 206d 6574 686f 6420 7573 6564 bust method used │ │ │ +000cc3d0: 2074 6f20 636f 6d70 7574 6520 7468 6520 to compute the │ │ │ +000cc3e0: 7472 616e 7366 6f72 6d61 7469 6f6e 2e20 transformation. │ │ │ +000cc3f0: 5468 6520 666f 6c6c 6f77 696e 6720 6d65 The following me │ │ │ +000cc400: 7468 6f64 7320 6172 6520 706f 7373 6962 thods are possib │ │ │ +000cc410: 6c65 3a0a 3c75 6c3e 0a20 203c 6c69 3e0a le:.
      .
    • . │ │ │ +000cc420: 2020 2052 4546 3a20 5241 4e53 4143 202d REF: RANSAC - │ │ │ +000cc430: 2052 414e 5341 432d 6261 7365 6420 726f RANSAC-based ro │ │ │ +000cc440: 6275 7374 206d 6574 686f 640a 2020 3c2f bust method. .
    • . RE │ │ │ +000cc460: 463a 204c 4d45 4453 202d 204c 6561 7374 F: LMEDS - Least │ │ │ +000cc470: 2d4d 6564 6961 6e20 726f 6275 7374 206d -Median robust m │ │ │ +000cc480: 6574 686f 640a 5241 4e53 4143 2069 7320 ethod.RANSAC is │ │ │ +000cc490: 7468 6520 6465 6661 756c 7420 6d65 7468 the default meth │ │ │ +000cc4a0: 6f64 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c od..
    • .
    .
    ransacReprojThr │ │ │ +000cc4d0: 6573 686f 6c64 3c2f 636f 6465 3e20 2d20 eshold - │ │ │ +000cc4e0: 4d61 7869 6d75 6d20 7265 7072 6f6a 6563 Maximum reprojec │ │ │ +000cc4f0: 7469 6f6e 2065 7272 6f72 2069 6e20 7468 tion error in th │ │ │ +000cc500: 6520 5241 4e53 4143 2061 6c67 6f72 6974 e RANSAC algorit │ │ │ +000cc510: 686d 2074 6f20 636f 6e73 6964 6572 0a61 hm to consider.a │ │ │ +000cc520: 2070 6f69 6e74 2061 7320 616e 2069 6e6c point as an inl │ │ │ +000cc530: 6965 722e 2041 7070 6c69 6573 206f 6e6c ier. Applies onl │ │ │ +000cc540: 7920 746f 2052 414e 5341 432e 0a62 6574 y to RANSAC..bet │ │ │ +000cc550: 7765 656e 2030 2e39 3520 616e 6420 302e ween 0.95 and 0. │ │ │ +000cc560: 3939 2069 7320 7573 7561 6c6c 7920 676f 99 is usually go │ │ │ +000cc570: 6f64 2065 6e6f 7567 682e 2056 616c 7565 od enough. Value │ │ │ +000cc580: 7320 746f 6f20 636c 6f73 6520 746f 2031 s too close to 1 │ │ │ +000cc590: 2063 616e 2073 6c6f 7720 646f 776e 2074 can slow down t │ │ │ +000cc5a0: 6865 2065 7374 696d 6174 696f 6e0a 7369 he estimation.si │ │ │ +000cc5b0: 676e 6966 6963 616e 746c 792e 2056 616c gnificantly. Val │ │ │ +000cc5c0: 7565 7320 6c6f 7765 7220 7468 616e 2030 ues lower than 0 │ │ │ +000cc5d0: 2e38 e280 9330 2e39 2063 616e 2072 6573 .8...0.9 can res │ │ │ +000cc5e0: 756c 7420 696e 2061 6e20 696e 636f 7272 ult in an incorr │ │ │ +000cc5f0: 6563 746c 7920 6573 7469 6d61 7465 6420 ectly estimated │ │ │ +000cc600: 7472 616e 7366 6f72 6d61 7469 6f6e 2e0a transformation.. │ │ │ +000cc610: 7468 6520 6c65 6173 742d 7371 7561 7265 the least-square │ │ │ +000cc620: 7320 736f 6c75 7469 6f6e 206f 6e20 696e s solution on in │ │ │ +000cc630: 6c69 6572 7320 6973 2063 6c6f 7365 642d liers is closed- │ │ │ +000cc640: 666f 726d 2c20 736f 2070 6173 7369 6e67 form, so passing │ │ │ +000cc650: 2030 2069 7320 7265 636f 6d6d 656e 6465 0 is recommende │ │ │ +000cc660: 6420 286e 6f20 6164 6469 7469 6f6e 616c d (no additional │ │ │ +000cc670: 2072 6566 696e 6529 2e3c 2f64 643e 0a3c refine).
    .< │ │ │ +000cc680: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ +000cc690: 0a3c 6464 3e41 2032 4420 7472 616e 736c .
    A 2D transl │ │ │ +000cc6a0: 6174 696f 6e20 7665 6374 6f72 205c 285b ation vector \([ │ │ │ +000cc6b0: 745f 782c 2074 5f79 5d5e 545c 2920 6173 t_x, t_y]^T\) as │ │ │ +000cc6c0: 203c 636f 6465 3e63 763a 3a56 6563 3264 cv::Vec2d │ │ │ +000cc6d0: 3c2f 636f 6465 3e2e 2049 6620 7468 6520 . If the │ │ │ +000cc6e0: 7472 616e 736c 6174 696f 6e20 636f 756c translation coul │ │ │ +000cc6f0: 6420 6e6f 7420 6265 0a65 7374 696d 6174 d not be.estimat │ │ │ +000cc700: 6564 2c20 626f 7468 2063 6f6d 706f 6e65 ed, both compone │ │ │ +000cc710: 6e74 7320 6172 6520 7365 7420 746f 204e nts are set to N │ │ │ +000cc720: 614e 2061 6e64 2c20 6966 203c 636f 6465 aN and, if inliers │ │ │ +000cc740: 6973 2070 726f 7669 6465 642c 2074 6865 is provided, the │ │ │ +000cc750: 206d 6173 6b20 6973 2066 696c 6c65 6420 mask is filled │ │ │ +000cc760: 7769 7468 207a 6572 6f73 2e0a 0a5c 7061 with zeros...\pa │ │ │ +000cc770: 7220 436f 6e76 6572 7469 6e67 2074 6f20 r Converting to │ │ │ +000cc780: 6120 3278 3320 7472 616e 7366 6f72 6d61 a 2x3 transforma │ │ │ +000cc790: 7469 6f6e 206d 6174 7269 783a 0a5c 280a tion matrix:.\(. │ │ │ +000cc7a0: 5c62 6567 696e 7b62 6d61 7472 6978 7d0a \begin{bmatrix}. │ │ │ +000cc7b0: 3120 2661 6d70 3b20 3020 2661 6d70 3b20 1 & 0 & │ │ │ +000cc7c0: 745f 785c 5c0a 3020 2661 6d70 3b20 3120 t_x\\.0 & 1 │ │ │ +000cc7d0: 2661 6d70 3b20 745f 790a 5c65 6e64 7b62 & t_y.\end{b │ │ │ +000cc7e0: 6d61 7472 6978 7d0a 5c29 0a0a 3c63 6f64 matrix}.\)...cv::Vec2d t = │ │ │ +000cc800: 2063 763a 3a65 7374 696d 6174 6554 7261 cv::estimateTra │ │ │ +000cc810: 6e73 6c61 7469 6f6e 3244 2866 726f 6d2c nslation2D(from, │ │ │ +000cc820: 2074 6f2c 2069 6e6c 6965 7273 293b 0a63 to, inliers);.c │ │ │ +000cc830: 763a 3a4d 6174 2054 203d 2028 6376 3a3a v::Mat T = (cv:: │ │ │ +000cc840: 4d61 745f 266c 743b 646f 7562 6c65 2667 Mat_<double&g │ │ │ +000cc850: 743b 2832 2c33 2920 266c 743b 266c 743b t;(2,3) << │ │ │ +000cc860: 2031 2c30 2c74 5b30 5d2c 2030 2c31 2c74 1,0,t[0], 0,1,t │ │ │ +000cc870: 5b31 5d29 3b0a 3c2f 636f 6465 3e0a 0a54 [1]);...T │ │ │ +000cc880: 6865 2066 756e 6374 696f 6e20 6573 7469 he function esti │ │ │ +000cc890: 6d61 7465 7320 6120 7075 7265 2032 4420 mates a pure 2D │ │ │ +000cc8a0: 7472 616e 736c 6174 696f 6e20 6265 7477 translation betw │ │ │ +000cc8b0: 6565 6e20 7477 6f20 3244 2070 6f69 6e74 een two 2D point │ │ │ +000cc8c0: 2073 6574 7320 7573 696e 6720 7468 6520 sets using the │ │ │ +000cc8d0: 7365 6c65 6374 6564 2072 6f62 7573 740a selected robust. │ │ │ +000cc8e0: 616c 676f 7269 7468 6d2e 2049 6e6c 6965 algorithm. Inlie │ │ │ +000cc8f0: 7273 2061 7265 2064 6574 6572 6d69 6e65 rs are determine │ │ │ +000cc900: 6420 6279 2074 6865 2072 6570 726f 6a65 d by the reproje │ │ │ +000cc910: 6374 696f 6e20 6572 726f 7220 7468 7265 ction error thre │ │ │ +000cc920: 7368 6f6c 642e 0a0a 3c62 3e4e 6f74 653a shold...Note: │ │ │ +000cc930: 3c2f 623e 0a54 6865 2052 414e 5341 4320 .The RANSAC │ │ │ +000cc940: 6d65 7468 6f64 2063 616e 2068 616e 646c method can handl │ │ │ +000cc950: 6520 7072 6163 7469 6361 6c6c 7920 616e e practically an │ │ │ +000cc960: 7920 7261 7469 6f20 6f66 206f 7574 6c69 y ratio of outli │ │ │ +000cc970: 6572 7320 6275 7420 6e65 6564 7320 6120 ers but needs a │ │ │ +000cc980: 7468 7265 7368 6f6c 6420 746f 0a64 6973 threshold to.dis │ │ │ +000cc990: 7469 6e67 7569 7368 2069 6e6c 6965 7273 tinguish inliers │ │ │ +000cc9a0: 2066 726f 6d20 6f75 746c 6965 7273 2e20 from outliers. │ │ │ +000cc9b0: 5468 6520 6d65 7468 6f64 204c 4d65 4453 The method LMeDS │ │ │ +000cc9c0: 2064 6f65 7320 6e6f 7420 6e65 6564 2061 does not need a │ │ │ +000cc9d0: 6e79 2074 6872 6573 686f 6c64 2062 7574 ny threshold but │ │ │ +000cc9e0: 2077 6f72 6b73 0a63 6f72 7265 6374 6c79 works.correctly │ │ │ +000cc9f0: 206f 6e6c 7920 7768 656e 2074 6865 7265 only when there │ │ │ +000cca00: 2061 7265 206d 6f72 6520 7468 616e 2035 are more than 5 │ │ │ +000cca10: 3025 2069 6e6c 6965 7273 2e0a 0a53 4545 0% inliers...SEE │ │ │ +000cca20: 3a20 6573 7469 6d61 7465 4166 6669 6e65 : estimateAffine │ │ │ +000cca30: 3244 2c20 6573 7469 6d61 7465 4166 6669 2D, estimateAffi │ │ │ +000cca40: 6e65 5061 7274 6961 6c32 442c 2067 6574 nePartial2D, get │ │ │ +000cca50: 4166 6669 6e65 5472 616e 7366 6f72 6d3c AffineTransform< │ │ │ +000cca60: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    ....
  • .
    .

    estimateTransla │ │ │ +000ccb10: 7469 6f6e 3244 3c2f 6833 3e0a 3c64 6976 tion2D

    .
    .
    public static< │ │ │ +000ccb80: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> double[] estimateTr │ │ │ +000ccbe0: 616e 736c 6174 696f 6e32 443c 2f73 7061 anslation2D │ │ │ +000ccc10: 283c 6120 6872 6566 3d22 2e2e 2f63 6f72 (Mat │ │ │ +000ccc50: 3c2f 613e 266e 6273 703b 6672 6f6d 2c0a  from,. │ │ │ +000ccc60: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000ccca0: 3c2f 613e 266e 6273 703b 746f 2c0a 203c  to,. < │ │ │ +000cccb0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000cccc0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000cccd0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000ccce0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat inliers, │ │ │ +000ccd00: 0a20 696e 7426 6e62 7370 3b6d 6574 686f . int metho │ │ │ +000ccd10: 6429 3c2f 7370 616e 3e3c 2f64 6976 3e0a d)
    . │ │ │ +000ccd20: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Computes a pu │ │ │ +000ccd40: 7265 2032 4420 7472 616e 736c 6174 696f re 2D translatio │ │ │ +000ccd50: 6e20 6265 7477 6565 6e20 7477 6f20 3244 n between two 2D │ │ │ +000ccd60: 2070 6f69 6e74 2073 6574 732e 0a0a 4974 point sets...It │ │ │ +000ccd70: 2063 6f6d 7075 7465 730a 5c28 0a5c 6265 computes.\(.\be │ │ │ +000ccd80: 6769 6e7b 626d 6174 7269 787d 0a78 5c5c gin{bmatrix}.x\\ │ │ │ +000ccd90: 0a79 0a5c 656e 647b 626d 6174 7269 787d .y.\end{bmatrix} │ │ │ +000ccda0: 0a3d 0a5c 6265 6769 6e7b 626d 6174 7269 .=.\begin{bmatri │ │ │ +000ccdb0: 787d 0a31 2026 616d 703b 2030 5c5c 0a30 x}.1 & 0\\.0 │ │ │ +000ccdc0: 2026 616d 703b 2031 0a5c 656e 647b 626d & 1.\end{bm │ │ │ +000ccdd0: 6174 7269 787d 0a5c 6265 6769 6e7b 626d atrix}.\begin{bm │ │ │ +000ccde0: 6174 7269 787d 0a58 5c5c 0a59 0a5c 656e atrix}.X\\.Y.\en │ │ │ +000ccdf0: 647b 626d 6174 7269 787d 0a2b 0a5c 6265 d{bmatrix}.+.\be │ │ │ +000cce00: 6769 6e7b 626d 6174 7269 787d 0a74 5f78 gin{bmatrix}.t_x │ │ │ +000cce10: 5c5c 0a74 5f79 0a5c 656e 647b 626d 6174 \\.t_y.\end{bmat │ │ │ +000cce20: 7269 787d 2e0a 5c29 3c2f 6469 763e 0a3c rix}..\)
    .< │ │ │ +000cce30: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ +000cce40: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ +000cce50: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    from - F │ │ │ +000cce70: 6972 7374 2069 6e70 7574 2032 4420 706f irst input 2D po │ │ │ +000cce80: 696e 7420 7365 7420 636f 6e74 6169 6e69 int set containi │ │ │ +000cce90: 6e67 205c 2828 582c 5929 5c29 2e3c 2f64 ng \((X,Y)\)..
    to< │ │ │ +000cceb0: 2f63 6f64 653e 202d 2053 6563 6f6e 6420 /code> - Second │ │ │ +000ccec0: 696e 7075 7420 3244 2070 6f69 6e74 2073 input 2D point s │ │ │ +000cced0: 6574 2063 6f6e 7461 696e 696e 6720 5c28 et containing \( │ │ │ +000ccee0: 2878 2c79 295c 292e 3c2f 6464 3e0a 3c64 (x,y)\).
    .inliers< │ │ │ +000ccf00: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ +000ccf10: 7665 6374 6f72 2069 6e64 6963 6174 696e vector indicatin │ │ │ +000ccf20: 6720 7768 6963 6820 706f 696e 7473 2061 g which points a │ │ │ +000ccf30: 7265 2069 6e6c 6965 7273 2028 312d 696e re inliers (1-in │ │ │ +000ccf40: 6c69 6572 2c20 302d 6f75 746c 6965 7229 lier, 0-outlier) │ │ │ +000ccf50: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 ..
    method - │ │ │ +000ccf70: 2052 6f62 7573 7420 6d65 7468 6f64 2075 Robust method u │ │ │ +000ccf80: 7365 6420 746f 2063 6f6d 7075 7465 2074 sed to compute t │ │ │ +000ccf90: 6865 2074 7261 6e73 666f 726d 6174 696f he transformatio │ │ │ +000ccfa0: 6e2e 2054 6865 2066 6f6c 6c6f 7769 6e67 n. The following │ │ │ +000ccfb0: 206d 6574 686f 6473 2061 7265 2070 6f73 methods are pos │ │ │ +000ccfc0: 7369 626c 653a 0a3c 756c 3e0a 2020 3c6c sible:.
      . . REF: RANSA │ │ │ +000ccfe0: 4320 2d20 5241 4e53 4143 2d62 6173 6564 C - RANSAC-based │ │ │ +000ccff0: 2072 6f62 7573 7420 6d65 7468 6f64 0a20 robust method. │ │ │ +000cd000: 203c 2f6c 693e 0a20 203c 6c69 3e0a 2020 .
    • . │ │ │ +000cd010: 2052 4546 3a20 4c4d 4544 5320 2d20 4c65 REF: LMEDS - Le │ │ │ +000cd020: 6173 742d 4d65 6469 616e 2072 6f62 7573 ast-Median robus │ │ │ +000cd030: 7420 6d65 7468 6f64 0a52 414e 5341 4320 t method.RANSAC │ │ │ +000cd040: 6973 2074 6865 2064 6566 6175 6c74 206d is the default m │ │ │ +000cd050: 6574 686f 642e 0a20 203c 2f6c 693e 0a3c ethod..
    • .< │ │ │ +000cd060: 2f75 6c3e 0a61 2070 6f69 6e74 2061 7320 /ul>.a point as │ │ │ +000cd070: 616e 2069 6e6c 6965 722e 2041 7070 6c69 an inlier. Appli │ │ │ +000cd080: 6573 206f 6e6c 7920 746f 2052 414e 5341 es only to RANSA │ │ │ +000cd090: 432e 0a62 6574 7765 656e 2030 2e39 3520 C..between 0.95 │ │ │ +000cd0a0: 616e 6420 302e 3939 2069 7320 7573 7561 and 0.99 is usua │ │ │ +000cd0b0: 6c6c 7920 676f 6f64 2065 6e6f 7567 682e lly good enough. │ │ │ +000cd0c0: 2056 616c 7565 7320 746f 6f20 636c 6f73 Values too clos │ │ │ +000cd0d0: 6520 746f 2031 2063 616e 2073 6c6f 7720 e to 1 can slow │ │ │ +000cd0e0: 646f 776e 2074 6865 2065 7374 696d 6174 down the estimat │ │ │ +000cd0f0: 696f 6e0a 7369 676e 6966 6963 616e 746c ion.significantl │ │ │ +000cd100: 792e 2056 616c 7565 7320 6c6f 7765 7220 y. Values lower │ │ │ +000cd110: 7468 616e 2030 2e38 e280 9330 2e39 2063 than 0.8...0.9 c │ │ │ +000cd120: 616e 2072 6573 756c 7420 696e 2061 6e20 an result in an │ │ │ +000cd130: 696e 636f 7272 6563 746c 7920 6573 7469 incorrectly esti │ │ │ +000cd140: 6d61 7465 6420 7472 616e 7366 6f72 6d61 mated transforma │ │ │ +000cd150: 7469 6f6e 2e0a 7468 6520 6c65 6173 742d tion..the least- │ │ │ +000cd160: 7371 7561 7265 7320 736f 6c75 7469 6f6e squares solution │ │ │ +000cd170: 206f 6e20 696e 6c69 6572 7320 6973 2063 on inliers is c │ │ │ +000cd180: 6c6f 7365 642d 666f 726d 2c20 736f 2070 losed-form, so p │ │ │ +000cd190: 6173 7369 6e67 2030 2069 7320 7265 636f assing 0 is reco │ │ │ +000cd1a0: 6d6d 656e 6465 6420 286e 6f20 6164 6469 mmended (no addi │ │ │ +000cd1b0: 7469 6f6e 616c 2072 6566 696e 6529 2e3c tional refine).< │ │ │ +000cd1c0: 2f64 643e 0a3c 6474 3e52 6574 7572 6e73 /dd>.
      Returns │ │ │ +000cd1d0: 3a3c 2f64 743e 0a3c 6464 3e41 2032 4420 :
      .
      A 2D │ │ │ +000cd1e0: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ +000cd1f0: 6f72 205c 285b 745f 782c 2074 5f79 5d5e or \([t_x, t_y]^ │ │ │ +000cd200: 545c 2920 6173 203c 636f 6465 3e63 763a T\) as cv: │ │ │ +000cd210: 3a56 6563 3264 3c2f 636f 6465 3e2e 2049 :Vec2d. I │ │ │ +000cd220: 6620 7468 6520 7472 616e 736c 6174 696f f the translatio │ │ │ +000cd230: 6e20 636f 756c 6420 6e6f 7420 6265 0a65 n could not be.e │ │ │ +000cd240: 7374 696d 6174 6564 2c20 626f 7468 2063 stimated, both c │ │ │ +000cd250: 6f6d 706f 6e65 6e74 7320 6172 6520 7365 omponents are se │ │ │ +000cd260: 7420 746f 204e 614e 2061 6e64 2c20 6966 t to NaN and, if │ │ │ +000cd270: 203c 636f 6465 3e69 6e6c 6965 7273 3c2f inliers is provide │ │ │ +000cd290: 642c 2074 6865 206d 6173 6b20 6973 2066 d, the mask is f │ │ │ +000cd2a0: 696c 6c65 6420 7769 7468 207a 6572 6f73 illed with zeros │ │ │ +000cd2b0: 2e0a 0a5c 7061 7220 436f 6e76 6572 7469 ...\par Converti │ │ │ +000cd2c0: 6e67 2074 6f20 6120 3278 3320 7472 616e ng to a 2x3 tran │ │ │ +000cd2d0: 7366 6f72 6d61 7469 6f6e 206d 6174 7269 sformation matri │ │ │ +000cd2e0: 783a 0a5c 280a 5c62 6567 696e 7b62 6d61 x:.\(.\begin{bma │ │ │ +000cd2f0: 7472 6978 7d0a 3120 2661 6d70 3b20 3020 trix}.1 & 0 │ │ │ +000cd300: 2661 6d70 3b20 745f 785c 5c0a 3020 2661 & t_x\\.0 &a │ │ │ +000cd310: 6d70 3b20 3120 2661 6d70 3b20 745f 790a mp; 1 & t_y. │ │ │ +000cd320: 5c65 6e64 7b62 6d61 7472 6978 7d0a 5c29 \end{bmatrix}.\) │ │ │ +000cd330: 0a0a 3c63 6f64 653e 0a63 763a 3a56 6563 ...cv::Vec │ │ │ +000cd340: 3264 2074 203d 2063 763a 3a65 7374 696d 2d t = cv::estim │ │ │ +000cd350: 6174 6554 7261 6e73 6c61 7469 6f6e 3244 ateTranslation2D │ │ │ +000cd360: 2866 726f 6d2c 2074 6f2c 2069 6e6c 6965 (from, to, inlie │ │ │ +000cd370: 7273 293b 0a63 763a 3a4d 6174 2054 203d rs);.cv::Mat T = │ │ │ +000cd380: 2028 6376 3a3a 4d61 745f 266c 743b 646f (cv::Mat_<do │ │ │ +000cd390: 7562 6c65 2667 743b 2832 2c33 2920 266c uble>(2,3) &l │ │ │ +000cd3a0: 743b 266c 743b 2031 2c30 2c74 5b30 5d2c t;< 1,0,t[0], │ │ │ +000cd3b0: 2030 2c31 2c74 5b31 5d29 3b0a 3c2f 636f 0,1,t[1]);...The functio │ │ │ +000cd3d0: 6e20 6573 7469 6d61 7465 7320 6120 7075 n estimates a pu │ │ │ +000cd3e0: 7265 2032 4420 7472 616e 736c 6174 696f re 2D translatio │ │ │ +000cd3f0: 6e20 6265 7477 6565 6e20 7477 6f20 3244 n between two 2D │ │ │ +000cd400: 2070 6f69 6e74 2073 6574 7320 7573 696e point sets usin │ │ │ +000cd410: 6720 7468 6520 7365 6c65 6374 6564 2072 g the selected r │ │ │ +000cd420: 6f62 7573 740a 616c 676f 7269 7468 6d2e obust.algorithm. │ │ │ +000cd430: 2049 6e6c 6965 7273 2061 7265 2064 6574 Inliers are det │ │ │ +000cd440: 6572 6d69 6e65 6420 6279 2074 6865 2072 ermined by the r │ │ │ +000cd450: 6570 726f 6a65 6374 696f 6e20 6572 726f eprojection erro │ │ │ +000cd460: 7220 7468 7265 7368 6f6c 642e 0a0a 3c62 r threshold...Note:.The R │ │ │ +000cd480: 414e 5341 4320 6d65 7468 6f64 2063 616e ANSAC method can │ │ │ +000cd490: 2068 616e 646c 6520 7072 6163 7469 6361 handle practica │ │ │ +000cd4a0: 6c6c 7920 616e 7920 7261 7469 6f20 6f66 lly any ratio of │ │ │ +000cd4b0: 206f 7574 6c69 6572 7320 6275 7420 6e65 outliers but ne │ │ │ +000cd4c0: 6564 7320 6120 7468 7265 7368 6f6c 6420 eds a threshold │ │ │ +000cd4d0: 746f 0a64 6973 7469 6e67 7569 7368 2069 to.distinguish i │ │ │ +000cd4e0: 6e6c 6965 7273 2066 726f 6d20 6f75 746c nliers from outl │ │ │ +000cd4f0: 6965 7273 2e20 5468 6520 6d65 7468 6f64 iers. The method │ │ │ +000cd500: 204c 4d65 4453 2064 6f65 7320 6e6f 7420 LMeDS does not │ │ │ +000cd510: 6e65 6564 2061 6e79 2074 6872 6573 686f need any thresho │ │ │ +000cd520: 6c64 2062 7574 2077 6f72 6b73 0a63 6f72 ld but works.cor │ │ │ +000cd530: 7265 6374 6c79 206f 6e6c 7920 7768 656e rectly only when │ │ │ +000cd540: 2074 6865 7265 2061 7265 206d 6f72 6520 there are more │ │ │ +000cd550: 7468 616e 2035 3025 2069 6e6c 6965 7273 than 50% inliers │ │ │ +000cd560: 2e0a 0a53 4545 3a20 6573 7469 6d61 7465 ...SEE: estimate │ │ │ +000cd570: 4166 6669 6e65 3244 2c20 6573 7469 6d61 Affine2D, estima │ │ │ +000cd580: 7465 4166 6669 6e65 5061 7274 6961 6c32 teAffinePartial2 │ │ │ +000cd590: 442c 2067 6574 4166 6669 6e65 5472 616e D, getAffineTran │ │ │ +000cd5a0: 7366 6f72 6d3c 2f64 643e 0a3c 2f64 6c3e sform
      . │ │ │ +000cd5b0: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • ..< │ │ │ +000cd640: 6833 3e65 7374 696d 6174 6554 7261 6e73 h3>estimateTrans │ │ │ +000cd650: 6c61 7469 6f6e 3244 3c2f 6833 3e0a 3c64 lation2D
  • ..public stati │ │ │ +000cd6c0: 633c 2f73 7061 6e3e 266e 6273 703b 3c73 c double[] │ │ │ +000cd6f0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  estimate │ │ │ +000cd720: 5472 616e 736c 6174 696f 6e32 443c 2f73 Translation2D(M │ │ │ +000cd790: 6174 3c2f 613e 266e 6273 703b 6672 6f6d at from │ │ │ +000cd7a0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000cd7e0: 6174 3c2f 613e 266e 6273 703b 746f 2c0a at to,. │ │ │ +000cd7f0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000cd830: 3c2f 613e 266e 6273 703b 696e 6c69 6572  inlier │ │ │ +000cd840: 7329 3c2f 7370 616e 3e3c 2f64 6976 3e0a s). │ │ │ +000cd850: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Computes a pu │ │ │ +000cd870: 7265 2032 4420 7472 616e 736c 6174 696f re 2D translatio │ │ │ +000cd880: 6e20 6265 7477 6565 6e20 7477 6f20 3244 n between two 2D │ │ │ +000cd890: 2070 6f69 6e74 2073 6574 732e 0a0a 4974 point sets...It │ │ │ +000cd8a0: 2063 6f6d 7075 7465 730a 5c28 0a5c 6265 computes.\(.\be │ │ │ +000cd8b0: 6769 6e7b 626d 6174 7269 787d 0a78 5c5c gin{bmatrix}.x\\ │ │ │ +000cd8c0: 0a79 0a5c 656e 647b 626d 6174 7269 787d .y.\end{bmatrix} │ │ │ +000cd8d0: 0a3d 0a5c 6265 6769 6e7b 626d 6174 7269 .=.\begin{bmatri │ │ │ +000cd8e0: 787d 0a31 2026 616d 703b 2030 5c5c 0a30 x}.1 & 0\\.0 │ │ │ +000cd8f0: 2026 616d 703b 2031 0a5c 656e 647b 626d & 1.\end{bm │ │ │ +000cd900: 6174 7269 787d 0a5c 6265 6769 6e7b 626d atrix}.\begin{bm │ │ │ +000cd910: 6174 7269 787d 0a58 5c5c 0a59 0a5c 656e atrix}.X\\.Y.\en │ │ │ +000cd920: 647b 626d 6174 7269 787d 0a2b 0a5c 6265 d{bmatrix}.+.\be │ │ │ +000cd930: 6769 6e7b 626d 6174 7269 787d 0a74 5f78 gin{bmatrix}.t_x │ │ │ +000cd940: 5c5c 0a74 5f79 0a5c 656e 647b 626d 6174 \\.t_y.\end{bmat │ │ │ +000cd950: 7269 787d 2e0a 5c29 3c2f 6469 763e 0a3c rix}..\)
    .< │ │ │ +000cd960: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ +000cd970: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ +000cd980: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    from - F │ │ │ +000cd9a0: 6972 7374 2069 6e70 7574 2032 4420 706f irst input 2D po │ │ │ +000cd9b0: 696e 7420 7365 7420 636f 6e74 6169 6e69 int set containi │ │ │ +000cd9c0: 6e67 205c 2828 582c 5929 5c29 2e3c 2f64 ng \((X,Y)\)..
    to< │ │ │ +000cd9e0: 2f63 6f64 653e 202d 2053 6563 6f6e 6420 /code> - Second │ │ │ +000cd9f0: 696e 7075 7420 3244 2070 6f69 6e74 2073 input 2D point s │ │ │ +000cda00: 6574 2063 6f6e 7461 696e 696e 6720 5c28 et containing \( │ │ │ +000cda10: 2878 2c79 295c 292e 3c2f 6464 3e0a 3c64 (x,y)\).
    .inliers< │ │ │ +000cda30: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ +000cda40: 7665 6374 6f72 2069 6e64 6963 6174 696e vector indicatin │ │ │ +000cda50: 6720 7768 6963 6820 706f 696e 7473 2061 g which points a │ │ │ +000cda60: 7265 2069 6e6c 6965 7273 2028 312d 696e re inliers (1-in │ │ │ +000cda70: 6c69 6572 2c20 302d 6f75 746c 6965 7229 lier, 0-outlier) │ │ │ +000cda80: 2e0a 3c75 6c3e 0a20 203c 6c69 3e0a 2020 ..
      .
    • . │ │ │ +000cda90: 2052 4546 3a20 5241 4e53 4143 202d 2052 REF: RANSAC - R │ │ │ +000cdaa0: 414e 5341 432d 6261 7365 6420 726f 6275 ANSAC-based robu │ │ │ +000cdab0: 7374 206d 6574 686f 640a 2020 3c2f 6c69 st method.
    • .
    • . REF: │ │ │ +000cdad0: 204c 4d45 4453 202d 204c 6561 7374 2d4d LMEDS - Least-M │ │ │ +000cdae0: 6564 6961 6e20 726f 6275 7374 206d 6574 edian robust met │ │ │ +000cdaf0: 686f 640a 5241 4e53 4143 2069 7320 7468 hod.RANSAC is th │ │ │ +000cdb00: 6520 6465 6661 756c 7420 6d65 7468 6f64 e default method │ │ │ +000cdb10: 2e0a 2020 3c2f 6c69 3e0a 3c2f 756c 3e0a ..
    • .
    . │ │ │ +000cdb20: 6120 706f 696e 7420 6173 2061 6e20 696e a point as an in │ │ │ +000cdb30: 6c69 6572 2e20 4170 706c 6965 7320 6f6e lier. Applies on │ │ │ +000cdb40: 6c79 2074 6f20 5241 4e53 4143 2e0a 6265 ly to RANSAC..be │ │ │ +000cdb50: 7477 6565 6e20 302e 3935 2061 6e64 2030 tween 0.95 and 0 │ │ │ +000cdb60: 2e39 3920 6973 2075 7375 616c 6c79 2067 .99 is usually g │ │ │ +000cdb70: 6f6f 6420 656e 6f75 6768 2e20 5661 6c75 ood enough. Valu │ │ │ +000cdb80: 6573 2074 6f6f 2063 6c6f 7365 2074 6f20 es too close to │ │ │ +000cdb90: 3120 6361 6e20 736c 6f77 2064 6f77 6e20 1 can slow down │ │ │ +000cdba0: 7468 6520 6573 7469 6d61 7469 6f6e 0a73 the estimation.s │ │ │ +000cdbb0: 6967 6e69 6669 6361 6e74 6c79 2e20 5661 ignificantly. Va │ │ │ +000cdbc0: 6c75 6573 206c 6f77 6572 2074 6861 6e20 lues lower than │ │ │ +000cdbd0: 302e 38e2 8093 302e 3920 6361 6e20 7265 0.8...0.9 can re │ │ │ +000cdbe0: 7375 6c74 2069 6e20 616e 2069 6e63 6f72 sult in an incor │ │ │ +000cdbf0: 7265 6374 6c79 2065 7374 696d 6174 6564 rectly estimated │ │ │ +000cdc00: 2074 7261 6e73 666f 726d 6174 696f 6e2e transformation. │ │ │ +000cdc10: 0a74 6865 206c 6561 7374 2d73 7175 6172 .the least-squar │ │ │ +000cdc20: 6573 2073 6f6c 7574 696f 6e20 6f6e 2069 es solution on i │ │ │ +000cdc30: 6e6c 6965 7273 2069 7320 636c 6f73 6564 nliers is closed │ │ │ +000cdc40: 2d66 6f72 6d2c 2073 6f20 7061 7373 696e -form, so passin │ │ │ +000cdc50: 6720 3020 6973 2072 6563 6f6d 6d65 6e64 g 0 is recommend │ │ │ +000cdc60: 6564 2028 6e6f 2061 6464 6974 696f 6e61 ed (no additiona │ │ │ +000cdc70: 6c20 7265 6669 6e65 292e 3c2f 6464 3e0a l refine).. │ │ │ +000cdc80: 3c64 743e 5265 7475 726e 733a 3c2f 6474
    Returns:
    .
    A 2D trans │ │ │ +000cdca0: 6c61 7469 6f6e 2076 6563 746f 7220 5c28 lation vector \( │ │ │ +000cdcb0: 5b74 5f78 2c20 745f 795d 5e54 5c29 2061 [t_x, t_y]^T\) a │ │ │ +000cdcc0: 7320 3c63 6f64 653e 6376 3a3a 5665 6332 s cv::Vec2 │ │ │ +000cdcd0: 643c 2f63 6f64 653e 2e20 4966 2074 6865 d. If the │ │ │ +000cdce0: 2074 7261 6e73 6c61 7469 6f6e 2063 6f75 translation cou │ │ │ +000cdcf0: 6c64 206e 6f74 2062 650a 6573 7469 6d61 ld not be.estima │ │ │ +000cdd00: 7465 642c 2062 6f74 6820 636f 6d70 6f6e ted, both compon │ │ │ +000cdd10: 656e 7473 2061 7265 2073 6574 2074 6f20 ents are set to │ │ │ +000cdd20: 4e61 4e20 616e 642c 2069 6620 3c63 6f64 NaN and, if inliers │ │ │ +000cdd40: 2069 7320 7072 6f76 6964 6564 2c20 7468 is provided, th │ │ │ +000cdd50: 6520 6d61 736b 2069 7320 6669 6c6c 6564 e mask is filled │ │ │ +000cdd60: 2077 6974 6820 7a65 726f 732e 0a0a 5c70 with zeros...\p │ │ │ +000cdd70: 6172 2043 6f6e 7665 7274 696e 6720 746f ar Converting to │ │ │ +000cdd80: 2061 2032 7833 2074 7261 6e73 666f 726d a 2x3 transform │ │ │ +000cdd90: 6174 696f 6e20 6d61 7472 6978 3a0a 5c28 ation matrix:.\( │ │ │ +000cdda0: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ +000cddb0: 0a31 2026 616d 703b 2030 2026 616d 703b .1 & 0 & │ │ │ +000cddc0: 2074 5f78 5c5c 0a30 2026 616d 703b 2031 t_x\\.0 & 1 │ │ │ +000cddd0: 2026 616d 703b 2074 5f79 0a5c 656e 647b & t_y.\end{ │ │ │ +000cdde0: 626d 6174 7269 787d 0a5c 290a 0a3c 636f bmatrix}.\)...cv::Vec2d t │ │ │ +000cde00: 3d20 6376 3a3a 6573 7469 6d61 7465 5472 = cv::estimateTr │ │ │ +000cde10: 616e 736c 6174 696f 6e32 4428 6672 6f6d anslation2D(from │ │ │ +000cde20: 2c20 746f 2c20 696e 6c69 6572 7329 3b0a , to, inliers);. │ │ │ +000cde30: 6376 3a3a 4d61 7420 5420 3d20 2863 763a cv::Mat T = (cv: │ │ │ +000cde40: 3a4d 6174 5f26 6c74 3b64 6f75 626c 6526 :Mat_<double& │ │ │ +000cde50: 6774 3b28 322c 3329 2026 6c74 3b26 6c74 gt;(2,3) << │ │ │ +000cde60: 3b20 312c 302c 745b 305d 2c20 302c 312c ; 1,0,t[0], 0,1, │ │ │ +000cde70: 745b 315d 293b 0a3c 2f63 6f64 653e 0a0a t[1]);... │ │ │ +000cde80: 5468 6520 6675 6e63 7469 6f6e 2065 7374 The function est │ │ │ +000cde90: 696d 6174 6573 2061 2070 7572 6520 3244 imates a pure 2D │ │ │ +000cdea0: 2074 7261 6e73 6c61 7469 6f6e 2062 6574 translation bet │ │ │ +000cdeb0: 7765 656e 2074 776f 2032 4420 706f 696e ween two 2D poin │ │ │ +000cdec0: 7420 7365 7473 2075 7369 6e67 2074 6865 t sets using the │ │ │ +000cded0: 2073 656c 6563 7465 6420 726f 6275 7374 selected robust │ │ │ +000cdee0: 0a61 6c67 6f72 6974 686d 2e20 496e 6c69 .algorithm. Inli │ │ │ +000cdef0: 6572 7320 6172 6520 6465 7465 726d 696e ers are determin │ │ │ +000cdf00: 6564 2062 7920 7468 6520 7265 7072 6f6a ed by the reproj │ │ │ +000cdf10: 6563 7469 6f6e 2065 7272 6f72 2074 6872 ection error thr │ │ │ +000cdf20: 6573 686f 6c64 2e0a 0a3c 623e 4e6f 7465 eshold...Note │ │ │ +000cdf30: 3a3c 2f62 3e0a 5468 6520 5241 4e53 4143 :.The RANSAC │ │ │ +000cdf40: 206d 6574 686f 6420 6361 6e20 6861 6e64 method can hand │ │ │ +000cdf50: 6c65 2070 7261 6374 6963 616c 6c79 2061 le practically a │ │ │ +000cdf60: 6e79 2072 6174 696f 206f 6620 6f75 746c ny ratio of outl │ │ │ +000cdf70: 6965 7273 2062 7574 206e 6565 6473 2061 iers but needs a │ │ │ +000cdf80: 2074 6872 6573 686f 6c64 2074 6f0a 6469 threshold to.di │ │ │ +000cdf90: 7374 696e 6775 6973 6820 696e 6c69 6572 stinguish inlier │ │ │ +000cdfa0: 7320 6672 6f6d 206f 7574 6c69 6572 732e s from outliers. │ │ │ +000cdfb0: 2054 6865 206d 6574 686f 6420 4c4d 6544 The method LMeD │ │ │ +000cdfc0: 5320 646f 6573 206e 6f74 206e 6565 6420 S does not need │ │ │ +000cdfd0: 616e 7920 7468 7265 7368 6f6c 6420 6275 any threshold bu │ │ │ +000cdfe0: 7420 776f 726b 730a 636f 7272 6563 746c t works.correctl │ │ │ +000cdff0: 7920 6f6e 6c79 2077 6865 6e20 7468 6572 y only when ther │ │ │ +000ce000: 6520 6172 6520 6d6f 7265 2074 6861 6e20 e are more than │ │ │ +000ce010: 3530 2520 696e 6c69 6572 732e 0a0a 5345 50% inliers...SE │ │ │ +000ce020: 453a 2065 7374 696d 6174 6541 6666 696e E: estimateAffin │ │ │ +000ce030: 6532 442c 2065 7374 696d 6174 6541 6666 e2D, estimateAff │ │ │ +000ce040: 696e 6550 6172 7469 616c 3244 2c20 6765 inePartial2D, ge │ │ │ +000ce050: 7441 6666 696e 6554 7261 6e73 666f 726d tAffineTransform │ │ │ +000ce060: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .....
  • ..

    estima │ │ │ +000ce0f0: 7465 5472 616e 736c 6174 696f 6e32 443c teTranslation2D< │ │ │ +000ce100: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +000ce160: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +000ce170: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;d │ │ │ +000ce190: 6f75 626c 655b 5d3c 2f73 7061 6e3e 266e ouble[]&n │ │ │ +000ce1a0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;e │ │ │ +000ce1c0: 7374 696d 6174 6554 7261 6e73 6c61 7469 stimateTranslati │ │ │ +000ce1d0: 6f6e 3244 3c2f 7370 616e 3e3c 7762 723e on2D │ │ │ +000ce1e0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +000ce240: 7370 3b66 726f 6d2c 0a20 3c61 2068 7265 sp;from,. Mat&nb │ │ │ +000ce290: 7370 3b74 6f29 3c2f 7370 616e 3e3c 2f64 sp;to).
    Computes │ │ │ +000ce2c0: 6120 7075 7265 2032 4420 7472 616e 736c a pure 2D transl │ │ │ +000ce2d0: 6174 696f 6e20 6265 7477 6565 6e20 7477 ation between tw │ │ │ +000ce2e0: 6f20 3244 2070 6f69 6e74 2073 6574 732e o 2D point sets. │ │ │ +000ce2f0: 0a0a 4974 2063 6f6d 7075 7465 730a 5c28 ..It computes.\( │ │ │ +000ce300: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ +000ce310: 0a78 5c5c 0a79 0a5c 656e 647b 626d 6174 .x\\.y.\end{bmat │ │ │ +000ce320: 7269 787d 0a3d 0a5c 6265 6769 6e7b 626d rix}.=.\begin{bm │ │ │ +000ce330: 6174 7269 787d 0a31 2026 616d 703b 2030 atrix}.1 & 0 │ │ │ +000ce340: 5c5c 0a30 2026 616d 703b 2031 0a5c 656e \\.0 & 1.\en │ │ │ +000ce350: 647b 626d 6174 7269 787d 0a5c 6265 6769 d{bmatrix}.\begi │ │ │ +000ce360: 6e7b 626d 6174 7269 787d 0a58 5c5c 0a59 n{bmatrix}.X\\.Y │ │ │ +000ce370: 0a5c 656e 647b 626d 6174 7269 787d 0a2b .\end{bmatrix}.+ │ │ │ +000ce380: 0a5c 6265 6769 6e7b 626d 6174 7269 787d .\begin{bmatrix} │ │ │ +000ce390: 0a74 5f78 5c5c 0a74 5f79 0a5c 656e 647b .t_x\\.t_y.\end{ │ │ │ +000ce3a0: 626d 6174 7269 787d 2e0a 5c29 3c2f 6469 bmatrix}..\).
    .
    Parame │ │ │ +000ce3d0: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ +000ce3e0: 636f 6465 3e66 726f 6d3c 2f63 6f64 653e code>from │ │ │ +000ce3f0: 202d 2046 6972 7374 2069 6e70 7574 2032 - First input 2 │ │ │ +000ce400: 4420 706f 696e 7420 7365 7420 636f 6e74 D point set cont │ │ │ +000ce410: 6169 6e69 6e67 205c 2828 582c 5929 5c29 aining \((X,Y)\) │ │ │ +000ce420: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    to - Sec │ │ │ +000ce440: 6f6e 6420 696e 7075 7420 3244 2070 6f69 ond input 2D poi │ │ │ +000ce450: 6e74 2073 6574 2063 6f6e 7461 696e 696e nt set containin │ │ │ +000ce460: 6720 5c28 2878 2c79 295c 292e 0a3c 756c g \((x,y)\)..
      .
    • . REF: │ │ │ +000ce480: 2052 414e 5341 4320 2d20 5241 4e53 4143 RANSAC - RANSAC │ │ │ +000ce490: 2d62 6173 6564 2072 6f62 7573 7420 6d65 -based robust me │ │ │ +000ce4a0: 7468 6f64 0a20 203c 2f6c 693e 0a20 203c thod.
    • . < │ │ │ +000ce4b0: 6c69 3e0a 2020 2052 4546 3a20 4c4d 4544 li>. REF: LMED │ │ │ +000ce4c0: 5320 2d20 4c65 6173 742d 4d65 6469 616e S - Least-Median │ │ │ +000ce4d0: 2072 6f62 7573 7420 6d65 7468 6f64 0a52 robust method.R │ │ │ +000ce4e0: 414e 5341 4320 6973 2074 6865 2064 6566 ANSAC is the def │ │ │ +000ce4f0: 6175 6c74 206d 6574 686f 642e 0a20 203c ault method.. < │ │ │ +000ce500: 2f6c 693e 0a3c 2f75 6c3e 0a61 2070 6f69 /li>.
    .a poi │ │ │ +000ce510: 6e74 2061 7320 616e 2069 6e6c 6965 722e nt as an inlier. │ │ │ +000ce520: 2041 7070 6c69 6573 206f 6e6c 7920 746f Applies only to │ │ │ +000ce530: 2052 414e 5341 432e 0a62 6574 7765 656e RANSAC..between │ │ │ +000ce540: 2030 2e39 3520 616e 6420 302e 3939 2069 0.95 and 0.99 i │ │ │ +000ce550: 7320 7573 7561 6c6c 7920 676f 6f64 2065 s usually good e │ │ │ +000ce560: 6e6f 7567 682e 2056 616c 7565 7320 746f nough. Values to │ │ │ +000ce570: 6f20 636c 6f73 6520 746f 2031 2063 616e o close to 1 can │ │ │ +000ce580: 2073 6c6f 7720 646f 776e 2074 6865 2065 slow down the e │ │ │ +000ce590: 7374 696d 6174 696f 6e0a 7369 676e 6966 stimation.signif │ │ │ +000ce5a0: 6963 616e 746c 792e 2056 616c 7565 7320 icantly. Values │ │ │ +000ce5b0: 6c6f 7765 7220 7468 616e 2030 2e38 e280 lower than 0.8.. │ │ │ +000ce5c0: 9330 2e39 2063 616e 2072 6573 756c 7420 .0.9 can result │ │ │ +000ce5d0: 696e 2061 6e20 696e 636f 7272 6563 746c in an incorrectl │ │ │ +000ce5e0: 7920 6573 7469 6d61 7465 6420 7472 616e y estimated tran │ │ │ +000ce5f0: 7366 6f72 6d61 7469 6f6e 2e0a 7468 6520 sformation..the │ │ │ +000ce600: 6c65 6173 742d 7371 7561 7265 7320 736f least-squares so │ │ │ +000ce610: 6c75 7469 6f6e 206f 6e20 696e 6c69 6572 lution on inlier │ │ │ +000ce620: 7320 6973 2063 6c6f 7365 642d 666f 726d s is closed-form │ │ │ +000ce630: 2c20 736f 2070 6173 7369 6e67 2030 2069 , so passing 0 i │ │ │ +000ce640: 7320 7265 636f 6d6d 656e 6465 6420 286e s recommended (n │ │ │ +000ce650: 6f20 6164 6469 7469 6f6e 616c 2072 6566 o additional ref │ │ │ +000ce660: 696e 6529 2e3c 2f64 643e 0a3c 6474 3e52 ine).
    .
    R │ │ │ +000ce670: 6574 7572 6e73 3a3c 2f64 743e 0a3c 6464 eturns:
    .
    A 2D translatio │ │ │ +000ce690: 6e20 7665 6374 6f72 205c 285b 745f 782c n vector \([t_x, │ │ │ +000ce6a0: 2074 5f79 5d5e 545c 2920 6173 203c 636f t_y]^T\) as cv::Vec2d. If the tran │ │ │ +000ce6d0: 736c 6174 696f 6e20 636f 756c 6420 6e6f slation could no │ │ │ +000ce6e0: 7420 6265 0a65 7374 696d 6174 6564 2c20 t be.estimated, │ │ │ +000ce6f0: 626f 7468 2063 6f6d 706f 6e65 6e74 7320 both components │ │ │ +000ce700: 6172 6520 7365 7420 746f 204e 614e 2061 are set to NaN a │ │ │ +000ce710: 6e64 2c20 6966 203c 636f 6465 3e69 6e6c nd, if inl │ │ │ +000ce720: 6965 7273 3c2f 636f 6465 3e20 6973 2070 iers is p │ │ │ +000ce730: 726f 7669 6465 642c 2074 6865 206d 6173 rovided, the mas │ │ │ +000ce740: 6b20 6973 2066 696c 6c65 6420 7769 7468 k is filled with │ │ │ +000ce750: 207a 6572 6f73 2e0a 0a5c 7061 7220 436f zeros...\par Co │ │ │ +000ce760: 6e76 6572 7469 6e67 2074 6f20 6120 3278 nverting to a 2x │ │ │ +000ce770: 3320 7472 616e 7366 6f72 6d61 7469 6f6e 3 transformation │ │ │ +000ce780: 206d 6174 7269 783a 0a5c 280a 5c62 6567 matrix:.\(.\beg │ │ │ +000ce790: 696e 7b62 6d61 7472 6978 7d0a 3120 2661 in{bmatrix}.1 &a │ │ │ +000ce7a0: 6d70 3b20 3020 2661 6d70 3b20 745f 785c mp; 0 & t_x\ │ │ │ +000ce7b0: 5c0a 3020 2661 6d70 3b20 3120 2661 6d70 \.0 & 1 & │ │ │ +000ce7c0: 3b20 745f 790a 5c65 6e64 7b62 6d61 7472 ; t_y.\end{bmatr │ │ │ +000ce7d0: 6978 7d0a 5c29 0a0a 3c63 6f64 653e 0a63 ix}.\)...c │ │ │ +000ce7e0: 763a 3a56 6563 3264 2074 203d 2063 763a v::Vec2d t = cv: │ │ │ +000ce7f0: 3a65 7374 696d 6174 6554 7261 6e73 6c61 :estimateTransla │ │ │ +000ce800: 7469 6f6e 3244 2866 726f 6d2c 2074 6f2c tion2D(from, to, │ │ │ +000ce810: 2069 6e6c 6965 7273 293b 0a63 763a 3a4d inliers);.cv::M │ │ │ +000ce820: 6174 2054 203d 2028 6376 3a3a 4d61 745f at T = (cv::Mat_ │ │ │ +000ce830: 266c 743b 646f 7562 6c65 2667 743b 2832 <double>(2 │ │ │ +000ce840: 2c33 2920 266c 743b 266c 743b 2031 2c30 ,3) << 1,0 │ │ │ +000ce850: 2c74 5b30 5d2c 2030 2c31 2c74 5b31 5d29 ,t[0], 0,1,t[1]) │ │ │ +000ce860: 3b0a 3c2f 636f 6465 3e0a 0a54 6865 2066 ;...The f │ │ │ +000ce870: 756e 6374 696f 6e20 6573 7469 6d61 7465 unction estimate │ │ │ +000ce880: 7320 6120 7075 7265 2032 4420 7472 616e s a pure 2D tran │ │ │ +000ce890: 736c 6174 696f 6e20 6265 7477 6565 6e20 slation between │ │ │ +000ce8a0: 7477 6f20 3244 2070 6f69 6e74 2073 6574 two 2D point set │ │ │ +000ce8b0: 7320 7573 696e 6720 7468 6520 7365 6c65 s using the sele │ │ │ +000ce8c0: 6374 6564 2072 6f62 7573 740a 616c 676f cted robust.algo │ │ │ +000ce8d0: 7269 7468 6d2e 2049 6e6c 6965 7273 2061 rithm. Inliers a │ │ │ +000ce8e0: 7265 2064 6574 6572 6d69 6e65 6420 6279 re determined by │ │ │ +000ce8f0: 2074 6865 2072 6570 726f 6a65 6374 696f the reprojectio │ │ │ +000ce900: 6e20 6572 726f 7220 7468 7265 7368 6f6c n error threshol │ │ │ +000ce910: 642e 0a0a 3c62 3e4e 6f74 653a 3c2f 623e d...Note: │ │ │ +000ce920: 0a54 6865 2052 414e 5341 4320 6d65 7468 .The RANSAC meth │ │ │ +000ce930: 6f64 2063 616e 2068 616e 646c 6520 7072 od can handle pr │ │ │ +000ce940: 6163 7469 6361 6c6c 7920 616e 7920 7261 actically any ra │ │ │ +000ce950: 7469 6f20 6f66 206f 7574 6c69 6572 7320 tio of outliers │ │ │ +000ce960: 6275 7420 6e65 6564 7320 6120 7468 7265 but needs a thre │ │ │ +000ce970: 7368 6f6c 6420 746f 0a64 6973 7469 6e67 shold to.disting │ │ │ +000ce980: 7569 7368 2069 6e6c 6965 7273 2066 726f uish inliers fro │ │ │ +000ce990: 6d20 6f75 746c 6965 7273 2e20 5468 6520 m outliers. The │ │ │ +000ce9a0: 6d65 7468 6f64 204c 4d65 4453 2064 6f65 method LMeDS doe │ │ │ +000ce9b0: 7320 6e6f 7420 6e65 6564 2061 6e79 2074 s not need any t │ │ │ +000ce9c0: 6872 6573 686f 6c64 2062 7574 2077 6f72 hreshold but wor │ │ │ +000ce9d0: 6b73 0a63 6f72 7265 6374 6c79 206f 6e6c ks.correctly onl │ │ │ +000ce9e0: 7920 7768 656e 2074 6865 7265 2061 7265 y when there are │ │ │ +000ce9f0: 206d 6f72 6520 7468 616e 2035 3025 2069 more than 50% i │ │ │ +000cea00: 6e6c 6965 7273 2e0a 0a53 4545 3a20 6573 nliers...SEE: es │ │ │ +000cea10: 7469 6d61 7465 4166 6669 6e65 3244 2c20 timateAffine2D, │ │ │ +000cea20: 6573 7469 6d61 7465 4166 6669 6e65 5061 estimateAffinePa │ │ │ +000cea30: 7274 6961 6c32 442c 2067 6574 4166 6669 rtial2D, getAffi │ │ │ +000cea40: 6e65 5472 616e 7366 6f72 6d3c 2f64 643e neTransform
    │ │ │ +000cea50: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    .
    ..

  • .< │ │ │ +000cea70: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .< │ │ │ +000ceb00: 6833 3e64 6563 6f6d 706f 7365 486f 6d6f h3>decomposeHomo │ │ │ +000ceb10: 6772 6170 6879 4d61 743c 2f68 333e 0a3c graphyMat.< │ │ │ +000ceb20: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +000ceb30: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +000ceb40: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +000ceb50: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +000ceb80: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +000ceb90: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +000ceba0: 726e 2d74 7970 6522 3e69 6e74 3c2f 7370 rn-type">int decomposeHom │ │ │ +000cebe0: 6f67 7261 7068 794d 6174 3c2f 7370 616e ographyMat( │ │ │ +000cec10: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000cec50: 2f61 3e26 6e62 7370 3b48 2c0a 203c 6120 /a> H,. Mat │ │ │ +000ceca0: 266e 6273 703b 4b2c 0a20 3c61 2068 7265  K,. List<< │ │ │ +000ced50: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000ced60: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000ced70: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000ced80: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat> rota │ │ │ +000ceda0: 7469 6f6e 732c 0a20 3c61 2068 7265 663d tions,. List<Mat │ │ │ +000cee90: 2667 743b 266e 6273 703b 7472 616e 736c > transl │ │ │ +000ceea0: 6174 696f 6e73 2c0a 203c 6120 6872 6566 ations,. List<Mat> norma │ │ │ +000cefa0: 6c73 293c 2f73 7061 6e3e 3c2f 6469 763e ls) │ │ │ +000cefb0: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Decompose a │ │ │ +000cefd0: 686f 6d6f 6772 6170 6879 206d 6174 7269 homography matri │ │ │ +000cefe0: 7820 746f 2072 6f74 6174 696f 6e28 7329 x to rotation(s) │ │ │ +000ceff0: 2c20 7472 616e 736c 6174 696f 6e28 7329 , translation(s) │ │ │ +000cf000: 2061 6e64 2070 6c61 6e65 206e 6f72 6d61 and plane norma │ │ │ +000cf010: 6c28 7329 2e3c 2f64 6976 3e0a 3c64 6c20 l(s).
    .
    .< │ │ │ +000cf030: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    H< │ │ │ +000cf050: 2f63 6f64 653e 202d 2054 6865 2069 6e70 /code> - The inp │ │ │ +000cf060: 7574 2068 6f6d 6f67 7261 7068 7920 6d61 ut homography ma │ │ │ +000cf070: 7472 6978 2062 6574 7765 656e 2074 776f trix between two │ │ │ +000cf080: 2069 6d61 6765 732e 3c2f 6464 3e0a 3c64 images.
    .K │ │ │ +000cf0a0: 202d 2054 6865 2069 6e70 7574 2063 616d - The input cam │ │ │ +000cf0b0: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +000cf0c0: 7472 6978 2e3c 2f64 643e 0a3c 6464 3e3c trix..
    < │ │ │ +000cf0d0: 636f 6465 3e72 6f74 6174 696f 6e73 3c2f code>rotations - Array of │ │ │ +000cf0f0: 2072 6f74 6174 696f 6e20 6d61 7472 6963 rotation matric │ │ │ +000cf100: 6573 2e3c 2f64 643e 0a3c 6464 3e3c 636f es.
    .
    translations< │ │ │ +000cf120: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ +000cf130: 6620 7472 616e 736c 6174 696f 6e20 6d61 f translation ma │ │ │ +000cf140: 7472 6963 6573 2e3c 2f64 643e 0a3c 6464 trices.
    .
    normals - Array of │ │ │ +000cf170: 2070 6c61 6e65 206e 6f72 6d61 6c20 6d61 plane normal ma │ │ │ +000cf180: 7472 6963 6573 2e0a 0a54 6869 7320 6675 trices...This fu │ │ │ +000cf190: 6e63 7469 6f6e 2065 7874 7261 6374 7320 nction extracts │ │ │ +000cf1a0: 7265 6c61 7469 7665 2063 616d 6572 6120 relative camera │ │ │ +000cf1b0: 6d6f 7469 6f6e 2062 6574 7765 656e 2074 motion between t │ │ │ +000cf1c0: 776f 2076 6965 7773 206f 6620 6120 706c wo views of a pl │ │ │ +000cf1d0: 616e 6172 206f 626a 6563 7420 616e 6420 anar object and │ │ │ +000cf1e0: 7265 7475 726e 7320 7570 2074 6f0a 666f returns up to.fo │ │ │ +000cf1f0: 7572 206d 6174 6865 6d61 7469 6361 6c20 ur mathematical │ │ │ +000cf200: 736f 6c75 7469 6f6e 2074 7570 6c65 7320 solution tuples │ │ │ +000cf210: 6f66 2072 6f74 6174 696f 6e2c 2074 7261 of rotation, tra │ │ │ +000cf220: 6e73 6c61 7469 6f6e 2c20 616e 6420 706c nslation, and pl │ │ │ +000cf230: 616e 6520 6e6f 726d 616c 2e20 5468 6520 ane normal. The │ │ │ +000cf240: 6465 636f 6d70 6f73 6974 696f 6e20 6f66 decomposition of │ │ │ +000cf250: 0a74 6865 2068 6f6d 6f67 7261 7068 7920 .the homography │ │ │ +000cf260: 6d61 7472 6978 2048 2069 7320 6465 7363 matrix H is desc │ │ │ +000cf270: 7269 6265 6420 696e 2064 6574 6169 6c20 ribed in detail │ │ │ +000cf280: 696e 2043 4954 453a 204d 616c 6973 3230 in CITE: Malis20 │ │ │ +000cf290: 3037 2e0a 0a49 6620 7468 6520 686f 6d6f 07...If the homo │ │ │ +000cf2a0: 6772 6170 6879 2048 2c20 696e 6475 6365 graphy H, induce │ │ │ +000cf2b0: 6420 6279 2074 6865 2070 6c61 6e65 2c20 d by the plane, │ │ │ +000cf2c0: 6769 7665 7320 7468 6520 636f 6e73 7472 gives the constr │ │ │ +000cf2d0: 6169 6e74 0a5c 2873 5f69 205c 7665 6374 aint.\(s_i \vect │ │ │ +000cf2e0: 6872 6565 7b78 275f 697d 7b79 275f 697d hree{x'_i}{y'_i} │ │ │ +000cf2f0: 7b31 7d20 5c73 696d 2048 205c 7665 6374 {1} \sim H \vect │ │ │ +000cf300: 6872 6565 7b78 5f69 7d7b 795f 697d 7b31 hree{x_i}{y_i}{1 │ │ │ +000cf310: 7d5c 2920 6f6e 2074 6865 2073 6f75 7263 }\) on the sourc │ │ │ +000cf320: 6520 696d 6167 6520 706f 696e 7473 0a5c e image points.\ │ │ │ +000cf330: 2870 5f69 5c29 2061 6e64 2074 6865 2064 (p_i\) and the d │ │ │ +000cf340: 6573 7469 6e61 7469 6f6e 2069 6d61 6765 estination image │ │ │ +000cf350: 2070 6f69 6e74 7320 5c28 7027 5f69 5c29 points \(p'_i\) │ │ │ +000cf360: 2c20 7468 656e 2074 6865 2074 7570 6c65 , then the tuple │ │ │ +000cf370: 206f 6620 726f 7461 7469 6f6e 735b 6b5d of rotations[k] │ │ │ +000cf380: 2061 6e64 0a74 7261 6e73 6c61 7469 6f6e and.translation │ │ │ +000cf390: 735b 6b5d 2069 7320 6120 6368 616e 6765 s[k] is a change │ │ │ +000cf3a0: 206f 6620 6261 7369 7320 6672 6f6d 2074 of basis from t │ │ │ +000cf3b0: 6865 2073 6f75 7263 6520 6361 6d65 7261 he source camera │ │ │ +000cf3c0: 2773 2063 6f6f 7264 696e 6174 6520 7379 's coordinate sy │ │ │ +000cf3d0: 7374 656d 2074 6f20 7468 6520 6465 7374 stem to the dest │ │ │ +000cf3e0: 696e 6174 696f 6e0a 6361 6d65 7261 2773 ination.camera's │ │ │ +000cf3f0: 2063 6f6f 7264 696e 6174 6520 7379 7374 coordinate syst │ │ │ +000cf400: 656d 2e20 486f 7765 7665 722c 2062 7920 em. However, by │ │ │ +000cf410: 6465 636f 6d70 6f73 696e 6720 482c 206f decomposing H, o │ │ │ +000cf420: 6e65 2063 616e 206f 6e6c 7920 6765 7420 ne can only get │ │ │ +000cf430: 7468 6520 7472 616e 736c 6174 696f 6e20 the translation │ │ │ +000cf440: 6e6f 726d 616c 697a 6564 0a62 7920 7468 normalized.by th │ │ │ +000cf450: 6520 2874 7970 6963 616c 6c79 2075 6e6b e (typically unk │ │ │ +000cf460: 6e6f 776e 2920 6465 7074 6820 6f66 2074 nown) depth of t │ │ │ +000cf470: 6865 2073 6365 6e65 2c20 692e 652e 2069 he scene, i.e. i │ │ │ +000cf480: 7473 2064 6972 6563 7469 6f6e 2062 7574 ts direction but │ │ │ +000cf490: 2077 6974 6820 6e6f 726d 616c 697a 6564 with normalized │ │ │ +000cf4a0: 206c 656e 6774 682e 0a0a 4966 2070 6f69 length...If poi │ │ │ +000cf4b0: 6e74 2063 6f72 7265 7370 6f6e 6465 6e63 nt correspondenc │ │ │ +000cf4c0: 6573 2061 7265 2061 7661 696c 6162 6c65 es are available │ │ │ +000cf4d0: 2c20 6174 206c 6561 7374 2074 776f 2073 , at least two s │ │ │ +000cf4e0: 6f6c 7574 696f 6e73 206d 6179 2066 7572 olutions may fur │ │ │ +000cf4f0: 7468 6572 2062 6520 696e 7661 6c69 6461 ther be invalida │ │ │ +000cf500: 7465 642c 2062 790a 6170 706c 7969 6e67 ted, by.applying │ │ │ +000cf510: 2070 6f73 6974 6976 6520 6465 7074 6820 positive depth │ │ │ +000cf520: 636f 6e73 7472 6169 6e74 2c20 692e 652e constraint, i.e. │ │ │ +000cf530: 2061 6c6c 2070 6f69 6e74 7320 6d75 7374 all points must │ │ │ +000cf540: 2062 6520 696e 2066 726f 6e74 206f 6620 be in front of │ │ │ +000cf550: 7468 6520 6361 6d65 7261 2e3c 2f64 643e the camera.
    │ │ │ +000cf560: 0a3c 6474 3e52 6574 7572 6e73 3a3c 2f64 .
    Returns:.
    automatic │ │ │ +000cf580: 616c 6c79 2067 656e 6572 6174 6564 3c2f ally generated.
    . │ │ │ +000cf5a0: 0a3c 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 .
    ..
  • .
    .

    filterHomograph │ │ │ +000cf680: 7944 6563 6f6d 7042 7956 6973 6962 6c65 yDecompByVisible │ │ │ +000cf690: 5265 6670 6f69 6e74 733c 2f68 333e 0a3c Refpoints

    .< │ │ │ +000cf6a0: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +000cf6b0: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +000cf6c0: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +000cf6d0: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +000cf700: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +000cf710: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +000cf720: 726e 2d74 7970 6522 3e76 6f69 643c 2f73 rn-type">void
     filterHomog │ │ │ +000cf760: 7261 7068 7944 6563 6f6d 7042 7956 6973 raphyDecompByVis │ │ │ +000cf770: 6962 6c65 5265 6670 6f69 6e74 733c 2f73 ibleRefpoints(List │ │ │ +000cf840: 3c2f 613e 266c 743b 3c61 2068 7265 663d <Mat>& │ │ │ +000cf890: 6e62 7370 3b72 6f74 6174 696f 6e73 2c0a nbsp;rotations,. │ │ │ +000cf8a0: 203c 6120 6872 6566 3d22 6874 7470 733a List<Mat>&nb │ │ │ +000cf990: 7370 3b6e 6f72 6d61 6c73 2c0a 203c 6120 sp;normals,. Mat │ │ │ +000cf9e0: 266e 6273 703b 6265 666f 7265 506f 696e  beforePoin │ │ │ +000cf9f0: 7473 2c0a 203c 6120 6872 6566 3d22 2e2e ts,. Mat af │ │ │ +000cfa40: 7465 7250 6f69 6e74 732c 0a20 3c61 2068 terPoints,. Mat& │ │ │ +000cfa90: 6e62 7370 3b70 6f73 7369 626c 6553 6f6c nbsp;possibleSol │ │ │ +000cfaa0: 7574 696f 6e73 2c0a 203c 6120 6872 6566 utions,. Mat&nbs │ │ │ +000cfaf0: 703b 706f 696e 7473 4d61 736b 293c 2f73 p;pointsMask).
    Fi │ │ │ +000cfb20: 6c74 6572 7320 686f 6d6f 6772 6170 6879 lters homography │ │ │ +000cfb30: 2064 6563 6f6d 706f 7369 7469 6f6e 7320 decompositions │ │ │ +000cfb40: 6261 7365 6420 6f6e 2061 6464 6974 696f based on additio │ │ │ +000cfb50: 6e61 6c20 696e 666f 726d 6174 696f 6e2e nal information. │ │ │ +000cfb60: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ +000cfb80: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ +000cfb90: 6464 3e3c 636f 6465 3e72 6f74 6174 696f dd>rotatio │ │ │ +000cfba0: 6e73 3c2f 636f 6465 3e20 2d20 5665 6374 ns - Vect │ │ │ +000cfbb0: 6f72 206f 6620 726f 7461 7469 6f6e 206d or of rotation m │ │ │ +000cfbc0: 6174 7269 6365 732e 3c2f 6464 3e0a 3c64 atrices..normals< │ │ │ +000cfbe0: 2f63 6f64 653e 202d 2056 6563 746f 7220 /code> - Vector │ │ │ +000cfbf0: 6f66 2070 6c61 6e65 206e 6f72 6d61 6c20 of plane normal │ │ │ +000cfc00: 6d61 7472 6963 6573 2e3c 2f64 643e 0a3c matrices..< │ │ │ +000cfc10: 6464 3e3c 636f 6465 3e62 6566 6f72 6550 dd>beforeP │ │ │ +000cfc20: 6f69 6e74 733c 2f63 6f64 653e 202d 2056 oints - V │ │ │ +000cfc30: 6563 746f 7220 6f66 2028 7265 6374 6966 ector of (rectif │ │ │ +000cfc40: 6965 6429 2076 6973 6962 6c65 2072 6566 ied) visible ref │ │ │ +000cfc50: 6572 656e 6365 2070 6f69 6e74 7320 6265 erence points be │ │ │ +000cfc60: 666f 7265 2074 6865 2068 6f6d 6f67 7261 fore the homogra │ │ │ +000cfc70: 7068 7920 6973 2061 7070 6c69 6564 3c2f phy is applied.
    af │ │ │ +000cfc90: 7465 7250 6f69 6e74 733c 2f63 6f64 653e terPoints │ │ │ +000cfca0: 202d 2056 6563 746f 7220 6f66 2028 7265 - Vector of (re │ │ │ +000cfcb0: 6374 6966 6965 6429 2076 6973 6962 6c65 ctified) visible │ │ │ +000cfcc0: 2072 6566 6572 656e 6365 2070 6f69 6e74 reference point │ │ │ +000cfcd0: 7320 6166 7465 7220 7468 6520 686f 6d6f s after the homo │ │ │ +000cfce0: 6772 6170 6879 2069 7320 6170 706c 6965 graphy is applie │ │ │ +000cfcf0: 643c 2f64 643e 0a3c 6464 3e3c 636f 6465 d
    .
    possibleSolutio │ │ │ +000cfd10: 6e73 3c2f 636f 6465 3e20 2d20 5665 6374 ns - Vect │ │ │ +000cfd20: 6f72 206f 6620 696e 7420 696e 6469 6365 or of int indice │ │ │ +000cfd30: 7320 7265 7072 6573 656e 7469 6e67 2074 s representing t │ │ │ +000cfd40: 6865 2076 6961 626c 6520 736f 6c75 7469 he viable soluti │ │ │ +000cfd50: 6f6e 2073 6574 2061 6674 6572 2066 696c on set after fil │ │ │ +000cfd60: 7465 7269 6e67 3c2f 6464 3e0a 3c64 643e tering
    .
    │ │ │ +000cfd70: 3c63 6f64 653e 706f 696e 7473 4d61 736b pointsMask │ │ │ +000cfd80: 3c2f 636f 6465 3e20 2d20 6f70 7469 6f6e - option │ │ │ +000cfd90: 616c 204d 6174 2f56 6563 746f 7220 6f66 al Mat/Vector of │ │ │ +000cfda0: 2043 565f 3855 2c20 4356 5f38 5320 6f72 CV_8U, CV_8S or │ │ │ +000cfdb0: 2043 565f 426f 6f6c 2074 7970 6520 7265 CV_Bool type re │ │ │ +000cfdc0: 7072 6573 656e 7469 6e67 2074 6865 206d presenting the m │ │ │ +000cfdd0: 6173 6b20 666f 7220 7468 6520 696e 6c69 ask for the inli │ │ │ +000cfde0: 6572 730a 6173 2067 6976 656e 2062 7920 ers.as given by │ │ │ +000cfdf0: 7468 6520 2366 696e 6448 6f6d 6f67 7261 the #findHomogra │ │ │ +000cfe00: 7068 7920 6675 6e63 7469 6f6e 0a0a 5468 phy function..Th │ │ │ +000cfe10: 6973 2066 756e 6374 696f 6e20 6973 2069 is function is i │ │ │ +000cfe20: 6e74 656e 6465 6420 746f 2066 696c 7465 ntended to filte │ │ │ +000cfe30: 7220 7468 6520 6f75 7470 7574 206f 6620 r the output of │ │ │ +000cfe40: 7468 6520 2364 6563 6f6d 706f 7365 486f the #decomposeHo │ │ │ +000cfe50: 6d6f 6772 6170 6879 4d61 7420 6261 7365 mographyMat base │ │ │ +000cfe60: 6420 6f6e 2061 6464 6974 696f 6e61 6c0a d on additional. │ │ │ +000cfe70: 696e 666f 726d 6174 696f 6e20 6173 2064 information as d │ │ │ +000cfe80: 6573 6372 6962 6564 2069 6e20 4349 5445 escribed in CITE │ │ │ +000cfe90: 3a20 4d61 6c69 7332 3030 3720 2e20 5468 : Malis2007 . Th │ │ │ +000cfea0: 6520 7375 6d6d 6172 7920 6f66 2074 6865 e summary of the │ │ │ +000cfeb0: 206d 6574 686f 643a 2074 6865 2023 6465 method: the #de │ │ │ +000cfec0: 636f 6d70 6f73 6548 6f6d 6f67 7261 7068 composeHomograph │ │ │ +000cfed0: 794d 6174 2066 756e 6374 696f 6e0a 7265 yMat function.re │ │ │ +000cfee0: 7475 726e 7320 3220 756e 6971 7565 2073 turns 2 unique s │ │ │ +000cfef0: 6f6c 7574 696f 6e73 2061 6e64 2074 6865 olutions and the │ │ │ +000cff00: 6972 2022 6f70 706f 7369 7465 7322 2066 ir "opposites" f │ │ │ +000cff10: 6f72 2061 2074 6f74 616c 206f 6620 3420 or a total of 4 │ │ │ +000cff20: 736f 6c75 7469 6f6e 732e 2049 6620 7765 solutions. If we │ │ │ +000cff30: 2068 6176 6520 6163 6365 7373 2074 6f20 have access to │ │ │ +000cff40: 7468 650a 7365 7473 206f 6620 706f 696e the.sets of poin │ │ │ +000cff50: 7473 2076 6973 6962 6c65 2069 6e20 7468 ts visible in th │ │ │ +000cff60: 6520 6361 6d65 7261 2066 7261 6d65 2062 e camera frame b │ │ │ +000cff70: 6566 6f72 6520 616e 6420 6166 7465 7220 efore and after │ │ │ +000cff80: 7468 6520 686f 6d6f 6772 6170 6879 2074 the homography t │ │ │ +000cff90: 7261 6e73 666f 726d 6174 696f 6e20 6973 ransformation is │ │ │ +000cffa0: 2061 7070 6c69 6564 2c0a 7765 2063 616e applied,.we can │ │ │ +000cffb0: 2064 6574 6572 6d69 6e65 2077 6869 6368 determine which │ │ │ +000cffc0: 2061 7265 2074 6865 2074 7275 6520 706f are the true po │ │ │ +000cffd0: 7465 6e74 6961 6c20 736f 6c75 7469 6f6e tential solution │ │ │ +000cffe0: 7320 616e 6420 7768 6963 6820 6172 6520 s and which are │ │ │ +000cfff0: 7468 6520 6f70 706f 7369 7465 7320 6279 the opposites by │ │ │ +000d0000: 2076 6572 6966 7969 6e67 2077 6869 6368 verifying which │ │ │ +000d0010: 0a68 6f6d 6f67 7261 7068 6965 7320 6172 .homographies ar │ │ │ +000d0020: 6520 636f 6e73 6973 7465 6e74 2077 6974 e consistent wit │ │ │ +000d0030: 6820 616c 6c20 7669 7369 626c 6520 7265 h all visible re │ │ │ +000d0040: 6665 7265 6e63 6520 706f 696e 7473 2062 ference points b │ │ │ +000d0050: 6569 6e67 2069 6e20 6672 6f6e 7420 6f66 eing in front of │ │ │ +000d0060: 2074 6865 2063 616d 6572 612e 2054 6865 the camera. The │ │ │ +000d0070: 2069 6e70 7574 730a 6172 6520 6c65 6674 inputs.are left │ │ │ +000d0080: 2075 6e63 6861 6e67 6564 3b20 7468 6520 unchanged; the │ │ │ +000d0090: 6669 6c74 6572 6564 2073 6f6c 7574 696f filtered solutio │ │ │ +000d00a0: 6e20 7365 7420 6973 2072 6574 7572 6e65 n set is returne │ │ │ +000d00b0: 6420 6173 2069 6e64 6963 6573 2069 6e74 d as indices int │ │ │ +000d00c0: 6f20 7468 6520 6578 6973 7469 6e67 206f o the existing o │ │ │ +000d00d0: 6e65 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c ne.
    .
    .< │ │ │ +000d00e0: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ +000d00f0: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..filterHomograp │ │ │ +000d01b0: 6879 4465 636f 6d70 4279 5669 7369 626c hyDecompByVisibl │ │ │ +000d01c0: 6552 6566 706f 696e 7473 3c2f 6833 3e0a eRefpoints. │ │ │ +000d01d0: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ +000d01f0: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ +000d0230: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ +000d0240: 3c73 7061 6e20 636c 6173 733d 2272 6574 void filterHomo │ │ │ +000d0290: 6772 6170 6879 4465 636f 6d70 4279 5669 graphyDecompByVi │ │ │ +000d02a0: 7369 626c 6552 6566 706f 696e 7473 3c2f sibleRefpoints(Lis │ │ │ +000d0370: 743c 2f61 3e26 6c74 3b3c 6120 6872 6566 t<Mat> │ │ │ +000d03c0: 266e 6273 703b 726f 7461 7469 6f6e 732c  rotations, │ │ │ +000d03d0: 0a20 3c61 2068 7265 663d 2268 7474 7073 . List< │ │ │ +000d0470: 2f61 3e26 6c74 3b3c 6120 6872 6566 3d22 /a><Mat>&n │ │ │ +000d04c0: 6273 703b 6e6f 726d 616c 732c 0a20 3c61 bsp;normals,. Mat beforePoi │ │ │ +000d0520: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. Mat a │ │ │ +000d0570: 6674 6572 506f 696e 7473 2c0a 203c 6120 fterPoints,. Mat │ │ │ +000d05c0: 266e 6273 703b 706f 7373 6962 6c65 536f  possibleSo │ │ │ +000d05d0: 6c75 7469 6f6e 7329 3c2f 7370 616e 3e3c lutions)< │ │ │ +000d05e0: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Filters │ │ │ +000d0600: 2068 6f6d 6f67 7261 7068 7920 6465 636f homography deco │ │ │ +000d0610: 6d70 6f73 6974 696f 6e73 2062 6173 6564 mpositions based │ │ │ +000d0620: 206f 6e20 6164 6469 7469 6f6e 616c 2069 on additional i │ │ │ +000d0630: 6e66 6f72 6d61 7469 6f6e 2e3c 2f64 6976 nformation.
    .
    .
    Paramet │ │ │ +000d0660: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    rotations - Vector of │ │ │ +000d0690: 2072 6f74 6174 696f 6e20 6d61 7472 6963 rotation matric │ │ │ +000d06a0: 6573 2e3c 2f64 643e 0a3c 6464 3e3c 636f es.
    .
    normals - Vector of pl │ │ │ +000d06d0: 616e 6520 6e6f 726d 616c 206d 6174 7269 ane normal matri │ │ │ +000d06e0: 6365 732e 3c2f 6464 3e0a 3c64 643e 3c63 ces.
    .
    beforePoints │ │ │ +000d0700: 3c2f 636f 6465 3e20 2d20 5665 6374 6f72 - Vector │ │ │ +000d0710: 206f 6620 2872 6563 7469 6669 6564 2920 of (rectified) │ │ │ +000d0720: 7669 7369 626c 6520 7265 6665 7265 6e63 visible referenc │ │ │ +000d0730: 6520 706f 696e 7473 2062 6566 6f72 6520 e points before │ │ │ +000d0740: 7468 6520 686f 6d6f 6772 6170 6879 2069 the homography i │ │ │ +000d0750: 7320 6170 706c 6965 643c 2f64 643e 0a3c s applied
    .< │ │ │ +000d0760: 6464 3e3c 636f 6465 3e61 6674 6572 506f dd>afterPo │ │ │ +000d0770: 696e 7473 3c2f 636f 6465 3e20 2d20 5665 ints - Ve │ │ │ +000d0780: 6374 6f72 206f 6620 2872 6563 7469 6669 ctor of (rectifi │ │ │ +000d0790: 6564 2920 7669 7369 626c 6520 7265 6665 ed) visible refe │ │ │ +000d07a0: 7265 6e63 6520 706f 696e 7473 2061 6674 rence points aft │ │ │ +000d07b0: 6572 2074 6865 2068 6f6d 6f67 7261 7068 er the homograph │ │ │ +000d07c0: 7920 6973 2061 7070 6c69 6564 3c2f 6464 y is applied.
    poss │ │ │ +000d07e0: 6962 6c65 536f 6c75 7469 6f6e 733c 2f63 ibleSolutions - Vector of │ │ │ +000d0800: 2069 6e74 2069 6e64 6963 6573 2072 6570 int indices rep │ │ │ +000d0810: 7265 7365 6e74 696e 6720 7468 6520 7669 resenting the vi │ │ │ +000d0820: 6162 6c65 2073 6f6c 7574 696f 6e20 7365 able solution se │ │ │ +000d0830: 7420 6166 7465 7220 6669 6c74 6572 696e t after filterin │ │ │ +000d0840: 670a 6173 2067 6976 656e 2062 7920 7468 g.as given by th │ │ │ +000d0850: 6520 2366 696e 6448 6f6d 6f67 7261 7068 e #findHomograph │ │ │ +000d0860: 7920 6675 6e63 7469 6f6e 0a0a 5468 6973 y function..This │ │ │ +000d0870: 2066 756e 6374 696f 6e20 6973 2069 6e74 function is int │ │ │ +000d0880: 656e 6465 6420 746f 2066 696c 7465 7220 ended to filter │ │ │ +000d0890: 7468 6520 6f75 7470 7574 206f 6620 7468 the output of th │ │ │ +000d08a0: 6520 2364 6563 6f6d 706f 7365 486f 6d6f e #decomposeHomo │ │ │ +000d08b0: 6772 6170 6879 4d61 7420 6261 7365 6420 graphyMat based │ │ │ +000d08c0: 6f6e 2061 6464 6974 696f 6e61 6c0a 696e on additional.in │ │ │ +000d08d0: 666f 726d 6174 696f 6e20 6173 2064 6573 formation as des │ │ │ +000d08e0: 6372 6962 6564 2069 6e20 4349 5445 3a20 cribed in CITE: │ │ │ +000d08f0: 4d61 6c69 7332 3030 3720 2e20 5468 6520 Malis2007 . The │ │ │ +000d0900: 7375 6d6d 6172 7920 6f66 2074 6865 206d summary of the m │ │ │ +000d0910: 6574 686f 643a 2074 6865 2023 6465 636f ethod: the #deco │ │ │ +000d0920: 6d70 6f73 6548 6f6d 6f67 7261 7068 794d mposeHomographyM │ │ │ +000d0930: 6174 2066 756e 6374 696f 6e0a 7265 7475 at function.retu │ │ │ +000d0940: 726e 7320 3220 756e 6971 7565 2073 6f6c rns 2 unique sol │ │ │ +000d0950: 7574 696f 6e73 2061 6e64 2074 6865 6972 utions and their │ │ │ +000d0960: 2022 6f70 706f 7369 7465 7322 2066 6f72 "opposites" for │ │ │ +000d0970: 2061 2074 6f74 616c 206f 6620 3420 736f a total of 4 so │ │ │ +000d0980: 6c75 7469 6f6e 732e 2049 6620 7765 2068 lutions. If we h │ │ │ +000d0990: 6176 6520 6163 6365 7373 2074 6f20 7468 ave access to th │ │ │ +000d09a0: 650a 7365 7473 206f 6620 706f 696e 7473 e.sets of points │ │ │ +000d09b0: 2076 6973 6962 6c65 2069 6e20 7468 6520 visible in the │ │ │ +000d09c0: 6361 6d65 7261 2066 7261 6d65 2062 6566 camera frame bef │ │ │ +000d09d0: 6f72 6520 616e 6420 6166 7465 7220 7468 ore and after th │ │ │ +000d09e0: 6520 686f 6d6f 6772 6170 6879 2074 7261 e homography tra │ │ │ +000d09f0: 6e73 666f 726d 6174 696f 6e20 6973 2061 nsformation is a │ │ │ +000d0a00: 7070 6c69 6564 2c0a 7765 2063 616e 2064 pplied,.we can d │ │ │ +000d0a10: 6574 6572 6d69 6e65 2077 6869 6368 2061 etermine which a │ │ │ +000d0a20: 7265 2074 6865 2074 7275 6520 706f 7465 re the true pote │ │ │ +000d0a30: 6e74 6961 6c20 736f 6c75 7469 6f6e 7320 ntial solutions │ │ │ +000d0a40: 616e 6420 7768 6963 6820 6172 6520 7468 and which are th │ │ │ +000d0a50: 6520 6f70 706f 7369 7465 7320 6279 2076 e opposites by v │ │ │ +000d0a60: 6572 6966 7969 6e67 2077 6869 6368 0a68 erifying which.h │ │ │ +000d0a70: 6f6d 6f67 7261 7068 6965 7320 6172 6520 omographies are │ │ │ +000d0a80: 636f 6e73 6973 7465 6e74 2077 6974 6820 consistent with │ │ │ +000d0a90: 616c 6c20 7669 7369 626c 6520 7265 6665 all visible refe │ │ │ +000d0aa0: 7265 6e63 6520 706f 696e 7473 2062 6569 rence points bei │ │ │ +000d0ab0: 6e67 2069 6e20 6672 6f6e 7420 6f66 2074 ng in front of t │ │ │ +000d0ac0: 6865 2063 616d 6572 612e 2054 6865 2069 he camera. The i │ │ │ +000d0ad0: 6e70 7574 730a 6172 6520 6c65 6674 2075 nputs.are left u │ │ │ +000d0ae0: 6e63 6861 6e67 6564 3b20 7468 6520 6669 nchanged; the fi │ │ │ +000d0af0: 6c74 6572 6564 2073 6f6c 7574 696f 6e20 ltered solution │ │ │ +000d0b00: 7365 7420 6973 2072 6574 7572 6e65 6420 set is returned │ │ │ +000d0b10: 6173 2069 6e64 6963 6573 2069 6e74 6f20 as indices into │ │ │ +000d0b20: 7468 6520 6578 6973 7469 6e67 206f 6e65 the existing one │ │ │ +000d0b30: 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 .
    .
    ...< │ │ │ +000d0b50: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    calibratio │ │ │ +000d0c10: 6e4d 6174 7269 7856 616c 7565 733c 2f68 nMatrixValues.
    .
    public │ │ │ +000d0c80: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +000d0c90: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;voi │ │ │ +000d0cb0: 643c 2f73 7061 6e3e 266e 6273 703b 3c73 d calibra │ │ │ +000d0ce0: 7469 6f6e 4d61 7472 6978 5661 6c75 6573 tionMatrixValues │ │ │ +000d0cf0: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat c │ │ │ +000d0d60: 616d 6572 614d 6174 7269 782c 0a20 3c61 ameraMatrix,. Size< │ │ │ +000d0db0: 2f61 3e26 6e62 7370 3b69 6d61 6765 5369 /a> imageSi │ │ │ +000d0dc0: 7a65 2c0a 2064 6f75 626c 6526 6e62 7370 ze,. double  │ │ │ +000d0dd0: 3b61 7065 7274 7572 6557 6964 7468 2c0a ;apertureWidth,. │ │ │ +000d0de0: 2064 6f75 626c 6526 6e62 7370 3b61 7065 double ape │ │ │ +000d0df0: 7274 7572 6548 6569 6768 742c 0a20 646f rtureHeight,. do │ │ │ +000d0e00: 7562 6c65 5b5d 266e 6273 703b 666f 7678 uble[] fovx │ │ │ +000d0e10: 2c0a 2064 6f75 626c 655b 5d26 6e62 7370 ,. double[]  │ │ │ +000d0e20: 3b66 6f76 792c 0a20 646f 7562 6c65 5b5d ;fovy,. double[] │ │ │ +000d0e30: 266e 6273 703b 666f 6361 6c4c 656e 6774  focalLengt │ │ │ +000d0e40: 682c 0a20 3c61 2068 7265 663d 222e 2e2f h,. Point  │ │ │ +000d0e90: 3b70 7269 6e63 6970 616c 506f 696e 742c ;principalPoint, │ │ │ +000d0ea0: 0a20 646f 7562 6c65 5b5d 266e 6273 703b . double[]  │ │ │ +000d0eb0: 6173 7065 6374 5261 7469 6f29 3c2f 7370 aspectRatio)
    .
    Com │ │ │ +000d0ee0: 7075 7465 7320 7573 6566 756c 2063 616d putes useful cam │ │ │ +000d0ef0: 6572 6120 6368 6172 6163 7465 7269 7374 era characterist │ │ │ +000d0f00: 6963 7320 6672 6f6d 2074 6865 2063 616d ics from the cam │ │ │ +000d0f10: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +000d0f20: 7472 6978 2e3c 2f64 6976 3e0a 3c64 6c20 trix.
    .
    .< │ │ │ +000d0f40: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    ca │ │ │ +000d0f60: 6d65 7261 4d61 7472 6978 3c2f 636f 6465 meraMatrix - Input camera │ │ │ +000d0f80: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ +000d0f90: 7820 7468 6174 2063 616e 2062 6520 6573 x that can be es │ │ │ +000d0fa0: 7469 6d61 7465 6420 6279 2023 6361 6c69 timated by #cali │ │ │ +000d0fb0: 6272 6174 6543 616d 6572 6120 6f72 0a23 brateCamera or.# │ │ │ +000d0fc0: 7374 6572 656f 4361 6c69 6272 6174 6520 stereoCalibrate │ │ │ +000d0fd0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    imageSize - Input image │ │ │ +000d1000: 7369 7a65 2069 6e20 7069 7865 6c73 2e3c size in pixels.< │ │ │ +000d1010: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e61 /dd>.
    a │ │ │ +000d1020: 7065 7274 7572 6557 6964 7468 3c2f 636f pertureWidth - Physical w │ │ │ +000d1040: 6964 7468 2069 6e20 6d6d 206f 6620 7468 idth in mm of th │ │ │ +000d1050: 6520 7365 6e73 6f72 2e3c 2f64 643e 0a3c e sensor.
    .< │ │ │ +000d1060: 6464 3e3c 636f 6465 3e61 7065 7274 7572 dd>apertur │ │ │ +000d1070: 6548 6569 6768 743c 2f63 6f64 653e 202d eHeight - │ │ │ +000d1080: 2050 6879 7369 6361 6c20 6865 6967 6874 Physical height │ │ │ +000d1090: 2069 6e20 6d6d 206f 6620 7468 6520 7365 in mm of the se │ │ │ +000d10a0: 6e73 6f72 2e3c 2f64 643e 0a3c 6464 3e3c nsor..
    < │ │ │ +000d10b0: 636f 6465 3e66 6f76 783c 2f63 6f64 653e code>fovx │ │ │ +000d10c0: 202d 204f 7574 7075 7420 6669 656c 6420 - Output field │ │ │ +000d10d0: 6f66 2076 6965 7720 696e 2064 6567 7265 of view in degre │ │ │ +000d10e0: 6573 2061 6c6f 6e67 2074 6865 2068 6f72 es along the hor │ │ │ +000d10f0: 697a 6f6e 7461 6c20 7365 6e73 6f72 2061 izontal sensor a │ │ │ +000d1100: 7869 732e 3c2f 6464 3e0a 3c64 643e 3c63 xis.
    .
    fovy │ │ │ +000d1120: 2d20 4f75 7470 7574 2066 6965 6c64 206f - Output field o │ │ │ +000d1130: 6620 7669 6577 2069 6e20 6465 6772 6565 f view in degree │ │ │ +000d1140: 7320 616c 6f6e 6720 7468 6520 7665 7274 s along the vert │ │ │ +000d1150: 6963 616c 2073 656e 736f 7220 6178 6973 ical sensor axis │ │ │ +000d1160: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    focalLength - Focal leng │ │ │ +000d1190: 7468 206f 6620 7468 6520 6c65 6e73 2069 th of the lens i │ │ │ +000d11a0: 6e20 6d6d 2e3c 2f64 643e 0a3c 6464 3e3c n mm.
    .
    < │ │ │ +000d11b0: 636f 6465 3e70 7269 6e63 6970 616c 506f code>principalPo │ │ │ +000d11c0: 696e 743c 2f63 6f64 653e 202d 2050 7269 int - Pri │ │ │ +000d11d0: 6e63 6970 616c 2070 6f69 6e74 2069 6e20 ncipal point in │ │ │ +000d11e0: 6d6d 2e3c 2f64 643e 0a3c 6464 3e3c 636f mm.
    .
    aspectRatio - \(f_y/f_ │ │ │ +000d1210: 785c 290a 0a54 6865 2066 756e 6374 696f x\)..The functio │ │ │ +000d1220: 6e20 636f 6d70 7574 6573 2076 6172 696f n computes vario │ │ │ +000d1230: 7573 2075 7365 6675 6c20 6361 6d65 7261 us useful camera │ │ │ +000d1240: 2063 6861 7261 6374 6572 6973 7469 6373 characteristics │ │ │ +000d1250: 2066 726f 6d20 7468 6520 7072 6576 696f from the previo │ │ │ +000d1260: 7573 6c79 2065 7374 696d 6174 6564 2063 usly estimated c │ │ │ +000d1270: 616d 6572 610a 6d61 7472 6978 2e0a 0a3c amera.matrix...< │ │ │ +000d1280: 623e 4e6f 7465 3a3c 2f62 3e0a 446f 206b b>Note:.Do k │ │ │ +000d1290: 6565 7020 696e 206d 696e 6420 7468 6174 eep in mind that │ │ │ +000d12a0: 2074 6865 2075 6e69 7479 206d 6561 7375 the unity measu │ │ │ +000d12b0: 7265 2027 6d6d 2720 7374 616e 6473 2066 re 'mm' stands f │ │ │ +000d12c0: 6f72 2077 6861 7465 7665 7220 756e 6974 or whatever unit │ │ │ +000d12d0: 206f 6620 6d65 6173 7572 6520 6f6e 6520 of measure one │ │ │ +000d12e0: 6368 6f6f 7365 7320 666f 720a 7468 6520 chooses for.the │ │ │ +000d12f0: 6368 6573 7362 6f61 7264 2070 6974 6368 chessboard pitch │ │ │ +000d1300: 2028 6974 2063 616e 2074 6875 7320 6265 (it can thus be │ │ │ +000d1310: 2061 6e79 2076 616c 7565 292e 3c2f 6464 any value).
    .
    .
    .< │ │ │ +000d1330: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.

  • . │ │ │ +000d1340: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .< │ │ │ +000d13b0: 6833 3e67 6574 4465 6661 756c 744e 6577 h3>getDefaultNew │ │ │ +000d13c0: 4361 6d65 7261 4d61 7472 6978 3c2f 6833 CameraMatrix.
    .
    │ │ │ +000d1410: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +000d1430: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +000d1440: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;Mat< │ │ │ +000d14a0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> getDefaul │ │ │ +000d14d0: 744e 6577 4361 6d65 7261 4d61 7472 6978 tNewCameraMatrix │ │ │ +000d14e0: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat c │ │ │ +000d1550: 616d 6572 614d 6174 7269 782c 0a20 3c61 ameraMatrix,. Size< │ │ │ +000d15a0: 2f61 3e26 6e62 7370 3b69 6d67 7369 7a65 /a> imgsize │ │ │ +000d15b0: 2c0a 2062 6f6f 6c65 616e 266e 6273 703b ,. boolean  │ │ │ +000d15c0: 6365 6e74 6572 5072 696e 6369 7061 6c50 centerPrincipalP │ │ │ +000d15d0: 6f69 6e74 293c 2f73 7061 6e3e 3c2f 6469 oint).
    Returns th │ │ │ +000d1600: 6520 6465 6661 756c 7420 6e65 7720 6361 e default new ca │ │ │ +000d1610: 6d65 7261 206d 6174 7269 782e 0a0a 5468 mera matrix...Th │ │ │ +000d1620: 6520 6675 6e63 7469 6f6e 2072 6574 7572 e function retur │ │ │ +000d1630: 6e73 2074 6865 2063 616d 6572 6120 6d61 ns the camera ma │ │ │ +000d1640: 7472 6978 2074 6861 7420 6973 2065 6974 trix that is eit │ │ │ +000d1650: 6865 7220 616e 2065 7861 6374 2063 6f70 her an exact cop │ │ │ +000d1660: 7920 6f66 2074 6865 2069 6e70 7574 2063 y of the input c │ │ │ +000d1670: 616d 6572 614d 6174 7269 7820 2877 6865 ameraMatrix (whe │ │ │ +000d1680: 6e0a 6365 6e74 6572 5072 696e 6963 6970 n.centerPrinicip │ │ │ +000d1690: 616c 506f 696e 743d 6661 6c73 6520 292c alPoint=false ), │ │ │ +000d16a0: 206f 7220 7468 6520 6d6f 6469 6669 6564 or the modified │ │ │ +000d16b0: 206f 6e65 2028 7768 656e 2063 656e 7465 one (when cente │ │ │ +000d16c0: 7250 7269 6e63 6970 616c 506f 696e 743d rPrincipalPoint= │ │ │ +000d16d0: 7472 7565 292e 0a0a 496e 2074 6865 206c true)...In the l │ │ │ +000d16e0: 6174 7465 7220 6361 7365 2c20 7468 6520 atter case, the │ │ │ +000d16f0: 6e65 7720 6361 6d65 7261 206d 6174 7269 new camera matri │ │ │ +000d1700: 7820 7769 6c6c 2062 653a 0a0a 5c28 5c62 x will be:..\(\b │ │ │ +000d1710: 6567 696e 7b62 6d61 7472 6978 7d20 665f egin{bmatrix} f_ │ │ │ +000d1720: 7820 2661 6d70 3b26 616d 703b 2030 2026 x && 0 & │ │ │ +000d1730: 616d 703b 2661 6d70 3b20 2820 5c74 6578 amp;& ( \tex │ │ │ +000d1740: 7474 747b 696d 6753 697a 652e 7769 6474 ttt{imgSize.widt │ │ │ +000d1750: 687d 202d 3129 2a30 2e35 2020 5c5c 2030 h} -1)*0.5 \\ 0 │ │ │ +000d1760: 2026 616d 703b 2661 6d70 3b20 665f 7920 && f_y │ │ │ +000d1770: 2661 6d70 3b26 616d 703b 2028 205c 7465 && ( \te │ │ │ +000d1780: 7874 7474 7b69 6d67 5369 7a65 2e68 6569 xttt{imgSize.hei │ │ │ +000d1790: 6768 747d 202d 3129 2a30 2e35 2020 5c5c ght} -1)*0.5 \\ │ │ │ +000d17a0: 2030 2026 616d 703b 2661 6d70 3b20 3020 0 && 0 │ │ │ +000d17b0: 2661 6d70 3b26 616d 703b 2031 205c 656e && 1 \en │ │ │ +000d17c0: 647b 626d 6174 7269 787d 202c 5c29 0a0a d{bmatrix} ,\).. │ │ │ +000d17d0: 7768 6572 6520 5c28 665f 785c 2920 616e where \(f_x\) an │ │ │ +000d17e0: 6420 5c28 665f 795c 2920 6172 6520 5c28 d \(f_y\) are \( │ │ │ +000d17f0: 2830 2c30 295c 2920 616e 6420 5c28 2831 (0,0)\) and \((1 │ │ │ +000d1800: 2c31 295c 2920 656c 656d 656e 7473 206f ,1)\) elements o │ │ │ +000d1810: 6620 6361 6d65 7261 4d61 7472 6978 2c20 f cameraMatrix, │ │ │ +000d1820: 7265 7370 6563 7469 7665 6c79 2e0a 0a42 respectively...B │ │ │ +000d1830: 7920 6465 6661 756c 742c 2074 6865 2075 y default, the u │ │ │ +000d1840: 6e64 6973 746f 7274 696f 6e20 6675 6e63 ndistortion func │ │ │ +000d1850: 7469 6f6e 7320 696e 204f 7065 6e43 5620 tions in OpenCV │ │ │ +000d1860: 2873 6565 2023 696e 6974 556e 6469 7374 (see #initUndist │ │ │ +000d1870: 6f72 7452 6563 7469 6679 4d61 702c 2023 ortRectifyMap, # │ │ │ +000d1880: 756e 6469 7374 6f72 7429 2064 6f20 6e6f undistort) do no │ │ │ +000d1890: 740a 6d6f 7665 2074 6865 2070 7269 6e63 t.move the princ │ │ │ +000d18a0: 6970 616c 2070 6f69 6e74 2e20 486f 7765 ipal point. Howe │ │ │ +000d18b0: 7665 722c 2077 6865 6e20 796f 7520 776f ver, when you wo │ │ │ +000d18c0: 726b 2077 6974 6820 7374 6572 656f 2c20 rk with stereo, │ │ │ +000d18d0: 6974 2069 7320 696d 706f 7274 616e 7420 it is important │ │ │ +000d18e0: 746f 206d 6f76 6520 7468 6520 7072 696e to move the prin │ │ │ +000d18f0: 6369 7061 6c0a 706f 696e 7473 2069 6e20 cipal.points in │ │ │ +000d1900: 626f 7468 2076 6965 7773 2074 6f20 7468 both views to th │ │ │ +000d1910: 6520 7361 6d65 2079 2d63 6f6f 7264 696e e same y-coordin │ │ │ +000d1920: 6174 6520 2877 6869 6368 2069 7320 7265 ate (which is re │ │ │ +000d1930: 7175 6972 6564 2062 7920 6d6f 7374 206f quired by most o │ │ │ +000d1940: 6620 7374 6572 656f 2063 6f72 7265 7370 f stereo corresp │ │ │ +000d1950: 6f6e 6465 6e63 650a 616c 676f 7269 7468 ondence.algorith │ │ │ +000d1960: 6d73 292c 2061 6e64 206d 6179 2062 6520 ms), and may be │ │ │ +000d1970: 746f 2074 6865 2073 616d 6520 782d 636f to the same x-co │ │ │ +000d1980: 6f72 6469 6e61 7465 2074 6f6f 2e20 536f ordinate too. So │ │ │ +000d1990: 2c20 796f 7520 6361 6e20 666f 726d 2074 , you can form t │ │ │ +000d19a0: 6865 206e 6577 2063 616d 6572 6120 6d61 he new camera ma │ │ │ +000d19b0: 7472 6978 2066 6f72 0a65 6163 6820 7669 trix for.each vi │ │ │ +000d19c0: 6577 2077 6865 7265 2074 6865 2070 7269 ew where the pri │ │ │ +000d19d0: 6e63 6970 616c 2070 6f69 6e74 7320 6172 ncipal points ar │ │ │ +000d19e0: 6520 6c6f 6361 7465 6420 6174 2074 6865 e located at the │ │ │ +000d19f0: 2063 656e 7465 722e 3c2f 6469 763e 0a3c center.
    .< │ │ │ +000d1a00: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ +000d1a10: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ +000d1a20: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    cameraMatrix - Input cam │ │ │ +000d1a50: 6572 6120 6d61 7472 6978 2e3c 2f64 643e era matrix.
    │ │ │ +000d1a60: 0a3c 6464 3e3c 636f 6465 3e69 6d67 7369 .
    imgsi │ │ │ +000d1a70: 7a65 3c2f 636f 6465 3e20 2d20 4361 6d65 ze - Came │ │ │ +000d1a80: 7261 2076 6965 7720 696d 6167 6520 7369 ra view image si │ │ │ +000d1a90: 7a65 2069 6e20 7069 7865 6c73 2e3c 2f64 ze in pixels..
    cen │ │ │ +000d1ab0: 7465 7250 7269 6e63 6970 616c 506f 696e terPrincipalPoin │ │ │ +000d1ac0: 743c 2f63 6f64 653e 202d 204c 6f63 6174 t - Locat │ │ │ +000d1ad0: 696f 6e20 6f66 2074 6865 2070 7269 6e63 ion of the princ │ │ │ +000d1ae0: 6970 616c 2070 6f69 6e74 2069 6e20 7468 ipal point in th │ │ │ +000d1af0: 6520 6e65 7720 6361 6d65 7261 206d 6174 e new camera mat │ │ │ +000d1b00: 7269 782e 2054 6865 0a70 6172 616d 6574 rix. The.paramet │ │ │ +000d1b10: 6572 2069 6e64 6963 6174 6573 2077 6865 er indicates whe │ │ │ +000d1b20: 7468 6572 2074 6869 7320 6c6f 6361 7469 ther this locati │ │ │ +000d1b30: 6f6e 2073 686f 756c 6420 6265 2061 7420 on should be at │ │ │ +000d1b40: 7468 6520 696d 6167 6520 6365 6e74 6572 the image center │ │ │ +000d1b50: 206f 7220 6e6f 742e 3c2f 6464 3e0a 3c64 or not.
    .Returns:. │ │ │ +000d1b70: 3c64 643e 6175 746f 6d61 7469 6361 6c6c
    automaticall │ │ │ +000d1b80: 7920 6765 6e65 7261 7465 643c 2f64 643e y generated
    │ │ │ +000d1b90: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f ..
    ..
  • .< │ │ │ +000d1bb0: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .

    getDef │ │ │ +000d1c20: 6175 6c74 4e65 7743 616d 6572 614d 6174 aultNewCameraMat │ │ │ +000d1c30: 7269 783c 2f68 333e 0a3c 6469 7620 636c rix

    .
    .
    p │ │ │ +000d1c90: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static M │ │ │ +000d1d00: 6174 3c2f 613e 3c2f 7370 616e 3e26 6e62 at&nb │ │ │ +000d1d10: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;ge │ │ │ +000d1d30: 7444 6566 6175 6c74 4e65 7743 616d 6572 tDefaultNewCamer │ │ │ +000d1d40: 614d 6174 7269 783c 2f73 7061 6e3e 3c77 aMatrix(Mat │ │ │ +000d1db0: 266e 6273 703b 6361 6d65 7261 4d61 7472  cameraMatr │ │ │ +000d1dc0: 6978 2c0a 203c 6120 6872 6566 3d22 2e2e ix,. Size  │ │ │ +000d1e10: 696d 6773 697a 6529 3c2f 7370 616e 3e3c imgsize)< │ │ │ +000d1e20: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Returns │ │ │ +000d1e40: 2074 6865 2064 6566 6175 6c74 206e 6577 the default new │ │ │ +000d1e50: 2063 616d 6572 6120 6d61 7472 6978 2e0a camera matrix.. │ │ │ +000d1e60: 0a54 6865 2066 756e 6374 696f 6e20 7265 .The function re │ │ │ +000d1e70: 7475 726e 7320 7468 6520 6361 6d65 7261 turns the camera │ │ │ +000d1e80: 206d 6174 7269 7820 7468 6174 2069 7320 matrix that is │ │ │ +000d1e90: 6569 7468 6572 2061 6e20 6578 6163 7420 either an exact │ │ │ +000d1ea0: 636f 7079 206f 6620 7468 6520 696e 7075 copy of the inpu │ │ │ +000d1eb0: 7420 6361 6d65 7261 4d61 7472 6978 2028 t cameraMatrix ( │ │ │ +000d1ec0: 7768 656e 0a63 656e 7465 7250 7269 6e69 when.centerPrini │ │ │ +000d1ed0: 6369 7061 6c50 6f69 6e74 3d66 616c 7365 cipalPoint=false │ │ │ +000d1ee0: 2029 2c20 6f72 2074 6865 206d 6f64 6966 ), or the modif │ │ │ +000d1ef0: 6965 6420 6f6e 6520 2877 6865 6e20 6365 ied one (when ce │ │ │ +000d1f00: 6e74 6572 5072 696e 6369 7061 6c50 6f69 nterPrincipalPoi │ │ │ +000d1f10: 6e74 3d74 7275 6529 2e0a 0a49 6e20 7468 nt=true)...In th │ │ │ +000d1f20: 6520 6c61 7474 6572 2063 6173 652c 2074 e latter case, t │ │ │ +000d1f30: 6865 206e 6577 2063 616d 6572 6120 6d61 he new camera ma │ │ │ +000d1f40: 7472 6978 2077 696c 6c20 6265 3a0a 0a5c trix will be:..\ │ │ │ +000d1f50: 285c 6265 6769 6e7b 626d 6174 7269 787d (\begin{bmatrix} │ │ │ +000d1f60: 2066 5f78 2026 616d 703b 2661 6d70 3b20 f_x && │ │ │ +000d1f70: 3020 2661 6d70 3b26 616d 703b 2028 205c 0 && ( \ │ │ │ +000d1f80: 7465 7874 7474 7b69 6d67 5369 7a65 2e77 texttt{imgSize.w │ │ │ +000d1f90: 6964 7468 7d20 2d31 292a 302e 3520 205c idth} -1)*0.5 \ │ │ │ +000d1fa0: 5c20 3020 2661 6d70 3b26 616d 703b 2066 \ 0 && f │ │ │ +000d1fb0: 5f79 2026 616d 703b 2661 6d70 3b20 2820 _y && ( │ │ │ +000d1fc0: 5c74 6578 7474 747b 696d 6753 697a 652e \texttt{imgSize. │ │ │ +000d1fd0: 6865 6967 6874 7d20 2d31 292a 302e 3520 height} -1)*0.5 │ │ │ +000d1fe0: 205c 5c20 3020 2661 6d70 3b26 616d 703b \\ 0 && │ │ │ +000d1ff0: 2030 2026 616d 703b 2661 6d70 3b20 3120 0 && 1 │ │ │ +000d2000: 5c65 6e64 7b62 6d61 7472 6978 7d20 2c5c \end{bmatrix} ,\ │ │ │ +000d2010: 290a 0a77 6865 7265 205c 2866 5f78 5c29 )..where \(f_x\) │ │ │ +000d2020: 2061 6e64 205c 2866 5f79 5c29 2061 7265 and \(f_y\) are │ │ │ +000d2030: 205c 2828 302c 3029 5c29 2061 6e64 205c \((0,0)\) and \ │ │ │ +000d2040: 2828 312c 3129 5c29 2065 6c65 6d65 6e74 ((1,1)\) element │ │ │ +000d2050: 7320 6f66 2063 616d 6572 614d 6174 7269 s of cameraMatri │ │ │ +000d2060: 782c 2072 6573 7065 6374 6976 656c 792e x, respectively. │ │ │ +000d2070: 0a0a 4279 2064 6566 6175 6c74 2c20 7468 ..By default, th │ │ │ +000d2080: 6520 756e 6469 7374 6f72 7469 6f6e 2066 e undistortion f │ │ │ +000d2090: 756e 6374 696f 6e73 2069 6e20 4f70 656e unctions in Open │ │ │ +000d20a0: 4356 2028 7365 6520 2369 6e69 7455 6e64 CV (see #initUnd │ │ │ +000d20b0: 6973 746f 7274 5265 6374 6966 794d 6170 istortRectifyMap │ │ │ +000d20c0: 2c20 2375 6e64 6973 746f 7274 2920 646f , #undistort) do │ │ │ +000d20d0: 206e 6f74 0a6d 6f76 6520 7468 6520 7072 not.move the pr │ │ │ +000d20e0: 696e 6369 7061 6c20 706f 696e 742e 2048 incipal point. H │ │ │ +000d20f0: 6f77 6576 6572 2c20 7768 656e 2079 6f75 owever, when you │ │ │ +000d2100: 2077 6f72 6b20 7769 7468 2073 7465 7265 work with stere │ │ │ +000d2110: 6f2c 2069 7420 6973 2069 6d70 6f72 7461 o, it is importa │ │ │ +000d2120: 6e74 2074 6f20 6d6f 7665 2074 6865 2070 nt to move the p │ │ │ +000d2130: 7269 6e63 6970 616c 0a70 6f69 6e74 7320 rincipal.points │ │ │ +000d2140: 696e 2062 6f74 6820 7669 6577 7320 746f in both views to │ │ │ +000d2150: 2074 6865 2073 616d 6520 792d 636f 6f72 the same y-coor │ │ │ +000d2160: 6469 6e61 7465 2028 7768 6963 6820 6973 dinate (which is │ │ │ +000d2170: 2072 6571 7569 7265 6420 6279 206d 6f73 required by mos │ │ │ +000d2180: 7420 6f66 2073 7465 7265 6f20 636f 7272 t of stereo corr │ │ │ +000d2190: 6573 706f 6e64 656e 6365 0a61 6c67 6f72 espondence.algor │ │ │ +000d21a0: 6974 686d 7329 2c20 616e 6420 6d61 7920 ithms), and may │ │ │ +000d21b0: 6265 2074 6f20 7468 6520 7361 6d65 2078 be to the same x │ │ │ +000d21c0: 2d63 6f6f 7264 696e 6174 6520 746f 6f2e -coordinate too. │ │ │ +000d21d0: 2053 6f2c 2079 6f75 2063 616e 2066 6f72 So, you can for │ │ │ +000d21e0: 6d20 7468 6520 6e65 7720 6361 6d65 7261 m the new camera │ │ │ +000d21f0: 206d 6174 7269 7820 666f 720a 6561 6368 matrix for.each │ │ │ +000d2200: 2076 6965 7720 7768 6572 6520 7468 6520 view where the │ │ │ +000d2210: 7072 696e 6369 7061 6c20 706f 696e 7473 principal points │ │ │ +000d2220: 2061 7265 206c 6f63 6174 6564 2061 7420 are located at │ │ │ +000d2230: 7468 6520 6365 6e74 6572 2e3c 2f64 6976 the center.
    .
    .
    Paramet │ │ │ +000d2260: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    cameraMatrix │ │ │ +000d2280: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ +000d2290: 6361 6d65 7261 206d 6174 7269 782e 3c2f camera matrix..
    im │ │ │ +000d22b0: 6773 697a 653c 2f63 6f64 653e 202d 2043 gsize - C │ │ │ +000d22c0: 616d 6572 6120 7669 6577 2069 6d61 6765 amera view image │ │ │ +000d22d0: 2073 697a 6520 696e 2070 6978 656c 732e size in pixels. │ │ │ +000d22e0: 0a70 6172 616d 6574 6572 2069 6e64 6963 .parameter indic │ │ │ +000d22f0: 6174 6573 2077 6865 7468 6572 2074 6869 ates whether thi │ │ │ +000d2300: 7320 6c6f 6361 7469 6f6e 2073 686f 756c s location shoul │ │ │ +000d2310: 6420 6265 2061 7420 7468 6520 696d 6167 d be at the imag │ │ │ +000d2320: 6520 6365 6e74 6572 206f 7220 6e6f 742e e center or not. │ │ │ +000d2330: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e
    .
    Return │ │ │ +000d2340: 733a 3c2f 6474 3e0a 3c64 643e 6175 746f s:
    .
    auto │ │ │ +000d2350: 6d61 7469 6361 6c6c 7920 6765 6e65 7261 matically genera │ │ │ +000d2360: 7465 643c 2f64 643e 0a3c 2f64 6c3e 0a3c ted
    .
    .< │ │ │ +000d2370: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.
    │ │ │ +000d2380: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 ..
  • ..

    get │ │ │ +000d23e0: 4465 6661 756c 744e 6577 4361 6d65 7261 DefaultNewCamera │ │ │ +000d23f0: 4d61 7472 6978 3c2f 6833 3e0a 3c64 6976 Matrix

    .
    .
    public static< │ │ │ +000d2460: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> Mat │ │ │ +000d24d0: 266e 6273 703b 3c73 7061 6e20 636c 6173  getDefaultNewCa │ │ │ +000d2500: 6d65 7261 4d61 7472 6978 3c2f 7370 616e meraMatrix( │ │ │ +000d2530: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000d2570: 2f61 3e26 6e62 7370 3b63 616d 6572 614d /a> cameraM │ │ │ +000d2580: 6174 7269 7829 3c2f 7370 616e 3e3c 2f64 atrix).
    Returns t │ │ │ +000d25b0: 6865 2064 6566 6175 6c74 206e 6577 2063 he default new c │ │ │ +000d25c0: 616d 6572 6120 6d61 7472 6978 2e0a 0a54 amera matrix...T │ │ │ +000d25d0: 6865 2066 756e 6374 696f 6e20 7265 7475 he function retu │ │ │ +000d25e0: 726e 7320 7468 6520 6361 6d65 7261 206d rns the camera m │ │ │ +000d25f0: 6174 7269 7820 7468 6174 2069 7320 6569 atrix that is ei │ │ │ +000d2600: 7468 6572 2061 6e20 6578 6163 7420 636f ther an exact co │ │ │ +000d2610: 7079 206f 6620 7468 6520 696e 7075 7420 py of the input │ │ │ +000d2620: 6361 6d65 7261 4d61 7472 6978 2028 7768 cameraMatrix (wh │ │ │ +000d2630: 656e 0a63 656e 7465 7250 7269 6e69 6369 en.centerPrinici │ │ │ +000d2640: 7061 6c50 6f69 6e74 3d66 616c 7365 2029 palPoint=false ) │ │ │ +000d2650: 2c20 6f72 2074 6865 206d 6f64 6966 6965 , or the modifie │ │ │ +000d2660: 6420 6f6e 6520 2877 6865 6e20 6365 6e74 d one (when cent │ │ │ +000d2670: 6572 5072 696e 6369 7061 6c50 6f69 6e74 erPrincipalPoint │ │ │ +000d2680: 3d74 7275 6529 2e0a 0a49 6e20 7468 6520 =true)...In the │ │ │ +000d2690: 6c61 7474 6572 2063 6173 652c 2074 6865 latter case, the │ │ │ +000d26a0: 206e 6577 2063 616d 6572 6120 6d61 7472 new camera matr │ │ │ +000d26b0: 6978 2077 696c 6c20 6265 3a0a 0a5c 285c ix will be:..\(\ │ │ │ +000d26c0: 6265 6769 6e7b 626d 6174 7269 787d 2066 begin{bmatrix} f │ │ │ +000d26d0: 5f78 2026 616d 703b 2661 6d70 3b20 3020 _x && 0 │ │ │ +000d26e0: 2661 6d70 3b26 616d 703b 2028 205c 7465 && ( \te │ │ │ +000d26f0: 7874 7474 7b69 6d67 5369 7a65 2e77 6964 xttt{imgSize.wid │ │ │ +000d2700: 7468 7d20 2d31 292a 302e 3520 205c 5c20 th} -1)*0.5 \\ │ │ │ +000d2710: 3020 2661 6d70 3b26 616d 703b 2066 5f79 0 && f_y │ │ │ +000d2720: 2026 616d 703b 2661 6d70 3b20 2820 5c74 && ( \t │ │ │ +000d2730: 6578 7474 747b 696d 6753 697a 652e 6865 exttt{imgSize.he │ │ │ +000d2740: 6967 6874 7d20 2d31 292a 302e 3520 205c ight} -1)*0.5 \ │ │ │ +000d2750: 5c20 3020 2661 6d70 3b26 616d 703b 2030 \ 0 && 0 │ │ │ +000d2760: 2026 616d 703b 2661 6d70 3b20 3120 5c65 && 1 \e │ │ │ +000d2770: 6e64 7b62 6d61 7472 6978 7d20 2c5c 290a nd{bmatrix} ,\). │ │ │ +000d2780: 0a77 6865 7265 205c 2866 5f78 5c29 2061 .where \(f_x\) a │ │ │ +000d2790: 6e64 205c 2866 5f79 5c29 2061 7265 205c nd \(f_y\) are \ │ │ │ +000d27a0: 2828 302c 3029 5c29 2061 6e64 205c 2828 ((0,0)\) and \(( │ │ │ +000d27b0: 312c 3129 5c29 2065 6c65 6d65 6e74 7320 1,1)\) elements │ │ │ +000d27c0: 6f66 2063 616d 6572 614d 6174 7269 782c of cameraMatrix, │ │ │ +000d27d0: 2072 6573 7065 6374 6976 656c 792e 0a0a respectively... │ │ │ +000d27e0: 4279 2064 6566 6175 6c74 2c20 7468 6520 By default, the │ │ │ +000d27f0: 756e 6469 7374 6f72 7469 6f6e 2066 756e undistortion fun │ │ │ +000d2800: 6374 696f 6e73 2069 6e20 4f70 656e 4356 ctions in OpenCV │ │ │ +000d2810: 2028 7365 6520 2369 6e69 7455 6e64 6973 (see #initUndis │ │ │ +000d2820: 746f 7274 5265 6374 6966 794d 6170 2c20 tortRectifyMap, │ │ │ +000d2830: 2375 6e64 6973 746f 7274 2920 646f 206e #undistort) do n │ │ │ +000d2840: 6f74 0a6d 6f76 6520 7468 6520 7072 696e ot.move the prin │ │ │ +000d2850: 6369 7061 6c20 706f 696e 742e 2048 6f77 cipal point. How │ │ │ +000d2860: 6576 6572 2c20 7768 656e 2079 6f75 2077 ever, when you w │ │ │ +000d2870: 6f72 6b20 7769 7468 2073 7465 7265 6f2c ork with stereo, │ │ │ +000d2880: 2069 7420 6973 2069 6d70 6f72 7461 6e74 it is important │ │ │ +000d2890: 2074 6f20 6d6f 7665 2074 6865 2070 7269 to move the pri │ │ │ +000d28a0: 6e63 6970 616c 0a70 6f69 6e74 7320 696e ncipal.points in │ │ │ +000d28b0: 2062 6f74 6820 7669 6577 7320 746f 2074 both views to t │ │ │ +000d28c0: 6865 2073 616d 6520 792d 636f 6f72 6469 he same y-coordi │ │ │ +000d28d0: 6e61 7465 2028 7768 6963 6820 6973 2072 nate (which is r │ │ │ +000d28e0: 6571 7569 7265 6420 6279 206d 6f73 7420 equired by most │ │ │ +000d28f0: 6f66 2073 7465 7265 6f20 636f 7272 6573 of stereo corres │ │ │ +000d2900: 706f 6e64 656e 6365 0a61 6c67 6f72 6974 pondence.algorit │ │ │ +000d2910: 686d 7329 2c20 616e 6420 6d61 7920 6265 hms), and may be │ │ │ +000d2920: 2074 6f20 7468 6520 7361 6d65 2078 2d63 to the same x-c │ │ │ +000d2930: 6f6f 7264 696e 6174 6520 746f 6f2e 2053 oordinate too. S │ │ │ +000d2940: 6f2c 2079 6f75 2063 616e 2066 6f72 6d20 o, you can form │ │ │ +000d2950: 7468 6520 6e65 7720 6361 6d65 7261 206d the new camera m │ │ │ +000d2960: 6174 7269 7820 666f 720a 6561 6368 2076 atrix for.each v │ │ │ +000d2970: 6965 7720 7768 6572 6520 7468 6520 7072 iew where the pr │ │ │ +000d2980: 696e 6369 7061 6c20 706f 696e 7473 2061 incipal points a │ │ │ +000d2990: 7265 206c 6f63 6174 6564 2061 7420 7468 re located at th │ │ │ +000d29a0: 6520 6365 6e74 6572 2e3c 2f64 6976 3e0a e center.
    . │ │ │ +000d29b0: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ +000d29d0: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    cameraMatrix - Input ca │ │ │ +000d2a00: 6d65 7261 206d 6174 7269 782e 0a70 6172 mera matrix..par │ │ │ +000d2a10: 616d 6574 6572 2069 6e64 6963 6174 6573 ameter indicates │ │ │ +000d2a20: 2077 6865 7468 6572 2074 6869 7320 6c6f whether this lo │ │ │ +000d2a30: 6361 7469 6f6e 2073 686f 756c 6420 6265 cation should be │ │ │ +000d2a40: 2061 7420 7468 6520 696d 6167 6520 6365 at the image ce │ │ │ +000d2a50: 6e74 6572 206f 7220 6e6f 742e 3c2f 6464 nter or not.
    .
    Returns:.
    automati │ │ │ +000d2a80: 6361 6c6c 7920 6765 6e65 7261 7465 643c cally generated< │ │ │ +000d2a90: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    ...
  • .
    .

    getOp │ │ │ +000d2b70: 7469 6d61 6c4e 6577 4361 6d65 7261 4d61 timalNewCameraMa │ │ │ +000d2b80: 7472 6978 3c2f 6833 3e0a 3c64 6976 2063 trix

    .
    .
    │ │ │ +000d2be0: 7075 626c 6963 2073 7461 7469 633c 2f73 public static  │ │ │ +000d2c50: 4d61 743c 2f61 3e3c 2f73 7061 6e3e 266e Mat&n │ │ │ +000d2c60: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;g │ │ │ +000d2c80: 6574 4f70 7469 6d61 6c4e 6577 4361 6d65 etOptimalNewCame │ │ │ +000d2c90: 7261 4d61 7472 6978 3c2f 7370 616e 3e3c raMatrix< │ │ │ +000d2ca0: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat cameraMat │ │ │ +000d2d10: 7269 782c 0a20 3c61 2068 7265 663d 222e rix,. Mat d │ │ │ +000d2d60: 6973 7443 6f65 6666 732c 0a20 3c61 2068 istCoeffs,. Size imageSize │ │ │ +000d2dc0: 2c0a 2064 6f75 626c 6526 6e62 7370 3b61 ,. double a │ │ │ +000d2dd0: 6c70 6861 2c0a 203c 6120 6872 6566 3d22 lpha,. Size&nbs │ │ │ +000d2e20: 703b 6e65 7749 6d67 5369 7a65 2c0a 203c p;newImgSize,. < │ │ │ +000d2e30: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000d2e40: 5265 6374 2e68 746d 6c22 2074 6974 6c65 Rect.html" title │ │ │ +000d2e50: 3d22 636c 6173 7320 696e 206f 7267 2e6f ="class in org.o │ │ │ +000d2e60: 7065 6e63 762e 636f 7265 223e 5265 6374 pencv.core">Rect │ │ │ +000d2e70: 3c2f 613e 266e 6273 703b 7661 6c69 6450  validP │ │ │ +000d2e80: 6978 524f 492c 0a20 626f 6f6c 6561 6e26 ixROI,. boolean& │ │ │ +000d2e90: 6e62 7370 3b63 656e 7465 7250 7269 6e63 nbsp;centerPrinc │ │ │ +000d2ea0: 6970 616c 506f 696e 7429 3c2f 7370 616e ipalPoint)
    .
    Retur │ │ │ +000d2ed0: 6e73 2074 6865 206e 6577 2063 616d 6572 ns the new camer │ │ │ +000d2ee0: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ +000d2ef0: 6978 2062 6173 6564 206f 6e20 7468 6520 ix based on the │ │ │ +000d2f00: 6672 6565 2073 6361 6c69 6e67 2070 6172 free scaling par │ │ │ +000d2f10: 616d 6574 6572 2e3c 2f64 6976 3e0a 3c64 ameter.
    . │ │ │ +000d2f30: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +000d2f40: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000d2f50: 6361 6d65 7261 4d61 7472 6978 3c2f 636f cameraMatrix - Input came │ │ │ +000d2f70: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ +000d2f80: 7269 782e 3c2f 6464 3e0a 3c64 643e 3c63 rix.
    .
    distCoeffs - Input ve │ │ │ +000d2fb0: 6374 6f72 206f 6620 6469 7374 6f72 7469 ctor of distorti │ │ │ +000d2fc0: 6f6e 2063 6f65 6666 6963 6965 6e74 730a on coefficients. │ │ │ +000d2fd0: 5c28 5c64 6973 7463 6f65 6666 735c 292e \(\distcoeffs\). │ │ │ +000d2fe0: 2049 6620 7468 6520 7665 6374 6f72 2069 If the vector i │ │ │ +000d2ff0: 7320 4e55 4c4c 2f65 6d70 7479 2c20 7468 s NULL/empty, th │ │ │ +000d3000: 6520 7a65 726f 2064 6973 746f 7274 696f e zero distortio │ │ │ +000d3010: 6e20 636f 6566 6669 6369 656e 7473 2061 n coefficients a │ │ │ +000d3020: 7265 0a61 7373 756d 6564 2e3c 2f64 643e re.assumed.
    │ │ │ +000d3030: 0a3c 6464 3e3c 636f 6465 3e69 6d61 6765 .
    image │ │ │ +000d3040: 5369 7a65 3c2f 636f 6465 3e20 2d20 4f72 Size - Or │ │ │ +000d3050: 6967 696e 616c 2069 6d61 6765 2073 697a iginal image siz │ │ │ +000d3060: 652e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 e.
    .
    alpha - │ │ │ +000d3080: 2046 7265 6520 7363 616c 696e 6720 7061 Free scaling pa │ │ │ +000d3090: 7261 6d65 7465 7220 6265 7477 6565 6e20 rameter between │ │ │ +000d30a0: 3020 2877 6865 6e20 616c 6c20 7468 6520 0 (when all the │ │ │ +000d30b0: 7069 7865 6c73 2069 6e20 7468 6520 756e pixels in the un │ │ │ +000d30c0: 6469 7374 6f72 7465 6420 696d 6167 6520 distorted image │ │ │ +000d30d0: 6172 650a 7661 6c69 6429 2061 6e64 2031 are.valid) and 1 │ │ │ +000d30e0: 2028 7768 656e 2061 6c6c 2074 6865 2073 (when all the s │ │ │ +000d30f0: 6f75 7263 6520 696d 6167 6520 7069 7865 ource image pixe │ │ │ +000d3100: 6c73 2061 7265 2072 6574 6169 6e65 6420 ls are retained │ │ │ +000d3110: 696e 2074 6865 2075 6e64 6973 746f 7274 in the undistort │ │ │ +000d3120: 6564 2069 6d61 6765 292e 2053 6565 0a23 ed image). See.# │ │ │ +000d3130: 7374 6572 656f 5265 6374 6966 7920 666f stereoRectify fo │ │ │ +000d3140: 7220 6465 7461 696c 732e 3c2f 6464 3e0a r details.
    . │ │ │ +000d3150: 3c64 643e 3c63 6f64 653e 6e65 7749 6d67
    newImg │ │ │ +000d3160: 5369 7a65 3c2f 636f 6465 3e20 2d20 496d Size - Im │ │ │ +000d3170: 6167 6520 7369 7a65 2061 6674 6572 2072 age size after r │ │ │ +000d3180: 6563 7469 6669 6361 7469 6f6e 2e20 4279 ectification. By │ │ │ +000d3190: 2064 6566 6175 6c74 2c20 6974 2069 7320 default, it is │ │ │ +000d31a0: 7365 7420 746f 2069 6d61 6765 5369 7a65 set to imageSize │ │ │ +000d31b0: 202e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 .
    .
    validPixROI - Optional │ │ │ +000d31e0: 6f75 7470 7574 2072 6563 7461 6e67 6c65 output rectangle │ │ │ +000d31f0: 2074 6861 7420 6f75 746c 696e 6573 2061 that outlines a │ │ │ +000d3200: 6c6c 2d67 6f6f 642d 7069 7865 6c73 2072 ll-good-pixels r │ │ │ +000d3210: 6567 696f 6e20 696e 2074 6865 0a75 6e64 egion in the.und │ │ │ +000d3220: 6973 746f 7274 6564 2069 6d61 6765 2e20 istorted image. │ │ │ +000d3230: 5365 6520 726f 6931 2c20 726f 6932 2064 See roi1, roi2 d │ │ │ +000d3240: 6573 6372 6970 7469 6f6e 2069 6e20 2373 escription in #s │ │ │ +000d3250: 7465 7265 6f52 6563 7469 6679 202e 3c2f tereoRectify ..
    ce │ │ │ +000d3270: 6e74 6572 5072 696e 6369 7061 6c50 6f69 nterPrincipalPoi │ │ │ +000d3280: 6e74 3c2f 636f 6465 3e20 2d20 4f70 7469 nt - Opti │ │ │ +000d3290: 6f6e 616c 2066 6c61 6720 7468 6174 2069 onal flag that i │ │ │ +000d32a0: 6e64 6963 6174 6573 2077 6865 7468 6572 ndicates whether │ │ │ +000d32b0: 2069 6e20 7468 6520 6e65 7720 6361 6d65 in the new came │ │ │ +000d32c0: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ +000d32d0: 7269 7820 7468 650a 7072 696e 6369 7061 rix the.principa │ │ │ +000d32e0: 6c20 706f 696e 7420 7368 6f75 6c64 2062 l point should b │ │ │ +000d32f0: 6520 6174 2074 6865 2069 6d61 6765 2063 e at the image c │ │ │ +000d3300: 656e 7465 7220 6f72 206e 6f74 2e20 4279 enter or not. By │ │ │ +000d3310: 2064 6566 6175 6c74 2c20 7468 6520 7072 default, the pr │ │ │ +000d3320: 696e 6369 7061 6c20 706f 696e 7420 6973 incipal point is │ │ │ +000d3330: 2063 686f 7365 6e20 746f 0a62 6573 7420 chosen to.best │ │ │ +000d3340: 6669 7420 6120 7375 6273 6574 206f 6620 fit a subset of │ │ │ +000d3350: 7468 6520 736f 7572 6365 2069 6d61 6765 the source image │ │ │ +000d3360: 2028 6465 7465 726d 696e 6564 2062 7920 (determined by │ │ │ +000d3370: 616c 7068 6129 2074 6f20 7468 6520 636f alpha) to the co │ │ │ +000d3380: 7272 6563 7465 6420 696d 6167 652e 3c2f rrected image..
    Returns: │ │ │ +000d33a0: 3c2f 6474 3e0a 3c64 643e 6e65 775f 6361
    .
    new_ca │ │ │ +000d33b0: 6d65 7261 5f6d 6174 7269 7820 4f75 7470 mera_matrix Outp │ │ │ +000d33c0: 7574 206e 6577 2063 616d 6572 6120 696e ut new camera in │ │ │ +000d33d0: 7472 696e 7369 6320 6d61 7472 6978 2e0a trinsic matrix.. │ │ │ +000d33e0: 0a54 6865 2066 756e 6374 696f 6e20 636f .The function co │ │ │ +000d33f0: 6d70 7574 6573 2061 6e64 2072 6574 7572 mputes and retur │ │ │ +000d3400: 6e73 2074 6865 206f 7074 696d 616c 206e ns the optimal n │ │ │ +000d3410: 6577 2063 616d 6572 6120 696e 7472 696e ew camera intrin │ │ │ +000d3420: 7369 6320 6d61 7472 6978 2062 6173 6564 sic matrix based │ │ │ +000d3430: 206f 6e20 7468 6520 6672 6565 2073 6361 on the free sca │ │ │ +000d3440: 6c69 6e67 2070 6172 616d 6574 6572 2e0a ling parameter.. │ │ │ +000d3450: 4279 2076 6172 7969 6e67 2074 6869 7320 By varying this │ │ │ +000d3460: 7061 7261 6d65 7465 722c 2079 6f75 206d parameter, you m │ │ │ +000d3470: 6179 2072 6574 7269 6576 6520 6f6e 6c79 ay retrieve only │ │ │ +000d3480: 2073 656e 7369 626c 6520 7069 7865 6c73 sensible pixels │ │ │ +000d3490: 2061 6c70 6861 3d30 202c 206b 6565 7020 alpha=0 , keep │ │ │ +000d34a0: 616c 6c20 7468 6520 6f72 6967 696e 616c all the original │ │ │ +000d34b0: 0a69 6d61 6765 2070 6978 656c 7320 6966 .image pixels if │ │ │ +000d34c0: 2074 6865 7265 2069 7320 7661 6c75 6162 there is valuab │ │ │ +000d34d0: 6c65 2069 6e66 6f72 6d61 7469 6f6e 2069 le information i │ │ │ +000d34e0: 6e20 7468 6520 636f 726e 6572 7320 616c n the corners al │ │ │ +000d34f0: 7068 613d 3120 2c20 6f72 2067 6574 2073 pha=1 , or get s │ │ │ +000d3500: 6f6d 6574 6869 6e67 2069 6e20 6265 7477 omething in betw │ │ │ +000d3510: 6565 6e2e 0a57 6865 6e20 616c 7068 6126 een..When alpha& │ │ │ +000d3520: 6774 3b30 202c 2074 6865 2075 6e64 6973 gt;0 , the undis │ │ │ +000d3530: 746f 7274 6564 2072 6573 756c 7420 6973 torted result is │ │ │ +000d3540: 206c 696b 656c 7920 746f 2068 6176 6520 likely to have │ │ │ +000d3550: 736f 6d65 2062 6c61 636b 2070 6978 656c some black pixel │ │ │ +000d3560: 7320 636f 7272 6573 706f 6e64 696e 6720 s corresponding │ │ │ +000d3570: 746f 0a22 7669 7274 7561 6c22 2070 6978 to."virtual" pix │ │ │ +000d3580: 656c 7320 6f75 7473 6964 6520 6f66 2074 els outside of t │ │ │ +000d3590: 6865 2063 6170 7475 7265 6420 6469 7374 he captured dist │ │ │ +000d35a0: 6f72 7465 6420 696d 6167 652e 2054 6865 orted image. The │ │ │ +000d35b0: 206f 7269 6769 6e61 6c20 6361 6d65 7261 original camera │ │ │ +000d35c0: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ +000d35d0: 782c 2064 6973 746f 7274 696f 6e0a 636f x, distortion.co │ │ │ +000d35e0: 6566 6669 6369 656e 7473 2c20 7468 6520 efficients, the │ │ │ +000d35f0: 636f 6d70 7574 6564 206e 6577 2063 616d computed new cam │ │ │ +000d3600: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +000d3610: 7472 6978 2c20 616e 6420 6e65 7749 6d61 trix, and newIma │ │ │ +000d3620: 6765 5369 7a65 2073 686f 756c 6420 6265 geSize should be │ │ │ +000d3630: 2070 6173 7365 6420 746f 0a23 696e 6974 passed to.#init │ │ │ +000d3640: 556e 6469 7374 6f72 7452 6563 7469 6679 UndistortRectify │ │ │ +000d3650: 4d61 7020 746f 2070 726f 6475 6365 2074 Map to produce t │ │ │ +000d3660: 6865 206d 6170 7320 666f 7220 2372 656d he maps for #rem │ │ │ +000d3670: 6170 202e 3c2f 6464 3e0a 3c2f 646c 3e0a ap .
    .. │ │ │ +000d3680: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e
    .
    .
  • .
  • ..

    getOptim │ │ │ +000d3750: 616c 4e65 7743 616d 6572 614d 6174 7269 alNewCameraMatri │ │ │ +000d3760: 783c 2f68 333e 0a3c 6469 7620 636c 6173 x

    .
    .
    pub │ │ │ +000d37c0: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static Mat │ │ │ +000d3830: 3c2f 613e 3c2f 7370 616e 3e26 6e62 7370   │ │ │ +000d3840: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;getO │ │ │ +000d3860: 7074 696d 616c 4e65 7743 616d 6572 614d ptimalNewCameraM │ │ │ +000d3870: 6174 7269 783c 2f73 7061 6e3e 3c77 6272 atrix(Mat&n │ │ │ +000d38e0: 6273 703b 6361 6d65 7261 4d61 7472 6978 bsp;cameraMatrix │ │ │ +000d38f0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000d3930: 6174 3c2f 613e 266e 6273 703b 6469 7374 at dist │ │ │ +000d3940: 436f 6566 6673 2c0a 203c 6120 6872 6566 Coeffs,. Size&n │ │ │ +000d3990: 6273 703b 696d 6167 6553 697a 652c 0a20 bsp;imageSize,. │ │ │ +000d39a0: 646f 7562 6c65 266e 6273 703b 616c 7068 double alph │ │ │ +000d39b0: 612c 0a20 3c61 2068 7265 663d 222e 2e2f a,. Size n │ │ │ +000d3a00: 6577 496d 6753 697a 652c 0a20 3c61 2068 ewImgSize,. Rect validPixR │ │ │ +000d3a60: 4f49 293c 2f73 7061 6e3e 3c2f 6469 763e OI)
    │ │ │ +000d3a70: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Returns the │ │ │ +000d3a90: 6e65 7720 6361 6d65 7261 2069 6e74 7269 new camera intri │ │ │ +000d3aa0: 6e73 6963 206d 6174 7269 7820 6261 7365 nsic matrix base │ │ │ +000d3ab0: 6420 6f6e 2074 6865 2066 7265 6520 7363 d on the free sc │ │ │ +000d3ac0: 616c 696e 6720 7061 7261 6d65 7465 722e aling parameter. │ │ │ +000d3ad0: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ +000d3af0: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ +000d3b00: 6464 3e3c 636f 6465 3e63 616d 6572 614d dd>cameraM │ │ │ +000d3b10: 6174 7269 783c 2f63 6f64 653e 202d 2049 atrix - I │ │ │ +000d3b20: 6e70 7574 2063 616d 6572 6120 696e 7472 nput camera intr │ │ │ +000d3b30: 696e 7369 6320 6d61 7472 6978 2e3c 2f64 insic matrix..
    dis │ │ │ +000d3b50: 7443 6f65 6666 733c 2f63 6f64 653e 202d tCoeffs - │ │ │ +000d3b60: 2049 6e70 7574 2076 6563 746f 7220 6f66 Input vector of │ │ │ +000d3b70: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ +000d3b80: 6669 6369 656e 7473 0a5c 285c 6469 7374 ficients.\(\dist │ │ │ +000d3b90: 636f 6566 6673 5c29 2e20 4966 2074 6865 coeffs\). If the │ │ │ +000d3ba0: 2076 6563 746f 7220 6973 204e 554c 4c2f vector is NULL/ │ │ │ +000d3bb0: 656d 7074 792c 2074 6865 207a 6572 6f20 empty, the zero │ │ │ +000d3bc0: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ +000d3bd0: 6963 6965 6e74 7320 6172 650a 6173 7375 icients are.assu │ │ │ +000d3be0: 6d65 642e 3c2f 6464 3e0a 3c64 643e 3c63 med.
    .
    imageSize - Original │ │ │ +000d3c10: 696d 6167 6520 7369 7a65 2e3c 2f64 643e image size.
    │ │ │ +000d3c20: 0a3c 6464 3e3c 636f 6465 3e61 6c70 6861 .
    alpha │ │ │ +000d3c30: 3c2f 636f 6465 3e20 2d20 4672 6565 2073 - Free s │ │ │ +000d3c40: 6361 6c69 6e67 2070 6172 616d 6574 6572 caling parameter │ │ │ +000d3c50: 2062 6574 7765 656e 2030 2028 7768 656e between 0 (when │ │ │ +000d3c60: 2061 6c6c 2074 6865 2070 6978 656c 7320 all the pixels │ │ │ +000d3c70: 696e 2074 6865 2075 6e64 6973 746f 7274 in the undistort │ │ │ +000d3c80: 6564 2069 6d61 6765 2061 7265 0a76 616c ed image are.val │ │ │ +000d3c90: 6964 2920 616e 6420 3120 2877 6865 6e20 id) and 1 (when │ │ │ +000d3ca0: 616c 6c20 7468 6520 736f 7572 6365 2069 all the source i │ │ │ +000d3cb0: 6d61 6765 2070 6978 656c 7320 6172 6520 mage pixels are │ │ │ +000d3cc0: 7265 7461 696e 6564 2069 6e20 7468 6520 retained in the │ │ │ +000d3cd0: 756e 6469 7374 6f72 7465 6420 696d 6167 undistorted imag │ │ │ +000d3ce0: 6529 2e20 5365 650a 2373 7465 7265 6f52 e). See.#stereoR │ │ │ +000d3cf0: 6563 7469 6679 2066 6f72 2064 6574 6169 ectify for detai │ │ │ +000d3d00: 6c73 2e3c 2f64 643e 0a3c 6464 3e3c 636f ls.
    .
    newImgSize - Image siz │ │ │ +000d3d30: 6520 6166 7465 7220 7265 6374 6966 6963 e after rectific │ │ │ +000d3d40: 6174 696f 6e2e 2042 7920 6465 6661 756c ation. By defaul │ │ │ +000d3d50: 742c 2069 7420 6973 2073 6574 2074 6f20 t, it is set to │ │ │ +000d3d60: 696d 6167 6553 697a 6520 2e3c 2f64 643e imageSize .
    │ │ │ +000d3d70: 0a3c 6464 3e3c 636f 6465 3e76 616c 6964 .
    valid │ │ │ +000d3d80: 5069 7852 4f49 3c2f 636f 6465 3e20 2d20 PixROI - │ │ │ +000d3d90: 4f70 7469 6f6e 616c 206f 7574 7075 7420 Optional output │ │ │ +000d3da0: 7265 6374 616e 676c 6520 7468 6174 206f rectangle that o │ │ │ +000d3db0: 7574 6c69 6e65 7320 616c 6c2d 676f 6f64 utlines all-good │ │ │ +000d3dc0: 2d70 6978 656c 7320 7265 6769 6f6e 2069 -pixels region i │ │ │ +000d3dd0: 6e20 7468 650a 756e 6469 7374 6f72 7465 n the.undistorte │ │ │ +000d3de0: 6420 696d 6167 652e 2053 6565 2072 6f69 d image. See roi │ │ │ +000d3df0: 312c 2072 6f69 3220 6465 7363 7269 7074 1, roi2 descript │ │ │ +000d3e00: 696f 6e20 696e 2023 7374 6572 656f 5265 ion in #stereoRe │ │ │ +000d3e10: 6374 6966 7920 2e0a 7072 696e 6369 7061 ctify ..principa │ │ │ +000d3e20: 6c20 706f 696e 7420 7368 6f75 6c64 2062 l point should b │ │ │ +000d3e30: 6520 6174 2074 6865 2069 6d61 6765 2063 e at the image c │ │ │ +000d3e40: 656e 7465 7220 6f72 206e 6f74 2e20 4279 enter or not. By │ │ │ +000d3e50: 2064 6566 6175 6c74 2c20 7468 6520 7072 default, the pr │ │ │ +000d3e60: 696e 6369 7061 6c20 706f 696e 7420 6973 incipal point is │ │ │ +000d3e70: 2063 686f 7365 6e20 746f 0a62 6573 7420 chosen to.best │ │ │ +000d3e80: 6669 7420 6120 7375 6273 6574 206f 6620 fit a subset of │ │ │ +000d3e90: 7468 6520 736f 7572 6365 2069 6d61 6765 the source image │ │ │ +000d3ea0: 2028 6465 7465 726d 696e 6564 2062 7920 (determined by │ │ │ +000d3eb0: 616c 7068 6129 2074 6f20 7468 6520 636f alpha) to the co │ │ │ +000d3ec0: 7272 6563 7465 6420 696d 6167 652e 3c2f rrected image..
    Returns: │ │ │ +000d3ee0: 3c2f 6474 3e0a 3c64 643e 6e65 775f 6361
    .
    new_ca │ │ │ +000d3ef0: 6d65 7261 5f6d 6174 7269 7820 4f75 7470 mera_matrix Outp │ │ │ +000d3f00: 7574 206e 6577 2063 616d 6572 6120 696e ut new camera in │ │ │ +000d3f10: 7472 696e 7369 6320 6d61 7472 6978 2e0a trinsic matrix.. │ │ │ +000d3f20: 0a54 6865 2066 756e 6374 696f 6e20 636f .The function co │ │ │ +000d3f30: 6d70 7574 6573 2061 6e64 2072 6574 7572 mputes and retur │ │ │ +000d3f40: 6e73 2074 6865 206f 7074 696d 616c 206e ns the optimal n │ │ │ +000d3f50: 6577 2063 616d 6572 6120 696e 7472 696e ew camera intrin │ │ │ +000d3f60: 7369 6320 6d61 7472 6978 2062 6173 6564 sic matrix based │ │ │ +000d3f70: 206f 6e20 7468 6520 6672 6565 2073 6361 on the free sca │ │ │ +000d3f80: 6c69 6e67 2070 6172 616d 6574 6572 2e0a ling parameter.. │ │ │ +000d3f90: 4279 2076 6172 7969 6e67 2074 6869 7320 By varying this │ │ │ +000d3fa0: 7061 7261 6d65 7465 722c 2079 6f75 206d parameter, you m │ │ │ +000d3fb0: 6179 2072 6574 7269 6576 6520 6f6e 6c79 ay retrieve only │ │ │ +000d3fc0: 2073 656e 7369 626c 6520 7069 7865 6c73 sensible pixels │ │ │ +000d3fd0: 2061 6c70 6861 3d30 202c 206b 6565 7020 alpha=0 , keep │ │ │ +000d3fe0: 616c 6c20 7468 6520 6f72 6967 696e 616c all the original │ │ │ +000d3ff0: 0a69 6d61 6765 2070 6978 656c 7320 6966 .image pixels if │ │ │ +000d4000: 2074 6865 7265 2069 7320 7661 6c75 6162 there is valuab │ │ │ +000d4010: 6c65 2069 6e66 6f72 6d61 7469 6f6e 2069 le information i │ │ │ +000d4020: 6e20 7468 6520 636f 726e 6572 7320 616c n the corners al │ │ │ +000d4030: 7068 613d 3120 2c20 6f72 2067 6574 2073 pha=1 , or get s │ │ │ +000d4040: 6f6d 6574 6869 6e67 2069 6e20 6265 7477 omething in betw │ │ │ +000d4050: 6565 6e2e 0a57 6865 6e20 616c 7068 6126 een..When alpha& │ │ │ +000d4060: 6774 3b30 202c 2074 6865 2075 6e64 6973 gt;0 , the undis │ │ │ +000d4070: 746f 7274 6564 2072 6573 756c 7420 6973 torted result is │ │ │ +000d4080: 206c 696b 656c 7920 746f 2068 6176 6520 likely to have │ │ │ +000d4090: 736f 6d65 2062 6c61 636b 2070 6978 656c some black pixel │ │ │ +000d40a0: 7320 636f 7272 6573 706f 6e64 696e 6720 s corresponding │ │ │ +000d40b0: 746f 0a22 7669 7274 7561 6c22 2070 6978 to."virtual" pix │ │ │ +000d40c0: 656c 7320 6f75 7473 6964 6520 6f66 2074 els outside of t │ │ │ +000d40d0: 6865 2063 6170 7475 7265 6420 6469 7374 he captured dist │ │ │ +000d40e0: 6f72 7465 6420 696d 6167 652e 2054 6865 orted image. The │ │ │ +000d40f0: 206f 7269 6769 6e61 6c20 6361 6d65 7261 original camera │ │ │ +000d4100: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ +000d4110: 782c 2064 6973 746f 7274 696f 6e0a 636f x, distortion.co │ │ │ +000d4120: 6566 6669 6369 656e 7473 2c20 7468 6520 efficients, the │ │ │ +000d4130: 636f 6d70 7574 6564 206e 6577 2063 616d computed new cam │ │ │ +000d4140: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +000d4150: 7472 6978 2c20 616e 6420 6e65 7749 6d61 trix, and newIma │ │ │ +000d4160: 6765 5369 7a65 2073 686f 756c 6420 6265 geSize should be │ │ │ +000d4170: 2070 6173 7365 6420 746f 0a23 696e 6974 passed to.#init │ │ │ +000d4180: 556e 6469 7374 6f72 7452 6563 7469 6679 UndistortRectify │ │ │ +000d4190: 4d61 7020 746f 2070 726f 6475 6365 2074 Map to produce t │ │ │ +000d41a0: 6865 206d 6170 7320 666f 7220 2372 656d he maps for #rem │ │ │ +000d41b0: 6170 202e 3c2f 6464 3e0a 3c2f 646c 3e0a ap .
    .
    . │ │ │ +000d41c0: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e
    ..
  • .
  • ..< │ │ │ +000d4270: 6833 3e67 6574 4f70 7469 6d61 6c4e 6577 h3>getOptimalNew │ │ │ +000d4280: 4361 6d65 7261 4d61 7472 6978 3c2f 6833 CameraMatrix.
    .
    │ │ │ +000d42d0: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +000d42f0: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +000d4300: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;Mat< │ │ │ +000d4360: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> getOptima │ │ │ +000d4390: 6c4e 6577 4361 6d65 7261 4d61 7472 6978 lNewCameraMatrix │ │ │ +000d43a0: 3c2f 7370 616e 3e3c 7762 723e 3c73 7061 (Mat c │ │ │ +000d4410: 616d 6572 614d 6174 7269 782c 0a20 3c61 ameraMatrix,. Mat distCoeff │ │ │ +000d4470: 732c 0a20 3c61 2068 7265 663d 222e 2e2f s,. Size i │ │ │ +000d44c0: 6d61 6765 5369 7a65 2c0a 2064 6f75 626c mageSize,. doubl │ │ │ +000d44d0: 6526 6e62 7370 3b61 6c70 6861 2c0a 203c e alpha,. < │ │ │ +000d44e0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000d44f0: 5369 7a65 2e68 746d 6c22 2074 6974 6c65 Size.html" title │ │ │ +000d4500: 3d22 636c 6173 7320 696e 206f 7267 2e6f ="class in org.o │ │ │ +000d4510: 7065 6e63 762e 636f 7265 223e 5369 7a65 pencv.core">Size │ │ │ +000d4520: 3c2f 613e 266e 6273 703b 6e65 7749 6d67  newImg │ │ │ +000d4530: 5369 7a65 293c 2f73 7061 6e3e 3c2f 6469 Size).
    Returns th │ │ │ +000d4560: 6520 6e65 7720 6361 6d65 7261 2069 6e74 e new camera int │ │ │ +000d4570: 7269 6e73 6963 206d 6174 7269 7820 6261 rinsic matrix ba │ │ │ +000d4580: 7365 6420 6f6e 2074 6865 2066 7265 6520 sed on the free │ │ │ +000d4590: 7363 616c 696e 6720 7061 7261 6d65 7465 scaling paramete │ │ │ +000d45a0: 722e 3c2f 6469 763e 0a3c 646c 2063 6c61 r.
    .
    .
    │ │ │ +000d45c0: 5061 7261 6d65 7465 7273 3a3c 2f64 743e Parameters:
    │ │ │ +000d45d0: 0a3c 6464 3e3c 636f 6465 3e63 616d 6572 .
    camer │ │ │ +000d45e0: 614d 6174 7269 783c 2f63 6f64 653e 202d aMatrix - │ │ │ +000d45f0: 2049 6e70 7574 2063 616d 6572 6120 696e Input camera in │ │ │ +000d4600: 7472 696e 7369 6320 6d61 7472 6978 2e3c trinsic matrix.< │ │ │ +000d4610: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ +000d4620: 6973 7443 6f65 6666 733c 2f63 6f64 653e istCoeffs │ │ │ +000d4630: 202d 2049 6e70 7574 2076 6563 746f 7220 - Input vector │ │ │ +000d4640: 6f66 2064 6973 746f 7274 696f 6e20 636f of distortion co │ │ │ +000d4650: 6566 6669 6369 656e 7473 0a5c 285c 6469 efficients.\(\di │ │ │ +000d4660: 7374 636f 6566 6673 5c29 2e20 4966 2074 stcoeffs\). If t │ │ │ +000d4670: 6865 2076 6563 746f 7220 6973 204e 554c he vector is NUL │ │ │ +000d4680: 4c2f 656d 7074 792c 2074 6865 207a 6572 L/empty, the zer │ │ │ +000d4690: 6f20 6469 7374 6f72 7469 6f6e 2063 6f65 o distortion coe │ │ │ +000d46a0: 6666 6963 6965 6e74 7320 6172 650a 6173 fficients are.as │ │ │ +000d46b0: 7375 6d65 642e 3c2f 6464 3e0a 3c64 643e sumed.
    .
    │ │ │ +000d46c0: 3c63 6f64 653e 696d 6167 6553 697a 653c imageSize< │ │ │ +000d46d0: 2f63 6f64 653e 202d 204f 7269 6769 6e61 /code> - Origina │ │ │ +000d46e0: 6c20 696d 6167 6520 7369 7a65 2e3c 2f64 l image size..
    alp │ │ │ +000d4700: 6861 3c2f 636f 6465 3e20 2d20 4672 6565 ha - Free │ │ │ +000d4710: 2073 6361 6c69 6e67 2070 6172 616d 6574 scaling paramet │ │ │ +000d4720: 6572 2062 6574 7765 656e 2030 2028 7768 er between 0 (wh │ │ │ +000d4730: 656e 2061 6c6c 2074 6865 2070 6978 656c en all the pixel │ │ │ +000d4740: 7320 696e 2074 6865 2075 6e64 6973 746f s in the undisto │ │ │ +000d4750: 7274 6564 2069 6d61 6765 2061 7265 0a76 rted image are.v │ │ │ +000d4760: 616c 6964 2920 616e 6420 3120 2877 6865 alid) and 1 (whe │ │ │ +000d4770: 6e20 616c 6c20 7468 6520 736f 7572 6365 n all the source │ │ │ +000d4780: 2069 6d61 6765 2070 6978 656c 7320 6172 image pixels ar │ │ │ +000d4790: 6520 7265 7461 696e 6564 2069 6e20 7468 e retained in th │ │ │ +000d47a0: 6520 756e 6469 7374 6f72 7465 6420 696d e undistorted im │ │ │ +000d47b0: 6167 6529 2e20 5365 650a 2373 7465 7265 age). See.#stere │ │ │ +000d47c0: 6f52 6563 7469 6679 2066 6f72 2064 6574 oRectify for det │ │ │ +000d47d0: 6169 6c73 2e3c 2f64 643e 0a3c 6464 3e3c ails.
    .
    < │ │ │ +000d47e0: 636f 6465 3e6e 6577 496d 6753 697a 653c code>newImgSize< │ │ │ +000d47f0: 2f63 6f64 653e 202d 2049 6d61 6765 2073 /code> - Image s │ │ │ +000d4800: 697a 6520 6166 7465 7220 7265 6374 6966 ize after rectif │ │ │ +000d4810: 6963 6174 696f 6e2e 2042 7920 6465 6661 ication. By defa │ │ │ +000d4820: 756c 742c 2069 7420 6973 2073 6574 2074 ult, it is set t │ │ │ +000d4830: 6f20 696d 6167 6553 697a 6520 2e0a 756e o imageSize ..un │ │ │ +000d4840: 6469 7374 6f72 7465 6420 696d 6167 652e distorted image. │ │ │ +000d4850: 2053 6565 2072 6f69 312c 2072 6f69 3220 See roi1, roi2 │ │ │ +000d4860: 6465 7363 7269 7074 696f 6e20 696e 2023 description in # │ │ │ +000d4870: 7374 6572 656f 5265 6374 6966 7920 2e0a stereoRectify .. │ │ │ +000d4880: 7072 696e 6369 7061 6c20 706f 696e 7420 principal point │ │ │ +000d4890: 7368 6f75 6c64 2062 6520 6174 2074 6865 should be at the │ │ │ +000d48a0: 2069 6d61 6765 2063 656e 7465 7220 6f72 image center or │ │ │ +000d48b0: 206e 6f74 2e20 4279 2064 6566 6175 6c74 not. By default │ │ │ +000d48c0: 2c20 7468 6520 7072 696e 6369 7061 6c20 , the principal │ │ │ +000d48d0: 706f 696e 7420 6973 2063 686f 7365 6e20 point is chosen │ │ │ +000d48e0: 746f 0a62 6573 7420 6669 7420 6120 7375 to.best fit a su │ │ │ +000d48f0: 6273 6574 206f 6620 7468 6520 736f 7572 bset of the sour │ │ │ +000d4900: 6365 2069 6d61 6765 2028 6465 7465 726d ce image (determ │ │ │ +000d4910: 696e 6564 2062 7920 616c 7068 6129 2074 ined by alpha) t │ │ │ +000d4920: 6f20 7468 6520 636f 7272 6563 7465 6420 o the corrected │ │ │ +000d4930: 696d 6167 652e 3c2f 6464 3e0a 3c64 743e image.
    .
    │ │ │ +000d4940: 5265 7475 726e 733a 3c2f 6474 3e0a 3c64 Returns:
    .new_camera_mat │ │ │ +000d4960: 7269 7820 4f75 7470 7574 206e 6577 2063 rix Output new c │ │ │ +000d4970: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ +000d4980: 6d61 7472 6978 2e0a 0a54 6865 2066 756e matrix...The fun │ │ │ +000d4990: 6374 696f 6e20 636f 6d70 7574 6573 2061 ction computes a │ │ │ +000d49a0: 6e64 2072 6574 7572 6e73 2074 6865 206f nd returns the o │ │ │ +000d49b0: 7074 696d 616c 206e 6577 2063 616d 6572 ptimal new camer │ │ │ +000d49c0: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ +000d49d0: 6978 2062 6173 6564 206f 6e20 7468 6520 ix based on the │ │ │ +000d49e0: 6672 6565 2073 6361 6c69 6e67 2070 6172 free scaling par │ │ │ +000d49f0: 616d 6574 6572 2e0a 4279 2076 6172 7969 ameter..By varyi │ │ │ +000d4a00: 6e67 2074 6869 7320 7061 7261 6d65 7465 ng this paramete │ │ │ +000d4a10: 722c 2079 6f75 206d 6179 2072 6574 7269 r, you may retri │ │ │ +000d4a20: 6576 6520 6f6e 6c79 2073 656e 7369 626c eve only sensibl │ │ │ +000d4a30: 6520 7069 7865 6c73 2061 6c70 6861 3d30 e pixels alpha=0 │ │ │ +000d4a40: 202c 206b 6565 7020 616c 6c20 7468 6520 , keep all the │ │ │ +000d4a50: 6f72 6967 696e 616c 0a69 6d61 6765 2070 original.image p │ │ │ +000d4a60: 6978 656c 7320 6966 2074 6865 7265 2069 ixels if there i │ │ │ +000d4a70: 7320 7661 6c75 6162 6c65 2069 6e66 6f72 s valuable infor │ │ │ +000d4a80: 6d61 7469 6f6e 2069 6e20 7468 6520 636f mation in the co │ │ │ +000d4a90: 726e 6572 7320 616c 7068 613d 3120 2c20 rners alpha=1 , │ │ │ +000d4aa0: 6f72 2067 6574 2073 6f6d 6574 6869 6e67 or get something │ │ │ +000d4ab0: 2069 6e20 6265 7477 6565 6e2e 0a57 6865 in between..Whe │ │ │ +000d4ac0: 6e20 616c 7068 6126 6774 3b30 202c 2074 n alpha>0 , t │ │ │ +000d4ad0: 6865 2075 6e64 6973 746f 7274 6564 2072 he undistorted r │ │ │ +000d4ae0: 6573 756c 7420 6973 206c 696b 656c 7920 esult is likely │ │ │ +000d4af0: 746f 2068 6176 6520 736f 6d65 2062 6c61 to have some bla │ │ │ +000d4b00: 636b 2070 6978 656c 7320 636f 7272 6573 ck pixels corres │ │ │ +000d4b10: 706f 6e64 696e 6720 746f 0a22 7669 7274 ponding to."virt │ │ │ +000d4b20: 7561 6c22 2070 6978 656c 7320 6f75 7473 ual" pixels outs │ │ │ +000d4b30: 6964 6520 6f66 2074 6865 2063 6170 7475 ide of the captu │ │ │ +000d4b40: 7265 6420 6469 7374 6f72 7465 6420 696d red distorted im │ │ │ +000d4b50: 6167 652e 2054 6865 206f 7269 6769 6e61 age. The origina │ │ │ +000d4b60: 6c20 6361 6d65 7261 2069 6e74 7269 6e73 l camera intrins │ │ │ +000d4b70: 6963 206d 6174 7269 782c 2064 6973 746f ic matrix, disto │ │ │ +000d4b80: 7274 696f 6e0a 636f 6566 6669 6369 656e rtion.coefficien │ │ │ +000d4b90: 7473 2c20 7468 6520 636f 6d70 7574 6564 ts, the computed │ │ │ +000d4ba0: 206e 6577 2063 616d 6572 6120 696e 7472 new camera intr │ │ │ +000d4bb0: 696e 7369 6320 6d61 7472 6978 2c20 616e insic matrix, an │ │ │ +000d4bc0: 6420 6e65 7749 6d61 6765 5369 7a65 2073 d newImageSize s │ │ │ +000d4bd0: 686f 756c 6420 6265 2070 6173 7365 6420 hould be passed │ │ │ +000d4be0: 746f 0a23 696e 6974 556e 6469 7374 6f72 to.#initUndistor │ │ │ +000d4bf0: 7452 6563 7469 6679 4d61 7020 746f 2070 tRectifyMap to p │ │ │ +000d4c00: 726f 6475 6365 2074 6865 206d 6170 7320 roduce the maps │ │ │ +000d4c10: 666f 7220 2372 656d 6170 202e 3c2f 6464 for #remap ..
    .
    .< │ │ │ +000d4c30: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ +000d4c40: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    getOptimal │ │ │ +000d4cd0: 4e65 7743 616d 6572 614d 6174 7269 783c NewCameraMatrix< │ │ │ +000d4ce0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +000d4d40: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +000d4d50: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;< │ │ │ +000d4d70: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000d4d80: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000d4d90: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000d4da0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat < │ │ │ +000d4dc0: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +000d4dd0: 656e 742d 6e61 6d65 223e 6765 744f 7074 ent-name">getOpt │ │ │ +000d4de0: 696d 616c 4e65 7743 616d 6572 614d 6174 imalNewCameraMat │ │ │ +000d4df0: 7269 783c 2f73 7061 6e3e 3c77 6272 3e3c rix< │ │ │ +000d4e00: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +000d4e10: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ +000d4e60: 703b 6361 6d65 7261 4d61 7472 6978 2c0a p;cameraMatrix,. │ │ │ +000d4e70: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000d4eb0: 3c2f 613e 266e 6273 703b 6469 7374 436f  distCo │ │ │ +000d4ec0: 6566 6673 2c0a 203c 6120 6872 6566 3d22 effs,. Size&nbs │ │ │ +000d4f10: 703b 696d 6167 6553 697a 652c 0a20 646f p;imageSize,. do │ │ │ +000d4f20: 7562 6c65 266e 6273 703b 616c 7068 6129 uble alpha) │ │ │ +000d4f30: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Returns the new │ │ │ +000d4f60: 2063 616d 6572 6120 696e 7472 696e 7369 camera intrinsi │ │ │ +000d4f70: 6320 6d61 7472 6978 2062 6173 6564 206f c matrix based o │ │ │ +000d4f80: 6e20 7468 6520 6672 6565 2073 6361 6c69 n the free scali │ │ │ +000d4f90: 6e67 2070 6172 616d 6574 6572 2e3c 2f64 ng parameter..
    .
    Param │ │ │ +000d4fc0: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ +000d4fd0: 3c63 6f64 653e 6361 6d65 7261 4d61 7472 cameraMatr │ │ │ +000d4fe0: 6978 3c2f 636f 6465 3e20 2d20 496e 7075 ix - Inpu │ │ │ +000d4ff0: 7420 6361 6d65 7261 2069 6e74 7269 6e73 t camera intrins │ │ │ +000d5000: 6963 206d 6174 7269 782e 3c2f 6464 3e0a ic matrix.
    . │ │ │ +000d5010: 3c64 643e 3c63 6f64 653e 6469 7374 436f
    distCo │ │ │ +000d5020: 6566 6673 3c2f 636f 6465 3e20 2d20 496e effs - In │ │ │ +000d5030: 7075 7420 7665 6374 6f72 206f 6620 6469 put vector of di │ │ │ +000d5040: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ +000d5050: 6965 6e74 730a 5c28 5c64 6973 7463 6f65 ients.\(\distcoe │ │ │ +000d5060: 6666 735c 292e 2049 6620 7468 6520 7665 ffs\). If the ve │ │ │ +000d5070: 6374 6f72 2069 7320 4e55 4c4c 2f65 6d70 ctor is NULL/emp │ │ │ +000d5080: 7479 2c20 7468 6520 7a65 726f 2064 6973 ty, the zero dis │ │ │ +000d5090: 746f 7274 696f 6e20 636f 6566 6669 6369 tortion coeffici │ │ │ +000d50a0: 656e 7473 2061 7265 0a61 7373 756d 6564 ents are.assumed │ │ │ +000d50b0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    imageSize - Original ima │ │ │ +000d50e0: 6765 2073 697a 652e 3c2f 6464 3e0a 3c64 ge size.
    .alpha - Free scal │ │ │ +000d5110: 696e 6720 7061 7261 6d65 7465 7220 6265 ing parameter be │ │ │ +000d5120: 7477 6565 6e20 3020 2877 6865 6e20 616c tween 0 (when al │ │ │ +000d5130: 6c20 7468 6520 7069 7865 6c73 2069 6e20 l the pixels in │ │ │ +000d5140: 7468 6520 756e 6469 7374 6f72 7465 6420 the undistorted │ │ │ +000d5150: 696d 6167 6520 6172 650a 7661 6c69 6429 image are.valid) │ │ │ +000d5160: 2061 6e64 2031 2028 7768 656e 2061 6c6c and 1 (when all │ │ │ +000d5170: 2074 6865 2073 6f75 7263 6520 696d 6167 the source imag │ │ │ +000d5180: 6520 7069 7865 6c73 2061 7265 2072 6574 e pixels are ret │ │ │ +000d5190: 6169 6e65 6420 696e 2074 6865 2075 6e64 ained in the und │ │ │ +000d51a0: 6973 746f 7274 6564 2069 6d61 6765 292e istorted image). │ │ │ +000d51b0: 2053 6565 0a23 7374 6572 656f 5265 6374 See.#stereoRect │ │ │ +000d51c0: 6966 7920 666f 7220 6465 7461 696c 732e ify for details. │ │ │ +000d51d0: 0a75 6e64 6973 746f 7274 6564 2069 6d61 .undistorted ima │ │ │ +000d51e0: 6765 2e20 5365 6520 726f 6931 2c20 726f ge. See roi1, ro │ │ │ +000d51f0: 6932 2064 6573 6372 6970 7469 6f6e 2069 i2 description i │ │ │ +000d5200: 6e20 2373 7465 7265 6f52 6563 7469 6679 n #stereoRectify │ │ │ +000d5210: 202e 0a70 7269 6e63 6970 616c 2070 6f69 ..principal poi │ │ │ +000d5220: 6e74 2073 686f 756c 6420 6265 2061 7420 nt should be at │ │ │ +000d5230: 7468 6520 696d 6167 6520 6365 6e74 6572 the image center │ │ │ +000d5240: 206f 7220 6e6f 742e 2042 7920 6465 6661 or not. By defa │ │ │ +000d5250: 756c 742c 2074 6865 2070 7269 6e63 6970 ult, the princip │ │ │ +000d5260: 616c 2070 6f69 6e74 2069 7320 6368 6f73 al point is chos │ │ │ +000d5270: 656e 2074 6f0a 6265 7374 2066 6974 2061 en to.best fit a │ │ │ +000d5280: 2073 7562 7365 7420 6f66 2074 6865 2073 subset of the s │ │ │ +000d5290: 6f75 7263 6520 696d 6167 6520 2864 6574 ource image (det │ │ │ +000d52a0: 6572 6d69 6e65 6420 6279 2061 6c70 6861 ermined by alpha │ │ │ +000d52b0: 2920 746f 2074 6865 2063 6f72 7265 6374 ) to the correct │ │ │ +000d52c0: 6564 2069 6d61 6765 2e3c 2f64 643e 0a3c ed image..< │ │ │ +000d52d0: 6474 3e52 6574 7572 6e73 3a3c 2f64 743e dt>Returns: │ │ │ +000d52e0: 0a3c 6464 3e6e 6577 5f63 616d 6572 615f .
    new_camera_ │ │ │ +000d52f0: 6d61 7472 6978 204f 7574 7075 7420 6e65 matrix Output ne │ │ │ +000d5300: 7720 6361 6d65 7261 2069 6e74 7269 6e73 w camera intrins │ │ │ +000d5310: 6963 206d 6174 7269 782e 0a0a 5468 6520 ic matrix...The │ │ │ +000d5320: 6675 6e63 7469 6f6e 2063 6f6d 7075 7465 function compute │ │ │ +000d5330: 7320 616e 6420 7265 7475 726e 7320 7468 s and returns th │ │ │ +000d5340: 6520 6f70 7469 6d61 6c20 6e65 7720 6361 e optimal new ca │ │ │ +000d5350: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ +000d5360: 6174 7269 7820 6261 7365 6420 6f6e 2074 atrix based on t │ │ │ +000d5370: 6865 2066 7265 6520 7363 616c 696e 6720 he free scaling │ │ │ +000d5380: 7061 7261 6d65 7465 722e 0a42 7920 7661 parameter..By va │ │ │ +000d5390: 7279 696e 6720 7468 6973 2070 6172 616d rying this param │ │ │ +000d53a0: 6574 6572 2c20 796f 7520 6d61 7920 7265 eter, you may re │ │ │ +000d53b0: 7472 6965 7665 206f 6e6c 7920 7365 6e73 trieve only sens │ │ │ +000d53c0: 6962 6c65 2070 6978 656c 7320 616c 7068 ible pixels alph │ │ │ +000d53d0: 613d 3020 2c20 6b65 6570 2061 6c6c 2074 a=0 , keep all t │ │ │ +000d53e0: 6865 206f 7269 6769 6e61 6c0a 696d 6167 he original.imag │ │ │ +000d53f0: 6520 7069 7865 6c73 2069 6620 7468 6572 e pixels if ther │ │ │ +000d5400: 6520 6973 2076 616c 7561 626c 6520 696e e is valuable in │ │ │ +000d5410: 666f 726d 6174 696f 6e20 696e 2074 6865 formation in the │ │ │ +000d5420: 2063 6f72 6e65 7273 2061 6c70 6861 3d31 corners alpha=1 │ │ │ +000d5430: 202c 206f 7220 6765 7420 736f 6d65 7468 , or get someth │ │ │ +000d5440: 696e 6720 696e 2062 6574 7765 656e 2e0a ing in between.. │ │ │ +000d5450: 5768 656e 2061 6c70 6861 2667 743b 3020 When alpha>0 │ │ │ +000d5460: 2c20 7468 6520 756e 6469 7374 6f72 7465 , the undistorte │ │ │ +000d5470: 6420 7265 7375 6c74 2069 7320 6c69 6b65 d result is like │ │ │ +000d5480: 6c79 2074 6f20 6861 7665 2073 6f6d 6520 ly to have some │ │ │ +000d5490: 626c 6163 6b20 7069 7865 6c73 2063 6f72 black pixels cor │ │ │ +000d54a0: 7265 7370 6f6e 6469 6e67 2074 6f0a 2276 responding to."v │ │ │ +000d54b0: 6972 7475 616c 2220 7069 7865 6c73 206f irtual" pixels o │ │ │ +000d54c0: 7574 7369 6465 206f 6620 7468 6520 6361 utside of the ca │ │ │ +000d54d0: 7074 7572 6564 2064 6973 746f 7274 6564 ptured distorted │ │ │ +000d54e0: 2069 6d61 6765 2e20 5468 6520 6f72 6967 image. The orig │ │ │ +000d54f0: 696e 616c 2063 616d 6572 6120 696e 7472 inal camera intr │ │ │ +000d5500: 696e 7369 6320 6d61 7472 6978 2c20 6469 insic matrix, di │ │ │ +000d5510: 7374 6f72 7469 6f6e 0a63 6f65 6666 6963 stortion.coeffic │ │ │ +000d5520: 6965 6e74 732c 2074 6865 2063 6f6d 7075 ients, the compu │ │ │ +000d5530: 7465 6420 6e65 7720 6361 6d65 7261 2069 ted new camera i │ │ │ +000d5540: 6e74 7269 6e73 6963 206d 6174 7269 782c ntrinsic matrix, │ │ │ +000d5550: 2061 6e64 206e 6577 496d 6167 6553 697a and newImageSiz │ │ │ +000d5560: 6520 7368 6f75 6c64 2062 6520 7061 7373 e should be pass │ │ │ +000d5570: 6564 2074 6f0a 2369 6e69 7455 6e64 6973 ed to.#initUndis │ │ │ +000d5580: 746f 7274 5265 6374 6966 794d 6170 2074 tortRectifyMap t │ │ │ +000d5590: 6f20 7072 6f64 7563 6520 7468 6520 6d61 o produce the ma │ │ │ +000d55a0: 7073 2066 6f72 2023 7265 6d61 7020 2e3c ps for #remap .< │ │ │ +000d55b0: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .

    ..
  • .
    .undistortPoint │ │ │ +000d56c0: 733c 2f68 333e 0a3c 6469 7620 636c 6173 s.
    .
    pub │ │ │ +000d5720: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static void&nbs │ │ │ +000d5760: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;und │ │ │ +000d5780: 6973 746f 7274 506f 696e 7473 3c2f 7370 istortPoints(MatOfPoin │ │ │ +000d5800: 7432 663c 2f61 3e26 6e62 7370 3b73 7263 t2f src │ │ │ +000d5810: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. MatOfPoi │ │ │ +000d5860: 6e74 3266 3c2f 613e 266e 6273 703b 6473 nt2f ds │ │ │ +000d5870: 742c 0a20 3c61 2068 7265 663d 222e 2e2f t,. │ │ │ +000d58b0: 4d61 743c 2f61 3e26 6e62 7370 3b63 616d Mat cam │ │ │ +000d58c0: 6572 614d 6174 7269 782c 0a20 3c61 2068 eraMatrix,. Mat& │ │ │ +000d5910: 6e62 7370 3b64 6973 7443 6f65 6666 732c nbsp;distCoeffs, │ │ │ +000d5920: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000d5960: 743c 2f61 3e26 6e62 7370 3b52 2c0a 203c t R,. < │ │ │ +000d5970: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000d5980: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000d5990: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000d59a0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat P,. TermCriteria criteria) │ │ │ +000d5a20: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Computes the id │ │ │ +000d5a50: 6561 6c20 706f 696e 7420 636f 6f72 6469 eal point coordi │ │ │ +000d5a60: 6e61 7465 7320 6672 6f6d 2074 6865 206f nates from the o │ │ │ +000d5a70: 6273 6572 7665 6420 706f 696e 7420 636f bserved point co │ │ │ +000d5a80: 6f72 6469 6e61 7465 732e 0a0a 5468 6520 ordinates...The │ │ │ +000d5a90: 6675 6e63 7469 6f6e 2069 7320 7369 6d69 function is simi │ │ │ +000d5aa0: 6c61 7220 746f 2023 756e 6469 7374 6f72 lar to #undistor │ │ │ +000d5ab0: 7420 616e 6420 2369 6e69 7455 6e64 6973 t and #initUndis │ │ │ +000d5ac0: 746f 7274 5265 6374 6966 794d 6170 2062 tortRectifyMap b │ │ │ +000d5ad0: 7574 2069 7420 6f70 6572 6174 6573 206f ut it operates o │ │ │ +000d5ae0: 6e20 610a 7370 6172 7365 2073 6574 206f n a.sparse set o │ │ │ +000d5af0: 6620 706f 696e 7473 2069 6e73 7465 6164 f points instead │ │ │ +000d5b00: 206f 6620 6120 7261 7374 6572 2069 6d61 of a raster ima │ │ │ +000d5b10: 6765 2e20 416c 736f 2074 6865 2066 756e ge. Also the fun │ │ │ +000d5b20: 6374 696f 6e20 7065 7266 6f72 6d73 2061 ction performs a │ │ │ +000d5b30: 2072 6576 6572 7365 2074 7261 6e73 666f reverse transfo │ │ │ +000d5b40: 726d 6174 696f 6e0a 746f 2020 2370 726f rmation.to #pro │ │ │ +000d5b50: 6a65 6374 506f 696e 7473 2e20 496e 2063 jectPoints. In c │ │ │ +000d5b60: 6173 6520 6f66 2061 2033 4420 6f62 6a65 ase of a 3D obje │ │ │ +000d5b70: 6374 2c20 6974 2064 6f65 7320 6e6f 7420 ct, it does not │ │ │ +000d5b80: 7265 636f 6e73 7472 7563 7420 6974 7320 reconstruct its │ │ │ +000d5b90: 3344 2063 6f6f 7264 696e 6174 6573 2c20 3D coordinates, │ │ │ +000d5ba0: 6275 7420 666f 7220 610a 706c 616e 6172 but for a.planar │ │ │ +000d5bb0: 206f 626a 6563 742c 2069 7420 646f 6573 object, it does │ │ │ +000d5bc0: 2c20 7570 2074 6f20 6120 7472 616e 736c , up to a transl │ │ │ +000d5bd0: 6174 696f 6e20 7665 6374 6f72 2c20 6966 ation vector, if │ │ │ +000d5be0: 2074 6865 2070 726f 7065 7220 5220 6973 the proper R is │ │ │ +000d5bf0: 2073 7065 6369 6669 6564 2e0a 0a46 6f72 specified...For │ │ │ +000d5c00: 2065 6163 6820 6f62 7365 7276 6564 2070 each observed p │ │ │ +000d5c10: 6f69 6e74 2063 6f6f 7264 696e 6174 6520 oint coordinate │ │ │ +000d5c20: 5c28 2875 2c20 7629 5c29 2074 6865 2066 \((u, v)\) the f │ │ │ +000d5c30: 756e 6374 696f 6e20 636f 6d70 7574 6573 unction computes │ │ │ +000d5c40: 3a0a 5c28 0a5c 6265 6769 6e7b 6172 7261 :.\(.\begin{arra │ │ │ +000d5c50: 797d 7b6c 7d0a 785e 7b22 7d20 205c 6c65 y}{l}.x^{"} \le │ │ │ +000d5c60: 6674 6172 726f 7720 2875 202d 2063 5f78 ftarrow (u - c_x │ │ │ +000d5c70: 292f 665f 7820 205c 5c0a 795e 7b22 7d20 )/f_x \\.y^{"} │ │ │ +000d5c80: 205c 6c65 6674 6172 726f 7720 2876 202d \leftarrow (v - │ │ │ +000d5c90: 2063 5f79 292f 665f 7920 205c 5c0a 2878 c_y)/f_y \\.(x │ │ │ +000d5ca0: 272c 7927 2920 3d20 756e 6469 7374 6f72 ',y') = undistor │ │ │ +000d5cb0: 7428 785e 7b22 7d2c 795e 7b22 7d2c 205c t(x^{"},y^{"}, \ │ │ │ +000d5cc0: 7465 7874 7474 7b64 6973 7443 6f65 6666 texttt{distCoeff │ │ │ +000d5cd0: 737d 2920 5c5c 0a7b 5b58 5c2c 595c 2c57 s}) \\.{[X\,Y\,W │ │ │ +000d5ce0: 5d7d 205e 5420 205c 6c65 6674 6172 726f ]} ^T \leftarro │ │ │ +000d5cf0: 7720 522a 5b78 2720 5c2c 2079 2720 5c2c w R*[x' \, y' \, │ │ │ +000d5d00: 2031 5d5e 5420 205c 5c0a 7820 205c 6c65 1]^T \\.x \le │ │ │ +000d5d10: 6674 6172 726f 7720 582f 5720 205c 5c0a ftarrow X/W \\. │ │ │ +000d5d20: 7920 205c 6c65 6674 6172 726f 7720 592f y \leftarrow Y/ │ │ │ +000d5d30: 5720 205c 5c0a 5c74 6578 747b 6f6e 6c79 W \\.\text{only │ │ │ +000d5d40: 2070 6572 666f 726d 6564 2069 6620 5020 performed if P │ │ │ +000d5d50: 6973 2073 7065 6369 6669 6564 3a7d 205c is specified:} \ │ │ │ +000d5d60: 5c0a 7527 2020 5c6c 6566 7461 7272 6f77 \.u' \leftarrow │ │ │ +000d5d70: 2078 207b 6627 7d5f 7820 2b20 7b63 277d x {f'}_x + {c'} │ │ │ +000d5d80: 5f78 2020 5c5c 0a76 2720 205c 6c65 6674 _x \\.v' \left │ │ │ +000d5d90: 6172 726f 7720 7920 7b66 277d 5f79 202b arrow y {f'}_y + │ │ │ +000d5da0: 207b 6327 7d5f 790a 5c65 6e64 7b61 7272 {c'}_y.\end{arr │ │ │ +000d5db0: 6179 7d0a 5c29 0a0a 7768 6572 6520 2a75 ay}.\)..where *u │ │ │ +000d5dc0: 6e64 6973 746f 7274 2a20 6973 2061 6e20 ndistort* is an │ │ │ +000d5dd0: 6170 7072 6f78 696d 6174 6520 6974 6572 approximate iter │ │ │ +000d5de0: 6174 6976 6520 616c 676f 7269 7468 6d20 ative algorithm │ │ │ +000d5df0: 7468 6174 2065 7374 696d 6174 6573 2074 that estimates t │ │ │ +000d5e00: 6865 206e 6f72 6d61 6c69 7a65 6420 6f72 he normalized or │ │ │ +000d5e10: 6967 696e 616c 0a70 6f69 6e74 2063 6f6f iginal.point coo │ │ │ +000d5e20: 7264 696e 6174 6573 206f 7574 206f 6620 rdinates out of │ │ │ +000d5e30: 7468 6520 6e6f 726d 616c 697a 6564 2064 the normalized d │ │ │ +000d5e40: 6973 746f 7274 6564 2070 6f69 6e74 2063 istorted point c │ │ │ +000d5e50: 6f6f 7264 696e 6174 6573 2028 226e 6f72 oordinates ("nor │ │ │ +000d5e60: 6d61 6c69 7a65 6422 206d 6561 6e73 2074 malized" means t │ │ │ +000d5e70: 6861 7420 7468 650a 636f 6f72 6469 6e61 hat the.coordina │ │ │ +000d5e80: 7465 7320 646f 206e 6f74 2064 6570 656e tes do not depen │ │ │ +000d5e90: 6420 6f6e 2074 6865 2063 616d 6572 6120 d on the camera │ │ │ +000d5ea0: 6d61 7472 6978 292e 0a0a 5468 6520 6675 matrix)...The fu │ │ │ +000d5eb0: 6e63 7469 6f6e 2063 616e 2062 6520 7573 nction can be us │ │ │ +000d5ec0: 6564 2066 6f72 2062 6f74 6820 6120 7374 ed for both a st │ │ │ +000d5ed0: 6572 656f 2063 616d 6572 6120 6865 6164 ereo camera head │ │ │ +000d5ee0: 206f 7220 6120 6d6f 6e6f 6375 6c61 7220 or a monocular │ │ │ +000d5ef0: 6361 6d65 7261 2028 7768 656e 2052 2069 camera (when R i │ │ │ +000d5f00: 7320 656d 7074 7929 2e0a 0a3c 623e 4e6f s empty)...No │ │ │ +000d5f10: 7465 3a3c 2f62 3e20 3c62 3e43 6f6f 7264 te: Coord │ │ │ +000d5f20: 696e 6174 6520 5379 7374 656d 733a 3c2f inate Systems:.
      .
    • . │ │ │ +000d5f40: 3c62 3e49 6e70 7574 2028 3c63 6f64 653e Input ( │ │ │ +000d5f50: 7372 633c 2f63 6f64 653e 293c 2f62 3e3a src): │ │ │ +000d5f60: 2050 6f69 6e74 7320 6172 6520 6578 7065 Points are expe │ │ │ +000d5f70: 6374 6564 2069 6e20 3c62 3e70 6978 656c cted in pixel │ │ │ +000d5f80: 2063 6f6f 7264 696e 6174 6573 3c2f 623e coordinates │ │ │ +000d5f90: 206f 6620 7468 6520 6469 7374 6f72 7465 of the distorte │ │ │ +000d5fa0: 6420 696d 6167 652c 2069 2e65 2e2c 0a20 d image, i.e.,. │ │ │ +000d5fb0: 2063 6f6f 7264 696e 6174 6573 205c 2828 coordinates \(( │ │ │ +000d5fc0: 752c 2076 295c 2920 6d65 6173 7572 6564 u, v)\) measured │ │ │ +000d5fd0: 2069 6e20 7069 7865 6c73 2066 726f 6d20 in pixels from │ │ │ +000d5fe0: 7468 6520 746f 702d 6c65 6674 2063 6f72 the top-left cor │ │ │ +000d5ff0: 6e65 7220 6f66 2074 6865 2069 6d61 6765 ner of the image │ │ │ +000d6000: 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c 693e ..
    • .
    • │ │ │ +000d6010: 0a20 3c62 3e4f 7574 7075 7420 283c 636f . Output (dst): The coordina │ │ │ +000d6040: 7465 2073 7973 7465 6d20 6f66 206f 7574 te system of out │ │ │ +000d6050: 7075 7420 706f 696e 7473 2064 6570 656e put points depen │ │ │ +000d6060: 6473 206f 6e20 7061 7261 6d65 7465 7220 ds on parameter │ │ │ +000d6070: 3c63 6f64 653e 503c 2f63 6f64 653e 3a0a P:. │ │ │ +000d6080: 2020 3c75 6c3e 0a20 2020 203c 6c69 3e0a
        .
      • . │ │ │ +000d6090: 2020 2049 6620 3c63 6f64 653e 503c 2f63 If P is provided │ │ │ +000d60b0: 2028 6e6f 7420 656d 7074 7929 3a20 4f75 (not empty): Ou │ │ │ +000d60c0: 7470 7574 2070 6f69 6e74 7320 6172 6520 tput points are │ │ │ +000d60d0: 696e 203c 623e 7069 7865 6c20 636f 6f72 in pixel coor │ │ │ +000d60e0: 6469 6e61 7465 733c 2f62 3e20 6f66 2074 dinates of t │ │ │ +000d60f0: 6865 2072 6563 7469 6669 6564 2f75 6e64 he rectified/und │ │ │ +000d6100: 6973 746f 7274 6564 2069 6d61 6765 2070 istorted image p │ │ │ +000d6110: 6c61 6e65 2c20 7573 696e 6720 7468 6520 lane, using the │ │ │ +000d6120: 6361 6d65 7261 206d 6174 7269 7820 3c63 camera matrix P.. │ │ │ +000d6140: 2020 3c2f 6c69 3e0a 2020 2020 3c6c 693e
      • .
      • │ │ │ +000d6150: 0a20 2020 4966 203c 636f 6465 3e50 3c2f . If P is empty o │ │ │ +000d6170: 7220 6964 656e 7469 7479 3a20 4f75 7470 r identity: Outp │ │ │ +000d6180: 7574 2070 6f69 6e74 7320 6172 6520 696e ut points are in │ │ │ +000d6190: 203c 623e 6e6f 726d 616c 697a 6564 2063 normalized c │ │ │ +000d61a0: 616d 6572 6120 636f 6f72 6469 6e61 7465 amera coordinate │ │ │ +000d61b0: 733c 2f62 3e20 2861 6c73 6f20 6361 6c6c s (also call │ │ │ +000d61c0: 6564 2022 6e6f 726d 616c 697a 6564 2069 ed "normalized i │ │ │ +000d61d0: 6d61 6765 2063 6f6f 7264 696e 6174 6573 mage coordinates │ │ │ +000d61e0: 2229 2c0a 2020 2020 7768 6963 6820 6172 "),. which ar │ │ │ +000d61f0: 6520 6469 6d65 6e73 696f 6e6c 6573 7320 e dimensionless │ │ │ +000d6200: 636f 6f72 6469 6e61 7465 7320 5c28 2878 coordinates \((x │ │ │ +000d6210: 2c20 7929 5c29 2069 6e20 7468 6520 6361 , y)\) in the ca │ │ │ +000d6220: 6d65 7261 2773 2066 6f63 616c 2070 6c61 mera's focal pla │ │ │ +000d6230: 6e65 2c20 7265 6c61 7465 6420 746f 2070 ne, related to p │ │ │ +000d6240: 6978 656c 2063 6f6f 7264 696e 6174 6573 ixel coordinates │ │ │ +000d6250: 2062 793a 0a20 2020 205c 2878 203d 2028 by:. \(x = ( │ │ │ +000d6260: 7520 2d20 635f 7829 202f 2066 5f78 5c29 u - c_x) / f_x\) │ │ │ +000d6270: 2061 6e64 205c 2879 203d 2028 7620 2d20 and \(y = (v - │ │ │ +000d6280: 635f 7929 202f 2066 5f79 5c29 2e20 5468 c_y) / f_y\). Th │ │ │ +000d6290: 6573 6520 6e6f 726d 616c 697a 6564 2063 ese normalized c │ │ │ +000d62a0: 6f6f 7264 696e 6174 6573 2061 7265 2069 oordinates are i │ │ │ +000d62b0: 6e64 6570 656e 6465 6e74 206f 6620 7468 ndependent of th │ │ │ +000d62c0: 6520 6361 6d65 7261 2773 2069 6e74 7269 e camera's intri │ │ │ +000d62d0: 6e73 6963 2070 6172 616d 6574 6572 7320 nsic parameters │ │ │ +000d62e0: 616e 6420 6172 6520 7573 6566 756c 2066 and are useful f │ │ │ +000d62f0: 6f72 2033 4420 7265 636f 6e73 7472 7563 or 3D reconstruc │ │ │ +000d6300: 7469 6f6e 206f 7220 6570 6970 6f6c 6172 tion or epipolar │ │ │ +000d6310: 2067 656f 6d65 7472 792e 0a20 2020 203c geometry.. < │ │ │ +000d6320: 2f6c 693e 0a20 203c 2f75 6c3e 0a0a 2020 /li>.
      .. │ │ │ +000d6330: 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64 6976
    • .
    .
    .
    Paramet │ │ │ +000d6360: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    src - │ │ │ +000d6380: 204f 6273 6572 7665 6420 706f 696e 7420 Observed point │ │ │ +000d6390: 636f 6f72 6469 6e61 7465 7320 696e 203c coordinates in < │ │ │ +000d63a0: 623e 7069 7865 6c20 636f 6f72 6469 6e61 b>pixel coordina │ │ │ +000d63b0: 7465 733c 2f62 3e20 6f66 2074 6865 2064 tes of the d │ │ │ +000d63c0: 6973 746f 7274 6564 2069 6d61 6765 2c20 istorted image, │ │ │ +000d63d0: 3278 4e2f 4e78 3220 312d 6368 616e 6e65 2xN/Nx2 1-channe │ │ │ +000d63e0: 6c20 6f72 2031 784e 2f4e 7831 2032 2d63 l or 1xN/Nx1 2-c │ │ │ +000d63f0: 6861 6e6e 656c 2028 4356 5f33 3246 4332 hannel (CV_32FC2 │ │ │ +000d6400: 206f 7220 4356 5f36 3446 4332 2920 286f or CV_64FC2) (o │ │ │ +000d6410: 720a 7665 6374 6f72 266c 743b 506f 696e r.vector<Poin │ │ │ +000d6420: 7432 6626 6774 3b20 292e 3c2f 6464 3e0a t2f> ).
    . │ │ │ +000d6430: 3c64 643e 3c63 6f64 653e 6473 743c 2f63
    dst - Output id │ │ │ +000d6450: 6561 6c20 706f 696e 7420 636f 6f72 6469 eal point coordi │ │ │ +000d6460: 6e61 7465 7320 2831 784e 2f4e 7831 2032 nates (1xN/Nx1 2 │ │ │ +000d6470: 2d63 6861 6e6e 656c 206f 7220 7665 6374 -channel or vect │ │ │ +000d6480: 6f72 266c 743b 506f 696e 7432 6626 6774 or<Point2f> │ │ │ +000d6490: 3b20 2920 6166 7465 7220 756e 6469 7374 ; ) after undist │ │ │ +000d64a0: 6f72 7469 6f6e 2061 6e64 2072 6576 6572 ortion and rever │ │ │ +000d64b0: 7365 2070 6572 7370 6563 7469 7665 0a74 se perspective.t │ │ │ +000d64c0: 7261 6e73 666f 726d 6174 696f 6e2e 2049 ransformation. I │ │ │ +000d64d0: 6620 6d61 7472 6978 2050 2069 7320 6964 f matrix P is id │ │ │ +000d64e0: 656e 7469 7479 206f 7220 6f6d 6974 7465 entity or omitte │ │ │ +000d64f0: 642c 2064 7374 2077 696c 6c20 636f 6e74 d, dst will cont │ │ │ +000d6500: 6169 6e20 6e6f 726d 616c 697a 6564 2070 ain normalized p │ │ │ +000d6510: 6f69 6e74 2063 6f6f 7264 696e 6174 6573 oint coordinates │ │ │ +000d6520: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    cameraMatrix - Camera ma │ │ │ +000d6550: 7472 6978 205c 285c 7665 6374 6872 6565 trix \(\vecthree │ │ │ +000d6560: 7468 7265 657b 665f 787d 7b30 7d7b 635f three{f_x}{0}{c_ │ │ │ +000d6570: 787d 7b30 7d7b 665f 797d 7b63 5f79 7d7b x}{0}{f_y}{c_y}{ │ │ │ +000d6580: 307d 7b30 7d7b 317d 5c29 202e 3c2f 6464 0}{0}{1}\) .
    .
    dist │ │ │ +000d65a0: 436f 6566 6673 3c2f 636f 6465 3e20 2d20 Coeffs - │ │ │ +000d65b0: 496e 7075 7420 7665 6374 6f72 206f 6620 Input vector of │ │ │ +000d65c0: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ +000d65d0: 6963 6965 6e74 730a 5c28 286b 5f31 2c20 icients.\((k_1, │ │ │ +000d65e0: 6b5f 322c 2070 5f31 2c20 705f 325b 2c20 k_2, p_1, p_2[, │ │ │ +000d65f0: 6b5f 335b 2c20 6b5f 342c 206b 5f35 2c20 k_3[, k_4, k_5, │ │ │ +000d6600: 6b5f 365b 2c20 735f 312c 2073 5f32 2c20 k_6[, s_1, s_2, │ │ │ +000d6610: 735f 332c 2073 5f34 5b2c 205c 7461 755f s_3, s_4[, \tau_ │ │ │ +000d6620: 782c 205c 7461 755f 795d 5d5d 5d29 5c29 x, \tau_y]]]])\) │ │ │ +000d6630: 0a6f 6620 342c 2035 2c20 382c 2031 3220 .of 4, 5, 8, 12 │ │ │ +000d6640: 6f72 2031 3420 656c 656d 656e 7473 2e20 or 14 elements. │ │ │ +000d6650: 4966 2074 6865 2076 6563 746f 7220 6973 If the vector is │ │ │ +000d6660: 204e 554c 4c2f 656d 7074 792c 2074 6865 NULL/empty, the │ │ │ +000d6670: 207a 6572 6f20 6469 7374 6f72 7469 6f6e zero distortion │ │ │ +000d6680: 2063 6f65 6666 6963 6965 6e74 7320 6172 coefficients ar │ │ │ +000d6690: 6520 6173 7375 6d65 642e 3c2f 6464 3e0a e assumed.
    . │ │ │ +000d66a0: 3c64 643e 3c63 6f64 653e 523c 2f63 6f64
    R - Rectificati │ │ │ +000d66c0: 6f6e 2074 7261 6e73 666f 726d 6174 696f on transformatio │ │ │ +000d66d0: 6e20 696e 2074 6865 206f 626a 6563 7420 n in the object │ │ │ +000d66e0: 7370 6163 6520 2833 7833 206d 6174 7269 space (3x3 matri │ │ │ +000d66f0: 7829 2e20 5231 206f 7220 5232 2063 6f6d x). R1 or R2 com │ │ │ +000d6700: 7075 7465 6420 6279 0a23 7374 6572 656f puted by.#stereo │ │ │ +000d6710: 5265 6374 6966 7920 6361 6e20 6265 2070 Rectify can be p │ │ │ +000d6720: 6173 7365 6420 6865 7265 2e20 4966 2074 assed here. If t │ │ │ +000d6730: 6865 206d 6174 7269 7820 6973 2065 6d70 he matrix is emp │ │ │ +000d6740: 7479 2c20 7468 6520 6964 656e 7469 7479 ty, the identity │ │ │ +000d6750: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ +000d6760: 6973 2075 7365 642e 3c2f 6464 3e0a 3c64 is used.
    .P │ │ │ +000d6780: 202d 204e 6577 2063 616d 6572 6120 6d61 - New camera ma │ │ │ +000d6790: 7472 6978 2028 3378 3329 206f 7220 6e65 trix (3x3) or ne │ │ │ +000d67a0: 7720 7072 6f6a 6563 7469 6f6e 206d 6174 w projection mat │ │ │ +000d67b0: 7269 7820 2833 7834 2920 5c28 5c62 6567 rix (3x4) \(\beg │ │ │ +000d67c0: 696e 7b62 6d61 7472 6978 7d20 7b66 277d in{bmatrix} {f'} │ │ │ +000d67d0: 5f78 2026 616d 703b 2030 2026 616d 703b _x & 0 & │ │ │ +000d67e0: 207b 6327 7d5f 7820 2661 6d70 3b20 745f {c'}_x & t_ │ │ │ +000d67f0: 7820 5c5c 2030 2026 616d 703b 207b 6627 x \\ 0 & {f' │ │ │ +000d6800: 7d5f 7920 2661 6d70 3b20 7b63 277d 5f79 }_y & {c'}_y │ │ │ +000d6810: 2026 616d 703b 2074 5f79 205c 5c20 3020 & t_y \\ 0 │ │ │ +000d6820: 2661 6d70 3b20 3020 2661 6d70 3b20 3120 & 0 & 1 │ │ │ +000d6830: 2661 6d70 3b20 745f 7a20 5c65 6e64 7b62 & t_z \end{b │ │ │ +000d6840: 6d61 7472 6978 7d5c 292e 2050 3120 6f72 matrix}\). P1 or │ │ │ +000d6850: 2050 3220 636f 6d70 7574 6564 2062 790a P2 computed by. │ │ │ +000d6860: 2373 7465 7265 6f52 6563 7469 6679 2063 #stereoRectify c │ │ │ +000d6870: 616e 2062 6520 7061 7373 6564 2068 6572 an be passed her │ │ │ +000d6880: 652e 2049 6620 7468 6520 6d61 7472 6978 e. If the matrix │ │ │ +000d6890: 2069 7320 656d 7074 792c 2074 6865 2069 is empty, the i │ │ │ +000d68a0: 6465 6e74 6974 7920 6e65 7720 6361 6d65 dentity new came │ │ │ +000d68b0: 7261 206d 6174 7269 7820 6973 2075 7365 ra matrix is use │ │ │ +000d68c0: 6420 616e 6420 6f75 7470 7574 2077 696c d and output wil │ │ │ +000d68d0: 6c20 6265 2069 6e20 6e6f 726d 616c 697a l be in normaliz │ │ │ +000d68e0: 6564 2063 6f6f 7264 696e 6174 6573 2e3c ed coordinates.< │ │ │ +000d68f0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ +000d6900: 7269 7465 7269 613c 2f63 6f64 653e 202d riteria - │ │ │ +000d6910: 2074 6572 6d69 6e61 7469 6f6e 2063 7269 termination cri │ │ │ +000d6920: 7465 7269 6120 666f 7220 7468 6520 6974 teria for the it │ │ │ +000d6930: 6572 6174 6976 6520 706f 696e 7420 756e erative point un │ │ │ +000d6940: 6469 7374 6f72 7469 6f6e 2061 6c67 6f72 distortion algor │ │ │ +000d6950: 6974 686d 3c2f 6464 3e0a 3c2f 646c 3e0a ithm
    .
    . │ │ │ +000d6960: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e .
    .
  • .
  • ..

    undist │ │ │ +000d6a40: 6f72 7450 6f69 6e74 733c 2f68 333e 0a3c ortPoints

    .< │ │ │ +000d6a50: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +000d6a60: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +000d6a70: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +000d6a80: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +000d6ab0: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +000d6ac0: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +000d6ad0: 726e 2d74 7970 6522 3e76 6f69 643c 2f73 rn-type">void
     undistortPo │ │ │ +000d6b10: 696e 7473 3c2f 7370 616e 3e3c 7762 723e ints │ │ │ +000d6b20: 3c73 7061 6e20 636c 6173 733d 2270 6172 (M │ │ │ +000d6b80: 6174 4f66 506f 696e 7432 663c 2f61 3e26 atOfPoint2f& │ │ │ +000d6b90: 6e62 7370 3b73 7263 2c0a 203c 6120 6872 nbsp;src,. │ │ │ +000d6be0: 4d61 744f 6650 6f69 6e74 3266 3c2f 613e MatOfPoint2f │ │ │ +000d6bf0: 266e 6273 703b 6473 742c 0a20 3c61 2068  dst,. Mat& │ │ │ +000d6c40: 6e62 7370 3b63 616d 6572 614d 6174 7269 nbsp;cameraMatri │ │ │ +000d6c50: 782c 0a20 3c61 2068 7265 663d 222e 2e2f x,. │ │ │ +000d6c90: 4d61 743c 2f61 3e26 6e62 7370 3b64 6973 Mat dis │ │ │ +000d6ca0: 7443 6f65 6666 732c 0a20 3c61 2068 7265 tCoeffs,. Mat&nb │ │ │ +000d6cf0: 7370 3b52 2c0a 203c 6120 6872 6566 3d22 sp;R,. Mat  │ │ │ +000d6d40: 5029 3c2f 7370 616e 3e3c 2f64 6976 3e0a P). │ │ │ +000d6d50: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Computes the │ │ │ +000d6d70: 6964 6561 6c20 706f 696e 7420 636f 6f72 ideal point coor │ │ │ +000d6d80: 6469 6e61 7465 7320 6672 6f6d 2074 6865 dinates from the │ │ │ +000d6d90: 206f 6273 6572 7665 6420 706f 696e 7420 observed point │ │ │ +000d6da0: 636f 6f72 6469 6e61 7465 732e 0a0a 5468 coordinates...Th │ │ │ +000d6db0: 6520 6675 6e63 7469 6f6e 2069 7320 7369 e function is si │ │ │ +000d6dc0: 6d69 6c61 7220 746f 2023 756e 6469 7374 milar to #undist │ │ │ +000d6dd0: 6f72 7420 616e 6420 2369 6e69 7455 6e64 ort and #initUnd │ │ │ +000d6de0: 6973 746f 7274 5265 6374 6966 794d 6170 istortRectifyMap │ │ │ +000d6df0: 2062 7574 2069 7420 6f70 6572 6174 6573 but it operates │ │ │ +000d6e00: 206f 6e20 610a 7370 6172 7365 2073 6574 on a.sparse set │ │ │ +000d6e10: 206f 6620 706f 696e 7473 2069 6e73 7465 of points inste │ │ │ +000d6e20: 6164 206f 6620 6120 7261 7374 6572 2069 ad of a raster i │ │ │ +000d6e30: 6d61 6765 2e20 416c 736f 2074 6865 2066 mage. Also the f │ │ │ +000d6e40: 756e 6374 696f 6e20 7065 7266 6f72 6d73 unction performs │ │ │ +000d6e50: 2061 2072 6576 6572 7365 2074 7261 6e73 a reverse trans │ │ │ +000d6e60: 666f 726d 6174 696f 6e0a 746f 2020 2370 formation.to #p │ │ │ +000d6e70: 726f 6a65 6374 506f 696e 7473 2e20 496e rojectPoints. In │ │ │ +000d6e80: 2063 6173 6520 6f66 2061 2033 4420 6f62 case of a 3D ob │ │ │ +000d6e90: 6a65 6374 2c20 6974 2064 6f65 7320 6e6f ject, it does no │ │ │ +000d6ea0: 7420 7265 636f 6e73 7472 7563 7420 6974 t reconstruct it │ │ │ +000d6eb0: 7320 3344 2063 6f6f 7264 696e 6174 6573 s 3D coordinates │ │ │ +000d6ec0: 2c20 6275 7420 666f 7220 610a 706c 616e , but for a.plan │ │ │ +000d6ed0: 6172 206f 626a 6563 742c 2069 7420 646f ar object, it do │ │ │ +000d6ee0: 6573 2c20 7570 2074 6f20 6120 7472 616e es, up to a tran │ │ │ +000d6ef0: 736c 6174 696f 6e20 7665 6374 6f72 2c20 slation vector, │ │ │ +000d6f00: 6966 2074 6865 2070 726f 7065 7220 5220 if the proper R │ │ │ +000d6f10: 6973 2073 7065 6369 6669 6564 2e0a 0a46 is specified...F │ │ │ +000d6f20: 6f72 2065 6163 6820 6f62 7365 7276 6564 or each observed │ │ │ +000d6f30: 2070 6f69 6e74 2063 6f6f 7264 696e 6174 point coordinat │ │ │ +000d6f40: 6520 5c28 2875 2c20 7629 5c29 2074 6865 e \((u, v)\) the │ │ │ +000d6f50: 2066 756e 6374 696f 6e20 636f 6d70 7574 function comput │ │ │ +000d6f60: 6573 3a0a 5c28 0a5c 6265 6769 6e7b 6172 es:.\(.\begin{ar │ │ │ +000d6f70: 7261 797d 7b6c 7d0a 785e 7b22 7d20 205c ray}{l}.x^{"} \ │ │ │ +000d6f80: 6c65 6674 6172 726f 7720 2875 202d 2063 leftarrow (u - c │ │ │ +000d6f90: 5f78 292f 665f 7820 205c 5c0a 795e 7b22 _x)/f_x \\.y^{" │ │ │ +000d6fa0: 7d20 205c 6c65 6674 6172 726f 7720 2876 } \leftarrow (v │ │ │ +000d6fb0: 202d 2063 5f79 292f 665f 7920 205c 5c0a - c_y)/f_y \\. │ │ │ +000d6fc0: 2878 272c 7927 2920 3d20 756e 6469 7374 (x',y') = undist │ │ │ +000d6fd0: 6f72 7428 785e 7b22 7d2c 795e 7b22 7d2c ort(x^{"},y^{"}, │ │ │ +000d6fe0: 205c 7465 7874 7474 7b64 6973 7443 6f65 \texttt{distCoe │ │ │ +000d6ff0: 6666 737d 2920 5c5c 0a7b 5b58 5c2c 595c ffs}) \\.{[X\,Y\ │ │ │ +000d7000: 2c57 5d7d 205e 5420 205c 6c65 6674 6172 ,W]} ^T \leftar │ │ │ +000d7010: 726f 7720 522a 5b78 2720 5c2c 2079 2720 row R*[x' \, y' │ │ │ +000d7020: 5c2c 2031 5d5e 5420 205c 5c0a 7820 205c \, 1]^T \\.x \ │ │ │ +000d7030: 6c65 6674 6172 726f 7720 582f 5720 205c leftarrow X/W \ │ │ │ +000d7040: 5c0a 7920 205c 6c65 6674 6172 726f 7720 \.y \leftarrow │ │ │ +000d7050: 592f 5720 205c 5c0a 5c74 6578 747b 6f6e Y/W \\.\text{on │ │ │ +000d7060: 6c79 2070 6572 666f 726d 6564 2069 6620 ly performed if │ │ │ +000d7070: 5020 6973 2073 7065 6369 6669 6564 3a7d P is specified:} │ │ │ +000d7080: 205c 5c0a 7527 2020 5c6c 6566 7461 7272 \\.u' \leftarr │ │ │ +000d7090: 6f77 2078 207b 6627 7d5f 7820 2b20 7b63 ow x {f'}_x + {c │ │ │ +000d70a0: 277d 5f78 2020 5c5c 0a76 2720 205c 6c65 '}_x \\.v' \le │ │ │ +000d70b0: 6674 6172 726f 7720 7920 7b66 277d 5f79 ftarrow y {f'}_y │ │ │ +000d70c0: 202b 207b 6327 7d5f 790a 5c65 6e64 7b61 + {c'}_y.\end{a │ │ │ +000d70d0: 7272 6179 7d0a 5c29 0a0a 7768 6572 6520 rray}.\)..where │ │ │ +000d70e0: 2a75 6e64 6973 746f 7274 2a20 6973 2061 *undistort* is a │ │ │ +000d70f0: 6e20 6170 7072 6f78 696d 6174 6520 6974 n approximate it │ │ │ +000d7100: 6572 6174 6976 6520 616c 676f 7269 7468 erative algorith │ │ │ +000d7110: 6d20 7468 6174 2065 7374 696d 6174 6573 m that estimates │ │ │ +000d7120: 2074 6865 206e 6f72 6d61 6c69 7a65 6420 the normalized │ │ │ +000d7130: 6f72 6967 696e 616c 0a70 6f69 6e74 2063 original.point c │ │ │ +000d7140: 6f6f 7264 696e 6174 6573 206f 7574 206f oordinates out o │ │ │ +000d7150: 6620 7468 6520 6e6f 726d 616c 697a 6564 f the normalized │ │ │ +000d7160: 2064 6973 746f 7274 6564 2070 6f69 6e74 distorted point │ │ │ +000d7170: 2063 6f6f 7264 696e 6174 6573 2028 226e coordinates ("n │ │ │ +000d7180: 6f72 6d61 6c69 7a65 6422 206d 6561 6e73 ormalized" means │ │ │ +000d7190: 2074 6861 7420 7468 650a 636f 6f72 6469 that the.coordi │ │ │ +000d71a0: 6e61 7465 7320 646f 206e 6f74 2064 6570 nates do not dep │ │ │ +000d71b0: 656e 6420 6f6e 2074 6865 2063 616d 6572 end on the camer │ │ │ +000d71c0: 6120 6d61 7472 6978 292e 0a0a 5468 6520 a matrix)...The │ │ │ +000d71d0: 6675 6e63 7469 6f6e 2063 616e 2062 6520 function can be │ │ │ +000d71e0: 7573 6564 2066 6f72 2062 6f74 6820 6120 used for both a │ │ │ +000d71f0: 7374 6572 656f 2063 616d 6572 6120 6865 stereo camera he │ │ │ +000d7200: 6164 206f 7220 6120 6d6f 6e6f 6375 6c61 ad or a monocula │ │ │ +000d7210: 7220 6361 6d65 7261 2028 7768 656e 2052 r camera (when R │ │ │ +000d7220: 2069 7320 656d 7074 7929 2e0a 0a3c 623e is empty)... │ │ │ +000d7230: 4e6f 7465 3a3c 2f62 3e20 3c62 3e43 6f6f Note: Coo │ │ │ +000d7240: 7264 696e 6174 6520 5379 7374 656d 733a rdinate Systems: │ │ │ +000d7250: 3c2f 623e 0a3c 756c 3e0a 2020 3c6c 693e .
      .
    • │ │ │ +000d7260: 0a20 3c62 3e49 6e70 7574 2028 3c63 6f64 . Input (src): Points are ex │ │ │ +000d7290: 7065 6374 6564 2069 6e20 3c62 3e70 6978 pected in pix │ │ │ +000d72a0: 656c 2063 6f6f 7264 696e 6174 6573 3c2f el coordinates of the distor │ │ │ +000d72c0: 7465 6420 696d 6167 652c 2069 2e65 2e2c ted image, i.e., │ │ │ +000d72d0: 0a20 2063 6f6f 7264 696e 6174 6573 205c . coordinates \ │ │ │ +000d72e0: 2828 752c 2076 295c 2920 6d65 6173 7572 ((u, v)\) measur │ │ │ +000d72f0: 6564 2069 6e20 7069 7865 6c73 2066 726f ed in pixels fro │ │ │ +000d7300: 6d20 7468 6520 746f 702d 6c65 6674 2063 m the top-left c │ │ │ +000d7310: 6f72 6e65 7220 6f66 2074 6865 2069 6d61 orner of the ima │ │ │ +000d7320: 6765 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c ge..
    • . . Output (< │ │ │ +000d7340: 636f 6465 3e64 7374 3c2f 636f 6465 3e29 code>dst
      ) │ │ │ +000d7350: 3c2f 623e 3a20 5468 6520 636f 6f72 6469 : The coordi │ │ │ +000d7360: 6e61 7465 2073 7973 7465 6d20 6f66 206f nate system of o │ │ │ +000d7370: 7574 7075 7420 706f 696e 7473 2064 6570 utput points dep │ │ │ +000d7380: 656e 6473 206f 6e20 7061 7261 6d65 7465 ends on paramete │ │ │ +000d7390: 7220 3c63 6f64 653e 503c 2f63 6f64 653e r P │ │ │ +000d73a0: 3a0a 2020 3c75 6c3e 0a20 2020 203c 6c69 :.
        .
      • . If P< │ │ │ +000d73c0: 2f63 6f64 653e 2069 7320 7072 6f76 6964 /code> is provid │ │ │ +000d73d0: 6564 2028 6e6f 7420 656d 7074 7929 3a20 ed (not empty): │ │ │ +000d73e0: 4f75 7470 7574 2070 6f69 6e74 7320 6172 Output points ar │ │ │ +000d73f0: 6520 696e 203c 623e 7069 7865 6c20 636f e in pixel co │ │ │ +000d7400: 6f72 6469 6e61 7465 733c 2f62 3e20 6f66 ordinates of │ │ │ +000d7410: 2074 6865 2072 6563 7469 6669 6564 2f75 the rectified/u │ │ │ +000d7420: 6e64 6973 746f 7274 6564 2069 6d61 6765 ndistorted image │ │ │ +000d7430: 2070 6c61 6e65 2c20 7573 696e 6720 7468 plane, using th │ │ │ +000d7440: 6520 6361 6d65 7261 206d 6174 7269 7820 e camera matrix │ │ │ +000d7450: 3c63 6f64 653e 503c 2f63 6f64 653e 2e0a P.. │ │ │ +000d7460: 2020 2020 3c2f 6c69 3e0a 2020 2020 3c6c
      • . . If P │ │ │ +000d7480: 3c2f 636f 6465 3e20 6973 2065 6d70 7479 is empty │ │ │ +000d7490: 206f 7220 6964 656e 7469 7479 3a20 4f75 or identity: Ou │ │ │ +000d74a0: 7470 7574 2070 6f69 6e74 7320 6172 6520 tput points are │ │ │ +000d74b0: 696e 203c 623e 6e6f 726d 616c 697a 6564 in normalized │ │ │ +000d74c0: 2063 616d 6572 6120 636f 6f72 6469 6e61 camera coordina │ │ │ +000d74d0: 7465 733c 2f62 3e20 2861 6c73 6f20 6361 tes (also ca │ │ │ +000d74e0: 6c6c 6564 2022 6e6f 726d 616c 697a 6564 lled "normalized │ │ │ +000d74f0: 2069 6d61 6765 2063 6f6f 7264 696e 6174 image coordinat │ │ │ +000d7500: 6573 2229 2c0a 2020 2020 7768 6963 6820 es"),. which │ │ │ +000d7510: 6172 6520 6469 6d65 6e73 696f 6e6c 6573 are dimensionles │ │ │ +000d7520: 7320 636f 6f72 6469 6e61 7465 7320 5c28 s coordinates \( │ │ │ +000d7530: 2878 2c20 7929 5c29 2069 6e20 7468 6520 (x, y)\) in the │ │ │ +000d7540: 6361 6d65 7261 2773 2066 6f63 616c 2070 camera's focal p │ │ │ +000d7550: 6c61 6e65 2c20 7265 6c61 7465 6420 746f lane, related to │ │ │ +000d7560: 2070 6978 656c 2063 6f6f 7264 696e 6174 pixel coordinat │ │ │ +000d7570: 6573 2062 793a 0a20 2020 205c 2878 203d es by:. \(x = │ │ │ +000d7580: 2028 7520 2d20 635f 7829 202f 2066 5f78 (u - c_x) / f_x │ │ │ +000d7590: 5c29 2061 6e64 205c 2879 203d 2028 7620 \) and \(y = (v │ │ │ +000d75a0: 2d20 635f 7929 202f 2066 5f79 5c29 2e20 - c_y) / f_y\). │ │ │ +000d75b0: 5468 6573 6520 6e6f 726d 616c 697a 6564 These normalized │ │ │ +000d75c0: 2063 6f6f 7264 696e 6174 6573 2061 7265 coordinates are │ │ │ +000d75d0: 2069 6e64 6570 656e 6465 6e74 206f 6620 independent of │ │ │ +000d75e0: 7468 6520 6361 6d65 7261 2773 2069 6e74 the camera's int │ │ │ +000d75f0: 7269 6e73 6963 2070 6172 616d 6574 6572 rinsic parameter │ │ │ +000d7600: 7320 616e 6420 6172 6520 7573 6566 756c s and are useful │ │ │ +000d7610: 2066 6f72 2033 4420 7265 636f 6e73 7472 for 3D reconstr │ │ │ +000d7620: 7563 7469 6f6e 206f 7220 6570 6970 6f6c uction or epipol │ │ │ +000d7630: 6172 2067 656f 6d65 7472 792e 0a20 2020 ar geometry.. │ │ │ +000d7640: 203c 2f6c 693e 0a20 203c 2f75 6c3e 0a0a .
      .. │ │ │ +000d7650: 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64 .
    .
    .
    Param │ │ │ +000d7680: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ +000d7690: 3c63 6f64 653e 7372 633c 2f63 6f64 653e src │ │ │ +000d76a0: 202d 204f 6273 6572 7665 6420 706f 696e - Observed poin │ │ │ +000d76b0: 7420 636f 6f72 6469 6e61 7465 7320 696e t coordinates in │ │ │ +000d76c0: 203c 623e 7069 7865 6c20 636f 6f72 6469 pixel coordi │ │ │ +000d76d0: 6e61 7465 733c 2f62 3e20 6f66 2074 6865 nates of the │ │ │ +000d76e0: 2064 6973 746f 7274 6564 2069 6d61 6765 distorted image │ │ │ +000d76f0: 2c20 3278 4e2f 4e78 3220 312d 6368 616e , 2xN/Nx2 1-chan │ │ │ +000d7700: 6e65 6c20 6f72 2031 784e 2f4e 7831 2032 nel or 1xN/Nx1 2 │ │ │ +000d7710: 2d63 6861 6e6e 656c 2028 4356 5f33 3246 -channel (CV_32F │ │ │ +000d7720: 4332 206f 7220 4356 5f36 3446 4332 2920 C2 or CV_64FC2) │ │ │ +000d7730: 286f 720a 7665 6374 6f72 266c 743b 506f (or.vector<Po │ │ │ +000d7740: 696e 7432 6626 6774 3b20 292e 3c2f 6464 int2f> ).
    .
    dst< │ │ │ +000d7760: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ +000d7770: 6964 6561 6c20 706f 696e 7420 636f 6f72 ideal point coor │ │ │ +000d7780: 6469 6e61 7465 7320 2831 784e 2f4e 7831 dinates (1xN/Nx1 │ │ │ +000d7790: 2032 2d63 6861 6e6e 656c 206f 7220 7665 2-channel or ve │ │ │ +000d77a0: 6374 6f72 266c 743b 506f 696e 7432 6626 ctor<Point2f& │ │ │ +000d77b0: 6774 3b20 2920 6166 7465 7220 756e 6469 gt; ) after undi │ │ │ +000d77c0: 7374 6f72 7469 6f6e 2061 6e64 2072 6576 stortion and rev │ │ │ +000d77d0: 6572 7365 2070 6572 7370 6563 7469 7665 erse perspective │ │ │ +000d77e0: 0a74 7261 6e73 666f 726d 6174 696f 6e2e .transformation. │ │ │ +000d77f0: 2049 6620 6d61 7472 6978 2050 2069 7320 If matrix P is │ │ │ +000d7800: 6964 656e 7469 7479 206f 7220 6f6d 6974 identity or omit │ │ │ +000d7810: 7465 642c 2064 7374 2077 696c 6c20 636f ted, dst will co │ │ │ +000d7820: 6e74 6169 6e20 6e6f 726d 616c 697a 6564 ntain normalized │ │ │ +000d7830: 2070 6f69 6e74 2063 6f6f 7264 696e 6174 point coordinat │ │ │ +000d7840: 6573 2e3c 2f64 643e 0a3c 6464 3e3c 636f es.
    .
    cameraMatrix< │ │ │ +000d7860: 2f63 6f64 653e 202d 2043 616d 6572 6120 /code> - Camera │ │ │ +000d7870: 6d61 7472 6978 205c 285c 7665 6374 6872 matrix \(\vecthr │ │ │ +000d7880: 6565 7468 7265 657b 665f 787d 7b30 7d7b eethree{f_x}{0}{ │ │ │ +000d7890: 635f 787d 7b30 7d7b 665f 797d 7b63 5f79 c_x}{0}{f_y}{c_y │ │ │ +000d78a0: 7d7b 307d 7b30 7d7b 317d 5c29 202e 3c2f }{0}{0}{1}\) ..
    di │ │ │ +000d78c0: 7374 436f 6566 6673 3c2f 636f 6465 3e20 stCoeffs │ │ │ +000d78d0: 2d20 496e 7075 7420 7665 6374 6f72 206f - Input vector o │ │ │ +000d78e0: 6620 6469 7374 6f72 7469 6f6e 2063 6f65 f distortion coe │ │ │ +000d78f0: 6666 6963 6965 6e74 730a 5c28 286b 5f31 fficients.\((k_1 │ │ │ +000d7900: 2c20 6b5f 322c 2070 5f31 2c20 705f 325b , k_2, p_1, p_2[ │ │ │ +000d7910: 2c20 6b5f 335b 2c20 6b5f 342c 206b 5f35 , k_3[, k_4, k_5 │ │ │ +000d7920: 2c20 6b5f 365b 2c20 735f 312c 2073 5f32 , k_6[, s_1, s_2 │ │ │ +000d7930: 2c20 735f 332c 2073 5f34 5b2c 205c 7461 , s_3, s_4[, \ta │ │ │ +000d7940: 755f 782c 205c 7461 755f 795d 5d5d 5d29 u_x, \tau_y]]]]) │ │ │ +000d7950: 5c29 0a6f 6620 342c 2035 2c20 382c 2031 \).of 4, 5, 8, 1 │ │ │ +000d7960: 3220 6f72 2031 3420 656c 656d 656e 7473 2 or 14 elements │ │ │ +000d7970: 2e20 4966 2074 6865 2076 6563 746f 7220 . If the vector │ │ │ +000d7980: 6973 204e 554c 4c2f 656d 7074 792c 2074 is NULL/empty, t │ │ │ +000d7990: 6865 207a 6572 6f20 6469 7374 6f72 7469 he zero distorti │ │ │ +000d79a0: 6f6e 2063 6f65 6666 6963 6965 6e74 7320 on coefficients │ │ │ +000d79b0: 6172 6520 6173 7375 6d65 642e 3c2f 6464 are assumed.
    .
    R - Rectifica │ │ │ +000d79e0: 7469 6f6e 2074 7261 6e73 666f 726d 6174 tion transformat │ │ │ +000d79f0: 696f 6e20 696e 2074 6865 206f 626a 6563 ion in the objec │ │ │ +000d7a00: 7420 7370 6163 6520 2833 7833 206d 6174 t space (3x3 mat │ │ │ +000d7a10: 7269 7829 2e20 5231 206f 7220 5232 2063 rix). R1 or R2 c │ │ │ +000d7a20: 6f6d 7075 7465 6420 6279 0a23 7374 6572 omputed by.#ster │ │ │ +000d7a30: 656f 5265 6374 6966 7920 6361 6e20 6265 eoRectify can be │ │ │ +000d7a40: 2070 6173 7365 6420 6865 7265 2e20 4966 passed here. If │ │ │ +000d7a50: 2074 6865 206d 6174 7269 7820 6973 2065 the matrix is e │ │ │ +000d7a60: 6d70 7479 2c20 7468 6520 6964 656e 7469 mpty, the identi │ │ │ +000d7a70: 7479 2074 7261 6e73 666f 726d 6174 696f ty transformatio │ │ │ +000d7a80: 6e20 6973 2075 7365 642e 3c2f 6464 3e0a n is used.
    . │ │ │ +000d7a90: 3c64 643e 3c63 6f64 653e 503c 2f63 6f64
    P - New camera │ │ │ +000d7ab0: 6d61 7472 6978 2028 3378 3329 206f 7220 matrix (3x3) or │ │ │ +000d7ac0: 6e65 7720 7072 6f6a 6563 7469 6f6e 206d new projection m │ │ │ +000d7ad0: 6174 7269 7820 2833 7834 2920 5c28 5c62 atrix (3x4) \(\b │ │ │ +000d7ae0: 6567 696e 7b62 6d61 7472 6978 7d20 7b66 egin{bmatrix} {f │ │ │ +000d7af0: 277d 5f78 2026 616d 703b 2030 2026 616d '}_x & 0 &am │ │ │ +000d7b00: 703b 207b 6327 7d5f 7820 2661 6d70 3b20 p; {c'}_x & │ │ │ +000d7b10: 745f 7820 5c5c 2030 2026 616d 703b 207b t_x \\ 0 & { │ │ │ +000d7b20: 6627 7d5f 7920 2661 6d70 3b20 7b63 277d f'}_y & {c'} │ │ │ +000d7b30: 5f79 2026 616d 703b 2074 5f79 205c 5c20 _y & t_y \\ │ │ │ +000d7b40: 3020 2661 6d70 3b20 3020 2661 6d70 3b20 0 & 0 & │ │ │ +000d7b50: 3120 2661 6d70 3b20 745f 7a20 5c65 6e64 1 & t_z \end │ │ │ +000d7b60: 7b62 6d61 7472 6978 7d5c 292e 2050 3120 {bmatrix}\). P1 │ │ │ +000d7b70: 6f72 2050 3220 636f 6d70 7574 6564 2062 or P2 computed b │ │ │ +000d7b80: 790a 2373 7465 7265 6f52 6563 7469 6679 y.#stereoRectify │ │ │ +000d7b90: 2063 616e 2062 6520 7061 7373 6564 2068 can be passed h │ │ │ +000d7ba0: 6572 652e 2049 6620 7468 6520 6d61 7472 ere. If the matr │ │ │ +000d7bb0: 6978 2069 7320 656d 7074 792c 2074 6865 ix is empty, the │ │ │ +000d7bc0: 2069 6465 6e74 6974 7920 6e65 7720 6361 identity new ca │ │ │ +000d7bd0: 6d65 7261 206d 6174 7269 7820 6973 2075 mera matrix is u │ │ │ +000d7be0: 7365 6420 616e 6420 6f75 7470 7574 2077 sed and output w │ │ │ +000d7bf0: 696c 6c20 6265 2069 6e20 6e6f 726d 616c ill be in normal │ │ │ +000d7c00: 697a 6564 2063 6f6f 7264 696e 6174 6573 ized coordinates │ │ │ +000d7c10: 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 .
    .
    ...< │ │ │ +000d7c30: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..< │ │ │ +000d7ce0: 6833 3e75 6e64 6973 746f 7274 506f 696e h3>undistortPoin │ │ │ +000d7cf0: 7473 3c2f 6833 3e0a 3c64 6976 2063 6c61 ts.
    .
    pu │ │ │ +000d7d50: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static void&nb │ │ │ +000d7d90: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;un │ │ │ +000d7db0: 6469 7374 6f72 7450 6f69 6e74 733c 2f73 distortPoints(MatOfPoi │ │ │ +000d7e30: 6e74 3266 3c2f 613e 266e 6273 703b 7372 nt2f sr │ │ │ +000d7e40: 632c 0a20 3c61 2068 7265 663d 222e 2e2f c,. MatOfPo │ │ │ +000d7e90: 696e 7432 663c 2f61 3e26 6e62 7370 3b64 int2f d │ │ │ +000d7ea0: 7374 2c0a 203c 6120 6872 6566 3d22 2e2e st,. Mat ca │ │ │ +000d7ef0: 6d65 7261 4d61 7472 6978 2c0a 203c 6120 meraMatrix,. Mat │ │ │ +000d7f40: 266e 6273 703b 6469 7374 436f 6566 6673  distCoeffs │ │ │ +000d7f50: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000d7f90: 6174 3c2f 613e 266e 6273 703b 5229 3c2f at R)
    .
    C │ │ │ +000d7fc0: 6f6d 7075 7465 7320 7468 6520 6964 6561 omputes the idea │ │ │ +000d7fd0: 6c20 706f 696e 7420 636f 6f72 6469 6e61 l point coordina │ │ │ +000d7fe0: 7465 7320 6672 6f6d 2074 6865 206f 6273 tes from the obs │ │ │ +000d7ff0: 6572 7665 6420 706f 696e 7420 636f 6f72 erved point coor │ │ │ +000d8000: 6469 6e61 7465 732e 0a0a 5468 6520 6675 dinates...The fu │ │ │ +000d8010: 6e63 7469 6f6e 2069 7320 7369 6d69 6c61 nction is simila │ │ │ +000d8020: 7220 746f 2023 756e 6469 7374 6f72 7420 r to #undistort │ │ │ +000d8030: 616e 6420 2369 6e69 7455 6e64 6973 746f and #initUndisto │ │ │ +000d8040: 7274 5265 6374 6966 794d 6170 2062 7574 rtRectifyMap but │ │ │ +000d8050: 2069 7420 6f70 6572 6174 6573 206f 6e20 it operates on │ │ │ +000d8060: 610a 7370 6172 7365 2073 6574 206f 6620 a.sparse set of │ │ │ +000d8070: 706f 696e 7473 2069 6e73 7465 6164 206f points instead o │ │ │ +000d8080: 6620 6120 7261 7374 6572 2069 6d61 6765 f a raster image │ │ │ +000d8090: 2e20 416c 736f 2074 6865 2066 756e 6374 . Also the funct │ │ │ +000d80a0: 696f 6e20 7065 7266 6f72 6d73 2061 2072 ion performs a r │ │ │ +000d80b0: 6576 6572 7365 2074 7261 6e73 666f 726d everse transform │ │ │ +000d80c0: 6174 696f 6e0a 746f 2020 2370 726f 6a65 ation.to #proje │ │ │ +000d80d0: 6374 506f 696e 7473 2e20 496e 2063 6173 ctPoints. In cas │ │ │ +000d80e0: 6520 6f66 2061 2033 4420 6f62 6a65 6374 e of a 3D object │ │ │ +000d80f0: 2c20 6974 2064 6f65 7320 6e6f 7420 7265 , it does not re │ │ │ +000d8100: 636f 6e73 7472 7563 7420 6974 7320 3344 construct its 3D │ │ │ +000d8110: 2063 6f6f 7264 696e 6174 6573 2c20 6275 coordinates, bu │ │ │ +000d8120: 7420 666f 7220 610a 706c 616e 6172 206f t for a.planar o │ │ │ +000d8130: 626a 6563 742c 2069 7420 646f 6573 2c20 bject, it does, │ │ │ +000d8140: 7570 2074 6f20 6120 7472 616e 736c 6174 up to a translat │ │ │ +000d8150: 696f 6e20 7665 6374 6f72 2c20 6966 2074 ion vector, if t │ │ │ +000d8160: 6865 2070 726f 7065 7220 5220 6973 2073 he proper R is s │ │ │ +000d8170: 7065 6369 6669 6564 2e0a 0a46 6f72 2065 pecified...For e │ │ │ +000d8180: 6163 6820 6f62 7365 7276 6564 2070 6f69 ach observed poi │ │ │ +000d8190: 6e74 2063 6f6f 7264 696e 6174 6520 5c28 nt coordinate \( │ │ │ +000d81a0: 2875 2c20 7629 5c29 2074 6865 2066 756e (u, v)\) the fun │ │ │ +000d81b0: 6374 696f 6e20 636f 6d70 7574 6573 3a0a ction computes:. │ │ │ +000d81c0: 5c28 0a5c 6265 6769 6e7b 6172 7261 797d \(.\begin{array} │ │ │ +000d81d0: 7b6c 7d0a 785e 7b22 7d20 205c 6c65 6674 {l}.x^{"} \left │ │ │ +000d81e0: 6172 726f 7720 2875 202d 2063 5f78 292f arrow (u - c_x)/ │ │ │ +000d81f0: 665f 7820 205c 5c0a 795e 7b22 7d20 205c f_x \\.y^{"} \ │ │ │ +000d8200: 6c65 6674 6172 726f 7720 2876 202d 2063 leftarrow (v - c │ │ │ +000d8210: 5f79 292f 665f 7920 205c 5c0a 2878 272c _y)/f_y \\.(x', │ │ │ +000d8220: 7927 2920 3d20 756e 6469 7374 6f72 7428 y') = undistort( │ │ │ +000d8230: 785e 7b22 7d2c 795e 7b22 7d2c 205c 7465 x^{"},y^{"}, \te │ │ │ +000d8240: 7874 7474 7b64 6973 7443 6f65 6666 737d xttt{distCoeffs} │ │ │ +000d8250: 2920 5c5c 0a7b 5b58 5c2c 595c 2c57 5d7d ) \\.{[X\,Y\,W]} │ │ │ +000d8260: 205e 5420 205c 6c65 6674 6172 726f 7720 ^T \leftarrow │ │ │ +000d8270: 522a 5b78 2720 5c2c 2079 2720 5c2c 2031 R*[x' \, y' \, 1 │ │ │ +000d8280: 5d5e 5420 205c 5c0a 7820 205c 6c65 6674 ]^T \\.x \left │ │ │ +000d8290: 6172 726f 7720 582f 5720 205c 5c0a 7920 arrow X/W \\.y │ │ │ +000d82a0: 205c 6c65 6674 6172 726f 7720 592f 5720 \leftarrow Y/W │ │ │ +000d82b0: 205c 5c0a 5c74 6578 747b 6f6e 6c79 2070 \\.\text{only p │ │ │ +000d82c0: 6572 666f 726d 6564 2069 6620 5020 6973 erformed if P is │ │ │ +000d82d0: 2073 7065 6369 6669 6564 3a7d 205c 5c0a specified:} \\. │ │ │ +000d82e0: 7527 2020 5c6c 6566 7461 7272 6f77 2078 u' \leftarrow x │ │ │ +000d82f0: 207b 6627 7d5f 7820 2b20 7b63 277d 5f78 {f'}_x + {c'}_x │ │ │ +000d8300: 2020 5c5c 0a76 2720 205c 6c65 6674 6172 \\.v' \leftar │ │ │ +000d8310: 726f 7720 7920 7b66 277d 5f79 202b 207b row y {f'}_y + { │ │ │ +000d8320: 6327 7d5f 790a 5c65 6e64 7b61 7272 6179 c'}_y.\end{array │ │ │ +000d8330: 7d0a 5c29 0a0a 7768 6572 6520 2a75 6e64 }.\)..where *und │ │ │ +000d8340: 6973 746f 7274 2a20 6973 2061 6e20 6170 istort* is an ap │ │ │ +000d8350: 7072 6f78 696d 6174 6520 6974 6572 6174 proximate iterat │ │ │ +000d8360: 6976 6520 616c 676f 7269 7468 6d20 7468 ive algorithm th │ │ │ +000d8370: 6174 2065 7374 696d 6174 6573 2074 6865 at estimates the │ │ │ +000d8380: 206e 6f72 6d61 6c69 7a65 6420 6f72 6967 normalized orig │ │ │ +000d8390: 696e 616c 0a70 6f69 6e74 2063 6f6f 7264 inal.point coord │ │ │ +000d83a0: 696e 6174 6573 206f 7574 206f 6620 7468 inates out of th │ │ │ +000d83b0: 6520 6e6f 726d 616c 697a 6564 2064 6973 e normalized dis │ │ │ +000d83c0: 746f 7274 6564 2070 6f69 6e74 2063 6f6f torted point coo │ │ │ +000d83d0: 7264 696e 6174 6573 2028 226e 6f72 6d61 rdinates ("norma │ │ │ +000d83e0: 6c69 7a65 6422 206d 6561 6e73 2074 6861 lized" means tha │ │ │ +000d83f0: 7420 7468 650a 636f 6f72 6469 6e61 7465 t the.coordinate │ │ │ +000d8400: 7320 646f 206e 6f74 2064 6570 656e 6420 s do not depend │ │ │ +000d8410: 6f6e 2074 6865 2063 616d 6572 6120 6d61 on the camera ma │ │ │ +000d8420: 7472 6978 292e 0a0a 5468 6520 6675 6e63 trix)...The func │ │ │ +000d8430: 7469 6f6e 2063 616e 2062 6520 7573 6564 tion can be used │ │ │ +000d8440: 2066 6f72 2062 6f74 6820 6120 7374 6572 for both a ster │ │ │ +000d8450: 656f 2063 616d 6572 6120 6865 6164 206f eo camera head o │ │ │ +000d8460: 7220 6120 6d6f 6e6f 6375 6c61 7220 6361 r a monocular ca │ │ │ +000d8470: 6d65 7261 2028 7768 656e 2052 2069 7320 mera (when R is │ │ │ +000d8480: 656d 7074 7929 2e0a 0a3c 623e 4e6f 7465 empty)...Note │ │ │ +000d8490: 3a3c 2f62 3e20 3c62 3e43 6f6f 7264 696e : Coordin │ │ │ +000d84a0: 6174 6520 5379 7374 656d 733a 3c2f 623e ate Systems: │ │ │ +000d84b0: 0a3c 756c 3e0a 2020 3c6c 693e 0a20 3c62 .
      .
    • . Input (sr │ │ │ +000d84d0: 633c 2f63 6f64 653e 293c 2f62 3e3a 2050 c): P │ │ │ +000d84e0: 6f69 6e74 7320 6172 6520 6578 7065 6374 oints are expect │ │ │ +000d84f0: 6564 2069 6e20 3c62 3e70 6978 656c 2063 ed in pixel c │ │ │ +000d8500: 6f6f 7264 696e 6174 6573 3c2f 623e 206f oordinates o │ │ │ +000d8510: 6620 7468 6520 6469 7374 6f72 7465 6420 f the distorted │ │ │ +000d8520: 696d 6167 652c 2069 2e65 2e2c 0a20 2063 image, i.e.,. c │ │ │ +000d8530: 6f6f 7264 696e 6174 6573 205c 2828 752c oordinates \((u, │ │ │ +000d8540: 2076 295c 2920 6d65 6173 7572 6564 2069 v)\) measured i │ │ │ +000d8550: 6e20 7069 7865 6c73 2066 726f 6d20 7468 n pixels from th │ │ │ +000d8560: 6520 746f 702d 6c65 6674 2063 6f72 6e65 e top-left corne │ │ │ +000d8570: 7220 6f66 2074 6865 2069 6d61 6765 2e0a r of the image.. │ │ │ +000d8580: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ +000d8590: 3c62 3e4f 7574 7075 7420 283c 636f 6465 Output (dst) │ │ │ +000d85b0: 3a20 5468 6520 636f 6f72 6469 6e61 7465 : The coordinate │ │ │ +000d85c0: 2073 7973 7465 6d20 6f66 206f 7574 7075 system of outpu │ │ │ +000d85d0: 7420 706f 696e 7473 2064 6570 656e 6473 t points depends │ │ │ +000d85e0: 206f 6e20 7061 7261 6d65 7465 7220 3c63 on parameter P:. │ │ │ +000d8600: 3c75 6c3e 0a20 2020 203c 6c69 3e0a 2020
        .
      • . │ │ │ +000d8610: 2049 6620 3c63 6f64 653e 503c 2f63 6f64 If P is provided ( │ │ │ +000d8630: 6e6f 7420 656d 7074 7929 3a20 4f75 7470 not empty): Outp │ │ │ +000d8640: 7574 2070 6f69 6e74 7320 6172 6520 696e ut points are in │ │ │ +000d8650: 203c 623e 7069 7865 6c20 636f 6f72 6469 pixel coordi │ │ │ +000d8660: 6e61 7465 733c 2f62 3e20 6f66 2074 6865 nates of the │ │ │ +000d8670: 2072 6563 7469 6669 6564 2f75 6e64 6973 rectified/undis │ │ │ +000d8680: 746f 7274 6564 2069 6d61 6765 2070 6c61 torted image pla │ │ │ +000d8690: 6e65 2c20 7573 696e 6720 7468 6520 6361 ne, using the ca │ │ │ +000d86a0: 6d65 7261 206d 6174 7269 7820 3c63 6f64 mera matrix P.. │ │ │ +000d86c0: 3c2f 6c69 3e0a 2020 2020 3c6c 693e 0a20
      • .
      • . │ │ │ +000d86d0: 2020 4966 203c 636f 6465 3e50 3c2f 636f If P is empty or │ │ │ +000d86f0: 6964 656e 7469 7479 3a20 4f75 7470 7574 identity: Output │ │ │ +000d8700: 2070 6f69 6e74 7320 6172 6520 696e 203c points are in < │ │ │ +000d8710: 623e 6e6f 726d 616c 697a 6564 2063 616d b>normalized cam │ │ │ +000d8720: 6572 6120 636f 6f72 6469 6e61 7465 733c era coordinates< │ │ │ +000d8730: 2f62 3e20 2861 6c73 6f20 6361 6c6c 6564 /b> (also called │ │ │ +000d8740: 2022 6e6f 726d 616c 697a 6564 2069 6d61 "normalized ima │ │ │ +000d8750: 6765 2063 6f6f 7264 696e 6174 6573 2229 ge coordinates") │ │ │ +000d8760: 2c0a 2020 2020 7768 6963 6820 6172 6520 ,. which are │ │ │ +000d8770: 6469 6d65 6e73 696f 6e6c 6573 7320 636f dimensionless co │ │ │ +000d8780: 6f72 6469 6e61 7465 7320 5c28 2878 2c20 ordinates \((x, │ │ │ +000d8790: 7929 5c29 2069 6e20 7468 6520 6361 6d65 y)\) in the came │ │ │ +000d87a0: 7261 2773 2066 6f63 616c 2070 6c61 6e65 ra's focal plane │ │ │ +000d87b0: 2c20 7265 6c61 7465 6420 746f 2070 6978 , related to pix │ │ │ +000d87c0: 656c 2063 6f6f 7264 696e 6174 6573 2062 el coordinates b │ │ │ +000d87d0: 793a 0a20 2020 205c 2878 203d 2028 7520 y:. \(x = (u │ │ │ +000d87e0: 2d20 635f 7829 202f 2066 5f78 5c29 2061 - c_x) / f_x\) a │ │ │ +000d87f0: 6e64 205c 2879 203d 2028 7620 2d20 635f nd \(y = (v - c_ │ │ │ +000d8800: 7929 202f 2066 5f79 5c29 2e20 5468 6573 y) / f_y\). Thes │ │ │ +000d8810: 6520 6e6f 726d 616c 697a 6564 2063 6f6f e normalized coo │ │ │ +000d8820: 7264 696e 6174 6573 2061 7265 2069 6e64 rdinates are ind │ │ │ +000d8830: 6570 656e 6465 6e74 206f 6620 7468 6520 ependent of the │ │ │ +000d8840: 6361 6d65 7261 2773 2069 6e74 7269 6e73 camera's intrins │ │ │ +000d8850: 6963 2070 6172 616d 6574 6572 7320 616e ic parameters an │ │ │ +000d8860: 6420 6172 6520 7573 6566 756c 2066 6f72 d are useful for │ │ │ +000d8870: 2033 4420 7265 636f 6e73 7472 7563 7469 3D reconstructi │ │ │ +000d8880: 6f6e 206f 7220 6570 6970 6f6c 6172 2067 on or epipolar g │ │ │ +000d8890: 656f 6d65 7472 792e 0a20 2020 203c 2f6c eometry.. .
      .. .
    . │ │ │ +000d88c0: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ +000d88e0: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    src - O │ │ │ +000d8900: 6273 6572 7665 6420 706f 696e 7420 636f bserved point co │ │ │ +000d8910: 6f72 6469 6e61 7465 7320 696e 203c 623e ordinates in │ │ │ +000d8920: 7069 7865 6c20 636f 6f72 6469 6e61 7465 pixel coordinate │ │ │ +000d8930: 733c 2f62 3e20 6f66 2074 6865 2064 6973 s of the dis │ │ │ +000d8940: 746f 7274 6564 2069 6d61 6765 2c20 3278 torted image, 2x │ │ │ +000d8950: 4e2f 4e78 3220 312d 6368 616e 6e65 6c20 N/Nx2 1-channel │ │ │ +000d8960: 6f72 2031 784e 2f4e 7831 2032 2d63 6861 or 1xN/Nx1 2-cha │ │ │ +000d8970: 6e6e 656c 2028 4356 5f33 3246 4332 206f nnel (CV_32FC2 o │ │ │ +000d8980: 7220 4356 5f36 3446 4332 2920 286f 720a r CV_64FC2) (or. │ │ │ +000d8990: 7665 6374 6f72 266c 743b 506f 696e 7432 vector<Point2 │ │ │ +000d89a0: 6626 6774 3b20 292e 3c2f 6464 3e0a 3c64 f> ).
    .dst - Output idea │ │ │ +000d89d0: 6c20 706f 696e 7420 636f 6f72 6469 6e61 l point coordina │ │ │ +000d89e0: 7465 7320 2831 784e 2f4e 7831 2032 2d63 tes (1xN/Nx1 2-c │ │ │ +000d89f0: 6861 6e6e 656c 206f 7220 7665 6374 6f72 hannel or vector │ │ │ +000d8a00: 266c 743b 506f 696e 7432 6626 6774 3b20 <Point2f> │ │ │ +000d8a10: 2920 6166 7465 7220 756e 6469 7374 6f72 ) after undistor │ │ │ +000d8a20: 7469 6f6e 2061 6e64 2072 6576 6572 7365 tion and reverse │ │ │ +000d8a30: 2070 6572 7370 6563 7469 7665 0a74 7261 perspective.tra │ │ │ +000d8a40: 6e73 666f 726d 6174 696f 6e2e 2049 6620 nsformation. If │ │ │ +000d8a50: 6d61 7472 6978 2050 2069 7320 6964 656e matrix P is iden │ │ │ +000d8a60: 7469 7479 206f 7220 6f6d 6974 7465 642c tity or omitted, │ │ │ +000d8a70: 2064 7374 2077 696c 6c20 636f 6e74 6169 dst will contai │ │ │ +000d8a80: 6e20 6e6f 726d 616c 697a 6564 2070 6f69 n normalized poi │ │ │ +000d8a90: 6e74 2063 6f6f 7264 696e 6174 6573 2e3c nt coordinates.< │ │ │ +000d8aa0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e63 /dd>.
    c │ │ │ +000d8ab0: 616d 6572 614d 6174 7269 783c 2f63 6f64 ameraMatrix - Camera matr │ │ │ +000d8ad0: 6978 205c 285c 7665 6374 6872 6565 7468 ix \(\vecthreeth │ │ │ +000d8ae0: 7265 657b 665f 787d 7b30 7d7b 635f 787d ree{f_x}{0}{c_x} │ │ │ +000d8af0: 7b30 7d7b 665f 797d 7b63 5f79 7d7b 307d {0}{f_y}{c_y}{0} │ │ │ +000d8b00: 7b30 7d7b 317d 5c29 202e 3c2f 6464 3e0a {0}{1}\) .
    . │ │ │ +000d8b10: 3c64 643e 3c63 6f64 653e 6469 7374 436f
    distCo │ │ │ +000d8b20: 6566 6673 3c2f 636f 6465 3e20 2d20 496e effs - In │ │ │ +000d8b30: 7075 7420 7665 6374 6f72 206f 6620 6469 put vector of di │ │ │ +000d8b40: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ +000d8b50: 6965 6e74 730a 5c28 286b 5f31 2c20 6b5f ients.\((k_1, k_ │ │ │ +000d8b60: 322c 2070 5f31 2c20 705f 325b 2c20 6b5f 2, p_1, p_2[, k_ │ │ │ +000d8b70: 335b 2c20 6b5f 342c 206b 5f35 2c20 6b5f 3[, k_4, k_5, k_ │ │ │ +000d8b80: 365b 2c20 735f 312c 2073 5f32 2c20 735f 6[, s_1, s_2, s_ │ │ │ +000d8b90: 332c 2073 5f34 5b2c 205c 7461 755f 782c 3, s_4[, \tau_x, │ │ │ +000d8ba0: 205c 7461 755f 795d 5d5d 5d29 5c29 0a6f \tau_y]]]])\).o │ │ │ +000d8bb0: 6620 342c 2035 2c20 382c 2031 3220 6f72 f 4, 5, 8, 12 or │ │ │ +000d8bc0: 2031 3420 656c 656d 656e 7473 2e20 4966 14 elements. If │ │ │ +000d8bd0: 2074 6865 2076 6563 746f 7220 6973 204e the vector is N │ │ │ +000d8be0: 554c 4c2f 656d 7074 792c 2074 6865 207a ULL/empty, the z │ │ │ +000d8bf0: 6572 6f20 6469 7374 6f72 7469 6f6e 2063 ero distortion c │ │ │ +000d8c00: 6f65 6666 6963 6965 6e74 7320 6172 6520 oefficients are │ │ │ +000d8c10: 6173 7375 6d65 642e 3c2f 6464 3e0a 3c64 assumed.
    .R │ │ │ +000d8c30: 202d 2052 6563 7469 6669 6361 7469 6f6e - Rectification │ │ │ +000d8c40: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ +000d8c50: 696e 2074 6865 206f 626a 6563 7420 7370 in the object sp │ │ │ +000d8c60: 6163 6520 2833 7833 206d 6174 7269 7829 ace (3x3 matrix) │ │ │ +000d8c70: 2e20 5231 206f 7220 5232 2063 6f6d 7075 . R1 or R2 compu │ │ │ +000d8c80: 7465 6420 6279 0a23 7374 6572 656f 5265 ted by.#stereoRe │ │ │ +000d8c90: 6374 6966 7920 6361 6e20 6265 2070 6173 ctify can be pas │ │ │ +000d8ca0: 7365 6420 6865 7265 2e20 4966 2074 6865 sed here. If the │ │ │ +000d8cb0: 206d 6174 7269 7820 6973 2065 6d70 7479 matrix is empty │ │ │ +000d8cc0: 2c20 7468 6520 6964 656e 7469 7479 2074 , the identity t │ │ │ +000d8cd0: 7261 6e73 666f 726d 6174 696f 6e20 6973 ransformation is │ │ │ +000d8ce0: 2075 7365 642e 0a23 7374 6572 656f 5265 used..#stereoRe │ │ │ +000d8cf0: 6374 6966 7920 6361 6e20 6265 2070 6173 ctify can be pas │ │ │ +000d8d00: 7365 6420 6865 7265 2e20 4966 2074 6865 sed here. If the │ │ │ +000d8d10: 206d 6174 7269 7820 6973 2065 6d70 7479 matrix is empty │ │ │ +000d8d20: 2c20 7468 6520 6964 656e 7469 7479 206e , the identity n │ │ │ +000d8d30: 6577 2063 616d 6572 6120 6d61 7472 6978 ew camera matrix │ │ │ +000d8d40: 2069 7320 7573 6564 2061 6e64 206f 7574 is used and out │ │ │ +000d8d50: 7075 7420 7769 6c6c 2062 6520 696e 206e put will be in n │ │ │ +000d8d60: 6f72 6d61 6c69 7a65 6420 636f 6f72 6469 ormalized coordi │ │ │ +000d8d70: 6e61 7465 732e 3c2f 6464 3e0a 3c2f 646c nates..
    .
    ..
  • .
  • .< │ │ │ +000d8da0: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +000d8db0: 6574 6169 6c22 2069 643d 2275 6e64 6973 etail" id="undis │ │ │ +000d8dc0: 746f 7274 506f 696e 7473 286f 7267 2e6f tortPoints(org.o │ │ │ +000d8dd0: 7065 6e63 762e 636f 7265 2e4d 6174 4f66 pencv.core.MatOf │ │ │ +000d8de0: 506f 696e 7432 662c 6f72 672e 6f70 656e Point2f,org.open │ │ │ +000d8df0: 6376 2e63 6f72 652e 4d61 744f 6650 6f69 cv.core.MatOfPoi │ │ │ +000d8e00: 6e74 3266 2c6f 7267 2e6f 7065 6e63 762e nt2f,org.opencv. │ │ │ +000d8e10: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ +000d8e20: 6e63 762e 636f 7265 2e4d 6174 2922 3e0a ncv.core.Mat)">. │ │ │ +000d8e30: 3c68 333e 756e 6469 7374 6f72 7450 6f69

    undistortPoi │ │ │ +000d8e40: 6e74 733c 2f68 333e 0a3c 6469 7620 636c nts

    .
    .
    p │ │ │ +000d8ea0: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static void&n │ │ │ +000d8ee0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;u │ │ │ +000d8f00: 6e64 6973 746f 7274 506f 696e 7473 3c2f ndistortPoints(MatOfPo │ │ │ +000d8f80: 696e 7432 663c 2f61 3e26 6e62 7370 3b73 int2f s │ │ │ +000d8f90: 7263 2c0a 203c 6120 6872 6566 3d22 2e2e rc,. MatOfP │ │ │ +000d8fe0: 6f69 6e74 3266 3c2f 613e 266e 6273 703b oint2f  │ │ │ +000d8ff0: 6473 742c 0a20 3c61 2068 7265 663d 222e dst,. Mat c │ │ │ +000d9040: 616d 6572 614d 6174 7269 782c 0a20 3c61 ameraMatrix,. Mat distCoeff │ │ │ +000d90a0: 7329 3c2f 7370 616e 3e3c 2f64 6976 3e0a s)
    . │ │ │ +000d90b0: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Computes the │ │ │ +000d90d0: 6964 6561 6c20 706f 696e 7420 636f 6f72 ideal point coor │ │ │ +000d90e0: 6469 6e61 7465 7320 6672 6f6d 2074 6865 dinates from the │ │ │ +000d90f0: 206f 6273 6572 7665 6420 706f 696e 7420 observed point │ │ │ +000d9100: 636f 6f72 6469 6e61 7465 732e 0a0a 5468 coordinates...Th │ │ │ +000d9110: 6520 6675 6e63 7469 6f6e 2069 7320 7369 e function is si │ │ │ +000d9120: 6d69 6c61 7220 746f 2023 756e 6469 7374 milar to #undist │ │ │ +000d9130: 6f72 7420 616e 6420 2369 6e69 7455 6e64 ort and #initUnd │ │ │ +000d9140: 6973 746f 7274 5265 6374 6966 794d 6170 istortRectifyMap │ │ │ +000d9150: 2062 7574 2069 7420 6f70 6572 6174 6573 but it operates │ │ │ +000d9160: 206f 6e20 610a 7370 6172 7365 2073 6574 on a.sparse set │ │ │ +000d9170: 206f 6620 706f 696e 7473 2069 6e73 7465 of points inste │ │ │ +000d9180: 6164 206f 6620 6120 7261 7374 6572 2069 ad of a raster i │ │ │ +000d9190: 6d61 6765 2e20 416c 736f 2074 6865 2066 mage. Also the f │ │ │ +000d91a0: 756e 6374 696f 6e20 7065 7266 6f72 6d73 unction performs │ │ │ +000d91b0: 2061 2072 6576 6572 7365 2074 7261 6e73 a reverse trans │ │ │ +000d91c0: 666f 726d 6174 696f 6e0a 746f 2020 2370 formation.to #p │ │ │ +000d91d0: 726f 6a65 6374 506f 696e 7473 2e20 496e rojectPoints. In │ │ │ +000d91e0: 2063 6173 6520 6f66 2061 2033 4420 6f62 case of a 3D ob │ │ │ +000d91f0: 6a65 6374 2c20 6974 2064 6f65 7320 6e6f ject, it does no │ │ │ +000d9200: 7420 7265 636f 6e73 7472 7563 7420 6974 t reconstruct it │ │ │ +000d9210: 7320 3344 2063 6f6f 7264 696e 6174 6573 s 3D coordinates │ │ │ +000d9220: 2c20 6275 7420 666f 7220 610a 706c 616e , but for a.plan │ │ │ +000d9230: 6172 206f 626a 6563 742c 2069 7420 646f ar object, it do │ │ │ +000d9240: 6573 2c20 7570 2074 6f20 6120 7472 616e es, up to a tran │ │ │ +000d9250: 736c 6174 696f 6e20 7665 6374 6f72 2c20 slation vector, │ │ │ +000d9260: 6966 2074 6865 2070 726f 7065 7220 5220 if the proper R │ │ │ +000d9270: 6973 2073 7065 6369 6669 6564 2e0a 0a46 is specified...F │ │ │ +000d9280: 6f72 2065 6163 6820 6f62 7365 7276 6564 or each observed │ │ │ +000d9290: 2070 6f69 6e74 2063 6f6f 7264 696e 6174 point coordinat │ │ │ +000d92a0: 6520 5c28 2875 2c20 7629 5c29 2074 6865 e \((u, v)\) the │ │ │ +000d92b0: 2066 756e 6374 696f 6e20 636f 6d70 7574 function comput │ │ │ +000d92c0: 6573 3a0a 5c28 0a5c 6265 6769 6e7b 6172 es:.\(.\begin{ar │ │ │ +000d92d0: 7261 797d 7b6c 7d0a 785e 7b22 7d20 205c ray}{l}.x^{"} \ │ │ │ +000d92e0: 6c65 6674 6172 726f 7720 2875 202d 2063 leftarrow (u - c │ │ │ +000d92f0: 5f78 292f 665f 7820 205c 5c0a 795e 7b22 _x)/f_x \\.y^{" │ │ │ +000d9300: 7d20 205c 6c65 6674 6172 726f 7720 2876 } \leftarrow (v │ │ │ +000d9310: 202d 2063 5f79 292f 665f 7920 205c 5c0a - c_y)/f_y \\. │ │ │ +000d9320: 2878 272c 7927 2920 3d20 756e 6469 7374 (x',y') = undist │ │ │ +000d9330: 6f72 7428 785e 7b22 7d2c 795e 7b22 7d2c ort(x^{"},y^{"}, │ │ │ +000d9340: 205c 7465 7874 7474 7b64 6973 7443 6f65 \texttt{distCoe │ │ │ +000d9350: 6666 737d 2920 5c5c 0a7b 5b58 5c2c 595c ffs}) \\.{[X\,Y\ │ │ │ +000d9360: 2c57 5d7d 205e 5420 205c 6c65 6674 6172 ,W]} ^T \leftar │ │ │ +000d9370: 726f 7720 522a 5b78 2720 5c2c 2079 2720 row R*[x' \, y' │ │ │ +000d9380: 5c2c 2031 5d5e 5420 205c 5c0a 7820 205c \, 1]^T \\.x \ │ │ │ +000d9390: 6c65 6674 6172 726f 7720 582f 5720 205c leftarrow X/W \ │ │ │ +000d93a0: 5c0a 7920 205c 6c65 6674 6172 726f 7720 \.y \leftarrow │ │ │ +000d93b0: 592f 5720 205c 5c0a 5c74 6578 747b 6f6e Y/W \\.\text{on │ │ │ +000d93c0: 6c79 2070 6572 666f 726d 6564 2069 6620 ly performed if │ │ │ +000d93d0: 5020 6973 2073 7065 6369 6669 6564 3a7d P is specified:} │ │ │ +000d93e0: 205c 5c0a 7527 2020 5c6c 6566 7461 7272 \\.u' \leftarr │ │ │ +000d93f0: 6f77 2078 207b 6627 7d5f 7820 2b20 7b63 ow x {f'}_x + {c │ │ │ +000d9400: 277d 5f78 2020 5c5c 0a76 2720 205c 6c65 '}_x \\.v' \le │ │ │ +000d9410: 6674 6172 726f 7720 7920 7b66 277d 5f79 ftarrow y {f'}_y │ │ │ +000d9420: 202b 207b 6327 7d5f 790a 5c65 6e64 7b61 + {c'}_y.\end{a │ │ │ +000d9430: 7272 6179 7d0a 5c29 0a0a 7768 6572 6520 rray}.\)..where │ │ │ +000d9440: 2a75 6e64 6973 746f 7274 2a20 6973 2061 *undistort* is a │ │ │ +000d9450: 6e20 6170 7072 6f78 696d 6174 6520 6974 n approximate it │ │ │ +000d9460: 6572 6174 6976 6520 616c 676f 7269 7468 erative algorith │ │ │ +000d9470: 6d20 7468 6174 2065 7374 696d 6174 6573 m that estimates │ │ │ +000d9480: 2074 6865 206e 6f72 6d61 6c69 7a65 6420 the normalized │ │ │ +000d9490: 6f72 6967 696e 616c 0a70 6f69 6e74 2063 original.point c │ │ │ +000d94a0: 6f6f 7264 696e 6174 6573 206f 7574 206f oordinates out o │ │ │ +000d94b0: 6620 7468 6520 6e6f 726d 616c 697a 6564 f the normalized │ │ │ +000d94c0: 2064 6973 746f 7274 6564 2070 6f69 6e74 distorted point │ │ │ +000d94d0: 2063 6f6f 7264 696e 6174 6573 2028 226e coordinates ("n │ │ │ +000d94e0: 6f72 6d61 6c69 7a65 6422 206d 6561 6e73 ormalized" means │ │ │ +000d94f0: 2074 6861 7420 7468 650a 636f 6f72 6469 that the.coordi │ │ │ +000d9500: 6e61 7465 7320 646f 206e 6f74 2064 6570 nates do not dep │ │ │ +000d9510: 656e 6420 6f6e 2074 6865 2063 616d 6572 end on the camer │ │ │ +000d9520: 6120 6d61 7472 6978 292e 0a0a 5468 6520 a matrix)...The │ │ │ +000d9530: 6675 6e63 7469 6f6e 2063 616e 2062 6520 function can be │ │ │ +000d9540: 7573 6564 2066 6f72 2062 6f74 6820 6120 used for both a │ │ │ +000d9550: 7374 6572 656f 2063 616d 6572 6120 6865 stereo camera he │ │ │ +000d9560: 6164 206f 7220 6120 6d6f 6e6f 6375 6c61 ad or a monocula │ │ │ +000d9570: 7220 6361 6d65 7261 2028 7768 656e 2052 r camera (when R │ │ │ +000d9580: 2069 7320 656d 7074 7929 2e0a 0a3c 623e is empty)... │ │ │ +000d9590: 4e6f 7465 3a3c 2f62 3e20 3c62 3e43 6f6f Note: Coo │ │ │ +000d95a0: 7264 696e 6174 6520 5379 7374 656d 733a rdinate Systems: │ │ │ +000d95b0: 3c2f 623e 0a3c 756c 3e0a 2020 3c6c 693e .
      .
    • │ │ │ +000d95c0: 0a20 3c62 3e49 6e70 7574 2028 3c63 6f64 . Input (src): Points are ex │ │ │ +000d95f0: 7065 6374 6564 2069 6e20 3c62 3e70 6978 pected in pix │ │ │ +000d9600: 656c 2063 6f6f 7264 696e 6174 6573 3c2f el coordinates of the distor │ │ │ +000d9620: 7465 6420 696d 6167 652c 2069 2e65 2e2c ted image, i.e., │ │ │ +000d9630: 0a20 2063 6f6f 7264 696e 6174 6573 205c . coordinates \ │ │ │ +000d9640: 2828 752c 2076 295c 2920 6d65 6173 7572 ((u, v)\) measur │ │ │ +000d9650: 6564 2069 6e20 7069 7865 6c73 2066 726f ed in pixels fro │ │ │ +000d9660: 6d20 7468 6520 746f 702d 6c65 6674 2063 m the top-left c │ │ │ +000d9670: 6f72 6e65 7220 6f66 2074 6865 2069 6d61 orner of the ima │ │ │ +000d9680: 6765 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c ge..
    • . . Output (< │ │ │ +000d96a0: 636f 6465 3e64 7374 3c2f 636f 6465 3e29 code>dst
      ) │ │ │ +000d96b0: 3c2f 623e 3a20 5468 6520 636f 6f72 6469 : The coordi │ │ │ +000d96c0: 6e61 7465 2073 7973 7465 6d20 6f66 206f nate system of o │ │ │ +000d96d0: 7574 7075 7420 706f 696e 7473 2064 6570 utput points dep │ │ │ +000d96e0: 656e 6473 206f 6e20 7061 7261 6d65 7465 ends on paramete │ │ │ +000d96f0: 7220 3c63 6f64 653e 503c 2f63 6f64 653e r P │ │ │ +000d9700: 3a0a 2020 3c75 6c3e 0a20 2020 203c 6c69 :.
        .
      • . If P< │ │ │ +000d9720: 2f63 6f64 653e 2069 7320 7072 6f76 6964 /code> is provid │ │ │ +000d9730: 6564 2028 6e6f 7420 656d 7074 7929 3a20 ed (not empty): │ │ │ +000d9740: 4f75 7470 7574 2070 6f69 6e74 7320 6172 Output points ar │ │ │ +000d9750: 6520 696e 203c 623e 7069 7865 6c20 636f e in pixel co │ │ │ +000d9760: 6f72 6469 6e61 7465 733c 2f62 3e20 6f66 ordinates of │ │ │ +000d9770: 2074 6865 2072 6563 7469 6669 6564 2f75 the rectified/u │ │ │ +000d9780: 6e64 6973 746f 7274 6564 2069 6d61 6765 ndistorted image │ │ │ +000d9790: 2070 6c61 6e65 2c20 7573 696e 6720 7468 plane, using th │ │ │ +000d97a0: 6520 6361 6d65 7261 206d 6174 7269 7820 e camera matrix │ │ │ +000d97b0: 3c63 6f64 653e 503c 2f63 6f64 653e 2e0a P.. │ │ │ +000d97c0: 2020 2020 3c2f 6c69 3e0a 2020 2020 3c6c
      • . . If P │ │ │ +000d97e0: 3c2f 636f 6465 3e20 6973 2065 6d70 7479 is empty │ │ │ +000d97f0: 206f 7220 6964 656e 7469 7479 3a20 4f75 or identity: Ou │ │ │ +000d9800: 7470 7574 2070 6f69 6e74 7320 6172 6520 tput points are │ │ │ +000d9810: 696e 203c 623e 6e6f 726d 616c 697a 6564 in normalized │ │ │ +000d9820: 2063 616d 6572 6120 636f 6f72 6469 6e61 camera coordina │ │ │ +000d9830: 7465 733c 2f62 3e20 2861 6c73 6f20 6361 tes (also ca │ │ │ +000d9840: 6c6c 6564 2022 6e6f 726d 616c 697a 6564 lled "normalized │ │ │ +000d9850: 2069 6d61 6765 2063 6f6f 7264 696e 6174 image coordinat │ │ │ +000d9860: 6573 2229 2c0a 2020 2020 7768 6963 6820 es"),. which │ │ │ +000d9870: 6172 6520 6469 6d65 6e73 696f 6e6c 6573 are dimensionles │ │ │ +000d9880: 7320 636f 6f72 6469 6e61 7465 7320 5c28 s coordinates \( │ │ │ +000d9890: 2878 2c20 7929 5c29 2069 6e20 7468 6520 (x, y)\) in the │ │ │ +000d98a0: 6361 6d65 7261 2773 2066 6f63 616c 2070 camera's focal p │ │ │ +000d98b0: 6c61 6e65 2c20 7265 6c61 7465 6420 746f lane, related to │ │ │ +000d98c0: 2070 6978 656c 2063 6f6f 7264 696e 6174 pixel coordinat │ │ │ +000d98d0: 6573 2062 793a 0a20 2020 205c 2878 203d es by:. \(x = │ │ │ +000d98e0: 2028 7520 2d20 635f 7829 202f 2066 5f78 (u - c_x) / f_x │ │ │ +000d98f0: 5c29 2061 6e64 205c 2879 203d 2028 7620 \) and \(y = (v │ │ │ +000d9900: 2d20 635f 7929 202f 2066 5f79 5c29 2e20 - c_y) / f_y\). │ │ │ +000d9910: 5468 6573 6520 6e6f 726d 616c 697a 6564 These normalized │ │ │ +000d9920: 2063 6f6f 7264 696e 6174 6573 2061 7265 coordinates are │ │ │ +000d9930: 2069 6e64 6570 656e 6465 6e74 206f 6620 independent of │ │ │ +000d9940: 7468 6520 6361 6d65 7261 2773 2069 6e74 the camera's int │ │ │ +000d9950: 7269 6e73 6963 2070 6172 616d 6574 6572 rinsic parameter │ │ │ +000d9960: 7320 616e 6420 6172 6520 7573 6566 756c s and are useful │ │ │ +000d9970: 2066 6f72 2033 4420 7265 636f 6e73 7472 for 3D reconstr │ │ │ +000d9980: 7563 7469 6f6e 206f 7220 6570 6970 6f6c uction or epipol │ │ │ +000d9990: 6172 2067 656f 6d65 7472 792e 0a20 2020 ar geometry.. │ │ │ +000d99a0: 203c 2f6c 693e 0a20 203c 2f75 6c3e 0a0a .
      .. │ │ │ +000d99b0: 2020 3c2f 6c69 3e0a 3c2f 756c 3e3c 2f64 .
    .
    .
    Param │ │ │ +000d99e0: 6574 6572 733a 3c2f 6474 3e0a 3c64 643e eters:
    .
    │ │ │ +000d99f0: 3c63 6f64 653e 7372 633c 2f63 6f64 653e src │ │ │ +000d9a00: 202d 204f 6273 6572 7665 6420 706f 696e - Observed poin │ │ │ +000d9a10: 7420 636f 6f72 6469 6e61 7465 7320 696e t coordinates in │ │ │ +000d9a20: 203c 623e 7069 7865 6c20 636f 6f72 6469 pixel coordi │ │ │ +000d9a30: 6e61 7465 733c 2f62 3e20 6f66 2074 6865 nates of the │ │ │ +000d9a40: 2064 6973 746f 7274 6564 2069 6d61 6765 distorted image │ │ │ +000d9a50: 2c20 3278 4e2f 4e78 3220 312d 6368 616e , 2xN/Nx2 1-chan │ │ │ +000d9a60: 6e65 6c20 6f72 2031 784e 2f4e 7831 2032 nel or 1xN/Nx1 2 │ │ │ +000d9a70: 2d63 6861 6e6e 656c 2028 4356 5f33 3246 -channel (CV_32F │ │ │ +000d9a80: 4332 206f 7220 4356 5f36 3446 4332 2920 C2 or CV_64FC2) │ │ │ +000d9a90: 286f 720a 7665 6374 6f72 266c 743b 506f (or.vector<Po │ │ │ +000d9aa0: 696e 7432 6626 6774 3b20 292e 3c2f 6464 int2f> ).
    .
    dst< │ │ │ +000d9ac0: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ +000d9ad0: 6964 6561 6c20 706f 696e 7420 636f 6f72 ideal point coor │ │ │ +000d9ae0: 6469 6e61 7465 7320 2831 784e 2f4e 7831 dinates (1xN/Nx1 │ │ │ +000d9af0: 2032 2d63 6861 6e6e 656c 206f 7220 7665 2-channel or ve │ │ │ +000d9b00: 6374 6f72 266c 743b 506f 696e 7432 6626 ctor<Point2f& │ │ │ +000d9b10: 6774 3b20 2920 6166 7465 7220 756e 6469 gt; ) after undi │ │ │ +000d9b20: 7374 6f72 7469 6f6e 2061 6e64 2072 6576 stortion and rev │ │ │ +000d9b30: 6572 7365 2070 6572 7370 6563 7469 7665 erse perspective │ │ │ +000d9b40: 0a74 7261 6e73 666f 726d 6174 696f 6e2e .transformation. │ │ │ +000d9b50: 2049 6620 6d61 7472 6978 2050 2069 7320 If matrix P is │ │ │ +000d9b60: 6964 656e 7469 7479 206f 7220 6f6d 6974 identity or omit │ │ │ +000d9b70: 7465 642c 2064 7374 2077 696c 6c20 636f ted, dst will co │ │ │ +000d9b80: 6e74 6169 6e20 6e6f 726d 616c 697a 6564 ntain normalized │ │ │ +000d9b90: 2070 6f69 6e74 2063 6f6f 7264 696e 6174 point coordinat │ │ │ +000d9ba0: 6573 2e3c 2f64 643e 0a3c 6464 3e3c 636f es.
    .
    cameraMatrix< │ │ │ +000d9bc0: 2f63 6f64 653e 202d 2043 616d 6572 6120 /code> - Camera │ │ │ +000d9bd0: 6d61 7472 6978 205c 285c 7665 6374 6872 matrix \(\vecthr │ │ │ +000d9be0: 6565 7468 7265 657b 665f 787d 7b30 7d7b eethree{f_x}{0}{ │ │ │ +000d9bf0: 635f 787d 7b30 7d7b 665f 797d 7b63 5f79 c_x}{0}{f_y}{c_y │ │ │ +000d9c00: 7d7b 307d 7b30 7d7b 317d 5c29 202e 3c2f }{0}{0}{1}\) ..
    di │ │ │ +000d9c20: 7374 436f 6566 6673 3c2f 636f 6465 3e20 stCoeffs │ │ │ +000d9c30: 2d20 496e 7075 7420 7665 6374 6f72 206f - Input vector o │ │ │ +000d9c40: 6620 6469 7374 6f72 7469 6f6e 2063 6f65 f distortion coe │ │ │ +000d9c50: 6666 6963 6965 6e74 730a 5c28 286b 5f31 fficients.\((k_1 │ │ │ +000d9c60: 2c20 6b5f 322c 2070 5f31 2c20 705f 325b , k_2, p_1, p_2[ │ │ │ +000d9c70: 2c20 6b5f 335b 2c20 6b5f 342c 206b 5f35 , k_3[, k_4, k_5 │ │ │ +000d9c80: 2c20 6b5f 365b 2c20 735f 312c 2073 5f32 , k_6[, s_1, s_2 │ │ │ +000d9c90: 2c20 735f 332c 2073 5f34 5b2c 205c 7461 , s_3, s_4[, \ta │ │ │ +000d9ca0: 755f 782c 205c 7461 755f 795d 5d5d 5d29 u_x, \tau_y]]]]) │ │ │ +000d9cb0: 5c29 0a6f 6620 342c 2035 2c20 382c 2031 \).of 4, 5, 8, 1 │ │ │ +000d9cc0: 3220 6f72 2031 3420 656c 656d 656e 7473 2 or 14 elements │ │ │ +000d9cd0: 2e20 4966 2074 6865 2076 6563 746f 7220 . If the vector │ │ │ +000d9ce0: 6973 204e 554c 4c2f 656d 7074 792c 2074 is NULL/empty, t │ │ │ +000d9cf0: 6865 207a 6572 6f20 6469 7374 6f72 7469 he zero distorti │ │ │ +000d9d00: 6f6e 2063 6f65 6666 6963 6965 6e74 7320 on coefficients │ │ │ +000d9d10: 6172 6520 6173 7375 6d65 642e 0a23 7374 are assumed..#st │ │ │ +000d9d20: 6572 656f 5265 6374 6966 7920 6361 6e20 ereoRectify can │ │ │ +000d9d30: 6265 2070 6173 7365 6420 6865 7265 2e20 be passed here. │ │ │ +000d9d40: 4966 2074 6865 206d 6174 7269 7820 6973 If the matrix is │ │ │ +000d9d50: 2065 6d70 7479 2c20 7468 6520 6964 656e empty, the iden │ │ │ +000d9d60: 7469 7479 2074 7261 6e73 666f 726d 6174 tity transformat │ │ │ +000d9d70: 696f 6e20 6973 2075 7365 642e 0a23 7374 ion is used..#st │ │ │ +000d9d80: 6572 656f 5265 6374 6966 7920 6361 6e20 ereoRectify can │ │ │ +000d9d90: 6265 2070 6173 7365 6420 6865 7265 2e20 be passed here. │ │ │ +000d9da0: 4966 2074 6865 206d 6174 7269 7820 6973 If the matrix is │ │ │ +000d9db0: 2065 6d70 7479 2c20 7468 6520 6964 656e empty, the iden │ │ │ +000d9dc0: 7469 7479 206e 6577 2063 616d 6572 6120 tity new camera │ │ │ +000d9dd0: 6d61 7472 6978 2069 7320 7573 6564 2061 matrix is used a │ │ │ +000d9de0: 6e64 206f 7574 7075 7420 7769 6c6c 2062 nd output will b │ │ │ +000d9df0: 6520 696e 206e 6f72 6d61 6c69 7a65 6420 e in normalized │ │ │ +000d9e00: 636f 6f72 6469 6e61 7465 732e 3c2f 6464 coordinates.
    .
    .
    .< │ │ │ +000d9e20: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.
  • . │ │ │ +000d9e30: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    undist │ │ │ +000d9ee0: 6f72 7449 6d61 6765 506f 696e 7473 3c2f ortImagePoints.
    .
    public │ │ │ +000d9f50: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +000d9f60: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;vo │ │ │ +000d9f80: 6964 3c2f 7370 616e 3e26 6e62 7370 3b3c id < │ │ │ +000d9f90: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +000d9fa0: 656e 742d 6e61 6d65 223e 756e 6469 7374 ent-name">undist │ │ │ +000d9fb0: 6f72 7449 6d61 6765 506f 696e 7473 3c2f ortImagePoints( │ │ │ +000da020: 4d61 743c 2f61 3e26 6e62 7370 3b73 7263 Mat src │ │ │ +000da030: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000da070: 6174 3c2f 613e 266e 6273 703b 6473 742c at dst, │ │ │ +000da080: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000da0c0: 743c 2f61 3e26 6e62 7370 3b63 616d 6572 t camer │ │ │ +000da0d0: 614d 6174 7269 782c 0a20 3c61 2068 7265 aMatrix,. Mat&nb │ │ │ +000da120: 7370 3b64 6973 7443 6f65 6666 732c 0a20 sp;distCoeffs,. │ │ │ +000da130: 3c61 2068 7265 663d 222e 2e2f 636f 7265 TermCriteri │ │ │ +000da180: 613c 2f61 3e26 6e62 7370 3b61 7267 3129 a arg1) │ │ │ +000da190: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Compute undisto │ │ │ +000da1c0: 7274 6564 2069 6d61 6765 2070 6f69 6e74 rted image point │ │ │ +000da1d0: 7320 706f 7369 7469 6f6e 3c2f 6469 763e s position
    │ │ │ +000da1e0: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ +000da200: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    src - │ │ │ +000da220: 4f62 7365 7276 6564 2070 6f69 6e74 7320 Observed points │ │ │ +000da230: 706f 7369 7469 6f6e 2c20 3278 4e2f 4e78 position, 2xN/Nx │ │ │ +000da240: 3220 312d 6368 616e 6e65 6c20 6f72 2031 2 1-channel or 1 │ │ │ +000da250: 784e 2f4e 7831 2032 2d63 6861 6e6e 656c xN/Nx1 2-channel │ │ │ +000da260: 2028 4356 5f33 3246 4332 206f 7220 4356 (CV_32FC2 or CV │ │ │ +000da270: 5f36 3446 4332 2920 286f 7220 7665 6374 _64FC2) (or vect │ │ │ +000da280: 6f72 266c 743b 506f 696e 7432 6626 6774 or<Point2f> │ │ │ +000da290: 3b20 292e 3c2f 6464 3e0a 3c64 643e 3c63 ; ).
    .
    dst - │ │ │ +000da2b0: 204f 7574 7075 7420 756e 6469 7374 6f72 Output undistor │ │ │ +000da2c0: 7465 6420 706f 696e 7473 2070 6f73 6974 ted points posit │ │ │ +000da2d0: 696f 6e20 2831 784e 2f4e 7831 2032 2d63 ion (1xN/Nx1 2-c │ │ │ +000da2e0: 6861 6e6e 656c 206f 7220 7665 6374 6f72 hannel or vector │ │ │ +000da2f0: 266c 743b 506f 696e 7432 6626 6774 3b20 <Point2f> │ │ │ +000da300: 292e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 ).
    .
    cameraMatrix - Camera m │ │ │ +000da330: 6174 7269 7820 5c28 5c76 6563 7468 7265 atrix \(\vecthre │ │ │ +000da340: 6574 6872 6565 7b66 5f78 7d7b 307d 7b63 ethree{f_x}{0}{c │ │ │ +000da350: 5f78 7d7b 307d 7b66 5f79 7d7b 635f 797d _x}{0}{f_y}{c_y} │ │ │ +000da360: 7b30 7d7b 307d 7b31 7d5c 2920 2e3c 2f64 {0}{0}{1}\) ..
    dis │ │ │ +000da380: 7443 6f65 6666 733c 2f63 6f64 653e 202d tCoeffs - │ │ │ +000da390: 2044 6973 746f 7274 696f 6e20 636f 6566 Distortion coef │ │ │ +000da3a0: 6669 6369 656e 7473 3c2f 6464 3e0a 3c64 ficients
    .arg1 - automatica │ │ │ +000da3d0: 6c6c 7920 6765 6e65 7261 7465 643c 2f64 lly generated.
    .. │ │ │ +000da3f0: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e

    .
  • │ │ │ +000da400: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    un │ │ │ +000da490: 6469 7374 6f72 7449 6d61 6765 506f 696e distortImagePoin │ │ │ +000da4a0: 7473 3c2f 6833 3e0a 3c64 6976 2063 6c61 ts

    .
    .
    pu │ │ │ +000da500: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static void&nb │ │ │ +000da540: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;un │ │ │ +000da560: 6469 7374 6f72 7449 6d61 6765 506f 696e distortImagePoin │ │ │ +000da570: 7473 3c2f 7370 616e 3e3c 7762 723e 3c73 ts(Mat  │ │ │ +000da5e0: 3b73 7263 2c0a 203c 6120 6872 6566 3d22 ;src,. Mat  │ │ │ +000da630: 6473 742c 0a20 3c61 2068 7265 663d 222e dst,. Mat c │ │ │ +000da680: 616d 6572 614d 6174 7269 782c 0a20 3c61 ameraMatrix,. Mat distCoeff │ │ │ +000da6e0: 7329 3c2f 7370 616e 3e3c 2f64 6976 3e0a s)
    . │ │ │ +000da6f0: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Compute undis │ │ │ +000da710: 746f 7274 6564 2069 6d61 6765 2070 6f69 torted image poi │ │ │ +000da720: 6e74 7320 706f 7369 7469 6f6e 3c2f 6469 nts position.
    .
    Parame │ │ │ +000da750: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ +000da760: 636f 6465 3e73 7263 3c2f 636f 6465 3e20 code>src │ │ │ +000da770: 2d20 4f62 7365 7276 6564 2070 6f69 6e74 - Observed point │ │ │ +000da780: 7320 706f 7369 7469 6f6e 2c20 3278 4e2f s position, 2xN/ │ │ │ +000da790: 4e78 3220 312d 6368 616e 6e65 6c20 6f72 Nx2 1-channel or │ │ │ +000da7a0: 2031 784e 2f4e 7831 2032 2d63 6861 6e6e 1xN/Nx1 2-chann │ │ │ +000da7b0: 656c 2028 4356 5f33 3246 4332 206f 7220 el (CV_32FC2 or │ │ │ +000da7c0: 4356 5f36 3446 4332 2920 286f 7220 7665 CV_64FC2) (or ve │ │ │ +000da7d0: 6374 6f72 266c 743b 506f 696e 7432 6626 ctor<Point2f& │ │ │ +000da7e0: 6774 3b20 292e 3c2f 6464 3e0a 3c64 643e gt; ).
    .
    │ │ │ +000da7f0: 3c63 6f64 653e 6473 743c 2f63 6f64 653e dst │ │ │ +000da800: 202d 204f 7574 7075 7420 756e 6469 7374 - Output undist │ │ │ +000da810: 6f72 7465 6420 706f 696e 7473 2070 6f73 orted points pos │ │ │ +000da820: 6974 696f 6e20 2831 784e 2f4e 7831 2032 ition (1xN/Nx1 2 │ │ │ +000da830: 2d63 6861 6e6e 656c 206f 7220 7665 6374 -channel or vect │ │ │ +000da840: 6f72 266c 743b 506f 696e 7432 6626 6774 or<Point2f> │ │ │ +000da850: 3b20 292e 3c2f 6464 3e0a 3c64 643e 3c63 ; ).
    .
    cameraMatrix │ │ │ +000da870: 3c2f 636f 6465 3e20 2d20 4361 6d65 7261 - Camera │ │ │ +000da880: 206d 6174 7269 7820 5c28 5c76 6563 7468 matrix \(\vecth │ │ │ +000da890: 7265 6574 6872 6565 7b66 5f78 7d7b 307d reethree{f_x}{0} │ │ │ +000da8a0: 7b63 5f78 7d7b 307d 7b66 5f79 7d7b 635f {c_x}{0}{f_y}{c_ │ │ │ +000da8b0: 797d 7b30 7d7b 307d 7b31 7d5c 2920 2e3c y}{0}{0}{1}\) .< │ │ │ +000da8c0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ +000da8d0: 6973 7443 6f65 6666 733c 2f63 6f64 653e istCoeffs │ │ │ +000da8e0: 202d 2044 6973 746f 7274 696f 6e20 636f - Distortion co │ │ │ +000da8f0: 6566 6669 6369 656e 7473 3c2f 6464 3e0a efficients
    . │ │ │ +000da900: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    .
    .
  • ..
    .

    f │ │ │ +000da9f0: 6973 6865 7965 5f70 726f 6a65 6374 506f isheye_projectPo │ │ │ +000daa00: 696e 7473 3c2f 6833 3e0a 3c64 6976 2063 ints

    .
    .
    │ │ │ +000daa60: 7075 626c 6963 2073 7461 7469 633c 2f73 public static void& │ │ │ +000daaa0: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ +000daac0: 6669 7368 6579 655f 7072 6f6a 6563 7450 fisheye_projectP │ │ │ +000daad0: 6f69 6e74 733c 2f73 7061 6e3e 3c77 6272 oints(Mat&n │ │ │ +000dab40: 6273 703b 6f62 6a65 6374 506f 696e 7473 bsp;objectPoints │ │ │ +000dab50: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000dab90: 6174 3c2f 613e 266e 6273 703b 696d 6167 at imag │ │ │ +000daba0: 6550 6f69 6e74 732c 0a20 3c61 2068 7265 ePoints,. Mat&nb │ │ │ +000dabf0: 7370 3b72 7665 632c 0a20 3c61 2068 7265 sp;rvec,. Mat&nb │ │ │ +000dac40: 7370 3b74 7665 632c 0a20 3c61 2068 7265 sp;tvec,. Mat&nb │ │ │ +000dac90: 7370 3b4b 2c0a 203c 6120 6872 6566 3d22 sp;K,. Mat  │ │ │ +000dace0: 442c 0a20 646f 7562 6c65 266e 6273 703b D,. double  │ │ │ +000dacf0: 616c 7068 612c 0a20 3c61 2068 7265 663d alpha,. Mat  │ │ │ +000dad40: 3b6a 6163 6f62 6961 6e29 3c2f 7370 616e ;jacobian)
    .
    .< │ │ │ +000dad60: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.. │ │ │ +000dad70: 3c6c 693e 0a3c 7365 6374 696f 6e20 636c
  • .
    .

    fis │ │ │ +000dae30: 6865 7965 5f70 726f 6a65 6374 506f 696e heye_projectPoin │ │ │ +000dae40: 7473 3c2f 6833 3e0a 3c64 6976 2063 6c61 ts

    .
    .
    pu │ │ │ +000daea0: 626c 6963 2073 7461 7469 633c 2f73 7061 blic static void&nb │ │ │ +000daee0: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;fi │ │ │ +000daf00: 7368 6579 655f 7072 6f6a 6563 7450 6f69 sheye_projectPoi │ │ │ +000daf10: 6e74 733c 2f73 7061 6e3e 3c77 6272 3e3c nts< │ │ │ +000daf20: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +000daf30: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ +000daf80: 703b 6f62 6a65 6374 506f 696e 7473 2c0a p;objectPoints,. │ │ │ +000daf90: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000dafd0: 3c2f 613e 266e 6273 703b 696d 6167 6550  imageP │ │ │ +000dafe0: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ +000db030: 3b72 7665 632c 0a20 3c61 2068 7265 663d ;rvec,. Mat  │ │ │ +000db080: 3b74 7665 632c 0a20 3c61 2068 7265 663d ;tvec,. Mat  │ │ │ +000db0d0: 3b4b 2c0a 203c 6120 6872 6566 3d22 2e2e ;K,. Mat D, │ │ │ +000db120: 0a20 646f 7562 6c65 266e 6273 703b 616c . double al │ │ │ +000db130: 7068 6129 3c2f 7370 616e 3e3c 2f64 6976 pha)
    .
    ..
  • .
  • .< │ │ │ +000db160: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +000db170: 6574 6169 6c22 2069 643d 2266 6973 6865 etail" id="fishe │ │ │ +000db180: 7965 5f70 726f 6a65 6374 506f 696e 7473 ye_projectPoints │ │ │ +000db190: 286f 7267 2e6f 7065 6e63 762e 636f 7265 (org.opencv.core │ │ │ +000db1a0: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ +000db1b0: 636f 7265 2e4d 6174 2c6f 7267 2e6f 7065 core.Mat,org.ope │ │ │ +000db1c0: 6e63 762e 636f 7265 2e4d 6174 2c6f 7267 ncv.core.Mat,org │ │ │ +000db1d0: 2e6f 7065 6e63 762e 636f 7265 2e4d 6174 .opencv.core.Mat │ │ │ +000db1e0: 2c6f 7267 2e6f 7065 6e63 762e 636f 7265 ,org.opencv.core │ │ │ +000db1f0: 2e4d 6174 2c6f 7267 2e6f 7065 6e63 762e .Mat,org.opencv. │ │ │ +000db200: 636f 7265 2e4d 6174 2922 3e0a 3c68 333e core.Mat)">.

    │ │ │ +000db210: 6669 7368 6579 655f 7072 6f6a 6563 7450 fisheye_projectP │ │ │ +000db220: 6f69 6e74 733c 2f68 333e 0a3c 6469 7620 oints

    .
    .
    public static void │ │ │ +000db2c0: 266e 6273 703b 3c73 7061 6e20 636c 6173  fisheye_project │ │ │ +000db2f0: 506f 696e 7473 3c2f 7370 616e 3e3c 7762 Points(Mat& │ │ │ +000db360: 6e62 7370 3b6f 626a 6563 7450 6f69 6e74 nbsp;objectPoint │ │ │ +000db370: 732c 0a20 3c61 2068 7265 663d 222e 2e2f s,. │ │ │ +000db3b0: 4d61 743c 2f61 3e26 6e62 7370 3b69 6d61 Mat ima │ │ │ +000db3c0: 6765 506f 696e 7473 2c0a 203c 6120 6872 gePoints,. Mat&n │ │ │ +000db410: 6273 703b 7276 6563 2c0a 203c 6120 6872 bsp;rvec,. Mat&n │ │ │ +000db460: 6273 703b 7476 6563 2c0a 203c 6120 6872 bsp;tvec,. Mat&n │ │ │ +000db4b0: 6273 703b 4b2c 0a20 3c61 2068 7265 663d bsp;K,. Mat  │ │ │ +000db500: 3b44 293c 2f73 7061 6e3e 3c2f 6469 763e ;D)
    │ │ │ +000db510: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ..
  • .
  • ..

    fi │ │ │ +000db5c0: 7368 6579 655f 6469 7374 6f72 7450 6f69 sheye_distortPoi │ │ │ +000db5d0: 6e74 733c 2f68 333e 0a3c 6469 7620 636c nts

    .
    .
    p │ │ │ +000db630: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static void&n │ │ │ +000db670: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;f │ │ │ +000db690: 6973 6865 7965 5f64 6973 746f 7274 506f isheye_distortPo │ │ │ +000db6a0: 696e 7473 3c2f 7370 616e 3e3c 7762 723e ints │ │ │ +000db6b0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +000db710: 7370 3b75 6e64 6973 746f 7274 6564 2c0a sp;undistorted,. │ │ │ +000db720: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000db760: 3c2f 613e 266e 6273 703b 6469 7374 6f72  distor │ │ │ +000db770: 7465 642c 0a20 3c61 2068 7265 663d 222e ted,. Mat K │ │ │ +000db7c0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000db800: 6174 3c2f 613e 266e 6273 703b 442c 0a20 at D,. │ │ │ +000db810: 646f 7562 6c65 266e 6273 703b 616c 7068 double alph │ │ │ +000db820: 6129 3c2f 7370 616e 3e3c 2f64 6976 3e0a a)
    . │ │ │ +000db830: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Distorts 2D p │ │ │ +000db850: 6f69 6e74 7320 7573 696e 6720 6669 7368 oints using fish │ │ │ +000db860: 6579 6520 6d6f 6465 6c2e 3c2f 6469 763e eye model.
    │ │ │ +000db870: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ +000db890: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    undistorted - Array of │ │ │ +000db8c0: 206f 626a 6563 7420 706f 696e 7473 2c20 object points, │ │ │ +000db8d0: 3178 4e2f 4e78 3120 322d 6368 616e 6e65 1xN/Nx1 2-channe │ │ │ +000db8e0: 6c20 286f 7220 7665 6374 6f72 266c 743b l (or vector< │ │ │ +000db8f0: 506f 696e 7432 6626 6774 3b20 292c 2077 Point2f> ), w │ │ │ +000db900: 6865 7265 204e 2069 730a 7468 6520 6e75 here N is.the nu │ │ │ +000db910: 6d62 6572 206f 6620 706f 696e 7473 2069 mber of points i │ │ │ +000db920: 6e20 7468 6520 7669 6577 2e3c 2f64 643e n the view.
    │ │ │ +000db930: 0a3c 6464 3e3c 636f 6465 3e64 6973 746f .
    disto │ │ │ +000db940: 7274 6564 3c2f 636f 6465 3e20 2d20 4f75 rted - Ou │ │ │ +000db950: 7470 7574 2061 7272 6179 206f 6620 696d tput array of im │ │ │ +000db960: 6167 6520 706f 696e 7473 2c20 3178 4e2f age points, 1xN/ │ │ │ +000db970: 4e78 3120 322d 6368 616e 6e65 6c2c 206f Nx1 2-channel, o │ │ │ +000db980: 7220 7665 6374 6f72 266c 743b 506f 696e r vector<Poin │ │ │ +000db990: 7432 6626 6774 3b20 2e0a 0a4e 6f74 6520 t2f> ...Note │ │ │ +000db9a0: 7468 6174 2074 6865 2066 756e 6374 696f that the functio │ │ │ +000db9b0: 6e20 6173 7375 6d65 7320 7468 6520 6361 n assumes the ca │ │ │ +000db9c0: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ +000db9d0: 6174 7269 7820 6f66 2074 6865 2075 6e64 atrix of the und │ │ │ +000db9e0: 6973 746f 7274 6564 2070 6f69 6e74 7320 istorted points │ │ │ +000db9f0: 746f 2062 6520 6964 656e 7469 7479 2e0a to be identity.. │ │ │ +000dba00: 5468 6973 206d 6561 6e73 2069 6620 796f This means if yo │ │ │ +000dba10: 7520 7761 6e74 2074 6f20 6469 7374 6f72 u want to distor │ │ │ +000dba20: 7420 696d 6167 6520 706f 696e 7473 2079 t image points y │ │ │ +000dba30: 6f75 2068 6176 6520 746f 206d 756c 7469 ou have to multi │ │ │ +000dba40: 706c 7920 7468 656d 2077 6974 6820 5c28 ply them with \( │ │ │ +000dba50: 4b5e 7b2d 317d 5c29 206f 720a 7573 6520 K^{-1}\) or.use │ │ │ +000dba60: 616e 6f74 6865 7220 6675 6e63 7469 6f6e another function │ │ │ +000dba70: 206f 7665 726c 6f61 642e 3c2f 6464 3e0a overload.
    . │ │ │ +000dba80: 3c64 643e 3c63 6f64 653e 4b3c 2f63 6f64
    K - Camera intr │ │ │ +000dbaa0: 696e 7369 6320 6d61 7472 6978 205c 2863 insic matrix \(c │ │ │ +000dbab0: 616d 6572 616d 6174 7269 787b 4b7d 5c29 ameramatrix{K}\) │ │ │ +000dbac0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    D - Inpu │ │ │ +000dbae0: 7420 7665 6374 6f72 206f 6620 6469 7374 t vector of dist │ │ │ +000dbaf0: 6f72 7469 6f6e 2063 6f65 6666 6963 6965 ortion coefficie │ │ │ +000dbb00: 6e74 7320 5c28 5c64 6973 7463 6f65 6666 nts \(\distcoeff │ │ │ +000dbb10: 7366 6973 6865 7965 5c29 2e3c 2f64 643e sfisheye\).
    │ │ │ +000dbb20: 0a3c 6464 3e3c 636f 6465 3e61 6c70 6861 .
    alpha │ │ │ +000dbb30: 3c2f 636f 6465 3e20 2d20 5468 6520 736b - The sk │ │ │ +000dbb40: 6577 2063 6f65 6666 6963 6965 6e74 2e3c ew coefficient.< │ │ │ +000dbb50: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .
  • .
    .
  • .
    .

    fisheye_distort │ │ │ +000dbc10: 506f 696e 7473 3c2f 6833 3e0a 3c64 6976 Points

    .
    .
    public static< │ │ │ +000dbc80: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> void fisheye_distor │ │ │ +000dbce0: 7450 6f69 6e74 733c 2f73 7061 6e3e 3c77 tPoints(Mat │ │ │ +000dbd50: 266e 6273 703b 756e 6469 7374 6f72 7465  undistorte │ │ │ +000dbd60: 642c 0a20 3c61 2068 7265 663d 222e 2e2f d,. │ │ │ +000dbda0: 4d61 743c 2f61 3e26 6e62 7370 3b64 6973 Mat dis │ │ │ +000dbdb0: 746f 7274 6564 2c0a 203c 6120 6872 6566 torted,. Mat&nbs │ │ │ +000dbe00: 703b 4b2c 0a20 3c61 2068 7265 663d 222e p;K,. Mat D │ │ │ +000dbe50: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ +000dbe60: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ +000dbe70: 223e 4469 7374 6f72 7473 2032 4420 706f ">Distorts 2D po │ │ │ +000dbe80: 696e 7473 2075 7369 6e67 2066 6973 6865 ints using fishe │ │ │ +000dbe90: 7965 206d 6f64 656c 2e3c 2f64 6976 3e0a ye model.
    . │ │ │ +000dbea0: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ +000dbec0: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    undistorted - Array of │ │ │ +000dbef0: 6f62 6a65 6374 2070 6f69 6e74 732c 2031 object points, 1 │ │ │ +000dbf00: 784e 2f4e 7831 2032 2d63 6861 6e6e 656c xN/Nx1 2-channel │ │ │ +000dbf10: 2028 6f72 2076 6563 746f 7226 6c74 3b50 (or vector<P │ │ │ +000dbf20: 6f69 6e74 3266 2667 743b 2029 2c20 7768 oint2f> ), wh │ │ │ +000dbf30: 6572 6520 4e20 6973 0a74 6865 206e 756d ere N is.the num │ │ │ +000dbf40: 6265 7220 6f66 2070 6f69 6e74 7320 696e ber of points in │ │ │ +000dbf50: 2074 6865 2076 6965 772e 3c2f 6464 3e0a the view.
    . │ │ │ +000dbf60: 3c64 643e 3c63 6f64 653e 6469 7374 6f72
    distor │ │ │ +000dbf70: 7465 643c 2f63 6f64 653e 202d 204f 7574 ted - Out │ │ │ +000dbf80: 7075 7420 6172 7261 7920 6f66 2069 6d61 put array of ima │ │ │ +000dbf90: 6765 2070 6f69 6e74 732c 2031 784e 2f4e ge points, 1xN/N │ │ │ +000dbfa0: 7831 2032 2d63 6861 6e6e 656c 2c20 6f72 x1 2-channel, or │ │ │ +000dbfb0: 2076 6563 746f 7226 6c74 3b50 6f69 6e74 vector<Point │ │ │ +000dbfc0: 3266 2667 743b 202e 0a0a 4e6f 7465 2074 2f> ...Note t │ │ │ +000dbfd0: 6861 7420 7468 6520 6675 6e63 7469 6f6e hat the function │ │ │ +000dbfe0: 2061 7373 756d 6573 2074 6865 2063 616d assumes the cam │ │ │ +000dbff0: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +000dc000: 7472 6978 206f 6620 7468 6520 756e 6469 trix of the undi │ │ │ +000dc010: 7374 6f72 7465 6420 706f 696e 7473 2074 storted points t │ │ │ +000dc020: 6f20 6265 2069 6465 6e74 6974 792e 0a54 o be identity..T │ │ │ +000dc030: 6869 7320 6d65 616e 7320 6966 2079 6f75 his means if you │ │ │ +000dc040: 2077 616e 7420 746f 2064 6973 746f 7274 want to distort │ │ │ +000dc050: 2069 6d61 6765 2070 6f69 6e74 7320 796f image points yo │ │ │ +000dc060: 7520 6861 7665 2074 6f20 6d75 6c74 6970 u have to multip │ │ │ +000dc070: 6c79 2074 6865 6d20 7769 7468 205c 284b ly them with \(K │ │ │ +000dc080: 5e7b 2d31 7d5c 2920 6f72 0a75 7365 2061 ^{-1}\) or.use a │ │ │ +000dc090: 6e6f 7468 6572 2066 756e 6374 696f 6e20 nother function │ │ │ +000dc0a0: 6f76 6572 6c6f 6164 2e3c 2f64 643e 0a3c overload.
    .< │ │ │ +000dc0b0: 6464 3e3c 636f 6465 3e4b 3c2f 636f 6465 dd>K - Camera intri │ │ │ +000dc0d0: 6e73 6963 206d 6174 7269 7820 5c28 6361 nsic matrix \(ca │ │ │ +000dc0e0: 6d65 7261 6d61 7472 6978 7b4b 7d5c 292e meramatrix{K}\). │ │ │ +000dc0f0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e .
    │ │ │ +000dc100: 443c 2f63 6f64 653e 202d 2049 6e70 7574 D - Input │ │ │ +000dc110: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ +000dc120: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ +000dc130: 7473 205c 285c 6469 7374 636f 6566 6673 ts \(\distcoeffs │ │ │ +000dc140: 6669 7368 6579 655c 292e 3c2f 6464 3e0a fisheye\).
    . │ │ │ +000dc150: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    ..
    .
  • ..
    .

    fisheye_d │ │ │ +000dc220: 6973 746f 7274 506f 696e 7473 3c2f 6833 istortPoints

    .
    .
    │ │ │ +000dc270: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +000dc290: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +000dc2a0: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;void │ │ │ +000dc2c0: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  fisheye_ │ │ │ +000dc2f0: 6469 7374 6f72 7450 6f69 6e74 733c 2f73 distortPoints(M │ │ │ +000dc360: 6174 3c2f 613e 266e 6273 703b 756e 6469 at undi │ │ │ +000dc370: 7374 6f72 7465 642c 0a20 3c61 2068 7265 storted,. Mat&nb │ │ │ +000dc3c0: 7370 3b64 6973 746f 7274 6564 2c0a 203c sp;distorted,. < │ │ │ +000dc3d0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000dc3e0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000dc3f0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000dc400: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat Kundisto │ │ │ +000dc420: 7274 6564 2c0a 203c 6120 6872 6566 3d22 rted,. Mat  │ │ │ +000dc470: 4b2c 0a20 3c61 2068 7265 663d 222e 2e2f K,. │ │ │ +000dc4b0: 4d61 743c 2f61 3e26 6e62 7370 3b44 2c0a Mat D,. │ │ │ +000dc4c0: 2064 6f75 626c 6526 6e62 7370 3b61 6c70 double alp │ │ │ +000dc4d0: 6861 293c 2f73 7061 6e3e 3c2f 6469 763e ha)
    │ │ │ +000dc4e0: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Overload of │ │ │ +000dc500: 6469 7374 6f72 7450 6f69 6e74 7320 6675 distortPoints fu │ │ │ +000dc510: 6e63 7469 6f6e 2074 6f20 6861 6e64 6c65 nction to handle │ │ │ +000dc520: 2063 6173 6573 2077 6865 6e20 756e 6469 cases when undi │ │ │ +000dc530: 7374 6f72 7465 6420 706f 696e 7473 2061 storted points a │ │ │ +000dc540: 7265 2067 6f74 2077 6974 6820 6e6f 6e2d re got with non- │ │ │ +000dc550: 6964 656e 7469 7479 0a63 616d 6572 6120 identity.camera │ │ │ +000dc560: 6d61 7472 6978 2c20 652e 672e 206f 7574 matrix, e.g. out │ │ │ +000dc570: 7075 7420 6f66 2023 6573 7469 6d61 7465 put of #estimate │ │ │ +000dc580: 4e65 7743 616d 6572 614d 6174 7269 7846 NewCameraMatrixF │ │ │ +000dc590: 6f72 556e 6469 7374 6f72 7452 6563 7469 orUndistortRecti │ │ │ +000dc5a0: 6679 2e3c 2f64 6976 3e0a 3c64 6c20 636c fy.
    .
    .
    Parameters:
    .
    undi │ │ │ +000dc5e0: 7374 6f72 7465 643c 2f63 6f64 653e 202d storted - │ │ │ +000dc5f0: 2041 7272 6179 206f 6620 6f62 6a65 6374 Array of object │ │ │ +000dc600: 2070 6f69 6e74 732c 2031 784e 2f4e 7831 points, 1xN/Nx1 │ │ │ +000dc610: 2032 2d63 6861 6e6e 656c 2028 6f72 2076 2-channel (or v │ │ │ +000dc620: 6563 746f 7226 6c74 3b50 6f69 6e74 3266 ector<Point2f │ │ │ +000dc630: 2667 743b 2029 2c20 7768 6572 6520 4e20 > ), where N │ │ │ +000dc640: 6973 0a74 6865 206e 756d 6265 7220 6f66 is.the number of │ │ │ +000dc650: 2070 6f69 6e74 7320 696e 2074 6865 2076 points in the v │ │ │ +000dc660: 6965 772e 3c2f 6464 3e0a 3c64 643e 3c63 iew.
    .
    distorted - Output ar │ │ │ +000dc690: 7261 7920 6f66 2069 6d61 6765 2070 6f69 ray of image poi │ │ │ +000dc6a0: 6e74 732c 2031 784e 2f4e 7831 2032 2d63 nts, 1xN/Nx1 2-c │ │ │ +000dc6b0: 6861 6e6e 656c 2c20 6f72 2076 6563 746f hannel, or vecto │ │ │ +000dc6c0: 7226 6c74 3b50 6f69 6e74 3266 2667 743b r<Point2f> │ │ │ +000dc6d0: 202e 0a53 4545 3a20 6573 7469 6d61 7465 ..SEE: estimate │ │ │ +000dc6e0: 4e65 7743 616d 6572 614d 6174 7269 7846 NewCameraMatrixF │ │ │ +000dc6f0: 6f72 556e 6469 7374 6f72 7452 6563 7469 orUndistortRecti │ │ │ +000dc700: 6679 3c2f 6464 3e0a 3c64 643e 3c63 6f64 fy
    .
    Kundistorted - Camera i │ │ │ +000dc730: 6e74 7269 6e73 6963 206d 6174 7269 7820 ntrinsic matrix │ │ │ +000dc740: 7573 6564 2061 7320 6e65 7720 6361 6d65 used as new came │ │ │ +000dc750: 7261 206d 6174 7269 7820 666f 7220 756e ra matrix for un │ │ │ +000dc760: 6469 7374 6f72 7469 6f6e 2e3c 2f64 643e distortion.
    │ │ │ +000dc770: 0a3c 6464 3e3c 636f 6465 3e4b 3c2f 636f .
    K - Camera int │ │ │ +000dc790: 7269 6e73 6963 206d 6174 7269 7820 5c28 rinsic matrix \( │ │ │ +000dc7a0: 6361 6d65 7261 6d61 7472 6978 7b4b 7d5c cameramatrix{K}\ │ │ │ +000dc7b0: 292e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 ).
    .
    D - Inp │ │ │ +000dc7d0: 7574 2076 6563 746f 7220 6f66 2064 6973 ut vector of dis │ │ │ +000dc7e0: 746f 7274 696f 6e20 636f 6566 6669 6369 tortion coeffici │ │ │ +000dc7f0: 656e 7473 205c 285c 6469 7374 636f 6566 ents \(\distcoef │ │ │ +000dc800: 6673 6669 7368 6579 655c 292e 3c2f 6464 fsfisheye\).
    .
    alph │ │ │ +000dc820: 613c 2f63 6f64 653e 202d 2054 6865 2073 a - The s │ │ │ +000dc830: 6b65 7720 636f 6566 6669 6369 656e 742e kew coefficient. │ │ │ +000dc840: 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f 6469
    .
    ..
    ..
  • ..

    fisheye_di │ │ │ +000dc910: 7374 6f72 7450 6f69 6e74 733c 2f68 333e stortPoints

    │ │ │ +000dc920: 0a3c 6469 7620 636c 6173 733d 2268 6f72 .
    │ │ │ +000dc940: 0a3c 6469 7620 636c 6173 733d 226d 656d .
    < │ │ │ +000dc960: 7370 616e 2063 6c61 7373 3d22 6d6f 6469 span class="modi │ │ │ +000dc970: 6669 6572 7322 3e70 7562 6c69 6320 7374 fiers">public st │ │ │ +000dc980: 6174 6963 3c2f 7370 616e 3e26 6e62 7370 atic  │ │ │ +000dc990: 3b3c 7370 616e 2063 6c61 7373 3d22 7265 ;void< │ │ │ +000dc9b0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> fisheye_d │ │ │ +000dc9e0: 6973 746f 7274 506f 696e 7473 3c2f 7370 istortPoints(Ma │ │ │ +000dca50: 743c 2f61 3e26 6e62 7370 3b75 6e64 6973 t undis │ │ │ +000dca60: 746f 7274 6564 2c0a 203c 6120 6872 6566 torted,. Mat&nbs │ │ │ +000dcab0: 703b 6469 7374 6f72 7465 642c 0a20 3c61 p;distorted,. Mat Kundistor │ │ │ +000dcb10: 7465 642c 0a20 3c61 2068 7265 663d 222e ted,. Mat K │ │ │ +000dcb60: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000dcba0: 6174 3c2f 613e 266e 6273 703b 4429 3c2f at D)
    .
    O │ │ │ +000dcbd0: 7665 726c 6f61 6420 6f66 2064 6973 746f verload of disto │ │ │ +000dcbe0: 7274 506f 696e 7473 2066 756e 6374 696f rtPoints functio │ │ │ +000dcbf0: 6e20 746f 2068 616e 646c 6520 6361 7365 n to handle case │ │ │ +000dcc00: 7320 7768 656e 2075 6e64 6973 746f 7274 s when undistort │ │ │ +000dcc10: 6564 2070 6f69 6e74 7320 6172 6520 676f ed points are go │ │ │ +000dcc20: 7420 7769 7468 206e 6f6e 2d69 6465 6e74 t with non-ident │ │ │ +000dcc30: 6974 790a 6361 6d65 7261 206d 6174 7269 ity.camera matri │ │ │ +000dcc40: 782c 2065 2e67 2e20 6f75 7470 7574 206f x, e.g. output o │ │ │ +000dcc50: 6620 2365 7374 696d 6174 654e 6577 4361 f #estimateNewCa │ │ │ +000dcc60: 6d65 7261 4d61 7472 6978 466f 7255 6e64 meraMatrixForUnd │ │ │ +000dcc70: 6973 746f 7274 5265 6374 6966 792e 3c2f istortRectify..
    .
    Para │ │ │ +000dcca0: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    undistort │ │ │ +000dccc0: 6564 3c2f 636f 6465 3e20 2d20 4172 7261 ed - Arra │ │ │ +000dccd0: 7920 6f66 206f 626a 6563 7420 706f 696e y of object poin │ │ │ +000dcce0: 7473 2c20 3178 4e2f 4e78 3120 322d 6368 ts, 1xN/Nx1 2-ch │ │ │ +000dccf0: 616e 6e65 6c20 286f 7220 7665 6374 6f72 annel (or vector │ │ │ +000dcd00: 266c 743b 506f 696e 7432 6626 6774 3b20 <Point2f> │ │ │ +000dcd10: 292c 2077 6865 7265 204e 2069 730a 7468 ), where N is.th │ │ │ +000dcd20: 6520 6e75 6d62 6572 206f 6620 706f 696e e number of poin │ │ │ +000dcd30: 7473 2069 6e20 7468 6520 7669 6577 2e3c ts in the view.< │ │ │ +000dcd40: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e64 /dd>.
    d │ │ │ +000dcd50: 6973 746f 7274 6564 3c2f 636f 6465 3e20 istorted │ │ │ +000dcd60: 2d20 4f75 7470 7574 2061 7272 6179 206f - Output array o │ │ │ +000dcd70: 6620 696d 6167 6520 706f 696e 7473 2c20 f image points, │ │ │ +000dcd80: 3178 4e2f 4e78 3120 322d 6368 616e 6e65 1xN/Nx1 2-channe │ │ │ +000dcd90: 6c2c 206f 7220 7665 6374 6f72 266c 743b l, or vector< │ │ │ +000dcda0: 506f 696e 7432 6626 6774 3b20 2e0a 5345 Point2f> ..SE │ │ │ +000dcdb0: 453a 2065 7374 696d 6174 654e 6577 4361 E: estimateNewCa │ │ │ +000dcdc0: 6d65 7261 4d61 7472 6978 466f 7255 6e64 meraMatrixForUnd │ │ │ +000dcdd0: 6973 746f 7274 5265 6374 6966 793c 2f64 istortRectify.
    Kun │ │ │ +000dcdf0: 6469 7374 6f72 7465 643c 2f63 6f64 653e distorted │ │ │ +000dce00: 202d 2043 616d 6572 6120 696e 7472 696e - Camera intrin │ │ │ +000dce10: 7369 6320 6d61 7472 6978 2075 7365 6420 sic matrix used │ │ │ +000dce20: 6173 206e 6577 2063 616d 6572 6120 6d61 as new camera ma │ │ │ +000dce30: 7472 6978 2066 6f72 2075 6e64 6973 746f trix for undisto │ │ │ +000dce40: 7274 696f 6e2e 3c2f 6464 3e0a 3c64 643e rtion.
    .
    │ │ │ +000dce50: 3c63 6f64 653e 4b3c 2f63 6f64 653e 202d K - │ │ │ +000dce60: 2043 616d 6572 6120 696e 7472 696e 7369 Camera intrinsi │ │ │ +000dce70: 6320 6d61 7472 6978 205c 2863 616d 6572 c matrix \(camer │ │ │ +000dce80: 616d 6174 7269 787b 4b7d 5c29 2e3c 2f64 amatrix{K}\)..
    D - Input ve │ │ │ +000dceb0: 6374 6f72 206f 6620 6469 7374 6f72 7469 ctor of distorti │ │ │ +000dcec0: 6f6e 2063 6f65 6666 6963 6965 6e74 7320 on coefficients │ │ │ +000dced0: 5c28 5c64 6973 7463 6f65 6666 7366 6973 \(\distcoeffsfis │ │ │ +000dcee0: 6865 7965 5c29 2e3c 2f64 643e 0a3c 2f64 heye\).
    ..
    ..
  • .
  • . │ │ │ +000dcf10: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    │ │ │ +000dcfe0: 6669 7368 6579 655f 756e 6469 7374 6f72 fisheye_undistor │ │ │ +000dcff0: 7450 6f69 6e74 733c 2f68 333e 0a3c 6469 tPoints

    ..public static │ │ │ +000dd060: 3c2f 7370 616e 3e26 6e62 7370 3b3c 7370  void fisheye_undis │ │ │ +000dd0c0: 746f 7274 506f 696e 7473 3c2f 7370 616e tortPoints( │ │ │ +000dd0f0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000dd130: 2f61 3e26 6e62 7370 3b64 6973 746f 7274 /a> distort │ │ │ +000dd140: 6564 2c0a 203c 6120 6872 6566 3d22 2e2e ed,. Mat un │ │ │ +000dd190: 6469 7374 6f72 7465 642c 0a20 3c61 2068 distorted,. Mat& │ │ │ +000dd1e0: 6e62 7370 3b4b 2c0a 203c 6120 6872 6566 nbsp;K,. Mat&nbs │ │ │ +000dd230: 703b 442c 0a20 3c61 2068 7265 663d 222e p;D,. Mat R │ │ │ +000dd280: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000dd2c0: 6174 3c2f 613e 266e 6273 703b 502c 0a20 at P,. │ │ │ +000dd2d0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 TermCriteri │ │ │ +000dd320: 613c 2f61 3e26 6e62 7370 3b63 7269 7465 a crite │ │ │ +000dd330: 7269 6129 3c2f 7370 616e 3e3c 2f64 6976 ria).
    Undistorts │ │ │ +000dd360: 3244 2070 6f69 6e74 7320 7573 696e 6720 2D points using │ │ │ +000dd370: 6669 7368 6579 6520 6361 6d65 7261 206d fisheye camera m │ │ │ +000dd380: 6f64 656c 0a0a 5468 6973 2066 756e 6374 odel..This funct │ │ │ +000dd390: 696f 6e20 7065 7266 6f72 6d73 2075 6e64 ion performs und │ │ │ +000dd3a0: 6973 746f 7274 696f 6e20 666f 7220 6669 istortion for fi │ │ │ +000dd3b0: 7368 6579 6520 6361 6d65 7261 206d 6f64 sheye camera mod │ │ │ +000dd3c0: 656c 732c 2077 6869 6368 2075 7365 2061 els, which use a │ │ │ +000dd3d0: 2064 6966 6665 7265 6e74 2064 6973 746f different disto │ │ │ +000dd3e0: 7274 696f 6e20 6d6f 6465 6c0a 636f 6d70 rtion model.comp │ │ │ +000dd3f0: 6172 6564 2074 6f20 7468 6520 7374 616e ared to the stan │ │ │ +000dd400: 6461 7264 2070 696e 686f 6c65 2063 616d dard pinhole cam │ │ │ +000dd410: 6572 6120 6d6f 6465 6c20 7573 6564 2062 era model used b │ │ │ +000dd420: 7920 2375 6e64 6973 746f 7274 506f 696e y #undistortPoin │ │ │ +000dd430: 7473 2e20 5468 6520 6669 7368 6579 6520 ts. The fisheye │ │ │ +000dd440: 6d6f 6465 6c20 6973 2073 7569 7461 626c model is suitabl │ │ │ +000dd450: 650a 666f 7220 7769 6465 2d61 6e67 6c65 e.for wide-angle │ │ │ +000dd460: 2063 616d 6572 6173 2e0a 0a54 6865 2066 cameras...The f │ │ │ +000dd470: 756e 6374 696f 6e20 7472 616e 7366 6f72 unction transfor │ │ │ +000dd480: 6d73 2070 6f69 6e74 7320 6672 6f6d 2074 ms points from t │ │ │ +000dd490: 6865 2064 6973 746f 7274 6564 2066 6973 he distorted fis │ │ │ +000dd4a0: 6865 7965 2069 6d61 6765 2074 6f20 756e heye image to un │ │ │ +000dd4b0: 6469 7374 6f72 7465 6420 636f 6f72 6469 distorted coordi │ │ │ +000dd4c0: 6e61 7465 732c 206f 7074 696f 6e61 6c6c nates, optionall │ │ │ +000dd4d0: 790a 6170 706c 7969 6e67 2061 2072 6563 y.applying a rec │ │ │ +000dd4e0: 7469 6669 6361 7469 6f6e 2074 7261 6e73 tification trans │ │ │ +000dd4f0: 666f 726d 6174 696f 6e20 2852 2920 616e formation (R) an │ │ │ +000dd500: 6420 7072 6f6a 6563 7469 6e67 2074 6f20 d projecting to │ │ │ +000dd510: 6120 6e65 7720 696d 6167 6520 706c 616e a new image plan │ │ │ +000dd520: 6520 2850 292e 0a0a 3c62 3e4e 6f74 653a e (P)...Note: │ │ │ +000dd530: 3c2f 623e 203c 623e 436f 6f72 6469 6e61 Coordina │ │ │ +000dd540: 7465 2053 7973 7465 6d73 3a3c 2f62 3e0a te Systems:. │ │ │ +000dd550: 3c75 6c3e 0a20 203c 6c69 3e0a 203c 623e
      .
    • . │ │ │ +000dd560: 496e 7075 7420 283c 636f 6465 3e64 6973 Input (dis │ │ │ +000dd570: 746f 7274 6564 3c2f 636f 6465 3e29 3c2f torted): Points are e │ │ │ +000dd590: 7870 6563 7465 6420 696e 203c 623e 7069 xpected in pi │ │ │ +000dd5a0: 7865 6c20 636f 6f72 6469 6e61 7465 733c xel coordinates< │ │ │ +000dd5b0: 2f62 3e20 6f66 2074 6865 2064 6973 746f /b> of the disto │ │ │ +000dd5c0: 7274 6564 2066 6973 6865 7965 2069 6d61 rted fisheye ima │ │ │ +000dd5d0: 6765 2c0a 2020 2020 692e 652e 2c20 636f ge,. i.e., co │ │ │ +000dd5e0: 6f72 6469 6e61 7465 7320 6d65 6173 7572 ordinates measur │ │ │ +000dd5f0: 6564 2069 6e20 7069 7865 6c73 2066 726f ed in pixels fro │ │ │ +000dd600: 6d20 7468 6520 746f 702d 6c65 6674 2063 m the top-left c │ │ │ +000dd610: 6f72 6e65 7220 6f66 2074 6865 2069 6d61 orner of the ima │ │ │ +000dd620: 6765 2e0a 2020 3c2f 6c69 3e0a 2020 3c6c ge..
    • . . Output (< │ │ │ +000dd640: 636f 6465 3e75 6e64 6973 746f 7274 6564 code>undistorted │ │ │ +000dd650: 3c2f 636f 6465 3e29 3c2f 623e 3a20 5468
      ): Th │ │ │ +000dd660: 6520 636f 6f72 6469 6e61 7465 2073 7973 e coordinate sys │ │ │ +000dd670: 7465 6d20 6465 7065 6e64 7320 6f6e 2070 tem depends on p │ │ │ +000dd680: 6172 616d 6574 6572 203c 636f 6465 3e50 arameter P │ │ │ +000dd690: 3c2f 636f 6465 3e3a 0a20 203c 756c 3e0a :.
        . │ │ │ +000dd6a0: 2020 2020 3c6c 693e 0a20 2020 2020 4966
      • . If │ │ │ +000dd6b0: 203c 636f 6465 3e50 3c2f 636f 6465 3e20 P │ │ │ +000dd6c0: 6973 2070 726f 7669 6465 6420 286e 6f74 is provided (not │ │ │ +000dd6d0: 2065 6d70 7479 293a 204f 7574 7075 7420 empty): Output │ │ │ +000dd6e0: 706f 696e 7473 2061 7265 2069 6e20 3c62 points are in pixel coordinat │ │ │ +000dd700: 6573 3c2f 623e 206f 6620 7468 6520 7265 es of the re │ │ │ +000dd710: 6374 6966 6965 642f 756e 6469 7374 6f72 ctified/undistor │ │ │ +000dd720: 7465 640a 2020 2020 696d 6167 6520 706c ted. image pl │ │ │ +000dd730: 616e 652c 2075 7369 6e67 2074 6865 2063 ane, using the c │ │ │ +000dd740: 616d 6572 6120 6d61 7472 6978 203c 636f amera matrix P.. │ │ │ +000dd760: 203c 2f6c 693e 0a20 2020 203c 6c69 3e0a
      • .
      • . │ │ │ +000dd770: 2020 2020 2049 6620 3c63 6f64 653e 503c If P< │ │ │ +000dd780: 2f63 6f64 653e 2069 7320 656d 7074 7920 /code> is empty │ │ │ +000dd790: 6f72 2069 6465 6e74 6974 793a 204f 7574 or identity: Out │ │ │ +000dd7a0: 7075 7420 706f 696e 7473 2061 7265 2069 put points are i │ │ │ +000dd7b0: 6e20 3c62 3e6e 6f72 6d61 6c69 7a65 6420 n normalized │ │ │ +000dd7c0: 6361 6d65 7261 2063 6f6f 7264 696e 6174 camera coordinat │ │ │ +000dd7d0: 6573 3c2f 623e 2028 6e6f 726d 616c 697a es (normaliz │ │ │ +000dd7e0: 6564 2069 6d61 6765 2063 6f6f 7264 696e ed image coordin │ │ │ +000dd7f0: 6174 6573 292c 0a20 2020 2077 6869 6368 ates),. which │ │ │ +000dd800: 2061 7265 2064 696d 656e 7369 6f6e 6c65 are dimensionle │ │ │ +000dd810: 7373 2063 6f6f 7264 696e 6174 6573 2069 ss coordinates i │ │ │ +000dd820: 6e20 7468 6520 6361 6d65 7261 2773 2066 n the camera's f │ │ │ +000dd830: 6f63 616c 2070 6c61 6e65 2c20 696e 6465 ocal plane, inde │ │ │ +000dd840: 7065 6e64 656e 7420 6f66 2069 6e74 7269 pendent of intri │ │ │ +000dd850: 6e73 6963 2070 6172 616d 6574 6572 732e nsic parameters. │ │ │ +000dd860: 0a20 2020 203c 2f6c 693e 0a20 203c 2f75 .
      • .
        .. .
      .Note: < │ │ │ +000dd890: 623e 4669 7368 6579 6520 7673 2e20 5374 b>Fisheye vs. St │ │ │ +000dd8a0: 616e 6461 7264 204d 6f64 656c 3a3c 2f62 andard Model:
      .Use this funct │ │ │ +000dd8c0: 696f 6e20 2823 6376 3a3a 6669 7368 6579 ion (#cv::fishey │ │ │ +000dd8d0: 653a 3a75 6e64 6973 746f 7274 506f 696e e::undistortPoin │ │ │ +000dd8e0: 7473 2920 666f 7220 6669 7368 6579 6520 ts) for fisheye │ │ │ +000dd8f0: 6361 6d65 7261 7320 2877 6964 652d 616e cameras (wide-an │ │ │ +000dd900: 676c 6520 6c65 6e73 6573 292e 0a46 6f72 gle lenses)..For │ │ │ +000dd910: 2073 7461 6e64 6172 6420 7069 6e68 6f6c standard pinhol │ │ │ +000dd920: 6520 6361 6d65 7261 732c 2075 7365 2023 e cameras, use # │ │ │ +000dd930: 756e 6469 7374 6f72 7450 6f69 6e74 7320 undistortPoints │ │ │ +000dd940: 696e 7374 6561 642e 2054 6865 2066 6973 instead. The fis │ │ │ +000dd950: 6865 7965 206d 6f64 656c 2075 7365 7320 heye model uses │ │ │ +000dd960: 6120 6469 6666 6572 656e 7420 6469 7374 a different dist │ │ │ +000dd970: 6f72 7469 6f6e 0a70 6172 616d 6574 6572 ortion.parameter │ │ │ +000dd980: 697a 6174 696f 6e20 2834 2063 6f65 6666 ization (4 coeff │ │ │ +000dd990: 6963 6965 6e74 7329 2063 6f6d 7061 7265 icients) compare │ │ │ +000dd9a0: 6420 746f 2074 6865 2073 7461 6e64 6172 d to the standar │ │ │ +000dd9b0: 6420 6d6f 6465 6c20 2834 2d31 3420 636f d model (4-14 co │ │ │ +000dd9c0: 6566 6669 6369 656e 7473 292e 3c2f 6469 efficients)..
      .
      Parame │ │ │ +000dd9f0: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
      .
      < │ │ │ +000dda00: 636f 6465 3e64 6973 746f 7274 6564 3c2f code>distorted - Array of │ │ │ +000dda20: 2064 6973 746f 7274 6564 2070 6f69 6e74 distorted point │ │ │ +000dda30: 2063 6f6f 7264 696e 6174 6573 2069 6e20 coordinates in │ │ │ +000dda40: 3c62 3e70 6978 656c 2063 6f6f 7264 696e pixel coordin │ │ │ +000dda50: 6174 6573 3c2f 623e 206f 6620 7468 6520 ates of the │ │ │ +000dda60: 6669 7368 6579 6520 696d 6167 652c 0a31 fisheye image,.1 │ │ │ +000dda70: 784e 2f4e 7831 2032 2d63 6861 6e6e 656c xN/Nx1 2-channel │ │ │ +000dda80: 2028 6f72 2076 6563 746f 7226 6c74 3b50 (or vector<P │ │ │ +000dda90: 6f69 6e74 3266 2667 743b 2029 2c20 7768 oint2f> ), wh │ │ │ +000ddaa0: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ +000ddab0: 6265 7220 6f66 2070 6f69 6e74 7320 696e ber of points in │ │ │ +000ddac0: 2074 6865 2076 6965 772e 3c2f 6464 3e0a the view.
      . │ │ │ +000ddad0: 3c64 643e 3c63 6f64 653e 756e 6469 7374
      undist │ │ │ +000ddae0: 6f72 7465 643c 2f63 6f64 653e 202d 204f orted - O │ │ │ +000ddaf0: 7574 7075 7420 6172 7261 7920 6f66 2075 utput array of u │ │ │ +000ddb00: 6e64 6973 746f 7274 6564 2069 6d61 6765 ndistorted image │ │ │ +000ddb10: 2070 6f69 6e74 732c 2031 784e 2f4e 7831 points, 1xN/Nx1 │ │ │ +000ddb20: 2032 2d63 6861 6e6e 656c 2c20 6f72 2076 2-channel, or v │ │ │ +000ddb30: 6563 746f 7226 6c74 3b50 6f69 6e74 3266 ector<Point2f │ │ │ +000ddb40: 2667 743b 202e 0a54 6865 2063 6f6f 7264 > ..The coord │ │ │ +000ddb50: 696e 6174 6520 7379 7374 656d 2064 6570 inate system dep │ │ │ +000ddb60: 656e 6473 206f 6e20 7061 7261 6d65 7465 ends on paramete │ │ │ +000ddb70: 7220 5020 2873 6565 2061 626f 7665 292e r P (see above). │ │ │ +000ddb80: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
      .
      │ │ │ +000ddb90: 4b3c 2f63 6f64 653e 202d 2043 616d 6572 K - Camer │ │ │ +000ddba0: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ +000ddbb0: 6978 205c 285c 6361 6d65 7261 6d61 7472 ix \(\cameramatr │ │ │ +000ddbc0: 6978 7b4b 7d5c 2920 6f66 2074 6865 2066 ix{K}\) of the f │ │ │ +000ddbd0: 6973 6865 7965 2063 616d 6572 612e 3c2f isheye camera..
      D< │ │ │ +000ddbf0: 2f63 6f64 653e 202d 2049 6e70 7574 2076 /code> - Input v │ │ │ +000ddc00: 6563 746f 7220 6f66 2066 6973 6865 7965 ector of fisheye │ │ │ +000ddc10: 2064 6973 746f 7274 696f 6e20 636f 6566 distortion coef │ │ │ +000ddc20: 6669 6369 656e 7473 205c 285c 6469 7374 ficients \(\dist │ │ │ +000ddc30: 636f 6566 6673 6669 7368 6579 655c 2920 coeffsfisheye\) │ │ │ +000ddc40: 286d 7573 7420 636f 6e74 6169 6e20 6578 (must contain ex │ │ │ +000ddc50: 6163 746c 7920 3420 636f 6566 6669 6369 actly 4 coeffici │ │ │ +000ddc60: 656e 7473 292e 3c2f 6464 3e0a 3c64 643e ents).
      .
      │ │ │ +000ddc70: 3c63 6f64 653e 523c 2f63 6f64 653e 202d R - │ │ │ +000ddc80: 2052 6563 7469 6669 6361 7469 6f6e 2074 Rectification t │ │ │ +000ddc90: 7261 6e73 666f 726d 6174 696f 6e20 696e ransformation in │ │ │ +000ddca0: 2074 6865 206f 626a 6563 7420 7370 6163 the object spac │ │ │ +000ddcb0: 653a 2033 7833 2031 2d63 6861 6e6e 656c e: 3x3 1-channel │ │ │ +000ddcc0: 2c20 6f72 2076 6563 746f 723a 2033 7831 , or vector: 3x1 │ │ │ +000ddcd0: 2f31 7833 0a31 2d63 6861 6e6e 656c 206f /1x3.1-channel o │ │ │ +000ddce0: 7220 3178 3120 332d 6368 616e 6e65 6c2e r 1x1 3-channel. │ │ │ +000ddcf0: 2049 6620 656d 7074 792c 2074 6865 2069 If empty, the i │ │ │ +000ddd00: 6465 6e74 6974 7920 7472 616e 7366 6f72 dentity transfor │ │ │ +000ddd10: 6d61 7469 6f6e 2069 7320 7573 6564 2e3c mation is used.< │ │ │ +000ddd20: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e50 /dd>.
      P │ │ │ +000ddd30: 3c2f 636f 6465 3e20 2d20 4e65 7720 6361 - New ca │ │ │ +000ddd40: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ +000ddd50: 6174 7269 7820 2833 7833 2920 6f72 206e atrix (3x3) or n │ │ │ +000ddd60: 6577 2070 726f 6a65 6374 696f 6e20 6d61 ew projection ma │ │ │ +000ddd70: 7472 6978 2028 3378 3429 2e20 4966 2065 trix (3x4). If e │ │ │ +000ddd80: 6d70 7479 206f 7220 6964 656e 7469 7479 mpty or identity │ │ │ +000ddd90: 2c0a 6f75 7470 7574 2077 696c 6c20 6265 ,.output will be │ │ │ +000ddda0: 2069 6e20 6e6f 726d 616c 697a 6564 2063 in normalized c │ │ │ +000dddb0: 616d 6572 6120 636f 6f72 6469 6e61 7465 amera coordinate │ │ │ +000dddc0: 732e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 s.
      .
      criteria - Termination │ │ │ +000dddf0: 6372 6974 6572 6961 2066 6f72 2074 6865 criteria for the │ │ │ +000dde00: 2069 7465 7261 7469 7665 2075 6e64 6973 iterative undis │ │ │ +000dde10: 746f 7274 696f 6e20 616c 676f 7269 7468 tortion algorith │ │ │ +000dde20: 6d2e 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f m.
      .
      ..
    . │ │ │ +000dde40: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..

    fi │ │ │ +000ddf00: 7368 6579 655f 756e 6469 7374 6f72 7450 sheye_undistortP │ │ │ +000ddf10: 6f69 6e74 733c 2f68 333e 0a3c 6469 7620 oints

    .
    .
    public static void │ │ │ +000ddfb0: 266e 6273 703b 3c73 7061 6e20 636c 6173  fisheye_undisto │ │ │ +000ddfe0: 7274 506f 696e 7473 3c2f 7370 616e 3e3c rtPoints< │ │ │ +000ddff0: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat distorted │ │ │ +000de060: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000de0a0: 6174 3c2f 613e 266e 6273 703b 756e 6469 at undi │ │ │ +000de0b0: 7374 6f72 7465 642c 0a20 3c61 2068 7265 storted,. Mat&nb │ │ │ +000de100: 7370 3b4b 2c0a 203c 6120 6872 6566 3d22 sp;K,. Mat  │ │ │ +000de150: 442c 0a20 3c61 2068 7265 663d 222e 2e2f D,. │ │ │ +000de190: 4d61 743c 2f61 3e26 6e62 7370 3b52 2c0a Mat R,. │ │ │ +000de1a0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000de1e0: 3c2f 613e 266e 6273 703b 5029 3c2f 7370  P)
    .
    Und │ │ │ +000de210: 6973 746f 7274 7320 3244 2070 6f69 6e74 istorts 2D point │ │ │ +000de220: 7320 7573 696e 6720 6669 7368 6579 6520 s using fisheye │ │ │ +000de230: 6361 6d65 7261 206d 6f64 656c 0a0a 5468 camera model..Th │ │ │ +000de240: 6973 2066 756e 6374 696f 6e20 7065 7266 is function perf │ │ │ +000de250: 6f72 6d73 2075 6e64 6973 746f 7274 696f orms undistortio │ │ │ +000de260: 6e20 666f 7220 6669 7368 6579 6520 6361 n for fisheye ca │ │ │ +000de270: 6d65 7261 206d 6f64 656c 732c 2077 6869 mera models, whi │ │ │ +000de280: 6368 2075 7365 2061 2064 6966 6665 7265 ch use a differe │ │ │ +000de290: 6e74 2064 6973 746f 7274 696f 6e20 6d6f nt distortion mo │ │ │ +000de2a0: 6465 6c0a 636f 6d70 6172 6564 2074 6f20 del.compared to │ │ │ +000de2b0: 7468 6520 7374 616e 6461 7264 2070 696e the standard pin │ │ │ +000de2c0: 686f 6c65 2063 616d 6572 6120 6d6f 6465 hole camera mode │ │ │ +000de2d0: 6c20 7573 6564 2062 7920 2375 6e64 6973 l used by #undis │ │ │ +000de2e0: 746f 7274 506f 696e 7473 2e20 5468 6520 tortPoints. The │ │ │ +000de2f0: 6669 7368 6579 6520 6d6f 6465 6c20 6973 fisheye model is │ │ │ +000de300: 2073 7569 7461 626c 650a 666f 7220 7769 suitable.for wi │ │ │ +000de310: 6465 2d61 6e67 6c65 2063 616d 6572 6173 de-angle cameras │ │ │ +000de320: 2e0a 0a54 6865 2066 756e 6374 696f 6e20 ...The function │ │ │ +000de330: 7472 616e 7366 6f72 6d73 2070 6f69 6e74 transforms point │ │ │ +000de340: 7320 6672 6f6d 2074 6865 2064 6973 746f s from the disto │ │ │ +000de350: 7274 6564 2066 6973 6865 7965 2069 6d61 rted fisheye ima │ │ │ +000de360: 6765 2074 6f20 756e 6469 7374 6f72 7465 ge to undistorte │ │ │ +000de370: 6420 636f 6f72 6469 6e61 7465 732c 206f d coordinates, o │ │ │ +000de380: 7074 696f 6e61 6c6c 790a 6170 706c 7969 ptionally.applyi │ │ │ +000de390: 6e67 2061 2072 6563 7469 6669 6361 7469 ng a rectificati │ │ │ +000de3a0: 6f6e 2074 7261 6e73 666f 726d 6174 696f on transformatio │ │ │ +000de3b0: 6e20 2852 2920 616e 6420 7072 6f6a 6563 n (R) and projec │ │ │ +000de3c0: 7469 6e67 2074 6f20 6120 6e65 7720 696d ting to a new im │ │ │ +000de3d0: 6167 6520 706c 616e 6520 2850 292e 0a0a age plane (P)... │ │ │ +000de3e0: 3c62 3e4e 6f74 653a 3c2f 623e 203c 623e Note: │ │ │ +000de3f0: 436f 6f72 6469 6e61 7465 2053 7973 7465 Coordinate Syste │ │ │ +000de400: 6d73 3a3c 2f62 3e0a 3c75 6c3e 0a20 203c ms:.
      . < │ │ │ +000de410: 6c69 3e0a 203c 623e 496e 7075 7420 283c li>. Input (< │ │ │ +000de420: 636f 6465 3e64 6973 746f 7274 6564 3c2f code>distorted): Poin │ │ │ +000de440: 7473 2061 7265 2065 7870 6563 7465 6420 ts are expected │ │ │ +000de450: 696e 203c 623e 7069 7865 6c20 636f 6f72 in pixel coor │ │ │ +000de460: 6469 6e61 7465 733c 2f62 3e20 6f66 2074 dinates of t │ │ │ +000de470: 6865 2064 6973 746f 7274 6564 2066 6973 he distorted fis │ │ │ +000de480: 6865 7965 2069 6d61 6765 2c0a 2020 2020 heye image,. │ │ │ +000de490: 692e 652e 2c20 636f 6f72 6469 6e61 7465 i.e., coordinate │ │ │ +000de4a0: 7320 6d65 6173 7572 6564 2069 6e20 7069 s measured in pi │ │ │ +000de4b0: 7865 6c73 2066 726f 6d20 7468 6520 746f xels from the to │ │ │ +000de4c0: 702d 6c65 6674 2063 6f72 6e65 7220 6f66 p-left corner of │ │ │ +000de4d0: 2074 6865 2069 6d61 6765 2e0a 2020 3c2f the image.. .
    • . O │ │ │ +000de4f0: 7574 7075 7420 283c 636f 6465 3e75 6e64 utput (und │ │ │ +000de500: 6973 746f 7274 6564 3c2f 636f 6465 3e29 istorted) │ │ │ +000de510: 3c2f 623e 3a20 5468 6520 636f 6f72 6469 : The coordi │ │ │ +000de520: 6e61 7465 2073 7973 7465 6d20 6465 7065 nate system depe │ │ │ +000de530: 6e64 7320 6f6e 2070 6172 616d 6574 6572 nds on parameter │ │ │ +000de540: 203c 636f 6465 3e50 3c2f 636f 6465 3e3a P: │ │ │ +000de550: 0a20 203c 756c 3e0a 2020 2020 3c6c 693e .
        .
      • │ │ │ +000de560: 0a20 2020 2020 4966 203c 636f 6465 3e50 . If P │ │ │ +000de570: 3c2f 636f 6465 3e20 6973 2070 726f 7669 is provi │ │ │ +000de580: 6465 6420 286e 6f74 2065 6d70 7479 293a ded (not empty): │ │ │ +000de590: 204f 7574 7075 7420 706f 696e 7473 2061 Output points a │ │ │ +000de5a0: 7265 2069 6e20 3c62 3e70 6978 656c 2063 re in pixel c │ │ │ +000de5b0: 6f6f 7264 696e 6174 6573 3c2f 623e 206f oordinates o │ │ │ +000de5c0: 6620 7468 6520 7265 6374 6966 6965 642f f the rectified/ │ │ │ +000de5d0: 756e 6469 7374 6f72 7465 640a 2020 2020 undistorted. │ │ │ +000de5e0: 696d 6167 6520 706c 616e 652c 2075 7369 image plane, usi │ │ │ +000de5f0: 6e67 2074 6865 2063 616d 6572 6120 6d61 ng the camera ma │ │ │ +000de600: 7472 6978 203c 636f 6465 3e50 3c2f 636f trix P..
      • . │ │ │ +000de620: 2020 203c 6c69 3e0a 2020 2020 2049 6620
      • . If │ │ │ +000de630: 3c63 6f64 653e 503c 2f63 6f64 653e 2069 P i │ │ │ +000de640: 7320 656d 7074 7920 6f72 2069 6465 6e74 s empty or ident │ │ │ +000de650: 6974 793a 204f 7574 7075 7420 706f 696e ity: Output poin │ │ │ +000de660: 7473 2061 7265 2069 6e20 3c62 3e6e 6f72 ts are in nor │ │ │ +000de670: 6d61 6c69 7a65 6420 6361 6d65 7261 2063 malized camera c │ │ │ +000de680: 6f6f 7264 696e 6174 6573 3c2f 623e 2028 oordinates ( │ │ │ +000de690: 6e6f 726d 616c 697a 6564 2069 6d61 6765 normalized image │ │ │ +000de6a0: 2063 6f6f 7264 696e 6174 6573 292c 0a20 coordinates),. │ │ │ +000de6b0: 2020 2077 6869 6368 2061 7265 2064 696d which are dim │ │ │ +000de6c0: 656e 7369 6f6e 6c65 7373 2063 6f6f 7264 ensionless coord │ │ │ +000de6d0: 696e 6174 6573 2069 6e20 7468 6520 6361 inates in the ca │ │ │ +000de6e0: 6d65 7261 2773 2066 6f63 616c 2070 6c61 mera's focal pla │ │ │ +000de6f0: 6e65 2c20 696e 6465 7065 6e64 656e 7420 ne, independent │ │ │ +000de700: 6f66 2069 6e74 7269 6e73 6963 2070 6172 of intrinsic par │ │ │ +000de710: 616d 6574 6572 732e 0a20 2020 203c 2f6c ameters.. .
      .. .
    .Not │ │ │ +000de740: 653a 3c2f 623e 203c 623e 4669 7368 6579 e: Fishey │ │ │ +000de750: 6520 7673 2e20 5374 616e 6461 7264 204d e vs. Standard M │ │ │ +000de760: 6f64 656c 3a3c 2f62 3e0a 5573 6520 7468 odel:.Use th │ │ │ +000de770: 6973 2066 756e 6374 696f 6e20 2823 6376 is function (#cv │ │ │ +000de780: 3a3a 6669 7368 6579 653a 3a75 6e64 6973 ::fisheye::undis │ │ │ +000de790: 746f 7274 506f 696e 7473 2920 666f 7220 tortPoints) for │ │ │ +000de7a0: 6669 7368 6579 6520 6361 6d65 7261 7320 fisheye cameras │ │ │ +000de7b0: 2877 6964 652d 616e 676c 6520 6c65 6e73 (wide-angle lens │ │ │ +000de7c0: 6573 292e 0a46 6f72 2073 7461 6e64 6172 es)..For standar │ │ │ +000de7d0: 6420 7069 6e68 6f6c 6520 6361 6d65 7261 d pinhole camera │ │ │ +000de7e0: 732c 2075 7365 2023 756e 6469 7374 6f72 s, use #undistor │ │ │ +000de7f0: 7450 6f69 6e74 7320 696e 7374 6561 642e tPoints instead. │ │ │ +000de800: 2054 6865 2066 6973 6865 7965 206d 6f64 The fisheye mod │ │ │ +000de810: 656c 2075 7365 7320 6120 6469 6666 6572 el uses a differ │ │ │ +000de820: 656e 7420 6469 7374 6f72 7469 6f6e 0a70 ent distortion.p │ │ │ +000de830: 6172 616d 6574 6572 697a 6174 696f 6e20 arameterization │ │ │ +000de840: 2834 2063 6f65 6666 6963 6965 6e74 7329 (4 coefficients) │ │ │ +000de850: 2063 6f6d 7061 7265 6420 746f 2074 6865 compared to the │ │ │ +000de860: 2073 7461 6e64 6172 6420 6d6f 6465 6c20 standard model │ │ │ +000de870: 2834 2d31 3420 636f 6566 6669 6369 656e (4-14 coefficien │ │ │ +000de880: 7473 292e 3c2f 6469 763e 0a3c 646c 2063 ts).
    .
    .Parameters:.
    dis │ │ │ +000de8c0: 746f 7274 6564 3c2f 636f 6465 3e20 2d20 torted - │ │ │ +000de8d0: 4172 7261 7920 6f66 2064 6973 746f 7274 Array of distort │ │ │ +000de8e0: 6564 2070 6f69 6e74 2063 6f6f 7264 696e ed point coordin │ │ │ +000de8f0: 6174 6573 2069 6e20 3c62 3e70 6978 656c ates in pixel │ │ │ +000de900: 2063 6f6f 7264 696e 6174 6573 3c2f 623e coordinates │ │ │ +000de910: 206f 6620 7468 6520 6669 7368 6579 6520 of the fisheye │ │ │ +000de920: 696d 6167 652c 0a31 784e 2f4e 7831 2032 image,.1xN/Nx1 2 │ │ │ +000de930: 2d63 6861 6e6e 656c 2028 6f72 2076 6563 -channel (or vec │ │ │ +000de940: 746f 7226 6c74 3b50 6f69 6e74 3266 2667 tor<Point2f&g │ │ │ +000de950: 743b 2029 2c20 7768 6572 6520 4e20 6973 t; ), where N is │ │ │ +000de960: 2074 6865 206e 756d 6265 7220 6f66 2070 the number of p │ │ │ +000de970: 6f69 6e74 7320 696e 2074 6865 2076 6965 oints in the vie │ │ │ +000de980: 772e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 w.
    .
    undistorted - Output ar │ │ │ +000de9b0: 7261 7920 6f66 2075 6e64 6973 746f 7274 ray of undistort │ │ │ +000de9c0: 6564 2069 6d61 6765 2070 6f69 6e74 732c ed image points, │ │ │ +000de9d0: 2031 784e 2f4e 7831 2032 2d63 6861 6e6e 1xN/Nx1 2-chann │ │ │ +000de9e0: 656c 2c20 6f72 2076 6563 746f 7226 6c74 el, or vector< │ │ │ +000de9f0: 3b50 6f69 6e74 3266 2667 743b 202e 0a54 ;Point2f> ..T │ │ │ +000dea00: 6865 2063 6f6f 7264 696e 6174 6520 7379 he coordinate sy │ │ │ +000dea10: 7374 656d 2064 6570 656e 6473 206f 6e20 stem depends on │ │ │ +000dea20: 7061 7261 6d65 7465 7220 5020 2873 6565 parameter P (see │ │ │ +000dea30: 2061 626f 7665 292e 3c2f 6464 3e0a 3c64 above).
    .K │ │ │ +000dea50: 202d 2043 616d 6572 6120 696e 7472 696e - Camera intrin │ │ │ +000dea60: 7369 6320 6d61 7472 6978 205c 285c 6361 sic matrix \(\ca │ │ │ +000dea70: 6d65 7261 6d61 7472 6978 7b4b 7d5c 2920 meramatrix{K}\) │ │ │ +000dea80: 6f66 2074 6865 2066 6973 6865 7965 2063 of the fisheye c │ │ │ +000dea90: 616d 6572 612e 3c2f 6464 3e0a 3c64 643e amera..
    │ │ │ +000deaa0: 3c63 6f64 653e 443c 2f63 6f64 653e 202d D - │ │ │ +000deab0: 2049 6e70 7574 2076 6563 746f 7220 6f66 Input vector of │ │ │ +000deac0: 2066 6973 6865 7965 2064 6973 746f 7274 fisheye distort │ │ │ +000dead0: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ +000deae0: 205c 285c 6469 7374 636f 6566 6673 6669 \(\distcoeffsfi │ │ │ +000deaf0: 7368 6579 655c 2920 286d 7573 7420 636f sheye\) (must co │ │ │ +000deb00: 6e74 6169 6e20 6578 6163 746c 7920 3420 ntain exactly 4 │ │ │ +000deb10: 636f 6566 6669 6369 656e 7473 292e 3c2f coefficients)..
    R< │ │ │ +000deb30: 2f63 6f64 653e 202d 2052 6563 7469 6669 /code> - Rectifi │ │ │ +000deb40: 6361 7469 6f6e 2074 7261 6e73 666f 726d cation transform │ │ │ +000deb50: 6174 696f 6e20 696e 2074 6865 206f 626a ation in the obj │ │ │ +000deb60: 6563 7420 7370 6163 653a 2033 7833 2031 ect space: 3x3 1 │ │ │ +000deb70: 2d63 6861 6e6e 656c 2c20 6f72 2076 6563 -channel, or vec │ │ │ +000deb80: 746f 723a 2033 7831 2f31 7833 0a31 2d63 tor: 3x1/1x3.1-c │ │ │ +000deb90: 6861 6e6e 656c 206f 7220 3178 3120 332d hannel or 1x1 3- │ │ │ +000deba0: 6368 616e 6e65 6c2e 2049 6620 656d 7074 channel. If empt │ │ │ +000debb0: 792c 2074 6865 2069 6465 6e74 6974 7920 y, the identity │ │ │ +000debc0: 7472 616e 7366 6f72 6d61 7469 6f6e 2069 transformation i │ │ │ +000debd0: 7320 7573 6564 2e3c 2f64 643e 0a3c 6464 s used.
    .
    P │ │ │ +000debf0: 2d20 4e65 7720 6361 6d65 7261 2069 6e74 - New camera int │ │ │ +000dec00: 7269 6e73 6963 206d 6174 7269 7820 2833 rinsic matrix (3 │ │ │ +000dec10: 7833 2920 6f72 206e 6577 2070 726f 6a65 x3) or new proje │ │ │ +000dec20: 6374 696f 6e20 6d61 7472 6978 2028 3378 ction matrix (3x │ │ │ +000dec30: 3429 2e20 4966 2065 6d70 7479 206f 7220 4). If empty or │ │ │ +000dec40: 6964 656e 7469 7479 2c0a 6f75 7470 7574 identity,.output │ │ │ +000dec50: 2077 696c 6c20 6265 2069 6e20 6e6f 726d will be in norm │ │ │ +000dec60: 616c 697a 6564 2063 616d 6572 6120 636f alized camera co │ │ │ +000dec70: 6f72 6469 6e61 7465 732e 3c2f 6464 3e0a ordinates.
    . │ │ │ +000dec80: 3c2f 646c 3e0a 3c2f 6469 763e 0a3c 2f73
    .
    ..
  • ..
    .fisheye_undist │ │ │ +000ded50: 6f72 7450 6f69 6e74 733c 2f68 333e 0a3c ortPoints.< │ │ │ +000ded60: 6469 7620 636c 6173 733d 2268 6f72 697a div class="horiz │ │ │ +000ded70: 6f6e 7461 6c2d 7363 726f 6c6c 223e 0a3c ontal-scroll">.< │ │ │ +000ded80: 6469 7620 636c 6173 733d 226d 656d 6265 div class="membe │ │ │ +000ded90: 722d 7369 676e 6174 7572 6522 3e3c 7370 r-signature">public stat │ │ │ +000dedc0: 6963 3c2f 7370 616e 3e26 6e62 7370 3b3c ic < │ │ │ +000dedd0: 7370 616e 2063 6c61 7373 3d22 7265 7475 span class="retu │ │ │ +000dede0: 726e 2d74 7970 6522 3e76 6f69 643c 2f73 rn-type">void fisheye_und │ │ │ +000dee20: 6973 746f 7274 506f 696e 7473 3c2f 7370 istortPoints(Ma │ │ │ +000dee90: 743c 2f61 3e26 6e62 7370 3b64 6973 746f t disto │ │ │ +000deea0: 7274 6564 2c0a 203c 6120 6872 6566 3d22 rted,. Mat  │ │ │ +000deef0: 756e 6469 7374 6f72 7465 642c 0a20 3c61 undistorted,. Mat K,. Mat&n │ │ │ +000def90: 6273 703b 442c 0a20 3c61 2068 7265 663d bsp;D,. Mat  │ │ │ +000defe0: 3b52 293c 2f73 7061 6e3e 3c2f 6469 763e ;R) │ │ │ +000deff0: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Undistorts 2 │ │ │ +000df010: 4420 706f 696e 7473 2075 7369 6e67 2066 D points using f │ │ │ +000df020: 6973 6865 7965 2063 616d 6572 6120 6d6f isheye camera mo │ │ │ +000df030: 6465 6c0a 0a54 6869 7320 6675 6e63 7469 del..This functi │ │ │ +000df040: 6f6e 2070 6572 666f 726d 7320 756e 6469 on performs undi │ │ │ +000df050: 7374 6f72 7469 6f6e 2066 6f72 2066 6973 stortion for fis │ │ │ +000df060: 6865 7965 2063 616d 6572 6120 6d6f 6465 heye camera mode │ │ │ +000df070: 6c73 2c20 7768 6963 6820 7573 6520 6120 ls, which use a │ │ │ +000df080: 6469 6666 6572 656e 7420 6469 7374 6f72 different distor │ │ │ +000df090: 7469 6f6e 206d 6f64 656c 0a63 6f6d 7061 tion model.compa │ │ │ +000df0a0: 7265 6420 746f 2074 6865 2073 7461 6e64 red to the stand │ │ │ +000df0b0: 6172 6420 7069 6e68 6f6c 6520 6361 6d65 ard pinhole came │ │ │ +000df0c0: 7261 206d 6f64 656c 2075 7365 6420 6279 ra model used by │ │ │ +000df0d0: 2023 756e 6469 7374 6f72 7450 6f69 6e74 #undistortPoint │ │ │ +000df0e0: 732e 2054 6865 2066 6973 6865 7965 206d s. The fisheye m │ │ │ +000df0f0: 6f64 656c 2069 7320 7375 6974 6162 6c65 odel is suitable │ │ │ +000df100: 0a66 6f72 2077 6964 652d 616e 676c 6520 .for wide-angle │ │ │ +000df110: 6361 6d65 7261 732e 0a0a 5468 6520 6675 cameras...The fu │ │ │ +000df120: 6e63 7469 6f6e 2074 7261 6e73 666f 726d nction transform │ │ │ +000df130: 7320 706f 696e 7473 2066 726f 6d20 7468 s points from th │ │ │ +000df140: 6520 6469 7374 6f72 7465 6420 6669 7368 e distorted fish │ │ │ +000df150: 6579 6520 696d 6167 6520 746f 2075 6e64 eye image to und │ │ │ +000df160: 6973 746f 7274 6564 2063 6f6f 7264 696e istorted coordin │ │ │ +000df170: 6174 6573 2c20 6f70 7469 6f6e 616c 6c79 ates, optionally │ │ │ +000df180: 0a61 7070 6c79 696e 6720 6120 7265 6374 .applying a rect │ │ │ +000df190: 6966 6963 6174 696f 6e20 7472 616e 7366 ification transf │ │ │ +000df1a0: 6f72 6d61 7469 6f6e 2028 5229 2061 6e64 ormation (R) and │ │ │ +000df1b0: 2070 726f 6a65 6374 696e 6720 746f 2061 projecting to a │ │ │ +000df1c0: 206e 6577 2069 6d61 6765 2070 6c61 6e65 new image plane │ │ │ +000df1d0: 2028 5029 2e0a 0a3c 623e 4e6f 7465 3a3c (P)...Note:< │ │ │ +000df1e0: 2f62 3e20 3c62 3e43 6f6f 7264 696e 6174 /b> Coordinat │ │ │ +000df1f0: 6520 5379 7374 656d 733a 3c2f 623e 0a3c e Systems:.< │ │ │ +000df200: 756c 3e0a 2020 3c6c 693e 0a20 3c62 3e49 ul>.
  • . I │ │ │ +000df210: 6e70 7574 2028 3c63 6f64 653e 6469 7374 nput (dist │ │ │ +000df220: 6f72 7465 643c 2f63 6f64 653e 293c 2f62 orted): Points are ex │ │ │ +000df240: 7065 6374 6564 2069 6e20 3c62 3e70 6978 pected in pix │ │ │ +000df250: 656c 2063 6f6f 7264 696e 6174 6573 3c2f el coordinates of the distor │ │ │ +000df270: 7465 6420 6669 7368 6579 6520 696d 6167 ted fisheye imag │ │ │ +000df280: 652c 0a20 2020 2069 2e65 2e2c 2063 6f6f e,. i.e., coo │ │ │ +000df290: 7264 696e 6174 6573 206d 6561 7375 7265 rdinates measure │ │ │ +000df2a0: 6420 696e 2070 6978 656c 7320 6672 6f6d d in pixels from │ │ │ +000df2b0: 2074 6865 2074 6f70 2d6c 6566 7420 636f the top-left co │ │ │ +000df2c0: 726e 6572 206f 6620 7468 6520 696d 6167 rner of the imag │ │ │ +000df2d0: 652e 0a20 203c 2f6c 693e 0a20 203c 6c69 e..
  • .
  • . Output (undistorted< │ │ │ +000df300: 2f63 6f64 653e 293c 2f62 3e3a 2054 6865 /code>): The │ │ │ +000df310: 2063 6f6f 7264 696e 6174 6520 7379 7374 coordinate syst │ │ │ +000df320: 656d 2064 6570 656e 6473 206f 6e20 7061 em depends on pa │ │ │ +000df330: 7261 6d65 7465 7220 3c63 6f64 653e 503c rameter P< │ │ │ +000df340: 2f63 6f64 653e 3a0a 2020 3c75 6c3e 0a20 /code>:.
      . │ │ │ +000df350: 2020 203c 6c69 3e0a 2020 2020 2049 6620
    • . If │ │ │ +000df360: 3c63 6f64 653e 503c 2f63 6f64 653e 2069 P i │ │ │ +000df370: 7320 7072 6f76 6964 6564 2028 6e6f 7420 s provided (not │ │ │ +000df380: 656d 7074 7929 3a20 4f75 7470 7574 2070 empty): Output p │ │ │ +000df390: 6f69 6e74 7320 6172 6520 696e 203c 623e oints are in │ │ │ +000df3a0: 7069 7865 6c20 636f 6f72 6469 6e61 7465 pixel coordinate │ │ │ +000df3b0: 733c 2f62 3e20 6f66 2074 6865 2072 6563 s of the rec │ │ │ +000df3c0: 7469 6669 6564 2f75 6e64 6973 746f 7274 tified/undistort │ │ │ +000df3d0: 6564 0a20 2020 2069 6d61 6765 2070 6c61 ed. image pla │ │ │ +000df3e0: 6e65 2c20 7573 696e 6720 7468 6520 6361 ne, using the ca │ │ │ +000df3f0: 6d65 7261 206d 6174 7269 7820 3c63 6f64 mera matrix P.. │ │ │ +000df410: 3c2f 6c69 3e0a 2020 2020 3c6c 693e 0a20
    • .
    • . │ │ │ +000df420: 2020 2020 4966 203c 636f 6465 3e50 3c2f If P is empty o │ │ │ +000df440: 7220 6964 656e 7469 7479 3a20 4f75 7470 r identity: Outp │ │ │ +000df450: 7574 2070 6f69 6e74 7320 6172 6520 696e ut points are in │ │ │ +000df460: 203c 623e 6e6f 726d 616c 697a 6564 2063 normalized c │ │ │ +000df470: 616d 6572 6120 636f 6f72 6469 6e61 7465 amera coordinate │ │ │ +000df480: 733c 2f62 3e20 286e 6f72 6d61 6c69 7a65 s (normalize │ │ │ +000df490: 6420 696d 6167 6520 636f 6f72 6469 6e61 d image coordina │ │ │ +000df4a0: 7465 7329 2c0a 2020 2020 7768 6963 6820 tes),. which │ │ │ +000df4b0: 6172 6520 6469 6d65 6e73 696f 6e6c 6573 are dimensionles │ │ │ +000df4c0: 7320 636f 6f72 6469 6e61 7465 7320 696e s coordinates in │ │ │ +000df4d0: 2074 6865 2063 616d 6572 6127 7320 666f the camera's fo │ │ │ +000df4e0: 6361 6c20 706c 616e 652c 2069 6e64 6570 cal plane, indep │ │ │ +000df4f0: 656e 6465 6e74 206f 6620 696e 7472 696e endent of intrin │ │ │ +000df500: 7369 6320 7061 7261 6d65 7465 7273 2e0a sic parameters.. │ │ │ +000df510: 2020 2020 3c2f 6c69 3e0a 2020 3c2f 756c
    • .
    ..
  • . │ │ │ +000df530: 0a3c 623e 4e6f 7465 3a3c 2f62 3e20 3c62 .Note: Fisheye vs. Sta │ │ │ +000df550: 6e64 6172 6420 4d6f 6465 6c3a 3c2f 623e ndard Model: │ │ │ +000df560: 0a55 7365 2074 6869 7320 6675 6e63 7469 .Use this functi │ │ │ +000df570: 6f6e 2028 2363 763a 3a66 6973 6865 7965 on (#cv::fisheye │ │ │ +000df580: 3a3a 756e 6469 7374 6f72 7450 6f69 6e74 ::undistortPoint │ │ │ +000df590: 7329 2066 6f72 2066 6973 6865 7965 2063 s) for fisheye c │ │ │ +000df5a0: 616d 6572 6173 2028 7769 6465 2d61 6e67 ameras (wide-ang │ │ │ +000df5b0: 6c65 206c 656e 7365 7329 2e0a 466f 7220 le lenses)..For │ │ │ +000df5c0: 7374 616e 6461 7264 2070 696e 686f 6c65 standard pinhole │ │ │ +000df5d0: 2063 616d 6572 6173 2c20 7573 6520 2375 cameras, use #u │ │ │ +000df5e0: 6e64 6973 746f 7274 506f 696e 7473 2069 ndistortPoints i │ │ │ +000df5f0: 6e73 7465 6164 2e20 5468 6520 6669 7368 nstead. The fish │ │ │ +000df600: 6579 6520 6d6f 6465 6c20 7573 6573 2061 eye model uses a │ │ │ +000df610: 2064 6966 6665 7265 6e74 2064 6973 746f different disto │ │ │ +000df620: 7274 696f 6e0a 7061 7261 6d65 7465 7269 rtion.parameteri │ │ │ +000df630: 7a61 7469 6f6e 2028 3420 636f 6566 6669 zation (4 coeffi │ │ │ +000df640: 6369 656e 7473 2920 636f 6d70 6172 6564 cients) compared │ │ │ +000df650: 2074 6f20 7468 6520 7374 616e 6461 7264 to the standard │ │ │ +000df660: 206d 6f64 656c 2028 342d 3134 2063 6f65 model (4-14 coe │ │ │ +000df670: 6666 6963 6965 6e74 7329 2e3c 2f64 6976 fficients).
    .
    .
    Paramet │ │ │ +000df6a0: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    distorted - Array of │ │ │ +000df6d0: 6469 7374 6f72 7465 6420 706f 696e 7420 distorted point │ │ │ +000df6e0: 636f 6f72 6469 6e61 7465 7320 696e 203c coordinates in < │ │ │ +000df6f0: 623e 7069 7865 6c20 636f 6f72 6469 6e61 b>pixel coordina │ │ │ +000df700: 7465 733c 2f62 3e20 6f66 2074 6865 2066 tes of the f │ │ │ +000df710: 6973 6865 7965 2069 6d61 6765 2c0a 3178 isheye image,.1x │ │ │ +000df720: 4e2f 4e78 3120 322d 6368 616e 6e65 6c20 N/Nx1 2-channel │ │ │ +000df730: 286f 7220 7665 6374 6f72 266c 743b 506f (or vector<Po │ │ │ +000df740: 696e 7432 6626 6774 3b20 292c 2077 6865 int2f> ), whe │ │ │ +000df750: 7265 204e 2069 7320 7468 6520 6e75 6d62 re N is the numb │ │ │ +000df760: 6572 206f 6620 706f 696e 7473 2069 6e20 er of points in │ │ │ +000df770: 7468 6520 7669 6577 2e3c 2f64 643e 0a3c the view.
    .< │ │ │ +000df780: 6464 3e3c 636f 6465 3e75 6e64 6973 746f dd>undisto │ │ │ +000df790: 7274 6564 3c2f 636f 6465 3e20 2d20 4f75 rted - Ou │ │ │ +000df7a0: 7470 7574 2061 7272 6179 206f 6620 756e tput array of un │ │ │ +000df7b0: 6469 7374 6f72 7465 6420 696d 6167 6520 distorted image │ │ │ +000df7c0: 706f 696e 7473 2c20 3178 4e2f 4e78 3120 points, 1xN/Nx1 │ │ │ +000df7d0: 322d 6368 616e 6e65 6c2c 206f 7220 7665 2-channel, or ve │ │ │ +000df7e0: 6374 6f72 266c 743b 506f 696e 7432 6626 ctor<Point2f& │ │ │ +000df7f0: 6774 3b20 2e0a 5468 6520 636f 6f72 6469 gt; ..The coordi │ │ │ +000df800: 6e61 7465 2073 7973 7465 6d20 6465 7065 nate system depe │ │ │ +000df810: 6e64 7320 6f6e 2070 6172 616d 6574 6572 nds on parameter │ │ │ +000df820: 2050 2028 7365 6520 6162 6f76 6529 2e3c P (see above).< │ │ │ +000df830: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e4b /dd>.
    K │ │ │ +000df840: 3c2f 636f 6465 3e20 2d20 4361 6d65 7261 - Camera │ │ │ +000df850: 2069 6e74 7269 6e73 6963 206d 6174 7269 intrinsic matri │ │ │ +000df860: 7820 5c28 5c63 616d 6572 616d 6174 7269 x \(\cameramatri │ │ │ +000df870: 787b 4b7d 5c29 206f 6620 7468 6520 6669 x{K}\) of the fi │ │ │ +000df880: 7368 6579 6520 6361 6d65 7261 2e3c 2f64 sheye camera..
    D - Input ve │ │ │ +000df8b0: 6374 6f72 206f 6620 6669 7368 6579 6520 ctor of fisheye │ │ │ +000df8c0: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ +000df8d0: 6963 6965 6e74 7320 5c28 5c64 6973 7463 icients \(\distc │ │ │ +000df8e0: 6f65 6666 7366 6973 6865 7965 5c29 2028 oeffsfisheye\) ( │ │ │ +000df8f0: 6d75 7374 2063 6f6e 7461 696e 2065 7861 must contain exa │ │ │ +000df900: 6374 6c79 2034 2063 6f65 6666 6963 6965 ctly 4 coefficie │ │ │ +000df910: 6e74 7329 2e3c 2f64 643e 0a3c 6464 3e3c nts).
    .
    < │ │ │ +000df920: 636f 6465 3e52 3c2f 636f 6465 3e20 2d20 code>R - │ │ │ +000df930: 5265 6374 6966 6963 6174 696f 6e20 7472 Rectification tr │ │ │ +000df940: 616e 7366 6f72 6d61 7469 6f6e 2069 6e20 ansformation in │ │ │ +000df950: 7468 6520 6f62 6a65 6374 2073 7061 6365 the object space │ │ │ +000df960: 3a20 3378 3320 312d 6368 616e 6e65 6c2c : 3x3 1-channel, │ │ │ +000df970: 206f 7220 7665 6374 6f72 3a20 3378 312f or vector: 3x1/ │ │ │ +000df980: 3178 330a 312d 6368 616e 6e65 6c20 6f72 1x3.1-channel or │ │ │ +000df990: 2031 7831 2033 2d63 6861 6e6e 656c 2e20 1x1 3-channel. │ │ │ +000df9a0: 4966 2065 6d70 7479 2c20 7468 6520 6964 If empty, the id │ │ │ +000df9b0: 656e 7469 7479 2074 7261 6e73 666f 726d entity transform │ │ │ +000df9c0: 6174 696f 6e20 6973 2075 7365 642e 0a6f ation is used..o │ │ │ +000df9d0: 7574 7075 7420 7769 6c6c 2062 6520 696e utput will be in │ │ │ +000df9e0: 206e 6f72 6d61 6c69 7a65 6420 6361 6d65 normalized came │ │ │ +000df9f0: 7261 2063 6f6f 7264 696e 6174 6573 2e3c ra coordinates.< │ │ │ +000dfa00: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    ..
    .
    .
  • .
    .< │ │ │ +000dfab0: 6833 3e66 6973 6865 7965 5f75 6e64 6973 h3>fisheye_undis │ │ │ +000dfac0: 746f 7274 506f 696e 7473 3c2f 6833 3e0a tortPoints. │ │ │ +000dfad0: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ +000dfaf0: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ +000dfb30: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ +000dfb40: 3c73 7061 6e20 636c 6173 733d 2272 6574 void fisheye_un │ │ │ +000dfb90: 6469 7374 6f72 7450 6f69 6e74 733c 2f73 distortPoints(M │ │ │ +000dfc00: 6174 3c2f 613e 266e 6273 703b 6469 7374 at dist │ │ │ +000dfc10: 6f72 7465 642c 0a20 3c61 2068 7265 663d orted,. Mat  │ │ │ +000dfc60: 3b75 6e64 6973 746f 7274 6564 2c0a 203c ;undistorted,. < │ │ │ +000dfc70: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000dfc80: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000dfc90: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000dfca0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat K,. Mat& │ │ │ +000dfd00: 6e62 7370 3b44 293c 2f73 7061 6e3e 3c2f nbsp;D).
    Undistor │ │ │ +000dfd30: 7473 2032 4420 706f 696e 7473 2075 7369 ts 2D points usi │ │ │ +000dfd40: 6e67 2066 6973 6865 7965 2063 616d 6572 ng fisheye camer │ │ │ +000dfd50: 6120 6d6f 6465 6c0a 0a54 6869 7320 6675 a model..This fu │ │ │ +000dfd60: 6e63 7469 6f6e 2070 6572 666f 726d 7320 nction performs │ │ │ +000dfd70: 756e 6469 7374 6f72 7469 6f6e 2066 6f72 undistortion for │ │ │ +000dfd80: 2066 6973 6865 7965 2063 616d 6572 6120 fisheye camera │ │ │ +000dfd90: 6d6f 6465 6c73 2c20 7768 6963 6820 7573 models, which us │ │ │ +000dfda0: 6520 6120 6469 6666 6572 656e 7420 6469 e a different di │ │ │ +000dfdb0: 7374 6f72 7469 6f6e 206d 6f64 656c 0a63 stortion model.c │ │ │ +000dfdc0: 6f6d 7061 7265 6420 746f 2074 6865 2073 ompared to the s │ │ │ +000dfdd0: 7461 6e64 6172 6420 7069 6e68 6f6c 6520 tandard pinhole │ │ │ +000dfde0: 6361 6d65 7261 206d 6f64 656c 2075 7365 camera model use │ │ │ +000dfdf0: 6420 6279 2023 756e 6469 7374 6f72 7450 d by #undistortP │ │ │ +000dfe00: 6f69 6e74 732e 2054 6865 2066 6973 6865 oints. The fishe │ │ │ +000dfe10: 7965 206d 6f64 656c 2069 7320 7375 6974 ye model is suit │ │ │ +000dfe20: 6162 6c65 0a66 6f72 2077 6964 652d 616e able.for wide-an │ │ │ +000dfe30: 676c 6520 6361 6d65 7261 732e 0a0a 5468 gle cameras...Th │ │ │ +000dfe40: 6520 6675 6e63 7469 6f6e 2074 7261 6e73 e function trans │ │ │ +000dfe50: 666f 726d 7320 706f 696e 7473 2066 726f forms points fro │ │ │ +000dfe60: 6d20 7468 6520 6469 7374 6f72 7465 6420 m the distorted │ │ │ +000dfe70: 6669 7368 6579 6520 696d 6167 6520 746f fisheye image to │ │ │ +000dfe80: 2075 6e64 6973 746f 7274 6564 2063 6f6f undistorted coo │ │ │ +000dfe90: 7264 696e 6174 6573 2c20 6f70 7469 6f6e rdinates, option │ │ │ +000dfea0: 616c 6c79 0a61 7070 6c79 696e 6720 6120 ally.applying a │ │ │ +000dfeb0: 7265 6374 6966 6963 6174 696f 6e20 7472 rectification tr │ │ │ +000dfec0: 616e 7366 6f72 6d61 7469 6f6e 2028 5229 ansformation (R) │ │ │ +000dfed0: 2061 6e64 2070 726f 6a65 6374 696e 6720 and projecting │ │ │ +000dfee0: 746f 2061 206e 6577 2069 6d61 6765 2070 to a new image p │ │ │ +000dfef0: 6c61 6e65 2028 5029 2e0a 0a3c 623e 4e6f lane (P)...No │ │ │ +000dff00: 7465 3a3c 2f62 3e20 3c62 3e43 6f6f 7264 te: Coord │ │ │ +000dff10: 696e 6174 6520 5379 7374 656d 733a 3c2f inate Systems:.
      .
    • . │ │ │ +000dff30: 3c62 3e49 6e70 7574 2028 3c63 6f64 653e Input ( │ │ │ +000dff40: 6469 7374 6f72 7465 643c 2f63 6f64 653e distorted │ │ │ +000dff50: 293c 2f62 3e3a 2050 6f69 6e74 7320 6172 ): Points ar │ │ │ +000dff60: 6520 6578 7065 6374 6564 2069 6e20 3c62 e expected in pixel coordinat │ │ │ +000dff80: 6573 3c2f 623e 206f 6620 7468 6520 6469 es of the di │ │ │ +000dff90: 7374 6f72 7465 6420 6669 7368 6579 6520 storted fisheye │ │ │ +000dffa0: 696d 6167 652c 0a20 2020 2069 2e65 2e2c image,. i.e., │ │ │ +000dffb0: 2063 6f6f 7264 696e 6174 6573 206d 6561 coordinates mea │ │ │ +000dffc0: 7375 7265 6420 696e 2070 6978 656c 7320 sured in pixels │ │ │ +000dffd0: 6672 6f6d 2074 6865 2074 6f70 2d6c 6566 from the top-lef │ │ │ +000dffe0: 7420 636f 726e 6572 206f 6620 7468 6520 t corner of the │ │ │ +000dfff0: 696d 6167 652e 0a20 203c 2f6c 693e 0a20 image..
    • . │ │ │ +000e0000: 203c 6c69 3e0a 203c 623e 4f75 7470 7574
    • . Output │ │ │ +000e0010: 2028 3c63 6f64 653e 756e 6469 7374 6f72 (undistor │ │ │ +000e0020: 7465 643c 2f63 6f64 653e 293c 2f62 3e3a ted): │ │ │ +000e0030: 2054 6865 2063 6f6f 7264 696e 6174 6520 The coordinate │ │ │ +000e0040: 7379 7374 656d 2064 6570 656e 6473 206f system depends o │ │ │ +000e0050: 6e20 7061 7261 6d65 7465 7220 3c63 6f64 n parameter P:. .
    • . │ │ │ +000e0080: 2049 6620 3c63 6f64 653e 503c 2f63 6f64 If P is provided ( │ │ │ +000e00a0: 6e6f 7420 656d 7074 7929 3a20 4f75 7470 not empty): Outp │ │ │ +000e00b0: 7574 2070 6f69 6e74 7320 6172 6520 696e ut points are in │ │ │ +000e00c0: 203c 623e 7069 7865 6c20 636f 6f72 6469 pixel coordi │ │ │ +000e00d0: 6e61 7465 733c 2f62 3e20 6f66 2074 6865 nates of the │ │ │ +000e00e0: 2072 6563 7469 6669 6564 2f75 6e64 6973 rectified/undis │ │ │ +000e00f0: 746f 7274 6564 0a20 2020 2069 6d61 6765 torted. image │ │ │ +000e0100: 2070 6c61 6e65 2c20 7573 696e 6720 7468 plane, using th │ │ │ +000e0110: 6520 6361 6d65 7261 206d 6174 7269 7820 e camera matrix │ │ │ +000e0120: 3c63 6f64 653e 503c 2f63 6f64 653e 2e0a P.. │ │ │ +000e0130: 2020 2020 3c2f 6c69 3e0a 2020 2020 3c6c
    • . . If P is emp │ │ │ +000e0160: 7479 206f 7220 6964 656e 7469 7479 3a20 ty or identity: │ │ │ +000e0170: 4f75 7470 7574 2070 6f69 6e74 7320 6172 Output points ar │ │ │ +000e0180: 6520 696e 203c 623e 6e6f 726d 616c 697a e in normaliz │ │ │ +000e0190: 6564 2063 616d 6572 6120 636f 6f72 6469 ed camera coordi │ │ │ +000e01a0: 6e61 7465 733c 2f62 3e20 286e 6f72 6d61 nates (norma │ │ │ +000e01b0: 6c69 7a65 6420 696d 6167 6520 636f 6f72 lized image coor │ │ │ +000e01c0: 6469 6e61 7465 7329 2c0a 2020 2020 7768 dinates),. wh │ │ │ +000e01d0: 6963 6820 6172 6520 6469 6d65 6e73 696f ich are dimensio │ │ │ +000e01e0: 6e6c 6573 7320 636f 6f72 6469 6e61 7465 nless coordinate │ │ │ +000e01f0: 7320 696e 2074 6865 2063 616d 6572 6127 s in the camera' │ │ │ +000e0200: 7320 666f 6361 6c20 706c 616e 652c 2069 s focal plane, i │ │ │ +000e0210: 6e64 6570 656e 6465 6e74 206f 6620 696e ndependent of in │ │ │ +000e0220: 7472 696e 7369 6320 7061 7261 6d65 7465 trinsic paramete │ │ │ +000e0230: 7273 2e0a 2020 2020 3c2f 6c69 3e0a 2020 rs.. . │ │ │ +000e0240: 3c2f 756c 3e0a 0a20 203c 2f6c 693e 0a3c
    ..
  • .< │ │ │ +000e0250: 2f75 6c3e 0a3c 623e 4e6f 7465 3a3c 2f62 /ul>.Note: Fisheye vs. │ │ │ +000e0270: 2053 7461 6e64 6172 6420 4d6f 6465 6c3a Standard Model: │ │ │ +000e0280: 3c2f 623e 0a55 7365 2074 6869 7320 6675 .Use this fu │ │ │ +000e0290: 6e63 7469 6f6e 2028 2363 763a 3a66 6973 nction (#cv::fis │ │ │ +000e02a0: 6865 7965 3a3a 756e 6469 7374 6f72 7450 heye::undistortP │ │ │ +000e02b0: 6f69 6e74 7329 2066 6f72 2066 6973 6865 oints) for fishe │ │ │ +000e02c0: 7965 2063 616d 6572 6173 2028 7769 6465 ye cameras (wide │ │ │ +000e02d0: 2d61 6e67 6c65 206c 656e 7365 7329 2e0a -angle lenses).. │ │ │ +000e02e0: 466f 7220 7374 616e 6461 7264 2070 696e For standard pin │ │ │ +000e02f0: 686f 6c65 2063 616d 6572 6173 2c20 7573 hole cameras, us │ │ │ +000e0300: 6520 2375 6e64 6973 746f 7274 506f 696e e #undistortPoin │ │ │ +000e0310: 7473 2069 6e73 7465 6164 2e20 5468 6520 ts instead. The │ │ │ +000e0320: 6669 7368 6579 6520 6d6f 6465 6c20 7573 fisheye model us │ │ │ +000e0330: 6573 2061 2064 6966 6665 7265 6e74 2064 es a different d │ │ │ +000e0340: 6973 746f 7274 696f 6e0a 7061 7261 6d65 istortion.parame │ │ │ +000e0350: 7465 7269 7a61 7469 6f6e 2028 3420 636f terization (4 co │ │ │ +000e0360: 6566 6669 6369 656e 7473 2920 636f 6d70 efficients) comp │ │ │ +000e0370: 6172 6564 2074 6f20 7468 6520 7374 616e ared to the stan │ │ │ +000e0380: 6461 7264 206d 6f64 656c 2028 342d 3134 dard model (4-14 │ │ │ +000e0390: 2063 6f65 6666 6963 6965 6e74 7329 2e3c coefficients).< │ │ │ +000e03a0: 2f64 6976 3e0a 3c64 6c20 636c 6173 733d /div>.
    .
    Par │ │ │ +000e03c0: 616d 6574 6572 733a 3c2f 6474 3e0a 3c64 ameters:
    .distorte │ │ │ +000e03e0: 643c 2f63 6f64 653e 202d 2041 7272 6179 d - Array │ │ │ +000e03f0: 206f 6620 6469 7374 6f72 7465 6420 706f of distorted po │ │ │ +000e0400: 696e 7420 636f 6f72 6469 6e61 7465 7320 int coordinates │ │ │ +000e0410: 696e 203c 623e 7069 7865 6c20 636f 6f72 in pixel coor │ │ │ +000e0420: 6469 6e61 7465 733c 2f62 3e20 6f66 2074 dinates of t │ │ │ +000e0430: 6865 2066 6973 6865 7965 2069 6d61 6765 he fisheye image │ │ │ +000e0440: 2c0a 3178 4e2f 4e78 3120 322d 6368 616e ,.1xN/Nx1 2-chan │ │ │ +000e0450: 6e65 6c20 286f 7220 7665 6374 6f72 266c nel (or vector&l │ │ │ +000e0460: 743b 506f 696e 7432 6626 6774 3b20 292c t;Point2f> ), │ │ │ +000e0470: 2077 6865 7265 204e 2069 7320 7468 6520 where N is the │ │ │ +000e0480: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ +000e0490: 2069 6e20 7468 6520 7669 6577 2e3c 2f64 in the view..
    und │ │ │ +000e04b0: 6973 746f 7274 6564 3c2f 636f 6465 3e20 istorted │ │ │ +000e04c0: 2d20 4f75 7470 7574 2061 7272 6179 206f - Output array o │ │ │ +000e04d0: 6620 756e 6469 7374 6f72 7465 6420 696d f undistorted im │ │ │ +000e04e0: 6167 6520 706f 696e 7473 2c20 3178 4e2f age points, 1xN/ │ │ │ +000e04f0: 4e78 3120 322d 6368 616e 6e65 6c2c 206f Nx1 2-channel, o │ │ │ +000e0500: 7220 7665 6374 6f72 266c 743b 506f 696e r vector<Poin │ │ │ +000e0510: 7432 6626 6774 3b20 2e0a 5468 6520 636f t2f> ..The co │ │ │ +000e0520: 6f72 6469 6e61 7465 2073 7973 7465 6d20 ordinate system │ │ │ +000e0530: 6465 7065 6e64 7320 6f6e 2070 6172 616d depends on param │ │ │ +000e0540: 6574 6572 2050 2028 7365 6520 6162 6f76 eter P (see abov │ │ │ +000e0550: 6529 2e3c 2f64 643e 0a3c 6464 3e3c 636f e).
    .
    K - Ca │ │ │ +000e0570: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ +000e0580: 6174 7269 7820 5c28 5c63 616d 6572 616d atrix \(\cameram │ │ │ +000e0590: 6174 7269 787b 4b7d 5c29 206f 6620 7468 atrix{K}\) of th │ │ │ +000e05a0: 6520 6669 7368 6579 6520 6361 6d65 7261 e fisheye camera │ │ │ +000e05b0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    D - Inpu │ │ │ +000e05d0: 7420 7665 6374 6f72 206f 6620 6669 7368 t vector of fish │ │ │ +000e05e0: 6579 6520 6469 7374 6f72 7469 6f6e 2063 eye distortion c │ │ │ +000e05f0: 6f65 6666 6963 6965 6e74 7320 5c28 5c64 oefficients \(\d │ │ │ +000e0600: 6973 7463 6f65 6666 7366 6973 6865 7965 istcoeffsfisheye │ │ │ +000e0610: 5c29 2028 6d75 7374 2063 6f6e 7461 696e \) (must contain │ │ │ +000e0620: 2065 7861 6374 6c79 2034 2063 6f65 6666 exactly 4 coeff │ │ │ +000e0630: 6963 6965 6e74 7329 2e0a 312d 6368 616e icients)..1-chan │ │ │ +000e0640: 6e65 6c20 6f72 2031 7831 2033 2d63 6861 nel or 1x1 3-cha │ │ │ +000e0650: 6e6e 656c 2e20 4966 2065 6d70 7479 2c20 nnel. If empty, │ │ │ +000e0660: 7468 6520 6964 656e 7469 7479 2074 7261 the identity tra │ │ │ +000e0670: 6e73 666f 726d 6174 696f 6e20 6973 2075 nsformation is u │ │ │ +000e0680: 7365 642e 0a6f 7574 7075 7420 7769 6c6c sed..output will │ │ │ +000e0690: 2062 6520 696e 206e 6f72 6d61 6c69 7a65 be in normalize │ │ │ +000e06a0: 6420 6361 6d65 7261 2063 6f6f 7264 696e d camera coordin │ │ │ +000e06b0: 6174 6573 2e3c 2f64 643e 0a3c 2f64 6c3e ates.
    .
    │ │ │ +000e06c0: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f ....
  • ..

    fish │ │ │ +000e07c0: 6579 655f 6573 7469 6d61 7465 4e65 7743 eye_estimateNewC │ │ │ +000e07d0: 616d 6572 614d 6174 7269 7846 6f72 556e ameraMatrixForUn │ │ │ +000e07e0: 6469 7374 6f72 7452 6563 7469 6679 3c2f distortRectify.
    .
    public │ │ │ +000e0850: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +000e0860: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;vo │ │ │ +000e0880: 6964 3c2f 7370 616e 3e26 6e62 7370 3b3c id < │ │ │ +000e0890: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +000e08a0: 656e 742d 6e61 6d65 223e 6669 7368 6579 ent-name">fishey │ │ │ +000e08b0: 655f 6573 7469 6d61 7465 4e65 7743 616d e_estimateNewCam │ │ │ +000e08c0: 6572 614d 6174 7269 7846 6f72 556e 6469 eraMatrixForUndi │ │ │ +000e08d0: 7374 6f72 7452 6563 7469 6679 3c2f 7370 stortRectify(Ma │ │ │ +000e0940: 743c 2f61 3e26 6e62 7370 3b4b 2c0a 203c t K,. < │ │ │ +000e0950: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000e0960: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000e0970: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000e0980: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat D,. Size image_siz │ │ │ +000e09f0: 652c 0a20 3c61 2068 7265 663d 222e 2e2f e,. │ │ │ +000e0a30: 4d61 743c 2f61 3e26 6e62 7370 3b52 2c0a Mat R,. │ │ │ +000e0a40: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000e0a80: 3c2f 613e 266e 6273 703b 502c 0a20 646f  P,. do │ │ │ +000e0a90: 7562 6c65 266e 6273 703b 6261 6c61 6e63 uble balanc │ │ │ +000e0aa0: 652c 0a20 3c61 2068 7265 663d 222e 2e2f e,. Size n │ │ │ +000e0af0: 6577 5f73 697a 652c 0a20 646f 7562 6c65 ew_size,. double │ │ │ +000e0b00: 266e 6273 703b 666f 765f 7363 616c 6529  fov_scale) │ │ │ +000e0b10: 3c2f 7370 616e 3e3c 2f64 6976 3e0a 3c64
    .Estimates new c │ │ │ +000e0b40: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ +000e0b50: 6d61 7472 6978 2066 6f72 2075 6e64 6973 matrix for undis │ │ │ +000e0b60: 746f 7274 696f 6e20 6f72 2072 6563 7469 tortion or recti │ │ │ +000e0b70: 6669 6361 7469 6f6e 2e3c 2f64 6976 3e0a fication.
    . │ │ │ +000e0b80: 3c64 6c20 636c 6173 733d 226e 6f74 6573
    .
    Parameter │ │ │ +000e0ba0: 733a 3c2f 6474 3e0a 3c64 643e 3c63 6f64 s:
    .
    K - Cam │ │ │ +000e0bc0: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +000e0bd0: 7472 6978 205c 2863 616d 6572 616d 6174 trix \(cameramat │ │ │ +000e0be0: 7269 787b 4b7d 5c29 2e3c 2f64 643e 0a3c rix{K}\).
    .< │ │ │ +000e0bf0: 6464 3e3c 636f 6465 3e44 3c2f 636f 6465 dd>D - Input vector │ │ │ +000e0c10: 206f 6620 6469 7374 6f72 7469 6f6e 2063 of distortion c │ │ │ +000e0c20: 6f65 6666 6963 6965 6e74 7320 5c28 5c64 oefficients \(\d │ │ │ +000e0c30: 6973 7463 6f65 6666 7366 6973 6865 7965 istcoeffsfisheye │ │ │ +000e0c40: 5c29 2e3c 2f64 643e 0a3c 6464 3e3c 636f \)..
    image_size - Size of t │ │ │ +000e0c70: 6865 2069 6d61 6765 3c2f 6464 3e0a 3c64 he image
    .R │ │ │ +000e0c90: 202d 2052 6563 7469 6669 6361 7469 6f6e - Rectification │ │ │ +000e0ca0: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ +000e0cb0: 696e 2074 6865 206f 626a 6563 7420 7370 in the object sp │ │ │ +000e0cc0: 6163 653a 2033 7833 2031 2d63 6861 6e6e ace: 3x3 1-chann │ │ │ +000e0cd0: 656c 2c20 6f72 2076 6563 746f 723a 2033 el, or vector: 3 │ │ │ +000e0ce0: 7831 2f31 7833 0a31 2d63 6861 6e6e 656c x1/1x3.1-channel │ │ │ +000e0cf0: 206f 7220 3178 3120 332d 6368 616e 6e65 or 1x1 3-channe │ │ │ +000e0d00: 6c3c 2f64 643e 0a3c 6464 3e3c 636f 6465 l.
    P - New │ │ │ +000e0d20: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ +000e0d30: 206d 6174 7269 7820 2833 7833 2920 6f72 matrix (3x3) or │ │ │ +000e0d40: 206e 6577 2070 726f 6a65 6374 696f 6e20 new projection │ │ │ +000e0d50: 6d61 7472 6978 2028 3378 3429 3c2f 6464 matrix (3x4)
    .
    bala │ │ │ +000e0d70: 6e63 653c 2f63 6f64 653e 202d 2053 6574 nce - Set │ │ │ +000e0d80: 7320 7468 6520 6e65 7720 666f 6361 6c20 s the new focal │ │ │ +000e0d90: 6c65 6e67 7468 2069 6e20 7261 6e67 6520 length in range │ │ │ +000e0da0: 6265 7477 6565 6e20 7468 6520 6d69 6e20 between the min │ │ │ +000e0db0: 666f 6361 6c20 6c65 6e67 7468 2061 6e64 focal length and │ │ │ +000e0dc0: 2074 6865 206d 6178 2066 6f63 616c 0a6c the max focal.l │ │ │ +000e0dd0: 656e 6774 682e 2042 616c 616e 6365 2069 ength. Balance i │ │ │ +000e0de0: 7320 696e 2072 616e 6765 206f 6620 5b30 s in range of [0 │ │ │ +000e0df0: 2c20 315d 2e3c 2f64 643e 0a3c 6464 3e3c , 1].
    .
    < │ │ │ +000e0e00: 636f 6465 3e6e 6577 5f73 697a 653c 2f63 code>new_size - the new s │ │ │ +000e0e20: 697a 653c 2f64 643e 0a3c 6464 3e3c 636f ize
    .
    fov_scale - Divisor fo │ │ │ +000e0e50: 7220 6e65 7720 666f 6361 6c20 6c65 6e67 r new focal leng │ │ │ +000e0e60: 7468 2e3c 2f64 643e 0a3c 2f64 6c3e 0a3c th.
    .
    .< │ │ │ +000e0e70: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>. │ │ │ +000e0e80: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .

  • .
  • ..< │ │ │ +000e0f60: 6833 3e66 6973 6865 7965 5f65 7374 696d h3>fisheye_estim │ │ │ +000e0f70: 6174 654e 6577 4361 6d65 7261 4d61 7472 ateNewCameraMatr │ │ │ +000e0f80: 6978 466f 7255 6e64 6973 746f 7274 5265 ixForUndistortRe │ │ │ +000e0f90: 6374 6966 793c 2f68 333e 0a3c 6469 7620 ctify.
    .
    public static void │ │ │ +000e1030: 266e 6273 703b 3c73 7061 6e20 636c 6173  fisheye_estimat │ │ │ +000e1060: 654e 6577 4361 6d65 7261 4d61 7472 6978 eNewCameraMatrix │ │ │ +000e1070: 466f 7255 6e64 6973 746f 7274 5265 6374 ForUndistortRect │ │ │ +000e1080: 6966 793c 2f73 7061 6e3e 3c77 6272 3e3c ify< │ │ │ +000e1090: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +000e10a0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ +000e10f0: 703b 4b2c 0a20 3c61 2068 7265 663d 222e p;K,. Mat D │ │ │ +000e1140: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. │ │ │ +000e1180: 5369 7a65 3c2f 613e 266e 6273 703b 696d Size im │ │ │ +000e1190: 6167 655f 7369 7a65 2c0a 203c 6120 6872 age_size,. Mat&n │ │ │ +000e11e0: 6273 703b 522c 0a20 3c61 2068 7265 663d bsp;R,. Mat  │ │ │ +000e1230: 3b50 2c0a 2064 6f75 626c 6526 6e62 7370 ;P,. double  │ │ │ +000e1240: 3b62 616c 616e 6365 2c0a 203c 6120 6872 ;balance,. Size │ │ │ +000e1290: 266e 6273 703b 6e65 775f 7369 7a65 293c  new_size)< │ │ │ +000e12a0: 2f73 7061 6e3e 3c2f 6469 763e 0a3c 6469 /span>
    . │ │ │ +000e12c0: 4573 7469 6d61 7465 7320 6e65 7720 6361 Estimates new ca │ │ │ +000e12d0: 6d65 7261 2069 6e74 7269 6e73 6963 206d mera intrinsic m │ │ │ +000e12e0: 6174 7269 7820 666f 7220 756e 6469 7374 atrix for undist │ │ │ +000e12f0: 6f72 7469 6f6e 206f 7220 7265 6374 6966 ortion or rectif │ │ │ +000e1300: 6963 6174 696f 6e2e 3c2f 6469 763e 0a3c ication.
    .< │ │ │ +000e1310: 646c 2063 6c61 7373 3d22 6e6f 7465 7322 dl class="notes" │ │ │ +000e1320: 3e0a 3c64 743e 5061 7261 6d65 7465 7273 >.
    Parameters │ │ │ +000e1330: 3a3c 2f64 743e 0a3c 6464 3e3c 636f 6465 :
    .
    K - Came │ │ │ +000e1350: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ +000e1360: 7269 7820 5c28 6361 6d65 7261 6d61 7472 rix \(cameramatr │ │ │ +000e1370: 6978 7b4b 7d5c 292e 3c2f 6464 3e0a 3c64 ix{K}\).
    .D │ │ │ +000e1390: 202d 2049 6e70 7574 2076 6563 746f 7220 - Input vector │ │ │ +000e13a0: 6f66 2064 6973 746f 7274 696f 6e20 636f of distortion co │ │ │ +000e13b0: 6566 6669 6369 656e 7473 205c 285c 6469 efficients \(\di │ │ │ +000e13c0: 7374 636f 6566 6673 6669 7368 6579 655c stcoeffsfisheye\ │ │ │ +000e13d0: 292e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 )..
    image_size - Size of th │ │ │ +000e1400: 6520 696d 6167 653c 2f64 643e 0a3c 6464 e image
    .
    R │ │ │ +000e1420: 2d20 5265 6374 6966 6963 6174 696f 6e20 - Rectification │ │ │ +000e1430: 7472 616e 7366 6f72 6d61 7469 6f6e 2069 transformation i │ │ │ +000e1440: 6e20 7468 6520 6f62 6a65 6374 2073 7061 n the object spa │ │ │ +000e1450: 6365 3a20 3378 3320 312d 6368 616e 6e65 ce: 3x3 1-channe │ │ │ +000e1460: 6c2c 206f 7220 7665 6374 6f72 3a20 3378 l, or vector: 3x │ │ │ +000e1470: 312f 3178 330a 312d 6368 616e 6e65 6c20 1/1x3.1-channel │ │ │ +000e1480: 6f72 2031 7831 2033 2d63 6861 6e6e 656c or 1x1 3-channel │ │ │ +000e1490: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000e14a0: 503c 2f63 6f64 653e 202d 204e 6577 2063 P - New c │ │ │ +000e14b0: 616d 6572 6120 696e 7472 696e 7369 6320 amera intrinsic │ │ │ +000e14c0: 6d61 7472 6978 2028 3378 3329 206f 7220 matrix (3x3) or │ │ │ +000e14d0: 6e65 7720 7072 6f6a 6563 7469 6f6e 206d new projection m │ │ │ +000e14e0: 6174 7269 7820 2833 7834 293c 2f64 643e atrix (3x4)
    │ │ │ +000e14f0: 0a3c 6464 3e3c 636f 6465 3e62 616c 616e .
    balan │ │ │ +000e1500: 6365 3c2f 636f 6465 3e20 2d20 5365 7473 ce - Sets │ │ │ +000e1510: 2074 6865 206e 6577 2066 6f63 616c 206c the new focal l │ │ │ +000e1520: 656e 6774 6820 696e 2072 616e 6765 2062 ength in range b │ │ │ +000e1530: 6574 7765 656e 2074 6865 206d 696e 2066 etween the min f │ │ │ +000e1540: 6f63 616c 206c 656e 6774 6820 616e 6420 ocal length and │ │ │ +000e1550: 7468 6520 6d61 7820 666f 6361 6c0a 6c65 the max focal.le │ │ │ +000e1560: 6e67 7468 2e20 4261 6c61 6e63 6520 6973 ngth. Balance is │ │ │ +000e1570: 2069 6e20 7261 6e67 6520 6f66 205b 302c in range of [0, │ │ │ +000e1580: 2031 5d2e 3c2f 6464 3e0a 3c64 643e 3c63 1].
    .
    new_size - the new si │ │ │ +000e15b0: 7a65 3c2f 6464 3e0a 3c2f 646c 3e0a 3c2f ze
    .... │ │ │ +000e15d0: 3c2f 6c69 3e0a 3c6c 693e 0a3c 7365 6374
  • .
  • ..

    fis │ │ │ +000e16a0: 6865 7965 5f65 7374 696d 6174 654e 6577 heye_estimateNew │ │ │ +000e16b0: 4361 6d65 7261 4d61 7472 6978 466f 7255 CameraMatrixForU │ │ │ +000e16c0: 6e64 6973 746f 7274 5265 6374 6966 793c ndistortRectify< │ │ │ +000e16d0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +000e1730: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +000e1740: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;v │ │ │ +000e1760: 6f69 643c 2f73 7061 6e3e 266e 6273 703b oid  │ │ │ +000e1770: 3c73 7061 6e20 636c 6173 733d 2265 6c65 fishe │ │ │ +000e1790: 7965 5f65 7374 696d 6174 654e 6577 4361 ye_estimateNewCa │ │ │ +000e17a0: 6d65 7261 4d61 7472 6978 466f 7255 6e64 meraMatrixForUnd │ │ │ +000e17b0: 6973 746f 7274 5265 6374 6966 793c 2f73 istortRectify(M │ │ │ +000e1820: 6174 3c2f 613e 266e 6273 703b 4b2c 0a20 at K,. │ │ │ +000e1830: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000e1870: 2f61 3e26 6e62 7370 3b44 2c0a 203c 6120 /a> D,. Size image_si │ │ │ +000e18d0: 7a65 2c0a 203c 6120 6872 6566 3d22 2e2e ze,. Mat R, │ │ │ +000e1920: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000e1960: 743c 2f61 3e26 6e62 7370 3b50 2c0a 2064 t P,. d │ │ │ +000e1970: 6f75 626c 6526 6e62 7370 3b62 616c 616e ouble balan │ │ │ +000e1980: 6365 293c 2f73 7061 6e3e 3c2f 6469 763e ce)
    │ │ │ +000e1990: 0a3c 6469 7620 636c 6173 733d 2262 6c6f .
    Estimates ne │ │ │ +000e19b0: 7720 6361 6d65 7261 2069 6e74 7269 6e73 w camera intrins │ │ │ +000e19c0: 6963 206d 6174 7269 7820 666f 7220 756e ic matrix for un │ │ │ +000e19d0: 6469 7374 6f72 7469 6f6e 206f 7220 7265 distortion or re │ │ │ +000e19e0: 6374 6966 6963 6174 696f 6e2e 3c2f 6469 ctification..
    .
    Parame │ │ │ +000e1a10: 7465 7273 3a3c 2f64 743e 0a3c 6464 3e3c ters:
    .
    < │ │ │ +000e1a20: 636f 6465 3e4b 3c2f 636f 6465 3e20 2d20 code>K - │ │ │ +000e1a30: 4361 6d65 7261 2069 6e74 7269 6e73 6963 Camera intrinsic │ │ │ +000e1a40: 206d 6174 7269 7820 5c28 6361 6d65 7261 matrix \(camera │ │ │ +000e1a50: 6d61 7472 6978 7b4b 7d5c 292e 3c2f 6464 matrix{K}\).
    .
    D - Input vec │ │ │ +000e1a80: 746f 7220 6f66 2064 6973 746f 7274 696f tor of distortio │ │ │ +000e1a90: 6e20 636f 6566 6669 6369 656e 7473 205c n coefficients \ │ │ │ +000e1aa0: 285c 6469 7374 636f 6566 6673 6669 7368 (\distcoeffsfish │ │ │ +000e1ab0: 6579 655c 292e 3c2f 6464 3e0a 3c64 643e eye\).
    .
    │ │ │ +000e1ac0: 3c63 6f64 653e 696d 6167 655f 7369 7a65 image_size │ │ │ +000e1ad0: 3c2f 636f 6465 3e20 2d20 5369 7a65 206f - Size o │ │ │ +000e1ae0: 6620 7468 6520 696d 6167 653c 2f64 643e f the image
    │ │ │ +000e1af0: 0a3c 6464 3e3c 636f 6465 3e52 3c2f 636f .
    R - Rectificat │ │ │ +000e1b10: 696f 6e20 7472 616e 7366 6f72 6d61 7469 ion transformati │ │ │ +000e1b20: 6f6e 2069 6e20 7468 6520 6f62 6a65 6374 on in the object │ │ │ +000e1b30: 2073 7061 6365 3a20 3378 3320 312d 6368 space: 3x3 1-ch │ │ │ +000e1b40: 616e 6e65 6c2c 206f 7220 7665 6374 6f72 annel, or vector │ │ │ +000e1b50: 3a20 3378 312f 3178 330a 312d 6368 616e : 3x1/1x3.1-chan │ │ │ +000e1b60: 6e65 6c20 6f72 2031 7831 2033 2d63 6861 nel or 1x1 3-cha │ │ │ +000e1b70: 6e6e 656c 3c2f 6464 3e0a 3c64 643e 3c63 nnel
    .
    P - N │ │ │ +000e1b90: 6577 2063 616d 6572 6120 696e 7472 696e ew camera intrin │ │ │ +000e1ba0: 7369 6320 6d61 7472 6978 2028 3378 3329 sic matrix (3x3) │ │ │ +000e1bb0: 206f 7220 6e65 7720 7072 6f6a 6563 7469 or new projecti │ │ │ +000e1bc0: 6f6e 206d 6174 7269 7820 2833 7834 293c on matrix (3x4)< │ │ │ +000e1bd0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e62 /dd>.
    b │ │ │ +000e1be0: 616c 616e 6365 3c2f 636f 6465 3e20 2d20 alance - │ │ │ +000e1bf0: 5365 7473 2074 6865 206e 6577 2066 6f63 Sets the new foc │ │ │ +000e1c00: 616c 206c 656e 6774 6820 696e 2072 616e al length in ran │ │ │ +000e1c10: 6765 2062 6574 7765 656e 2074 6865 206d ge between the m │ │ │ +000e1c20: 696e 2066 6f63 616c 206c 656e 6774 6820 in focal length │ │ │ +000e1c30: 616e 6420 7468 6520 6d61 7820 666f 6361 and the max foca │ │ │ +000e1c40: 6c0a 6c65 6e67 7468 2e20 4261 6c61 6e63 l.length. Balanc │ │ │ +000e1c50: 6520 6973 2069 6e20 7261 6e67 6520 6f66 e is in range of │ │ │ +000e1c60: 205b 302c 2031 5d2e 3c2f 6464 3e0a 3c2f [0, 1].
    ..
    ..

  • .
  • │ │ │ +000e1c90: 0a3c 7365 6374 696f 6e20 636c 6173 733d .
    .

    fish │ │ │ +000e1d50: 6579 655f 6573 7469 6d61 7465 4e65 7743 eye_estimateNewC │ │ │ +000e1d60: 616d 6572 614d 6174 7269 7846 6f72 556e ameraMatrixForUn │ │ │ +000e1d70: 6469 7374 6f72 7452 6563 7469 6679 3c2f distortRectify.
    .
    public │ │ │ +000e1de0: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +000e1df0: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;vo │ │ │ +000e1e10: 6964 3c2f 7370 616e 3e26 6e62 7370 3b3c id < │ │ │ +000e1e20: 7370 616e 2063 6c61 7373 3d22 656c 656d span class="elem │ │ │ +000e1e30: 656e 742d 6e61 6d65 223e 6669 7368 6579 ent-name">fishey │ │ │ +000e1e40: 655f 6573 7469 6d61 7465 4e65 7743 616d e_estimateNewCam │ │ │ +000e1e50: 6572 614d 6174 7269 7846 6f72 556e 6469 eraMatrixForUndi │ │ │ +000e1e60: 7374 6f72 7452 6563 7469 6679 3c2f 7370 stortRectify(Ma │ │ │ +000e1ed0: 743c 2f61 3e26 6e62 7370 3b4b 2c0a 203c t K,. < │ │ │ +000e1ee0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000e1ef0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000e1f00: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000e1f10: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat D,. Size image_siz │ │ │ +000e1f80: 652c 0a20 3c61 2068 7265 663d 222e 2e2f e,. │ │ │ +000e1fc0: 4d61 743c 2f61 3e26 6e62 7370 3b52 2c0a Mat R,. │ │ │ +000e1fd0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000e2010: 3c2f 613e 266e 6273 703b 5029 3c2f 7370  P)
    .
    Est │ │ │ +000e2040: 696d 6174 6573 206e 6577 2063 616d 6572 imates new camer │ │ │ +000e2050: 6120 696e 7472 696e 7369 6320 6d61 7472 a intrinsic matr │ │ │ +000e2060: 6978 2066 6f72 2075 6e64 6973 746f 7274 ix for undistort │ │ │ +000e2070: 696f 6e20 6f72 2072 6563 7469 6669 6361 ion or rectifica │ │ │ +000e2080: 7469 6f6e 2e3c 2f64 6976 3e0a 3c64 6c20 tion.
    .
    .< │ │ │ +000e20a0: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    K< │ │ │ +000e20c0: 2f63 6f64 653e 202d 2043 616d 6572 6120 /code> - Camera │ │ │ +000e20d0: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ +000e20e0: 205c 2863 616d 6572 616d 6174 7269 787b \(cameramatrix{ │ │ │ +000e20f0: 4b7d 5c29 2e3c 2f64 643e 0a3c 6464 3e3c K}\).
    .
    < │ │ │ +000e2100: 636f 6465 3e44 3c2f 636f 6465 3e20 2d20 code>D - │ │ │ +000e2110: 496e 7075 7420 7665 6374 6f72 206f 6620 Input vector of │ │ │ +000e2120: 6469 7374 6f72 7469 6f6e 2063 6f65 6666 distortion coeff │ │ │ +000e2130: 6963 6965 6e74 7320 5c28 5c64 6973 7463 icients \(\distc │ │ │ +000e2140: 6f65 6666 7366 6973 6865 7965 5c29 2e3c oeffsfisheye\).< │ │ │ +000e2150: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e69 /dd>.
    i │ │ │ +000e2160: 6d61 6765 5f73 697a 653c 2f63 6f64 653e mage_size │ │ │ +000e2170: 202d 2053 697a 6520 6f66 2074 6865 2069 - Size of the i │ │ │ +000e2180: 6d61 6765 3c2f 6464 3e0a 3c64 643e 3c63 mage
    .
    R - R │ │ │ +000e21a0: 6563 7469 6669 6361 7469 6f6e 2074 7261 ectification tra │ │ │ +000e21b0: 6e73 666f 726d 6174 696f 6e20 696e 2074 nsformation in t │ │ │ +000e21c0: 6865 206f 626a 6563 7420 7370 6163 653a he object space: │ │ │ +000e21d0: 2033 7833 2031 2d63 6861 6e6e 656c 2c20 3x3 1-channel, │ │ │ +000e21e0: 6f72 2076 6563 746f 723a 2033 7831 2f31 or vector: 3x1/1 │ │ │ +000e21f0: 7833 0a31 2d63 6861 6e6e 656c 206f 7220 x3.1-channel or │ │ │ +000e2200: 3178 3120 332d 6368 616e 6e65 6c3c 2f64 1x1 3-channel.
    P - New came │ │ │ +000e2230: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ +000e2240: 7269 7820 2833 7833 2920 6f72 206e 6577 rix (3x3) or new │ │ │ +000e2250: 2070 726f 6a65 6374 696f 6e20 6d61 7472 projection matr │ │ │ +000e2260: 6978 2028 3378 3429 0a6c 656e 6774 682e ix (3x4).length. │ │ │ +000e2270: 2042 616c 616e 6365 2069 7320 696e 2072 Balance is in r │ │ │ +000e2280: 616e 6765 206f 6620 5b30 2c20 315d 2e3c ange of [0, 1].< │ │ │ +000e2290: 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 6976 /dd>.
    .
    .

    ..
  • .
    .

    fis │ │ │ +000e2390: 6865 7965 5f73 6f6c 7665 506e 503c 2f68 heye_solvePnP.
    .
    public │ │ │ +000e2400: 7374 6174 6963 3c2f 7370 616e 3e26 6e62 static&nb │ │ │ +000e2410: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;boo │ │ │ +000e2430: 6c65 616e 3c2f 7370 616e 3e26 6e62 7370 lean  │ │ │ +000e2440: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;fish │ │ │ +000e2460: 6579 655f 736f 6c76 6550 6e50 3c2f 7370 eye_solvePnP(Ma │ │ │ +000e24d0: 743c 2f61 3e26 6e62 7370 3b6f 626a 6563 t objec │ │ │ +000e24e0: 7450 6f69 6e74 732c 0a20 3c61 2068 7265 tPoints,. Mat&nb │ │ │ +000e2530: 7370 3b69 6d61 6765 506f 696e 7473 2c0a sp;imagePoints,. │ │ │ +000e2540: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000e2580: 3c2f 613e 266e 6273 703b 6361 6d65 7261  camera │ │ │ +000e2590: 4d61 7472 6978 2c0a 203c 6120 6872 6566 Matrix,. Mat&nbs │ │ │ +000e25e0: 703b 6469 7374 436f 6566 6673 2c0a 203c p;distCoeffs,. < │ │ │ +000e25f0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000e2600: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000e2610: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000e2620: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat rvec,. < │ │ │ +000e2640: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000e2650: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000e2660: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000e2670: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat tvec,. b │ │ │ +000e2690: 6f6f 6c65 616e 266e 6273 703b 7573 6545 oolean useE │ │ │ +000e26a0: 7874 7269 6e73 6963 4775 6573 732c 0a20 xtrinsicGuess,. │ │ │ +000e26b0: 696e 7426 6e62 7370 3b66 6c61 6773 2c0a int flags,. │ │ │ +000e26c0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 TermCriter │ │ │ +000e2710: 6961 3c2f 613e 266e 6273 703b 6372 6974 ia crit │ │ │ +000e2720: 6572 6961 293c 2f73 7061 6e3e 3c2f 6469 eria).
    Finds an o │ │ │ +000e2750: 626a 6563 7420 706f 7365 2066 726f 6d20 bject pose from │ │ │ +000e2760: 3344 2d32 4420 706f 696e 7420 636f 7272 3D-2D point corr │ │ │ +000e2770: 6573 706f 6e64 656e 6365 7320 666f 7220 espondences for │ │ │ +000e2780: 6669 7368 6579 6520 6361 6d65 7261 206d fisheye camera m │ │ │ +000e2790: 6f64 656c 2e3c 2f64 6976 3e0a 3c64 6c20 odel.
    .
    .< │ │ │ +000e27b0: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    ob │ │ │ +000e27d0: 6a65 6374 506f 696e 7473 3c2f 636f 6465 jectPoints - Array of obj │ │ │ +000e27f0: 6563 7420 706f 696e 7473 2069 6e20 7468 ect points in th │ │ │ +000e2800: 6520 6f62 6a65 6374 2063 6f6f 7264 696e e object coordin │ │ │ +000e2810: 6174 6520 7370 6163 652c 204e 7833 2031 ate space, Nx3 1 │ │ │ +000e2820: 2d63 6861 6e6e 656c 206f 720a 3178 4e2f -channel or.1xN/ │ │ │ +000e2830: 4e78 3120 332d 6368 616e 6e65 6c2c 2077 Nx1 3-channel, w │ │ │ +000e2840: 6865 7265 204e 2069 7320 7468 6520 6e75 here N is the nu │ │ │ +000e2850: 6d62 6572 206f 6620 706f 696e 7473 2e20 mber of points. │ │ │ +000e2860: 7665 6374 6f72 266c 743b 506f 696e 7433 vector<Point3 │ │ │ +000e2870: 6426 6774 3b20 6361 6e20 616c 736f 2062 d> can also b │ │ │ +000e2880: 6520 7061 7373 6564 2068 6572 652e 3c2f e passed here..
    im │ │ │ +000e28a0: 6167 6550 6f69 6e74 733c 2f63 6f64 653e agePoints │ │ │ +000e28b0: 202d 2041 7272 6179 206f 6620 636f 7272 - Array of corr │ │ │ +000e28c0: 6573 706f 6e64 696e 6720 696d 6167 6520 esponding image │ │ │ +000e28d0: 706f 696e 7473 2c20 4e78 3220 312d 6368 points, Nx2 1-ch │ │ │ +000e28e0: 616e 6e65 6c20 6f72 2031 784e 2f4e 7831 annel or 1xN/Nx1 │ │ │ +000e28f0: 2032 2d63 6861 6e6e 656c 2c0a 7768 6572 2-channel,.wher │ │ │ +000e2900: 6520 4e20 6973 2074 6865 206e 756d 6265 e N is the numbe │ │ │ +000e2910: 7220 6f66 2070 6f69 6e74 732e 2076 6563 r of points. vec │ │ │ +000e2920: 746f 7226 6c74 3b50 6f69 6e74 3264 2667 tor<Point2d&g │ │ │ +000e2930: 743b 2063 616e 2061 6c73 6f20 6265 2070 t; can also be p │ │ │ +000e2940: 6173 7365 6420 6865 7265 2e3c 2f64 643e assed here.
    │ │ │ +000e2950: 0a3c 6464 3e3c 636f 6465 3e63 616d 6572 .
    camer │ │ │ +000e2960: 614d 6174 7269 783c 2f63 6f64 653e 202d aMatrix - │ │ │ +000e2970: 2049 6e70 7574 2063 616d 6572 6120 696e Input camera in │ │ │ +000e2980: 7472 696e 7369 6320 6d61 7472 6978 205c trinsic matrix \ │ │ │ +000e2990: 285c 6361 6d65 7261 6d61 7472 6978 7b41 (\cameramatrix{A │ │ │ +000e29a0: 7d5c 2920 2e3c 2f64 643e 0a3c 6464 3e3c }\) .
    .
    < │ │ │ +000e29b0: 636f 6465 3e64 6973 7443 6f65 6666 733c code>distCoeffs< │ │ │ +000e29c0: 2f63 6f64 653e 202d 2049 6e70 7574 2076 /code> - Input v │ │ │ +000e29d0: 6563 746f 7220 6f66 2064 6973 746f 7274 ector of distort │ │ │ +000e29e0: 696f 6e20 636f 6566 6669 6369 656e 7473 ion coefficients │ │ │ +000e29f0: 2028 3478 312f 3178 3429 2e3c 2f64 643e (4x1/1x4).
    │ │ │ +000e2a00: 0a3c 6464 3e3c 636f 6465 3e72 7665 633c .
    rvec< │ │ │ +000e2a10: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ +000e2a20: 726f 7461 7469 6f6e 2076 6563 746f 7220 rotation vector │ │ │ +000e2a30: 2873 6565 2052 4546 3a20 526f 6472 6967 (see REF: Rodrig │ │ │ +000e2a40: 7565 7320 2920 7468 6174 2c20 746f 6765 ues ) that, toge │ │ │ +000e2a50: 7468 6572 2077 6974 6820 7476 6563 2c20 ther with tvec, │ │ │ +000e2a60: 6272 696e 6773 2070 6f69 6e74 7320 6672 brings points fr │ │ │ +000e2a70: 6f6d 0a74 6865 206d 6f64 656c 2063 6f6f om.the model coo │ │ │ +000e2a80: 7264 696e 6174 6520 7379 7374 656d 2074 rdinate system t │ │ │ +000e2a90: 6f20 7468 6520 6361 6d65 7261 2063 6f6f o the camera coo │ │ │ +000e2aa0: 7264 696e 6174 6520 7379 7374 656d 2e3c rdinate system.< │ │ │ +000e2ab0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e74 /dd>.
    t │ │ │ +000e2ac0: 7665 633c 2f63 6f64 653e 202d 204f 7574 vec - Out │ │ │ +000e2ad0: 7075 7420 7472 616e 736c 6174 696f 6e20 put translation │ │ │ +000e2ae0: 7665 6374 6f72 2e3c 2f64 643e 0a3c 6464 vector.
    .
    useExtrin │ │ │ +000e2b00: 7369 6347 7565 7373 3c2f 636f 6465 3e20 sicGuess │ │ │ +000e2b10: 2d20 5061 7261 6d65 7465 7220 7573 6564 - Parameter used │ │ │ +000e2b20: 2066 6f72 2023 534f 4c56 4550 4e50 5f49 for #SOLVEPNP_I │ │ │ +000e2b30: 5445 5241 5449 5645 2e20 4966 2074 7275 TERATIVE. If tru │ │ │ +000e2b40: 6520 2831 292c 2074 6865 2066 756e 6374 e (1), the funct │ │ │ +000e2b50: 696f 6e20 7573 6573 0a74 6865 2070 726f ion uses.the pro │ │ │ +000e2b60: 7669 6465 6420 7276 6563 2061 6e64 2074 vided rvec and t │ │ │ +000e2b70: 7665 6320 7661 6c75 6573 2061 7320 696e vec values as in │ │ │ +000e2b80: 6974 6961 6c20 6170 7072 6f78 696d 6174 itial approximat │ │ │ +000e2b90: 696f 6e73 206f 6620 7468 6520 726f 7461 ions of the rota │ │ │ +000e2ba0: 7469 6f6e 2061 6e64 2074 7261 6e73 6c61 tion and transla │ │ │ +000e2bb0: 7469 6f6e 0a76 6563 746f 7273 2c20 7265 tion.vectors, re │ │ │ +000e2bc0: 7370 6563 7469 7665 6c79 2c20 616e 6420 spectively, and │ │ │ +000e2bd0: 6675 7274 6865 7220 6f70 7469 6d69 7a65 further optimize │ │ │ +000e2be0: 7320 7468 656d 2e3c 2f64 643e 0a3c 6464 s them.
    .
    flags - Method for │ │ │ +000e2c10: 2073 6f6c 7669 6e67 2061 2050 6e50 2070 solving a PnP p │ │ │ +000e2c20: 726f 626c 656d 3a20 7365 6520 5245 463a roblem: see REF: │ │ │ +000e2c30: 2063 616c 6962 3364 5f73 6f6c 7665 506e calib3d_solvePn │ │ │ +000e2c40: 505f 666c 6167 730a 5468 6973 2066 756e P_flags.This fun │ │ │ +000e2c50: 6374 696f 6e20 7265 7475 726e 7320 7468 ction returns th │ │ │ +000e2c60: 6520 726f 7461 7469 6f6e 2061 6e64 2074 e rotation and t │ │ │ +000e2c70: 6865 2074 7261 6e73 6c61 7469 6f6e 2076 he translation v │ │ │ +000e2c80: 6563 746f 7273 2074 6861 7420 7472 616e ectors that tran │ │ │ +000e2c90: 7366 6f72 6d20 6120 3344 2070 6f69 6e74 sform a 3D point │ │ │ +000e2ca0: 2065 7870 7265 7373 6564 2069 6e20 7468 expressed in th │ │ │ +000e2cb0: 6520 6f62 6a65 6374 0a63 6f6f 7264 696e e object.coordin │ │ │ +000e2cc0: 6174 6520 6672 616d 6520 746f 2074 6865 ate frame to the │ │ │ +000e2cd0: 2063 616d 6572 6120 636f 6f72 6469 6e61 camera coordina │ │ │ +000e2ce0: 7465 2066 7261 6d65 2c20 7573 696e 6720 te frame, using │ │ │ +000e2cf0: 6469 6666 6572 656e 7420 6d65 7468 6f64 different method │ │ │ +000e2d00: 733a 0a3c 756c 3e0a 2020 3c6c 693e 0a20 s:.
      .
    • . │ │ │ +000e2d10: 5033 5020 6d65 7468 6f64 7320 2852 4546 P3P methods (REF │ │ │ +000e2d20: 3a20 534f 4c56 4550 4e50 5f50 3350 2c20 : SOLVEPNP_P3P, │ │ │ +000e2d30: 5245 463a 2053 4f4c 5645 504e 505f 4150 REF: SOLVEPNP_AP │ │ │ +000e2d40: 3350 293a 206e 6565 6420 3420 696e 7075 3P): need 4 inpu │ │ │ +000e2d50: 7420 706f 696e 7473 2074 6f20 7265 7475 t points to retu │ │ │ +000e2d60: 726e 2061 2075 6e69 7175 6520 736f 6c75 rn a unique solu │ │ │ +000e2d70: 7469 6f6e 2e0a 2020 3c2f 6c69 3e0a 2020 tion..
    • . │ │ │ +000e2d80: 3c6c 693e 0a20 5245 463a 2053 4f4c 5645
    • . REF: SOLVE │ │ │ +000e2d90: 504e 505f 4950 5045 2049 6e70 7574 2070 PNP_IPPE Input p │ │ │ +000e2da0: 6f69 6e74 7320 6d75 7374 2062 6520 2667 oints must be &g │ │ │ +000e2db0: 743b 3d20 3420 616e 6420 6f62 6a65 6374 t;= 4 and object │ │ │ +000e2dc0: 2070 6f69 6e74 7320 6d75 7374 2062 6520 points must be │ │ │ +000e2dd0: 636f 706c 616e 6172 2e0a 2020 3c2f 6c69 coplanar..
    • .
    • . REF: S │ │ │ +000e2df0: 4f4c 5645 504e 505f 4950 5045 5f53 5155 OLVEPNP_IPPE_SQU │ │ │ +000e2e00: 4152 4520 5370 6563 6961 6c20 6361 7365 ARE Special case │ │ │ +000e2e10: 2073 7569 7461 626c 6520 666f 7220 6d61 suitable for ma │ │ │ +000e2e20: 726b 6572 2070 6f73 6520 6573 7469 6d61 rker pose estima │ │ │ +000e2e30: 7469 6f6e 2e0a 4e75 6d62 6572 206f 6620 tion..Number of │ │ │ +000e2e40: 696e 7075 7420 706f 696e 7473 206d 7573 input points mus │ │ │ +000e2e50: 7420 6265 2034 2e20 4f62 6a65 6374 2070 t be 4. Object p │ │ │ +000e2e60: 6f69 6e74 7320 6d75 7374 2062 6520 6465 oints must be de │ │ │ +000e2e70: 6669 6e65 6420 696e 2074 6865 2066 6f6c fined in the fol │ │ │ +000e2e80: 6c6f 7769 6e67 206f 7264 6572 3a0a 2020 lowing order:. │ │ │ +000e2e90: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 706f
    • .
    • . po │ │ │ +000e2ea0: 696e 7420 303a 205b 2d73 7175 6172 654c int 0: [-squareL │ │ │ +000e2eb0: 656e 6774 6820 2f20 322c 2020 7371 7561 ength / 2, squa │ │ │ +000e2ec0: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ +000e2ed0: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ +000e2ee0: 2070 6f69 6e74 2031 3a20 5b20 7371 7561 point 1: [ squa │ │ │ +000e2ef0: 7265 4c65 6e67 7468 202f 2032 2c20 2073 reLength / 2, s │ │ │ +000e2f00: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ +000e2f10: 2030 5d0a 2020 3c2f 6c69 3e0a 2020 3c6c 0].
    • . . point 2: [ s │ │ │ +000e2f30: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ +000e2f40: 202d 7371 7561 7265 4c65 6e67 7468 202f -squareLength / │ │ │ +000e2f50: 2032 2c20 305d 0a20 203c 2f6c 693e 0a20 2, 0]. . │ │ │ +000e2f60: 203c 6c69 3e0a 2070 6f69 6e74 2033 3a20
    • . point 3: │ │ │ +000e2f70: 5b2d 7371 7561 7265 4c65 6e67 7468 202f [-squareLength / │ │ │ +000e2f80: 2032 2c20 2d73 7175 6172 654c 656e 6774 2, -squareLengt │ │ │ +000e2f90: 6820 2f20 322c 2030 5d0a 2020 3c2f 6c69 h / 2, 0].
    • .
    • . for al │ │ │ +000e2fb0: 6c20 7468 6520 6f74 6865 7220 666c 6167 l the other flag │ │ │ +000e2fc0: 732c 206e 756d 6265 7220 6f66 2069 6e70 s, number of inp │ │ │ +000e2fd0: 7574 2070 6f69 6e74 7320 6d75 7374 2062 ut points must b │ │ │ +000e2fe0: 6520 2667 743b 3d20 3420 616e 6420 6f62 e >= 4 and ob │ │ │ +000e2ff0: 6a65 6374 2070 6f69 6e74 7320 6361 6e20 ject points can │ │ │ +000e3000: 6265 2069 6e20 616e 7920 636f 6e66 6967 be in any config │ │ │ +000e3010: 7572 6174 696f 6e2e 0a20 203c 2f6c 693e uration..
    • │ │ │ +000e3020: 0a3c 2f75 6c3e 3c2f 6464 3e0a 3c64 643e .
    .
    │ │ │ +000e3030: 3c63 6f64 653e 6372 6974 6572 6961 3c2f criteria - Terminat │ │ │ +000e3050: 696f 6e20 6372 6974 6572 6961 2066 6f72 ion criteria for │ │ │ +000e3060: 2069 6e74 6572 6e61 6c20 756e 6469 7374 internal undist │ │ │ +000e3070: 6f72 7450 6f69 6e74 7320 6361 6c6c 2e0a ortPoints call.. │ │ │ +000e3080: 5468 6520 6675 6e63 7469 6f6e 2069 6e74 The function int │ │ │ +000e3090: 6572 6e61 6c6c 7920 756e 6469 7374 6f72 ernally undistor │ │ │ +000e30a0: 7473 2070 6f69 6e74 7320 7769 7468 2052 ts points with R │ │ │ +000e30b0: 4546 3a20 756e 6469 7374 6f72 7450 6f69 EF: undistortPoi │ │ │ +000e30c0: 6e74 7320 616e 6420 6361 6c6c 2052 4546 nts and call REF │ │ │ +000e30d0: 3a20 6376 3a3a 736f 6c76 6550 6e50 2c0a : cv::solvePnP,. │ │ │ +000e30e0: 7468 7573 2074 6865 2069 6e70 7574 2061 thus the input a │ │ │ +000e30f0: 7265 2076 6572 7920 7369 6d69 6c61 722e re very similar. │ │ │ +000e3100: 2043 6865 636b 2074 6865 7265 2061 6e64 Check there and │ │ │ +000e3110: 2050 6572 7370 6563 7469 7665 2d6e 2d50 Perspective-n-P │ │ │ +000e3120: 6f69 6e74 7320 6973 2064 6573 6372 6962 oints is describ │ │ │ +000e3130: 6564 2069 6e20 5245 463a 2063 616c 6962 ed in REF: calib │ │ │ +000e3140: 3364 5f73 6f6c 7665 506e 500a 666f 7220 3d_solvePnP.for │ │ │ +000e3150: 6d6f 7265 2069 6e66 6f72 6d61 7469 6f6e more information │ │ │ +000e3160: 2e3c 2f64 643e 0a3c 6474 3e52 6574 7572 .
    .
    Retur │ │ │ +000e3170: 6e73 3a3c 2f64 743e 0a3c 6464 3e61 7574 ns:
    .
    aut │ │ │ +000e3180: 6f6d 6174 6963 616c 6c79 2067 656e 6572 omatically gener │ │ │ +000e3190: 6174 6564 3c2f 6464 3e0a 3c2f 646c 3e0a ated
    .
    . │ │ │ +000e31a0: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e
    .

    .
  • .
  • . │ │ │ +000e3270: 0a3c 6833 3e66 6973 6865 7965 5f73 6f6c .

    fisheye_sol │ │ │ +000e3280: 7665 506e 503c 2f68 333e 0a3c 6469 7620 vePnP

    .
    .
    public static boolean fisheye_solv │ │ │ +000e3350: 6550 6e50 3c2f 7370 616e 3e3c 7762 723e ePnP │ │ │ +000e3360: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +000e33c0: 7370 3b6f 626a 6563 7450 6f69 6e74 732c sp;objectPoints, │ │ │ +000e33d0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000e3410: 743c 2f61 3e26 6e62 7370 3b69 6d61 6765 t image │ │ │ +000e3420: 506f 696e 7473 2c0a 203c 6120 6872 6566 Points,. Mat&nbs │ │ │ +000e3470: 703b 6361 6d65 7261 4d61 7472 6978 2c0a p;cameraMatrix,. │ │ │ +000e3480: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000e34c0: 3c2f 613e 266e 6273 703b 6469 7374 436f  distCo │ │ │ +000e34d0: 6566 6673 2c0a 203c 6120 6872 6566 3d22 effs,. Mat  │ │ │ +000e3520: 7276 6563 2c0a 203c 6120 6872 6566 3d22 rvec,. Mat  │ │ │ +000e3570: 7476 6563 2c0a 2062 6f6f 6c65 616e 266e tvec,. boolean&n │ │ │ +000e3580: 6273 703b 7573 6545 7874 7269 6e73 6963 bsp;useExtrinsic │ │ │ +000e3590: 4775 6573 732c 0a20 696e 7426 6e62 7370 Guess,. int  │ │ │ +000e35a0: 3b66 6c61 6773 293c 2f73 7061 6e3e 3c2f ;flags).
    Finds an │ │ │ +000e35d0: 206f 626a 6563 7420 706f 7365 2066 726f object pose fro │ │ │ +000e35e0: 6d20 3344 2d32 4420 706f 696e 7420 636f m 3D-2D point co │ │ │ +000e35f0: 7272 6573 706f 6e64 656e 6365 7320 666f rrespondences fo │ │ │ +000e3600: 7220 6669 7368 6579 6520 6361 6d65 7261 r fisheye camera │ │ │ +000e3610: 206d 6f64 656c 2e3c 2f64 6976 3e0a 3c64 model.
    . │ │ │ +000e3630: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +000e3640: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000e3650: 6f62 6a65 6374 506f 696e 7473 3c2f 636f objectPoints - Array of o │ │ │ +000e3670: 626a 6563 7420 706f 696e 7473 2069 6e20 bject points in │ │ │ +000e3680: 7468 6520 6f62 6a65 6374 2063 6f6f 7264 the object coord │ │ │ +000e3690: 696e 6174 6520 7370 6163 652c 204e 7833 inate space, Nx3 │ │ │ +000e36a0: 2031 2d63 6861 6e6e 656c 206f 720a 3178 1-channel or.1x │ │ │ +000e36b0: 4e2f 4e78 3120 332d 6368 616e 6e65 6c2c N/Nx1 3-channel, │ │ │ +000e36c0: 2077 6865 7265 204e 2069 7320 7468 6520 where N is the │ │ │ +000e36d0: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ +000e36e0: 2e20 7665 6374 6f72 266c 743b 506f 696e . vector<Poin │ │ │ +000e36f0: 7433 6426 6774 3b20 6361 6e20 616c 736f t3d> can also │ │ │ +000e3700: 2062 6520 7061 7373 6564 2068 6572 652e be passed here. │ │ │ +000e3710: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000e3720: 696d 6167 6550 6f69 6e74 733c 2f63 6f64 imagePoints - Array of co │ │ │ +000e3740: 7272 6573 706f 6e64 696e 6720 696d 6167 rresponding imag │ │ │ +000e3750: 6520 706f 696e 7473 2c20 4e78 3220 312d e points, Nx2 1- │ │ │ +000e3760: 6368 616e 6e65 6c20 6f72 2031 784e 2f4e channel or 1xN/N │ │ │ +000e3770: 7831 2032 2d63 6861 6e6e 656c 2c0a 7768 x1 2-channel,.wh │ │ │ +000e3780: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ +000e3790: 6265 7220 6f66 2070 6f69 6e74 732e 2076 ber of points. v │ │ │ +000e37a0: 6563 746f 7226 6c74 3b50 6f69 6e74 3264 ector<Point2d │ │ │ +000e37b0: 2667 743b 2063 616e 2061 6c73 6f20 6265 > can also be │ │ │ +000e37c0: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    cam │ │ │ +000e37e0: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ +000e37f0: 202d 2049 6e70 7574 2063 616d 6572 6120 - Input camera │ │ │ +000e3800: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ +000e3810: 205c 285c 6361 6d65 7261 6d61 7472 6978 \(\cameramatrix │ │ │ +000e3820: 7b41 7d5c 2920 2e3c 2f64 643e 0a3c 6464 {A}\) .
    .
    distCoeff │ │ │ +000e3840: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ +000e3850: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ +000e3860: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ +000e3870: 7473 2028 3478 312f 3178 3429 2e3c 2f64 ts (4x1/1x4)..
    rve │ │ │ +000e3890: 633c 2f63 6f64 653e 202d 204f 7574 7075 c - Outpu │ │ │ +000e38a0: 7420 726f 7461 7469 6f6e 2076 6563 746f t rotation vecto │ │ │ +000e38b0: 7220 2873 6565 2052 4546 3a20 526f 6472 r (see REF: Rodr │ │ │ +000e38c0: 6967 7565 7320 2920 7468 6174 2c20 746f igues ) that, to │ │ │ +000e38d0: 6765 7468 6572 2077 6974 6820 7476 6563 gether with tvec │ │ │ +000e38e0: 2c20 6272 696e 6773 2070 6f69 6e74 7320 , brings points │ │ │ +000e38f0: 6672 6f6d 0a74 6865 206d 6f64 656c 2063 from.the model c │ │ │ +000e3900: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ +000e3910: 2074 6f20 7468 6520 6361 6d65 7261 2063 to the camera c │ │ │ +000e3920: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ +000e3930: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    tvec - O │ │ │ +000e3950: 7574 7075 7420 7472 616e 736c 6174 696f utput translatio │ │ │ +000e3960: 6e20 7665 6374 6f72 2e3c 2f64 643e 0a3c n vector.
    .< │ │ │ +000e3970: 6464 3e3c 636f 6465 3e75 7365 4578 7472 dd>useExtr │ │ │ +000e3980: 696e 7369 6347 7565 7373 3c2f 636f 6465 insicGuess - Parameter us │ │ │ +000e39a0: 6564 2066 6f72 2023 534f 4c56 4550 4e50 ed for #SOLVEPNP │ │ │ +000e39b0: 5f49 5445 5241 5449 5645 2e20 4966 2074 _ITERATIVE. If t │ │ │ +000e39c0: 7275 6520 2831 292c 2074 6865 2066 756e rue (1), the fun │ │ │ +000e39d0: 6374 696f 6e20 7573 6573 0a74 6865 2070 ction uses.the p │ │ │ +000e39e0: 726f 7669 6465 6420 7276 6563 2061 6e64 rovided rvec and │ │ │ +000e39f0: 2074 7665 6320 7661 6c75 6573 2061 7320 tvec values as │ │ │ +000e3a00: 696e 6974 6961 6c20 6170 7072 6f78 696d initial approxim │ │ │ +000e3a10: 6174 696f 6e73 206f 6620 7468 6520 726f ations of the ro │ │ │ +000e3a20: 7461 7469 6f6e 2061 6e64 2074 7261 6e73 tation and trans │ │ │ +000e3a30: 6c61 7469 6f6e 0a76 6563 746f 7273 2c20 lation.vectors, │ │ │ +000e3a40: 7265 7370 6563 7469 7665 6c79 2c20 616e respectively, an │ │ │ +000e3a50: 6420 6675 7274 6865 7220 6f70 7469 6d69 d further optimi │ │ │ +000e3a60: 7a65 7320 7468 656d 2e3c 2f64 643e 0a3c zes them..< │ │ │ +000e3a70: 6464 3e3c 636f 6465 3e66 6c61 6773 3c2f dd>flags - Method f │ │ │ +000e3a90: 6f72 2073 6f6c 7669 6e67 2061 2050 6e50 or solving a PnP │ │ │ +000e3aa0: 2070 726f 626c 656d 3a20 7365 6520 5245 problem: see RE │ │ │ +000e3ab0: 463a 2063 616c 6962 3364 5f73 6f6c 7665 F: calib3d_solve │ │ │ +000e3ac0: 506e 505f 666c 6167 730a 5468 6973 2066 PnP_flags.This f │ │ │ +000e3ad0: 756e 6374 696f 6e20 7265 7475 726e 7320 unction returns │ │ │ +000e3ae0: 7468 6520 726f 7461 7469 6f6e 2061 6e64 the rotation and │ │ │ +000e3af0: 2074 6865 2074 7261 6e73 6c61 7469 6f6e the translation │ │ │ +000e3b00: 2076 6563 746f 7273 2074 6861 7420 7472 vectors that tr │ │ │ +000e3b10: 616e 7366 6f72 6d20 6120 3344 2070 6f69 ansform a 3D poi │ │ │ +000e3b20: 6e74 2065 7870 7265 7373 6564 2069 6e20 nt expressed in │ │ │ +000e3b30: 7468 6520 6f62 6a65 6374 0a63 6f6f 7264 the object.coord │ │ │ +000e3b40: 696e 6174 6520 6672 616d 6520 746f 2074 inate frame to t │ │ │ +000e3b50: 6865 2063 616d 6572 6120 636f 6f72 6469 he camera coordi │ │ │ +000e3b60: 6e61 7465 2066 7261 6d65 2c20 7573 696e nate frame, usin │ │ │ +000e3b70: 6720 6469 6666 6572 656e 7420 6d65 7468 g different meth │ │ │ +000e3b80: 6f64 733a 0a3c 756c 3e0a 2020 3c6c 693e ods:.
      .
    • │ │ │ +000e3b90: 0a20 5033 5020 6d65 7468 6f64 7320 2852 . P3P methods (R │ │ │ +000e3ba0: 4546 3a20 534f 4c56 4550 4e50 5f50 3350 EF: SOLVEPNP_P3P │ │ │ +000e3bb0: 2c20 5245 463a 2053 4f4c 5645 504e 505f , REF: SOLVEPNP_ │ │ │ +000e3bc0: 4150 3350 293a 206e 6565 6420 3420 696e AP3P): need 4 in │ │ │ +000e3bd0: 7075 7420 706f 696e 7473 2074 6f20 7265 put points to re │ │ │ +000e3be0: 7475 726e 2061 2075 6e69 7175 6520 736f turn a unique so │ │ │ +000e3bf0: 6c75 7469 6f6e 2e0a 2020 3c2f 6c69 3e0a lution..
    • . │ │ │ +000e3c00: 2020 3c6c 693e 0a20 5245 463a 2053 4f4c
    • . REF: SOL │ │ │ +000e3c10: 5645 504e 505f 4950 5045 2049 6e70 7574 VEPNP_IPPE Input │ │ │ +000e3c20: 2070 6f69 6e74 7320 6d75 7374 2062 6520 points must be │ │ │ +000e3c30: 2667 743b 3d20 3420 616e 6420 6f62 6a65 >= 4 and obje │ │ │ +000e3c40: 6374 2070 6f69 6e74 7320 6d75 7374 2062 ct points must b │ │ │ +000e3c50: 6520 636f 706c 616e 6172 2e0a 2020 3c2f e coplanar.. .
    • . REF: │ │ │ +000e3c70: 2053 4f4c 5645 504e 505f 4950 5045 5f53 SOLVEPNP_IPPE_S │ │ │ +000e3c80: 5155 4152 4520 5370 6563 6961 6c20 6361 QUARE Special ca │ │ │ +000e3c90: 7365 2073 7569 7461 626c 6520 666f 7220 se suitable for │ │ │ +000e3ca0: 6d61 726b 6572 2070 6f73 6520 6573 7469 marker pose esti │ │ │ +000e3cb0: 6d61 7469 6f6e 2e0a 4e75 6d62 6572 206f mation..Number o │ │ │ +000e3cc0: 6620 696e 7075 7420 706f 696e 7473 206d f input points m │ │ │ +000e3cd0: 7573 7420 6265 2034 2e20 4f62 6a65 6374 ust be 4. Object │ │ │ +000e3ce0: 2070 6f69 6e74 7320 6d75 7374 2062 6520 points must be │ │ │ +000e3cf0: 6465 6669 6e65 6420 696e 2074 6865 2066 defined in the f │ │ │ +000e3d00: 6f6c 6c6f 7769 6e67 206f 7264 6572 3a0a ollowing order:. │ │ │ +000e3d10: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ +000e3d20: 706f 696e 7420 303a 205b 2d73 7175 6172 point 0: [-squar │ │ │ +000e3d30: 654c 656e 6774 6820 2f20 322c 2020 7371 eLength / 2, sq │ │ │ +000e3d40: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +000e3d50: 305d 0a20 203c 2f6c 693e 0a20 203c 6c69 0].
    • .
    • . point 1: [ sq │ │ │ +000e3d70: 7561 7265 4c65 6e67 7468 202f 2032 2c20 uareLength / 2, │ │ │ +000e3d80: 2073 7175 6172 654c 656e 6774 6820 2f20 squareLength / │ │ │ +000e3d90: 322c 2030 5d0a 2020 3c2f 6c69 3e0a 2020 2, 0].
    • . │ │ │ +000e3da0: 3c6c 693e 0a20 706f 696e 7420 323a 205b
    • . point 2: [ │ │ │ +000e3db0: 2073 7175 6172 654c 656e 6774 6820 2f20 squareLength / │ │ │ +000e3dc0: 322c 202d 7371 7561 7265 4c65 6e67 7468 2, -squareLength │ │ │ +000e3dd0: 202f 2032 2c20 305d 0a20 203c 2f6c 693e / 2, 0].
    • │ │ │ +000e3de0: 0a20 203c 6c69 3e0a 2070 6f69 6e74 2033 .
    • . point 3 │ │ │ +000e3df0: 3a20 5b2d 7371 7561 7265 4c65 6e67 7468 : [-squareLength │ │ │ +000e3e00: 202f 2032 2c20 2d73 7175 6172 654c 656e / 2, -squareLen │ │ │ +000e3e10: 6774 6820 2f20 322c 2030 5d0a 2020 3c2f gth / 2, 0]. .
    • . for │ │ │ +000e3e30: 616c 6c20 7468 6520 6f74 6865 7220 666c all the other fl │ │ │ +000e3e40: 6167 732c 206e 756d 6265 7220 6f66 2069 ags, number of i │ │ │ +000e3e50: 6e70 7574 2070 6f69 6e74 7320 6d75 7374 nput points must │ │ │ +000e3e60: 2062 6520 2667 743b 3d20 3420 616e 6420 be >= 4 and │ │ │ +000e3e70: 6f62 6a65 6374 2070 6f69 6e74 7320 6361 object points ca │ │ │ +000e3e80: 6e20 6265 2069 6e20 616e 7920 636f 6e66 n be in any conf │ │ │ +000e3e90: 6967 7572 6174 696f 6e2e 0a20 203c 2f6c iguration.. .
    .The fun │ │ │ +000e3eb0: 6374 696f 6e20 696e 7465 726e 616c 6c79 ction internally │ │ │ +000e3ec0: 2075 6e64 6973 746f 7274 7320 706f 696e undistorts poin │ │ │ +000e3ed0: 7473 2077 6974 6820 5245 463a 2075 6e64 ts with REF: und │ │ │ +000e3ee0: 6973 746f 7274 506f 696e 7473 2061 6e64 istortPoints and │ │ │ +000e3ef0: 2063 616c 6c20 5245 463a 2063 763a 3a73 call REF: cv::s │ │ │ +000e3f00: 6f6c 7665 506e 502c 0a74 6875 7320 7468 olvePnP,.thus th │ │ │ +000e3f10: 6520 696e 7075 7420 6172 6520 7665 7279 e input are very │ │ │ +000e3f20: 2073 696d 696c 6172 2e20 4368 6563 6b20 similar. Check │ │ │ +000e3f30: 7468 6572 6520 616e 6420 5065 7273 7065 there and Perspe │ │ │ +000e3f40: 6374 6976 652d 6e2d 506f 696e 7473 2069 ctive-n-Points i │ │ │ +000e3f50: 7320 6465 7363 7269 6265 6420 696e 2052 s described in R │ │ │ +000e3f60: 4546 3a20 6361 6c69 6233 645f 736f 6c76 EF: calib3d_solv │ │ │ +000e3f70: 6550 6e50 0a66 6f72 206d 6f72 6520 696e ePnP.for more in │ │ │ +000e3f80: 666f 726d 6174 696f 6e2e 3c2f 6464 3e0a formation.. │ │ │ +000e3f90: 3c64 743e 5265 7475 726e 733a 3c2f 6474
    Returns:
    .
    automatica │ │ │ +000e3fb0: 6c6c 7920 6765 6e65 7261 7465 643c 2f64 lly generated..
    . │ │ │ +000e3fd0: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e .
  • │ │ │ +000e3fe0: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    fishey │ │ │ +000e40a0: 655f 736f 6c76 6550 6e50 3c2f 6833 3e0a e_solvePnP

    . │ │ │ +000e40b0: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ +000e40d0: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ +000e4110: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ +000e4120: 3c73 7061 6e20 636c 6173 733d 2272 6574 boolea │ │ │ +000e4140: 6e3c 2f73 7061 6e3e 266e 6273 703b 3c73 n fisheye │ │ │ +000e4170: 5f73 6f6c 7665 506e 503c 2f73 7061 6e3e _solvePnP │ │ │ +000e4180: 3c77 6272 3e3c 7370 616e 2063 6c61 7373 (< │ │ │ +000e41a0: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000e41b0: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000e41c0: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000e41d0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat objectPo │ │ │ +000e41f0: 696e 7473 2c0a 203c 6120 6872 6566 3d22 ints,. Mat  │ │ │ +000e4240: 696d 6167 6550 6f69 6e74 732c 0a20 3c61 imagePoints,. Mat cameraMat │ │ │ +000e42a0: 7269 782c 0a20 3c61 2068 7265 663d 222e rix,. Mat d │ │ │ +000e42f0: 6973 7443 6f65 6666 732c 0a20 3c61 2068 istCoeffs,. Mat& │ │ │ +000e4340: 6e62 7370 3b72 7665 632c 0a20 3c61 2068 nbsp;rvec,. Mat& │ │ │ +000e4390: 6e62 7370 3b74 7665 632c 0a20 626f 6f6c nbsp;tvec,. bool │ │ │ +000e43a0: 6561 6e26 6e62 7370 3b75 7365 4578 7472 ean useExtr │ │ │ +000e43b0: 696e 7369 6347 7565 7373 293c 2f73 7061 insicGuess)
    .
    Find │ │ │ +000e43e0: 7320 616e 206f 626a 6563 7420 706f 7365 s an object pose │ │ │ +000e43f0: 2066 726f 6d20 3344 2d32 4420 706f 696e from 3D-2D poin │ │ │ +000e4400: 7420 636f 7272 6573 706f 6e64 656e 6365 t correspondence │ │ │ +000e4410: 7320 666f 7220 6669 7368 6579 6520 6361 s for fisheye ca │ │ │ +000e4420: 6d65 7261 206d 6f64 656c 2e3c 2f64 6976 mera model.
    .
    .
    Paramet │ │ │ +000e4450: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    objectPoints │ │ │ +000e4470: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ +000e4480: 6f66 206f 626a 6563 7420 706f 696e 7473 of object points │ │ │ +000e4490: 2069 6e20 7468 6520 6f62 6a65 6374 2063 in the object c │ │ │ +000e44a0: 6f6f 7264 696e 6174 6520 7370 6163 652c oordinate space, │ │ │ +000e44b0: 204e 7833 2031 2d63 6861 6e6e 656c 206f Nx3 1-channel o │ │ │ +000e44c0: 720a 3178 4e2f 4e78 3120 332d 6368 616e r.1xN/Nx1 3-chan │ │ │ +000e44d0: 6e65 6c2c 2077 6865 7265 204e 2069 7320 nel, where N is │ │ │ +000e44e0: 7468 6520 6e75 6d62 6572 206f 6620 706f the number of po │ │ │ +000e44f0: 696e 7473 2e20 7665 6374 6f72 266c 743b ints. vector< │ │ │ +000e4500: 506f 696e 7433 6426 6774 3b20 6361 6e20 Point3d> can │ │ │ +000e4510: 616c 736f 2062 6520 7061 7373 6564 2068 also be passed h │ │ │ +000e4520: 6572 652e 3c2f 6464 3e0a 3c64 643e 3c63 ere.
    .
    imagePoints< │ │ │ +000e4540: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ +000e4550: 6620 636f 7272 6573 706f 6e64 696e 6720 f corresponding │ │ │ +000e4560: 696d 6167 6520 706f 696e 7473 2c20 4e78 image points, Nx │ │ │ +000e4570: 3220 312d 6368 616e 6e65 6c20 6f72 2031 2 1-channel or 1 │ │ │ +000e4580: 784e 2f4e 7831 2032 2d63 6861 6e6e 656c xN/Nx1 2-channel │ │ │ +000e4590: 2c0a 7768 6572 6520 4e20 6973 2074 6865 ,.where N is the │ │ │ +000e45a0: 206e 756d 6265 7220 6f66 2070 6f69 6e74 number of point │ │ │ +000e45b0: 732e 2076 6563 746f 7226 6c74 3b50 6f69 s. vector<Poi │ │ │ +000e45c0: 6e74 3264 2667 743b 2063 616e 2061 6c73 nt2d> can als │ │ │ +000e45d0: 6f20 6265 2070 6173 7365 6420 6865 7265 o be passed here │ │ │ +000e45e0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    cameraMatrix - Input cam │ │ │ +000e4610: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +000e4620: 7472 6978 205c 285c 6361 6d65 7261 6d61 trix \(\camerama │ │ │ +000e4630: 7472 6978 7b41 7d5c 2920 2e3c 2f64 643e trix{A}\) .
    │ │ │ +000e4640: 0a3c 6464 3e3c 636f 6465 3e64 6973 7443 .
    distC │ │ │ +000e4650: 6f65 6666 733c 2f63 6f64 653e 202d 2049 oeffs - I │ │ │ +000e4660: 6e70 7574 2076 6563 746f 7220 6f66 2064 nput vector of d │ │ │ +000e4670: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ +000e4680: 6369 656e 7473 2028 3478 312f 3178 3429 cients (4x1/1x4) │ │ │ +000e4690: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    rvec - O │ │ │ +000e46b0: 7574 7075 7420 726f 7461 7469 6f6e 2076 utput rotation v │ │ │ +000e46c0: 6563 746f 7220 2873 6565 2052 4546 3a20 ector (see REF: │ │ │ +000e46d0: 526f 6472 6967 7565 7320 2920 7468 6174 Rodrigues ) that │ │ │ +000e46e0: 2c20 746f 6765 7468 6572 2077 6974 6820 , together with │ │ │ +000e46f0: 7476 6563 2c20 6272 696e 6773 2070 6f69 tvec, brings poi │ │ │ +000e4700: 6e74 7320 6672 6f6d 0a74 6865 206d 6f64 nts from.the mod │ │ │ +000e4710: 656c 2063 6f6f 7264 696e 6174 6520 7379 el coordinate sy │ │ │ +000e4720: 7374 656d 2074 6f20 7468 6520 6361 6d65 stem to the came │ │ │ +000e4730: 7261 2063 6f6f 7264 696e 6174 6520 7379 ra coordinate sy │ │ │ +000e4740: 7374 656d 2e3c 2f64 643e 0a3c 6464 3e3c stem.
    .
    < │ │ │ +000e4750: 636f 6465 3e74 7665 633c 2f63 6f64 653e code>tvec │ │ │ +000e4760: 202d 204f 7574 7075 7420 7472 616e 736c - Output transl │ │ │ +000e4770: 6174 696f 6e20 7665 6374 6f72 2e3c 2f64 ation vector..
    use │ │ │ +000e4790: 4578 7472 696e 7369 6347 7565 7373 3c2f ExtrinsicGuess - Paramete │ │ │ +000e47b0: 7220 7573 6564 2066 6f72 2023 534f 4c56 r used for #SOLV │ │ │ +000e47c0: 4550 4e50 5f49 5445 5241 5449 5645 2e20 EPNP_ITERATIVE. │ │ │ +000e47d0: 4966 2074 7275 6520 2831 292c 2074 6865 If true (1), the │ │ │ +000e47e0: 2066 756e 6374 696f 6e20 7573 6573 0a74 function uses.t │ │ │ +000e47f0: 6865 2070 726f 7669 6465 6420 7276 6563 he provided rvec │ │ │ +000e4800: 2061 6e64 2074 7665 6320 7661 6c75 6573 and tvec values │ │ │ +000e4810: 2061 7320 696e 6974 6961 6c20 6170 7072 as initial appr │ │ │ +000e4820: 6f78 696d 6174 696f 6e73 206f 6620 7468 oximations of th │ │ │ +000e4830: 6520 726f 7461 7469 6f6e 2061 6e64 2074 e rotation and t │ │ │ +000e4840: 7261 6e73 6c61 7469 6f6e 0a76 6563 746f ranslation.vecto │ │ │ +000e4850: 7273 2c20 7265 7370 6563 7469 7665 6c79 rs, respectively │ │ │ +000e4860: 2c20 616e 6420 6675 7274 6865 7220 6f70 , and further op │ │ │ +000e4870: 7469 6d69 7a65 7320 7468 656d 2e0a 5468 timizes them..Th │ │ │ +000e4880: 6973 2066 756e 6374 696f 6e20 7265 7475 is function retu │ │ │ +000e4890: 726e 7320 7468 6520 726f 7461 7469 6f6e rns the rotation │ │ │ +000e48a0: 2061 6e64 2074 6865 2074 7261 6e73 6c61 and the transla │ │ │ +000e48b0: 7469 6f6e 2076 6563 746f 7273 2074 6861 tion vectors tha │ │ │ +000e48c0: 7420 7472 616e 7366 6f72 6d20 6120 3344 t transform a 3D │ │ │ +000e48d0: 2070 6f69 6e74 2065 7870 7265 7373 6564 point expressed │ │ │ +000e48e0: 2069 6e20 7468 6520 6f62 6a65 6374 0a63 in the object.c │ │ │ +000e48f0: 6f6f 7264 696e 6174 6520 6672 616d 6520 oordinate frame │ │ │ +000e4900: 746f 2074 6865 2063 616d 6572 6120 636f to the camera co │ │ │ +000e4910: 6f72 6469 6e61 7465 2066 7261 6d65 2c20 ordinate frame, │ │ │ +000e4920: 7573 696e 6720 6469 6666 6572 656e 7420 using different │ │ │ +000e4930: 6d65 7468 6f64 733a 0a3c 756c 3e0a 2020 methods:.
      . │ │ │ +000e4940: 3c6c 693e 0a20 5033 5020 6d65 7468 6f64
    • . P3P method │ │ │ +000e4950: 7320 2852 4546 3a20 534f 4c56 4550 4e50 s (REF: SOLVEPNP │ │ │ +000e4960: 5f50 3350 2c20 5245 463a 2053 4f4c 5645 _P3P, REF: SOLVE │ │ │ +000e4970: 504e 505f 4150 3350 293a 206e 6565 6420 PNP_AP3P): need │ │ │ +000e4980: 3420 696e 7075 7420 706f 696e 7473 2074 4 input points t │ │ │ +000e4990: 6f20 7265 7475 726e 2061 2075 6e69 7175 o return a uniqu │ │ │ +000e49a0: 6520 736f 6c75 7469 6f6e 2e0a 2020 3c2f e solution.. .
    • . REF: │ │ │ +000e49c0: 2053 4f4c 5645 504e 505f 4950 5045 2049 SOLVEPNP_IPPE I │ │ │ +000e49d0: 6e70 7574 2070 6f69 6e74 7320 6d75 7374 nput points must │ │ │ +000e49e0: 2062 6520 2667 743b 3d20 3420 616e 6420 be >= 4 and │ │ │ +000e49f0: 6f62 6a65 6374 2070 6f69 6e74 7320 6d75 object points mu │ │ │ +000e4a00: 7374 2062 6520 636f 706c 616e 6172 2e0a st be coplanar.. │ │ │ +000e4a10: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ +000e4a20: 5245 463a 2053 4f4c 5645 504e 505f 4950 REF: SOLVEPNP_IP │ │ │ +000e4a30: 5045 5f53 5155 4152 4520 5370 6563 6961 PE_SQUARE Specia │ │ │ +000e4a40: 6c20 6361 7365 2073 7569 7461 626c 6520 l case suitable │ │ │ +000e4a50: 666f 7220 6d61 726b 6572 2070 6f73 6520 for marker pose │ │ │ +000e4a60: 6573 7469 6d61 7469 6f6e 2e0a 4e75 6d62 estimation..Numb │ │ │ +000e4a70: 6572 206f 6620 696e 7075 7420 706f 696e er of input poin │ │ │ +000e4a80: 7473 206d 7573 7420 6265 2034 2e20 4f62 ts must be 4. Ob │ │ │ +000e4a90: 6a65 6374 2070 6f69 6e74 7320 6d75 7374 ject points must │ │ │ +000e4aa0: 2062 6520 6465 6669 6e65 6420 696e 2074 be defined in t │ │ │ +000e4ab0: 6865 2066 6f6c 6c6f 7769 6e67 206f 7264 he following ord │ │ │ +000e4ac0: 6572 3a0a 2020 3c2f 6c69 3e0a 2020 3c6c er:.
    • . . point 0: [-s │ │ │ +000e4ae0: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ +000e4af0: 2020 7371 7561 7265 4c65 6e67 7468 202f squareLength / │ │ │ +000e4b00: 2032 2c20 305d 0a20 203c 2f6c 693e 0a20 2, 0]. . │ │ │ +000e4b10: 203c 6c69 3e0a 2070 6f69 6e74 2031 3a20
    • . point 1: │ │ │ +000e4b20: 5b20 7371 7561 7265 4c65 6e67 7468 202f [ squareLength / │ │ │ +000e4b30: 2032 2c20 2073 7175 6172 654c 656e 6774 2, squareLengt │ │ │ +000e4b40: 6820 2f20 322c 2030 5d0a 2020 3c2f 6c69 h / 2, 0].
    • .
    • . point │ │ │ +000e4b60: 323a 205b 2073 7175 6172 654c 656e 6774 2: [ squareLengt │ │ │ +000e4b70: 6820 2f20 322c 202d 7371 7561 7265 4c65 h / 2, -squareLe │ │ │ +000e4b80: 6e67 7468 202f 2032 2c20 305d 0a20 203c ngth / 2, 0]. < │ │ │ +000e4b90: 2f6c 693e 0a20 203c 6c69 3e0a 2070 6f69 /li>.
    • . poi │ │ │ +000e4ba0: 6e74 2033 3a20 5b2d 7371 7561 7265 4c65 nt 3: [-squareLe │ │ │ +000e4bb0: 6e67 7468 202f 2032 2c20 2d73 7175 6172 ngth / 2, -squar │ │ │ +000e4bc0: 654c 656e 6774 6820 2f20 322c 2030 5d0a eLength / 2, 0]. │ │ │ +000e4bd0: 2020 3c2f 6c69 3e0a 2020 3c6c 693e 0a20
    • .
    • . │ │ │ +000e4be0: 666f 7220 616c 6c20 7468 6520 6f74 6865 for all the othe │ │ │ +000e4bf0: 7220 666c 6167 732c 206e 756d 6265 7220 r flags, number │ │ │ +000e4c00: 6f66 2069 6e70 7574 2070 6f69 6e74 7320 of input points │ │ │ +000e4c10: 6d75 7374 2062 6520 2667 743b 3d20 3420 must be >= 4 │ │ │ +000e4c20: 616e 6420 6f62 6a65 6374 2070 6f69 6e74 and object point │ │ │ +000e4c30: 7320 6361 6e20 6265 2069 6e20 616e 7920 s can be in any │ │ │ +000e4c40: 636f 6e66 6967 7572 6174 696f 6e2e 0a20 configuration.. │ │ │ +000e4c50: 203c 2f6c 693e 0a3c 2f75 6c3e 0a54 6865
    • .
    .The │ │ │ +000e4c60: 2066 756e 6374 696f 6e20 696e 7465 726e function intern │ │ │ +000e4c70: 616c 6c79 2075 6e64 6973 746f 7274 7320 ally undistorts │ │ │ +000e4c80: 706f 696e 7473 2077 6974 6820 5245 463a points with REF: │ │ │ +000e4c90: 2075 6e64 6973 746f 7274 506f 696e 7473 undistortPoints │ │ │ +000e4ca0: 2061 6e64 2063 616c 6c20 5245 463a 2063 and call REF: c │ │ │ +000e4cb0: 763a 3a73 6f6c 7665 506e 502c 0a74 6875 v::solvePnP,.thu │ │ │ +000e4cc0: 7320 7468 6520 696e 7075 7420 6172 6520 s the input are │ │ │ +000e4cd0: 7665 7279 2073 696d 696c 6172 2e20 4368 very similar. Ch │ │ │ +000e4ce0: 6563 6b20 7468 6572 6520 616e 6420 5065 eck there and Pe │ │ │ +000e4cf0: 7273 7065 6374 6976 652d 6e2d 506f 696e rspective-n-Poin │ │ │ +000e4d00: 7473 2069 7320 6465 7363 7269 6265 6420 ts is described │ │ │ +000e4d10: 696e 2052 4546 3a20 6361 6c69 6233 645f in REF: calib3d_ │ │ │ +000e4d20: 736f 6c76 6550 6e50 0a66 6f72 206d 6f72 solvePnP.for mor │ │ │ +000e4d30: 6520 696e 666f 726d 6174 696f 6e2e 3c2f e information..
    Returns: │ │ │ +000e4d50: 3c2f 6474 3e0a 3c64 643e 6175 746f 6d61
    .
    automa │ │ │ +000e4d60: 7469 6361 6c6c 7920 6765 6e65 7261 7465 tically generate │ │ │ +000e4d70: 643c 2f64 643e 0a3c 2f64 6c3e 0a3c 2f64 d
    .
    ..
    .< │ │ │ +000e4d90: 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 7469 /li>.
  • ..

    fisheye_so │ │ │ +000e4e50: 6c76 6550 6e50 3c2f 6833 3e0a 3c64 6976 lvePnP

    .
    .
    public static< │ │ │ +000e4ec0: 2f73 7061 6e3e 266e 6273 703b 3c73 7061 /span> boolean fisheye_sol │ │ │ +000e4f20: 7665 506e 503c 2f73 7061 6e3e 3c77 6272 vePnP(Mat&n │ │ │ +000e4f90: 6273 703b 6f62 6a65 6374 506f 696e 7473 bsp;objectPoints │ │ │ +000e4fa0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000e4fe0: 6174 3c2f 613e 266e 6273 703b 696d 6167 at imag │ │ │ +000e4ff0: 6550 6f69 6e74 732c 0a20 3c61 2068 7265 ePoints,. Mat&nb │ │ │ +000e5040: 7370 3b63 616d 6572 614d 6174 7269 782c sp;cameraMatrix, │ │ │ +000e5050: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000e5090: 743c 2f61 3e26 6e62 7370 3b64 6973 7443 t distC │ │ │ +000e50a0: 6f65 6666 732c 0a20 3c61 2068 7265 663d oeffs,. Mat  │ │ │ +000e50f0: 3b72 7665 632c 0a20 3c61 2068 7265 663d ;rvec,. Mat  │ │ │ +000e5140: 3b74 7665 6329 3c2f 7370 616e 3e3c 2f64 ;tvec).
    Finds an │ │ │ +000e5170: 6f62 6a65 6374 2070 6f73 6520 6672 6f6d object pose from │ │ │ +000e5180: 2033 442d 3244 2070 6f69 6e74 2063 6f72 3D-2D point cor │ │ │ +000e5190: 7265 7370 6f6e 6465 6e63 6573 2066 6f72 respondences for │ │ │ +000e51a0: 2066 6973 6865 7965 2063 616d 6572 6120 fisheye camera │ │ │ +000e51b0: 6d6f 6465 6c2e 3c2f 6469 763e 0a3c 646c model.
    .
    . │ │ │ +000e51d0: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ +000e51e0: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e6f /dt>.
    o │ │ │ +000e51f0: 626a 6563 7450 6f69 6e74 733c 2f63 6f64 bjectPoints - Array of ob │ │ │ +000e5210: 6a65 6374 2070 6f69 6e74 7320 696e 2074 ject points in t │ │ │ +000e5220: 6865 206f 626a 6563 7420 636f 6f72 6469 he object coordi │ │ │ +000e5230: 6e61 7465 2073 7061 6365 2c20 4e78 3320 nate space, Nx3 │ │ │ +000e5240: 312d 6368 616e 6e65 6c20 6f72 0a31 784e 1-channel or.1xN │ │ │ +000e5250: 2f4e 7831 2033 2d63 6861 6e6e 656c 2c20 /Nx1 3-channel, │ │ │ +000e5260: 7768 6572 6520 4e20 6973 2074 6865 206e where N is the n │ │ │ +000e5270: 756d 6265 7220 6f66 2070 6f69 6e74 732e umber of points. │ │ │ +000e5280: 2076 6563 746f 7226 6c74 3b50 6f69 6e74 vector<Point │ │ │ +000e5290: 3364 2667 743b 2063 616e 2061 6c73 6f20 3d> can also │ │ │ +000e52a0: 6265 2070 6173 7365 6420 6865 7265 2e3c be passed here.< │ │ │ +000e52b0: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e69 /dd>.
    i │ │ │ +000e52c0: 6d61 6765 506f 696e 7473 3c2f 636f 6465 magePoints - Array of cor │ │ │ +000e52e0: 7265 7370 6f6e 6469 6e67 2069 6d61 6765 responding image │ │ │ +000e52f0: 2070 6f69 6e74 732c 204e 7832 2031 2d63 points, Nx2 1-c │ │ │ +000e5300: 6861 6e6e 656c 206f 7220 3178 4e2f 4e78 hannel or 1xN/Nx │ │ │ +000e5310: 3120 322d 6368 616e 6e65 6c2c 0a77 6865 1 2-channel,.whe │ │ │ +000e5320: 7265 204e 2069 7320 7468 6520 6e75 6d62 re N is the numb │ │ │ +000e5330: 6572 206f 6620 706f 696e 7473 2e20 7665 er of points. ve │ │ │ +000e5340: 6374 6f72 266c 743b 506f 696e 7432 6426 ctor<Point2d& │ │ │ +000e5350: 6774 3b20 6361 6e20 616c 736f 2062 6520 gt; can also be │ │ │ +000e5360: 7061 7373 6564 2068 6572 652e 3c2f 6464 passed here.
    .
    came │ │ │ +000e5380: 7261 4d61 7472 6978 3c2f 636f 6465 3e20 raMatrix │ │ │ +000e5390: 2d20 496e 7075 7420 6361 6d65 7261 2069 - Input camera i │ │ │ +000e53a0: 6e74 7269 6e73 6963 206d 6174 7269 7820 ntrinsic matrix │ │ │ +000e53b0: 5c28 5c63 616d 6572 616d 6174 7269 787b \(\cameramatrix{ │ │ │ +000e53c0: 417d 5c29 202e 3c2f 6464 3e0a 3c64 643e A}\) .
    .
    │ │ │ +000e53d0: 3c63 6f64 653e 6469 7374 436f 6566 6673 distCoeffs │ │ │ +000e53e0: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ +000e53f0: 7665 6374 6f72 206f 6620 6469 7374 6f72 vector of distor │ │ │ +000e5400: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ +000e5410: 7320 2834 7831 2f31 7834 292e 3c2f 6464 s (4x1/1x4).
    .
    rvec │ │ │ +000e5430: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +000e5440: 2072 6f74 6174 696f 6e20 7665 6374 6f72 rotation vector │ │ │ +000e5450: 2028 7365 6520 5245 463a 2052 6f64 7269 (see REF: Rodri │ │ │ +000e5460: 6775 6573 2029 2074 6861 742c 2074 6f67 gues ) that, tog │ │ │ +000e5470: 6574 6865 7220 7769 7468 2074 7665 632c ether with tvec, │ │ │ +000e5480: 2062 7269 6e67 7320 706f 696e 7473 2066 brings points f │ │ │ +000e5490: 726f 6d0a 7468 6520 6d6f 6465 6c20 636f rom.the model co │ │ │ +000e54a0: 6f72 6469 6e61 7465 2073 7973 7465 6d20 ordinate system │ │ │ +000e54b0: 746f 2074 6865 2063 616d 6572 6120 636f to the camera co │ │ │ +000e54c0: 6f72 6469 6e61 7465 2073 7973 7465 6d2e ordinate system. │ │ │ +000e54d0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000e54e0: 7476 6563 3c2f 636f 6465 3e20 2d20 4f75 tvec - Ou │ │ │ +000e54f0: 7470 7574 2074 7261 6e73 6c61 7469 6f6e tput translation │ │ │ +000e5500: 2076 6563 746f 722e 0a74 6865 2070 726f vector..the pro │ │ │ +000e5510: 7669 6465 6420 7276 6563 2061 6e64 2074 vided rvec and t │ │ │ +000e5520: 7665 6320 7661 6c75 6573 2061 7320 696e vec values as in │ │ │ +000e5530: 6974 6961 6c20 6170 7072 6f78 696d 6174 itial approximat │ │ │ +000e5540: 696f 6e73 206f 6620 7468 6520 726f 7461 ions of the rota │ │ │ +000e5550: 7469 6f6e 2061 6e64 2074 7261 6e73 6c61 tion and transla │ │ │ +000e5560: 7469 6f6e 0a76 6563 746f 7273 2c20 7265 tion.vectors, re │ │ │ +000e5570: 7370 6563 7469 7665 6c79 2c20 616e 6420 spectively, and │ │ │ +000e5580: 6675 7274 6865 7220 6f70 7469 6d69 7a65 further optimize │ │ │ +000e5590: 7320 7468 656d 2e0a 5468 6973 2066 756e s them..This fun │ │ │ +000e55a0: 6374 696f 6e20 7265 7475 726e 7320 7468 ction returns th │ │ │ +000e55b0: 6520 726f 7461 7469 6f6e 2061 6e64 2074 e rotation and t │ │ │ +000e55c0: 6865 2074 7261 6e73 6c61 7469 6f6e 2076 he translation v │ │ │ +000e55d0: 6563 746f 7273 2074 6861 7420 7472 616e ectors that tran │ │ │ +000e55e0: 7366 6f72 6d20 6120 3344 2070 6f69 6e74 sform a 3D point │ │ │ +000e55f0: 2065 7870 7265 7373 6564 2069 6e20 7468 expressed in th │ │ │ +000e5600: 6520 6f62 6a65 6374 0a63 6f6f 7264 696e e object.coordin │ │ │ +000e5610: 6174 6520 6672 616d 6520 746f 2074 6865 ate frame to the │ │ │ +000e5620: 2063 616d 6572 6120 636f 6f72 6469 6e61 camera coordina │ │ │ +000e5630: 7465 2066 7261 6d65 2c20 7573 696e 6720 te frame, using │ │ │ +000e5640: 6469 6666 6572 656e 7420 6d65 7468 6f64 different method │ │ │ +000e5650: 733a 0a3c 756c 3e0a 2020 3c6c 693e 0a20 s:.
      .
    • . │ │ │ +000e5660: 5033 5020 6d65 7468 6f64 7320 2852 4546 P3P methods (REF │ │ │ +000e5670: 3a20 534f 4c56 4550 4e50 5f50 3350 2c20 : SOLVEPNP_P3P, │ │ │ +000e5680: 5245 463a 2053 4f4c 5645 504e 505f 4150 REF: SOLVEPNP_AP │ │ │ +000e5690: 3350 293a 206e 6565 6420 3420 696e 7075 3P): need 4 inpu │ │ │ +000e56a0: 7420 706f 696e 7473 2074 6f20 7265 7475 t points to retu │ │ │ +000e56b0: 726e 2061 2075 6e69 7175 6520 736f 6c75 rn a unique solu │ │ │ +000e56c0: 7469 6f6e 2e0a 2020 3c2f 6c69 3e0a 2020 tion..
    • . │ │ │ +000e56d0: 3c6c 693e 0a20 5245 463a 2053 4f4c 5645
    • . REF: SOLVE │ │ │ +000e56e0: 504e 505f 4950 5045 2049 6e70 7574 2070 PNP_IPPE Input p │ │ │ +000e56f0: 6f69 6e74 7320 6d75 7374 2062 6520 2667 oints must be &g │ │ │ +000e5700: 743b 3d20 3420 616e 6420 6f62 6a65 6374 t;= 4 and object │ │ │ +000e5710: 2070 6f69 6e74 7320 6d75 7374 2062 6520 points must be │ │ │ +000e5720: 636f 706c 616e 6172 2e0a 2020 3c2f 6c69 coplanar..
    • .
    • . REF: S │ │ │ +000e5740: 4f4c 5645 504e 505f 4950 5045 5f53 5155 OLVEPNP_IPPE_SQU │ │ │ +000e5750: 4152 4520 5370 6563 6961 6c20 6361 7365 ARE Special case │ │ │ +000e5760: 2073 7569 7461 626c 6520 666f 7220 6d61 suitable for ma │ │ │ +000e5770: 726b 6572 2070 6f73 6520 6573 7469 6d61 rker pose estima │ │ │ +000e5780: 7469 6f6e 2e0a 4e75 6d62 6572 206f 6620 tion..Number of │ │ │ +000e5790: 696e 7075 7420 706f 696e 7473 206d 7573 input points mus │ │ │ +000e57a0: 7420 6265 2034 2e20 4f62 6a65 6374 2070 t be 4. Object p │ │ │ +000e57b0: 6f69 6e74 7320 6d75 7374 2062 6520 6465 oints must be de │ │ │ +000e57c0: 6669 6e65 6420 696e 2074 6865 2066 6f6c fined in the fol │ │ │ +000e57d0: 6c6f 7769 6e67 206f 7264 6572 3a0a 2020 lowing order:. │ │ │ +000e57e0: 3c2f 6c69 3e0a 2020 3c6c 693e 0a20 706f
    • .
    • . po │ │ │ +000e57f0: 696e 7420 303a 205b 2d73 7175 6172 654c int 0: [-squareL │ │ │ +000e5800: 656e 6774 6820 2f20 322c 2020 7371 7561 ength / 2, squa │ │ │ +000e5810: 7265 4c65 6e67 7468 202f 2032 2c20 305d reLength / 2, 0] │ │ │ +000e5820: 0a20 203c 2f6c 693e 0a20 203c 6c69 3e0a .
    • .
    • . │ │ │ +000e5830: 2070 6f69 6e74 2031 3a20 5b20 7371 7561 point 1: [ squa │ │ │ +000e5840: 7265 4c65 6e67 7468 202f 2032 2c20 2073 reLength / 2, s │ │ │ +000e5850: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ +000e5860: 2030 5d0a 2020 3c2f 6c69 3e0a 2020 3c6c 0].
    • . . point 2: [ s │ │ │ +000e5880: 7175 6172 654c 656e 6774 6820 2f20 322c quareLength / 2, │ │ │ +000e5890: 202d 7371 7561 7265 4c65 6e67 7468 202f -squareLength / │ │ │ +000e58a0: 2032 2c20 305d 0a20 203c 2f6c 693e 0a20 2, 0]. . │ │ │ +000e58b0: 203c 6c69 3e0a 2070 6f69 6e74 2033 3a20
    • . point 3: │ │ │ +000e58c0: 5b2d 7371 7561 7265 4c65 6e67 7468 202f [-squareLength / │ │ │ +000e58d0: 2032 2c20 2d73 7175 6172 654c 656e 6774 2, -squareLengt │ │ │ +000e58e0: 6820 2f20 322c 2030 5d0a 2020 3c2f 6c69 h / 2, 0].
    • .
    • . for al │ │ │ +000e5900: 6c20 7468 6520 6f74 6865 7220 666c 6167 l the other flag │ │ │ +000e5910: 732c 206e 756d 6265 7220 6f66 2069 6e70 s, number of inp │ │ │ +000e5920: 7574 2070 6f69 6e74 7320 6d75 7374 2062 ut points must b │ │ │ +000e5930: 6520 2667 743b 3d20 3420 616e 6420 6f62 e >= 4 and ob │ │ │ +000e5940: 6a65 6374 2070 6f69 6e74 7320 6361 6e20 ject points can │ │ │ +000e5950: 6265 2069 6e20 616e 7920 636f 6e66 6967 be in any config │ │ │ +000e5960: 7572 6174 696f 6e2e 0a20 203c 2f6c 693e uration..
    • │ │ │ +000e5970: 0a3c 2f75 6c3e 0a54 6865 2066 756e 6374 .
    .The funct │ │ │ +000e5980: 696f 6e20 696e 7465 726e 616c 6c79 2075 ion internally u │ │ │ +000e5990: 6e64 6973 746f 7274 7320 706f 696e 7473 ndistorts points │ │ │ +000e59a0: 2077 6974 6820 5245 463a 2075 6e64 6973 with REF: undis │ │ │ +000e59b0: 746f 7274 506f 696e 7473 2061 6e64 2063 tortPoints and c │ │ │ +000e59c0: 616c 6c20 5245 463a 2063 763a 3a73 6f6c all REF: cv::sol │ │ │ +000e59d0: 7665 506e 502c 0a74 6875 7320 7468 6520 vePnP,.thus the │ │ │ +000e59e0: 696e 7075 7420 6172 6520 7665 7279 2073 input are very s │ │ │ +000e59f0: 696d 696c 6172 2e20 4368 6563 6b20 7468 imilar. Check th │ │ │ +000e5a00: 6572 6520 616e 6420 5065 7273 7065 6374 ere and Perspect │ │ │ +000e5a10: 6976 652d 6e2d 506f 696e 7473 2069 7320 ive-n-Points is │ │ │ +000e5a20: 6465 7363 7269 6265 6420 696e 2052 4546 described in REF │ │ │ +000e5a30: 3a20 6361 6c69 6233 645f 736f 6c76 6550 : calib3d_solveP │ │ │ +000e5a40: 6e50 0a66 6f72 206d 6f72 6520 696e 666f nP.for more info │ │ │ +000e5a50: 726d 6174 696f 6e2e 3c2f 6464 3e0a 3c64 rmation.
    .Returns:. │ │ │ +000e5a70: 3c64 643e 6175 746f 6d61 7469 6361 6c6c
    automaticall │ │ │ +000e5a80: 7920 6765 6e65 7261 7465 643c 2f64 643e y generated
    │ │ │ +000e5a90: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    .
    ..
  • .< │ │ │ +000e5ab0: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    . │ │ │ +000e5bb0: 3c68 333e 6669 7368 6579 655f 736f 6c76

    fisheye_solv │ │ │ +000e5bc0: 6550 6e50 5261 6e73 6163 3c2f 6833 3e0a ePnPRansac

    . │ │ │ +000e5bd0: 3c64 6976 2063 6c61 7373 3d22 686f 7269
    . │ │ │ +000e5bf0: 3c64 6976 2063 6c61 7373 3d22 6d65 6d62
    public sta │ │ │ +000e5c30: 7469 633c 2f73 7061 6e3e 266e 6273 703b tic  │ │ │ +000e5c40: 3c73 7061 6e20 636c 6173 733d 2272 6574 boolea │ │ │ +000e5c60: 6e3c 2f73 7061 6e3e 266e 6273 703b 3c73 n fisheye │ │ │ +000e5c90: 5f73 6f6c 7665 506e 5052 616e 7361 633c _solvePnPRansac< │ │ │ +000e5ca0: 2f73 7061 6e3e 3c77 6272 3e3c 7370 616e /span>(Mat ob │ │ │ +000e5d10: 6a65 6374 506f 696e 7473 2c0a 203c 6120 jectPoints,. Mat │ │ │ +000e5d60: 266e 6273 703b 696d 6167 6550 6f69 6e74  imagePoint │ │ │ +000e5d70: 732c 0a20 3c61 2068 7265 663d 222e 2e2f s,. │ │ │ +000e5db0: 4d61 743c 2f61 3e26 6e62 7370 3b63 616d Mat cam │ │ │ +000e5dc0: 6572 614d 6174 7269 782c 0a20 3c61 2068 eraMatrix,. Mat& │ │ │ +000e5e10: 6e62 7370 3b64 6973 7443 6f65 6666 732c nbsp;distCoeffs, │ │ │ +000e5e20: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000e5e60: 743c 2f61 3e26 6e62 7370 3b72 7665 632c t rvec, │ │ │ +000e5e70: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000e5eb0: 743c 2f61 3e26 6e62 7370 3b74 7665 632c t tvec, │ │ │ +000e5ec0: 0a20 626f 6f6c 6561 6e26 6e62 7370 3b75 . boolean u │ │ │ +000e5ed0: 7365 4578 7472 696e 7369 6347 7565 7373 seExtrinsicGuess │ │ │ +000e5ee0: 2c0a 2069 6e74 266e 6273 703b 6974 6572 ,. int iter │ │ │ +000e5ef0: 6174 696f 6e73 436f 756e 742c 0a20 666c ationsCount,. fl │ │ │ +000e5f00: 6f61 7426 6e62 7370 3b72 6570 726f 6a65 oat reproje │ │ │ +000e5f10: 6374 696f 6e45 7272 6f72 2c0a 2064 6f75 ctionError,. dou │ │ │ +000e5f20: 626c 6526 6e62 7370 3b63 6f6e 6669 6465 ble confide │ │ │ +000e5f30: 6e63 652c 0a20 3c61 2068 7265 663d 222e nce,. Mat i │ │ │ +000e5f80: 6e6c 6965 7273 2c0a 2069 6e74 266e 6273 nliers,. int&nbs │ │ │ +000e5f90: 703b 666c 6167 732c 0a20 3c61 2068 7265 p;flags,. T │ │ │ +000e5fe0: 6572 6d43 7269 7465 7269 613c 2f61 3e26 ermCriteria& │ │ │ +000e5ff0: 6e62 7370 3b63 7269 7465 7269 6129 3c2f nbsp;criteria)
    .
    F │ │ │ +000e6020: 696e 6473 2061 6e20 6f62 6a65 6374 2070 inds an object p │ │ │ +000e6030: 6f73 6520 6672 6f6d 2033 442d 3244 2070 ose from 3D-2D p │ │ │ +000e6040: 6f69 6e74 2063 6f72 7265 7370 6f6e 6465 oint corresponde │ │ │ +000e6050: 6e63 6573 2075 7369 6e67 2074 6865 2052 nces using the R │ │ │ +000e6060: 414e 5341 4320 7363 6865 6d65 2066 6f72 ANSAC scheme for │ │ │ +000e6070: 2066 6973 6865 7965 2063 616d 6572 6120 fisheye camera │ │ │ +000e6080: 6d6f 6f64 656c 2e3c 2f64 6976 3e0a 3c64 moodel.
    . │ │ │ +000e60a0: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +000e60b0: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000e60c0: 6f62 6a65 6374 506f 696e 7473 3c2f 636f objectPoints - Array of o │ │ │ +000e60e0: 626a 6563 7420 706f 696e 7473 2069 6e20 bject points in │ │ │ +000e60f0: 7468 6520 6f62 6a65 6374 2063 6f6f 7264 the object coord │ │ │ +000e6100: 696e 6174 6520 7370 6163 652c 204e 7833 inate space, Nx3 │ │ │ +000e6110: 2031 2d63 6861 6e6e 656c 206f 720a 3178 1-channel or.1x │ │ │ +000e6120: 4e2f 4e78 3120 332d 6368 616e 6e65 6c2c N/Nx1 3-channel, │ │ │ +000e6130: 2077 6865 7265 204e 2069 7320 7468 6520 where N is the │ │ │ +000e6140: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ +000e6150: 2e20 7665 6374 6f72 266c 743b 506f 696e . vector<Poin │ │ │ +000e6160: 7433 6426 6774 3b20 6361 6e20 6265 2061 t3d> can be a │ │ │ +000e6170: 6c73 6f20 7061 7373 6564 2068 6572 652e lso passed here. │ │ │ +000e6180: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000e6190: 696d 6167 6550 6f69 6e74 733c 2f63 6f64 imagePoints - Array of co │ │ │ +000e61b0: 7272 6573 706f 6e64 696e 6720 696d 6167 rresponding imag │ │ │ +000e61c0: 6520 706f 696e 7473 2c20 4e78 3220 312d e points, Nx2 1- │ │ │ +000e61d0: 6368 616e 6e65 6c20 6f72 2031 784e 2f4e channel or 1xN/N │ │ │ +000e61e0: 7831 2032 2d63 6861 6e6e 656c 2c0a 7768 x1 2-channel,.wh │ │ │ +000e61f0: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ +000e6200: 6265 7220 6f66 2070 6f69 6e74 732e 2076 ber of points. v │ │ │ +000e6210: 6563 746f 7226 6c74 3b50 6f69 6e74 3264 ector<Point2d │ │ │ +000e6220: 2667 743b 2063 616e 2062 6520 616c 736f > can be also │ │ │ +000e6230: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    cam │ │ │ +000e6250: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ +000e6260: 202d 2049 6e70 7574 2063 616d 6572 6120 - Input camera │ │ │ +000e6270: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ +000e6280: 205c 285c 6361 6d65 7261 6d61 7472 6978 \(\cameramatrix │ │ │ +000e6290: 7b41 7d5c 2920 2e3c 2f64 643e 0a3c 6464 {A}\) .
    .
    distCoeff │ │ │ +000e62b0: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ +000e62c0: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ +000e62d0: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ +000e62e0: 7473 2028 3478 312f 3178 3429 2e3c 2f64 ts (4x1/1x4)..
    rve │ │ │ +000e6300: 633c 2f63 6f64 653e 202d 204f 7574 7075 c - Outpu │ │ │ +000e6310: 7420 726f 7461 7469 6f6e 2076 6563 746f t rotation vecto │ │ │ +000e6320: 7220 2873 6565 2052 4546 3a20 526f 6472 r (see REF: Rodr │ │ │ +000e6330: 6967 7565 7320 2920 7468 6174 2c20 746f igues ) that, to │ │ │ +000e6340: 6765 7468 6572 2077 6974 6820 7476 6563 gether with tvec │ │ │ +000e6350: 2c20 6272 696e 6773 2070 6f69 6e74 7320 , brings points │ │ │ +000e6360: 6672 6f6d 0a74 6865 206d 6f64 656c 2063 from.the model c │ │ │ +000e6370: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ +000e6380: 2074 6f20 7468 6520 6361 6d65 7261 2063 to the camera c │ │ │ +000e6390: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ +000e63a0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    tvec - O │ │ │ +000e63c0: 7574 7075 7420 7472 616e 736c 6174 696f utput translatio │ │ │ +000e63d0: 6e20 7665 6374 6f72 2e3c 2f64 643e 0a3c n vector.
    .< │ │ │ +000e63e0: 6464 3e3c 636f 6465 3e75 7365 4578 7472 dd>useExtr │ │ │ +000e63f0: 696e 7369 6347 7565 7373 3c2f 636f 6465 insicGuess - Parameter us │ │ │ +000e6410: 6564 2066 6f72 2023 534f 4c56 4550 4e50 ed for #SOLVEPNP │ │ │ +000e6420: 5f49 5445 5241 5449 5645 2e20 4966 2074 _ITERATIVE. If t │ │ │ +000e6430: 7275 6520 2831 292c 2074 6865 2066 756e rue (1), the fun │ │ │ +000e6440: 6374 696f 6e20 7573 6573 0a74 6865 2070 ction uses.the p │ │ │ +000e6450: 726f 7669 6465 6420 7276 6563 2061 6e64 rovided rvec and │ │ │ +000e6460: 2074 7665 6320 7661 6c75 6573 2061 7320 tvec values as │ │ │ +000e6470: 696e 6974 6961 6c20 6170 7072 6f78 696d initial approxim │ │ │ +000e6480: 6174 696f 6e73 206f 6620 7468 6520 726f ations of the ro │ │ │ +000e6490: 7461 7469 6f6e 2061 6e64 2074 7261 6e73 tation and trans │ │ │ +000e64a0: 6c61 7469 6f6e 0a76 6563 746f 7273 2c20 lation.vectors, │ │ │ +000e64b0: 7265 7370 6563 7469 7665 6c79 2c20 616e respectively, an │ │ │ +000e64c0: 6420 6675 7274 6865 7220 6f70 7469 6d69 d further optimi │ │ │ +000e64d0: 7a65 7320 7468 656d 2e3c 2f64 643e 0a3c zes them..< │ │ │ +000e64e0: 6464 3e3c 636f 6465 3e69 7465 7261 7469 dd>iterati │ │ │ +000e64f0: 6f6e 7343 6f75 6e74 3c2f 636f 6465 3e20 onsCount │ │ │ +000e6500: 2d20 4e75 6d62 6572 206f 6620 6974 6572 - Number of iter │ │ │ +000e6510: 6174 696f 6e73 2e3c 2f64 643e 0a3c 6464 ations..
    reproject │ │ │ +000e6530: 696f 6e45 7272 6f72 3c2f 636f 6465 3e20 ionError │ │ │ +000e6540: 2d20 496e 6c69 6572 2074 6872 6573 686f - Inlier thresho │ │ │ +000e6550: 6c64 2076 616c 7565 2075 7365 6420 6279 ld value used by │ │ │ +000e6560: 2074 6865 2052 414e 5341 4320 7072 6f63 the RANSAC proc │ │ │ +000e6570: 6564 7572 652e 2054 6865 2070 6172 616d edure. The param │ │ │ +000e6580: 6574 6572 2076 616c 7565 0a69 7320 7468 eter value.is th │ │ │ +000e6590: 6520 6d61 7869 6d75 6d20 616c 6c6f 7765 e maximum allowe │ │ │ +000e65a0: 6420 6469 7374 616e 6365 2062 6574 7765 d distance betwe │ │ │ +000e65b0: 656e 2074 6865 206f 6273 6572 7665 6420 en the observed │ │ │ +000e65c0: 616e 6420 636f 6d70 7574 6564 2070 6f69 and computed poi │ │ │ +000e65d0: 6e74 2070 726f 6a65 6374 696f 6e73 2074 nt projections t │ │ │ +000e65e0: 6f20 636f 6e73 6964 6572 2069 740a 616e o consider it.an │ │ │ +000e65f0: 2069 6e6c 6965 722e 3c2f 6464 3e0a 3c64 inlier.
    .confiden │ │ │ +000e6610: 6365 3c2f 636f 6465 3e20 2d20 5468 6520 ce - The │ │ │ +000e6620: 7072 6f62 6162 696c 6974 7920 7468 6174 probability that │ │ │ +000e6630: 2074 6865 2061 6c67 6f72 6974 686d 2070 the algorithm p │ │ │ +000e6640: 726f 6475 6365 7320 6120 7573 6566 756c roduces a useful │ │ │ +000e6650: 2072 6573 756c 742e 3c2f 6464 3e0a 3c64 result..inliers< │ │ │ +000e6670: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ +000e6680: 7665 6374 6f72 2074 6861 7420 636f 6e74 vector that cont │ │ │ +000e6690: 6169 6e73 2069 6e64 6963 6573 206f 6620 ains indices of │ │ │ +000e66a0: 696e 6c69 6572 7320 696e 206f 626a 6563 inliers in objec │ │ │ +000e66b0: 7450 6f69 6e74 7320 616e 6420 696d 6167 tPoints and imag │ │ │ +000e66c0: 6550 6f69 6e74 7320 2e3c 2f64 643e 0a3c ePoints ..< │ │ │ +000e66d0: 6464 3e3c 636f 6465 3e66 6c61 6773 3c2f dd>flags - Method f │ │ │ +000e66f0: 6f72 2073 6f6c 7669 6e67 2061 2050 6e50 or solving a PnP │ │ │ +000e6700: 2070 726f 626c 656d 3a20 7365 6520 5245 problem: see RE │ │ │ +000e6710: 463a 2063 616c 6962 3364 5f73 6f6c 7665 F: calib3d_solve │ │ │ +000e6720: 506e 505f 666c 6167 733c 2f64 643e 0a3c PnP_flags.< │ │ │ +000e6730: 6464 3e3c 636f 6465 3e63 7269 7465 7269 dd>criteri │ │ │ +000e6740: 613c 2f63 6f64 653e 202d 2054 6572 6d69 a - Termi │ │ │ +000e6750: 6e61 7469 6f6e 2063 7269 7465 7269 6120 nation criteria │ │ │ +000e6760: 666f 7220 696e 7465 726e 616c 2075 6e64 for internal und │ │ │ +000e6770: 6973 746f 7274 506f 696e 7473 2063 616c istortPoints cal │ │ │ +000e6780: 6c2e 0a54 6865 2066 756e 6374 696f 6e20 l..The function │ │ │ +000e6790: 696e 7465 7261 6c6c 7920 756e 6469 7374 interally undist │ │ │ +000e67a0: 6f72 7473 2070 6f69 6e74 7320 7769 7468 orts points with │ │ │ +000e67b0: 2052 4546 3a20 756e 6469 7374 6f72 7450 REF: undistortP │ │ │ +000e67c0: 6f69 6e74 7320 616e 6420 6361 6c6c 2052 oints and call R │ │ │ +000e67d0: 4546 3a20 6376 3a3a 736f 6c76 6550 6e50 EF: cv::solvePnP │ │ │ +000e67e0: 2c0a 7468 7573 2074 6865 2069 6e70 7574 ,.thus the input │ │ │ +000e67f0: 2061 7265 2076 6572 7920 7369 6d69 6c61 are very simila │ │ │ +000e6800: 722e 204d 6f72 6520 696e 666f 726d 6174 r. More informat │ │ │ +000e6810: 696f 6e20 6162 6f75 7420 5065 7273 7065 ion about Perspe │ │ │ +000e6820: 6374 6976 652d 6e2d 506f 696e 7473 2069 ctive-n-Points i │ │ │ +000e6830: 7320 6465 7363 7269 6265 6420 696e 2052 s described in R │ │ │ +000e6840: 4546 3a20 6361 6c69 6233 645f 736f 6c76 EF: calib3d_solv │ │ │ +000e6850: 6550 6e50 0a66 6f72 206d 6f72 6520 696e ePnP.for more in │ │ │ +000e6860: 666f 726d 6174 696f 6e2e 3c2f 6464 3e0a formation.. │ │ │ +000e6870: 3c64 743e 5265 7475 726e 733a 3c2f 6474
    Returns:
    .
    automatica │ │ │ +000e6890: 6c6c 7920 6765 6e65 7261 7465 643c 2f64 lly generated..
    . │ │ │ +000e68b0: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e
    . │ │ │ +000e68c0: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    fisheye │ │ │ +000e69b0: 5f73 6f6c 7665 506e 5052 616e 7361 633c _solvePnPRansac< │ │ │ +000e69c0: 2f68 333e 0a3c 6469 7620 636c 6173 733d /h3>.
    .
    publi │ │ │ +000e6a20: 6320 7374 6174 6963 3c2f 7370 616e 3e26 c static& │ │ │ +000e6a30: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp;b │ │ │ +000e6a50: 6f6f 6c65 616e 3c2f 7370 616e 3e26 6e62 oolean&nb │ │ │ +000e6a60: 7370 3b3c 7370 616e 2063 6c61 7373 3d22 sp;fi │ │ │ +000e6a80: 7368 6579 655f 736f 6c76 6550 6e50 5261 sheye_solvePnPRa │ │ │ +000e6a90: 6e73 6163 3c2f 7370 616e 3e3c 7762 723e nsac │ │ │ +000e6aa0: 3c73 7061 6e20 636c 6173 733d 2270 6172 (Mat&nb │ │ │ +000e6b00: 7370 3b6f 626a 6563 7450 6f69 6e74 732c sp;objectPoints, │ │ │ +000e6b10: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000e6b50: 743c 2f61 3e26 6e62 7370 3b69 6d61 6765 t image │ │ │ +000e6b60: 506f 696e 7473 2c0a 203c 6120 6872 6566 Points,. Mat&nbs │ │ │ +000e6bb0: 703b 6361 6d65 7261 4d61 7472 6978 2c0a p;cameraMatrix,. │ │ │ +000e6bc0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000e6c00: 3c2f 613e 266e 6273 703b 6469 7374 436f  distCo │ │ │ +000e6c10: 6566 6673 2c0a 203c 6120 6872 6566 3d22 effs,. Mat  │ │ │ +000e6c60: 7276 6563 2c0a 203c 6120 6872 6566 3d22 rvec,. Mat  │ │ │ +000e6cb0: 7476 6563 2c0a 2062 6f6f 6c65 616e 266e tvec,. boolean&n │ │ │ +000e6cc0: 6273 703b 7573 6545 7874 7269 6e73 6963 bsp;useExtrinsic │ │ │ +000e6cd0: 4775 6573 732c 0a20 696e 7426 6e62 7370 Guess,. int  │ │ │ +000e6ce0: 3b69 7465 7261 7469 6f6e 7343 6f75 6e74 ;iterationsCount │ │ │ +000e6cf0: 2c0a 2066 6c6f 6174 266e 6273 703b 7265 ,. float re │ │ │ +000e6d00: 7072 6f6a 6563 7469 6f6e 4572 726f 722c projectionError, │ │ │ +000e6d10: 0a20 646f 7562 6c65 266e 6273 703b 636f . double co │ │ │ +000e6d20: 6e66 6964 656e 6365 2c0a 203c 6120 6872 nfidence,. Mat&n │ │ │ +000e6d70: 6273 703b 696e 6c69 6572 732c 0a20 696e bsp;inliers,. in │ │ │ +000e6d80: 7426 6e62 7370 3b66 6c61 6773 293c 2f73 t flags)
    .
    Fi │ │ │ +000e6db0: 6e64 7320 616e 206f 626a 6563 7420 706f nds an object po │ │ │ +000e6dc0: 7365 2066 726f 6d20 3344 2d32 4420 706f se from 3D-2D po │ │ │ +000e6dd0: 696e 7420 636f 7272 6573 706f 6e64 656e int corresponden │ │ │ +000e6de0: 6365 7320 7573 696e 6720 7468 6520 5241 ces using the RA │ │ │ +000e6df0: 4e53 4143 2073 6368 656d 6520 666f 7220 NSAC scheme for │ │ │ +000e6e00: 6669 7368 6579 6520 6361 6d65 7261 206d fisheye camera m │ │ │ +000e6e10: 6f6f 6465 6c2e 3c2f 6469 763e 0a3c 646c oodel.
    .
    . │ │ │ +000e6e30: 3c64 743e 5061 7261 6d65 7465 7273 3a3c
    Parameters:< │ │ │ +000e6e40: 2f64 743e 0a3c 6464 3e3c 636f 6465 3e6f /dt>.
    o │ │ │ +000e6e50: 626a 6563 7450 6f69 6e74 733c 2f63 6f64 bjectPoints - Array of ob │ │ │ +000e6e70: 6a65 6374 2070 6f69 6e74 7320 696e 2074 ject points in t │ │ │ +000e6e80: 6865 206f 626a 6563 7420 636f 6f72 6469 he object coordi │ │ │ +000e6e90: 6e61 7465 2073 7061 6365 2c20 4e78 3320 nate space, Nx3 │ │ │ +000e6ea0: 312d 6368 616e 6e65 6c20 6f72 0a31 784e 1-channel or.1xN │ │ │ +000e6eb0: 2f4e 7831 2033 2d63 6861 6e6e 656c 2c20 /Nx1 3-channel, │ │ │ +000e6ec0: 7768 6572 6520 4e20 6973 2074 6865 206e where N is the n │ │ │ +000e6ed0: 756d 6265 7220 6f66 2070 6f69 6e74 732e umber of points. │ │ │ +000e6ee0: 2076 6563 746f 7226 6c74 3b50 6f69 6e74 vector<Point │ │ │ +000e6ef0: 3364 2667 743b 2063 616e 2062 6520 616c 3d> can be al │ │ │ +000e6f00: 736f 2070 6173 7365 6420 6865 7265 2e3c so passed here.< │ │ │ +000e6f10: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e69 /dd>.
    i │ │ │ +000e6f20: 6d61 6765 506f 696e 7473 3c2f 636f 6465 magePoints - Array of cor │ │ │ +000e6f40: 7265 7370 6f6e 6469 6e67 2069 6d61 6765 responding image │ │ │ +000e6f50: 2070 6f69 6e74 732c 204e 7832 2031 2d63 points, Nx2 1-c │ │ │ +000e6f60: 6861 6e6e 656c 206f 7220 3178 4e2f 4e78 hannel or 1xN/Nx │ │ │ +000e6f70: 3120 322d 6368 616e 6e65 6c2c 0a77 6865 1 2-channel,.whe │ │ │ +000e6f80: 7265 204e 2069 7320 7468 6520 6e75 6d62 re N is the numb │ │ │ +000e6f90: 6572 206f 6620 706f 696e 7473 2e20 7665 er of points. ve │ │ │ +000e6fa0: 6374 6f72 266c 743b 506f 696e 7432 6426 ctor<Point2d& │ │ │ +000e6fb0: 6774 3b20 6361 6e20 6265 2061 6c73 6f20 gt; can be also │ │ │ +000e6fc0: 7061 7373 6564 2068 6572 652e 3c2f 6464 passed here.
    .
    came │ │ │ +000e6fe0: 7261 4d61 7472 6978 3c2f 636f 6465 3e20 raMatrix │ │ │ +000e6ff0: 2d20 496e 7075 7420 6361 6d65 7261 2069 - Input camera i │ │ │ +000e7000: 6e74 7269 6e73 6963 206d 6174 7269 7820 ntrinsic matrix │ │ │ +000e7010: 5c28 5c63 616d 6572 616d 6174 7269 787b \(\cameramatrix{ │ │ │ +000e7020: 417d 5c29 202e 3c2f 6464 3e0a 3c64 643e A}\) .
    .
    │ │ │ +000e7030: 3c63 6f64 653e 6469 7374 436f 6566 6673 distCoeffs │ │ │ +000e7040: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ +000e7050: 7665 6374 6f72 206f 6620 6469 7374 6f72 vector of distor │ │ │ +000e7060: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ +000e7070: 7320 2834 7831 2f31 7834 292e 3c2f 6464 s (4x1/1x4).
    .
    rvec │ │ │ +000e7090: 3c2f 636f 6465 3e20 2d20 4f75 7470 7574 - Output │ │ │ +000e70a0: 2072 6f74 6174 696f 6e20 7665 6374 6f72 rotation vector │ │ │ +000e70b0: 2028 7365 6520 5245 463a 2052 6f64 7269 (see REF: Rodri │ │ │ +000e70c0: 6775 6573 2029 2074 6861 742c 2074 6f67 gues ) that, tog │ │ │ +000e70d0: 6574 6865 7220 7769 7468 2074 7665 632c ether with tvec, │ │ │ +000e70e0: 2062 7269 6e67 7320 706f 696e 7473 2066 brings points f │ │ │ +000e70f0: 726f 6d0a 7468 6520 6d6f 6465 6c20 636f rom.the model co │ │ │ +000e7100: 6f72 6469 6e61 7465 2073 7973 7465 6d20 ordinate system │ │ │ +000e7110: 746f 2074 6865 2063 616d 6572 6120 636f to the camera co │ │ │ +000e7120: 6f72 6469 6e61 7465 2073 7973 7465 6d2e ordinate system. │ │ │ +000e7130: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000e7140: 7476 6563 3c2f 636f 6465 3e20 2d20 4f75 tvec - Ou │ │ │ +000e7150: 7470 7574 2074 7261 6e73 6c61 7469 6f6e tput translation │ │ │ +000e7160: 2076 6563 746f 722e 3c2f 6464 3e0a 3c64 vector.
    .useExtri │ │ │ +000e7180: 6e73 6963 4775 6573 733c 2f63 6f64 653e nsicGuess │ │ │ +000e7190: 202d 2050 6172 616d 6574 6572 2075 7365 - Parameter use │ │ │ +000e71a0: 6420 666f 7220 2353 4f4c 5645 504e 505f d for #SOLVEPNP_ │ │ │ +000e71b0: 4954 4552 4154 4956 452e 2049 6620 7472 ITERATIVE. If tr │ │ │ +000e71c0: 7565 2028 3129 2c20 7468 6520 6675 6e63 ue (1), the func │ │ │ +000e71d0: 7469 6f6e 2075 7365 730a 7468 6520 7072 tion uses.the pr │ │ │ +000e71e0: 6f76 6964 6564 2072 7665 6320 616e 6420 ovided rvec and │ │ │ +000e71f0: 7476 6563 2076 616c 7565 7320 6173 2069 tvec values as i │ │ │ +000e7200: 6e69 7469 616c 2061 7070 726f 7869 6d61 nitial approxima │ │ │ +000e7210: 7469 6f6e 7320 6f66 2074 6865 2072 6f74 tions of the rot │ │ │ +000e7220: 6174 696f 6e20 616e 6420 7472 616e 736c ation and transl │ │ │ +000e7230: 6174 696f 6e0a 7665 6374 6f72 732c 2072 ation.vectors, r │ │ │ +000e7240: 6573 7065 6374 6976 656c 792c 2061 6e64 espectively, and │ │ │ +000e7250: 2066 7572 7468 6572 206f 7074 696d 697a further optimiz │ │ │ +000e7260: 6573 2074 6865 6d2e 3c2f 6464 3e0a 3c64 es them..iteratio │ │ │ +000e7280: 6e73 436f 756e 743c 2f63 6f64 653e 202d nsCount - │ │ │ +000e7290: 204e 756d 6265 7220 6f66 2069 7465 7261 Number of itera │ │ │ +000e72a0: 7469 6f6e 732e 3c2f 6464 3e0a 3c64 643e tions..
    │ │ │ +000e72b0: 3c63 6f64 653e 7265 7072 6f6a 6563 7469 reprojecti │ │ │ +000e72c0: 6f6e 4572 726f 723c 2f63 6f64 653e 202d onError - │ │ │ +000e72d0: 2049 6e6c 6965 7220 7468 7265 7368 6f6c Inlier threshol │ │ │ +000e72e0: 6420 7661 6c75 6520 7573 6564 2062 7920 d value used by │ │ │ +000e72f0: 7468 6520 5241 4e53 4143 2070 726f 6365 the RANSAC proce │ │ │ +000e7300: 6475 7265 2e20 5468 6520 7061 7261 6d65 dure. The parame │ │ │ +000e7310: 7465 7220 7661 6c75 650a 6973 2074 6865 ter value.is the │ │ │ +000e7320: 206d 6178 696d 756d 2061 6c6c 6f77 6564 maximum allowed │ │ │ +000e7330: 2064 6973 7461 6e63 6520 6265 7477 6565 distance betwee │ │ │ +000e7340: 6e20 7468 6520 6f62 7365 7276 6564 2061 n the observed a │ │ │ +000e7350: 6e64 2063 6f6d 7075 7465 6420 706f 696e nd computed poin │ │ │ +000e7360: 7420 7072 6f6a 6563 7469 6f6e 7320 746f t projections to │ │ │ +000e7370: 2063 6f6e 7369 6465 7220 6974 0a61 6e20 consider it.an │ │ │ +000e7380: 696e 6c69 6572 2e3c 2f64 643e 0a3c 6464 inlier.
    .
    confidenc │ │ │ +000e73a0: 653c 2f63 6f64 653e 202d 2054 6865 2070 e - The p │ │ │ +000e73b0: 726f 6261 6269 6c69 7479 2074 6861 7420 robability that │ │ │ +000e73c0: 7468 6520 616c 676f 7269 7468 6d20 7072 the algorithm pr │ │ │ +000e73d0: 6f64 7563 6573 2061 2075 7365 6675 6c20 oduces a useful │ │ │ +000e73e0: 7265 7375 6c74 2e3c 2f64 643e 0a3c 6464 result.
    .
    inliers - Output v │ │ │ +000e7410: 6563 746f 7220 7468 6174 2063 6f6e 7461 ector that conta │ │ │ +000e7420: 696e 7320 696e 6469 6365 7320 6f66 2069 ins indices of i │ │ │ +000e7430: 6e6c 6965 7273 2069 6e20 6f62 6a65 6374 nliers in object │ │ │ +000e7440: 506f 696e 7473 2061 6e64 2069 6d61 6765 Points and image │ │ │ +000e7450: 506f 696e 7473 202e 3c2f 6464 3e0a 3c64 Points .
    .flags - Method fo │ │ │ +000e7480: 7220 736f 6c76 696e 6720 6120 506e 5020 r solving a PnP │ │ │ +000e7490: 7072 6f62 6c65 6d3a 2073 6565 2052 4546 problem: see REF │ │ │ +000e74a0: 3a20 6361 6c69 6233 645f 736f 6c76 6550 : calib3d_solveP │ │ │ +000e74b0: 6e50 5f66 6c61 6773 0a54 6865 2066 756e nP_flags.The fun │ │ │ +000e74c0: 6374 696f 6e20 696e 7465 7261 6c6c 7920 ction interally │ │ │ +000e74d0: 756e 6469 7374 6f72 7473 2070 6f69 6e74 undistorts point │ │ │ +000e74e0: 7320 7769 7468 2052 4546 3a20 756e 6469 s with REF: undi │ │ │ +000e74f0: 7374 6f72 7450 6f69 6e74 7320 616e 6420 stortPoints and │ │ │ +000e7500: 6361 6c6c 2052 4546 3a20 6376 3a3a 736f call REF: cv::so │ │ │ +000e7510: 6c76 6550 6e50 2c0a 7468 7573 2074 6865 lvePnP,.thus the │ │ │ +000e7520: 2069 6e70 7574 2061 7265 2076 6572 7920 input are very │ │ │ +000e7530: 7369 6d69 6c61 722e 204d 6f72 6520 696e similar. More in │ │ │ +000e7540: 666f 726d 6174 696f 6e20 6162 6f75 7420 formation about │ │ │ +000e7550: 5065 7273 7065 6374 6976 652d 6e2d 506f Perspective-n-Po │ │ │ +000e7560: 696e 7473 2069 7320 6465 7363 7269 6265 ints is describe │ │ │ +000e7570: 6420 696e 2052 4546 3a20 6361 6c69 6233 d in REF: calib3 │ │ │ +000e7580: 645f 736f 6c76 6550 6e50 0a66 6f72 206d d_solvePnP.for m │ │ │ +000e7590: 6f72 6520 696e 666f 726d 6174 696f 6e2e ore information. │ │ │ +000e75a0: 3c2f 6464 3e0a 3c64 743e 5265 7475 726e .
    Return │ │ │ +000e75b0: 733a 3c2f 6474 3e0a 3c64 643e 6175 746f s:
    .
    auto │ │ │ +000e75c0: 6d61 7469 6361 6c6c 7920 6765 6e65 7261 matically genera │ │ │ +000e75d0: 7465 643c 2f64 643e 0a3c 2f64 6c3e 0a3c ted
    .
    .< │ │ │ +000e75e0: 2f64 6976 3e0a 3c2f 7365 6374 696f 6e3e /div>.

    │ │ │ +000e75f0: 0a3c 2f6c 693e 0a3c 6c69 3e0a 3c73 6563 .
  • .
  • ..

    fishe │ │ │ +000e76e0: 7965 5f73 6f6c 7665 506e 5052 616e 7361 ye_solvePnPRansa │ │ │ +000e76f0: 633c 2f68 333e 0a3c 6469 7620 636c 6173 c

    .
    .
    pub │ │ │ +000e7750: 6c69 6320 7374 6174 6963 3c2f 7370 616e lic static boolean& │ │ │ +000e7790: 6e62 7370 3b3c 7370 616e 2063 6c61 7373 nbsp; │ │ │ +000e77b0: 6669 7368 6579 655f 736f 6c76 6550 6e50 fisheye_solvePnP │ │ │ +000e77c0: 5261 6e73 6163 3c2f 7370 616e 3e3c 7762 Ransac(Mat& │ │ │ +000e7830: 6e62 7370 3b6f 626a 6563 7450 6f69 6e74 nbsp;objectPoint │ │ │ +000e7840: 732c 0a20 3c61 2068 7265 663d 222e 2e2f s,. │ │ │ +000e7880: 4d61 743c 2f61 3e26 6e62 7370 3b69 6d61 Mat ima │ │ │ +000e7890: 6765 506f 696e 7473 2c0a 203c 6120 6872 gePoints,. Mat&n │ │ │ +000e78e0: 6273 703b 6361 6d65 7261 4d61 7472 6978 bsp;cameraMatrix │ │ │ +000e78f0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000e7930: 6174 3c2f 613e 266e 6273 703b 6469 7374 at dist │ │ │ +000e7940: 436f 6566 6673 2c0a 203c 6120 6872 6566 Coeffs,. Mat&nbs │ │ │ +000e7990: 703b 7276 6563 2c0a 203c 6120 6872 6566 p;rvec,. Mat&nbs │ │ │ +000e79e0: 703b 7476 6563 2c0a 2062 6f6f 6c65 616e p;tvec,. boolean │ │ │ +000e79f0: 266e 6273 703b 7573 6545 7874 7269 6e73  useExtrins │ │ │ +000e7a00: 6963 4775 6573 732c 0a20 696e 7426 6e62 icGuess,. int&nb │ │ │ +000e7a10: 7370 3b69 7465 7261 7469 6f6e 7343 6f75 sp;iterationsCou │ │ │ +000e7a20: 6e74 2c0a 2066 6c6f 6174 266e 6273 703b nt,. float  │ │ │ +000e7a30: 7265 7072 6f6a 6563 7469 6f6e 4572 726f reprojectionErro │ │ │ +000e7a40: 722c 0a20 646f 7562 6c65 266e 6273 703b r,. double  │ │ │ +000e7a50: 636f 6e66 6964 656e 6365 2c0a 203c 6120 confidence,. Mat │ │ │ +000e7aa0: 266e 6273 703b 696e 6c69 6572 7329 3c2f  inliers)
    .
    F │ │ │ +000e7ad0: 696e 6473 2061 6e20 6f62 6a65 6374 2070 inds an object p │ │ │ +000e7ae0: 6f73 6520 6672 6f6d 2033 442d 3244 2070 ose from 3D-2D p │ │ │ +000e7af0: 6f69 6e74 2063 6f72 7265 7370 6f6e 6465 oint corresponde │ │ │ +000e7b00: 6e63 6573 2075 7369 6e67 2074 6865 2052 nces using the R │ │ │ +000e7b10: 414e 5341 4320 7363 6865 6d65 2066 6f72 ANSAC scheme for │ │ │ +000e7b20: 2066 6973 6865 7965 2063 616d 6572 6120 fisheye camera │ │ │ +000e7b30: 6d6f 6f64 656c 2e3c 2f64 6976 3e0a 3c64 moodel.
    . │ │ │ +000e7b50: 0a3c 6474 3e50 6172 616d 6574 6572 733a .
    Parameters: │ │ │ +000e7b60: 3c2f 6474 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000e7b70: 6f62 6a65 6374 506f 696e 7473 3c2f 636f objectPoints - Array of o │ │ │ +000e7b90: 626a 6563 7420 706f 696e 7473 2069 6e20 bject points in │ │ │ +000e7ba0: 7468 6520 6f62 6a65 6374 2063 6f6f 7264 the object coord │ │ │ +000e7bb0: 696e 6174 6520 7370 6163 652c 204e 7833 inate space, Nx3 │ │ │ +000e7bc0: 2031 2d63 6861 6e6e 656c 206f 720a 3178 1-channel or.1x │ │ │ +000e7bd0: 4e2f 4e78 3120 332d 6368 616e 6e65 6c2c N/Nx1 3-channel, │ │ │ +000e7be0: 2077 6865 7265 204e 2069 7320 7468 6520 where N is the │ │ │ +000e7bf0: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ +000e7c00: 2e20 7665 6374 6f72 266c 743b 506f 696e . vector<Poin │ │ │ +000e7c10: 7433 6426 6774 3b20 6361 6e20 6265 2061 t3d> can be a │ │ │ +000e7c20: 6c73 6f20 7061 7373 6564 2068 6572 652e lso passed here. │ │ │ +000e7c30: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000e7c40: 696d 6167 6550 6f69 6e74 733c 2f63 6f64 imagePoints - Array of co │ │ │ +000e7c60: 7272 6573 706f 6e64 696e 6720 696d 6167 rresponding imag │ │ │ +000e7c70: 6520 706f 696e 7473 2c20 4e78 3220 312d e points, Nx2 1- │ │ │ +000e7c80: 6368 616e 6e65 6c20 6f72 2031 784e 2f4e channel or 1xN/N │ │ │ +000e7c90: 7831 2032 2d63 6861 6e6e 656c 2c0a 7768 x1 2-channel,.wh │ │ │ +000e7ca0: 6572 6520 4e20 6973 2074 6865 206e 756d ere N is the num │ │ │ +000e7cb0: 6265 7220 6f66 2070 6f69 6e74 732e 2076 ber of points. v │ │ │ +000e7cc0: 6563 746f 7226 6c74 3b50 6f69 6e74 3264 ector<Point2d │ │ │ +000e7cd0: 2667 743b 2063 616e 2062 6520 616c 736f > can be also │ │ │ +000e7ce0: 2070 6173 7365 6420 6865 7265 2e3c 2f64 passed here..
    cam │ │ │ +000e7d00: 6572 614d 6174 7269 783c 2f63 6f64 653e eraMatrix │ │ │ +000e7d10: 202d 2049 6e70 7574 2063 616d 6572 6120 - Input camera │ │ │ +000e7d20: 696e 7472 696e 7369 6320 6d61 7472 6978 intrinsic matrix │ │ │ +000e7d30: 205c 285c 6361 6d65 7261 6d61 7472 6978 \(\cameramatrix │ │ │ +000e7d40: 7b41 7d5c 2920 2e3c 2f64 643e 0a3c 6464 {A}\) .
    .
    distCoeff │ │ │ +000e7d60: 733c 2f63 6f64 653e 202d 2049 6e70 7574 s - Input │ │ │ +000e7d70: 2076 6563 746f 7220 6f66 2064 6973 746f vector of disto │ │ │ +000e7d80: 7274 696f 6e20 636f 6566 6669 6369 656e rtion coefficien │ │ │ +000e7d90: 7473 2028 3478 312f 3178 3429 2e3c 2f64 ts (4x1/1x4)..
    rve │ │ │ +000e7db0: 633c 2f63 6f64 653e 202d 204f 7574 7075 c - Outpu │ │ │ +000e7dc0: 7420 726f 7461 7469 6f6e 2076 6563 746f t rotation vecto │ │ │ +000e7dd0: 7220 2873 6565 2052 4546 3a20 526f 6472 r (see REF: Rodr │ │ │ +000e7de0: 6967 7565 7320 2920 7468 6174 2c20 746f igues ) that, to │ │ │ +000e7df0: 6765 7468 6572 2077 6974 6820 7476 6563 gether with tvec │ │ │ +000e7e00: 2c20 6272 696e 6773 2070 6f69 6e74 7320 , brings points │ │ │ +000e7e10: 6672 6f6d 0a74 6865 206d 6f64 656c 2063 from.the model c │ │ │ +000e7e20: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ +000e7e30: 2074 6f20 7468 6520 6361 6d65 7261 2063 to the camera c │ │ │ +000e7e40: 6f6f 7264 696e 6174 6520 7379 7374 656d oordinate system │ │ │ +000e7e50: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    tvec - O │ │ │ +000e7e70: 7574 7075 7420 7472 616e 736c 6174 696f utput translatio │ │ │ +000e7e80: 6e20 7665 6374 6f72 2e3c 2f64 643e 0a3c n vector.
    .< │ │ │ +000e7e90: 6464 3e3c 636f 6465 3e75 7365 4578 7472 dd>useExtr │ │ │ +000e7ea0: 696e 7369 6347 7565 7373 3c2f 636f 6465 insicGuess - Parameter us │ │ │ +000e7ec0: 6564 2066 6f72 2023 534f 4c56 4550 4e50 ed for #SOLVEPNP │ │ │ +000e7ed0: 5f49 5445 5241 5449 5645 2e20 4966 2074 _ITERATIVE. If t │ │ │ +000e7ee0: 7275 6520 2831 292c 2074 6865 2066 756e rue (1), the fun │ │ │ +000e7ef0: 6374 696f 6e20 7573 6573 0a74 6865 2070 ction uses.the p │ │ │ +000e7f00: 726f 7669 6465 6420 7276 6563 2061 6e64 rovided rvec and │ │ │ +000e7f10: 2074 7665 6320 7661 6c75 6573 2061 7320 tvec values as │ │ │ +000e7f20: 696e 6974 6961 6c20 6170 7072 6f78 696d initial approxim │ │ │ +000e7f30: 6174 696f 6e73 206f 6620 7468 6520 726f ations of the ro │ │ │ +000e7f40: 7461 7469 6f6e 2061 6e64 2074 7261 6e73 tation and trans │ │ │ +000e7f50: 6c61 7469 6f6e 0a76 6563 746f 7273 2c20 lation.vectors, │ │ │ +000e7f60: 7265 7370 6563 7469 7665 6c79 2c20 616e respectively, an │ │ │ +000e7f70: 6420 6675 7274 6865 7220 6f70 7469 6d69 d further optimi │ │ │ +000e7f80: 7a65 7320 7468 656d 2e3c 2f64 643e 0a3c zes them..< │ │ │ +000e7f90: 6464 3e3c 636f 6465 3e69 7465 7261 7469 dd>iterati │ │ │ +000e7fa0: 6f6e 7343 6f75 6e74 3c2f 636f 6465 3e20 onsCount │ │ │ +000e7fb0: 2d20 4e75 6d62 6572 206f 6620 6974 6572 - Number of iter │ │ │ +000e7fc0: 6174 696f 6e73 2e3c 2f64 643e 0a3c 6464 ations..
    reproject │ │ │ +000e7fe0: 696f 6e45 7272 6f72 3c2f 636f 6465 3e20 ionError │ │ │ +000e7ff0: 2d20 496e 6c69 6572 2074 6872 6573 686f - Inlier thresho │ │ │ +000e8000: 6c64 2076 616c 7565 2075 7365 6420 6279 ld value used by │ │ │ +000e8010: 2074 6865 2052 414e 5341 4320 7072 6f63 the RANSAC proc │ │ │ +000e8020: 6564 7572 652e 2054 6865 2070 6172 616d edure. The param │ │ │ +000e8030: 6574 6572 2076 616c 7565 0a69 7320 7468 eter value.is th │ │ │ +000e8040: 6520 6d61 7869 6d75 6d20 616c 6c6f 7765 e maximum allowe │ │ │ +000e8050: 6420 6469 7374 616e 6365 2062 6574 7765 d distance betwe │ │ │ +000e8060: 656e 2074 6865 206f 6273 6572 7665 6420 en the observed │ │ │ +000e8070: 616e 6420 636f 6d70 7574 6564 2070 6f69 and computed poi │ │ │ +000e8080: 6e74 2070 726f 6a65 6374 696f 6e73 2074 nt projections t │ │ │ +000e8090: 6f20 636f 6e73 6964 6572 2069 740a 616e o consider it.an │ │ │ +000e80a0: 2069 6e6c 6965 722e 3c2f 6464 3e0a 3c64 inlier.
    .confiden │ │ │ +000e80c0: 6365 3c2f 636f 6465 3e20 2d20 5468 6520 ce - The │ │ │ +000e80d0: 7072 6f62 6162 696c 6974 7920 7468 6174 probability that │ │ │ +000e80e0: 2074 6865 2061 6c67 6f72 6974 686d 2070 the algorithm p │ │ │ +000e80f0: 726f 6475 6365 7320 6120 7573 6566 756c roduces a useful │ │ │ +000e8100: 2072 6573 756c 742e 3c2f 6464 3e0a 3c64 result..inliers< │ │ │ +000e8120: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ +000e8130: 7665 6374 6f72 2074 6861 7420 636f 6e74 vector that cont │ │ │ +000e8140: 6169 6e73 2069 6e64 6963 6573 206f 6620 ains indices of │ │ │ +000e8150: 696e 6c69 6572 7320 696e 206f 626a 6563 inliers in objec │ │ │ +000e8160: 7450 6f69 6e74 7320 616e 6420 696d 6167 tPoints and imag │ │ │ +000e8170: 6550 6f69 6e74 7320 2e0a 5468 6520 6675 ePoints ..The fu │ │ │ +000e8180: 6e63 7469 6f6e 2069 6e74 6572 616c 6c79 nction interally │ │ │ +000e8190: 2075 6e64 6973 746f 7274 7320 706f 696e undistorts poin │ │ │ +000e81a0: 7473 2077 6974 6820 5245 463a 2075 6e64 ts with REF: und │ │ │ +000e81b0: 6973 746f 7274 506f 696e 7473 2061 6e64 istortPoints and │ │ │ +000e81c0: 2063 616c 6c20 5245 463a 2063 763a 3a73 call REF: cv::s │ │ │ +000e81d0: 6f6c 7665 506e 502c 0a74 6875 7320 7468 olvePnP,.thus th │ │ │ +000e81e0: 6520 696e 7075 7420 6172 6520 7665 7279 e input are very │ │ │ +000e81f0: 2073 696d 696c 6172 2e20 4d6f 7265 2069 similar. More i │ │ │ +000e8200: 6e66 6f72 6d61 7469 6f6e 2061 626f 7574 nformation about │ │ │ +000e8210: 2050 6572 7370 6563 7469 7665 2d6e 2d50 Perspective-n-P │ │ │ +000e8220: 6f69 6e74 7320 6973 2064 6573 6372 6962 oints is describ │ │ │ +000e8230: 6564 2069 6e20 5245 463a 2063 616c 6962 ed in REF: calib │ │ │ +000e8240: 3364 5f73 6f6c 7665 506e 500a 666f 7220 3d_solvePnP.for │ │ │ +000e8250: 6d6f 7265 2069 6e66 6f72 6d61 7469 6f6e more information │ │ │ +000e8260: 2e3c 2f64 643e 0a3c 6474 3e52 6574 7572 ..
    Retur │ │ │ +000e8270: 6e73 3a3c 2f64 743e 0a3c 6464 3e61 7574 ns:
    .
    aut │ │ │ +000e8280: 6f6d 6174 6963 616c 6c79 2067 656e 6572 omatically gener │ │ │ +000e8290: 6174 6564 3c2f 6464 3e0a 3c2f 646c 3e0a ated
    .. │ │ │ +000e82a0: 3c2f 6469 763e 0a3c 2f73 6563 7469 6f6e
    ..
  • .
  • ..

    fisheye_ │ │ │ +000e8390: 736f 6c76 6550 6e50 5261 6e73 6163 3c2f solvePnPRansac.
    .
    public │ │ │ +000e8400: 2073 7461 7469 633c 2f73 7061 6e3e 266e static&n │ │ │ +000e8410: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;bo │ │ │ +000e8430: 6f6c 6561 6e3c 2f73 7061 6e3e 266e 6273 olean&nbs │ │ │ +000e8440: 703b 3c73 7061 6e20 636c 6173 733d 2265 p;fis │ │ │ +000e8460: 6865 7965 5f73 6f6c 7665 506e 5052 616e heye_solvePnPRan │ │ │ +000e8470: 7361 633c 2f73 7061 6e3e 3c77 6272 3e3c sac< │ │ │ +000e8480: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ +000e8490: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ +000e84e0: 703b 6f62 6a65 6374 506f 696e 7473 2c0a p;objectPoints,. │ │ │ +000e84f0: 203c 6120 6872 6566 3d22 2e2e 2f63 6f72 Mat │ │ │ +000e8530: 3c2f 613e 266e 6273 703b 696d 6167 6550  imageP │ │ │ +000e8540: 6f69 6e74 732c 0a20 3c61 2068 7265 663d oints,. Mat  │ │ │ +000e8590: 3b63 616d 6572 614d 6174 7269 782c 0a20 ;cameraMatrix,. │ │ │ +000e85a0: 3c61 2068 7265 663d 222e 2e2f 636f 7265 Mat< │ │ │ +000e85e0: 2f61 3e26 6e62 7370 3b64 6973 7443 6f65 /a> distCoe │ │ │ +000e85f0: 6666 732c 0a20 3c61 2068 7265 663d 222e ffs,. Mat r │ │ │ +000e8640: 7665 632c 0a20 3c61 2068 7265 663d 222e vec,. Mat t │ │ │ +000e8690: 7665 632c 0a20 626f 6f6c 6561 6e26 6e62 vec,. boolean&nb │ │ │ +000e86a0: 7370 3b75 7365 4578 7472 696e 7369 6347 sp;useExtrinsicG │ │ │ +000e86b0: 7565 7373 2c0a 2069 6e74 266e 6273 703b uess,. int  │ │ │ +000e86c0: 6974 6572 6174 696f 6e73 436f 756e 742c iterationsCount, │ │ │ +000e86d0: 0a20 666c 6f61 7426 6e62 7370 3b72 6570 . float rep │ │ │ +000e86e0: 726f 6a65 6374 696f 6e45 7272 6f72 2c0a rojectionError,. │ │ │ +000e86f0: 2064 6f75 626c 6526 6e62 7370 3b63 6f6e double con │ │ │ +000e8700: 6669 6465 6e63 6529 3c2f 7370 616e 3e3c fidence)< │ │ │ +000e8710: 2f64 6976 3e0a 3c64 6976 2063 6c61 7373 /div>.
    Finds a │ │ │ +000e8730: 6e20 6f62 6a65 6374 2070 6f73 6520 6672 n object pose fr │ │ │ +000e8740: 6f6d 2033 442d 3244 2070 6f69 6e74 2063 om 3D-2D point c │ │ │ +000e8750: 6f72 7265 7370 6f6e 6465 6e63 6573 2075 orrespondences u │ │ │ +000e8760: 7369 6e67 2074 6865 2052 414e 5341 4320 sing the RANSAC │ │ │ +000e8770: 7363 6865 6d65 2066 6f72 2066 6973 6865 scheme for fishe │ │ │ +000e8780: 7965 2063 616d 6572 6120 6d6f 6f64 656c ye camera moodel │ │ │ +000e8790: 2e3c 2f64 6976 3e0a 3c64 6c20 636c 6173 .
    .
    .
    P │ │ │ +000e87b0: 6172 616d 6574 6572 733a 3c2f 6474 3e0a arameters:
    . │ │ │ +000e87c0: 3c64 643e 3c63 6f64 653e 6f62 6a65 6374
    object │ │ │ +000e87d0: 506f 696e 7473 3c2f 636f 6465 3e20 2d20 Points - │ │ │ +000e87e0: 4172 7261 7920 6f66 206f 626a 6563 7420 Array of object │ │ │ +000e87f0: 706f 696e 7473 2069 6e20 7468 6520 6f62 points in the ob │ │ │ +000e8800: 6a65 6374 2063 6f6f 7264 696e 6174 6520 ject coordinate │ │ │ +000e8810: 7370 6163 652c 204e 7833 2031 2d63 6861 space, Nx3 1-cha │ │ │ +000e8820: 6e6e 656c 206f 720a 3178 4e2f 4e78 3120 nnel or.1xN/Nx1 │ │ │ +000e8830: 332d 6368 616e 6e65 6c2c 2077 6865 7265 3-channel, where │ │ │ +000e8840: 204e 2069 7320 7468 6520 6e75 6d62 6572 N is the number │ │ │ +000e8850: 206f 6620 706f 696e 7473 2e20 7665 6374 of points. vect │ │ │ +000e8860: 6f72 266c 743b 506f 696e 7433 6426 6774 or<Point3d> │ │ │ +000e8870: 3b20 6361 6e20 6265 2061 6c73 6f20 7061 ; can be also pa │ │ │ +000e8880: 7373 6564 2068 6572 652e 3c2f 6464 3e0a ssed here.
    . │ │ │ +000e8890: 3c64 643e 3c63 6f64 653e 696d 6167 6550
    imageP │ │ │ +000e88a0: 6f69 6e74 733c 2f63 6f64 653e 202d 2041 oints - A │ │ │ +000e88b0: 7272 6179 206f 6620 636f 7272 6573 706f rray of correspo │ │ │ +000e88c0: 6e64 696e 6720 696d 6167 6520 706f 696e nding image poin │ │ │ +000e88d0: 7473 2c20 4e78 3220 312d 6368 616e 6e65 ts, Nx2 1-channe │ │ │ +000e88e0: 6c20 6f72 2031 784e 2f4e 7831 2032 2d63 l or 1xN/Nx1 2-c │ │ │ +000e88f0: 6861 6e6e 656c 2c0a 7768 6572 6520 4e20 hannel,.where N │ │ │ +000e8900: 6973 2074 6865 206e 756d 6265 7220 6f66 is the number of │ │ │ +000e8910: 2070 6f69 6e74 732e 2076 6563 746f 7226 points. vector& │ │ │ +000e8920: 6c74 3b50 6f69 6e74 3264 2667 743b 2063 lt;Point2d> c │ │ │ +000e8930: 616e 2062 6520 616c 736f 2070 6173 7365 an be also passe │ │ │ +000e8940: 6420 6865 7265 2e3c 2f64 643e 0a3c 6464 d here.
    .
    cameraMat │ │ │ +000e8960: 7269 783c 2f63 6f64 653e 202d 2049 6e70 rix - Inp │ │ │ +000e8970: 7574 2063 616d 6572 6120 696e 7472 696e ut camera intrin │ │ │ +000e8980: 7369 6320 6d61 7472 6978 205c 285c 6361 sic matrix \(\ca │ │ │ +000e8990: 6d65 7261 6d61 7472 6978 7b41 7d5c 2920 meramatrix{A}\) │ │ │ +000e89a0: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    distCoeffs - Input vecto │ │ │ +000e89d0: 7220 6f66 2064 6973 746f 7274 696f 6e20 r of distortion │ │ │ +000e89e0: 636f 6566 6669 6369 656e 7473 2028 3478 coefficients (4x │ │ │ +000e89f0: 312f 3178 3429 2e3c 2f64 643e 0a3c 6464 1/1x4).
    .
    rvec - Output rota │ │ │ +000e8a20: 7469 6f6e 2076 6563 746f 7220 2873 6565 tion vector (see │ │ │ +000e8a30: 2052 4546 3a20 526f 6472 6967 7565 7320 REF: Rodrigues │ │ │ +000e8a40: 2920 7468 6174 2c20 746f 6765 7468 6572 ) that, together │ │ │ +000e8a50: 2077 6974 6820 7476 6563 2c20 6272 696e with tvec, brin │ │ │ +000e8a60: 6773 2070 6f69 6e74 7320 6672 6f6d 0a74 gs points from.t │ │ │ +000e8a70: 6865 206d 6f64 656c 2063 6f6f 7264 696e he model coordin │ │ │ +000e8a80: 6174 6520 7379 7374 656d 2074 6f20 7468 ate system to th │ │ │ +000e8a90: 6520 6361 6d65 7261 2063 6f6f 7264 696e e camera coordin │ │ │ +000e8aa0: 6174 6520 7379 7374 656d 2e3c 2f64 643e ate system.
    │ │ │ +000e8ab0: 0a3c 6464 3e3c 636f 6465 3e74 7665 633c .
    tvec< │ │ │ +000e8ac0: 2f63 6f64 653e 202d 204f 7574 7075 7420 /code> - Output │ │ │ +000e8ad0: 7472 616e 736c 6174 696f 6e20 7665 6374 translation vect │ │ │ +000e8ae0: 6f72 2e3c 2f64 643e 0a3c 6464 3e3c 636f or.
    .
    useExtrinsicG │ │ │ +000e8b00: 7565 7373 3c2f 636f 6465 3e20 2d20 5061 uess - Pa │ │ │ +000e8b10: 7261 6d65 7465 7220 7573 6564 2066 6f72 rameter used for │ │ │ +000e8b20: 2023 534f 4c56 4550 4e50 5f49 5445 5241 #SOLVEPNP_ITERA │ │ │ +000e8b30: 5449 5645 2e20 4966 2074 7275 6520 2831 TIVE. If true (1 │ │ │ +000e8b40: 292c 2074 6865 2066 756e 6374 696f 6e20 ), the function │ │ │ +000e8b50: 7573 6573 0a74 6865 2070 726f 7669 6465 uses.the provide │ │ │ +000e8b60: 6420 7276 6563 2061 6e64 2074 7665 6320 d rvec and tvec │ │ │ +000e8b70: 7661 6c75 6573 2061 7320 696e 6974 6961 values as initia │ │ │ +000e8b80: 6c20 6170 7072 6f78 696d 6174 696f 6e73 l approximations │ │ │ +000e8b90: 206f 6620 7468 6520 726f 7461 7469 6f6e of the rotation │ │ │ +000e8ba0: 2061 6e64 2074 7261 6e73 6c61 7469 6f6e and translation │ │ │ +000e8bb0: 0a76 6563 746f 7273 2c20 7265 7370 6563 .vectors, respec │ │ │ +000e8bc0: 7469 7665 6c79 2c20 616e 6420 6675 7274 tively, and furt │ │ │ +000e8bd0: 6865 7220 6f70 7469 6d69 7a65 7320 7468 her optimizes th │ │ │ +000e8be0: 656d 2e3c 2f64 643e 0a3c 6464 3e3c 636f em.
    .
    iterationsCou │ │ │ +000e8c00: 6e74 3c2f 636f 6465 3e20 2d20 4e75 6d62 nt - Numb │ │ │ +000e8c10: 6572 206f 6620 6974 6572 6174 696f 6e73 er of iterations │ │ │ +000e8c20: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    reprojectionErr │ │ │ +000e8c40: 6f72 3c2f 636f 6465 3e20 2d20 496e 6c69 or - Inli │ │ │ +000e8c50: 6572 2074 6872 6573 686f 6c64 2076 616c er threshold val │ │ │ +000e8c60: 7565 2075 7365 6420 6279 2074 6865 2052 ue used by the R │ │ │ +000e8c70: 414e 5341 4320 7072 6f63 6564 7572 652e ANSAC procedure. │ │ │ +000e8c80: 2054 6865 2070 6172 616d 6574 6572 2076 The parameter v │ │ │ +000e8c90: 616c 7565 0a69 7320 7468 6520 6d61 7869 alue.is the maxi │ │ │ +000e8ca0: 6d75 6d20 616c 6c6f 7765 6420 6469 7374 mum allowed dist │ │ │ +000e8cb0: 616e 6365 2062 6574 7765 656e 2074 6865 ance between the │ │ │ +000e8cc0: 206f 6273 6572 7665 6420 616e 6420 636f observed and co │ │ │ +000e8cd0: 6d70 7574 6564 2070 6f69 6e74 2070 726f mputed point pro │ │ │ +000e8ce0: 6a65 6374 696f 6e73 2074 6f20 636f 6e73 jections to cons │ │ │ +000e8cf0: 6964 6572 2069 740a 616e 2069 6e6c 6965 ider it.an inlie │ │ │ +000e8d00: 722e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 r.
    .
    confidence - The probab │ │ │ +000e8d30: 696c 6974 7920 7468 6174 2074 6865 2061 ility that the a │ │ │ +000e8d40: 6c67 6f72 6974 686d 2070 726f 6475 6365 lgorithm produce │ │ │ +000e8d50: 7320 6120 7573 6566 756c 2072 6573 756c s a useful resul │ │ │ +000e8d60: 742e 0a54 6865 2066 756e 6374 696f 6e20 t..The function │ │ │ +000e8d70: 696e 7465 7261 6c6c 7920 756e 6469 7374 interally undist │ │ │ +000e8d80: 6f72 7473 2070 6f69 6e74 7320 7769 7468 orts points with │ │ │ +000e8d90: 2052 4546 3a20 756e 6469 7374 6f72 7450 REF: undistortP │ │ │ +000e8da0: 6f69 6e74 7320 616e 6420 6361 6c6c 2052 oints and call R │ │ │ +000e8db0: 4546 3a20 6376 3a3a 736f 6c76 6550 6e50 EF: cv::solvePnP │ │ │ +000e8dc0: 2c0a 7468 7573 2074 6865 2069 6e70 7574 ,.thus the input │ │ │ +000e8dd0: 2061 7265 2076 6572 7920 7369 6d69 6c61 are very simila │ │ │ +000e8de0: 722e 204d 6f72 6520 696e 666f 726d 6174 r. More informat │ │ │ +000e8df0: 696f 6e20 6162 6f75 7420 5065 7273 7065 ion about Perspe │ │ │ +000e8e00: 6374 6976 652d 6e2d 506f 696e 7473 2069 ctive-n-Points i │ │ │ +000e8e10: 7320 6465 7363 7269 6265 6420 696e 2052 s described in R │ │ │ +000e8e20: 4546 3a20 6361 6c69 6233 645f 736f 6c76 EF: calib3d_solv │ │ │ +000e8e30: 6550 6e50 0a66 6f72 206d 6f72 6520 696e ePnP.for more in │ │ │ +000e8e40: 666f 726d 6174 696f 6e2e 3c2f 6464 3e0a formation.
    . │ │ │ +000e8e50: 3c64 743e 5265 7475 726e 733a 3c2f 6474
    Returns:
    .
    automatica │ │ │ +000e8e70: 6c6c 7920 6765 6e65 7261 7465 643c 2f64 lly generated.
    .
    . │ │ │ +000e8e90: 3c2f 7365 6374 696f 6e3e 0a3c 2f6c 693e .

  • │ │ │ +000e8ea0: 0a3c 6c69 3e0a 3c73 6563 7469 6f6e 2063 .
  • .
    .

    fishey │ │ │ +000e8f70: 655f 736f 6c76 6550 6e50 5261 6e73 6163 e_solvePnPRansac │ │ │ +000e8f80: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ +000e8fe0: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ +000e8ff0: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ +000e9010: 626f 6f6c 6561 6e3c 2f73 7061 6e3e 266e boolean&n │ │ │ +000e9020: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;f │ │ │ +000e9040: 6973 6865 7965 5f73 6f6c 7665 506e 5052 isheye_solvePnPR │ │ │ +000e9050: 616e 7361 633c 2f73 7061 6e3e 3c77 6272 ansac(Mat&n │ │ │ +000e90c0: 6273 703b 6f62 6a65 6374 506f 696e 7473 bsp;objectPoints │ │ │ +000e90d0: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000e9110: 6174 3c2f 613e 266e 6273 703b 696d 6167 at imag │ │ │ +000e9120: 6550 6f69 6e74 732c 0a20 3c61 2068 7265 ePoints,. Mat&nb │ │ │ +000e9170: 7370 3b63 616d 6572 614d 6174 7269 782c sp;cameraMatrix, │ │ │ +000e9180: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000e91c0: 743c 2f61 3e26 6e62 7370 3b64 6973 7443 t distC │ │ │ +000e91d0: 6f65 6666 732c 0a20 3c61 2068 7265 663d oeffs,. Mat  │ │ │ +000e9220: 3b72 7665 632c 0a20 3c61 2068 7265 663d ;rvec,. Mat  │ │ │ +000e9270: 3b74 7665 632c 0a20 626f 6f6c 6561 6e26 ;tvec,. boolean& │ │ │ +000e9280: 6e62 7370 3b75 7365 4578 7472 696e 7369 nbsp;useExtrinsi │ │ │ +000e9290: 6347 7565 7373 2c0a 2069 6e74 266e 6273 cGuess,. int&nbs │ │ │ +000e92a0: 703b 6974 6572 6174 696f 6e73 436f 756e p;iterationsCoun │ │ │ +000e92b0: 742c 0a20 666c 6f61 7426 6e62 7370 3b72 t,. float r │ │ │ +000e92c0: 6570 726f 6a65 6374 696f 6e45 7272 6f72 eprojectionError │ │ │ +000e92d0: 293c 2f73 7061 6e3e 3c2f 6469 763e 0a3c )
    .< │ │ │ +000e92e0: 6469 7620 636c 6173 733d 2262 6c6f 636b div class="block │ │ │ +000e92f0: 223e 4669 6e64 7320 616e 206f 626a 6563 ">Finds an objec │ │ │ +000e9300: 7420 706f 7365 2066 726f 6d20 3344 2d32 t pose from 3D-2 │ │ │ +000e9310: 4420 706f 696e 7420 636f 7272 6573 706f D point correspo │ │ │ +000e9320: 6e64 656e 6365 7320 7573 696e 6720 7468 ndences using th │ │ │ +000e9330: 6520 5241 4e53 4143 2073 6368 656d 6520 e RANSAC scheme │ │ │ +000e9340: 666f 7220 6669 7368 6579 6520 6361 6d65 for fisheye came │ │ │ +000e9350: 7261 206d 6f6f 6465 6c2e 3c2f 6469 763e ra moodel.
    │ │ │ +000e9360: 0a3c 646c 2063 6c61 7373 3d22 6e6f 7465 .
    .
    Paramete │ │ │ +000e9380: 7273 3a3c 2f64 743e 0a3c 6464 3e3c 636f rs:
    .
    objectPoints< │ │ │ +000e93a0: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ +000e93b0: 6620 6f62 6a65 6374 2070 6f69 6e74 7320 f object points │ │ │ +000e93c0: 696e 2074 6865 206f 626a 6563 7420 636f in the object co │ │ │ +000e93d0: 6f72 6469 6e61 7465 2073 7061 6365 2c20 ordinate space, │ │ │ +000e93e0: 4e78 3320 312d 6368 616e 6e65 6c20 6f72 Nx3 1-channel or │ │ │ +000e93f0: 0a31 784e 2f4e 7831 2033 2d63 6861 6e6e .1xN/Nx1 3-chann │ │ │ +000e9400: 656c 2c20 7768 6572 6520 4e20 6973 2074 el, where N is t │ │ │ +000e9410: 6865 206e 756d 6265 7220 6f66 2070 6f69 he number of poi │ │ │ +000e9420: 6e74 732e 2076 6563 746f 7226 6c74 3b50 nts. vector<P │ │ │ +000e9430: 6f69 6e74 3364 2667 743b 2063 616e 2062 oint3d> can b │ │ │ +000e9440: 6520 616c 736f 2070 6173 7365 6420 6865 e also passed he │ │ │ +000e9450: 7265 2e3c 2f64 643e 0a3c 6464 3e3c 636f re.
    .
    imagePoints - Array of │ │ │ +000e9480: 2063 6f72 7265 7370 6f6e 6469 6e67 2069 corresponding i │ │ │ +000e9490: 6d61 6765 2070 6f69 6e74 732c 204e 7832 mage points, Nx2 │ │ │ +000e94a0: 2031 2d63 6861 6e6e 656c 206f 7220 3178 1-channel or 1x │ │ │ +000e94b0: 4e2f 4e78 3120 322d 6368 616e 6e65 6c2c N/Nx1 2-channel, │ │ │ +000e94c0: 0a77 6865 7265 204e 2069 7320 7468 6520 .where N is the │ │ │ +000e94d0: 6e75 6d62 6572 206f 6620 706f 696e 7473 number of points │ │ │ +000e94e0: 2e20 7665 6374 6f72 266c 743b 506f 696e . vector<Poin │ │ │ +000e94f0: 7432 6426 6774 3b20 6361 6e20 6265 2061 t2d> can be a │ │ │ +000e9500: 6c73 6f20 7061 7373 6564 2068 6572 652e lso passed here. │ │ │ +000e9510: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000e9520: 6361 6d65 7261 4d61 7472 6978 3c2f 636f cameraMatrix - Input came │ │ │ +000e9540: 7261 2069 6e74 7269 6e73 6963 206d 6174 ra intrinsic mat │ │ │ +000e9550: 7269 7820 5c28 5c63 616d 6572 616d 6174 rix \(\cameramat │ │ │ +000e9560: 7269 787b 417d 5c29 202e 3c2f 6464 3e0a rix{A}\) .
    . │ │ │ +000e9570: 3c64 643e 3c63 6f64 653e 6469 7374 436f
    distCo │ │ │ +000e9580: 6566 6673 3c2f 636f 6465 3e20 2d20 496e effs - In │ │ │ +000e9590: 7075 7420 7665 6374 6f72 206f 6620 6469 put vector of di │ │ │ +000e95a0: 7374 6f72 7469 6f6e 2063 6f65 6666 6963 stortion coeffic │ │ │ +000e95b0: 6965 6e74 7320 2834 7831 2f31 7834 292e ients (4x1/1x4). │ │ │ +000e95c0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000e95d0: 7276 6563 3c2f 636f 6465 3e20 2d20 4f75 rvec - Ou │ │ │ +000e95e0: 7470 7574 2072 6f74 6174 696f 6e20 7665 tput rotation ve │ │ │ +000e95f0: 6374 6f72 2028 7365 6520 5245 463a 2052 ctor (see REF: R │ │ │ +000e9600: 6f64 7269 6775 6573 2029 2074 6861 742c odrigues ) that, │ │ │ +000e9610: 2074 6f67 6574 6865 7220 7769 7468 2074 together with t │ │ │ +000e9620: 7665 632c 2062 7269 6e67 7320 706f 696e vec, brings poin │ │ │ +000e9630: 7473 2066 726f 6d0a 7468 6520 6d6f 6465 ts from.the mode │ │ │ +000e9640: 6c20 636f 6f72 6469 6e61 7465 2073 7973 l coordinate sys │ │ │ +000e9650: 7465 6d20 746f 2074 6865 2063 616d 6572 tem to the camer │ │ │ +000e9660: 6120 636f 6f72 6469 6e61 7465 2073 7973 a coordinate sys │ │ │ +000e9670: 7465 6d2e 3c2f 6464 3e0a 3c64 643e 3c63 tem.
    .
    tvec │ │ │ +000e9690: 2d20 4f75 7470 7574 2074 7261 6e73 6c61 - Output transla │ │ │ +000e96a0: 7469 6f6e 2076 6563 746f 722e 3c2f 6464 tion vector.
    .
    useE │ │ │ +000e96c0: 7874 7269 6e73 6963 4775 6573 733c 2f63 xtrinsicGuess - Parameter │ │ │ +000e96e0: 2075 7365 6420 666f 7220 2353 4f4c 5645 used for #SOLVE │ │ │ +000e96f0: 504e 505f 4954 4552 4154 4956 452e 2049 PNP_ITERATIVE. I │ │ │ +000e9700: 6620 7472 7565 2028 3129 2c20 7468 6520 f true (1), the │ │ │ +000e9710: 6675 6e63 7469 6f6e 2075 7365 730a 7468 function uses.th │ │ │ +000e9720: 6520 7072 6f76 6964 6564 2072 7665 6320 e provided rvec │ │ │ +000e9730: 616e 6420 7476 6563 2076 616c 7565 7320 and tvec values │ │ │ +000e9740: 6173 2069 6e69 7469 616c 2061 7070 726f as initial appro │ │ │ +000e9750: 7869 6d61 7469 6f6e 7320 6f66 2074 6865 ximations of the │ │ │ +000e9760: 2072 6f74 6174 696f 6e20 616e 6420 7472 rotation and tr │ │ │ +000e9770: 616e 736c 6174 696f 6e0a 7665 6374 6f72 anslation.vector │ │ │ +000e9780: 732c 2072 6573 7065 6374 6976 656c 792c s, respectively, │ │ │ +000e9790: 2061 6e64 2066 7572 7468 6572 206f 7074 and further opt │ │ │ +000e97a0: 696d 697a 6573 2074 6865 6d2e 3c2f 6464 imizes them.
    .
    iter │ │ │ +000e97c0: 6174 696f 6e73 436f 756e 743c 2f63 6f64 ationsCount - Number of i │ │ │ +000e97e0: 7465 7261 7469 6f6e 732e 3c2f 6464 3e0a terations.
    . │ │ │ +000e97f0: 3c64 643e 3c63 6f64 653e 7265 7072 6f6a
    reproj │ │ │ +000e9800: 6563 7469 6f6e 4572 726f 723c 2f63 6f64 ectionError - Inlier thre │ │ │ +000e9820: 7368 6f6c 6420 7661 6c75 6520 7573 6564 shold value used │ │ │ +000e9830: 2062 7920 7468 6520 5241 4e53 4143 2070 by the RANSAC p │ │ │ +000e9840: 726f 6365 6475 7265 2e20 5468 6520 7061 rocedure. The pa │ │ │ +000e9850: 7261 6d65 7465 7220 7661 6c75 650a 6973 rameter value.is │ │ │ +000e9860: 2074 6865 206d 6178 696d 756d 2061 6c6c the maximum all │ │ │ +000e9870: 6f77 6564 2064 6973 7461 6e63 6520 6265 owed distance be │ │ │ +000e9880: 7477 6565 6e20 7468 6520 6f62 7365 7276 tween the observ │ │ │ +000e9890: 6564 2061 6e64 2063 6f6d 7075 7465 6420 ed and computed │ │ │ +000e98a0: 706f 696e 7420 7072 6f6a 6563 7469 6f6e point projection │ │ │ +000e98b0: 7320 746f 2063 6f6e 7369 6465 7220 6974 s to consider it │ │ │ +000e98c0: 0a61 6e20 696e 6c69 6572 2e0a 5468 6520 .an inlier..The │ │ │ +000e98d0: 6675 6e63 7469 6f6e 2069 6e74 6572 616c function interal │ │ │ +000e98e0: 6c79 2075 6e64 6973 746f 7274 7320 706f ly undistorts po │ │ │ +000e98f0: 696e 7473 2077 6974 6820 5245 463a 2075 ints with REF: u │ │ │ +000e9900: 6e64 6973 746f 7274 506f 696e 7473 2061 ndistortPoints a │ │ │ +000e9910: 6e64 2063 616c 6c20 5245 463a 2063 763a nd call REF: cv: │ │ │ +000e9920: 3a73 6f6c 7665 506e 502c 0a74 6875 7320 :solvePnP,.thus │ │ │ +000e9930: 7468 6520 696e 7075 7420 6172 6520 7665 the input are ve │ │ │ +000e9940: 7279 2073 696d 696c 6172 2e20 4d6f 7265 ry similar. More │ │ │ +000e9950: 2069 6e66 6f72 6d61 7469 6f6e 2061 626f information abo │ │ │ +000e9960: 7574 2050 6572 7370 6563 7469 7665 2d6e ut Perspective-n │ │ │ +000e9970: 2d50 6f69 6e74 7320 6973 2064 6573 6372 -Points is descr │ │ │ +000e9980: 6962 6564 2069 6e20 5245 463a 2063 616c ibed in REF: cal │ │ │ +000e9990: 6962 3364 5f73 6f6c 7665 506e 500a 666f ib3d_solvePnP.fo │ │ │ +000e99a0: 7220 6d6f 7265 2069 6e66 6f72 6d61 7469 r more informati │ │ │ +000e99b0: 6f6e 2e3c 2f64 643e 0a3c 6474 3e52 6574 on.
    .
    Ret │ │ │ +000e99c0: 7572 6e73 3a3c 2f64 743e 0a3c 6464 3e61 urns:
    .
    a │ │ │ +000e99d0: 7574 6f6d 6174 6963 616c 6c79 2067 656e utomatically gen │ │ │ +000e99e0: 6572 6174 6564 3c2f 6464 3e0a 3c2f 646c erated
    .
    ...
  • .
  • .< │ │ │ +000e9a10: 7365 6374 696f 6e20 636c 6173 733d 2264 section class="d │ │ │ +000e9a20: 6574 6169 6c22 2069 643d 2266 6973 6865 etail" id="fishe │ │ │ +000e9a30: 7965 5f73 6f6c 7665 506e 5052 616e 7361 ye_solvePnPRansa │ │ │ +000e9a40: 6328 6f72 672e 6f70 656e 6376 2e63 6f72 c(org.opencv.cor │ │ │ +000e9a50: 652e 4d61 742c 6f72 672e 6f70 656e 6376 e.Mat,org.opencv │ │ │ +000e9a60: 2e63 6f72 652e 4d61 742c 6f72 672e 6f70 .core.Mat,org.op │ │ │ +000e9a70: 656e 6376 2e63 6f72 652e 4d61 742c 6f72 encv.core.Mat,or │ │ │ +000e9a80: 672e 6f70 656e 6376 2e63 6f72 652e 4d61 g.opencv.core.Ma │ │ │ +000e9a90: 742c 6f72 672e 6f70 656e 6376 2e63 6f72 t,org.opencv.cor │ │ │ +000e9aa0: 652e 4d61 742c 6f72 672e 6f70 656e 6376 e.Mat,org.opencv │ │ │ +000e9ab0: 2e63 6f72 652e 4d61 742c 626f 6f6c 6561 .core.Mat,boolea │ │ │ +000e9ac0: 6e2c 696e 7429 223e 0a3c 6833 3e66 6973 n,int)">.

    fis │ │ │ +000e9ad0: 6865 7965 5f73 6f6c 7665 506e 5052 616e heye_solvePnPRan │ │ │ +000e9ae0: 7361 633c 2f68 333e 0a3c 6469 7620 636c sac

    .
    .
    p │ │ │ +000e9b40: 7562 6c69 6320 7374 6174 6963 3c2f 7370 ublic static boolean fisheye_solveP │ │ │ +000e9bb0: 6e50 5261 6e73 6163 3c2f 7370 616e 3e3c nPRansac< │ │ │ +000e9bc0: 7762 723e 3c73 7061 6e20 636c 6173 733d wbr>(Mat objectPoi │ │ │ +000e9c30: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. Mat i │ │ │ +000e9c80: 6d61 6765 506f 696e 7473 2c0a 203c 6120 magePoints,. Mat │ │ │ +000e9cd0: 266e 6273 703b 6361 6d65 7261 4d61 7472  cameraMatr │ │ │ +000e9ce0: 6978 2c0a 203c 6120 6872 6566 3d22 2e2e ix,. Mat di │ │ │ +000e9d30: 7374 436f 6566 6673 2c0a 203c 6120 6872 stCoeffs,. Mat&n │ │ │ +000e9d80: 6273 703b 7276 6563 2c0a 203c 6120 6872 bsp;rvec,. Mat&n │ │ │ +000e9dd0: 6273 703b 7476 6563 2c0a 2062 6f6f 6c65 bsp;tvec,. boole │ │ │ +000e9de0: 616e 266e 6273 703b 7573 6545 7874 7269 an useExtri │ │ │ +000e9df0: 6e73 6963 4775 6573 732c 0a20 696e 7426 nsicGuess,. int& │ │ │ +000e9e00: 6e62 7370 3b69 7465 7261 7469 6f6e 7343 nbsp;iterationsC │ │ │ +000e9e10: 6f75 6e74 293c 2f73 7061 6e3e 3c2f 6469 ount).
    Finds an o │ │ │ +000e9e40: 626a 6563 7420 706f 7365 2066 726f 6d20 bject pose from │ │ │ +000e9e50: 3344 2d32 4420 706f 696e 7420 636f 7272 3D-2D point corr │ │ │ +000e9e60: 6573 706f 6e64 656e 6365 7320 7573 696e espondences usin │ │ │ +000e9e70: 6720 7468 6520 5241 4e53 4143 2073 6368 g the RANSAC sch │ │ │ +000e9e80: 656d 6520 666f 7220 6669 7368 6579 6520 eme for fisheye │ │ │ +000e9e90: 6361 6d65 7261 206d 6f6f 6465 6c2e 3c2f camera moodel..
    .
    Para │ │ │ +000e9ec0: 6d65 7465 7273 3a3c 2f64 743e 0a3c 6464 meters:
    .
    objectPoi │ │ │ +000e9ee0: 6e74 733c 2f63 6f64 653e 202d 2041 7272 nts - Arr │ │ │ +000e9ef0: 6179 206f 6620 6f62 6a65 6374 2070 6f69 ay of object poi │ │ │ +000e9f00: 6e74 7320 696e 2074 6865 206f 626a 6563 nts in the objec │ │ │ +000e9f10: 7420 636f 6f72 6469 6e61 7465 2073 7061 t coordinate spa │ │ │ +000e9f20: 6365 2c20 4e78 3320 312d 6368 616e 6e65 ce, Nx3 1-channe │ │ │ +000e9f30: 6c20 6f72 0a31 784e 2f4e 7831 2033 2d63 l or.1xN/Nx1 3-c │ │ │ +000e9f40: 6861 6e6e 656c 2c20 7768 6572 6520 4e20 hannel, where N │ │ │ +000e9f50: 6973 2074 6865 206e 756d 6265 7220 6f66 is the number of │ │ │ +000e9f60: 2070 6f69 6e74 732e 2076 6563 746f 7226 points. vector& │ │ │ +000e9f70: 6c74 3b50 6f69 6e74 3364 2667 743b 2063 lt;Point3d> c │ │ │ +000e9f80: 616e 2062 6520 616c 736f 2070 6173 7365 an be also passe │ │ │ +000e9f90: 6420 6865 7265 2e3c 2f64 643e 0a3c 6464 d here.
    .
    imagePoin │ │ │ +000e9fb0: 7473 3c2f 636f 6465 3e20 2d20 4172 7261 ts - Arra │ │ │ +000e9fc0: 7920 6f66 2063 6f72 7265 7370 6f6e 6469 y of correspondi │ │ │ +000e9fd0: 6e67 2069 6d61 6765 2070 6f69 6e74 732c ng image points, │ │ │ +000e9fe0: 204e 7832 2031 2d63 6861 6e6e 656c 206f Nx2 1-channel o │ │ │ +000e9ff0: 7220 3178 4e2f 4e78 3120 322d 6368 616e r 1xN/Nx1 2-chan │ │ │ +000ea000: 6e65 6c2c 0a77 6865 7265 204e 2069 7320 nel,.where N is │ │ │ +000ea010: 7468 6520 6e75 6d62 6572 206f 6620 706f the number of po │ │ │ +000ea020: 696e 7473 2e20 7665 6374 6f72 266c 743b ints. vector< │ │ │ +000ea030: 506f 696e 7432 6426 6774 3b20 6361 6e20 Point2d> can │ │ │ +000ea040: 6265 2061 6c73 6f20 7061 7373 6564 2068 be also passed h │ │ │ +000ea050: 6572 652e 3c2f 6464 3e0a 3c64 643e 3c63 ere.
    .
    cameraMatrix │ │ │ +000ea070: 3c2f 636f 6465 3e20 2d20 496e 7075 7420 - Input │ │ │ +000ea080: 6361 6d65 7261 2069 6e74 7269 6e73 6963 camera intrinsic │ │ │ +000ea090: 206d 6174 7269 7820 5c28 5c63 616d 6572 matrix \(\camer │ │ │ +000ea0a0: 616d 6174 7269 787b 417d 5c29 202e 3c2f amatrix{A}\) ..
    di │ │ │ +000ea0c0: 7374 436f 6566 6673 3c2f 636f 6465 3e20 stCoeffs │ │ │ +000ea0d0: 2d20 496e 7075 7420 7665 6374 6f72 206f - Input vector o │ │ │ +000ea0e0: 6620 6469 7374 6f72 7469 6f6e 2063 6f65 f distortion coe │ │ │ +000ea0f0: 6666 6963 6965 6e74 7320 2834 7831 2f31 fficients (4x1/1 │ │ │ +000ea100: 7834 292e 3c2f 6464 3e0a 3c64 643e 3c63 x4).
    .
    rvec │ │ │ +000ea120: 2d20 4f75 7470 7574 2072 6f74 6174 696f - Output rotatio │ │ │ +000ea130: 6e20 7665 6374 6f72 2028 7365 6520 5245 n vector (see RE │ │ │ +000ea140: 463a 2052 6f64 7269 6775 6573 2029 2074 F: Rodrigues ) t │ │ │ +000ea150: 6861 742c 2074 6f67 6574 6865 7220 7769 hat, together wi │ │ │ +000ea160: 7468 2074 7665 632c 2062 7269 6e67 7320 th tvec, brings │ │ │ +000ea170: 706f 696e 7473 2066 726f 6d0a 7468 6520 points from.the │ │ │ +000ea180: 6d6f 6465 6c20 636f 6f72 6469 6e61 7465 model coordinate │ │ │ +000ea190: 2073 7973 7465 6d20 746f 2074 6865 2063 system to the c │ │ │ +000ea1a0: 616d 6572 6120 636f 6f72 6469 6e61 7465 amera coordinate │ │ │ +000ea1b0: 2073 7973 7465 6d2e 3c2f 6464 3e0a 3c64 system.
    .tvec - Output tra │ │ │ +000ea1e0: 6e73 6c61 7469 6f6e 2076 6563 746f 722e nslation vector. │ │ │ +000ea1f0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e .
    │ │ │ +000ea200: 7573 6545 7874 7269 6e73 6963 4775 6573 useExtrinsicGues │ │ │ +000ea210: 733c 2f63 6f64 653e 202d 2050 6172 616d s - Param │ │ │ +000ea220: 6574 6572 2075 7365 6420 666f 7220 2353 eter used for #S │ │ │ +000ea230: 4f4c 5645 504e 505f 4954 4552 4154 4956 OLVEPNP_ITERATIV │ │ │ +000ea240: 452e 2049 6620 7472 7565 2028 3129 2c20 E. If true (1), │ │ │ +000ea250: 7468 6520 6675 6e63 7469 6f6e 2075 7365 the function use │ │ │ +000ea260: 730a 7468 6520 7072 6f76 6964 6564 2072 s.the provided r │ │ │ +000ea270: 7665 6320 616e 6420 7476 6563 2076 616c vec and tvec val │ │ │ +000ea280: 7565 7320 6173 2069 6e69 7469 616c 2061 ues as initial a │ │ │ +000ea290: 7070 726f 7869 6d61 7469 6f6e 7320 6f66 pproximations of │ │ │ +000ea2a0: 2074 6865 2072 6f74 6174 696f 6e20 616e the rotation an │ │ │ +000ea2b0: 6420 7472 616e 736c 6174 696f 6e0a 7665 d translation.ve │ │ │ +000ea2c0: 6374 6f72 732c 2072 6573 7065 6374 6976 ctors, respectiv │ │ │ +000ea2d0: 656c 792c 2061 6e64 2066 7572 7468 6572 ely, and further │ │ │ +000ea2e0: 206f 7074 696d 697a 6573 2074 6865 6d2e optimizes them. │ │ │ +000ea2f0: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000ea300: 6974 6572 6174 696f 6e73 436f 756e 743c iterationsCount< │ │ │ +000ea310: 2f63 6f64 653e 202d 204e 756d 6265 7220 /code> - Number │ │ │ +000ea320: 6f66 2069 7465 7261 7469 6f6e 732e 0a69 of iterations..i │ │ │ +000ea330: 7320 7468 6520 6d61 7869 6d75 6d20 616c s the maximum al │ │ │ +000ea340: 6c6f 7765 6420 6469 7374 616e 6365 2062 lowed distance b │ │ │ +000ea350: 6574 7765 656e 2074 6865 206f 6273 6572 etween the obser │ │ │ +000ea360: 7665 6420 616e 6420 636f 6d70 7574 6564 ved and computed │ │ │ +000ea370: 2070 6f69 6e74 2070 726f 6a65 6374 696f point projectio │ │ │ +000ea380: 6e73 2074 6f20 636f 6e73 6964 6572 2069 ns to consider i │ │ │ +000ea390: 740a 616e 2069 6e6c 6965 722e 0a54 6865 t.an inlier..The │ │ │ +000ea3a0: 2066 756e 6374 696f 6e20 696e 7465 7261 function intera │ │ │ +000ea3b0: 6c6c 7920 756e 6469 7374 6f72 7473 2070 lly undistorts p │ │ │ +000ea3c0: 6f69 6e74 7320 7769 7468 2052 4546 3a20 oints with REF: │ │ │ +000ea3d0: 756e 6469 7374 6f72 7450 6f69 6e74 7320 undistortPoints │ │ │ +000ea3e0: 616e 6420 6361 6c6c 2052 4546 3a20 6376 and call REF: cv │ │ │ +000ea3f0: 3a3a 736f 6c76 6550 6e50 2c0a 7468 7573 ::solvePnP,.thus │ │ │ +000ea400: 2074 6865 2069 6e70 7574 2061 7265 2076 the input are v │ │ │ +000ea410: 6572 7920 7369 6d69 6c61 722e 204d 6f72 ery similar. Mor │ │ │ +000ea420: 6520 696e 666f 726d 6174 696f 6e20 6162 e information ab │ │ │ +000ea430: 6f75 7420 5065 7273 7065 6374 6976 652d out Perspective- │ │ │ +000ea440: 6e2d 506f 696e 7473 2069 7320 6465 7363 n-Points is desc │ │ │ +000ea450: 7269 6265 6420 696e 2052 4546 3a20 6361 ribed in REF: ca │ │ │ +000ea460: 6c69 6233 645f 736f 6c76 6550 6e50 0a66 lib3d_solvePnP.f │ │ │ +000ea470: 6f72 206d 6f72 6520 696e 666f 726d 6174 or more informat │ │ │ +000ea480: 696f 6e2e 3c2f 6464 3e0a 3c64 743e 5265 ion.
    .
    Re │ │ │ +000ea490: 7475 726e 733a 3c2f 6474 3e0a 3c64 643e turns:
    .
    │ │ │ +000ea4a0: 6175 746f 6d61 7469 6361 6c6c 7920 6765 automatically ge │ │ │ +000ea4b0: 6e65 7261 7465 643c 2f64 643e 0a3c 2f64 nerated
    .
    .
    ..
  • .
  • . │ │ │ +000ea4e0: 3c73 6563 7469 6f6e 2063 6c61 7373 3d22
    .

    fishey │ │ │ +000ea5a0: 655f 736f 6c76 6550 6e50 5261 6e73 6163 e_solvePnPRansac │ │ │ +000ea5b0: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ +000ea610: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ +000ea620: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ +000ea640: 626f 6f6c 6561 6e3c 2f73 7061 6e3e 266e boolean&n │ │ │ +000ea650: 6273 703b 3c73 7061 6e20 636c 6173 733d bsp;f │ │ │ +000ea670: 6973 6865 7965 5f73 6f6c 7665 506e 5052 isheye_solvePnPR │ │ │ +000ea680: 616e 7361 633c 2f73 7061 6e3e 3c77 6272 ansac(Mat&n │ │ │ +000ea6f0: 6273 703b 6f62 6a65 6374 506f 696e 7473 bsp;objectPoints │ │ │ +000ea700: 2c0a 203c 6120 6872 6566 3d22 2e2e 2f63 ,. M │ │ │ +000ea740: 6174 3c2f 613e 266e 6273 703b 696d 6167 at imag │ │ │ +000ea750: 6550 6f69 6e74 732c 0a20 3c61 2068 7265 ePoints,. Mat&nb │ │ │ +000ea7a0: 7370 3b63 616d 6572 614d 6174 7269 782c sp;cameraMatrix, │ │ │ +000ea7b0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ +000ea7f0: 743c 2f61 3e26 6e62 7370 3b64 6973 7443 t distC │ │ │ +000ea800: 6f65 6666 732c 0a20 3c61 2068 7265 663d oeffs,. Mat  │ │ │ +000ea850: 3b72 7665 632c 0a20 3c61 2068 7265 663d ;rvec,. Mat  │ │ │ +000ea8a0: 3b74 7665 632c 0a20 626f 6f6c 6561 6e26 ;tvec,. boolean& │ │ │ +000ea8b0: 6e62 7370 3b75 7365 4578 7472 696e 7369 nbsp;useExtrinsi │ │ │ +000ea8c0: 6347 7565 7373 293c 2f73 7061 6e3e 3c2f cGuess).
    Finds an │ │ │ +000ea8f0: 206f 626a 6563 7420 706f 7365 2066 726f object pose fro │ │ │ +000ea900: 6d20 3344 2d32 4420 706f 696e 7420 636f m 3D-2D point co │ │ │ +000ea910: 7272 6573 706f 6e64 656e 6365 7320 7573 rrespondences us │ │ │ +000ea920: 696e 6720 7468 6520 5241 4e53 4143 2073 ing the RANSAC s │ │ │ +000ea930: 6368 656d 6520 666f 7220 6669 7368 6579 cheme for fishey │ │ │ +000ea940: 6520 6361 6d65 7261 206d 6f6f 6465 6c2e e camera moodel. │ │ │ +000ea950: 3c2f 6469 763e 0a3c 646c 2063 6c61 7373
    .
    .
    Pa │ │ │ +000ea970: 7261 6d65 7465 7273 3a3c 2f64 743e 0a3c rameters:
    .< │ │ │ +000ea980: 6464 3e3c 636f 6465 3e6f 626a 6563 7450 dd>objectP │ │ │ +000ea990: 6f69 6e74 733c 2f63 6f64 653e 202d 2041 oints - A │ │ │ +000ea9a0: 7272 6179 206f 6620 6f62 6a65 6374 2070 rray of object p │ │ │ +000ea9b0: 6f69 6e74 7320 696e 2074 6865 206f 626a oints in the obj │ │ │ +000ea9c0: 6563 7420 636f 6f72 6469 6e61 7465 2073 ect coordinate s │ │ │ +000ea9d0: 7061 6365 2c20 4e78 3320 312d 6368 616e pace, Nx3 1-chan │ │ │ +000ea9e0: 6e65 6c20 6f72 0a31 784e 2f4e 7831 2033 nel or.1xN/Nx1 3 │ │ │ +000ea9f0: 2d63 6861 6e6e 656c 2c20 7768 6572 6520 -channel, where │ │ │ +000eaa00: 4e20 6973 2074 6865 206e 756d 6265 7220 N is the number │ │ │ +000eaa10: 6f66 2070 6f69 6e74 732e 2076 6563 746f of points. vecto │ │ │ +000eaa20: 7226 6c74 3b50 6f69 6e74 3364 2667 743b r<Point3d> │ │ │ +000eaa30: 2063 616e 2062 6520 616c 736f 2070 6173 can be also pas │ │ │ +000eaa40: 7365 6420 6865 7265 2e3c 2f64 643e 0a3c sed here..< │ │ │ +000eaa50: 6464 3e3c 636f 6465 3e69 6d61 6765 506f dd>imagePo │ │ │ +000eaa60: 696e 7473 3c2f 636f 6465 3e20 2d20 4172 ints - Ar │ │ │ +000eaa70: 7261 7920 6f66 2063 6f72 7265 7370 6f6e ray of correspon │ │ │ +000eaa80: 6469 6e67 2069 6d61 6765 2070 6f69 6e74 ding image point │ │ │ +000eaa90: 732c 204e 7832 2031 2d63 6861 6e6e 656c s, Nx2 1-channel │ │ │ +000eaaa0: 206f 7220 3178 4e2f 4e78 3120 322d 6368 or 1xN/Nx1 2-ch │ │ │ +000eaab0: 616e 6e65 6c2c 0a77 6865 7265 204e 2069 annel,.where N i │ │ │ +000eaac0: 7320 7468 6520 6e75 6d62 6572 206f 6620 s the number of │ │ │ +000eaad0: 706f 696e 7473 2e20 7665 6374 6f72 266c points. vector&l │ │ │ +000eaae0: 743b 506f 696e 7432 6426 6774 3b20 6361 t;Point2d> ca │ │ │ +000eaaf0: 6e20 6265 2061 6c73 6f20 7061 7373 6564 n be also passed │ │ │ +000eab00: 2068 6572 652e 3c2f 6464 3e0a 3c64 643e here..
    │ │ │ +000eab10: 3c63 6f64 653e 6361 6d65 7261 4d61 7472 cameraMatr │ │ │ +000eab20: 6978 3c2f 636f 6465 3e20 2d20 496e 7075 ix - Inpu │ │ │ +000eab30: 7420 6361 6d65 7261 2069 6e74 7269 6e73 t camera intrins │ │ │ +000eab40: 6963 206d 6174 7269 7820 5c28 5c63 616d ic matrix \(\cam │ │ │ +000eab50: 6572 616d 6174 7269 787b 417d 5c29 202e eramatrix{A}\) . │ │ │ +000eab60: 3c2f 6464 3e0a 3c64 643e 3c63 6f64 653e
    .
    │ │ │ +000eab70: 6469 7374 436f 6566 6673 3c2f 636f 6465 distCoeffs - Input vector │ │ │ +000eab90: 206f 6620 6469 7374 6f72 7469 6f6e 2063 of distortion c │ │ │ +000eaba0: 6f65 6666 6963 6965 6e74 7320 2834 7831 oefficients (4x1 │ │ │ +000eabb0: 2f31 7834 292e 3c2f 6464 3e0a 3c64 643e /1x4).
    .
    │ │ │ +000eabc0: 3c63 6f64 653e 7276 6563 3c2f 636f 6465 rvec - Output rotat │ │ │ +000eabe0: 696f 6e20 7665 6374 6f72 2028 7365 6520 ion vector (see │ │ │ +000eabf0: 5245 463a 2052 6f64 7269 6775 6573 2029 REF: Rodrigues ) │ │ │ +000eac00: 2074 6861 742c 2074 6f67 6574 6865 7220 that, together │ │ │ +000eac10: 7769 7468 2074 7665 632c 2062 7269 6e67 with tvec, bring │ │ │ +000eac20: 7320 706f 696e 7473 2066 726f 6d0a 7468 s points from.th │ │ │ +000eac30: 6520 6d6f 6465 6c20 636f 6f72 6469 6e61 e model coordina │ │ │ +000eac40: 7465 2073 7973 7465 6d20 746f 2074 6865 te system to the │ │ │ +000eac50: 2063 616d 6572 6120 636f 6f72 6469 6e61 camera coordina │ │ │ +000eac60: 7465 2073 7973 7465 6d2e 3c2f 6464 3e0a te system.
    . │ │ │ +000eac70: 3c64 643e 3c63 6f64 653e 7476 6563 3c2f
    tvec - Output t │ │ │ +000eac90: 7261 6e73 6c61 7469 6f6e 2076 6563 746f ranslation vecto │ │ │ +000eaca0: 722e 3c2f 6464 3e0a 3c64 643e 3c63 6f64 r.
    .
    useExtrinsicGu │ │ │ +000eacc0: 6573 733c 2f63 6f64 653e 202d 2050 6172 ess - Par │ │ │ +000eacd0: 616d 6574 6572 2075 7365 6420 666f 7220 ameter used for │ │ │ +000eace0: 2353 4f4c 5645 504e 505f 4954 4552 4154 #SOLVEPNP_ITERAT │ │ │ +000eacf0: 4956 452e 2049 6620 7472 7565 2028 3129 IVE. If true (1) │ │ │ +000ead00: 2c20 7468 6520 6675 6e63 7469 6f6e 2075 , the function u │ │ │ +000ead10: 7365 730a 7468 6520 7072 6f76 6964 6564 ses.the provided │ │ │ +000ead20: 2072 7665 6320 616e 6420 7476 6563 2076 rvec and tvec v │ │ │ +000ead30: 616c 7565 7320 6173 2069 6e69 7469 616c alues as initial │ │ │ +000ead40: 2061 7070 726f 7869 6d61 7469 6f6e 7320 approximations │ │ │ +000ead50: 6f66 2074 6865 2072 6f74 6174 696f 6e20 of the rotation │ │ │ +000ead60: 616e 6420 7472 616e 736c 6174 696f 6e0a and translation. │ │ │ +000ead70: 7665 6374 6f72 732c 2072 6573 7065 6374 vectors, respect │ │ │ +000ead80: 6976 656c 792c 2061 6e64 2066 7572 7468 ively, and furth │ │ │ +000ead90: 6572 206f 7074 696d 697a 6573 2074 6865 er optimizes the │ │ │ +000eada0: 6d2e 0a69 7320 7468 6520 6d61 7869 6d75 m..is the maximu │ │ │ +000eadb0: 6d20 616c 6c6f 7765 6420 6469 7374 616e m allowed distan │ │ │ +000eadc0: 6365 2062 6574 7765 656e 2074 6865 206f ce between the o │ │ │ +000eadd0: 6273 6572 7665 6420 616e 6420 636f 6d70 bserved and comp │ │ │ +000eade0: 7574 6564 2070 6f69 6e74 2070 726f 6a65 uted point proje │ │ │ +000eadf0: 6374 696f 6e73 2074 6f20 636f 6e73 6964 ctions to consid │ │ │ +000eae00: 6572 2069 740a 616e 2069 6e6c 6965 722e er it.an inlier. │ │ │ +000eae10: 0a54 6865 2066 756e 6374 696f 6e20 696e .The function in │ │ │ +000eae20: 7465 7261 6c6c 7920 756e 6469 7374 6f72 terally undistor │ │ │ +000eae30: 7473 2070 6f69 6e74 7320 7769 7468 2052 ts points with R │ │ │ +000eae40: 4546 3a20 756e 6469 7374 6f72 7450 6f69 EF: undistortPoi │ │ │ +000eae50: 6e74 7320 616e 6420 6361 6c6c 2052 4546 nts and call REF │ │ │ +000eae60: 3a20 6376 3a3a 736f 6c76 6550 6e50 2c0a : cv::solvePnP,. │ │ │ +000eae70: 7468 7573 2074 6865 2069 6e70 7574 2061 thus the input a │ │ │ +000eae80: 7265 2076 6572 7920 7369 6d69 6c61 722e re very similar. │ │ │ +000eae90: 204d 6f72 6520 696e 666f 726d 6174 696f More informatio │ │ │ +000eaea0: 6e20 6162 6f75 7420 5065 7273 7065 6374 n about Perspect │ │ │ +000eaeb0: 6976 652d 6e2d 506f 696e 7473 2069 7320 ive-n-Points is │ │ │ +000eaec0: 6465 7363 7269 6265 6420 696e 2052 4546 described in REF │ │ │ +000eaed0: 3a20 6361 6c69 6233 645f 736f 6c76 6550 : calib3d_solveP │ │ │ +000eaee0: 6e50 0a66 6f72 206d 6f72 6520 696e 666f nP.for more info │ │ │ +000eaef0: 726d 6174 696f 6e2e 3c2f 6464 3e0a 3c64 rmation.
    .Returns:. │ │ │ +000eaf10: 3c64 643e 6175 746f 6d61 7469 6361 6c6c
    automaticall │ │ │ +000eaf20: 7920 6765 6e65 7261 7465 643c 2f64 643e y generated
    │ │ │ +000eaf30: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    .
    ..
  • .< │ │ │ +000eaf50: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.
    .

    fisheye_so │ │ │ +000eb010: 6c76 6550 6e50 5261 6e73 6163 3c2f 6833 lvePnPRansac

    .
    .
    │ │ │ +000eb060: 3c73 7061 6e20 636c 6173 733d 226d 6f64 public s │ │ │ +000eb080: 7461 7469 633c 2f73 7061 6e3e 266e 6273 tatic&nbs │ │ │ +000eb090: 703b 3c73 7061 6e20 636c 6173 733d 2272 p;bool │ │ │ +000eb0b0: 6561 6e3c 2f73 7061 6e3e 266e 6273 703b ean  │ │ │ +000eb0c0: 3c73 7061 6e20 636c 6173 733d 2265 6c65 fishe │ │ │ +000eb0e0: 7965 5f73 6f6c 7665 506e 5052 616e 7361 ye_solvePnPRansa │ │ │ +000eb0f0: 633c 2f73 7061 6e3e 3c77 6272 3e3c 7370 c(Mat  │ │ │ +000eb160: 6f62 6a65 6374 506f 696e 7473 2c0a 203c objectPoints,. < │ │ │ +000eb170: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ +000eb180: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ +000eb190: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ +000eb1a0: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat imagePoi │ │ │ +000eb1c0: 6e74 732c 0a20 3c61 2068 7265 663d 222e nts,. Mat c │ │ │ +000eb210: 616d 6572 614d 6174 7269 782c 0a20 3c61 ameraMatrix,. Mat distCoeff │ │ │ +000eb270: 732c 0a20 3c61 2068 7265 663d 222e 2e2f s,. │ │ │ +000eb2b0: 4d61 743c 2f61 3e26 6e62 7370 3b72 7665 Mat rve │ │ │ +000eb2c0: 632c 0a20 3c61 2068 7265 663d 222e 2e2f c,. │ │ │ +000eb300: 4d61 743c 2f61 3e26 6e62 7370 3b74 7665 Mat tve │ │ │ +000eb310: 6329 3c2f 7370 616e 3e3c 2f64 6976 3e0a c)
    . │ │ │ +000eb320: 3c64 6976 2063 6c61 7373 3d22 626c 6f63
    Finds an obje │ │ │ +000eb340: 6374 2070 6f73 6520 6672 6f6d 2033 442d ct pose from 3D- │ │ │ +000eb350: 3244 2070 6f69 6e74 2063 6f72 7265 7370 2D point corresp │ │ │ +000eb360: 6f6e 6465 6e63 6573 2075 7369 6e67 2074 ondences using t │ │ │ +000eb370: 6865 2052 414e 5341 4320 7363 6865 6d65 he RANSAC scheme │ │ │ +000eb380: 2066 6f72 2066 6973 6865 7965 2063 616d for fisheye cam │ │ │ +000eb390: 6572 6120 6d6f 6f64 656c 2e3c 2f64 6976 era moodel.
    .
    .
    Paramet │ │ │ +000eb3c0: 6572 733a 3c2f 6474 3e0a 3c64 643e 3c63 ers:
    .
    objectPoints │ │ │ +000eb3e0: 3c2f 636f 6465 3e20 2d20 4172 7261 7920 - Array │ │ │ +000eb3f0: 6f66 206f 626a 6563 7420 706f 696e 7473 of object points │ │ │ +000eb400: 2069 6e20 7468 6520 6f62 6a65 6374 2063 in the object c │ │ │ +000eb410: 6f6f 7264 696e 6174 6520 7370 6163 652c oordinate space, │ │ │ +000eb420: 204e 7833 2031 2d63 6861 6e6e 656c 206f Nx3 1-channel o │ │ │ +000eb430: 720a 3178 4e2f 4e78 3120 332d 6368 616e r.1xN/Nx1 3-chan │ │ │ +000eb440: 6e65 6c2c 2077 6865 7265 204e 2069 7320 nel, where N is │ │ │ +000eb450: 7468 6520 6e75 6d62 6572 206f 6620 706f the number of po │ │ │ +000eb460: 696e 7473 2e20 7665 6374 6f72 266c 743b ints. vector< │ │ │ +000eb470: 506f 696e 7433 6426 6774 3b20 6361 6e20 Point3d> can │ │ │ +000eb480: 6265 2061 6c73 6f20 7061 7373 6564 2068 be also passed h │ │ │ +000eb490: 6572 652e 3c2f 6464 3e0a 3c64 643e 3c63 ere.
    .
    imagePoints< │ │ │ +000eb4b0: 2f63 6f64 653e 202d 2041 7272 6179 206f /code> - Array o │ │ │ +000eb4c0: 6620 636f 7272 6573 706f 6e64 696e 6720 f corresponding │ │ │ +000eb4d0: 696d 6167 6520 706f 696e 7473 2c20 4e78 image points, Nx │ │ │ +000eb4e0: 3220 312d 6368 616e 6e65 6c20 6f72 2031 2 1-channel or 1 │ │ │ +000eb4f0: 784e 2f4e 7831 2032 2d63 6861 6e6e 656c xN/Nx1 2-channel │ │ │ +000eb500: 2c0a 7768 6572 6520 4e20 6973 2074 6865 ,.where N is the │ │ │ +000eb510: 206e 756d 6265 7220 6f66 2070 6f69 6e74 number of point │ │ │ +000eb520: 732e 2076 6563 746f 7226 6c74 3b50 6f69 s. vector<Poi │ │ │ +000eb530: 6e74 3264 2667 743b 2063 616e 2062 6520 nt2d> can be │ │ │ +000eb540: 616c 736f 2070 6173 7365 6420 6865 7265 also passed here │ │ │ +000eb550: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    cameraMatrix - Input cam │ │ │ +000eb580: 6572 6120 696e 7472 696e 7369 6320 6d61 era intrinsic ma │ │ │ +000eb590: 7472 6978 205c 285c 6361 6d65 7261 6d61 trix \(\camerama │ │ │ +000eb5a0: 7472 6978 7b41 7d5c 2920 2e3c 2f64 643e trix{A}\) .
    │ │ │ +000eb5b0: 0a3c 6464 3e3c 636f 6465 3e64 6973 7443 .
    distC │ │ │ +000eb5c0: 6f65 6666 733c 2f63 6f64 653e 202d 2049 oeffs - I │ │ │ +000eb5d0: 6e70 7574 2076 6563 746f 7220 6f66 2064 nput vector of d │ │ │ +000eb5e0: 6973 746f 7274 696f 6e20 636f 6566 6669 istortion coeffi │ │ │ +000eb5f0: 6369 656e 7473 2028 3478 312f 3178 3429 cients (4x1/1x4) │ │ │ +000eb600: 2e3c 2f64 643e 0a3c 6464 3e3c 636f 6465 .
    .
    rvec - O │ │ │ +000eb620: 7574 7075 7420 726f 7461 7469 6f6e 2076 utput rotation v │ │ │ +000eb630: 6563 746f 7220 2873 6565 2052 4546 3a20 ector (see REF: │ │ │ +000eb640: 526f 6472 6967 7565 7320 2920 7468 6174 Rodrigues ) that │ │ │ +000eb650: 2c20 746f 6765 7468 6572 2077 6974 6820 , together with │ │ │ +000eb660: 7476 6563 2c20 6272 696e 6773 2070 6f69 tvec, brings poi │ │ │ +000eb670: 6e74 7320 6672 6f6d 0a74 6865 206d 6f64 nts from.the mod │ │ │ +000eb680: 656c 2063 6f6f 7264 696e 6174 6520 7379 el coordinate sy │ │ │ +000eb690: 7374 656d 2074 6f20 7468 6520 6361 6d65 stem to the came │ │ │ +000eb6a0: 7261 2063 6f6f 7264 696e 6174 6520 7379 ra coordinate sy │ │ │ +000eb6b0: 7374 656d 2e3c 2f64 643e 0a3c 6464 3e3c stem.
    .
    < │ │ │ +000eb6c0: 636f 6465 3e74 7665 633c 2f63 6f64 653e code>tvec │ │ │ +000eb6d0: 202d 204f 7574 7075 7420 7472 616e 736c - Output transl │ │ │ +000eb6e0: 6174 696f 6e20 7665 6374 6f72 2e0a 7468 ation vector..th │ │ │ +000eb6f0: 6520 7072 6f76 6964 6564 2072 7665 6320 e provided rvec │ │ │ +000eb700: 616e 6420 7476 6563 2076 616c 7565 7320 and tvec values │ │ │ +000eb710: 6173 2069 6e69 7469 616c 2061 7070 726f as initial appro │ │ │ +000eb720: 7869 6d61 7469 6f6e 7320 6f66 2074 6865 ximations of the │ │ │ +000eb730: 2072 6f74 6174 696f 6e20 616e 6420 7472 rotation and tr │ │ │ +000eb740: 616e 736c 6174 696f 6e0a 7665 6374 6f72 anslation.vector │ │ │ +000eb750: 732c 2072 6573 7065 6374 6976 656c 792c s, respectively, │ │ │ +000eb760: 2061 6e64 2066 7572 7468 6572 206f 7074 and further opt │ │ │ +000eb770: 696d 697a 6573 2074 6865 6d2e 0a69 7320 imizes them..is │ │ │ +000eb780: 7468 6520 6d61 7869 6d75 6d20 616c 6c6f the maximum allo │ │ │ +000eb790: 7765 6420 6469 7374 616e 6365 2062 6574 wed distance bet │ │ │ +000eb7a0: 7765 656e 2074 6865 206f 6273 6572 7665 ween the observe │ │ │ +000eb7b0: 6420 616e 6420 636f 6d70 7574 6564 2070 d and computed p │ │ │ +000eb7c0: 6f69 6e74 2070 726f 6a65 6374 696f 6e73 oint projections │ │ │ +000eb7d0: 2074 6f20 636f 6e73 6964 6572 2069 740a to consider it. │ │ │ +000eb7e0: 616e 2069 6e6c 6965 722e 0a54 6865 2066 an inlier..The f │ │ │ +000eb7f0: 756e 6374 696f 6e20 696e 7465 7261 6c6c unction interall │ │ │ +000eb800: 7920 756e 6469 7374 6f72 7473 2070 6f69 y undistorts poi │ │ │ +000eb810: 6e74 7320 7769 7468 2052 4546 3a20 756e nts with REF: un │ │ │ +000eb820: 6469 7374 6f72 7450 6f69 6e74 7320 616e distortPoints an │ │ │ +000eb830: 6420 6361 6c6c 2052 4546 3a20 6376 3a3a d call REF: cv:: │ │ │ +000eb840: 736f 6c76 6550 6e50 2c0a 7468 7573 2074 solvePnP,.thus t │ │ │ +000eb850: 6865 2069 6e70 7574 2061 7265 2076 6572 he input are ver │ │ │ +000eb860: 7920 7369 6d69 6c61 722e 204d 6f72 6520 y similar. More │ │ │ +000eb870: 696e 666f 726d 6174 696f 6e20 6162 6f75 information abou │ │ │ +000eb880: 7420 5065 7273 7065 6374 6976 652d 6e2d t Perspective-n- │ │ │ +000eb890: 506f 696e 7473 2069 7320 6465 7363 7269 Points is descri │ │ │ +000eb8a0: 6265 6420 696e 2052 4546 3a20 6361 6c69 bed in REF: cali │ │ │ +000eb8b0: 6233 645f 736f 6c76 6550 6e50 0a66 6f72 b3d_solvePnP.for │ │ │ +000eb8c0: 206d 6f72 6520 696e 666f 726d 6174 696f more informatio │ │ │ +000eb8d0: 6e2e 3c2f 6464 3e0a 3c64 743e 5265 7475 n.
    .
    Retu │ │ │ +000eb8e0: 726e 733a 3c2f 6474 3e0a 3c64 643e 6175 rns:
    .
    au │ │ │ +000eb8f0: 746f 6d61 7469 6361 6c6c 7920 6765 6e65 tomatically gene │ │ │ +000eb900: 7261 7465 643c 2f64 643e 0a3c 2f64 6c3e rated
    .
    │ │ │ 000eb910: 0a3c 2f64 6976 3e0a 3c2f 7365 6374 696f .
    ....< │ │ │ 000eb930: 2f73 6563 7469 6f6e 3e0a 3c2f 6c69 3e0a /section>.. │ │ │ 000eb940: 3c2f 756c 3e0a 3c2f 7365 6374 696f 6e3e .
    │ │ │ 000eb950: 0a3c 212d 2d20 3d3d 3d3d 3d3d 3d3d 3d20 .. │ │ │ ├── html2text {} │ │ │ │ @@ -83,284 +83,284 @@ │ │ │ │ 61. _S_O_L_V_E_P_N_P___M_A_X___C_O_U_N_T │ │ │ │ 62. _V_a_r_i_a_b_l_e_T_y_p_e___L_I_N_E_A_R │ │ │ │ 63. _V_a_r_i_a_b_l_e_T_y_p_e___S_O_3 │ │ │ │ 64. _V_a_r_i_a_b_l_e_T_y_p_e___S_E_3 │ │ │ │ 6. _C_o_n_s_t_r_u_c_t_o_r_ _D_e_t_a_i_l_s │ │ │ │ 1. _G_e_o_m_e_t_r_y_(_) │ │ │ │ 7. _M_e_t_h_o_d_ _D_e_t_a_i_l_s │ │ │ │ - 1. _R_o_d_r_i_g_u_e_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 2. _R_o_d_r_i_g_u_e_s_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 3. _f_i_n_d_H_o_m_o_g_r_a_p_h_y_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _M_a_t_,_ _i_n_t_, │ │ │ │ + 1. _a_p_p_r_o_x_P_o_l_y_D_P_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _d_o_u_b_l_e_,_ _b_o_o_l_e_a_n_) │ │ │ │ + 2. _a_p_p_r_o_x_P_o_l_y_N_(_M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _f_l_o_a_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ + 3. _a_p_p_r_o_x_P_o_l_y_N_(_M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _f_l_o_a_t_) │ │ │ │ + 4. _a_p_p_r_o_x_P_o_l_y_N_(_M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ + 5. _m_i_n_A_r_e_a_R_e_c_t_(_M_a_t_O_f_P_o_i_n_t_2_f_) │ │ │ │ + 6. _b_o_x_P_o_i_n_t_s_(_R_o_t_a_t_e_d_R_e_c_t_,_ _M_a_t_) │ │ │ │ + 7. _m_i_n_E_n_c_l_o_s_i_n_g_C_i_r_c_l_e_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _P_o_i_n_t_,_ _f_l_o_a_t_[_]_) │ │ │ │ + 8. _m_i_n_E_n_c_l_o_s_i_n_g_T_r_i_a_n_g_l_e_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 9. _m_i_n_E_n_c_l_o_s_i_n_g_C_o_n_v_e_x_P_o_l_y_g_o_n_(_M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ + 10. _m_o_m_e_n_t_s_(_M_a_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ + 11. _m_o_m_e_n_t_s_(_M_a_t_) │ │ │ │ + 12. _H_u_M_o_m_e_n_t_s_(_M_o_m_e_n_t_s_,_ _M_a_t_) │ │ │ │ + 13. _m_a_t_c_h_S_h_a_p_e_s_(_M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 14. _c_o_n_v_e_x_H_u_l_l_(_M_a_t_O_f_P_o_i_n_t_,_ _M_a_t_O_f_I_n_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ + 15. _c_o_n_v_e_x_H_u_l_l_(_M_a_t_O_f_P_o_i_n_t_,_ _M_a_t_O_f_I_n_t_) │ │ │ │ + 16. _c_o_n_v_e_x_i_t_y_D_e_f_e_c_t_s_(_M_a_t_O_f_P_o_i_n_t_,_ _M_a_t_O_f_I_n_t_,_ _M_a_t_O_f_I_n_t_4_) │ │ │ │ + 17. _i_s_C_o_n_t_o_u_r_C_o_n_v_e_x_(_M_a_t_O_f_P_o_i_n_t_) │ │ │ │ + 18. _i_n_t_e_r_s_e_c_t_C_o_n_v_e_x_C_o_n_v_e_x_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ + 19. _i_n_t_e_r_s_e_c_t_C_o_n_v_e_x_C_o_n_v_e_x_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 20. _f_i_t_E_l_l_i_p_s_e_(_M_a_t_O_f_P_o_i_n_t_2_f_) │ │ │ │ + 21. _f_i_t_E_l_l_i_p_s_e_A_M_S_(_M_a_t_) │ │ │ │ + 22. _f_i_t_E_l_l_i_p_s_e_D_i_r_e_c_t_(_M_a_t_) │ │ │ │ + 23. _g_e_t_C_l_o_s_e_s_t_E_l_l_i_p_s_e_P_o_i_n_t_s_(_R_o_t_a_t_e_d_R_e_c_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 24. _f_i_t_L_i_n_e_(_M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ + 25. _p_o_i_n_t_P_o_l_y_g_o_n_T_e_s_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _P_o_i_n_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ + 26. _r_o_t_a_t_e_d_R_e_c_t_a_n_g_l_e_I_n_t_e_r_s_e_c_t_i_o_n_(_R_o_t_a_t_e_d_R_e_c_t_,_ _R_o_t_a_t_e_d_R_e_c_t_,_ _M_a_t_) │ │ │ │ + 27. _a_r_c_L_e_n_g_t_h_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _b_o_o_l_e_a_n_) │ │ │ │ + 28. _c_o_n_t_o_u_r_A_r_e_a_(_M_a_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ + 29. _c_o_n_t_o_u_r_A_r_e_a_(_M_a_t_) │ │ │ │ + 30. _b_o_u_n_d_i_n_g_R_e_c_t_(_M_a_t_) │ │ │ │ + 31. _g_e_t_R_o_t_a_t_i_o_n_M_a_t_r_i_x_2_D_(_P_o_i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ + 32. _i_n_v_e_r_t_A_f_f_i_n_e_T_r_a_n_s_f_o_r_m_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 33. _g_e_t_P_e_r_s_p_e_c_t_i_v_e_T_r_a_n_s_f_o_r_m_(_M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ + 34. _g_e_t_P_e_r_s_p_e_c_t_i_v_e_T_r_a_n_s_f_o_r_m_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 35. _g_e_t_A_f_f_i_n_e_T_r_a_n_s_f_o_r_m_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_) │ │ │ │ + 36. _R_o_d_r_i_g_u_e_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 37. _R_o_d_r_i_g_u_e_s_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 38. _f_i_n_d_H_o_m_o_g_r_a_p_h_y_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _M_a_t_,_ _i_n_t_, │ │ │ │ _d_o_u_b_l_e_) │ │ │ │ - 4. _f_i_n_d_H_o_m_o_g_r_a_p_h_y_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 5. _f_i_n_d_H_o_m_o_g_r_a_p_h_y_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _M_a_t_) │ │ │ │ - 6. _f_i_n_d_H_o_m_o_g_r_a_p_h_y_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 7. _f_i_n_d_H_o_m_o_g_r_a_p_h_y_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_) │ │ │ │ - 8. _f_i_n_d_H_o_m_o_g_r_a_p_h_y_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_) │ │ │ │ - 9. _f_i_n_d_H_o_m_o_g_r_a_p_h_y_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _U_s_a_c_P_a_r_a_m_s_) │ │ │ │ - 10. _R_Q_D_e_c_o_m_p_3_x_3_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 11. _R_Q_D_e_c_o_m_p_3_x_3_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 12. _R_Q_D_e_c_o_m_p_3_x_3_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 13. _R_Q_D_e_c_o_m_p_3_x_3_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 14. _d_e_c_o_m_p_o_s_e_P_r_o_j_e_c_t_i_o_n_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 15. _d_e_c_o_m_p_o_s_e_P_r_o_j_e_c_t_i_o_n_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 16. _d_e_c_o_m_p_o_s_e_P_r_o_j_e_c_t_i_o_n_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 17. _d_e_c_o_m_p_o_s_e_P_r_o_j_e_c_t_i_o_n_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 18. _d_e_c_o_m_p_o_s_e_P_r_o_j_e_c_t_i_o_n_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 19. _m_a_t_M_u_l_D_e_r_i_v_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 20. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ + 39. _f_i_n_d_H_o_m_o_g_r_a_p_h_y_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ + 40. _f_i_n_d_H_o_m_o_g_r_a_p_h_y_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _M_a_t_) │ │ │ │ + 41. _f_i_n_d_H_o_m_o_g_r_a_p_h_y_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 42. _f_i_n_d_H_o_m_o_g_r_a_p_h_y_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_) │ │ │ │ + 43. _f_i_n_d_H_o_m_o_g_r_a_p_h_y_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_) │ │ │ │ + 44. _f_i_n_d_H_o_m_o_g_r_a_p_h_y_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _U_s_a_c_P_a_r_a_m_s_) │ │ │ │ + 45. _R_Q_D_e_c_o_m_p_3_x_3_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 46. _R_Q_D_e_c_o_m_p_3_x_3_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 47. _R_Q_D_e_c_o_m_p_3_x_3_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 48. _R_Q_D_e_c_o_m_p_3_x_3_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 49. _d_e_c_o_m_p_o_s_e_P_r_o_j_e_c_t_i_o_n_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 50. _d_e_c_o_m_p_o_s_e_P_r_o_j_e_c_t_i_o_n_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 51. _d_e_c_o_m_p_o_s_e_P_r_o_j_e_c_t_i_o_n_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 52. _d_e_c_o_m_p_o_s_e_P_r_o_j_e_c_t_i_o_n_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 53. _d_e_c_o_m_p_o_s_e_P_r_o_j_e_c_t_i_o_n_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 54. _m_a_t_M_u_l_D_e_r_i_v_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 55. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 21. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ + 56. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ _M_a_t_,_ _M_a_t_) │ │ │ │ - 22. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ + 57. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ _M_a_t_) │ │ │ │ - 23. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 24. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 25. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 26. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 27. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 28. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 29. _p_r_o_j_e_c_t_P_o_i_n_t_s_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_, │ │ │ │ + 58. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 59. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 60. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 61. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 62. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 63. _c_o_m_p_o_s_e_R_T_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 64. _p_r_o_j_e_c_t_P_o_i_n_t_s_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_, │ │ │ │ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 30. _p_r_o_j_e_c_t_P_o_i_n_t_s_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_, │ │ │ │ + 65. _p_r_o_j_e_c_t_P_o_i_n_t_s_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_, │ │ │ │ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_) │ │ │ │ - 31. _p_r_o_j_e_c_t_P_o_i_n_t_s_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_, │ │ │ │ + 66. _p_r_o_j_e_c_t_P_o_i_n_t_s_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_, │ │ │ │ _M_a_t_O_f_P_o_i_n_t_2_f_) │ │ │ │ - 32. _p_r_o_j_e_c_t_P_o_i_n_t_s_S_e_p_J_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ + 67. _p_r_o_j_e_c_t_P_o_i_n_t_s_S_e_p_J_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 33. _p_r_o_j_e_c_t_P_o_i_n_t_s_S_e_p_J_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ + 68. _p_r_o_j_e_c_t_P_o_i_n_t_s_S_e_p_J_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ _M_a_t_,_ _M_a_t_) │ │ │ │ - 34. _p_r_o_j_e_c_t_P_o_i_n_t_s_S_e_p_J_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ + 69. _p_r_o_j_e_c_t_P_o_i_n_t_s_S_e_p_J_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ _M_a_t_) │ │ │ │ - 35. _p_r_o_j_e_c_t_P_o_i_n_t_s_S_e_p_J_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 36. _p_r_o_j_e_c_t_P_o_i_n_t_s_S_e_p_J_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 37. _p_r_o_j_e_c_t_P_o_i_n_t_s_S_e_p_J_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 38. _s_o_l_v_e_P_n_P_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ + 70. _p_r_o_j_e_c_t_P_o_i_n_t_s_S_e_p_J_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 71. _p_r_o_j_e_c_t_P_o_i_n_t_s_S_e_p_J_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 72. _p_r_o_j_e_c_t_P_o_i_n_t_s_S_e_p_J_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 73. _s_o_l_v_e_P_n_P_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ _b_o_o_l_e_a_n_,_ _i_n_t_) │ │ │ │ - 39. _s_o_l_v_e_P_n_P_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ + 74. _s_o_l_v_e_P_n_P_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ _b_o_o_l_e_a_n_) │ │ │ │ - 40. _s_o_l_v_e_P_n_P_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 41. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ + 75. _s_o_l_v_e_P_n_P_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 76. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_,_ _f_l_o_a_t_,_ _d_o_u_b_l_e_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 42. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ + 77. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_,_ _f_l_o_a_t_,_ _d_o_u_b_l_e_,_ _M_a_t_) │ │ │ │ - 43. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ + 78. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_,_ _f_l_o_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 44. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ + 79. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_,_ _f_l_o_a_t_) │ │ │ │ - 45. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ + 80. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_) │ │ │ │ - 46. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ + 81. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ _M_a_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ - 47. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ + 82. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ _M_a_t_) │ │ │ │ - 48. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ + 83. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ _M_a_t_,_ _M_a_t_,_ _U_s_a_c_P_a_r_a_m_s_) │ │ │ │ - 49. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ + 84. _s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_O_f_P_o_i_n_t_3_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_O_f_D_o_u_b_l_e_,_ _M_a_t_, │ │ │ │ _M_a_t_,_ _M_a_t_) │ │ │ │ - 50. _s_o_l_v_e_P_3_P_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_,_ _i_n_t_) │ │ │ │ - 51. _s_o_l_v_e_P_n_P_R_e_f_i_n_e_L_M_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _T_e_r_m_C_r_i_t_e_r_i_a_) │ │ │ │ - 52. _s_o_l_v_e_P_n_P_R_e_f_i_n_e_L_M_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 53. _s_o_l_v_e_P_n_P_R_e_f_i_n_e_V_V_S_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _T_e_r_m_C_r_i_t_e_r_i_a_, │ │ │ │ + 85. _s_o_l_v_e_P_3_P_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_,_ _i_n_t_) │ │ │ │ + 86. _s_o_l_v_e_P_n_P_R_e_f_i_n_e_L_M_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _T_e_r_m_C_r_i_t_e_r_i_a_) │ │ │ │ + 87. _s_o_l_v_e_P_n_P_R_e_f_i_n_e_L_M_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 88. _s_o_l_v_e_P_n_P_R_e_f_i_n_e_V_V_S_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _T_e_r_m_C_r_i_t_e_r_i_a_, │ │ │ │ _d_o_u_b_l_e_) │ │ │ │ - 54. _s_o_l_v_e_P_n_P_R_e_f_i_n_e_V_V_S_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _T_e_r_m_C_r_i_t_e_r_i_a_) │ │ │ │ - 55. _s_o_l_v_e_P_n_P_R_e_f_i_n_e_V_V_S_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 56. _s_o_l_v_e_P_n_P_G_e_n_e_r_i_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_,_ _M_a_t_, │ │ │ │ + 89. _s_o_l_v_e_P_n_P_R_e_f_i_n_e_V_V_S_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _T_e_r_m_C_r_i_t_e_r_i_a_) │ │ │ │ + 90. _s_o_l_v_e_P_n_P_R_e_f_i_n_e_V_V_S_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 91. _s_o_l_v_e_P_n_P_G_e_n_e_r_i_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_,_ _M_a_t_, │ │ │ │ _M_a_t_,_ _M_a_t_) │ │ │ │ - 57. _s_o_l_v_e_P_n_P_G_e_n_e_r_i_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_,_ _M_a_t_, │ │ │ │ + 92. _s_o_l_v_e_P_n_P_G_e_n_e_r_i_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_,_ _M_a_t_, │ │ │ │ _M_a_t_) │ │ │ │ - 58. _s_o_l_v_e_P_n_P_G_e_n_e_r_i_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_,_ _M_a_t_) │ │ │ │ - 59. _s_o_l_v_e_P_n_P_G_e_n_e_r_i_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_) │ │ │ │ - 60. _s_o_l_v_e_P_n_P_G_e_n_e_r_i_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ - 61. _s_o_l_v_e_P_n_P_G_e_n_e_r_i_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_) │ │ │ │ - 62. _c_o_n_v_e_r_t_P_o_i_n_t_s_T_o_H_o_m_o_g_e_n_e_o_u_s_(_M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 63. _c_o_n_v_e_r_t_P_o_i_n_t_s_T_o_H_o_m_o_g_e_n_e_o_u_s_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 64. _c_o_n_v_e_r_t_P_o_i_n_t_s_F_r_o_m_H_o_m_o_g_e_n_e_o_u_s_(_M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 65. _c_o_n_v_e_r_t_P_o_i_n_t_s_F_r_o_m_H_o_m_o_g_e_n_e_o_u_s_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 66. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_, │ │ │ │ + 93. _s_o_l_v_e_P_n_P_G_e_n_e_r_i_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_,_ _M_a_t_) │ │ │ │ + 94. _s_o_l_v_e_P_n_P_G_e_n_e_r_i_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_) │ │ │ │ + 95. _s_o_l_v_e_P_n_P_G_e_n_e_r_i_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ + 96. _s_o_l_v_e_P_n_P_G_e_n_e_r_i_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_) │ │ │ │ + 97. _c_o_n_v_e_r_t_P_o_i_n_t_s_T_o_H_o_m_o_g_e_n_e_o_u_s_(_M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ + 98. _c_o_n_v_e_r_t_P_o_i_n_t_s_T_o_H_o_m_o_g_e_n_e_o_u_s_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 99. _c_o_n_v_e_r_t_P_o_i_n_t_s_F_r_o_m_H_o_m_o_g_e_n_e_o_u_s_(_M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ + 100. _c_o_n_v_e_r_t_P_o_i_n_t_s_F_r_o_m_H_o_m_o_g_e_n_e_o_u_s_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 101. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_, │ │ │ │ _i_n_t_,_ _M_a_t_) │ │ │ │ - 67. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_, │ │ │ │ + 102. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_, │ │ │ │ _i_n_t_) │ │ │ │ - 68. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_, │ │ │ │ + 103. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_, │ │ │ │ _M_a_t_) │ │ │ │ - 69. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ - 70. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 71. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_) │ │ │ │ - 72. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_) │ │ │ │ - 73. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _U_s_a_c_P_a_r_a_m_s_) │ │ │ │ - 74. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_,_ _i_n_t_,_ _M_a_t_) │ │ │ │ - 75. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_,_ _i_n_t_) │ │ │ │ - 76. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ - 77. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 78. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 79. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 80. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_,_ _i_n_t_, │ │ │ │ + 104. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ + 105. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 106. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _i_n_t_) │ │ │ │ + 107. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_) │ │ │ │ + 108. _f_i_n_d_F_u_n_d_a_m_e_n_t_a_l_M_a_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _U_s_a_c_P_a_r_a_m_s_) │ │ │ │ + 109. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_,_ _i_n_t_,_ _M_a_t_) │ │ │ │ + 110. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_,_ _i_n_t_) │ │ │ │ + 111. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ + 112. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 113. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ + 114. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 115. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_,_ _i_n_t_, │ │ │ │ _M_a_t_) │ │ │ │ - 81. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_,_ _i_n_t_) │ │ │ │ - 82. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ - 83. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 84. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_,_ _i_n_t_) │ │ │ │ - 85. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_) │ │ │ │ - 86. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 87. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 88. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_, │ │ │ │ + 116. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_,_ _i_n_t_) │ │ │ │ + 117. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ + 118. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 119. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_,_ _i_n_t_) │ │ │ │ + 120. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_) │ │ │ │ + 121. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 122. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 123. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_, │ │ │ │ _M_a_t_) │ │ │ │ - 89. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ - 90. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 91. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 92. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 93. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _U_s_a_c_P_a_r_a_m_s_) │ │ │ │ - 94. _d_e_c_o_m_p_o_s_e_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 95. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_, │ │ │ │ + 124. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ + 125. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 126. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ + 127. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 128. _f_i_n_d_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _U_s_a_c_P_a_r_a_m_s_) │ │ │ │ + 129. _d_e_c_o_m_p_o_s_e_E_s_s_e_n_t_i_a_l_M_a_t_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 130. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_, │ │ │ │ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_,_ _M_a_t_) │ │ │ │ - 96. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_, │ │ │ │ + 131. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_, │ │ │ │ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ - 97. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_, │ │ │ │ + 132. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_, │ │ │ │ _d_o_u_b_l_e_) │ │ │ │ - 98. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 99. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 100. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 101. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 102. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_,_ _M_a_t_) │ │ │ │ - 103. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_) │ │ │ │ - 104. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 105. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 106. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 107. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _M_a_t_) │ │ │ │ - 108. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 109. _c_o_m_p_u_t_e_C_o_r_r_e_s_p_o_n_d_E_p_i_l_i_n_e_s_(_M_a_t_,_ _i_n_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 110. _t_r_i_a_n_g_u_l_a_t_e_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 111. _c_o_r_r_e_c_t_M_a_t_c_h_e_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 112. _s_a_m_p_s_o_n_D_i_s_t_a_n_c_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 113. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_3_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ - 114. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_3_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 115. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_3_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 116. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_3_D_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_[_]_,_ _b_o_o_l_e_a_n_) │ │ │ │ - 117. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_3_D_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_[_]_) │ │ │ │ - 118. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_3_D_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 119. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_3_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ - 120. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_3_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 121. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_3_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 122. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_,_ _d_o_u_b_l_e_,_ _l_o_n_g_) │ │ │ │ - 123. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_,_ _d_o_u_b_l_e_) │ │ │ │ - 124. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_) │ │ │ │ - 125. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 126. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 127. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 128. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 129. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _U_s_a_c_P_a_r_a_m_s_) │ │ │ │ - 130. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_P_a_r_t_i_a_l_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_,_ _d_o_u_b_l_e_, │ │ │ │ + 133. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ + 134. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 135. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 136. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 137. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_,_ _M_a_t_) │ │ │ │ + 138. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _P_o_i_n_t_) │ │ │ │ + 139. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 140. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 141. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 142. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _M_a_t_) │ │ │ │ + 143. _r_e_c_o_v_e_r_P_o_s_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 144. _c_o_m_p_u_t_e_C_o_r_r_e_s_p_o_n_d_E_p_i_l_i_n_e_s_(_M_a_t_,_ _i_n_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 145. _t_r_i_a_n_g_u_l_a_t_e_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 146. _c_o_r_r_e_c_t_M_a_t_c_h_e_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 147. _s_a_m_p_s_o_n_D_i_s_t_a_n_c_e_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 148. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_3_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ + 149. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_3_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 150. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_3_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 151. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_3_D_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_[_]_,_ _b_o_o_l_e_a_n_) │ │ │ │ + 152. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_3_D_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_[_]_) │ │ │ │ + 153. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_3_D_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 154. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_3_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ + 155. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_3_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 156. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_3_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 157. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_,_ _d_o_u_b_l_e_,_ _l_o_n_g_) │ │ │ │ + 158. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_,_ _d_o_u_b_l_e_) │ │ │ │ + 159. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_) │ │ │ │ + 160. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 161. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ + 162. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 163. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 164. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _U_s_a_c_P_a_r_a_m_s_) │ │ │ │ + 165. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_P_a_r_t_i_a_l_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_,_ _d_o_u_b_l_e_, │ │ │ │ _l_o_n_g_) │ │ │ │ - 131. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_P_a_r_t_i_a_l_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_,_ _d_o_u_b_l_e_) │ │ │ │ - 132. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_P_a_r_t_i_a_l_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_) │ │ │ │ - 133. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_P_a_r_t_i_a_l_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 134. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_P_a_r_t_i_a_l_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 135. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_P_a_r_t_i_a_l_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 136. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_P_a_r_t_i_a_l_2_D_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 137. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_,_ _d_o_u_b_l_e_, │ │ │ │ + 166. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_P_a_r_t_i_a_l_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_,_ _d_o_u_b_l_e_) │ │ │ │ + 167. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_P_a_r_t_i_a_l_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_) │ │ │ │ + 168. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_P_a_r_t_i_a_l_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 169. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_P_a_r_t_i_a_l_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ + 170. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_P_a_r_t_i_a_l_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 171. _e_s_t_i_m_a_t_e_A_f_f_i_n_e_P_a_r_t_i_a_l_2_D_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 172. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_,_ _d_o_u_b_l_e_, │ │ │ │ _l_o_n_g_) │ │ │ │ - 138. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_,_ _d_o_u_b_l_e_) │ │ │ │ - 139. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_) │ │ │ │ - 140. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 141. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 142. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 143. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_2_D_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 144. _d_e_c_o_m_p_o_s_e_H_o_m_o_g_r_a_p_h_y_M_a_t_(_M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_,_ _L_i_s_t_) │ │ │ │ - 145. _f_i_l_t_e_r_H_o_m_o_g_r_a_p_h_y_D_e_c_o_m_p_B_y_V_i_s_i_b_l_e_R_e_f_p_o_i_n_t_s_(_L_i_s_t_,_ _L_i_s_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ + 173. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_,_ _d_o_u_b_l_e_) │ │ │ │ + 174. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _l_o_n_g_) │ │ │ │ + 175. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 176. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ + 177. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_2_D_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 178. _e_s_t_i_m_a_t_e_T_r_a_n_s_l_a_t_i_o_n_2_D_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 179. _d_e_c_o_m_p_o_s_e_H_o_m_o_g_r_a_p_h_y_M_a_t_(_M_a_t_,_ _M_a_t_,_ _L_i_s_t_,_ _L_i_s_t_,_ _L_i_s_t_) │ │ │ │ + 180. _f_i_l_t_e_r_H_o_m_o_g_r_a_p_h_y_D_e_c_o_m_p_B_y_V_i_s_i_b_l_e_R_e_f_p_o_i_n_t_s_(_L_i_s_t_,_ _L_i_s_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ _M_a_t_) │ │ │ │ - 146. _f_i_l_t_e_r_H_o_m_o_g_r_a_p_h_y_D_e_c_o_m_p_B_y_V_i_s_i_b_l_e_R_e_f_p_o_i_n_t_s_(_L_i_s_t_,_ _L_i_s_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 147. _c_a_l_i_b_r_a_t_i_o_n_M_a_t_r_i_x_V_a_l_u_e_s_(_M_a_t_,_ _S_i_z_e_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_[_]_,_ _d_o_u_b_l_e │ │ │ │ + 181. _f_i_l_t_e_r_H_o_m_o_g_r_a_p_h_y_D_e_c_o_m_p_B_y_V_i_s_i_b_l_e_R_e_f_p_o_i_n_t_s_(_L_i_s_t_,_ _L_i_s_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 182. _c_a_l_i_b_r_a_t_i_o_n_M_a_t_r_i_x_V_a_l_u_e_s_(_M_a_t_,_ _S_i_z_e_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_[_]_,_ _d_o_u_b_l_e │ │ │ │ _[_]_,_ _d_o_u_b_l_e_[_]_,_ _P_o_i_n_t_,_ _d_o_u_b_l_e_[_]_) │ │ │ │ - 148. _g_e_t_D_e_f_a_u_l_t_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_(_M_a_t_,_ _S_i_z_e_,_ _b_o_o_l_e_a_n_) │ │ │ │ - 149. _g_e_t_D_e_f_a_u_l_t_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_(_M_a_t_,_ _S_i_z_e_) │ │ │ │ - 150. _g_e_t_D_e_f_a_u_l_t_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_(_M_a_t_) │ │ │ │ - 151. _g_e_t_O_p_t_i_m_a_l_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_,_ _d_o_u_b_l_e_,_ _S_i_z_e_,_ _R_e_c_t_, │ │ │ │ + 183. _g_e_t_D_e_f_a_u_l_t_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_(_M_a_t_,_ _S_i_z_e_,_ _b_o_o_l_e_a_n_) │ │ │ │ + 184. _g_e_t_D_e_f_a_u_l_t_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_(_M_a_t_,_ _S_i_z_e_) │ │ │ │ + 185. _g_e_t_D_e_f_a_u_l_t_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_(_M_a_t_) │ │ │ │ + 186. _g_e_t_O_p_t_i_m_a_l_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_,_ _d_o_u_b_l_e_,_ _S_i_z_e_,_ _R_e_c_t_, │ │ │ │ _b_o_o_l_e_a_n_) │ │ │ │ - 152. _g_e_t_O_p_t_i_m_a_l_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_,_ _d_o_u_b_l_e_,_ _S_i_z_e_,_ _R_e_c_t_) │ │ │ │ - 153. _g_e_t_O_p_t_i_m_a_l_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_,_ _d_o_u_b_l_e_,_ _S_i_z_e_) │ │ │ │ - 154. _g_e_t_O_p_t_i_m_a_l_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_,_ _d_o_u_b_l_e_) │ │ │ │ - 155. _u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ + 187. _g_e_t_O_p_t_i_m_a_l_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_,_ _d_o_u_b_l_e_,_ _S_i_z_e_,_ _R_e_c_t_) │ │ │ │ + 188. _g_e_t_O_p_t_i_m_a_l_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_,_ _d_o_u_b_l_e_,_ _S_i_z_e_) │ │ │ │ + 189. _g_e_t_O_p_t_i_m_a_l_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_,_ _d_o_u_b_l_e_) │ │ │ │ + 190. _u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_, │ │ │ │ _T_e_r_m_C_r_i_t_e_r_i_a_) │ │ │ │ - 156. _u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 157. _u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 158. _u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 159. _u_n_d_i_s_t_o_r_t_I_m_a_g_e_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _T_e_r_m_C_r_i_t_e_r_i_a_) │ │ │ │ - 160. _u_n_d_i_s_t_o_r_t_I_m_a_g_e_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 161. _f_i_s_h_e_y_e___p_r_o_j_e_c_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _M_a_t_) │ │ │ │ - 162. _f_i_s_h_e_y_e___p_r_o_j_e_c_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 163. _f_i_s_h_e_y_e___p_r_o_j_e_c_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 164. _f_i_s_h_e_y_e___d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 165. _f_i_s_h_e_y_e___d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 166. _f_i_s_h_e_y_e___d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 167. _f_i_s_h_e_y_e___d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 168. _f_i_s_h_e_y_e___u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _T_e_r_m_C_r_i_t_e_r_i_a_) │ │ │ │ - 169. _f_i_s_h_e_y_e___u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 170. _f_i_s_h_e_y_e___u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 171. _f_i_s_h_e_y_e___u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 172. _f_i_s_h_e_y_e___e_s_t_i_m_a_t_e_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_F_o_r_U_n_d_i_s_t_o_r_t_R_e_c_t_i_f_y_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_, │ │ │ │ + 191. _u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 192. _u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 193. _u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 194. _u_n_d_i_s_t_o_r_t_I_m_a_g_e_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _T_e_r_m_C_r_i_t_e_r_i_a_) │ │ │ │ + 195. _u_n_d_i_s_t_o_r_t_I_m_a_g_e_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 196. _f_i_s_h_e_y_e___p_r_o_j_e_c_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _M_a_t_) │ │ │ │ + 197. _f_i_s_h_e_y_e___p_r_o_j_e_c_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 198. _f_i_s_h_e_y_e___p_r_o_j_e_c_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 199. _f_i_s_h_e_y_e___d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 200. _f_i_s_h_e_y_e___d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 201. _f_i_s_h_e_y_e___d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 202. _f_i_s_h_e_y_e___d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 203. _f_i_s_h_e_y_e___u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _T_e_r_m_C_r_i_t_e_r_i_a_) │ │ │ │ + 204. _f_i_s_h_e_y_e___u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 205. _f_i_s_h_e_y_e___u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 206. _f_i_s_h_e_y_e___u_n_d_i_s_t_o_r_t_P_o_i_n_t_s_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 207. _f_i_s_h_e_y_e___e_s_t_i_m_a_t_e_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_F_o_r_U_n_d_i_s_t_o_r_t_R_e_c_t_i_f_y_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_, │ │ │ │ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _S_i_z_e_,_ _d_o_u_b_l_e_) │ │ │ │ - 173. _f_i_s_h_e_y_e___e_s_t_i_m_a_t_e_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_F_o_r_U_n_d_i_s_t_o_r_t_R_e_c_t_i_f_y_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_, │ │ │ │ + 208. _f_i_s_h_e_y_e___e_s_t_i_m_a_t_e_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_F_o_r_U_n_d_i_s_t_o_r_t_R_e_c_t_i_f_y_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_, │ │ │ │ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _S_i_z_e_) │ │ │ │ - 174. _f_i_s_h_e_y_e___e_s_t_i_m_a_t_e_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_F_o_r_U_n_d_i_s_t_o_r_t_R_e_c_t_i_f_y_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_, │ │ │ │ + 209. _f_i_s_h_e_y_e___e_s_t_i_m_a_t_e_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_F_o_r_U_n_d_i_s_t_o_r_t_R_e_c_t_i_f_y_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_, │ │ │ │ _M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 175. _f_i_s_h_e_y_e___e_s_t_i_m_a_t_e_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_F_o_r_U_n_d_i_s_t_o_r_t_R_e_c_t_i_f_y_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_, │ │ │ │ + 210. _f_i_s_h_e_y_e___e_s_t_i_m_a_t_e_N_e_w_C_a_m_e_r_a_M_a_t_r_i_x_F_o_r_U_n_d_i_s_t_o_r_t_R_e_c_t_i_f_y_(_M_a_t_,_ _M_a_t_,_ _S_i_z_e_, │ │ │ │ _M_a_t_,_ _M_a_t_) │ │ │ │ - 176. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_, │ │ │ │ + 211. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_, │ │ │ │ _T_e_r_m_C_r_i_t_e_r_i_a_) │ │ │ │ - 177. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_) │ │ │ │ - 178. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ - 179. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 180. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_, │ │ │ │ + 212. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_) │ │ │ │ + 213. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ + 214. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ + 215. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_, │ │ │ │ _f_l_o_a_t_,_ _d_o_u_b_l_e_,_ _M_a_t_,_ _i_n_t_,_ _T_e_r_m_C_r_i_t_e_r_i_a_) │ │ │ │ - 181. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_, │ │ │ │ + 216. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_, │ │ │ │ _f_l_o_a_t_,_ _d_o_u_b_l_e_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 182. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_, │ │ │ │ + 217. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_, │ │ │ │ _f_l_o_a_t_,_ _d_o_u_b_l_e_,_ _M_a_t_) │ │ │ │ - 183. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_, │ │ │ │ + 218. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_, │ │ │ │ _f_l_o_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 184. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_, │ │ │ │ + 219. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_, │ │ │ │ _f_l_o_a_t_) │ │ │ │ - 185. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_) │ │ │ │ - 186. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ - 187. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 188. _a_p_p_r_o_x_P_o_l_y_D_P_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_,_ _d_o_u_b_l_e_,_ _b_o_o_l_e_a_n_) │ │ │ │ - 189. _a_p_p_r_o_x_P_o_l_y_N_(_M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _f_l_o_a_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ - 190. _a_p_p_r_o_x_P_o_l_y_N_(_M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _f_l_o_a_t_) │ │ │ │ - 191. _a_p_p_r_o_x_P_o_l_y_N_(_M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 192. _m_i_n_A_r_e_a_R_e_c_t_(_M_a_t_O_f_P_o_i_n_t_2_f_) │ │ │ │ - 193. _b_o_x_P_o_i_n_t_s_(_R_o_t_a_t_e_d_R_e_c_t_,_ _M_a_t_) │ │ │ │ - 194. _m_i_n_E_n_c_l_o_s_i_n_g_C_i_r_c_l_e_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _P_o_i_n_t_,_ _f_l_o_a_t_[_]_) │ │ │ │ - 195. _m_i_n_E_n_c_l_o_s_i_n_g_T_r_i_a_n_g_l_e_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 196. _m_i_n_E_n_c_l_o_s_i_n_g_C_o_n_v_e_x_P_o_l_y_g_o_n_(_M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 197. _m_o_m_e_n_t_s_(_M_a_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ - 198. _m_o_m_e_n_t_s_(_M_a_t_) │ │ │ │ - 199. _H_u_M_o_m_e_n_t_s_(_M_o_m_e_n_t_s_,_ _M_a_t_) │ │ │ │ - 200. _m_a_t_c_h_S_h_a_p_e_s_(_M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 201. _c_o_n_v_e_x_H_u_l_l_(_M_a_t_O_f_P_o_i_n_t_,_ _M_a_t_O_f_I_n_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ - 202. _c_o_n_v_e_x_H_u_l_l_(_M_a_t_O_f_P_o_i_n_t_,_ _M_a_t_O_f_I_n_t_) │ │ │ │ - 203. _c_o_n_v_e_x_i_t_y_D_e_f_e_c_t_s_(_M_a_t_O_f_P_o_i_n_t_,_ _M_a_t_O_f_I_n_t_,_ _M_a_t_O_f_I_n_t_4_) │ │ │ │ - 204. _i_s_C_o_n_t_o_u_r_C_o_n_v_e_x_(_M_a_t_O_f_P_o_i_n_t_) │ │ │ │ - 205. _i_n_t_e_r_s_e_c_t_C_o_n_v_e_x_C_o_n_v_e_x_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ - 206. _i_n_t_e_r_s_e_c_t_C_o_n_v_e_x_C_o_n_v_e_x_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 207. _f_i_t_E_l_l_i_p_s_e_(_M_a_t_O_f_P_o_i_n_t_2_f_) │ │ │ │ - 208. _f_i_t_E_l_l_i_p_s_e_A_M_S_(_M_a_t_) │ │ │ │ - 209. _f_i_t_E_l_l_i_p_s_e_D_i_r_e_c_t_(_M_a_t_) │ │ │ │ - 210. _g_e_t_C_l_o_s_e_s_t_E_l_l_i_p_s_e_P_o_i_n_t_s_(_R_o_t_a_t_e_d_R_e_c_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ - 211. _f_i_t_L_i_n_e_(_M_a_t_,_ _M_a_t_,_ _i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ - 212. _p_o_i_n_t_P_o_l_y_g_o_n_T_e_s_t_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _P_o_i_n_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ - 213. _r_o_t_a_t_e_d_R_e_c_t_a_n_g_l_e_I_n_t_e_r_s_e_c_t_i_o_n_(_R_o_t_a_t_e_d_R_e_c_t_,_ _R_o_t_a_t_e_d_R_e_c_t_,_ _M_a_t_) │ │ │ │ - 214. _a_r_c_L_e_n_g_t_h_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _b_o_o_l_e_a_n_) │ │ │ │ - 215. _c_o_n_t_o_u_r_A_r_e_a_(_M_a_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ - 216. _c_o_n_t_o_u_r_A_r_e_a_(_M_a_t_) │ │ │ │ - 217. _b_o_u_n_d_i_n_g_R_e_c_t_(_M_a_t_) │ │ │ │ - 218. _g_e_t_R_o_t_a_t_i_o_n_M_a_t_r_i_x_2_D_(_P_o_i_n_t_,_ _d_o_u_b_l_e_,_ _d_o_u_b_l_e_) │ │ │ │ - 219. _i_n_v_e_r_t_A_f_f_i_n_e_T_r_a_n_s_f_o_r_m_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 220. _g_e_t_P_e_r_s_p_e_c_t_i_v_e_T_r_a_n_s_f_o_r_m_(_M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 221. _g_e_t_P_e_r_s_p_e_c_t_i_v_e_T_r_a_n_s_f_o_r_m_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 222. _g_e_t_A_f_f_i_n_e_T_r_a_n_s_f_o_r_m_(_M_a_t_O_f_P_o_i_n_t_2_f_,_ _M_a_t_O_f_P_o_i_n_t_2_f_) │ │ │ │ + 220. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_,_ _i_n_t_) │ │ │ │ + 221. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _b_o_o_l_e_a_n_) │ │ │ │ + 222. _f_i_s_h_e_y_e___s_o_l_v_e_P_n_P_R_a_n_s_a_c_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ Hide sidebar [Hide sidebar][Show sidebar] Show sidebar │ │ │ │ ************ CCllaassss GGeeoommeettrryy ************ │ │ │ │ _j_a_v_a_._l_a_n_g_._O_b_j_e_c_t │ │ │ │ org.opencv.geometry.Geometry │ │ │ │ =============================================================================== │ │ │ │ public class Geometry extends _O_b_j_e_c_t │ │ │ │ * ********** FFiieelldd SSuummmmaarryy ********** │ │ │ │ @@ -1840,14 +1840,716 @@ │ │ │ │ public static final int VariableType_SE3 │ │ │ │ See Also: │ │ │ │ # _C_o_n_s_t_a_n_t_ _F_i_e_l_d_ _V_a_l_u_e_s │ │ │ │ * ********** CCoonnssttrruuccttoorr DDeettaaiillss ********** │ │ │ │ o ******** GGeeoommeettrryy ******** │ │ │ │ public Geometry() │ │ │ │ * ********** MMeetthhoodd DDeettaaiillss ********** │ │ │ │ + o ******** aapppprrooxxPPoollyyDDPP ******** │ │ │ │ + public static void approxPolyDP(_M_a_t_O_f_P_o_i_n_t_2_f curve, │ │ │ │ + _M_a_t_O_f_P_o_i_n_t_2_f approxCurve, double epsilon, boolean closed) │ │ │ │ + Approximates a polygonal curve(s) with the specified precision. T │ │ │ │ + he function cv::approxPolyDP approximates a curve or a p*olygon │ │ │ │ + with another curve/polygon with less vertices so that the distance │ │ │ │ + between them is less or equal to the specified precision. It uses │ │ │ │ + the Douglas-Peucker algorithm │ │ │ │ + Parameters: │ │ │ │ + curve - Input vector of a 2D point stored in std::vector or │ │ │ │ + Mat │ │ │ │ + approxCurve - Result of the approximation. The type should │ │ │ │ + match the type of the input curve. │ │ │ │ + epsilon - Parameter specifying the approximation accuracy. │ │ │ │ + This is the maximum distance between the original curve and │ │ │ │ + its approximation. │ │ │ │ + closed - If true, the approximated curve is closed (its first │ │ │ │ + and last vertices are connected). Otherwise, it is not │ │ │ │ + closed. │ │ │ │ + o ******** aapppprrooxxPPoollyyNN ******** │ │ │ │ + public static void approxPolyN(_M_a_t curve, _M_a_t approxCurve, │ │ │ │ + int nsides, float epsilon_percentage, boolean ensure_convex) │ │ │ │ + Approximates a polygon with a convex hull with a specified accuracy │ │ │ │ + and number of sides. T he cv::approxPolyN function approximates a │ │ │ │ + polygon with *a convex hull so that the difference between the │ │ │ │ + contour area of the original contour and the new polygon is │ │ │ │ + minimal. It uses a greedy algorithm for contracting two vertices │ │ │ │ + into one in such a way that the additional area is minimal. │ │ │ │ + Straight lines formed by each edge of the convex contour are drawn │ │ │ │ + and the areas of the resulting triangles are considered. Each │ │ │ │ + vertex will lie either on the original contour or outside it. The │ │ │ │ + algorithm based on the paper CITE: LowIlie2003 . │ │ │ │ + Parameters: │ │ │ │ + curve - Input vector of a 2D points stored in std::vector or │ │ │ │ + Mat, points must be float or integer. │ │ │ │ + approxCurve - Result of the approximation. The type is vector │ │ │ │ + of a 2D point (Point2f or Point) in std::vector or Mat. │ │ │ │ + nsides - The parameter defines the number of sides of the │ │ │ │ + result polygon. │ │ │ │ + epsilon_percentage - defines the percentage of the maximum of │ │ │ │ + additional area. If it equals -1, it is not used. Otherwise │ │ │ │ + algorithm stops if additional area is greater than │ │ │ │ + contourArea(_curve) * percentage. If additional area exceeds │ │ │ │ + the limit, algorithm returns as many vertices as there were │ │ │ │ + at the moment the limit was exceeded. │ │ │ │ + ensure_convex - If it is true, algorithm creates a convex │ │ │ │ + hull of input contour. Otherwise input vector should be │ │ │ │ + convex. │ │ │ │ + o ******** aapppprrooxxPPoollyyNN ******** │ │ │ │ + public static void approxPolyN(_M_a_t curve, _M_a_t approxCurve, │ │ │ │ + int nsides, float epsilon_percentage) │ │ │ │ + Approximates a polygon with a convex hull with a specified accuracy │ │ │ │ + and number of sides. T he cv::approxPolyN function approximates a │ │ │ │ + polygon with *a convex hull so that the difference between the │ │ │ │ + contour area of the original contour and the new polygon is │ │ │ │ + minimal. It uses a greedy algorithm for contracting two vertices │ │ │ │ + into one in such a way that the additional area is minimal. │ │ │ │ + Straight lines formed by each edge of the convex contour are drawn │ │ │ │ + and the areas of the resulting triangles are considered. Each │ │ │ │ + vertex will lie either on the original contour or outside it. The │ │ │ │ + algorithm based on the paper CITE: LowIlie2003 . │ │ │ │ + Parameters: │ │ │ │ + curve - Input vector of a 2D points stored in std::vector or │ │ │ │ + Mat, points must be float or integer. │ │ │ │ + approxCurve - Result of the approximation. The type is vector │ │ │ │ + of a 2D point (Point2f or Point) in std::vector or Mat. │ │ │ │ + nsides - The parameter defines the number of sides of the │ │ │ │ + result polygon. │ │ │ │ + epsilon_percentage - defines the percentage of the maximum of │ │ │ │ + additional area. If it equals -1, it is not used. Otherwise │ │ │ │ + algorithm stops if additional area is greater than │ │ │ │ + contourArea(_curve) * percentage. If additional area exceeds │ │ │ │ + the limit, algorithm returns as many vertices as there were │ │ │ │ + at the moment the limit was exceeded. │ │ │ │ + o ******** aapppprrooxxPPoollyyNN ******** │ │ │ │ + public static void approxPolyN(_M_a_t curve, _M_a_t approxCurve, │ │ │ │ + int nsides) │ │ │ │ + Approximates a polygon with a convex hull with a specified accuracy │ │ │ │ + and number of sides. T he cv::approxPolyN function approximates a │ │ │ │ + polygon with *a convex hull so that the difference between the │ │ │ │ + contour area of the original contour and the new polygon is │ │ │ │ + minimal. It uses a greedy algorithm for contracting two vertices │ │ │ │ + into one in such a way that the additional area is minimal. │ │ │ │ + Straight lines formed by each edge of the convex contour are drawn │ │ │ │ + and the areas of the resulting triangles are considered. Each │ │ │ │ + vertex will lie either on the original contour or outside it. The │ │ │ │ + algorithm based on the paper CITE: LowIlie2003 . │ │ │ │ + Parameters: │ │ │ │ + curve - Input vector of a 2D points stored in std::vector or │ │ │ │ + Mat, points must be float or integer. │ │ │ │ + approxCurve - Result of the approximation. The type is vector │ │ │ │ + of a 2D point (Point2f or Point) in std::vector or Mat. │ │ │ │ + nsides - The parameter defines the number of sides of the │ │ │ │ + result polygon. If it equals -1, it is not used. Otherwise │ │ │ │ + algorithm stops if additional area is greater than │ │ │ │ + contourArea(_curve) * percentage. If additional area exceeds │ │ │ │ + the limit, algorithm returns as many vertices as there were │ │ │ │ + at the moment the limit was exceeded. │ │ │ │ + o ******** mmiinnAArreeaaRReecctt ******** │ │ │ │ + public static _R_o_t_a_t_e_d_R_e_c_t minAreaRect(_M_a_t_O_f_P_o_i_n_t_2_f points) │ │ │ │ + Finds a rotated rectangle of the minimum area enclosing the input │ │ │ │ + 2D point set. The function calculates and returns the minimum-area │ │ │ │ + bounding rectangle (possibly rotated) for a specified point set. │ │ │ │ + The angle of rotation represents the angle between the line │ │ │ │ + connecting the starting and ending points (based on the clockwise │ │ │ │ + order with greatest index for the corner with greatest \(y\)) and │ │ │ │ + the horizontal axis. This angle always falls between \([-90, 0)\) │ │ │ │ + because, if the object rotates more than a rect angle, the next │ │ │ │ + edge is used to measure the angle. The starting and ending points │ │ │ │ + change as the object rotates.Developer should keep in mind that the │ │ │ │ + returned RotatedRect can contain negative indices when data is │ │ │ │ + close to the containing Mat element boundary. │ │ │ │ + Parameters: │ │ │ │ + points - Input vector of 2D points, stored in std::vector<> │ │ │ │ + or Mat │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** bbooxxPPooiinnttss ******** │ │ │ │ + public static void boxPoints(_R_o_t_a_t_e_d_R_e_c_t box, _M_a_t points) │ │ │ │ + Finds the four vertices of a rotated rect. Useful to draw the │ │ │ │ + rotated rectangle. The function finds the four vertices of a │ │ │ │ + rotated rectangle. The four vertices are returned in clockwise │ │ │ │ + order starting from the point with greatest \(y\). If two points │ │ │ │ + have the same \(y\) coordinate the rightmost is the starting point. │ │ │ │ + This function is useful to draw the rectangle. In C++, instead of │ │ │ │ + using this function, you can directly use RotatedRect::points │ │ │ │ + method. Please visit the REF: tutorial_bounding_rotated_ellipses │ │ │ │ + "tutorial on Creating Bounding rotated boxes and ellipses for │ │ │ │ + contours" for more information. │ │ │ │ + Parameters: │ │ │ │ + box - The input rotated rectangle. It may be the output of │ │ │ │ + REF: minAreaRect. │ │ │ │ + points - The output array of four vertices of rectangles. │ │ │ │ + o ******** mmiinnEEnncclloossiinnggCCiirrccllee ******** │ │ │ │ + public static void minEnclosingCircle(_M_a_t_O_f_P_o_i_n_t_2_f points, │ │ │ │ + _P_o_i_n_t center, float[] radius) │ │ │ │ + Finds a circle of the minimum area enclosing a 2D point set. The │ │ │ │ + function finds the minimal enclosing circle of a 2D point set using │ │ │ │ + an iterative algorithm. │ │ │ │ + Parameters: │ │ │ │ + points - Input vector of 2D points, stored in std::vector<> │ │ │ │ + or Mat │ │ │ │ + center - Output center of the circle. │ │ │ │ + radius - Output radius of the circle. │ │ │ │ + o ******** mmiinnEEnncclloossiinnggTTrriiaannggllee ******** │ │ │ │ + public static double minEnclosingTriangle(_M_a_t points, _M_a_t triangle) │ │ │ │ + Finds a triangle of minimum area enclosing a 2D point set and │ │ │ │ + returns its area. The function finds a triangle of minimum area │ │ │ │ + enclosing the given set of 2D points and returns its area. The │ │ │ │ + output for a given 2D point set is shown in the image below. 2D │ │ │ │ + points are depicted in red* and the enclosing triangle in *yellow*. │ │ │ │ + ![Sample output of the minimum enclosing triangle function](pics/ │ │ │ │ + minenclosingtriangle.png) The implementation of the algorithm is │ │ │ │ + based on O'Rourke's CITE: ORourke86 and Klee and Laskowski's CITE: │ │ │ │ + KleeLaskowski85 papers. O'Rourke provides a \(\theta(n)\) algorithm │ │ │ │ + for finding the minimal enclosing triangle of a 2D convex polygon │ │ │ │ + with n vertices. Since the #minEnclosingTriangle function takes a │ │ │ │ + 2D point set as input an additional preprocessing step of computing │ │ │ │ + the convex hull of the 2D point set is required. The complexity of │ │ │ │ + the #convexHull function is \(O(n log(n))\) which is higher than \ │ │ │ │ + (\theta(n)\). Thus the overall complexity of the function is \(O(n │ │ │ │ + log(n))\). │ │ │ │ + Parameters: │ │ │ │ + points - Input vector of 2D points with depth CV_32S or │ │ │ │ + CV_32F, stored in std::vector<> or Mat │ │ │ │ + triangle - Output vector of three 2D points defining the │ │ │ │ + vertices of the triangle. The depth of the OutputArray must │ │ │ │ + be CV_32F. │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** mmiinnEEnncclloossiinnggCCoonnvveexxPPoollyyggoonn ******** │ │ │ │ + public static double minEnclosingConvexPolygon(_M_a_t points, │ │ │ │ + _M_a_t polygon, int k) │ │ │ │ + Finds a convex polygon of minimum area enclosing a 2D point set and │ │ │ │ + returns its area. This function takes a given set of 2D points and │ │ │ │ + finds the enclosing polygon with k vertices and minimal area. It │ │ │ │ + takes the set of points and the parameter k as input and returns │ │ │ │ + the area of the minimal enclosing polygon. The Implementation is │ │ │ │ + based on a paper by Aggarwal, Chang and Yap CITE: Aggarwal1985. │ │ │ │ + They provide a \(\theta(n²log(n)log(k))\) algorithm for finding the │ │ │ │ + minimal convex polygon with k vertices enclosing a 2D convex │ │ │ │ + polygon with n vertices (k < n). Since the │ │ │ │ + #minEnclosingConvexPolygon function takes a 2D point set as input, │ │ │ │ + an additional preprocessing step of computing the convex hull of │ │ │ │ + the 2D point set is required. The complexity of the #convexHull │ │ │ │ + function is \(O(n log(n))\) which is lower than \(\theta(n²log │ │ │ │ + (n)log(k))\). Thus the overall complexity of the function is \(O │ │ │ │ + (n²log(n)log(k))\). │ │ │ │ + Parameters: │ │ │ │ + points - Input vector of 2D points, stored in std::vector<> │ │ │ │ + or Mat │ │ │ │ + polygon - Output vector of 2D points defining the vertices of │ │ │ │ + the enclosing polygon │ │ │ │ + k - Number of vertices of the output polygon │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** mmoommeennttss ******** │ │ │ │ + public static _M_o_m_e_n_t_s moments(_M_a_t array, boolean binaryImage) │ │ │ │ + Calculates all of the moments up to the third order of a polygon or │ │ │ │ + rasterized shape. The function computes moments, up to the 3rd │ │ │ │ + order, of a vector shape or a rasterized shape. The results are │ │ │ │ + returned in the structure cv::Moments. │ │ │ │ + Parameters: │ │ │ │ + array - Single channel raster image (CV_8U, CV_16U, CV_16S, │ │ │ │ + CV_32F, CV_64F) or an array ( \(1 \times N\) or \(N \times │ │ │ │ + 1\) ) of 2D points (Point or Point2f). │ │ │ │ + binaryImage - If it is true, all non-zero image pixels are │ │ │ │ + treated as 1's. The parameter is used for images only. │ │ │ │ + Returns: │ │ │ │ + moments. NNoottee:: Only applicable to contour moments │ │ │ │ + calculations from Python bindings: Note that the numpy type │ │ │ │ + for the input array should be either np.int32 or np.float32. │ │ │ │ + NNoottee:: For contour-based moments, the zeroth-order moment \c │ │ │ │ + m00 represents the contour area. If the input contour is │ │ │ │ + degenerate (for example, a single point or all points are │ │ │ │ + collinear), the area is zero and therefore \c m00 == 0. In │ │ │ │ + this case, the centroid coordinates (\c m10/m00, \c m01/m00) │ │ │ │ + are undefined and must be handled explicitly by the caller. A │ │ │ │ + common workaround is to compute the center using cv:: │ │ │ │ + boundingRect() or by averaging the input points. SEE: │ │ │ │ + contourArea, arcLength │ │ │ │ + o ******** mmoommeennttss ******** │ │ │ │ + public static _M_o_m_e_n_t_s moments(_M_a_t array) │ │ │ │ + Calculates all of the moments up to the third order of a polygon or │ │ │ │ + rasterized shape. The function computes moments, up to the 3rd │ │ │ │ + order, of a vector shape or a rasterized shape. The results are │ │ │ │ + returned in the structure cv::Moments. │ │ │ │ + Parameters: │ │ │ │ + array - Single channel raster image (CV_8U, CV_16U, CV_16S, │ │ │ │ + CV_32F, CV_64F) or an array ( \(1 \times N\) or \(N \times │ │ │ │ + 1\) ) of 2D points (Point or Point2f). used for images only. │ │ │ │ + Returns: │ │ │ │ + moments. NNoottee:: Only applicable to contour moments │ │ │ │ + calculations from Python bindings: Note that the numpy type │ │ │ │ + for the input array should be either np.int32 or np.float32. │ │ │ │ + NNoottee:: For contour-based moments, the zeroth-order moment \c │ │ │ │ + m00 represents the contour area. If the input contour is │ │ │ │ + degenerate (for example, a single point or all points are │ │ │ │ + collinear), the area is zero and therefore \c m00 == 0. In │ │ │ │ + this case, the centroid coordinates (\c m10/m00, \c m01/m00) │ │ │ │ + are undefined and must be handled explicitly by the caller. A │ │ │ │ + common workaround is to compute the center using cv:: │ │ │ │ + boundingRect() or by averaging the input points. SEE: │ │ │ │ + contourArea, arcLength │ │ │ │ + o ******** HHuuMMoommeennttss ******** │ │ │ │ + public static void HuMoments(_M_o_m_e_n_t_s m, _M_a_t hu) │ │ │ │ + o ******** mmaattcchhSShhaappeess ******** │ │ │ │ + public static double matchShapes(_M_a_t contour1, _M_a_t contour2, │ │ │ │ + int method, double parameter) │ │ │ │ + Compares two shapes. The function compares two shapes. All three │ │ │ │ + implemented methods use the Hu invariants (see #HuMoments) │ │ │ │ + Parameters: │ │ │ │ + contour1 - First contour or grayscale image. │ │ │ │ + contour2 - Second contour or grayscale image. │ │ │ │ + method - Comparison method, see #ShapeMatchModes │ │ │ │ + parameter - Method-specific parameter (not supported now). │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** ccoonnvveexxHHuullll ******** │ │ │ │ + public static void convexHull(_M_a_t_O_f_P_o_i_n_t points, _M_a_t_O_f_I_n_t hull, │ │ │ │ + boolean clockwise) │ │ │ │ + Finds the convex hull of a point set. The function cv::convexHull │ │ │ │ + finds the convex hull of a 2D point set using the Sklansky's │ │ │ │ + algorithm CITE: Sklansky82 that has *O(N logN)* complexity in the │ │ │ │ + current implementation. │ │ │ │ + Parameters: │ │ │ │ + points - Input 2D point set, stored in std::vector or Mat. │ │ │ │ + hull - Output convex hull. It is either an integer vector of │ │ │ │ + indices or vector of points. In the first case, the hull │ │ │ │ + elements are 0-based indices of the convex hull points in the │ │ │ │ + original array (since the set of convex hull points is a │ │ │ │ + subset of the original point set). In the second case, hull │ │ │ │ + elements are the convex hull points themselves. │ │ │ │ + clockwise - Orientation flag. If it is true, the output │ │ │ │ + convex hull is oriented clockwise. Otherwise, it is oriented │ │ │ │ + counter-clockwise. The assumed coordinate system has its X │ │ │ │ + axis pointing to the right, and its Y axis pointing upwards. │ │ │ │ + returns convex hull points. Otherwise, it returns indices of │ │ │ │ + the convex hull points. When the output array is std::vector, │ │ │ │ + the flag is ignored, and the output depends on the type of │ │ │ │ + the vector: std::vector implies returnPoints=false, │ │ │ │ + std::vector implies returnPoints=true. NNoottee:: points │ │ │ │ + and hull should be different arrays, inplace processing isn't │ │ │ │ + supported. Check REF: tutorial_hull "the corresponding │ │ │ │ + tutorial" for more details. useful links: https:// │ │ │ │ + www.learnopencv.com/convex-hull-using-opencv-in-python-and-c/ │ │ │ │ + o ******** ccoonnvveexxHHuullll ******** │ │ │ │ + public static void convexHull(_M_a_t_O_f_P_o_i_n_t points, _M_a_t_O_f_I_n_t hull) │ │ │ │ + Finds the convex hull of a point set. The function cv::convexHull │ │ │ │ + finds the convex hull of a 2D point set using the Sklansky's │ │ │ │ + algorithm CITE: Sklansky82 that has *O(N logN)* complexity in the │ │ │ │ + current implementation. │ │ │ │ + Parameters: │ │ │ │ + points - Input 2D point set, stored in std::vector or Mat. │ │ │ │ + hull - Output convex hull. It is either an integer vector of │ │ │ │ + indices or vector of points. In the first case, the hull │ │ │ │ + elements are 0-based indices of the convex hull points in the │ │ │ │ + original array (since the set of convex hull points is a │ │ │ │ + subset of the original point set). In the second case, hull │ │ │ │ + elements are the convex hull points themselves. Otherwise, it │ │ │ │ + is oriented counter-clockwise. The assumed coordinate system │ │ │ │ + has its X axis pointing to the right, and its Y axis pointing │ │ │ │ + upwards. returns convex hull points. Otherwise, it returns │ │ │ │ + indices of the convex hull points. When the output array is │ │ │ │ + std::vector, the flag is ignored, and the output depends on │ │ │ │ + the type of the vector: std::vector implies │ │ │ │ + returnPoints=false, std::vector implies │ │ │ │ + returnPoints=true. NNoottee:: points and hull should be different │ │ │ │ + arrays, inplace processing isn't supported. Check REF: │ │ │ │ + tutorial_hull "the corresponding tutorial" for more details. │ │ │ │ + useful links: https://www.learnopencv.com/convex-hull-using- │ │ │ │ + opencv-in-python-and-c/ │ │ │ │ + o ******** ccoonnvveexxiittyyDDeeffeeccttss ******** │ │ │ │ + public static void convexityDefects(_M_a_t_O_f_P_o_i_n_t contour, │ │ │ │ + _M_a_t_O_f_I_n_t convexhull, _M_a_t_O_f_I_n_t_4 convexityDefects) │ │ │ │ + Finds the convexity defects of a contour. The figure below displays │ │ │ │ + convexity defects of a hand contour: ![image](pics/defects.png) │ │ │ │ + Parameters: │ │ │ │ + contour - Input contour. │ │ │ │ + convexhull - Convex hull obtained using convexHull that │ │ │ │ + should contain indices of the contour points that make the │ │ │ │ + hull. │ │ │ │ + convexityDefects - The output vector of convexity defects. In │ │ │ │ + C++ and the new Python/Java interface each convexity defect │ │ │ │ + is represented as 4-element integer vector (a.k.a. #Vec4i): │ │ │ │ + (start_index, end_index, farthest_pt_index, fixpt_depth), │ │ │ │ + where indices are 0-based indices in the original contour of │ │ │ │ + the convexity defect beginning, end and the farthest point, │ │ │ │ + and fixpt_depth is fixed-point approximation (with 8 │ │ │ │ + fractional bits) of the distance between the farthest contour │ │ │ │ + point and the hull. That is, to get the floating-point value │ │ │ │ + of the depth will be fixpt_depth/256.0. │ │ │ │ + o ******** iissCCoonnttoouurrCCoonnvveexx ******** │ │ │ │ + public static boolean isContourConvex(_M_a_t_O_f_P_o_i_n_t contour) │ │ │ │ + Tests a contour convexity. The function tests whether the input │ │ │ │ + contour is convex or not. The contour must be simple, that is, │ │ │ │ + without self-intersections. Otherwise, the function output is │ │ │ │ + undefined. │ │ │ │ + Parameters: │ │ │ │ + contour - Input vector of 2D points, stored in std::vector<> │ │ │ │ + or Mat │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** iinntteerrsseeccttCCoonnvveexxCCoonnvveexx ******** │ │ │ │ + public static float intersectConvexConvex(_M_a_t p1, _M_a_t p2, _M_a_t p12, │ │ │ │ + boolean handleNested) │ │ │ │ + Finds intersection of two convex polygons │ │ │ │ + Parameters: │ │ │ │ + p1 - First polygon │ │ │ │ + p2 - Second polygon │ │ │ │ + p12 - Output polygon describing the intersecting area │ │ │ │ + handleNested - When true, an intersection is found if one of │ │ │ │ + the polygons is fully enclosed in the other. When false, no │ │ │ │ + intersection is found. If the polygons share a side or the │ │ │ │ + vertex of one polygon lies on an edge of the other, they are │ │ │ │ + not considered nested and an intersection will be found │ │ │ │ + regardless of the value of handleNested. │ │ │ │ + Returns: │ │ │ │ + Area of intersecting polygon. May be negative, if algorithm │ │ │ │ + has not converged, e.g. non-convex input. NNoottee:: │ │ │ │ + intersectConvexConvex doesn't confirm that both polygons are │ │ │ │ + convex and will return invalid results if they aren't. │ │ │ │ + o ******** iinntteerrsseeccttCCoonnvveexxCCoonnvveexx ******** │ │ │ │ + public static float intersectConvexConvex(_M_a_t p1, _M_a_t p2, _M_a_t p12) │ │ │ │ + Finds intersection of two convex polygons │ │ │ │ + Parameters: │ │ │ │ + p1 - First polygon │ │ │ │ + p2 - Second polygon │ │ │ │ + p12 - Output polygon describing the intersecting area When │ │ │ │ + false, no intersection is found. If the polygons share a side │ │ │ │ + or the vertex of one polygon lies on an edge of the other, │ │ │ │ + they are not considered nested and an intersection will be │ │ │ │ + found regardless of the value of handleNested. │ │ │ │ + Returns: │ │ │ │ + Area of intersecting polygon. May be negative, if algorithm │ │ │ │ + has not converged, e.g. non-convex input. NNoottee:: │ │ │ │ + intersectConvexConvex doesn't confirm that both polygons are │ │ │ │ + convex and will return invalid results if they aren't. │ │ │ │ + o ******** ffiittEElllliippssee ******** │ │ │ │ + public static _R_o_t_a_t_e_d_R_e_c_t fitEllipse(_M_a_t_O_f_P_o_i_n_t_2_f points) │ │ │ │ + Fits an ellipse around a set of 2D points. The function calculates │ │ │ │ + the ellipse that fits (in a least-squares sense) a set of 2D points │ │ │ │ + best of all. It returns the rotated rectangle in which the ellipse │ │ │ │ + is inscribed. The first algorithm described by CITE: Fitzgibbon95 │ │ │ │ + is used. Developer should keep in mind that it is possible that the │ │ │ │ + returned ellipse/rotatedRect data contains negative indices, due to │ │ │ │ + the data points being close to the border of the containing Mat │ │ │ │ + element. │ │ │ │ + Parameters: │ │ │ │ + points - Input 2D point set, stored in std::vector<> or Mat │ │ │ │ + NNoottee:: Input point types are REF: Point2i or REF: Point2f and │ │ │ │ + at least 5 points are required. NNoottee:: REF: │ │ │ │ + getClosestEllipsePoints function can be used to compute the │ │ │ │ + ellipse fitting error. │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** ffiittEElllliippsseeAAMMSS ******** │ │ │ │ + public static _R_o_t_a_t_e_d_R_e_c_t fitEllipseAMS(_M_a_t points) │ │ │ │ + Fits an ellipse around a set of 2D points. The function calculates │ │ │ │ + the ellipse that fits a set of 2D points. It returns the rotated │ │ │ │ + rectangle in which the ellipse is inscribed. The Approximate Mean │ │ │ │ + Square (AMS) proposed by CITE: Taubin1991 is used. For an ellipse, │ │ │ │ + this basis set is \( \chi= \left(x^2, x y, y^2, x, y, 1\right) \), │ │ │ │ + which is a set of six free coefficients \( A^T=\left\{A_{\text │ │ │ │ + {xx}},A_{\text{xy}},A_{\text{yy}},A_x,A_y,A_0\right\} \). However, │ │ │ │ + to specify an ellipse, all that is needed is five numbers; the │ │ │ │ + major and minor axes lengths \( (a,b) \), the position \( (x_0,y_0) │ │ │ │ + \), and the orientation \( \theta \). This is because the basis set │ │ │ │ + includes lines, quadratics, parabolic and hyperbolic functions as │ │ │ │ + well as elliptical functions as possible fits. If the fit is found │ │ │ │ + to be a parabolic or hyperbolic function then the standard │ │ │ │ + #fitEllipse method is used. The AMS method restricts the fit to │ │ │ │ + parabolic, hyperbolic and elliptical curves by imposing the │ │ │ │ + condition that \( A^T ( D_x^T D_x + D_y^T D_y) A = 1 \) where the │ │ │ │ + matrices \( Dx \) and \( Dy \) are the partial derivatives of the │ │ │ │ + design matrix \( D \) with respect to x and y. The matrices are │ │ │ │ + formed row by row applying the following to each of the points in │ │ │ │ + the set: \(align*}{ D(i,:)&=\left\{x_i^2, x_i y_i, y_i^2, x_i, y_i, │ │ │ │ + 1\right\} & D_x(i,:)&=\left\{2 x_i,y_i,0,1,0,0\right\} & D_y(i,: │ │ │ │ + )&=\left\{0,x_i,2 y_i,0,1,0\right\} \) The AMS method minimizes the │ │ │ │ + cost function \(equation*}{ \epsilon ^2=\frac{ A^T D^T D A }{ A^T │ │ │ │ + (D_x^T D_x + D_y^T D_y) A^T } \) The minimum cost is found by │ │ │ │ + solving the generalized eigenvalue problem. \(equation*}{ D^T D A = │ │ │ │ + \lambda \left( D_x^T D_x + D_y^T D_y\right) A \) │ │ │ │ + Parameters: │ │ │ │ + points - Input 2D point set, stored in std::vector<> or Mat │ │ │ │ + NNoottee:: Input point types are REF: Point2i or REF: Point2f and │ │ │ │ + at least 5 points are required. NNoottee:: REF: │ │ │ │ + getClosestEllipsePoints function can be used to compute the │ │ │ │ + ellipse fitting error. │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** ffiittEElllliippsseeDDiirreecctt ******** │ │ │ │ + public static _R_o_t_a_t_e_d_R_e_c_t fitEllipseDirect(_M_a_t points) │ │ │ │ + Fits an ellipse around a set of 2D points. The function calculates │ │ │ │ + the ellipse that fits a set of 2D points. It returns the rotated │ │ │ │ + rectangle in which the ellipse is inscribed. The Direct least │ │ │ │ + square (Direct) method by CITE: oy1998NumericallySD is used. For an │ │ │ │ + ellipse, this basis set is \( \chi= \left(x^2, x y, y^2, x, y, │ │ │ │ + 1\right) \), which is a set of six free coefficients \( A^T=\left\ │ │ │ │ + {A_{\text{xx}},A_{\text{xy}},A_{\text{yy}},A_x,A_y,A_0\right\} \). │ │ │ │ + However, to specify an ellipse, all that is needed is five numbers; │ │ │ │ + the major and minor axes lengths \( (a,b) \), the position \( │ │ │ │ + (x_0,y_0) \), and the orientation \( \theta \). This is because the │ │ │ │ + basis set includes lines, quadratics, parabolic and hyperbolic │ │ │ │ + functions as well as elliptical functions as possible fits. The │ │ │ │ + Direct method confines the fit to ellipses by ensuring that \( 4 A_ │ │ │ │ + {xx} A_{yy}- A_{xy}^2 > 0 \). The condition imposed is that \( 4 A_ │ │ │ │ + {xx} A_{yy}- A_{xy}^2=1 \) which satisfies the inequality and as │ │ │ │ + the coefficients can be arbitrarily scaled is not overly │ │ │ │ + restrictive. \(equation*}{ \epsilon ^2= A^T D^T D A \quad \text │ │ │ │ + {with} \quad A^T C A =1 \quad \text{and} \quad C=\left(\begin │ │ │ │ + {matrix} 0 & 0 & 2 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 & 0 & 0 \\ 2 & 0 & │ │ │ │ + 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ │ │ │ │ + 0 & 0 & 0 & 0 & 0 & 0 \end{matrix} \right) \) The minimum cost is │ │ │ │ + found by solving the generalized eigenvalue problem. \(equation*} │ │ │ │ + { D^T D A = \lambda \left( C\right) A \) The system produces only │ │ │ │ + one positive eigenvalue \( \lambda\) which is chosen as the │ │ │ │ + solution with its eigenvector \(\mathbf{u}\). These are used to │ │ │ │ + find the coefficients \(equation*}{ A = \sqrt{\frac{1}{\mathbf{u}^T │ │ │ │ + C \mathbf{u}}} \mathbf{u} \) The scaling factor guarantees that \ │ │ │ │ + (A^T C A =1\). │ │ │ │ + Parameters: │ │ │ │ + points - Input 2D point set, stored in std::vector<> or Mat │ │ │ │ + NNoottee:: Input point types are REF: Point2i or REF: Point2f and │ │ │ │ + at least 5 points are required. NNoottee:: REF: │ │ │ │ + getClosestEllipsePoints function can be used to compute the │ │ │ │ + ellipse fitting error. │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** ggeettCClloosseessttEElllliippsseePPooiinnttss ******** │ │ │ │ + public static void getClosestEllipsePoints │ │ │ │ + (_R_o_t_a_t_e_d_R_e_c_t ellipse_params, _M_a_t points, _M_a_t closest_pts) │ │ │ │ + Compute for each 2d point the nearest 2d point located on a given │ │ │ │ + ellipse. The function computes the nearest 2d location on a given │ │ │ │ + ellipse for a vector of 2d points and is based on CITE: │ │ │ │ + Chatfield2017 code. This function can be used to compute for │ │ │ │ + instance the ellipse fitting error. │ │ │ │ + Parameters: │ │ │ │ + ellipse_params - Ellipse parameters │ │ │ │ + points - Input 2d points │ │ │ │ + closest_pts - For each 2d point, their corresponding closest │ │ │ │ + 2d point located on a given ellipse NNoottee:: Input point types │ │ │ │ + are REF: Point2i or REF: Point2f SEE: fitEllipse, │ │ │ │ + fitEllipseAMS, fitEllipseDirect │ │ │ │ + o ******** ffiittLLiinnee ******** │ │ │ │ + public static void fitLine(_M_a_t points, _M_a_t line, int distType, │ │ │ │ + double param, double reps, double aeps) │ │ │ │ + Fits a line to a 2D or 3D point set. The function fitLine fits a │ │ │ │ + line to a 2D or 3D point set by minimizing \(\sum_i \rho(r_i)\) │ │ │ │ + where \(r_i\) is a distance between the \(i^{th}\) point, the line │ │ │ │ + and \(\rho(r)\) is a distance function, one of the following: - │ │ │ │ + DIST_L2 \(\rho (r) = r^2/2 \quad \text{(the simplest and the │ │ │ │ + fastest least-squares method)}\) - DIST_L1 \(\rho (r) = r\) - │ │ │ │ + DIST_L12 \(\rho (r) = 2 \cdot ( \sqrt{1 + \frac{r^2}{2}} - 1)\) - │ │ │ │ + DIST_FAIR \(\rho \left (r \right ) = C^2 \cdot \left ( \frac{r}{C} │ │ │ │ + - \log{\left(1 + \frac{r}{C}\right)} \right ) \quad \text{where} │ │ │ │ + \quad C=1.3998\) - DIST_WELSCH \(\rho \left (r \right ) = \frac │ │ │ │ + {C^2}{2} \cdot \left ( 1 - \exp{\left(-\left(\frac{r} │ │ │ │ + {C}\right)^2\right)} \right ) \quad \text{where} \quad C=2.9846\) - │ │ │ │ + DIST_HUBER \(\rho (r) = \fork{r^2/2}{if \(r < C\)}{C \cdot (r-C/2)} │ │ │ │ + {otherwise} \quad \text{where} \quad C=1.345\) The algorithm is │ │ │ │ + based on the M-estimator ( ) technique that iteratively fits the line using the │ │ │ │ + weighted least-squares algorithm. After each iteration the weights │ │ │ │ + \(w_i\) are adjusted to be inversely proportional to \(\rho(r_i)\) │ │ │ │ + . │ │ │ │ + Parameters: │ │ │ │ + points - Input vector of 2D or 3D points, stored in std:: │ │ │ │ + vector<> or Mat. │ │ │ │ + line - Output line parameters. In case of 2D fitting, it │ │ │ │ + should be a vector of 4 elements (like Vec4f) - (vx, vy, x0, │ │ │ │ + y0), where (vx, vy) is a normalized vector collinear to the │ │ │ │ + line and (x0, y0) is a point on the line. In case of 3D │ │ │ │ + fitting, it should be a vector of 6 elements (like Vec6f) - │ │ │ │ + (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized │ │ │ │ + vector collinear to the line and (x0, y0, z0) is a point on │ │ │ │ + the line. │ │ │ │ + distType - Distance used by the M-estimator, see │ │ │ │ + #DistanceTypes │ │ │ │ + param - Numerical parameter ( C ) for some types of │ │ │ │ + distances. If it is 0, an optimal value is chosen. │ │ │ │ + reps - Sufficient accuracy for the radius (distance between │ │ │ │ + the coordinate origin and the line). │ │ │ │ + aeps - Sufficient accuracy for the angle. 0.01 would be a │ │ │ │ + good default value for reps and aeps. │ │ │ │ + o ******** ppooiinnttPPoollyyggoonnTTeesstt ******** │ │ │ │ + public static double pointPolygonTest(_M_a_t_O_f_P_o_i_n_t_2_f contour, │ │ │ │ + _P_o_i_n_t pt, boolean measureDist) │ │ │ │ + Performs a point-in-contour test. The function determines whether │ │ │ │ + the point is inside a contour, outside, or lies on an edge (or │ │ │ │ + coincides with a vertex). It returns positive (inside), negative │ │ │ │ + (outside), or zero (on an edge) value, correspondingly. When │ │ │ │ + measureDist=false , the return value is +1, -1, and 0, │ │ │ │ + respectively. Otherwise, the return value is a signed distance │ │ │ │ + between the point and the nearest contour edge. See below a sample │ │ │ │ + output of the function where each image pixel is tested against the │ │ │ │ + contour: ![sample output](pics/pointpolygon.png) │ │ │ │ + Parameters: │ │ │ │ + contour - Input contour. │ │ │ │ + pt - Point tested against the contour. │ │ │ │ + measureDist - If true, the function estimates the signed │ │ │ │ + distance from the point to the nearest contour edge. │ │ │ │ + Otherwise, the function only checks if the point is inside a │ │ │ │ + contour or not. │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** rroottaatteeddRReeccttaanngglleeIInntteerrsseeccttiioonn ******** │ │ │ │ + public static int rotatedRectangleIntersection(_R_o_t_a_t_e_d_R_e_c_t rect1, │ │ │ │ + _R_o_t_a_t_e_d_R_e_c_t rect2, _M_a_t intersectingRegion) │ │ │ │ + Finds out if there is any intersection between two rotated │ │ │ │ + rectangles. If there is then the vertices of the intersecting │ │ │ │ + region are returned as well. Below are some examples of │ │ │ │ + intersection configurations. The hatched pattern indicates the │ │ │ │ + intersecting region and the red vertices are returned by the │ │ │ │ + function. ![intersection examples](pics/intersection.png) │ │ │ │ + Parameters: │ │ │ │ + rect1 - First rectangle │ │ │ │ + rect2 - Second rectangle │ │ │ │ + intersectingRegion - The output array of the vertices of the │ │ │ │ + intersecting region. It returns at most 8 vertices. Stored as │ │ │ │ + std::vector or cv::Mat as Mx1 of type CV_32FC2. │ │ │ │ + Returns: │ │ │ │ + One of #RectanglesIntersectTypes │ │ │ │ + o ******** aarrccLLeennggtthh ******** │ │ │ │ + public static double arcLength(_M_a_t_O_f_P_o_i_n_t_2_f curve, boolean closed) │ │ │ │ + Calculates a contour perimeter or a curve length. The function │ │ │ │ + computes a curve length or a closed contour perimeter. │ │ │ │ + Parameters: │ │ │ │ + curve - Input vector of 2D points, stored in std::vector or │ │ │ │ + Mat. │ │ │ │ + closed - Flag indicating whether the curve is closed or not. │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** ccoonnttoouurrAArreeaa ******** │ │ │ │ + public static double contourArea(_M_a_t contour, boolean oriented) │ │ │ │ + Calculates a contour area. The function computes a contour area. │ │ │ │ + Similarly to moments , the area is computed using the Green │ │ │ │ + formula. Thus, the returned area and the number of non-zero pixels, │ │ │ │ + if you draw the contour using #drawContours or #fillPoly , can be │ │ │ │ + different. Also, the function will most certainly give a wrong │ │ │ │ + results for contours with self-intersections. Example: │ │ │ │ + vector contour; contour.push_back(Point2f(0, 0)); │ │ │ │ + contour.push_back(Point2f(10, 0)); contour.push_back(Point2f(10, │ │ │ │ + 10)); contour.push_back(Point2f(5, 4)); double area0 = contourArea │ │ │ │ + (contour); vector approx; approxPolyDP(contour, approx, 5, │ │ │ │ + true); double area1 = contourArea(approx); cout << "area0 =" << │ │ │ │ + area0 << endl << "area1 =" << area1 << endl << "approx poly │ │ │ │ + vertices" << approx.size() << endl; │ │ │ │ + Parameters: │ │ │ │ + contour - Input vector of 2D points (contour vertices), │ │ │ │ + stored in std::vector or Mat. │ │ │ │ + oriented - Oriented area flag. If it is true, the function │ │ │ │ + returns a signed area value, depending on the contour │ │ │ │ + orientation (clockwise or counter-clockwise). Using this │ │ │ │ + feature you can determine orientation of a contour by taking │ │ │ │ + the sign of an area. By default, the parameter is false, │ │ │ │ + which means that the absolute value is returned. │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** ccoonnttoouurrAArreeaa ******** │ │ │ │ + public static double contourArea(_M_a_t contour) │ │ │ │ + Calculates a contour area. The function computes a contour area. │ │ │ │ + Similarly to moments , the area is computed using the Green │ │ │ │ + formula. Thus, the returned area and the number of non-zero pixels, │ │ │ │ + if you draw the contour using #drawContours or #fillPoly , can be │ │ │ │ + different. Also, the function will most certainly give a wrong │ │ │ │ + results for contours with self-intersections. Example: │ │ │ │ + vector contour; contour.push_back(Point2f(0, 0)); │ │ │ │ + contour.push_back(Point2f(10, 0)); contour.push_back(Point2f(10, │ │ │ │ + 10)); contour.push_back(Point2f(5, 4)); double area0 = contourArea │ │ │ │ + (contour); vector approx; approxPolyDP(contour, approx, 5, │ │ │ │ + true); double area1 = contourArea(approx); cout << "area0 =" << │ │ │ │ + area0 << endl << "area1 =" << area1 << endl << "approx poly │ │ │ │ + vertices" << approx.size() << endl; │ │ │ │ + Parameters: │ │ │ │ + contour - Input vector of 2D points (contour vertices), │ │ │ │ + stored in std::vector or Mat. depending on the contour │ │ │ │ + orientation (clockwise or counter-clockwise). Using this │ │ │ │ + feature you can determine orientation of a contour by taking │ │ │ │ + the sign of an area. By default, the parameter is false, │ │ │ │ + which means that the absolute value is returned. │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** bboouunnddiinnggRReecctt ******** │ │ │ │ + public static _R_e_c_t boundingRect(_M_a_t array) │ │ │ │ + Calculates the up-right bounding rectangle of a point set or non- │ │ │ │ + zero pixels of gray-scale image. The function calculates and │ │ │ │ + returns the minimal up-right bounding rectangle for the specified │ │ │ │ + point set or non-zero pixels of gray-scale image. │ │ │ │ + Parameters: │ │ │ │ + array - Input gray-scale image or 2D point set, stored in │ │ │ │ + std::vector or Mat. │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** ggeettRRoottaattiioonnMMaattrriixx22DD ******** │ │ │ │ + public static _M_a_t getRotationMatrix2D(_P_o_i_n_t center, double angle, │ │ │ │ + double scale) │ │ │ │ + Calculates an affine matrix of 2D rotation. The function calculates │ │ │ │ + the following matrix: \(\begin{bmatrix} \alpha & \beta & (1- \alpha │ │ │ │ + ) \cdot \texttt{center.x} - \beta \cdot \texttt{center.y} \\ - │ │ │ │ + \beta & \alpha & \beta \cdot \texttt{center.x} + (1- \alpha ) \cdot │ │ │ │ + \texttt{center.y} \end{bmatrix}\) where \(\begin{array}{l} \alpha = │ │ │ │ + \texttt{scale} \cdot \cos \texttt{angle} , \\ \beta = \texttt │ │ │ │ + {scale} \cdot \sin \texttt{angle} \end{array}\) The transformation │ │ │ │ + maps the rotation center to itself. If this is not the target, │ │ │ │ + adjust the shift. │ │ │ │ + Parameters: │ │ │ │ + center - Center of the rotation in the source image. │ │ │ │ + angle - Rotation angle in degrees. Positive values mean │ │ │ │ + counter-clockwise rotation (the coordinate origin is assumed │ │ │ │ + to be the top-left corner). │ │ │ │ + scale - Isotropic scale factor. SEE: getAffineTransform, │ │ │ │ + warpAffine, transform │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** iinnvveerrttAAffffiinneeTTrraannssffoorrmm ******** │ │ │ │ + public static void invertAffineTransform(_M_a_t M, _M_a_t iM) │ │ │ │ + Inverts an affine transformation. The function computes an inverse │ │ │ │ + affine transformation represented by \(2 \times 3\) matrix M: \ │ │ │ │ + (\begin{bmatrix} a_{11} & a_{12} & b_1 \\ a_{21} & a_{22} & b_2 │ │ │ │ + \end{bmatrix}\) The result is also a \(2 \times 3\) matrix of the │ │ │ │ + same type as M. │ │ │ │ + Parameters: │ │ │ │ + M - Original affine transformation. │ │ │ │ + iM - Output reverse affine transformation. │ │ │ │ + o ******** ggeettPPeerrssppeeccttiivveeTTrraannssffoorrmm ******** │ │ │ │ + public static _M_a_t getPerspectiveTransform(_M_a_t src, _M_a_t dst, │ │ │ │ + int solveMethod) │ │ │ │ + Calculates a perspective transform from four pairs of the │ │ │ │ + corresponding points. The function calculates the \(3 \times 3\) │ │ │ │ + matrix of a perspective transform so that: \(\begin{bmatrix} t_i │ │ │ │ + x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map_matrix} \cdot │ │ │ │ + \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\) where \(dst(i)= │ │ │ │ + (x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\) │ │ │ │ + Parameters: │ │ │ │ + src - Coordinates of quadrangle vertices in the source image. │ │ │ │ + dst - Coordinates of the corresponding quadrangle vertices in │ │ │ │ + the destination image. │ │ │ │ + solveMethod - method passed to cv::solve (#DecompTypes) SEE: │ │ │ │ + findHomography, warpPerspective, perspectiveTransform │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** ggeettPPeerrssppeeccttiivveeTTrraannssffoorrmm ******** │ │ │ │ + public static _M_a_t getPerspectiveTransform(_M_a_t src, _M_a_t dst) │ │ │ │ + Calculates a perspective transform from four pairs of the │ │ │ │ + corresponding points. The function calculates the \(3 \times 3\) │ │ │ │ + matrix of a perspective transform so that: \(\begin{bmatrix} t_i │ │ │ │ + x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map_matrix} \cdot │ │ │ │ + \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\) where \(dst(i)= │ │ │ │ + (x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\) │ │ │ │ + Parameters: │ │ │ │ + src - Coordinates of quadrangle vertices in the source image. │ │ │ │ + dst - Coordinates of the corresponding quadrangle vertices in │ │ │ │ + the destination image. SEE: findHomography, warpPerspective, │ │ │ │ + perspectiveTransform │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** ggeettAAffffiinneeTTrraannssffoorrmm ******** │ │ │ │ + public static _M_a_t getAffineTransform(_M_a_t_O_f_P_o_i_n_t_2_f src, │ │ │ │ + _M_a_t_O_f_P_o_i_n_t_2_f dst) │ │ │ │ o ******** RRooddrriigguueess ******** │ │ │ │ public static void Rodrigues(_M_a_t src, _M_a_t dst, _M_a_t jacobian) │ │ │ │ Converts a rotation matrix to a rotation vector or vice versa. │ │ │ │ Parameters: │ │ │ │ src - Input rotation vector (3x1 or 1x3) or rotation matrix │ │ │ │ (3x3). │ │ │ │ dst - Output rotation matrix (3x3) or rotation vector (3x1 or │ │ │ │ @@ -8864,710 +9566,8 @@ │ │ │ │ and computed point projections to consider it an inlier. The │ │ │ │ function interally undistorts points with REF: │ │ │ │ undistortPoints and call REF: cv::solvePnP, thus the input │ │ │ │ are very similar. More information about Perspective-n-Points │ │ │ │ is described in REF: calib3d_solvePnP for more information. │ │ │ │ Returns: │ │ │ │ automatically generated │ │ │ │ - o ******** aapppprrooxxPPoollyyDDPP ******** │ │ │ │ - public static void approxPolyDP(_M_a_t_O_f_P_o_i_n_t_2_f curve, │ │ │ │ - _M_a_t_O_f_P_o_i_n_t_2_f approxCurve, double epsilon, boolean closed) │ │ │ │ - Approximates a polygonal curve(s) with the specified precision. T │ │ │ │ - he function cv::approxPolyDP approximates a curve or a p*olygon │ │ │ │ - with another curve/polygon with less vertices so that the distance │ │ │ │ - between them is less or equal to the specified precision. It uses │ │ │ │ - the Douglas-Peucker algorithm │ │ │ │ - Parameters: │ │ │ │ - curve - Input vector of a 2D point stored in std::vector or │ │ │ │ - Mat │ │ │ │ - approxCurve - Result of the approximation. The type should │ │ │ │ - match the type of the input curve. │ │ │ │ - epsilon - Parameter specifying the approximation accuracy. │ │ │ │ - This is the maximum distance between the original curve and │ │ │ │ - its approximation. │ │ │ │ - closed - If true, the approximated curve is closed (its first │ │ │ │ - and last vertices are connected). Otherwise, it is not │ │ │ │ - closed. │ │ │ │ - o ******** aapppprrooxxPPoollyyNN ******** │ │ │ │ - public static void approxPolyN(_M_a_t curve, _M_a_t approxCurve, │ │ │ │ - int nsides, float epsilon_percentage, boolean ensure_convex) │ │ │ │ - Approximates a polygon with a convex hull with a specified accuracy │ │ │ │ - and number of sides. T he cv::approxPolyN function approximates a │ │ │ │ - polygon with *a convex hull so that the difference between the │ │ │ │ - contour area of the original contour and the new polygon is │ │ │ │ - minimal. It uses a greedy algorithm for contracting two vertices │ │ │ │ - into one in such a way that the additional area is minimal. │ │ │ │ - Straight lines formed by each edge of the convex contour are drawn │ │ │ │ - and the areas of the resulting triangles are considered. Each │ │ │ │ - vertex will lie either on the original contour or outside it. The │ │ │ │ - algorithm based on the paper CITE: LowIlie2003 . │ │ │ │ - Parameters: │ │ │ │ - curve - Input vector of a 2D points stored in std::vector or │ │ │ │ - Mat, points must be float or integer. │ │ │ │ - approxCurve - Result of the approximation. The type is vector │ │ │ │ - of a 2D point (Point2f or Point) in std::vector or Mat. │ │ │ │ - nsides - The parameter defines the number of sides of the │ │ │ │ - result polygon. │ │ │ │ - epsilon_percentage - defines the percentage of the maximum of │ │ │ │ - additional area. If it equals -1, it is not used. Otherwise │ │ │ │ - algorithm stops if additional area is greater than │ │ │ │ - contourArea(_curve) * percentage. If additional area exceeds │ │ │ │ - the limit, algorithm returns as many vertices as there were │ │ │ │ - at the moment the limit was exceeded. │ │ │ │ - ensure_convex - If it is true, algorithm creates a convex │ │ │ │ - hull of input contour. Otherwise input vector should be │ │ │ │ - convex. │ │ │ │ - o ******** aapppprrooxxPPoollyyNN ******** │ │ │ │ - public static void approxPolyN(_M_a_t curve, _M_a_t approxCurve, │ │ │ │ - int nsides, float epsilon_percentage) │ │ │ │ - Approximates a polygon with a convex hull with a specified accuracy │ │ │ │ - and number of sides. T he cv::approxPolyN function approximates a │ │ │ │ - polygon with *a convex hull so that the difference between the │ │ │ │ - contour area of the original contour and the new polygon is │ │ │ │ - minimal. It uses a greedy algorithm for contracting two vertices │ │ │ │ - into one in such a way that the additional area is minimal. │ │ │ │ - Straight lines formed by each edge of the convex contour are drawn │ │ │ │ - and the areas of the resulting triangles are considered. Each │ │ │ │ - vertex will lie either on the original contour or outside it. The │ │ │ │ - algorithm based on the paper CITE: LowIlie2003 . │ │ │ │ - Parameters: │ │ │ │ - curve - Input vector of a 2D points stored in std::vector or │ │ │ │ - Mat, points must be float or integer. │ │ │ │ - approxCurve - Result of the approximation. The type is vector │ │ │ │ - of a 2D point (Point2f or Point) in std::vector or Mat. │ │ │ │ - nsides - The parameter defines the number of sides of the │ │ │ │ - result polygon. │ │ │ │ - epsilon_percentage - defines the percentage of the maximum of │ │ │ │ - additional area. If it equals -1, it is not used. Otherwise │ │ │ │ - algorithm stops if additional area is greater than │ │ │ │ - contourArea(_curve) * percentage. If additional area exceeds │ │ │ │ - the limit, algorithm returns as many vertices as there were │ │ │ │ - at the moment the limit was exceeded. │ │ │ │ - o ******** aapppprrooxxPPoollyyNN ******** │ │ │ │ - public static void approxPolyN(_M_a_t curve, _M_a_t approxCurve, │ │ │ │ - int nsides) │ │ │ │ - Approximates a polygon with a convex hull with a specified accuracy │ │ │ │ - and number of sides. T he cv::approxPolyN function approximates a │ │ │ │ - polygon with *a convex hull so that the difference between the │ │ │ │ - contour area of the original contour and the new polygon is │ │ │ │ - minimal. It uses a greedy algorithm for contracting two vertices │ │ │ │ - into one in such a way that the additional area is minimal. │ │ │ │ - Straight lines formed by each edge of the convex contour are drawn │ │ │ │ - and the areas of the resulting triangles are considered. Each │ │ │ │ - vertex will lie either on the original contour or outside it. The │ │ │ │ - algorithm based on the paper CITE: LowIlie2003 . │ │ │ │ - Parameters: │ │ │ │ - curve - Input vector of a 2D points stored in std::vector or │ │ │ │ - Mat, points must be float or integer. │ │ │ │ - approxCurve - Result of the approximation. The type is vector │ │ │ │ - of a 2D point (Point2f or Point) in std::vector or Mat. │ │ │ │ - nsides - The parameter defines the number of sides of the │ │ │ │ - result polygon. If it equals -1, it is not used. Otherwise │ │ │ │ - algorithm stops if additional area is greater than │ │ │ │ - contourArea(_curve) * percentage. If additional area exceeds │ │ │ │ - the limit, algorithm returns as many vertices as there were │ │ │ │ - at the moment the limit was exceeded. │ │ │ │ - o ******** mmiinnAArreeaaRReecctt ******** │ │ │ │ - public static _R_o_t_a_t_e_d_R_e_c_t minAreaRect(_M_a_t_O_f_P_o_i_n_t_2_f points) │ │ │ │ - Finds a rotated rectangle of the minimum area enclosing the input │ │ │ │ - 2D point set. The function calculates and returns the minimum-area │ │ │ │ - bounding rectangle (possibly rotated) for a specified point set. │ │ │ │ - The angle of rotation represents the angle between the line │ │ │ │ - connecting the starting and ending points (based on the clockwise │ │ │ │ - order with greatest index for the corner with greatest \(y\)) and │ │ │ │ - the horizontal axis. This angle always falls between \([-90, 0)\) │ │ │ │ - because, if the object rotates more than a rect angle, the next │ │ │ │ - edge is used to measure the angle. The starting and ending points │ │ │ │ - change as the object rotates.Developer should keep in mind that the │ │ │ │ - returned RotatedRect can contain negative indices when data is │ │ │ │ - close to the containing Mat element boundary. │ │ │ │ - Parameters: │ │ │ │ - points - Input vector of 2D points, stored in std::vector<> │ │ │ │ - or Mat │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** bbooxxPPooiinnttss ******** │ │ │ │ - public static void boxPoints(_R_o_t_a_t_e_d_R_e_c_t box, _M_a_t points) │ │ │ │ - Finds the four vertices of a rotated rect. Useful to draw the │ │ │ │ - rotated rectangle. The function finds the four vertices of a │ │ │ │ - rotated rectangle. The four vertices are returned in clockwise │ │ │ │ - order starting from the point with greatest \(y\). If two points │ │ │ │ - have the same \(y\) coordinate the rightmost is the starting point. │ │ │ │ - This function is useful to draw the rectangle. In C++, instead of │ │ │ │ - using this function, you can directly use RotatedRect::points │ │ │ │ - method. Please visit the REF: tutorial_bounding_rotated_ellipses │ │ │ │ - "tutorial on Creating Bounding rotated boxes and ellipses for │ │ │ │ - contours" for more information. │ │ │ │ - Parameters: │ │ │ │ - box - The input rotated rectangle. It may be the output of │ │ │ │ - REF: minAreaRect. │ │ │ │ - points - The output array of four vertices of rectangles. │ │ │ │ - o ******** mmiinnEEnncclloossiinnggCCiirrccllee ******** │ │ │ │ - public static void minEnclosingCircle(_M_a_t_O_f_P_o_i_n_t_2_f points, │ │ │ │ - _P_o_i_n_t center, float[] radius) │ │ │ │ - Finds a circle of the minimum area enclosing a 2D point set. The │ │ │ │ - function finds the minimal enclosing circle of a 2D point set using │ │ │ │ - an iterative algorithm. │ │ │ │ - Parameters: │ │ │ │ - points - Input vector of 2D points, stored in std::vector<> │ │ │ │ - or Mat │ │ │ │ - center - Output center of the circle. │ │ │ │ - radius - Output radius of the circle. │ │ │ │ - o ******** mmiinnEEnncclloossiinnggTTrriiaannggllee ******** │ │ │ │ - public static double minEnclosingTriangle(_M_a_t points, _M_a_t triangle) │ │ │ │ - Finds a triangle of minimum area enclosing a 2D point set and │ │ │ │ - returns its area. The function finds a triangle of minimum area │ │ │ │ - enclosing the given set of 2D points and returns its area. The │ │ │ │ - output for a given 2D point set is shown in the image below. 2D │ │ │ │ - points are depicted in red* and the enclosing triangle in *yellow*. │ │ │ │ - ![Sample output of the minimum enclosing triangle function](pics/ │ │ │ │ - minenclosingtriangle.png) The implementation of the algorithm is │ │ │ │ - based on O'Rourke's CITE: ORourke86 and Klee and Laskowski's CITE: │ │ │ │ - KleeLaskowski85 papers. O'Rourke provides a \(\theta(n)\) algorithm │ │ │ │ - for finding the minimal enclosing triangle of a 2D convex polygon │ │ │ │ - with n vertices. Since the #minEnclosingTriangle function takes a │ │ │ │ - 2D point set as input an additional preprocessing step of computing │ │ │ │ - the convex hull of the 2D point set is required. The complexity of │ │ │ │ - the #convexHull function is \(O(n log(n))\) which is higher than \ │ │ │ │ - (\theta(n)\). Thus the overall complexity of the function is \(O(n │ │ │ │ - log(n))\). │ │ │ │ - Parameters: │ │ │ │ - points - Input vector of 2D points with depth CV_32S or │ │ │ │ - CV_32F, stored in std::vector<> or Mat │ │ │ │ - triangle - Output vector of three 2D points defining the │ │ │ │ - vertices of the triangle. The depth of the OutputArray must │ │ │ │ - be CV_32F. │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** mmiinnEEnncclloossiinnggCCoonnvveexxPPoollyyggoonn ******** │ │ │ │ - public static double minEnclosingConvexPolygon(_M_a_t points, │ │ │ │ - _M_a_t polygon, int k) │ │ │ │ - Finds a convex polygon of minimum area enclosing a 2D point set and │ │ │ │ - returns its area. This function takes a given set of 2D points and │ │ │ │ - finds the enclosing polygon with k vertices and minimal area. It │ │ │ │ - takes the set of points and the parameter k as input and returns │ │ │ │ - the area of the minimal enclosing polygon. The Implementation is │ │ │ │ - based on a paper by Aggarwal, Chang and Yap CITE: Aggarwal1985. │ │ │ │ - They provide a \(\theta(n²log(n)log(k))\) algorithm for finding the │ │ │ │ - minimal convex polygon with k vertices enclosing a 2D convex │ │ │ │ - polygon with n vertices (k < n). Since the │ │ │ │ - #minEnclosingConvexPolygon function takes a 2D point set as input, │ │ │ │ - an additional preprocessing step of computing the convex hull of │ │ │ │ - the 2D point set is required. The complexity of the #convexHull │ │ │ │ - function is \(O(n log(n))\) which is lower than \(\theta(n²log │ │ │ │ - (n)log(k))\). Thus the overall complexity of the function is \(O │ │ │ │ - (n²log(n)log(k))\). │ │ │ │ - Parameters: │ │ │ │ - points - Input vector of 2D points, stored in std::vector<> │ │ │ │ - or Mat │ │ │ │ - polygon - Output vector of 2D points defining the vertices of │ │ │ │ - the enclosing polygon │ │ │ │ - k - Number of vertices of the output polygon │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** mmoommeennttss ******** │ │ │ │ - public static _M_o_m_e_n_t_s moments(_M_a_t array, boolean binaryImage) │ │ │ │ - Calculates all of the moments up to the third order of a polygon or │ │ │ │ - rasterized shape. The function computes moments, up to the 3rd │ │ │ │ - order, of a vector shape or a rasterized shape. The results are │ │ │ │ - returned in the structure cv::Moments. │ │ │ │ - Parameters: │ │ │ │ - array - Single channel raster image (CV_8U, CV_16U, CV_16S, │ │ │ │ - CV_32F, CV_64F) or an array ( \(1 \times N\) or \(N \times │ │ │ │ - 1\) ) of 2D points (Point or Point2f). │ │ │ │ - binaryImage - If it is true, all non-zero image pixels are │ │ │ │ - treated as 1's. The parameter is used for images only. │ │ │ │ - Returns: │ │ │ │ - moments. NNoottee:: Only applicable to contour moments │ │ │ │ - calculations from Python bindings: Note that the numpy type │ │ │ │ - for the input array should be either np.int32 or np.float32. │ │ │ │ - NNoottee:: For contour-based moments, the zeroth-order moment \c │ │ │ │ - m00 represents the contour area. If the input contour is │ │ │ │ - degenerate (for example, a single point or all points are │ │ │ │ - collinear), the area is zero and therefore \c m00 == 0. In │ │ │ │ - this case, the centroid coordinates (\c m10/m00, \c m01/m00) │ │ │ │ - are undefined and must be handled explicitly by the caller. A │ │ │ │ - common workaround is to compute the center using cv:: │ │ │ │ - boundingRect() or by averaging the input points. SEE: │ │ │ │ - contourArea, arcLength │ │ │ │ - o ******** mmoommeennttss ******** │ │ │ │ - public static _M_o_m_e_n_t_s moments(_M_a_t array) │ │ │ │ - Calculates all of the moments up to the third order of a polygon or │ │ │ │ - rasterized shape. The function computes moments, up to the 3rd │ │ │ │ - order, of a vector shape or a rasterized shape. The results are │ │ │ │ - returned in the structure cv::Moments. │ │ │ │ - Parameters: │ │ │ │ - array - Single channel raster image (CV_8U, CV_16U, CV_16S, │ │ │ │ - CV_32F, CV_64F) or an array ( \(1 \times N\) or \(N \times │ │ │ │ - 1\) ) of 2D points (Point or Point2f). used for images only. │ │ │ │ - Returns: │ │ │ │ - moments. NNoottee:: Only applicable to contour moments │ │ │ │ - calculations from Python bindings: Note that the numpy type │ │ │ │ - for the input array should be either np.int32 or np.float32. │ │ │ │ - NNoottee:: For contour-based moments, the zeroth-order moment \c │ │ │ │ - m00 represents the contour area. If the input contour is │ │ │ │ - degenerate (for example, a single point or all points are │ │ │ │ - collinear), the area is zero and therefore \c m00 == 0. In │ │ │ │ - this case, the centroid coordinates (\c m10/m00, \c m01/m00) │ │ │ │ - are undefined and must be handled explicitly by the caller. A │ │ │ │ - common workaround is to compute the center using cv:: │ │ │ │ - boundingRect() or by averaging the input points. SEE: │ │ │ │ - contourArea, arcLength │ │ │ │ - o ******** HHuuMMoommeennttss ******** │ │ │ │ - public static void HuMoments(_M_o_m_e_n_t_s m, _M_a_t hu) │ │ │ │ - o ******** mmaattcchhSShhaappeess ******** │ │ │ │ - public static double matchShapes(_M_a_t contour1, _M_a_t contour2, │ │ │ │ - int method, double parameter) │ │ │ │ - Compares two shapes. The function compares two shapes. All three │ │ │ │ - implemented methods use the Hu invariants (see #HuMoments) │ │ │ │ - Parameters: │ │ │ │ - contour1 - First contour or grayscale image. │ │ │ │ - contour2 - Second contour or grayscale image. │ │ │ │ - method - Comparison method, see #ShapeMatchModes │ │ │ │ - parameter - Method-specific parameter (not supported now). │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** ccoonnvveexxHHuullll ******** │ │ │ │ - public static void convexHull(_M_a_t_O_f_P_o_i_n_t points, _M_a_t_O_f_I_n_t hull, │ │ │ │ - boolean clockwise) │ │ │ │ - Finds the convex hull of a point set. The function cv::convexHull │ │ │ │ - finds the convex hull of a 2D point set using the Sklansky's │ │ │ │ - algorithm CITE: Sklansky82 that has *O(N logN)* complexity in the │ │ │ │ - current implementation. │ │ │ │ - Parameters: │ │ │ │ - points - Input 2D point set, stored in std::vector or Mat. │ │ │ │ - hull - Output convex hull. It is either an integer vector of │ │ │ │ - indices or vector of points. In the first case, the hull │ │ │ │ - elements are 0-based indices of the convex hull points in the │ │ │ │ - original array (since the set of convex hull points is a │ │ │ │ - subset of the original point set). In the second case, hull │ │ │ │ - elements are the convex hull points themselves. │ │ │ │ - clockwise - Orientation flag. If it is true, the output │ │ │ │ - convex hull is oriented clockwise. Otherwise, it is oriented │ │ │ │ - counter-clockwise. The assumed coordinate system has its X │ │ │ │ - axis pointing to the right, and its Y axis pointing upwards. │ │ │ │ - returns convex hull points. Otherwise, it returns indices of │ │ │ │ - the convex hull points. When the output array is std::vector, │ │ │ │ - the flag is ignored, and the output depends on the type of │ │ │ │ - the vector: std::vector implies returnPoints=false, │ │ │ │ - std::vector implies returnPoints=true. NNoottee:: points │ │ │ │ - and hull should be different arrays, inplace processing isn't │ │ │ │ - supported. Check REF: tutorial_hull "the corresponding │ │ │ │ - tutorial" for more details. useful links: https:// │ │ │ │ - www.learnopencv.com/convex-hull-using-opencv-in-python-and-c/ │ │ │ │ - o ******** ccoonnvveexxHHuullll ******** │ │ │ │ - public static void convexHull(_M_a_t_O_f_P_o_i_n_t points, _M_a_t_O_f_I_n_t hull) │ │ │ │ - Finds the convex hull of a point set. The function cv::convexHull │ │ │ │ - finds the convex hull of a 2D point set using the Sklansky's │ │ │ │ - algorithm CITE: Sklansky82 that has *O(N logN)* complexity in the │ │ │ │ - current implementation. │ │ │ │ - Parameters: │ │ │ │ - points - Input 2D point set, stored in std::vector or Mat. │ │ │ │ - hull - Output convex hull. It is either an integer vector of │ │ │ │ - indices or vector of points. In the first case, the hull │ │ │ │ - elements are 0-based indices of the convex hull points in the │ │ │ │ - original array (since the set of convex hull points is a │ │ │ │ - subset of the original point set). In the second case, hull │ │ │ │ - elements are the convex hull points themselves. Otherwise, it │ │ │ │ - is oriented counter-clockwise. The assumed coordinate system │ │ │ │ - has its X axis pointing to the right, and its Y axis pointing │ │ │ │ - upwards. returns convex hull points. Otherwise, it returns │ │ │ │ - indices of the convex hull points. When the output array is │ │ │ │ - std::vector, the flag is ignored, and the output depends on │ │ │ │ - the type of the vector: std::vector implies │ │ │ │ - returnPoints=false, std::vector implies │ │ │ │ - returnPoints=true. NNoottee:: points and hull should be different │ │ │ │ - arrays, inplace processing isn't supported. Check REF: │ │ │ │ - tutorial_hull "the corresponding tutorial" for more details. │ │ │ │ - useful links: https://www.learnopencv.com/convex-hull-using- │ │ │ │ - opencv-in-python-and-c/ │ │ │ │ - o ******** ccoonnvveexxiittyyDDeeffeeccttss ******** │ │ │ │ - public static void convexityDefects(_M_a_t_O_f_P_o_i_n_t contour, │ │ │ │ - _M_a_t_O_f_I_n_t convexhull, _M_a_t_O_f_I_n_t_4 convexityDefects) │ │ │ │ - Finds the convexity defects of a contour. The figure below displays │ │ │ │ - convexity defects of a hand contour: ![image](pics/defects.png) │ │ │ │ - Parameters: │ │ │ │ - contour - Input contour. │ │ │ │ - convexhull - Convex hull obtained using convexHull that │ │ │ │ - should contain indices of the contour points that make the │ │ │ │ - hull. │ │ │ │ - convexityDefects - The output vector of convexity defects. In │ │ │ │ - C++ and the new Python/Java interface each convexity defect │ │ │ │ - is represented as 4-element integer vector (a.k.a. #Vec4i): │ │ │ │ - (start_index, end_index, farthest_pt_index, fixpt_depth), │ │ │ │ - where indices are 0-based indices in the original contour of │ │ │ │ - the convexity defect beginning, end and the farthest point, │ │ │ │ - and fixpt_depth is fixed-point approximation (with 8 │ │ │ │ - fractional bits) of the distance between the farthest contour │ │ │ │ - point and the hull. That is, to get the floating-point value │ │ │ │ - of the depth will be fixpt_depth/256.0. │ │ │ │ - o ******** iissCCoonnttoouurrCCoonnvveexx ******** │ │ │ │ - public static boolean isContourConvex(_M_a_t_O_f_P_o_i_n_t contour) │ │ │ │ - Tests a contour convexity. The function tests whether the input │ │ │ │ - contour is convex or not. The contour must be simple, that is, │ │ │ │ - without self-intersections. Otherwise, the function output is │ │ │ │ - undefined. │ │ │ │ - Parameters: │ │ │ │ - contour - Input vector of 2D points, stored in std::vector<> │ │ │ │ - or Mat │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** iinntteerrsseeccttCCoonnvveexxCCoonnvveexx ******** │ │ │ │ - public static float intersectConvexConvex(_M_a_t p1, _M_a_t p2, _M_a_t p12, │ │ │ │ - boolean handleNested) │ │ │ │ - Finds intersection of two convex polygons │ │ │ │ - Parameters: │ │ │ │ - p1 - First polygon │ │ │ │ - p2 - Second polygon │ │ │ │ - p12 - Output polygon describing the intersecting area │ │ │ │ - handleNested - When true, an intersection is found if one of │ │ │ │ - the polygons is fully enclosed in the other. When false, no │ │ │ │ - intersection is found. If the polygons share a side or the │ │ │ │ - vertex of one polygon lies on an edge of the other, they are │ │ │ │ - not considered nested and an intersection will be found │ │ │ │ - regardless of the value of handleNested. │ │ │ │ - Returns: │ │ │ │ - Area of intersecting polygon. May be negative, if algorithm │ │ │ │ - has not converged, e.g. non-convex input. NNoottee:: │ │ │ │ - intersectConvexConvex doesn't confirm that both polygons are │ │ │ │ - convex and will return invalid results if they aren't. │ │ │ │ - o ******** iinntteerrsseeccttCCoonnvveexxCCoonnvveexx ******** │ │ │ │ - public static float intersectConvexConvex(_M_a_t p1, _M_a_t p2, _M_a_t p12) │ │ │ │ - Finds intersection of two convex polygons │ │ │ │ - Parameters: │ │ │ │ - p1 - First polygon │ │ │ │ - p2 - Second polygon │ │ │ │ - p12 - Output polygon describing the intersecting area When │ │ │ │ - false, no intersection is found. If the polygons share a side │ │ │ │ - or the vertex of one polygon lies on an edge of the other, │ │ │ │ - they are not considered nested and an intersection will be │ │ │ │ - found regardless of the value of handleNested. │ │ │ │ - Returns: │ │ │ │ - Area of intersecting polygon. May be negative, if algorithm │ │ │ │ - has not converged, e.g. non-convex input. NNoottee:: │ │ │ │ - intersectConvexConvex doesn't confirm that both polygons are │ │ │ │ - convex and will return invalid results if they aren't. │ │ │ │ - o ******** ffiittEElllliippssee ******** │ │ │ │ - public static _R_o_t_a_t_e_d_R_e_c_t fitEllipse(_M_a_t_O_f_P_o_i_n_t_2_f points) │ │ │ │ - Fits an ellipse around a set of 2D points. The function calculates │ │ │ │ - the ellipse that fits (in a least-squares sense) a set of 2D points │ │ │ │ - best of all. It returns the rotated rectangle in which the ellipse │ │ │ │ - is inscribed. The first algorithm described by CITE: Fitzgibbon95 │ │ │ │ - is used. Developer should keep in mind that it is possible that the │ │ │ │ - returned ellipse/rotatedRect data contains negative indices, due to │ │ │ │ - the data points being close to the border of the containing Mat │ │ │ │ - element. │ │ │ │ - Parameters: │ │ │ │ - points - Input 2D point set, stored in std::vector<> or Mat │ │ │ │ - NNoottee:: Input point types are REF: Point2i or REF: Point2f and │ │ │ │ - at least 5 points are required. NNoottee:: REF: │ │ │ │ - getClosestEllipsePoints function can be used to compute the │ │ │ │ - ellipse fitting error. │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** ffiittEElllliippsseeAAMMSS ******** │ │ │ │ - public static _R_o_t_a_t_e_d_R_e_c_t fitEllipseAMS(_M_a_t points) │ │ │ │ - Fits an ellipse around a set of 2D points. The function calculates │ │ │ │ - the ellipse that fits a set of 2D points. It returns the rotated │ │ │ │ - rectangle in which the ellipse is inscribed. The Approximate Mean │ │ │ │ - Square (AMS) proposed by CITE: Taubin1991 is used. For an ellipse, │ │ │ │ - this basis set is \( \chi= \left(x^2, x y, y^2, x, y, 1\right) \), │ │ │ │ - which is a set of six free coefficients \( A^T=\left\{A_{\text │ │ │ │ - {xx}},A_{\text{xy}},A_{\text{yy}},A_x,A_y,A_0\right\} \). However, │ │ │ │ - to specify an ellipse, all that is needed is five numbers; the │ │ │ │ - major and minor axes lengths \( (a,b) \), the position \( (x_0,y_0) │ │ │ │ - \), and the orientation \( \theta \). This is because the basis set │ │ │ │ - includes lines, quadratics, parabolic and hyperbolic functions as │ │ │ │ - well as elliptical functions as possible fits. If the fit is found │ │ │ │ - to be a parabolic or hyperbolic function then the standard │ │ │ │ - #fitEllipse method is used. The AMS method restricts the fit to │ │ │ │ - parabolic, hyperbolic and elliptical curves by imposing the │ │ │ │ - condition that \( A^T ( D_x^T D_x + D_y^T D_y) A = 1 \) where the │ │ │ │ - matrices \( Dx \) and \( Dy \) are the partial derivatives of the │ │ │ │ - design matrix \( D \) with respect to x and y. The matrices are │ │ │ │ - formed row by row applying the following to each of the points in │ │ │ │ - the set: \(align*}{ D(i,:)&=\left\{x_i^2, x_i y_i, y_i^2, x_i, y_i, │ │ │ │ - 1\right\} & D_x(i,:)&=\left\{2 x_i,y_i,0,1,0,0\right\} & D_y(i,: │ │ │ │ - )&=\left\{0,x_i,2 y_i,0,1,0\right\} \) The AMS method minimizes the │ │ │ │ - cost function \(equation*}{ \epsilon ^2=\frac{ A^T D^T D A }{ A^T │ │ │ │ - (D_x^T D_x + D_y^T D_y) A^T } \) The minimum cost is found by │ │ │ │ - solving the generalized eigenvalue problem. \(equation*}{ D^T D A = │ │ │ │ - \lambda \left( D_x^T D_x + D_y^T D_y\right) A \) │ │ │ │ - Parameters: │ │ │ │ - points - Input 2D point set, stored in std::vector<> or Mat │ │ │ │ - NNoottee:: Input point types are REF: Point2i or REF: Point2f and │ │ │ │ - at least 5 points are required. NNoottee:: REF: │ │ │ │ - getClosestEllipsePoints function can be used to compute the │ │ │ │ - ellipse fitting error. │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** ffiittEElllliippsseeDDiirreecctt ******** │ │ │ │ - public static _R_o_t_a_t_e_d_R_e_c_t fitEllipseDirect(_M_a_t points) │ │ │ │ - Fits an ellipse around a set of 2D points. The function calculates │ │ │ │ - the ellipse that fits a set of 2D points. It returns the rotated │ │ │ │ - rectangle in which the ellipse is inscribed. The Direct least │ │ │ │ - square (Direct) method by CITE: oy1998NumericallySD is used. For an │ │ │ │ - ellipse, this basis set is \( \chi= \left(x^2, x y, y^2, x, y, │ │ │ │ - 1\right) \), which is a set of six free coefficients \( A^T=\left\ │ │ │ │ - {A_{\text{xx}},A_{\text{xy}},A_{\text{yy}},A_x,A_y,A_0\right\} \). │ │ │ │ - However, to specify an ellipse, all that is needed is five numbers; │ │ │ │ - the major and minor axes lengths \( (a,b) \), the position \( │ │ │ │ - (x_0,y_0) \), and the orientation \( \theta \). This is because the │ │ │ │ - basis set includes lines, quadratics, parabolic and hyperbolic │ │ │ │ - functions as well as elliptical functions as possible fits. The │ │ │ │ - Direct method confines the fit to ellipses by ensuring that \( 4 A_ │ │ │ │ - {xx} A_{yy}- A_{xy}^2 > 0 \). The condition imposed is that \( 4 A_ │ │ │ │ - {xx} A_{yy}- A_{xy}^2=1 \) which satisfies the inequality and as │ │ │ │ - the coefficients can be arbitrarily scaled is not overly │ │ │ │ - restrictive. \(equation*}{ \epsilon ^2= A^T D^T D A \quad \text │ │ │ │ - {with} \quad A^T C A =1 \quad \text{and} \quad C=\left(\begin │ │ │ │ - {matrix} 0 & 0 & 2 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 & 0 & 0 \\ 2 & 0 & │ │ │ │ - 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ │ │ │ │ - 0 & 0 & 0 & 0 & 0 & 0 \end{matrix} \right) \) The minimum cost is │ │ │ │ - found by solving the generalized eigenvalue problem. \(equation*} │ │ │ │ - { D^T D A = \lambda \left( C\right) A \) The system produces only │ │ │ │ - one positive eigenvalue \( \lambda\) which is chosen as the │ │ │ │ - solution with its eigenvector \(\mathbf{u}\). These are used to │ │ │ │ - find the coefficients \(equation*}{ A = \sqrt{\frac{1}{\mathbf{u}^T │ │ │ │ - C \mathbf{u}}} \mathbf{u} \) The scaling factor guarantees that \ │ │ │ │ - (A^T C A =1\). │ │ │ │ - Parameters: │ │ │ │ - points - Input 2D point set, stored in std::vector<> or Mat │ │ │ │ - NNoottee:: Input point types are REF: Point2i or REF: Point2f and │ │ │ │ - at least 5 points are required. NNoottee:: REF: │ │ │ │ - getClosestEllipsePoints function can be used to compute the │ │ │ │ - ellipse fitting error. │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** ggeettCClloosseessttEElllliippsseePPooiinnttss ******** │ │ │ │ - public static void getClosestEllipsePoints │ │ │ │ - (_R_o_t_a_t_e_d_R_e_c_t ellipse_params, _M_a_t points, _M_a_t closest_pts) │ │ │ │ - Compute for each 2d point the nearest 2d point located on a given │ │ │ │ - ellipse. The function computes the nearest 2d location on a given │ │ │ │ - ellipse for a vector of 2d points and is based on CITE: │ │ │ │ - Chatfield2017 code. This function can be used to compute for │ │ │ │ - instance the ellipse fitting error. │ │ │ │ - Parameters: │ │ │ │ - ellipse_params - Ellipse parameters │ │ │ │ - points - Input 2d points │ │ │ │ - closest_pts - For each 2d point, their corresponding closest │ │ │ │ - 2d point located on a given ellipse NNoottee:: Input point types │ │ │ │ - are REF: Point2i or REF: Point2f SEE: fitEllipse, │ │ │ │ - fitEllipseAMS, fitEllipseDirect │ │ │ │ - o ******** ffiittLLiinnee ******** │ │ │ │ - public static void fitLine(_M_a_t points, _M_a_t line, int distType, │ │ │ │ - double param, double reps, double aeps) │ │ │ │ - Fits a line to a 2D or 3D point set. The function fitLine fits a │ │ │ │ - line to a 2D or 3D point set by minimizing \(\sum_i \rho(r_i)\) │ │ │ │ - where \(r_i\) is a distance between the \(i^{th}\) point, the line │ │ │ │ - and \(\rho(r)\) is a distance function, one of the following: - │ │ │ │ - DIST_L2 \(\rho (r) = r^2/2 \quad \text{(the simplest and the │ │ │ │ - fastest least-squares method)}\) - DIST_L1 \(\rho (r) = r\) - │ │ │ │ - DIST_L12 \(\rho (r) = 2 \cdot ( \sqrt{1 + \frac{r^2}{2}} - 1)\) - │ │ │ │ - DIST_FAIR \(\rho \left (r \right ) = C^2 \cdot \left ( \frac{r}{C} │ │ │ │ - - \log{\left(1 + \frac{r}{C}\right)} \right ) \quad \text{where} │ │ │ │ - \quad C=1.3998\) - DIST_WELSCH \(\rho \left (r \right ) = \frac │ │ │ │ - {C^2}{2} \cdot \left ( 1 - \exp{\left(-\left(\frac{r} │ │ │ │ - {C}\right)^2\right)} \right ) \quad \text{where} \quad C=2.9846\) - │ │ │ │ - DIST_HUBER \(\rho (r) = \fork{r^2/2}{if \(r < C\)}{C \cdot (r-C/2)} │ │ │ │ - {otherwise} \quad \text{where} \quad C=1.345\) The algorithm is │ │ │ │ - based on the M-estimator ( ) technique that iteratively fits the line using the │ │ │ │ - weighted least-squares algorithm. After each iteration the weights │ │ │ │ - \(w_i\) are adjusted to be inversely proportional to \(\rho(r_i)\) │ │ │ │ - . │ │ │ │ - Parameters: │ │ │ │ - points - Input vector of 2D or 3D points, stored in std:: │ │ │ │ - vector<> or Mat. │ │ │ │ - line - Output line parameters. In case of 2D fitting, it │ │ │ │ - should be a vector of 4 elements (like Vec4f) - (vx, vy, x0, │ │ │ │ - y0), where (vx, vy) is a normalized vector collinear to the │ │ │ │ - line and (x0, y0) is a point on the line. In case of 3D │ │ │ │ - fitting, it should be a vector of 6 elements (like Vec6f) - │ │ │ │ - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized │ │ │ │ - vector collinear to the line and (x0, y0, z0) is a point on │ │ │ │ - the line. │ │ │ │ - distType - Distance used by the M-estimator, see │ │ │ │ - #DistanceTypes │ │ │ │ - param - Numerical parameter ( C ) for some types of │ │ │ │ - distances. If it is 0, an optimal value is chosen. │ │ │ │ - reps - Sufficient accuracy for the radius (distance between │ │ │ │ - the coordinate origin and the line). │ │ │ │ - aeps - Sufficient accuracy for the angle. 0.01 would be a │ │ │ │ - good default value for reps and aeps. │ │ │ │ - o ******** ppooiinnttPPoollyyggoonnTTeesstt ******** │ │ │ │ - public static double pointPolygonTest(_M_a_t_O_f_P_o_i_n_t_2_f contour, │ │ │ │ - _P_o_i_n_t pt, boolean measureDist) │ │ │ │ - Performs a point-in-contour test. The function determines whether │ │ │ │ - the point is inside a contour, outside, or lies on an edge (or │ │ │ │ - coincides with a vertex). It returns positive (inside), negative │ │ │ │ - (outside), or zero (on an edge) value, correspondingly. When │ │ │ │ - measureDist=false , the return value is +1, -1, and 0, │ │ │ │ - respectively. Otherwise, the return value is a signed distance │ │ │ │ - between the point and the nearest contour edge. See below a sample │ │ │ │ - output of the function where each image pixel is tested against the │ │ │ │ - contour: ![sample output](pics/pointpolygon.png) │ │ │ │ - Parameters: │ │ │ │ - contour - Input contour. │ │ │ │ - pt - Point tested against the contour. │ │ │ │ - measureDist - If true, the function estimates the signed │ │ │ │ - distance from the point to the nearest contour edge. │ │ │ │ - Otherwise, the function only checks if the point is inside a │ │ │ │ - contour or not. │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** rroottaatteeddRReeccttaanngglleeIInntteerrsseeccttiioonn ******** │ │ │ │ - public static int rotatedRectangleIntersection(_R_o_t_a_t_e_d_R_e_c_t rect1, │ │ │ │ - _R_o_t_a_t_e_d_R_e_c_t rect2, _M_a_t intersectingRegion) │ │ │ │ - Finds out if there is any intersection between two rotated │ │ │ │ - rectangles. If there is then the vertices of the intersecting │ │ │ │ - region are returned as well. Below are some examples of │ │ │ │ - intersection configurations. The hatched pattern indicates the │ │ │ │ - intersecting region and the red vertices are returned by the │ │ │ │ - function. ![intersection examples](pics/intersection.png) │ │ │ │ - Parameters: │ │ │ │ - rect1 - First rectangle │ │ │ │ - rect2 - Second rectangle │ │ │ │ - intersectingRegion - The output array of the vertices of the │ │ │ │ - intersecting region. It returns at most 8 vertices. Stored as │ │ │ │ - std::vector or cv::Mat as Mx1 of type CV_32FC2. │ │ │ │ - Returns: │ │ │ │ - One of #RectanglesIntersectTypes │ │ │ │ - o ******** aarrccLLeennggtthh ******** │ │ │ │ - public static double arcLength(_M_a_t_O_f_P_o_i_n_t_2_f curve, boolean closed) │ │ │ │ - Calculates a contour perimeter or a curve length. The function │ │ │ │ - computes a curve length or a closed contour perimeter. │ │ │ │ - Parameters: │ │ │ │ - curve - Input vector of 2D points, stored in std::vector or │ │ │ │ - Mat. │ │ │ │ - closed - Flag indicating whether the curve is closed or not. │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** ccoonnttoouurrAArreeaa ******** │ │ │ │ - public static double contourArea(_M_a_t contour, boolean oriented) │ │ │ │ - Calculates a contour area. The function computes a contour area. │ │ │ │ - Similarly to moments , the area is computed using the Green │ │ │ │ - formula. Thus, the returned area and the number of non-zero pixels, │ │ │ │ - if you draw the contour using #drawContours or #fillPoly , can be │ │ │ │ - different. Also, the function will most certainly give a wrong │ │ │ │ - results for contours with self-intersections. Example: │ │ │ │ - vector contour; contour.push_back(Point2f(0, 0)); │ │ │ │ - contour.push_back(Point2f(10, 0)); contour.push_back(Point2f(10, │ │ │ │ - 10)); contour.push_back(Point2f(5, 4)); double area0 = contourArea │ │ │ │ - (contour); vector approx; approxPolyDP(contour, approx, 5, │ │ │ │ - true); double area1 = contourArea(approx); cout << "area0 =" << │ │ │ │ - area0 << endl << "area1 =" << area1 << endl << "approx poly │ │ │ │ - vertices" << approx.size() << endl; │ │ │ │ - Parameters: │ │ │ │ - contour - Input vector of 2D points (contour vertices), │ │ │ │ - stored in std::vector or Mat. │ │ │ │ - oriented - Oriented area flag. If it is true, the function │ │ │ │ - returns a signed area value, depending on the contour │ │ │ │ - orientation (clockwise or counter-clockwise). Using this │ │ │ │ - feature you can determine orientation of a contour by taking │ │ │ │ - the sign of an area. By default, the parameter is false, │ │ │ │ - which means that the absolute value is returned. │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** ccoonnttoouurrAArreeaa ******** │ │ │ │ - public static double contourArea(_M_a_t contour) │ │ │ │ - Calculates a contour area. The function computes a contour area. │ │ │ │ - Similarly to moments , the area is computed using the Green │ │ │ │ - formula. Thus, the returned area and the number of non-zero pixels, │ │ │ │ - if you draw the contour using #drawContours or #fillPoly , can be │ │ │ │ - different. Also, the function will most certainly give a wrong │ │ │ │ - results for contours with self-intersections. Example: │ │ │ │ - vector contour; contour.push_back(Point2f(0, 0)); │ │ │ │ - contour.push_back(Point2f(10, 0)); contour.push_back(Point2f(10, │ │ │ │ - 10)); contour.push_back(Point2f(5, 4)); double area0 = contourArea │ │ │ │ - (contour); vector approx; approxPolyDP(contour, approx, 5, │ │ │ │ - true); double area1 = contourArea(approx); cout << "area0 =" << │ │ │ │ - area0 << endl << "area1 =" << area1 << endl << "approx poly │ │ │ │ - vertices" << approx.size() << endl; │ │ │ │ - Parameters: │ │ │ │ - contour - Input vector of 2D points (contour vertices), │ │ │ │ - stored in std::vector or Mat. depending on the contour │ │ │ │ - orientation (clockwise or counter-clockwise). Using this │ │ │ │ - feature you can determine orientation of a contour by taking │ │ │ │ - the sign of an area. By default, the parameter is false, │ │ │ │ - which means that the absolute value is returned. │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** bboouunnddiinnggRReecctt ******** │ │ │ │ - public static _R_e_c_t boundingRect(_M_a_t array) │ │ │ │ - Calculates the up-right bounding rectangle of a point set or non- │ │ │ │ - zero pixels of gray-scale image. The function calculates and │ │ │ │ - returns the minimal up-right bounding rectangle for the specified │ │ │ │ - point set or non-zero pixels of gray-scale image. │ │ │ │ - Parameters: │ │ │ │ - array - Input gray-scale image or 2D point set, stored in │ │ │ │ - std::vector or Mat. │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** ggeettRRoottaattiioonnMMaattrriixx22DD ******** │ │ │ │ - public static _M_a_t getRotationMatrix2D(_P_o_i_n_t center, double angle, │ │ │ │ - double scale) │ │ │ │ - Calculates an affine matrix of 2D rotation. The function calculates │ │ │ │ - the following matrix: \(\begin{bmatrix} \alpha & \beta & (1- \alpha │ │ │ │ - ) \cdot \texttt{center.x} - \beta \cdot \texttt{center.y} \\ - │ │ │ │ - \beta & \alpha & \beta \cdot \texttt{center.x} + (1- \alpha ) \cdot │ │ │ │ - \texttt{center.y} \end{bmatrix}\) where \(\begin{array}{l} \alpha = │ │ │ │ - \texttt{scale} \cdot \cos \texttt{angle} , \\ \beta = \texttt │ │ │ │ - {scale} \cdot \sin \texttt{angle} \end{array}\) The transformation │ │ │ │ - maps the rotation center to itself. If this is not the target, │ │ │ │ - adjust the shift. │ │ │ │ - Parameters: │ │ │ │ - center - Center of the rotation in the source image. │ │ │ │ - angle - Rotation angle in degrees. Positive values mean │ │ │ │ - counter-clockwise rotation (the coordinate origin is assumed │ │ │ │ - to be the top-left corner). │ │ │ │ - scale - Isotropic scale factor. SEE: getAffineTransform, │ │ │ │ - warpAffine, transform │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** iinnvveerrttAAffffiinneeTTrraannssffoorrmm ******** │ │ │ │ - public static void invertAffineTransform(_M_a_t M, _M_a_t iM) │ │ │ │ - Inverts an affine transformation. The function computes an inverse │ │ │ │ - affine transformation represented by \(2 \times 3\) matrix M: \ │ │ │ │ - (\begin{bmatrix} a_{11} & a_{12} & b_1 \\ a_{21} & a_{22} & b_2 │ │ │ │ - \end{bmatrix}\) The result is also a \(2 \times 3\) matrix of the │ │ │ │ - same type as M. │ │ │ │ - Parameters: │ │ │ │ - M - Original affine transformation. │ │ │ │ - iM - Output reverse affine transformation. │ │ │ │ - o ******** ggeettPPeerrssppeeccttiivveeTTrraannssffoorrmm ******** │ │ │ │ - public static _M_a_t getPerspectiveTransform(_M_a_t src, _M_a_t dst, │ │ │ │ - int solveMethod) │ │ │ │ - Calculates a perspective transform from four pairs of the │ │ │ │ - corresponding points. The function calculates the \(3 \times 3\) │ │ │ │ - matrix of a perspective transform so that: \(\begin{bmatrix} t_i │ │ │ │ - x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map_matrix} \cdot │ │ │ │ - \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\) where \(dst(i)= │ │ │ │ - (x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\) │ │ │ │ - Parameters: │ │ │ │ - src - Coordinates of quadrangle vertices in the source image. │ │ │ │ - dst - Coordinates of the corresponding quadrangle vertices in │ │ │ │ - the destination image. │ │ │ │ - solveMethod - method passed to cv::solve (#DecompTypes) SEE: │ │ │ │ - findHomography, warpPerspective, perspectiveTransform │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** ggeettPPeerrssppeeccttiivveeTTrraannssffoorrmm ******** │ │ │ │ - public static _M_a_t getPerspectiveTransform(_M_a_t src, _M_a_t dst) │ │ │ │ - Calculates a perspective transform from four pairs of the │ │ │ │ - corresponding points. The function calculates the \(3 \times 3\) │ │ │ │ - matrix of a perspective transform so that: \(\begin{bmatrix} t_i │ │ │ │ - x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map_matrix} \cdot │ │ │ │ - \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\) where \(dst(i)= │ │ │ │ - (x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\) │ │ │ │ - Parameters: │ │ │ │ - src - Coordinates of quadrangle vertices in the source image. │ │ │ │ - dst - Coordinates of the corresponding quadrangle vertices in │ │ │ │ - the destination image. SEE: findHomography, warpPerspective, │ │ │ │ - perspectiveTransform │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** ggeettAAffffiinneeTTrraannssffoorrmm ******** │ │ │ │ - public static _M_a_t getAffineTransform(_M_a_t_O_f_P_o_i_n_t_2_f src, │ │ │ │ - _M_a_t_O_f_P_o_i_n_t_2_f dst) │ │ │ │ =============================================================================== │ │ ├── ./usr/share/doc/opencv-doc/opencv5/html/javadoc/org/opencv/img_hash/Img_hash.html │ │ │┄ Ordering differences only │ │ │ @@ -66,25 +66,25 @@ │ │ │
  • Constructor Details │ │ │
      │ │ │
    1. Img_hash()
    2. │ │ │
    │ │ │
  • │ │ │
  • Method Details │ │ │
      │ │ │ -
    1. radialVarianceHash(Mat, Mat, double, int)
    2. │ │ │ -
    3. radialVarianceHash(Mat, Mat, double)
    4. │ │ │ -
    5. radialVarianceHash(Mat, Mat)
    6. │ │ │ -
    7. pHash(Mat, Mat)
    8. │ │ │
    9. marrHildrethHash(Mat, Mat, float, float)
    10. │ │ │
    11. marrHildrethHash(Mat, Mat, float)
    12. │ │ │
    13. marrHildrethHash(Mat, Mat)
    14. │ │ │ -
    15. colorMomentHash(Mat, Mat)
    16. │ │ │ +
    17. radialVarianceHash(Mat, Mat, double, int)
    18. │ │ │ +
    19. radialVarianceHash(Mat, Mat, double)
    20. │ │ │ +
    21. radialVarianceHash(Mat, Mat)
    22. │ │ │
    23. blockMeanHash(Mat, Mat, int)
    24. │ │ │
    25. blockMeanHash(Mat, Mat)
    26. │ │ │ +
    27. pHash(Mat, Mat)
    28. │ │ │
    29. averageHash(Mat, Mat)
    30. │ │ │ +
    31. colorMomentHash(Mat, Mat)
    32. │ │ │
    │ │ │
  • │ │ │ │ │ │ │ │ │
    │ │ │ │ │ │
    │ │ │ @@ -289,154 +289,120 @@ │ │ │ │ │ │ │ │ │
  • │ │ │
    │ │ │

    Method Details

    │ │ │
      │ │ │
    • │ │ │ -
      │ │ │ -

      radialVarianceHash

      │ │ │ +
      │ │ │ +

      marrHildrethHash

      │ │ │
      │ │ │ -
      public static void radialVarianceHash(Mat inputArr, │ │ │ +
      public static void marrHildrethHash(Mat inputArr, │ │ │ Mat outputArr, │ │ │ - double sigma, │ │ │ - int numOfAngleLine)
      │ │ │ -
      Computes radial variance hash of the input image
      │ │ │ + float alpha, │ │ │ + float scale)
      │ │ │ +
      Computes average hash value of the input image
      │ │ │
      │ │ │
      Parameters:
      │ │ │
      inputArr - input image want to compute hash value, │ │ │ type should be CV_8UC4, CV_8UC3, CV_8UC1.
      │ │ │ -
      outputArr - Hash value of input
      │ │ │ -
      sigma - Gaussian kernel standard deviation
      │ │ │ -
      numOfAngleLine - The number of angles to consider
      │ │ │ +
      outputArr - Hash value of input, it will contain 16 hex │ │ │ + decimal number, return type is CV_8U
      │ │ │ +
      alpha - int scale factor for marr wavelet (default=2).
      │ │ │ +
      scale - int level of scale factor (default = 1)
      │ │ │
      │ │ │
      │ │ │
      │ │ │
    • │ │ │
    • │ │ │ -
      │ │ │ -

      radialVarianceHash

      │ │ │ +
      │ │ │ +

      marrHildrethHash

      │ │ │
      │ │ │ -
      public static void radialVarianceHash(Mat inputArr, │ │ │ +
      public static void marrHildrethHash(Mat inputArr, │ │ │ Mat outputArr, │ │ │ - double sigma)
      │ │ │ -
      Computes radial variance hash of the input image
      │ │ │ -
      │ │ │ -
      Parameters:
      │ │ │ -
      inputArr - input image want to compute hash value, │ │ │ - type should be CV_8UC4, CV_8UC3, CV_8UC1.
      │ │ │ -
      outputArr - Hash value of input
      │ │ │ -
      sigma - Gaussian kernel standard deviation
      │ │ │ -
      │ │ │ -
      │ │ │ -
      │ │ │ -
    • │ │ │ -
    • │ │ │ -
      │ │ │ -

      radialVarianceHash

      │ │ │ -
      │ │ │ -
      public static void radialVarianceHash(Mat inputArr, │ │ │ - Mat outputArr)
      │ │ │ -
      Computes radial variance hash of the input image
      │ │ │ + float alpha)
      │ │ │ +
      Computes average hash value of the input image
      │ │ │
      │ │ │
      Parameters:
      │ │ │
      inputArr - input image want to compute hash value, │ │ │ type should be CV_8UC4, CV_8UC3, CV_8UC1.
      │ │ │ -
      outputArr - Hash value of input
      │ │ │ -
      │ │ │ -
  • │ │ │ - │ │ │ - │ │ │ -
  • │ │ │ -
    │ │ │ -

    pHash

    │ │ │ -
    │ │ │ -
    public static void pHash(Mat inputArr, │ │ │ - Mat outputArr)
    │ │ │ -
    Computes pHash value of the input image
    │ │ │ -
    │ │ │ -
    Parameters:
    │ │ │ -
    inputArr - input image want to compute hash value, │ │ │ - type should be CV_8UC4, CV_8UC3, CV_8UC1.
    │ │ │ -
    outputArr - Hash value of input, it will contain 8 uchar value
    │ │ │ +
    outputArr - Hash value of input, it will contain 16 hex │ │ │ + decimal number, return type is CV_8U
    │ │ │ +
    alpha - int scale factor for marr wavelet (default=2).
    │ │ │
    │ │ │
    │ │ │
    │ │ │
  • │ │ │
  • │ │ │ -
    │ │ │ +
    │ │ │

    marrHildrethHash

    │ │ │
    │ │ │
    public static void marrHildrethHash(Mat inputArr, │ │ │ - Mat outputArr, │ │ │ - float alpha, │ │ │ - float scale)
    │ │ │ + Mat outputArr)
    │ │ │
    Computes average hash value of the input image
    │ │ │
    │ │ │
    Parameters:
    │ │ │
    inputArr - input image want to compute hash value, │ │ │ type should be CV_8UC4, CV_8UC3, CV_8UC1.
    │ │ │
    outputArr - Hash value of input, it will contain 16 hex │ │ │ decimal number, return type is CV_8U
    │ │ │ -
    alpha - int scale factor for marr wavelet (default=2).
    │ │ │ -
    scale - int level of scale factor (default = 1)
    │ │ │
    │ │ │ │ │ │
    │ │ │
  • │ │ │
  • │ │ │ -
    │ │ │ -

    marrHildrethHash

    │ │ │ +
    │ │ │ +

    radialVarianceHash

    │ │ │
    │ │ │ -
    public static void marrHildrethHash(Mat inputArr, │ │ │ +
    public static void radialVarianceHash(Mat inputArr, │ │ │ Mat outputArr, │ │ │ - float alpha)
    │ │ │ -
    Computes average hash value of the input image
    │ │ │ + double sigma, │ │ │ + int numOfAngleLine)
    │ │ │ +
    Computes radial variance hash of the input image
    │ │ │
    │ │ │
    Parameters:
    │ │ │
    inputArr - input image want to compute hash value, │ │ │ type should be CV_8UC4, CV_8UC3, CV_8UC1.
    │ │ │ -
    outputArr - Hash value of input, it will contain 16 hex │ │ │ - decimal number, return type is CV_8U
    │ │ │ -
    alpha - int scale factor for marr wavelet (default=2).
    │ │ │ +
    outputArr - Hash value of input
    │ │ │ +
    sigma - Gaussian kernel standard deviation
    │ │ │ +
    numOfAngleLine - The number of angles to consider
    │ │ │
    │ │ │
    │ │ │
    │ │ │
  • │ │ │
  • │ │ │ -
    │ │ │ -

    marrHildrethHash

    │ │ │ +
    │ │ │ +

    radialVarianceHash

    │ │ │
    │ │ │ -
    public static void marrHildrethHash(Mat inputArr, │ │ │ - Mat outputArr)
    │ │ │ -
    Computes average hash value of the input image
    │ │ │ +
    public static void radialVarianceHash(Mat inputArr, │ │ │ + Mat outputArr, │ │ │ + double sigma)
    │ │ │ +
    Computes radial variance hash of the input image
    │ │ │
    │ │ │
    Parameters:
    │ │ │
    inputArr - input image want to compute hash value, │ │ │ type should be CV_8UC4, CV_8UC3, CV_8UC1.
    │ │ │ -
    outputArr - Hash value of input, it will contain 16 hex │ │ │ - decimal number, return type is CV_8U
    │ │ │ +
    outputArr - Hash value of input
    │ │ │ +
    sigma - Gaussian kernel standard deviation
    │ │ │
    │ │ │
    │ │ │
    │ │ │
  • │ │ │
  • │ │ │ -
    │ │ │ -

    colorMomentHash

    │ │ │ +
    │ │ │ +

    radialVarianceHash

    │ │ │
    │ │ │ -
    public static void colorMomentHash(Mat inputArr, │ │ │ +
    public static void radialVarianceHash(Mat inputArr, │ │ │ Mat outputArr)
    │ │ │ -
    Computes color moment hash of the input, the algorithm │ │ │ - is come from the paper "Perceptual Hashing for Color Images │ │ │ - Using Invariant Moments"
    │ │ │ +
    Computes radial variance hash of the input image
    │ │ │
    │ │ │
    Parameters:
    │ │ │
    inputArr - input image want to compute hash value, │ │ │ - type should be CV_8UC4, CV_8UC3 or CV_8UC1.
    │ │ │ -
    outputArr - 42 hash values with type CV_64F(double)
    │ │ │ + type should be CV_8UC4, CV_8UC3, CV_8UC1. │ │ │ +
    outputArr - Hash value of input
    │ │ │
    │ │ │
    │ │ │
    │ │ │
  • │ │ │
  • │ │ │
    │ │ │

    blockMeanHash

    │ │ │ @@ -466,28 +432,62 @@ │ │ │
    inputArr - input image want to compute hash value, type should be CV_8UC4, CV_8UC3 or CV_8UC1.
    │ │ │
    outputArr - Hash value of input, it will contain 16 hex decimal number, return type is CV_8U
    │ │ │ │ │ │ │ │ │
    │ │ │
  • │ │ │
  • │ │ │ +
    │ │ │ +

    pHash

    │ │ │ +
    │ │ │ +
    public static void pHash(Mat inputArr, │ │ │ + Mat outputArr)
    │ │ │ +
    Computes pHash value of the input image
    │ │ │ +
    │ │ │ +
    Parameters:
    │ │ │ +
    inputArr - input image want to compute hash value, │ │ │ + type should be CV_8UC4, CV_8UC3, CV_8UC1.
    │ │ │ +
    outputArr - Hash value of input, it will contain 8 uchar value
    │ │ │ +
    │ │ │ +
    │ │ │ +
    │ │ │ +
  • │ │ │ +
  • │ │ │
    │ │ │

    averageHash

    │ │ │
    │ │ │
    public static void averageHash(Mat inputArr, │ │ │ Mat outputArr)
    │ │ │
    Calculates img_hash::AverageHash in one call
    │ │ │
    │ │ │
    Parameters:
    │ │ │
    inputArr - input image want to compute hash value, type should be CV_8UC4, CV_8UC3 or CV_8UC1.
    │ │ │
    outputArr - Hash value of input, it will contain 16 hex decimal number, return type is CV_8U
    │ │ │
    │ │ │
    │ │ │
    │ │ │
  • │ │ │ +
  • │ │ │ +
    │ │ │ +

    colorMomentHash

    │ │ │ +
    │ │ │ +
    public static void colorMomentHash(Mat inputArr, │ │ │ + Mat outputArr)
    │ │ │ +
    Computes color moment hash of the input, the algorithm │ │ │ + is come from the paper "Perceptual Hashing for Color Images │ │ │ + Using Invariant Moments"
    │ │ │ +
    │ │ │ +
    Parameters:
    │ │ │ +
    inputArr - input image want to compute hash value, │ │ │ + type should be CV_8UC4, CV_8UC3 or CV_8UC1.
    │ │ │ +
    outputArr - 42 hash values with type CV_64F(double)
    │ │ │ +
    │ │ │ +
    │ │ │ +
    │ │ │ +
  • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ ├── html2text {} │ │ │ │ @@ -21,25 +21,25 @@ │ │ │ │ 4. _M_e_t_h_o_d_ _S_u_m_m_a_r_y │ │ │ │ 5. _F_i_e_l_d_ _D_e_t_a_i_l_s │ │ │ │ 1. _B_L_O_C_K___M_E_A_N___H_A_S_H___M_O_D_E___0 │ │ │ │ 2. _B_L_O_C_K___M_E_A_N___H_A_S_H___M_O_D_E___1 │ │ │ │ 6. _C_o_n_s_t_r_u_c_t_o_r_ _D_e_t_a_i_l_s │ │ │ │ 1. _I_m_g___h_a_s_h_(_) │ │ │ │ 7. _M_e_t_h_o_d_ _D_e_t_a_i_l_s │ │ │ │ - 1. _r_a_d_i_a_l_V_a_r_i_a_n_c_e_H_a_s_h_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _i_n_t_) │ │ │ │ - 2. _r_a_d_i_a_l_V_a_r_i_a_n_c_e_H_a_s_h_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ - 3. _r_a_d_i_a_l_V_a_r_i_a_n_c_e_H_a_s_h_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 4. _p_H_a_s_h_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 5. _m_a_r_r_H_i_l_d_r_e_t_h_H_a_s_h_(_M_a_t_,_ _M_a_t_,_ _f_l_o_a_t_,_ _f_l_o_a_t_) │ │ │ │ - 6. _m_a_r_r_H_i_l_d_r_e_t_h_H_a_s_h_(_M_a_t_,_ _M_a_t_,_ _f_l_o_a_t_) │ │ │ │ - 7. _m_a_r_r_H_i_l_d_r_e_t_h_H_a_s_h_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 8. _c_o_l_o_r_M_o_m_e_n_t_H_a_s_h_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 9. _b_l_o_c_k_M_e_a_n_H_a_s_h_(_M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 10. _b_l_o_c_k_M_e_a_n_H_a_s_h_(_M_a_t_,_ _M_a_t_) │ │ │ │ - 11. _a_v_e_r_a_g_e_H_a_s_h_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 1. _m_a_r_r_H_i_l_d_r_e_t_h_H_a_s_h_(_M_a_t_,_ _M_a_t_,_ _f_l_o_a_t_,_ _f_l_o_a_t_) │ │ │ │ + 2. _m_a_r_r_H_i_l_d_r_e_t_h_H_a_s_h_(_M_a_t_,_ _M_a_t_,_ _f_l_o_a_t_) │ │ │ │ + 3. _m_a_r_r_H_i_l_d_r_e_t_h_H_a_s_h_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 4. _r_a_d_i_a_l_V_a_r_i_a_n_c_e_H_a_s_h_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_,_ _i_n_t_) │ │ │ │ + 5. _r_a_d_i_a_l_V_a_r_i_a_n_c_e_H_a_s_h_(_M_a_t_,_ _M_a_t_,_ _d_o_u_b_l_e_) │ │ │ │ + 6. _r_a_d_i_a_l_V_a_r_i_a_n_c_e_H_a_s_h_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 7. _b_l_o_c_k_M_e_a_n_H_a_s_h_(_M_a_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ + 8. _b_l_o_c_k_M_e_a_n_H_a_s_h_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 9. _p_H_a_s_h_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 10. _a_v_e_r_a_g_e_H_a_s_h_(_M_a_t_,_ _M_a_t_) │ │ │ │ + 11. _c_o_l_o_r_M_o_m_e_n_t_H_a_s_h_(_M_a_t_,_ _M_a_t_) │ │ │ │ Hide sidebar [Hide sidebar][Show sidebar] Show sidebar │ │ │ │ ************ CCllaassss IImmgg__hhaasshh ************ │ │ │ │ _j_a_v_a_._l_a_n_g_._O_b_j_e_c_t │ │ │ │ org.opencv.img_hash.Img_hash │ │ │ │ =============================================================================== │ │ │ │ public class Img_hash extends _O_b_j_e_c_t │ │ │ │ * ********** FFiieelldd SSuummmmaarryy ********** │ │ │ │ @@ -111,48 +111,14 @@ │ │ │ │ public static final int BLOCK_MEAN_HASH_MODE_1 │ │ │ │ See Also: │ │ │ │ # _C_o_n_s_t_a_n_t_ _F_i_e_l_d_ _V_a_l_u_e_s │ │ │ │ * ********** CCoonnssttrruuccttoorr DDeettaaiillss ********** │ │ │ │ o ******** IImmgg__hhaasshh ******** │ │ │ │ public Img_hash() │ │ │ │ * ********** MMeetthhoodd DDeettaaiillss ********** │ │ │ │ - o ******** rraaddiiaallVVaarriiaanncceeHHaasshh ******** │ │ │ │ - public static void radialVarianceHash(_M_a_t inputArr, _M_a_t outputArr, │ │ │ │ - double sigma, int numOfAngleLine) │ │ │ │ - Computes radial variance hash of the input image │ │ │ │ - Parameters: │ │ │ │ - inputArr - input image want to compute hash value, type │ │ │ │ - should be CV_8UC4, CV_8UC3, CV_8UC1. │ │ │ │ - outputArr - Hash value of input │ │ │ │ - sigma - Gaussian kernel standard deviation │ │ │ │ - numOfAngleLine - The number of angles to consider │ │ │ │ - o ******** rraaddiiaallVVaarriiaanncceeHHaasshh ******** │ │ │ │ - public static void radialVarianceHash(_M_a_t inputArr, _M_a_t outputArr, │ │ │ │ - double sigma) │ │ │ │ - Computes radial variance hash of the input image │ │ │ │ - Parameters: │ │ │ │ - inputArr - input image want to compute hash value, type │ │ │ │ - should be CV_8UC4, CV_8UC3, CV_8UC1. │ │ │ │ - outputArr - Hash value of input │ │ │ │ - sigma - Gaussian kernel standard deviation │ │ │ │ - o ******** rraaddiiaallVVaarriiaanncceeHHaasshh ******** │ │ │ │ - public static void radialVarianceHash(_M_a_t inputArr, _M_a_t outputArr) │ │ │ │ - Computes radial variance hash of the input image │ │ │ │ - Parameters: │ │ │ │ - inputArr - input image want to compute hash value, type │ │ │ │ - should be CV_8UC4, CV_8UC3, CV_8UC1. │ │ │ │ - outputArr - Hash value of input │ │ │ │ - o ******** ppHHaasshh ******** │ │ │ │ - public static void pHash(_M_a_t inputArr, _M_a_t outputArr) │ │ │ │ - Computes pHash value of the input image │ │ │ │ - Parameters: │ │ │ │ - inputArr - input image want to compute hash value, type │ │ │ │ - should be CV_8UC4, CV_8UC3, CV_8UC1. │ │ │ │ - outputArr - Hash value of input, it will contain 8 uchar │ │ │ │ - value │ │ │ │ o ******** mmaarrrrHHiillddrreetthhHHaasshh ******** │ │ │ │ public static void marrHildrethHash(_M_a_t inputArr, _M_a_t outputArr, │ │ │ │ float alpha, float scale) │ │ │ │ Computes average hash value of the input image │ │ │ │ Parameters: │ │ │ │ inputArr - input image want to compute hash value, type │ │ │ │ should be CV_8UC4, CV_8UC3, CV_8UC1. │ │ │ │ @@ -174,23 +140,40 @@ │ │ │ │ public static void marrHildrethHash(_M_a_t inputArr, _M_a_t outputArr) │ │ │ │ Computes average hash value of the input image │ │ │ │ Parameters: │ │ │ │ inputArr - input image want to compute hash value, type │ │ │ │ should be CV_8UC4, CV_8UC3, CV_8UC1. │ │ │ │ outputArr - Hash value of input, it will contain 16 hex │ │ │ │ decimal number, return type is CV_8U │ │ │ │ - o ******** ccoolloorrMMoommeennttHHaasshh ******** │ │ │ │ - public static void colorMomentHash(_M_a_t inputArr, _M_a_t outputArr) │ │ │ │ - Computes color moment hash of the input, the algorithm is come from │ │ │ │ - the paper "Perceptual Hashing for Color Images Using Invariant │ │ │ │ - Moments" │ │ │ │ + o ******** rraaddiiaallVVaarriiaanncceeHHaasshh ******** │ │ │ │ + public static void radialVarianceHash(_M_a_t inputArr, _M_a_t outputArr, │ │ │ │ + double sigma, int numOfAngleLine) │ │ │ │ + Computes radial variance hash of the input image │ │ │ │ Parameters: │ │ │ │ inputArr - input image want to compute hash value, type │ │ │ │ - should be CV_8UC4, CV_8UC3 or CV_8UC1. │ │ │ │ - outputArr - 42 hash values with type CV_64F(double) │ │ │ │ + should be CV_8UC4, CV_8UC3, CV_8UC1. │ │ │ │ + outputArr - Hash value of input │ │ │ │ + sigma - Gaussian kernel standard deviation │ │ │ │ + numOfAngleLine - The number of angles to consider │ │ │ │ + o ******** rraaddiiaallVVaarriiaanncceeHHaasshh ******** │ │ │ │ + public static void radialVarianceHash(_M_a_t inputArr, _M_a_t outputArr, │ │ │ │ + double sigma) │ │ │ │ + Computes radial variance hash of the input image │ │ │ │ + Parameters: │ │ │ │ + inputArr - input image want to compute hash value, type │ │ │ │ + should be CV_8UC4, CV_8UC3, CV_8UC1. │ │ │ │ + outputArr - Hash value of input │ │ │ │ + sigma - Gaussian kernel standard deviation │ │ │ │ + o ******** rraaddiiaallVVaarriiaanncceeHHaasshh ******** │ │ │ │ + public static void radialVarianceHash(_M_a_t inputArr, _M_a_t outputArr) │ │ │ │ + Computes radial variance hash of the input image │ │ │ │ + Parameters: │ │ │ │ + inputArr - input image want to compute hash value, type │ │ │ │ + should be CV_8UC4, CV_8UC3, CV_8UC1. │ │ │ │ + outputArr - Hash value of input │ │ │ │ o ******** bblloocckkMMeeaannHHaasshh ******** │ │ │ │ public static void blockMeanHash(_M_a_t inputArr, _M_a_t outputArr, │ │ │ │ int mode) │ │ │ │ Computes block mean hash of the input image │ │ │ │ Parameters: │ │ │ │ inputArr - input image want to compute hash value, type │ │ │ │ should be CV_8UC4, CV_8UC3 or CV_8UC1. │ │ │ │ @@ -201,16 +184,33 @@ │ │ │ │ public static void blockMeanHash(_M_a_t inputArr, _M_a_t outputArr) │ │ │ │ Computes block mean hash of the input image │ │ │ │ Parameters: │ │ │ │ inputArr - input image want to compute hash value, type │ │ │ │ should be CV_8UC4, CV_8UC3 or CV_8UC1. │ │ │ │ outputArr - Hash value of input, it will contain 16 hex │ │ │ │ decimal number, return type is CV_8U │ │ │ │ + o ******** ppHHaasshh ******** │ │ │ │ + public static void pHash(_M_a_t inputArr, _M_a_t outputArr) │ │ │ │ + Computes pHash value of the input image │ │ │ │ + Parameters: │ │ │ │ + inputArr - input image want to compute hash value, type │ │ │ │ + should be CV_8UC4, CV_8UC3, CV_8UC1. │ │ │ │ + outputArr - Hash value of input, it will contain 8 uchar │ │ │ │ + value │ │ │ │ o ******** aavveerraaggeeHHaasshh ******** │ │ │ │ public static void averageHash(_M_a_t inputArr, _M_a_t outputArr) │ │ │ │ Calculates img_hash::AverageHash in one call │ │ │ │ Parameters: │ │ │ │ inputArr - input image want to compute hash value, type │ │ │ │ should be CV_8UC4, CV_8UC3 or CV_8UC1. │ │ │ │ outputArr - Hash value of input, it will contain 16 hex │ │ │ │ decimal number, return type is CV_8U │ │ │ │ + o ******** ccoolloorrMMoommeennttHHaasshh ******** │ │ │ │ + public static void colorMomentHash(_M_a_t inputArr, _M_a_t outputArr) │ │ │ │ + Computes color moment hash of the input, the algorithm is come from │ │ │ │ + the paper "Perceptual Hashing for Color Images Using Invariant │ │ │ │ + Moments" │ │ │ │ + Parameters: │ │ │ │ + inputArr - input image want to compute hash value, type │ │ │ │ + should be CV_8UC4, CV_8UC3 or CV_8UC1. │ │ │ │ + outputArr - 42 hash values with type CV_64F(double) │ │ │ │ =============================================================================== │ │ ├── ./usr/share/doc/opencv-doc/opencv5/html/javadoc/org/opencv/objdetect/Objdetect.html │ │ │┄ Ordering differences only │ │ │ @@ -125,23 +125,23 @@ │ │ │
  • findCirclesGrid(Mat, Size, Mat)
  • │ │ │
  • drawDetectedCornersCharuco(Mat, Mat, Mat, Scalar)
  • │ │ │
  • drawDetectedCornersCharuco(Mat, Mat, Mat)
  • │ │ │
  • drawDetectedCornersCharuco(Mat, Mat)
  • │ │ │
  • drawDetectedDiamonds(Mat, List, Mat, Scalar)
  • │ │ │
  • drawDetectedDiamonds(Mat, List, Mat)
  • │ │ │
  • drawDetectedDiamonds(Mat, List)
  • │ │ │ -
  • getPredefinedDictionary(int)
  • │ │ │ -
  • extendDictionary(int, int, Dictionary, int)
  • │ │ │ -
  • extendDictionary(int, int, Dictionary)
  • │ │ │ -
  • extendDictionary(int, int)
  • │ │ │
  • drawDetectedMarkers(Mat, List, Mat, Scalar)
  • │ │ │
  • drawDetectedMarkers(Mat, List, Mat)
  • │ │ │
  • drawDetectedMarkers(Mat, List)
  • │ │ │
  • generateImageMarker(Dictionary, int, int, Mat, int)
  • │ │ │
  • generateImageMarker(Dictionary, int, int, Mat)
  • │ │ │ +
  • getPredefinedDictionary(int)
  • │ │ │ +
  • extendDictionary(int, int, Dictionary, int)
  • │ │ │ +
  • extendDictionary(int, int, Dictionary)
  • │ │ │ +
  • extendDictionary(int, int)
  • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ │ │ │
    │ │ │ @@ -1858,101 +1858,14 @@ │ │ │ are painted and the markers identifiers if provided. │ │ │ Useful for debugging purposes. │ │ │ │ │ │
    │ │ │ │ │ │ │ │ │
  • │ │ │ -
    │ │ │ -

    getPredefinedDictionary

    │ │ │ -
    │ │ │ -
    public static Dictionary getPredefinedDictionary(int dict)
    │ │ │ -
    Returns one of the predefined dictionaries referenced by DICT_*.
    │ │ │ -
    │ │ │ -
    Parameters:
    │ │ │ -
    dict - automatically generated
    │ │ │ -
    Returns:
    │ │ │ -
    automatically generated
    │ │ │ -
    │ │ │ -
    │ │ │ -
    │ │ │ -
  • │ │ │ -
  • │ │ │ -
    │ │ │ -

    extendDictionary

    │ │ │ -
    │ │ │ -
    public static Dictionary extendDictionary(int nMarkers, │ │ │ - int markerSize, │ │ │ - Dictionary baseDictionary, │ │ │ - int randomSeed)
    │ │ │ -
    Extend base dictionary by new nMarkers
    │ │ │ -
    │ │ │ -
    Parameters:
    │ │ │ -
    nMarkers - number of markers in the dictionary
    │ │ │ -
    markerSize - number of bits per dimension of each markers
    │ │ │ -
    baseDictionary - Include the markers in this dictionary at the beginning (optional)
    │ │ │ -
    randomSeed - a user supplied seed for theRNG() │ │ │ - │ │ │ -This function creates a new dictionary composed by nMarkers markers and each markers composed │ │ │ -by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly │ │ │ -included and the rest are generated based on them. If the size of baseDictionary is higher │ │ │ -than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.
    │ │ │ -
    Returns:
    │ │ │ -
    automatically generated
    │ │ │ -
    │ │ │ -
    │ │ │ -
    │ │ │ -
  • │ │ │ -
  • │ │ │ -
    │ │ │ -

    extendDictionary

    │ │ │ -
    │ │ │ -
    public static Dictionary extendDictionary(int nMarkers, │ │ │ - int markerSize, │ │ │ - Dictionary baseDictionary)
    │ │ │ -
    Extend base dictionary by new nMarkers
    │ │ │ -
    │ │ │ -
    Parameters:
    │ │ │ -
    nMarkers - number of markers in the dictionary
    │ │ │ -
    markerSize - number of bits per dimension of each markers
    │ │ │ -
    baseDictionary - Include the markers in this dictionary at the beginning (optional) │ │ │ - │ │ │ -This function creates a new dictionary composed by nMarkers markers and each markers composed │ │ │ -by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly │ │ │ -included and the rest are generated based on them. If the size of baseDictionary is higher │ │ │ -than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.
    │ │ │ -
    Returns:
    │ │ │ -
    automatically generated
    │ │ │ -
    │ │ │ -
    │ │ │ -
    │ │ │ -
  • │ │ │ -
  • │ │ │ -
    │ │ │ -

    extendDictionary

    │ │ │ -
    │ │ │ -
    public static Dictionary extendDictionary(int nMarkers, │ │ │ - int markerSize)
    │ │ │ -
    Extend base dictionary by new nMarkers
    │ │ │ -
    │ │ │ -
    Parameters:
    │ │ │ -
    nMarkers - number of markers in the dictionary
    │ │ │ -
    markerSize - number of bits per dimension of each markers │ │ │ - │ │ │ -This function creates a new dictionary composed by nMarkers markers and each markers composed │ │ │ -by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly │ │ │ -included and the rest are generated based on them. If the size of baseDictionary is higher │ │ │ -than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.
    │ │ │ -
    Returns:
    │ │ │ -
    automatically generated
    │ │ │ -
    │ │ │ -
    │ │ │ -
    │ │ │ -
  • │ │ │ -
  • │ │ │
    │ │ │

    drawDetectedMarkers

    │ │ │
    │ │ │
    public static void drawDetectedMarkers(Mat image, │ │ │ List<Mat> corners, │ │ │ Mat ids, │ │ │ Scalar borderColor)
    │ │ │ @@ -2063,14 +1976,101 @@ │ │ │
    img - output image with the marker │ │ │ │ │ │ This function returns a marker image in its canonical form (i.e. ready to be printed)
    │ │ │ │ │ │
    │ │ │
    │ │ │
  • │ │ │ +
  • │ │ │ +
    │ │ │ +

    getPredefinedDictionary

    │ │ │ +
    │ │ │ +
    public static Dictionary getPredefinedDictionary(int dict)
    │ │ │ +
    Returns one of the predefined dictionaries referenced by DICT_*.
    │ │ │ +
    │ │ │ +
    Parameters:
    │ │ │ +
    dict - automatically generated
    │ │ │ +
    Returns:
    │ │ │ +
    automatically generated
    │ │ │ +
    │ │ │ +
    │ │ │ +
    │ │ │ +
  • │ │ │ +
  • │ │ │ +
    │ │ │ +

    extendDictionary

    │ │ │ +
    │ │ │ +
    public static Dictionary extendDictionary(int nMarkers, │ │ │ + int markerSize, │ │ │ + Dictionary baseDictionary, │ │ │ + int randomSeed)
    │ │ │ +
    Extend base dictionary by new nMarkers
    │ │ │ +
    │ │ │ +
    Parameters:
    │ │ │ +
    nMarkers - number of markers in the dictionary
    │ │ │ +
    markerSize - number of bits per dimension of each markers
    │ │ │ +
    baseDictionary - Include the markers in this dictionary at the beginning (optional)
    │ │ │ +
    randomSeed - a user supplied seed for theRNG() │ │ │ + │ │ │ +This function creates a new dictionary composed by nMarkers markers and each markers composed │ │ │ +by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly │ │ │ +included and the rest are generated based on them. If the size of baseDictionary is higher │ │ │ +than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.
    │ │ │ +
    Returns:
    │ │ │ +
    automatically generated
    │ │ │ +
    │ │ │ +
    │ │ │ +
    │ │ │ +
  • │ │ │ +
  • │ │ │ +
    │ │ │ +

    extendDictionary

    │ │ │ +
    │ │ │ +
    public static Dictionary extendDictionary(int nMarkers, │ │ │ + int markerSize, │ │ │ + Dictionary baseDictionary)
    │ │ │ +
    Extend base dictionary by new nMarkers
    │ │ │ +
    │ │ │ +
    Parameters:
    │ │ │ +
    nMarkers - number of markers in the dictionary
    │ │ │ +
    markerSize - number of bits per dimension of each markers
    │ │ │ +
    baseDictionary - Include the markers in this dictionary at the beginning (optional) │ │ │ + │ │ │ +This function creates a new dictionary composed by nMarkers markers and each markers composed │ │ │ +by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly │ │ │ +included and the rest are generated based on them. If the size of baseDictionary is higher │ │ │ +than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.
    │ │ │ +
    Returns:
    │ │ │ +
    automatically generated
    │ │ │ +
    │ │ │ +
    │ │ │ +
    │ │ │ +
  • │ │ │ +
  • │ │ │ +
    │ │ │ +

    extendDictionary

    │ │ │ +
    │ │ │ +
    public static Dictionary extendDictionary(int nMarkers, │ │ │ + int markerSize)
    │ │ │ +
    Extend base dictionary by new nMarkers
    │ │ │ +
    │ │ │ +
    Parameters:
    │ │ │ +
    nMarkers - number of markers in the dictionary
    │ │ │ +
    markerSize - number of bits per dimension of each markers │ │ │ + │ │ │ +This function creates a new dictionary composed by nMarkers markers and each markers composed │ │ │ +by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly │ │ │ +included and the rest are generated based on them. If the size of baseDictionary is higher │ │ │ +than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.
    │ │ │ +
    Returns:
    │ │ │ +
    automatically generated
    │ │ │ +
    │ │ │ +
    │ │ │ +
    │ │ │ +
  • │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
    │ │ │ ├── html2text {} │ │ │ │ @@ -80,23 +80,23 @@ │ │ │ │ 14. _f_i_n_d_C_i_r_c_l_e_s_G_r_i_d_(_M_a_t_,_ _S_i_z_e_,_ _M_a_t_) │ │ │ │ 15. _d_r_a_w_D_e_t_e_c_t_e_d_C_o_r_n_e_r_s_C_h_a_r_u_c_o_(_M_a_t_,_ _M_a_t_,_ _M_a_t_,_ _S_c_a_l_a_r_) │ │ │ │ 16. _d_r_a_w_D_e_t_e_c_t_e_d_C_o_r_n_e_r_s_C_h_a_r_u_c_o_(_M_a_t_,_ _M_a_t_,_ _M_a_t_) │ │ │ │ 17. _d_r_a_w_D_e_t_e_c_t_e_d_C_o_r_n_e_r_s_C_h_a_r_u_c_o_(_M_a_t_,_ _M_a_t_) │ │ │ │ 18. _d_r_a_w_D_e_t_e_c_t_e_d_D_i_a_m_o_n_d_s_(_M_a_t_,_ _L_i_s_t_,_ _M_a_t_,_ _S_c_a_l_a_r_) │ │ │ │ 19. _d_r_a_w_D_e_t_e_c_t_e_d_D_i_a_m_o_n_d_s_(_M_a_t_,_ _L_i_s_t_,_ _M_a_t_) │ │ │ │ 20. _d_r_a_w_D_e_t_e_c_t_e_d_D_i_a_m_o_n_d_s_(_M_a_t_,_ _L_i_s_t_) │ │ │ │ - 21. _g_e_t_P_r_e_d_e_f_i_n_e_d_D_i_c_t_i_o_n_a_r_y_(_i_n_t_) │ │ │ │ - 22. _e_x_t_e_n_d_D_i_c_t_i_o_n_a_r_y_(_i_n_t_,_ _i_n_t_,_ _D_i_c_t_i_o_n_a_r_y_,_ _i_n_t_) │ │ │ │ - 23. _e_x_t_e_n_d_D_i_c_t_i_o_n_a_r_y_(_i_n_t_,_ _i_n_t_,_ _D_i_c_t_i_o_n_a_r_y_) │ │ │ │ - 24. _e_x_t_e_n_d_D_i_c_t_i_o_n_a_r_y_(_i_n_t_,_ _i_n_t_) │ │ │ │ - 25. _d_r_a_w_D_e_t_e_c_t_e_d_M_a_r_k_e_r_s_(_M_a_t_,_ _L_i_s_t_,_ _M_a_t_,_ _S_c_a_l_a_r_) │ │ │ │ - 26. _d_r_a_w_D_e_t_e_c_t_e_d_M_a_r_k_e_r_s_(_M_a_t_,_ _L_i_s_t_,_ _M_a_t_) │ │ │ │ - 27. _d_r_a_w_D_e_t_e_c_t_e_d_M_a_r_k_e_r_s_(_M_a_t_,_ _L_i_s_t_) │ │ │ │ - 28. _g_e_n_e_r_a_t_e_I_m_a_g_e_M_a_r_k_e_r_(_D_i_c_t_i_o_n_a_r_y_,_ _i_n_t_,_ _i_n_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ - 29. _g_e_n_e_r_a_t_e_I_m_a_g_e_M_a_r_k_e_r_(_D_i_c_t_i_o_n_a_r_y_,_ _i_n_t_,_ _i_n_t_,_ _M_a_t_) │ │ │ │ + 21. _d_r_a_w_D_e_t_e_c_t_e_d_M_a_r_k_e_r_s_(_M_a_t_,_ _L_i_s_t_,_ _M_a_t_,_ _S_c_a_l_a_r_) │ │ │ │ + 22. _d_r_a_w_D_e_t_e_c_t_e_d_M_a_r_k_e_r_s_(_M_a_t_,_ _L_i_s_t_,_ _M_a_t_) │ │ │ │ + 23. _d_r_a_w_D_e_t_e_c_t_e_d_M_a_r_k_e_r_s_(_M_a_t_,_ _L_i_s_t_) │ │ │ │ + 24. _g_e_n_e_r_a_t_e_I_m_a_g_e_M_a_r_k_e_r_(_D_i_c_t_i_o_n_a_r_y_,_ _i_n_t_,_ _i_n_t_,_ _M_a_t_,_ _i_n_t_) │ │ │ │ + 25. _g_e_n_e_r_a_t_e_I_m_a_g_e_M_a_r_k_e_r_(_D_i_c_t_i_o_n_a_r_y_,_ _i_n_t_,_ _i_n_t_,_ _M_a_t_) │ │ │ │ + 26. _g_e_t_P_r_e_d_e_f_i_n_e_d_D_i_c_t_i_o_n_a_r_y_(_i_n_t_) │ │ │ │ + 27. _e_x_t_e_n_d_D_i_c_t_i_o_n_a_r_y_(_i_n_t_,_ _i_n_t_,_ _D_i_c_t_i_o_n_a_r_y_,_ _i_n_t_) │ │ │ │ + 28. _e_x_t_e_n_d_D_i_c_t_i_o_n_a_r_y_(_i_n_t_,_ _i_n_t_,_ _D_i_c_t_i_o_n_a_r_y_) │ │ │ │ + 29. _e_x_t_e_n_d_D_i_c_t_i_o_n_a_r_y_(_i_n_t_,_ _i_n_t_) │ │ │ │ Hide sidebar [Hide sidebar][Show sidebar] Show sidebar │ │ │ │ ************ CCllaassss OObbjjddeetteecctt ************ │ │ │ │ _j_a_v_a_._l_a_n_g_._O_b_j_e_c_t │ │ │ │ org.opencv.objdetect.Objdetect │ │ │ │ =============================================================================== │ │ │ │ public class Objdetect extends _O_b_j_e_c_t │ │ │ │ * ********** FFiieelldd SSuummmmaarryy ********** │ │ │ │ @@ -971,73 +971,14 @@ │ │ │ │ the dimensions of this array should be Nx4. The order of the │ │ │ │ corners should be clockwise. returned by detectCharucoDiamond │ │ │ │ () (e.g. std::vector). Optional, if not provided, ids │ │ │ │ are not painted. are calculated based on this one. Given an │ │ │ │ array of detected diamonds, this functions draws them in the │ │ │ │ image. The marker borders are painted and the markers │ │ │ │ identifiers if provided. Useful for debugging purposes. │ │ │ │ - o ******** ggeettPPrreeddeeffiinneeddDDiiccttiioonnaarryy ******** │ │ │ │ - public static _D_i_c_t_i_o_n_a_r_y getPredefinedDictionary(int dict) │ │ │ │ - Returns one of the predefined dictionaries referenced by DICT_*. │ │ │ │ - Parameters: │ │ │ │ - dict - automatically generated │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** eexxtteennddDDiiccttiioonnaarryy ******** │ │ │ │ - public static _D_i_c_t_i_o_n_a_r_y extendDictionary(int nMarkers, │ │ │ │ - int markerSize, _D_i_c_t_i_o_n_a_r_y baseDictionary, int randomSeed) │ │ │ │ - Extend base dictionary by new nMarkers │ │ │ │ - Parameters: │ │ │ │ - nMarkers - number of markers in the dictionary │ │ │ │ - markerSize - number of bits per dimension of each markers │ │ │ │ - baseDictionary - Include the markers in this dictionary at │ │ │ │ - the beginning (optional) │ │ │ │ - randomSeed - a user supplied seed for theRNG() This function │ │ │ │ - creates a new dictionary composed by nMarkers markers and │ │ │ │ - each markers composed by markerSize x markerSize bits. If │ │ │ │ - baseDictionary is provided, its markers are directly included │ │ │ │ - and the rest are generated based on them. If the size of │ │ │ │ - baseDictionary is higher than nMarkers, only the first │ │ │ │ - nMarkers in baseDictionary are taken and no new marker is │ │ │ │ - added. │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** eexxtteennddDDiiccttiioonnaarryy ******** │ │ │ │ - public static _D_i_c_t_i_o_n_a_r_y extendDictionary(int nMarkers, │ │ │ │ - int markerSize, _D_i_c_t_i_o_n_a_r_y baseDictionary) │ │ │ │ - Extend base dictionary by new nMarkers │ │ │ │ - Parameters: │ │ │ │ - nMarkers - number of markers in the dictionary │ │ │ │ - markerSize - number of bits per dimension of each markers │ │ │ │ - baseDictionary - Include the markers in this dictionary at │ │ │ │ - the beginning (optional) This function creates a new │ │ │ │ - dictionary composed by nMarkers markers and each markers │ │ │ │ - composed by markerSize x markerSize bits. If baseDictionary │ │ │ │ - is provided, its markers are directly included and the rest │ │ │ │ - are generated based on them. If the size of baseDictionary is │ │ │ │ - higher than nMarkers, only the first nMarkers in │ │ │ │ - baseDictionary are taken and no new marker is added. │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ - o ******** eexxtteennddDDiiccttiioonnaarryy ******** │ │ │ │ - public static _D_i_c_t_i_o_n_a_r_y extendDictionary(int nMarkers, │ │ │ │ - int markerSize) │ │ │ │ - Extend base dictionary by new nMarkers │ │ │ │ - Parameters: │ │ │ │ - nMarkers - number of markers in the dictionary │ │ │ │ - markerSize - number of bits per dimension of each markers │ │ │ │ - This function creates a new dictionary composed by nMarkers │ │ │ │ - markers and each markers composed by markerSize x markerSize │ │ │ │ - bits. If baseDictionary is provided, its markers are directly │ │ │ │ - included and the rest are generated based on them. If the │ │ │ │ - size of baseDictionary is higher than nMarkers, only the │ │ │ │ - first nMarkers in baseDictionary are taken and no new marker │ │ │ │ - is added. │ │ │ │ - Returns: │ │ │ │ - automatically generated │ │ │ │ o ******** ddrraawwDDeetteecctteeddMMaarrkkeerrss ******** │ │ │ │ public static void drawDetectedMarkers(_M_a_t image, │ │ │ │ _L_i_s_t<_M_a_t> corners, _M_a_t ids, _S_c_a_l_a_r borderColor) │ │ │ │ Draw detected markers in image │ │ │ │ Parameters: │ │ │ │ image - input/output image. It must have 1 or 3 channels. The │ │ │ │ number of channels is not altered. │ │ │ │ @@ -1111,8 +1052,67 @@ │ │ │ │ dictionary - dictionary of markers indicating the type of │ │ │ │ markers │ │ │ │ id - identifier of the marker that will be returned. It has │ │ │ │ to be a valid id in the specified dictionary. │ │ │ │ sidePixels - size of the image in pixels │ │ │ │ img - output image with the marker This function returns a │ │ │ │ marker image in its canonical form (i.e. ready to be printed) │ │ │ │ + o ******** ggeettPPrreeddeeffiinneeddDDiiccttiioonnaarryy ******** │ │ │ │ + public static _D_i_c_t_i_o_n_a_r_y getPredefinedDictionary(int dict) │ │ │ │ + Returns one of the predefined dictionaries referenced by DICT_*. │ │ │ │ + Parameters: │ │ │ │ + dict - automatically generated │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** eexxtteennddDDiiccttiioonnaarryy ******** │ │ │ │ + public static _D_i_c_t_i_o_n_a_r_y extendDictionary(int nMarkers, │ │ │ │ + int markerSize, _D_i_c_t_i_o_n_a_r_y baseDictionary, int randomSeed) │ │ │ │ + Extend base dictionary by new nMarkers │ │ │ │ + Parameters: │ │ │ │ + nMarkers - number of markers in the dictionary │ │ │ │ + markerSize - number of bits per dimension of each markers │ │ │ │ + baseDictionary - Include the markers in this dictionary at │ │ │ │ + the beginning (optional) │ │ │ │ + randomSeed - a user supplied seed for theRNG() This function │ │ │ │ + creates a new dictionary composed by nMarkers markers and │ │ │ │ + each markers composed by markerSize x markerSize bits. If │ │ │ │ + baseDictionary is provided, its markers are directly included │ │ │ │ + and the rest are generated based on them. If the size of │ │ │ │ + baseDictionary is higher than nMarkers, only the first │ │ │ │ + nMarkers in baseDictionary are taken and no new marker is │ │ │ │ + added. │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** eexxtteennddDDiiccttiioonnaarryy ******** │ │ │ │ + public static _D_i_c_t_i_o_n_a_r_y extendDictionary(int nMarkers, │ │ │ │ + int markerSize, _D_i_c_t_i_o_n_a_r_y baseDictionary) │ │ │ │ + Extend base dictionary by new nMarkers │ │ │ │ + Parameters: │ │ │ │ + nMarkers - number of markers in the dictionary │ │ │ │ + markerSize - number of bits per dimension of each markers │ │ │ │ + baseDictionary - Include the markers in this dictionary at │ │ │ │ + the beginning (optional) This function creates a new │ │ │ │ + dictionary composed by nMarkers markers and each markers │ │ │ │ + composed by markerSize x markerSize bits. If baseDictionary │ │ │ │ + is provided, its markers are directly included and the rest │ │ │ │ + are generated based on them. If the size of baseDictionary is │ │ │ │ + higher than nMarkers, only the first nMarkers in │ │ │ │ + baseDictionary are taken and no new marker is added. │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ + o ******** eexxtteennddDDiiccttiioonnaarryy ******** │ │ │ │ + public static _D_i_c_t_i_o_n_a_r_y extendDictionary(int nMarkers, │ │ │ │ + int markerSize) │ │ │ │ + Extend base dictionary by new nMarkers │ │ │ │ + Parameters: │ │ │ │ + nMarkers - number of markers in the dictionary │ │ │ │ + markerSize - number of bits per dimension of each markers │ │ │ │ + This function creates a new dictionary composed by nMarkers │ │ │ │ + markers and each markers composed by markerSize x markerSize │ │ │ │ + bits. If baseDictionary is provided, its markers are directly │ │ │ │ + included and the rest are generated based on them. If the │ │ │ │ + size of baseDictionary is higher than nMarkers, only the │ │ │ │ + first nMarkers in baseDictionary are taken and no new marker │ │ │ │ + is added. │ │ │ │ + Returns: │ │ │ │ + automatically generated │ │ │ │ =============================================================================== │ │ ├── ./usr/share/doc/opencv-doc/opencv5/html/javadoc/org/opencv/text/Text.html │ │ │ @@ -209,32 +209,32 @@ │ │ │ 00000d00: 3022 3e4d 6574 686f 6420 5375 6d6d 6172 0">Method Summar │ │ │ 00000d10: 793c 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c y.
  • < │ │ │ 00000d20: 6120 6872 6566 3d22 2366 6965 6c64 2d64 a href="#field-d │ │ │ 00000d30: 6574 6169 6c22 2074 6162 696e 6465 783d etail" tabindex= │ │ │ 00000d40: 2230 223e 4669 656c 6420 4465 7461 696c "0">Field Detail │ │ │ 00000d50: 733c 2f61 3e0a 3c6f 6c20 636c 6173 733d s.
      .
    1. │ │ │ -00000d70: 3c61 2068 7265 663d 2223 4f43 525f 4c45 OCR_LEVEL │ │ │ -00000da0: 5f57 4f52 443c 2f61 3e3c 2f6c 693e 0a3c _WORD
    2. .< │ │ │ -00000db0: 6c69 3e3c 6120 6872 6566 3d22 234f 4352 li>OC │ │ │ -00000de0: 525f 4c45 5645 4c5f 5445 5854 4c49 4e45 R_LEVEL_TEXTLINE │ │ │ -00000df0: 3c2f 613e 3c2f 6c69 3e0a 3c6c 693e 3c61 .
    3. ERFIL │ │ │ -00000e30: 5445 525f 4e4d 5f52 4742 4c47 7261 643c TER_NM_RGBLGrad< │ │ │ -00000e40: 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c 6120 /a>
    4. .
    5. ERFILTE │ │ │ -00000e80: 525f 4e4d 5f49 4853 4772 6164 3c2f 613e R_NM_IHSGrad │ │ │ +00000d70: 3c61 2068 7265 663d 2223 4552 4649 4c54 ERF │ │ │ +00000da0: 494c 5445 525f 4e4d 5f52 4742 4c47 7261 ILTER_NM_RGBLGra │ │ │ +00000db0: 643c 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c d
    6. .
    7. < │ │ │ +00000dc0: 6120 6872 6566 3d22 2345 5246 494c 5445 a href="#ERFILTE │ │ │ +00000dd0: 525f 4e4d 5f49 4853 4772 6164 2220 7461 R_NM_IHSGrad" ta │ │ │ +00000de0: 6269 6e64 6578 3d22 3022 3e45 5246 494c bindex="0">ERFIL │ │ │ +00000df0: 5445 525f 4e4d 5f49 4853 4772 6164 3c2f TER_NM_IHSGrad
    8. .
    9. OCR_LEVEL_WOR │ │ │ +00000e40: 443c 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c D
    10. .
    11. < │ │ │ +00000e50: 6120 6872 6566 3d22 234f 4352 5f4c 4556 a href="#OCR_LEV │ │ │ +00000e60: 454c 5f54 4558 544c 494e 4522 2074 6162 EL_TEXTLINE" tab │ │ │ +00000e70: 696e 6465 783d 2230 223e 4f43 525f 4c45 index="0">OCR_LE │ │ │ +00000e80: 5645 4c5f 5445 5854 4c49 4e45 3c2f 613e VEL_TEXTLINE │ │ │ 00000e90: 3c2f 6c69 3e0a 3c6c 693e 3c61 2068 7265
    12. .
    13. OCR_KNN_CLA │ │ │ 00000ed0: 5353 4946 4945 523c 2f61 3e3c 2f6c 693e SSIFIER
    14. │ │ │ 00000ee0: 0a3c 6c69 3e3c 6120 6872 6566 3d22 234f .
    15. det │ │ │ 00001720: 6563 7454 6578 7453 5754 284d 6174 2c20 ectTextSWT(Mat, │ │ │ 00001730: 4d61 744f 6652 6563 742c 2062 6f6f 6c65 MatOfRect, boole │ │ │ 00001740: 616e 293c 2f61 3e3c 2f6c 693e 0a3c 6c69 an)
    16. .
    17. loadOCRHMMClas │ │ │ -000017a0: 7369 6669 6572 4e4d 2853 7472 696e 6729 sifierNM(String) │ │ │ -000017b0: 3c2f 613e 3c2f 6c69 3e0a 3c6c 693e 3c61
    18. .
    19. │ │ │ -00001800: 6c6f 6164 4f43 5248 4d4d 436c 6173 7369 loadOCRHMMClassi │ │ │ -00001810: 6669 6572 434e 4e28 5374 7269 6e67 293c fierCNN(String)< │ │ │ -00001820: 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c 6120 /a>
    20. .
    21. │ │ │ -00001870: 6c6f 6164 4f43 5248 4d4d 436c 6173 7369 loadOCRHMMClassi │ │ │ -00001880: 6669 6572 2853 7472 696e 672c 2069 6e74 fier(String, int │ │ │ -00001890: 293c 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c )
    22. .
    23. < │ │ │ -000018a0: 6120 6872 6566 3d22 2363 7265 6174 654f a href="#createO │ │ │ -000018b0: 4352 484d 4d54 7261 6e73 6974 696f 6e73 CRHMMTransitions │ │ │ -000018c0: 5461 626c 6528 6a61 7661 2e6c 616e 672e Table(java.lang. │ │ │ -000018d0: 5374 7269 6e67 2c6a 6176 612e 7574 696c String,java.util │ │ │ -000018e0: 2e4c 6973 7429 2220 7461 6269 6e64 6578 .List)" tabindex │ │ │ -000018f0: 3d22 3022 3e63 7265 6174 654f 4352 484d ="0">createOCRHM │ │ │ -00001900: 4d54 7261 6e73 6974 696f 6e73 5461 626c MTransitionsTabl │ │ │ -00001910: 6528 5374 7269 6e67 2c20 4c69 7374 293c e(String, List)< │ │ │ -00001920: 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c 6120 /a>
    24. .
    25. loadOCRBea │ │ │ -00001980: 6d53 6561 7263 6843 6c61 7373 6966 6965 mSearchClassifie │ │ │ -00001990: 7243 4e4e 2853 7472 696e 6729 3c2f 613e rCNN(String) │ │ │ -000019a0: 3c2f 6c69 3e0a 3c6c 693e 3c61 2068 7265
    26. .
    27. creat │ │ │ -00001a20: 6545 5246 696c 7465 724e 4d31 2845 5246 eERFilterNM1(ERF │ │ │ -00001a30: 696c 7465 725f 4361 6c6c 6261 636b 2c20 ilter_Callback, │ │ │ -00001a40: 696e 742c 2066 6c6f 6174 2c20 666c 6f61 int, float, floa │ │ │ -00001a50: 742c 2066 6c6f 6174 2c20 626f 6f6c 6561 t, float, boolea │ │ │ -00001a60: 6e2c 2066 6c6f 6174 293c 2f61 3e3c 2f6c n, float).
    28. createERFilter │ │ │ -00001af0: 4e4d 3128 4552 4669 6c74 6572 5f43 616c NM1(ERFilter_Cal │ │ │ -00001b00: 6c62 6163 6b2c 2069 6e74 2c20 666c 6f61 lback, int, floa │ │ │ -00001b10: 742c 2066 6c6f 6174 2c20 666c 6f61 742c t, float, float, │ │ │ -00001b20: 2062 6f6f 6c65 616e 293c 2f61 3e3c 2f6c boolean).
    29. create │ │ │ -00001ba0: 4552 4669 6c74 6572 4e4d 3128 4552 4669 ERFilterNM1(ERFi │ │ │ -00001bb0: 6c74 6572 5f43 616c 6c62 6163 6b2c 2069 lter_Callback, i │ │ │ -00001bc0: 6e74 2c20 666c 6f61 742c 2066 6c6f 6174 nt, float, float │ │ │ -00001bd0: 2c20 666c 6f61 7429 3c2f 613e 3c2f 6c69 , float)
    30. .
    31. createERFilte │ │ │ -00001c50: 724e 4d31 2845 5246 696c 7465 725f 4361 rNM1(ERFilter_Ca │ │ │ -00001c60: 6c6c 6261 636b 2c20 696e 742c 2066 6c6f llback, int, flo │ │ │ -00001c70: 6174 2c20 666c 6f61 7429 3c2f 613e 3c2f at, float).
    32. c │ │ │ -00001ce0: 7265 6174 6545 5246 696c 7465 724e 4d31 reateERFilterNM1 │ │ │ -00001cf0: 2845 5246 696c 7465 725f 4361 6c6c 6261 (ERFilter_Callba │ │ │ -00001d00: 636b 2c20 696e 742c 2066 6c6f 6174 293c ck, int, float)< │ │ │ -00001d10: 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c 6120 /a>
    33. .
    34. cr │ │ │ -00001d70: 6561 7465 4552 4669 6c74 6572 4e4d 3128 eateERFilterNM1( │ │ │ -00001d80: 4552 4669 6c74 6572 5f43 616c 6c62 6163 ERFilter_Callbac │ │ │ -00001d90: 6b2c 2069 6e74 293c 2f61 3e3c 2f6c 693e k, int)
    35. │ │ │ -00001da0: 0a3c 6c69 3e3c 6120 6872 6566 3d22 2363 .
    36. createERFilter │ │ │ -00001e00: 4e4d 3128 4552 4669 6c74 6572 5f43 616c NM1(ERFilter_Cal │ │ │ -00001e10: 6c62 6163 6b29 3c2f 613e 3c2f 6c69 3e0a lback)
    37. . │ │ │ -00001e20: 3c6c 693e 3c61 2068 7265 663d 2223 6372
    38. createERF │ │ │ -00001e80: 696c 7465 724e 4d32 2845 5246 696c 7465 ilterNM2(ERFilte │ │ │ -00001e90: 725f 4361 6c6c 6261 636b 2c20 666c 6f61 r_Callback, floa │ │ │ -00001ea0: 7429 3c2f 613e 3c2f 6c69 3e0a 3c6c 693e t)
    39. .
    40. │ │ │ -00001eb0: 3c61 2068 7265 663d 2223 6372 6561 7465 cre │ │ │ -00001f00: 6174 6545 5246 696c 7465 724e 4d32 2845 ateERFilterNM2(E │ │ │ -00001f10: 5246 696c 7465 725f 4361 6c6c 6261 636b RFilter_Callback │ │ │ -00001f20: 293c 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c )
    41. .
    42. < │ │ │ -00001f30: 6120 6872 6566 3d22 2363 7265 6174 6545 a href="#createE │ │ │ -00001f40: 5246 696c 7465 724e 4d31 286a 6176 612e RFilterNM1(java. │ │ │ -00001f50: 6c61 6e67 2e53 7472 696e 672c 696e 742c lang.String,int, │ │ │ -00001f60: 666c 6f61 742c 666c 6f61 742c 666c 6f61 float,float,floa │ │ │ -00001f70: 742c 626f 6f6c 6561 6e2c 666c 6f61 7429 t,boolean,float) │ │ │ -00001f80: 2220 7461 6269 6e64 6578 3d22 3022 3e63 " tabindex="0">c │ │ │ -00001f90: 7265 6174 6545 5246 696c 7465 724e 4d31 reateERFilterNM1 │ │ │ -00001fa0: 2853 7472 696e 672c 2069 6e74 2c20 666c (String, int, fl │ │ │ -00001fb0: 6f61 742c 2066 6c6f 6174 2c20 666c 6f61 oat, float, floa │ │ │ -00001fc0: 742c 2062 6f6f 6c65 616e 2c20 666c 6f61 t, boolean, floa │ │ │ -00001fd0: 7429 3c2f 613e 3c2f 6c69 3e0a 3c6c 693e t)
    43. .
    44. │ │ │ -00001fe0: 3c61 2068 7265 663d 2223 6372 6561 7465 create │ │ │ -00002040: 4552 4669 6c74 6572 4e4d 3128 5374 7269 ERFilterNM1(Stri │ │ │ -00002050: 6e67 2c20 696e 742c 2066 6c6f 6174 2c20 ng, int, float, │ │ │ -00002060: 666c 6f61 742c 2066 6c6f 6174 2c20 626f float, float, bo │ │ │ -00002070: 6f6c 6561 6e29 3c2f 613e 3c2f 6c69 3e0a olean)
    45. . │ │ │ -00002080: 3c6c 693e 3c61 2068 7265 663d 2223 6372
    46. createERFi │ │ │ -000020e0: 6c74 6572 4e4d 3128 5374 7269 6e67 2c20 lterNM1(String, │ │ │ -000020f0: 696e 742c 2066 6c6f 6174 2c20 666c 6f61 int, float, floa │ │ │ -00002100: 742c 2066 6c6f 6174 293c 2f61 3e3c 2f6c t, float).
    47. createERFilte │ │ │ -00002170: 724e 4d31 2853 7472 696e 672c 2069 6e74 rNM1(String, int │ │ │ -00002180: 2c20 666c 6f61 742c 2066 6c6f 6174 293c , float, float)< │ │ │ -00002190: 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c 6120 /a>
    48. .
    49. createERFilte │ │ │ -000021f0: 724e 4d31 2853 7472 696e 672c 2069 6e74 rNM1(String, int │ │ │ -00002200: 2c20 666c 6f61 7429 3c2f 613e 3c2f 6c69 , float)
    50. .
    51. createERFi │ │ │ -00002260: 6c74 6572 4e4d 3128 5374 7269 6e67 2c20 lterNM1(String, │ │ │ -00002270: 696e 7429 3c2f 613e 3c2f 6c69 3e0a 3c6c int)
    52. .cr │ │ │ -000022c0: 6561 7465 4552 4669 6c74 6572 4e4d 3128 eateERFilterNM1( │ │ │ -000022d0: 5374 7269 6e67 293c 2f61 3e3c 2f6c 693e String) │ │ │ -000022e0: 0a3c 6c69 3e3c 6120 6872 6566 3d22 2363 .
    53. createERF │ │ │ -00002330: 696c 7465 724e 4d32 2853 7472 696e 672c ilterNM2(String, │ │ │ -00002340: 2066 6c6f 6174 293c 2f61 3e3c 2f6c 693e float)
    54. │ │ │ -00002350: 0a3c 6c69 3e3c 6120 6872 6566 3d22 2363 .
    55. createERFilterN │ │ │ -000023a0: 4d32 2853 7472 696e 6729 3c2f 613e 3c2f M2(String).
    56. loadClassifi │ │ │ -00002400: 6572 4e4d 3128 5374 7269 6e67 293c 2f61 erNM1(String)
    57. .
    58. loadClass │ │ │ -00002460: 6966 6965 724e 4d32 2853 7472 696e 6729 ifierNM2(String) │ │ │ -00002470: 3c2f 613e 3c2f 6c69 3e0a 3c6c 693e 3c61
    59. .
    60. │ │ │ -000024d0: 636f 6d70 7574 654e 4d43 6861 6e6e 656c computeNMChannel │ │ │ -000024e0: 7328 4d61 742c 204c 6973 742c 2069 6e74 s(Mat, List, int │ │ │ -000024f0: 293c 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c )
    61. .
    62. < │ │ │ -00002500: 6120 6872 6566 3d22 2363 6f6d 7075 7465 a href="#compute │ │ │ -00002510: 4e4d 4368 616e 6e65 6c73 286f 7267 2e6f NMChannels(org.o │ │ │ -00002520: 7065 6e63 762e 636f 7265 2e4d 6174 2c6a pencv.core.Mat,j │ │ │ -00002530: 6176 612e 7574 696c 2e4c 6973 7429 2220 ava.util.List)" │ │ │ -00002540: 7461 6269 6e64 6578 3d22 3022 3e63 6f6d tabindex="0">com │ │ │ -00002550: 7075 7465 4e4d 4368 616e 6e65 6c73 284d puteNMChannels(M │ │ │ -00002560: 6174 2c20 4c69 7374 293c 2f61 3e3c 2f6c at, List).
    63. erGroupin │ │ │ -00002610: 6728 4d61 742c 204d 6174 2c20 4c69 7374 g(Mat, Mat, List │ │ │ -00002620: 2c20 4d61 744f 6652 6563 742c 2069 6e74 , MatOfRect, int │ │ │ -00002630: 2c20 5374 7269 6e67 2c20 666c 6f61 7429 , String, float) │ │ │ -00002640: 3c2f 613e 3c2f 6c69 3e0a 3c6c 693e 3c61
    64. .
    65. erGroupi │ │ │ -000026e0: 6e67 284d 6174 2c20 4d61 742c 204c 6973 ng(Mat, Mat, Lis │ │ │ -000026f0: 742c 204d 6174 4f66 5265 6374 2c20 696e t, MatOfRect, in │ │ │ -00002700: 742c 2053 7472 696e 6729 3c2f 613e 3c2f t, String).
    66. erGrouping(Mat, │ │ │ -000027a0: 204d 6174 2c20 4c69 7374 2c20 4d61 744f Mat, List, MatO │ │ │ -000027b0: 6652 6563 742c 2069 6e74 293c 2f61 3e3c fRect, int)< │ │ │ -000027c0: 2f6c 693e 0a3c 6c69 3e3c 6120 6872 6566 /li>.
    67. er │ │ │ -00002840: 4772 6f75 7069 6e67 284d 6174 2c20 4d61 Grouping(Mat, Ma │ │ │ -00002850: 742c 204c 6973 742c 204d 6174 4f66 5265 t, List, MatOfRe │ │ │ -00002860: 6374 293c 2f61 3e3c 2f6c 693e 0a3c 6c69 ct)
    68. .
    69. det │ │ │ -000028f0: 6563 7452 6567 696f 6e73 284d 6174 2c20 ectRegions(Mat, │ │ │ -00002900: 4552 4669 6c74 6572 2c20 4552 4669 6c74 ERFilter, ERFilt │ │ │ -00002910: 6572 2c20 4c69 7374 293c 2f61 3e3c 2f6c er, List).
    70. detectR │ │ │ -000029d0: 6567 696f 6e73 284d 6174 2c20 4552 4669 egions(Mat, ERFi │ │ │ -000029e0: 6c74 6572 2c20 4552 4669 6c74 6572 2c20 lter, ERFilter, │ │ │ -000029f0: 4d61 744f 6652 6563 742c 2069 6e74 2c20 MatOfRect, int, │ │ │ -00002a00: 5374 7269 6e67 2c20 666c 6f61 7429 3c2f String, float)
    71. .
    72. detectRe │ │ │ -00002ac0: 6769 6f6e 7328 4d61 742c 2045 5246 696c gions(Mat, ERFil │ │ │ -00002ad0: 7465 722c 2045 5246 696c 7465 722c 204d ter, ERFilter, M │ │ │ -00002ae0: 6174 4f66 5265 6374 2c20 696e 742c 2053 atOfRect, int, S │ │ │ -00002af0: 7472 696e 6729 3c2f 613e 3c2f 6c69 3e0a tring)
    73. . │ │ │ -00002b00: 3c6c 693e 3c61 2068 7265 663d 2223 6465
    74. d │ │ │ -00002b90: 6574 6563 7452 6567 696f 6e73 284d 6174 etectRegions(Mat │ │ │ -00002ba0: 2c20 4552 4669 6c74 6572 2c20 4552 4669 , ERFilter, ERFi │ │ │ -00002bb0: 6c74 6572 2c20 4d61 744f 6652 6563 742c lter, MatOfRect, │ │ │ -00002bc0: 2069 6e74 293c 2f61 3e3c 2f6c 693e 0a3c int)
    75. .< │ │ │ -00002bd0: 6c69 3e3c 6120 6872 6566 3d22 2364 6574 li>detect │ │ │ -00002c60: 5265 6769 6f6e 7328 4d61 742c 2045 5246 Regions(Mat, ERF │ │ │ -00002c70: 696c 7465 722c 2045 5246 696c 7465 722c ilter, ERFilter, │ │ │ -00002c80: 204d 6174 4f66 5265 6374 293c 2f61 3e3c MatOfRect)< │ │ │ +00001750: 3e3c 6120 6872 6566 3d22 2363 7265 6174 >createERFilter │ │ │ +000017d0: 4e4d 3128 4552 4669 6c74 6572 5f43 616c NM1(ERFilter_Cal │ │ │ +000017e0: 6c62 6163 6b2c 2069 6e74 2c20 666c 6f61 lback, int, floa │ │ │ +000017f0: 742c 2066 6c6f 6174 2c20 666c 6f61 742c t, float, float, │ │ │ +00001800: 2062 6f6f 6c65 616e 2c20 666c 6f61 7429 boolean, float) │ │ │ +00001810: 3c2f 613e 3c2f 6c69 3e0a 3c6c 693e 3c61 .
    76. createE │ │ │ +00001890: 5246 696c 7465 724e 4d31 2845 5246 696c RFilterNM1(ERFil │ │ │ +000018a0: 7465 725f 4361 6c6c 6261 636b 2c20 696e ter_Callback, in │ │ │ +000018b0: 742c 2066 6c6f 6174 2c20 666c 6f61 742c t, float, float, │ │ │ +000018c0: 2066 6c6f 6174 2c20 626f 6f6c 6561 6e29 float, boolean) │ │ │ +000018d0: 3c2f 613e 3c2f 6c69 3e0a 3c6c 693e 3c61
    77. .
    78. createERFilterN │ │ │ +00001950: 4d31 2845 5246 696c 7465 725f 4361 6c6c M1(ERFilter_Call │ │ │ +00001960: 6261 636b 2c20 696e 742c 2066 6c6f 6174 back, int, float │ │ │ +00001970: 2c20 666c 6f61 742c 2066 6c6f 6174 293c , float, float)< │ │ │ +00001980: 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c 6120 /a>
    79. .
    80. create │ │ │ +000019f0: 4552 4669 6c74 6572 4e4d 3128 4552 4669 ERFilterNM1(ERFi │ │ │ +00001a00: 6c74 6572 5f43 616c 6c62 6163 6b2c 2069 lter_Callback, i │ │ │ +00001a10: 6e74 2c20 666c 6f61 742c 2066 6c6f 6174 nt, float, float │ │ │ +00001a20: 293c 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c )
    81. .
    82. < │ │ │ +00001a30: 6120 6872 6566 3d22 2363 7265 6174 6545 a href="#createE │ │ │ +00001a40: 5246 696c 7465 724e 4d31 286f 7267 2e6f RFilterNM1(org.o │ │ │ +00001a50: 7065 6e63 762e 7465 7874 2e45 5246 696c pencv.text.ERFil │ │ │ +00001a60: 7465 725f 4361 6c6c 6261 636b 2c69 6e74 ter_Callback,int │ │ │ +00001a70: 2c66 6c6f 6174 2922 2074 6162 696e 6465 ,float)" tabinde │ │ │ +00001a80: 783d 2230 223e 6372 6561 7465 4552 4669 x="0">createERFi │ │ │ +00001a90: 6c74 6572 4e4d 3128 4552 4669 6c74 6572 lterNM1(ERFilter │ │ │ +00001aa0: 5f43 616c 6c62 6163 6b2c 2069 6e74 2c20 _Callback, int, │ │ │ +00001ab0: 666c 6f61 7429 3c2f 613e 3c2f 6c69 3e0a float)
    83. . │ │ │ +00001ac0: 3c6c 693e 3c61 2068 7265 663d 2223 6372
    84. createERFil │ │ │ +00001b20: 7465 724e 4d31 2845 5246 696c 7465 725f terNM1(ERFilter_ │ │ │ +00001b30: 4361 6c6c 6261 636b 2c20 696e 7429 3c2f Callback, int)
    85. .
    86. createE │ │ │ +00001ba0: 5246 696c 7465 724e 4d31 2845 5246 696c RFilterNM1(ERFil │ │ │ +00001bb0: 7465 725f 4361 6c6c 6261 636b 293c 2f61 ter_Callback)
    87. .
    88. cr │ │ │ +00001c20: 6561 7465 4552 4669 6c74 6572 4e4d 3228 eateERFilterNM2( │ │ │ +00001c30: 4552 4669 6c74 6572 5f43 616c 6c62 6163 ERFilter_Callbac │ │ │ +00001c40: 6b2c 2066 6c6f 6174 293c 2f61 3e3c 2f6c k, float).
    89. createERFilt │ │ │ +00001cb0: 6572 4e4d 3228 4552 4669 6c74 6572 5f43 erNM2(ERFilter_C │ │ │ +00001cc0: 616c 6c62 6163 6b29 3c2f 613e 3c2f 6c69 allback)
    90. .
    91. createERFi │ │ │ +00001d40: 6c74 6572 4e4d 3128 5374 7269 6e67 2c20 lterNM1(String, │ │ │ +00001d50: 696e 742c 2066 6c6f 6174 2c20 666c 6f61 int, float, floa │ │ │ +00001d60: 742c 2066 6c6f 6174 2c20 626f 6f6c 6561 t, float, boolea │ │ │ +00001d70: 6e2c 2066 6c6f 6174 293c 2f61 3e3c 2f6c n, float).
    92. createERFilterN │ │ │ +00001df0: 4d31 2853 7472 696e 672c 2069 6e74 2c20 M1(String, int, │ │ │ +00001e00: 666c 6f61 742c 2066 6c6f 6174 2c20 666c float, float, fl │ │ │ +00001e10: 6f61 742c 2062 6f6f 6c65 616e 293c 2f61 oat, boolean)
    93. .
    94. cre │ │ │ +00001e80: 6174 6545 5246 696c 7465 724e 4d31 2853 ateERFilterNM1(S │ │ │ +00001e90: 7472 696e 672c 2069 6e74 2c20 666c 6f61 tring, int, floa │ │ │ +00001ea0: 742c 2066 6c6f 6174 2c20 666c 6f61 7429 t, float, float) │ │ │ +00001eb0: 3c2f 613e 3c2f 6c69 3e0a 3c6c 693e 3c61
    95. .
    96. create │ │ │ +00001f10: 4552 4669 6c74 6572 4e4d 3128 5374 7269 ERFilterNM1(Stri │ │ │ +00001f20: 6e67 2c20 696e 742c 2066 6c6f 6174 2c20 ng, int, float, │ │ │ +00001f30: 666c 6f61 7429 3c2f 613e 3c2f 6c69 3e0a float)
    97. . │ │ │ +00001f40: 3c6c 693e 3c61 2068 7265 663d 2223 6372
    98. create │ │ │ +00001f90: 4552 4669 6c74 6572 4e4d 3128 5374 7269 ERFilterNM1(Stri │ │ │ +00001fa0: 6e67 2c20 696e 742c 2066 6c6f 6174 293c ng, int, float)< │ │ │ +00001fb0: 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c 6120 /a>
    99. .
    100. cre │ │ │ +00002000: 6174 6545 5246 696c 7465 724e 4d31 2853 ateERFilterNM1(S │ │ │ +00002010: 7472 696e 672c 2069 6e74 293c 2f61 3e3c tring, int)< │ │ │ +00002020: 2f6c 693e 0a3c 6c69 3e3c 6120 6872 6566 /li>.
    101. createERFil │ │ │ +00002070: 7465 724e 4d31 2853 7472 696e 6729 3c2f terNM1(String)
    102. .
    103. cr │ │ │ +000020d0: 6561 7465 4552 4669 6c74 6572 4e4d 3228 eateERFilterNM2( │ │ │ +000020e0: 5374 7269 6e67 2c20 666c 6f61 7429 3c2f String, float)
    104. .
    105. createER │ │ │ +00002140: 4669 6c74 6572 4e4d 3228 5374 7269 6e67 FilterNM2(String │ │ │ +00002150: 293c 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c )
    106. .
    107. < │ │ │ +00002160: 6120 6872 6566 3d22 236c 6f61 6443 6c61 a href="#loadCla │ │ │ +00002170: 7373 6966 6965 724e 4d31 286a 6176 612e ssifierNM1(java. │ │ │ +00002180: 6c61 6e67 2e53 7472 696e 6729 2220 7461 lang.String)" ta │ │ │ +00002190: 6269 6e64 6578 3d22 3022 3e6c 6f61 6443 bindex="0">loadC │ │ │ +000021a0: 6c61 7373 6966 6965 724e 4d31 2853 7472 lassifierNM1(Str │ │ │ +000021b0: 696e 6729 3c2f 613e 3c2f 6c69 3e0a 3c6c ing)
    108. .lo │ │ │ +00002200: 6164 436c 6173 7369 6669 6572 4e4d 3228 adClassifierNM2( │ │ │ +00002210: 5374 7269 6e67 293c 2f61 3e3c 2f6c 693e String) │ │ │ +00002220: 0a3c 6c69 3e3c 6120 6872 6566 3d22 2363 .
    109. computeNM │ │ │ +00002280: 4368 616e 6e65 6c73 284d 6174 2c20 4c69 Channels(Mat, Li │ │ │ +00002290: 7374 2c20 696e 7429 3c2f 613e 3c2f 6c69 st, int)
    110. .
    111. computeNMCha │ │ │ +00002300: 6e6e 656c 7328 4d61 742c 204c 6973 7429 nnels(Mat, List) │ │ │ +00002310: 3c2f 613e 3c2f 6c69 3e0a 3c6c 693e 3c61
    112. .
    113. er │ │ │ +000023b0: 4772 6f75 7069 6e67 284d 6174 2c20 4d61 Grouping(Mat, Ma │ │ │ +000023c0: 742c 204c 6973 742c 204d 6174 4f66 5265 t, List, MatOfRe │ │ │ +000023d0: 6374 2c20 696e 742c 2053 7472 696e 672c ct, int, String, │ │ │ +000023e0: 2066 6c6f 6174 293c 2f61 3e3c 2f6c 693e float)
    114. │ │ │ +000023f0: 0a3c 6c69 3e3c 6120 6872 6566 3d22 2365 .
    115. e │ │ │ +00002480: 7247 726f 7570 696e 6728 4d61 742c 204d rGrouping(Mat, M │ │ │ +00002490: 6174 2c20 4c69 7374 2c20 4d61 744f 6652 at, List, MatOfR │ │ │ +000024a0: 6563 742c 2069 6e74 2c20 5374 7269 6e67 ect, int, String │ │ │ +000024b0: 293c 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c )
    116. .
    117. < │ │ │ +000024c0: 6120 6872 6566 3d22 2365 7247 726f 7570 a href="#erGroup │ │ │ +000024d0: 696e 6728 6f72 672e 6f70 656e 6376 2e63 ing(org.opencv.c │ │ │ +000024e0: 6f72 652e 4d61 742c 6f72 672e 6f70 656e ore.Mat,org.open │ │ │ +000024f0: 6376 2e63 6f72 652e 4d61 742c 6a61 7661 cv.core.Mat,java │ │ │ +00002500: 2e75 7469 6c2e 4c69 7374 2c6f 7267 2e6f .util.List,org.o │ │ │ +00002510: 7065 6e63 762e 636f 7265 2e4d 6174 4f66 pencv.core.MatOf │ │ │ +00002520: 5265 6374 2c69 6e74 2922 2074 6162 696e Rect,int)" tabin │ │ │ +00002530: 6465 783d 2230 223e 6572 4772 6f75 7069 dex="0">erGroupi │ │ │ +00002540: 6e67 284d 6174 2c20 4d61 742c 204c 6973 ng(Mat, Mat, Lis │ │ │ +00002550: 742c 204d 6174 4f66 5265 6374 2c20 696e t, MatOfRect, in │ │ │ +00002560: 7429 3c2f 613e 3c2f 6c69 3e0a 3c6c 693e t)
    118. .
    119. │ │ │ +00002570: 3c61 2068 7265 663d 2223 6572 4772 6f75 erGrouping( │ │ │ +000025f0: 4d61 742c 204d 6174 2c20 4c69 7374 2c20 Mat, Mat, List, │ │ │ +00002600: 4d61 744f 6652 6563 7429 3c2f 613e 3c2f MatOfRect).
    120. detectRegion │ │ │ +000026a0: 7328 4d61 742c 2045 5246 696c 7465 722c s(Mat, ERFilter, │ │ │ +000026b0: 2045 5246 696c 7465 722c 204c 6973 7429 ERFilter, List) │ │ │ +000026c0: 3c2f 613e 3c2f 6c69 3e0a 3c6c 693e 3c61
    121. .
    122. │ │ │ +00002770: 6465 7465 6374 5265 6769 6f6e 7328 4d61 detectRegions(Ma │ │ │ +00002780: 742c 2045 5246 696c 7465 722c 2045 5246 t, ERFilter, ERF │ │ │ +00002790: 696c 7465 722c 204d 6174 4f66 5265 6374 ilter, MatOfRect │ │ │ +000027a0: 2c20 696e 742c 2053 7472 696e 672c 2066 , int, String, f │ │ │ +000027b0: 6c6f 6174 293c 2f61 3e3c 2f6c 693e 0a3c loat)
    123. .< │ │ │ +000027c0: 6c69 3e3c 6120 6872 6566 3d22 2364 6574 li>d │ │ │ +00002860: 6574 6563 7452 6567 696f 6e73 284d 6174 etectRegions(Mat │ │ │ +00002870: 2c20 4552 4669 6c74 6572 2c20 4552 4669 , ERFilter, ERFi │ │ │ +00002880: 6c74 6572 2c20 4d61 744f 6652 6563 742c lter, MatOfRect, │ │ │ +00002890: 2069 6e74 2c20 5374 7269 6e67 293c 2f61 int, String).
    124. detectRegi │ │ │ +00002940: 6f6e 7328 4d61 742c 2045 5246 696c 7465 ons(Mat, ERFilte │ │ │ +00002950: 722c 2045 5246 696c 7465 722c 204d 6174 r, ERFilter, Mat │ │ │ +00002960: 4f66 5265 6374 2c20 696e 7429 3c2f 613e OfRect, int) │ │ │ +00002970: 3c2f 6c69 3e0a 3c6c 693e 3c61 2068 7265
    125. .
    126. detectRegions(M │ │ │ +00002a10: 6174 2c20 4552 4669 6c74 6572 2c20 4552 at, ERFilter, ER │ │ │ +00002a20: 4669 6c74 6572 2c20 4d61 744f 6652 6563 Filter, MatOfRec │ │ │ +00002a30: 7429 3c2f 613e 3c2f 6c69 3e0a 3c6c 693e t)
    127. .
    128. │ │ │ +00002a40: 3c61 2068 7265 663d 2223 6c6f 6164 4f43 loadOCRHMMClass │ │ │ +00002a90: 6966 6965 724e 4d28 5374 7269 6e67 293c ifierNM(String)< │ │ │ +00002aa0: 2f61 3e3c 2f6c 693e 0a3c 6c69 3e3c 6120 /a>
    129. .
    130. l │ │ │ +00002af0: 6f61 644f 4352 484d 4d43 6c61 7373 6966 oadOCRHMMClassif │ │ │ +00002b00: 6965 7243 4e4e 2853 7472 696e 6729 3c2f ierCNN(String)
    131. .
    132. l │ │ │ +00002b60: 6f61 644f 4352 484d 4d43 6c61 7373 6966 oadOCRHMMClassif │ │ │ +00002b70: 6965 7228 5374 7269 6e67 2c20 696e 7429 ier(String, int) │ │ │ +00002b80: 3c2f 613e 3c2f 6c69 3e0a 3c6c 693e 3c61
    133. .
    134. createOCRHMM │ │ │ +00002bf0: 5472 616e 7369 7469 6f6e 7354 6162 6c65 TransitionsTable │ │ │ +00002c00: 2853 7472 696e 672c 204c 6973 7429 3c2f (String, List)
    135. .
    136. loadOCRBeam │ │ │ +00002c70: 5365 6172 6368 436c 6173 7369 6669 6572 SearchClassifier │ │ │ +00002c80: 434e 4e28 5374 7269 6e67 293c 2f61 3e3c CNN(String)< │ │ │ 00002c90: 2f6c 693e 0a3c 2f6f 6c3e 0a3c 2f6c 693e /li>.
    .
  • │ │ │ 00002ca0: 0a3c 2f6f 6c3e 0a3c 6275 7474 6f6e 2063 ..
  • ..

    fisheye │ │ │ -000cf1c0: 5f75 6e64 6973 746f 7274 506f 696e 7473 _undistortPoints │ │ │ -000cf1d0: 3c2f 6833 3e0a 3c64 6976 2063 6c61 7373

    .
    .
    publ │ │ │ -000cf230: 6963 2073 7461 7469 633c 2f73 7061 6e3e ic static │ │ │ -000cf240: 266e 6273 703b 3c73 7061 6e20 636c 6173   │ │ │ -000cf260: 766f 6964 3c2f 7370 616e 3e26 6e62 7370 void  │ │ │ -000cf270: 3b3c 7370 616e 2063 6c61 7373 3d22 656c ;fish │ │ │ -000cf290: 6579 655f 756e 6469 7374 6f72 7450 6f69 eye_undistortPoi │ │ │ -000cf2a0: 6e74 733c 2f73 7061 6e3e 3c77 6272 3e3c nts< │ │ │ -000cf2b0: 7370 616e 2063 6c61 7373 3d22 7061 7261 span class="para │ │ │ -000cf2c0: 6d65 7465 7273 223e 283c 6120 6872 6566 meters">(Mat&nbs │ │ │ -000cf310: 703b 6469 7374 6f72 7465 642c 0a20 3c61 p;distorted,. Mat undistort │ │ │ -000cf370: 6564 2c0a 203c 6120 6872 6566 3d22 2e2e ed,. Mat K, │ │ │ -000cf3c0: 0a20 3c61 2068 7265 663d 222e 2e2f 636f . Ma │ │ │ -000cf400: 743c 2f61 3e26 6e62 7370 3b44 2c0a 203c t D,. < │ │ │ -000cf410: 6120 6872 6566 3d22 2e2e 2f63 6f72 652f a href="../core/ │ │ │ -000cf420: 4d61 742e 6874 6d6c 2220 7469 746c 653d Mat.html" title= │ │ │ -000cf430: 2263 6c61 7373 2069 6e20 6f72 672e 6f70 "class in org.op │ │ │ -000cf440: 656e 6376 2e63 6f72 6522 3e4d 6174 3c2f encv.core">Mat R,. Mat& │ │ │ -000cf4a0: 6e62 7370 3b50 2c0a 203c 6120 6872 6566 nbsp;P,. Te │ │ │ -000cf4f0: 726d 4372 6974 6572 6961 3c2f 613e 266e rmCriteria&n │ │ │ -000cf500: 6273 703b 6372 6974 6572 6961 293c 2f73 bsp;criteria)
    .
    Un │ │ │ -000cf530: 6469 7374 6f72 7473 2032 4420 706f 696e distorts 2D poin │ │ │ -000cf540: 7473 2075 7369 6e67 2066 6973 6865 7965 ts using fisheye │ │ │ -000cf550: 2063 616d 6572 6120 6d6f 6465 6c0a 0a54 camera model..T │ │ │ -000cf560: 6869 7320 6675 6e63 7469 6f6e 2070 6572 his function per │ │ │ -000cf570: 666f 726d 7320 756e 6469 7374 6f72 7469 forms undistorti │ │ │ -000cf580: 6f6e 2066 6f72 2066 6973 6865 7965 2063 on for fisheye c │ │ │ -000cf590: 616d 6572 6120 6d6f 6465 6c73 2c20 7768 amera models, wh │ │ │ -000cf5a0: 6963 6820 7573 6520 6120 6469 6666 6572 ich use a differ │ │ │ -000cf5b0: 656e 7420 6469 7374 6f72 7469 6f6e 206d ent distortion m │ │ │ -000cf5c0: 6f64 656c 0a63 6f6d 7061 7265 6420 746f odel.compared to │ │ │ -000cf5d0: 2074 6865 2073 7461 6e64 6172 6420 7069 the standard pi │ │ │ -000cf5e0: 6e68 6f6c 6520 6361 6d65 7261 206d 6f64 nhole camera mod │ │ │ -000cf5f0: 656c 2075 7365 6420 6279 2023 756e 6469 el used by #undi │ │ │ -000cf600: 7374 6f72 7450 6f69 6e74 732e 2054 6865 stortPoints. The │ │ │ -000cf610: 2066 6973 6865 7965 206d 6f64 656c 2069 fisheye model i │ │ │ -000cf620: 7320 7375 6974 6162 6c65 0a66 6f72 2077 s suitable.for w │ │ │ -000cf630: 6964 652d 616e 676c 6520 6361 6d65 7261 ide-angle camera │ │ │ -000cf640: 732e 0a0a 5468 6520 6675 6e63 7469 6f6e s...The function │ │ │ -000cf650: 2074 7261 6e73 666f 726d 7320 706f 696e transforms poin │ │ │ -000cf660: 7473 2066 726f 6d20 7468 6520 6469 7374 ts from the dist │ │ │ -000cf670: 6f72 7465 6420 6669 7368 6579 6520 696d orted fisheye im │ │ │ -000cf680: 6167 6520 746f 2075 6e64 6973 746f 7274 age to undistort │ │ │ -000cf690: 6564 2063 6f6f 7264 696e 6174 6573 2c20 ed coordinates, │ │ │ -000cf6a0: 6f70 7469 6f6e 616c 6c79 0a61 7070 6c79 optionally.apply │ │ │ -000cf6b0: 696e 6720 6120 7265 6374 6966 6963 6174 ing a rectificat │ │ │ -000cf6c0: 696f 6e20 7472 616e 7366 6f72 6d61 7469 ion transformati │ │ │ -000cf6d0: 6f6e 2028 5229 2061 6e64 2070 726f 6a65 on (R) and proje │ │ │ -000cf6e0: 6374 696e 6720 746f 2061 206e 6577 2069 cting to a new i │ │ │ -000cf6f0: 6d61 6765 2070 6c61 6e65 2028 5029 2e0a mage plane (P).. │ │ │ -000cf700: 0a3c 623e 4e6f 7465 3a3c 2f62 3e20 3c62 .Note: Coordinate Syst │ │ │ -000cf720: 656d 733a 3c2f 623e 0a3c 756c 3e0a 2020 ems:.
      . │ │ │ -000cf730: 3c6c 693e 0a20 3c62 3e49 6e70 7574 2028
    • . Input ( │ │ │ -000cf740: 3c63 6f64 653e 6469 7374 6f72 7465 643c distorted< │ │ │ -000cf750: 2f63 6f64 653e 293c 2f62 3e3a 2050 6f69 /code>): Poi │ │ │ -000cf760: 6e74 7320 6172 6520 6578 7065 6374 6564 nts are expected │ │ │ -000cf770: 2069 6e20 3c62 3e70 6978 656c 2063 6f6f in pixel coo │ │ │ -000cf780: 7264 696e 6174 6573 3c2f 623e 206f 6620 rdinates of │ │ │ -000cf790: 7468 6520 6469 7374 6f72 7465 6420 6669 the distorted fi │ │ │ -000cf7a0: 7368 6579 6520 696d 6167 652c 0a20 2020 sheye image,. │ │ │ -000cf7b0: 2069 2e65 2e2c 2063 6f6f 7264 696e 6174 i.e., coordinat │ │ │ -000cf7c0: 6573 206d 6561 7375 7265 6420 696e 2070 es measured in p │ │ │ -000cf7d0: 6978 656c 7320 6672 6f6d 2074 6865 2074 ixels from the t │ │ │ -000cf7e0: 6f70 2d6c 6566 7420 636f 726e 6572 206f op-left corner o │ │ │ -000cf7f0: 6620 7468 6520 696d 6167 652e 0a20 203c f the image.. < │ │ │ -000cf800: 2f6c 693e 0a20 203c 6c69 3e0a 203c 623e /li>.
    • . │ │ │ -000cf810: 4f75 7470 7574 2028 3c63 6f64 653e 756e Output (un │ │ │ -000cf820: 6469 7374 6f72 7465 643c 2f63 6f64 653e distorted │ │ │ -000cf830: 293c 2f62 3e3a 2054 6865 2063 6f6f 7264 ): The coord │ │ │ -000cf840: 696e 6174 6520 7379 7374 656d 2064 6570 inate system dep │ │ │ -000cf850: 656e 6473 206f 6e20 7061 7261 6d65 7465 ends on paramete │ │ │ -000cf860: 7220 3c63 6f64 653e 503c 2f63 6f64 653e r P │ │ │ -000cf870: 3a0a 2020 3c75 6c3e 0a20 2020 203c 6c69 :.
        .
      • . If │ │ │ -000cf890: 503c 2f63 6f64 653e 2069 7320 7072 6f76 P is prov │ │ │ -000cf8a0: 6964 6564 2028 6e6f 7420 656d 7074 7929 ided (not empty) │ │ │ -000cf8b0: 3a20 4f75 7470 7574 2070 6f69 6e74 7320 : Output points │ │ │ -000cf8c0: 6172 6520 696e 203c 623e 7069 7865 6c20 are in pixel │ │ │ -000cf8d0: 636f 6f72 6469 6e61 7465 733c 2f62 3e20 coordinates │ │ │ -000cf8e0: 6f66 2074 6865 2072 6563 7469 6669 6564 of the rectified │ │ │ -000cf8f0: 2f75 6e64 6973 746f 7274 6564 0a20 2020 /undistorted. │ │ │ -000cf900: 2069 6d61 6765 2070 6c61 6e65 2c20 7573 image plane, us │ │ │ -000cf910: 696e 6720 7468 6520 6361 6d65 7261 206d ing the camera m │ │ │ -000cf920: 6174 7269 7820 3c63 6f64 653e 503c 2f63 atrix P..
      • . │ │ │ -000cf940: 2020 2020 3c6c 693e 0a20 2020 2020 4966
      • . If │ │ │ -000cf950: 203c 636f 6465 3e50 3c2f 636f 6465 3e20 P │ │ │ -000cf960: 6973 2065 6d70 7479 206f 7220 6964 656e is empty or iden │ │ │ -000cf970: 7469 7479 3a20 4f75 7470 7574 2070 6f69 tity: Output poi │ │ │ -000cf980: 6e74 7320 6172 6520 696e 203c 623e 6e6f nts are in no │ │ │ -000cf990: 726d 616c 697a 6564 2063 616d 6572 6120 rmalized camera │ │ │ -000cf9a0: 636f 6f72 6469 6e61 7465 733c 2f62 3e20 coordinates │ │ │ -000cf9b0: 286e 6f72 6d61 6c69 7a65 6420 696d 6167 (normalized imag │ │ │ -000cf9c0: 6520 636f 6f72 6469 6e61 7465 7329 2c0a e coordinates),. │ │ │ -000cf9d0: 2020 2020 7768 6963 6820 6172 6520 6469 which are di │ │ │ -000cf9e0: 6d65 6e73 696f 6e6c 6573 7320 636f 6f72 mensionless coor │ │ │ -000cf9f0: 6469 6e61 7465 7320 696e 2074 6865 2063 dinates in the c │ │ │ -000cfa00: 616d 6572 6127 7320 666f 6361 6c20 706c amera's focal pl │ │ │ -000cfa10: 616e 652c 2069 6e64 6570 656e 6465 6e74 ane, independent │ │ │ -000cfa20: 206f 6620 696e 7472 696e 7369 6320 7061 of intrinsic pa │ │ │ -000cfa30: 7261 6d65 7465 7273 2e0a 2020 2020 3c2f rameters.. .
      .. < │ │ │ -000cfa50: 2f6c 693e 0a3c 2f75 6c3e 0a3c 623e 4e6f /li>.
    .No │ │ │ -000cfa60: 7465 3a3c 2f62 3e20 3c62 3e46 6973 6865 te: Fishe │ │ │ -000cfa70: 7965 2076 732e 2053 7461 6e64 6172 6420 ye vs. Standard │ │ │ -000cfa80: 4d6f 6465 6c3a 3c2f 623e 0a55 7365 2074 Model:.Use t │ │ │ -000cfa90: 6869 7320 6675 6e63 7469 6f6e 2028 2363 his function (#c │ │ │ -000cfaa0: 763a 3a66 6973 6865 7965 3a3a 756e 6469 v::fisheye::undi │ │ │ -000cfab0: 7374 6f72 7450 6f69 6e74 7329 2066 6f72 stortPoints) for │ │ │ -000cfac0: 2066 6973 6865 7965 2063 616d 6572 6173 fisheye cameras │ │ │ -000cfad0: 2028 7769 6465 2d61 6e67 6c65 206c 656e (wide-angle len │ │ │ -000cfae0: 7365 7329 2e0a 466f 7220 7374 616e 6461 ses)..For standa │ │ │ -000cfaf0: 7264 2070 696e 686f 6c65 2063 616d 6572 rd pinhole camer │ │ │ -000cfb00: 6173 2c20 7573 6520 2375 6e64 6973 746f as, use #undisto │ │ │ -000cfb10: 7274 506f 696e 7473 2069 6e73 7465 6164 rtPoints instead │ │ │ -000cfb20: 2e20 5468 6520 6669 7368 6579 6520 6d6f . The fisheye mo │ │ │ -000cfb30: 6465 6c20 7573 6573 2061 2064 6966 6665 del uses a diffe │ │ │ -000cfb40: 7265 6e74 2064 6973 746f 7274 696f 6e0a rent distortion. │ │ │ -000cfb50: 7061 7261 6d65 7465 7269 7a61 7469 6f6e parameterization │ │ │ -000cfb60: 2028 3420 636f 6566 6669 6369 656e 7473 (4 coefficients │ │ │ -000cfb70: 2920 636f 6d70 6172 6564 2074 6f20 7468 ) compared to th │ │ │ -000cfb80: 6520 7374 616e 6461 7264 206d 6f64 656c e standard model │ │ │ -000cfb90: 2028 342d 3134 2063 6f65 6666 6963 6965 (4-14 coefficie │ │ │ -000cfba0: 6e74 7329 2e3c 2f64 6976 3e0a 3c64 6c20 nts).
    .
    .< │ │ │ -000cfbc0: 6474 3e50 6172 616d 6574 6572 733a 3c2f dt>Parameters:.
    di │ │ │ -000cfbe0: 7374 6f72 7465 643c 2f63 6f64 653e 202d storted - │ │ │ -000cfbf0: 2041 7272 6179 206f 6620 6469 7374 6f72 Array of distor │ │ │ -000cfc00: 7465 6420 706f 696e 7420 636f 6f72 6469 ted point coordi │ │ │ -000cfc10: 6e61 7465 7320 696e 203c 623e 7069 7865 nates in pixe │ │ │ -000cfc20: 6c20 636f 6f72 6469 6e61 7465 733c 2f62 l coordinates of the fisheye │ │ │ -000cfc40: 2069 6d61 6765 2c0a 3178 4e2f 4e78 3120 image,.1xN/Nx1 │ │ │ -000cfc50: 322d 6368 616e 6e65 6c20 286f 7220 7665 2-channel (or ve │ │ │ -000cfc60: 6374 6f72 266c 743b 506f 696e 7432 6626 ctor<Point2f& │ │ │ -000cfc70: 6774 3b20 292c 2077 6865 7265 204e 2069 gt; ), where N i │ │ │ -000cfc80: 7320 7468 6520 6e75 6d62 6572 206f 6620 s the number of │ │ │ -000cfc90: 706f 696e 7473 2069 6e20 7468 6520 7669 points in the vi │ │ │ -000cfca0: 6577 2e3c 2f64 643e 0a3c 6464 3e3c 636f ew.
    .
    undistorted - Output a │ │ │ -000cfcd0: 7272 6179 206f 6620 756e 6469 7374 6f72 rray of undistor │ │ │ -000cfce0: 7465 6420 696d 6167 6520 706f 696e 7473 ted image points │ │ │ -000cfcf0: 2c20 3178 4e2f 4e78 3120 322d 6368 616e , 1xN/Nx1 2-chan │ │ │ -000cfd00: 6e65 6c2c 206f 7220 7665 6374 6f72 266c nel, or vector&l │ │ │ -000cfd10: 743b 506f 696e 7432 6626 6774 3b20 2e0a t;Point2f> .. │ │ │ -000cfd20: 5468 6520 636f 6f72 6469 6e61 7465 2073 The coordinate s │ │ │ -000cfd30: 7973 7465 6d20 6465 7065 6e64 7320 6f6e ystem depends on │ │ │ -000cfd40: 2070 6172 616d 6574 6572 2050 2028 7365 parameter P (se │ │ │ -000cfd50: 6520 6162 6f76 6529 2e3c 2f64 643e 0a3c e above).
    .< │ │ │ -000cfd60: 6464 3e3c 636f 6465 3e4b 3c2f 636f 6465 dd>K - Camera intri │ │ │ -000cfd80: 6e73 6963 206d 6174 7269 7820 5c28 5c63 nsic matrix \(\c │ │ │ -000cfd90: 616d 6572 616d 6174 7269 787b 4b7d 5c29 ameramatrix{K}\) │ │ │ -000cfda0: 206f 6620 7468 6520 6669 7368 6579 6520 of the fisheye │ │ │ -000cfdb0: 6361 6d65 7261 2e3c 2f64 643e 0a3c 6464 camera..
    D │ │ │ -000cfdd0: 2d20 496e 7075 7420 7665 6374 6f72 206f - Input vector o │ │ │ -000cfde0: 6620 6669 7368 6579 6520 6469 7374 6f72 f fisheye distor │ │ │ -000cfdf0: 7469 6f6e 2063 6f65 6666 6963 6965 6e74 tion coefficient │ │ │ -000cfe00: 7320 5c28 5c64 6973 7463 6f65 6666 7366 s \(\distcoeffsf │ │ │ -000cfe10: 6973 6865 7965 5c29 2028 6d75 7374 2063 isheye\) (must c │ │ │ -000cfe20: 6f6e 7461 696e 2065 7861 6374 6c79 2034 ontain exactly 4 │ │ │ -000cfe30: 2063 6f65 6666 6963 6965 6e74 7329 2e3c coefficients).< │ │ │ -000cfe40: 2f64 643e 0a3c 6464 3e3c 636f 6465 3e52 /dd>.
    R │ │ │ -000cfe50: 3c2f 636f 6465 3e20 2d20 5265 6374 6966 - Rectif │ │ │ -000cfe60: 6963 6174 696f 6e20 7472 616e 7366 6f72 ication transfor │ │ │ -000cfe70: 6d61 7469 6f6e 2069 6e20 7468 6520 6f62 mation in the ob │ │ │ -000cfe80: 6a65 6374 2073 7061 6365 3a20 3378 3320 ject space: 3x3 │ │ │ -000cfe90: 312d 6368 616e 6e65 6c2c 206f 7220 7665 1-channel, or ve │ │ │ -000cfea0: 6374 6f72 3a20 3378 312f 3178 330a 312d ctor: 3x1/1x3.1- │ │ │ -000cfeb0: 6368 616e 6e65 6c20 6f72 2031 7831 2033 channel or 1x1 3 │ │ │ -000cfec0: 2d63 6861 6e6e 656c 2e20 4966 2065 6d70 -channel. If emp │ │ │ -000cfed0: 7479 2c20 7468 6520 6964 656e 7469 7479 ty, the identity │ │ │ -000cfee0: 2074 7261 6e73 666f 726d 6174 696f 6e20 transformation │ │ │ -000cfef0: 6973 2075 7365 642e 3c2f 6464 3e0a 3c64 is used.
    .P │ │ │ -000cff10: 202d 204e 6577 2063 616d 6572 6120 696e - New camera in │ │ │ -000cff20: 7472 696e 7369 6320 6d61 7472 6978 2028 trinsic matrix ( │ │ │ -000cff30: 3378 3329 206f 7220 6e65 7720 7072 6f6a 3x3) or new proj │ │ │ -000cff40: 6563 7469 6f6e 206d 6174 7269 7820 2833 ection matrix (3 │ │ │ -000cff50: 7834 292e 2049 6620 656d 7074 7920 6f72 x4). If empty or │ │ │ -000cff60: 2069 6465 6e74 6974 792c 0a6f 7574 7075 identity,.outpu │ │ │ -000cff70: 7420 7769 6c6c 2062 6520 696e 206e 6f72 t will be in nor │ │ │ -000cff80: 6d61 6c69 7a65 6420 6361 6d65 7261 2063 malized camera c │ │ │ -000cff90: 6f6f 7264 696e 6174 6573 2e3c 2f64 643e oordinates. │ │ │ -000cffa0: 0a3c 6464 3e3c 636f 6465 3e63 7269 7465 .
    crite │ │ │ -000cffb0: 7269 613c 2f63 6f64 653e 202d 2054 6572 ria - Ter │ │ │ -000cffc0: 6d69 6e61 7469 6f6e 2063 7269 7465 7269 mination criteri │ │ │ -000cffd0: 6120 666f 7220 7468 6520 6974 6572 6174 a for the iterat │ │ │ -000cffe0: 6976 6520 756e 6469 7374 6f72 7469 6f6e ive undistortion │ │ │ -000cfff0: 2061 6c67 6f72 6974 686d 2e3c 2f64 643e algorithm.
    │ │ │ -000d0000: 0a3c 2f64 6c3e 0a3c 2f64 6976 3e0a 3c2f .
    .
    ..
  • .< │ │ │ -000d0020: 6c69 3e0a 3c73 6563 7469 6f6e 2063 6c61 li>.