Alex Perry | e9775c3 | 2019-03-09 10:48:57 -0800 | [diff] [blame^] | 1 | #ifndef _Y2019_VISION_IMAGE_WRITER_H_ |
| 2 | #define _Y2019_VISION_IMAGE_WRITER_H_ |
| 3 | |
| 4 | #include <string> |
| 5 | |
| 6 | #include "aos/logging/logging.h" |
| 7 | #include "aos/vision/image/image_types.h" |
| 8 | |
| 9 | namespace y2019 { |
| 10 | namespace vision { |
| 11 | |
| 12 | class ImageWriter { |
| 13 | public: |
| 14 | ImageWriter() { |
| 15 | LOG(INFO, "Initializing image writer\n"); |
| 16 | SetDirPath(); |
| 17 | } |
| 18 | |
| 19 | // This is destructive to data. |
| 20 | void ProcessImage(::aos::vision::DataRef data, size_t num_targets); |
| 21 | private: |
| 22 | void SetDirPath(); |
| 23 | |
| 24 | void WriteImage(::aos::vision::DataRef data); |
| 25 | |
| 26 | std::string file_prefix_ = std::string("debug_viewer_jpeg_"); |
| 27 | std::string dir_path_; |
| 28 | |
| 29 | size_t previous_num_targets_ = 0; |
| 30 | char previous_image_[640 * 480 * 2]; |
| 31 | |
| 32 | unsigned int image_count_ = 0; |
| 33 | unsigned int debounce_count_ = 0; |
| 34 | }; |
| 35 | |
| 36 | } // namespace vision |
| 37 | } // namespace y2017 |
| 38 | |
| 39 | #endif // _Y2019_VISION_IMAGE_WRITER_H_ |