Skip to content

Commit

Permalink
比赛仅使用交通灯检测,放弃标志牌检测识别
Browse files Browse the repository at this point in the history
保存比赛视频
  • Loading branch information
JayYangSS committed Nov 14, 2015
1 parent bfaca4b commit 1a1948a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
35 changes: 20 additions & 15 deletions Main_TrafficSignRecognition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ int main()
RectBlueSVM.load("src//RectBlueTSR.xml");
}

openMP_MultiThreadVideo();
//openMP_MultiThreadCamera();
//openMP_MultiThreadVideo();
openMP_MultiThreadCamera();
cvReleaseMat(&g_mat);
system("pause");
}
Expand Down Expand Up @@ -778,7 +778,11 @@ void openMP_MultiThreadCamera()
Drogonfly_ImgRead p;
p.Camera_Intial();
#if IS_SAVE
CvVideoWriter *writer = cvCreateVideoWriter("cameraCapture6.avi",CV_FOURCC('X','V','I','D'),10,Size(800,600),1);
SYSTEMTIME stTime;
GetLocalTime(&stTime);
char *videoPath = new char[100];// "D:/123.dat";
sprintf(videoPath, "CamraVideo//Video_%04d%02d%02d%02d%02d%02d.avi", stTime.wYear, stTime.wMonth, stTime.wDay, stTime.wHour, stTime.wMinute, stTime.wSecond);
CvVideoWriter *writer = cvCreateVideoWriter(videoPath,CV_FOURCC('X','V','I','D'),10,Size(800,600),1);
#endif

IplImage * src_frame,*copyFrame;
Expand All @@ -789,17 +793,18 @@ void openMP_MultiThreadCamera()
src_frame=p.Camera2IplImage();
float TSRSend[5]={0,0,0,0,0};//store the traffic signs recognition result
float TLDSend[3]={0,0,0};//store the traffic lights detection result
IplImage* frame=cvCreateImage(Size(800,600),src_frame->depth,src_frame->nChannels);
//IplImage* frame=cvCreateImage(Size(800,600),src_frame->depth,src_frame->nChannels);
int start=cvGetTickCount();
if(!frame)break;
if(!src_frame)break;
//MultiThread
#if ISDEBUG_TL
cvNamedWindow("imgseg");
#endif
//copyFrame=cvCloneImage(frame);
copyFrame=cvCreateImage(Size(frame->width,frame->height),frame->depth,frame->nChannels);
cvResize(src_frame,frame);
cvCopy(frame,copyFrame);
copyFrame=cvCreateImage(Size(800,600),src_frame->depth,src_frame->nChannels);
//cvResize(src_frame,frame);
//cvCopy(frame,copyFrame);
cvResize(src_frame,copyFrame);

#if OPENMP
#pragma omp parallel sections
Expand All @@ -817,7 +822,7 @@ void openMP_MultiThreadCamera()
}
}
#else
TSRecognitionPerFrame(frame,TSRSend);
//TSRecognitionPerFrame(frame,TSRSend);
TLDetectionPerFrame(copyFrame,TLDSend);
#endif

Expand All @@ -827,15 +832,15 @@ void openMP_MultiThreadCamera()
cvShowImage("TL",resize_TLR);
cvWaitKey(5);
//show the detection result of TSR
namedWindow("TSR");
imshow("TSR",re_src);
waitKey(5);
//namedWindow("TSR");
//imshow("TSR",re_src);
//waitKey(5);
#endif

#if IS_SAVE
cvWriteFrame(writer,frame);
cvWriteFrame(writer,copyFrame);
#endif
cvReleaseImage(&frame);
//cvReleaseImage(&frame);
cvReleaseImage(&copyFrame);
//get the union result
for (int i=0;i<5;i++)
Expand Down
4 changes: 2 additions & 2 deletions traffic.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <vector>
#include <stdlib.h>

#define IS_SAVE 0 //摄像头采集信息是否保存
#define OPENMP 1//是否使用OPENMP并行处理
#define IS_SAVE 1 //摄像头采集信息是否保存
#define OPENMP 0//是否使用OPENMP并行处理
#define ISDEBUG_TL 0//调试时用来输出中间调试图像及信息(Traffic Light)
#define ISDEBUG_TS 0//调试时用来输出中间调试图像及信息(Traffic Sign)
#define IS_SHOW_RESULT 1//是否显示检测结果,不显示图像结果处理速度更快
Expand Down

0 comments on commit 1a1948a

Please sign in to comment.