forked from bartvdbraak/blender
Camera tracking integration
=========================== Fixes for MSVC.
This commit is contained in:
parent
ed3e6aa972
commit
c15012e568
12
extern/libmv/ChangeLog
vendored
12
extern/libmv/ChangeLog
vendored
@ -1,3 +1,15 @@
|
||||
commit 5299ea67043459eda147950e589c2d327a8fbced
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Fri Aug 19 16:05:54 2011 +0200
|
||||
|
||||
sqrt takes double precision.
|
||||
|
||||
commit 9f9221ce151d788c49b48f6f293ab2e2f8813978
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Fri Aug 19 16:04:37 2011 +0200
|
||||
|
||||
MSVC compatibility: heap allocate pattern, explicit float cast.
|
||||
|
||||
commit 702658d2f8616964a6eeb3743fd85e97ac7ff09d
|
||||
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
|
||||
Date: Fri Aug 19 14:59:24 2011 +0200
|
||||
|
6
extern/libmv/libmv/tracking/sad.cc
vendored
6
extern/libmv/libmv/tracking/sad.cc
vendored
@ -122,6 +122,7 @@ float Track(ubyte* reference, ubyte* warped, int size, ubyte* image, int stride,
|
||||
min=-1; //reset score since direct warped search match too well (but the wrong pattern).
|
||||
|
||||
// 6D coordinate descent to find affine transform
|
||||
ubyte match = new ubyte[size*size];
|
||||
float step = 0.5;
|
||||
for(int p = 0; p < 8; p++) { //foreach precision level
|
||||
for(int i = 0; i < 2; i++) { // iterate twice per precision level
|
||||
@ -130,7 +131,6 @@ float Track(ubyte* reference, ubyte* warped, int size, ubyte* image, int stride,
|
||||
for(float x = -step; x <= step; x+=step) { //solve subproblem (evaluate only along one coordinate)
|
||||
mat32 t = m;
|
||||
t.data[d] += x;
|
||||
ubyte match[size*size];
|
||||
//TODO: better performance would also allow a more exhaustive search
|
||||
SamplePattern(image,stride,t,match,size);
|
||||
uint sad = SAD(reference,match,size,size);
|
||||
@ -152,7 +152,6 @@ float Track(ubyte* reference, ubyte* warped, int size, ubyte* image, int stride,
|
||||
|
||||
// Compute Pearson product-moment correlation coefficient
|
||||
uint sX=0,sY=0,sXX=0,sYY=0,sXY=0;
|
||||
ubyte match[size*size];
|
||||
SamplePattern(image,stride,m,match,size);
|
||||
SAD(reference,match,size,size);
|
||||
for(int i = 0; i < size; i++) {
|
||||
@ -166,9 +165,10 @@ float Track(ubyte* reference, ubyte* warped, int size, ubyte* image, int stride,
|
||||
sXY += x*y;
|
||||
}
|
||||
}
|
||||
delete[] match;
|
||||
const int N = size*size;
|
||||
sX /= N, sY /= N, sXX /= N, sYY /= N, sXY /= N;
|
||||
return (sXY-sX*sY)/sqrt((sXX-sX*sX)*(sYY-sY*sY));
|
||||
return (sXY-sX*sY)/sqrt(double((sXX-sX*sX)*(sYY-sY*sY)));
|
||||
}
|
||||
|
||||
} // namespace libmv
|
||||
|
Loading…
Reference in New Issue
Block a user