资源简介
利用团块技术实现车辆视频检测与跟踪,测试效果比较理想。
代码片段和文件信息
////////////////////////////////////////////////////////////////////////////////////
//
// //// /////// // // // // // //////
// // // // // // //// //// // // //
// // // ////// // // // // // // //
// // // // // // // // /////// //
// //// ////// // // // // // // //////
//
//objdetect.cpp
//
//ObjDetect 0.5.0 Alpha
//
//Dexmac 2011
//
//www.opencvchina.com
//www.dexmac.com
//
// GNU General Public License Usage
// Alternatively this file may be used under the terms of the GNU
// General Public License version 3.0 as published by the Free Software
// Foundation and appearing in the file LICENSE.GPL included in the
// packaging of this file. Please review the following information to
// ensure the GNU General Public License version 3.0 requirements will be
// met: http://www.gnu.org/copyleft/gpl.html.
///////////////////////////////////////////////////////////////////////////////////
#include
#include
#include
#include
#include
#include “opencv2/objdetect/objdetect.hpp“
#include “opencv2/highgui/highgui.hpp“
#include “opencv2/imgproc/imgproc.hpp“
#include “opencv2/video/tracking.hpp“
#include “opencv2/video/background_segm.hpp“
using namespace std;
using namespace cv;
//params
#define FAST_UPDATE 0.8
#define SLOW_UPDATE 0.999999
#define TH 14
#define DISTANCE 2.0
#define STILL_frame 512
#define MERGED_BLOB_DISTANCE 50.0
#define MIN_CONTOUR_SIZE 100
#define DEXMAC_SEGMENT
//#define MOG2_SEGMENT
#define WIN_SEGMENT_DEBUG
#define IMAGE_DIFFERENCE
//#define COLOR_TRACKER
//#define object_TRACKER
#define VERBOSE
//#define VERBOSE_MERGE
#define HSTG
//#define HSTC
#define DRAWING_TRACE
//#define RED_TRACK
//#define GREEN_TRACK
#define BLUE_TRACK
//#define YELLOW_TRACK
#ifdef RED_TRACK
#define MINB 0
#define MAXB 0
#define MING 0
#define MAXG 0
#define MINR 180
#define MAXR 200
#endif
#ifdef GREEN_TRACK
#define MINB 0
#define MAXB 0
#define MING 220
#define MAXG 240
#define MINR 0
#define MAXR 0
#endif
#ifdef BLUE_TRACK
#define MINB 200
#define MAXB 220
#define MING 0
#define MAXG 0
#define MINR 0
#define MAXR 0
#endif
#ifdef YELLOW_TRACK
#define MINB 0
#define MAXB 0
#define MING 220
#define MAXG 240
#define MINR 180
#define MAXR 200
#endif
//macros
#define MAX_VAL(ab) a>b ? a : b;
#define MIN_VAL(ab) a
String cascadeName = “../../data/haarcascades/haarcascade_frontalface_alt.xml“;
String nestedCascadeName = “../../data/haarcascades/haarcascade_eye_tree_eyeglasses.xml“;
typedef struct _coord {
int px;
int py;
} coord;
//blob class
class blob
{
public:
blob(){
min_x=0;
min_y=0;
max_x=0;
max_y=0;
id=0;
bar_x=0;
bar_y=0;
live_frame=0;
still_frame=0;
area=0;
coords.clear();
};
public:
int min_x;
int min_y;
int max_x
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 38027 2012-05-27 15:56 源码\blob_tracker\blob_tracker.cpp
文件 1182720 2012-05-27 15:51 源码\blob_tracker\blob_tracker.ncb
文件 888 2012-05-27 15:30 源码\blob_tracker\blob_tracker.sln
..A..H. 10240 2012-05-27 15:51 源码\blob_tracker\blob_tracker.suo
文件 4462 2012-05-27 15:38 源码\blob_tracker\blob_tracker.vcproj
文件 1405 2012-05-27 15:51 源码\blob_tracker\blob_tracker.vcproj.庞锋.Administrator.user
文件 980 2012-05-27 15:30 源码\blob_tracker\ReadMe.txt
文件 217 2012-05-27 15:30 源码\blob_tracker\stdafx.cpp
文件 276 2012-05-27 15:30 源码\blob_tracker\stdafx.h
目录 0 2012-06-16 18:17 源码\blob_tracker\Debug
目录 0 2012-06-16 18:18 源码\blob_tracker
目录 0 2012-05-27 15:52 源码
----------- --------- ---------- ----- ----
1239215 12
评论
共有 条评论