Forum

Author Topic: Python API, Photo.project(point) crashes Ps  (Read 7770 times)

ju523m

  • Guest
Python API, Photo.project(point) crashes Ps
« on: December 20, 2011, 10:44:36 AM »
Hi everybody,

to get the two-dimensional image coordinates for a 3D point, is it correct to use photo.project(point)?

For example to check just for testing, if the 3D coordinate of the camera center(focal point)  results in a projected point in the 2D image plane.  It should be projected to the coordinates of the principal point, right?

When I try the following from python console, PS (0.8.4 1289,  Ubuntu linux 10.04.3) crashes (no crash report generated)

import PhotoScan as ps

photo_0 = ps.app.document.activeChunk.photos[0]
cphoto = photo_0.center
(imgx, imgy) = photo_0.project(cphoto)


Ps crashes also when I homogenize the point vector for this operation.

Am I missing something? The Api documentation is a little unprecise at this point.
For example when converting the Camera center coordinates from chunk-coordinate-system into projected map coordinate system - let's say WGS84 UTM Zone 32 N - it is necessary to homogenize the 3D Point vector.

I did it like this:

(preliminaries as above)
currentChunk = ps.app.document.activeChunk
TM = currentChunk.transform          #4x4 Transformation Matrix
grcon = currentCHunk.ground_control
geopro = grcon.projection

#some 3D point pt and  coordinates as  vector of size 3
pv = pt.coord
pv.size = 4
pv.w = 1
pt_geocentric = TM * pv

#resize the resulting vector
pt_geocentric.size = 3
pt_projected = geopro.project(pt_geocentric)


Which works fine.

So, any ideas about photo.project(point) problem?
Thanks for your help.

kind regards



Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15438
    • View Profile
Re: Python API, Photo.project(point) crashes Ps
« Reply #1 on: December 20, 2011, 05:28:37 PM »
Hello Tomas,

Thank you for reporting.
Photo.project crashing bug will be fixed in the next update.
« Last Edit: December 21, 2011, 01:57:57 PM by Alexey Pasumansky »
Best regards,
Alexey Pasumansky,
Agisoft LLC

zzzzzmman

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Python API, Photo.project(point) crashes Ps
« Reply #2 on: January 08, 2015, 10:48:39 AM »
I understand what you are saying but I think there should be more comments regarding the threat that was initially started so that the pool of thoughts is attracted.  Regards.
You can get score highest marks in ccna quiz dumps exam using ccnp certificate and test king which are prepared