Tuesday, August 16, 2016

Align two images in OpenCV

Leave a Comment

I have two images (see below). These images represent the contours of a pair of cables and were captured using laser based 3D triangulation. The first image is captured with the left camera, while the second one with the right camera. As can be seen, these images are partially overlapping. The left part on the first image partly corresponds to the left part on the second image. The same holds for the right part. I want to merge these two images into one image so that the corresponding parts overlap.

Next to these images, I also have the following information at my disposal:

  • A 3x3 homography matrix H of left and right camera
  • Intrinsic camera parameters K of left and right camera
  • Distortion coefficients D (9 of them) of left and right camera
  • Offset O of left and right camera

This data is specified below.

In Halcon, I have tried to do this using mosaicking:

  • Extract characteristic points in both images using Harris
  • Compute a projective transformation matrix from one image to the other using Ransac.
  • Apply the found projective transformation matrix.

This approach was however not successful. I am looking for a similar approach in OpenCV or Halcon or an approach (also in OpenCV or Halcon) that makes use of the calibration data I have at my disposal, such as the homography matrix and camera matrix.

Please provide ample explanations, if possible, since I am only starting out with Machine Vision.

enter image description here enter image description here

Hl := [0.00175186,   4.73083e-05, -0.00108921,        0.000780817, -0.00145615,   0.00118631,        0.0534139,   -0.030823,     1.0        ] Kl := [4578.21,   -5.05144, 759.766,        0.0,     4576.87,    568.223,        0.0,        0.0,       1.0   ] Dl := [-0.12573, 0.0533453, -0.575361, -0.0130272, 0.00348033, 0.00852617, -0.0271142, 0.0176706, -0.00575124] Ol := [0.0, 150.0]  Hr := [0.00173883, -2.94597e-05, 0.00109873,       -0.00077676, -0.0014687,   0.00121393,       -0.0653829,  -0.0443924,   1.0        ] Kr := [4591.96,  -4.55317, 1284.74,        0.0,    4591.19,     534.317,        0.0,       0.0,        1.0   ] Dr := [-0.110751, -0.349716, 3.86535, 0.017393, -0.00364957, -0.00633656, 0.0338833, -0.0212222, 0.00543694] Or := [0.0, 100.0] 

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment