nothing
This commit is contained in:
parent
e806adfbce
commit
e1bf64b189
|
@ -381,12 +381,10 @@ void scanner_hw::thread_image_capture(void)
|
|||
break;
|
||||
}
|
||||
img.prc_time = watch.elapse_ms();
|
||||
printf("Fetch paper %d: %ums\n", img.pos.paper_ind + 1, img.prc_time);
|
||||
mem = new dyn_mem_shared(frame, size, put_v4l2_mem, (void*)ind);
|
||||
used_v4l2_mem++;
|
||||
img.pos.paper_ind++;
|
||||
img.pos.status = IMG_STATUS_OK;
|
||||
printf("Image height: %d\n", img.height);
|
||||
img_handler_(mem, true, &img);
|
||||
mem->release();
|
||||
|
||||
|
|
|
@ -92,8 +92,8 @@ void auto_crop::init(void)
|
|||
};
|
||||
OPTION_FUNC(paper)
|
||||
{
|
||||
crop_ = strcmp((char*)val, WORDS_PAPER_ORIGIN_SIZE) == 0
|
||||
|| strcmp((char*)val, WORDS_PAPER_MAX_SIZE_CROP) == 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_));
|
||||
else
|
||||
|
@ -122,8 +122,8 @@ void auto_crop::init(void)
|
|||
int auto_crop::work(PROCIMGINFO& in, PROCIMGINFO& out)
|
||||
{
|
||||
int ret = SCANNER_ERR_OK,
|
||||
dWidth = fixed_paper_.cx,
|
||||
dHeight = fixed_paper_.cy;
|
||||
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;
|
||||
|
||||
|
@ -165,7 +165,7 @@ int auto_crop::work(PROCIMGINFO& in, PROCIMGINFO& out)
|
|||
|
||||
cv::Scalar blankColor;
|
||||
if (fill_bg_)
|
||||
if (/*isColorBlank*/1)
|
||||
if (/*isColorBlank*/0)
|
||||
{
|
||||
cv::Rect boudingRect = cv::boundingRect(maxContour);
|
||||
boudingRect.x *= FX_FY;
|
||||
|
@ -324,6 +324,7 @@ int auto_crop::process(std::vector<PROCIMGINFO>& in, std::vector<PROCIMGINFO>& o
|
|||
chronograph watch;
|
||||
|
||||
ret = work(v, o);
|
||||
|
||||
o.info = v.info;
|
||||
o.info.prc_time = watch.elapse_ms();
|
||||
o.info.prc_stage = get_position();
|
||||
|
|
|
@ -14,7 +14,7 @@ class auto_crop : public image_processor
|
|||
bool fill_bg_ = true;
|
||||
bool convex_ = true;
|
||||
bool fill_clr_ = false;
|
||||
int threshold_ = 10;
|
||||
int threshold_ = 40;
|
||||
int indent_ = 5;
|
||||
int noise_ = 8;
|
||||
SIZE fixed_paper_ = {0, 0};
|
||||
|
|
|
@ -34,6 +34,18 @@ imgproc_mgr::imgproc_mgr(std::function<void(data_source_ptr)> sender
|
|||
{
|
||||
thread_worker();
|
||||
};
|
||||
auto restart = [this](const char* thread_name) ->void
|
||||
{
|
||||
auto thrd = [this](void) -> void
|
||||
{
|
||||
thread_worker();
|
||||
};
|
||||
workers_.stop(thread_name);
|
||||
add_busy_worker(-1);
|
||||
printf("\nrestart imgproc_mgr::thread_worker\n\n");
|
||||
workers_.start(thrd, "imgproc_mgr::thread_worker", (void*)&imgproc_mgr::thread_worker);
|
||||
};
|
||||
workers_.set_exception_handler(restart);
|
||||
workers_.start(thrd, "imgproc_mgr::thread_worker", (void*)&imgproc_mgr::thread_worker);
|
||||
}
|
||||
imgproc_mgr::~imgproc_mgr()
|
||||
|
@ -158,7 +170,6 @@ void imgproc_mgr::send_image(LPPACKIMAGE head, uint8_t* data, size_t size, void*
|
|||
dyn_mem_ptr mem(dyn_mem::memory(size));
|
||||
image_packet_ptr ptr = nullptr;
|
||||
|
||||
printf("send image %d(%d-0x%04x) with size %u:\n", head->pos.paper_ind, head->pos.paper_side, head->prc_stage, size);
|
||||
mem->put(data, size);
|
||||
ptr = imgproc_mgr::image_sent_packet(head, mem, scan_id_, info, info_l);
|
||||
mem->release();
|
||||
|
|
|
@ -163,12 +163,27 @@ int image_holder::save_2_file(const char* root_dir, const char* alg)
|
|||
{
|
||||
fwrite(bfh.c_str(), 1, bfh.length(), dst);
|
||||
fwrite(bih.c_str(), 1, bih.length(), dst);
|
||||
fwrite(data() + head_.info_size, 1, head_.data_size, dst);
|
||||
if(head_.data_size == ((LPBITMAPINFOHEADER)&bih[0])->biSizeImage)
|
||||
fwrite(data() + head_.info_size, 1, head_.data_size, dst);
|
||||
else
|
||||
{
|
||||
int l = BMP_LINE_BYTES(head_.width * head_.bpp * head_.channels),
|
||||
dif = l - (head_.width * head_.bpp * head_.channels + 7) / 8;
|
||||
char pad[4] = { 0 };
|
||||
uint8_t *ptr = data() + head_.info_size;
|
||||
for (int i = 0; i < head_.height; ++i)
|
||||
{
|
||||
fwrite(ptr, 1, l - dif, dst);
|
||||
fwrite(pad, 1, dif, dst);
|
||||
ptr += l - dif;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dst)
|
||||
fclose(dst);
|
||||
utils::to_log(LOG_LEVEL_ALL, "Image-Process of file '%s' is %ums.\n", file.c_str(), head_.prc_time);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue