We're currently trying to do protogrammetry with an Oak-D Pro (FF) mounted to a drone. We fly slowly above the area to be mapped, take a picture every few metres and use these pictures to generate a height model. For this algorithm to work, the pictures need to be very clear and detailed.
Unfortunately, the pictures taken by the Oak-D's color camera tend to get quite blurry in the finer details. The following picture was taken with a stationary camera out of my window to exclude any possible vibrations through gimbal or drone.
Notice how the sharpness degrades along the length of the building and that the finer tree structures in the back tend to get very blurry? I may seem to exaggerate here, but this is unfortunately the quality the photogrammetry algorithm demands…
I turned sharpness all the way up and disabled denoising completely, as the algorithm deals better with noise than with blur. This is the test script I used:
import depthai as dai
import time
import os
if __name__ == '__main__':
# set image directory here
workDir = "/home/foo/img"
pipeline = dai.Pipeline()
camRgb = pipeline.create(dai.node.ColorCamera)
camRgb.initialControl.setSharpness(4) # range: 0..4, default: 1
camRgb.initialControl.setLumaDenoise(0) # range: 0..4, default: 1
camRgb.initialControl.setChromaDenoise(0) # range: 0..4, default: 1
camRgb.setBoardSocket(dai.CameraBoardSocket.CAM_A)
camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_12_MP)
xin = pipeline.create(dai.node.XLinkIn)
xin.setStreamName("control")
xin.out.link(camRgb.inputControl)
# Properties
videoEnc = pipeline.create(dai.node.VideoEncoder)
videoEnc.setDefaultProfilePreset(1, dai.VideoEncoderProperties.Profile.MJPEG)
camRgb.still.link(videoEnc.input)
# Linking
xoutStill = pipeline.create(dai.node.XLinkOut)
xoutStill.setStreamName("still")
videoEnc.bitstream.link(xoutStill.input)
with dai.Device(pipeline) as device:
qStill = device.getOutputQueue(name="still", maxSize=30, blocking=True)
qControl = device.getInputQueue(name="control")
while True:
ctrl = dai.CameraControl()
ctrl.setCaptureStill(True)
qControl.send(ctrl)
while True:
if qStill.has():
file_name = f"{int(time.time() * 1000)}.jpeg"
print("Taking picture...")
with open(os.path.join(workDir, file_name), "wb") as f:
f.write(qStill.get().getData())
print('Image saved to', file_name)
break
Is there anything I can do to improve my images?
Also let me say: I realize that, nowadays, we tend to take stunning image quality for granted as every cheap smartphone is equipped with professional grade sensors, so maybe I'm asking too much and this is simply the best this sensor can deliver. If so, could we gain anything from using an Oak-1 Max instead?
Thanks in advance