I have a series of images in a series of folders. Each folder is a separate camera, and each camera requires a separate calibration, and the images are taken at separate time points. The following script loads up the images and reconstructs the 3D scene at the different time points. What it doesn't do is produce a separate calibration per camera. I was hoping that the putting each camera into a different group would achieve this but actually it doesn't look like my code does that. As far as I can see from the output, all the cameras end up in in the same group. Obviously I'm missing something. I've put the part I think might be wrong in red.
Any help appreciated!
Bill
import os
import PhotoScan
doc = PhotoScan.app.document
input_folder = '/Users/wis/Work/data/2014-10-08/test_frames/clip0000'
output_folder = '/Users/wis/Work/data/2014-10-08/test/clip0000'
camera_folders = ['camera00','camera01','camera02','camera03','camera04']
folders = list()
for f in camera_folders:
folders.append(os.path.join(input_folder, f))
#processing parameters
accuracy = PhotoScan.Accuracy.HighAccuracy #align photos accuracy
preselection = PhotoScan.Preselection.GenericPreselection
keypoints = 40000 #align photos key point limit
tiepoints = 10000 #align photos tie point limit
source = PhotoScan.PointsSource.DensePoints #build mesh source
surface = PhotoScan.SurfaceType.Arbitrary #build mesh surface type
quality = PhotoScan.Quality.MediumQuality #build dense cloud quality
filtering = PhotoScan.FilterMode.AggressiveFiltering #depth filtering
print("Script started")
#creating new chunk
doc.addChunk()
chunk = doc.chunks[-1]
chunk.label = "New Chunk"
#loading images
photo_list = list()
for f in folders:
image_list = os.listdir(f)
photo_list.append(os.path.join(f, image_list[0]))
chunk.addPhotos(photo_list)
# put the new cameras into different camera groups
for camera in chunk.cameras:
cameraGroup = chunk.addCameraGroup()
camera.group = cameraGroup
# load in the extra frames per camera
for iframe in range(1, 6):
frame = chunk.addFrame()
photo_list = list()
for ifolder in range(0, len(folders)):
image_list = os.listdir(folders[ifolder])
frame.cameras[ifolder].open(os.path.join(folders[ifolder], image_list[iframe]))
#align photos
for frame in chunk.frames:
frame.matchPhotos(accuracy=accuracy,preselection=preselection,filter_mask=False,keypoint_limit=keypoints,tiepoint_limit=tiepoints)
chunk.alignCameras()
chunk.optimizeCameras()
#building dense cloud
for frame in chunk.frames:
frame.buildDenseCloud(quality = quality, filter = filtering)
# and save
doc.save(os.path.join(output_folder, 'PhotoScanModel.psz'))