mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
Create Charuco objects only if the selected pattern is a Charuco board. Otherwise it gives the following error:
opencv/modules/objdetect/src/aruco/aruco_board.cpp:543: error: (-215:Assertion failed) size.width > 1 && size.height > 1 && markerLength > 0 && squareLength > markerLength in function 'CharucoBoard'
This commit is contained in:
@@ -540,9 +540,14 @@ int main( int argc, char** argv )
|
||||
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() )
|
||||
{
|
||||
@@ -563,7 +568,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++)
|
||||
{
|
||||
@@ -612,7 +617,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user