fix add image-processor bug

This commit is contained in:
gb 2023-11-15 14:31:09 +08:00
parent 47e802669c
commit 03be4693dc
1 changed files with 12 additions and 12 deletions

View File

@ -128,9 +128,9 @@ void imgproc_mgr::dump_real(const std::vector<PROCIMGINFO>& img, const char* aft
char name[128] = { 0 };
int ind = 0;
sprintf(name, "%04x-%d-%d-%04x-%s", v.info.paper_ind, v.info.paper_side, v.info.split_ind, pos, after);
sprintf(name, "%04x-%04x-%d-%d-%s", v.info.paper_ind, pos, v.info.paper_side, v.info.split_ind, after);
while(std::find(existing.begin(), existing.end(), name) != existing.end())
sprintf(name, "%04x-%d-%d-%04x-%s(%d)", v.info.paper_ind, v.info.paper_side, v.info.split_ind, pos, after, ++ind);
sprintf(name, "%04x-%04x-%d-%d-%s(%d)", v.info.paper_ind, pos, v.info.paper_side, v.info.split_ind, after, ++ind);
existing.push_back(name);
cv::imwrite((root + name + ".jpg").c_str(), v.img);
}
@ -150,17 +150,17 @@ std::string imgproc_mgr::dump_usb_img_real(uint8_t* data, size_t bytes, HGIMGINF
else
tail = "";
sprintf(name, "%04x-usb%s%s", info->paper_ind, tail_leader, tail);
sprintf(name, "%04x-0000-0-0-usb%s%s", info->paper_ind, tail_leader, tail);
{
// check repeat ...
dst = fopen((root + name + ".jpg").c_str(), "rb");
while (dst)
{
fclose(dst);
sprintf(name, "%04x-usb%s%s(%d)", info->paper_ind, tail_leader, tail, ++ind);
dst = fopen((root + name + ".jpg").c_str(), "rb");
}
//dst = fopen((root + name + ".jpg").c_str(), "rb");
//while (dst)
//{
// fclose(dst);
// sprintf(name, "%04x-0000-0-0-usb%s%s(%d)", info->paper_ind, tail_leader, tail, ++ind);
// dst = fopen((root + name + ".jpg").c_str(), "rb");
//}
}
dst = fopen((root + name + ".jpg").c_str(), "wb");
@ -312,7 +312,7 @@ int imgproc_mgr::load_processor(const char* path)
{ \
cls *obj = new cls(); \
opts_->add(obj); \
obj->release(); \
processors_.push_back(obj); \
}
ADD_IMG_PROCESSOR(hole_filler);
@ -334,7 +334,7 @@ int imgproc_mgr::clear(void)
int imgproc_mgr::process(HGIMGINFO* info, uint8_t* data, size_t bytes, std::vector<PROCIMGINFO>& out)
{
std::vector<PROCIMGINFO> mid[2], in, *src = &in, * dst = &mid[0];
int ret = decode(info, data, bytes, in), sn = 0;
int ret = decode(info, data, bytes, in), sn = 0, ind = 0;
if (ret == SCANNER_ERR_OK)
{