@@ -252,6 +252,8 @@ TEST_P(Objdetect_QRCode, regression)
252
252
decoded_info = qrcode.detectAndDecode (src, corners, straight_barcode);
253
253
ASSERT_FALSE (corners.empty ());
254
254
ASSERT_FALSE (decoded_info.empty ());
255
+ int expected_barcode_type = CV_8UC1;
256
+ EXPECT_EQ (expected_barcode_type, straight_barcode.type ());
255
257
#else
256
258
ASSERT_TRUE (qrcode.detect (src, corners));
257
259
#endif
@@ -317,6 +319,8 @@ TEST_P(Objdetect_QRCode_Close, regression)
317
319
decoded_info = qrcode.detectAndDecode (barcode, corners, straight_barcode);
318
320
ASSERT_FALSE (corners.empty ());
319
321
ASSERT_FALSE (decoded_info.empty ());
322
+ int expected_barcode_type = CV_8UC1;
323
+ EXPECT_EQ (expected_barcode_type, straight_barcode.type ());
320
324
#else
321
325
ASSERT_TRUE (qrcode.detect (barcode, corners));
322
326
#endif
@@ -382,6 +386,8 @@ TEST_P(Objdetect_QRCode_Monitor, regression)
382
386
decoded_info = qrcode.detectAndDecode (barcode, corners, straight_barcode);
383
387
ASSERT_FALSE (corners.empty ());
384
388
ASSERT_FALSE (decoded_info.empty ());
389
+ int expected_barcode_type = CV_8UC1;
390
+ EXPECT_EQ (expected_barcode_type, straight_barcode.type ());
385
391
#else
386
392
ASSERT_TRUE (qrcode.detect (barcode, corners));
387
393
#endif
@@ -442,6 +448,8 @@ TEST_P(Objdetect_QRCode_Curved, regression)
442
448
decoded_info = qrcode.detectAndDecodeCurved (src, corners, straight_barcode);
443
449
ASSERT_FALSE (corners.empty ());
444
450
ASSERT_FALSE (decoded_info.empty ());
451
+ int expected_barcode_type = CV_8UC1;
452
+ EXPECT_EQ (expected_barcode_type, straight_barcode.type ());
445
453
#else
446
454
ASSERT_TRUE (qrcode.detect (src, corners));
447
455
#endif
@@ -502,6 +510,9 @@ TEST_P(Objdetect_QRCode_Multi, regression)
502
510
EXPECT_TRUE (qrcode.detectAndDecodeMulti (src, decoded_info, corners, straight_barcode));
503
511
ASSERT_FALSE (corners.empty ());
504
512
ASSERT_FALSE (decoded_info.empty ());
513
+ int expected_barcode_type = CV_8UC1;
514
+ for (size_t i = 0 ; i < straight_barcode.size (); i++)
515
+ EXPECT_EQ (expected_barcode_type, straight_barcode[i].type ());
505
516
#else
506
517
ASSERT_TRUE (qrcode.detectMulti (src, corners));
507
518
#endif
@@ -612,6 +623,32 @@ TEST(Objdetect_QRCode_detectMulti, detect_regression_16961)
612
623
EXPECT_EQ (corners.size (), expect_corners_size);
613
624
}
614
625
626
+ TEST (Objdetect_QRCode_decodeMulti, check_output_parameters_type_19363)
627
+ {
628
+ const std::string name_current_image = " 9_qrcodes.jpg" ;
629
+ const std::string root = " qrcode/multiple/" ;
630
+
631
+ std::string image_path = findDataFile (root + name_current_image);
632
+ Mat src = imread (image_path);
633
+ ASSERT_FALSE (src.empty ()) << " Can't read image: " << image_path;
634
+ #ifdef HAVE_QUIRC
635
+ QRCodeDetector qrcode;
636
+ std::vector<Point> corners;
637
+ std::vector<cv::String> decoded_info;
638
+ #if 0 // FIXIT: OutputArray::create() type check
639
+ std::vector<Mat2b> straight_barcode_nchannels;
640
+ EXPECT_ANY_THROW(qrcode.detectAndDecodeMulti(src, decoded_info, corners, straight_barcode_nchannels));
641
+ #endif
642
+
643
+ int expected_barcode_type = CV_8UC1;
644
+ std::vector<Mat1b> straight_barcode;
645
+ EXPECT_TRUE (qrcode.detectAndDecodeMulti (src, decoded_info, corners, straight_barcode));
646
+ ASSERT_FALSE (corners.empty ());
647
+ for (size_t i = 0 ; i < straight_barcode.size (); i++)
648
+ EXPECT_EQ (expected_barcode_type, straight_barcode[i].type ());
649
+ #endif
650
+ }
651
+
615
652
TEST (Objdetect_QRCode_basic, not_found_qrcode)
616
653
{
617
654
std::vector<Point> corners;
0 commit comments