• 大小: 43.05MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-22
  • 语言: C/C++
  • 标签: 车牌识别  

资源简介

基于视频的车牌识别,通过OpenCV视觉库对信息进行处理达到目的

资源截图

代码片段和文件信息


#include 
#include “opencv2/imgproc/imgproc.hpp“
#include “opencv2/highgui/highgui.hpp“
#include 
#include 
#include “utils.h“

#define USE_VIDEO 1

#undef MIN
#undef MAX
#define MAX(ab) ((a)<(b)?(b):(a))
#define MIN(ab) ((a)>(b)?(b):(a))

void crop(IplImage* src  IplImage* dest CvRect rect) {
    cvSetImageROI(src rect); 
    cvCopy(src dest); 
    cvResetImageROI(src); 
}

struct Lane {
Lane(){}
Lane(CvPoint a CvPoint b float angle float kl float bl): p0(a)p1(b)angle(angle)
votes(0)visited(false)found(false)k(kl)b(bl) { }

CvPoint p0 p1;
int votes;
bool visited found;
float angle k b;
};

struct Status {
Status():reset(true)lost(0){}
ExpMovingAverage k b;
bool reset;
int lost;
};

struct Vehicle {
CvPoint bmin bmax;
int symmetryX;
bool valid;
unsigned int lastUpdate;
};

struct VehicleSample {
CvPoint center;
float radi;
unsigned int frameDetected;
int vehicleIndex;
};

#define GREEN CV_RGB(02550)
#define RED CV_RGB(25500)
#define BLUE CV_RGB(2550255)
#define PURPLE CV_RGB(2550255)

Status laneR laneL;
std::vector vehicles;
std::vector samples;

enum{
    SCAN_STEP = 5   // in pixels
LINE_REJECT_DEGREES = 10 // in degrees
    BW_TRESHOLD = 250   // edge response strength to recognize for ‘WHITE‘
    BORDERX = 10   // px skip this much from left & right borders
MAX_RESPONSE_DIST = 5   // px

CANNY_MIN_TRESHOLD = 1   // edge detector minimum hysteresis threshold
CANNY_MAX_TRESHOLD = 100 // edge detector maximum hysteresis threshold

HOUGH_TRESHOLD = 50 // line approval vote threshold
HOUGH_MIN_LINE_LENGTH = 50 // remove lines shorter than this treshold
HOUGH_MAX_LINE_GAP = 100   // join lines to one with smaller than this gaps

CAR_DETECT_LINES = 4    // minimum lines for a region to pass validation as a ‘CAR‘
CAR_H_LINE_LENGTH = 10  // minimum horizontal line length from car body in px

MAX_VEHICLE_SAMPLES = 30      // max vehicle detection sampling history
CAR_DETECT_POSITIVE_SAMPLES = MAX_VEHICLE_SAMPLES-2 // probability positive matches for valid car
MAX_VEHICLE_NO_UPDATE_FREQ = 15 // remove car after this much no update frames
};

#define K_VARY_FACTOR 0.2f
#define B_VARY_FACTOR 20
#define MAX_LOST_frameS 30

void FindResponses(IplImage *img int startX int endX int y std::vector& list)
{
    // scans for single response: /^\_

const int row = y * img->width * img->nChannels;
unsigned char* ptr = (unsigned char*)img->imageData;

    int step = (endX < startX) ? -1: 1;
    int range = (endX > startX) ? endX-startX+1 : startX-endX+1;

    for(int x = startX; range>0; x += step range--)
    {
        if(ptr[row + x] <= BW_TRESHOLD) continue; // skip black: loop until white pixels show up

        // first response found
        int idx = x + step;

        // skip same response(white)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-04-20 20:03  opencv-lane-vehicle-track-master\
     目录           0  2018-04-20 20:03  opencv-lane-vehicle-track-master\Debug\
     文件       12676  2018-04-06 21:24  opencv-lane-vehicle-track-master\Debug\CL.read.1.tlog
     文件         420  2018-04-06 21:24  opencv-lane-vehicle-track-master\Debug\CL.write.1.tlog
     文件         706  2018-04-06 21:24  opencv-lane-vehicle-track-master\Debug\cl.command.1.tlog
     文件           2  2018-04-06 21:24  opencv-lane-vehicle-track-master\Debug\flowdemo.exe.embed.manifest
     文件          68  2018-04-06 21:24  opencv-lane-vehicle-track-master\Debug\flowdemo.exe.embed.manifest.res
     文件          82  2018-04-07 09:44  opencv-lane-vehicle-track-master\Debug\flowdemo.lastbuildstate
     文件        2658  2018-04-07 09:44  opencv-lane-vehicle-track-master\Debug\flowdemo.log
     文件           0  2018-04-07 09:44  opencv-lane-vehicle-track-master\Debug\flowdemo.unsuccessfulbuild
     文件           0  2018-04-06 21:24  opencv-lane-vehicle-track-master\Debug\flowdemo.write.1.tlog
     文件         206  2018-04-06 21:24  opencv-lane-vehicle-track-master\Debug\flowdemo_manifest.rc
     文件           2  2018-04-07 09:44  opencv-lane-vehicle-track-master\Debug\link.command.1.tlog
     文件           2  2018-04-07 09:44  opencv-lane-vehicle-track-master\Debug\link.read.1.tlog
     文件           2  2018-04-07 09:44  opencv-lane-vehicle-track-master\Debug\link.write.1.tlog
     文件      460482  2018-04-06 21:24  opencv-lane-vehicle-track-master\Debug\main.obj
     文件         594  2018-04-06 21:24  opencv-lane-vehicle-track-master\Debug\rc.command.1.tlog
     文件         350  2018-04-06 21:24  opencv-lane-vehicle-track-master\Debug\rc.read.1.tlog
     文件         358  2018-04-06 21:24  opencv-lane-vehicle-track-master\Debug\rc.write.1.tlog
     文件      478208  2018-04-06 21:24  opencv-lane-vehicle-track-master\Debug\vc100.idb
     文件     1003520  2018-04-06 21:24  opencv-lane-vehicle-track-master\Debug\vc100.pdb
     目录           0  2018-04-20 20:03  opencv-lane-vehicle-track-master\bin\
     目录           0  2018-04-20 20:03  opencv-lane-vehicle-track-master\bin\haar\
     文件        3311  2014-04-06 03:09  opencv-lane-vehicle-track-master\bin\haar\MIT cars128x128.txt
     文件         353  2014-04-06 03:09  opencv-lane-vehicle-track-master\bin\haar\README
     文件      118803  2014-04-06 03:09  opencv-lane-vehicle-track-master\bin\haar\cars3.xml
     文件     2000896  2014-04-06 03:09  opencv-lane-vehicle-track-master\bin\opencv_core242.dll
     文件      668672  2014-04-06 03:09  opencv-lane-vehicle-track-master\bin\opencv_features2d242.dll
     文件     9156997  2014-04-06 03:09  opencv-lane-vehicle-track-master\bin\opencv_ffmpeg242.dll
     文件      460800  2014-04-06 03:09  opencv-lane-vehicle-track-master\bin\opencv_flann242.dll
     文件      385536  2014-04-06 03:09  opencv-lane-vehicle-track-master\bin\opencv_gpu242.dll
............此处省略26个文件信息

评论

共有 条评论