stereo-example.txt
上传用户:fengshi120
上传日期:2014-07-17
资源大小:6155k
文件大小:1k
源码类别:

3D图形编程

开发平台:

C/C++

  1. #include "estereo.h"
  2. StereoMatching* stereo = new StereoMatching();
  3. stereo->setImageSize(320,240);
  4. stereo->setHoropter(0);
  5. stereo->setNumDepth(32);
  6. stereo->initializeContext();
  7. stereo->setCorrelationWindowSize(9,9);
  8. stereo->setUndefinedDepthValue(0);
  9. stereo->setAcceptDisparityThreshold(5);
  10. stereo->setCameraParameters(focallength,baseline,u0,v0);
  11. int stereo_grow_ScoreValidation = 20;
  12. int stereo_grow_nb_passes = 3;
  13. // 8-bits B&W images 
  14. uchar *leftImage, *rightImage, *topImage;
  15. do {
  16. // grab images 
  17. .....
  18. // do stereo
  19. stereo->doStereo(leftImage, rightImage, topImage);
  20. // improve stereo (optional)  
  21. stereo->doStereo_grow(1, stereo_grow_ScoreValidation,  stereo_grow_nb_passes);
  22. // do 3-D reconstruction (uses sub-pixel disparity) 
  23. stereo->doReconstruction();
  24. // use getDisparityImage() to access 8-bits disparity image
  25. // use getXlist(), getYlist() and getZlist() and getNumPoints() to get 3-D reconstructions
  26. } while (...)