videocapture_realsense.cpp 738 B

123456789101112131415161718192021222324252627282930313233
  1. #include "opencv2/videoio.hpp"
  2. #include "opencv2/highgui.hpp"
  3. #include "opencv2/imgproc.hpp"
  4. using namespace cv;
  5. using namespace std;
  6. int main()
  7. {
  8. VideoCapture capture(CAP_INTELPERC);
  9. for(;;)
  10. {
  11. Mat depthMap;
  12. Mat image;
  13. Mat irImage;
  14. Mat adjMap;
  15. capture.grab();
  16. capture.retrieve(depthMap,CAP_INTELPERC_DEPTH_MAP);
  17. capture.retrieve(image,CAP_INTELPERC_IMAGE);
  18. capture.retrieve(irImage,CAP_INTELPERC_IR_MAP);
  19. normalize(depthMap, adjMap, 0, 255, NORM_MINMAX, CV_8UC1);
  20. applyColorMap(adjMap, adjMap, COLORMAP_JET);
  21. imshow("RGB", image);
  22. imshow("IR", irImage);
  23. imshow("DEPTH", adjMap);
  24. if( waitKey( 30 ) >= 0 )
  25. break;
  26. }
  27. return 0;
  28. }