Changeset 68 in pacpussensors for trunk/StereoVisionDisparity


Ignore:
Timestamp:
10/08/14 15:02:31 (10 years ago)
Author:
phudelai
Message:

New function

Location:
trunk/StereoVisionDisparity
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/StereoVisionDisparity/ObstacleDetectionComponent.cpp

    r64 r68  
    273273        if (config.getProperty("cam_channels") != QString::null)
    274274                this->cam_channels = config.getProperty("cam_channels").toInt();
     275
     276        if (config.getProperty("cam_ref_cx") != QString::null)
     277                this->cam_ref_cx = config.getProperty("cam_ref_cx").toDouble(); // cx camera divide by x image size
     278
     279        if (config.getProperty("cam_ref_cy") != QString::null)
     280                this->cam_ref_cy = config.getProperty("cam_ref_cy").toDouble(); // cy camera divide by y image size
     281
     282        if (config.getProperty("cam_ref_fx") != QString::null)
     283                this->cam_ref_fx = config.getProperty("cam_ref_fx").toDouble(); // fx camera divide by x image size
     284
     285        if (config.getProperty("cam_ref_fy") != QString::null)
     286                this->cam_ref_fy = config.getProperty("cam_ref_fy").toDouble(); // fy camera divide by y image size
     287
     288        if (config.getProperty("cam_baseline") != QString::null)
     289                this->cam_baseline = config.getProperty("cam_baseline").toDouble(); // distance between two cameras in meter
    275290
    276291        if (config.getProperty("min_disp") != QString::null)
     
    631646x,y,z = world coordinates
    632647disparity = disparity value
    633 
     648*/
    634649bool ObstacleDetectionComponent::PointTriangulate(int row, int col, double &x, double &y, double &z, double disparity)
    635650{
    636                 bool valid_point = false;
    637 
    638651        if(disparity > 0.0 && disparity < 255.0)
    639652        {
    640                 z = this->cam_width * this->cam_fx * this->cam_baseline / disparity;
    641                 double u = col / (this->cam_width - 1.0) - this->cam_cx;
    642                 double v = row / (this->cam_height - 1.0) - this->cam_cy;
    643 
    644                 x = u * z / this->cam_fx;
    645 
    646                 y = v * z / this->cam_fy;
    647 
    648                 valid_point = true;
    649         }
    650 
    651         return valid_point;
    652 }*/
     653                z = this->cam_width * this->cam_ref_fx * this->cam_baseline / disparity;
     654                double u = col / (this->cam_width - 1) - this->cam_ref_cx;
     655                double v = row / (this->cam_height - 1) - this->cam_ref_cy;
     656
     657                x = u * z / this->cam_ref_fx;
     658                y = v * z / this->cam_ref_fy;
     659
     660                return true;
     661        }
     662
     663        return false;
     664}//*/
    653665
    654666
  • trunk/StereoVisionDisparity/ObstacleDetectionComponent.h

    r64 r68  
    7474        double cam_ref_fx;              // fx camera divide by x image size
    7575        double cam_ref_fy;              // fy camera divide by y image size
     76        double cam_baseline;    // distance between two cameras in meter
    7677        bool showdebug;                 // Show frame acquired
    7778        int min_disp;                   // Minimum disparity value to detect obstacles in the u/v-disp map
     
    194195        A CalcMedian(std::vector<A> vetor) const;
    195196
    196         //bool PointTriangulate(int row, int col, double &x, double &y, double &z, double disparity);
     197        bool PointTriangulate(int row, int col, double &x, double &y, double &z, double disparity);
    197198};
    198199
Note: See TracChangeset for help on using the changeset viewer.