/* * @Author: xiewenji 527774126@qq.com * @Date: 2025-09-11 15:33:10 * @LastEditors: xiewenji 527774126@qq.com * @LastEditTime: 2025-09-13 17:07:23 * @FilePath: /BOE_CELL_AOI_Detect/ExtractImageModule/include/ExtractInstance.h * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ #ifndef ExtractInstance_H_ #define ExtractInstance_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include "ExtractBase.h" #include using namespace std; namespace fs = std::filesystem; // jpg 图片的内存指针 struct JPGImgDataPtr { unsigned char *buffer = nullptr; size_t imgDataSize = 0; unsigned char *ptr_start = nullptr; unsigned char *ptr_end = nullptr; cv::Mat decodedImg; int width = 0; int height = 0; void printInfo(const std::string &name = "") const { std::cout << "=== JPGImgDataPtr " << name << " ===" << std::endl; std::cout << " imgDataSize: " << imgDataSize << " bytes" << std::endl; std::cout << " buffer: " << (buffer ? "OK" : "NULL") << std::endl; std::cout << " buffer: " << (void *)buffer << std::endl; std::cout << " ptr_start: " << (void *)ptr_start << " ptr_end: " << (void *)ptr_end << std::endl; } }; class ExtractInstance : public ExtractBase { public: ExtractInstance(); ~ExtractInstance(); int ReadCELLImg(std::string strimgPath, cv::Mat &outImg, bool bdecode); // 返回检测版本信息 std::string GetVersion(); // 返回错误信息 std::string GetErrorInfo(); private: long getcurTime(); bool decode_Img(const std::string &file_path, cv::Mat &img); // 读取图片的内存地址 int ReadImgData(const std::string &file_path, unsigned char *&buffer, size_t *fileSize); int CalAllImgPtrDate(unsigned char *buffer, size_t fileSize, std::vector &ptrImgdataList); int DecodeJpgImg(std::vector &ptrImgdataList, cv::Mat &outImg); private: }; #endif