资源简介
基于opencv的交通标志识别,主要运用轮廓识别和模板匹配。适用于简单自然条件下的识别

代码片段和文件信息
// opcv1.cpp : 定义控制台应用程序的入口点。
//
#include “stdafx.h“
#include
#include
#include
#include
#include
#include
#include
#include “cv.h“
#include
using namespace std;
CvSeq* findSquares4( IplImage* img CvMemStorage* storage int minarea int maxarea int minangle int maxangle);
void drawSquares1( IplImage* img CvSeq* squares const char* wndname);
void findCircle(IplImage* imgCvMemStorage* storage);
int thresh = 50;
IplImage* img = 0;
IplImage* img0 = 0;
CvMemStorage* storage = 0;
CvPoint pt[4];
const char* wndname = “Square Detection Demo“;
double angle( CvPoint* pt1 CvPoint* pt2 CvPoint* pt0 )
{
double dx1 = pt1->x - pt0->x;
double dy1 = pt1->y - pt0->y;
double dx2 = pt2->x - pt0->x;
double dy2 = pt2->y - pt0->y;//
return (dx1*dx2 + dy1*dy2)/sqrt((dx1*dx1 + dy1*dy1)*(dx2*dx2 + dy2*dy2) + 1e-10);
// double angle_line = (dx1*dx2 + dy1*dy2)/sqrt((dx1*dx1 + dy1*dy1)*(dx2*dx2 + dy2*dy2) + 1e-10);//余弦值
// return acos(angle_line)*180/3.141592653;
}
// returns sequence of squares detected on the image.
// the sequence is stored in the specified memory storage
CvSeq* findSquares3( IplImage* img CvMemStorage* storage )
{
CvSeq* contours;
int i c l N = 11;
CvSize sz = cvSize( img->width & -2 img->height & -2 );
IplImage* timg = cvCloneImage( img ); // make a copy of input image
IplImage* gray = cvCreateImage( sz 8 1 ); //1/2
IplImage* pyr = cvCreateImage( cvSize(sz.width/2 sz.height/2) 8 3 ); //1/4
IplImage* tgray;
CvSeq* result;
double s t;
// create empty sequence that will contain points -
// 4 points per square (the square‘s vertices)
CvSeq* squares = cvCreateSeq( 0 sizeof(CvSeq) sizeof(CvPoint) storage );
// select the maximum ROI in the image
// with the width and height divisible by 2
cvSetImageROI( timg cvRect( 0 0 sz.width sz.height )); //去图像1/2大小的图片,即将图片分为四份,去左上角的部分
// down-scale and upscale the image to filter out the noise
cvPyrDown( timg pyr 7 );
cvPyrUp( pyr timg 7 );
tgray = cvCreateImage( sz 8 1 );
// find squares in every color plane of the image
for( c = 0; c < 3; c++ )//在三通道下
{
// extract the c-th color plane
cvSetImageCOI( timg c+1 );
cvCopy( timg tgray 0 );
// try several threshold levels
for( l = 0; l < N; l++ )
{
// hack: use Canny instead of zero threshold level.
// Canny helps to catch squares with gradient shading
if( l == 0 )
{
// apply Canny. Take the upper threshold from slider
// and set the lower to 0 (which forces edges merging) //thresh
cvCanny( tgray gray 1000 900 5 );
// cvThreshold( tgray gray (l+
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-10-17 10:18 opcv1\
目录 0 2016-10-08 18:35 opcv1\Debug\
目录 0 2016-10-17 09:37 opcv1\ipch\
目录 0 2016-10-17 09:37 opcv1\ipch\opcv1-de206ace\
文件 2359296 2016-10-17 09:37 opcv1\ipch\opcv1-de206ace\opcv1-df31438d.ipch
目录 0 2016-10-12 11:47 opcv1\opcv1\
文件 18042880 2016-10-17 10:18 opcv1\opcv1.sdf
文件 1236 2016-10-08 18:36 opcv1\opcv1.sln
文件 14336 2016-10-17 10:18 opcv1\opcv1.suo
目录 0 2016-10-08 18:35 opcv1\opcv1\Debug\
文件 1402 2016-10-08 18:35 opcv1\opcv1\Debug\cl.command.1.tlog
文件 13984 2016-10-08 18:35 opcv1\opcv1\Debug\CL.read.1.tlog
文件 714 2016-10-08 18:35 opcv1\opcv1\Debug\CL.write.1.tlog
文件 2 2016-10-08 18:35 opcv1\opcv1\Debug\li
文件 2 2016-10-08 18:35 opcv1\opcv1\Debug\li
文件 2 2016-10-08 18:35 opcv1\opcv1\Debug\li
文件 2 2016-10-08 18:35 opcv1\opcv1\Debug\opcv1.exe.em
文件 68 2016-10-08 18:35 opcv1\opcv1\Debug\opcv1.exe.em
文件 56 2016-10-08 18:35 opcv1\opcv1\Debug\opcv1.lastbuildstate
文件 2702 2016-10-08 18:35 opcv1\opcv1\Debug\opcv1.log
文件 61018 2016-10-08 18:35 opcv1\opcv1\Debug\opcv1.obj
文件 1179648 2016-10-08 18:35 opcv1\opcv1\Debug\opcv1.pch
文件 0 2016-10-08 18:35 opcv1\opcv1\Debug\opcv1.unsuccessfulbuild
文件 713 2016-10-08 18:35 opcv1\opcv1\Debug\opcv1.vcxprojResolveAssemblyReference.cache
文件 0 2016-10-08 18:35 opcv1\opcv1\Debug\opcv1.write.1.tlog
文件 200 2016-10-08 18:35 opcv1\opcv1\Debug\opcv1_manifest.rc
文件 484 2016-10-08 18:35 opcv1\opcv1\Debug\rc.command.1.tlog
文件 258 2016-10-08 18:35 opcv1\opcv1\Debug\rc.read.1.tlog
文件 266 2016-10-08 18:35 opcv1\opcv1\Debug\rc.write.1.tlog
文件 11743 2016-10-08 18:35 opcv1\opcv1\Debug\stdafx.obj
文件 388096 2016-10-08 18:35 opcv1\opcv1\Debug\vc100.idb
............此处省略75个文件信息
- 上一篇:stm32f103驱动光电编码器测量正反转转速角度
- 下一篇:7168个病毒样本
相关资源
- 基于OpenCV的数字识别468815
- 使用opencv去掉二值化图像中黑色面积
- opencv环境配置
- win10 64位下编译的opencv4.5.5库,opencv
- NVIDIAOpticalFlowSDK-79c6cee80a2df9a196f20afd6
- opencv_contrib-3.4.0.zip
- opencv2.4.9源码分析——SIFT
- 用两个摄像头实现,双目标定,双目
- opencv_traincascade训练分类器,手势识别
- opencv3.0交叉编译用parallel.cpp
- 基于opencv的图像识别识别图像中的色
- 基于openCV的识别特定颜色区域
- 基于OpenCV的分水岭算法实现
- QT+opencv+OCR 身份证号码,银行卡号识别
- opencv视频特定颜色区域识别
- 把RGB转换为HSV和HSI然后根据黄色和蓝
- opencv视觉测距
- 基于Qt和opencv的身份证号码识别系统
- opencv_ffmpeg249.dll
- SfM稀疏三维点云重建--完整工程文件
- 基于opencv的数人头程序源代码
- 利用OpenCV中的Stitcher类实现全景图像拼
- opencv实现的sift算法源码,包含了图像
- openCV 上的小波变换
- 基于OPENCV的车牌识别系统设计
- 617张国内车牌60-17bmp图片用于OpenCV正样
- hog特征提取,c版本代码
- 基于Qt5.8+OpenCV3.2的Basler多相机触发开
- 基于Opencv实现的图像纠偏
- ImageWatch2019.vsix
评论
共有 条评论