Open Source Computer Vision Library https://opencv.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

356 lines
10 KiB

#include "opencv2/objdetect.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
5 years ago
#include "opencv2/videoio.hpp"
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
#include "opencv2/imgcodecs.hpp"
#include <string>
#include <iostream>
using namespace std;
using namespace cv;
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
static int liveQRCodeDetect();
static int imageQRCodeDetect(const string& in_file);
Merge pull request #23264 from AleksandrPanov:add_detect_qr_with_aruco Add detect qr with aruco #23264 Using Aruco to detect finder patterns to search QR codes. TODO (in next PR): - add single QR detect (update `detect()` and `detectAndDecode()`) - need reduce full enumeration of finder patterns - need add finder pattern info to `decode` step - need to merge the pipeline of the old and new algorithm [Current results:](https://docs.google.com/spreadsheets/d/1ufKyR-Zs-IGXwvqPgftssmTlceVjiQX364sbrjr2QU8/edit#gid=1192415584) +20% total detect, +8% total decode in OpenCV [QR benchmark](https://github.com/opencv/opencv_benchmarks/tree/develop/python_benchmarks/qr_codes) ![res1](https://user-images.githubusercontent.com/22337800/231228556-191d3eae-a318-44e1-af99-e7d420bf6248.png) 78.4% detect, 58.7% decode vs 58.5 detect, 50.5% decode in default [main.py.txt](https://github.com/opencv/opencv/files/10762369/main.py.txt) ![res2](https://user-images.githubusercontent.com/22337800/231229123-ed7f1eda-159a-444b-a3ff-f107d8eb4a20.png) add new info to [google docs](https://docs.google.com/spreadsheets/d/1ufKyR-Zs-IGXwvqPgftssmTlceVjiQX364sbrjr2QU8/edit?usp=sharing) ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
2 years ago
static bool g_useArucoBased = false;
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
static bool g_modeMultiQR = false;
static bool g_detectOnly = false;
static string g_out_file_name, g_out_file_ext;
static int g_save_idx = 0;
static bool g_saveDetections = false;
static bool g_saveAll = false;
static string getQRModeString()
{
std::ostringstream out;
out << "QR"
<< (g_modeMultiQR ? " multi" : "")
<< (g_detectOnly ? " detector" : " decoder");
return out.str();
}
int main(int argc, char *argv[])
{
const string keys =
"{h help ? | | print help messages }"
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
"{i in | | input image path (also switches to image detection mode) }"
Merge pull request #23264 from AleksandrPanov:add_detect_qr_with_aruco Add detect qr with aruco #23264 Using Aruco to detect finder patterns to search QR codes. TODO (in next PR): - add single QR detect (update `detect()` and `detectAndDecode()`) - need reduce full enumeration of finder patterns - need add finder pattern info to `decode` step - need to merge the pipeline of the old and new algorithm [Current results:](https://docs.google.com/spreadsheets/d/1ufKyR-Zs-IGXwvqPgftssmTlceVjiQX364sbrjr2QU8/edit#gid=1192415584) +20% total detect, +8% total decode in OpenCV [QR benchmark](https://github.com/opencv/opencv_benchmarks/tree/develop/python_benchmarks/qr_codes) ![res1](https://user-images.githubusercontent.com/22337800/231228556-191d3eae-a318-44e1-af99-e7d420bf6248.png) 78.4% detect, 58.7% decode vs 58.5 detect, 50.5% decode in default [main.py.txt](https://github.com/opencv/opencv/files/10762369/main.py.txt) ![res2](https://user-images.githubusercontent.com/22337800/231229123-ed7f1eda-159a-444b-a3ff-f107d8eb4a20.png) add new info to [google docs](https://docs.google.com/spreadsheets/d/1ufKyR-Zs-IGXwvqPgftssmTlceVjiQX364sbrjr2QU8/edit?usp=sharing) ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
2 years ago
"{aruco_based | false | use Aruco-based QR code detector instead of contour-based }"
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
"{detect | false | detect QR code only (skip decoding) }"
"{m multi | | use detect for multiple qr-codes }"
"{o out | qr_code.png | path to result file }"
"{save_detections | false | save all QR detections (video mode only) }"
"{save_all | false | save all processed frames (video mode only) }"
;
CommandLineParser cmd_parser(argc, argv, keys);
cmd_parser.about("This program detects the QR-codes from camera or images using the OpenCV library.");
if (cmd_parser.has("help"))
{
cmd_parser.printMessage();
return 0;
}
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
string in_file_name = cmd_parser.get<string>("in"); // path to input image
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
if (cmd_parser.has("out"))
{
std::string fpath = cmd_parser.get<string>("out"); // path to output image
std::string::size_type idx = fpath.rfind('.');
if (idx != std::string::npos)
{
g_out_file_name = fpath.substr(0, idx);
g_out_file_ext = fpath.substr(idx);
}
else
{
g_out_file_name = fpath;
g_out_file_ext = ".png";
}
}
if (!cmd_parser.check())
{
cmd_parser.printErrors();
return -1;
}
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
g_modeMultiQR = cmd_parser.has("multi") && cmd_parser.get<bool>("multi");
g_detectOnly = cmd_parser.has("detect") && cmd_parser.get<bool>("detect");
Merge pull request #23264 from AleksandrPanov:add_detect_qr_with_aruco Add detect qr with aruco #23264 Using Aruco to detect finder patterns to search QR codes. TODO (in next PR): - add single QR detect (update `detect()` and `detectAndDecode()`) - need reduce full enumeration of finder patterns - need add finder pattern info to `decode` step - need to merge the pipeline of the old and new algorithm [Current results:](https://docs.google.com/spreadsheets/d/1ufKyR-Zs-IGXwvqPgftssmTlceVjiQX364sbrjr2QU8/edit#gid=1192415584) +20% total detect, +8% total decode in OpenCV [QR benchmark](https://github.com/opencv/opencv_benchmarks/tree/develop/python_benchmarks/qr_codes) ![res1](https://user-images.githubusercontent.com/22337800/231228556-191d3eae-a318-44e1-af99-e7d420bf6248.png) 78.4% detect, 58.7% decode vs 58.5 detect, 50.5% decode in default [main.py.txt](https://github.com/opencv/opencv/files/10762369/main.py.txt) ![res2](https://user-images.githubusercontent.com/22337800/231229123-ed7f1eda-159a-444b-a3ff-f107d8eb4a20.png) add new info to [google docs](https://docs.google.com/spreadsheets/d/1ufKyR-Zs-IGXwvqPgftssmTlceVjiQX364sbrjr2QU8/edit?usp=sharing) ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
2 years ago
g_useArucoBased = cmd_parser.has("aruco_based") && cmd_parser.get<bool>("aruco_based");
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
g_saveDetections = cmd_parser.has("save_detections") && cmd_parser.get<bool>("save_detections");
g_saveAll = cmd_parser.has("save_all") && cmd_parser.get<bool>("save_all");
int return_code = 0;
if (in_file_name.empty())
{
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
return_code = liveQRCodeDetect();
}
else
{
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
return_code = imageQRCodeDetect(samples::findFile(in_file_name));
}
return return_code;
}
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
static
void drawQRCodeContour(Mat &color_image, const vector<Point>& corners)
{
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
if (!corners.empty())
{
double show_radius = (color_image.rows > color_image.cols)
? (2.813 * color_image.rows) / color_image.cols
: (2.813 * color_image.cols) / color_image.rows;
double contour_radius = show_radius * 0.4;
vector< vector<Point> > contours;
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
contours.push_back(corners);
drawContours(color_image, contours, 0, Scalar(211, 0, 148), cvRound(contour_radius));
RNG rng(1000);
for (size_t i = 0; i < 4; i++)
{
Scalar color = Scalar(rng.uniform(0,255), rng.uniform(0, 255), rng.uniform(0, 255));
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
circle(color_image, corners[i], cvRound(show_radius), color, -1);
}
}
}
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
static
void drawFPS(Mat &color_image, double fps)
{
ostringstream convert;
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
convert << cv::format("%.2f", fps) << " FPS (" << getQRModeString() << ")";
putText(color_image, convert.str(), Point(25, 25), FONT_HERSHEY_DUPLEX, 1, Scalar(0, 0, 255), 2);
}
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
static
void drawQRCodeResults(Mat& frame, const vector<Point>& corners, const vector<cv::String>& decode_info, double fps)
{
if (!corners.empty())
{
for (size_t i = 0; i < corners.size(); i += 4)
{
size_t qr_idx = i / 4;
vector<Point> qrcode_contour(corners.begin() + i, corners.begin() + i + 4);
drawQRCodeContour(frame, qrcode_contour);
cout << "QR[" << qr_idx << "] @ " << Mat(qrcode_contour).reshape(2, 1) << ": ";
if (decode_info.size() > qr_idx)
{
if (!decode_info[qr_idx].empty())
cout << "'" << decode_info[qr_idx] << "'" << endl;
else
cout << "can't decode QR code" << endl;
}
else
{
cout << "decode information is not available (disabled)" << endl;
}
}
}
else
{
cout << "QR code is not detected" << endl;
}
drawFPS(frame, fps);
}
static
void runQR(
const GraphicalCodeDetector& qrcode, const Mat& input,
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
vector<Point>& corners, vector<cv::String>& decode_info
// +global: bool g_modeMultiQR, bool g_detectOnly
)
{
if (!g_modeMultiQR)
{
if (!g_detectOnly)
{
String decode_info1 = qrcode.detectAndDecode(input, corners);
decode_info.push_back(decode_info1);
}
else
{
bool detection_result = qrcode.detect(input, corners);
CV_UNUSED(detection_result);
}
}
else
{
if (!g_detectOnly)
{
bool result_detection = qrcode.detectAndDecodeMulti(input, decode_info, corners);
CV_UNUSED(result_detection);
}
else
{
bool result_detection = qrcode.detectMulti(input, corners);
CV_UNUSED(result_detection);
}
}
}
static
double processQRCodeDetection(const GraphicalCodeDetector& qrcode, const Mat& input, Mat& result, vector<Point>& corners)
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
{
if (input.channels() == 1)
cvtColor(input, result, COLOR_GRAY2BGR);
else
input.copyTo(result);
cout << "Run " << getQRModeString()
<< " on image: " << input.size() << " (" << typeToString(input.type()) << ")"
<< endl;
TickMeter timer;
vector<cv::String> decode_info;
timer.start();
runQR(qrcode, input, corners, decode_info);
timer.stop();
double fps = 1 / timer.getTimeSec();
drawQRCodeResults(result, corners, decode_info, fps);
return fps;
}
int liveQRCodeDetect()
{
VideoCapture cap(0);
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
if (!cap.isOpened())
{
cout << "Cannot open a camera" << endl;
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
return 2;
}
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
cout << "Press 'm' to switch between detectAndDecode and detectAndDecodeMulti" << endl;
cout << "Press 'd' to switch between decoder and detector" << endl;
cout << "Press ' ' (space) to save result into images" << endl;
cout << "Press 'ESC' to exit" << endl;
GraphicalCodeDetector qrcode = QRCodeDetector();
Merge pull request #23264 from AleksandrPanov:add_detect_qr_with_aruco Add detect qr with aruco #23264 Using Aruco to detect finder patterns to search QR codes. TODO (in next PR): - add single QR detect (update `detect()` and `detectAndDecode()`) - need reduce full enumeration of finder patterns - need add finder pattern info to `decode` step - need to merge the pipeline of the old and new algorithm [Current results:](https://docs.google.com/spreadsheets/d/1ufKyR-Zs-IGXwvqPgftssmTlceVjiQX364sbrjr2QU8/edit#gid=1192415584) +20% total detect, +8% total decode in OpenCV [QR benchmark](https://github.com/opencv/opencv_benchmarks/tree/develop/python_benchmarks/qr_codes) ![res1](https://user-images.githubusercontent.com/22337800/231228556-191d3eae-a318-44e1-af99-e7d420bf6248.png) 78.4% detect, 58.7% decode vs 58.5 detect, 50.5% decode in default [main.py.txt](https://github.com/opencv/opencv/files/10762369/main.py.txt) ![res2](https://user-images.githubusercontent.com/22337800/231229123-ed7f1eda-159a-444b-a3ff-f107d8eb4a20.png) add new info to [google docs](https://docs.google.com/spreadsheets/d/1ufKyR-Zs-IGXwvqPgftssmTlceVjiQX364sbrjr2QU8/edit?usp=sharing) ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
2 years ago
if (g_useArucoBased)
qrcode = QRCodeDetectorAruco();
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
for (;;)
{
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
Mat frame;
cap >> frame;
if (frame.empty())
{
cout << "End of video stream" << endl;
break;
}
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
bool forceSave = g_saveAll;
Mat result;
try
{
vector<Point> corners;
double fps = processQRCodeDetection(qrcode, frame, result, corners);
cout << "FPS: " << fps << endl;
forceSave |= (g_saveDetections && !corners.empty());
//forceSave |= fps < 1.0;
}
catch (const cv::Exception& e)
{
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
cerr << "ERROR exception: " << e.what() << endl;
forceSave = true;
}
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
if (!result.empty())
imshow("QR code", result);
int code = waitKey(1);
if (code < 0 && !forceSave)
continue; // timeout
char c = (char)code;
if (c == ' ' || forceSave)
{
string fsuffix = cv::format("-%05d", g_save_idx++);
string fname_input = g_out_file_name + fsuffix + "_input.png";
cout << "Saving QR code detection input: '" << fname_input << "' ..." << endl;
imwrite(fname_input, frame);
string fname = g_out_file_name + fsuffix + g_out_file_ext;
cout << "Saving QR code detection result: '" << fname << "' ..." << endl;
imwrite(fname, result);
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
cout << "Saved" << endl;
}
if (c == 'm')
{
g_modeMultiQR = !g_modeMultiQR;
cout << "Switching QR code mode ==> " << (g_modeMultiQR ? "detectAndDecodeMulti" : "detectAndDecode") << endl;
}
if (c == 'd')
{
g_detectOnly = !g_detectOnly;
cout << "Switching QR decoder mode ==> " << (g_detectOnly ? "detect" : "decode") << endl;
}
if (c == 27)
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
{
cout << "'ESC' is pressed. Exiting..." << endl;
break;
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
}
}
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
cout << "Exit." << endl;
return 0;
}
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
int imageQRCodeDetect(const string& in_file)
{
const int count_experiments = 10;
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
Mat input = imread(in_file, IMREAD_COLOR);
cout << "Run " << getQRModeString()
<< " on image: " << input.size() << " (" << typeToString(input.type()) << ")"
<< endl;
GraphicalCodeDetector qrcode = QRCodeDetector();
Merge pull request #23264 from AleksandrPanov:add_detect_qr_with_aruco Add detect qr with aruco #23264 Using Aruco to detect finder patterns to search QR codes. TODO (in next PR): - add single QR detect (update `detect()` and `detectAndDecode()`) - need reduce full enumeration of finder patterns - need add finder pattern info to `decode` step - need to merge the pipeline of the old and new algorithm [Current results:](https://docs.google.com/spreadsheets/d/1ufKyR-Zs-IGXwvqPgftssmTlceVjiQX364sbrjr2QU8/edit#gid=1192415584) +20% total detect, +8% total decode in OpenCV [QR benchmark](https://github.com/opencv/opencv_benchmarks/tree/develop/python_benchmarks/qr_codes) ![res1](https://user-images.githubusercontent.com/22337800/231228556-191d3eae-a318-44e1-af99-e7d420bf6248.png) 78.4% detect, 58.7% decode vs 58.5 detect, 50.5% decode in default [main.py.txt](https://github.com/opencv/opencv/files/10762369/main.py.txt) ![res2](https://user-images.githubusercontent.com/22337800/231229123-ed7f1eda-159a-444b-a3ff-f107d8eb4a20.png) add new info to [google docs](https://docs.google.com/spreadsheets/d/1ufKyR-Zs-IGXwvqPgftssmTlceVjiQX364sbrjr2QU8/edit?usp=sharing) ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
2 years ago
if (g_useArucoBased)
qrcode = QRCodeDetectorAruco();
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
vector<Point> corners;
vector<cv::String> decode_info;
TickMeter timer;
for (size_t i = 0; i < count_experiments; i++)
{
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
corners.clear();
decode_info.clear();
timer.start();
runQR(qrcode, input, corners, decode_info);
timer.stop();
}
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
double fps = count_experiments / timer.getTimeSec();
cout << "FPS: " << fps << endl;
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
Mat result; input.copyTo(result);
drawQRCodeResults(result, corners, decode_info, fps);
imshow("QR", result); waitKey(1);
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
if (!g_out_file_name.empty())
{
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
string out_file = g_out_file_name + g_out_file_ext;
cout << "Saving result: " << out_file << endl;
imwrite(out_file, result);
}
Merge pull request #15338 from rayonnant14:my_detect_and_decode_3.4 QR-Code detector : multiple detection * change in qr-codes detection * change in qr-codes detection * change in test * change in test * add multiple detection * multiple detection * multiple detect * add parallel implementation * add functional for performance tests * change in test * add perftest * returned implementation for 1 qr-code, added support for vector<Mat> and vector<vector<Point2f>> in MultipleDetectAndDecode * deleted all lambda expressions * changing in triangle sort * fixed warnings * fixed errors * add java and python tests * change in java tests * change in java and python tests * change in perf test * change in qrcode.cpp * add spaces * change in qrcode.cpp * change in qrcode.cpp * change in qrcode.cpp * change in java tests * change in java tests * solved problems * solved problems * change in java and python tests * change in python tests * change in python tests * change in python tests * change in methods name * deleted sample qrcode_multi, change in qrcode.cpp * change in perf tests * change in objdetect.hpp * deleted code duplication in sample qrcode.cpp * returned spaces * added spaces * deleted draw function * change in qrcode.cpp * change in qrcode.cpp * deleted all draw functions * objdetect(QR): extractVerticalLines * objdetect(QR): whitespaces * objdetect(QR): simplify operations, avoid duplicated code * change in interface, additional checks in java and python tests, added new key in sample for saving original image from camera * fix warnings and errors in python test * fix * write in file with space key * solved error with empty mat check in python test * correct path to test image * deleted spaces * solved error with check empty mat in python tests * added check of empty vector of points * samples: rework qrcode.cpp * objdetect(QR): fix API, input parameters must be first * objdetect(QR): test/fix points layout
5 years ago
cout << "Press any key to exit ..." << endl;
waitKey(0);
cout << "Exit." << endl;
return 0;
}