CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Moved barcode from opencv_contrib #23666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 items I 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not downloaded automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
set(OPENCV_CPP_SAMPLES_REQUIRED_DEPS | |
opencv_core | |
opencv_imgproc | |
opencv_flann | |
opencv_imgcodecs | |
opencv_videoio | |
opencv_highgui | |
opencv_ml | |
opencv_video | |
opencv_objdetect | |
opencv_photo | |
opencv_features2d | |
opencv_calib3d | |
opencv_stitching | |
opencv_dnn | |
opencv_gapi | |
${OPENCV_MODULES_PUBLIC} | |
${OpenCV_LIB_COMPONENTS}) | |
ocv_check_dependencies(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS}) |
If you think it is better to move it to others (
samples/cpp
) I will do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
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