Changeset 56 in pacpussensors for trunk/StereoVisionDisparity/DisparityMap.cpp


Ignore:
Timestamp:
Jun 27, 2014, 2:16:15 PM (10 years ago)
Author:
phudelai
Message:

Vision component updated for StereoVision for PointGrey Flea3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/StereoVisionDisparity/DisparityMap.cpp

    r53 r56  
    144144        THREAD_ALIVE = true;
    145145        start();
     146
     147        emit minimumDisparityChanged(this->min_disp);
     148        emit numberOfDisparityChanged(this->num_disp);
     149        emit SADWindowSizeChanged(this->sbm_SADWindowSize);
     150        emit textureTresholdChanged(this->sbm_textureThreshold);
     151        emit uniquenessRatioChanged(this->sbm_uniquenessRatio);
    146152}
    147153
     
    577583}
    578584
     585
     586////////////////////////////////////////////////////////////////////////////////
     587void DisparityMap::setMinimumDisparity(int minimum_disp)
     588{
     589        this->min_disp = minimum_disp;
     590
     591        emit minimumDisparityChanged(this->min_disp);
     592}
     593
     594
     595////////////////////////////////////////////////////////////////////////////////
     596void DisparityMap::setNumberOfDisparity(int numberOfDisparity)
     597{
     598        // Must be a multiple of 16
     599        this->num_disp = numberOfDisparity & ~15;
     600        if (this->num_disp < 16)
     601                this->num_disp = 16;
     602
     603        emit numberOfDisparityChanged(this->num_disp);
     604}
     605
     606
     607////////////////////////////////////////////////////////////////////////////////
     608void DisparityMap::setSADWindowSize(int SADWindowSize)
     609{
     610        // Must be an odd number
     611        this->sbm_SADWindowSize = SADWindowSize | 1;
     612       
     613        emit SADWindowSizeChanged(this->sbm_SADWindowSize);
     614}
     615
     616
     617////////////////////////////////////////////////////////////////////////////////
     618void DisparityMap::setTextureTreshold(int textureTreshold)
     619{
     620        this->sbm_textureThreshold = textureTreshold;
     621
     622        emit textureTresholdChanged(this->sbm_textureThreshold);
     623}
     624
     625
     626////////////////////////////////////////////////////////////////////////////////
     627void DisparityMap::setUniquenessRatio(int uniquenessRatio)
     628{
     629        this->sbm_uniquenessRatio = uniquenessRatio;
     630
     631        emit uniquenessRatioChanged(this->sbm_uniquenessRatio);
     632}
     633
     634
    579635////////////////////////////////////////////////////////////////////////////////
    580636///     CalcDisparityMap
     
    640696                        Right_img_gray = Right_img_exp;
    641697                }
     698
     699                /*cv::namedWindow("Disparity trackbar", CV_WINDOW_NORMAL);
     700                cv::createTrackbar("sbm_preFilterCap", "Disparity trackbar", &sbm_preFilterCap, 63);
     701                cv::createTrackbar("sbm_preFilterSize", "Disparity trackbar", &sbm_preFilterSize, 250);
     702                cv::createTrackbar("sbm_SADWindowSize", "Disparity trackbar", &sbm_SADWindowSize, 250);
     703                cv::createTrackbar("min_disp", "Disparity trackbar", &min_disp, 250);
     704                cv::createTrackbar("num_disp", "Disparity trackbar", &num_disp, 250);
     705                cv::createTrackbar("sbm_textureThreshold", "Disparity trackbar", &sbm_textureThreshold, 250);
     706                cv::createTrackbar("sbm_uniquenessRatio", "Disparity trackbar", &sbm_uniquenessRatio, 250);
     707                cv::createTrackbar("sbm_speckleWindowSize", "Disparity trackbar", &sbm_speckleWindowSize, 250);
     708                cv::createTrackbar("sbm_speckleRange", "Disparity trackbar", &sbm_speckleRange, 250);
     709                this->sbm_SADWindowSize = (this->sbm_SADWindowSize % 2 > 0) ? this->sbm_SADWindowSize : this->sbm_SADWindowSize + 1;
     710                this->num_disp = (this->num_disp % 16 == 0) ? this->num_disp : this->num_disp - (this->num_disp % 16);*/
    642711
    643712                // Configuration
     
    666735                                                                                                                                        // the parameter to a positive value, it will be implicitly multiplied by 16. Normally, 1 or 2 is
    667736                                                                                                                                        // good enough.
    668                
     737
    669738                // Calculate the disparity image (16S = scaled by 16, must be divided by 16; 32F = original value)
    670739                sbm(Left_img_gray, Right_img_gray, Disp_map_exp, CV_16S);
     
    701770                sgbm.disp12MaxDiff = this->sgbm_disp12MaxDiff;                          // Maximum allowed difference (in integer pixel units) in the left-right disparity check. Set it to
    702771                                                                                                                                        // a non-positive value to disable the check.
    703                 sgbm.fullDP = type == SGBM;                                                     // Set it to true to run the full-scale two-pass dynamic programming algorithm.
     772                sgbm.fullDP = type == SGBM;                                                                     // Set it to true to run the full-scale two-pass dynamic programming algorithm.
    704773                                                                                                                                        // It will consume O(W*H*numDisparities) bytes, which is large for 640x480 stereo
    705774                                                                                                                                        // and huge for HD-size pictures.
Note: See TracChangeset for help on using the changeset viewer.