mirror of
https://github.com/opencv/opencv.git
synced 2024-12-18 03:18:01 +08:00
Merge pull request #22146 from rogday:symcircles
This commit is contained in:
commit
163770f99a
@ -21,7 +21,7 @@ namespace calib
|
|||||||
|
|
||||||
enum InputType { Video, Pictures };
|
enum InputType { Video, Pictures };
|
||||||
enum InputVideoSource { Camera, File };
|
enum InputVideoSource { Camera, File };
|
||||||
enum TemplateType { AcirclesGrid, Chessboard, chAruco, DoubleAcirclesGrid };
|
enum TemplateType { AcirclesGrid, Chessboard, chAruco, DoubleAcirclesGrid, CirclesGrid };
|
||||||
|
|
||||||
static const std::string mainWindowName = "Calibration";
|
static const std::string mainWindowName = "Calibration";
|
||||||
static const std::string gridWindowName = "Board locations";
|
static const std::string gridWindowName = "Board locations";
|
||||||
|
@ -108,6 +108,16 @@ bool CalibProcessor::detectAndParseChAruco(const cv::Mat &frame)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CalibProcessor::detectAndParseCircles(const cv::Mat &frame)
|
||||||
|
{
|
||||||
|
bool isTemplateFound = findCirclesGrid(frame, mBoardSize, mCurrentImagePoints, cv::CALIB_CB_SYMMETRIC_GRID, mBlobDetectorPtr);
|
||||||
|
if(isTemplateFound) {
|
||||||
|
mTemplateLocations.insert(mTemplateLocations.begin(), mCurrentImagePoints[0]);
|
||||||
|
cv::drawChessboardCorners(frame, mBoardSize, cv::Mat(mCurrentImagePoints), isTemplateFound);
|
||||||
|
}
|
||||||
|
return isTemplateFound;
|
||||||
|
}
|
||||||
|
|
||||||
bool CalibProcessor::detectAndParseACircles(const cv::Mat &frame)
|
bool CalibProcessor::detectAndParseACircles(const cv::Mat &frame)
|
||||||
{
|
{
|
||||||
bool isTemplateFound = findCirclesGrid(frame, mBoardSize, mCurrentImagePoints, cv::CALIB_CB_ASYMMETRIC_GRID, mBlobDetectorPtr);
|
bool isTemplateFound = findCirclesGrid(frame, mBoardSize, mCurrentImagePoints, cv::CALIB_CB_ASYMMETRIC_GRID, mBlobDetectorPtr);
|
||||||
@ -160,6 +170,14 @@ void CalibProcessor::saveFrameData()
|
|||||||
mCalibData->allCharucoCorners.push_back(mCurrentCharucoCorners);
|
mCalibData->allCharucoCorners.push_back(mCurrentCharucoCorners);
|
||||||
mCalibData->allCharucoIds.push_back(mCurrentCharucoIds);
|
mCalibData->allCharucoIds.push_back(mCurrentCharucoIds);
|
||||||
break;
|
break;
|
||||||
|
case CirclesGrid:
|
||||||
|
objectPoints.reserve(mBoardSize.height*mBoardSize.width);
|
||||||
|
for( int i = 0; i < mBoardSize.height; i++ )
|
||||||
|
for( int j = 0; j < mBoardSize.width; j++ )
|
||||||
|
objectPoints.push_back(cv::Point3f(j*mSquareSize, i*mSquareSize, 0));
|
||||||
|
mCalibData->imagePoints.push_back(mCurrentImagePoints);
|
||||||
|
mCalibData->objectPoints.push_back(objectPoints);
|
||||||
|
break;
|
||||||
case AcirclesGrid:
|
case AcirclesGrid:
|
||||||
objectPoints.reserve(mBoardSize.height*mBoardSize.width);
|
objectPoints.reserve(mBoardSize.height*mBoardSize.width);
|
||||||
for( int i = 0; i < mBoardSize.height; i++ )
|
for( int i = 0; i < mBoardSize.height; i++ )
|
||||||
@ -288,6 +306,7 @@ CalibProcessor::CalibProcessor(cv::Ptr<calibrationData> data, captureParameters
|
|||||||
capParams.charucoMarkerSize, mArucoDictionary);
|
capParams.charucoMarkerSize, mArucoDictionary);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
case CirclesGrid:
|
||||||
case AcirclesGrid:
|
case AcirclesGrid:
|
||||||
mBlobDetectorPtr = cv::SimpleBlobDetector::create();
|
mBlobDetectorPtr = cv::SimpleBlobDetector::create();
|
||||||
break;
|
break;
|
||||||
@ -318,6 +337,9 @@ cv::Mat CalibProcessor::processFrame(const cv::Mat &frame)
|
|||||||
case chAruco:
|
case chAruco:
|
||||||
isTemplateFound = detectAndParseChAruco(frameCopy);
|
isTemplateFound = detectAndParseChAruco(frameCopy);
|
||||||
break;
|
break;
|
||||||
|
case CirclesGrid:
|
||||||
|
isTemplateFound = detectAndParseCircles(frameCopy);
|
||||||
|
break;
|
||||||
case AcirclesGrid:
|
case AcirclesGrid:
|
||||||
isTemplateFound = detectAndParseACircles(frameCopy);
|
isTemplateFound = detectAndParseACircles(frameCopy);
|
||||||
break;
|
break;
|
||||||
|
@ -55,6 +55,7 @@ protected:
|
|||||||
|
|
||||||
bool detectAndParseChessboard(const cv::Mat& frame);
|
bool detectAndParseChessboard(const cv::Mat& frame);
|
||||||
bool detectAndParseChAruco(const cv::Mat& frame);
|
bool detectAndParseChAruco(const cv::Mat& frame);
|
||||||
|
bool detectAndParseCircles(const cv::Mat& frame);
|
||||||
bool detectAndParseACircles(const cv::Mat& frame);
|
bool detectAndParseACircles(const cv::Mat& frame);
|
||||||
bool detectAndParseDualACircles(const cv::Mat& frame);
|
bool detectAndParseDualACircles(const cv::Mat& frame);
|
||||||
void saveFrameData();
|
void saveFrameData();
|
||||||
|
@ -30,7 +30,7 @@ const std::string keys =
|
|||||||
"{v | | Input from video file }"
|
"{v | | Input from video file }"
|
||||||
"{ci | 0 | Default camera id }"
|
"{ci | 0 | Default camera id }"
|
||||||
"{flip | false | Vertical flip of input frames }"
|
"{flip | false | Vertical flip of input frames }"
|
||||||
"{t | circles | Template for calibration (circles, chessboard, dualCircles, charuco) }"
|
"{t | circles | Template for calibration (circles, chessboard, dualCircles, charuco, symcircles) }"
|
||||||
"{sz | 16.3 | Distance between two nearest centers of circles or squares on calibration board}"
|
"{sz | 16.3 | Distance between two nearest centers of circles or squares on calibration board}"
|
||||||
"{dst | 295 | Distance between white and black parts of daulCircles template}"
|
"{dst | 295 | Distance between white and black parts of daulCircles template}"
|
||||||
"{w | | Width of template (in corners or circles)}"
|
"{w | | Width of template (in corners or circles)}"
|
||||||
|
@ -108,7 +108,11 @@ bool calib::parametersController::loadFromParser(cv::CommandLineParser &parser)
|
|||||||
|
|
||||||
std::string templateType = parser.get<std::string>("t");
|
std::string templateType = parser.get<std::string>("t");
|
||||||
|
|
||||||
if(templateType.find("circles", 0) == 0) {
|
if(templateType.find("symcircles", 0) == 0) {
|
||||||
|
mCapParams.board = CirclesGrid;
|
||||||
|
mCapParams.boardSize = cv::Size(4, 11);
|
||||||
|
}
|
||||||
|
else if(templateType.find("circles", 0) == 0) {
|
||||||
mCapParams.board = AcirclesGrid;
|
mCapParams.board = AcirclesGrid;
|
||||||
mCapParams.boardSize = cv::Size(4, 11);
|
mCapParams.boardSize = cv::Size(4, 11);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user