Forum

Author Topic: About disable photos  (Read 5784 times)

ppkong

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
About disable photos
« 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

ppkong

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Re: About disable photos
« Reply #1 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

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14818
    • View Profile
Re: About disable photos
« Reply #2 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.
Best regards,
Alexey Pasumansky,
Agisoft LLC

ppkong

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Re: About disable photos
« Reply #3 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!