Forum

Author Topic: Removing photos below certain altitude  (Read 6680 times)

ppant

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Removing photos below certain altitude
« on: July 07, 2017, 07:01:06 PM »
Hello
I am new to photoscan. I am trying to automate my photo mosaicing process. I am able to do most of the work with a python script. Load photos, align etc.  As there are many pictures in a single collection, I would like to delete some of the photos that are taken below some altitude. Is there a way I can do that.   

In the user interface I can select those photos and remove them. But in python scripting I am not sure How to achieve that.

Thank

PPant

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15413
    • View Profile
Re: Removing photos below certain altitude
« Reply #1 on: July 07, 2017, 08:29:53 PM »
Hello PPant,

I think you need to get the estimated camera locations, check their Z value and disable/remove corresponding cameras from the project.
For example:

Code: [Select]
THRESHOLD = 100
chunk = PhotoScan.app.document.chunk
for camera in list(chunk.cameras):
   coord = chunk.crs.project(chunk.transform.matrix.mulp(camera.center))
   if coord.z < THRESHOLD:
      camera.enabled = False

This code should work for geographic coordinate systems and will disable all cameras that have Z coordinate value lower than 100 (meters).
Best regards,
Alexey Pasumansky,
Agisoft LLC

ppant

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Removing photos below certain altitude
« Reply #2 on: July 12, 2017, 09:00:25 PM »
Hey  Alexey,
I tried doing this but I am getting error like

TypeError: argument 1 must be PhotoScan.Vector, not None

Thanks

PPant

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15413
    • View Profile
Re: Removing photos below certain altitude
« Reply #3 on: July 12, 2017, 09:02:18 PM »
Hello PPant,

Are all the cameras in the chunk aligned or there are some NA (not aligned) cameras?
Best regards,
Alexey Pasumansky,
Agisoft LLC

ppant

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Removing photos below certain altitude
« Reply #4 on: July 12, 2017, 10:57:42 PM »
Alexy
All the pictures are from the same collection set (same flight). I plan to remove those photos that were taken when the drone was going up and down. So that there are lesser number of picture for further processing (alignment and etc )

But I managed to solve my problem with (camera.photo.meta['Exif/GPSAltitude']) information. 
Thank for showing me light to follow camera information.

PPant

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15413
    • View Profile
Re: Removing photos below certain altitude
« Reply #5 on: July 13, 2017, 10:50:36 AM »
Hello PPant,

I thought you meant filtering based on the estimated altitude and not the source (measured) values.

Source values can be accessed using camera.reference.location method.
Best regards,
Alexey Pasumansky,
Agisoft LLC