Add Sconscript for unit test
authorPeng Li <seudut@gmail.com>
Tue, 17 Jul 2018 11:17:54 +0000 (19:17 +0800)
committerPeng Li <seudut@gmail.com>
Tue, 17 Jul 2018 11:29:35 +0000 (19:29 +0800)
25 files changed:
README.md
SConstruct
include/Detector.h [new file with mode: 0644]
include/Engine.h [new file with mode: 0644]
include/Logger.h [new file with mode: 0644]
include/Metrics.h [new file with mode: 0644]
include/MultiTracker.h [new file with mode: 0644]
include/SharedPtr.h [new file with mode: 0644]
include/Tracker.h [new file with mode: 0644]
include/VideoReader.h [new file with mode: 0644]
include/VideoSource.h [new file with mode: 0644]
include/test.h [new file with mode: 0644]
main.cpp
src/Detector.h [deleted file]
src/Engine.h [deleted file]
src/Logger.h [deleted file]
src/Metrics.h [deleted file]
src/MultiTracker.h [deleted file]
src/SharedPtr.h [deleted file]
src/Tracker.h [deleted file]
src/VideoReader.h [deleted file]
src/VideoSource.h [deleted file]
src/test.cpp [new file with mode: 0644]
test/SConscript [new file with mode: 0644]
test/test-unittest.cpp [new file with mode: 0644]

index 51122bf..36d7542 100644 (file)
--- a/README.md
+++ b/README.md
@@ -10,3 +10,15 @@ Tracker++ cpp version on Linux (arm)
 ### Run
 
 `./main`
+
+
+## Build with `scons`
+install scons tool `apt-get install scons`
+
+- Run `scons` to build the `src/` and `main`. It will generate a library
+`libtracker.a` and an executable file `main` under current folder.
+
+- Run `scons --all` to build source and `test` file. A executable file `TestMain`,
+which is used to run the unit test, will be generated under `test`
+
+- Run `scons --all -c` to clean.
index 6556a3e..e779fc9 100644 (file)
@@ -1,12 +1,29 @@
 import sys
+import os
 
-env = Environment(CC="g++")
-env.Append(CPPFLAGS = '-Wall -std=c++11')
+# using -j4 by default
+SetOption('num_jobs', 4)
 
+AddOption('--all', dest='all', action='store_true', help='Build all include test')
+
+env = Environment(CXX="g++", 
+                CPPPATH=['#include'],
+                ALL=GetOption('all'))
+
+env.Append(CCFLAGS = ['-Wall', '-std=c++11'])
 env.ParseConfig("pkg-config --libs opencv log4cpp")
-#env.Append(LIBS=['-llog4cpp', '-lpthread'])
 
-obj = env.Object(Glob("src/*.cpp")) + env.Object("main.cpp")
+#obj = env.Object(Glob("src/*.cpp")) + env.Object("main.cpp")
+obj = env.Object('main.cpp')
+env.StaticLibrary('tracker', Glob('src/*.cpp'))
+
+#print env['LINKFLAGS']
+#print env['LIBS']
+env.Append(LIBS = ['tracker'])
+env.Append(LIBPATH=['#.'])
 
+#env.Program("main", 'main.cpp', LIBS=['tracker'], LIBPATH=['.'])
 env.Program("main", list(obj))
 
+if GetOption('all'):
+    SConscript('test/SConscript', exports='env')
diff --git a/include/Detector.h b/include/Detector.h
new file mode 100644 (file)
index 0000000..edf875c
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef _DETECTOR_H_
+#define _DETECTOR_H_
+
+#include "VideoReader.h"
+#include "SharedPtr.h"
+
+namespace suanzi {
+
+    struct Detection;
+
+    TK_DECLARE_PTR(Detector);
+    class Detector
+    {
+    public:
+        Detector();
+        virtual ~Detector();
+        unsigned int detect(cv::Mat& frame, Detection* detections){return 1;}
+    };
+
+    struct Detection
+    {
+        // 检测目标的类型,目前只有一个类human,默认等于0。为以后可以检测的更多类别预留
+        unsigned int object_type;
+        // 检测目标的分数,可以不填
+        float score;
+        // 检测目标的坐标,包括物体中心的x、y坐标,物体的高和宽
+        unsigned int center_x;
+        unsigned int center_y;
+        unsigned int height;
+        unsigned int width;
+        // 检测目标的特征向量
+        unsigned int feature_size;
+        float * feature;
+    };
+
+}
+
+
+#endif /* _DETECTOR_H_ */
+
+
diff --git a/include/Engine.h b/include/Engine.h
new file mode 100644 (file)
index 0000000..5405539
--- /dev/null
@@ -0,0 +1,87 @@
+#ifndef _ENGINE_H_
+#define _ENGINE_H_
+
+#include<string>
+#include<sstream>
+#include<set>
+#include "Tracker.h"
+#include "Detector.h"
+#include "MultiTracker.h"
+#include "VideoReader.h"
+#include "SharedPtr.h"
+
+namespace suanzi{
+
+class EngineObserver;
+
+TK_DECLARE_PTR(Engine);
+
+class Engine
+{
+public:
+    static EnginePtr create();
+    void destroy();
+    virtual ~Engine();
+
+    virtual void start();
+    void addObserver(EngineObserver* o);
+    void setVideoSrc(VideoSrcType type, const std::string& url);
+
+private:
+    Engine();
+    void run();
+    DetectorPtr detector;
+    MultiTrackerPtr multiTracker;
+    std::set<EngineObserver *> observer_list;
+    //std::string videoSrc;
+    VideoReaderPtr reader;
+};
+
+struct Person
+{
+    typedef enum {
+        Male,
+        Female
+    } Gender;
+
+    typedef enum {
+        Kid,        // < 10
+        Teenager,   // 12 ~ 19
+        Adult_2,    // 20 - 30
+        Adult_3,    // 30 - 40
+        Adult_4,    // 40 - 50
+        Adult_5,    // 50 - 60
+        Elder       // > 60
+    } Ages;
+
+    unsigned long id = 0x001;
+    Gender gender = Female;
+    Ages age = Kid;
+
+    std::string ageToString (Ages age){
+        switch (age){
+        case Kid: return "Kid";
+        case Teenager: return "Teenager";
+        default: return "no";
+        }
+    }
+
+    std::string toString(){
+        std::stringstream ss;
+        ss << "Person: id=" << id << ". Gender:" << (gender == Gender::Male ? "Male" : "Female" ) <<
+            ". Age: " << ageToString(age);
+        return ss.str();
+    }
+};
+
+class EngineObserver
+{
+public:
+    //virtual void onPersonIn(std::set<Person> persons) = 0;
+    virtual void onPersonIn(Person& p) = 0;
+    virtual void onPersonOut(Person& p) = 0;
+};
+
+} // namespace suanzi
+
+#endif /* _ENGINE_H_ */
diff --git a/include/Logger.h b/include/Logger.h
new file mode 100644 (file)
index 0000000..a97a9a4
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef _LOGGER_H_
+#define _LOGGER_H_
+
+#include <log4cpp/Category.hh>
+#include <log4cpp/PropertyConfigurator.hh>
+
+extern log4cpp::Category * gLogger;
+
+#define LOG_DEBUG(TAG, msg)  LOG4CPP_DEBUG_S((*gLogger)) << '[' << TAG << ']' <<" ("<<__FILE__<<":"<<__LINE__<<") - " << msg;
+#define LOG_INFO(TAG, msg)   LOG4CPP_INFO_S((*gLogger)) << '[' << TAG << ']' <<" ("<<__FILE__<<":"<<__LINE__<<") - " << msg;
+#define LOG_WARN(TAG, msg)   LOG4CPP_WARN_S((*gLogger)) << '[' << TAG << ']' <<" ("<<__FILE__<<":"<<__LINE__<<") - " << msg;
+#define LOG_ERROR(TAG, msg)  LOG4CPP_ERROR_S((*gLogger)) << '[' << TAG << ']' <<" ("<<__FILE__<<":"<<__LINE__<<") - " << msg;
+#define LOG_FATAL(TAG, msg)  LOG4CPP_FATAL_S((*gLogger)) << '[' << TAG << ']' <<" ("<<__FILE__<<":"<<__LINE__<<") - " << msg;
+
+void initLogger(const char* fname);
+
+#endif /* _LOGGER_H_ */
diff --git a/include/Metrics.h b/include/Metrics.h
new file mode 100644 (file)
index 0000000..c991d9f
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _METRICS_H_
+#define _METRICS_H_
+
+#include <string>
+#include <opencv2/opencv.hpp>
+#include "SharedPtr.h"
+
+namespace suanzi {
+
+    TK_DECLARE_PTR(Metrics);
+    TK_DECLARE_PTR(Patch);
+    class Metrics
+    {
+    public:
+        Metrics(const std::string& cl_path = "");
+        ~Metrics(){}
+        const static long int MaxCost = 100000;
+        const static int MaxPatch = 5;
+
+    private:
+        cv::HOGDescriptor descriptor = {cv::Size(64, 128), cv::Size(16, 16), cv::Size(8, 8), cv::Size(8, 8), 9};
+    };
+
+    class Patch
+    {
+    public:
+        Patch(){};
+        ~Patch(){};
+    };
+
+}
+
+#endif /* _METRICS_H_ */
diff --git a/include/MultiTracker.h b/include/MultiTracker.h
new file mode 100644 (file)
index 0000000..0fd1d3a
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _MULTI_TRACKER_H_
+#define _MULTI_TRACKER_H_
+
+#include "Tracker.h"
+#include "Detector.h"
+#include "Metrics.h"
+#include "SharedPtr.h"
+#include <opencv2/opencv.hpp>
+
+namespace suanzi {
+
+    TK_DECLARE_PTR(MultiTracker);
+
+    class MultiTracker 
+    {
+    public:
+        MultiTracker(MetricsPtr m);
+        virtual ~MultiTracker();
+        void update(unsigned int total, const Detection* d, const cv::Mat& image);
+
+    private:
+        MetricsPtr metrics;
+        std::set<TrackerPtr> trackers;
+        int max_id = 0;
+        void addTracker(TrackerPtr t);
+        TrackerPtr createTracker(int id = 0);
+        void removeTracker(TrackerPtr t);
+        void correctTrackers(MetricsPtr m, cv::Mat& image);
+        void initNewTrackers(cv::Mat& iamge);
+    };
+
+
+}
+
+#endif /* _MULTI_TRACKER_H_ */
diff --git a/include/SharedPtr.h b/include/SharedPtr.h
new file mode 100644 (file)
index 0000000..9b13584
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef _SHARED_PTR_H_
+#define _SHARED_PTR_H_
+
+#include <memory>
+#ifndef TK_DECLARE_PTR
+#define  TK_DECLARE_PTR(className) \
+    class className; \
+    typedef std::shared_ptr<className> className##Ptr; \
+    typedef std::weak_ptr<className> className##WPtr;
+#endif
+
+#endif /* _SHARED_PTR_H_ */
diff --git a/include/Tracker.h b/include/Tracker.h
new file mode 100644 (file)
index 0000000..490201a
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef _TRACKER_H_
+#define _TRACKER_H_
+
+#include <opencv2/opencv.hpp>
+#include <string>
+#include <vector>
+#include "Metrics.h"
+#include "SharedPtr.h"
+
+namespace suanzi {
+
+    typedef enum 
+    {
+        Fire = -1,
+        Active = 2,
+        Lost,
+        Delete
+    } TrackerStatus;
+
+    TK_DECLARE_PTR(Tracker);
+//    TK_DECLARE_PTR(KalmanFilter);
+    class Tracker
+    {
+    public:
+        Tracker(int id);
+        virtual ~Tracker();
+        void updateState(const cv::Mat& image);
+        void addPatch(Patch* p);
+        TrackerStatus status;
+
+    private:
+        TrackerStatus preStatus;
+        int id;
+        int age;
+        int last_active;
+        std::vector<Patch *> patches;
+        cv::KalmanFilter kf = {4,2};
+    };
+
+//    class KalmanFilter
+//    {
+//    public:
+//        KalmanFilter();
+//        ~KalmanFilter();
+//    private:
+//        cv::KalmanFilter
+//
+//    };
+
+
+}
+
+#endif /* _TRACKER_H_ */
diff --git a/include/VideoReader.h b/include/VideoReader.h
new file mode 100644 (file)
index 0000000..79d39d0
--- /dev/null
@@ -0,0 +1,68 @@
+#ifndef _IVIDEO_READER_H_
+#define _IVIDEO_READER_H_
+
+#include "SharedPtr.h"
+#include <string>
+#include <opencv2/opencv.hpp>
+
+namespace suanzi {
+
+    typedef enum {
+        URL,
+        File,
+        USB
+    } VideoSrcType;
+
+    TK_DECLARE_PTR(VideoReaderFactory);
+    TK_DECLARE_PTR(VideoReader);
+    TK_DECLARE_PTR(URLReader);
+
+    class VideoReaderFactory
+    {
+        public:
+            static VideoReaderPtr createVideoReader(VideoSrcType type, const std::string& url);
+    };
+
+    class VideoReader
+    {
+        public:
+            VideoReader(VideoSrcType type, const std::string& url) : type(type), url(url){}
+
+            virtual ~VideoReader();
+            virtual bool read(cv::Mat& mat){return true;}
+
+        private:
+            VideoSrcType type;
+
+        protected:
+            std::string url;
+    };
+
+    class UrlReader  : public VideoReader
+    {
+        public:
+            UrlReader(VideoSrcType type, const std::string& url);
+            virtual ~UrlReader();
+            bool read(cv::Mat& mat);
+        private:
+            cv::VideoCapture vcap;
+    };
+
+    class FileReader : public VideoReader
+    {
+        public:
+            FileReader(VideoSrcType type, const std::string& url):VideoReader(type, url){}
+        //    void read(){};
+    };
+
+    class UsbReader : public VideoReader
+    {
+        public:
+            UsbReader(VideoSrcType type, const std::string& url):VideoReader(type, url){}
+        //    void read(){};
+    };
+
+}
+
+
+#endif /* _IVIDEO_READER_H_ */
diff --git a/include/VideoSource.h b/include/VideoSource.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/include/test.h b/include/test.h
new file mode 100644 (file)
index 0000000..cf43d54
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef __TEST_H__
+#define __TEST_H__
+
+int sum(int a, int b);
+
+#endif // __TEST_H__
index 83affc2..1dbaef5 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -1,7 +1,7 @@
 #include<iostream>
-#include "src/Engine.h"
+#include "Engine.h"
 #include <string>
-#include "src/Logger.h"
+#include "Logger.h"
 
 #define TAG "Main"
 
diff --git a/src/Detector.h b/src/Detector.h
deleted file mode 100644 (file)
index edf875c..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef _DETECTOR_H_
-#define _DETECTOR_H_
-
-#include "VideoReader.h"
-#include "SharedPtr.h"
-
-namespace suanzi {
-
-    struct Detection;
-
-    TK_DECLARE_PTR(Detector);
-    class Detector
-    {
-    public:
-        Detector();
-        virtual ~Detector();
-        unsigned int detect(cv::Mat& frame, Detection* detections){return 1;}
-    };
-
-    struct Detection
-    {
-        // 检测目标的类型,目前只有一个类human,默认等于0。为以后可以检测的更多类别预留
-        unsigned int object_type;
-        // 检测目标的分数,可以不填
-        float score;
-        // 检测目标的坐标,包括物体中心的x、y坐标,物体的高和宽
-        unsigned int center_x;
-        unsigned int center_y;
-        unsigned int height;
-        unsigned int width;
-        // 检测目标的特征向量
-        unsigned int feature_size;
-        float * feature;
-    };
-
-}
-
-
-#endif /* _DETECTOR_H_ */
-
-
diff --git a/src/Engine.h b/src/Engine.h
deleted file mode 100644 (file)
index 5405539..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef _ENGINE_H_
-#define _ENGINE_H_
-
-#include<string>
-#include<sstream>
-#include<set>
-#include "Tracker.h"
-#include "Detector.h"
-#include "MultiTracker.h"
-#include "VideoReader.h"
-#include "SharedPtr.h"
-
-namespace suanzi{
-
-class EngineObserver;
-
-TK_DECLARE_PTR(Engine);
-
-class Engine
-{
-public:
-    static EnginePtr create();
-    void destroy();
-    virtual ~Engine();
-
-    virtual void start();
-    void addObserver(EngineObserver* o);
-    void setVideoSrc(VideoSrcType type, const std::string& url);
-
-private:
-    Engine();
-    void run();
-    DetectorPtr detector;
-    MultiTrackerPtr multiTracker;
-    std::set<EngineObserver *> observer_list;
-    //std::string videoSrc;
-    VideoReaderPtr reader;
-};
-
-struct Person
-{
-    typedef enum {
-        Male,
-        Female
-    } Gender;
-
-    typedef enum {
-        Kid,        // < 10
-        Teenager,   // 12 ~ 19
-        Adult_2,    // 20 - 30
-        Adult_3,    // 30 - 40
-        Adult_4,    // 40 - 50
-        Adult_5,    // 50 - 60
-        Elder       // > 60
-    } Ages;
-
-    unsigned long id = 0x001;
-    Gender gender = Female;
-    Ages age = Kid;
-
-    std::string ageToString (Ages age){
-        switch (age){
-        case Kid: return "Kid";
-        case Teenager: return "Teenager";
-        default: return "no";
-        }
-    }
-
-    std::string toString(){
-        std::stringstream ss;
-        ss << "Person: id=" << id << ". Gender:" << (gender == Gender::Male ? "Male" : "Female" ) <<
-            ". Age: " << ageToString(age);
-        return ss.str();
-    }
-};
-
-class EngineObserver
-{
-public:
-    //virtual void onPersonIn(std::set<Person> persons) = 0;
-    virtual void onPersonIn(Person& p) = 0;
-    virtual void onPersonOut(Person& p) = 0;
-};
-
-} // namespace suanzi
-
-#endif /* _ENGINE_H_ */
diff --git a/src/Logger.h b/src/Logger.h
deleted file mode 100644 (file)
index a97a9a4..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _LOGGER_H_
-#define _LOGGER_H_
-
-#include <log4cpp/Category.hh>
-#include <log4cpp/PropertyConfigurator.hh>
-
-extern log4cpp::Category * gLogger;
-
-#define LOG_DEBUG(TAG, msg)  LOG4CPP_DEBUG_S((*gLogger)) << '[' << TAG << ']' <<" ("<<__FILE__<<":"<<__LINE__<<") - " << msg;
-#define LOG_INFO(TAG, msg)   LOG4CPP_INFO_S((*gLogger)) << '[' << TAG << ']' <<" ("<<__FILE__<<":"<<__LINE__<<") - " << msg;
-#define LOG_WARN(TAG, msg)   LOG4CPP_WARN_S((*gLogger)) << '[' << TAG << ']' <<" ("<<__FILE__<<":"<<__LINE__<<") - " << msg;
-#define LOG_ERROR(TAG, msg)  LOG4CPP_ERROR_S((*gLogger)) << '[' << TAG << ']' <<" ("<<__FILE__<<":"<<__LINE__<<") - " << msg;
-#define LOG_FATAL(TAG, msg)  LOG4CPP_FATAL_S((*gLogger)) << '[' << TAG << ']' <<" ("<<__FILE__<<":"<<__LINE__<<") - " << msg;
-
-void initLogger(const char* fname);
-
-#endif /* _LOGGER_H_ */
diff --git a/src/Metrics.h b/src/Metrics.h
deleted file mode 100644 (file)
index c991d9f..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _METRICS_H_
-#define _METRICS_H_
-
-#include <string>
-#include <opencv2/opencv.hpp>
-#include "SharedPtr.h"
-
-namespace suanzi {
-
-    TK_DECLARE_PTR(Metrics);
-    TK_DECLARE_PTR(Patch);
-    class Metrics
-    {
-    public:
-        Metrics(const std::string& cl_path = "");
-        ~Metrics(){}
-        const static long int MaxCost = 100000;
-        const static int MaxPatch = 5;
-
-    private:
-        cv::HOGDescriptor descriptor = {cv::Size(64, 128), cv::Size(16, 16), cv::Size(8, 8), cv::Size(8, 8), 9};
-    };
-
-    class Patch
-    {
-    public:
-        Patch(){};
-        ~Patch(){};
-    };
-
-}
-
-#endif /* _METRICS_H_ */
diff --git a/src/MultiTracker.h b/src/MultiTracker.h
deleted file mode 100644 (file)
index 0fd1d3a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef _MULTI_TRACKER_H_
-#define _MULTI_TRACKER_H_
-
-#include "Tracker.h"
-#include "Detector.h"
-#include "Metrics.h"
-#include "SharedPtr.h"
-#include <opencv2/opencv.hpp>
-
-namespace suanzi {
-
-    TK_DECLARE_PTR(MultiTracker);
-
-    class MultiTracker 
-    {
-    public:
-        MultiTracker(MetricsPtr m);
-        virtual ~MultiTracker();
-        void update(unsigned int total, const Detection* d, const cv::Mat& image);
-
-    private:
-        MetricsPtr metrics;
-        std::set<TrackerPtr> trackers;
-        int max_id = 0;
-        void addTracker(TrackerPtr t);
-        TrackerPtr createTracker(int id = 0);
-        void removeTracker(TrackerPtr t);
-        void correctTrackers(MetricsPtr m, cv::Mat& image);
-        void initNewTrackers(cv::Mat& iamge);
-    };
-
-
-}
-
-#endif /* _MULTI_TRACKER_H_ */
diff --git a/src/SharedPtr.h b/src/SharedPtr.h
deleted file mode 100644 (file)
index 9b13584..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _SHARED_PTR_H_
-#define _SHARED_PTR_H_
-
-#include <memory>
-#ifndef TK_DECLARE_PTR
-#define  TK_DECLARE_PTR(className) \
-    class className; \
-    typedef std::shared_ptr<className> className##Ptr; \
-    typedef std::weak_ptr<className> className##WPtr;
-#endif
-
-#endif /* _SHARED_PTR_H_ */
diff --git a/src/Tracker.h b/src/Tracker.h
deleted file mode 100644 (file)
index 490201a..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef _TRACKER_H_
-#define _TRACKER_H_
-
-#include <opencv2/opencv.hpp>
-#include <string>
-#include <vector>
-#include "Metrics.h"
-#include "SharedPtr.h"
-
-namespace suanzi {
-
-    typedef enum 
-    {
-        Fire = -1,
-        Active = 2,
-        Lost,
-        Delete
-    } TrackerStatus;
-
-    TK_DECLARE_PTR(Tracker);
-//    TK_DECLARE_PTR(KalmanFilter);
-    class Tracker
-    {
-    public:
-        Tracker(int id);
-        virtual ~Tracker();
-        void updateState(const cv::Mat& image);
-        void addPatch(Patch* p);
-        TrackerStatus status;
-
-    private:
-        TrackerStatus preStatus;
-        int id;
-        int age;
-        int last_active;
-        std::vector<Patch *> patches;
-        cv::KalmanFilter kf = {4,2};
-    };
-
-//    class KalmanFilter
-//    {
-//    public:
-//        KalmanFilter();
-//        ~KalmanFilter();
-//    private:
-//        cv::KalmanFilter
-//
-//    };
-
-
-}
-
-#endif /* _TRACKER_H_ */
diff --git a/src/VideoReader.h b/src/VideoReader.h
deleted file mode 100644 (file)
index 79d39d0..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef _IVIDEO_READER_H_
-#define _IVIDEO_READER_H_
-
-#include "SharedPtr.h"
-#include <string>
-#include <opencv2/opencv.hpp>
-
-namespace suanzi {
-
-    typedef enum {
-        URL,
-        File,
-        USB
-    } VideoSrcType;
-
-    TK_DECLARE_PTR(VideoReaderFactory);
-    TK_DECLARE_PTR(VideoReader);
-    TK_DECLARE_PTR(URLReader);
-
-    class VideoReaderFactory
-    {
-        public:
-            static VideoReaderPtr createVideoReader(VideoSrcType type, const std::string& url);
-    };
-
-    class VideoReader
-    {
-        public:
-            VideoReader(VideoSrcType type, const std::string& url) : type(type), url(url){}
-
-            virtual ~VideoReader();
-            virtual bool read(cv::Mat& mat){return true;}
-
-        private:
-            VideoSrcType type;
-
-        protected:
-            std::string url;
-    };
-
-    class UrlReader  : public VideoReader
-    {
-        public:
-            UrlReader(VideoSrcType type, const std::string& url);
-            virtual ~UrlReader();
-            bool read(cv::Mat& mat);
-        private:
-            cv::VideoCapture vcap;
-    };
-
-    class FileReader : public VideoReader
-    {
-        public:
-            FileReader(VideoSrcType type, const std::string& url):VideoReader(type, url){}
-        //    void read(){};
-    };
-
-    class UsbReader : public VideoReader
-    {
-        public:
-            UsbReader(VideoSrcType type, const std::string& url):VideoReader(type, url){}
-        //    void read(){};
-    };
-
-}
-
-
-#endif /* _IVIDEO_READER_H_ */
diff --git a/src/VideoSource.h b/src/VideoSource.h
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/src/test.cpp b/src/test.cpp
new file mode 100644 (file)
index 0000000..fef6dc4
--- /dev/null
@@ -0,0 +1,8 @@
+#include "test.h"
+
+#include <iostream>
+
+int sum(int a, int b)
+{
+    return a + b;
+}
diff --git a/test/SConscript b/test/SConscript
new file mode 100644 (file)
index 0000000..7e05fba
--- /dev/null
@@ -0,0 +1,13 @@
+import sys, os
+
+Import('env')
+
+env1 = env.Clone()
+
+env1.Append(CPPPATH = ['#third_party/googletest/include'])
+env1.Append(LIBPATH = ['#third_party/googletest/lib'])
+env1['LIBS'] = ['tracker', 'gtest', 'pthread']
+
+obj = env1.Object(Glob("*.cpp"))
+
+env1.Program("TestMain", list(obj))
diff --git a/test/test-unittest.cpp b/test/test-unittest.cpp
new file mode 100644 (file)
index 0000000..a7459d6
--- /dev/null
@@ -0,0 +1,12 @@
+#include "test.h"
+#include "gtest/gtest.h"
+
+TEST(FactorialTest, Negative) {
+  // This test is named "Negative", and belongs to the "FactorialTest"
+  // test case.
+  EXPECT_EQ(2, sum(1, 2));
+  //EXPECT_GT(Factorial(-10), 0);
+
+}
+
+