Make imgproc.hpp independent from C API

pull/785/head
Andrey Kamaev 12 years ago
parent 7ac0d86992
commit 288a0634c2
  1. 3
      apps/traincascade/imagestorage.cpp
  2. 1
      include/opencv/cv.h
  3. 2
      include/opencv/cv.hpp
  4. 1
      include/opencv/cvaux.h
  5. 1
      include/opencv/highgui.h
  6. 13
      modules/gpu/perf/perf_imgproc.cpp
  7. 1468
      modules/imgproc/include/opencv2/imgproc.hpp
  8. 22
      modules/imgproc/include/opencv2/imgproc/types_c.h
  9. 284
      modules/imgproc/perf/perf_cvt_color.cpp
  10. 14
      modules/imgproc/perf/perf_matchTemplate.cpp
  11. 2
      modules/imgproc/src/corner.cpp
  12. 4
      modules/imgproc/src/histogram.cpp
  13. 19
      modules/imgproc/src/moments.cpp
  14. 3
      modules/imgproc/src/morph.cpp
  15. 1
      modules/legacy/include/opencv2/legacy.hpp
  16. 2
      modules/legacy/include/opencv2/legacy/legacy.hpp
  17. 4
      modules/nonfree/test/test_detectors.cpp
  18. 4
      modules/objdetect/test/test_cascadeandhog.cpp
  19. 4
      modules/ocl/include/opencv2/ocl/private/util.hpp
  20. 10
      modules/ocl/perf/perf_color.cpp
  21. 20
      modules/ocl/perf/perf_match_template.cpp
  22. 7
      modules/ocl/test/test_color.cpp
  23. 2
      modules/ocl/test/test_haar.cpp
  24. 10
      modules/ocl/test/test_hog.cpp
  25. 2
      modules/ocl/test/utility.cpp
  26. 8
      modules/photo/src/denoising.cpp
  27. 6
      modules/photo/src/inpaint.cpp
  28. 2
      modules/photo/test/test_inpaint.cpp
  29. 2
      modules/stitching/src/blenders.cpp
  30. 8
      modules/stitching/src/matchers.cpp
  31. 12
      modules/stitching/src/seam_finders.cpp
  32. 2
      modules/ts/src/gpu_test.cpp
  33. 4
      modules/video/include/opencv2/video/tracking.hpp
  34. 4
      samples/c/delaunay.c
  35. 2
      samples/c/facedetect.cpp
  36. 4
      samples/c/polar_transforms.c
  37. 5
      samples/c/pyramid_segmentation.c
  38. 2
      samples/c/smiledetect.cpp
  39. 4
      samples/cpp/3calibration.cpp
  40. 2
      samples/cpp/build3dmodel.cpp
  41. 2
      samples/cpp/calibration.cpp
  42. 2
      samples/cpp/chamfer.cpp
  43. 2
      samples/cpp/detection_based_tracker_sample.cpp
  44. 42
      samples/cpp/distrans.cpp
  45. 2
      samples/cpp/edge.cpp
  46. 10
      samples/cpp/ffilldemo.cpp
  47. 2
      samples/cpp/fitellipse.cpp
  48. 4
      samples/cpp/houghcircles.cpp
  49. 2
      samples/cpp/houghlines.cpp
  50. 4
      samples/cpp/image.cpp
  51. 10
      samples/cpp/laplace.cpp
  52. 4
      samples/cpp/morphology2.cpp
  53. 2
      samples/cpp/phase_corr.cpp
  54. 4
      samples/cpp/rgbdodometry.cpp
  55. 2
      samples/cpp/segment_objects.cpp
  56. 2
      samples/cpp/squares.cpp
  57. 8
      samples/cpp/stereo_calib.cpp
  58. 2
      samples/cpp/tutorial_code/Histograms_Matching/EqualizeHist_Demo.cpp
  59. 2
      samples/cpp/tutorial_code/Histograms_Matching/MatchTemplate_Demo.cpp
  60. 2
      samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo1.cpp
  61. 2
      samples/cpp/tutorial_code/Histograms_Matching/calcBackProject_Demo2.cpp
  62. 6
      samples/cpp/tutorial_code/Histograms_Matching/compareHist_Demo.cpp
  63. 2
      samples/cpp/tutorial_code/ImgProc/Threshold.cpp
  64. 2
      samples/cpp/tutorial_code/ImgTrans/CannyDetector_Demo.cpp
  65. 4
      samples/cpp/tutorial_code/ImgTrans/HoughCircle_Demo.cpp
  66. 6
      samples/cpp/tutorial_code/ImgTrans/HoughLines_Demo.cpp
  67. 2
      samples/cpp/tutorial_code/ImgTrans/Laplace_Demo.cpp
  68. 2
      samples/cpp/tutorial_code/ImgTrans/Remap_Demo.cpp
  69. 2
      samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp
  70. 4
      samples/cpp/tutorial_code/ShapeDescriptors/findContours_demo.cpp
  71. 4
      samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo1.cpp
  72. 4
      samples/cpp/tutorial_code/ShapeDescriptors/generalContours_demo2.cpp
  73. 4
      samples/cpp/tutorial_code/ShapeDescriptors/hull_demo.cpp
  74. 4
      samples/cpp/tutorial_code/ShapeDescriptors/moments_demo.cpp
  75. 2
      samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo.cpp
  76. 2
      samples/cpp/tutorial_code/TrackingMotion/cornerHarris_Demo.cpp
  77. 2
      samples/cpp/tutorial_code/TrackingMotion/cornerSubPix_Demo.cpp
  78. 2
      samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo.cpp
  79. 2
      samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp
  80. 4
      samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp
  81. 2
      samples/cpp/tutorial_code/objectDetection/objectDetection.cpp
  82. 2
      samples/cpp/tutorial_code/objectDetection/objectDetection2.cpp
  83. 2
      samples/cpp/video_dmtx.cpp
  84. 2
      samples/cpp/video_homography.cpp
  85. 6
      samples/cpp/watershed.cpp
  86. 4
      samples/gpu/cascadeclassifier.cpp
  87. 6
      samples/gpu/generalized_hough.cpp
  88. 8
      samples/gpu/hog.cpp
  89. 2
      samples/gpu/houghlines.cpp
  90. 6
      samples/gpu/morphology.cpp
  91. 12
      samples/gpu/stereo_match.cpp
  92. 2
      samples/ocl/facedetect.cpp
  93. 8
      samples/ocl/hog.cpp
  94. 2
      samples/ocl/squares.cpp
  95. 8
      samples/ocl/surf_matcher.cpp

@ -1,6 +1,7 @@
#include "opencv2/core.hpp" #include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "cv.h"
#include "imagestorage.h" #include "imagestorage.h"
#include <stdio.h> #include <stdio.h>
#include <iostream> #include <iostream>

@ -62,7 +62,6 @@
#include "opencv2/core/core_c.h" #include "opencv2/core/core_c.h"
#include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/imgproc.hpp"
#include "opencv2/video.hpp" #include "opencv2/video.hpp"
#include "opencv2/features2d.hpp" #include "opencv2/features2d.hpp"
#include "opencv2/flann.hpp" #include "opencv2/flann.hpp"

@ -49,5 +49,7 @@
#include "cv.h" #include "cv.h"
#include "opencv2/core.hpp" #include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#endif #endif

@ -48,7 +48,6 @@
#include "opencv2/core/core_c.h" #include "opencv2/core/core_c.h"
#include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/imgproc.hpp"
#include "opencv2/video.hpp" #include "opencv2/video.hpp"
#include "opencv2/features2d.hpp" #include "opencv2/features2d.hpp"
#include "opencv2/calib3d.hpp" #include "opencv2/calib3d.hpp"

@ -44,6 +44,5 @@
#include "opencv2/core/core_c.h" #include "opencv2/core/core_c.h"
#include "opencv2/highgui/highgui_c.h" #include "opencv2/highgui/highgui_c.h"
#include "opencv2/highgui.hpp"
#endif #endif

@ -1815,12 +1815,17 @@ PERF_TEST_P(Sz_Dp_MinDist, ImgProc_HoughCircles,
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// GeneralizedHough // GeneralizedHough
CV_FLAGS(GHMethod, cv::GHT_POSITION, cv::GHT_SCALE, cv::GHT_ROTATION); enum { GHT_POSITION = cv::GeneralizedHough::GHT_POSITION,
GHT_SCALE = cv::GeneralizedHough::GHT_SCALE,
GHT_ROTATION = cv::GeneralizedHough::GHT_ROTATION
};
CV_FLAGS(GHMethod, GHT_POSITION, GHT_SCALE, GHT_ROTATION);
DEF_PARAM_TEST(Method_Sz, GHMethod, cv::Size); DEF_PARAM_TEST(Method_Sz, GHMethod, cv::Size);
PERF_TEST_P(Method_Sz, ImgProc_GeneralizedHough, PERF_TEST_P(Method_Sz, ImgProc_GeneralizedHough,
Combine(Values(GHMethod(cv::GHT_POSITION), GHMethod(cv::GHT_POSITION | cv::GHT_SCALE), GHMethod(cv::GHT_POSITION | cv::GHT_ROTATION), GHMethod(cv::GHT_POSITION | cv::GHT_SCALE | cv::GHT_ROTATION)), Combine(Values(GHMethod(GHT_POSITION), GHMethod(GHT_POSITION | GHT_SCALE), GHMethod(GHT_POSITION | GHT_ROTATION), GHMethod(GHT_POSITION | GHT_SCALE | GHT_ROTATION)),
GPU_TYPICAL_MAT_SIZES)) GPU_TYPICAL_MAT_SIZES))
{ {
declare.time(10); declare.time(10);
@ -1870,7 +1875,7 @@ PERF_TEST_P(Method_Sz, ImgProc_GeneralizedHough,
cv::gpu::GpuMat posAndVotes; cv::gpu::GpuMat posAndVotes;
cv::Ptr<cv::gpu::GeneralizedHough_GPU> d_hough = cv::gpu::GeneralizedHough_GPU::create(method); cv::Ptr<cv::gpu::GeneralizedHough_GPU> d_hough = cv::gpu::GeneralizedHough_GPU::create(method);
if (method & cv::GHT_ROTATION) if (method & GHT_ROTATION)
{ {
d_hough->set("maxAngle", 90.0); d_hough->set("maxAngle", 90.0);
d_hough->set("angleStep", 2.0); d_hough->set("angleStep", 2.0);
@ -1888,7 +1893,7 @@ PERF_TEST_P(Method_Sz, ImgProc_GeneralizedHough,
cv::Mat positions; cv::Mat positions;
cv::Ptr<cv::GeneralizedHough> hough = cv::GeneralizedHough::create(method); cv::Ptr<cv::GeneralizedHough> hough = cv::GeneralizedHough::create(method);
if (method & cv::GHT_ROTATION) if (method & GHT_ROTATION)
{ {
hough->set("maxAngle", 90.0); hough->set("maxAngle", 90.0);
hough->set("angleStep", 2.0); hough->set("angleStep", 2.0);

File diff suppressed because it is too large Load Diff

@ -45,6 +45,10 @@
#include "opencv2/core/core_c.h" #include "opencv2/core/core_c.h"
#ifdef __cplusplus
# include "opencv2/imgproc.hpp"
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -383,6 +387,24 @@ typedef struct CvMoments
double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /* spatial moments */ double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /* spatial moments */
double mu20, mu11, mu02, mu30, mu21, mu12, mu03; /* central moments */ double mu20, mu11, mu02, mu30, mu21, mu12, mu03; /* central moments */
double inv_sqrt_m00; /* m00 != 0 ? 1/sqrt(m00) : 0 */ double inv_sqrt_m00; /* m00 != 0 ? 1/sqrt(m00) : 0 */
#ifdef __cplusplus
CvMoments(){}
CvMoments(const cv::Moments& m)
{
m00 = m.m00; m10 = m.m10; m01 = m.m01;
m20 = m.m20; m11 = m.m11; m02 = m.m02;
m30 = m.m30; m21 = m.m21; m12 = m.m12; m03 = m.m03;
mu20 = m.mu20; mu11 = m.mu11; mu02 = m.mu02;
mu30 = m.mu30; mu21 = m.mu21; mu12 = m.mu12; mu03 = m.mu03;
double am00 = std::abs(m.m00);
inv_sqrt_m00 = am00 > DBL_EPSILON ? 1./std::sqrt(am00) : 0;
}
operator cv::Moments() const
{
return cv::Moments(m00, m10, m01, m20, m11, m02, m30, m21, m12, m03);
}
#endif
} }
CvMoments; CvMoments;

@ -9,114 +9,114 @@ using std::tr1::get;
//extra color conversions supported implicitly //extra color conversions supported implicitly
enum enum
{ {
CX_BGRA2HLS = CV_COLORCVT_MAX + CV_BGR2HLS, CX_BGRA2HLS = COLOR_COLORCVT_MAX + COLOR_BGR2HLS,
CX_BGRA2HLS_FULL = CV_COLORCVT_MAX + CV_BGR2HLS_FULL, CX_BGRA2HLS_FULL = COLOR_COLORCVT_MAX + COLOR_BGR2HLS_FULL,
CX_BGRA2HSV = CV_COLORCVT_MAX + CV_BGR2HSV, CX_BGRA2HSV = COLOR_COLORCVT_MAX + COLOR_BGR2HSV,
CX_BGRA2HSV_FULL = CV_COLORCVT_MAX + CV_BGR2HSV_FULL, CX_BGRA2HSV_FULL = COLOR_COLORCVT_MAX + COLOR_BGR2HSV_FULL,
CX_BGRA2Lab = CV_COLORCVT_MAX + CV_BGR2Lab, CX_BGRA2Lab = COLOR_COLORCVT_MAX + COLOR_BGR2Lab,
CX_BGRA2Luv = CV_COLORCVT_MAX + CV_BGR2Luv, CX_BGRA2Luv = COLOR_COLORCVT_MAX + COLOR_BGR2Luv,
CX_BGRA2XYZ = CV_COLORCVT_MAX + CV_BGR2XYZ, CX_BGRA2XYZ = COLOR_COLORCVT_MAX + COLOR_BGR2XYZ,
CX_BGRA2YCrCb = CV_COLORCVT_MAX + CV_BGR2YCrCb, CX_BGRA2YCrCb = COLOR_COLORCVT_MAX + COLOR_BGR2YCrCb,
CX_BGRA2YUV = CV_COLORCVT_MAX + CV_BGR2YUV, CX_BGRA2YUV = COLOR_COLORCVT_MAX + COLOR_BGR2YUV,
CX_HLS2BGRA = CV_COLORCVT_MAX + CV_HLS2BGR, CX_HLS2BGRA = COLOR_COLORCVT_MAX + COLOR_HLS2BGR,
CX_HLS2BGRA_FULL = CV_COLORCVT_MAX + CV_HLS2BGR_FULL, CX_HLS2BGRA_FULL = COLOR_COLORCVT_MAX + COLOR_HLS2BGR_FULL,
CX_HLS2RGBA = CV_COLORCVT_MAX + CV_HLS2RGB, CX_HLS2RGBA = COLOR_COLORCVT_MAX + COLOR_HLS2RGB,
CX_HLS2RGBA_FULL = CV_COLORCVT_MAX + CV_HLS2RGB_FULL, CX_HLS2RGBA_FULL = COLOR_COLORCVT_MAX + COLOR_HLS2RGB_FULL,
CX_HSV2BGRA = CV_COLORCVT_MAX + CV_HSV2BGR, CX_HSV2BGRA = COLOR_COLORCVT_MAX + COLOR_HSV2BGR,
CX_HSV2BGRA_FULL = CV_COLORCVT_MAX + CV_HSV2BGR_FULL, CX_HSV2BGRA_FULL = COLOR_COLORCVT_MAX + COLOR_HSV2BGR_FULL,
CX_HSV2RGBA = CV_COLORCVT_MAX + CV_HSV2RGB, CX_HSV2RGBA = COLOR_COLORCVT_MAX + COLOR_HSV2RGB,
CX_HSV2RGBA_FULL = CV_COLORCVT_MAX + CV_HSV2RGB_FULL, CX_HSV2RGBA_FULL = COLOR_COLORCVT_MAX + COLOR_HSV2RGB_FULL,
CX_Lab2BGRA = CV_COLORCVT_MAX + CV_Lab2BGR, CX_Lab2BGRA = COLOR_COLORCVT_MAX + COLOR_Lab2BGR,
CX_Lab2LBGRA = CV_COLORCVT_MAX + CV_Lab2LBGR, CX_Lab2LBGRA = COLOR_COLORCVT_MAX + COLOR_Lab2LBGR,
CX_Lab2LRGBA = CV_COLORCVT_MAX + CV_Lab2LRGB, CX_Lab2LRGBA = COLOR_COLORCVT_MAX + COLOR_Lab2LRGB,
CX_Lab2RGBA = CV_COLORCVT_MAX + CV_Lab2RGB, CX_Lab2RGBA = COLOR_COLORCVT_MAX + COLOR_Lab2RGB,
CX_LBGRA2Lab = CV_COLORCVT_MAX + CV_LBGR2Lab, CX_LBGRA2Lab = COLOR_COLORCVT_MAX + COLOR_LBGR2Lab,
CX_LBGRA2Luv = CV_COLORCVT_MAX + CV_LBGR2Luv, CX_LBGRA2Luv = COLOR_COLORCVT_MAX + COLOR_LBGR2Luv,
CX_LRGBA2Lab = CV_COLORCVT_MAX + CV_LRGB2Lab, CX_LRGBA2Lab = COLOR_COLORCVT_MAX + COLOR_LRGB2Lab,
CX_LRGBA2Luv = CV_COLORCVT_MAX + CV_LRGB2Luv, CX_LRGBA2Luv = COLOR_COLORCVT_MAX + COLOR_LRGB2Luv,
CX_Luv2BGRA = CV_COLORCVT_MAX + CV_Luv2BGR, CX_Luv2BGRA = COLOR_COLORCVT_MAX + COLOR_Luv2BGR,
CX_Luv2LBGRA = CV_COLORCVT_MAX + CV_Luv2LBGR, CX_Luv2LBGRA = COLOR_COLORCVT_MAX + COLOR_Luv2LBGR,
CX_Luv2LRGBA = CV_COLORCVT_MAX + CV_Luv2LRGB, CX_Luv2LRGBA = COLOR_COLORCVT_MAX + COLOR_Luv2LRGB,
CX_Luv2RGBA = CV_COLORCVT_MAX + CV_Luv2RGB, CX_Luv2RGBA = COLOR_COLORCVT_MAX + COLOR_Luv2RGB,
CX_RGBA2HLS = CV_COLORCVT_MAX + CV_RGB2HLS, CX_RGBA2HLS = COLOR_COLORCVT_MAX + COLOR_RGB2HLS,
CX_RGBA2HLS_FULL = CV_COLORCVT_MAX + CV_RGB2HLS_FULL, CX_RGBA2HLS_FULL = COLOR_COLORCVT_MAX + COLOR_RGB2HLS_FULL,
CX_RGBA2HSV = CV_COLORCVT_MAX + CV_RGB2HSV, CX_RGBA2HSV = COLOR_COLORCVT_MAX + COLOR_RGB2HSV,
CX_RGBA2HSV_FULL = CV_COLORCVT_MAX + CV_RGB2HSV_FULL, CX_RGBA2HSV_FULL = COLOR_COLORCVT_MAX + COLOR_RGB2HSV_FULL,
CX_RGBA2Lab = CV_COLORCVT_MAX + CV_RGB2Lab, CX_RGBA2Lab = COLOR_COLORCVT_MAX + COLOR_RGB2Lab,
CX_RGBA2Luv = CV_COLORCVT_MAX + CV_RGB2Luv, CX_RGBA2Luv = COLOR_COLORCVT_MAX + COLOR_RGB2Luv,
CX_RGBA2XYZ = CV_COLORCVT_MAX + CV_RGB2XYZ, CX_RGBA2XYZ = COLOR_COLORCVT_MAX + COLOR_RGB2XYZ,
CX_RGBA2YCrCb = CV_COLORCVT_MAX + CV_RGB2YCrCb, CX_RGBA2YCrCb = COLOR_COLORCVT_MAX + COLOR_RGB2YCrCb,
CX_RGBA2YUV = CV_COLORCVT_MAX + CV_RGB2YUV, CX_RGBA2YUV = COLOR_COLORCVT_MAX + COLOR_RGB2YUV,
CX_XYZ2BGRA = CV_COLORCVT_MAX + CV_XYZ2BGR, CX_XYZ2BGRA = COLOR_COLORCVT_MAX + COLOR_XYZ2BGR,
CX_XYZ2RGBA = CV_COLORCVT_MAX + CV_XYZ2RGB, CX_XYZ2RGBA = COLOR_COLORCVT_MAX + COLOR_XYZ2RGB,
CX_YCrCb2BGRA = CV_COLORCVT_MAX + CV_YCrCb2BGR, CX_YCrCb2BGRA = COLOR_COLORCVT_MAX + COLOR_YCrCb2BGR,
CX_YCrCb2RGBA = CV_COLORCVT_MAX + CV_YCrCb2RGB, CX_YCrCb2RGBA = COLOR_COLORCVT_MAX + COLOR_YCrCb2RGB,
CX_YUV2BGRA = CV_COLORCVT_MAX + CV_YUV2BGR, CX_YUV2BGRA = COLOR_COLORCVT_MAX + COLOR_YUV2BGR,
CX_YUV2RGBA = CV_COLORCVT_MAX + CV_YUV2RGB CX_YUV2RGBA = COLOR_COLORCVT_MAX + COLOR_YUV2RGB
}; };
CV_ENUM(CvtMode, CV_ENUM(CvtMode,
CV_BGR2BGR555, CV_BGR2BGR565, CV_BGR2BGRA, CV_BGR2GRAY, COLOR_BGR2BGR555, COLOR_BGR2BGR565, COLOR_BGR2BGRA, COLOR_BGR2GRAY,
CV_BGR2HLS, CV_BGR2HLS_FULL, CV_BGR2HSV, CV_BGR2HSV_FULL, COLOR_BGR2HLS, COLOR_BGR2HLS_FULL, COLOR_BGR2HSV, COLOR_BGR2HSV_FULL,
CV_BGR2Lab, CV_BGR2Luv, CV_BGR2RGB, CV_BGR2RGBA, CV_BGR2XYZ, COLOR_BGR2Lab, COLOR_BGR2Luv, COLOR_BGR2RGB, COLOR_BGR2RGBA, COLOR_BGR2XYZ,
CV_BGR2YCrCb, CV_BGR2YUV, CV_BGR5552BGR, CV_BGR5552BGRA, COLOR_BGR2YCrCb, COLOR_BGR2YUV, COLOR_BGR5552BGR, COLOR_BGR5552BGRA,
CV_BGR5552GRAY, CV_BGR5552RGB, CV_BGR5552RGBA, CV_BGR5652BGR, COLOR_BGR5552GRAY, COLOR_BGR5552RGB, COLOR_BGR5552RGBA, COLOR_BGR5652BGR,
CV_BGR5652BGRA, CV_BGR5652GRAY, CV_BGR5652RGB, CV_BGR5652RGBA, COLOR_BGR5652BGRA, COLOR_BGR5652GRAY, COLOR_BGR5652RGB, COLOR_BGR5652RGBA,
CV_BGRA2BGR, CV_BGRA2BGR555, CV_BGRA2BGR565, CV_BGRA2GRAY, CV_BGRA2RGBA, COLOR_BGRA2BGR, COLOR_BGRA2BGR555, COLOR_BGRA2BGR565, COLOR_BGRA2GRAY, COLOR_BGRA2RGBA,
CX_BGRA2HLS, CX_BGRA2HLS_FULL, CX_BGRA2HSV, CX_BGRA2HSV_FULL, CX_BGRA2HLS, CX_BGRA2HLS_FULL, CX_BGRA2HSV, CX_BGRA2HSV_FULL,
CX_BGRA2Lab, CX_BGRA2Luv, CX_BGRA2XYZ, CX_BGRA2Lab, CX_BGRA2Luv, CX_BGRA2XYZ,
CX_BGRA2YCrCb, CX_BGRA2YUV, CX_BGRA2YCrCb, CX_BGRA2YUV,
CV_GRAY2BGR, CV_GRAY2BGR555, CV_GRAY2BGR565, CV_GRAY2BGRA, COLOR_GRAY2BGR, COLOR_GRAY2BGR555, COLOR_GRAY2BGR565, COLOR_GRAY2BGRA,
CV_HLS2BGR, CV_HLS2BGR_FULL, CV_HLS2RGB, CV_HLS2RGB_FULL, COLOR_HLS2BGR, COLOR_HLS2BGR_FULL, COLOR_HLS2RGB, COLOR_HLS2RGB_FULL,
CX_HLS2BGRA, CX_HLS2BGRA_FULL, CX_HLS2RGBA, CX_HLS2RGBA_FULL, CX_HLS2BGRA, CX_HLS2BGRA_FULL, CX_HLS2RGBA, CX_HLS2RGBA_FULL,
CV_HSV2BGR, CV_HSV2BGR_FULL, CV_HSV2RGB, CV_HSV2RGB_FULL, COLOR_HSV2BGR, COLOR_HSV2BGR_FULL, COLOR_HSV2RGB, COLOR_HSV2RGB_FULL,
CX_HSV2BGRA, CX_HSV2BGRA_FULL, CX_HSV2RGBA, CX_HSV2RGBA_FULL, CX_HSV2BGRA, CX_HSV2BGRA_FULL, CX_HSV2RGBA, CX_HSV2RGBA_FULL,
CV_Lab2BGR, CV_Lab2LBGR, CV_Lab2LRGB, CV_Lab2RGB, COLOR_Lab2BGR, COLOR_Lab2LBGR, COLOR_Lab2LRGB, COLOR_Lab2RGB,
CX_Lab2BGRA, CX_Lab2LBGRA, CX_Lab2LRGBA, CX_Lab2RGBA, CX_Lab2BGRA, CX_Lab2LBGRA, CX_Lab2LRGBA, CX_Lab2RGBA,
CV_LBGR2Lab, CV_LBGR2Luv, CV_LRGB2Lab, CV_LRGB2Luv, COLOR_LBGR2Lab, COLOR_LBGR2Luv, COLOR_LRGB2Lab, COLOR_LRGB2Luv,
CX_LBGRA2Lab, CX_LBGRA2Luv, CX_LRGBA2Lab, CX_LRGBA2Luv, CX_LBGRA2Lab, CX_LBGRA2Luv, CX_LRGBA2Lab, CX_LRGBA2Luv,
CV_Luv2BGR, CV_Luv2LBGR, CV_Luv2LRGB, CV_Luv2RGB, COLOR_Luv2BGR, COLOR_Luv2LBGR, COLOR_Luv2LRGB, COLOR_Luv2RGB,
CX_Luv2BGRA, CX_Luv2LBGRA, CX_Luv2LRGBA, CX_Luv2RGBA, CX_Luv2BGRA, CX_Luv2LBGRA, CX_Luv2LRGBA, CX_Luv2RGBA,
CV_RGB2BGR555, CV_RGB2BGR565, CV_RGB2GRAY, COLOR_RGB2BGR555, COLOR_RGB2BGR565, COLOR_RGB2GRAY,
CV_RGB2HLS, CV_RGB2HLS_FULL, CV_RGB2HSV, CV_RGB2HSV_FULL, COLOR_RGB2HLS, COLOR_RGB2HLS_FULL, COLOR_RGB2HSV, COLOR_RGB2HSV_FULL,
CV_RGB2Lab, CV_RGB2Luv, CV_RGB2XYZ, CV_RGB2YCrCb, CV_RGB2YUV, COLOR_RGB2Lab, COLOR_RGB2Luv, COLOR_RGB2XYZ, COLOR_RGB2YCrCb, COLOR_RGB2YUV,
CV_RGBA2BGR, CV_RGBA2BGR555, CV_RGBA2BGR565, CV_RGBA2GRAY, COLOR_RGBA2BGR, COLOR_RGBA2BGR555, COLOR_RGBA2BGR565, COLOR_RGBA2GRAY,
CX_RGBA2HLS, CX_RGBA2HLS_FULL, CX_RGBA2HSV, CX_RGBA2HSV_FULL, CX_RGBA2HLS, CX_RGBA2HLS_FULL, CX_RGBA2HSV, CX_RGBA2HSV_FULL,
CX_RGBA2Lab, CX_RGBA2Luv, CX_RGBA2XYZ, CX_RGBA2Lab, CX_RGBA2Luv, CX_RGBA2XYZ,
CX_RGBA2YCrCb, CX_RGBA2YUV, CX_RGBA2YCrCb, CX_RGBA2YUV,
CV_XYZ2BGR, CV_XYZ2RGB, CX_XYZ2BGRA, CX_XYZ2RGBA, COLOR_XYZ2BGR, COLOR_XYZ2RGB, CX_XYZ2BGRA, CX_XYZ2RGBA,
CV_YCrCb2BGR, CV_YCrCb2RGB, CX_YCrCb2BGRA, CX_YCrCb2RGBA, COLOR_YCrCb2BGR, COLOR_YCrCb2RGB, CX_YCrCb2BGRA, CX_YCrCb2RGBA,
CV_YUV2BGR, CV_YUV2RGB, CX_YUV2BGRA, CX_YUV2RGBA COLOR_YUV2BGR, COLOR_YUV2RGB, CX_YUV2BGRA, CX_YUV2RGBA
) )
CV_ENUM(CvtModeBayer, CV_ENUM(CvtModeBayer,
CV_BayerBG2BGR, CV_BayerBG2BGR_VNG, CV_BayerBG2GRAY, COLOR_BayerBG2BGR, COLOR_BayerBG2BGR_VNG, COLOR_BayerBG2GRAY,
CV_BayerGB2BGR, CV_BayerGB2BGR_VNG, CV_BayerGB2GRAY, COLOR_BayerGB2BGR, COLOR_BayerGB2BGR_VNG, COLOR_BayerGB2GRAY,
CV_BayerGR2BGR, CV_BayerGR2BGR_VNG, CV_BayerGR2GRAY, COLOR_BayerGR2BGR, COLOR_BayerGR2BGR_VNG, COLOR_BayerGR2GRAY,
CV_BayerRG2BGR, CV_BayerRG2BGR_VNG, CV_BayerRG2GRAY COLOR_BayerRG2BGR, COLOR_BayerRG2BGR_VNG, COLOR_BayerRG2GRAY
) )
CV_ENUM(CvtMode2, CV_YUV2BGR_NV12, CV_YUV2BGRA_NV12, CV_YUV2RGB_NV12, CV_YUV2RGBA_NV12, CV_YUV2BGR_NV21, CV_YUV2BGRA_NV21, CV_YUV2RGB_NV21, CV_YUV2RGBA_NV21, CV_ENUM(CvtMode2, COLOR_YUV2BGR_NV12, COLOR_YUV2BGRA_NV12, COLOR_YUV2RGB_NV12, COLOR_YUV2RGBA_NV12, COLOR_YUV2BGR_NV21, COLOR_YUV2BGRA_NV21, COLOR_YUV2RGB_NV21, COLOR_YUV2RGBA_NV21,
CV_YUV2BGR_YV12, CV_YUV2BGRA_YV12, CV_YUV2RGB_YV12, CV_YUV2RGBA_YV12, CV_YUV2BGR_IYUV, CV_YUV2BGRA_IYUV, CV_YUV2RGB_IYUV, CV_YUV2RGBA_IYUV, COLOR_YUV2BGR_YV12, COLOR_YUV2BGRA_YV12, COLOR_YUV2RGB_YV12, COLOR_YUV2RGBA_YV12, COLOR_YUV2BGR_IYUV, COLOR_YUV2BGRA_IYUV, COLOR_YUV2RGB_IYUV, COLOR_YUV2RGBA_IYUV,
COLOR_YUV2GRAY_420, CV_YUV2RGB_UYVY, CV_YUV2BGR_UYVY, CV_YUV2RGBA_UYVY, CV_YUV2BGRA_UYVY, CV_YUV2RGB_YUY2, CV_YUV2BGR_YUY2, CV_YUV2RGB_YVYU, COLOR_YUV2GRAY_420, COLOR_YUV2RGB_UYVY, COLOR_YUV2BGR_UYVY, COLOR_YUV2RGBA_UYVY, COLOR_YUV2BGRA_UYVY, COLOR_YUV2RGB_YUY2, COLOR_YUV2BGR_YUY2, COLOR_YUV2RGB_YVYU,
CV_YUV2BGR_YVYU, CV_YUV2RGBA_YUY2, CV_YUV2BGRA_YUY2, CV_YUV2RGBA_YVYU, CV_YUV2BGRA_YVYU) COLOR_YUV2BGR_YVYU, COLOR_YUV2RGBA_YUY2, COLOR_YUV2BGRA_YUY2, COLOR_YUV2RGBA_YVYU, COLOR_YUV2BGRA_YVYU)
CV_ENUM(CvtMode3, CV_RGB2YUV_IYUV, CV_BGR2YUV_IYUV, CV_RGBA2YUV_IYUV, CV_BGRA2YUV_IYUV, CV_ENUM(CvtMode3, COLOR_RGB2YUV_IYUV, COLOR_BGR2YUV_IYUV, COLOR_RGBA2YUV_IYUV, COLOR_BGRA2YUV_IYUV,
CV_RGB2YUV_YV12, CV_BGR2YUV_YV12, CV_RGBA2YUV_YV12, CV_BGRA2YUV_YV12) COLOR_RGB2YUV_YV12, COLOR_BGR2YUV_YV12, COLOR_RGBA2YUV_YV12, COLOR_BGRA2YUV_YV12)
struct ChPair struct ChPair
{ {
@ -128,74 +128,74 @@ ChPair getConversionInfo(int cvtMode)
{ {
switch(cvtMode) switch(cvtMode)
{ {
case CV_BayerBG2GRAY: case CV_BayerGB2GRAY: case COLOR_BayerBG2GRAY: case COLOR_BayerGB2GRAY:
case CV_BayerGR2GRAY: case CV_BayerRG2GRAY: case COLOR_BayerGR2GRAY: case COLOR_BayerRG2GRAY:
case CV_YUV2GRAY_420: case COLOR_YUV2GRAY_420:
return ChPair(1,1); return ChPair(1,1);
case CV_GRAY2BGR555: case CV_GRAY2BGR565: case COLOR_GRAY2BGR555: case COLOR_GRAY2BGR565:
return ChPair(1,2); return ChPair(1,2);
case CV_BayerBG2BGR: case CV_BayerBG2BGR_VNG: case COLOR_BayerBG2BGR: case COLOR_BayerBG2BGR_VNG:
case CV_BayerGB2BGR: case CV_BayerGB2BGR_VNG: case COLOR_BayerGB2BGR: case COLOR_BayerGB2BGR_VNG:
case CV_BayerGR2BGR: case CV_BayerGR2BGR_VNG: case COLOR_BayerGR2BGR: case COLOR_BayerGR2BGR_VNG:
case CV_BayerRG2BGR: case CV_BayerRG2BGR_VNG: case COLOR_BayerRG2BGR: case COLOR_BayerRG2BGR_VNG:
case CV_GRAY2BGR: case COLOR_GRAY2BGR:
case CV_YUV2BGR_NV12: case CV_YUV2RGB_NV12: case COLOR_YUV2BGR_NV12: case COLOR_YUV2RGB_NV12:
case CV_YUV2BGR_NV21: case CV_YUV2RGB_NV21: case COLOR_YUV2BGR_NV21: case COLOR_YUV2RGB_NV21:
case CV_YUV2BGR_YV12: case CV_YUV2RGB_YV12: case COLOR_YUV2BGR_YV12: case COLOR_YUV2RGB_YV12:
case CV_YUV2BGR_IYUV: case CV_YUV2RGB_IYUV: case COLOR_YUV2BGR_IYUV: case COLOR_YUV2RGB_IYUV:
return ChPair(1,3); return ChPair(1,3);
case CV_GRAY2BGRA: case COLOR_GRAY2BGRA:
case CV_YUV2BGRA_NV12: case CV_YUV2RGBA_NV12: case COLOR_YUV2BGRA_NV12: case COLOR_YUV2RGBA_NV12:
case CV_YUV2BGRA_NV21: case CV_YUV2RGBA_NV21: case COLOR_YUV2BGRA_NV21: case COLOR_YUV2RGBA_NV21:
case CV_YUV2BGRA_YV12: case CV_YUV2RGBA_YV12: case COLOR_YUV2BGRA_YV12: case COLOR_YUV2RGBA_YV12:
case CV_YUV2BGRA_IYUV: case CV_YUV2RGBA_IYUV: case COLOR_YUV2BGRA_IYUV: case COLOR_YUV2RGBA_IYUV:
return ChPair(1,4); return ChPair(1,4);
case CV_BGR5552GRAY: case CV_BGR5652GRAY: case COLOR_BGR5552GRAY: case COLOR_BGR5652GRAY:
return ChPair(2,1); return ChPair(2,1);
case CV_BGR5552BGR: case CV_BGR5552RGB: case COLOR_BGR5552BGR: case COLOR_BGR5552RGB:
case CV_BGR5652BGR: case CV_BGR5652RGB: case COLOR_BGR5652BGR: case COLOR_BGR5652RGB:
case CV_YUV2RGB_UYVY: case CV_YUV2BGR_UYVY: case COLOR_YUV2RGB_UYVY: case COLOR_YUV2BGR_UYVY:
case CV_YUV2RGBA_UYVY: case CV_YUV2BGRA_UYVY: case COLOR_YUV2RGBA_UYVY: case COLOR_YUV2BGRA_UYVY:
case CV_YUV2RGB_YUY2: case CV_YUV2BGR_YUY2: case COLOR_YUV2RGB_YUY2: case COLOR_YUV2BGR_YUY2:
case CV_YUV2RGB_YVYU: case CV_YUV2BGR_YVYU: case COLOR_YUV2RGB_YVYU: case COLOR_YUV2BGR_YVYU:
case CV_YUV2RGBA_YUY2: case CV_YUV2BGRA_YUY2: case COLOR_YUV2RGBA_YUY2: case COLOR_YUV2BGRA_YUY2:
case CV_YUV2RGBA_YVYU: case CV_YUV2BGRA_YVYU: case COLOR_YUV2RGBA_YVYU: case COLOR_YUV2BGRA_YVYU:
return ChPair(2,3); return ChPair(2,3);
case CV_BGR5552BGRA: case CV_BGR5552RGBA: case COLOR_BGR5552BGRA: case COLOR_BGR5552RGBA:
case CV_BGR5652BGRA: case CV_BGR5652RGBA: case COLOR_BGR5652BGRA: case COLOR_BGR5652RGBA:
return ChPair(2,4); return ChPair(2,4);
case CV_BGR2GRAY: case CV_RGB2GRAY: case COLOR_BGR2GRAY: case COLOR_RGB2GRAY:
case CV_RGB2YUV_IYUV: case CV_RGB2YUV_YV12: case COLOR_RGB2YUV_IYUV: case COLOR_RGB2YUV_YV12:
case CV_BGR2YUV_IYUV: case CV_BGR2YUV_YV12: case COLOR_BGR2YUV_IYUV: case COLOR_BGR2YUV_YV12:
return ChPair(3,1); return ChPair(3,1);
case CV_BGR2BGR555: case CV_BGR2BGR565: case COLOR_BGR2BGR555: case COLOR_BGR2BGR565:
case CV_RGB2BGR555: case CV_RGB2BGR565: case COLOR_RGB2BGR555: case COLOR_RGB2BGR565:
return ChPair(3,2); return ChPair(3,2);
case CV_BGR2HLS: case CV_BGR2HLS_FULL: case COLOR_BGR2HLS: case COLOR_BGR2HLS_FULL:
case CV_BGR2HSV: case CV_BGR2HSV_FULL: case COLOR_BGR2HSV: case COLOR_BGR2HSV_FULL:
case CV_BGR2Lab: case CV_BGR2Luv: case COLOR_BGR2Lab: case COLOR_BGR2Luv:
case CV_BGR2RGB: case CV_BGR2XYZ: case COLOR_BGR2RGB: case COLOR_BGR2XYZ:
case CV_BGR2YCrCb: case CV_BGR2YUV: case COLOR_BGR2YCrCb: case COLOR_BGR2YUV:
case CV_HLS2BGR: case CV_HLS2BGR_FULL: case COLOR_HLS2BGR: case COLOR_HLS2BGR_FULL:
case CV_HLS2RGB: case CV_HLS2RGB_FULL: case COLOR_HLS2RGB: case COLOR_HLS2RGB_FULL:
case CV_HSV2BGR: case CV_HSV2BGR_FULL: case COLOR_HSV2BGR: case COLOR_HSV2BGR_FULL:
case CV_HSV2RGB: case CV_HSV2RGB_FULL: case COLOR_HSV2RGB: case COLOR_HSV2RGB_FULL:
case CV_Lab2BGR: case CV_Lab2LBGR: case COLOR_Lab2BGR: case COLOR_Lab2LBGR:
case CV_Lab2LRGB: case CV_Lab2RGB: case COLOR_Lab2LRGB: case COLOR_Lab2RGB:
case CV_LBGR2Lab: case CV_LBGR2Luv: case COLOR_LBGR2Lab: case COLOR_LBGR2Luv:
case CV_LRGB2Lab: case CV_LRGB2Luv: case COLOR_LRGB2Lab: case COLOR_LRGB2Luv:
case CV_Luv2BGR: case CV_Luv2LBGR: case COLOR_Luv2BGR: case COLOR_Luv2LBGR:
case CV_Luv2LRGB: case CV_Luv2RGB: case COLOR_Luv2LRGB: case COLOR_Luv2RGB:
case CV_RGB2HLS: case CV_RGB2HLS_FULL: case COLOR_RGB2HLS: case COLOR_RGB2HLS_FULL:
case CV_RGB2HSV: case CV_RGB2HSV_FULL: case COLOR_RGB2HSV: case COLOR_RGB2HSV_FULL:
case CV_RGB2Lab: case CV_RGB2Luv: case COLOR_RGB2Lab: case COLOR_RGB2Luv:
case CV_RGB2XYZ: case CV_RGB2YCrCb: case COLOR_RGB2XYZ: case COLOR_RGB2YCrCb:
case CV_RGB2YUV: case CV_XYZ2BGR: case COLOR_RGB2YUV: case COLOR_XYZ2BGR:
case CV_XYZ2RGB: case CV_YCrCb2BGR: case COLOR_XYZ2RGB: case COLOR_YCrCb2BGR:
case CV_YCrCb2RGB: case CV_YUV2BGR: case COLOR_YCrCb2RGB: case COLOR_YUV2BGR:
case CV_YUV2RGB: case COLOR_YUV2RGB:
return ChPair(3,3); return ChPair(3,3);
case CV_BGR2BGRA: case CV_BGR2RGBA: case COLOR_BGR2BGRA: case COLOR_BGR2RGBA:
case CX_HLS2BGRA: case CX_HLS2BGRA_FULL: case CX_HLS2BGRA: case CX_HLS2BGRA_FULL:
case CX_HLS2RGBA: case CX_HLS2RGBA_FULL: case CX_HLS2RGBA: case CX_HLS2RGBA_FULL:
case CX_HSV2BGRA: case CX_HSV2BGRA_FULL: case CX_HSV2BGRA: case CX_HSV2BGRA_FULL:
@ -208,27 +208,27 @@ ChPair getConversionInfo(int cvtMode)
case CX_YCrCb2BGRA: case CX_YCrCb2RGBA: case CX_YCrCb2BGRA: case CX_YCrCb2RGBA:
case CX_YUV2BGRA: case CX_YUV2RGBA: case CX_YUV2BGRA: case CX_YUV2RGBA:
return ChPair(3,4); return ChPair(3,4);
case CV_BGRA2GRAY: case CV_RGBA2GRAY: case COLOR_BGRA2GRAY: case COLOR_RGBA2GRAY:
case CV_RGBA2YUV_IYUV: case CV_RGBA2YUV_YV12: case COLOR_RGBA2YUV_IYUV: case COLOR_RGBA2YUV_YV12:
case CV_BGRA2YUV_IYUV: case CV_BGRA2YUV_YV12: case COLOR_BGRA2YUV_IYUV: case COLOR_BGRA2YUV_YV12:
return ChPair(4,1); return ChPair(4,1);
case CV_BGRA2BGR555: case CV_BGRA2BGR565: case COLOR_BGRA2BGR555: case COLOR_BGRA2BGR565:
case CV_RGBA2BGR555: case CV_RGBA2BGR565: case COLOR_RGBA2BGR555: case COLOR_RGBA2BGR565:
return ChPair(4,2); return ChPair(4,2);
case CV_BGRA2BGR: case CX_BGRA2HLS: case COLOR_BGRA2BGR: case CX_BGRA2HLS:
case CX_BGRA2HLS_FULL: case CX_BGRA2HSV: case CX_BGRA2HLS_FULL: case CX_BGRA2HSV:
case CX_BGRA2HSV_FULL: case CX_BGRA2Lab: case CX_BGRA2HSV_FULL: case CX_BGRA2Lab:
case CX_BGRA2Luv: case CX_BGRA2XYZ: case CX_BGRA2Luv: case CX_BGRA2XYZ:
case CX_BGRA2YCrCb: case CX_BGRA2YUV: case CX_BGRA2YCrCb: case CX_BGRA2YUV:
case CX_LBGRA2Lab: case CX_LBGRA2Luv: case CX_LBGRA2Lab: case CX_LBGRA2Luv:
case CX_LRGBA2Lab: case CX_LRGBA2Luv: case CX_LRGBA2Lab: case CX_LRGBA2Luv:
case CV_RGBA2BGR: case CX_RGBA2HLS: case COLOR_RGBA2BGR: case CX_RGBA2HLS:
case CX_RGBA2HLS_FULL: case CX_RGBA2HSV: case CX_RGBA2HLS_FULL: case CX_RGBA2HSV:
case CX_RGBA2HSV_FULL: case CX_RGBA2Lab: case CX_RGBA2HSV_FULL: case CX_RGBA2Lab:
case CX_RGBA2Luv: case CX_RGBA2XYZ: case CX_RGBA2Luv: case CX_RGBA2XYZ:
case CX_RGBA2YCrCb: case CX_RGBA2YUV: case CX_RGBA2YCrCb: case CX_RGBA2YUV:
return ChPair(4,3); return ChPair(4,3);
case CV_BGRA2RGBA: case COLOR_BGRA2RGBA:
return ChPair(4,4); return ChPair(4,4);
default: default:
ADD_FAILURE() << "Unknown conversion type"; ADD_FAILURE() << "Unknown conversion type";
@ -250,7 +250,7 @@ PERF_TEST_P(Size_CvtMode, cvtColor8u,
Size sz = get<0>(GetParam()); Size sz = get<0>(GetParam());
int mode = get<1>(GetParam()); int mode = get<1>(GetParam());
ChPair ch = getConversionInfo(mode); ChPair ch = getConversionInfo(mode);
mode %= CV_COLORCVT_MAX; mode %= COLOR_COLORCVT_MAX;
Mat src(sz, CV_8UC(ch.scn)); Mat src(sz, CV_8UC(ch.scn));
Mat dst(sz, CV_8UC(ch.dcn)); Mat dst(sz, CV_8UC(ch.dcn));
@ -276,7 +276,7 @@ PERF_TEST_P(Size_CvtMode_Bayer, cvtColorBayer8u,
Size sz = get<0>(GetParam()); Size sz = get<0>(GetParam());
int mode = get<1>(GetParam()); int mode = get<1>(GetParam());
ChPair ch = getConversionInfo(mode); ChPair ch = getConversionInfo(mode);
mode %= CV_COLORCVT_MAX; mode %= COLOR_COLORCVT_MAX;
Mat src(sz, CV_8UC(ch.scn)); Mat src(sz, CV_8UC(ch.scn));
Mat dst(sz, CV_8UC(ch.dcn)); Mat dst(sz, CV_8UC(ch.dcn));

@ -6,7 +6,7 @@ using namespace perf;
using std::tr1::make_tuple; using std::tr1::make_tuple;
using std::tr1::get; using std::tr1::get;
CV_ENUM(MethodType, CV_TM_SQDIFF, CV_TM_SQDIFF_NORMED, CV_TM_CCORR, CV_TM_CCORR_NORMED, CV_TM_CCOEFF, CV_TM_CCOEFF_NORMED) CV_ENUM(MethodType, TM_SQDIFF, TM_SQDIFF_NORMED, TM_CCORR, TM_CCORR_NORMED, TM_CCOEFF, TM_CCOEFF_NORMED)
typedef std::tr1::tuple<Size, Size, MethodType> ImgSize_TmplSize_Method_t; typedef std::tr1::tuple<Size, Size, MethodType> ImgSize_TmplSize_Method_t;
typedef perf::TestBaseWithParam<ImgSize_TmplSize_Method_t> ImgSize_TmplSize_Method; typedef perf::TestBaseWithParam<ImgSize_TmplSize_Method_t> ImgSize_TmplSize_Method;
@ -39,9 +39,9 @@ PERF_TEST_P(ImgSize_TmplSize_Method, matchTemplateSmall,
TEST_CYCLE() matchTemplate(img, tmpl, result, method); TEST_CYCLE() matchTemplate(img, tmpl, result, method);
bool isNormed = bool isNormed =
method == CV_TM_CCORR_NORMED || method == TM_CCORR_NORMED ||
method == CV_TM_SQDIFF_NORMED || method == TM_SQDIFF_NORMED ||
method == CV_TM_CCOEFF_NORMED; method == TM_CCOEFF_NORMED;
double eps = isNormed ? 1e-6 double eps = isNormed ? 1e-6
: 255 * 255 * tmpl.total() * 1e-6; : 255 * 255 * tmpl.total() * 1e-6;
@ -73,9 +73,9 @@ PERF_TEST_P(ImgSize_TmplSize_Method, matchTemplateBig,
TEST_CYCLE() matchTemplate(img, tmpl, result, method); TEST_CYCLE() matchTemplate(img, tmpl, result, method);
bool isNormed = bool isNormed =
method == CV_TM_CCORR_NORMED || method == TM_CCORR_NORMED ||
method == CV_TM_SQDIFF_NORMED || method == TM_SQDIFF_NORMED ||
method == CV_TM_CCOEFF_NORMED; method == TM_CCOEFF_NORMED;
double eps = isNormed ? 1e-6 double eps = isNormed ? 1e-6
: 255 * 255 * tmpl.total() * 1e-6; : 255 * 255 * tmpl.total() * 1e-6;

@ -162,7 +162,7 @@ calcHarris( const Mat& _cov, Mat& _dst, double k )
} }
void eigen2x2( const float* cov, float* dst, int n ) static void eigen2x2( const float* cov, float* dst, int n )
{ {
for( int j = 0; j < n; j++ ) for( int j = 0; j < n; j++ )
{ {

@ -43,10 +43,6 @@
namespace cv namespace cv
{ {
template<> void Ptr<CvHistogram>::delete_obj()
{ cvReleaseHist(&obj); }
////////////////// Helper functions ////////////////////// ////////////////// Helper functions //////////////////////
static const size_t OUT_OF_RANGE = (size_t)1 << (sizeof(size_t)*8 - 2); static const size_t OUT_OF_RANGE = (size_t)1 << (sizeof(size_t)*8 - 2);

@ -354,25 +354,6 @@ Moments::Moments( double _m00, double _m10, double _m01, double _m20, double _m1
nu30 = mu30*s3; nu21 = mu21*s3; nu12 = mu12*s3; nu03 = mu03*s3; nu30 = mu30*s3; nu21 = mu21*s3; nu12 = mu12*s3; nu03 = mu03*s3;
} }
Moments::Moments( const CvMoments& m )
{
*this = Moments(m.m00, m.m10, m.m01, m.m20, m.m11, m.m02, m.m30, m.m21, m.m12, m.m03);
}
Moments::operator CvMoments() const
{
CvMoments m;
m.m00 = m00; m.m10 = m10; m.m01 = m01;
m.m20 = m20; m.m11 = m11; m.m02 = m02;
m.m30 = m30; m.m21 = m21; m.m12 = m12; m.m03 = m03;
m.mu20 = mu20; m.mu11 = mu11; m.mu02 = mu02;
m.mu30 = mu30; m.mu21 = mu21; m.mu12 = mu12; m.mu03 = mu03;
double am00 = std::abs(m00);
m.inv_sqrt_m00 = am00 > DBL_EPSILON ? 1./std::sqrt(am00) : 0;
return m;
}
} }

@ -1191,9 +1191,6 @@ static void morphOp( int op, InputArray _src, OutputArray _dst,
// f->apply( dst, dst ); // f->apply( dst, dst );
} }
template<> void Ptr<IplConvKernel>::delete_obj()
{ cvReleaseStructuringElement(&obj); }
} }
void cv::erode( InputArray src, OutputArray dst, InputArray kernel, void cv::erode( InputArray src, OutputArray dst, InputArray kernel,

@ -42,7 +42,6 @@
#ifndef __OPENCV_LEGACY_HPP__ #ifndef __OPENCV_LEGACY_HPP__
#define __OPENCV_LEGACY_HPP__ #define __OPENCV_LEGACY_HPP__
#include "opencv2/imgproc.hpp"
#include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/features2d.hpp" #include "opencv2/features2d.hpp"
#include "opencv2/calib3d.hpp" #include "opencv2/calib3d.hpp"

@ -45,4 +45,4 @@
#error this is a compatibility header which should not be used inside the OpenCV library #error this is a compatibility header which should not be used inside the OpenCV library
#endif #endif
#include "opencv2/legacy.hpp" #include "opencv2/legacy.hpp"

@ -113,7 +113,7 @@ void showOrig(const Mat& img, const vector<KeyPoint>& orig_pts)
{ {
Mat img_color; Mat img_color;
cvtColor(img, img_color, CV_GRAY2BGR); cvtColor(img, img_color, COLOR_GRAY2BGR);
for(size_t i = 0; i < orig_pts.size(); ++i) for(size_t i = 0; i < orig_pts.size(); ++i)
circle(img_color, orig_pts[i].pt, (int)orig_pts[i].size/2, CV_RGB(0, 255, 0)); circle(img_color, orig_pts[i].pt, (int)orig_pts[i].size/2, CV_RGB(0, 255, 0));
@ -125,7 +125,7 @@ void show(const string& name, const Mat& new_img, const vector<KeyPoint>& new_pt
{ {
Mat new_img_color; Mat new_img_color;
cvtColor(new_img, new_img_color, CV_GRAY2BGR); cvtColor(new_img, new_img_color, COLOR_GRAY2BGR);
for(size_t i = 0; i < transf_pts.size(); ++i) for(size_t i = 0; i < transf_pts.size(); ++i)
circle(new_img_color, transf_pts[i].pt, (int)transf_pts[i].size/2, CV_RGB(255, 0, 0)); circle(new_img_color, transf_pts[i].pt, (int)transf_pts[i].size/2, CV_RGB(255, 0, 0));

@ -434,7 +434,7 @@ int CV_CascadeDetectorTest::detectMultiScale_C( const string& filename,
return cvtest::TS::FAIL_INVALID_TEST_DATA; return cvtest::TS::FAIL_INVALID_TEST_DATA;
} }
Mat grayImg; Mat grayImg;
cvtColor( img, grayImg, CV_BGR2GRAY ); cvtColor( img, grayImg, COLOR_BGR2GRAY );
equalizeHist( grayImg, grayImg ); equalizeHist( grayImg, grayImg );
CvMat c_gray = grayImg; CvMat c_gray = grayImg;
@ -469,7 +469,7 @@ int CV_CascadeDetectorTest::detectMultiScale( int di, const Mat& img,
return cvtest::TS::FAIL_INVALID_TEST_DATA; return cvtest::TS::FAIL_INVALID_TEST_DATA;
} }
Mat grayImg; Mat grayImg;
cvtColor( img, grayImg, CV_BGR2GRAY ); cvtColor( img, grayImg, COLOR_BGR2GRAY );
equalizeHist( grayImg, grayImg ); equalizeHist( grayImg, grayImg );
cascade.detectMultiScale( grayImg, objects, 1.1, 3, flags[di] ); cascade.detectMultiScale( grayImg, objects, 1.1, 3, flags[di] );
return cvtest::TS::OK; return cvtest::TS::OK;

@ -46,14 +46,14 @@
#ifndef __OPENCV_OCL_PRIVATE_UTIL__ #ifndef __OPENCV_OCL_PRIVATE_UTIL__
#define __OPENCV_OCL_PRIVATE_UTIL__ #define __OPENCV_OCL_PRIVATE_UTIL__
#include "opencv2/ocl.hpp"
#if defined __APPLE__ #if defined __APPLE__
#include <OpenCL/OpenCL.h> #include <OpenCL/OpenCL.h>
#else #else
#include <CL/opencl.h> #include <CL/opencl.h>
#endif #endif
#include "opencv2/ocl.hpp"
namespace cv namespace cv
{ {
namespace ocl namespace ocl

@ -60,26 +60,26 @@ TEST(cvtColor)
gen(src, size, size, all_type[j], 0, 256); gen(src, size, size, all_type[j], 0, 256);
SUBTEST << size << "x" << size << "; " << type_name[j] << " ; CV_RGBA2GRAY"; SUBTEST << size << "x" << size << "; " << type_name[j] << " ; CV_RGBA2GRAY";
cvtColor(src, dst, CV_RGBA2GRAY, 4); cvtColor(src, dst, COLOR_RGBA2GRAY, 4);
CPU_ON; CPU_ON;
cvtColor(src, dst, CV_RGBA2GRAY, 4); cvtColor(src, dst, COLOR_RGBA2GRAY, 4);
CPU_OFF; CPU_OFF;
d_src.upload(src); d_src.upload(src);
WARMUP_ON; WARMUP_ON;
ocl::cvtColor(d_src, d_dst, CV_RGBA2GRAY, 4); ocl::cvtColor(d_src, d_dst, COLOR_RGBA2GRAY, 4);
WARMUP_OFF; WARMUP_OFF;
GPU_ON; GPU_ON;
ocl::cvtColor(d_src, d_dst, CV_RGBA2GRAY, 4); ocl::cvtColor(d_src, d_dst, COLOR_RGBA2GRAY, 4);
; ;
GPU_OFF; GPU_OFF;
GPU_FULL_ON; GPU_FULL_ON;
d_src.upload(src); d_src.upload(src);
ocl::cvtColor(d_src, d_dst, CV_RGBA2GRAY, 4); ocl::cvtColor(d_src, d_dst, COLOR_RGBA2GRAY, 4);
d_dst.download(dst); d_dst.download(dst);
GPU_FULL_OFF; GPU_FULL_OFF;
} }

@ -75,10 +75,10 @@ TEST(matchTemplate)
gen(templ, templ_size, templ_size, all_type[j], 0, 1); gen(templ, templ_size, templ_size, all_type[j], 0, 1);
matchTemplate(src, templ, dst, CV_TM_CCORR); matchTemplate(src, templ, dst, TM_CCORR);
CPU_ON; CPU_ON;
matchTemplate(src, templ, dst, CV_TM_CCORR); matchTemplate(src, templ, dst, TM_CCORR);
CPU_OFF; CPU_OFF;
ocl::oclMat d_src(src), d_templ, d_dst; ocl::oclMat d_src(src), d_templ, d_dst;
@ -86,18 +86,18 @@ TEST(matchTemplate)
d_templ.upload(templ); d_templ.upload(templ);
WARMUP_ON; WARMUP_ON;
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR); ocl::matchTemplate(d_src, d_templ, d_dst, TM_CCORR);
WARMUP_OFF; WARMUP_OFF;
GPU_ON; GPU_ON;
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR); ocl::matchTemplate(d_src, d_templ, d_dst, TM_CCORR);
; ;
GPU_OFF; GPU_OFF;
GPU_FULL_ON; GPU_FULL_ON;
d_src.upload(src); d_src.upload(src);
d_templ.upload(templ); d_templ.upload(templ);
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR); ocl::matchTemplate(d_src, d_templ, d_dst, TM_CCORR);
d_dst.download(dst); d_dst.download(dst);
GPU_FULL_OFF; GPU_FULL_OFF;
} }
@ -116,28 +116,28 @@ TEST(matchTemplate)
gen(templ, templ_size, templ_size, all_type_8U[j], 0, 255); gen(templ, templ_size, templ_size, all_type_8U[j], 0, 255);
matchTemplate(src, templ, dst, CV_TM_CCORR_NORMED); matchTemplate(src, templ, dst, TM_CCORR_NORMED);
CPU_ON; CPU_ON;
matchTemplate(src, templ, dst, CV_TM_CCORR_NORMED); matchTemplate(src, templ, dst, TM_CCORR_NORMED);
CPU_OFF; CPU_OFF;
ocl::oclMat d_src(src); ocl::oclMat d_src(src);
ocl::oclMat d_templ(templ), d_dst; ocl::oclMat d_templ(templ), d_dst;
WARMUP_ON; WARMUP_ON;
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR_NORMED); ocl::matchTemplate(d_src, d_templ, d_dst, TM_CCORR_NORMED);
WARMUP_OFF; WARMUP_OFF;
GPU_ON; GPU_ON;
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR_NORMED); ocl::matchTemplate(d_src, d_templ, d_dst, TM_CCORR_NORMED);
; ;
GPU_OFF; GPU_OFF;
GPU_FULL_ON; GPU_FULL_ON;
d_src.upload(src); d_src.upload(src);
d_templ.upload(templ); d_templ.upload(templ);
ocl::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR_NORMED); ocl::matchTemplate(d_src, d_templ, d_dst, TM_CCORR_NORMED);
d_dst.download(dst); d_dst.download(dst);
GPU_FULL_OFF; GPU_FULL_OFF;
} }

@ -44,6 +44,9 @@
//M*/ //M*/
#include "precomp.hpp" #include "precomp.hpp"
using namespace cv;
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
//#define MAT_DEBUG //#define MAT_DEBUG
@ -181,13 +184,13 @@ INSTANTIATE_TEST_CASE_P(OCL_ImgProc, CvtColor, testing::Combine(
INSTANTIATE_TEST_CASE_P(OCL_ImgProc, CvtColor_YUV420, testing::Combine( INSTANTIATE_TEST_CASE_P(OCL_ImgProc, CvtColor_YUV420, testing::Combine(
testing::Values(cv::Size(128, 45), cv::Size(46, 132), cv::Size(1024, 1023)), testing::Values(cv::Size(128, 45), cv::Size(46, 132), cv::Size(1024, 1023)),
testing::Values((int)CV_YUV2RGBA_NV12, (int)CV_YUV2BGRA_NV12, (int)CV_YUV2RGB_NV12, (int)CV_YUV2BGR_NV12) testing::Values((int)COLOR_YUV2RGBA_NV12, (int)COLOR_YUV2BGRA_NV12, (int)COLOR_YUV2RGB_NV12, (int)COLOR_YUV2BGR_NV12)
)); ));
INSTANTIATE_TEST_CASE_P(OCL_ImgProc, CvtColor_Gray2RGB, testing::Combine( INSTANTIATE_TEST_CASE_P(OCL_ImgProc, CvtColor_Gray2RGB, testing::Combine(
DIFFERENT_SIZES, DIFFERENT_SIZES,
testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F)), testing::Values(MatDepth(CV_8U), MatDepth(CV_16U), MatDepth(CV_32F)),
testing::Values((int)CV_GRAY2BGR, (int)CV_GRAY2BGRA, (int)CV_GRAY2RGB, (int)CV_GRAY2RGBA) testing::Values((int)COLOR_GRAY2BGR, (int)COLOR_GRAY2BGRA, (int)COLOR_GRAY2RGB, (int)COLOR_GRAY2RGBA)
)); ));
} }
#endif #endif

@ -121,7 +121,7 @@ TEST_F(Haar, FaceDetect)
Mat gray, smallImg(cvRound (img.rows / scale), cvRound(img.cols / scale), CV_8UC1 ); Mat gray, smallImg(cvRound (img.rows / scale), cvRound(img.cols / scale), CV_8UC1 );
MemStorage storage(cvCreateMemStorage(0)); MemStorage storage(cvCreateMemStorage(0));
cvtColor( img, gray, CV_BGR2GRAY ); cvtColor( img, gray, COLOR_BGR2GRAY );
resize( gray, smallImg, smallImg.size(), 0, 0, INTER_LINEAR ); resize( gray, smallImg, smallImg.size(), 0, 0, INTER_LINEAR );
equalizeHist( smallImg, smallImg ); equalizeHist( smallImg, smallImg );

@ -44,7 +44,7 @@
//M*/ //M*/
#include "precomp.hpp" #include "precomp.hpp"
#include "opencv2/core.hpp"
using namespace std; using namespace std;
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
@ -71,11 +71,11 @@ TEST_P(HOG, GetDescriptors)
switch (type) switch (type)
{ {
case CV_8UC1: case CV_8UC1:
cv::cvtColor(img_rgb, img, CV_BGR2GRAY); cv::cvtColor(img_rgb, img, cv::COLOR_BGR2GRAY);
break; break;
case CV_8UC4: case CV_8UC4:
default: default:
cv::cvtColor(img_rgb, img, CV_BGR2BGRA); cv::cvtColor(img_rgb, img, cv::COLOR_BGR2BGRA);
break; break;
} }
cv::ocl::oclMat d_img(img); cv::ocl::oclMat d_img(img);
@ -128,11 +128,11 @@ TEST_P(HOG, Detect)
switch (type) switch (type)
{ {
case CV_8UC1: case CV_8UC1:
cv::cvtColor(img_rgb, img, CV_BGR2GRAY); cv::cvtColor(img_rgb, img, cv::COLOR_BGR2GRAY);
break; break;
case CV_8UC4: case CV_8UC4:
default: default:
cv::cvtColor(img_rgb, img, CV_BGR2BGRA); cv::cvtColor(img_rgb, img, cv::COLOR_BGR2BGRA);
break; break;
} }
cv::ocl::oclMat d_img(img); cv::ocl::oclMat d_img(img);

@ -245,7 +245,7 @@ double checkNorm(const Mat &m1, const Mat &m2)
double checkSimilarity(const Mat &m1, const Mat &m2) double checkSimilarity(const Mat &m1, const Mat &m2)
{ {
Mat diff; Mat diff;
matchTemplate(m1, m2, diff, CV_TM_CCORR_NORMED); matchTemplate(m1, m2, diff, TM_CCORR_NORMED);
return std::abs(diff.at<float>(0, 0) - 1.f); return std::abs(diff.at<float>(0, 0) - 1.f);
} }

@ -93,7 +93,7 @@ void cv::fastNlMeansDenoisingColored( InputArray _src, OutputArray _dst,
} }
Mat src_lab; Mat src_lab;
cvtColor(src, src_lab, CV_LBGR2Lab); cvtColor(src, src_lab, COLOR_LBGR2Lab);
Mat l(src.size(), CV_8U); Mat l(src.size(), CV_8U);
Mat ab(src.size(), CV_8UC2); Mat ab(src.size(), CV_8UC2);
@ -108,7 +108,7 @@ void cv::fastNlMeansDenoisingColored( InputArray _src, OutputArray _dst,
Mat dst_lab(src.size(), src.type()); Mat dst_lab(src.size(), src.type());
mixChannels(l_ab_denoised, 2, &dst_lab, 1, from_to, 3); mixChannels(l_ab_denoised, 2, &dst_lab, 1, from_to, 3);
cvtColor(dst_lab, dst, CV_Lab2LBGR); cvtColor(dst_lab, dst, COLOR_Lab2LBGR);
} }
static void fastNlMeansDenoisingMultiCheckPreconditions( static void fastNlMeansDenoisingMultiCheckPreconditions(
@ -215,7 +215,7 @@ void cv::fastNlMeansDenoisingColoredMulti( InputArrayOfArrays _srcImgs, OutputAr
src_lab[i] = Mat::zeros(srcImgs[0].size(), CV_8UC3); src_lab[i] = Mat::zeros(srcImgs[0].size(), CV_8UC3);
l[i] = Mat::zeros(srcImgs[0].size(), CV_8UC1); l[i] = Mat::zeros(srcImgs[0].size(), CV_8UC1);
ab[i] = Mat::zeros(srcImgs[0].size(), CV_8UC2); ab[i] = Mat::zeros(srcImgs[0].size(), CV_8UC2);
cvtColor(srcImgs[i], src_lab[i], CV_LBGR2Lab); cvtColor(srcImgs[i], src_lab[i], COLOR_LBGR2Lab);
Mat l_ab[] = { l[i], ab[i] }; Mat l_ab[] = { l[i], ab[i] };
mixChannels(&src_lab[i], 1, l_ab, 2, from_to, 3); mixChannels(&src_lab[i], 1, l_ab, 2, from_to, 3);
@ -236,7 +236,7 @@ void cv::fastNlMeansDenoisingColoredMulti( InputArrayOfArrays _srcImgs, OutputAr
Mat dst_lab(srcImgs[0].size(), srcImgs[0].type()); Mat dst_lab(srcImgs[0].size(), srcImgs[0].type());
mixChannels(l_ab_denoised, 2, &dst_lab, 1, from_to, 3); mixChannels(l_ab_denoised, 2, &dst_lab, 1, from_to, 3);
cvtColor(dst_lab, dst, CV_Lab2LBGR); cvtColor(dst_lab, dst, COLOR_Lab2LBGR);
} }

@ -716,6 +716,12 @@ icvNSInpaintFMM(const CvMat *f, CvMat *t, CvMat *out, int range, CvPriorityQueue
}\ }\
} }
namespace cv {
template<> void cv::Ptr<IplConvKernel>::delete_obj()
{
cvReleaseStructuringElement(&obj);
}
}
void void
cvInpaint( const CvArr* _input_img, const CvArr* _inpaint_mask, CvArr* _output_img, cvInpaint( const CvArr* _input_img, const CvArr* _inpaint_mask, CvArr* _output_img,

@ -78,7 +78,7 @@ void CV_InpaintTest::run( int )
mask.convertTo(inv_mask, CV_8UC3, -1.0, 255.0); mask.convertTo(inv_mask, CV_8UC3, -1.0, 255.0);
Mat mask1ch; Mat mask1ch;
cv::cvtColor(mask, mask1ch, CV_BGR2GRAY); cv::cvtColor(mask, mask1ch, COLOR_BGR2GRAY);
Mat test = orig.clone(); Mat test = orig.clone();
test.setTo(Scalar::all(255), mask1ch); test.setTo(Scalar::all(255), mask1ch);

@ -425,7 +425,7 @@ void normalizeUsingWeightMap(const Mat& weight, Mat& src)
void createWeightMap(const Mat &mask, float sharpness, Mat &weight) void createWeightMap(const Mat &mask, float sharpness, Mat &weight)
{ {
CV_Assert(mask.type() == CV_8U); CV_Assert(mask.type() == CV_8U);
distanceTransform(mask, weight, CV_DIST_L1, 3); distanceTransform(mask, weight, DIST_L1, 3);
threshold(weight * sharpness, weight, 1.f, 1.f, THRESH_TRUNC); threshold(weight * sharpness, weight, 1.f, 1.f, THRESH_TRUNC);
} }

@ -350,7 +350,7 @@ void SurfFeaturesFinder::find(const Mat &image, ImageFeatures &features)
CV_Assert((image.type() == CV_8UC3) || (image.type() == CV_8UC1)); CV_Assert((image.type() == CV_8UC3) || (image.type() == CV_8UC1));
if(image.type() == CV_8UC3) if(image.type() == CV_8UC3)
{ {
cvtColor(image, gray_image, CV_BGR2GRAY); cvtColor(image, gray_image, COLOR_BGR2GRAY);
} }
else else
{ {
@ -382,9 +382,9 @@ void OrbFeaturesFinder::find(const Mat &image, ImageFeatures &features)
CV_Assert((image.type() == CV_8UC3) || (image.type() == CV_8UC4) || (image.type() == CV_8UC1)); CV_Assert((image.type() == CV_8UC3) || (image.type() == CV_8UC4) || (image.type() == CV_8UC1));
if (image.type() == CV_8UC3) { if (image.type() == CV_8UC3) {
cvtColor(image, gray_image, CV_BGR2GRAY); cvtColor(image, gray_image, COLOR_BGR2GRAY);
} else if (image.type() == CV_8UC4) { } else if (image.type() == CV_8UC4) {
cvtColor(image, gray_image, CV_BGRA2GRAY); cvtColor(image, gray_image, COLOR_BGRA2GRAY);
} else if (image.type() == CV_8UC1) { } else if (image.type() == CV_8UC1) {
gray_image=image; gray_image=image;
} else { } else {
@ -457,7 +457,7 @@ void SurfFeaturesFinderGpu::find(const Mat &image, ImageFeatures &features)
image_.upload(image); image_.upload(image);
ensureSizeIsEnough(image.size(), CV_8UC1, gray_image_); ensureSizeIsEnough(image.size(), CV_8UC1, gray_image_);
cvtColor(image_, gray_image_, CV_BGR2GRAY); cvtColor(image_, gray_image_, COLOR_BGR2GRAY);
surf_.nOctaves = num_octaves_; surf_.nOctaves = num_octaves_;
surf_.nOctaveLayers = num_layers_; surf_.nOctaveLayers = num_layers_;

@ -139,8 +139,8 @@ void VoronoiSeamFinder::findInPair(size_t first, size_t second, Rect roi)
Mat unique2 = submask2.clone(); unique2.setTo(0, collision); Mat unique2 = submask2.clone(); unique2.setTo(0, collision);
Mat dist1, dist2; Mat dist1, dist2;
distanceTransform(unique1 == 0, dist1, CV_DIST_L1, 3); distanceTransform(unique1 == 0, dist1, DIST_L1, 3);
distanceTransform(unique2 == 0, dist2, CV_DIST_L1, 3); distanceTransform(unique2 == 0, dist2, DIST_L1, 3);
Mat seam = dist1 < dist2; Mat seam = dist1 < dist2;
@ -522,17 +522,17 @@ void DpSeamFinder::computeGradients(const Mat &image1, const Mat &image2)
Mat gray; Mat gray;
if (image1.channels() == 3) if (image1.channels() == 3)
cvtColor(image1, gray, CV_BGR2GRAY); cvtColor(image1, gray, COLOR_BGR2GRAY);
else if (image1.channels() == 4) else if (image1.channels() == 4)
cvtColor(image1, gray, CV_BGRA2GRAY); cvtColor(image1, gray, COLOR_BGRA2GRAY);
Sobel(gray, gradx1_, CV_32F, 1, 0); Sobel(gray, gradx1_, CV_32F, 1, 0);
Sobel(gray, grady1_, CV_32F, 0, 1); Sobel(gray, grady1_, CV_32F, 0, 1);
if (image2.channels() == 3) if (image2.channels() == 3)
cvtColor(image2, gray, CV_BGR2GRAY); cvtColor(image2, gray, COLOR_BGR2GRAY);
else if (image2.channels() == 4) else if (image2.channels() == 4)
cvtColor(image2, gray, CV_BGRA2GRAY); cvtColor(image2, gray, COLOR_BGRA2GRAY);
Sobel(gray, gradx2_, CV_32F, 1, 0); Sobel(gray, gradx2_, CV_32F, 1, 0);
Sobel(gray, grady2_, CV_32F, 0, 1); Sobel(gray, grady2_, CV_32F, 0, 1);

@ -330,7 +330,7 @@ namespace cvtest
double checkSimilarity(InputArray m1, InputArray m2) double checkSimilarity(InputArray m1, InputArray m2)
{ {
Mat diff; Mat diff;
matchTemplate(getMat(m1), getMat(m2), diff, CV_TM_CCORR_NORMED); matchTemplate(getMat(m1), getMat(m2), diff, TM_CCORR_NORMED);
return std::abs(diff.at<float>(0, 0) - 1.f); return std::abs(diff.at<float>(0, 0) - 1.f);
} }

@ -45,8 +45,10 @@
#ifdef __cplusplus #ifdef __cplusplus
# include "opencv2/core.hpp" # include "opencv2/core.hpp"
# include "opencv2/imgproc.hpp"
#endif #endif
#include "opencv2/imgproc.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

@ -1,6 +1,6 @@
#include <opencv2/imgproc/imgproc_c.h> #include <opencv2/imgproc/imgproc_c.h>
#include <opencv2/legacy/legacy.hpp> #include <opencv2/highgui/highgui_c.h>
#include "opencv2/highgui/highgui.hpp" #include <opencv2/legacy.hpp>
#include <stdio.h> #include <stdio.h>
static void help( void ) static void help( void )

@ -207,7 +207,7 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade,
CV_RGB(255,0,255)} ; CV_RGB(255,0,255)} ;
Mat gray, smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 ); Mat gray, smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 );
cvtColor( img, gray, CV_BGR2GRAY ); cvtColor( img, gray, COLOR_BGR2GRAY );
resize( gray, smallImg, smallImg.size(), 0, 0, INTER_LINEAR ); resize( gray, smallImg, smallImg.size(), 0, 0, INTER_LINEAR );
equalizeHist( smallImg, smallImg ); equalizeHist( smallImg, smallImg );

@ -1,7 +1,5 @@
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/highgui/highgui_c.h"
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>

@ -1,7 +1,6 @@
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/legacy/legacy.hpp" #include "opencv2/highgui/highgui_c.h"
#include "opencv2/legacy.hpp"
#include <stdio.h> #include <stdio.h>
static void help(void) static void help(void)

@ -167,7 +167,7 @@ void detectAndDraw( Mat& img, CascadeClassifier& cascade,
CV_RGB(255,0,255)} ; CV_RGB(255,0,255)} ;
Mat gray, smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 ); Mat gray, smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 );
cvtColor( img, gray, CV_BGR2GRAY ); cvtColor( img, gray, COLOR_BGR2GRAY );
resize( gray, smallImg, smallImg.size(), 0, 0, INTER_LINEAR ); resize( gray, smallImg, smallImg.size(), 0, 0, INTER_LINEAR );
equalizeHist( smallImg, smallImg ); equalizeHist( smallImg, smallImg );

@ -271,7 +271,7 @@ int main( int argc, char** argv )
{ {
vector<Point2f> ptvec; vector<Point2f> ptvec;
imageSize = view.size(); imageSize = view.size();
cvtColor(view, viewGray, CV_BGR2GRAY); cvtColor(view, viewGray, COLOR_BGR2GRAY);
bool found = findChessboardCorners( view, boardSize, ptvec, CV_CALIB_CB_ADAPTIVE_THRESH ); bool found = findChessboardCorners( view, boardSize, ptvec, CV_CALIB_CB_ADAPTIVE_THRESH );
drawChessboardCorners( view, boardSize, Mat(ptvec), found ); drawChessboardCorners( view, boardSize, Mat(ptvec), found );
@ -359,7 +359,7 @@ int main( int argc, char** argv )
continue; continue;
Mat rview = canvas.colRange(k2*imageSize.width, (k2+1)*imageSize.width); Mat rview = canvas.colRange(k2*imageSize.width, (k2+1)*imageSize.width);
remap(view, rview, map1[k1], map2[k1], CV_INTER_LINEAR); remap(view, rview, map1[k1], map2[k1], INTER_LINEAR);
} }
printf("%s %s %s\n", imageList[i*3].c_str(), imageList[i*3+1].c_str(), imageList[i*3+2].c_str()); printf("%s %s %s\n", imageList[i*3].c_str(), imageList[i*3+1].c_str(), imageList[i*3+2].c_str());
resize( canvas, small_canvas, Size(1500, 1500/3) ); resize( canvas, small_canvas, Size(1500, 1500/3) );

@ -509,7 +509,7 @@ static void build3dmodel( const Ptr<FeatureDetector>& detector,
for( size_t i = 0; i < nimages; i++ ) for( size_t i = 0; i < nimages; i++ )
{ {
Mat img = imread(imageList[i], 1), gray; Mat img = imread(imageList[i], 1), gray;
cvtColor(img, gray, CV_BGR2GRAY); cvtColor(img, gray, COLOR_BGR2GRAY);
vector<KeyPoint> keypoints; vector<KeyPoint> keypoints;
detector->detect(gray, keypoints); detector->detect(gray, keypoints);

@ -462,7 +462,7 @@ int main( int argc, char** argv )
flip( view, view, 0 ); flip( view, view, 0 );
vector<Point2f> pointbuf; vector<Point2f> pointbuf;
cvtColor(view, viewGray, CV_BGR2GRAY); cvtColor(view, viewGray, COLOR_BGR2GRAY);
bool found; bool found;
switch( pattern ) switch( pattern )

@ -41,7 +41,7 @@ int main( int argc, const char** argv )
return -1; return -1;
} }
Mat cimg; Mat cimg;
cvtColor(img, cimg, CV_GRAY2BGR); cvtColor(img, cimg, COLOR_GRAY2BGR);
// if the image and the template are not edge maps but normal grayscale images, // if the image and the template are not edge maps but normal grayscale images,
// you might want to uncomment the lines below to produce the maps. You can also // you might want to uncomment the lines below to produce the maps. You can also

@ -144,7 +144,7 @@ static int test_FaceDetector(int argc, char *argv[])
LOGD("\n\nSTEP n=%d from prev step %f ms\n", n, t_ms); LOGD("\n\nSTEP n=%d from prev step %f ms\n", n, t_ms);
m=images[n-1]; m=images[n-1];
CV_Assert(! m.empty()); CV_Assert(! m.empty());
cvtColor(m, gray, CV_BGR2GRAY); cvtColor(m, gray, COLOR_BGR2GRAY);
fd.process(gray); fd.process(gray);

@ -7,10 +7,10 @@
using namespace std; using namespace std;
using namespace cv; using namespace cv;
int maskSize0 = CV_DIST_MASK_5; int maskSize0 = DIST_MASK_5;
int voronoiType = -1; int voronoiType = -1;
int edgeThresh = 100; int edgeThresh = 100;
int distType0 = CV_DIST_L1; int distType0 = DIST_L1;
// The output and temporary images // The output and temporary images
Mat gray; Mat gray;
@ -31,8 +31,8 @@ static void onTrackbar( int, void* )
Scalar(255,0,255) Scalar(255,0,255)
}; };
int maskSize = voronoiType >= 0 ? CV_DIST_MASK_5 : maskSize0; int maskSize = voronoiType >= 0 ? DIST_MASK_5 : maskSize0;
int distType = voronoiType >= 0 ? CV_DIST_L2 : distType0; int distType = voronoiType >= 0 ? DIST_L2 : distType0;
Mat edge = gray >= edgeThresh, dist, labels, dist8u; Mat edge = gray >= edgeThresh, dist, labels, dist8u;
@ -140,17 +140,17 @@ int main( int argc, const char** argv )
voronoiType = -1; voronoiType = -1;
if( c == 'c' || c == 'C' ) if( c == 'c' || c == 'C' )
distType0 = CV_DIST_C; distType0 = DIST_C;
else if( c == '1' ) else if( c == '1' )
distType0 = CV_DIST_L1; distType0 = DIST_L1;
else if( c == '2' ) else if( c == '2' )
distType0 = CV_DIST_L2; distType0 = DIST_L2;
else if( c == '3' ) else if( c == '3' )
maskSize0 = CV_DIST_MASK_3; maskSize0 = DIST_MASK_3;
else if( c == '5' ) else if( c == '5' )
maskSize0 = CV_DIST_MASK_5; maskSize0 = DIST_MASK_5;
else if( c == '0' ) else if( c == '0' )
maskSize0 = CV_DIST_MASK_PRECISE; maskSize0 = DIST_MASK_PRECISE;
else if( c == 'v' ) else if( c == 'v' )
voronoiType = 0; voronoiType = 0;
else if( c == 'p' ) else if( c == 'p' )
@ -162,18 +162,18 @@ int main( int argc, const char** argv )
else if( voronoiType == 1 ) else if( voronoiType == 1 )
{ {
voronoiType = -1; voronoiType = -1;
maskSize0 = CV_DIST_MASK_3; maskSize0 = DIST_MASK_3;
distType0 = CV_DIST_C; distType0 = DIST_C;
} }
else if( distType0 == CV_DIST_C ) else if( distType0 == DIST_C )
distType0 = CV_DIST_L1; distType0 = DIST_L1;
else if( distType0 == CV_DIST_L1 ) else if( distType0 == DIST_L1 )
distType0 = CV_DIST_L2; distType0 = DIST_L2;
else if( maskSize0 == CV_DIST_MASK_3 ) else if( maskSize0 == DIST_MASK_3 )
maskSize0 = CV_DIST_MASK_5; maskSize0 = DIST_MASK_5;
else if( maskSize0 == CV_DIST_MASK_5 ) else if( maskSize0 == DIST_MASK_5 )
maskSize0 = CV_DIST_MASK_PRECISE; maskSize0 = DIST_MASK_PRECISE;
else if( maskSize0 == CV_DIST_MASK_PRECISE ) else if( maskSize0 == DIST_MASK_PRECISE )
voronoiType = 0; voronoiType = 0;
} }
} }

@ -50,7 +50,7 @@ int main( int argc, const char** argv )
return -1; return -1;
} }
cedge.create(image.size(), image.type()); cedge.create(image.size(), image.type());
cvtColor(image, gray, CV_BGR2GRAY); cvtColor(image, gray, COLOR_BGR2GRAY);
// Create a window // Create a window
namedWindow("Edge map", 1); namedWindow("Edge map", 1);

@ -41,7 +41,7 @@ static void onMouse( int event, int x, int y, int, void* )
int lo = ffillMode == 0 ? 0 : loDiff; int lo = ffillMode == 0 ? 0 : loDiff;
int up = ffillMode == 0 ? 0 : upDiff; int up = ffillMode == 0 ? 0 : upDiff;
int flags = connectivity + (newMaskVal << 8) + int flags = connectivity + (newMaskVal << 8) +
(ffillMode == 1 ? CV_FLOODFILL_FIXED_RANGE : 0); (ffillMode == 1 ? FLOODFILL_FIXED_RANGE : 0);
int b = (unsigned)theRNG() & 255; int b = (unsigned)theRNG() & 255;
int g = (unsigned)theRNG() & 255; int g = (unsigned)theRNG() & 255;
int r = (unsigned)theRNG() & 255; int r = (unsigned)theRNG() & 255;
@ -53,7 +53,7 @@ static void onMouse( int event, int x, int y, int, void* )
if( useMask ) if( useMask )
{ {
threshold(mask, mask, 1, 128, CV_THRESH_BINARY); threshold(mask, mask, 1, 128, THRESH_BINARY);
area = floodFill(dst, mask, seed, newVal, &ccomp, Scalar(lo, lo, lo), area = floodFill(dst, mask, seed, newVal, &ccomp, Scalar(lo, lo, lo),
Scalar(up, up, up), flags); Scalar(up, up, up), flags);
imshow( "mask", mask ); imshow( "mask", mask );
@ -81,7 +81,7 @@ int main( int argc, char** argv )
} }
help(); help();
image0.copyTo(image); image0.copyTo(image);
cvtColor(image0, gray, CV_BGR2GRAY); cvtColor(image0, gray, COLOR_BGR2GRAY);
mask.create(image0.rows+2, image0.cols+2, CV_8UC1); mask.create(image0.rows+2, image0.cols+2, CV_8UC1);
namedWindow( "image", 0 ); namedWindow( "image", 0 );
@ -106,7 +106,7 @@ int main( int argc, char** argv )
if( isColor ) if( isColor )
{ {
cout << "Grayscale mode is set\n"; cout << "Grayscale mode is set\n";
cvtColor(image0, gray, CV_BGR2GRAY); cvtColor(image0, gray, COLOR_BGR2GRAY);
mask = Scalar::all(0); mask = Scalar::all(0);
isColor = false; isColor = false;
} }
@ -135,7 +135,7 @@ int main( int argc, char** argv )
case 'r': case 'r':
cout << "Original image is restored\n"; cout << "Original image is restored\n";
image0.copyTo(image); image0.copyTo(image);
cvtColor(image, gray, CV_BGR2GRAY); cvtColor(image, gray, COLOR_BGR2GRAY);
mask = Scalar::all(0); mask = Scalar::all(0);
break; break;
case 's': case 's':

@ -64,7 +64,7 @@ void processImage(int /*h*/, void*)
vector<vector<Point> > contours; vector<vector<Point> > contours;
Mat bimage = image >= sliderPos; Mat bimage = image >= sliderPos;
findContours(bimage, contours, CV_RETR_LIST, CV_CHAIN_APPROX_NONE); findContours(bimage, contours, RETR_LIST, CHAIN_APPROX_NONE);
Mat cimage = Mat::zeros(bimage.size(), CV_8UC3); Mat cimage = Mat::zeros(bimage.size(), CV_8UC3);

@ -27,10 +27,10 @@ int main(int argc, char** argv)
Mat cimg; Mat cimg;
medianBlur(img, img, 5); medianBlur(img, img, 5);
cvtColor(img, cimg, CV_GRAY2BGR); cvtColor(img, cimg, COLOR_GRAY2BGR);
vector<Vec3f> circles; vector<Vec3f> circles;
HoughCircles(img, circles, CV_HOUGH_GRADIENT, 1, 10, HoughCircles(img, circles, HOUGH_GRADIENT, 1, 10,
100, 30, 1, 30 // change the last two parameters 100, 30, 1, 30 // change the last two parameters
// (min_radius & max_radius) to detect larger circles // (min_radius & max_radius) to detect larger circles
); );

@ -27,7 +27,7 @@ int main(int argc, char** argv)
Mat dst, cdst; Mat dst, cdst;
Canny(src, dst, 50, 200, 3); Canny(src, dst, 50, 200, 3);
cvtColor(dst, cdst, CV_GRAY2BGR); cvtColor(dst, cdst, COLOR_GRAY2BGR);
#if 0 #if 0
vector<Vec2f> lines; vector<Vec2f> lines;

@ -49,7 +49,7 @@ int main( int argc, char** argv )
return -1; return -1;
Mat img_yuv; Mat img_yuv;
cvtColor(img, img_yuv, CV_BGR2YCrCb); // convert image to YUV color space. The output image will be created automatically cvtColor(img, img_yuv, COLOR_BGR2YCrCb); // convert image to YUV color space. The output image will be created automatically
vector<Mat> planes; // Vector is template vector class, similar to STL's vector. It can store matrices too. vector<Mat> planes; // Vector is template vector class, similar to STL's vector. It can store matrices too.
split(img_yuv, planes); // split the image into separate color planes split(img_yuv, planes); // split the image into separate color planes
@ -107,7 +107,7 @@ int main( int argc, char** argv )
// now merge the results back // now merge the results back
merge(planes, img_yuv); merge(planes, img_yuv);
// and produce the output RGB image // and produce the output RGB image
cvtColor(img_yuv, img, CV_YCrCb2BGR); cvtColor(img_yuv, img, COLOR_YCrCb2BGR);
// this is counterpart for cvNamedWindow // this is counterpart for cvNamedWindow
namedWindow("image with grain", CV_WINDOW_AUTOSIZE); namedWindow("image with grain", CV_WINDOW_AUTOSIZE);

@ -17,8 +17,10 @@ static void help()
"./laplace [camera #, default 0]\n" << endl; "./laplace [camera #, default 0]\n" << endl;
} }
enum {GAUSSIAN, BLUR, MEDIAN};
int sigma = 3; int sigma = 3;
int smoothType = CV_GAUSSIAN; int smoothType = GAUSSIAN;
int main( int argc, char** argv ) int main( int argc, char** argv )
{ {
@ -63,9 +65,9 @@ int main( int argc, char** argv )
break; break;
int ksize = (sigma*5)|1; int ksize = (sigma*5)|1;
if(smoothType == CV_GAUSSIAN) if(smoothType == GAUSSIAN)
GaussianBlur(frame, smoothed, Size(ksize, ksize), sigma, sigma); GaussianBlur(frame, smoothed, Size(ksize, ksize), sigma, sigma);
else if(smoothType == CV_BLUR) else if(smoothType == BLUR)
blur(frame, smoothed, Size(ksize, ksize)); blur(frame, smoothed, Size(ksize, ksize));
else else
medianBlur(frame, smoothed, ksize); medianBlur(frame, smoothed, ksize);
@ -76,7 +78,7 @@ int main( int argc, char** argv )
int c = waitKey(30); int c = waitKey(30);
if( c == ' ' ) if( c == ' ' )
smoothType = smoothType == CV_GAUSSIAN ? CV_BLUR : smoothType == CV_BLUR ? CV_MEDIAN : CV_GAUSSIAN; smoothType = smoothType == GAUSSIAN ? BLUR : smoothType == BLUR ? MEDIAN : GAUSSIAN;
if( c == 'q' || c == 'Q' || (c & 255) == 27 ) if( c == 'q' || c == 'Q' || (c & 255) == 27 )
break; break;
} }

@ -37,9 +37,9 @@ static void OpenClose(int, void*)
int an = n > 0 ? n : -n; int an = n > 0 ? n : -n;
Mat element = getStructuringElement(element_shape, Size(an*2+1, an*2+1), Point(an, an) ); Mat element = getStructuringElement(element_shape, Size(an*2+1, an*2+1), Point(an, an) );
if( n < 0 ) if( n < 0 )
morphologyEx(src, dst, CV_MOP_OPEN, element); morphologyEx(src, dst, MORPH_OPEN, element);
else else
morphologyEx(src, dst, CV_MOP_CLOSE, element); morphologyEx(src, dst, MORPH_CLOSE, element);
imshow("Open/Close",dst); imshow("Open/Close",dst);
} }

@ -13,7 +13,7 @@ int main(int, char* [])
do do
{ {
video >> frame; video >> frame;
cvtColor(frame, curr, CV_RGB2GRAY); cvtColor(frame, curr, COLOR_RGB2GRAY);
if(prev.empty()) if(prev.empty())
{ {

@ -125,8 +125,8 @@ int main(int argc, char** argv)
} }
Mat grayImage0, grayImage1, depthFlt0, depthFlt1/*in meters*/; Mat grayImage0, grayImage1, depthFlt0, depthFlt1/*in meters*/;
cvtColor( colorImage0, grayImage0, CV_BGR2GRAY ); cvtColor( colorImage0, grayImage0, COLOR_BGR2GRAY );
cvtColor( colorImage1, grayImage1, CV_BGR2GRAY ); cvtColor( colorImage1, grayImage1, COLOR_BGR2GRAY );
depth0.convertTo( depthFlt0, CV_32FC1, 1./1000 ); depth0.convertTo( depthFlt0, CV_32FC1, 1./1000 );
depth1.convertTo( depthFlt1, CV_32FC1, 1./1000 ); depth1.convertTo( depthFlt1, CV_32FC1, 1./1000 );

@ -30,7 +30,7 @@ static void refineSegments(const Mat& img, Mat& mask, Mat& dst)
erode(temp, temp, Mat(), Point(-1,-1), niters*2); erode(temp, temp, Mat(), Point(-1,-1), niters*2);
dilate(temp, temp, Mat(), Point(-1,-1), niters); dilate(temp, temp, Mat(), Point(-1,-1), niters);
findContours( temp, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE ); findContours( temp, contours, hierarchy, RETR_CCOMP, CHAIN_APPROX_SIMPLE );
dst = Mat::zeros(img.size(), CV_8UC3); dst = Mat::zeros(img.size(), CV_8UC3);

@ -83,7 +83,7 @@ static void findSquares( const Mat& image, vector<vector<Point> >& squares )
} }
// find contours and store them all as a list // find contours and store them all as a list
findContours(gray, contours, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE); findContours(gray, contours, RETR_LIST, CHAIN_APPROX_SIMPLE);
vector<Point> approx; vector<Point> approx;

@ -121,7 +121,7 @@ StereoCalib(const vector<string>& imagelist, Size boardSize, bool useCalibrated=
{ {
cout << filename << endl; cout << filename << endl;
Mat cimg, cimg1; Mat cimg, cimg1;
cvtColor(img, cimg, CV_GRAY2BGR); cvtColor(img, cimg, COLOR_GRAY2BGR);
drawChessboardCorners(cimg, boardSize, corners, found); drawChessboardCorners(cimg, boardSize, corners, found);
double sf = 640./MAX(img.rows, img.cols); double sf = 640./MAX(img.rows, img.cols);
resize(cimg, cimg1, Size(), sf, sf); resize(cimg, cimg1, Size(), sf, sf);
@ -304,10 +304,10 @@ StereoCalib(const vector<string>& imagelist, Size boardSize, bool useCalibrated=
for( k = 0; k < 2; k++ ) for( k = 0; k < 2; k++ )
{ {
Mat img = imread(goodImageList[i*2+k], 0), rimg, cimg; Mat img = imread(goodImageList[i*2+k], 0), rimg, cimg;
remap(img, rimg, rmap[k][0], rmap[k][1], CV_INTER_LINEAR); remap(img, rimg, rmap[k][0], rmap[k][1], INTER_LINEAR);
cvtColor(rimg, cimg, CV_GRAY2BGR); cvtColor(rimg, cimg, COLOR_GRAY2BGR);
Mat canvasPart = !isVerticalStereo ? canvas(Rect(w*k, 0, w, h)) : canvas(Rect(0, h*k, w, h)); Mat canvasPart = !isVerticalStereo ? canvas(Rect(w*k, 0, w, h)) : canvas(Rect(0, h*k, w, h));
resize(cimg, canvasPart, canvasPart.size(), 0, 0, CV_INTER_AREA); resize(cimg, canvasPart, canvasPart.size(), 0, 0, INTER_AREA);
if( useCalibrated ) if( useCalibrated )
{ {
Rect vroi(cvRound(validRoi[k].x*sf), cvRound(validRoi[k].y*sf), Rect vroi(cvRound(validRoi[k].x*sf), cvRound(validRoi[k].y*sf),

@ -31,7 +31,7 @@ int main( int, char** argv )
} }
/// Convert to grayscale /// Convert to grayscale
cvtColor( src, src, CV_BGR2GRAY ); cvtColor( src, src, COLOR_BGR2GRAY );
/// Apply Histogram Equalization /// Apply Histogram Equalization
equalizeHist( src, dst ); equalizeHist( src, dst );

@ -74,7 +74,7 @@ void MatchingMethod( int, void* )
/// For SQDIFF and SQDIFF_NORMED, the best matches are lower values. For all the other methods, the higher the better /// For SQDIFF and SQDIFF_NORMED, the best matches are lower values. For all the other methods, the higher the better
if( match_method == CV_TM_SQDIFF || match_method == CV_TM_SQDIFF_NORMED ) if( match_method == TM_SQDIFF || match_method == TM_SQDIFF_NORMED )
{ matchLoc = minLoc; } { matchLoc = minLoc; }
else else
{ matchLoc = maxLoc; } { matchLoc = maxLoc; }

@ -28,7 +28,7 @@ int main( int, char** argv )
/// Read the image /// Read the image
src = imread( argv[1], 1 ); src = imread( argv[1], 1 );
/// Transform it to HSV /// Transform it to HSV
cvtColor( src, hsv, CV_BGR2HSV ); cvtColor( src, hsv, COLOR_BGR2HSV );
/// Use only the Hue value /// Use only the Hue value
hue.create( hsv.size(), hsv.depth() ); hue.create( hsv.size(), hsv.depth() );

@ -31,7 +31,7 @@ int main( int, char** argv )
/// Read the image /// Read the image
src = imread( argv[1], 1 ); src = imread( argv[1], 1 );
/// Transform it to HSV /// Transform it to HSV
cvtColor( src, hsv, CV_BGR2HSV ); cvtColor( src, hsv, COLOR_BGR2HSV );
/// Show the image /// Show the image
namedWindow( window_image, CV_WINDOW_AUTOSIZE ); namedWindow( window_image, CV_WINDOW_AUTOSIZE );

@ -33,9 +33,9 @@ int main( int argc, char** argv )
src_test2 = imread( argv[3], 1 ); src_test2 = imread( argv[3], 1 );
/// Convert to HSV /// Convert to HSV
cvtColor( src_base, hsv_base, CV_BGR2HSV ); cvtColor( src_base, hsv_base, COLOR_BGR2HSV );
cvtColor( src_test1, hsv_test1, CV_BGR2HSV ); cvtColor( src_test1, hsv_test1, COLOR_BGR2HSV );
cvtColor( src_test2, hsv_test2, CV_BGR2HSV ); cvtColor( src_test2, hsv_test2, COLOR_BGR2HSV );
hsv_half_down = hsv_base( Range( hsv_base.rows/2, hsv_base.rows - 1 ), Range( 0, hsv_base.cols - 1 ) ); hsv_half_down = hsv_base( Range( hsv_base.rows/2, hsv_base.rows - 1 ), Range( 0, hsv_base.cols - 1 ) );

@ -37,7 +37,7 @@ int main( int, char** argv )
src = imread( argv[1], 1 ); src = imread( argv[1], 1 );
/// Convert the image to Gray /// Convert the image to Gray
cvtColor( src, src_gray, CV_RGB2GRAY ); cvtColor( src, src_gray, COLOR_RGB2GRAY );
/// Create a window to display results /// Create a window to display results
namedWindow( window_name, CV_WINDOW_AUTOSIZE ); namedWindow( window_name, CV_WINDOW_AUTOSIZE );

@ -58,7 +58,7 @@ int main( int, char** argv )
dst.create( src.size(), src.type() ); dst.create( src.size(), src.type() );
/// Convert the image to grayscale /// Convert the image to grayscale
cvtColor( src, src_gray, CV_BGR2GRAY ); cvtColor( src, src_gray, COLOR_BGR2GRAY );
/// Create a window /// Create a window
namedWindow( window_name, CV_WINDOW_AUTOSIZE ); namedWindow( window_name, CV_WINDOW_AUTOSIZE );

@ -26,7 +26,7 @@ int main(int, char** argv)
{ return -1; } { return -1; }
/// Convert it to gray /// Convert it to gray
cvtColor( src, src_gray, CV_BGR2GRAY ); cvtColor( src, src_gray, COLOR_BGR2GRAY );
/// Reduce the noise so we avoid false circle detection /// Reduce the noise so we avoid false circle detection
GaussianBlur( src_gray, src_gray, Size(9, 9), 2, 2 ); GaussianBlur( src_gray, src_gray, Size(9, 9), 2, 2 );
@ -34,7 +34,7 @@ int main(int, char** argv)
vector<Vec3f> circles; vector<Vec3f> circles;
/// Apply the Hough Transform to find the circles /// Apply the Hough Transform to find the circles
HoughCircles( src_gray, circles, CV_HOUGH_GRADIENT, 1, src_gray.rows/8, 200, 100, 0, 0 ); HoughCircles( src_gray, circles, HOUGH_GRADIENT, 1, src_gray.rows/8, 200, 100, 0, 0 );
/// Draw the circles detected /// Draw the circles detected
for( size_t i = 0; i < circles.size(); i++ ) for( size_t i = 0; i < circles.size(); i++ )

@ -46,7 +46,7 @@ int main( int, char** argv )
} }
/// Pass the image to gray /// Pass the image to gray
cvtColor( src, src_gray, CV_RGB2GRAY ); cvtColor( src, src_gray, COLOR_RGB2GRAY );
/// Apply Canny edge detector /// Apply Canny edge detector
Canny( src_gray, edges, 50, 200, 3 ); Canny( src_gray, edges, 50, 200, 3 );
@ -85,7 +85,7 @@ void help()
void Standard_Hough( int, void* ) void Standard_Hough( int, void* )
{ {
vector<Vec2f> s_lines; vector<Vec2f> s_lines;
cvtColor( edges, standard_hough, CV_GRAY2BGR ); cvtColor( edges, standard_hough, COLOR_GRAY2BGR );
/// 1. Use Standard Hough Transform /// 1. Use Standard Hough Transform
HoughLines( edges, s_lines, 1, CV_PI/180, min_threshold + s_trackbar, 0, 0 ); HoughLines( edges, s_lines, 1, CV_PI/180, min_threshold + s_trackbar, 0, 0 );
@ -112,7 +112,7 @@ void Standard_Hough( int, void* )
void Probabilistic_Hough( int, void* ) void Probabilistic_Hough( int, void* )
{ {
vector<Vec4i> p_lines; vector<Vec4i> p_lines;
cvtColor( edges, probabilistic_hough, CV_GRAY2BGR ); cvtColor( edges, probabilistic_hough, COLOR_GRAY2BGR );
/// 2. Use Probabilistic Hough Transform /// 2. Use Probabilistic Hough Transform
HoughLinesP( edges, p_lines, 1, CV_PI/180, min_threshold + p_trackbar, 30, 10 ); HoughLinesP( edges, p_lines, 1, CV_PI/180, min_threshold + p_trackbar, 30, 10 );

@ -34,7 +34,7 @@ int main( int, char** argv )
GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT ); GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT );
/// Convert the image to grayscale /// Convert the image to grayscale
cvtColor( src, src_gray, CV_RGB2GRAY ); cvtColor( src, src_gray, COLOR_RGB2GRAY );
/// Create window /// Create window
namedWindow( window_name, CV_WINDOW_AUTOSIZE ); namedWindow( window_name, CV_WINDOW_AUTOSIZE );

@ -47,7 +47,7 @@ int main( int, char** argv )
/// Update map_x & map_y. Then apply remap /// Update map_x & map_y. Then apply remap
update_map(); update_map();
remap( src, dst, map_x, map_y, CV_INTER_LINEAR, BORDER_CONSTANT, Scalar(0, 0, 0) ); remap( src, dst, map_x, map_y, INTER_LINEAR, BORDER_CONSTANT, Scalar(0, 0, 0) );
// Display results // Display results
imshow( remap_window, dst ); imshow( remap_window, dst );

@ -33,7 +33,7 @@ int main( int, char** argv )
GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT ); GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT );
/// Convert it to gray /// Convert it to gray
cvtColor( src, src_gray, CV_RGB2GRAY ); cvtColor( src, src_gray, COLOR_RGB2GRAY );
/// Create window /// Create window
namedWindow( window_name, CV_WINDOW_AUTOSIZE ); namedWindow( window_name, CV_WINDOW_AUTOSIZE );

@ -30,7 +30,7 @@ int main( int, char** argv )
src = imread( argv[1], 1 ); src = imread( argv[1], 1 );
/// Convert image to gray and blur it /// Convert image to gray and blur it
cvtColor( src, src_gray, CV_BGR2GRAY ); cvtColor( src, src_gray, COLOR_BGR2GRAY );
blur( src_gray, src_gray, Size(3,3) ); blur( src_gray, src_gray, Size(3,3) );
/// Create Window /// Create Window
@ -57,7 +57,7 @@ void thresh_callback(int, void* )
/// Detect edges using canny /// Detect edges using canny
Canny( src_gray, canny_output, thresh, thresh*2, 3 ); Canny( src_gray, canny_output, thresh, thresh*2, 3 );
/// Find contours /// Find contours
findContours( canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) ); findContours( canny_output, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE, Point(0, 0) );
/// Draw contours /// Draw contours
Mat drawing = Mat::zeros( canny_output.size(), CV_8UC3 ); Mat drawing = Mat::zeros( canny_output.size(), CV_8UC3 );

@ -30,7 +30,7 @@ int main( int, char** argv )
src = imread( argv[1], 1 ); src = imread( argv[1], 1 );
/// Convert image to gray and blur it /// Convert image to gray and blur it
cvtColor( src, src_gray, CV_BGR2GRAY ); cvtColor( src, src_gray, COLOR_BGR2GRAY );
blur( src_gray, src_gray, Size(3,3) ); blur( src_gray, src_gray, Size(3,3) );
/// Create Window /// Create Window
@ -57,7 +57,7 @@ void thresh_callback(int, void* )
/// Detect edges using Threshold /// Detect edges using Threshold
threshold( src_gray, threshold_output, thresh, 255, THRESH_BINARY ); threshold( src_gray, threshold_output, thresh, 255, THRESH_BINARY );
/// Find contours /// Find contours
findContours( threshold_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) ); findContours( threshold_output, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE, Point(0, 0) );
/// Approximate contours to polygons + get bounding rects and circles /// Approximate contours to polygons + get bounding rects and circles
vector<vector<Point> > contours_poly( contours.size() ); vector<vector<Point> > contours_poly( contours.size() );

@ -30,7 +30,7 @@ int main( int, char** argv )
src = imread( argv[1], 1 ); src = imread( argv[1], 1 );
/// Convert image to gray and blur it /// Convert image to gray and blur it
cvtColor( src, src_gray, CV_BGR2GRAY ); cvtColor( src, src_gray, COLOR_BGR2GRAY );
blur( src_gray, src_gray, Size(3,3) ); blur( src_gray, src_gray, Size(3,3) );
/// Create Window /// Create Window
@ -57,7 +57,7 @@ void thresh_callback(int, void* )
/// Detect edges using Threshold /// Detect edges using Threshold
threshold( src_gray, threshold_output, thresh, 255, THRESH_BINARY ); threshold( src_gray, threshold_output, thresh, 255, THRESH_BINARY );
/// Find contours /// Find contours
findContours( threshold_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) ); findContours( threshold_output, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE, Point(0, 0) );
/// Find the rotated rectangles and ellipses for each contour /// Find the rotated rectangles and ellipses for each contour
vector<RotatedRect> minRect( contours.size() ); vector<RotatedRect> minRect( contours.size() );

@ -30,7 +30,7 @@ int main( int, char** argv )
src = imread( argv[1], 1 ); src = imread( argv[1], 1 );
/// Convert image to gray and blur it /// Convert image to gray and blur it
cvtColor( src, src_gray, CV_BGR2GRAY ); cvtColor( src, src_gray, COLOR_BGR2GRAY );
blur( src_gray, src_gray, Size(3,3) ); blur( src_gray, src_gray, Size(3,3) );
/// Create Window /// Create Window
@ -59,7 +59,7 @@ void thresh_callback(int, void* )
threshold( src_gray, threshold_output, thresh, 255, THRESH_BINARY ); threshold( src_gray, threshold_output, thresh, 255, THRESH_BINARY );
/// Find contours /// Find contours
findContours( threshold_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) ); findContours( threshold_output, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE, Point(0, 0) );
/// Find the convex hull object for each contour /// Find the convex hull object for each contour
vector<vector<Point> >hull( contours.size() ); vector<vector<Point> >hull( contours.size() );

@ -30,7 +30,7 @@ int main( int, char** argv )
src = imread( argv[1], 1 ); src = imread( argv[1], 1 );
/// Convert image to gray and blur it /// Convert image to gray and blur it
cvtColor( src, src_gray, CV_BGR2GRAY ); cvtColor( src, src_gray, COLOR_BGR2GRAY );
blur( src_gray, src_gray, Size(3,3) ); blur( src_gray, src_gray, Size(3,3) );
/// Create Window /// Create Window
@ -57,7 +57,7 @@ void thresh_callback(int, void* )
/// Detect edges using canny /// Detect edges using canny
Canny( src_gray, canny_output, thresh, thresh*2, 3 ); Canny( src_gray, canny_output, thresh, thresh*2, 3 );
/// Find contours /// Find contours
findContours( canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) ); findContours( canny_output, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE, Point(0, 0) );
/// Get the moments /// Get the moments
vector<Moments> mu(contours.size() ); vector<Moments> mu(contours.size() );

@ -40,7 +40,7 @@ int main( int, char** argv )
{ {
/// Load source image and convert it to gray /// Load source image and convert it to gray
src = imread( argv[1], 1 ); src = imread( argv[1], 1 );
cvtColor( src, src_gray, CV_BGR2GRAY ); cvtColor( src, src_gray, COLOR_BGR2GRAY );
/// Set some parameters /// Set some parameters
int blockSize = 3; int apertureSize = 3; int blockSize = 3; int apertureSize = 3;

@ -31,7 +31,7 @@ int main( int, char** argv )
{ {
/// Load source image and convert it to gray /// Load source image and convert it to gray
src = imread( argv[1], 1 ); src = imread( argv[1], 1 );
cvtColor( src, src_gray, CV_BGR2GRAY ); cvtColor( src, src_gray, COLOR_BGR2GRAY );
/// Create a window and a trackbar /// Create a window and a trackbar
namedWindow( source_window, CV_WINDOW_AUTOSIZE ); namedWindow( source_window, CV_WINDOW_AUTOSIZE );

@ -32,7 +32,7 @@ int main( int, char** argv )
{ {
/// Load source image and convert it to gray /// Load source image and convert it to gray
src = imread( argv[1], 1 ); src = imread( argv[1], 1 );
cvtColor( src, src_gray, CV_BGR2GRAY ); cvtColor( src, src_gray, COLOR_BGR2GRAY );
/// Create Window /// Create Window
namedWindow( source_window, CV_WINDOW_AUTOSIZE ); namedWindow( source_window, CV_WINDOW_AUTOSIZE );

@ -32,7 +32,7 @@ int main( int, char** argv )
{ {
/// Load source image and convert it to gray /// Load source image and convert it to gray
src = imread( argv[1], 1 ); src = imread( argv[1], 1 );
cvtColor( src, src_gray, CV_BGR2GRAY ); cvtColor( src, src_gray, COLOR_BGR2GRAY );
/// Create Window /// Create Window
namedWindow( source_window, CV_WINDOW_AUTOSIZE ); namedWindow( source_window, CV_WINDOW_AUTOSIZE );

@ -291,7 +291,7 @@ int main(int argc, char* argv[])
if( s.calibrationPattern == Settings::CHESSBOARD) if( s.calibrationPattern == Settings::CHESSBOARD)
{ {
Mat viewGray; Mat viewGray;
cvtColor(view, viewGray, CV_BGR2GRAY); cvtColor(view, viewGray, COLOR_BGR2GRAY);
cornerSubPix( viewGray, pointBuf, Size(11,11), cornerSubPix( viewGray, pointBuf, Size(11,11),
Size(-1,-1), TermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 30, 0.1 )); Size(-1,-1), TermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 30, 0.1 ));
} }

@ -46,7 +46,7 @@ int main( int argc, char** argv )
// convert image to YUV color space. The output image will be created automatically. // convert image to YUV color space. The output image will be created automatically.
Mat I_YUV; Mat I_YUV;
cvtColor(I, I_YUV, CV_BGR2YCrCb); cvtColor(I, I_YUV, COLOR_BGR2YCrCb);
vector<Mat> planes; // Use the STL's vector structure to store multiple Mat objects vector<Mat> planes; // Use the STL's vector structure to store multiple Mat objects
split(I_YUV, planes); // split the image into separate color planes (Y U V) split(I_YUV, planes); // split the image into separate color planes (Y U V)
@ -115,7 +115,7 @@ int main( int argc, char** argv )
merge(planes, I_YUV); // now merge the results back merge(planes, I_YUV); // now merge the results back
cvtColor(I_YUV, I, CV_YCrCb2BGR); // and produce the output RGB image cvtColor(I_YUV, I, COLOR_YCrCb2BGR); // and produce the output RGB image
namedWindow("image with grain", CV_WINDOW_AUTOSIZE); // use this to create images namedWindow("image with grain", CV_WINDOW_AUTOSIZE); // use this to create images

@ -68,7 +68,7 @@ void detectAndDisplay( Mat frame )
std::vector<Rect> faces; std::vector<Rect> faces;
Mat frame_gray; Mat frame_gray;
cvtColor( frame, frame_gray, CV_BGR2GRAY ); cvtColor( frame, frame_gray, COLOR_BGR2GRAY );
equalizeHist( frame_gray, frame_gray ); equalizeHist( frame_gray, frame_gray );
//-- Detect faces //-- Detect faces
face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ); face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) );

@ -68,7 +68,7 @@ void detectAndDisplay( Mat frame )
std::vector<Rect> faces; std::vector<Rect> faces;
Mat frame_gray; Mat frame_gray;
cvtColor( frame, frame_gray, CV_BGR2GRAY ); cvtColor( frame, frame_gray, COLOR_BGR2GRAY );
equalizeHist( frame_gray, frame_gray ); equalizeHist( frame_gray, frame_gray );
//-- Detect faces //-- Detect faces

@ -52,7 +52,7 @@ namespace
if (frame.empty()) if (frame.empty())
break; break;
cv::Mat gray; cv::Mat gray;
cv::cvtColor(frame,gray,CV_RGB2GRAY); cv::cvtColor(frame,gray, COLOR_RGB2GRAY);
vector<String> codes; vector<String> codes;
Mat corners; Mat corners;
findDataMatrix(gray, codes, corners); findDataMatrix(gray, codes, corners);

@ -161,7 +161,7 @@ int main(int ac, char ** av)
if (frame.empty()) if (frame.empty())
break; break;
cvtColor(frame, gray, CV_RGB2GRAY); cvtColor(frame, gray, COLOR_RGB2GRAY);
detector.detect(gray, query_kpts); //Find interest points detector.detect(gray, query_kpts); //Find interest points

@ -59,8 +59,8 @@ int main( int argc, char** argv )
namedWindow( "image", 1 ); namedWindow( "image", 1 );
img0.copyTo(img); img0.copyTo(img);
cvtColor(img, markerMask, CV_BGR2GRAY); cvtColor(img, markerMask, COLOR_BGR2GRAY);
cvtColor(markerMask, imgGray, CV_GRAY2BGR); cvtColor(markerMask, imgGray, COLOR_GRAY2BGR);
markerMask = Scalar::all(0); markerMask = Scalar::all(0);
imshow( "image", img ); imshow( "image", img );
setMouseCallback( "image", onMouse, 0 ); setMouseCallback( "image", onMouse, 0 );
@ -85,7 +85,7 @@ int main( int argc, char** argv )
vector<vector<Point> > contours; vector<vector<Point> > contours;
vector<Vec4i> hierarchy; vector<Vec4i> hierarchy;
findContours(markerMask, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE); findContours(markerMask, contours, hierarchy, RETR_CCOMP, CHAIN_APPROX_SIMPLE);
if( contours.empty() ) if( contours.empty() )
continue; continue;

@ -29,7 +29,7 @@ void convertAndResize(const T& src, T& gray, T& resized, double scale)
{ {
if (src.channels() == 3) if (src.channels() == 3)
{ {
cvtColor( src, gray, CV_BGR2GRAY ); cvtColor( src, gray, COLOR_BGR2GRAY );
} }
else else
{ {
@ -272,7 +272,7 @@ int main(int argc, const char *argv[])
} }
cout << endl; cout << endl;
cvtColor(resized_cpu, frameDisp, CV_GRAY2BGR); cvtColor(resized_cpu, frameDisp, COLOR_GRAY2BGR);
displayState(frameDisp, helpScreen, useGPU, findLargestObject, filterRects, fps); displayState(frameDisp, helpScreen, useGPU, findLargestObject, filterRects, fps);
imshow("result", frameDisp); imshow("result", frameDisp);

@ -86,11 +86,11 @@ int main(int argc, const char* argv[])
Mat templ = loadImage(templName); Mat templ = loadImage(templName);
Mat image = loadImage(imageName); Mat image = loadImage(imageName);
int method = GHT_POSITION; int method = cv::GeneralizedHough::GHT_POSITION;
if (estimateScale) if (estimateScale)
method += GHT_SCALE; method += cv::GeneralizedHough::GHT_SCALE;
if (estimateRotation) if (estimateRotation)
method += GHT_ROTATION; method += cv::GeneralizedHough::GHT_ROTATION;
vector<Vec4f> position; vector<Vec4f> position;
cv::TickMeter tm; cv::TickMeter tm;

@ -296,8 +296,8 @@ void App::run()
workBegin(); workBegin();
// Change format of the image // Change format of the image
if (make_gray) cvtColor(frame, img_aux, CV_BGR2GRAY); if (make_gray) cvtColor(frame, img_aux, COLOR_BGR2GRAY);
else if (use_gpu) cvtColor(frame, img_aux, CV_BGR2BGRA); else if (use_gpu) cvtColor(frame, img_aux, COLOR_BGR2BGRA);
else frame.copyTo(img_aux); else frame.copyTo(img_aux);
// Resize image // Resize image
@ -351,8 +351,8 @@ void App::run()
throw std::runtime_error("can't create video writer"); throw std::runtime_error("can't create video writer");
} }
if (make_gray) cvtColor(img_to_show, img, CV_GRAY2BGR); if (make_gray) cvtColor(img_to_show, img, COLOR_GRAY2BGR);
else cvtColor(img_to_show, img, CV_BGRA2BGR); else cvtColor(img_to_show, img, COLOR_BGRA2BGR);
video_writer << img; video_writer << img;
} }

@ -34,7 +34,7 @@ int main(int argc, const char* argv[])
Canny(src, mask, 100, 200, 3); Canny(src, mask, 100, 200, 3);
Mat dst_cpu; Mat dst_cpu;
cvtColor(mask, dst_cpu, CV_GRAY2BGR); cvtColor(mask, dst_cpu, COLOR_GRAY2BGR);
Mat dst_gpu = dst_cpu.clone(); Mat dst_gpu = dst_cpu.clone();
vector<Vec4i> lines_cpu; vector<Vec4i> lines_cpu;

@ -39,9 +39,9 @@ static void OpenClose(int, void*)
int an = n > 0 ? n : -n; int an = n > 0 ? n : -n;
Mat element = getStructuringElement(element_shape, Size(an*2+1, an*2+1), Point(an, an) ); Mat element = getStructuringElement(element_shape, Size(an*2+1, an*2+1), Point(an, an) );
if( n < 0 ) if( n < 0 )
cv::gpu::morphologyEx(src, dst, CV_MOP_OPEN, element); cv::gpu::morphologyEx(src, dst, MORPH_OPEN, element);
else else
cv::gpu::morphologyEx(src, dst, CV_MOP_CLOSE, element); cv::gpu::morphologyEx(src, dst, MORPH_CLOSE, element);
imshow("Open/Close",(Mat)dst); imshow("Open/Close",(Mat)dst);
} }
@ -84,7 +84,7 @@ int main( int argc, char** argv )
{ {
// gpu support only 4th channel images // gpu support only 4th channel images
GpuMat src4ch; GpuMat src4ch;
cv::gpu::cvtColor(src, src4ch, CV_BGR2BGRA); cv::gpu::cvtColor(src, src4ch, COLOR_BGR2BGRA);
src = src4ch; src = src4ch;
} }

@ -163,8 +163,8 @@ void App::run()
right_src = imread(p.right); right_src = imread(p.right);
if (left_src.empty()) throw runtime_error("can't open file \"" + p.left + "\""); if (left_src.empty()) throw runtime_error("can't open file \"" + p.left + "\"");
if (right_src.empty()) throw runtime_error("can't open file \"" + p.right + "\""); if (right_src.empty()) throw runtime_error("can't open file \"" + p.right + "\"");
cvtColor(left_src, left, CV_BGR2GRAY); cvtColor(left_src, left, COLOR_BGR2GRAY);
cvtColor(right_src, right, CV_BGR2GRAY); cvtColor(right_src, right, COLOR_BGR2GRAY);
d_left.upload(left); d_left.upload(left);
d_right.upload(right); d_right.upload(right);
@ -193,8 +193,8 @@ void App::run()
if (d_left.channels() > 1 || d_right.channels() > 1) if (d_left.channels() > 1 || d_right.channels() > 1)
{ {
cout << "BM doesn't support color images\n"; cout << "BM doesn't support color images\n";
cvtColor(left_src, left, CV_BGR2GRAY); cvtColor(left_src, left, COLOR_BGR2GRAY);
cvtColor(right_src, right, CV_BGR2GRAY); cvtColor(right_src, right, COLOR_BGR2GRAY);
cout << "image_channels: " << left.channels() << endl; cout << "image_channels: " << left.channels() << endl;
d_left.upload(left); d_left.upload(left);
d_right.upload(right); d_right.upload(right);
@ -262,8 +262,8 @@ void App::handleKey(char key)
} }
else else
{ {
cvtColor(left_src, left, CV_BGR2GRAY); cvtColor(left_src, left, COLOR_BGR2GRAY);
cvtColor(right_src, right, CV_BGR2GRAY); cvtColor(right_src, right, COLOR_BGR2GRAY);
} }
d_left.upload(left); d_left.upload(left);
d_right.upload(right); d_right.upload(right);

@ -197,7 +197,7 @@ void detectAndDraw( Mat& img,
cv::ocl::oclMat image(img); cv::ocl::oclMat image(img);
cv::ocl::oclMat gray, smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 ); cv::ocl::oclMat gray, smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 );
cv::ocl::cvtColor( image, gray, CV_BGR2GRAY ); cv::ocl::cvtColor( image, gray, COLOR_BGR2GRAY );
cv::ocl::resize( gray, smallImg, smallImg.size(), 0, 0, INTER_LINEAR ); cv::ocl::resize( gray, smallImg, smallImg.size(), 0, 0, INTER_LINEAR );
cv::ocl::equalizeHist( smallImg, smallImg ); cv::ocl::equalizeHist( smallImg, smallImg );

@ -296,8 +296,8 @@ void App::run()
workBegin(); workBegin();
// Change format of the image // Change format of the image
if (make_gray) cvtColor(frame, img_aux, CV_BGR2GRAY); if (make_gray) cvtColor(frame, img_aux, COLOR_BGR2GRAY);
else if (use_gpu) cvtColor(frame, img_aux, CV_BGR2BGRA); else if (use_gpu) cvtColor(frame, img_aux, COLOR_BGR2BGRA);
else frame.copyTo(img_aux); else frame.copyTo(img_aux);
// Resize image // Resize image
@ -351,8 +351,8 @@ void App::run()
throw std::runtime_error("can't create video writer"); throw std::runtime_error("can't create video writer");
} }
if (make_gray) cvtColor(img_to_show, img, CV_GRAY2BGR); if (make_gray) cvtColor(img_to_show, img, COLOR_GRAY2BGR);
else cvtColor(img_to_show, img, CV_BGRA2BGR); else cvtColor(img_to_show, img, COLOR_BGRA2BGR);
video_writer << img; video_writer << img;
} }

@ -88,7 +88,7 @@ static void findSquares( const Mat& image, vector<vector<Point> >& squares )
} }
// find contours and store them all as a list // find contours and store them all as a list
findContours(gray, contours, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE); findContours(gray, contours, RETR_LIST, CHAIN_APPROX_SIMPLE);
vector<Point> approx; vector<Point> approx;

@ -89,12 +89,12 @@ int main(int argc, char* argv[])
if(argc != 5) if(argc != 5)
{ {
cpu_img1 = imread("o.png"); cpu_img1 = imread("o.png");
cvtColor(cpu_img1, cpu_img1_grey, CV_BGR2GRAY); cvtColor(cpu_img1, cpu_img1_grey, COLOR_BGR2GRAY);
img1 = cpu_img1_grey; img1 = cpu_img1_grey;
CV_Assert(!img1.empty()); CV_Assert(!img1.empty());
cpu_img2 = imread("r2.png"); cpu_img2 = imread("r2.png");
cvtColor(cpu_img2, cpu_img2_grey, CV_BGR2GRAY); cvtColor(cpu_img2, cpu_img2_grey, COLOR_BGR2GRAY);
img2 = cpu_img2_grey; img2 = cpu_img2_grey;
} }
else else
@ -104,14 +104,14 @@ int main(int argc, char* argv[])
if (string(argv[i]) == "--left") if (string(argv[i]) == "--left")
{ {
cpu_img1 = imread(argv[++i]); cpu_img1 = imread(argv[++i]);
cvtColor(cpu_img1, cpu_img1_grey, CV_BGR2GRAY); cvtColor(cpu_img1, cpu_img1_grey, COLOR_BGR2GRAY);
img1 = cpu_img1_grey; img1 = cpu_img1_grey;
CV_Assert(!img1.empty()); CV_Assert(!img1.empty());
} }
else if (string(argv[i]) == "--right") else if (string(argv[i]) == "--right")
{ {
cpu_img2 = imread(argv[++i]); cpu_img2 = imread(argv[++i]);
cvtColor(cpu_img2, cpu_img2_grey, CV_BGR2GRAY); cvtColor(cpu_img2, cpu_img2_grey, COLOR_BGR2GRAY);
img2 = cpu_img2_grey; img2 = cpu_img2_grey;
} }
else if (string(argv[i]) == "--help") else if (string(argv[i]) == "--help")

Loading…
Cancel
Save