Skip to content

Commit ce16ef9

Browse files
authored
Merge pull request #3352 from AleksandrPanov:wechat_enable_tests
wechat qr code, enable 2 tests, enable dnn detector
2 parents 971685c + 98c9d36 commit ce16ef9

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

modules/wechat_qrcode/test/test_qrcode.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ std::string qrcode_images_curved[] = {"curved_1.jpg", /*"curved_2.jpg", "curved_
4141
"curved_4.jpg",*/
4242
"curved_5.jpg", "curved_6.jpg",
4343
/*"curved_7.jpg", "curved_8.jpg"*/};
44-
// std::string qrcode_images_multiple[] = {"2_qrcodes.png", "3_close_qrcodes.png", "3_qrcodes.png",
45-
// "4_qrcodes.png", "5_qrcodes.png", "6_qrcodes.png",
46-
// "7_qrcodes.png", "8_close_qrcodes.png"};
44+
std::string qrcode_images_multiple[] = {/*"2_qrcodes.png",*/ "3_close_qrcodes.png", /*"3_qrcodes.png",
45+
"4_qrcodes.png", "5_qrcodes.png", "6_qrcodes.png",*/
46+
"7_qrcodes.png"/*, "8_close_qrcodes.png"*/};
4747

4848
typedef testing::TestWithParam<std::string> Objdetect_QRCode;
4949
TEST_P(Objdetect_QRCode, regression) {
@@ -237,18 +237,20 @@ typedef testing::TestWithParam<std::string> Objdetect_QRCode_Multi;
237237
TEST_P(Objdetect_QRCode_Multi, regression) {
238238
const std::string name_current_image = GetParam();
239239
const std::string root = "qrcode/multiple/";
240+
string path_detect_prototxt, path_detect_caffemodel, path_sr_prototxt, path_sr_caffemodel;
241+
string model_version = "_2021-01";
242+
path_detect_prototxt = findDataFile("dnn/wechat"+model_version+"/detect.prototxt", false);
243+
path_detect_caffemodel = findDataFile("dnn/wechat"+model_version+"/detect.caffemodel", false);
244+
path_sr_prototxt = findDataFile("dnn/wechat"+model_version+"/sr.prototxt", false);
245+
path_sr_caffemodel = findDataFile("dnn/wechat"+model_version+"/sr.caffemodel", false);
240246

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

245251
vector<Mat> points;
246-
// can not find the model file
247-
// so we temporarily comment it out
248-
// auto detector = wechat_qrcode::WeChatQRCode(
249-
// findDataFile("detect.prototxt", false), findDataFile("detect.caffemodel", false),
250-
// findDataFile("sr.prototxt", false), findDataFile("sr.caffemodel", false));
251-
auto detector = wechat_qrcode::WeChatQRCode();
252+
auto detector = wechat_qrcode::WeChatQRCode(path_detect_prototxt, path_detect_caffemodel, path_sr_prototxt,
253+
path_sr_caffemodel);
252254
vector<string> decoded_info = detector.detectAndDecode(src, points);
253255

254256
const std::string dataset_config = findDataFile(root + "dataset_config.json");
@@ -343,7 +345,7 @@ INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode, testing::ValuesIn(qrcode_images_
343345
INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode_Close, testing::ValuesIn(qrcode_images_close));
344346
INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode_Monitor, testing::ValuesIn(qrcode_images_monitor));
345347
INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode_Curved, testing::ValuesIn(qrcode_images_curved));
346-
// INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode_Multi, testing::ValuesIn(qrcode_images_multiple));
348+
INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode_Multi, testing::ValuesIn(qrcode_images_multiple));
347349

348350
TEST(Objdetect_QRCode_Big, regression) {
349351
string path_detect_prototxt, path_detect_caffemodel, path_sr_prototxt, path_sr_caffemodel;

0 commit comments

Comments
 (0)