91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

早vs2008 中基于opencv2.4.3 的meanshift目標檢測,直接運行,視屏從電腦的攝像頭讀取,演示效果不錯,適合初學目標檢測的同行,可以從感性上理解meanshift的原理和不足,為改進的camshift理解做準備。原理部分參見我的博客:http://blog.csdn.net/tiandijun,共同學習、交流。

資源截圖

代碼片段和文件信息

//#include?“StdAfx.h“

#include?“opencv2/video/tracking.hpp“
#include?“opencv2/imgproc/imgproc.hpp“
#include?“opencv2/highgui/highgui.hpp“


#include?
#include?

using?namespace?cv;
using?namespace?std;

Mat?image;

bool?backprojMode?=?false;?//表示是否要進入反向投影模式,ture表示準備進入反向投影模式
bool?selectobject?=?false;//代表是否在選要跟蹤的初始目標,true表示正在用鼠標選擇
int?trackobject?=?0;?//代表跟蹤目標數目
bool?showHist?=?true;//是否顯示直方圖
Point?origin;//用于保存鼠標選擇第一次單擊時點的位置
Rect?selection;//用于保存鼠標選擇的矩形框
int?vmin?=?10?vmax?=?256?smin?=?30;

void?onMouse(?int?event?int?x?int?y?int?void*?)
{
????if(?selectobject?)//只有當鼠標左鍵按下去時才有效,然后通過if里面代碼就可以確定所選擇的矩形區域selection了
????{
????????selection.x?=?MIN(x?origin.x);//矩形左上角頂點坐標
????????selection.y?=?MIN(y?origin.y);
????????selection.width?=?std::abs(x?-?origin.x);//矩形寬
????????selection.height?=?std::abs(y?-?origin.y);//矩形高

????????selection?&=?Rect(0?0?image.cols?image.rows);//用于確保所選的矩形區域在圖片范圍內
????}

????switch(?event?)
????{
????case?CV_EVENT_LBUTTONDOWN:
????????origin?=?Point(xy);
????????selection?=?Rect(xy00);//鼠標剛按下去時初始化了一個矩形區域
????????selectobject?=?true;
????????break;
????case?CV_EVENT_LBUTTONUP:
????????selectobject?=?false;
????????if(?selection.width?>?0?&&?selection.height?>?0?)
????????????trackobject?=?-1;
????????break;
????}
}

void?help()
{
????cout?<sed?tracking\n“
????????“You?select?a?color?objects?such?as?your?face?and?it?tracks?it.\n“
????????“This?reads?from?video?camera?(0?by?default?or?the?camera?number?the?user?enters\n“
????????“Usage:?\n“
????????“????./camshiftdemo?[camera?number]\n“;

????cout?<????????“\tESC?-?quit?the?program\n“
????????“\tc?-?stop?the?tracking\n“
????????“\tb?-?switch?to/from?backprojection?view\n“
????????“\th?-?show/hide?object?histogram\n“
????????“\tp?-?pause?video\n“
????????“To?initialize?tracking?select?the?object?with?mouse\n“;
}

const?char*?keys?=?
{
????“{1|??|?0?|?camera?number}“
};

int?main(?int?argc?const?char**?argv?)
{
????help();

????VideoCapture?cap;?//定義一個攝像頭捕捉的類對象
????Rect?trackWindow;
????RotatedRect?trackBox;//定義一個旋轉的矩陣類對象
????int?hsize?=?16;
????float?hranges[]?=?{0180};//hranges在后面的計算直方圖函數中要用到
????const?float*?phranges?=?hranges;
????CommandLineParser?parser(argc?argv?keys);//命令解析器函數
????int?camNum?=?parser.get(“1“);?????

????cap.open(camNum);//直接調用成員函數打開攝像頭

????if(?!cap.isOpened()?)
????{
????????help();
????????cout?<????????cout?<????????parser.printParams();
????????return?-1;
????}

????namedWindow(?“Histogram“?0?);
????namedWindow(?“CamShift?Demo“?0?);
????setMouseCallback(?“CamShift?Demo“?onMouse?0?);//消息響應機制
????createTrackbar(?“Vmin“?“CamShift?Demo“?&vmin?256?0?);//createTrackbar函數的功能是在對應的窗口創建滑動條,滑動條Vminvmin表示滑動條的值,最大為256
????createTrackbar(?“Vmax“?“CamShift?Demo“?&vmax

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????10038??2014-06-18?10:43??2014-06-18?MeanShift\2014-06-18?MeanShift\2014-06-18?MeanShift.cpp

?????文件???????4785??2014-06-18?10:43??2014-06-18?MeanShift\2014-06-18?MeanShift\2014-06-18?MeanShift.vcproj

?????文件???????1425??2014-06-18?21:07??2014-06-18?MeanShift\2014-06-18?MeanShift\2014-06-18?MeanShift.vcproj.PC201310041721.Administrator.user

?????文件????????663??2014-06-18?10:44??2014-06-18?MeanShift\2014-06-18?MeanShift\Debug\2014-06-18?MeanShift.exe.embed.manifest

?????文件????????728??2014-06-18?10:44??2014-06-18?MeanShift\2014-06-18?MeanShift\Debug\2014-06-18?MeanShift.exe.embed.manifest.res

?????文件????????621??2014-06-18?10:44??2014-06-18?MeanShift\2014-06-18?MeanShift\Debug\2014-06-18?MeanShift.exe.intermediate.manifest

?????文件?????363539??2014-06-18?10:43??2014-06-18?MeanShift\2014-06-18?MeanShift\Debug\2014-06-18?MeanShift.obj

?????文件??????14644??2014-06-18?10:44??2014-06-18?MeanShift\2014-06-18?MeanShift\Debug\BuildLog.htm

?????文件?????????65??2014-06-18?10:44??2014-06-18?MeanShift\2014-06-18?MeanShift\Debug\mt.dep

?????文件?????289792??2014-06-18?10:43??2014-06-18?MeanShift\2014-06-18?MeanShift\Debug\vc90.idb

?????文件?????520192??2014-06-18?10:43??2014-06-18?MeanShift\2014-06-18?MeanShift\Debug\vc90.pdb

?????文件????3517440??2014-06-18?21:07??2014-06-18?MeanShift\2014-06-18?MeanShift.ncb

?????文件????????926??2014-06-18?10:42??2014-06-18?MeanShift\2014-06-18?MeanShift.sln

????..A..H.??????8704??2014-06-18?21:07??2014-06-18?MeanShift\2014-06-18?MeanShift.suo

?????文件??????97280??2014-06-18?10:44??2014-06-18?MeanShift\Debug\2014-06-18?MeanShift.exe

?????文件?????638544??2014-06-18?10:44??2014-06-18?MeanShift\Debug\2014-06-18?MeanShift.ilk

?????文件????1207296??2014-06-18?10:44??2014-06-18?MeanShift\Debug\2014-06-18?MeanShift.pdb

?????目錄??????????0??2014-06-18?10:44??2014-06-18?MeanShift\2014-06-18?MeanShift\Debug

?????目錄??????????0??2014-06-18?10:43??2014-06-18?MeanShift\2014-06-18?MeanShift

?????目錄??????????0??2014-06-18?10:44??2014-06-18?MeanShift\Debug

?????目錄??????????0??2014-06-18?10:43??2014-06-18?MeanShift

-----------?---------??----------?-----??----

??????????????6676682????????????????????21


評論

共有 條評論