Forum

Author Topic: Import camera orientation from Python script (since v 1.1.0)  (Read 5932 times)

jochemla

  • Newbie
  • *
  • Posts: 10
    • View Profile
Import camera orientation from Python script (since v 1.1.0)
« on: April 17, 2015, 04:18:16 PM »
Hi everyone,

Sorry, this post was in the wrong section.

I am trying to reconstruct quite complex scenes, and I am looking for ways to improve the speed of the reconstruction. I can access, for each photo I am using, to the orientation of the camera. This info is stored in three XMP tags for pitch, yaw, roll (the orientation of the UAV that took the pictures). I can access them from Python API, and am now wondering if these can be of any use to photoscan. I searched through the forums and found several answers, but I think they may be outdated, which is why I am opening this topic.

On April 09, 2012, Alexey said that "Source yaw, pitch, roll data is not used yet" ( http://www.agisoft.com/forum/index.php?topic=224.msg924#msg924 ). Is it still the case now ? Or is the orientation used for the Tie Points detection step now ? Is it used in the following operations ? I've done the reconstruction for several chunks, based on photos with GPS exif, and could find the estimated orientation in the Reference pane listed in this topic : http://www.agisoft.com/forum/index.php?topic=2572.0 .

The solution I am thinking of right now in order to import the orientation ( based on http://www.agisoft.com/forum/index.php?topic=3215.msg17080#msg17080 ) would be to loop through all the image files, and build a CSV file storing the orientation info as Omega Phi Kappa (as well as the GPS, but this may not be necessary since it is loaded from the EXIF). Then, I would like to import this camera calibration file into PhotoScan, also through the Python scripting. I could find an importCameras function in the 1.1.0 Python API, but no more details. I could find an example script for 1.0.4 here : http://www.agisoft.com/forum/index.php?topic=3095.msg16338#msg16338 but again, it seems to be too old for v 1.1.0, with which I use the chunk.addPhotos(photo_list) function. Second solution, write this data into the GPSPitch, GPSRoll and GPSDirection EXIF tags ( http://www.agisoft.com/forum/index.php?topic=2416.msg12846#msg12846 ), but they are not read yet in Photoscan right ?

First question : This topic : http://www.agisoft.com/forum/index.php?topic=3650.msg19088#msg19088 says we can use chunk.addPhotos and then chunk.importCameras. My problem is also that I have some cameras with the same filename, but different folders (different filepaths). Is it possible to build an importCamera ready CSV file taking that into account ? From what I've read on the forum, it only needs to store the name of the image. Moreover, what should the format of this CSV/txt file be ?

Second question : it would be easier for me not to build this CSV file. Is it possible to loop through the cameras of the chunk, read the orientation from the image file, set this information to the camera ? Will then Photoscan use it or do I need first to tell it to take the cameras orientation into account ?

I hope everything was clear. If not, you can ask me anything :)

Thanks in advance for your help,

Best regards,

Jonathan

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: Import camera orientation from Python script (since v 1.1.0)
« Reply #1 on: April 25, 2015, 03:44:49 PM »
Hello Jonathan,

Actually importing reference data to the Reference pane have different meaning from camera import operation. The first on just adds  camera/marker coordiante information that is used for georeferencing and optimization purposes for already aligned image set (camera orientation angles are still not utilized). Whereas camera import options loads both intrinsic and extrinsic information for each camera.
Since building the sparse cloud based on the imported camera positions doesn't refine camera positions, orientation or calibration, the imported data should be very accurate, so I doubt that using IMU data from on-board device will help you here.

Using Python you do not need to use importCameras() or loadReference() functions for the entire set at once, you can load the data for cameras one by one.
Best regards,
Alexey Pasumansky,
Agisoft LLC

jochemla

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Import camera orientation from Python script (since v 1.1.0)
« Reply #2 on: April 29, 2015, 03:07:17 PM »
Hello Alexey,

Thanks a lot for your answer. You are right, the GPS info is not accurate enough to be used as is - we still need the correction given through photogrammetry to adjust the camera positions and orientations. Moreover, we do not have calibrated images (so no intrinsic parameters), so we cannot use the import camera function. Thanks for pointing this out.

As for the roll, pitch, yaw, I thought it could make the matching a bit faster, but if it not implemented in Photoscan, that is fine. When saying I can load the data for cameras one by one, you mean if I have the extrinsic and extrinsic precisely calibrated, right ? And can I ask you what georeferencing and optimization purposes the reference can be used for ?

Thanks again for your help !

Best regards,

Jonathan

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: Import camera orientation from Python script (since v 1.1.0)
« Reply #3 on: April 29, 2015, 03:17:24 PM »
Hello Jonathan,

I meant that you can load any information (like reference coordinates, calibration information, precise position and etc.) for each camera individually and there's no need to use functions for multiple cameras, unless you really need them.
Best regards,
Alexey Pasumansky,
Agisoft LLC

jochemla

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Import camera orientation from Python script (since v 1.1.0)
« Reply #4 on: April 30, 2015, 10:17:34 AM »
Hello Alexey,

Alright, thanks again for your time !

Jonathan