Commit 79ddc32e authored by baisheng lai's avatar baisheng lai

rename files

parent 27609c12
......@@ -42,15 +42,16 @@
#ifndef __OPENCV_MULTICAMERACALIBRATION_HPP__
#define __OPENCV_MULTICAMERACALIBRATION_HPP__
#include "opencv2/ccalib/randomPatten.hpp"
#include "opencv2/ccalib/randpattern.hpp"
#include "opencv2/ccalib/omnidir.hpp"
#include <string>
#include <iostream>
namespace cv { namespace multicalib {
/** @defgroup mulcalib Multiple cameras calibration toolbox
*/
using namespace cv;
//! @addtogroup mulcalib
//! @{
......@@ -72,7 +73,7 @@ For more details, please refer to paper
Pattern", in IROS 2013.
*/
class CV_EXPORTS multiCameraCalibration
class CV_EXPORTS MultiCameraCalibration
{
public:
enum {
......@@ -132,7 +133,7 @@ public:
@descriptor feature descriptor.
@matcher feature matcher.
*/
multiCameraCalibration(int cameraType, int nCameras, const std::string& fileName, float patternWidth,
MultiCameraCalibration(int cameraType, int nCameras, const std::string& fileName, float patternWidth,
float patternHeight, int verbose = 0, int showExtration = 0, int nMiniMatches = 20, int flags = 0,
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 200, 1e-7),
Ptr<FeatureDetector> detector = AKAZE::create(AKAZE::DESCRIPTOR_MLDB, 0, 3, 0.006f),
......@@ -210,4 +211,6 @@ private:
};
//! @}
}} // namespace multicalib, cv
#endif
\ No newline at end of file
......@@ -45,14 +45,14 @@
#include "opencv2/features2d.hpp"
#include "opencv2/highgui.hpp"
namespace cv { namespace randpattern {
/** @defgroup ranPattern Random pattern calibration pattern
*/
using namespace cv;
/** @brief Class for finding features points and corresponding 3D in world coordinate of
a "random" pattern, which can be to be used in calibration. It is useful when pattern is
partly occluded or only a part of pattern can be observed in multiple cameras calibration.
The pattern can be generated by randomPatternGenerator class described in this file.
The pattern can be generated by RandomPatternGenerator class described in this file.
Please refer to paper
B. Li, L. Heng, K. Kevin and M. Pollefeys, "A Multiple-Camera System
......@@ -63,11 +63,11 @@ Please refer to paper
//! @addtogroup ranPattern
//! @{
class CV_EXPORTS randomPatternCornerFinder
class CV_EXPORTS RandomPatternCornerFinder
{
public:
/* @brief Construct randomPatternCalibration object
/* @brief Construct RandomPatternCornerFinder object
@param patternWidth the real width of "random" pattern in a user defined unit.
@param patternHeight the real height of "random" pattern in a user defined unit.
......@@ -78,14 +78,14 @@ public:
@descriptor feature descriptor.
@matcher feature matcher.
*/
randomPatternCornerFinder(float patternWidth, float patternHeight,
RandomPatternCornerFinder(float patternWidth, float patternHeight,
int nminiMatch = 20, int depth = CV_32F, int verbose = 0, int showExtraction = 0,
Ptr<FeatureDetector> detector = AKAZE::create(AKAZE::DESCRIPTOR_MLDB, 0, 3, 0.005f),
Ptr<DescriptorExtractor> descriptor = AKAZE::create(AKAZE::DESCRIPTOR_MLDB,0, 3, 0.005f),
Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create("BruteForce-L1"));
/* @brief Load pattern image and compute features for pattern
@param patternImage image for "random" pattern generated by randomPatternGenerator, run it first.
@param patternImage image for "random" pattern generated by RandomPatternGenerator, run it first.
*/
void loadPattern(cv::Mat patternImage);
......@@ -145,21 +145,21 @@ private:
const Mat& mask1, const Mat& mask2, const int step);
};
/* @brief Class to generate "random" pattern image that are used for randomPatternCornerFinder
/* @brief Class to generate "random" pattern image that are used for RandomPatternCornerFinder
Please refer to paper
B. Li, L. Heng, K. Kevin and M. Pollefeys, "A Multiple-Camera System
Calibration Toolbox Using A Feature Descriptor-Based Calibration
Pattern", in IROS 2013.
*/
class randomPatternGenerator
class RandomPatternGenerator
{
public:
/* @brief Construct randomPatternGenerator
/* @brief Construct RandomPatternGenerator
@param imageWidth image width of the generated pattern image
@param imageHeight image height of the generated pattern image
*/
randomPatternGenerator(int imageWidth, int imageHeight);
RandomPatternGenerator(int imageWidth, int imageHeight);
/* @brief Generate pattern
*/
......@@ -174,4 +174,5 @@ private:
//! @}
}} //namespace randpattern, cv
#endif
\ No newline at end of file
#include "opencv2/ccalib/omnidir.hpp"
#include "opencv2/ccalib/multiCameraCalibration.hpp"
#include "opencv2/ccalib/randomPatten.hpp"
#include "opencv2/ccalib/multicalib.hpp"
#include "opencv2/ccalib/randpattern.hpp"
using namespace std;
using namespace cv;
const char * usage =
"\n example command line for multi-camera calibration by using random pattern \n"
" multiCamCalib -nc 5 -pw 800 -ph 600 -ct 1 -fe 0 -nm 25 -v 0 multi_camera_omnidir.xml \n"
" multi_cameras_calibration -nc 5 -pw 800 -ph 600 -ct 1 -fe 0 -nm 25 -v 0 multi_camera_omnidir.xml \n"
"\n"
" the file multi_camera_omnidir.xml is generated by imagelist_creator as \n"
" imagelist_creator multi_camera_omnidir.xml *.* \n"
......@@ -108,7 +108,7 @@ int main(int argc, char** argv)
}
// do multi-camera calibration
multiCameraCalibration multiCalib(cameraType, nCamera, inputFilename, patternWidth, patternHeight, verbose, showFeatureExtraction, nMiniMatches);
multicalib::MultiCameraCalibration multiCalib(cameraType, nCamera, inputFilename, patternWidth, patternHeight, verbose, showFeatureExtraction, nMiniMatches);
multiCalib.loadImages();
multiCalib.initialize();
......
......@@ -13,7 +13,7 @@ using namespace std;
const char * usage =
"\n example command line for omnidirectional camera calibration.\n"
" omniCalibration -w 6 -h 9 -sw 80 -sh 80 imagelist.xml \n"
" omni_calibration -w 6 -h 9 -sw 80 -sh 80 imagelist.xml \n"
" \n"
" the file imagelist.xml is generated by imagelist_creator as\n"
"imagelist_creator imagelist.xml *.*";
......@@ -21,7 +21,7 @@ const char * usage =
static void help()
{
printf("\n This is a sample for omnidirectional camera calibration.\n"
"Usage: omniCalibration\n"
"Usage: omni_calibration\n"
" -w <board_width> # the number of inner corners per one of board dimension\n"
" -h <board_height> # the number of inner corners per another board dimension\n"
" [-sw <square_width>] # the width of square in some user-defined units (1 by default)\n"
......@@ -153,6 +153,8 @@ static void saveCameraParams( const string & filename, Size imageSize, Size boar
fs << "extrinsic_parameters" << rvec_tvec;
}
fs << "rms" << rms;
if ( !imagePoints.empty() )
{
Mat imageMat((int)imagePoints.size(), (int)imagePoints[0].total(), CV_64FC2);
......
......@@ -13,7 +13,7 @@ using namespace std;
const char * usage =
"\n example command line for calibrate a pair of omnidirectional camera.\n"
" omniStereoCalibration -w 8 -h 6 -sw 2.4399 -sh 2.4399 imagelist_left.xml imagelist_right.xml\n"
" omni_stereo_calibration -w 8 -h 6 -sw 2.4399 -sh 2.4399 imagelist_left.xml imagelist_right.xml\n"
" \n"
" the file image_list_1.xml and image_list_2.xml generated by imagelist_creator as\n"
"imagelist_creator image_list_1.xml *.*";
......@@ -21,7 +21,7 @@ const char * usage =
static void help()
{
printf("\n This is a sample for omnidirectional camera calibration.\n"
"Usage: omniCalibration\n"
"Usage: omni_calibration\n"
" -w <board_width> # the number of inner corners per one of board dimension\n"
" -h <board_height> # the number of inner corners per another board dimension\n"
" [-sw <square_width>] # the width of square in some user-defined units (1 by default)\n"
......@@ -170,6 +170,8 @@ static void saveCameraParams( const string & filename, const int flags, const Ma
fs << "extrinsic_parameters_1" << rvec_tvec;
}
fs << "rms" << rms;
//cvWriteComment( *fs, "names of images that are acturally used in calibration", 0 );
fs << "used_imgs_1" << "[";
for (int i = 0; i < (int)idx.total(); ++i)
......
#include "opencv2/ccalib/randomPatten.hpp";
#include "opencv2/ccalib/randpattern.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/calib3d.hpp"
......@@ -10,14 +10,14 @@ using namespace cv;
const char * usage =
"\n example command line for calibrate a camera by random pattern. \n"
" randomPatternCalibration -pw 600 -ph 850 -mm 20 image_list.xml \n"
" random_pattern_calibration -pw 600 -ph 850 -mm 20 image_list.xml \n"
"\n"
" the file image_list.xml is generated by imagelist_creator as\n"
"imagelist_creator image_list.xml *.*";
static void help()
{
printf("\n This is a sample for camera calibration by a random pattern.\n"
"Usage: randomPatternCalibration\n"
"Usage: random_pattern_calibration\n"
" -pw <pattern_width> # the physical width of random pattern\n"
" -ph <pattern_height> # the physical height of random pattern\n"
" -mm <minimal_match> # minimal number of matches\n"
......@@ -147,7 +147,7 @@ int main(int argc, char** argv)
vecImg.push_back(img);
}
randomPatternCornerFinder finder(patternWidth, patternHeight, nMiniMatches);
randpattern::RandomPatternCornerFinder finder(patternWidth, patternHeight, nMiniMatches);
finder.loadPattern(pattern);
finder.computeObjectImagePoints(vecImg);
vector<Mat> objectPoints = finder.getObjectPoints();
......
#include "opencv2/ccalib/randomPatten.hpp";
#include "opencv2/ccalib/randpattern.hpp"
using namespace cv;
const char * usage =
"\n example command line for generating a random pattern. \n"
" randomPatternGenerator -iw 600 -ih 850 pattern.png\n"
" random_patterng_generator -iw 600 -ih 850 pattern.png\n"
"\n";
static void help()
{
printf("\n This is a sample for generating a random pattern that can be used for calibration.\n"
"Usage: randomPatternGenerator\n"
"Usage: random_patterng_generator\n"
" -iw <image_width> # the width of pattern image\n"
" -ih <image_height> # the height of pattern image\n"
" filename # the filename for pattern image \n"
......@@ -50,7 +52,7 @@ int main(int argc, char** argv)
}
}
randomPatternGenerator generator(width, height);
randpattern::RandomPatternGenerator generator(width, height);
generator.generatePattern();
pattern = generator.getPattern();
imwrite(filename, pattern);
......
......@@ -1009,7 +1009,7 @@ void cv::omnidir::internal::computeJacobianStereo(InputArrayOfArrays objectPoint
JTE = J.t()*exAll;
subMatrix(JTJ, JTJ, _idx, _idx);
subMatrix(JTE, JTE, std::vector<int>(1, 1), _idx);
JTJ_inv = Mat(JTJ+epsilon).inv();
}
......@@ -1058,72 +1058,6 @@ void cv::omnidir::internal::compose_motion(InputArray _om1, InputArray _T1, Inpu
dT3dom1 = Mat::zeros(3, 3, CV_64FC1);
}
// This function is from fisheye.cpp
//void cv::omnidir::internal::JRodriguesMatlab(const Mat& src, Mat& dst)
//{
// Mat tmp(src.cols, src.rows, src.type());
// if (src.rows == 9)
// {
// Mat(src.row(0).t()).copyTo(tmp.col(0));
// Mat(src.row(1).t()).copyTo(tmp.col(3));
// Mat(src.row(2).t()).copyTo(tmp.col(6));
// Mat(src.row(3).t()).copyTo(tmp.col(1));
// Mat(src.row(4).t()).copyTo(tmp.col(4));
// Mat(src.row(5).t()).copyTo(tmp.col(7));
// Mat(src.row(6).t()).copyTo(tmp.col(2));
// Mat(src.row(7).t()).copyTo(tmp.col(5));
// Mat(src.row(8).t()).copyTo(tmp.col(8));
// }
// else
// {
// Mat(src.col(0).t()).copyTo(tmp.row(0));
// Mat(src.col(1).t()).copyTo(tmp.row(3));
// Mat(src.col(2).t()).copyTo(tmp.row(6));
// Mat(src.col(3).t()).copyTo(tmp.row(1));
// Mat(src.col(4).t()).copyTo(tmp.row(4));
// Mat(src.col(5).t()).copyTo(tmp.row(7));
// Mat(src.col(6).t()).copyTo(tmp.row(2));
// Mat(src.col(7).t()).copyTo(tmp.row(5));
// Mat(src.col(8).t()).copyTo(tmp.row(8));
// }
// dst = tmp.clone();
//}
// This function is from fisheye.cpp
//void cv::omnidir::internal::dAB(InputArray A, InputArray B, OutputArray dABdA, OutputArray dABdB)
//{
// CV_Assert(A.getMat().cols == B.getMat().rows);
// CV_Assert(A.type() == CV_64FC1 && B.type() == CV_64FC1);
//
// int p = A.getMat().rows;
// int n = A.getMat().cols;
// int q = B.getMat().cols;
//
// dABdA.create(p * q, p * n, CV_64FC1);
// dABdB.create(p * q, q * n, CV_64FC1);
//
// dABdA.getMat() = Mat::zeros(p * q, p * n, CV_64FC1);
// dABdB.getMat() = Mat::zeros(p * q, q * n, CV_64FC1);
//
// for (int i = 0; i < q; ++i)
// {
// for (int j = 0; j < p; ++j)
// {
// int ij = j + i * p;
// for (int k = 0; k < n; ++k)
// {
// int kj = j + k * p;
// dABdA.getMat().at<double>(ij, kj) = B.getMat().at<double>(k, i);
// }
// }
// }
//
// for (int i = 0; i < q; ++i)
// {
// A.getMat().copyTo(dABdB.getMat().rowRange(i * p, i * p + p).colRange(i * n, i * n + n));
// }
//}
double cv::omnidir::calibrate(InputArray patternPoints, InputArray imagePoints, Size size,
InputOutputArray K, InputOutputArray xi, InputOutputArray D, OutputArrayOfArrays omAll, OutputArrayOfArrays tAll,
int flags, TermCriteria criteria, OutputArray idx)
......
......@@ -53,11 +53,12 @@
* Pattern", in IROS 2013.
*/
#include "precomp.hpp"
#include "opencv2/ccalib/randomPatten.hpp"
#include "opencv2/ccalib/randpattern.hpp"
#include <iostream>
using namespace cv;
using namespace std;
randomPatternCornerFinder::randomPatternCornerFinder(float patternWidth, float patternHeight,
namespace cv { namespace randpattern {
RandomPatternCornerFinder::RandomPatternCornerFinder(float patternWidth, float patternHeight,
int nminiMatch, int depth, int verbose, int showExtraction, Ptr<FeatureDetector> detector, Ptr<DescriptorExtractor> descriptor,
Ptr<DescriptorMatcher> matcher)
{
......@@ -74,91 +75,7 @@ randomPatternCornerFinder::randomPatternCornerFinder(float patternWidth, float p
_verbose = verbose;
}
//void randomPatternCornerFinder::computeObjectImagePoints2(std::vector<cv::Mat> inputImages)
//{
// int nImag = (int)inputImages.size();
//
// Mat descriptorPattern = _descriptorPattern;
// std::vector<cv::KeyPoint> keypointsPattern = _keypointsPattern;
// Mat keypointsPatternLocation;
//
// //Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create("BruteForce-L1");
// for (int i = 0; i < nImag; ++i)
// {
// CV_Assert(inputImages[i].type() == CV_8UC1);
//
// Mat image = inputImages[i], imageEquHist;
// equalizeHist(image, imageEquHist);
//
// // key points for image
// std::vector<cv::KeyPoint> keypointsImage, keypointsImage1, keypointsImage2;
// Mat keypointsImageLocation;
// Mat descriptorImage, descriptorImage1, descriptorImage2;
//
// _detector->detect(image, keypointsImage1);
// _detector->detect(imageEquHist, keypointsImage2);
// _descriptor->compute(image, keypointsImage1, descriptorImage1);
// _descriptor->compute(imageEquHist, keypointsImage2, descriptorImage2);
//
// // only CV_32F type is support for match
// descriptorImage1.convertTo(descriptorImage1, CV_32F);
// descriptorImage2.convertTo(descriptorImage2, CV_32F);
//
// // match with pattern
// std::vector<DMatch> matchesImgtoPat, matchesImgtoPat1, matchesImgtoPat2;
//
// crossCheckMatching(this->_matcher, descriptorImage1, descriptorPattern, matchesImgtoPat1, 1);
// crossCheckMatching(this->_matcher, descriptorImage2, descriptorPattern, matchesImgtoPat2, 1);
//
// if ((int)matchesImgtoPat1.size() > (int)matchesImgtoPat2.size())
// {
// matchesImgtoPat = matchesImgtoPat1;
// keypointsImage = keypointsImage1;
// }
// else
// {
// matchesImgtoPat = matchesImgtoPat2;
// keypointsImage = keypointsImage2;
// }
//
// keyPoints2MatchedLocation(keypointsImage, keypointsPattern, matchesImgtoPat,
// keypointsImageLocation, keypointsPatternLocation);
//
// Mat img_corr;
//
// // innerMask is CV_8U type
// Mat innerMask1, innerMask2;
//
// // draw raw correspondence
// if (this->_showExtraction)
// {
// drawCorrespondence(inputImages[i], keypointsImage, this->_patternImage, keypointsPattern, matchesImgtoPat,
// innerMask1, innerMask2);
// }
//
// // outlier remove
// findFundamentalMat(keypointsImageLocation, keypointsPatternLocation,
// FM_7POINT, 1, 0.99, innerMask1);
// getFilteredLocation(keypointsImageLocation, keypointsPatternLocation, innerMask1);
//
// findHomography(keypointsImageLocation, keypointsPatternLocation, RANSAC, 3, innerMask2);
// getFilteredLocation(keypointsImageLocation, keypointsPatternLocation, innerMask2);
//
// // draw filtered correspondence
// if (this->_showExtraction)
// {
// drawCorrespondence(inputImages[i], keypointsImage, this->_patternImage, keypointsPattern, matchesImgtoPat,
// innerMask1, innerMask2);
// }
//
// if((int)keypointsImageLocation.total() > _nminiMatch)
// {
// getObjectImagePoints(keypointsImageLocation, keypointsPatternLocation);
// }
// }
//}
void randomPatternCornerFinder::computeObjectImagePoints(std::vector<cv::Mat> inputImages)
void RandomPatternCornerFinder::computeObjectImagePoints(std::vector<cv::Mat> inputImages)
{
CV_Assert(!_patternImage.empty());
CV_Assert(inputImages.size() > 0);
......@@ -176,7 +93,7 @@ void randomPatternCornerFinder::computeObjectImagePoints(std::vector<cv::Mat> in
}
}
void randomPatternCornerFinder::keyPoints2MatchedLocation(const std::vector<cv::KeyPoint>& imageKeypoints,
void RandomPatternCornerFinder::keyPoints2MatchedLocation(const std::vector<cv::KeyPoint>& imageKeypoints,
const std::vector<cv::KeyPoint>& patternKeypoints, const std::vector<cv::DMatch> matchces,
cv::Mat& matchedImagelocation, cv::Mat& matchedPatternLocation)
{
......@@ -194,7 +111,7 @@ void randomPatternCornerFinder::keyPoints2MatchedLocation(const std::vector<cv::
Mat(pattern).convertTo(matchedPatternLocation, CV_64FC2);
}
void randomPatternCornerFinder::getFilteredLocation(cv::Mat& imageKeypoints, cv::Mat& patternKeypoints, const cv::Mat mask)
void RandomPatternCornerFinder::getFilteredLocation(cv::Mat& imageKeypoints, cv::Mat& patternKeypoints, const cv::Mat mask)
{
Mat tmpKeypoint, tmpPattern;
imageKeypoints.copyTo(tmpKeypoint);
......@@ -214,7 +131,7 @@ void randomPatternCornerFinder::getFilteredLocation(cv::Mat& imageKeypoints, cv:
Mat(vecPattern).convertTo(patternKeypoints, CV_64FC2);
}
void randomPatternCornerFinder::getObjectImagePoints(const cv::Mat& imageKeypoints, const cv::Mat& patternKeypoints)
void RandomPatternCornerFinder::getObjectImagePoints(const cv::Mat& imageKeypoints, const cv::Mat& patternKeypoints)
{
Mat imagePoints_i, objectPoints_i;
int imagePointsType = CV_MAKETYPE(_depth, 2);
......@@ -239,7 +156,7 @@ void randomPatternCornerFinder::getObjectImagePoints(const cv::Mat& imageKeypoin
_objectPonits.push_back(objectPoints_i);
}
void randomPatternCornerFinder::crossCheckMatching( Ptr<DescriptorMatcher>& descriptorMatcher,
void RandomPatternCornerFinder::crossCheckMatching( Ptr<DescriptorMatcher>& descriptorMatcher,
const Mat& descriptors1, const Mat& descriptors2,
std::vector<DMatch>& filteredMatches12, int knn )
{
......@@ -269,7 +186,7 @@ void randomPatternCornerFinder::crossCheckMatching( Ptr<DescriptorMatcher>& desc
}
}
void randomPatternCornerFinder::drawCorrespondence(const Mat& image1, const std::vector<cv::KeyPoint> keypoint1,
void RandomPatternCornerFinder::drawCorrespondence(const Mat& image1, const std::vector<cv::KeyPoint> keypoint1,
const Mat& image2, const std::vector<cv::KeyPoint> keypoint2, const std::vector<cv::DMatch> matchces,
const Mat& mask1, const Mat& mask2, const int step)
{
......@@ -311,17 +228,17 @@ void randomPatternCornerFinder::drawCorrespondence(const Mat& image1, const std:
waitKey(0);
}
std::vector<cv::Mat> randomPatternCornerFinder::getObjectPoints()
std::vector<cv::Mat> RandomPatternCornerFinder::getObjectPoints()
{
return _objectPonits;
}
std::vector<cv::Mat> randomPatternCornerFinder::getImagePoints()
std::vector<cv::Mat> RandomPatternCornerFinder::getImagePoints()
{
return _imagePoints;
}
void randomPatternCornerFinder::loadPattern(cv::Mat patternImage)
void RandomPatternCornerFinder::loadPattern(cv::Mat patternImage)
{
_patternImage = patternImage.clone();
if (_patternImage.type()!= CV_8U)
......@@ -332,7 +249,7 @@ void randomPatternCornerFinder::loadPattern(cv::Mat patternImage)
_descriptorPattern.convertTo(_descriptorPattern, CV_32F);
}
std::vector<cv::Mat> randomPatternCornerFinder::computeObjectImagePointsForSingle(cv::Mat inputImage)
std::vector<cv::Mat> RandomPatternCornerFinder::computeObjectImagePointsForSingle(cv::Mat inputImage)
{
CV_Assert(!_patternImage.empty());
std::vector<cv::Mat> r(2);
......@@ -435,13 +352,13 @@ std::vector<cv::Mat> randomPatternCornerFinder::computeObjectImagePointsForSingl
return r;
}
randomPatternGenerator::randomPatternGenerator(int imageWidth, int imageHeight)
RandomPatternGenerator::RandomPatternGenerator(int imageWidth, int imageHeight)
{
_imageWidth = imageWidth;
_imageHeight = imageHeight;
}
void randomPatternGenerator::generatePattern()
void RandomPatternGenerator::generatePattern()
{
Mat pattern = Mat(_imageHeight, _imageWidth, CV_32F, Scalar(0.));
......@@ -464,15 +381,15 @@ void randomPatternGenerator::generatePattern()
count += 1;
m *= 2;
}
std::cout << pattern.at<float>(0,1) << std::endl;
pattern = pattern / count * 255;
pattern.convertTo(pattern, CV_8U);
std::cout << pattern.at<uchar>(0,1) << std::endl;
equalizeHist(pattern, pattern);
pattern.copyTo(_pattern);
}
cv::Mat randomPatternGenerator::getPattern()
cv::Mat RandomPatternGenerator::getPattern()
{
return _pattern;
}
\ No newline at end of file
}
}} //namespace randpattern, cv
\ No newline at end of file
......@@ -10,17 +10,17 @@ The random pattern is an image that is randomly generated. It is "random" so tha
![image](img/random_pattern.jpg)
![image](img/pattern_img.jpg)
To generate a random pattern, use the class ```cv::randomPatternGenerator``` in ```ccalib``` module. Run it as
To generate a random pattern, use the class ```cv::randpattern::RandomPatternGenerator``` in ```ccalib``` module. Run it as
```
randomPatternGenerator generator(width, height);
cv::randpattern::RandomPatternGenerator generator(width, height);
generator.generatePattern();
pattern = generator.getPattern();
```
Here ```width``` and ```height``` are width and height of pattern image. After getting the pattern, print it out and take some photos of it.
Now we can use these images to calibrate camera. First, ```objectPoints``` and ```imagePoints``` need to be detected. Use class ```randomPatternCornerFinder``` to detect them. A sample code can be
Now we can use these images to calibrate camera. First, ```objectPoints``` and ```imagePoints``` need to be detected. Use class ```cv::randpattern::RandomPatternCornerFinder``` to detect them. A sample code can be
```
randomPatternCornerFinder finder(patternWidth, patternHeight, nMiniMatches);
cv::randpattern::RandomPatternCornerFinder finder(patternWidth, patternHeight, nMiniMatches);
finder.loadPattern(pattern);
finder.computeObjectImagePoints(vecImg);
vector<Mat> objectPoints = finder.getObjectPoints();
......@@ -38,8 +38,8 @@ To calibrate multiple cameras, we first need to take some photos of random patte
Then, we can run multiple cameras calibration as
```
multiCameraCalibration multiCalib(cameraType, nCamera, inputFilename,patternWidth, patternHeight, showFeatureExtraction, nMiniMatches);
cv::multicalib::MultiCameraCalibration multiCalib(cameraType, nCamera, inputFilename,patternWidth, patternHeight, showFeatureExtraction, nMiniMatches);
multiCalib.run();
multiCalib.writeParameters(outputFilename);
```
Here ```cameraType``` indicates the camera type, ```multiCameraCalibration::PINHOLE``` and ```multiCameraCalibration::OMNIDIRECTIONAL``` are supported. For omnidirectional camera, you can refer to ```cv::omnidir``` module for detail. ```nCamera``` is the number of camers. ```inputFilename``` is the name of a file generated by ```imagelist_creator``` from ```opencv/sample```. It stores names of random pattern and calibration images, the first file name is the name of random pattern. ```patternWidth``` and ```patternHeight``` are physical width and height of pattern. ```showFeatureExtraction``` is a flags to indicate whether show feature extraction process. ```nMiniMatches``` is a minimal points that should be detected in each frame, otherwise this frame will be abandoned. ```outputFilename``` is a xml file name to store parameters.
Here ```cameraType``` indicates the camera type, ```multicalib::MultiCameraCalibration::PINHOLE``` and ```multicalib::MultiCameraCalibration::OMNIDIRECTIONAL``` are supported. For omnidirectional camera, you can refer to ```cv::omnidir``` module for detail. ```nCamera``` is the number of camers. ```inputFilename``` is the name of a file generated by ```imagelist_creator``` from ```opencv/sample```. It stores names of random pattern and calibration images, the first file name is the name of random pattern. ```patternWidth``` and ```patternHeight``` are physical width and height of pattern. ```showFeatureExtraction``` is a flags to indicate whether show feature extraction process. ```nMiniMatches``` is a minimal points that should be detected in each frame, otherwise this frame will be abandoned. ```outputFilename``` is a xml file name to store parameters.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment