Forum

Show Posts

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.


Topics - jamiemccoll1@gmail.com

Pages: [1]
1
Hello all,

For context, I am using a chunk with 170 cameras and a sparse cloud of 11936 tie points.

Using the right-click "Filter photos by points" option, Photoscan returns the relevant photos in 0.01325 sec.

Using a python script found elsewhere on these forums, shown below, it takes 2.00 sec.

Why is there this much of a difference? How is the right-click function able to perform so much faster?

Code: [Select]
#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)

Edit: code adjustment

2
Python and Java API / import cv2 causes photoscan crash
« on: January 18, 2018, 03:09:57 AM »
Hi Forum,

I have installed both numpy and opencv-python via pip using

./python3.5 -m pip install numpy
./python3.5 -m pip install opencv-python

from the photoscan-pro/python/bin directory.

From within the Photoscan console I am then able to use numpy via:
>>> import numpy

When trying to do the same for opencv via:
>>> import cv2
this causes Photoscan to close itself and a crash report message to pop up.

From the photoscan-pro/python/bin directory I also accessed python by running:
./python3.5
>>>import numpy   #(this works)
>>>import cv2

This produces an error:
 File "<stdin>", line 1, in <module>
ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type

So I think that Photoscan is trying to access a different cv2 than the one in its site-packages folder, which is written for python2.7 instead of Photoscan's python3.5?

Is there a way to correct this and let Photoscan use the opencv distribution in it's own folders?

Thank you!

3
The final product I am aiming for is an array where each pixel consists of an x,y,z float of where that point in the image is found on the model. Similar to what renderDepth does for the depth of a given image, I hope to get 3D position instead. This to be used in conjunction with the original image such that a click on a photo can give the x,y,z position of that point in 3D space.

Initial thought is to simply use Camera.unproject() for each pixel, but from reading other posts it sounds like this is not correct.

Any help or hints will be much appreciated!

Pages: [1]