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