JPG/PNG压缩前先纵向翻转图片
This commit is contained in:
parent
5524999d51
commit
bf939b8c96
|
@ -99,9 +99,12 @@ std::shared_ptr<std::vector<uchar>> img_encoder::encode(LPPACKIMAGE head, cv::Ma
|
|||
}
|
||||
else
|
||||
{
|
||||
cv::Mat out;
|
||||
|
||||
cv::flip(mat, out, 0);
|
||||
ptr.reset(new std::vector<uchar>());
|
||||
head->format = fmt_ == ".jpg" ? IMG_FMT_JPEG : IMG_FMT_PNG;
|
||||
cv::imencode(fmt_.c_str(), mat, *ptr, param_);
|
||||
cv::imencode(fmt_.c_str(), out, *ptr, param_);
|
||||
head->prc_time = watch.elapse_ms();
|
||||
printf("encode to '%s' in %ums: %u\n", fmt_.c_str(), head->prc_time, ptr->size());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue