1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2023-07-27 18:38:25 +03:00
151 changed files with 5199 additions and 1111 deletions
@@ -689,4 +689,32 @@ TEST(Charuco, testmatchImagePoints)
}
}
typedef testing::TestWithParam<cv::Size> CharucoBoard;
INSTANTIATE_TEST_CASE_P(/**/, CharucoBoard, testing::Values(Size(3, 2), Size(3, 2), Size(6, 2), Size(2, 6),
Size(3, 4), Size(4, 3), Size(7, 3), Size(3, 7)));
TEST_P(CharucoBoard, testWrongSizeDetection)
{
cv::Size boardSize = GetParam();
ASSERT_FALSE(boardSize.width == boardSize.height);
aruco::CharucoBoard board(boardSize, 1.f, 0.5f, aruco::getPredefinedDictionary(aruco::DICT_4X4_50));
vector<int> detectedCharucoIds, detectedArucoIds;
vector<Point2f> detectedCharucoCorners;
vector<vector<Point2f>> detectedArucoCorners;
Mat boardImage;
board.generateImage(boardSize*40, boardImage);
swap(boardSize.width, boardSize.height);
aruco::CharucoDetector detector(aruco::CharucoBoard(boardSize, 1.f, 0.5f, aruco::getPredefinedDictionary(aruco::DICT_4X4_50)));
// try detect board with wrong size
detector.detectBoard(boardImage, detectedCharucoCorners, detectedCharucoIds, detectedArucoCorners, detectedArucoIds);
// aruco markers must be found
ASSERT_EQ(detectedArucoIds.size(), board.getIds().size());
ASSERT_EQ(detectedArucoCorners.size(), board.getIds().size());
// charuco corners should not be found in board with wrong size
ASSERT_TRUE(detectedCharucoCorners.empty());
ASSERT_TRUE(detectedCharucoIds.empty());
}
}} // namespace
+3
View File
@@ -10,6 +10,9 @@ void check_qr(const string& root, const string& name_current_image, const string
const std::vector<Point>& corners,
const std::vector<string>& decoded_info, const int max_pixel_error,
bool isMulti = false) {
#ifndef HAVE_QUIRC
CV_UNUSED(decoded_info);
#endif
const std::string dataset_config = findDataFile(root + "dataset_config.json");
FileStorage file_config(dataset_config, FileStorage::READ);
ASSERT_TRUE(file_config.isOpened()) << "Can't read validation data: " << dataset_config;
+2 -2
View File
@@ -374,8 +374,8 @@ TEST_P(Objdetect_QRCode_Multi, regression)
qrcode = QRCodeDetectorAruco();
}
std::vector<Point> corners;
#ifdef HAVE_QUIRC
std::vector<cv::String> decoded_info;
#ifdef HAVE_QUIRC
std::vector<Mat> straight_barcode;
EXPECT_TRUE(qrcode.detectAndDecodeMulti(src, decoded_info, corners, straight_barcode));
ASSERT_FALSE(corners.empty());
@@ -538,7 +538,6 @@ TEST(Objdetect_QRCode_detect_flipped, regression_23249)
for(const auto &flipped_image : flipped_images){
const std::string &image_name = flipped_image.first;
const std::string &expect_msg = flipped_image.second;
std::string image_path = findDataFile(root + image_name);
Mat src = imread(image_path);
@@ -551,6 +550,7 @@ TEST(Objdetect_QRCode_detect_flipped, regression_23249)
EXPECT_TRUE(!corners.empty());
std::string decoded_msg;
#ifdef HAVE_QUIRC
const std::string &expect_msg = flipped_image.second;
EXPECT_NO_THROW(decoded_msg = qrcode.decode(src, corners, straight_barcode));
ASSERT_FALSE(straight_barcode.empty()) << "Can't decode qrimage.";
EXPECT_EQ(expect_msg, decoded_msg);