Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add GenericGraphicalCode, remove QRCodeDetectorBase
- Loading branch information
1 parent
af03e00
commit 2e4145d
Showing
6 changed files
with
121 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
modules/objdetect/include/opencv2/objdetect/generic_graphical_code.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// This file is part of OpenCV project. | ||
// It is subject to the license terms in the LICENSE file found in the top-level directory | ||
// of this distribution and at http://opencv.org/license.html | ||
#ifndef OPENCV_OBJDETECT_GENERIC_GRAPHICAL_CODE_HPP | ||
#define OPENCV_OBJDETECT_GENERIC_GRAPHICAL_CODE_HPP | ||
|
||
#include <opencv2/core.hpp> | ||
|
||
namespace cv { | ||
|
||
//! @addtogroup objdetect_common | ||
//! @{ | ||
|
||
class CV_EXPORTS_W_SIMPLE GenericGraphicalCode { | ||
public: | ||
CV_DEPRECATED_EXTERNAL // avoid using in C++ code, will be moved to "protected" (need to fix bindings first) | ||
GenericGraphicalCode(); | ||
|
||
GenericGraphicalCode(const GenericGraphicalCode&) = default; | ||
GenericGraphicalCode(GenericGraphicalCode&&) = default; | ||
GenericGraphicalCode& operator=(const GenericGraphicalCode&) = default; | ||
GenericGraphicalCode& operator=(GenericGraphicalCode&&) = default; | ||
|
||
/** @brief Detects graphical code in image and returns the quadrangle containing the code. | ||
@param img grayscale or color (BGR) image containing (or not) graphical code. | ||
@param points Output vector of vertices of the minimum-area quadrangle containing the code. | ||
*/ | ||
CV_WRAP bool detect(InputArray img, OutputArray points) const; | ||
|
||
/** @brief Decodes graphical code in image once it's found by the detect() method. | ||
Returns UTF8-encoded output string or empty string if the code cannot be decoded. | ||
@param img grayscale or color (BGR) image containing graphical code. | ||
@param points Quadrangle vertices found by detect() method (or some other algorithm). | ||
@param straight_code The optional output image containing binarized code, will be empty if not found. | ||
*/ | ||
CV_WRAP std::string decode(InputArray img, InputArray points, OutputArray straight_qrcode = noArray()) const; | ||
|
||
/** @brief Both detects and decodes graphical code | ||
@param img grayscale or color (BGR) image containing graphical code. | ||
@param points optional output array of vertices of the found graphical code quadrangle, will be empty if not found. | ||
@param straight_code The optional output image containing binarized code | ||
*/ | ||
CV_WRAP std::string detectAndDecode(InputArray img, OutputArray points = noArray(), | ||
OutputArray straight_qrcode = noArray()) const; | ||
|
||
|
||
/** @brief Detects graphical codes in image and returns the vector of the quadrangles containing the codes. | ||
@param img grayscale or color (BGR) image containing (or not) graphical codes. | ||
@param points Output vector of vector of vertices of the minimum-area quadrangle containing the codes. | ||
*/ | ||
CV_WRAP bool detectMulti(InputArray img, OutputArray points) const; | ||
|
||
/** @brief Decodes graphical codes in image once it's found by the detect() method. | ||
@param img grayscale or color (BGR) image containing graphical codes. | ||
@param decoded_info UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded. | ||
@param points vector of Quadrangle vertices found by detect() method (or some other algorithm). | ||
@param straight_code The optional output vector of images containing binarized codes | ||
*/ | ||
CV_WRAP bool decodeMulti(InputArray img, InputArray points, CV_OUT std::vector<std::string>& decoded_info, | ||
OutputArrayOfArrays straight_qrcode = noArray()) const; | ||
|
||
/** @brief Both detects and decodes graphical codes | ||
@param img grayscale or color (BGR) image containing graphical codes. | ||
@param decoded_info UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded. | ||
@param points optional output vector of vertices of the found graphical code quadrangles. Will be empty if not found. | ||
@param straight_code The optional vector of images containing binarized codes | ||
*/ | ||
CV_WRAP bool detectAndDecodeMulti(InputArray img, CV_OUT std::vector<std::string>& decoded_info, OutputArray points = noArray(), | ||
OutputArrayOfArrays straight_qrcode = noArray()) const; | ||
struct Impl; | ||
protected: | ||
Ptr<Impl> p; | ||
}; | ||
|
||
struct GenericGraphicalCode::Impl { | ||
virtual ~Impl() {} | ||
virtual bool detect(InputArray img, OutputArray points) const = 0; | ||
virtual std::string decode(InputArray img, InputArray points, OutputArray straight_qrcode) const = 0; | ||
virtual std::string detectAndDecode(InputArray img, OutputArray points, OutputArray straight_qrcode) const = 0; | ||
virtual bool detectMulti(InputArray img, OutputArray points) const = 0; | ||
virtual bool decodeMulti(InputArray img, InputArray points, std::vector<std::string>& decoded_info, | ||
OutputArrayOfArrays straight_code) const = 0; | ||
virtual bool detectAndDecodeMulti(InputArray img, std::vector<std::string>& decoded_info, | ||
OutputArray points, OutputArrayOfArrays straight_code) const = 0; | ||
}; | ||
|
||
//! @} | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters