Forum

Author Topic: gradual selection filtering with script and batch process  (Read 2677 times)

jazvec

  • Newbie
  • *
  • Posts: 13
    • View Profile
gradual selection filtering with script and batch process
« on: January 04, 2018, 08:08:52 PM »
hello,

first of all im not a coder so i have zero clue about python. all i know is what ive find on the internet.

im using this script for cleaning the point cloud. i like to delete all points from less than 3 cameras with image count gradual selection option.

this is my script:

import PhotoScan

chunk = PhotoScan.app.document.chunk
f = PhotoScan.PointCloud.Filter()
f.init(chunk,PhotoScan.PointCloud.Filter.ImageCount)
f.removePoints(2)

it works when i use it manually on each chunk.
problem is, it doesnt work in batch. it only process the active chunk and ignores the selection i have in batch process.

how to fix this? i want to clean all of my chunks with one click.

can you help? thanks.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: gradual selection filtering with script and batch process
« Reply #1 on: January 05, 2018, 07:16:15 PM »
Hello jazvec,

The first line of the script (after import of PhotoScan module) means that it would be applied to the active chunk. You can modify the script in the following way, if you need to apply the same gradual selection criterion for all chunks in the active project:

Code: [Select]
import PhotoScan

for chunk in PhotoScan.app.document.chunks:
    f = PhotoScan.PointCloud.Filter()
    f.init(chunk,PhotoScan.PointCloud.Filter.ImageCount)
    f.removePoints(2)
Best regards,
Alexey Pasumansky,
Agisoft LLC

jazvec

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: gradual selection filtering with script and batch process
« Reply #2 on: January 06, 2018, 04:33:34 PM »
hi,

thanks for the reply but it still doesnt work

i get this error and nothing happens.

.... cleancloud.py", line 5
2018-01-06 14:31:53     f = PhotoScan.PointCloud.Filter()
2018-01-06 14:31:53     ^
2018-01-06 14:31:53 IndentationError: expected an indented block

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: gradual selection filtering with script and batch process
« Reply #3 on: January 06, 2018, 04:49:54 PM »
Hello jazvec,

You need to have the same indentation in front of all last three lines, for example, "tab" symbol.
Best regards,
Alexey Pasumansky,
Agisoft LLC

jazvec

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: gradual selection filtering with script and batch process
« Reply #4 on: January 06, 2018, 05:32:58 PM »
it works!
thanks a bunch Alexey