算法对象使用时才初始化;屏蔽部分可局部化或未用的全局算法对象

This commit is contained in:
gb 2023-08-11 16:31:29 +08:00
parent 8fda1b6d53
commit e6a51ba329
3 changed files with 14 additions and 10 deletions

View File

@ -152,7 +152,6 @@ cv::Scalar CImageApplyAutoCrop::getBackGroudColor(const cv::Mat& image, int thre
}
}
CImageApplyDispersion m_dispersion_apply;
void CImageApplyAutoCrop::autoCrop_desaskew_fillBlank(cv::Mat& src, cv::Mat& dst, bool isAutoCrop, bool isDesaskew, bool isFillBlank, int dWidth, int dHeight,
bool isConvex, bool isColorBlank, double threshold, int noise, int indent, bool isNormalCrop, bool dispersion, double fx, double fy)
{
@ -217,6 +216,7 @@ void CImageApplyAutoCrop::autoCrop_desaskew_fillBlank(cv::Mat& src, cv::Mat& dst
if (dispersion)
{
CImageApplyDispersion m_dispersion_apply;
cv::Mat mat_dispersion = src(cv::boundingRect(maxContour));
m_dispersion_apply.apply(mat_dispersion, 0);
}

View File

@ -1,8 +1,8 @@
#include "ImageApplyColorRecognition.h"
#include "ImageApplyHeaders.h"
static CImageApplyBWBinaray m_bw;
static CImageApplyAdjustColors m_ac(0, 50, 1.0f);
//static CImageApplyBWBinaray m_bw;
//static CImageApplyAdjustColors m_ac(0, 50, 1.0f);
/// <summary>
/// 检测图像是否是彩色。当前逻辑仅针对红色像素进行判断,即存在红色像素则为彩色,否则为非彩色

View File

@ -234,7 +234,7 @@ hg_scanner::hg_scanner(ScannerSerial serial, const char* dev_name, usb_io* io, i
thread_devslock_handle_.reset(new std::thread(&hg_scanner::thread_devslock_handle, this));
#endif
ImagePrc_pHandle_ = hg_imgproc::init(pid_, isx86_Advan_);;
ImagePrc_pHandle_ = nullptr; // hg_imgproc::init(pid_, isx86_Advan_);;
}
hg_scanner::~hg_scanner()
{
@ -254,6 +254,7 @@ hg_scanner::~hg_scanner()
#endif
delete custom_gamma_val_;
if(ImagePrc_pHandle_)
hg_imgproc::release(ImagePrc_pHandle_);
name_.insert(0, hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_DEVS));
@ -1070,12 +1071,15 @@ void hg_scanner::thread_handle_image_process(void)
{
if (!ImagePrc_pHandle_)
{
ImagePrc_pHandle_ = hg_imgproc::init(pid_, isx86_Advan_);
if (!ImagePrc_pHandle_)
{
VLOG_MINI_1(LOG_LEVEL_FATAL, "[thread_handle_image_process]:Get Image Process is NULL pid is %d.\n", pid_);
stop_fatal_ = SCANNER_ERR_INSUFFICIENT_MEMORY;
stop();
break;
}
}
image_process(tiny_buffer, id);
}
catch (const std::exception& e)