Permalink
Browse files

Make highgui.hpp independent from C API

  • Loading branch information...
1 parent 288a063 commit 0738ea7d0f84c2b3725f6fc721f03c533ba058a1 @taka-no-me taka-no-me committed Apr 7, 2013
Showing with 901 additions and 596 deletions.
  1. +1 −0 3rdparty/ffmpeg/ffmpeg_version.cmake
  2. +3 −3 cmake/OpenCVFindLibsVideo.cmake
  3. +7 −8 modules/calib3d/test/test_chesscorners_timing.cpp
  4. +1 −2 modules/contrib/src/chamfermatching.cpp
  5. +27 −16 modules/core/include/opencv2/core.hpp
  6. +1 −0 modules/highgui/CMakeLists.txt
  7. +399 −99 modules/highgui/include/opencv2/highgui.hpp
  8. +0 −3 modules/highgui/include/opencv2/highgui/highgui_c.h
  9. +1 −1 modules/highgui/perf/perf_output.cpp
  10. +9 −4 modules/highgui/src/cap.cpp
  11. +1 −1 modules/highgui/src/cap_ffmpeg.cpp
  12. +3 −1 modules/highgui/src/ffmpeg_codecs.hpp
  13. +0 −37 modules/highgui/src/precomp.hpp
  14. +8 −7 modules/highgui/src/window.cpp
  15. +5 −5 modules/highgui/test/test_ffmpeg.cpp
  16. +2 −2 modules/highgui/test/test_framecount.cpp
  17. +8 −8 modules/highgui/test/test_grfmt.cpp
  18. +2 −2 modules/highgui/test/test_gui.cpp
  19. +5 −5 modules/highgui/test/test_positioning.cpp
  20. +1 −0 modules/highgui/test/test_precomp.hpp
  21. +12 −12 modules/highgui/test/test_video_io.cpp
  22. +5 −5 modules/highgui/test/test_video_pos.cpp
  23. +8 −8 modules/imgproc/test/test_color.cpp
  24. +2 −2 modules/imgproc/test/test_grabcut.cpp
  25. +2 −2 modules/imgproc/test/test_precomp.hpp
  26. +2 −3 modules/java/generator/src/cpp/VideoCapture.cpp
  27. +5 −6 modules/legacy/src/oneway.cpp
  28. +3 −3 modules/objdetect/src/latentsvm.cpp
  29. +4 −5 modules/objdetect/test/test_latentsvmdetector.cpp
  30. +1 −1 modules/ocl/perf/perf_canny.cpp
  31. +1 −1 modules/ocl/perf/perf_haar.cpp
  32. +8 −8 modules/photo/test/test_denoising.cpp
  33. +2 −0 modules/python/src2/cv2.cpp
  34. +1 −0 modules/python/src2/cv2.cv.hpp
  35. +1 −0 modules/python/src2/gen2.py
  36. +2 −2 modules/video/test/test_camshift.cpp
  37. +10 −10 modules/video/test/test_optflowpyrlk.cpp
  38. +4 −4 modules/videostab/src/frame_source.cpp
  39. +1 −1 samples/c/adaptiveskindetector.cpp
  40. +1 −1 samples/c/bgfg_codebook.cpp
  41. +1 −1 samples/c/blobtrack_sample.cpp
  42. +1 −1 samples/c/convert_cascade.c
  43. +5 −3 samples/c/facedetect.cpp
  44. +1 −1 samples/c/fback_c.c
  45. +1 −1 samples/c/find_obj.cpp
  46. +2 −2 samples/c/find_obj_calonder.cpp
  47. +5 −5 samples/c/find_obj_ferns.cpp
  48. +2 −2 samples/c/latentsvmdetect.cpp
  49. +1 −1 samples/c/morphology.c
  50. +1 −1 samples/c/motempl.c
  51. +2 −2 samples/c/one_way_sample.cpp
  52. +5 −3 samples/c/smiledetect.cpp
  53. +25 −20 samples/cpp/Qt_sample/main.cpp
  54. +4 −4 samples/cpp/bgfg_segm.cpp
  55. +2 −2 samples/cpp/brief_match_test.cpp
  56. +1 −1 samples/cpp/calibration_artificial.cpp
  57. +2 −2 samples/cpp/camshiftdemo.cpp
  58. +1 −1 samples/cpp/contours2.cpp
  59. +2 −2 samples/cpp/convexhull.cpp
  60. +1 −1 samples/cpp/dbt_face_detection.cpp
  61. +8 −8 samples/cpp/delaunay2.cpp
  62. +1 −1 samples/cpp/demhist.cpp
  63. +2 −2 samples/cpp/dft.cpp
  64. +1 −1 samples/cpp/distrans.cpp
  65. +3 −3 samples/cpp/drawing.cpp
  66. +1 −1 samples/cpp/ffilldemo.cpp
  67. +3 −3 samples/cpp/fitellipse.cpp
  68. +3 −3 samples/cpp/freak_demo.cpp
  69. +2 −2 samples/cpp/generic_descriptor_match.cpp
  70. +15 −15 samples/cpp/grabcut.cpp
  71. +2 −2 samples/cpp/houghcircles.cpp
  72. +1 −1 samples/cpp/houghlines.cpp
  73. +5 −5 samples/cpp/hybridtrackingsample.cpp
  74. +9 −5 samples/cpp/image.cpp
  75. +4 −4 samples/cpp/image_alignment.cpp
  76. +3 −3 samples/cpp/inpaint.cpp
  77. +3 −3 samples/cpp/kmeans.cpp
  78. +4 −4 samples/cpp/laplace.cpp
  79. +8 −8 samples/cpp/linemod.cpp
  80. +1 −1 samples/cpp/lkdemo.cpp
  81. +2 −2 samples/cpp/matcher_simple.cpp
  82. +2 −2 samples/cpp/matching_to_many_images.cpp
  83. +1 −1 samples/cpp/meanshift_segmentation.cpp
  84. +4 −4 samples/cpp/minarea.cpp
  85. +1 −1 samples/cpp/morphology2.cpp
  86. +24 −24 samples/cpp/openni_capture.cpp
  87. +6 −6 samples/cpp/pca.cpp
  88. +2 −2 samples/cpp/phase_corr.cpp
  89. +3 −3 samples/cpp/points_classifier.cpp
  90. +1 −1 samples/cpp/segment_objects.cpp
  91. +5 −5 samples/cpp/select3dobj.cpp
  92. +1 −1 samples/cpp/squares.cpp
  93. +9 −9 samples/cpp/starter_imagelist.cpp
  94. +1 −1 samples/cpp/starter_video.cpp
  95. +10 −10 samples/cpp/tutorial_code/HighGUI/video-input-psnr-ssim/video-input-psnr-ssim.cpp
  96. +6 −6 samples/cpp/tutorial_code/HighGUI/video-write/video-write.cpp
  97. +2 −2 samples/cpp/tutorial_code/Histograms_Matching/EqualizeHist_Demo.cpp
  98. +2 −2 samples/cpp/tutorial_code/Histograms_Matching/MatchTemplate_Demo.cpp
  99. +1 −1 samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo1.cpp
  100. +2 −2 samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo2.cpp
  101. +1 −1 samples/cpp/tutorial_code/Histograms_Matching/calcHist_Demo.cpp
  102. +3 −3 samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp
  103. +1 −1 samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp
  104. +1 −1 samples/cpp/tutorial_code/ImgProc/Pyramids.cpp
  105. +2 −2 samples/cpp/tutorial_code/ImgProc/Smoothing.cpp
  106. +1 −1 samples/cpp/tutorial_code/ImgProc/Threshold.cpp
  107. +1 −1 samples/cpp/tutorial_code/ImgTrans/CannyDetector_Demo.cpp
  108. +3 −3 samples/cpp/tutorial_code/ImgTrans/Geometric_Transforms_Demo.cpp
  109. +1 −1 samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp
  110. +4 −4 samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
  111. +1 −1 samples/cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp
  112. +1 −1 samples/cpp/tutorial_code/ImgTrans/Remap_Demo.cpp
  113. +1 −1 samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp
  114. +1 −1 samples/cpp/tutorial_code/ImgTrans/copyMakeBorder_demo.cpp
  115. +1 −1 samples/cpp/tutorial_code/ImgTrans/filter2D_demo.cpp
  116. +2 −2 samples/cpp/tutorial_code/ShapeDescriptors/findContours_demo.cpp
  117. +2 −2 samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo1.cpp
  118. +2 −2 samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo2.cpp
  119. +2 −2 samples/cpp/tutorial_code/ShapeDescriptors/hull_demo.cpp
  120. +2 −2 samples/cpp/tutorial_code/ShapeDescriptors/moments_demo.cpp
  121. +2 −2 samples/cpp/tutorial_code/ShapeDescriptors/pointPolygonTest_demo.cpp
  122. +2 −2 samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp
  123. +2 −2 samples/cpp/tutorial_code/TrackingMotion/cornerHarris_Demo.cpp
  124. +3 −3 samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp
  125. +2 −2 samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo.cpp
  126. +1 −1 samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp
  127. +3 −3 samples/cpp/tutorial_code/calib3d/stereoBM/SBM_Sample.cpp
  128. +2 −2 samples/cpp/tutorial_code/core/Matrix/Drawing_1.cpp
  129. +2 −2 samples/cpp/tutorial_code/core/Matrix/Drawing_2.cpp
  130. +2 −2 samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp
  131. +2 −2 samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp
  132. +5 −1 samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp
  133. +6 −6 samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp
  134. +2 −2 samples/cpp/tutorial_code/features2D/SURF_FlannMatcher.cpp
  135. +2 −2 samples/cpp/tutorial_code/features2D/SURF_Homography.cpp
  136. +2 −2 samples/cpp/tutorial_code/features2D/SURF_descriptor.cpp
  137. +2 −2 samples/cpp/tutorial_code/features2D/SURF_detector.cpp
  138. +5 −5 samples/cpp/tutorial_code/introduction/display_image/display_image.cpp
  139. +10 −10 samples/cpp/tutorial_code/introduction/windows_visual_studio_Opencv/Test.cpp
  140. +2 −0 samples/cpp/tutorial_code/objectDetection/objectDetection.cpp
  141. +2 −0 samples/cpp/tutorial_code/objectDetection/objectDetection2.cpp
  142. +1 −1 samples/cpp/video_dmtx.cpp
  143. +1 −1 samples/cpp/videostab.cpp
  144. +3 −3 samples/cpp/watershed.cpp
  145. +1 −1 samples/gpu/hog.cpp
  146. +1 −1 samples/gpu/morphology.cpp
  147. +4 −4 samples/gpu/performance/tests.cpp
  148. +1 −1 samples/gpu/super_resolution.cpp
  149. +2 −2 samples/gpu/surf_keypoint_matcher.cpp
  150. +1 −1 samples/gpu/video_writer.cpp
  151. +3 −0 samples/ocl/facedetect.cpp
  152. +1 −1 samples/ocl/hog.cpp
@@ -1,3 +1,4 @@
+set(HAVE_FFMPEG 1)
set(NEW_FFMPEG 1)
set(HAVE_FFMPEG_CODEC 1)
set(HAVE_FFMPEG_FORMAT 1)
@@ -29,7 +29,7 @@ if(WITH_GSTREAMER AND NOT WITH_GSTREAMER_1_X)
set(GSTREAMER_RIFF_VERSION ${ALIASOF_gstreamer-riff-0.10_VERSION})
set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-0.10_VERSION})
endif()
-
+
endif(WITH_GSTREAMER AND NOT WITH_GSTREAMER_1_X)
# 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)
CHECK_MODULE(gstreamer-app-1.0 HAVE_GSTREAMER_APP)
CHECK_MODULE(gstreamer-riff-1.0 HAVE_GSTREAMER_RIFF)
CHECK_MODULE(gstreamer-pbutils-1.0 HAVE_GSTREAMER_PBUTILS)
-
+
if(HAVE_GSTREAMER_BASE AND HAVE_GSTREAMER_VIDEO AND HAVE_GSTREAMER_APP AND HAVE_GSTREAMER_RIFF AND HAVE_GSTREAMER_PBUTILS)
set(HAVE_GSTREAMER TRUE)
set(GSTREAMER_BASE_VERSION ${ALIASOF_gstreamer-base-1.0_VERSION})
@@ -49,7 +49,7 @@ if(WITH_GSTREAMER_1_X OR NOT HAVE_GSTREAMER)
set(GSTREAMER_RIFF_VERSION ${ALIASOF_gstreamer-riff-1.0_VERSION})
set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-1.0_VERSION})
endif()
-
+
endif(WITH_GSTREAMER_1_X OR NOT HAVE_GSTREAMER)
# --- unicap ---
@@ -66,7 +66,7 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
CvMat* _v = 0;
CvPoint2D32f* v;
- IplImage* img = 0;
+ IplImage img;
IplImage* gray = 0;
IplImage* thresh = 0;
@@ -105,9 +105,10 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
/* read the image */
sprintf( filename, "%s%s", filepath, imgname );
- img = cvLoadImage( filename );
+ cv::Mat img2 = cv::imread( filename );
+ img = img2;
- if( !img )
+ if( img2.empty() )
{
ts->printf( cvtest::TS::LOG, "one of chessboard images can't be read: %s\n", filename );
if( max_idx == 1 )
@@ -120,9 +121,9 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
ts->printf(cvtest::TS::LOG, "%s: chessboard %d:\n", imgname, is_chessboard);
- gray = cvCreateImage( cvSize( img->width, img->height ), IPL_DEPTH_8U, 1 );
- thresh = cvCreateImage( cvSize( img->width, img->height ), IPL_DEPTH_8U, 1 );
- cvCvtColor( img, gray, CV_BGR2GRAY );
+ gray = cvCreateImage( cvSize( img.width, img.height ), IPL_DEPTH_8U, 1 );
+ thresh = cvCreateImage( cvSize( img.width, img.height ), IPL_DEPTH_8U, 1 );
+ cvCvtColor( &img, gray, CV_BGR2GRAY );
count0 = pattern_size.width*pattern_size.height;
@@ -164,7 +165,6 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
find_chessboard_time*1e-6, find_chessboard_time/num_pixels);
cvReleaseMat( &_v );
- cvReleaseImage( &img );
cvReleaseImage( &gray );
cvReleaseImage( &thresh );
progress = update_progress( progress, idx-1, max_idx, 0 );
@@ -175,7 +175,6 @@ void CV_ChessboardDetectorTimingTest::run( int start_from )
/* release occupied memory */
cvReleaseMat( &_v );
cvReleaseFileStorage( &fs );
- cvReleaseImage( &img );
cvReleaseImage( &gray );
cvReleaseImage( &thresh );
@@ -912,8 +912,7 @@ void ChamferMatcher::Template::show() const
#ifdef HAVE_OPENCV_HIGHGUI
namedWindow("templ",1);
imshow("templ",templ_color);
-
- cvWaitKey(0);
+ waitKey();
#else
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without GUI support");
#endif
@@ -496,67 +496,73 @@ CV_EXPORTS void randShuffle(InputOutputArray dst, double iterFactor = 1., RNG* r
CV_EXPORTS_AS(randShuffle) void randShuffle_(InputOutputArray dst, double iterFactor = 1.);
+enum { FILLED = -1,
+ LINE_4 = 4,
+ LINE_8 = 8,
+ LINE_AA = 16
+ };
+
//! draws the line segment (pt1, pt2) in the image
CV_EXPORTS_W void line(CV_IN_OUT Mat& img, Point pt1, Point pt2, const Scalar& color,
- int thickness = 1, int lineType = 8, int shift = 0);
+ int thickness = 1, int lineType = LINE_8, int shift = 0);
//! draws the rectangle outline or a solid rectangle with the opposite corners pt1 and pt2 in the image
CV_EXPORTS_W void rectangle(CV_IN_OUT Mat& img, Point pt1, Point pt2,
const Scalar& color, int thickness = 1,
- int lineType = 8, int shift = 0);
+ int lineType = LINE_8, int shift = 0);
//! draws the rectangle outline or a solid rectangle covering rec in the image
CV_EXPORTS void rectangle(CV_IN_OUT Mat& img, Rect rec,
const Scalar& color, int thickness = 1,
- int lineType = 8, int shift = 0);
+ int lineType = LINE_8, int shift = 0);
//! draws the circle outline or a solid circle in the image
CV_EXPORTS_W void circle(CV_IN_OUT Mat& img, Point center, int radius,
const Scalar& color, int thickness = 1,
- int lineType = 8, int shift = 0);
+ int lineType = LINE_8, int shift = 0);
//! draws an elliptic arc, ellipse sector or a rotated ellipse in the image
CV_EXPORTS_W void ellipse(CV_IN_OUT Mat& img, Point center, Size axes,
double angle, double startAngle, double endAngle,
const Scalar& color, int thickness = 1,
- int lineType = 8, int shift = 0);
+ int lineType = LINE_8, int shift = 0);
//! draws a rotated ellipse in the image
CV_EXPORTS_W void ellipse(CV_IN_OUT Mat& img, const RotatedRect& box, const Scalar& color,
- int thickness = 1, int lineType = 8);
+ int thickness = 1, int lineType = LINE_8);
//! draws a filled convex polygon in the image
CV_EXPORTS void fillConvexPoly(Mat& img, const Point* pts, int npts,
- const Scalar& color, int lineType = 8,
+ const Scalar& color, int lineType = LINE_8,
int shift = 0);
CV_EXPORTS_W void fillConvexPoly(InputOutputArray img, InputArray points,
- const Scalar& color, int lineType = 8,
+ const Scalar& color, int lineType = LINE_8,
int shift = 0);
//! fills an area bounded by one or more polygons
CV_EXPORTS void fillPoly(Mat& img, const Point** pts,
const int* npts, int ncontours,
- const Scalar& color, int lineType = 8, int shift = 0,
+ const Scalar& color, int lineType = LINE_8, int shift = 0,
Point offset = Point() );
CV_EXPORTS_W void fillPoly(InputOutputArray img, InputArrayOfArrays pts,
- const Scalar& color, int lineType = 8, int shift = 0,
+ const Scalar& color, int lineType = LINE_8, int shift = 0,
Point offset = Point() );
//! draws one or more polygonal curves
CV_EXPORTS void polylines(Mat& img, const Point* const* pts, const int* npts,
int ncontours, bool isClosed, const Scalar& color,
- int thickness = 1, int lineType = 8, int shift = 0 );
+ int thickness = 1, int lineType = LINE_8, int shift = 0 );
CV_EXPORTS_W void polylines(InputOutputArray img, InputArrayOfArrays pts,
bool isClosed, const Scalar& color,
- int thickness = 1, int lineType = 8, int shift = 0 );
+ int thickness = 1, int lineType = LINE_8, int shift = 0 );
//! draws contours in the image
CV_EXPORTS_W void drawContours( InputOutputArray image, InputArrayOfArrays contours,
int contourIdx, const Scalar& color,
- int thickness = 1, int lineType = 8,
+ int thickness = 1, int lineType = LINE_8,
InputArray hierarchy = noArray(),
int maxLevel = INT_MAX, Point offset = Point() );
@@ -587,7 +593,7 @@ enum
//! renders text string in the image
CV_EXPORTS_W void putText( Mat& img, const String& text, Point org,
int fontFace, double fontScale, Scalar color,
- int thickness = 1, int lineType = 8,
+ int thickness = 1, int lineType = LINE_8,
bool bottomLeftOrigin = false );
//! returns bounding box of the text string
@@ -631,9 +637,9 @@ CV_EXPORTS ConvertScaleData getConvertScaleElem(int fromType, int toType);
PCA pca(pcaset, // pass the data
Mat(), // we do not have a pre-computed mean vector,
// so let the PCA engine to compute it
- CV_PCA_DATA_AS_ROW, // indicate that the vectors
+ PCA::DATA_AS_ROW, // indicate that the vectors
// are stored as matrix rows
- // (use CV_PCA_DATA_AS_COL if the vectors are
+ // (use PCA::DATA_AS_COL if the vectors are
// the matrix columns)
maxComponents // specify, how many principal components to retain
);
@@ -663,6 +669,11 @@ CV_EXPORTS ConvertScaleData getConvertScaleElem(int fromType, int toType);
class CV_EXPORTS PCA
{
public:
+ enum { DATA_AS_ROW = 0,
+ DATA_AS_COL = 1,
+ USE_AVG = 2
+ };
+
//! default constructor
PCA();
@@ -221,6 +221,7 @@ endif()
if(WIN32)
link_directories("${OpenCV_SOURCE_DIR}/3rdparty/lib") # for ffmpeg wrapper only
include_directories(AFTER SYSTEM "${OpenCV_SOURCE_DIR}/3rdparty/include") # for directshow in VS2005 and multi-monitor support on MinGW
+ include_directories(AFTER SYSTEM "${OpenCV_SOURCE_DIR}/3rdparty/include/ffmpeg_") # for tests
endif()
if(UNIX)
Oops, something went wrong.

0 comments on commit 0738ea7

Please sign in to comment.