Skip to content

Commit 0738ea7

Browse files
author
Andrey Kamaev
committed
Make highgui.hpp independent from C API
1 parent 288a063 commit 0738ea7

File tree

152 files changed

+901
-596
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+901
-596
lines changed

3rdparty/ffmpeg/ffmpeg_version.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
set(HAVE_FFMPEG 1)
12
set(NEW_FFMPEG 1)
23
set(HAVE_FFMPEG_CODEC 1)
34
set(HAVE_FFMPEG_FORMAT 1)

cmake/OpenCVFindLibsVideo.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if(WITH_GSTREAMER AND NOT WITH_GSTREAMER_1_X)
2929
set(GSTREAMER_RIFF_VERSION ${ALIASOF_gstreamer-riff-0.10_VERSION})
3030
set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-0.10_VERSION})
3131
endif()
32-
32+
3333
endif(WITH_GSTREAMER AND NOT WITH_GSTREAMER_1_X)
3434

3535
# if gstreamer 0.10 was not found, or we specified we wanted 1.x, try to find it
@@ -40,7 +40,7 @@ if(WITH_GSTREAMER_1_X OR NOT HAVE_GSTREAMER)
4040
CHECK_MODULE(gstreamer-app-1.0 HAVE_GSTREAMER_APP)
4141
CHECK_MODULE(gstreamer-riff-1.0 HAVE_GSTREAMER_RIFF)
4242
CHECK_MODULE(gstreamer-pbutils-1.0 HAVE_GSTREAMER_PBUTILS)
43-
43+
4444
if(HAVE_GSTREAMER_BASE AND HAVE_GSTREAMER_VIDEO AND HAVE_GSTREAMER_APP AND HAVE_GSTREAMER_RIFF AND HAVE_GSTREAMER_PBUTILS)
4545
set(HAVE_GSTREAMER TRUE)
4646
set(GSTREAMER_BASE_VERSION ${ALIASOF_gstreamer-base-1.0_VERSION})
@@ -49,7 +49,7 @@ if(WITH_GSTREAMER_1_X OR NOT HAVE_GSTREAMER)
4949
set(GSTREAMER_RIFF_VERSION ${ALIASOF_gstreamer-riff-1.0_VERSION})
5050
set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-1.0_VERSION})
5151
endif()
52-
52+
5353
endif(WITH_GSTREAMER_1_X OR NOT HAVE_GSTREAMER)
5454

5555
# --- unicap ---

modules/calib3d/test/test_chesscorners_timing.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
6666
CvMat* _v = 0;
6767
CvPoint2D32f* v;
6868

69-
IplImage* img = 0;
69+
IplImage img;
7070
IplImage* gray = 0;
7171
IplImage* thresh = 0;
7272

@@ -105,9 +105,10 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
105105
/* read the image */
106106
sprintf( filename, "%s%s", filepath, imgname );
107107

108-
img = cvLoadImage( filename );
108+
cv::Mat img2 = cv::imread( filename );
109+
img = img2;
109110

110-
if( !img )
111+
if( img2.empty() )
111112
{
112113
ts->printf( cvtest::TS::LOG, "one of chessboard images can't be read: %s\n", filename );
113114
if( max_idx == 1 )
@@ -120,9 +121,9 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
120121

121122
ts->printf(cvtest::TS::LOG, "%s: chessboard %d:\n", imgname, is_chessboard);
122123

123-
gray = cvCreateImage( cvSize( img->width, img->height ), IPL_DEPTH_8U, 1 );
124-
thresh = cvCreateImage( cvSize( img->width, img->height ), IPL_DEPTH_8U, 1 );
125-
cvCvtColor( img, gray, CV_BGR2GRAY );
124+
gray = cvCreateImage( cvSize( img.width, img.height ), IPL_DEPTH_8U, 1 );
125+
thresh = cvCreateImage( cvSize( img.width, img.height ), IPL_DEPTH_8U, 1 );
126+
cvCvtColor( &img, gray, CV_BGR2GRAY );
126127

127128

128129
count0 = pattern_size.width*pattern_size.height;
@@ -164,7 +165,6 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
164165
find_chessboard_time*1e-6, find_chessboard_time/num_pixels);
165166

166167
cvReleaseMat( &_v );
167-
cvReleaseImage( &img );
168168
cvReleaseImage( &gray );
169169
cvReleaseImage( &thresh );
170170
progress = update_progress( progress, idx-1, max_idx, 0 );
@@ -175,7 +175,6 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
175175
/* release occupied memory */
176176
cvReleaseMat( &_v );
177177
cvReleaseFileStorage( &fs );
178-
cvReleaseImage( &img );
179178
cvReleaseImage( &gray );
180179
cvReleaseImage( &thresh );
181180

modules/contrib/src/chamfermatching.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,8 +912,7 @@ void ChamferMatcher::Template::show() const
912912
#ifdef HAVE_OPENCV_HIGHGUI
913913
namedWindow("templ",1);
914914
imshow("templ",templ_color);
915-
916-
cvWaitKey(0);
915+
waitKey();
917916
#else
918917
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without GUI support");
919918
#endif

modules/core/include/opencv2/core.hpp

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -496,67 +496,73 @@ CV_EXPORTS void randShuffle(InputOutputArray dst, double iterFactor = 1., RNG* r
496496

497497
CV_EXPORTS_AS(randShuffle) void randShuffle_(InputOutputArray dst, double iterFactor = 1.);
498498

499+
enum { FILLED = -1,
500+
LINE_4 = 4,
501+
LINE_8 = 8,
502+
LINE_AA = 16
503+
};
504+
499505
//! draws the line segment (pt1, pt2) in the image
500506
CV_EXPORTS_W void line(CV_IN_OUT Mat& img, Point pt1, Point pt2, const Scalar& color,
501-
int thickness = 1, int lineType = 8, int shift = 0);
507+
int thickness = 1, int lineType = LINE_8, int shift = 0);
502508

503509
//! draws the rectangle outline or a solid rectangle with the opposite corners pt1 and pt2 in the image
504510
CV_EXPORTS_W void rectangle(CV_IN_OUT Mat& img, Point pt1, Point pt2,
505511
const Scalar& color, int thickness = 1,
506-
int lineType = 8, int shift = 0);
512+
int lineType = LINE_8, int shift = 0);
507513

508514
//! draws the rectangle outline or a solid rectangle covering rec in the image
509515
CV_EXPORTS void rectangle(CV_IN_OUT Mat& img, Rect rec,
510516
const Scalar& color, int thickness = 1,
511-
int lineType = 8, int shift = 0);
517+
int lineType = LINE_8, int shift = 0);
512518

513519
//! draws the circle outline or a solid circle in the image
514520
CV_EXPORTS_W void circle(CV_IN_OUT Mat& img, Point center, int radius,
515521
const Scalar& color, int thickness = 1,
516-
int lineType = 8, int shift = 0);
522+
int lineType = LINE_8, int shift = 0);
517523

518524
//! draws an elliptic arc, ellipse sector or a rotated ellipse in the image
519525
CV_EXPORTS_W void ellipse(CV_IN_OUT Mat& img, Point center, Size axes,
520526
double angle, double startAngle, double endAngle,
521527
const Scalar& color, int thickness = 1,
522-
int lineType = 8, int shift = 0);
528+
int lineType = LINE_8, int shift = 0);
523529

524530
//! draws a rotated ellipse in the image
525531
CV_EXPORTS_W void ellipse(CV_IN_OUT Mat& img, const RotatedRect& box, const Scalar& color,
526-
int thickness = 1, int lineType = 8);
532+
int thickness = 1, int lineType = LINE_8);
527533

528534
//! draws a filled convex polygon in the image
529535
CV_EXPORTS void fillConvexPoly(Mat& img, const Point* pts, int npts,
530-
const Scalar& color, int lineType = 8,
536+
const Scalar& color, int lineType = LINE_8,
531537
int shift = 0);
532538

533539
CV_EXPORTS_W void fillConvexPoly(InputOutputArray img, InputArray points,
534-
const Scalar& color, int lineType = 8,
540+
const Scalar& color, int lineType = LINE_8,
535541
int shift = 0);
536542

537543
//! fills an area bounded by one or more polygons
538544
CV_EXPORTS void fillPoly(Mat& img, const Point** pts,
539545
const int* npts, int ncontours,
540-
const Scalar& color, int lineType = 8, int shift = 0,
546+
const Scalar& color, int lineType = LINE_8, int shift = 0,
541547
Point offset = Point() );
542548

543549
CV_EXPORTS_W void fillPoly(InputOutputArray img, InputArrayOfArrays pts,
544-
const Scalar& color, int lineType = 8, int shift = 0,
550+
const Scalar& color, int lineType = LINE_8, int shift = 0,
545551
Point offset = Point() );
546552

547553
//! draws one or more polygonal curves
548554
CV_EXPORTS void polylines(Mat& img, const Point* const* pts, const int* npts,
549555
int ncontours, bool isClosed, const Scalar& color,
550-
int thickness = 1, int lineType = 8, int shift = 0 );
556+
int thickness = 1, int lineType = LINE_8, int shift = 0 );
551557

552558
CV_EXPORTS_W void polylines(InputOutputArray img, InputArrayOfArrays pts,
553559
bool isClosed, const Scalar& color,
554-
int thickness = 1, int lineType = 8, int shift = 0 );
560+
int thickness = 1, int lineType = LINE_8, int shift = 0 );
555561

556562
//! draws contours in the image
557563
CV_EXPORTS_W void drawContours( InputOutputArray image, InputArrayOfArrays contours,
558564
int contourIdx, const Scalar& color,
559-
int thickness = 1, int lineType = 8,
565+
int thickness = 1, int lineType = LINE_8,
560566
InputArray hierarchy = noArray(),
561567
int maxLevel = INT_MAX, Point offset = Point() );
562568

@@ -587,7 +593,7 @@ enum
587593
//! renders text string in the image
588594
CV_EXPORTS_W void putText( Mat& img, const String& text, Point org,
589595
int fontFace, double fontScale, Scalar color,
590-
int thickness = 1, int lineType = 8,
596+
int thickness = 1, int lineType = LINE_8,
591597
bool bottomLeftOrigin = false );
592598

593599
//! returns bounding box of the text string
@@ -631,9 +637,9 @@ CV_EXPORTS ConvertScaleData getConvertScaleElem(int fromType, int toType);
631637
PCA pca(pcaset, // pass the data
632638
Mat(), // we do not have a pre-computed mean vector,
633639
// so let the PCA engine to compute it
634-
CV_PCA_DATA_AS_ROW, // indicate that the vectors
640+
PCA::DATA_AS_ROW, // indicate that the vectors
635641
// are stored as matrix rows
636-
// (use CV_PCA_DATA_AS_COL if the vectors are
642+
// (use PCA::DATA_AS_COL if the vectors are
637643
// the matrix columns)
638644
maxComponents // specify, how many principal components to retain
639645
);
@@ -663,6 +669,11 @@ CV_EXPORTS ConvertScaleData getConvertScaleElem(int fromType, int toType);
663669
class CV_EXPORTS PCA
664670
{
665671
public:
672+
enum { DATA_AS_ROW = 0,
673+
DATA_AS_COL = 1,
674+
USE_AVG = 2
675+
};
676+
666677
//! default constructor
667678
PCA();
668679

modules/highgui/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ endif()
221221
if(WIN32)
222222
link_directories("${OpenCV_SOURCE_DIR}/3rdparty/lib") # for ffmpeg wrapper only
223223
include_directories(AFTER SYSTEM "${OpenCV_SOURCE_DIR}/3rdparty/include") # for directshow in VS2005 and multi-monitor support on MinGW
224+
include_directories(AFTER SYSTEM "${OpenCV_SOURCE_DIR}/3rdparty/include/ffmpeg_") # for tests
224225
endif()
225226

226227
if(UNIX)

0 commit comments

Comments
 (0)