Commit c433e60a authored by caseymcc's avatar caseymcc

Allow setting the features on the RandomPatternCornerFinder (from previous run)

parent 8bb92ce2
...@@ -86,7 +86,14 @@ public: ...@@ -86,7 +86,14 @@ public:
/* @brief Load pattern image and compute features for pattern /* @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); void loadPattern(const cv::Mat &patternImage);
/* @brief Load pattern and features
@param patternImage image for "random" pattern generated by RandomPatternGenerator, run it first.
@param patternKeyPoints keyPoints created from a FeatureDetector.
@param patternDescriptors descriptors created from a DescriptorExtractor.
*/
void loadPattern(const cv::Mat &patternImage, const std::vector<cv::KeyPoint> &patternKeyPoints, const cv::Mat &patternDescriptors);
/* @brief Compute matched object points and image points which are used for calibration /* @brief Compute matched object points and image points which are used for calibration
The objectPoints (3D) and imagePoints (2D) are stored inside the class. Run getObjectPoints() The objectPoints (3D) and imagePoints (2D) are stored inside the class. Run getObjectPoints()
...@@ -108,11 +115,11 @@ public: ...@@ -108,11 +115,11 @@ public:
/* @brief Get object(3D) points /* @brief Get object(3D) points
*/ */
std::vector<cv::Mat> getObjectPoints(); const std::vector<cv::Mat> &getObjectPoints();
/* @brief and image(2D) points /* @brief and image(2D) points
*/ */
std::vector<cv::Mat> getImagePoints(); const std::vector<cv::Mat> &getImagePoints();
private: private:
......
...@@ -228,17 +228,17 @@ void RandomPatternCornerFinder::drawCorrespondence(const Mat& image1, const std: ...@@ -228,17 +228,17 @@ void RandomPatternCornerFinder::drawCorrespondence(const Mat& image1, const std:
waitKey(0); waitKey(0);
} }
std::vector<cv::Mat> RandomPatternCornerFinder::getObjectPoints() const std::vector<cv::Mat> &RandomPatternCornerFinder::getObjectPoints()
{ {
return _objectPonits; return _objectPonits;
} }
std::vector<cv::Mat> RandomPatternCornerFinder::getImagePoints() const std::vector<cv::Mat> &RandomPatternCornerFinder::getImagePoints()
{ {
return _imagePoints; return _imagePoints;
} }
void RandomPatternCornerFinder::loadPattern(cv::Mat patternImage) void RandomPatternCornerFinder::loadPattern(const cv::Mat &patternImage)
{ {
_patternImage = patternImage.clone(); _patternImage = patternImage.clone();
if (_patternImage.type()!= CV_8U) if (_patternImage.type()!= CV_8U)
...@@ -249,6 +249,21 @@ void RandomPatternCornerFinder::loadPattern(cv::Mat patternImage) ...@@ -249,6 +249,21 @@ void RandomPatternCornerFinder::loadPattern(cv::Mat patternImage)
_descriptorPattern.convertTo(_descriptorPattern, CV_32F); _descriptorPattern.convertTo(_descriptorPattern, CV_32F);
} }
void RandomPatternCornerFinder::loadPattern(const cv::Mat &patternImage, const std::vector<cv::KeyPoint> &patternKeyPoints, const cv::Mat &patternDescriptors)
{
CV_Assert((int)patternKeyPoints.size()==patternDescriptors.rows);
CV_Assert(patternDescriptors.cols==_descriptor->descriptorSize());
CV_Assert(patternDescriptors.type()==_descriptor->descriptorType());
_patternImage=patternImage.clone();
if(_patternImage.type()!=CV_8U)
_patternImage.convertTo(_patternImage, CV_8U);
_patternImageSize=patternImage.size();
_keypointsPattern=patternKeyPoints;
_descriptorPattern=patternDescriptors.clone();
_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()); CV_Assert(!_patternImage.empty());
......
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