Fixed windows warnings. Updated docs to include default detector/matcher.

pull/63/head
Daniel Angelov 10 years ago
parent 01d3b69b82
commit 9fb1a6dbc4
  1. 4
      modules/ccalib/doc/customPattern.rst
  2. 2
      modules/ccalib/include/opencv2/ccalib.hpp
  3. 21
      modules/ccalib/src/ccalib.cpp

@ -5,7 +5,7 @@ Custom Calibration Pattern
CustomPattern CustomPattern
------------- -------------
A custom pattern class that can be used to calibrate a camera and to further track the translation and rotation of the pattern. A custom pattern class that can be used to calibrate a camera and to further track the translation and rotation of the pattern. Defaultly it uses an ``ORB`` feature detector and a ``BruteForce-Hamming(2)`` descriptor matcher to find the location of the pattern feature points that will subsequently be used for calibration.
.. ocv:class:: CustomPattern : public Algorithm .. ocv:class:: CustomPattern : public Algorithm
@ -184,7 +184,7 @@ CustomPattern::drawOrientation
------------------------------ ------------------------------
Draws the ``(x,y,z)`` axis on the image, in the center of the pattern, showing the orientation of the pattern. Draws the ``(x,y,z)`` axis on the image, in the center of the pattern, showing the orientation of the pattern.
.. ocv:function:: void drawOrientation(InputOutputArray image, InputArray tvec, InputArray rvec, InputArray cameraMatrix, InputArray distCoeffs, double axis_length = 3, double axis_width = 2) .. ocv:function:: void drawOrientation(InputOutputArray image, InputArray tvec, InputArray rvec, InputArray cameraMatrix, InputArray distCoeffs, double axis_length = 3, int axis_width = 2)
:param image: The image, based on which the rotation and translation was calculated. The axis will be drawn in color - ``x`` - in red, ``y`` - in green, ``z`` - in blue. :param image: The image, based on which the rotation and translation was calculated. The axis will be drawn in color - ``x`` - in red, ``y`` - in green, ``z`` - in blue.

@ -110,7 +110,7 @@ public:
*/ */
void drawOrientation(InputOutputArray image, InputArray tvec, InputArray rvec, InputArray cameraMatrix, void drawOrientation(InputOutputArray image, InputArray tvec, InputArray rvec, InputArray cameraMatrix,
InputArray distCoeffs, double axis_length = 3, double axis_width = 2); InputArray distCoeffs, double axis_length = 3, int axis_width = 2);
/* /*
pattern_corners -> projected over the image position of the edges of the pattern. pattern_corners -> projected over the image position of the edges of the pattern.
*/ */

@ -88,8 +88,8 @@ bool CustomPattern::init(Mat& image, const float pixel_size, OutputArray output)
image.copyTo(img_roi); image.copyTo(img_roi);
//Setup object corners //Setup object corners
obj_corners = std::vector<Point2f>(4); obj_corners = std::vector<Point2f>(4);
obj_corners[0] = Point2f(0, 0); obj_corners[1] = Point2f(img_roi.cols, 0); obj_corners[0] = Point2f(0, 0); obj_corners[1] = Point2f(float(img_roi.cols), 0);
obj_corners[2] = Point2f(img_roi.cols, img_roi.rows); obj_corners[3] = Point2f(0, img_roi.rows); obj_corners[2] = Point2f(float(img_roi.cols), float(img_roi.rows)); obj_corners[3] = Point2f(0, float(img_roi.rows));
if (!detector) // if no detector chosen, use default if (!detector) // if no detector chosen, use default
{ {
@ -190,8 +190,8 @@ void CustomPattern::scaleFoundPoints(const double pixelSize,
for (unsigned int i = 0; i < corners.size(); ++i) for (unsigned int i = 0; i < corners.size(); ++i)
{ {
pts3d.push_back(Point3f( pts3d.push_back(Point3f(
corners[i].pt.x * pixelSize, float(corners[i].pt.x * pixelSize),
corners[i].pt.y * pixelSize, float(corners[i].pt.y * pixelSize),
0)); 0));
} }
} }
@ -321,7 +321,7 @@ bool CustomPattern::findPatternPass(const Mat& image, vector<Point2f>& matched_f
if (good_matches.empty()) return false; if (good_matches.empty()) return false;
uint numb_elem = good_matches.size(); size_t numb_elem = good_matches.size();
check_matches(matched_features, obj_points, good_matches, pattern_points, H); check_matches(matched_features, obj_points, good_matches, pattern_points, H);
if (good_matches.empty() || numb_elem < good_matches.size()) return false; if (good_matches.empty() || numb_elem < good_matches.size()) return false;
@ -465,15 +465,16 @@ bool CustomPattern::findRtRANSAC(InputArray image, InputArray cameraMatrix, Inpu
void CustomPattern::drawOrientation(InputOutputArray image, InputArray tvec, InputArray rvec, void CustomPattern::drawOrientation(InputOutputArray image, InputArray tvec, InputArray rvec,
InputArray cameraMatrix, InputArray distCoeffs, InputArray cameraMatrix, InputArray distCoeffs,
double axis_length, double axis_width) double axis_length, int axis_width)
{ {
Point3f ptrCtr3d = Point3f((img_roi.cols * pxSize)/2, (img_roi.rows * pxSize)/2, 0); Point3f ptrCtr3d = Point3f(float((img_roi.cols * pxSize)/2.0), float((img_roi.rows * pxSize)/2.0), 0);
vector<Point3f> axis(4); vector<Point3f> axis(4);
float alen = float(axis_length * pxSize);
axis[0] = ptrCtr3d; axis[0] = ptrCtr3d;
axis[1] = Point3f(axis_length * pxSize, 0, 0) + ptrCtr3d; axis[1] = Point3f(alen, 0, 0) + ptrCtr3d;
axis[2] = Point3f(0, axis_length * pxSize, 0) + ptrCtr3d; axis[2] = Point3f(0, alen, 0) + ptrCtr3d;
axis[3] = Point3f(0, 0, -axis_length * pxSize) + ptrCtr3d; axis[3] = Point3f(0, 0, -alen) + ptrCtr3d;
vector<Point2f> proj_axis; vector<Point2f> proj_axis;
projectPoints(axis, rvec, tvec, cameraMatrix, distCoeffs, proj_axis); projectPoints(axis, rvec, tvec, cameraMatrix, distCoeffs, proj_axis);

Loading…
Cancel
Save