谨此记录下以前写的相关核心代码,以备不时之需,其实效果很不理想,不要被误导了。 for (int i = distanceCount-2; i-- >= 0; ) { /* Found a potential boundary */ if (depth_score[i] >= threshold && framePossibleBoundaryMat->data.i[i] != lastFrame) { /* Check if the nearby area has anything better */ largest = true; currentFrame = framePossibleBoundaryMat->data.i[i]; currentDistance = distance[i]; nextFrame = framePossibleBoundaryMat->data.i[i+1]; nextDistance = distance[i+1]; count = 1; /* Scan left */ /* 满足此条件,则扫描i左边的相邻的neighbours个深度值,判断前面的帧是否与当前帧相同并计数 */ if(currentDistance > nextDistance) { for (int j = neighbours; largest && j > 0 && (i - j) > 0; j--) { if (framePossibleBound