const Mat& corners,
bool patternWasFound );
+CV_EXPORTS void drawChessboardCorners( Mat& image, Size patternSize,
+ const vector<Point2f>& corners,
+ bool patternWasFound );
+
enum
{
CALIB_USE_INTRINSIC_GUESS = 1,
if( corners.cols == 0 || corners.rows == 0 )
return;
CvMat _image = image;
- CV_Assert((corners.cols == 1 || corners.rows == 1) &&
- corners.type() == CV_32FC2 && corners.isContinuous());
+ int nelems = corners.checkVector(2, CV_32F, true);
+ CV_Assert(nelems >= 0);
cvDrawChessboardCorners( &_image, patternSize, (CvPoint2D32f*)corners.data,
- corners.cols + corners.rows - 1, patternWasFound );
+ nelems, patternWasFound );
+}
+
+void drawChessboardCorners( Mat& image, Size patternSize,
+ const vector<Point2f>& corners,
+ bool patternWasFound )
+{
+ if( corners.empty() )
+ return;
+ CvMat _image = image;
+ cvDrawChessboardCorners( &_image, patternSize, (CvPoint2D32f*)&corners[0],
+ (int)corners.size(), patternWasFound );
}
}
inline bool Mat::isContinuous() const { return (flags & CONTINUOUS_FLAG) != 0; }
inline bool Mat::isSubmatrix() const { return (flags & SUBMATRIX_FLAG) != 0; }
-inline size_t Mat::elemSize() const { return step.p[dims-1]; }
+inline size_t Mat::elemSize() const { return dims > 0 ? step.p[dims-1] : 0; }
inline size_t Mat::elemSize1() const { return CV_ELEM_SIZE1(flags); }
inline int Mat::type() const { return CV_MAT_TYPE(flags); }
inline int Mat::depth() const { return CV_MAT_DEPTH(flags); }
void cv::convexHull( const Mat& points, vector<int>& hull, bool clockwise )
{
- CV_Assert(points.checkVector(2) >= 0 && (points.depth() == CV_32F || points.depth() == CV_32S));
- hull.resize(points.cols*points.rows*points.channels()/2);
+ int nelems = points.checkVector(2);
+ CV_Assert(nelems >= 0 && (points.depth() == CV_32F || points.depth() == CV_32S));
+ hull.resize(nelems);
CvMat _points = Mat(points), _hull=Mat(hull);
cvConvexHull2(&_points, &_hull, clockwise ? CV_CLOCKWISE : CV_COUNTER_CLOCKWISE, 0);
hull.resize(_hull.cols + _hull.rows - 1);
void cv::convexHull( const Mat& points,
vector<Point>& hull, bool clockwise )
{
- CV_Assert(points.checkVector(2, CV_32S) >= 0);
- hull.resize(points.cols*points.rows*points.channels()/2);
+ int nelems = points.checkVector(2, CV_32S);
+ CV_Assert(nelems >= 0);
+ hull.resize(nelems);
CvMat _points = Mat(points), _hull=Mat(hull);
cvConvexHull2(&_points, &_hull, clockwise ? CV_CLOCKWISE : CV_COUNTER_CLOCKWISE, 1);
hull.resize(_hull.cols + _hull.rows - 1);
void cv::convexHull( const Mat& points,
vector<Point2f>& hull, bool clockwise )
{
- CV_Assert(points.checkVector(2, CV_32F) >= 0);
- hull.resize(points.cols*points.rows*points.channels()/2);
+ int nelems = points.checkVector(2, CV_32S);
+ CV_Assert(nelems >= 0);
+ hull.resize(nelems);
CvMat _points = Mat(points), _hull=Mat(hull);
cvConvexHull2(&_points, &_hull, clockwise ? CV_CLOCKWISE : CV_COUNTER_CLOCKWISE, 1);
hull.resize(_hull.cols + _hull.rows - 1);
uniranges.resize( dims*2 );
for( i = 0; i < dims; i++ )
{
- uniranges[i*2] = 1;
+ uniranges[i*2] = histSize[i]/256.;
uniranges[i*2+1] = 0;
}
}
#ifndef __OPENCV_COMPAT_HPP__
#define __OPENCV_COMPAT_HPP__
+#include "opencv2/core/core_c.h"
+#include "opencv2/imgproc/types_c.h"
+
#include <math.h>
#include <string.h>
\r
void parserRFilter (FILE * xmlf, int p, CvLSVMFilterObject * model, float *b){\r
int st = 0;\r
- int sizeX, sizeY;\r
+ int sizeX=0, sizeY=0;\r
int tag;\r
int tagVal;\r
char ch;\r
\r
void parserPFilter (FILE * xmlf, int p, int /*N_path*/, CvLSVMFilterObject * model){\r
int st = 0;\r
- int sizeX, sizeY;\r
+ int sizeX=0, sizeY=0;\r
int tag;\r
int tagVal;\r
char ch;\r