Move C API of opencv_video to separate file
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user