Moved barcode from opencv_contrib#23666
Conversation
|
I've met several issues which need to be resolved before finishing the move, @asmorkalov , @opencv-alalek , @vpisarev , please take a look. A) Dependency on opencv_dnnCurrently objdetect optionally depends on opencv_dnn, so that algorithms using DNN will print warnings when OpenCV has not been built with DNN support. Barcode module also can optionally use neural network for super-resolution (same as in wechat_qrcode module), but it also uses
B) Inconvenient module APIBarcode class returns results into a three vectors which have to be iterated together afterwards: bool detectAndDecode(
InputArray img,
CV_OUT std::vector<std::string> &decoded_info, // decoded strings - NUM items
CV_OUT std::vector<BarcodeType> &decoded_type, // code type (e.g. EAN-13), basically a vector of ints - NUM items
OutputArray points = noArray()) const; // corners - 4*NUM itemsI think it will be better to refactor this interface to look sililar to wechat_qrcode, so that it will be possible to unify all interfaces later: std::vector<std::string> detectAndDecode(InputArray img, OutputArrayOfArrays points = noArray());Note: code type can be encoded in the first one or two symbols of returned string or returned in a separate vector or tied to each string using a Note: I took a look at the #23264 and it also has slight inconsistency between single and multi interfaces: std::string detectAndDecode(
InputArray img,
OutputArray points=noArray(),
OutputArray straight_qrcode = noArray());
// but
bool detectAndDecodeMulti(
InputArray img,
CV_OUT std::vector<std::string>& decoded_info,
OutputArray points = noArray(),
OutputArrayOfArrays straight_qrcode = noArray()) const;C) Algorithm separationCurrently there are two algorithms used internally in the barcode implementation which can be moved outside:
|
|
Created #23711 which moves NMSBoxes from dnn to imgproc, thus we will be able to move barcode detector to objdetect while keeping its OPTIONAL dependency on dnn. |
7e75daf to
b374071
Compare
opencv-alalek
left a comment
There was a problem hiding this comment.
Well done! LGTM 👍
(need to merge opencv_contrib PR first)
|
|
||
| #### Initialization | ||
|
|
||
| User can construct BarcodeDetector with super resolution model which should be downloaded automatically to `<opencv_build_dir>/downloads/barcode`. If not, please download them from https://github.com/WeChatCV/opencv_3rdparty/tree/wechat_qrcode or choose not to use super resolution. |
There was a problem hiding this comment.
It's not downloaded automatically.
|
|
||
| User can construct BarcodeDetector with super resolution model which should be downloaded automatically to `<opencv_build_dir>/downloads/barcode`. If not, please download them from https://github.com/WeChatCV/opencv_3rdparty/tree/wechat_qrcode or choose not to use super resolution. | ||
|
|
||
| @snippet ./samples/barcode.cpp initialize |
There was a problem hiding this comment.
Barcode sample is located in wrong place: modules/objdetect/samples/barcode.cpp, but should be in samples/cpp/barcode.cpp.
There was a problem hiding this comment.
Technically OpenCV supports module-specific samples (like in OpenCV contrib). I decided to put it there because it demonstrates objdetect module functionality. Perhaps we can continue moving C++ samples to their respective modules to reduce this list:
opencv/samples/cpp/CMakeLists.txt
Lines 3 to 21 in 19f4f2e
If you think it is better to move it to others (
samples/cpp) I will do it.
There was a problem hiding this comment.
It's very unusual for main opencv repo and users do not search for samples in modules source code. I propose to put it to expected places and introduce new practice later globally.
Moved barcode from opencv_contrib opencv#23666 Merge with opencv/opencv_contrib#3497 ##### TODO - [x] Documentation (bib) - [x] Tutorial (references) - [x] Sample app (refactored) - [x] Java (test passes) - [x] Python (test passes) - [x] Build without DNN
Moved barcode from opencv_contrib opencv#23666 Merge with opencv/opencv_contrib#3497 ##### TODO - [x] Documentation (bib) - [x] Tutorial (references) - [x] Sample app (refactored) - [x] Java (test passes) - [x] Python (test passes) - [x] Build without DNN
Merge with opencv/opencv_contrib#3497
TODO