修复颜色校正及裁切算法BUG
This commit is contained in:
parent
ef6c6a0186
commit
9d9c29aa7d
|
@ -4,6 +4,7 @@
|
|||
#include <opencv2/core/core_c.h>
|
||||
#include <opencv2/core/types_c.h>
|
||||
#include <opencv2/imgproc/imgproc_c.h>
|
||||
#include <base/utils.h>
|
||||
|
||||
static cv::Mat lutGrayMat; //灰色校正值
|
||||
static cv::Mat lutColorMat; //彩色校正值
|
||||
|
@ -453,16 +454,19 @@ namespace hg
|
|||
|
||||
void initLut(const std::string lutpath,bool iscolor)
|
||||
{
|
||||
lutColorMat.release();
|
||||
lutGrayMat.release();
|
||||
|
||||
if (!lutpath.empty() && (access(lutpath.c_str(), F_OK) == 0))
|
||||
{
|
||||
printf("\n-----init lutpath =%s------------\n",lutpath.c_str());
|
||||
if(iscolor)
|
||||
{
|
||||
lutColorMat.release();
|
||||
lutColorMat = loadLUT(lutpath); //彩色校正值
|
||||
}
|
||||
else
|
||||
{
|
||||
lutGrayMat.release();
|
||||
lutGrayMat = loadLUT(lutpath); //灰色校正值
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -474,7 +478,6 @@ namespace hg
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cv::Mat image_temp(src.rows, src.cols * src.channels() / lutMat.channels(), CV_8UC(lutMat.channels()), src.data);
|
||||
|
||||
for (size_t i = 0; i < image_temp.cols; i++)
|
||||
|
|
|
@ -92,7 +92,7 @@ void auto_crop::init(void)
|
|||
};
|
||||
OPTION_FUNC(paper)
|
||||
{
|
||||
crop_ = //strcmp((char*)val, WORDS_PAPER_ORIGIN_SIZE) == 0 ||
|
||||
crop_ = strcmp((char*)val, WORDS_PAPER_ORIGIN_SIZE) == 0 ||
|
||||
strcmp((char*)val, WORDS_PAPER_MAX_SIZE_CROP) == 0;
|
||||
if(crop_)
|
||||
memset(&fixed_paper_, 0, sizeof(fixed_paper_));
|
||||
|
@ -125,9 +125,10 @@ int auto_crop::work(PROCIMGINFO& in, PROCIMGINFO& out)
|
|||
dWidth = fixed_paper_.cx * 1.0f / MM_PER_INCH * in.info.resolution_x + .5f,
|
||||
dHeight = fixed_paper_.cy * 1.0f / MM_PER_INCH * in.info.resolution_x + .5f;
|
||||
|
||||
cv::Mat thre;
|
||||
cv::Mat thre, resize;
|
||||
|
||||
hg::threshold_Mat(in.img, thre, threshold_);
|
||||
cv::resize(in.img, resize, cv::Size(), FX_FY, FX_FY, cv::INTER_NEAREST);
|
||||
hg::threshold_Mat(resize, thre, threshold_);
|
||||
|
||||
if (noise_ > 0)
|
||||
cv::morphologyEx(thre, thre, cv::MORPH_OPEN, getStructuringElement(cv::MORPH_RECT, cv::Size(cv::max(static_cast<int>(noise_ * FX_FY), 1), 1)),
|
||||
|
@ -157,6 +158,7 @@ int auto_crop::work(PROCIMGINFO& in, PROCIMGINFO& out)
|
|||
}
|
||||
|
||||
cv::RotatedRect rect = hg::getBoundingRect(maxContour);
|
||||
|
||||
if (rect.size.width < 1 || rect.size.height < 1)
|
||||
{
|
||||
out.img = in.img;
|
||||
|
|
|
@ -60,8 +60,8 @@ add_packagedirs("sdk")
|
|||
add_defines("BUILD_AS_DEVICE")
|
||||
add_defines("VER_MAIN=2")
|
||||
add_defines("VER_FAMILY=200")
|
||||
add_defines("VER_DATE=20240223")
|
||||
add_defines("VER_BUILD=12")
|
||||
add_defines("VER_DATE=20240225")
|
||||
add_defines("VER_BUILD=9")
|
||||
|
||||
target("conf")
|
||||
set_kind("phony")
|
||||
|
|
Loading…
Reference in New Issue