Hi all,
I am using educational version 1.1.6 and I am interested in exporting markers (many) per camera. Actually what I do is import markers through the reference panel and then I can see the grey flag on the images. Is it possible to export only the visible markers of each image with their pixel position? So I can get in the end a txt file that contains:
camera_label, marker_label, x_pixels, y_pixels
I am attaching the photo for an example to understand what I want.
Until now I am trying to play with a python script where I read a txt with the 3D position X,Y,Z for all the markers and manually import the camera label and I get in the console the pixel coordinates. It works fine but it also gives the pix coordinates of points that are not included in the specified camera. And I am wondering if there is any way to solve this automatically so I can get only the included markers as you can see in the attached picture.
Thanks a lot for any feedback!
The script I am using is:
#markers import script
#input file format:
#camera_label marker_label x y z
#(TAB separator)
import PhotoScan
doc = PhotoScan.app.document
chunk = doc.chunk
path = PhotoScan.app.getOpenFileName("Specify input file with marker coordinates:")
print("Import started...") #informational message
sth={}
file = open(path, "rt") #input file
eof = False
line = file.readline()
if len(line) == 0:
eof = True
while not eof:
#print(line)
sp_line = line.rsplit(",", 4) #splitting read line by 5 parts
oid = sp_line[0]
z = float(sp_line[3])
y = float(sp_line[2]) #x- coordinate of the current projection in pixels
x = float(sp_line[1]) #y- coordinate of the current projection in pixels
camera_label = 82 #camera label1
photo_0 = chunk.cameras[int(camera_label)]
point3D = PhotoScan.Vector([x,y,z])
point_geocentric = chunk.crs.unproject(point3D)
point_internal = chunk.transform.matrix.inv().mulp(point_geocentric)
imgx, imgy = photo_0.project(point_internal)
print(str(oid),str(imgx),str(imgy))
line = file.readline() #reading the line in input file
if not len(line):
eof = True
break # End of File
print("Script finished") #information message
file.close()