Skip to content

Commit

Permalink
Merge pull request #3352 from AleksandrPanov:wechat_enable_tests
Browse files Browse the repository at this point in the history
wechat qr code, enable 2 tests, enable dnn detector
  • Loading branch information
asmorkalov authored Sep 12, 2022
2 parents 971685c + 98c9d36 commit ce16ef9
Showing 1 changed file with 12 additions and 10 deletions.
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

0 comments on commit ce16ef9

Please sign in to comment.