Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: vass on November 03, 2012, 03:07:53 PM

Title: Import markers for photos (2D position)
Post by: vass on November 03, 2012, 03:07:53 PM
Hello

Is it posible to create specific marker in photo with Python? Idea is to import markers (tracked points) from tracking softvare and help Photoscan to align photos. I can not find it in Python API Reference.

Thanks

Vass
Title: Re: Import markers for photos (2D position)
Post by: Alexey Pasumansky on November 03, 2012, 03:29:01 PM
Hello Vass,

If you have correspondence between marker label and it's projections on different photos (in pixels) such data can be imported to PhotoScan using Python.
Title: Re: Import markers for photos (2D position)
Post by: vass on November 04, 2012, 03:41:52 PM
Hello Alexey

Thanks for your advice. I am new to python scripting. So it is maybe strange question.  I find how to read 2d positions of Marker for each photo (chunk.markers[0].projections.items()).
But I can not write 2d position like this:

chunk.markers[0].projections.values()[0] = (10.0, 10.0)

even "PhotoScan.Marker().projections" is not writeable

What I am doing wrong?

Thanks for any help

Vass

Title: Re: Import markers for photos (2D position)
Post by: Alexey Pasumansky on November 04, 2012, 04:00:05 PM
Hello Vass,

You should use the following construction for assigning j-marker projections on the i-photo:

Code: [Select]
chunk.markers[j].projections[chunk.photos[i]] = (x,y)
Title: Re: Import markers for photos (2D position)
Post by: vass on November 05, 2012, 12:05:18 PM
Hello Alexey

Thak you very much for help. This is what i was looking for. Now I can experimenting with this. I have one more question if  I may disturb :-).
I wrote script for reading 2D projection of specific point from Pointcloud back to image (x,y). And I need to read the same point for all cameras (photos). It looks like indexing of points in pointcloud is not the same for each camera. Is it like that or I am wrong?

points = chunk.point_cloud
PhotoScan.PointCloudProjection(points,cameraIndex,pointIndex)

Thanks for your time

Vass