OpenCV453
barcode.hpp
1// This file is part of OpenCV project.
2// It is subject to the license terms in the LICENSE file found in the top-level directory
3// of this distribution and at http://opencv.org/license.html.
4// Copyright (c) 2020-2021 darkliang wangberlinT Certseeds
5
6#ifndef __OPENCV_BARCODE_HPP__
7#define __OPENCV_BARCODE_HPP__
8
9#include <opencv2/core.hpp>
10#include <ostream>
11
15namespace cv {
16namespace barcode {
17
20
21enum BarcodeType
22{
23 NONE, EAN_8, EAN_13, UPC_A, UPC_E, UPC_EAN_EXTENSION
24};
25
26static inline std::ostream &operator<<(std::ostream &out, const BarcodeType &barcode_type)
27{
28 switch (barcode_type)
29 {
30 case BarcodeType::EAN_8:
31 out << "EAN_8";
32 break;
33 case BarcodeType::EAN_13:
34 out << "EAN_13";
35 break;
36 case BarcodeType::UPC_E:
37 out << "UPC_E";
38 break;
39 case BarcodeType::UPC_A:
40 out << "UPC_A";
41 break;
42 case BarcodeType::UPC_EAN_EXTENSION:
43 out << "UPC_EAN_EXTENSION";
44 break;
45 default:
46 out << "NONE";
47 }
48 return out;
49}
50
51class CV_EXPORTS_W BarcodeDetector
52{
53public:
59 CV_WRAP BarcodeDetector(const std::string &prototxt_path = "", const std::string &model_path = "");
60
62
70 CV_WRAP bool detect(InputArray img, OutputArray points) const;
71
81 CV_WRAP bool decode(InputArray img, InputArray points, CV_OUT std::vector<std::string> &decoded_info, CV_OUT
82 std::vector<BarcodeType> &decoded_type) const;
83
91 CV_WRAP bool detectAndDecode(InputArray img, CV_OUT std::vector<std::string> &decoded_info, CV_OUT
92 std::vector<BarcodeType> &decoded_type, OutputArray points = noArray()) const;
93
94protected:
95 struct Impl;
96 Ptr<Impl> p;
97};
99}
100} // cv::barcode::
101#endif //__OPENCV_BARCODE_HPP__
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:295
Definition: barcode.hpp:52
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
Definition: cvstd_wrapper.hpp:74