Forum

Author Topic: Filter Points by Photos  (Read 4644 times)

scanlab.ca

  • Jr. Member
  • **
  • Posts: 56
  • Vancouver, BC
    • View Profile
    • 3d Scanning Service in Vancouver
Filter Points by Photos
« on: October 01, 2013, 03:41:22 AM »
Would it be possible to implement such a filter.

The reason for it is to make it easier to figure out which photos are misaligned and need to be reset and realigned or masked.

The way it would work is I'd generate my aligned photos,
see where things don't fit or have not aligned properly,
select a few points from this misaligned set,
Filter Photos by Points - this would show me all the photos which have possible misalignment issues,
then select these photos and Filter Points by photos to see this whole set of points.

Not sure if I'm making any sense here.
Best regards,

Ruslan Vasylev | Scanlab Photogrammetry
S: https://scanlab.ca | E: ruslan@scanlab.ca | T: 1 (778) 991-5157

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Filter Points by Photos
« Reply #1 on: October 01, 2013, 11:50:51 AM »
Hello Ruslan,

You can use Python script for such type of operation (if you are using PhotoScan Pro), here's sample script that highlights (selects) all the points from selected photos from the current chunk:

Code: [Select]
#highlights valid matches for selected photos in active chunk
#compatibility: starting from Agisoft PhotoScan Pro 0.9.0

import PhotoScan

doc = PhotoScan.app.document
chunk = doc.activeChunk
point_cloud = chunk.point_cloud

selected_photos = list()

for photo in chunk.photos:
if photo.selected:
selected_photos.append(photo)

for photo in selected_photos:
projections = point_cloud.projections[photo]
for i in projections:
if point_cloud.points[i.index].valid:
point_cloud.points[i.index].selected = True

PhotoScan.app.update()

In PhotoScan Pro 0.9.1 it is possible to create custom menu item that runs any script.
Best regards,
Alexey Pasumansky,
Agisoft LLC

giancan

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Filter Points by Photos
« Reply #2 on: May 01, 2015, 08:40:01 PM »
Hi Alexey,
sorry to open again an old topic.
Can you please help me to convert this script for the 1.1 version?
Thanks

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Filter Points by Photos
« Reply #3 on: May 03, 2015, 12:26:39 PM »
Hello giancan,

You can try the following one:

Code: [Select]
#highlights valid matches for selected photos in active chunk
#compatibility: starting from Agisoft PhotoScan Pro 1.1.6

import PhotoScan

doc = PhotoScan.app.document
chunk = doc.chunk
point_cloud = chunk.point_cloud
points = point_cloud.points
npoints = len(point_cloud.points)

selected_photos = list()

for photo in chunk.cameras:
if photo.selected:
selected_photos.append(photo)

for photo in selected_photos:

point_index = 0
for proj in point_cloud.projections[photo]:
track_id = proj.track_id
while point_index < npoints and points[point_index].track_id < track_id:
point_index += 1
if point_index < npoints and points[point_index].track_id == track_id:
if points[point_index].valid:
points[point_index].selected = True

PhotoScan.app.update()
Best regards,
Alexey Pasumansky,
Agisoft LLC