From bb4adc75407aa251dadb16c8230b316893f12577 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Tue, 26 Mar 2019 03:15:00 +0100 Subject: [PATCH] divide image into columns and give min distance for each --- cpp/sampleOpenCV/sampleOpenCV.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/cpp/sampleOpenCV/sampleOpenCV.cpp b/cpp/sampleOpenCV/sampleOpenCV.cpp index d0587a4..0968319 100644 --- a/cpp/sampleOpenCV/sampleOpenCV.cpp +++ b/cpp/sampleOpenCV/sampleOpenCV.cpp @@ -39,9 +39,9 @@ using namespace cv; class MyListener : public IDepthDataListener { - static uint32_t const num_dist_columns_=5; - uint32_t latest_distance_[num_dist_columns_]; - uint32_t latest_distance_diff_[num_dist_columns_]; + static uint32_t const num_dist_columns_=4; + double latest_min_distance_[num_dist_columns_]; + double latest_min_distance_diff_[num_dist_columns_]; const int DELAY_BLUR = 100; // const int MAX_KERNEL_LENGTH = 31; @@ -126,8 +126,22 @@ public : } } - - + //// Debug: show column part of image + // Mat subimg = zImage8(Rect((zImage.cols/num_dist_columns_)*3,0, zImage.cols/num_dist_columns_ , zImage8.rows)); + // imshow ("column", subimg); + + //detect column distance + auto col_width = zImage.cols/num_dist_columns_; + for (uint32_t col=0; colwidth * 4, data->height * 4), CV_8UC1); @@ -306,6 +320,7 @@ int main (int argc, char *argv[]) // create two windows namedWindow ("Depth", WINDOW_AUTOSIZE); namedWindow ("Gray", WINDOW_AUTOSIZE); + // namedWindow ("column", WINDOW_AUTOSIZE); // start capture mode if (cameraDevice->startCapture() != CameraStatus::SUCCESS) -- 1.7.10.4