-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCoarse2FineTwoFrames.cpp
More file actions
executable file
·57 lines (52 loc) · 1.73 KB
/
Coarse2FineTwoFrames.cpp
File metadata and controls
executable file
·57 lines (52 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*#include "project.h"
#include "Image.h"
#include "OpticalFlow.h"
#include <iostream>
using namespace std;
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
// check for proper number of input and output arguments
if(nrhs<2 || nrhs>3)
mexErrMsgTxt("Only two or three input arguments are allowed!");
if(nlhs<2 || nlhs>3)
mexErrMsgTxt("Only two or three output arguments are allowed!");
DImage Im1,Im2;
Im1.LoadMatlabImage(prhs[0]);
Im2.LoadMatlabImage(prhs[1]);
//LoadImage(Im1,prhs[0]);
//LoadImage(Im2,prhs[1]);
//mexPrintf("width %d height %d nchannels %d\n",Im1.width(),Im1.height(),Im1.nchannels());
//mexPrintf("width %d height %d nchannels %d\n",Im2.width(),Im2.height(),Im2.nchannels());
if(Im1.matchDimension(Im2)==false)
mexErrMsgTxt("The two images don't match!");
// get the parameters
double alpha= 1;
double ratio=0.5;
int minWidth= 40;
int nOuterFPIterations = 3;
int nInnerFPIterations = 1;
int nSORIterations= 20;
if(nrhs>2)
{
int nDims=mxGetNumberOfDimensions(prhs[2]);
const int *dims=mxGetDimensions(prhs[2]);
double* para=(double *)mxGetData(prhs[2]);
int npara=dims[0]*dims[1];
if(npara>0)
alpha=para[0];
if(npara>1)
ratio=para[1];
if(npara>2)
minWidth=para[2];
if(npara>3)
nOuterFPIterations=para[3];
if(npara>4)
nInnerFPIterations=para[4];
if(npara>5)
nSORIterations = para[5];
}
//mexPrintf("alpha: %f ratio: %f minWidth: %d nOuterFPIterations: %d nInnerFPIterations: %d nCGIterations: %d\n",alpha,ratio,minWidth,nOuterFPIterations,nInnerFPIterations,nCGIterations);
DImage vx,vy,warpI2;
OpticalFlow::Coarse2FineFlow(vx,vy,warpI2,Im1,Im2,alpha,ratio,minWidth,nOuterFPIterations,nInnerFPIterations,nSORIterations);
}
*/