forked from wanglimin/dense_flow
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yjxiong
committed
Apr 28, 2016
1 parent
a128881
commit f64d0d0
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "dense_flow.h" | ||
#include "utils.h" | ||
|
||
INITIALIZE_EASYLOGGINGPP | ||
|
||
using namespace cv::gpu; | ||
|
||
int main(int argc, char** argv){ | ||
// IO operation | ||
const char* keys = | ||
{ | ||
"{ f | vidFile | ex2.avi | filename of video }" | ||
"{ x | xFlowFile | flow_x | filename of flow x component }" | ||
"{ y | yFlowFile | flow_y | filename of flow x component }" | ||
"{ b | bound | 15 | specify the maximum of optical flow}" | ||
"{ t | type | 0 | specify the optical flow algorithm }" | ||
"{ d | device_id | 0 | set gpu id}" | ||
"{ s | step | 1 | specify the step for frame sampling}" | ||
"{ o | out | zip | output style}" | ||
}; | ||
|
||
CommandLineParser cmd(argc, argv, keys); | ||
string vidFile = cmd.get<string>("vidFile"); | ||
string xFlowFile = cmd.get<string>("xFlowFile"); | ||
string yFlowFile = cmd.get<string>("yFlowFile"); | ||
string output_style = cmd.get<string>("out"); | ||
int bound = cmd.get<int>("bound"); | ||
int type = cmd.get<int>("type"); | ||
int device_id = cmd.get<int>("device_id"); | ||
int step = cmd.get<int>("step"); | ||
|
||
vector<vector<uchar> > out_vec_x, out_vec_y; | ||
|
||
calcDenseWarpFlowGPU(vidFile, bound, type, step, device_id, | ||
out_vec_x, out_vec_y); | ||
|
||
if (output_style == "dir") { | ||
writeImages(out_vec_x, xFlowFile); | ||
writeImages(out_vec_y, yFlowFile); | ||
}else{ | ||
// LOG(INFO)<<"Writing results to Zip archives"; | ||
writeZipFile(out_vec_x, "x_%05d.jpg", xFlowFile+".zip"); | ||
writeZipFile(out_vec_y, "y_%05d.jpg", yFlowFile+".zip"); | ||
} | ||
|
||
return 0; | ||
} |