本文整理汇总了C++中BoardDetector::set_repj_err_thres方法的典型用法代码示例。如果您正苦于以下问题:C++ BoardDetector::set_repj_err_thres方法的具体用法?C++ BoardDetector::set_repj_err_thres怎么用?C++ BoardDetector::set_repj_err_thres使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoardDetector
的用法示例。
在下文中一共展示了BoardDetector::set_repj_err_thres方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
try {
if (readArguments(argc, argv) == false)
return 0;
// parse arguments
TheBoardConfig.readFromFile(TheBoardConfigFile);
// read from camera or from file
if (TheInputVideo == "live") {
TheVideoCapturer.open(0);
waitTime = 10;
} else
TheVideoCapturer.open(TheInputVideo);
// check video is open
if (!TheVideoCapturer.isOpened()) {
cerr << "Could not open video" << endl;
return -1;
}
// read first image to get the dimensions
TheVideoCapturer >> TheInputImage;
// Open outputvideo
if (TheOutVideoFilePath != "")
VWriter.open(TheOutVideoFilePath, CV_FOURCC('M', 'J', 'P', 'G'), 15, TheInputImage.size());
// read camera parameters if passed
if (TheIntrinsicFile != "") {
TheCameraParameters.readFromXMLFile(TheIntrinsicFile);
TheCameraParameters.resize(TheInputImage.size());
}
// Create gui
cv::namedWindow("thres", 1);
cv::namedWindow("in", 1);
TheBoardDetector.setParams(TheBoardConfig, TheCameraParameters, TheMarkerSize);
TheBoardDetector.getMarkerDetector().getThresholdParams(ThresParam1, ThresParam2);
TheBoardDetector.getMarkerDetector().setCornerRefinementMethod(MarkerDetector::HARRIS);
TheBoardDetector.set_repj_err_thres(1.5);
// TheBoardDetector.getMarkerDetector().enableErosion(true);//for chessboards
iThresParam1 = ThresParam1;
iThresParam2 = ThresParam2;
cv::createTrackbar("ThresParam1", "in", &iThresParam1, 13, cvTackBarEvents);
cv::createTrackbar("ThresParam2", "in", &iThresParam2, 13, cvTackBarEvents);
char key = 0;
int index = 0;
// capture until press ESC or until the end of the video
do {
TheVideoCapturer.retrieve(TheInputImage);
TheInputImage.copyTo(TheInputImageCopy);
index++; // number of images captured
double tick = (double)getTickCount(); // for checking the speed
// Detection of the board
float probDetect = TheBoardDetector.detect(TheInputImage);
// chekc the speed by calculating the mean speed of all iterations
AvrgTime.first += ((double)getTickCount() - tick) / getTickFrequency();
AvrgTime.second++;
cout << "Time detection=" << 1000 * AvrgTime.first / AvrgTime.second << " milliseconds" << endl;
// print marker borders
for (unsigned int i = 0; i < TheBoardDetector.getDetectedMarkers().size(); i++)
TheBoardDetector.getDetectedMarkers()[i].draw(TheInputImageCopy, Scalar(0, 0, 255), 1);
// print board
if (TheCameraParameters.isValid()) {
if (probDetect > 0.2) {
CvDrawingUtils::draw3dAxis(TheInputImageCopy, TheBoardDetector.getDetectedBoard(),
TheCameraParameters);
// CvDrawingUtils::draw3dCube(TheInputImageCopy,
// TheBoardDetector.getDetectedBoard(),TheCameraParameters);
// draw3dBoardCube(
// TheInputImageCopy,TheBoardDetected,TheIntriscCameraMatrix,TheDistorsionCameraParams);
}
}
// DONE! Easy, right?
// show input with augmented information and the thresholded image
cv::imshow("in", TheInputImageCopy);
cv::imshow("thres", TheBoardDetector.getMarkerDetector().getThresholdedImage());
// write to video if required
if (TheOutVideoFilePath != "") {
// create a beautiful compiosed image showing the thresholded
// first create a small version of the thresholded image
cv::Mat smallThres;
cv::resize(TheBoardDetector.getMarkerDetector().getThresholdedImage(), smallThres,
cvSize(TheInputImageCopy.cols / 3, TheInputImageCopy.rows / 3));
cv::Mat small3C;
cv::cvtColor(smallThres, small3C, CV_GRAY2BGR);
cv::Mat roi = TheInputImageCopy(
cv::Rect(0, 0, TheInputImageCopy.cols / 3, TheInputImageCopy.rows / 3));
small3C.copyTo(roi);
VWriter << TheInputImageCopy;
// cv::imshow("TheInputImageCopy",TheInputImageCopy);
}
key = cv::waitKey(waitTime); // wait for key to be pressed
processKey(key);
} while (key != 27 && TheVideoCapturer.grab());
} catch (std::exception& ex)
//.........这里部分代码省略.........