Camera tracking integration

===========================

Just another fix for MSVC.
This commit is contained in:
Sergey Sharybin 2011-08-17 18:37:25 +00:00
parent 9589668e9f
commit 07017db093
3 changed files with 18 additions and 1 deletions

@ -1,3 +1,16 @@
commit a4876d8c40dcde615b44009c38c49e9a1b1d4698
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
Date: Wed Aug 17 20:26:01 2011 +0200
Hack to make sad.cc compile with MSVC on system without support for the SSE instruction set.
commit 0de723dfce5bbe44dbd19be8cd6dd6e9b03b7924
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
Date: Wed Aug 17 20:10:46 2011 +0200
Fix slow path (for computers without SSE2).
Heap allocate scores in detect.cc
commit 65a9d496f81e8b37eae39a4063957b8be9a4e6f0
Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
Date: Wed Aug 17 19:25:17 2011 +0200

@ -23,6 +23,7 @@
****************************************************************************/
#include "libmv/simple_pipeline/detect.h"
#include <stdlib.h>
#include <string.h>
namespace libmv {
@ -54,7 +55,7 @@ static uint SAD(const ubyte* imageA, const ubyte* imageB, int strideA, int strid
void Detect(ubyte* image, int stride, int width, int height, Feature* detected, int* count, int distance, ubyte* pattern) {
unsigned short histogram[256];
memset(histogram,0,sizeof(histogram));
ubyte scores[width*height];
ubyte* scores = new ubyte[width*height];
memset(scores,0,sizeof(scores));
const int r = 1; //radius for self similarity comparison
for(int y=distance; y<height-distance; y++) {
@ -103,6 +104,7 @@ void Detect(ubyte* image, int stride, int width, int height, Feature* detected,
}
}
*count = i;
free(scores);
}
}

@ -57,6 +57,8 @@ void SamplePattern(ubyte* image, int stride, mat3 warp, ubyte* pattern) {
//MSVC apparently doesn't support any float rounding.
int fx = _mm_cvtss_si32(_mm_set_ss(p.x*k));
int fy = _mm_cvtss_si32(_mm_set_ss(p.y*k));
#elif defined(_MSC_VER)
int fx = int(p.x*k+0.5), fy = int(p.y*k+0.5);
#else
int fx = lround(p.x*k), fy = lround(p.y*k);
#endif