1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

fixed 2 possible build problems (in opencv_gpu & docs) (ticket #1191 + fix from Steve Macao). removed obsolete stuff from opencv_extra_api.hpp, since with InputArray/OutputArray the existing C++ API can be successfully wrapped for Python.

This commit is contained in:
Vadim Pisarevsky
2011-07-05 14:28:25 +00:00
parent 5c23d3d96d
commit 9a1ef7272d
4 changed files with 19 additions and 218 deletions
+6 -6
View File
@@ -28,12 +28,12 @@ add_custom_target(docs
${CMAKE_CURRENT_SOURCE_DIR}/pics ${CMAKE_CURRENT_BINARY_DIR}/doc/opencv1/pics
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/mymath.sty ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${PDFLATEX_COMPILER} opencv2refman
COMMAND ${PDFLATEX_COMPILER} opencv2refman
COMMAND ${PDFLATEX_COMPILER} opencv_user
COMMAND ${PDFLATEX_COMPILER} opencv_user
COMMAND ${PDFLATEX_COMPILER} opencv_tutorials
COMMAND ${PDFLATEX_COMPILER} opencv_tutorials
COMMAND ${PDFLATEX_COMPILER} opencv2refman.tex
COMMAND ${PDFLATEX_COMPILER} opencv2refman.tex
COMMAND ${PDFLATEX_COMPILER} opencv_user.tex
COMMAND ${PDFLATEX_COMPILER} opencv_user.tex
COMMAND ${PDFLATEX_COMPILER} opencv_tutorials.tex
COMMAND ${PDFLATEX_COMPILER} opencv_tutorials.tex
DEPENDS ${OPENCV_DOC_DEPS}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating the PDF Manuals")
+1 -1
View File
@@ -218,7 +218,7 @@ if(BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test)
# Additional target properties
set_target_properties(${the_test_target} PROPERTIES
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}"
)
if(ENABLE_SOLUTION_FOLDERS)
@@ -455,9 +455,9 @@ CV_EXPORTS_W void preCornerDetect( InputArray src, OutputArray dst, int ksize,
int borderType=BORDER_DEFAULT );
//! adjusts the corner locations with sub-pixel accuracy to maximize the certain cornerness criteria
CV_EXPORTS void cornerSubPix( InputArray image, InputOutputArray corners,
Size winSize, Size zeroZone,
TermCriteria criteria );
CV_EXPORTS_W void cornerSubPix( InputArray image, InputOutputArray corners,
Size winSize, Size zeroZone,
TermCriteria criteria );
//! finds the strong enough corners where the cornerMinEigenVal() or cornerHarris() report the local maxima
CV_EXPORTS_W void goodFeaturesToTrack( InputArray image, OutputArray corners,
@@ -807,7 +807,7 @@ enum
};
//! retrieves contours and the hierarchical information from black-n-white image.
CV_EXPORTS void findContours( InputOutputArray image, OutputArrayOfArrays contours,
CV_EXPORTS_W void findContours( InputOutputArray image, OutputArrayOfArrays contours,
OutputArray hierarchy, int mode,
int method, Point offset=Point());
@@ -816,16 +816,16 @@ CV_EXPORTS void findContours( InputOutputArray image, OutputArrayOfArrays contou
int mode, int method, Point offset=Point());
//! draws contours in the image
CV_EXPORTS void drawContours( InputOutputArray image, InputArrayOfArrays contours,
CV_EXPORTS_W void drawContours( InputOutputArray image, InputArrayOfArrays contours,
int contourIdx, const Scalar& color,
int thickness=1, int lineType=8,
InputArray hierarchy=noArray(),
int maxLevel=INT_MAX, Point offset=Point() );
//! approximates contour or a curve using Douglas-Peucker algorithm
CV_EXPORTS void approxPolyDP( InputArray curve,
OutputArray approxCurve,
double epsilon, bool closed );
CV_EXPORTS_W void approxPolyDP( InputArray curve,
OutputArray approxCurve,
double epsilon, bool closed );
//! computes the contour perimeter (closed=true) or a curve length
CV_EXPORTS_W double arcLength( InputArray curve, bool closed );
@@ -842,8 +842,8 @@ CV_EXPORTS_W void minEnclosingCircle( InputArray points,
CV_EXPORTS_W double matchShapes( InputArray contour1, InputArray contour2,
int method, double parameter );
//! computes convex hull for a set of 2D points.
CV_EXPORTS void convexHull( InputArray points, OutputArray hull,
bool clockwise=false, bool returnPoints=true );
CV_EXPORTS_W void convexHull( InputArray points, OutputArray hull,
bool clockwise=false, bool returnPoints=true );
//! returns true iff the contour is convex. Does not support contours with self-intersection
CV_EXPORTS_W bool isContourConvex( InputArray contour );
@@ -852,8 +852,8 @@ CV_EXPORTS_W bool isContourConvex( InputArray contour );
CV_EXPORTS_W RotatedRect fitEllipse( InputArray points );
//! fits line to the set of 2D points using M-estimator algorithm
CV_EXPORTS void fitLine( InputArray points, OutputArray line, int distType,
double param, double reps, double aeps );
CV_EXPORTS_W void fitLine( InputArray points, OutputArray line, int distType,
double param, double reps, double aeps );
//! checks if the point is inside the contour. Optionally computes the signed distance from the point to the contour boundary
CV_EXPORTS_W double pointPolygonTest( InputArray contour, Point2f pt, bool measureDist );
-199
View File
@@ -205,207 +205,8 @@ CV_WRAP void calcBackProject( const vector<Mat>& images, const vector<int>& chan
}
static void addChildContour(const vector<Mat>& contours,
const Mat& hierarchy,
int i, vector<CvSeq>& seq,
vector<CvSeqBlock>& block)
{
size_t count = contours.size();
for( ; i >= 0; i = ((const Vec4i*)hierarchy.data)[i][0] )
{
const vector<Point>& ci = contours[i];
cvMakeSeqHeaderForArray(CV_SEQ_POLYGON, sizeof(CvSeq), sizeof(Point),
!ci.empty() ? (void*)&ci[0] : 0, (int)ci.size(),
&seq[i], &block[i] );
const Vec4i h_i = ((const Vec4i*)hierarchy.data)[i];
int h_next = h_i[0], h_prev = h_i[1], v_next = h_i[2], v_prev = h_i[3];
seq[i].h_next = (size_t)h_next < count ? &seq[h_next] : 0;
seq[i].h_prev = (size_t)h_prev < count ? &seq[h_prev] : 0;
seq[i].v_next = (size_t)v_next < count ? &seq[v_next] : 0;
seq[i].v_prev = (size_t)v_prev < count ? &seq[v_prev] : 0;
if( v_next >= 0 )
addChildContour(contours, hierarchy, v_next, seq, block);
}
}
//! draws contours in the image
CV_WRAP static inline void drawContours( Mat& image, const vector<Mat>& contours,
int contourIdx, const Scalar& color,
int thickness=1, int lineType=8,
const Mat& hierarchy=Mat(),
int maxLevel=INT_MAX, Point offset=Point() )
{
CvMat _image = image;
size_t i = 0, first = 0, last = contours.size();
vector<CvSeq> seq;
vector<CvSeqBlock> block;
if( !last )
return;
seq.resize(last);
block.resize(last);
for( i = first; i < last; i++ )
seq[i].first = 0;
if( contourIdx >= 0 )
{
CV_Assert( 0 <= contourIdx && contourIdx < (int)last );
first = contourIdx;
last = contourIdx + 1;
}
for( i = first; i < last; i++ )
{
const Mat& ci = contours[i];
int ci_size = ci.checkVector(2, CV_32S);
CV_Assert( ci_size >= 0 );
cvMakeSeqHeaderForArray(CV_SEQ_POLYGON, sizeof(CvSeq), sizeof(Point),
ci_size > 0 ? ci.data : 0, ci_size, &seq[i], &block[i] );
}
if( hierarchy.empty() || maxLevel == 0 )
for( i = first; i < last; i++ )
{
seq[i].h_next = i < last-1 ? &seq[i+1] : 0;
seq[i].h_prev = i > first ? &seq[i-1] : 0;
}
else
{
int hsz = hierarchy.checkVector(4, CV_32S);
size_t count = last - first;
CV_Assert((size_t)hsz == contours.size());
if( count == contours.size() )
{
for( i = first; i < last; i++ )
{
const Vec4i& h_i = ((const Vec4i*)hierarchy.data)[i];
int h_next = h_i[0], h_prev = h_i[1], v_next = h_i[2], v_prev = h_i[3];
seq[i].h_next = (size_t)h_next < count ? &seq[h_next] : 0;
seq[i].h_prev = (size_t)h_prev < count ? &seq[h_prev] : 0;
seq[i].v_next = (size_t)v_next < count ? &seq[v_next] : 0;
seq[i].v_prev = (size_t)v_prev < count ? &seq[v_prev] : 0;
}
}
else
{
int child = ((const Vec4i*)hierarchy.data)[first][2];
if( child >= 0 )
{
addChildContour(contours, hierarchy, child, seq, block);
seq[first].v_next = &seq[child];
}
}
}
cvDrawContours( &_image, &seq[first], color, color, contourIdx >= 0 ?
-maxLevel : maxLevel, thickness, lineType, offset );
}
CV_WRAP static inline void approxPolyDP( const Mat& curve,
CV_OUT Mat& approxCurve,
double epsilon, bool closed )
{
if( curve.depth() == CV_32S )
{
vector<Point> result;
approxPolyDP(curve, result, epsilon, closed);
Mat(result).copyTo(approxCurve);
}
else if( curve.depth() == CV_32F )
{
vector<Point2f> result;
approxPolyDP(curve, result, epsilon, closed);
Mat(result).copyTo(approxCurve);
}
else
CV_Error(CV_StsUnsupportedFormat, "");
}
CV_WRAP static inline void convexHull( const Mat& points, CV_OUT Mat& hull, bool returnPoints=true, bool clockwise=false )
{
if( !returnPoints )
{
vector<int> h;
convexHull(points, h, clockwise);
Mat(h).copyTo(hull);
}
else if( points.depth() == CV_32S )
{
vector<Point> h;
convexHull(points, h, clockwise);
Mat(h).copyTo(hull);
}
else if( points.depth() == CV_32F )
{
vector<Point2f> h;
convexHull(points, h, clockwise);
Mat(h).copyTo(hull);
}
}
CV_WRAP static inline void fitLine( const Mat& points, CV_OUT vector<float>& line,
int distType, double param, double reps, double aeps )
{
if(points.channels() == 2 || points.cols == 2)
{
line.resize(4);
fitLine(points, *(Vec4f*)&line[0], distType, param, reps, aeps);
}
else
{
line.resize(6);
fitLine(points, *(Vec6f*)&line[0], distType, param, reps, aeps);
}
}
CV_WRAP static inline int estimateAffine3D( const Mat& from, const Mat& to,
CV_OUT Mat& dst, CV_OUT Mat& outliers,
double param1 = 3.0, double param2 = 0.99 )
{
vector<uchar> outliers_vec;
int res = estimateAffine3D(from, to, dst, outliers_vec, param1, param2);
Mat(outliers_vec).copyTo(outliers);
return res;
}
CV_WRAP static inline void cornerSubPix( const Mat& image, Mat& corners,
Size winSize, Size zeroZone,
TermCriteria criteria )
{
int n = corners.checkVector(2, CV_32F);
CV_Assert(n >= 0);
if( n == 0 )
return;
CvMat _image = image;
cvFindCornerSubPix(&_image, (CvPoint2D32f*)corners.data, n, winSize, zeroZone, criteria);
}
/////////////////////////////// calib3d ///////////////////////////////////////////
CV_WRAP static inline void convertPointsHomogeneous( const Mat& src, CV_OUT Mat& dst )
{
int n;
if( (n = src.checkVector(2)) >= 0 )
dst.create(n, 2, src.depth());
else if( (n = src.checkVector(3)) >= 0 )
dst.create(n, 3, src.depth());
else
CV_Error(CV_StsBadSize, "");
CvMat _src = src, _dst = dst;
cvConvertPointsHomogeneous(&_src, &_dst);
}
//! finds circles' grid pattern of the specified size in the image
CV_WRAP static inline void findCirclesGridDefault( InputArray image, Size patternSize,
OutputArray centers, int flags=CALIB_CB_SYMMETRIC_GRID )