lamiastella

PMDCamera.hpp

Jun 9th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.23 KB | None | 0 0
  1. #pragma once
  2. // C++ Libraries
  3. #include<string.h>
  4.  
  5. // PMD Libraries
  6. #include <pmdsdk2.h>
  7.  
  8. // OpenCV Libraries
  9. #include <opencv/cxcore.h>
  10. #include <opencv/highgui.h>
  11. #include "opencv2/highgui/highgui.hpp"
  12. #include <opencv2/video/tracking.hpp>
  13. #include "opencv2/imgproc/imgproc.hpp"
  14. #include <opencv2/objdetect/objdetect.hpp>
  15. #include <opencv2/features2d/features2d.hpp>
  16.  
  17. // OpenARK Libraries
  18. #include "DepthCamera.h"
  19.  
  20. /**
  21. * Class defining the behavior of a PMD Camera.
  22. * Example on how to read from sensor and visualize its output
  23. * @include SensorIO.cpp
  24. */
  25. class PMDCamera : public DepthCamera
  26. {
  27. public:
  28.     /**
  29.     * Public constructor initializing the PMD Camera.
  30.     * @param use_live_sensor uses input from real sensor if TRUE. Otherwise reads from input file. Default is set to TRUE.
  31.     */
  32.     PMDCamera(bool use_live_sensor = true);
  33.  
  34.     /**
  35.     * Deconstructor for the PMD Camera.
  36.     */
  37.     ~PMDCamera();
  38.  
  39.     /**
  40.     * Gets new frame from sensor.
  41.     * Updates xyzMap, ampMap, and flagMap. Resets clusters.
  42.     */
  43.     void update();
  44.  
  45.     /**
  46.     * Gracefully closes the PMD camera.
  47.     */
  48.     void destroyInstance();
  49.  
  50. private:
  51.     /**
  52.     * Getter method for the x-coordinate at (i,j).
  53.     * @param i ith row
  54.     * @param j jth column
  55.     * @return x-coodinate at (i,j)
  56.     */
  57.     float getX(int i, int j) const;
  58.  
  59.     /**
  60.     * Getter method for the x-coordinate at (i,j).
  61.     * @param i ith row
  62.     * @param j jth column
  63.     * @return x-coodinate at (i,j)
  64.     */
  65.     float getY(int i, int j) const;
  66.  
  67.     /**
  68.     * Getter method for the x-coordinate at (i,j).
  69.     * @param i ith row
  70.     * @param j jth column
  71.     * @return x-coodinate at (i,j)
  72.     */
  73.     float getZ(int i, int j) const;
  74.  
  75.     /**
  76.     * Update the z-coordinates of the xyzMap.
  77.     */
  78.     void fillInZCoords();
  79.  
  80.     /**
  81.     * Update the values in the ampMap.
  82.     */
  83.     void fillInAmps();
  84.  
  85.     //Private Variable
  86.     const char* SOURCE_PLUGIN = "camboardpico";
  87.     const char* SOURCE_PARAM = "";
  88.     const char* PROC_PLUGIN = "camboardpicoproc";
  89.     const char* PROC_PARAM = "";
  90.  
  91.     PMDHandle hnd;
  92.     PMDDataDescription dd;
  93.     char err[128]; // Char array for storing PMD's error log
  94.  
  95.     int numPixels;
  96.     float* dists;
  97.     float* amps;
  98.  
  99.     cv::Mat frame;
  100.     cv::KalmanFilter KF;
  101.     cv::Mat_<float> measurement;
  102. };
  103.  
  104. /*
  105. * \include SensorIO.cpp
  106. * Example of how to read from sensor
  107. */
Add Comment
Please, Sign In to add comment