Hello,
I used this code that you posted for the marker georeferencing with python.
The code runs without error but I have no marker placed in my interface. can you help me?
I use Agisoft 1.2.6
#markers batch import script
#compatibility PhotoScan Professional 1.2.5
#camera_label #marker_label #px_x #px_y #world_x #world_y #altitude
import PhotoScan
import os
doc = PhotoScan.app.document
chunk = doc.chunk
path = PhotoScan.app.getOpenFileName("Specify the path to the file:") #"D:/input.txt"
file = open(path, "rt") #input file
eof = False
line = file.readline() #reading the line in input file
while not eof:
photos_total = len(chunk.cameras) #number of photos in chunk
markers_total = len(chunk.markers) #number of markers in chunk
sp_line = line.rsplit("\t", 6) #splitting read line by four parts
camera_name = sp_line[0] #camera label
marker_name = sp_line[1] #marker label
x = float(sp_line[2]) #x- coordinate of the current projection in pixels
y = float(sp_line[3]) #y- coordinate of the current projection in pixels
cx = float(sp_line[4]) #world x- coordinate of the current marker
cy = float(sp_line[5]) #world y- coordinate of the current marker
cz = float(sp_line[6]) #world z- coordinate of the current marker
flag = 0
for i in range (0, photos_total):
if chunk.cameras.label == camera.name:
for marker in chunk.markers: #searching for the marker (comparing with all the marker labels in chunk)
if marker.label == marker_name:
marker.projections[chunk.cameras] = (x,y) #setting up marker projection of the correct photo)
flag = 1
break
if not flag:
marker = chunk.addMarker()
marker.label = marker_name
marker.projections[chunk.cameras] = (x,y)
marker.reference.location = PhotoScan.Vector([cx, cy, cz])
break
line = file.readline() #reading the line in input file
if len(line) == 0:
eof = True
break # EOF
file.close()
chunk.updateTransform()
print("Import finished.") #information message