1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2026-03-19 09:19:35 +03:00
67 changed files with 1881 additions and 555 deletions
+30 -16
View File
@@ -91,6 +91,7 @@ static void help(char** argv)
" # the calibration grid. If this parameter is specified, a more\n"
" # accurate calibration method will be used which may be better\n"
" # with inaccurate, roughly planar target.\n"
" [-imread-apply-exif-rot] # use this flag to apply the exif orientation when reading images from list\n"
" [input_data] # input data, one of the following:\n"
" # - text file with a list of the images of the board\n"
" # the text file can be generated with imagelist_creator\n"
@@ -409,6 +410,7 @@ int main( int argc, char** argv )
"{oo||}{ws|11|}{dt||}"
"{fx||}{fy||}{cx||}{cy||}"
"{imshow-scale|1|}{enable-k3|0|}"
"{imread-apply-exif-rot||}"
"{@input_data|0|}");
if (parser.has("help"))
{
@@ -498,11 +500,16 @@ int main( int argc, char** argv )
}
int viewScaleFactor = parser.get<int>("imshow-scale");
bool useK3 = parser.get<bool>("enable-k3");
std::cout << "Use K3 distortion coefficient? " << useK3 << std::endl;
std::cout << "Use K3 distortion coefficient? " << (useK3 ? "yes" : "no") << std::endl;
if (!useK3)
{
flags |= CALIB_FIX_K3;
}
int imread_flag = IMREAD_COLOR;
if (!parser.has("imread-apply-exif-rot"))
{
imread_flag |= IMREAD_IGNORE_ORIENTATION;
}
float grid_width = squareSize *(pattern != CHARUCOBOARD ? (boardSize.width - 1): (boardSize.width - 2) );
bool release_object = false;
@@ -530,20 +537,27 @@ int main( int argc, char** argv )
return fprintf( stderr, "Invalid board height\n" ), -1;
cv::aruco::Dictionary dictionary;
if (dictFilename == "None") {
std::cout << "Using predefined dictionary with id: " << arucoDict << std::endl;
dictionary = aruco::getPredefinedDictionary(arucoDict);
}
else {
std::cout << "Using custom dictionary from file: " << dictFilename << std::endl;
cv::FileStorage dict_file(dictFilename, cv::FileStorage::Mode::READ);
cv::FileNode fn(dict_file.root());
dictionary.readDictionary(fn);
if (pattern == CHARUCOBOARD) {
if (dictFilename == "None") {
std::cout << "Using predefined dictionary with id: " << arucoDict << std::endl;
dictionary = aruco::getPredefinedDictionary(arucoDict);
}
else {
std::cout << "Using custom dictionary from file: " << dictFilename << std::endl;
cv::FileStorage dict_file(dictFilename, cv::FileStorage::Mode::READ);
cv::FileNode fn(dict_file.root());
dictionary.readDictionary(fn);
}
}
cv::aruco::CharucoBoard ch_board(boardSize, squareSize, markerSize, dictionary);
cv::Ptr<cv::aruco::CharucoBoard> ch_board;
std::vector<int> markerIds;
cv::aruco::CharucoDetector ch_detector(ch_board);
cv::Ptr<cv::aruco::CharucoDetector> ch_detector;
if (pattern == CHARUCOBOARD) {
ch_board = cv::makePtr<cv::aruco::CharucoBoard>(boardSize, squareSize, markerSize, dictionary);
ch_detector = cv::makePtr<cv::aruco::CharucoDetector>(cv::aruco::CharucoDetector(*ch_board));
}
if( !inputFilename.empty() )
{
@@ -564,7 +578,7 @@ int main( int argc, char** argv )
if( capture.isOpened() )
printf( "%s", liveCaptureHelp );
namedWindow( "Image View", 1 );
namedWindow( "Image View", cv::WINDOW_AUTOSIZE );
for(i = 0;;i++)
{
@@ -578,7 +592,7 @@ int main( int argc, char** argv )
view0.copyTo(view);
}
else if( i < (int)imageList.size() )
view = imread(imageList[i], IMREAD_COLOR);
view = imread(imageList[i], imread_flag);
if(view.empty())
{
@@ -613,7 +627,7 @@ int main( int argc, char** argv )
break;
case CHARUCOBOARD:
{
ch_detector.detectBoard(view, pointbuf, markerIds);
ch_detector->detectBoard(view, pointbuf, markerIds);
found = pointbuf.size() == (size_t)(boardSize.width-1)*(boardSize.height-1);
break;
}
@@ -714,7 +728,7 @@ int main( int argc, char** argv )
for( i = 0; i < (int)imageList.size(); i++ )
{
view = imread(imageList[i], IMREAD_COLOR);
view = imread(imageList[i], imread_flag);
if(view.empty())
continue;
remap(view, rview, map1, map2, INTER_LINEAR);