資源簡(jiǎn)介
對(duì)海康威視相機(jī)進(jìn)行二次開(kāi)發(fā),拼接多個(gè)相機(jī)模塊,形成全景圖像。該代碼塊在時(shí)vs2012+opencv2.4.13+HIKSDK完成的
代碼片段和文件信息
#include???
#include???
#include???
#include?“HCNetSDK.h“??
#include?“PlayM4.h“
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
//#include?
#define?USECOLOR?1??
using?namespace?std;??
using?namespace?cv;?
//--------------------------------------------??
int?iPicNum=1;//Set?channel?NO.??
LONG?nPort=-1;??
HWND?hWnd=0;???
const?double?MHI_DURATION?=?0.5;
const?double?MAX_TIME_DELTA?=?0.5;
const?double?MIN_TIME_DELTA?=?0.05;
const?int?N?=?3;
//
const?int?CONTOUR_MAX_AERA?=?16;
//?ring?image?buffer
IplImage?**buf?=?0;
int?last?=?0;
//CvFilter?filter?=?CV_GAUSSIAN_5x5;
CvConnectedComp?*cur_comp?min_comp;
CvConnectedComp?comp;
CvMemStorage?*storage;
CvPoint?pt[4];
void?OpenCvQuote(IplImage*?img)
{
Mat?srcImage(img);
Mat?grayImage?out_Canny;
cvShowImage(“picture01“img);
cvWaitKey(1);
cvtColor(srcImage?grayImage?COLOR_BGR2GRAY);
blur(grayImage?grayImage?Size(3?3));
Canny(grayImage?out_Canny?50?250?*2?3);
imshow(“picture02“out_Canny);
}
//change?vedio?format?from?yv12?to?YUV
void?yv12toYUV(char?*outYuv?char?*inYv12?int?width?int?heightint?widthStep)??
{??
???int?colrow;??
???unsigned?int?YUV;??
???int?tmp;??
???int?idx;???
???for?(row=0;?row ???{??
??????idx=row?*?widthStep;??
??????int?rowptr=row*width;??
??????for?(col=0;?col ??????{??
?????????//int?colhalf=col>>1;??
?????????tmp?=?(row/2)*(width/2)+(col/2);????
?????????Y=(unsigned?int)?inYv12[row*width+col];??
?????????U=(unsigned?int)?inYv12[width*height+width*height/4+tmp];??
?????????V=(unsigned?int)?inYv12[width*height+tmp];??
?????????outYuv[idx+col*3]???=?Y;??
?????????outYuv[idx+col*3+1]?=?U;??
?????????outYuv[idx+col*3+2]?=?V;??
??????}??
???}????
}??
//解碼回調(diào)?視頻為YUV數(shù)據(jù)(YV12),音頻為PCM數(shù)據(jù)??
void?CALLBACK?DecCBFun(long?nPortchar?*?pBuflong?nSizeframe_INFO?*?pframeInfo?long?nReserved1long?nReserved2)??
{??
????long?lframeType?=?pframeInfo->nType;??
????if(lframeType?==T_YV12)??//YV12
????{??
????IplImage*?pImgYCrCb?=?cvCreateImage(cvSize(pframeInfo->nWidthpframeInfo->nHeight)?IPL_DEPTH_8U?3);//得到圖像的Y分量????
????yv12toYUV(pImgYCrCb->imageData?pBuf?pframeInfo->nWidthpframeInfo->nHeightpImgYCrCb->widthStep);//得到全部RGB圖像??
???//申請(qǐng)內(nèi)存
????IplImage*?pImg?=?cvCreateImage(cvSize(pframeInfo->nWidthpframeInfo->nHeight)?IPL_DEPTH_8U?3);??
????IplImage*?motion?=?cvCreateImage(cvSize(pframeInfo->nWidthpframeInfo->nHeight)?IPL_DEPTH_8U?1);
????cvCvtColor(pImgYCrCbpImgCV_YCrCb2RGB);
OpenCvQuote(pImg);
????//update_mhi(?pImg?motion?60?);?
????//cvShowImage(?“motion“?pImg?);
???//?cvWaitKey(1);
????cvReleaseImage(&pImgYCrCb);?
????cvReleaseImag
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件?????152576??2018-05-29?20:29??HIK_motion\Debug\AudioRender.dll
?????文件?????410624??2018-05-29?20:29??HIK_motion\Debug\EagleEyeRender.dll
?????文件????1645320??2018-05-29?20:29??HIK_motion\Debug\gdiplus.dll
?????文件????1486336??2018-05-29?20:31??HIK_motion\Debug\HCCore.dll
?????文件?????675328??2018-05-29?20:35??HIK_motion\Debug\HCNetSDK.dll
?????文件?????433664??2018-05-29?20:29??HIK_motion\Debug\HCNetSDKCom\AnalyzeData.dll
?????文件?????610816??2018-05-29?20:29??HIK_motion\Debug\HCNetSDKCom\AudioIntercom.dll
?????文件?????506368??2018-05-29?20:33??HIK_motion\Debug\HCNetSDKCom\HCAlarm.dll
?????文件??????14822??2018-05-29?20:33??HIK_motion\Debug\HCNetSDKCom\HCAlarm.lib
?????文件?????836608??2018-05-29?20:32??HIK_motion\Debug\HCNetSDKCom\HCCoreDevCfg.dll
?????文件?????616960??2018-05-29?20:34??HIK_motion\Debug\HCNetSDKCom\HCDisplay.dll
?????文件????1083904??2018-05-29?20:34??HIK_motion\Debug\HCNetSDKCom\HCGeneralCfgMgr.dll
?????文件??????49402??2018-05-29?20:33??HIK_motion\Debug\HCNetSDKCom\HCGeneralCfgMgr.lib
?????文件?????797696??2018-05-29?20:33??HIK_motion\Debug\HCNetSDKCom\HCIndustry.dll
?????文件?????472064??2018-05-29?20:33??HIK_motion\Debug\HCNetSDKCom\HCPlayBack.dll
?????文件?????624128??2018-05-29?20:33??HIK_motion\Debug\HCNetSDKCom\HCPreview.dll
?????文件??????38128??2018-05-29?20:33??HIK_motion\Debug\HCNetSDKCom\HCPreview.lib
?????文件?????601600??2018-05-29?20:33??HIK_motion\Debug\HCNetSDKCom\HCVoiceTalk.dll
?????文件?????978432??2018-05-29?20:29??HIK_motion\Debug\HCNetSDKCom\libiconv2.dll
?????文件?????655872??2018-05-29?20:29??HIK_motion\Debug\HCNetSDKCom\msvcr90.dll
?????文件?????389632??2018-05-29?20:29??HIK_motion\Debug\HCNetSDKCom\OpenAL32.dll
?????文件?????638464??2018-05-29?20:29??HIK_motion\Debug\HCNetSDKCom\StreamTransClient.dll
?????文件?????655360??2018-05-29?20:29??HIK_motion\Debug\HCNetSDKCom\SystemTransform.dll
?????文件??????70144??2018-07-30?18:02??HIK_motion\Debug\HIK_motion.exe
?????文件?????749492??2018-07-30?18:02??HIK_motion\Debug\HIK_motion.ilk
?????文件????2239488??2018-07-30?18:02??HIK_motion\Debug\HIK_motion.pdb
?????文件????1325056??2018-05-29?20:29??HIK_motion\Debug\HWDecode.dll
?????文件????1273927??2018-05-29?20:29??HIK_motion\Debug\libeay32.dll
?????文件?????355328??2018-05-29?20:29??HIK_motion\Debug\MP_Render.dll
?????文件????3399749??2018-05-29?20:29??HIK_motion\Debug\MP_VIE.dll
............此處省略40個(gè)文件信息
評(píng)論
共有 條評(píng)論