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

  • 大小: 18.61MB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2023-07-06
  • 語言: 其他
  • 標簽: 霍夫變換??

資源簡介

利用霍夫變換實現了在一小段的足球視頻中對足球的識別和跟蹤,并將追蹤到的足球畫面截屏按幀保存。里面包含了可以實現的完整的代碼和視頻文件,運行環境是VS2010和OpenCV2.4.9(VS2012也能運行出來),這個是圖像處理課老師給的一個課題,有需要的可以下載參考!

資源截圖

代碼片段和文件信息

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

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


void?colorFilter(CvMat?*inputImage?CvMat?*&outputImage)??
{??
int?i?j;??
IplImage*?image?=?cvCreateImage(cvGetSize(inputImage)?8?3);??
cvGetImage(inputImage?image);??????
IplImage*?hsv?=?cvCreateImage(?cvGetSize(image)?8?3?);????

cvCvtColor(imagehsvCV_BGR2HSV);??
int?width?=?hsv->width;??
int?height?=?hsv->height;??
for?(i?=?0;?i? for?(j?=?0;?j? {??
CvScalar?s_hsv?=?cvGet2D(hsv?i?j);//獲取像素點為(j?i)點的HSV的值???
/*?
opencv?的H范圍是0~180,紅色的H范圍大概是(0~8)∪(160180)??
S是飽和度,一般是大于一個值S過低就是灰色(參考值S>80),?
V是亮度,過低就是黑色,過高就是白色(參考值220>V>50)。?
*/??
CvScalar?s;??
// if?(!(((s_hsv.val[0]>0)&&(s_hsv.val[0]<8))?||?(s_hsv.val[0]>120)&&(s_hsv.val[0]<180)))
if(((s_hsv.val[0]>0)&&(s_hsv.val[0]<180))&&(s_hsv.val[1]>0)&&(s_hsv.val[1]<45)&&(s_hsv.val[2]>220)&&(s_hsv.val[2]<255))
{
s.val[0]?=180;??
s.val[1]=255;??
s.val[2]=255;??
cvSet2D(hsv?i?j?s);?
}
else
if(!((s_hsv.val[0]>35)&&(s_hsv.val[0]<77)))
{??
s.val[0]?=0;??
s.val[1]=0;??
s.val[2]=0;??
cvSet2D(hsv?i?j?s);??
}??
}??
outputImage?=?cvCreateMat(?hsv->height?hsv->width?CV_8UC3?);??
cvConvert(hsv?outputImage);??
cvNamedWindow(“filter“);??
cvShowImage(“filter“?hsv);??
waitKey(0);??
cvReleaseImage(&hsv);??
}??

bool?in_cricle(int?i?int?j?Point?center?int?radius)
{
double?dis?=?sqrt((center.x?-?i)*(center.x?-?i)?+?(center.y?-?j)*(center.y?-?j));
return?dis?}

void?show_histogram()
{

}

string?Int_to_String(int?n)

{

ostringstream?stream;

stream?<
return?stream.str();

}

Mat?get_circle(Mat?src?Point?center?int?radius)
{
Mat?tmp?=?src;
for?(int?i?=?0;?i? {
for?(int?j?=?0;?j? {
if?(!in_cricle(i?j?center?radius))
{
tmp.at(i?j)[0]?=?0;
tmp.at(i?j)[1]?=?0;
tmp.at(i?j)[2]?=?0;
}
}
}
return?tmp;
}
int?main()??
{??

VideoCapture?capture(“ball.avi“);
if?(!capture.isOpened())
{
cout?< return?0;
}

double?rate?=?capture.get(CV_CAP_PROP_FPS);
int?delay?=?1000?/?rate;
Mat?framecannygary;
vector?circles;

int?cnt?=?0;
string?path_head?=?“dribble/“;
string?path_tail?=?“.jpg“;
while?(true)
{
if?(!capture.read(frame))
break;
cvtColor(frame?gary?CV_BGR2GRAY);
GaussianBlur(gary?gary?Size(9?9)?2?2);
Canny(gary?canny?10?50);
threshold(gary?gary?190?255?THRESH_BINARY);
// bitwise_not(gary?gary);
imshow(“canny“?canny);

imshow(“gary“?gary);
circles.clear();
// HoughCircles(gary?circles?CV_HOUGH_GRADIENT?1.5?20?90?20?10?45

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-04-12?08:43??hough\
?????目錄???????????0??2017-04-12?08:43??hough\Debug\
?????文件??????105472??2017-04-11?21:23??hough\Debug\following.exe
?????文件??????731716??2017-04-11?21:23??hough\Debug\following.ilk
?????文件?????2780160??2017-04-11?21:23??hough\Debug\following.pdb
?????目錄???????????0??2017-04-12?08:53??hough\following\
?????文件?????4869294??2017-04-10?18:29??hough\following\1.avi
?????目錄???????????0??2017-04-12?08:44??hough\following\Debug\
?????文件???????16912??2017-04-10?18:28??hough\following\Debug\CL.read.1.tlog
?????文件?????????748??2017-04-10?18:28??hough\following\Debug\CL.write.1.tlog
?????文件????????2014??2017-04-10?18:28??hough\following\Debug\cl.command.1.tlog
?????文件??????????66??2017-04-10?18:28??hough\following\Debug\following.lastbuildstate
?????文件?????????734??2017-04-12?08:47??hough\following\Debug\following.log
?????目錄???????????0??2017-04-12?08:44??hough\following\Debug\following.tlog\
?????文件???????22648??2017-04-11?21:23??hough\following\Debug\following.tlog\CL.read.1.tlog
?????文件????????1198??2017-04-11?21:23??hough\following\Debug\following.tlog\CL.write.1.tlog
?????文件????????1982??2017-04-11?21:23??hough\following\Debug\following.tlog\cl.command.1.tlog
?????文件?????????163??2017-04-11?21:23??hough\following\Debug\following.tlog\following.lastbuildstate
?????文件????????9080??2017-04-11?21:23??hough\following\Debug\following.tlog\link.command.1.tlog
?????文件???????14526??2017-04-11?21:23??hough\following\Debug\following.tlog\link.read.1.tlog
?????文件????????1130??2017-04-11?21:23??hough\following\Debug\following.tlog\link.write.1.tlog
?????文件??????340463??2017-04-11?21:23??hough\following\Debug\followmain.obj
?????文件???????????2??2017-04-10?18:28??hough\following\Debug\link-cvtres.read.1.tlog
?????文件???????????2??2017-04-10?18:28??hough\following\Debug\link-cvtres.write.1.tlog
?????文件???????????2??2017-04-10?18:28??hough\following\Debug\link-rc.read.1.tlog
?????文件???????????2??2017-04-10?18:28??hough\following\Debug\link-rc.write.1.tlog
?????文件???????????2??2017-04-10?18:28??hough\following\Debug\link.3240-cvtres.read.1.tlog
?????文件???????????2??2017-04-10?18:28??hough\following\Debug\link.3240-cvtres.write.1.tlog
?????文件???????????2??2017-04-10?18:28??hough\following\Debug\link.3240-rc.read.1.tlog
?????文件???????????2??2017-04-10?18:28??hough\following\Debug\link.3240-rc.write.1.tlog
?????文件???????????2??2017-04-10?18:28??hough\following\Debug\link.3240.read.1.tlog
............此處省略64個文件信息

評論

共有 條評論