1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Merge pull request #29227 from omrope79:object_detect_changes

Update BarcodeDetector super-resolution API to use single-file ONNX #29227

### Pull Request Readiness Checklist

This PR updates the `BarcodeDetector` super-resolution API to support and utilize a single-file ONNX model format. 

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
omrope79
2026-06-05 10:30:41 +05:30
committed by GitHub
parent 35ac66291f
commit ada32973b4
5 changed files with 48 additions and 22 deletions
@@ -18,16 +18,22 @@ namespace barcode {
class CV_EXPORTS_W_SIMPLE BarcodeDetector : public cv::GraphicalCodeDetector
{
public:
/** @brief Initialize the BarcodeDetector.
/** @brief Initialize the BarcodeDetector. Super resolution is disabled.
*/
CV_WRAP BarcodeDetector();
/** @brief Initialize the BarcodeDetector.
/** @brief Initialize the BarcodeDetector with a Super Resolution model.
*
* Parameters allow to load _optional_ Super Resolution DNN model for better quality.
* @param prototxt_path prototxt file path for the super resolution model
* @param model_path model file path for the super resolution model
* Loads a Super Resolution DNN model in ONNX format, used to upscale small/low-quality
* barcode crops before decoding for better quality.
*
* @note Caffe models (`sr.prototxt` / `sr.caffemodel`) are no longer supported; convert
* the model to ONNX (a converted `sr.onnx` is available from
* https://github.com/WeChatCV/opencv_3rdparty/tree/wechat_qrcode).
*
* @param super_resolution_model_path path to a single-file ONNX Super Resolution model.
*/
CV_WRAP BarcodeDetector(CV_WRAP_FILE_PATH const std::string &prototxt_path, CV_WRAP_FILE_PATH const std::string &model_path);
CV_WRAP BarcodeDetector(CV_WRAP_FILE_PATH const std::string &super_resolution_model_path);
~BarcodeDetector();
/** @brief Decodes barcode in image once it's found by the detect() method.