1
Python and Java API / Re: import cv2 causes photoscan crash
« on: January 19, 2018, 01:50:26 AM »
Thank you! I will try this shortly.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
#selects cameras where the projections of the selected tie points do appear
#compatibility: Agisoft PhotoScan Pro 1.2.1
import PhotoScan
import time
doc = PhotoScan.app.document
chunk = doc.chunk
point_cloud = chunk.point_cloud
points = point_cloud.points
projections = point_cloud.projections
npoints = len(points)
selected_photos = []
start_time = time.time()
for photo in chunk.cameras:
point_index = 0
photo.selected = False
for proj in 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 not points[point_index].valid:
continue
elif points[point_index].selected == True:
photo.selected = True
selected_photos.append(photo.label)
PhotoScan.app.update()
end_time = time.time()
print("Time Taken: "+str(end_time-start_time)+" sec")
print("For the selected points the following cameras were used: ")
print(selected_photos)