|
|
@ -2,30 +2,24 @@ |
|
|
|
#include "opencv2/core/utility.hpp" |
|
|
|
#include "opencv2/core/utility.hpp" |
|
|
|
#include "opencv2/highgui.hpp" |
|
|
|
#include "opencv2/highgui.hpp" |
|
|
|
#include "opencv2/imgproc.hpp" |
|
|
|
#include "opencv2/imgproc.hpp" |
|
|
|
|
|
|
|
#include "opencv2/videoio.hpp" |
|
|
|
#include "opencv2/video.hpp" |
|
|
|
#include "opencv2/video.hpp" |
|
|
|
|
|
|
|
|
|
|
|
using namespace std; |
|
|
|
using namespace std; |
|
|
|
using namespace cv; |
|
|
|
using namespace cv; |
|
|
|
|
|
|
|
|
|
|
|
static void help() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
printf("Usage: dis_optflow <video_file>\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char **argv) |
|
|
|
int main(int argc, char **argv) |
|
|
|
{ |
|
|
|
{ |
|
|
|
VideoCapture cap; |
|
|
|
CommandLineParser parser(argc, argv, "{ @video | vtest.avi | use video as input }"); |
|
|
|
|
|
|
|
string filename = samples::findFileOrKeep(parser.get<string>("@video")); |
|
|
|
|
|
|
|
|
|
|
|
if (argc < 2) |
|
|
|
VideoCapture cap; |
|
|
|
{ |
|
|
|
cap.open(filename); |
|
|
|
help(); |
|
|
|
|
|
|
|
exit(1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cap.open(argv[1]); |
|
|
|
|
|
|
|
if(!cap.isOpened()) |
|
|
|
if(!cap.isOpened()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
printf("ERROR: Cannot open file %s\n", argv[1]); |
|
|
|
printf("ERROR: Cannot open file %s\n", filename.c_str()); |
|
|
|
|
|
|
|
parser.printMessage(); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -35,9 +29,6 @@ int main(int argc, char **argv) |
|
|
|
Mat hsv_split[3], hsv; |
|
|
|
Mat hsv_split[3], hsv; |
|
|
|
char ret; |
|
|
|
char ret; |
|
|
|
|
|
|
|
|
|
|
|
namedWindow("flow", 1); |
|
|
|
|
|
|
|
namedWindow("orig", 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ptr<DenseOpticalFlow> algorithm = DISOpticalFlow::create(DISOpticalFlow::PRESET_MEDIUM); |
|
|
|
Ptr<DenseOpticalFlow> algorithm = DISOpticalFlow::create(DISOpticalFlow::PRESET_MEDIUM); |
|
|
|
|
|
|
|
|
|
|
|
while(true) |
|
|
|
while(true) |
|
|
|