Forum

Author Topic: Sort photos by Image Enabled / Disabled  (Read 4387 times)

rbhurtha

  • Newbie
  • *
  • Posts: 3
    • View Profile
Sort photos by Image Enabled / Disabled
« on: August 21, 2015, 12:57:23 PM »
 Hello Everyone, does anyone have a script that can sort images in the Photo pane by the criteria: if they are Enabled or Disabled ?

thanks
Roshan

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: Sort photos by Image Enabled / Disabled
« Reply #1 on: August 21, 2015, 01:41:07 PM »
Hello Roshan,

You can use the following code to select all disabled cameras in the active chunk. Then filtering by selection should be performed manually:

Code: [Select]
import PhotoScan
doc = PhotoScan.app.document
chunk = doc.chunk
for camera in chunk.cameras:
  if not camera.enabled:
  camera.selected = True
  else:
  camera.selected = False
Best regards,
Alexey Pasumansky,
Agisoft LLC

rbhurtha

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Sort photos by Image Enabled / Disabled
« Reply #2 on: August 26, 2015, 04:43:32 PM »
Thanks Alexey!
I will use it :)
regards
Roshan

bisenberger

  • Sr. Member
  • ****
  • Posts: 329
    • View Profile
    • Digital Mapping & Graphics
Re: Sort photos by Image Enabled / Disabled
« Reply #3 on: November 08, 2016, 03:59:21 PM »
Very useful.  :)
Digital Mapping & Graphics LLC
https://digital-mapping.net/

bisenberger

  • Sr. Member
  • ****
  • Posts: 329
    • View Profile
    • Digital Mapping & Graphics
Re: Sort photos by Image Enabled / Disabled
« Reply #4 on: March 20, 2020, 05:59:27 PM »
Hi Alexy,
The script doesn't work with Metashape 1.6.2.
Bill
Digital Mapping & Graphics LLC
https://digital-mapping.net/

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: Sort photos by Image Enabled / Disabled
« Reply #5 on: March 20, 2020, 09:41:25 PM »
Hello Bill,

Strange, but it works on my side. However, you can use the following code.
It adds two Custom menu options to select and filter out in Photos pane only enabled or only disabled cameras from the active chunk.

Code: [Select]
import Metashape


def filter_enabled():
doc = Metashape.app.document
chunk = doc.chunk
camera_list = []
for camera in chunk.cameras:
if camera.enabled:
camera.selected = True
camera_list.append(camera)
else:
camera.selected = False
Metashape.app.photos_pane.setFilter(camera_list)
return

def filter_disabled():
doc = Metashape.app.document
chunk = doc.chunk
camera_list = []
for camera in chunk.cameras:
if not camera.enabled:
camera.selected = True
camera_list.append(camera)
else:
camera.selected = False
Metashape.app.photos_pane.setFilter(camera_list)
return


Metashape.app.addMenuItem("Custom menu/Filter enabled cameras", filter_enabled)
Metashape.app.addMenuItem("Custom menu/Filter disabled cameras", filter_disabled)

Best regards,
Alexey Pasumansky,
Agisoft LLC