Minimize usages of legacy C API inside the library

pull/824/head
Andrey Kamaev 12 years ago
parent 4223a59497
commit 8f32902ce6
  1. 2
      cmake/OpenCVDetectAndroidSDK.cmake
  2. 3
      doc/tutorials/core/adding_images/adding_images.rst
  3. 3
      doc/tutorials/core/basic_linear_transform/basic_linear_transform.rst
  4. 48
      doc/tutorials/highgui/trackbar/trackbar.rst
  5. 26
      doc/tutorials/introduction/linux_eclipse/linux_eclipse.rst
  6. 9
      doc/tutorials/introduction/load_save_image/load_save_image.rst
  7. 3
      include/opencv2/opencv.hpp
  8. 9
      modules/core/doc/drawing_functions.rst
  9. 6
      modules/core/doc/intro.rst
  10. 1
      modules/gpu/app/nv_perf_test/main.cpp
  11. 6
      modules/gpu/perf/perf_core.cpp
  12. 4
      modules/gpu/perf/perf_imgproc.cpp
  13. 1
      modules/gpu/perf/perf_precomp.hpp
  14. 1
      modules/gpu/perf/perf_video.cpp
  15. 1
      modules/gpu/perf4au/main.cpp
  16. 1
      modules/gpu/test/test_precomp.hpp
  17. 15
      modules/imgproc/doc/feature_detection.rst
  18. 6
      modules/imgproc/doc/histograms.rst
  19. 1
      modules/imgproc/include/opencv2/imgproc/imgproc_c.h
  20. 8
      modules/legacy/include/opencv2/legacy/compat.hpp
  21. 5
      modules/legacy/src/corrimages.cpp
  22. 3
      modules/legacy/src/levmarprojbandle.cpp
  23. 4
      modules/legacy/src/trifocal.cpp
  24. 1
      modules/softcascade/src/octave.cpp
  25. 1
      modules/softcascade/src/precomp.hpp
  26. 18
      modules/softcascade/src/softcascade_init.cpp
  27. 3
      modules/ts/src/precomp.hpp
  28. 2
      modules/ts/src/ts.cpp
  29. 1
      modules/ts/src/ts_arrtest.cpp
  30. 50
      modules/ts/src/ts_func.cpp
  31. 2
      modules/video/src/optflowgf.cpp
  32. 2
      modules/video/src/precomp.hpp
  33. 8
      samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping.cpp
  34. 5
      samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping_video.cpp
  35. 3
      samples/cpp/bgfg_gmg.cpp
  36. 14
      samples/cpp/detector_descriptor_evaluation.cpp
  37. 10
      samples/cpp/em.cpp
  38. 6
      samples/cpp/fabmap_sample.cpp
  39. 5
      samples/cpp/freak_demo.cpp
  40. 4
      samples/cpp/hybridtrackingsample.cpp
  41. 4
      samples/cpp/logpolar_bsm.cpp
  42. 2
      samples/cpp/morphology2.cpp
  43. 3
      samples/cpp/retinaDemo.cpp
  44. 3
      samples/cpp/tutorial_code/contrib/retina_tutorial.cpp
  45. 109
      samples/gpu/performance/tests.cpp

@ -275,7 +275,7 @@ macro(add_android_project target path)
ocv_include_modules_recurse(${android_proj_NATIVE_DEPS})
ocv_include_directories("${path}/jni")
if (NATIVE_APP_GLUE)
if (NATIVE_APP_GLUE AND 0)
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
list(APPEND android_proj_jni_files ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
ocv_warnings_disable(CMAKE_C_FLAGS -Wstrict-prototypes -Wunused-parameter -Wmissing-prototypes)

@ -35,8 +35,7 @@ As usual, after the not-so-lengthy explanation, let's go to the code:
.. code-block:: cpp
#include <cv.h>
#include <highgui.h>
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;

@ -72,8 +72,7 @@ Code
.. code-block:: cpp
#include <cv.h>
#include <highgui.h>
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;

@ -28,9 +28,7 @@ Let's modify the program made in the tutorial :ref:`Adding_Images`. We will let
.. code-block:: cpp
#include <cv.h>
#include <highgui.h>
#include <opencv2/opencv.hpp>
using namespace cv;
/// Global Variables
@ -50,41 +48,41 @@ Let's modify the program made in the tutorial :ref:`Adding_Images`. We will let
*/
void on_trackbar( int, void* )
{
alpha = (double) alpha_slider/alpha_slider_max ;
beta = ( 1.0 - alpha );
alpha = (double) alpha_slider/alpha_slider_max ;
beta = ( 1.0 - alpha );
addWeighted( src1, alpha, src2, beta, 0.0, dst);
addWeighted( src1, alpha, src2, beta, 0.0, dst);
imshow( "Linear Blend", dst );
imshow( "Linear Blend", dst );
}
int main( int argc, char** argv )
{
/// Read image ( same size, same type )
src1 = imread("../../images/LinuxLogo.jpg");
src2 = imread("../../images/WindowsLogo.jpg");
/// Read image ( same size, same type )
src1 = imread("../../images/LinuxLogo.jpg");
src2 = imread("../../images/WindowsLogo.jpg");
if( !src1.data ) { printf("Error loading src1 \n"); return -1; }
if( !src2.data ) { printf("Error loading src2 \n"); return -1; }
if( !src1.data ) { printf("Error loading src1 \n"); return -1; }
if( !src2.data ) { printf("Error loading src2 \n"); return -1; }
/// Initialize values
alpha_slider = 0;
/// Initialize values
alpha_slider = 0;
/// Create Windows
namedWindow("Linear Blend", 1);
/// Create Windows
namedWindow("Linear Blend", 1);
/// Create Trackbars
char TrackbarName[50];
sprintf( TrackbarName, "Alpha x %d", alpha_slider_max );
/// Create Trackbars
char TrackbarName[50];
sprintf( TrackbarName, "Alpha x %d", alpha_slider_max );
createTrackbar( TrackbarName, "Linear Blend", &alpha_slider, alpha_slider_max, on_trackbar );
createTrackbar( TrackbarName, "Linear Blend", &alpha_slider, alpha_slider_max, on_trackbar );
/// Show some stuff
on_trackbar( alpha_slider, 0 );
/// Show some stuff
on_trackbar( alpha_slider, 0 );
/// Wait until user press some key
waitKey(0);
return 0;
/// Wait until user press some key
waitKey(0);
return 0;
}

@ -65,8 +65,7 @@ Making a project
.. code-block:: cpp
#include <cv.h>
#include <highgui.h>
#include <opencv2/opencv.hpp>
using namespace cv;
@ -81,7 +80,7 @@ Making a project
return -1;
}
namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
namedWindow( "Display Image", WINDOW_AUTOSIZE );
imshow( "Display Image", image );
waitKey(0);
@ -206,22 +205,15 @@ Say you have or create a new file, *helloworld.cpp* in a directory called *foo*:
.. code-block:: cpp
#include <cv.h>
#include <highgui.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main ( int argc, char **argv )
{
cvNamedWindow( "My Window", 1 );
IplImage *img = cvCreateImage( cvSize( 640, 480 ), IPL_DEPTH_8U, 1 );
CvFont font;
double hScale = 1.0;
double vScale = 1.0;
int lineWidth = 1;
cvInitFont( &font, CV_FONT_HERSHEY_SIMPLEX | CV_FONT_ITALIC,
hScale, vScale, 0, lineWidth );
cvPutText( img, "Hello World!", cvPoint( 200, 400 ), &font,
cvScalar( 255, 255, 0 ) );
cvShowImage( "My Window", img );
cvWaitKey();
Mat img(480, 640, CV_8U);
putText(img, "Hello World!", Point( 200, 400 ), FONT_HERSHEY_SIMPLEX | FONT_ITALIC, 1.0, Scalar( 255, 255, 0 ));
imshow("My Window", img);
waitKey();
return 0;
}

@ -26,8 +26,7 @@ Here it is:
.. code-block:: cpp
:linenos:
#include <cv.h>
#include <highgui.h>
#include <opencv2/opencv.hpp>
using namespace cv;
@ -45,12 +44,12 @@ Here it is:
}
Mat gray_image;
cvtColor( image, gray_image, CV_BGR2GRAY );
cvtColor( image, gray_image, COLOR_BGR2GRAY );
imwrite( "../../images/Gray_Image.jpg", gray_image );
namedWindow( imageName, CV_WINDOW_AUTOSIZE );
namedWindow( "Gray image", CV_WINDOW_AUTOSIZE );
namedWindow( imageName, WINDOW_AUTOSIZE );
namedWindow( "Gray image", WINDOW_AUTOSIZE );
imshow( imageName, image );
imshow( "Gray image", gray_image );

@ -44,15 +44,14 @@
#define __OPENCV_ALL_HPP__
#include "opencv2/core.hpp"
#include "opencv2/flann/miniflann.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/photo.hpp"
#include "opencv2/video.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/objdetect.hpp"
#include "opencv2/calib3d.hpp"
#include "opencv2/ml.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/contrib.hpp"
#include "opencv2/ml.hpp"
#endif

@ -507,10 +507,11 @@ The function draws contour outlines in the image if
:math:`\texttt{thickness} \ge 0` or fills the area bounded by the contours if
:math:`\texttt{thickness}<0` . The example below shows how to retrieve connected components from the binary image and label them: ::
#include "cv.h"
#include "highgui.h"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
@ -530,7 +531,7 @@ The function draws contour outlines in the image if
vector<Vec4i> hierarchy;
findContours( src, contours, hierarchy,
CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE );
RETR_CCOMP, CHAIN_APPROX_SIMPLE );
// iterate through all the top-level contours,
// draw each connected component with its own random color
@ -538,7 +539,7 @@ The function draws contour outlines in the image if
for( ; idx >= 0; idx = hierarchy[idx][0] )
{
Scalar color( rand()&255, rand()&255, rand()&255 );
drawContours( dst, contours, idx, color, CV_FILLED, 8, hierarchy );
drawContours( dst, contours, idx, color, FILLED, 8, hierarchy );
}
namedWindow( "Components", 1 );

@ -104,8 +104,8 @@ OpenCV deallocates the memory automatically, as well as automatically allocates
Example: ::
#include "cv.h"
#include "highgui.h"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
using namespace cv;
@ -119,7 +119,7 @@ Example: ::
for(;;)
{
cap >> frame;
cvtColor(frame, edges, CV_BGR2GRAY);
cvtColor(frame, edges, COLOR_BGR2GRAY);
GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
Canny(edges, edges, 0, 30, 3);
imshow("edges", edges);

@ -4,7 +4,6 @@
#include <opencv2/gpu.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/video.hpp>
#include <opencv2/legacy.hpp>
#include <opencv2/ts.hpp>
static void printOsInfo()

@ -1305,7 +1305,9 @@ PERF_TEST_P(Sz_3Depth, Core_AddWeighted,
// GEMM
CV_FLAGS(GemmFlags, 0, cv::GEMM_1_T, cv::GEMM_2_T, cv::GEMM_3_T)
#define ALL_GEMM_FLAGS Values(0, CV_GEMM_A_T, CV_GEMM_B_T, CV_GEMM_C_T, CV_GEMM_A_T | CV_GEMM_B_T, CV_GEMM_A_T | CV_GEMM_C_T, CV_GEMM_A_T | CV_GEMM_B_T | CV_GEMM_C_T)
#define ALL_GEMM_FLAGS Values(0, (int)cv::GEMM_1_T, (int)cv::GEMM_2_T, (int)cv::GEMM_3_T, \
(int)cv::GEMM_1_T | cv::GEMM_2_T, (int)cv::GEMM_1_T | cv::GEMM_3_T, \
(int)cv::GEMM_1_T | cv::GEMM_2_T | cv::GEMM_3_T)
DEF_PARAM_TEST(Sz_Type_Flags, cv::Size, MatType, GemmFlags);
@ -2071,7 +2073,7 @@ PERF_TEST_P(Sz_Depth, Core_CountNonZero,
//////////////////////////////////////////////////////////////////////
// Reduce
CV_ENUM(ReduceCode, CV_REDUCE_SUM, CV_REDUCE_AVG, CV_REDUCE_MAX, CV_REDUCE_MIN)
CV_ENUM(ReduceCode, cv::REDUCE_SUM, cv::REDUCE_AVG, cv::REDUCE_MAX, cv::REDUCE_MIN)
#define ALL_REDUCE_CODES ValuesIn(ReduceCode::all())
enum {Rows = 0, Cols = 1};

@ -1794,7 +1794,7 @@ PERF_TEST_P(Sz_Dp_MinDist, ImgProc_HoughCircles,
cv::gpu::GpuMat d_circles;
cv::gpu::HoughCirclesBuf d_buf;
TEST_CYCLE() cv::gpu::HoughCircles(d_src, d_circles, d_buf, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);
TEST_CYCLE() cv::gpu::HoughCircles(d_src, d_circles, d_buf, cv::HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);
cv::Mat gpu_circles(d_circles);
cv::Vec3f* begin = gpu_circles.ptr<cv::Vec3f>(0);
@ -1806,7 +1806,7 @@ PERF_TEST_P(Sz_Dp_MinDist, ImgProc_HoughCircles,
{
std::vector<cv::Vec3f> cpu_circles;
TEST_CYCLE() cv::HoughCircles(src, cpu_circles, CV_HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);
TEST_CYCLE() cv::HoughCircles(src, cpu_circles, cv::HOUGH_GRADIENT, dp, minDist, cannyThreshold, votesThreshold, minRadius, maxRadius);
SANITY_CHECK(cpu_circles);
}

@ -63,7 +63,6 @@
#include "opencv2/calib3d.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/video.hpp"
#include "opencv2/legacy.hpp"
#include "opencv2/photo.hpp"
#include "opencv2/core/gpu_private.hpp"

@ -41,6 +41,7 @@
//M*/
#include "perf_precomp.hpp"
#include "opencv2/legacy.hpp"
using namespace std;
using namespace testing;

@ -49,7 +49,6 @@
#include "opencv2/gpu.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/video.hpp"
#include "opencv2/legacy.hpp"
#include "opencv2/ts.hpp"
#include "opencv2/ts/gpu_perf.hpp"

@ -73,7 +73,6 @@
#include "opencv2/ts.hpp"
#include "opencv2/ts/gpu_test.hpp"
#include "opencv2/gpu.hpp"
#include "opencv2/legacy.hpp"
#include "interpolation.hpp"
#include "main_test_nvidia.h"

@ -306,8 +306,8 @@ The function finds circles in a grayscale image using a modification of the Houg
Example: ::
#include <cv.h>
#include <highgui.h>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <math.h>
using namespace cv;
@ -317,11 +317,11 @@ Example: ::
Mat img, gray;
if( argc != 2 && !(img=imread(argv[1], 1)).data)
return -1;
cvtColor(img, gray, CV_BGR2GRAY);
cvtColor(img, gray, COLOR_BGR2GRAY);
// smooth it, otherwise a lot of false circles may be detected
GaussianBlur( gray, gray, Size(9, 9), 2, 2 );
vector<Vec3f> circles;
HoughCircles(gray, circles, CV_HOUGH_GRADIENT,
HoughCircles(gray, circles, HOUGH_GRADIENT,
2, gray->rows/4, 200, 100 );
for( size_t i = 0; i < circles.size(); i++ )
{
@ -426,9 +426,8 @@ The function implements the probabilistic Hough transform algorithm for line det
/* This is a standalone program. Pass an image name as the first parameter
of the program. Switch between standard and probabilistic Hough transform
by changing "#if 1" to "#if 0" and back */
#include <cv.h>
#include <highgui.h>
#include <math.h>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
using namespace cv;
@ -439,7 +438,7 @@ The function implements the probabilistic Hough transform algorithm for line det
return -1;
Canny( src, dst, 50, 200, 3 );
cvtColor( dst, color_dst, CV_GRAY2BGR );
cvtColor( dst, color_dst, COLOR_GRAY2BGR );
#if 0
vector<Vec2f> lines;

@ -42,8 +42,8 @@ arrays. The elements of a tuple used to increment
a histogram bin are taken from the corresponding
input arrays at the same location. The sample below shows how to compute a 2D Hue-Saturation histogram for a color image. ::
#include <cv.h>
#include <highgui.h>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
using namespace cv;
@ -53,7 +53,7 @@ input arrays at the same location. The sample below shows how to compute a 2D Hu
if( argc != 2 || !(src=imread(argv[1], 1)).data )
return -1;
cvtColor(src, hsv, CV_BGR2HSV);
cvtColor(src, hsv, COLOR_BGR2HSV);
// Quantize the hue to 30 levels
// and the saturation to 32 levels

@ -43,7 +43,6 @@
#ifndef __OPENCV_IMGPROC_IMGPROC_C_H__
#define __OPENCV_IMGPROC_IMGPROC_C_H__
#include "opencv2/core/core_c.h"
#include "opencv2/imgproc/types_c.h"
#ifdef __cplusplus

@ -39,14 +39,6 @@
//
//M*/
/*
A few macros and definitions for backward compatibility
with the previous versions of OpenCV. They are obsolete and
are likely to be removed in future. To check whether your code
uses any of these, define CV_NO_BACKWARD_COMPATIBILITY before
including cv.h.
*/
#ifndef __OPENCV_COMPAT_HPP__
#define __OPENCV_COMPAT_HPP__

@ -40,11 +40,6 @@
//M*/
#include "precomp.hpp"
//#include "cvtypes.h"
//#include <float.h>
//#include <limits.h>
//#include "cv.h"
//#include "highgui.h"
#if 0
#include <stdio.h>

@ -41,11 +41,8 @@
#include "precomp.hpp"
//#include "cvtypes.h"
#include <float.h>
#include <limits.h>
//#include "cv.h"
#include <stdio.h>
void icvReconstructPoints4DStatus(CvMat** projPoints, CvMat **projMatrs, CvMat** presPoints, CvMat *points4D,int numImages,CvMat **projError=0);

@ -42,12 +42,8 @@
#include "precomp.hpp"
#include "opencv2/calib3d/calib3d_c.h"
//#include "cvtypes.h"
#include <float.h>
#include <limits.h>
//#include "cv.h"
//#include "windows.h"
#include <stdio.h>
/* Valery Mosyagin */

@ -41,6 +41,7 @@
//M*/
#include "precomp.hpp"
#include "opencv2/ml.hpp"
#include <queue>
using cv::InputArray;

@ -45,7 +45,6 @@
#include "opencv2/softcascade.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/ml.hpp"
#include "opencv2/core/private.hpp"
#include "opencv2/core/gpu_private.hpp"

@ -63,22 +63,4 @@ bool initModule_softcascade(void)
return (sc1->info() != 0) && (sc->info() != 0);
}
namespace internal {
void error(const char *error_string, const char *file, const int line, const char *func)
{
int code = CV_GpuApiCallError;
if (std::uncaught_exception())
{
const char* errorStr = cvErrorStr(code);
const char* function = func ? func : "unknown function";
std::cerr << "OpenCV Error: " << errorStr << "(" << error_string << ") in " << function << ", file " << file << ", line " << line;
std::cerr.flush();
}
else
cv::error( cv::Exception(code, error_string, func, file, line) );
}
}
} }

@ -1,8 +1,5 @@
#include "opencv2/ts.hpp"
#include "opencv2/core/core_c.h"
#include "opencv2/core/utility.hpp"
#include "opencv2/core/private.hpp"
#ifdef GTEST_LINKED_AS_SHARED_LIBRARY

@ -40,6 +40,8 @@
//M*/
#include "precomp.hpp"
#include "opencv2/core/core_c.h"
#include <ctype.h>
#include <stdarg.h>
#include <stdlib.h>

@ -40,6 +40,7 @@
//M*/
#include "precomp.hpp"
#include "opencv2/core/core_c.h"
namespace cvtest
{

@ -645,7 +645,7 @@ void erode(const Mat& _src, Mat& dst, const Mat& _kernel, Point anchor,
}
if( anchor == Point(-1,-1) )
anchor = Point(kernel.cols/2, kernel.rows/2);
if( borderType == IPL_BORDER_CONSTANT )
if( borderType == BORDER_CONSTANT )
borderValue = getMaxVal(src.depth());
copyMakeBorder(_src, src, anchor.y, kernel.rows - anchor.y - 1,
anchor.x, kernel.cols - anchor.x - 1,
@ -702,7 +702,7 @@ void dilate(const Mat& _src, Mat& dst, const Mat& _kernel, Point anchor,
}
if( anchor == Point(-1,-1) )
anchor = Point(kernel.cols/2, kernel.rows/2);
if( borderType == IPL_BORDER_CONSTANT )
if( borderType == BORDER_CONSTANT )
borderValue = getMinVal(src.depth());
copyMakeBorder(_src, src, anchor.y, kernel.rows - anchor.y - 1,
anchor.x, kernel.cols - anchor.x - 1,
@ -778,7 +778,7 @@ void filter2D(const Mat& _src, Mat& dst, int ddepth, const Mat& kernel,
CV_Assert( kernel.type() == CV_32F || kernel.type() == CV_64F );
if( anchor == Point(-1,-1) )
anchor = Point(kernel.cols/2, kernel.rows/2);
if( borderType == IPL_BORDER_CONSTANT )
if( borderType == BORDER_CONSTANT )
borderValue = getMinVal(src.depth());
copyMakeBorder(_src, src, anchor.y, kernel.rows - anchor.y - 1,
anchor.x, kernel.cols - anchor.x - 1,
@ -830,11 +830,11 @@ static int borderInterpolate( int p, int len, int borderType )
{
if( (unsigned)p < (unsigned)len )
;
else if( borderType == IPL_BORDER_REPLICATE )
else if( borderType == BORDER_REPLICATE )
p = p < 0 ? 0 : len - 1;
else if( borderType == IPL_BORDER_REFLECT || borderType == IPL_BORDER_REFLECT_101 )
else if( borderType == BORDER_REFLECT || borderType == BORDER_REFLECT_101 )
{
int delta = borderType == IPL_BORDER_REFLECT_101;
int delta = borderType == BORDER_REFLECT_101;
if( len == 1 )
return 0;
do
@ -846,17 +846,17 @@ static int borderInterpolate( int p, int len, int borderType )
}
while( (unsigned)p >= (unsigned)len );
}
else if( borderType == IPL_BORDER_WRAP )
else if( borderType == BORDER_WRAP )
{
if( p < 0 )
p -= ((p-len+1)/len)*len;
if( p >= len )
p %= len;
}
else if( borderType == IPL_BORDER_CONSTANT )
else if( borderType == BORDER_CONSTANT )
p = -1;
else
CV_Error( CV_StsBadArg, "Unknown/unsupported border type" );
CV_Error( Error::StsBadArg, "Unknown/unsupported border type" );
return p;
}
@ -868,7 +868,7 @@ void copyMakeBorder(const Mat& src, Mat& dst, int top, int bottom, int left, int
int i, j, k, esz = (int)src.elemSize();
int width = src.cols*esz, width1 = dst.cols*esz;
if( borderType == IPL_BORDER_CONSTANT )
if( borderType == BORDER_CONSTANT )
{
vector<uchar> valvec((src.cols + left + right)*esz);
uchar* val = &valvec[0];
@ -1304,7 +1304,7 @@ double norm(const Mat& src, int normType, const Mat& mask)
result = norm_((const double*)sptr, total, cn, normType, result, mptr);
break;
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(Error::StsUnsupportedFormat, "");
};
}
if( normType0 == NORM_L2 )
@ -1382,7 +1382,7 @@ double norm(const Mat& src1, const Mat& src2, int normType, const Mat& mask)
result = norm_((const double*)sptr1, (const double*)sptr2, total, cn, normType, result, mptr);
break;
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(Error::StsUnsupportedFormat, "");
};
}
if( normType0 == NORM_L2 )
@ -1441,7 +1441,7 @@ double crossCorr(const Mat& src1, const Mat& src2)
result += crossCorr_((const double*)sptr1, (const double*)sptr2, total);
break;
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(Error::StsUnsupportedFormat, "");
};
}
return result;
@ -1574,7 +1574,7 @@ compare_(const _Tp* src1, const _Tp* src2, uchar* dst, size_t total, int cmpop)
dst[i] = src1[i] > src2[i] ? 255 : 0;
break;
default:
CV_Error(CV_StsBadArg, "Unknown comparison operation");
CV_Error(Error::StsBadArg, "Unknown comparison operation");
}
}
@ -1610,7 +1610,7 @@ compareS_(const _Tp* src1, _WTp value, uchar* dst, size_t total, int cmpop)
dst[i] = src1[i] > value ? 255 : 0;
break;
default:
CV_Error(CV_StsBadArg, "Unknown comparison operation");
CV_Error(Error::StsBadArg, "Unknown comparison operation");
}
}
@ -1657,7 +1657,7 @@ void compare(const Mat& src1, const Mat& src2, Mat& dst, int cmpop)
compare_((const double*)sptr1, (const double*)sptr2, dptr, total, cmpop);
break;
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(Error::StsUnsupportedFormat, "");
}
}
}
@ -1704,7 +1704,7 @@ void compare(const Mat& src, double value, Mat& dst, int cmpop)
compareS_((const double*)sptr, value, dptr, total, cmpop);
break;
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(Error::StsUnsupportedFormat, "");
}
}
}
@ -1836,7 +1836,7 @@ bool cmpUlps(const Mat& src1, const Mat& src2, int imaxDiff, double* _realmaxdif
realmaxdiff = cmpUlpsFlt_((const int64*)sptr1, (const int64*)sptr2, total, imaxDiff, startidx, idx);
break;
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(Error::StsUnsupportedFormat, "");
}
if(_realmaxdiff)
@ -1925,7 +1925,7 @@ int check( const Mat& a, double fmin, double fmax, vector<int>* _idx )
checkFlt_((const double*)aptr, total, fmin, fmax, startidx, idx);
break;
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(Error::StsUnsupportedFormat, "");
}
if( idx != 0 )
@ -2344,7 +2344,7 @@ void transform( const Mat& src, Mat& dst, const Mat& transmat, const Mat& _shift
transform_((const double*)sptr, (double*)dptr, total, scn, dcn, mat);
break;
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(Error::StsUnsupportedFormat, "");
}
}
}
@ -2401,7 +2401,7 @@ static void minmax(const Mat& src1, const Mat& src2, Mat& dst, char op)
minmax_((const double*)sptr1, (const double*)sptr2, (double*)dptr, total, op);
break;
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(Error::StsUnsupportedFormat, "");
}
}
}
@ -2469,7 +2469,7 @@ static void minmax(const Mat& src1, double val, Mat& dst, char op)
minmax_((const double*)sptr1, saturate_cast<double>(val), (double*)dptr, total, op);
break;
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(Error::StsUnsupportedFormat, "");
}
}
}
@ -2541,7 +2541,7 @@ static void muldiv(const Mat& src1, const Mat& src2, Mat& dst, double scale, cha
muldiv_((const double*)sptr1, (const double*)sptr2, (double*)dptr, total, scale, op);
break;
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(Error::StsUnsupportedFormat, "");
}
}
}
@ -2626,7 +2626,7 @@ Scalar mean(const Mat& src, const Mat& mask)
mean_((const double*)sptr, mptr, total, cn, sum, nz);
break;
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(Error::StsUnsupportedFormat, "");
}
}
@ -2863,7 +2863,7 @@ static void writeElems(std::ostream& out, const void* data, int nelems, int dept
out.precision(pp);
}
else
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(Error::StsUnsupportedFormat, "");
}

@ -56,7 +56,7 @@ FarnebackPolyExp( const Mat& src, Mat& dst, int n, double sigma )
{
int k, x, y;
assert( src.type() == CV_32FC1 );
CV_Assert( src.type() == CV_32FC1 );
int width = src.cols;
int height = src.rows;
AutoBuffer<float> kbuf(n*6 + 3), _row((width + n*2)*3);

@ -44,8 +44,6 @@
#define __OPENCV_PRECOMP_H__
#include "opencv2/video.hpp"
#include "opencv2/video/tracking_c.h"
#include "opencv2/core/utility.hpp"
#include "opencv2/core/private.hpp"

@ -10,7 +10,8 @@
#include <iostream>
#include <cstring>
#include "opencv2/opencv.hpp"
#include "opencv2/contrib.hpp"
#include "opencv2/highgui.hpp"
static void help(std::string errorMessage)
{
@ -28,7 +29,7 @@ static void drawPlot(const cv::Mat curve, const std::string figureTitle, const i
cv::Mat displayedCurveImage = cv::Mat::ones(200, curve.size().height, CV_8U);
cv::Mat windowNormalizedCurve;
normalize(curve, windowNormalizedCurve, 0, 200, CV_MINMAX, CV_32F);
normalize(curve, windowNormalizedCurve, 0, 200, cv::NORM_MINMAX, CV_32F);
displayedCurveImage = cv::Scalar::all(255); // set a white background
int binW = cvRound((double)displayedCurveImage.cols/curve.size().height);
@ -80,8 +81,7 @@ static void drawPlot(const cv::Mat curve, const std::string figureTitle, const i
normalize(hist, normalizedHist, 1, 0, cv::NORM_L1, CV_32F); // normalize histogram so that its sum equals 1
double min_val, max_val;
CvMat histArr(normalizedHist);
cvMinMaxLoc(&histArr, &min_val, &max_val);
minMaxLoc(normalizedHist, &min_val, &max_val);
//std::cout<<"Hist max,min = "<<max_val<<", "<<min_val<<std::endl;
// compute density probability

@ -14,7 +14,8 @@
#include <stdio.h>
#include <cstring>
#include "opencv2/opencv.hpp"
#include "opencv2/contrib.hpp"
#include "opencv2/highgui.hpp"
static void help(std::string errorMessage)
{
@ -38,7 +39,7 @@ static void drawPlot(const cv::Mat curve, const std::string figureTitle, const i
cv::Mat displayedCurveImage = cv::Mat::ones(200, curve.size().height, CV_8U);
cv::Mat windowNormalizedCurve;
normalize(curve, windowNormalizedCurve, 0, 200, CV_MINMAX, CV_32F);
normalize(curve, windowNormalizedCurve, 0, 200, cv::NORM_MINMAX, CV_32F);
displayedCurveImage = cv::Scalar::all(255); // set a white background
int binW = cvRound((double)displayedCurveImage.cols/curve.size().height);

@ -5,7 +5,8 @@
* Author: Andrew B. Godbehere
*/
#include <opencv2/opencv.hpp>
#include "opencv2/video.hpp"
#include "opencv2/highgui.hpp"
#include <opencv2/core/utility.hpp>
#include <iostream>

@ -39,10 +39,10 @@
//
//M*/
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/legacy/legacy.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/legacy.hpp"
#include <limits>
#include <cstdio>
@ -93,7 +93,7 @@ static void calcKeyPointProjections( const vector<KeyPoint>& src, const Mat_<dou
{
if( !src.empty() )
{
assert( !H.empty() && H.cols == 3 && H.rows == 3);
CV_Assert( !H.empty() && H.cols == 3 && H.rows == 3);
dst.resize(src.size());
vector<KeyPoint>::const_iterator srcIt = src.begin();
vector<KeyPoint>::iterator dstIt = dst.begin();
@ -109,7 +109,7 @@ static void calcKeyPointProjections( const vector<KeyPoint>& src, const Mat_<dou
Mat_<double> Aff; linearizeHomographyAt(H, srcIt->pt, Aff);
Mat_<double> dstM; invert(Aff*invM*Aff.t(), dstM);
Mat_<double> eval; eigen( dstM, eval );
assert( eval(0,0) && eval(1,0) );
CV_Assert( eval(0,0) && eval(1,0) );
float dstSize = (float)pow(1./(eval(0,0)*eval(1,0)), 0.25);
// TODO: check angle projection
@ -526,7 +526,7 @@ inline void writeKeypoints( FileStorage& fs, const vector<KeyPoint>& keypoints,
inline void readKeypoints( FileStorage& fs, vector<KeyPoint>& keypoints, int imgIdx )
{
assert( fs.isOpened() );
CV_Assert( fs.isOpened() );
stringstream imgName; imgName << "img" << imgIdx;
read( fs[imgName.str()], keypoints);
}

@ -1,5 +1,5 @@
#include "opencv2/legacy/legacy.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/legacy.hpp"
using namespace cv;
@ -45,7 +45,7 @@ int main( int /*argc*/, char** /*argv*/ )
params.start_step = CvEM::START_AUTO_STEP;
params.term_crit.max_iter = 300;
params.term_crit.epsilon = 0.1;
params.term_crit.type = CV_TERMCRIT_ITER|CV_TERMCRIT_EPS;
params.term_crit.type = TermCriteria::COUNT|TermCriteria::EPS;
// cluster the data
em_model.train( samples, Mat(), params, &labels );
@ -76,7 +76,7 @@ int main( int /*argc*/, char** /*argv*/ )
int response = cvRound(em_model.predict( sample ));
Scalar c = colors[response];
circle( img, Point(j, i), 1, c*0.75, CV_FILLED );
circle( img, Point(j, i), 1, c*0.75, FILLED );
}
}
@ -84,7 +84,7 @@ int main( int /*argc*/, char** /*argv*/ )
for( i = 0; i < nsamples; i++ )
{
Point pt(cvRound(samples.at<float>(i, 0)), cvRound(samples.at<float>(i, 1)));
circle( img, pt, 1, colors[labels.at<int>(i)], CV_FILLED );
circle( img, pt, 1, colors[labels.at<int>(i)], FILLED );
}
imshow( "EM-clustering result", img );

@ -49,9 +49,11 @@
//
//M*/
#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/contrib.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/nonfree.hpp"
using namespace cv;
using namespace std;

@ -43,7 +43,6 @@
#include <opencv2/highgui.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/nonfree.hpp>
#include <opencv2/legacy.hpp>
using namespace cv;
@ -95,9 +94,9 @@ int main( int argc, char** argv ) {
// MATCHER
// The standard Hamming distance can be used such as
// BruteForceMatcher<Hamming> matcher;
// BFMatcher matcher(NORM_HAMMING);
// or the proposed cascade of hamming distance using SSSE3
BruteForceMatcher<Hamming> matcher;
BFMatcher matcher(NORM_HAMMING);
// detect
double t = (double)getTickCount();

@ -11,10 +11,6 @@
*
*/
//#include <cv.h>
//#include <ml.h>
//#include <cvaux.h>
//#include <highgui.h>
#include <stdio.h>
#include <time.h>
#include <iostream>

@ -6,7 +6,9 @@
* PSPC-lab - University of Genoa
*/
#include "opencv2/opencv.hpp"
#include "opencv2/contrib.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
#include <cmath>

@ -1,5 +1,3 @@
#define CV_NO_BACKWARD_COMPATIBILITY
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdlib.h>

@ -9,7 +9,8 @@
#include <iostream>
#include <cstring>
#include "opencv2/opencv.hpp"
#include "opencv2/contrib.hpp"
#include "opencv2/highgui.hpp"
static void help(std::string errorMessage)
{

@ -9,7 +9,8 @@
#include <iostream>
#include <cstring>
#include "opencv2/opencv.hpp"
#include "opencv2/contrib.hpp"
#include "opencv2/highgui.hpp"
static void help(std::string errorMessage)
{

@ -1,10 +1,11 @@
#include <stdexcept>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/video/video.hpp"
#include "opencv2/gpu/gpu.hpp"
#include "opencv2/legacy/legacy.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/calib3d.hpp"
#include "opencv2/video.hpp"
#include "opencv2/gpu.hpp"
#include "opencv2/legacy.hpp"
#include "performance.h"
#include "opencv2/opencv_modules.hpp"
@ -21,7 +22,7 @@ static void InitMatchTemplate()
Mat src; gen(src, 500, 500, CV_32F, 0, 1);
Mat templ; gen(templ, 500, 500, CV_32F, 0, 1);
gpu::GpuMat d_src(src), d_templ(templ), d_dst;
gpu::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR);
gpu::matchTemplate(d_src, d_templ, d_dst, TM_CCORR);
}
@ -39,17 +40,17 @@ TEST(matchTemplate)
SUBTEST << src.cols << 'x' << src.rows << ", 32FC1" << ", templ " << templ_size << 'x' << templ_size << ", CCORR";
gen(templ, templ_size, templ_size, CV_32F, 0, 1);
matchTemplate(src, templ, dst, CV_TM_CCORR);
matchTemplate(src, templ, dst, TM_CCORR);
CPU_ON;
matchTemplate(src, templ, dst, CV_TM_CCORR);
matchTemplate(src, templ, dst, TM_CCORR);
CPU_OFF;
d_templ.upload(templ);
gpu::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR);
gpu::matchTemplate(d_src, d_templ, d_dst, TM_CCORR);
GPU_ON;
gpu::matchTemplate(d_src, d_templ, d_dst, CV_TM_CCORR);
gpu::matchTemplate(d_src, d_templ, d_dst, TM_CCORR);
GPU_OFF;
}
}
@ -604,120 +605,120 @@ TEST(cvtColor)
gen(src, 4000, 4000, CV_8UC1, 0, 255);
d_src.upload(src);
SUBTEST << "4000x4000, 8UC1, CV_GRAY2BGRA";
SUBTEST << "4000x4000, 8UC1, COLOR_GRAY2BGRA";
cvtColor(src, dst, CV_GRAY2BGRA, 4);
cvtColor(src, dst, COLOR_GRAY2BGRA, 4);
CPU_ON;
cvtColor(src, dst, CV_GRAY2BGRA, 4);
cvtColor(src, dst, COLOR_GRAY2BGRA, 4);
CPU_OFF;
gpu::cvtColor(d_src, d_dst, CV_GRAY2BGRA, 4);
gpu::cvtColor(d_src, d_dst, COLOR_GRAY2BGRA, 4);
GPU_ON;
gpu::cvtColor(d_src, d_dst, CV_GRAY2BGRA, 4);
gpu::cvtColor(d_src, d_dst, COLOR_GRAY2BGRA, 4);
GPU_OFF;
cv::swap(src, dst);
d_src.swap(d_dst);
SUBTEST << "4000x4000, 8UC3 vs 8UC4, CV_BGR2YCrCb";
SUBTEST << "4000x4000, 8UC3 vs 8UC4, COLOR_BGR2YCrCb";
cvtColor(src, dst, CV_BGR2YCrCb);
cvtColor(src, dst, COLOR_BGR2YCrCb);
CPU_ON;
cvtColor(src, dst, CV_BGR2YCrCb);
cvtColor(src, dst, COLOR_BGR2YCrCb);
CPU_OFF;
gpu::cvtColor(d_src, d_dst, CV_BGR2YCrCb, 4);
gpu::cvtColor(d_src, d_dst, COLOR_BGR2YCrCb, 4);
GPU_ON;
gpu::cvtColor(d_src, d_dst, CV_BGR2YCrCb, 4);
gpu::cvtColor(d_src, d_dst, COLOR_BGR2YCrCb, 4);
GPU_OFF;
cv::swap(src, dst);
d_src.swap(d_dst);
SUBTEST << "4000x4000, 8UC4, CV_YCrCb2BGR";
SUBTEST << "4000x4000, 8UC4, COLOR_YCrCb2BGR";
cvtColor(src, dst, CV_YCrCb2BGR, 4);
cvtColor(src, dst, COLOR_YCrCb2BGR, 4);
CPU_ON;
cvtColor(src, dst, CV_YCrCb2BGR, 4);
cvtColor(src, dst, COLOR_YCrCb2BGR, 4);
CPU_OFF;
gpu::cvtColor(d_src, d_dst, CV_YCrCb2BGR, 4);
gpu::cvtColor(d_src, d_dst, COLOR_YCrCb2BGR, 4);
GPU_ON;
gpu::cvtColor(d_src, d_dst, CV_YCrCb2BGR, 4);
gpu::cvtColor(d_src, d_dst, COLOR_YCrCb2BGR, 4);
GPU_OFF;
cv::swap(src, dst);
d_src.swap(d_dst);
SUBTEST << "4000x4000, 8UC3 vs 8UC4, CV_BGR2XYZ";
SUBTEST << "4000x4000, 8UC3 vs 8UC4, COLOR_BGR2XYZ";
cvtColor(src, dst, CV_BGR2XYZ);
cvtColor(src, dst, COLOR_BGR2XYZ);
CPU_ON;
cvtColor(src, dst, CV_BGR2XYZ);
cvtColor(src, dst, COLOR_BGR2XYZ);
CPU_OFF;
gpu::cvtColor(d_src, d_dst, CV_BGR2XYZ, 4);
gpu::cvtColor(d_src, d_dst, COLOR_BGR2XYZ, 4);
GPU_ON;
gpu::cvtColor(d_src, d_dst, CV_BGR2XYZ, 4);
gpu::cvtColor(d_src, d_dst, COLOR_BGR2XYZ, 4);
GPU_OFF;
cv::swap(src, dst);
d_src.swap(d_dst);
SUBTEST << "4000x4000, 8UC4, CV_XYZ2BGR";
SUBTEST << "4000x4000, 8UC4, COLOR_XYZ2BGR";
cvtColor(src, dst, CV_XYZ2BGR, 4);
cvtColor(src, dst, COLOR_XYZ2BGR, 4);
CPU_ON;
cvtColor(src, dst, CV_XYZ2BGR, 4);
cvtColor(src, dst, COLOR_XYZ2BGR, 4);
CPU_OFF;
gpu::cvtColor(d_src, d_dst, CV_XYZ2BGR, 4);
gpu::cvtColor(d_src, d_dst, COLOR_XYZ2BGR, 4);
GPU_ON;
gpu::cvtColor(d_src, d_dst, CV_XYZ2BGR, 4);
gpu::cvtColor(d_src, d_dst, COLOR_XYZ2BGR, 4);
GPU_OFF;
cv::swap(src, dst);
d_src.swap(d_dst);
SUBTEST << "4000x4000, 8UC3 vs 8UC4, CV_BGR2HSV";
SUBTEST << "4000x4000, 8UC3 vs 8UC4, COLOR_BGR2HSV";
cvtColor(src, dst, CV_BGR2HSV);
cvtColor(src, dst, COLOR_BGR2HSV);
CPU_ON;
cvtColor(src, dst, CV_BGR2HSV);
cvtColor(src, dst, COLOR_BGR2HSV);
CPU_OFF;
gpu::cvtColor(d_src, d_dst, CV_BGR2HSV, 4);
gpu::cvtColor(d_src, d_dst, COLOR_BGR2HSV, 4);
GPU_ON;
gpu::cvtColor(d_src, d_dst, CV_BGR2HSV, 4);
gpu::cvtColor(d_src, d_dst, COLOR_BGR2HSV, 4);
GPU_OFF;
cv::swap(src, dst);
d_src.swap(d_dst);
SUBTEST << "4000x4000, 8UC4, CV_HSV2BGR";
SUBTEST << "4000x4000, 8UC4, COLOR_HSV2BGR";
cvtColor(src, dst, CV_HSV2BGR, 4);
cvtColor(src, dst, COLOR_HSV2BGR, 4);
CPU_ON;
cvtColor(src, dst, CV_HSV2BGR, 4);
cvtColor(src, dst, COLOR_HSV2BGR, 4);
CPU_OFF;
gpu::cvtColor(d_src, d_dst, CV_HSV2BGR, 4);
gpu::cvtColor(d_src, d_dst, COLOR_HSV2BGR, 4);
GPU_ON;
gpu::cvtColor(d_src, d_dst, CV_HSV2BGR, 4);
gpu::cvtColor(d_src, d_dst, COLOR_HSV2BGR, 4);
GPU_OFF;
cv::swap(src, dst);
@ -1093,30 +1094,30 @@ TEST(reduce)
SUBTEST << size << 'x' << size << ", dim = 0";
reduce(src, dst0, 0, CV_REDUCE_MIN);
reduce(src, dst0, 0, REDUCE_MIN);
CPU_ON;
reduce(src, dst0, 0, CV_REDUCE_MIN);
reduce(src, dst0, 0, REDUCE_MIN);
CPU_OFF;
gpu::reduce(d_src, d_dst0, 0, CV_REDUCE_MIN);
gpu::reduce(d_src, d_dst0, 0, REDUCE_MIN);
GPU_ON;
gpu::reduce(d_src, d_dst0, 0, CV_REDUCE_MIN);
gpu::reduce(d_src, d_dst0, 0, REDUCE_MIN);
GPU_OFF;
SUBTEST << size << 'x' << size << ", dim = 1";
reduce(src, dst1, 1, CV_REDUCE_MIN);
reduce(src, dst1, 1, REDUCE_MIN);
CPU_ON;
reduce(src, dst1, 1, CV_REDUCE_MIN);
reduce(src, dst1, 1, REDUCE_MIN);
CPU_OFF;
gpu::reduce(d_src, d_dst1, 1, CV_REDUCE_MIN);
gpu::reduce(d_src, d_dst1, 1, REDUCE_MIN);
GPU_ON;
gpu::reduce(d_src, d_dst1, 1, CV_REDUCE_MIN);
gpu::reduce(d_src, d_dst1, 1, REDUCE_MIN);
GPU_OFF;
}
}

Loading…
Cancel
Save