diff --git a/common/utils/utils.h b/common/utils/utils.h index 0bee4314..50f75caa 100644 --- a/common/utils/utils.h +++ b/common/utils/utils.h @@ -5,7 +5,6 @@ #ifndef OPENDETECTION_UTILS_H #define OPENDETECTION_UTILS_H -#include #include #include #include @@ -17,6 +16,15 @@ #include +#if defined(_WIN32) + #define NOMINMAX + #define WIN32_LEAN_AND_MEAN + #include + #include +#else + #include +#endif + namespace bf = boost::filesystem; @@ -121,13 +129,29 @@ namespace od class Timer { private: - - timeval startTime; - + double duration_; + public: +#if defined(_WIN32) + double tStart, tEnd, duration; - double duration_; + void start() + { + tStart = timeGetTime(); + } + double stop() + { + tEnd = timeGetTime(); + duration = tEnd - tStart; + duration_ = duration; + return duration; + } +#else + struct timeval startTime, endTime; + long seconds, useconds; + double duration; + void start() { gettimeofday(&startTime, NULL); @@ -135,10 +159,6 @@ namespace od double stop() { - timeval endTime; - long seconds, useconds; - double duration; - gettimeofday(&endTime, NULL); seconds = endTime.tv_sec - startTime.tv_sec; @@ -148,10 +168,11 @@ namespace od duration_ = duration; return duration; } - - +#endif double getDuration() - { return duration_; } + { + return duration_; + } static void printTime(double duration) { diff --git a/detectors/local2D/detection/ODCADRecognizer2DLocal.cpp b/detectors/local2D/detection/ODCADRecognizer2DLocal.cpp index 078f82a2..add8637c 100644 --- a/detectors/local2D/detection/ODCADRecognizer2DLocal.cpp +++ b/detectors/local2D/detection/ODCADRecognizer2DLocal.cpp @@ -37,8 +37,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include -#include // PnP Tutorial #include "simple_ransac_detection/Mesh.h" diff --git a/detectors/local2D/detection/simple_ransac_detection/Utils.h b/detectors/local2D/detection/simple_ransac_detection/Utils.h index 29ff27af..524c9826 100644 --- a/detectors/local2D/detection/simple_ransac_detection/Utils.h +++ b/detectors/local2D/detection/simple_ransac_detection/Utils.h @@ -9,7 +9,14 @@ #define UTILS_H_ #include -#include +#if defined(_WIN32) + #define NOMINMAX + #define WIN32_LEAN_AND_MEAN + #include + #include +#else + #include +#endif #include "PnPProblem.h" #include "Model.h" diff --git a/detectors/local2D/detection/simple_ransac_detection/main_detection_image_wo_k.cpp b/detectors/local2D/detection/simple_ransac_detection/main_detection_image_wo_k.cpp index c8e0f96a..7bb89da1 100644 --- a/detectors/local2D/detection/simple_ransac_detection/main_detection_image_wo_k.cpp +++ b/detectors/local2D/detection/simple_ransac_detection/main_detection_image_wo_k.cpp @@ -18,7 +18,15 @@ #include -#include +#if defined(_WIN32) + #define NOMINMAX + #define WIN32_LEAN_AND_MEAN + #include + #include +#else + #include +#endif + // PnP Tutorial #include "Mesh.h"