You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.3 KiB
73 lines
2.3 KiB
/*
|
|
* @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 <stdio.h>
|
|
#include <string.h>
|
|
#include <thread>
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <vector>
|
|
#include <string>
|
|
#include <filesystem>
|
|
#include <thread>
|
|
#include <mutex>
|
|
#include <future>
|
|
#include <opencv2/opencv.hpp>
|
|
|
|
#include "ExtractBase.h"
|
|
#include <filesystem>
|
|
|
|
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<JPGImgDataPtr> &ptrImgdataList);
|
|
int DecodeJpgImg(std::vector<JPGImgDataPtr> &ptrImgdataList, cv::Mat &outImg);
|
|
|
|
private:
|
|
};
|
|
|
|
#endif |