Conversation
| for(size_t i = 0; i < decoded_info.size(); i++) | ||
| { | ||
| ASSERT_FALSE(decoded_info[i].empty()); | ||
| } |
There was a problem hiding this comment.
Result check should be out of perf test loop.
| { | ||
| ASSERT_FALSE(decoded_info[i].empty()); | ||
| } |
There was a problem hiding this comment.
Result check should be out of perf test loop.
| // of this distribution and at http://opencv.org/license.html. | ||
| #include "perf_precomp.hpp" | ||
|
|
||
| CV_PERF_TEST_MAIN(wechat_qrcode) |
There was a problem hiding this comment.
Need to copy initTests() code from objdetect/test to properly find DNN models.
| std::string qrcode_images_multiple[] = {"2_qrcodes.png", "3_qrcodes.png", "3_close_qrcodes.png", | ||
| "4_qrcodes.png", "5_qrcodes.png", "7_qrcodes.png"}; | ||
|
|
||
| bool Find_Models_Files(std::vector<std::string>& models) { |
There was a problem hiding this comment.
function names should start with lowercase.
| path_sr_prototxt = findDataFile("dnn/wechat"+model_version+"/sr.prototxt", false); | ||
| path_sr_caffemodel = findDataFile("dnn/wechat"+model_version+"/sr.caffemodel", false); | ||
| models = {path_detect_prototxt, path_detect_caffemodel, path_sr_prototxt, path_sr_caffemodel}; | ||
| return true; |
There was a problem hiding this comment.
why always true? do we need bool result?
| ASSERT_TRUE(Find_Models_Files(models)); | ||
| auto detector = wechat_qrcode::WeChatQRCode(models[0], models[1], models[2], models[3]); | ||
|
|
||
| TEST_CYCLE() |
There was a problem hiding this comment.
With DNN models we should have "warmup" first call before measuring.
| ASSERT_TRUE(Find_Models_Files(models)); | ||
| auto detector = wechat_qrcode::WeChatQRCode(models[0], models[1], models[2], models[3]); |
There was a problem hiding this comment.
models[0], models[1], models[2], models[3]
createQRDetectorWithDNN()
| RNG rng; | ||
| rng.fill(not_qr_code, RNG::UNIFORM, Scalar(0), Scalar(1)); | ||
| } | ||
| if (type_gen == "chessboard") |
| int i = r / not_qr_code.cols; | ||
| int j = r % not_qr_code.cols; | ||
| not_qr_code.ptr<uchar>(i)[j] = next_pixel; | ||
| next_pixel = 255 - next_pixel; |
There was a problem hiding this comment.
with even cols that code draws vertical lines.
| if (type_gen == "random") | ||
| { | ||
| RNG rng; | ||
| rng.fill(not_qr_code, RNG::UNIFORM, Scalar(0), Scalar(1)); | ||
| } | ||
| if (type_gen == "chessboard") | ||
| { | ||
| uint8_t next_pixel = 0; | ||
| for (int r = 0; r < not_qr_code.rows * not_qr_code.cols; r++) | ||
| { | ||
| int i = r / not_qr_code.cols; | ||
| int j = r % not_qr_code.cols; | ||
| not_qr_code.ptr<uchar>(i)[j] = next_pixel; | ||
| next_pixel = 255 - next_pixel; | ||
| } | ||
| } |
|
@MaximMilashchenko please review this PR. |
reviewed, no comments from my side |
|
Overall looks good to me 👍 Details
|
Added perfomance tests for detection and decoding with and without nn.
Download model files from https://github.com/WeChatCV/opencv_3rdparty/tree/wechat_qrcode.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.