2

I am doing structure from motion from multiple images using OpenCV. I have 8 images, and I have generated 3D point clouds for each pair of images (img1&2, img2&3, img3&4 etc.). I know that each individual 3D point cloud is correct because they look good when displayed in VTK / OpenGL.

My cameras are (roughly) calibrated, using EXIF metadata for the focal length and the center of the image as the principal point.

How do I transform each of these 3D point clouds into the 3D coordinate system of the leftmost camera?

bard
  • 2,762
  • 9
  • 35
  • 49

1 Answers1

0

I am assuming you have your point-clouds stored in a PCL compatible format; then you can simply use pcl::transformPointCloud.. If not, then you will need to implement your own based on the source code given in transforms.hpp..

HTH

EDIT:

Please refer to slides 16-19 in this presentation. The transformation model is,

P_c = R_c (P_w - C)

This is the mathematical form of the the transformation given in my previous link.

scap3y
  • 1,188
  • 10
  • 27
  • My points are stored in a text file with x,y,z coord for one point on each line. – bard Nov 16 '13 at 05:37
  • If they have x, y and z coordinates, then you can apply this function to them (you don't even need to build PCL, just use the implementation in your own function).. – scap3y Nov 16 '13 at 05:39
  • I'm using OpenCV's python bindings though, so would that still be possible? It seems to me like I would have to translate the source code to Python. – bard Nov 16 '13 at 05:41
  • Yeah, PCL and OpenCV are built entirely on C++.. It shouldn't be that hard to write the equivalent Python code, though. – scap3y Nov 16 '13 at 05:42
  • I see. Does that mean there's no OpenCV function I can call to transform the 3D coordinate system? I've been trying to use solvePnP to get the camera position but I can't figure out which coordinate system it's relative to. – bard Nov 16 '13 at 05:47
  • solvePnP is used to get the object pose from 2D correspondences. You need to map the pose defined in one coordinate system to another. [This](http://stackoverflow.com/questions/695043/how-does-one-convert-world-coordinates-to-camera-coordinates) would be a helpful resource too. – scap3y Nov 16 '13 at 05:47
  • Yep, thanks for the link! I was also wondering if I could use estimateAffine3D to do the mapping? – bard Nov 16 '13 at 05:56