ImageTest.h 368 B

1234567891011121314151617
  1. #ifndef IMAGE_TEST_H
  2. #define IMAGE_TEST_H
  3. #include <opencv4/opencv2/opencv.hpp>
  4. #include <string>
  5. namespace ImageTest
  6. {
  7. void saveImageFromData(unsigned char *data, int width, int height, const std::string &filename = "./output.png")
  8. {
  9. cv::Mat image(height, width, CV_8UC3, data);
  10. cv::imwrite(filename, image);
  11. }
  12. }
  13. #endif // IMAGE_TEST_H