Changeset 68 in pacpussensors for trunk/StereoVisionDisparity/ObstacleDetectionComponent.cpp
- Timestamp:
- Oct 8, 2014, 3:02:31 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/StereoVisionDisparity/ObstacleDetectionComponent.cpp
r64 r68 273 273 if (config.getProperty("cam_channels") != QString::null) 274 274 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 275 290 276 291 if (config.getProperty("min_disp") != QString::null) … … 631 646 x,y,z = world coordinates 632 647 disparity = disparity value 633 648 */ 634 649 bool ObstacleDetectionComponent::PointTriangulate(int row, int col, double &x, double &y, double &z, double disparity) 635 650 { 636 bool valid_point = false;637 638 651 if(disparity > 0.0 && disparity < 255.0) 639 652 { 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 }//*/ 653 665 654 666
Note:
See TracChangeset
for help on using the changeset viewer.