Hi erik
Thank you so much for your quick response.
The distance to the ruler is about 880mm.
Stereo Depth modes are ...
` stereo->setDepthAlign(dai::CameraBoardSocket::RGB);
// Create a node that will produce the depth map (using disparity output as it's easier to visualize depth this way)
stereo->setDefaultProfilePreset(dai::node::StereoDepth::PresetMode::HIGH_DENSITY);
// Options: MEDIAN_OFF, KERNEL_3x3, KERNEL_5x5, KERNEL_7x7 (default)
//stereo->initialConfig.setMedianFilter(dai::MedianFilter::KERNEL_7x7);
stereo->initialConfig.setMedianFilter(dai::MedianFilter::KERNEL_5x5);
//stereo->initialConfig.setBilateralFilterSigma(7);
stereo->setLeftRightCheck(lr_check);
stereo->setExtendedDisparity(extended_disparity);
stereo->setSubpixel(subpixel);
auto config = stereo->initialConfig.get();
config.postProcessing.speckleFilter.enable = false;
config.postProcessing.speckleFilter.speckleRange = 50;
config.postProcessing.temporalFilter.enable = true;
config.postProcessing.spatialFilter.enable = true;
config.postProcessing.spatialFilter.holeFillingRadius = 2;
config.postProcessing.spatialFilter.numIterations = 1;
config.postProcessing.thresholdFilter.minRange = 400;
config.postProcessing.thresholdFilter.maxRange = 2000;
config.postProcessing.decimationFilter.decimationFactor = 1;
stereo->initialConfig.set(config);
`
The spatials-on-host demo is using the angle, so should I use the angle instead of the focal-length ?
In calc.py ...
def _calc_angle(self, frame, offset):
return math.atan(math.tan(self.monoHFOV / 2.0) * offset / (frame.shape[1] / 2.0))
:
angle_x = self._calc_angle(depthFrame, bb_x_pos)
angle_y = self._calc_angle(depthFrame, bb_y_pos)
spatials = {
'z': averageDepth,
'x': averageDepth * math.tan(angle_x),
'y': -averageDepth * math.tan(angle_y)
}
I will try to use the angle.
Thanks in advance.