Odm: Exporting Projection Matrix

Created on 28 Nov 2018  路  7Comments  路  Source: OpenDroneMap/ODM

How did you install OpenDroneMap? (Docker, natively, ...)?

Docker

What's your browser and operating system?

Chrome 70 on Linux

What is the problem?

Is there any way to export the projection matrix for each used for building pointcloud?

What I am trying to do is that, I want to project a 3D point (from geo-referenced pointcloud) back to image. Is there any way to do it already? If not, can we export camera projection matrix?

enhancement help wanted

All 7 comments

Hey @manik9000 :hand: see odm_georeferencing/odm_georeferencing_transform.txt for the local to geo coordinates transform, opensfm/reconstruction.json then has the camera parameters in local coordinates from which you could do the projection.

@pierotofy Thanks for you reply.
I went through your suggestions.

I couldn't find any odm_georeferencing/odm_georeferencing_transform.txt do I have to enable any flag while running docker? in odm_georeferencing folder I can bunch of <>_model_<> files. There's a file nmaed as proj.txt is this the file that you're referring to?
This is what I have in proj.txt : +units=m +no_defs=True +datum=WGS84 +proj=utm +zone=15

This is one example from opensfm/reconstruction.json file :

"INT00332.JPG": {
                "orientation": 1, 
                "camera": "v2 sony dsc-rx0 4800 3200 perspective 0.6666", 
                "gps_position": [
                    806.3396739157586, 
                    -51.800766397707775, 
                    452.768859019503
                ], 
                "gps_dop": 15.0, 
                "rotation": [
                    -2.1334483422574895, 
                    -1.215532252695722, 
                    0.7823746966289218
                ], 
                "translation": [
                    168.81621326100682, 
                    -803.4777232670473, 
                    553.1620842691636
                ], 
                "capture_time": 1537365901.0
            }, 

My question is, What are those "rotation" parameters? and how do I go from those rotation parameters to rotation matrix. I was planning to use following formula R = Rz(蠁)*Ry(胃)*Rx(蠄) is that the right approach?

You can also get the rotation matrix from opensfm/bundle_r000.out
Refer this link for more info - http://www.cs.cornell.edu/~snavely/bundler/bundler-v0.4-manual.html#S7

@pierotofy @garlac thanks for the response guys.

One more question, off the topic..
can you guys point me to some discussion on How can I get denser pointclouds?
Note: I have already gone through an issue talking about exposing few params from OpenSFM.
I tired all the param values suggested there.. but it always produces 1 million points no matter what I try

@manik9000 -- a good question for http://community.opendronemap.org, but in short, try this pull request: https://github.com/OpenDroneMap/ODM/pull/921.

I am shamelessly looking for testers of it anyway. :)

@pierotofy
I tired your suggestions but they are not producing the correct results.
can you comment on my following workflow:

  1. Convert Lat-Lon-Alt to UTM using proj.txt : +units=m +no_defs=True +datum=WGS84 +proj=utm +zone=15
  2. convert UTM XYZ to geocentric coordinates
def gps_to_ecef(lat, lon, alt):
    ecef = pyproj.Proj(proj='geocent', ellps='WGS84', datum='WGS84')
    lla = pyproj.Proj(proj='latlong', ellps='WGS84', datum='WGS84')
    x, y, z = pyproj.transform(lla, ecef, lon, lat, alt, radians=False)

    return x, y, z
  1. Use Tgeo (georeferencing_transform), Tcam, and K to project XYZ to pixX, pixY [something like] :
a = inv(Tgeo) * (np.matrix([x, y, z, 1])).T
imgPt = inv(Tcam) * a
tt = K * (np.matrix([ imgPt[0]/imgPt[2], imgPt[1]/imgPt[2], 1])).T

Note: I am using cv2.Rodrigues() to get camera Rotation matix

Unfortunately, these steps don't work with ODM outputs as expected where as they work excellent with Agisoft's outputs (camera_calibration.xml).

Am I missing something here? are there any some sort of offsets or something that I have to consider in case of ODM camera calibration?

Was this page helpful?
0 / 5 - 0 ratings