cv::circle(inOutImg, cv::Point(rect.x + 3 * gapW, rect.y + 3 * gapH), gapW, color, -1);
}
-static int __draw_logo(cv::Mat &image, const BarcodeConfig &config)
+/*
+ * Use only for mv_barcode_generate_image because,
+ * QR code size is maximum 177x177, then logo will be (35x35).
+ * mv_barcode_generate_image support user-defined resize, so user can set size detail.
+ */
+static void __draw_logo(cv::Mat &image, const BarcodeConfig &config)
{
+ if (config.logo_path.empty() || config.type != MV_BARCODE_QR)
+ return;
+
auto logo = cv::imread(config.logo_path.c_str(), cv::IMREAD_COLOR);
int color_decimal = strtol(config.bgcolor.c_str(), nullptr, 16);
cv::multiply(cv::Scalar::all(1.0) - maskMat, image, image);
cv::multiply(maskMat / 255, logoMat, logoMat);
cv::add(logoMat, image, image);
-
- return MEDIA_VISION_ERROR_NONE;
}
int write_buffer_to_img(zint_symbol *symbol, const BarcodeConfig &config)
cv::Mat image(symbol->bitmap_height, symbol->bitmap_width, CV_8UC3, symbol->bitmap);
cv::resize(image, image, cv::Size(config.image_width, config.image_height), 0, 0, cv::INTER_AREA);
-
- if (!config.logo_path.empty()) {
- error = __draw_logo(image, config);
- if (error != MEDIA_VISION_ERROR_NONE) {
- LOGE("__draw_logo error code : %d", error);
- return error;
- }
- }
+ __draw_logo(image, config);
error = cv::imwrite(resultFilePath, image, compressionParams) ? BARCODE_ERROR_NONE : BARCODE_ERROR_INVALID_DATA;