#include "imageusbtesthandler.h" #include "opencv2/opencv.hpp" #include "imgproc.h" #include "stringex.hpp" #include "memoryex.h" #include "usbimageprocqueue.h" #include "applog.h" static std::string loggername = "ImageUsbTestHandler"; ImageUsbTestHandler::ImageUsbTestHandler(std::shared_ptr images) : ImageUsbHandler(images) { } void ImageUsbTestHandler::add_image(void* data, int width, int height, int type ,int scannnum,unsigned int fpgaversion) { // results.emplace_back( // pool.enqueue([this, data, width, height, type] // { // int imtype = type ? CV_8UC3 : CV_8UC1; // int imheight = height; // int imwidth = width; // LOG_TRACE(string_format("buff one")); // auto mem = VectorMemroyPtr(new VectorMemroy()); // std::vector &imdata = mem->buf(); // if(imtype == CV_8UC3) // { // imheight /= 3; // imwidth *= 9; // } // cv::Mat mat(imheight, imwidth, type, data); // cv::imencode(".jpg", mat, imdata); // LOG_TRACE(string_format("buff size = %d \n", mem->size())); // images->push(mem); // })); }