Вы находитесь на странице: 1из 22

/ , OpenCV

7. ,

http://people.rit.edu/andpph/photofile-misc/strobe-motion-ta-08.jpg

:
www.uralvision.blogspot.com


perevalovds@gmail.com

/ 2010


VideoCapture capture; //
capture.open( 0 ); // ( 0)
// VideoCapture capture.open( "myfile.avi" ); - avi-
if ( !capture.isOpened() ) { // ,
cout << " " << endl;
return -1;
}
Mat image, smoothed, edges;
for(;;) {
capture >> image; //
cvtColor(image, smoothed, CV_BGR2GRAY);
GaussianBlur(smoothed, smoothed, Size(7,7), 1.5, 1.5 );
Canny(smoothed, edges, 0, 30, 3 );
imshow( "image", image );
imshow("edges", edges);
if(waitKey(30) >= 0) break; // 30 , -
}
// capture
return 0;


, . (
,
, ).



( 4-)


1.
, .
4 .
.
: ,
.
,
, .
2. getPerspectiveTransform
( ,
, ).
3. , warpPerspective
.


const int K = 4;
cv::Point2f src[K];
cv::Point2f dst[K];

// 4 .
//
//

src[ 0 ] = cv::Point2f( ..., ... );


src[ 1 ] = cv::Point2f( ..., ... );

src[ 2 ] = cv::Point2f( ..., ... );


src[ 3 ] = cv::Point2f( ..., ... );

//
//
//- dst, .

dst[ 0 ] = cv::Point2f( 0, 0 ); // ; w h -
dst[ 1 ] = cv::Point2f( w, 0 );
dst[ 2 ] = cv::Point2f( w, h );
dst[ 3 ] = cv::Point2f( 0, h );
Mat transform = getPerspectiveTransform( src, dst );

// .

warpPerspective( image, imageResult, transform, cv::Size( w, h ), INTER_LINEAR );


// image - imageResult


- ,
.

1.
,
.
- "code book",
,
.
.
:
- -
,
-
, ,
( ).

2.
, N
const float k = 0.01;
back = (1-k) * back + k * image;

, , .
.
-
.

.

3.
1.
2. ( , time of
filght cameras)
3. Kinect
,
, .

-
" "
1. image1, image2 - , .
2.
Mat diff;
absdiff( image1, image2, diff);
3.
Mat bin;
// ,
threshold( diff, bin, 100 /* */, 255, CV_THRESH_BINARY );

-
" "
,
.
.


(optical flow, optic flow) -
, ,
(, ) .

:
,
,


-

http://www.ultimategraphics.co.jp/jp/images/stories/ultimate/BCC/optical.jpg

1. ,
.
2. -
,
,
(
"").
3. -

, .

: . - ( fx(x, y), fy(x,y) )


- .

(I) ("" )
, .

(II) ( )
x, y, t.
1. Lucas-Kanade - .
2. Farneback - ,
3. CLG - , OpenCV
4. Lucas-Kanade, " "
5. Horn-Schunk -

(III) ()
min-cut, max-flow,
belief propagation.

1. Lucas-Kanade
, t
.
: .
: "aperture problem" -
, .
C- OpenCV, cvCalcOpticalFlowLK.

, .
,
.
10 ,
line. (:

).

2. Farneback
,
.
: .
: Lucas-Kanade.

void calcOpticalFlowFarneback(
const Mat& prevImg,
// , 8-
const Mat& nextImg,
// , prevImg
Mat& flow,
// , CV_32FC2
double pyrScale,
//<1, .
0.5
int levels,
//
5
int winsize,
// . -
// , 5
int iterations,
//
3
int polyN,
//
//
7
double polySigma,
//
//
1.5
int flags
//
// OPTFLOW_USE_INITIAL_FLOW - !!
//OPTFLOW_FARNEBACK_GAUSSIAN -
// .

3. CLG
"Combining Local and Global"
, Lucas-Kanade Horn-Schunk
(2010 .)
/ .
OpenCV.
( ):
CLG C/C++, ,
- .

Вам также может понравиться