mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 22:44:02 +08:00
JS bindings for bar code detector.
This commit is contained in:
parent
463cd09811
commit
538b13aeec
@ -236,11 +236,6 @@ class ArgInfo(object):
|
||||
self.tp = "std::vector<cv::Mat>&"
|
||||
elif self.inputarg:
|
||||
self.tp = "const std::vector<cv::Mat>&"
|
||||
if self.tp == "vector_string":
|
||||
if self.outputarg:
|
||||
self.tp = "std::vector<std::string>&"
|
||||
elif self.inputarg:
|
||||
self.tp = "const std::vector<std::string>&"
|
||||
self.tp = handle_vector(self.tp).strip()
|
||||
if self.const:
|
||||
self.tp = "const " + self.tp
|
||||
|
@ -101,6 +101,9 @@ using namespace cv::dnn;
|
||||
typedef TrackerMIL::Params TrackerMIL_Params;
|
||||
#endif
|
||||
|
||||
// HACK: JS generator ommits namespace for parameter types for some reason. Added typedef to handle std::string correctly
|
||||
typedef std::string string;
|
||||
|
||||
namespace binding_utils
|
||||
{
|
||||
template<typename classT, typename enumT>
|
||||
|
@ -221,6 +221,27 @@ QUnit.test('Aruco-based QR code detect', function (assert) {
|
||||
mat.delete();
|
||||
}
|
||||
});
|
||||
QUnit.test('Bar code detect', function (assert) {
|
||||
{
|
||||
let detector = new cv.barcode_BarcodeDetector();
|
||||
let mat = cv.Mat.ones(800, 600, cv.CV_8U);
|
||||
assert.ok(mat);
|
||||
|
||||
let points = new cv.Mat();
|
||||
let codeFound = detector.detect(mat, points);
|
||||
assert.equal(points.rows, 0)
|
||||
assert.equal(points.cols, 0)
|
||||
assert.equal(codeFound, false);
|
||||
|
||||
codeContent = detector.detectAndDecode(mat);
|
||||
assert.equal(typeof codeContent, 'string');
|
||||
assert.equal(codeContent, '');
|
||||
|
||||
detector.delete();
|
||||
points.delete();
|
||||
mat.delete();
|
||||
}
|
||||
});
|
||||
QUnit.test('Aruco detector', function (assert) {
|
||||
{
|
||||
let dictionary = cv.getPredefinedDictionary(cv.DICT_4X4_50);
|
||||
|
@ -126,7 +126,8 @@ objdetect = {'': ['groupRectangles', 'getPredefinedDictionary', 'extendDictionar
|
||||
'aruco_ArucoDetector': ['ArucoDetector', 'detectMarkers', 'refineDetectedMarkers', 'setDictionary', 'setDetectorParameters', 'setRefineParameters'],
|
||||
'aruco_CharucoDetector': ['CharucoDetector', 'setBoard', 'setCharucoParameters', 'setDetectorParameters', 'setRefineParameters', 'detectBoard', 'detectDiamonds'],
|
||||
'QRCodeDetectorAruco_Params': ['Params'],
|
||||
'QRCodeDetectorAruco': ['QRCodeDetectorAruco', 'decode', 'detect', 'detectAndDecode', 'detectMulti', 'decodeMulti', 'detectAndDecodeMulti', 'setDetectorParameters', 'setArucoParameters']
|
||||
'QRCodeDetectorAruco': ['QRCodeDetectorAruco', 'decode', 'detect', 'detectAndDecode', 'detectMulti', 'decodeMulti', 'detectAndDecodeMulti', 'setDetectorParameters', 'setArucoParameters'],
|
||||
'barcode_BarcodeDetector': ['BarcodeDetector', 'decode', 'detect', 'detectAndDecode', 'detectMulti', 'decodeMulti', 'detectAndDecodeMulti', 'decodeWithType', 'detectAndDecodeWithType']
|
||||
}
|
||||
|
||||
video = {
|
||||
|
Loading…
Reference in New Issue
Block a user