Points only camera calibration? 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:


Doing it manually

Quite hard and I can never get it right
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)
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! :)
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