8
$\begingroup$

1) I have a photo of an object, taken at a specific orientation and position of my camera. 2) I also have a 3D model of that same object.

I need to be able to calibrate the camera in Blender (or some other software which would allow me to easily export the results back into Blender), using only several reference points (whose corresponding coordinates are known both in the 2D space of the object's photo, and in the 3D space of the object's 3D model) so that it precisely matches the physical camera's orientation and position (and Focal Length, sensor size, etc.) as seen in the photo.

What I've tried so far:

  1. Doing it manually

    Quite hard and I can never get it right

  2. BLAM (the camera calibration tool for Blender)

    It seems to work only with "perspective" lines, and it my case I can only use several (4, 5, 6...) "reference" points (see above)

  3. Python script

    It does a "brute force" space search through millions of possible camera positions/orientations and outputs an approximate orientation and position of the camera, which, allegedly, match the physical camera ones.

Is there a better/easier way to do this in Blender?

I guess this is what I essentially need to do, but rather without (the several views of) a calibration pattern (again - I only have the above described "reference" points in both 2D and 3D space and my object is quite "irregular" so that no vanishing points can be defined for it)

P.S. First time asking a question on SE, so please excuse me if I messed up somehow! :)

$\endgroup$
  • 2
    $\begingroup$ I'd suggest use blam, but without seeing the image it's guessing... If possible please add it to your question. $\endgroup$ – p2or Feb 2 '16 at 23:44
  • $\begingroup$ I can add an image, but just imagine a photo of a ball, with some kind of texture mapped onto it (mother Earth, for example! :) ). Now imagine that you have a complete 3d model of the ball (let's say you 3d scanned it), and a photo of the ball at a specific position and direction of your camera. Now, your goal is to determine these two parameters (the "extrinsic matrix", and possibly the "intrinsic matrix" as well) by specifying several reference points on the 3d model of the ball (on its texture somewhere) and the corresponding 2d points on your photo of the ball. How would BLAM help? Thanks! $\endgroup$ – 10caret100 Feb 7 '16 at 21:20
2
$\begingroup$

Here an exact example of what you want

http://www1.cs.columbia.edu/~atroccol/3DPhoto/3D-2D_registration.html

The math broken down step by step

https://dsp.stackexchange.com/questions/1727/3d-position-estimation-using-2d-camera

If you need help with UI code, such as picking 3d or 2d points with a python modaloperator, I am happy to help with that.

EDIT: I have made a partially working module code: https://github.com/patmo141/odc_public/blob/master/image_object_registration.py blend: https://www.dropbox.com/s/rqk9rrh9a4rw9ez/image_object_registration.blend?dl=0

https://youtu.be/Edk9uA5Yl5k

-Patrick

$\endgroup$
  • $\begingroup$ I have made a modal operator which stores points clicked on the 3dView and poitns clicked by the user in the image editor. So the UI for this is done, just need someone (or for me to find the time) to dig into setting up the math. $\endgroup$ – patmo141 Oct 17 '16 at 11:34
  • $\begingroup$ youtu.be/Nc6myGYntpU $\endgroup$ – patmo141 Oct 18 '16 at 2:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.