Commit 199a35a1 authored by Andrey Kamaev's avatar Andrey Kamaev

Move C API of opencv_video to separate file

parent e27f4da9
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "HOGfeatures.h"
#include "cascadeclassifier.h"
......
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "haarfeatures.h"
#include "cascadeclassifier.h"
......
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "lbpfeatures.h"
#include "cascadeclassifier.h"
......
......@@ -63,8 +63,8 @@
#include "opencv2/core/core_c.h"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/photo/photo_c.h"
#include "opencv2/video/tracking_c.h"
#include "opencv2/video.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/flann.hpp"
#include "opencv2/calib3d.hpp"
......
......@@ -51,6 +51,7 @@
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/photo.hpp"
#include "opencv2/video.hpp"
#include "opencv2/highgui.hpp"
#endif
......@@ -49,8 +49,8 @@
#include "opencv2/core/core_c.h"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/photo/photo_c.h"
#include "opencv2/video/tracking_c.h"
#include "opencv2/video.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/calib3d.hpp"
#include "opencv2/objdetect.hpp"
......
......@@ -60,7 +60,7 @@ void CvMeanShiftTracker::newTrackingWindow(Mat image, Rect selection)
float srange[] = { 0, 1 };
const float* ranges[] = {hrange, srange};
cvtColor(image, hsv, CV_BGR2HSV);
cvtColor(image, hsv, COLOR_BGR2HSV);
inRange(hsv, Scalar(0, 30, MIN(10, 256)), Scalar(180, 256, MAX(10, 256)), mask);
hue.create(hsv.size(), CV_8UC2);
......@@ -83,7 +83,7 @@ RotatedRect CvMeanShiftTracker::updateTrackingWindow(Mat image)
float srange[] = { 0, 1 };
const float* ranges[] = {hrange, srange};
cvtColor(image, hsv, CV_BGR2HSV);
cvtColor(image, hsv, COLOR_BGR2HSV);
inRange(hsv, Scalar(0, 30, MIN(10, 256)), Scalar(180, 256, MAX(10, 256)), mask);
hue.create(hsv.size(), CV_8UC2);
mixChannels(&hsv, 1, &hue, 1, channels, 2);
......
......@@ -80,7 +80,7 @@ CvFeatureTracker::~CvFeatureTracker()
void CvFeatureTracker::newTrackingWindow(Mat image, Rect selection)
{
image.copyTo(prev_image);
cvtColor(prev_image, prev_image_bw, CV_BGR2GRAY);
cvtColor(prev_image, prev_image_bw, COLOR_BGR2GRAY);
prev_trackwindow = selection;
prev_center.x = selection.x;
prev_center.y = selection.y;
......@@ -148,12 +148,12 @@ Rect CvFeatureTracker::updateTrackingWindowWithFlow(Mat image)
ittr++;
Size subPixWinSize(10,10), winSize(31,31);
Mat image_bw;
TermCriteria termcrit(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 20, 0.03);
TermCriteria termcrit(TermCriteria::COUNT | TermCriteria::EPS, 20, 0.03);
std::vector<uchar> status;
std::vector<float> err;
cvtColor(image, image_bw, CV_BGR2GRAY);
cvtColor(prev_image, prev_image_bw, CV_BGR2GRAY);
cvtColor(image, image_bw, COLOR_BGR2GRAY);
cvtColor(prev_image, prev_image_bw, COLOR_BGR2GRAY);
if (ittr == 1)
{
......
......@@ -39,6 +39,7 @@
//M*/
#include "precomp.hpp"
#include "opencv2/video/tracking_c.h"
/*======================= KALMAN FILTER =========================*/
/* State vector is (x,y,w,h,dx,dy,dw,dh). */
......
......@@ -39,6 +39,7 @@
//
//M*/
#include "precomp.hpp"
#include "opencv2/video/tracking_c.h"
CvCamShiftTracker::CvCamShiftTracker()
{
......
......@@ -42,6 +42,7 @@
#include "test_precomp.hpp"
#include "opencv2/video/tracking.hpp"
#include "opencv2/video/tracking_c.h"
#include <string>
#include <iostream>
......
......@@ -25,6 +25,7 @@
#include "opencv2/highgui/highgui_c.h"
#include "opencv2/photo/photo_c.h"
#include "opencv2/video/tracking_c.h"
#include "opencv2/opencv_modules.hpp"
......
......@@ -7,11 +7,12 @@
// copy or use the software.
//
//
// License Agreement
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
......@@ -46,13 +47,9 @@
#include "opencv2/video/tracking.hpp"
#include "opencv2/video/background_segm.hpp"
#ifdef __cplusplus
namespace cv
{
CV_EXPORTS bool initModule_video(void);
}
#endif
#endif //__OPENCV_VIDEO_HPP__
......@@ -7,7 +7,7 @@
// copy or use the software.
//
//
// License Agreement
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
......@@ -45,7 +45,7 @@
#define __OPENCV_BACKGROUND_SEGM_HPP__
#include "opencv2/core.hpp"
#include <list>
namespace cv
{
......@@ -66,6 +66,7 @@ public:
};
/*!
Gaussian Mixture-based Backbround/Foreground Segmentation Algorithm
......@@ -97,6 +98,7 @@ CV_EXPORTS_W Ptr<BackgroundSubtractorMOG>
double backgroundRatio=0.7, double noiseSigma=0);
/*!
The class implements the following algorithm:
"Improved adaptive Gausian mixture model for background subtraction"
......@@ -193,6 +195,6 @@ public:
CV_EXPORTS_W Ptr<BackgroundSubtractorGMG> createBackgroundSubtractorGMG(int initializationFrames=120,
double decisionThreshold=0.8);
}
} // cv
#endif
This diff is collapsed.
......@@ -35,7 +35,7 @@ PERF_TEST_P(TransformationType, findTransformECC, /*testing::ValuesIn(MotionType
0.f, 1.f, 11.839f);
warpAffine(img, templateImage, warpGround,
Size(200,200), CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP);
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
break;
case MOTION_EUCLIDEAN:
angle = CV_PI/30;
......@@ -43,20 +43,20 @@ PERF_TEST_P(TransformationType, findTransformECC, /*testing::ValuesIn(MotionType
warpGround = (Mat_<float>(2,3) << (float)cos(angle), (float)-sin(angle), 12.123f,
(float)sin(angle), (float)cos(angle), 14.789f);
warpAffine(img, templateImage, warpGround,
Size(200,200), CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP);
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
break;
case MOTION_AFFINE:
warpGround = (Mat_<float>(2,3) << 0.98f, 0.03f, 15.523f,
-0.02f, 0.95f, 10.456f);
warpAffine(img, templateImage, warpGround,
Size(200,200), CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP);
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
break;
case MOTION_HOMOGRAPHY:
warpGround = (Mat_<float>(3,3) << 0.98f, 0.03f, 15.523f,
-0.02f, 0.95f, 10.456f,
0.0002f, 0.0003f, 1.f);
warpPerspective(img, templateImage, warpGround,
Size(200,200), CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP);
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
break;
}
......
......@@ -50,7 +50,7 @@ PERF_TEST_P(Path_Idx_Cn_NPoints_WSize, OpticalFlowPyrLK_full, testing::Combine(
int winSize = get<4>(GetParam());
int maxLevel = 2;
TermCriteria criteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS, 7, 0.001);
TermCriteria criteria(TermCriteria::COUNT|TermCriteria::EPS, 7, 0.001);
int flags = 0;
double minEigThreshold = 1e-4;
......@@ -124,7 +124,7 @@ PERF_TEST_P(Path_Idx_Cn_NPoints_WSize_Deriv, OpticalFlowPyrLK_self, testing::Com
bool withDerivatives = get<5>(GetParam());
int maxLevel = 2;
TermCriteria criteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS, 7, 0.001);
TermCriteria criteria(TermCriteria::COUNT|TermCriteria::EPS, 7, 0.001);
int flags = 0;
double minEigThreshold = 1e-4;
......
......@@ -42,6 +42,7 @@
#include "precomp.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/video/tracking_c.h"
// to be moved to legacy
......@@ -541,7 +542,7 @@ cvCalcAffineFlowPyrLK( const void* arrA, const void* arrB,
if( !matrices )
CV_Error( CV_StsNullPtr, "" );
imgSize = cvGetMatSize( imgA );
imgSize = cv::Size(imgA->cols, imgA->rows);
if( pyrA )
{
......
......@@ -124,7 +124,7 @@ public:
virtual void getBackgroundImage(OutputArray) const
{
CV_Error( CV_StsNotImplemented, "" );
CV_Error( Error::StsNotImplemented, "" );
}
virtual int getHistory() const { return history; }
......@@ -458,7 +458,7 @@ void BackgroundSubtractorMOGImpl::apply(InputArray _image, OutputArray _fgmask,
else if( image.type() == CV_8UC3 )
process8uC3( image, fgmask, learningRate, bgmodel, nmixtures, backgroundRatio, varThreshold, noiseSigma );
else
CV_Error( CV_StsUnsupportedFormat, "Only 1- and 3-channel 8-bit images are supported in BackgroundSubtractorMOG" );
CV_Error( Error::StsUnsupportedFormat, "Only 1- and 3-channel 8-bit images are supported in BackgroundSubtractorMOG" );
}
Ptr<BackgroundSubtractorMOG> createBackgroundSubtractorMOG(int history, int nmixtures,
......
......@@ -761,7 +761,7 @@ void BackgroundSubtractorMOG2Impl::getBackgroundImage(OutputArray backgroundImag
}
default:
CV_Error(CV_StsUnsupportedFormat, "");
CV_Error(Error::StsUnsupportedFormat, "");
}
}
......
......@@ -134,7 +134,7 @@ public:
virtual void getBackgroundImage(OutputArray) const
{
CV_Error( CV_StsNotImplemented, "" );
CV_Error( Error::StsNotImplemented, "" );
}
virtual void write(FileStorage& fs) const
......
......@@ -49,7 +49,7 @@ int cv::meanShift( InputArray _probImage, Rect& window, TermCriteria criteria )
CV_Assert( mat.channels() == 1 );
if( window.height <= 0 || window.width <= 0 )
CV_Error( CV_StsBadArg, "Input window has non-positive sizes" );
CV_Error( Error::StsBadArg, "Input window has non-positive sizes" );
window = window & Rect(0, 0, mat.cols, mat.rows);
......
......@@ -41,6 +41,7 @@
//M*/
#include "precomp.hpp"
#include "opencv2/video/tracking_c.h"
/////////////////////////// Meanshift & CAMShift ///////////////////////////
......
......@@ -325,14 +325,14 @@ double cv::findTransformECC(InputArray templateImage,
if( ! (src.type()==dst.type()))
CV_Error( CV_StsUnmatchedFormats, "Both input images must have the same data type" );
CV_Error( Error::StsUnmatchedFormats, "Both input images must have the same data type" );
//accept only 1-channel images
if( src.type() != CV_8UC1 && src.type()!= CV_32FC1)
CV_Error( CV_StsUnsupportedFormat, "Images must have 8uC1 or 32fC1 type");
CV_Error( Error::StsUnsupportedFormat, "Images must have 8uC1 or 32fC1 type");
if( map.type() != CV_32FC1)
CV_Error( CV_StsUnsupportedFormat, "warpMatrix must be single-channel floating-point matrix");
CV_Error( Error::StsUnsupportedFormat, "warpMatrix must be single-channel floating-point matrix");
CV_Assert (map.cols == 3);
CV_Assert (map.rows == 2 || map.rows ==3);
......@@ -428,8 +428,8 @@ double cv::findTransformECC(InputArray templateImage,
Mat deltaP = Mat(numberOfParameters, 1, CV_32F);//transformation parameter correction
Mat error = Mat(hs, ws, CV_32F);//error as 2D matrix
const int imageFlags = CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP;
const int maskFlags = CV_INTER_NN+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP;
const int imageFlags = INTER_LINEAR + WARP_INVERSE_MAP;
const int maskFlags = INTER_NEAREST + WARP_INVERSE_MAP;
// iteratively update map_matrix
......@@ -504,7 +504,7 @@ double cv::findTransformECC(InputArray templateImage,
if (lambda_d <= 0.0)
{
rho = -1;
CV_Error(CV_StsNoConv, "The algorithm stopped before its convergence. The correlation is going to be minimized. Images may be uncorrelated or non-overlapped");
CV_Error(Error::StsNoConv, "The algorithm stopped before its convergence. The correlation is going to be minimized. Images may be uncorrelated or non-overlapped");
}
const double lambda = (lambda_n/lambda_d);
......
......@@ -328,7 +328,7 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
float minEig = (A22 + A11 - std::sqrt((A11-A22)*(A11-A22) +
4.f*A12*A12))/(2*winSize.width*winSize.height);
if( err && (flags & CV_LKFLOW_GET_MIN_EIGENVALS) != 0 )
if( err && (flags & OPTFLOW_LK_GET_MIN_EIGENVALS) != 0 )
err[ptidx] = (float)minEig;
if( minEig < minEigThreshold || D < FLT_EPSILON )
......@@ -452,7 +452,7 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
prevDelta = delta;
}
if( status[ptidx] && err && level == 0 && (flags & CV_LKFLOW_GET_MIN_EIGENVALS) == 0 )
if( status[ptidx] && err && level == 0 && (flags & OPTFLOW_LK_GET_MIN_EIGENVALS) == 0 )
{
Point2f nextPoint = nextPts[ptidx] - halfWin;
Point inextPoint;
......@@ -864,10 +864,10 @@ cv::Mat cv::estimateRigidTransform( InputArray src1, InputArray src2, bool fullA
int good_count = 0;
if( A.size() != B.size() )
CV_Error( CV_StsUnmatchedSizes, "Both input images must have the same size" );
CV_Error( Error::StsUnmatchedSizes, "Both input images must have the same size" );
if( A.type() != B.type() )
CV_Error( CV_StsUnmatchedFormats, "Both input images must have the same data type" );
CV_Error( Error::StsUnmatchedFormats, "Both input images must have the same data type" );
int count = A.checkVector(2);
......@@ -947,7 +947,7 @@ cv::Mat cv::estimateRigidTransform( InputArray src1, InputArray src2, bool fullA
pB.resize(count);
}
else
CV_Error( CV_StsUnsupportedFormat, "Both input images must have either 8uC1 or 8uC3 type" );
CV_Error( Error::StsUnsupportedFormat, "Both input images must have either 8uC1 or 8uC3 type" );
good_idx.resize(count);
......
......@@ -123,13 +123,13 @@ void cv::calcMotionGradient( InputArray _mhi, OutputArray _mask,
Mat orient = _orientation.getMat();
if( aperture_size < 3 || aperture_size > 7 || (aperture_size & 1) == 0 )
CV_Error( CV_StsOutOfRange, "aperture_size must be 3, 5 or 7" );
CV_Error( Error::StsOutOfRange, "aperture_size must be 3, 5 or 7" );
if( delta1 <= 0 || delta2 <= 0 )
CV_Error( CV_StsOutOfRange, "both delta's must be positive" );
CV_Error( Error::StsOutOfRange, "both delta's must be positive" );
if( mhi.type() != CV_32FC1 )
CV_Error( CV_StsUnsupportedFormat,
CV_Error( Error::StsUnsupportedFormat,
"MHI must be single-channel floating-point images" );
if( orient.data == mhi.data )
......
......@@ -627,7 +627,7 @@ void cv::calcOpticalFlowFarneback( InputArray _prev0, InputArray _next0,
{
img[i]->convertTo(fimg, CV_32F);
GaussianBlur(fimg, fimg, Size(smooth_sz, smooth_sz), sigma, sigma);
resize( fimg, I, Size(width, height), CV_INTER_LINEAR );
resize( fimg, I, Size(width, height), INTER_LINEAR );
FarnebackPolyExp( I, R[i], poly_n, poly_sigma );
}
......
......@@ -44,12 +44,11 @@
#define __OPENCV_PRECOMP_H__
#include "opencv2/video.hpp"
#include "opencv2/video/tracking_c.h"
#include "opencv2/core/utility.hpp"
#include "opencv2/core/private.hpp"
#include <list>
#ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/video/video_tegra.hpp"
#endif
......
......@@ -41,7 +41,7 @@ void CV_BackgroundSubtractorTest::run(int)
Mat fgmask;
if (fgbg.empty())
CV_Error(CV_StsError,"Failed to create Algorithm\n");
CV_Error(Error::StsError,"Failed to create Algorithm\n");
/**
* Set a few parameters
......
......@@ -40,6 +40,7 @@
//M*/
#include "test_precomp.hpp"
#include "opencv2/video/tracking_c.h"
using namespace cv;
using namespace std;
......
......@@ -138,7 +138,7 @@ bool CV_ECC_Test_Translation::testTranslation(int from)
Mat warpedImage;
warpAffine(testImg, warpedImage, translationGround,
Size(200,200), CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP);
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
Mat mapTranslation = (Mat_<float>(2,3) << 1, 0, 0, 0, 1, 0);
......@@ -213,7 +213,7 @@ bool CV_ECC_Test_Euclidean::testEuclidean(int from)
Mat warpedImage;
warpAffine(testImg, warpedImage, euclideanGround,
Size(200,200), CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP);
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
Mat mapEuclidean = (Mat_<float>(2,3) << 1, 0, 0, 0, 1, 0);
......@@ -288,7 +288,7 @@ bool CV_ECC_Test_Affine::testAffine(int from)
Mat warpedImage;
warpAffine(testImg, warpedImage, affineGround,
Size(200,200), CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP);
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
Mat mapAffine = (Mat_<float>(2,3) << 1, 0, 0, 0, 1, 0);
......@@ -363,7 +363,7 @@ bool CV_ECC_Test_Homography::testHomography(int from)
Mat warpedImage;
warpPerspective(testImg, warpedImage, homoGround,
Size(200,200), CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP);
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
Mat mapHomography = Mat::eye(3, 3, CV_32F);
......
......@@ -93,18 +93,18 @@ bool CV_RigidTransform_Test::testNPoints(int from)
progress = update_progress(progress, k, ntests, 0);
Mat aff(2, 3, CV_64F);
rng.fill(aff, CV_RAND_UNI, Scalar(-2), Scalar(2));
rng.fill(aff, RNG::UNIFORM, Scalar(-2), Scalar(2));
int n = (unsigned)rng % 100 + 10;
Mat fpts(1, n, CV_32FC2);
Mat tpts(1, n, CV_32FC2);
rng.fill(fpts, CV_RAND_UNI, Scalar(0,0), Scalar(10,10));
rng.fill(fpts, RNG::UNIFORM, Scalar(0,0), Scalar(10,10));
transform(fpts.ptr<Point2f>(), fpts.ptr<Point2f>() + n, tpts.ptr<Point2f>(), WrapAff2D(aff));
Mat noise(1, n, CV_32FC2);
rng.fill(noise, CV_RAND_NORMAL, Scalar::all(0), Scalar::all(0.001*(n<=7 ? 0 : n <= 30 ? 1 : 10)));
rng.fill(noise, RNG::NORMAL, Scalar::all(0), Scalar::all(0.001*(n<=7 ? 0 : n <= 30 ? 1 : 10)));
tpts += noise;
Mat aff_est = estimateRigidTransform(fpts, tpts, true);
......
......@@ -40,6 +40,7 @@
//M*/
#include "test_precomp.hpp"
#include "opencv2/video/tracking_c.h"
using namespace cv;
......
......@@ -169,9 +169,7 @@ double CV_UpdateMHITest::get_success_error_level( int /*test_case_idx*/, int /*i
void CV_UpdateMHITest::run_func()
{
CvMat m = test_mat[INPUT_OUTPUT][0];
cv::updateMotionHistory( test_mat[INPUT][0], test_mat[INPUT_OUTPUT][0], timestamp, duration);
m = test_mat[INPUT_OUTPUT][0];
}
......@@ -203,8 +201,7 @@ static void test_MHIGradient( const Mat& mhi, Mat& mask, Mat& orientation,
if( delta1 > delta2 )
{
double t;
CV_SWAP( delta1, delta2, t );
std::swap( delta1, delta2 );
}
for( int i = 0; i < mhi.rows; i++ )
......@@ -417,7 +414,7 @@ void CV_MHIGlobalOrientTest::get_test_array_types_and_sizes( int test_case_idx,
{
RNG& rng = ts->get_rng();
CV_MHIBaseTest::get_test_array_types_and_sizes( test_case_idx, sizes, types );
CvSize size = sizes[INPUT][0];
Size size = sizes[INPUT][0];
size.width = MAX( size.width, 16 );
size.height = MAX( size.height, 16 );
......@@ -430,8 +427,7 @@ void CV_MHIGlobalOrientTest::get_test_array_types_and_sizes( int test_case_idx,
max_angle = cvtest::randReal(rng)*359.9;
if( min_angle >= max_angle )
{
double t;
CV_SWAP( min_angle, max_angle, t );
std::swap( min_angle, max_angle);
}
max_angle += 0.1;
duration = exp(cvtest::randReal(rng)*max_log_duration);
......@@ -474,7 +470,7 @@ int CV_MHIGlobalOrientTest::validate_test_results( int test_case_idx )
test_mat[INPUT][0], timestamp, duration );
double err_level = get_success_error_level( test_case_idx, 0, 0 );
int code = cvtest::TS::OK;
int nz = cvCountNonZero( test_array[INPUT][1] );
int nz = countNonZero( test_mat[INPUT][1] );
if( nz > 32 && !(min_angle - err_level <= angle &&
max_angle + err_level >= angle) &&
......
......@@ -40,6 +40,7 @@
//M*/
#include "test_precomp.hpp"
#include "opencv2/video/tracking_c.h"
/* ///////////////////// pyrlk_test ///////////////////////// */
......
......@@ -754,7 +754,7 @@ Mat KeypointBasedMotionEstimatorGpu::estimate(const gpu::GpuMat &frame0, const g
grayFrame0 = frame0;
else
{
gpu::cvtColor(frame0, grayFrame0_, CV_BGR2GRAY);
gpu::cvtColor(frame0, grayFrame0_, COLOR_BGR2GRAY);
grayFrame0 = grayFrame0_;
}
......
......@@ -357,7 +357,7 @@ void MotionInpainter::inpaint(int idx, Mat &frame, Mat &mask)
mask1_.setTo(255);
}
cvtColor(frame, grayFrame_, CV_BGR2GRAY);
cvtColor(frame, grayFrame_, COLOR_BGR2GRAY);
MotionInpaintBody body;
body.rad = 2;
......@@ -383,7 +383,7 @@ void MotionInpainter::inpaint(int idx, Mat &frame, Mat &mask)
frame1_, transformedFrame1_, motion1to0, frame1_.size(), INTER_LINEAR,
borderMode_);
cvtColor(transformedFrame1_, transformedGrayFrame1_, CV_BGR2GRAY);
cvtColor(transformedFrame1_, transformedGrayFrame1_, COLOR_BGR2GRAY);
// warp mask
......
#include "opencv2/video/tracking.hpp"
#include "opencv2/video/tracking_c.h"
#include "opencv2/highgui/highgui_c.h"
#include "opencv2/imgproc/imgproc_c.h"
#include <stdio.h>
......
#include "opencv2/video/tracking.hpp"
#include "opencv2/highgui/highgui_c.h"
#include "opencv2/video/tracking_c.h"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/highgui/highgui_c.h"
#include <time.h>
#include <stdio.h>
#include <ctype.h>
......
......@@ -69,7 +69,7 @@ static void drawPlot(const cv::Mat curve, const std::string figureTitle, const i
{
cv::Mat rgbIntImg;
outputMat.convertTo(rgbIntImg, CV_8UC3);
cvtColor(rgbIntImg, intGrayImage, CV_BGR2GRAY);
cv::cvtColor(rgbIntImg, intGrayImage, cv::COLOR_BGR2GRAY);
}
// get histogram density probability in order to cut values under above edges limits (here 5-95%)... usefull for HDR pixel errors cancellation
......
......@@ -88,7 +88,7 @@ static void rescaleGrayLevelMat(const cv::Mat &inputMat, cv::Mat &outputMat, con
{
cv::Mat rgbIntImg;
normalisedImage.convertTo(rgbIntImg, CV_8UC3);
cvtColor(rgbIntImg, intGrayImage, CV_BGR2GRAY);
cv::cvtColor(rgbIntImg, intGrayImage, cv::COLOR_BGR2GRAY);
}
// get histogram density probability in order to cut values under above edges limits (here 5-95%)... usefull for HDR pixel errors cancellation
......
......@@ -114,7 +114,7 @@ int main( int argc, const char** argv )
if( !paused )
{
cvtColor(image, hsv, CV_BGR2HSV);
cvtColor(image, hsv, COLOR_BGR2HSV);
if( trackObject )
{
......@@ -130,7 +130,7 @@ int main( int argc, const char** argv )
{
Mat roi(hue, selection), maskroi(mask, selection);
calcHist(&roi, 1, 0, maskroi, hist, 1, &hsize, &phranges);
normalize(hist, hist, 0, 255, CV_MINMAX);
normalize(hist, hist, 0, 255, NORM_MINMAX);
trackWindow = selection;
trackObject = 1;
......@@ -140,7 +140,7 @@ int main( int argc, const char** argv )
Mat buf(1, hsize, CV_8UC3);
for( int i = 0; i < hsize; i++ )
buf.at<Vec3b>(i) = Vec3b(saturate_cast<uchar>(i*180./hsize), 255, 255);
cvtColor(buf, buf, CV_HSV2BGR);
cvtColor(buf, buf, COLOR_HSV2BGR);
for( int i = 0; i < hsize; i++ )
{
......@@ -154,7 +154,7 @@ int main( int argc, const char** argv )
calcBackProject(&hue, 1, 0, hist, backproj, &phranges);
backproj &= mask;
RotatedRect trackBox = CamShift(backproj, trackWindow,
TermCriteria( CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 10, 1 ));
TermCriteria( TermCriteria::EPS | TermCriteria::COUNT, 10, 1 ));
if( trackWindow.area() <= 1 )
{
int cols = backproj.cols, rows = backproj.rows, r = (MIN(cols, rows) + 5)/6;
......@@ -164,8 +164,8 @@ int main( int argc, const char** argv )
}
if( backprojMode )
cvtColor( backproj, image, CV_GRAY2BGR );
ellipse( image, trackBox, Scalar(0,0,255), 3, CV_AA );
cvtColor( backproj, image, COLOR_GRAY2BGR );
ellipse( image, trackBox, Scalar(0,0,255), 3, LINE_AA );
}
}
else if( trackObject < 0 )
......
......@@ -204,7 +204,7 @@ int main(int argc, char * argv[]) {
}
Mat result_large(100, 100, CV_8UC1);
resize(result_small, result_large, Size(500, 500), 0, 0, CV_INTER_NN);
resize(result_small, result_large, Size(500, 500), 0, 0, INTER_NEAREST);
cout << endl << "Press any key to exit" << endl;
imshow("Confusion Matrix", result_large);
......
......@@ -42,13 +42,13 @@ int main(int, char**)
for(;;)
{
cap >> frame;
cvtColor(frame, gray, CV_BGR2GRAY);
cvtColor(frame, gray, COLOR_BGR2GRAY);
if( prevgray.data )
{
calcOpticalFlowFarneback(prevgray, gray, flow, 0.5, 3, 15, 3, 5, 1.2, 0);
cvtColor(prevgray, cflow, CV_GRAY2BGR);
drawOptFlowMap(flow, cflow, 16, 1.5, CV_RGB(0, 255, 0));
cvtColor(prevgray, cflow, COLOR_GRAY2BGR);
drawOptFlowMap(flow, cflow, 16, 1.5, Scalar(0, 255, 0));
imshow("flow", cflow);
}
if(waitKey(30)>=0)
......
......@@ -238,7 +238,7 @@ int main (const int argc, const char * argv[])
warpGround = (Mat_<float>(2,3) << 1, 0, (rng.uniform(10.f, 20.f)),
0, 1, (rng.uniform(10.f, 20.f)));
warpAffine(target_image, template_image, warpGround,
Size(200,200), CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP);
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
break;
case MOTION_EUCLIDEAN:
angle = CV_PI/30 + CV_PI*rng.uniform((double)-2.f, (double)2.f)/180;
......@@ -246,7 +246,7 @@ int main (const int argc, const char * argv[])
warpGround = (Mat_<float>(2,3) << cos(angle), -sin(angle), (rng.uniform(10.f, 20.f)),
sin(angle), cos(angle), (rng.uniform(10.f, 20.f)));
warpAffine(target_image, template_image, warpGround,
Size(200,200), CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP);
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
break;
case MOTION_AFFINE:
......@@ -255,7 +255,7 @@ int main (const int argc, const char * argv[])
(rng.uniform(-0.03f, 0.03f)), (1-rng.uniform(-0.05f, 0.05f)),
(rng.uniform(10.f, 20.f)));
warpAffine(target_image, template_image, warpGround,
Size(200,200), CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP);
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
break;
case MOTION_HOMOGRAPHY:
warpGround = (Mat_<float>(3,3) << (1-rng.uniform(-0.05f, 0.05f)),
......@@ -263,7 +263,7 @@ int main (const int argc, const char * argv[])
(rng.uniform(-0.03f, 0.03f)), (1-rng.uniform(-0.05f, 0.05f)),(rng.uniform(10.f, 20.f)),
(rng.uniform(0.0001f, 0.0003f)), (rng.uniform(0.0001f, 0.0003f)), 1.f);
warpPerspective(target_image, template_image, warpGround,
Size(200,200), CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP);
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
break;
}
}
......@@ -333,10 +333,10 @@ int main (const int argc, const char * argv[])
Mat warped_image = Mat(template_image.rows, template_image.cols, CV_32FC1);
if (warp_mode != MOTION_HOMOGRAPHY)
warpAffine (target_image, warped_image, warp_matrix, warped_image.size(),
CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP);
INTER_LINEAR + WARP_INVERSE_MAP);
else
warpPerspective (target_image, warped_image, warp_matrix, warped_image.size(),
CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP);
INTER_LINEAR + WARP_INVERSE_MAP);
//save the warped image
imwrite(warpedImFile, warped_image);
......
......@@ -69,18 +69,18 @@ int main(int, char**)
Point measPt = calcPoint(center, R, measAngle);
// plot points
#define drawCross( center, color, d ) \
line( img, Point( center.x - d, center.y - d ), \
Point( center.x + d, center.y + d ), color, 1, CV_AA, 0); \
line( img, Point( center.x + d, center.y - d ), \
Point( center.x - d, center.y + d ), color, 1, CV_AA, 0 )
#define drawCross( center, color, d ) \
line( img, Point( center.x - d, center.y - d ), \
Point( center.x + d, center.y + d ), color, 1, LINE_AA, 0); \
line( img, Point( center.x + d, center.y - d ), \
Point( center.x - d, center.y + d ), color, 1, LINE_AA, 0 )
img = Scalar::all(0);
drawCross( statePt, Scalar(255,255,255), 3 );
drawCross( measPt, Scalar(0,0,255), 3 );
drawCross( predictPt, Scalar(0,255,0), 3 );
line( img, statePt, measPt, Scalar(0,0,255), 3, CV_AA, 0 );
line( img, statePt, predictPt, Scalar(0,255,255), 3, CV_AA, 0 );
line( img, statePt, measPt, Scalar(0,0,255), 3, LINE_AA, 0 );
line( img, statePt, predictPt, Scalar(0,255,255), 3, LINE_AA, 0 );
if(theRNG().uniform(0,4) != 0)
KF.correct(measurement);
......
......@@ -38,7 +38,7 @@ static void onMouse( int event, int x, int y, int /*flags*/, void* /*param*/ )
int main( int argc, char** argv )
{
VideoCapture cap;
TermCriteria termcrit(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS,20,0.03);
TermCriteria termcrit(TermCriteria::COUNT|TermCriteria::EPS,20,0.03);
Size subPixWinSize(10,10), winSize(31,31);
const int MAX_COUNT = 500;
......@@ -72,7 +72,7 @@ int main( int argc, char** argv )
break;
frame.copyTo(image);
cvtColor(image, gray, CV_BGR2GRAY);
cvtColor(image, gray, COLOR_BGR2GRAY);
if( nightMode )
image = Scalar::all(0);
......@@ -117,7 +117,7 @@ int main( int argc, char** argv )
{
vector<Point2f> tmp;
tmp.push_back(point);
cornerSubPix( gray, tmp, winSize, cvSize(-1,-1), termcrit);
cornerSubPix( gray, tmp, winSize, Size(-1,-1), termcrit);
points[1].push_back(tmp[0]);
addRemovePt = false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment