Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make highgui.hpp independent from C API

  • Loading branch information...
commit 0738ea7d0f84c2b3725f6fc721f03c533ba058a1 1 parent 288a063
@taka-no-me taka-no-me authored
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
View
1  3rdparty/ffmpeg/ffmpeg_version.cmake
@@ -1,3 +1,4 @@
+set(HAVE_FFMPEG 1)
set(NEW_FFMPEG 1)
set(HAVE_FFMPEG_CODEC 1)
set(HAVE_FFMPEG_FORMAT 1)
View
6 cmake/OpenCVFindLibsVideo.cmake
@@ -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 ---
View
15 modules/calib3d/test/test_chesscorners_timing.cpp
@@ -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 );
View
3  modules/contrib/src/chamfermatching.cpp
@@ -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
View
43 modules/core/include/opencv2/core.hpp
@@ -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();
View
1  modules/highgui/CMakeLists.txt
@@ -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)
View
498 modules/highgui/include/opencv2/highgui.hpp
@@ -43,32 +43,81 @@
#ifndef __OPENCV_HIGHGUI_HPP__
#define __OPENCV_HIGHGUI_HPP__
-#include "opencv2/highgui/highgui_c.h"
-
-#ifdef __cplusplus
#include "opencv2/core.hpp"
-struct CvCapture;
-struct CvVideoWriter;
+///////////////////////// graphical user interface //////////////////////////
namespace cv
{
-enum {
- // Flags for namedWindow
- WINDOW_NORMAL = CV_WINDOW_NORMAL, // the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size
- WINDOW_AUTOSIZE = CV_WINDOW_AUTOSIZE, // the user cannot resize the window, the size is constrainted by the image displayed
- WINDOW_OPENGL = CV_WINDOW_OPENGL, // window with opengl support
-
- // Flags for set / getWindowProperty
- WND_PROP_FULLSCREEN = CV_WND_PROP_FULLSCREEN, // fullscreen property
- WND_PROP_AUTOSIZE = CV_WND_PROP_AUTOSIZE, // autosize property
- WND_PROP_ASPECT_RATIO = CV_WND_PROP_ASPECTRATIO, // window's aspect ration
- WND_PROP_OPENGL = CV_WND_PROP_OPENGL // opengl support
-};
+// Flags for namedWindow
+enum { WINDOW_NORMAL = 0x00000000, // the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size
+ WINDOW_AUTOSIZE = 0x00000001, // the user cannot resize the window, the size is constrainted by the image displayed
+ WINDOW_OPENGL = 0x00001000, // window with opengl support
+
+ WINDOW_FULLSCREEN = 1, // change the window to fullscreen
+ WINDOW_FREERATIO = 0x00000100, // the image expends as much as it can (no ratio constraint)
+ WINDOW_KEEPRATIO = 0x00000000 // the ratio of the image is respected
+ };
+
+// Flags for set / getWindowProperty
+enum { WND_PROP_FULLSCREEN = 0, // fullscreen property (can be WINDOW_NORMAL or WINDOW_FULLSCREEN)
+ WND_PROP_AUTOSIZE = 1, // autosize property (can be WINDOW_NORMAL or WINDOW_AUTOSIZE)
+ WND_PROP_ASPECT_RATIO = 2, // window's aspect ration (can be set to WINDOW_FREERATIO or WINDOW_KEEPRATIO);
+ WND_PROP_OPENGL = 3 // opengl support
+ };
+
+enum { EVENT_MOUSEMOVE = 0,
+ EVENT_LBUTTONDOWN = 1,
+ EVENT_RBUTTONDOWN = 2,
+ EVENT_MBUTTONDOWN = 3,
+ EVENT_LBUTTONUP = 4,
+ EVENT_RBUTTONUP = 5,
+ EVENT_MBUTTONUP = 6,
+ EVENT_LBUTTONDBLCLK = 7,
+ EVENT_RBUTTONDBLCLK = 8,
+ EVENT_MBUTTONDBLCLK = 9
+ };
+
+enum { EVENT_FLAG_LBUTTON = 1,
+ EVENT_FLAG_RBUTTON = 2,
+ EVENT_FLAG_MBUTTON = 4,
+ EVENT_FLAG_CTRLKEY = 8,
+ EVENT_FLAG_SHIFTKEY = 16,
+ EVENT_FLAG_ALTKEY = 32
+ };
+
+// Qt font
+enum { QT_FONT_LIGHT = 25, //QFont::Light,
+ QT_FONT_NORMAL = 50, //QFont::Normal,
+ QT_FONT_DEMIBOLD = 63, //QFont::DemiBold,
+ QT_FONT_BOLD = 75, //QFont::Bold,
+ QT_FONT_BLACK = 87 //QFont::Black
+ };
+
+// Qt font style
+enum { QT_STYLE_NORMAL = 0, //QFont::StyleNormal,
+ QT_STYLE_ITALIC = 1, //QFont::StyleItalic,
+ QT_STYLE_OBLIQUE = 2 //QFont::StyleOblique
+ };
+
+// Qt "button" type
+enum { QT_PUSH_BUTTON = 0,
+ QT_CHECKBOX = 1,
+ QT_RADIOBOX = 2
+ };
+
+
+typedef void (*MouseCallback)(int event, int x, int y, int flags, void* userdata);
+typedef void (*TrackbarCallback)(int pos, void* userdata);
+typedef void (*OpenGlDrawCallback)(void* userdata);
+typedef void (*ButtonCallback)(int state, void* userdata);
+
CV_EXPORTS_W void namedWindow(const String& winname, int flags = WINDOW_AUTOSIZE);
+
CV_EXPORTS_W void destroyWindow(const String& winname);
+
CV_EXPORTS_W void destroyAllWindows();
CV_EXPORTS_W int startWindowThread();
@@ -78,123 +127,373 @@ CV_EXPORTS_W int waitKey(int delay = 0);
CV_EXPORTS_W void imshow(const String& winname, InputArray mat);
CV_EXPORTS_W void resizeWindow(const String& winname, int width, int height);
+
CV_EXPORTS_W void moveWindow(const String& winname, int x, int y);
-CV_EXPORTS_W void setWindowProperty(const String& winname, int prop_id, double prop_value);//YV
-CV_EXPORTS_W double getWindowProperty(const String& winname, int prop_id);//YV
+CV_EXPORTS_W void setWindowProperty(const String& winname, int prop_id, double prop_value);
-enum
-{
- EVENT_MOUSEMOVE =0,
- EVENT_LBUTTONDOWN =1,
- EVENT_RBUTTONDOWN =2,
- EVENT_MBUTTONDOWN =3,
- EVENT_LBUTTONUP =4,
- EVENT_RBUTTONUP =5,
- EVENT_MBUTTONUP =6,
- EVENT_LBUTTONDBLCLK =7,
- EVENT_RBUTTONDBLCLK =8,
- EVENT_MBUTTONDBLCLK =9
-};
-
-enum
-{
- EVENT_FLAG_LBUTTON =1,
- EVENT_FLAG_RBUTTON =2,
- EVENT_FLAG_MBUTTON =4,
- EVENT_FLAG_CTRLKEY =8,
- EVENT_FLAG_SHIFTKEY =16,
- EVENT_FLAG_ALTKEY =32
-};
-
-typedef void (*MouseCallback)(int event, int x, int y, int flags, void* userdata);
+CV_EXPORTS_W double getWindowProperty(const String& winname, int prop_id);
//! assigns callback for mouse events
CV_EXPORTS void setMouseCallback(const String& winname, MouseCallback onMouse, void* userdata = 0);
-
-typedef void (CV_CDECL *TrackbarCallback)(int pos, void* userdata);
-
CV_EXPORTS int createTrackbar(const String& trackbarname, const String& winname,
int* value, int count,
TrackbarCallback onChange = 0,
void* userdata = 0);
CV_EXPORTS_W int getTrackbarPos(const String& trackbarname, const String& winname);
+
CV_EXPORTS_W void setTrackbarPos(const String& trackbarname, const String& winname, int pos);
-// OpenGL support
-typedef void (*OpenGlDrawCallback)(void* userdata);
+// OpenGL support
CV_EXPORTS void setOpenGlDrawCallback(const String& winname, OpenGlDrawCallback onOpenGlDraw, void* userdata = 0);
CV_EXPORTS void setOpenGlContext(const String& winname);
CV_EXPORTS void updateWindow(const String& winname);
-//Only for Qt
-CV_EXPORTS CvFont fontQt(const String& nameFont, int pointSize=-1,
- Scalar color=Scalar::all(0), int weight=CV_FONT_NORMAL,
- int style=CV_STYLE_NORMAL, int spacing=0);
-CV_EXPORTS void addText( const Mat& img, const String& text, Point org, CvFont font);
+// Only for Qt
+
+struct QtFont
+{
+ const char* nameFont; // Qt: nameFont
+ Scalar color; // Qt: ColorFont -> cvScalar(blue_component, green_component, red\_component[, alpha_component])
+ int font_face; // Qt: bool italic
+ const int* ascii; // font data and metrics
+ const int* greek;
+ const int* cyrillic;
+ float hscale, vscale;
+ float shear; // slope coefficient: 0 - normal, >0 - italic
+ int thickness; // Qt: weight
+ float dx; // horizontal interval between letters
+ int line_type; // Qt: PointSize
+};
+
+CV_EXPORTS QtFont fontQt(const String& nameFont, int pointSize = -1,
+ Scalar color = Scalar::all(0), int weight = QT_FONT_NORMAL,
+ int style = QT_STYLE_NORMAL, int spacing = 0);
-CV_EXPORTS void displayOverlay(const String& winname, const String& text, int delayms CV_DEFAULT(0));
-CV_EXPORTS void displayStatusBar(const String& winname, const String& text, int delayms CV_DEFAULT(0));
+CV_EXPORTS void addText( const Mat& img, const String& text, Point org, const QtFont& font);
+
+CV_EXPORTS void displayOverlay(const String& winname, const String& text, int delayms = 0);
+
+CV_EXPORTS void displayStatusBar(const String& winname, const String& text, int delayms = 0);
CV_EXPORTS void saveWindowParameters(const String& windowName);
+
CV_EXPORTS void loadWindowParameters(const String& windowName);
+
CV_EXPORTS int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
+
CV_EXPORTS void stopLoop();
-typedef void (CV_CDECL *ButtonCallback)(int state, void* userdata);
CV_EXPORTS int createButton( const String& bar_name, ButtonCallback on_change,
- void* userdata=NULL, int type=CV_PUSH_BUTTON,
- bool initial_button_state=0);
+ void* userdata = 0, int type = QT_PUSH_BUTTON,
+ bool initial_button_state = false);
-//-------------------------
+} // cv
-enum
-{
- // 8bit, color or not
- IMREAD_UNCHANGED =-1,
- // 8bit, gray
- IMREAD_GRAYSCALE =0,
- // ?, color
- IMREAD_COLOR =1,
- // any depth, ?
- IMREAD_ANYDEPTH =2,
- // ?, any color
- IMREAD_ANYCOLOR =4
-};
-enum
+
+//////////////////////////////// image codec ////////////////////////////////
+namespace cv
{
- IMWRITE_JPEG_QUALITY =1,
- IMWRITE_PNG_COMPRESSION =16,
- IMWRITE_PNG_STRATEGY =17,
- IMWRITE_PNG_BILEVEL =18,
- IMWRITE_PNG_STRATEGY_DEFAULT =0,
- IMWRITE_PNG_STRATEGY_FILTERED =1,
- IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY =2,
- IMWRITE_PNG_STRATEGY_RLE =3,
- IMWRITE_PNG_STRATEGY_FIXED =4,
- IMWRITE_PXM_BINARY =32
-};
-CV_EXPORTS_W Mat imread( const String& filename, int flags=1 );
+enum { IMREAD_UNCHANGED = -1, // 8bit, color or not
+ IMREAD_GRAYSCALE = 0, // 8bit, gray
+ IMREAD_COLOR = 1, // ?, color
+ IMREAD_ANYDEPTH = 2, // any depth, ?
+ IMREAD_ANYCOLOR = 4 // ?, any color
+ };
+
+enum { IMWRITE_JPEG_QUALITY = 1,
+ IMWRITE_PNG_COMPRESSION = 16,
+ IMWRITE_PNG_STRATEGY = 17,
+ IMWRITE_PNG_BILEVEL = 18,
+ IMWRITE_PXM_BINARY = 32,
+ IMWRITE_WEBP_QUALITY = 64
+ };
+
+enum { IMWRITE_PNG_STRATEGY_DEFAULT = 0,
+ IMWRITE_PNG_STRATEGY_FILTERED = 1,
+ IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2,
+ IMWRITE_PNG_STRATEGY_RLE = 3,
+ IMWRITE_PNG_STRATEGY_FIXED = 4
+ };
+
+CV_EXPORTS_W Mat imread( const String& filename, int flags = IMREAD_COLOR );
+
CV_EXPORTS_W bool imwrite( const String& filename, InputArray img,
- const std::vector<int>& params=std::vector<int>());
+ const std::vector<int>& params = std::vector<int>());
+
CV_EXPORTS_W Mat imdecode( InputArray buf, int flags );
-CV_EXPORTS Mat imdecode( InputArray buf, int flags, Mat* dst );
+
+CV_EXPORTS Mat imdecode( InputArray buf, int flags, Mat* dst);
+
CV_EXPORTS_W bool imencode( const String& ext, InputArray img,
CV_OUT std::vector<uchar>& buf,
- const std::vector<int>& params=std::vector<int>());
+ const std::vector<int>& params = std::vector<int>());
+
+} // cv
+
+
-#ifndef CV_NO_VIDEO_CAPTURE_CPP_API
+////////////////////////////////// video io /////////////////////////////////
+
+typedef struct CvCapture CvCapture;
+typedef struct CvVideoWriter CvVideoWriter;
+
+namespace cv
+{
+
+// Camera API
+enum { CAP_ANY = 0, // autodetect
+ CAP_VFW = 200, // platform native
+ CAP_V4L = 200,
+ CAP_V4L2 = CAP_V4L,
+ CAP_FIREWARE = 300, // IEEE 1394 drivers
+ CAP_FIREWIRE = CAP_FIREWARE,
+ CAP_IEEE1394 = CAP_FIREWARE,
+ CAP_DC1394 = CAP_FIREWARE,
+ CAP_CMU1394 = CAP_FIREWARE,
+ CAP_QT = 500, // QuickTime
+ CAP_UNICAP = 600, // Unicap drivers
+ CAP_DSHOW = 700, // DirectShow (via videoInput)
+ CAP_PVAPI = 800, // PvAPI, Prosilica GigE SDK
+ CAP_OPENNI = 900, // OpenNI (for Kinect)
+ CAP_OPENNI_ASUS = 910, // OpenNI (for Asus Xtion)
+ CAP_ANDROID = 1000, // Android
+ CAP_XIAPI = 1100, // XIMEA Camera API
+ CAP_AVFOUNDATION = 1200, // AVFoundation framework for iOS (OS X Lion will have the same API)
+ CAP_GIGANETIX = 1300, // Smartek Giganetix GigEVisionSDK
+ CAP_MSMF = 1400 // Microsoft Media Foundation (via videoInput)
+ };
+
+// generic properties (based on DC1394 properties)
+enum { CAP_PROP_POS_MSEC =0,
+ CAP_PROP_POS_FRAMES =1,
+ CAP_PROP_POS_AVI_RATIO =2,
+ CAP_PROP_FRAME_WIDTH =3,
+ CAP_PROP_FRAME_HEIGHT =4,
+ CAP_PROP_FPS =5,
+ CAP_PROP_FOURCC =6,
+ CAP_PROP_FRAME_COUNT =7,
+ CAP_PROP_FORMAT =8,
+ CAP_PROP_MODE =9,
+ CAP_PROP_BRIGHTNESS =10,
+ CAP_PROP_CONTRAST =11,
+ CAP_PROP_SATURATION =12,
+ CAP_PROP_HUE =13,
+ CAP_PROP_GAIN =14,
+ CAP_PROP_EXPOSURE =15,
+ CAP_PROP_CONVERT_RGB =16,
+ CAP_PROP_WHITE_BALANCE_BLUE_U =17,
+ CAP_PROP_RECTIFICATION =18,
+ CAP_PROP_MONOCROME =19,
+ CAP_PROP_SHARPNESS =20,
+ CAP_PROP_AUTO_EXPOSURE =21, // DC1394: exposure control done by camera, user can adjust refernce level using this feature
+ CAP_PROP_GAMMA =22,
+ CAP_PROP_TEMPERATURE =23,
+ CAP_PROP_TRIGGER =24,
+ CAP_PROP_TRIGGER_DELAY =25,
+ CAP_PROP_WHITE_BALANCE_RED_V =26,
+ CAP_PROP_ZOOM =27,
+ CAP_PROP_FOCUS =28,
+ CAP_PROP_GUID =29,
+ CAP_PROP_ISO_SPEED =30,
+ CAP_PROP_BACKLIGHT =32,
+ CAP_PROP_PAN =33,
+ CAP_PROP_TILT =34,
+ CAP_PROP_ROLL =35,
+ CAP_PROP_IRIS =36,
+ CAP_PROP_SETTINGS =37
+ };
+
+
+// DC1394 only
+// modes of the controlling registers (can be: auto, manual, auto single push, absolute Latter allowed with any other mode)
+// every feature can have only one mode turned on at a time
+enum { CAP_PROP_DC1394_OFF = -4, //turn the feature off (not controlled manually nor automatically)
+ CAP_PROP_DC1394_MODE_MANUAL = -3, //set automatically when a value of the feature is set by the user
+ CAP_PROP_DC1394_MODE_AUTO = -2,
+ CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1,
+ CAP_PROP_DC1394_MAX = 31
+ };
+
+
+// OpenNI map generators
+enum { CAP_OPENNI_DEPTH_GENERATOR = 1 << 31,
+ CAP_OPENNI_IMAGE_GENERATOR = 1 << 30,
+ CAP_OPENNI_GENERATORS_MASK = CAP_OPENNI_DEPTH_GENERATOR + CAP_OPENNI_IMAGE_GENERATOR
+ };
+
+// Properties of cameras available through OpenNI interfaces
+enum { CAP_PROP_OPENNI_OUTPUT_MODE = 100,
+ CAP_PROP_OPENNI_FRAME_MAX_DEPTH = 101, // in mm
+ CAP_PROP_OPENNI_BASELINE = 102, // in mm
+ CAP_PROP_OPENNI_FOCAL_LENGTH = 103, // in pixels
+ CAP_PROP_OPENNI_REGISTRATION = 104, // flag that synchronizes the remapping depth map to image map
+ // by changing depth generator's view point (if the flag is "on") or
+ // sets this view point to its normal one (if the flag is "off").
+ CAP_PROP_OPENNI_REGISTRATION_ON = CAP_PROP_OPENNI_REGISTRATION,
+ CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105,
+ CAP_PROP_OPENNI_MAX_BUFFER_SIZE = 106,
+ CAP_PROP_OPENNI_CIRCLE_BUFFER = 107,
+ CAP_PROP_OPENNI_MAX_TIME_DURATION = 108,
+ CAP_PROP_OPENNI_GENERATOR_PRESENT = 109
+ };
+
+// OpenNI shortcats
+enum { CAP_OPENNI_IMAGE_GENERATOR_PRESENT = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT,
+ CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_OUTPUT_MODE,
+ CAP_OPENNI_DEPTH_GENERATOR_BASELINE = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_BASELINE,
+ CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_FOCAL_LENGTH,
+ CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_REGISTRATION,
+ CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION
+ };
+
+// OpenNI data given from depth generator
+enum { CAP_OPENNI_DEPTH_MAP = 0, // Depth values in mm (CV_16UC1)
+ CAP_OPENNI_POINT_CLOUD_MAP = 1, // XYZ in meters (CV_32FC3)
+ CAP_OPENNI_DISPARITY_MAP = 2, // Disparity in pixels (CV_8UC1)
+ CAP_OPENNI_DISPARITY_MAP_32F = 3, // Disparity in pixels (CV_32FC1)
+ CAP_OPENNI_VALID_DEPTH_MASK = 4, // CV_8UC1
+
+ // Data given from RGB image generator
+ CAP_OPENNI_BGR_IMAGE = 5,
+ CAP_OPENNI_GRAY_IMAGE = 6
+ };
+
+// Supported output modes of OpenNI image generator
+enum { CAP_OPENNI_VGA_30HZ = 0,
+ CAP_OPENNI_SXGA_15HZ = 1,
+ CAP_OPENNI_SXGA_30HZ = 2,
+ CAP_OPENNI_QVGA_30HZ = 3,
+ CAP_OPENNI_QVGA_60HZ = 4
+ };
+
+
+// GStreamer
+enum { CAP_PROP_GSTREAMER_QUEUE_LENGTH = 200 // default is 1
+ };
+
+
+// PVAPI
+enum { CAP_PROP_PVAPI_MULTICASTIP = 300 // ip for anable multicast master mode. 0 for disable multicast
+ };
+
+
+// Properties of cameras available through XIMEA SDK interface
+enum { CAP_PROP_XI_DOWNSAMPLING = 400, // Change image resolution by binning or skipping.
+ CAP_PROP_XI_DATA_FORMAT = 401, // Output data format.
+ CAP_PROP_XI_OFFSET_X = 402, // Horizontal offset from the origin to the area of interest (in pixels).
+ CAP_PROP_XI_OFFSET_Y = 403, // Vertical offset from the origin to the area of interest (in pixels).
+ CAP_PROP_XI_TRG_SOURCE = 404, // Defines source of trigger.
+ CAP_PROP_XI_TRG_SOFTWARE = 405, // Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE.
+ CAP_PROP_XI_GPI_SELECTOR = 406, // Selects general purpose input
+ CAP_PROP_XI_GPI_MODE = 407, // Set general purpose input mode
+ CAP_PROP_XI_GPI_LEVEL = 408, // Get general purpose level
+ CAP_PROP_XI_GPO_SELECTOR = 409, // Selects general purpose output
+ CAP_PROP_XI_GPO_MODE = 410, // Set general purpose output mode
+ CAP_PROP_XI_LED_SELECTOR = 411, // Selects camera signalling LED
+ CAP_PROP_XI_LED_MODE = 412, // Define camera signalling LED functionality
+ CAP_PROP_XI_MANUAL_WB = 413, // Calculates White Balance(must be called during acquisition)
+ CAP_PROP_XI_AUTO_WB = 414, // Automatic white balance
+ CAP_PROP_XI_AEAG = 415, // Automatic exposure/gain
+ CAP_PROP_XI_EXP_PRIORITY = 416, // Exposure priority (0.5 - exposure 50%, gain 50%).
+ CAP_PROP_XI_AE_MAX_LIMIT = 417, // Maximum limit of exposure in AEAG procedure
+ CAP_PROP_XI_AG_MAX_LIMIT = 418, // Maximum limit of gain in AEAG procedure
+ CAP_PROP_XI_AEAG_LEVEL = 419, // Average intensity of output signal AEAG should achieve(in %)
+ CAP_PROP_XI_TIMEOUT = 420 // Image capture timeout in milliseconds
+ };
+
+
+// Properties for Android cameras
+enum { CAP_PROP_ANDROID_AUTOGRAB = 1024,
+ CAP_PROP_ANDROID_PREVIEW_SIZES_STRING = 1025, // readonly, tricky property, returns const char* indeed
+ CAP_PROP_ANDROID_PREVIEW_FORMAT = 1026, // readonly, tricky property, returns const char* indeed
+ CAP_PROP_ANDROID_FLASH_MODE = 8001,
+ CAP_PROP_ANDROID_FOCUS_MODE = 8002,
+ CAP_PROP_ANDROID_WHITE_BALANCE = 8003,
+ CAP_PROP_ANDROID_ANTIBANDING = 8004,
+ CAP_PROP_ANDROID_FOCAL_LENGTH = 8005,
+ CAP_PROP_ANDROID_FOCUS_DISTANCE_NEAR = 8006,
+ CAP_PROP_ANDROID_FOCUS_DISTANCE_OPTIMAL = 8007,
+ CAP_PROP_ANDROID_FOCUS_DISTANCE_FAR = 8008
+ };
+
+
+// Android camera output formats
+enum { CAP_ANDROID_COLOR_FRAME_BGR = 0, //BGR
+ CAP_ANDROID_COLOR_FRAME = CAP_ANDROID_COLOR_FRAME_BGR,
+ CAP_ANDROID_GREY_FRAME = 1, //Y
+ CAP_ANDROID_COLOR_FRAME_RGB = 2,
+ CAP_ANDROID_COLOR_FRAME_BGRA = 3,
+ CAP_ANDROID_COLOR_FRAME_RGBA = 4
+ };
+
+
+// Android camera flash modes
+enum { CAP_ANDROID_FLASH_MODE_AUTO = 0,
+ CAP_ANDROID_FLASH_MODE_OFF = 1,
+ CAP_ANDROID_FLASH_MODE_ON = 2,
+ CAP_ANDROID_FLASH_MODE_RED_EYE = 3,
+ CAP_ANDROID_FLASH_MODE_TORCH = 4
+ };
+
+
+// Android camera focus modes
+enum { CAP_ANDROID_FOCUS_MODE_AUTO = 0,
+ CAP_ANDROID_FOCUS_MODE_CONTINUOUS_VIDEO = 1,
+ CAP_ANDROID_FOCUS_MODE_EDOF = 2,
+ CAP_ANDROID_FOCUS_MODE_FIXED = 3,
+ CAP_ANDROID_FOCUS_MODE_INFINITY = 4,
+ CAP_ANDROID_FOCUS_MODE_MACRO = 5
+ };
+
+
+// Android camera white balance modes
+enum { CAP_ANDROID_WHITE_BALANCE_AUTO = 0,
+ CAP_ANDROID_WHITE_BALANCE_CLOUDY_DAYLIGHT = 1,
+ CAP_ANDROID_WHITE_BALANCE_DAYLIGHT = 2,
+ CAP_ANDROID_WHITE_BALANCE_FLUORESCENT = 3,
+ CAP_ANDROID_WHITE_BALANCE_INCANDESCENT = 4,
+ CAP_ANDROID_WHITE_BALANCE_SHADE = 5,
+ CAP_ANDROID_WHITE_BALANCE_TWILIGHT = 6,
+ CAP_ANDROID_WHITE_BALANCE_WARM_FLUORESCENT = 7
+ };
+
+
+// Android camera antibanding modes
+enum { CAP_ANDROID_ANTIBANDING_50HZ = 0,
+ CAP_ANDROID_ANTIBANDING_60HZ = 1,
+ CAP_ANDROID_ANTIBANDING_AUTO = 2,
+ CAP_ANDROID_ANTIBANDING_OFF = 3
+ };
+
+
+// Properties of cameras available through AVFOUNDATION interface
+enum { CAP_PROP_IOS_DEVICE_FOCUS = 9001,
+ CAP_PROP_IOS_DEVICE_EXPOSURE = 9002,
+ CAP_PROP_IOS_DEVICE_FLASH = 9003,
+ CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004,
+ CAP_PROP_IOS_DEVICE_TORCH = 9005
+ };
+
+
+// Properties of cameras available through Smartek Giganetix Ethernet Vision interface
+/* --- Vladimir Litvinenko (litvinenko.vladimir@gmail.com) --- */
+enum { CAP_PROP_GIGA_FRAME_OFFSET_X = 10001,
+ CAP_PROP_GIGA_FRAME_OFFSET_Y = 10002,
+ CAP_PROP_GIGA_FRAME_WIDTH_MAX = 10003,
+ CAP_PROP_GIGA_FRAME_HEIGH_MAX = 10004,
+ CAP_PROP_GIGA_FRAME_SENS_WIDTH = 10005,
+ CAP_PROP_GIGA_FRAME_SENS_HEIGH = 10006
+ };
-template<> void CV_EXPORTS Ptr<CvCapture>::delete_obj();
-template<> void CV_EXPORTS Ptr<CvVideoWriter>::delete_obj();
class CV_EXPORTS_W VideoCapture
{
@@ -210,7 +509,7 @@ class CV_EXPORTS_W VideoCapture
CV_WRAP virtual void release();
CV_WRAP virtual bool grab();
- CV_WRAP virtual bool retrieve(CV_OUT Mat& image, int channel=0);
+ CV_WRAP virtual bool retrieve(CV_OUT Mat& image, int flag = 0);
virtual VideoCapture& operator >> (CV_OUT Mat& image);
CV_WRAP virtual bool read(CV_OUT Mat& image);
@@ -227,24 +526,25 @@ class CV_EXPORTS_W VideoWriter
public:
CV_WRAP VideoWriter();
CV_WRAP VideoWriter(const String& filename, int fourcc, double fps,
- Size frameSize, bool isColor=true);
+ Size frameSize, bool isColor = true);
virtual ~VideoWriter();
CV_WRAP virtual bool open(const String& filename, int fourcc, double fps,
- Size frameSize, bool isColor=true);
+ Size frameSize, bool isColor = true);
CV_WRAP virtual bool isOpened() const;
CV_WRAP virtual void release();
virtual VideoWriter& operator << (const Mat& image);
CV_WRAP virtual void write(const Mat& image);
+ CV_WRAP static int fourcc(char c1, char c2, char c3, char c4);
+
protected:
Ptr<CvVideoWriter> writer;
};
-#endif
-
-}
+template<> void Ptr<CvCapture>::delete_obj();
+template<> void Ptr<CvVideoWriter>::delete_obj();
-#endif
+} // cv
#endif
View
3  modules/highgui/include/opencv2/highgui/highgui_c.h
@@ -570,9 +570,6 @@ CVAPI(CvVideoWriter*) cvCreateVideoWriter( const char* filename, int fourcc,
double fps, CvSize frame_size,
int is_color CV_DEFAULT(1));
-//CVAPI(CvVideoWriter*) cvCreateImageSequenceWriter( const char* filename,
-// int is_color CV_DEFAULT(1));
-
/* write frame to video file */
CVAPI(int) cvWriteFrame( CvVideoWriter* writer, const IplImage* image );
View
2  modules/highgui/perf/perf_output.cpp
@@ -23,7 +23,7 @@ PERF_TEST_P(VideoWriter_Writing, WriteFrame,
string filename = getDataPath(get<0>(GetParam()));
bool isColor = get<1>(GetParam());
- VideoWriter writer(cv::tempfile(".avi"), CV_FOURCC('X', 'V', 'I', 'D'), 25, cv::Size(640, 480), isColor);
+ VideoWriter writer(cv::tempfile(".avi"), VideoWriter::fourcc('X', 'V', 'I', 'D'), 25, cv::Size(640, 480), isColor);
TEST_CYCLE() { Mat image = imread(filename, 1); writer << image; }
View
13 modules/highgui/src/cap.cpp
@@ -540,9 +540,9 @@ double VideoCapture::get(int propId)
VideoWriter::VideoWriter()
{}
-VideoWriter::VideoWriter(const String& filename, int fourcc, double fps, Size frameSize, bool isColor)
+VideoWriter::VideoWriter(const String& filename, int _fourcc, double fps, Size frameSize, bool isColor)
{
- open(filename, fourcc, fps, frameSize, isColor);
+ open(filename, _fourcc, fps, frameSize, isColor);
}
void VideoWriter::release()
@@ -555,9 +555,9 @@ VideoWriter::~VideoWriter()
release();
}
-bool VideoWriter::open(const String& filename, int fourcc, double fps, Size frameSize, bool isColor)
+bool VideoWriter::open(const String& filename, int _fourcc, double fps, Size frameSize, bool isColor)
{
- writer = cvCreateVideoWriter(filename.c_str(), fourcc, fps, frameSize, isColor);
+ writer = cvCreateVideoWriter(filename.c_str(), _fourcc, fps, frameSize, isColor);
return isOpened();
}
@@ -578,4 +578,9 @@ VideoWriter& VideoWriter::operator << (const Mat& image)
return *this;
}
+int VideoWriter::fourcc(char c1, char c2, char c3, char c4)
+{
+ return (c1 & 255) + ((c2 & 255) << 8) + ((c3 & 255) << 16) + ((c4 & 255) << 24);
+}
+
}
View
2  modules/highgui/src/cap_ffmpeg.cpp
@@ -41,7 +41,7 @@
#include "precomp.hpp"
-#ifdef HAVE_FFMPEG
+#ifndef WIN32
#include "cap_ffmpeg_impl.hpp"
#else
#include "cap_ffmpeg_api.hpp"
View
4 modules/highgui/src/ffmpeg_codecs.hpp
@@ -61,7 +61,9 @@ extern "C" {
#endif
#ifdef WIN32
- #include <libavformat/avformat.h>
+# define AVUTIL_COMMON_H
+# define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))
+# include <libavformat/avformat.h>
#else
// if the header path is not specified explicitly, let's deduce it
View
37 modules/highgui/src/precomp.hpp
@@ -199,41 +199,4 @@ void cvSetRatioWindow_QT(const char* name,double prop_value);
double cvGetOpenGlProp_QT(const char* name);
#endif
-
-
-/*namespace cv
-{
-
-class CV_EXPORTS BaseWindow
-{
-public:
- BaseWindow(const String& name, int flags=0);
- virtual ~BaseWindow();
- virtual void close();
- virtual void show(const Mat& mat);
- virtual void resize(Size size);
- virtual void move(Point topleft);
- virtual Size size() const;
- virtual Point topLeft() const;
- virtual void setGeometry(Point topLeft, Size size);
- virtual void getGeometry(Point& topLeft, Size& size) const;
- virtual String getTitle() const;
- virtual void setTitle(const String& str);
- virtual String getName() const;
- virtual void setScaleMode(int mode);
- virtual int getScaleMode();
- virtual void setScrollPos(double pos);
- virtual double getScrollPos() const;
- virtual void setScale(double scale);
- virtual double getScale() const;
- virtual Point getImageCoords(Point pos) const;
- virtual Scalar getPixelValue(Point pos, const String& colorspace=String()) const;
-
- virtual void addTrackbar( const String& trackbar, int low, int high, int step );
-};
-
-typedef Ptr<BaseWindow> Window;
-
-}*/
-
#endif /* __HIGHGUI_H_ */
View
15 modules/highgui/src/window.cpp
@@ -342,15 +342,16 @@ CV_IMPL void cvUpdateWindow(const char*)
#if defined (HAVE_QT)
-CvFont cv::fontQt(const String& nameFont, int pointSize, Scalar color, int weight, int style, int /*spacing*/)
+cv::QtFont cv::fontQt(const String& nameFont, int pointSize, Scalar color, int weight, int style, int /*spacing*/)
{
-return cvFontQt(nameFont.c_str(), pointSize,color,weight, style);
+ CvFont f = cvFontQt(nameFont.c_str(), pointSize,color,weight, style);
+ return *(cv::QtFont*)(&f);
}
-void cv::addText( const Mat& img, const String& text, Point org, CvFont font)
+void cv::addText( const Mat& img, const String& text, Point org, const QtFont& font)
{
CvMat _img = img;
- cvAddText( &_img, text.c_str(), org,&font);
+ cvAddText( &_img, text.c_str(), org, (CvFont*)&font);
}
void cv::displayStatusBar(const String& name, const String& text, int delayms)
@@ -390,13 +391,13 @@ int cv::createButton(const String& button_name, ButtonCallback on_change, void*
#else
-CvFont cv::fontQt(const String&, int, Scalar, int, int, int)
+cv::QtFont cv::fontQt(const String&, int, Scalar, int, int, int)
{
CV_Error(CV_StsNotImplemented, "The library is compiled without QT support");
- return CvFont();
+ return QtFont();
}
-void cv::addText( const Mat&, const String&, Point, CvFont)
+void cv::addText( const Mat&, const String&, Point, const QtFont&)
{
CV_Error(CV_StsNotImplemented, "The library is compiled without QT support");
}
View
10 modules/highgui/test/test_ffmpeg.cpp
@@ -95,15 +95,15 @@ class CV_FFmpegWriteBigVideoTest : public cvtest::BaseTest
double fps = fps0;
Size frame_s = Size(img_c, img_r);
- if( tag == CV_FOURCC('H', '2', '6', '1') )
+ if( tag == VideoWriter::fourcc('H', '2', '6', '1') )
frame_s = Size(352, 288);
- else if( tag == CV_FOURCC('H', '2', '6', '3') )
+ else if( tag == VideoWriter::fourcc('H', '2', '6', '3') )
frame_s = Size(704, 576);
/*else if( tag == CV_FOURCC('M', 'J', 'P', 'G') ||
tag == CV_FOURCC('j', 'p', 'e', 'g') )
frame_s = Size(1920, 1080);*/
- if( tag == CV_FOURCC('M', 'P', 'E', 'G') )
+ if( tag == VideoWriter::fourcc('M', 'P', 'E', 'G') )
fps = 25;
VideoWriter writer(filename, tag, fps, frame_s);
@@ -201,7 +201,7 @@ class CreateVideoWriterInvoker :
std::string fileName = tempfile(stream.str().c_str());
files->operator[](i) = fileName;
- writers->operator[](i) = new VideoWriter(fileName, CV_FOURCC('X','V','I','D'), 25.0f, FrameSize);
+ writers->operator[](i) = new VideoWriter(fileName, VideoWriter::fourcc('X','V','I','D'), 25.0f, FrameSize);
CV_Assert(writers->operator[](i)->isOpened());
}
@@ -311,7 +311,7 @@ class ReadImageAndTest :
CV_Assert(capture->isOpened());
const static double eps = 23.0;
- unsigned int frameCount = static_cast<unsigned int>(capture->get(CV_CAP_PROP_FRAME_COUNT));
+ unsigned int frameCount = static_cast<unsigned int>(capture->get(CAP_PROP_FRAME_COUNT));
CV_Assert(frameCount == WriteVideo_Invoker::FrameCount);
Mat reference(CreateVideoWriterInvoker::FrameSize, CV_8UC3);
View
4 modules/highgui/test/test_framecount.cpp
@@ -41,7 +41,7 @@
//M*/
#include "test_precomp.hpp"
-#include "opencv2/highgui.hpp"
+#include "opencv2/highgui/highgui_c.h"
#include <stdio.h>
using namespace cv;
@@ -91,7 +91,7 @@ void CV_FramecountTest::run(int)
FrameCount++;
}
- int framecount = (int)cvGetCaptureProperty(cap, CV_CAP_PROP_FRAME_COUNT);
+ int framecount = (int)cvGetCaptureProperty(cap, CAP_PROP_FRAME_COUNT);
ts->printf(cvtest::TS::LOG, "\nFile information (video %d): \n"\
"\nName: big_buck_bunny.%s\nActual frame count: %d\n"\
View
16 modules/highgui/test/test_grfmt.cpp
@@ -113,7 +113,7 @@ class CV_GrfmtWriteSequenceImageTest : public cvtest::BaseTest
imwrite(img_path, img);
ts->printf(ts->LOG, "reading test image : %s\n", img_path.c_str());
- Mat img_test = imread(img_path, CV_LOAD_IMAGE_UNCHANGED);
+ Mat img_test = imread(img_path, IMREAD_UNCHANGED);
if (img_test.empty()) ts->set_failed_test_info(ts->FAIL_MISMATCH);
@@ -140,11 +140,11 @@ class CV_GrfmtWriteSequenceImageTest : public cvtest::BaseTest
string filename = cv::tempfile(".jpg");
imwrite(filename, img);
- img = imread(filename, CV_LOAD_IMAGE_UNCHANGED);
+ img = imread(filename, IMREAD_UNCHANGED);
filename = string(ts->get_data_path() + "readwrite/test_" + char(k + 48) + "_c" + char(num_channels + 48) + ".jpg");
ts->printf(ts->LOG, "reading test image : %s\n", filename.c_str());
- Mat img_test = imread(filename, CV_LOAD_IMAGE_UNCHANGED);
+ Mat img_test = imread(filename, IMREAD_UNCHANGED);
if (img_test.empty()) ts->set_failed_test_info(ts->FAIL_MISMATCH);
@@ -171,7 +171,7 @@ class CV_GrfmtWriteSequenceImageTest : public cvtest::BaseTest
string filename = cv::tempfile(".tiff");
imwrite(filename, img);
ts->printf(ts->LOG, "reading test image : %s\n", filename.c_str());
- Mat img_test = imread(filename, CV_LOAD_IMAGE_UNCHANGED);
+ Mat img_test = imread(filename, IMREAD_UNCHANGED);
if (img_test.empty()) ts->set_failed_test_info(ts->FAIL_MISMATCH);
@@ -242,12 +242,12 @@ class CV_GrfmtPNGEncodeTest : public cvtest::BaseTest
Mat im = Mat::zeros(1000,1000, CV_8U);
//randu(im, 0, 256);
vector<int> param;
- param.push_back(CV_IMWRITE_PNG_COMPRESSION);
+ param.push_back(IMWRITE_PNG_COMPRESSION);
param.push_back(3); //default(3) 0-9.
cv::imencode(".png" ,im ,buff, param);
// hangs
- Mat im2 = imdecode(buff,CV_LOAD_IMAGE_ANYDEPTH);
+ Mat im2 = imdecode(buff,IMREAD_ANYDEPTH);
}
catch(...)
{
@@ -375,7 +375,7 @@ TEST(Highgui_WebP, encode_decode_lossless_webp)
remove(output.c_str());
- cv::Mat decode = cv::imdecode(buf, CV_LOAD_IMAGE_COLOR);
+ cv::Mat decode = cv::imdecode(buf, IMREAD_COLOR);
ASSERT_FALSE(decode.empty());
EXPECT_TRUE(cv::norm(decode, img_webp, NORM_INF) == 0);
@@ -394,7 +394,7 @@ TEST(Highgui_WebP, encode_decode_lossy_webp)
for(int q = 100; q>=0; q-=10)
{
std::vector<int> params;
- params.push_back(CV_IMWRITE_WEBP_QUALITY);
+ params.push_back(IMWRITE_WEBP_QUALITY);
params.push_back(q);
string output = cv::tempfile(".webp");
View
4 modules/highgui/test/test_gui.cpp
@@ -59,7 +59,7 @@ void Foo(int /*k*/, void* /*z*/) {}
void CV_HighGuiOnlyGuiTest::run( int /*start_from */)
{
ts->printf(ts->LOG, "GUI 0\n");
- cvDestroyAllWindows();
+ destroyAllWindows();
ts->printf(ts->LOG, "GUI 1\n");
namedWindow("Win");
@@ -84,7 +84,7 @@ void CV_HighGuiOnlyGuiTest::run( int /*start_from */)
waitKey(500);
ts->printf(ts->LOG, "GUI 8\n");
- cvDestroyAllWindows();
+ destroyAllWindows();
ts->set_failed_test_info(cvtest::TS::OK);
}
View
10 modules/highgui/test/test_positioning.cpp
@@ -41,7 +41,7 @@
//M*/
#include "test_precomp.hpp"
-#include "opencv2/highgui.hpp"
+#include "opencv2/highgui/highgui_c.h"
#include <stdio.h>
using namespace cv;
@@ -88,7 +88,7 @@ CV_VideoRandomPositioningTest::~CV_VideoRandomPositioningTest() {}
void CV_VideoPositioningTest::generate_idx_seq(CvCapture* cap, int method)
{
idx.clear();
- int N = (int)cvGetCaptureProperty(cap, CV_CAP_PROP_FRAME_COUNT);
+ int N = (int)cvGetCaptureProperty(cap, CAP_PROP_FRAME_COUNT);
switch(method)
{
case PROGRESSIVE:
@@ -147,7 +147,7 @@ void CV_VideoPositioningTest::run_test(int method)
failed_videos++; continue;
}
- cvSetCaptureProperty(cap, CV_CAP_PROP_POS_FRAMES, 0);
+ cvSetCaptureProperty(cap, CAP_PROP_POS_FRAMES, 0);
generate_idx_seq(cap, method);
@@ -157,7 +157,7 @@ void CV_VideoPositioningTest::run_test(int method)
{
bool flag = false;
- cvSetCaptureProperty(cap, CV_CAP_PROP_POS_FRAMES, idx.at(j));
+ cvSetCaptureProperty(cap, CAP_PROP_POS_FRAMES, idx.at(j));
/* IplImage* frame = cvRetrieveFrame(cap);
@@ -173,7 +173,7 @@ void CV_VideoPositioningTest::run_test(int method)
flag = !flag;
} */
- int val = (int)cvGetCaptureProperty(cap, CV_CAP_PROP_POS_FRAMES);
+ int val = (int)cvGetCaptureProperty(cap, CAP_PROP_POS_FRAMES);
if (idx.at(j) != val)
{
View
1  modules/highgui/test/test_precomp.hpp
@@ -12,6 +12,7 @@
#include <iostream>
#include "opencv2/ts.hpp"
#include "opencv2/imgproc.hpp"
+#include "opencv2/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/core/private.hpp"
View
24 modules/highgui/test/test_video_io.cpp
@@ -41,7 +41,7 @@
//M*/
#include "test_precomp.hpp"
-#include "opencv2/highgui.hpp"
+#include "opencv2/highgui/highgui_c.h"
using namespace cv;
using namespace std;
@@ -56,15 +56,15 @@ string fourccToString(int fourcc)
const VideoFormat g_specific_fmt_list[] =
{
- VideoFormat("avi", CV_FOURCC('X', 'V', 'I', 'D')),
- VideoFormat("avi", CV_FOURCC('M', 'P', 'E', 'G')),
- VideoFormat("avi", CV_FOURCC('M', 'J', 'P', 'G')),
- //VideoFormat("avi", CV_FOURCC('I', 'Y', 'U', 'V')),
- VideoFormat("mkv", CV_FOURCC('X', 'V', 'I', 'D')),
- VideoFormat("mkv", CV_FOURCC('M', 'P', 'E', 'G')),
- VideoFormat("mkv", CV_FOURCC('M', 'J', 'P', 'G')),
-
- VideoFormat("mov", CV_FOURCC('m', 'p', '4', 'v')),
+ VideoFormat("avi", VideoWriter::fourcc('X', 'V', 'I', 'D')),
+ VideoFormat("avi", VideoWriter::fourcc('M', 'P', 'E', 'G')),
+ VideoFormat("avi", VideoWriter::fourcc('M', 'J', 'P', 'G')),
+ //VideoFormat("avi", VideoWriter::fourcc('I', 'Y', 'U', 'V')),
+ VideoFormat("mkv", VideoWriter::fourcc('X', 'V', 'I', 'D')),
+ VideoFormat("mkv", VideoWriter::fourcc('M', 'P', 'E', 'G')),
+ VideoFormat("mkv", VideoWriter::fourcc('M', 'J', 'P', 'G')),
+
+ VideoFormat("mov", VideoWriter::fourcc('m', 'p', '4', 'v')),
VideoFormat()
};
@@ -416,7 +416,7 @@ void CV_HighGuiTest::SpecificVideoTest(const string& dir, const cvtest::VideoFor
for( size_t i = 0; i < IMAGE_COUNT; ++i )
{
string file_path = format("%s../python/images/QCIF_%02d.bmp", dir.c_str(), i);
- Mat img = imread(file_path, CV_LOAD_IMAGE_COLOR);
+ Mat img = imread(file_path, IMREAD_COLOR);
if (img.empty())
{
@@ -442,7 +442,7 @@ void CV_HighGuiTest::SpecificVideoTest(const string& dir, const cvtest::VideoFor
writer.release();
VideoCapture cap(video_file);
- size_t FRAME_COUNT = (size_t)cap.get(CV_CAP_PROP_FRAME_COUNT);
+ size_t FRAME_COUNT = (size_t)cap.get(CAP_PROP_FRAME_COUNT);
if (FRAME_COUNT != IMAGE_COUNT )
{
View
10 modules/highgui/test/test_video_pos.cpp
@@ -110,9 +110,9 @@ class CV_PositioningTest : public cvtest::BaseTest
return;
}
- int N0 = (int)cap.get(CV_CAP_PROP_FRAME_COUNT);
- cap.set(CV_CAP_PROP_POS_FRAMES, 0);
- int N = (int)cap.get(CV_CAP_PROP_FRAME_COUNT);
+ int N0 = (int)cap.get(CAP_PROP_FRAME_COUNT);
+ cap.set(CAP_PROP_POS_FRAMES, 0);
+ int N = (int)cap.get(CAP_PROP_FRAME_COUNT);
if (N != n_frames || N != N0)
{
@@ -125,14 +125,14 @@ class CV_PositioningTest : public cvtest::BaseTest
{
int idx = theRNG().uniform(0, N);
- if( !cap.set(CV_CAP_PROP_POS_FRAMES, idx) )
+ if( !cap.set(CAP_PROP_POS_FRAMES, idx) )
{
ts->printf(ts->LOG, "\nError: cannot seek to frame %d.\n", idx);
ts->set_failed_test_info(ts->FAIL_INVALID_OUTPUT);
return;
}
- int idx1 = (int)cap.get(CV_CAP_PROP_POS_FRAMES);
+ int idx1 = (int)cap.get(CAP_PROP_POS_FRAMES);
Mat img; cap >> img;
Mat img0 = drawFrame(idx);
View
16 modules/imgproc/test/test_color.cpp
@@ -1687,8 +1687,8 @@ TEST(Imgproc_ColorBayer, regression)
{
cvtest::TS* ts = cvtest::TS::ptr();
- Mat given = imread(string(ts->get_data_path()) + "/cvtcolor/bayer_input.png", CV_LOAD_IMAGE_GRAYSCALE);
- Mat gold = imread(string(ts->get_data_path()) + "/cvtcolor/bayer_gold.png", CV_LOAD_IMAGE_UNCHANGED);
+ Mat given = imread(string(ts->get_data_path()) + "/cvtcolor/bayer_input.png", IMREAD_GRAYSCALE);
+ Mat gold = imread(string(ts->get_data_path()) + "/cvtcolor/bayer_gold.png", IMREAD_UNCHANGED);
Mat result;
CV_Assert(given.data != NULL && gold.data != NULL);
@@ -1709,9 +1709,9 @@ TEST(Imgproc_ColorBayerVNG, regression)
{
cvtest::TS* ts = cvtest::TS::ptr();
- Mat given = imread(string(ts->get_data_path()) + "/cvtcolor/bayer_input.png", CV_LOAD_IMAGE_GRAYSCALE);
+ Mat given = imread(string(ts->get_data_path()) + "/cvtcolor/bayer_input.png", IMREAD_GRAYSCALE);
string goldfname = string(ts->get_data_path()) + "/cvtcolor/bayerVNG_gold.png";
- Mat gold = imread(goldfname, CV_LOAD_IMAGE_UNCHANGED);
+ Mat gold = imread(goldfname, IMREAD_UNCHANGED);
Mat result;
CV_Assert(given.data != NULL);
@@ -1804,7 +1804,7 @@ TEST(Imgproc_ColorBayerVNG_Strict, regression)
Mat src, dst, bayer, reference;
std::string full_path = parent_path + image_name;
- src = imread(full_path, CV_LOAD_IMAGE_UNCHANGED);
+ src = imread(full_path, IMREAD_UNCHANGED);
if (src.data == NULL)
{
@@ -1824,7 +1824,7 @@ TEST(Imgproc_ColorBayerVNG_Strict, regression)
// reading a reference image
full_path = parent_path + pattern[i] + image_name;
- reference = imread(full_path, CV_LOAD_IMAGE_UNCHANGED);
+ reference = imread(full_path, IMREAD_UNCHANGED);
if (reference.data == NULL)
{
imwrite(full_path, dst);
@@ -2091,7 +2091,7 @@ TEST(ImgProc_BayerEdgeAwareDemosaicing, accuracy)
Mat src, bayer;
std::string full_path = parent_path + image_name;
- src = imread(full_path, CV_LOAD_IMAGE_UNCHANGED);
+ src = imread(full_path, IMREAD_UNCHANGED);
if (src.data == NULL)
{
@@ -2141,7 +2141,7 @@ TEST(ImgProc_BayerEdgeAwareDemosaicing, accuracy)
TEST(ImgProc_Bayer2RGBA, accuracy)
{
cvtest::TS* ts = cvtest::TS::ptr();
- Mat raw = imread(string(ts->get_data_path()) + "/cvtcolor/bayer_input.png", CV_LOAD_IMAGE_GRAYSCALE);
+ Mat raw = imread(string(ts->get_data_path()) + "/cvtcolor/bayer_input.png", IMREAD_GRAYSCALE);
Mat rgb, reference;
CV_Assert(raw.channels() == 1);
View
4 modules/imgproc/test/test_grabcut.cpp
@@ -143,8 +143,8 @@ TEST(Imgproc_GrabCut, repeatability)
{
cvtest::TS& ts = *cvtest::TS::ptr();
- Mat image_1 = imread(string(ts.get_data_path()) + "grabcut/image1652.ppm", CV_LOAD_IMAGE_COLOR);
- Mat mask_1 = imread(string(ts.get_data_path()) + "grabcut/mask1652.ppm", CV_LOAD_IMAGE_GRAYSCALE);
+ Mat image_1 = imread(string(ts.get_data_path()) + "grabcut/image1652.ppm", IMREAD_COLOR);
+ Mat mask_1 = imread(string(ts.get_data_path()) + "grabcut/mask1652.ppm", IMREAD_GRAYSCALE);
Rect roi_1(0, 0, 150, 150);
Mat image_2 = image_1.clone();
View
4 modules/imgproc/test/test_precomp.hpp
@@ -12,8 +12,8 @@
#include <iostream>
#include "opencv2/ts.hpp"
#include "opencv2/imgproc.hpp"
-#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/highgui.hpp"
-#include "opencv2/highgui/highgui_c.h"
+
+#include "opencv2/imgproc/imgproc_c.h"
#endif
View
5 modules/java/generator/src/cpp/VideoCapture.cpp
@@ -4,7 +4,6 @@
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_HIGHGUI
-#include "opencv2/highgui/highgui_c.h"
#include "opencv2/highgui.hpp"
using namespace cv;
@@ -394,7 +393,7 @@ JNIEXPORT jstring JNICALL Java_org_opencv_highgui_VideoCapture_n_1getSupportedPr
VideoCapture* me = (VideoCapture*) self; //TODO: check for NULL
union {double prop; const char* name;} u;
- u.prop = me->get(CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING);
+ u.prop = me->get(CAP_PROP_ANDROID_PREVIEW_SIZES_STRING);
return env->NewStringUTF(u.name);
} catch(cv::Exception e) {
@@ -432,4 +431,4 @@ JNIEXPORT void JNICALL Java_org_opencv_highgui_VideoCapture_n_1delete
} // extern "C"
-#endif // HAVE_OPENCV_HIGHGUI
+#endif // HAVE_OPENCV_HIGHGUI
View
11 modules/legacy/src/oneway.cpp
@@ -669,7 +669,7 @@ namespace cv{
cvConvertScale(m_samples[i], patch, 255/maxval);
#ifdef HAVE_OPENCV_HIGHGUI
- cvSaveImage(buf, patch);
+ cv::imwrite(buf, cv::cvarrToMat(patch));
#else
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without image I/O support");
#endif
@@ -1801,17 +1801,16 @@ namespace cv{
sprintf(filename, "%s/%s", path, imagename);
//printf("Reading image %s...", filename);
- IplImage* img = 0;
+ IplImage img;
#ifdef HAVE_OPENCV_HIGHGUI
- img = cvLoadImage(filename, CV_LOAD_IMAGE_GRAYSCALE);
+ Mat img2 = cv::imread(filename, IMREAD_GRAYSCALE);
+ img = img2;
#else
CV_Error(CV_StsNotImplemented, "OpenCV has been compiled without image I/O support");
#endif
//printf("done\n");
- extractPatches (img, patches, patch_size);
-
- cvReleaseImage(&img);
+ extractPatches (&img, patches, patch_size);
}
fclose(pFile);
}
View
6 modules/objdetect/src/latentsvm.cpp
@@ -389,7 +389,7 @@ int showRootFilterBoxes(IplImage *image,
color, thickness, line_type, shift);
}
#ifdef HAVE_OPENCV_HIGHGUI
- cvShowImage("Initial image", image);
+ cv::imshow("Initial image", cv::cvarrToMat(image));
#endif
return LATENT_SVM_OK;
}
@@ -445,7 +445,7 @@ int showPartFilterBoxes(IplImage *image,
}
}
#ifdef HAVE_OPENCV_HIGHGUI
- cvShowImage("Initial image", image);
+ cv::imshow("Initial image", cv::cvarrToMat(image));
#endif
return LATENT_SVM_OK;
}
@@ -481,7 +481,7 @@ int showBoxes(IplImage *img,
color, thickness, line_type, shift);
}
#ifdef HAVE_OPENCV_HIGHGUI
- cvShowImage("Initial image", img);
+ cv::imshow("Initial image", cv::cvarrToMat(img));
#endif
return LATENT_SVM_OK;
}
View
9 modules/objdetect/test/test_latentsvmdetector.cpp
@@ -82,8 +82,9 @@ void CV_LatentSVMDetectorTest::run( int /* start_from */)
init.initialize(numThreads);
#endif
- IplImage* image = cvLoadImage(img_path.c_str());
- if (!image)
+ Mat image2 = cv::imread(img_path.c_str());
+ IplImage image = image2;
+ if (image2.empty())
{
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
return;
@@ -93,13 +94,12 @@ void CV_LatentSVMDetectorTest::run( int /* start_from */)
if (!detector)
{
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_TEST_DATA );
- cvReleaseImage(&image);
return;
}
CvMemStorage* storage = cvCreateMemStorage(0);
CvSeq* detections = 0;
- detections = cvLatentSvmDetectObjects(image, detector, storage, 0.5f, numThreads);
+ detections = cvLatentSvmDetectObjects(&image, detector, storage, 0.5f, numThreads);
if (detections->total != num_detections)
{
ts->set_failed_test_info( cvtest::TS::FAIL_MISMATCH );
@@ -124,7 +124,6 @@ void CV_LatentSVMDetectorTest::run( int /* start_from */)
#endif
cvReleaseMemStorage( &storage );
cvReleaseLatentSvmDetector( &detector );
- cvReleaseImage( &image );
}
// Test for c++ version of Latent SVM
View
2  modules/ocl/perf/perf_canny.cpp
@@ -47,7 +47,7 @@
///////////// Canny ////////////////////////
TEST(Canny)
{
- Mat img = imread(abspath("aloeL.jpg"), CV_LOAD_IMAGE_GRAYSCALE);
+ Mat img = imread(abspath("aloeL.jpg"), IMREAD_GRAYSCALE);
if (img.empty())
{
View
2  modules/ocl/perf/perf_haar.cpp
@@ -84,7 +84,7 @@ class CascadeClassifier_GPU : public OclCascadeClassifier
}
TEST(Haar)
{
- Mat img = imread(abspath("basketball1.png"), CV_LOAD_IMAGE_GRAYSCALE);
+ Mat img = imread(abspath("basketball1.png"), IMREAD_GRAYSCALE);
if (img.empty())
{
View
16 modules/photo/test/test_denoising.cpp
@@ -62,8 +62,8 @@ TEST(Photo_DenoisingGrayscale, regression)
string original_path = folder + "lena_noised_gaussian_sigma=10.png";
string expected_path = folder + "lena_noised_denoised_grayscale_tw=7_sw=21_h=10.png";
- Mat original = imread(original_path, CV_LOAD_IMAGE_GRAYSCALE);
- Mat expected = imread(expected_path, CV_LOAD_IMAGE_GRAYSCALE);
+ Mat original = imread(original_path, IMREAD_GRAYSCALE);
+ Mat expected = imread(expected_path, IMREAD_GRAYSCALE);
ASSERT_FALSE(original.empty()) << "Could not load input image " << original_path;
ASSERT_FALSE(expected.empty()) << "Could not load reference image " << expected_path;
@@ -82,8 +82,8 @@ TEST(Photo_DenoisingColored, regression)
string original_path = folder + "lena_noised_gaussian_sigma=10.png";
string expected_path = folder + "lena_noised_denoised_lab12_tw=7_sw=21_h=10_h2=10.png";
- Mat original = imread(original_path, CV_LOAD_IMAGE_COLOR);
- Mat expected = imread(expected_path, CV_LOAD_IMAGE_COLOR);
+ Mat original = imread(original_path, IMREAD_COLOR);
+ Mat expected = imread(expected_path, IMREAD_COLOR);
ASSERT_FALSE(original.empty()) << "Could not load input image " << original_path;
ASSERT_FALSE(expected.empty()) << "Could not load reference image " << expected_path;
@@ -102,14 +102,14 @@ TEST(Photo_DenoisingGrayscaleMulti, regression)
string folder = string(cvtest::TS::ptr()->get_data_path()) + "denoising/";
string expected_path = folder + "lena_noised_denoised_multi_tw=7_sw=21_h=15.png";
- Mat expected = imread(expected_path, CV_LOAD_IMAGE_GRAYSCALE);
+ Mat expected = imread(expected_path, IMREAD_GRAYSCALE);
ASSERT_FALSE(expected.empty()) << "Could not load reference image " << expected_path;
vector<Mat> original(imgs_count);
for (int i = 0; i < imgs_count; i++)
{
string original_path = format("%slena_noised_gaussian_sigma=20_multi_%d.png", folder.c_str(), i);
- original[i] = imread(original_path, CV_LOAD_IMAGE_GRAYSCALE);
+ original[i] = imread(original_path, IMREAD_GRAYSCALE);
ASSERT_FALSE(original[i].empty()) << "Could not load input image " << original_path;
}
@@ -127,14 +127,14 @@ TEST(Photo_DenoisingColoredMulti, regression)
string folder = string(cvtest::TS::ptr()->get_data_path()) + "denoising/";
string expected_path = folder + "lena_noised_denoised_multi_lab12_tw=7_sw=21_h=10_h2=15.png";
- Mat expected = imread(expected_path, CV_LOAD_IMAGE_COLOR);
+ Mat expected = imread(expected_path, IMREAD_COLOR);
ASSERT_FALSE(expected.empty()) << "Could not load reference image " << expected_path;
vector<Mat> original(imgs_count);
for (int i = 0; i < imgs_count; i++)
{
string original_path = format("%slena_noised_gaussian_sigma=20_multi_%d.png", folder.c_str(), i);
- original[i] = imread(original_path, CV_LOAD_IMAGE_COLOR);
+ original[i] = imread(original_path, IMREAD_COLOR);
ASSERT_FALSE(original[i].empty()) << "Could not load input image " << original_path;
}
View
2  modules/python/src2/cv2.cpp
@@ -23,6 +23,8 @@
#include "opencv2/photo.hpp"
#include "opencv2/highgui.hpp"
+#include "opencv2/highgui/highgui_c.h"
+
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_NONFREE
View
1  modules/python/src2/cv2.cv.hpp
@@ -1,5 +1,6 @@
#include "opencv2/legacy.hpp"
#include "opencv2/legacy/compat.hpp"
+#include "opencv2/highgui/highgui_c.h"
#define OLD_MODULESTR "cv2.cv"
View
1  modules/python/src2/gen2.py
@@ -211,6 +211,7 @@
simple_argtype_mapping = {
"bool": ("bool", "b", "0"),
+ "char": ("char", "b", "0"),
"int": ("int", "i", "0"),
"float": ("float", "f", "0.f"),
"double": ("double", "d", "0"),
View
4 modules/video/test/test_camshift.cpp
@@ -345,7 +345,7 @@ int CV_CamShiftTest::validate_test_results( int /*test_case_idx*/ )
if( code < 0 )
{
-#if defined _DEBUG && defined WIN32
+#if 0 //defined _DEBUG && defined WIN32
IplImage* dst = cvCreateImage( img_size, 8, 3 );
cvNamedWindow( "test", 1 );
cvCmpS( img, 0, img, CV_CMP_GT );
@@ -484,7 +484,7 @@ int CV_MeanShiftTest::validate_test_results( int /*test_case_idx*/ )
if( code < 0 )
{
-#if defined _DEBUG && defined WIN32
+#if 0// defined _DEBUG && defined WIN32
IplImage* dst = cvCreateImage( img_size, 8, 3 );
cvNamedWindow( "test", 1 );
cvCmpS( img, 0, img, CV_CMP_GT );
View
20 modules/video/test/test_optflowpyrlk.cpp
@@ -72,8 +72,9 @@ void CV_OptFlowPyrLKTest::run( int )
CvMat *_u = 0, *_v = 0, *_v2 = 0;
char* status = 0;
- IplImage* imgI = 0;
- IplImage* imgJ = 0;
+ IplImage imgI;
+ IplImage imgJ;
+ cv::Mat imgI2, imgJ2;
int n = 0, i = 0;
@@ -115,9 +116,10 @@ void CV_OptFlowPyrLKTest::run( int )
/* read first image */
sprintf( filename, "%soptflow/%s", ts->get_data_path().c_str(), "rock_1.bmp" );
- imgI = cvLoadImage( filename, -1 );
+ imgI2 = cv::imread( filename, cv::IMREAD_UNCHANGED );
+ imgI = imgI2;
- if( !imgI )
+ if( imgI2.empty() )
{
ts->printf( cvtest::TS::LOG, "could not read %s\n", filename );
code = cvtest::TS::FAIL_MISSING_TEST_DATA;
@@ -126,9 +128,10 @@ void CV_OptFlowPyrLKTest::run( int )
/* read second image */
sprintf( filename, "%soptflow/%s", ts->get_data_path().c_str(), "rock_2.bmp" );
- imgJ = cvLoadImage( filename, -1 );
+ imgJ2 = cv::imread( filename, cv::IMREAD_UNCHANGED );
+ imgJ = imgJ2;
- if( !imgJ )
+ if( imgJ2.empty() )
{
ts->printf( cvtest::TS::LOG, "could not read %s\n", filename );
code = cvtest::TS::FAIL_MISSING_TEST_DATA;
@@ -139,7 +142,7 @@ void CV_OptFlowPyrLKTest::run( int )
status = (char*)cvAlloc(n*sizeof(status[0]));
/* calculate flow */
- cvCalcOpticalFlowPyrLK( imgI, imgJ, 0, 0, u, v2, n, cvSize( 41, 41 ),
+ cvCalcOpticalFlowPyrLK( &imgI, &imgJ, 0, 0, u, v2, n, cvSize( 41, 41 ),
4, status, 0, cvTermCriteria( CV_TERMCRIT_ITER|
CV_TERMCRIT_EPS, 30, 0.01f ), 0 );
@@ -201,9 +204,6 @@ void CV_OptFlowPyrLKTest::run( int )
cvReleaseMat( &_v );
cvReleaseMat( &_v2 );
- cvReleaseImage( &imgI );
- cvReleaseImage( &imgJ );
-
if( code < 0 )
ts->set_failed_test_info( code );
}
View
8 modules/videostab/src/frame_source.cpp
@@ -84,10 +84,10 @@ class VideoFileSourceImpl : public IFrameSource
}
#ifdef HAVE_OPENCV_HIGHGUI
- int width() {return static_cast<int>(vc.get(CV_CAP_PROP_FRAME_WIDTH));}
- int height() {return static_cast<int>(vc.get(CV_CAP_PROP_FRAME_HEIGHT));}
- int count() {return static_cast<int>(vc.get(CV_CAP_PROP_FRAME_COUNT));}
- double fps() {return vc.get(CV_CAP_PROP_FPS);}
+ int width() {return static_cast<int>(vc.get(CAP_PROP_FRAME_WIDTH));}
+ int height() {return static_cast<int>(vc.get(CAP_PROP_FRAME_HEIGHT));}
+ int count() {return static_cast<int>(vc.get(CAP_PROP_FRAME_COUNT));}
+ double fps() {return vc.get(CAP_PROP_FPS);}
#else
int width() {return 0;}
int height() {return 0;}
View
2  samples/c/adaptiveskindetector.cpp
@@ -40,7 +40,7 @@
#include <cstring>
#include <ctime>
#include "opencv2/contrib/contrib.hpp"
-#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/highgui/highgui_c.h"
static void help(char **argv)
{
View
2  samples/c/bgfg_codebook.cpp
@@ -24,7 +24,7 @@
#include "opencv2/core/utility.hpp"
#include "opencv2/video/background_segm.hpp"
#include "opencv2/imgproc/imgproc_c.h"
-#include "opencv2/highgui.hpp"
+#include "opencv2/highgui/highgui_c.h"
#include "opencv2/legacy.hpp"
#include <stdio.h>
View
2  samples/c/blobtrack_sample.cpp
@@ -1,7 +1,7 @@
#include "opencv2/video/background_segm.hpp"
#include "opencv2/legacy/blobtrack.hpp"
#include "opencv2/legacy/legacy.hpp"
-#include "opencv2/highgui/highgui.hpp"
+#include <opencv2/highgui/highgui_c.h>
#include <opencv2/imgproc/imgproc_c.h>
#include <stdio.h>
View
2  samples/c/convert_cascade.c
@@ -1,5 +1,5 @@
#include "opencv2/objdetect/objdetect.hpp"
-#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/highgui/highgui_c.h"
#include <ctype.h>
#include <stdio.h>
View
8 samples/c/facedetect.cpp
@@ -1,8 +1,10 @@
-#include "opencv2/objdetect/objdetect.hpp"
-#include "opencv2/highgui/highgui.hpp"
-#include "opencv2/imgproc/imgproc.hpp"
+#include "opencv2/objdetect.hpp"
+#include "opencv2/highgui.hpp"
+#include "opencv2/imgproc.hpp"
#include "opencv2/core/utility.hpp"
+#include "opencv2/highgui/highgui_c.h"
+
#include <cctype>
#include <iostream>
#include <iterator>
View
2  samples/c/fback_c.c
@@ -1,5 +1,5 @@
#include "opencv2/video/tracking.hpp"
-#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/highgui/highgui_c.h"
#include "opencv2/imgproc/imgproc_c.h"
#include <stdio.h>
View
2  samples/c/find_obj.cpp
@@ -6,10 +6,10 @@
*/
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/features2d/features2d.hpp"
-#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/imgproc/imgproc_c.h"
+#include "opencv2/highgui/highgui_c.h"
#include "opencv2/legacy/legacy.hpp"
#include "opencv2/legacy/compat.hpp"
View
4 samples/c/find_obj_calonder.cpp