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:
@@ -339,22 +339,21 @@ bool BarcodeImpl::detectAndDecodeMulti(InputArray img, vector<string> &decoded_i
|
||||
// Public class implementation
|
||||
|
||||
BarcodeDetector::BarcodeDetector()
|
||||
: BarcodeDetector(string(), string())
|
||||
: BarcodeDetector(std::string())
|
||||
{
|
||||
}
|
||||
|
||||
BarcodeDetector::BarcodeDetector(const string &prototxt_path, const string &model_path)
|
||||
BarcodeDetector::BarcodeDetector(const string &super_resolution_model_path)
|
||||
{
|
||||
Ptr<BarcodeImpl> p_ = new BarcodeImpl();
|
||||
p = p_;
|
||||
p_->sr = make_shared<SuperScale>();
|
||||
// The Super Resolution model is now a single-file ONNX network; the legacy Caffe
|
||||
// prototxt argument is retained for API compatibility but is no longer used.
|
||||
CV_UNUSED(prototxt_path);
|
||||
if (!model_path.empty())
|
||||
// The optional Super Resolution model is a single-file ONNX network (Caffe support
|
||||
// has been removed). An empty path simply disables super resolution.
|
||||
if (!super_resolution_model_path.empty())
|
||||
{
|
||||
CV_Assert(utils::fs::exists(model_path));
|
||||
int res = p_->sr->init(model_path);
|
||||
CV_Assert(utils::fs::exists(super_resolution_model_path));
|
||||
int res = p_->sr->init(super_resolution_model_path);
|
||||
CV_Assert(res == 0);
|
||||
p_->use_nn_sr = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user