Skip to content

Commit

Permalink
StereoDepth: update getMaxDisparity
Browse files Browse the repository at this point in the history
  • Loading branch information
SzabolcsGergely committed Nov 12, 2024
1 parent 36d3743 commit fe5b1fb
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/pipeline/datatype/StereoDepthConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,48 @@ float StereoDepthConfig::getMaxDisparity() const {
maxDisp += cfg.algorithmControl.disparityShift;
if(cfg.algorithmControl.enableExtended) maxDisp *= 2;
if(cfg.algorithmControl.enableSubpixel) maxDisp *= (1 << cfg.algorithmControl.subpixelFractionalBits);

std::vector<dai::StereoDepthConfig::PostProcessing::Filter> filtersToExecute;
for(auto filter : cfg.postProcessing.filteringOrder) {
switch(filter) {
case RawStereoDepthConfig::PostProcessing::Filter::SPECKLE:
if(cfg.postProcessing.speckleFilter.enable) {
filtersToExecute.push_back(filter);
}
break;
case RawStereoDepthConfig::PostProcessing::Filter::TEMPORAL:
if(cfg.postProcessing.temporalFilter.enable) {
filtersToExecute.push_back(filter);
}
break;
case RawStereoDepthConfig::PostProcessing::Filter::SPATIAL:
if(cfg.postProcessing.spatialFilter.enable) {
filtersToExecute.push_back(filter);
}
break;
case RawStereoDepthConfig::PostProcessing::Filter::DECIMATION:
if(cfg.postProcessing.decimationFilter.decimationFactor > 1) {
filtersToExecute.push_back(filter);
}
break;
case RawStereoDepthConfig::PostProcessing::Filter::MEDIAN:
if(cfg.postProcessing.median != dai::MedianFilter::MEDIAN_OFF) {
filtersToExecute.push_back(filter);
}
break;
case RawStereoDepthConfig::PostProcessing::Filter::NONE:
break;
default:
break;
}
}

if(filtersToExecute.size() != 0) {
if(filtersToExecute.back() != RawStereoDepthConfig::PostProcessing::Filter::MEDIAN) {
maxDisp = 1 << 13;
}
}

return maxDisp;
}

Expand Down

0 comments on commit fe5b1fb

Please sign in to comment.