Changeset 68 in pacpussensors


Ignore:
Timestamp:
Oct 8, 2014, 3:02:31 PM (10 years ago)
Author:
phudelai
Message:

New function

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/CMakeLists.txt

    r67 r68  
    8585# add_subdirectory(Alasca)
    8686#add_subdirectory(CanGateway)
    87 #add_subdirectory(PtGreyCameras)
     87add_subdirectory(PtGreyCameras)
    8888# add_subdirectory(Dualshock)
    89 add_subdirectory(PacpusSocket)
     89# add_subdirectory(PacpusSocket)
    9090# add_subdirectory(Sick)
    91 #add_subdirectory(StereoVisionDisparity)
     91add_subdirectory(StereoVisionDisparity)
    9292#add_subdirectory(SensorsApplication)
    9393# add_subdirectory(StdDbtPlayerComponents)
    9494# add_subdirectory(Wifibot)
    95 add_subdirectory(Gps)
     95#add_subdirectory(Gps)
    9696#add_subdirectory(SpanCPTComponent)
    97 add_subdirectory(NMEA0183)
    98 add_subdirectory(OpencvVideo)
     97#add_subdirectory(NMEA0183)
     98#add_subdirectory(OpencvVideo)
    9999
    100100# ========================================
  • trunk/PtGreyCameras/Flea3Grabber.cpp

    r67 r68  
    168168                this->nbrCamera_ = config.getProperty("number_of_cameras").toInt();
    169169
    170         if (config.getProperty("master_indice") != QString::null)
     170        if (config.getProperty("master_indice") != QString::null) // Master camera number
    171171                this->masterCamera_ = config.getProperty("master_indice").toInt();
    172172
  • 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.