Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: ppkong on June 05, 2014, 05:10:34 AM

Title: About disable photos
Post by: ppkong on June 05, 2014, 05:10:34 AM
In my project there are 100 images, I want to use the Python script to disable one of ten images. I have made a txt file to record these ten photos name.
Now I want to use Python scripting to achieve this functionality, including reading txt and disable photo, What should I use
Code: [Select]
class PhotoScan.Camera.enable
Title: Re: About disable photos
Post by: ppkong on June 05, 2014, 06:55:39 AM
Additional supplementary, I used the following code, but it does not seem to work
Code: [Select]
import PhotoScan
doc = PhotoScan.app.document
chunk = PhotoScan.Chunk()
p = PhotoScan.Camera()
p.enabled = False
Title: Re: About disable photos
Post by: Alexey Pasumansky on June 05, 2014, 08:04:33 AM
Hello ppkong,

Providing that you have input camera names to be disabled in camera_names list, I can suggest the following code:

Code: [Select]
import PhotoScan
doc = PhotoScan.app.document
chunk = doc.activeChunk

camera_names = list()
#then you need to populate it with filenames

for camera in chunk.cameras:
     if camera.label in camera_names:
          camera.enabled = False

In your second post you seem to be using newly created camera instance that has no connection to your project.
Title: Re: About disable photos
Post by: ppkong on June 05, 2014, 08:19:01 AM
Aha!Alexey Pasumansky,Thanks very much for your reply!
I have followed your method to solve this problem, thanks again!You are so great!