Class WeChatQRCode
- Namespace
- OpenCvSharp
- Assembly
- OpenCvSharp.dll
WeChat QRCode includes two CNN-based models: A object detection model and a super resolution model. Object detection model is applied to detect QRCode with the bounding box. super resolution model is applied to zoom in QRCode when it is small.
public class WeChatQRCode : CvObject, IDisposable
- Inheritance
-
WeChatQRCode
- Implements
- Inherited Members
Constructors
WeChatQRCode(string, string, string, string)
Initialize the WeChatQRCode. It includes two models, which are packaged with caffe format. Therefore, there are prototxt and caffe models (In total, four paramenters). Pass empty strings to create a detector without neural network models.
public WeChatQRCode(string detectorPrototxtPath = "", string detectorCaffeModelPath = "", string superResolutionPrototxtPath = "", string superResolutionCaffeModelPath = "")
Parameters
detectorPrototxtPathstringprototxt file path for the detector
detectorCaffeModelPathstringcaffe model file path for the detector
superResolutionPrototxtPathstringprototxt file path for the super resolution model
superResolutionCaffeModelPathstringcaffe file path for the super resolution model
Methods
DetectAndDecode(InputArray, out Point2f[][])
Both detects and decodes QR code. To simplify the usage, there is a only API: detectAndDecode
public string[] DetectAndDecode(InputArray inputImage, out Point2f[][] points)
Parameters
inputImageInputArraysupports grayscale or color(BGR) image.
pointsPoint2f[][]output array of vertices of the found QR code quadrangles. Each element is an array of 4 Point2f representing the corners of one detected QR code. Will be empty if not found.
Returns
- string[]
list of decoded string.
DetectAndDecodeRaw(InputArray, out Mat[])
Both detects and decodes QR code. Returns each QR code's corner points as a raw Mat (4x2, CV_32FC1), which can be passed directly to other OpenCV functions.
public string[] DetectAndDecodeRaw(InputArray inputImage, out Mat[] bbox)
Parameters
inputImageInputArraysupports grayscale or color(BGR) image.
bboxMat[]output array of vertices of the found QR code quadrangles as raw Mat (4x2, CV_32FC1). Will be empty if not found.
Returns
- string[]
list of decoded string.