Mercurial > hg > nsaunier > traffic-intelligence
comparison c/optical-flow.cpp @ 230:bc4ea09b1743
compatibility modifications for visual studio compilation
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Fri, 29 Jun 2012 16:15:13 -0400 |
| parents | 3ead4bcd001c |
| children | 8e30c9a6ac6f |
comparison
equal
deleted
inserted
replaced
| 207:48f83ff769fd | 230:bc4ea09b1743 |
|---|---|
| 4 #include "opencv/cv.h" | 4 #include "opencv/cv.h" |
| 5 #include "opencv/highgui.h" | 5 #include "opencv/highgui.h" |
| 6 | 6 |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 #include <ctime> | 8 #include <ctime> |
| 9 | |
| 10 /* MSVC does not have lrintf */ | |
| 11 #ifdef _MSC_VER | |
| 12 static inline long lrintf(float f){ | |
| 13 /* x64 does not supported embedded assembly */ | |
| 14 #ifdef _M_X64 | |
| 15 return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f)); | |
| 16 #else | |
| 17 int i; | |
| 18 | |
| 19 _asm{ | |
| 20 fld f | |
| 21 fistp i | |
| 22 }; | |
| 23 | |
| 24 return i; | |
| 25 #endif | |
| 26 } | |
| 27 #endif | |
| 9 | 28 |
| 10 using namespace std; | 29 using namespace std; |
| 11 | 30 |
| 12 void videoTiming(CvCapture* inputVideo) { | 31 void videoTiming(CvCapture* inputVideo) { |
| 13 IplImage* frame = cvQueryFrame(inputVideo); | 32 IplImage* frame = cvQueryFrame(inputVideo); |
