static void drawLogo(cv::Mat &image, const BarcodeConfig &config)
{
+ MEDIA_VISION_FUNCTION_ENTER();
if (config.logo_path.empty() || config.type != MV_BARCODE_QR)
return;
cv::multiply(cv::Scalar::all(1.0) - maskMat, image, image);
cv::multiply(maskMat / 255, logoMat, logoMat);
cv::add(logoMat, image, image);
+ MEDIA_VISION_FUNCTION_LEAVE();
}
static int write_buffer_to_img(const cv::Mat &buf, const BarcodeConfig &config)
{
+ MEDIA_VISION_FUNCTION_ENTER();
std::string imageFileName = config.image_path;
/* find directory */
std::string prefix_imageFileName = imageFileName.substr(0, imageFileName.find_last_of('/'));
LOGE("Write barcode image to file %s operation failed.", resultFilePath.c_str());
return error;
}
-
+ MEDIA_VISION_FUNCTION_LEAVE();
return error;
}
static void drawFinderPattern(cv::Mat &resize_buf, int resize_scale, int org_height, int org_width,
mv_barcode_generate_attr_shape_e shape)
{
+ MEDIA_VISION_FUNCTION_ENTER();
int posx[3] = { 2, org_width - 16, 2 };
int posy[3] = { 2, 2, org_height - 16 };
for (int pos = 0; pos < 3; pos++) {
}
}
}
+ MEDIA_VISION_FUNCTION_LEAVE();
}
static inline float l2_distance(int x1, int y1, int x2, int y2)
static void drawDataPattern(cv::Mat &resize_buf, const cv::Mat &buf, int resize_scale, int org_height, int org_width,
const BarcodeConfig &config)
{
+ MEDIA_VISION_FUNCTION_ENTER();
for (int y = 2; y < org_height - 2; y += 2) {
for (int x = 2; x < org_width - 2; x += 2) {
if (is_finder(x, y, org_width, org_height) || buf.at<unsigned char>(y, x, 0) == 255)
resize_scale - resize_scale / 4, cv::Scalar(0), -1);
}
}
+ MEDIA_VISION_FUNCTION_LEAVE();
}
static void drawDesignQR(cv::Mat &buf, const BarcodeConfig &config)
{
+ MEDIA_VISION_FUNCTION_ENTER();
if (config.type != MV_BARCODE_QR || ((config.data_shape == MV_BARCODE_GENERATE_ATTR_SHAPE_RECT &&
config.finder_shape == MV_BARCODE_GENERATE_ATTR_SHAPE_RECT) &&
config.logo_path.empty()))
drawDataPattern(resize_buf, buf, resize_scale, buf.rows, buf.cols, config);
cv::cvtColor(resize_buf, buf, cv::COLOR_GRAY2BGR);
+ MEDIA_VISION_FUNCTION_LEAVE();
}
static int symbol_to_buf(zint_symbol *symbol, const BarcodeConfig &config, cv::Mat &buf)