Skip to content

wechat qr code, enable 2 tests, enable dnn detector #3352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions modules/wechat_qrcode/test/test_qrcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ std::string qrcode_images_curved[] = {"curved_1.jpg", /*"curved_2.jpg", "curved_
"curved_4.jpg",*/
"curved_5.jpg", "curved_6.jpg",
/*"curved_7.jpg", "curved_8.jpg"*/};
// std::string qrcode_images_multiple[] = {"2_qrcodes.png", "3_close_qrcodes.png", "3_qrcodes.png",
// "4_qrcodes.png", "5_qrcodes.png", "6_qrcodes.png",
// "7_qrcodes.png", "8_close_qrcodes.png"};
std::string qrcode_images_multiple[] = {/*"2_qrcodes.png",*/ "3_close_qrcodes.png", /*"3_qrcodes.png",
"4_qrcodes.png", "5_qrcodes.png", "6_qrcodes.png",*/
"7_qrcodes.png"/*, "8_close_qrcodes.png"*/};

typedef testing::TestWithParam<std::string> Objdetect_QRCode;
TEST_P(Objdetect_QRCode, regression) {
Expand Down Expand Up @@ -237,18 +237,20 @@ typedef testing::TestWithParam<std::string> Objdetect_QRCode_Multi;
TEST_P(Objdetect_QRCode_Multi, regression) {
const std::string name_current_image = GetParam();
const std::string root = "qrcode/multiple/";
string path_detect_prototxt, path_detect_caffemodel, path_sr_prototxt, path_sr_caffemodel;
string model_version = "_2021-01";
path_detect_prototxt = findDataFile("dnn/wechat"+model_version+"/detect.prototxt", false);
path_detect_caffemodel = findDataFile("dnn/wechat"+model_version+"/detect.caffemodel", false);
path_sr_prototxt = findDataFile("dnn/wechat"+model_version+"/sr.prototxt", false);
path_sr_caffemodel = findDataFile("dnn/wechat"+model_version+"/sr.caffemodel", false);

std::string image_path = findDataFile(root + name_current_image);
Mat src = imread(image_path);
ASSERT_FALSE(src.empty()) << "Can't read image: " << image_path;

vector<Mat> points;
// can not find the model file
// so we temporarily comment it out
// auto detector = wechat_qrcode::WeChatQRCode(
// findDataFile("detect.prototxt", false), findDataFile("detect.caffemodel", false),
// findDataFile("sr.prototxt", false), findDataFile("sr.caffemodel", false));
auto detector = wechat_qrcode::WeChatQRCode();
auto detector = wechat_qrcode::WeChatQRCode(path_detect_prototxt, path_detect_caffemodel, path_sr_prototxt,
path_sr_caffemodel);
vector<string> decoded_info = detector.detectAndDecode(src, points);

const std::string dataset_config = findDataFile(root + "dataset_config.json");
Expand Down Expand Up @@ -343,7 +345,7 @@ INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode, testing::ValuesIn(qrcode_images_
INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode_Close, testing::ValuesIn(qrcode_images_close));
INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode_Monitor, testing::ValuesIn(qrcode_images_monitor));
INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode_Curved, testing::ValuesIn(qrcode_images_curved));
// INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode_Multi, testing::ValuesIn(qrcode_images_multiple));
INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode_Multi, testing::ValuesIn(qrcode_images_multiple));

TEST(Objdetect_QRCode_Big, regression) {
string path_detect_prototxt, path_detect_caffemodel, path_sr_prototxt, path_sr_caffemodel;
Expand Down