资源简介
源码为简单的车道线是别的源码,可做到简易低干扰效果的滤波,得到二值化后车道线的图像
代码片段和文件信息
#include
#include
#include “opencv2/imgproc.hpp“
#include
#include
#include
#include
#include
#include
#include
using namespace std;
using namespace cv;
clock_t start stop;
class LaneDetect
{
public:
Mat currframe; //stores the upcoming frame
Mat temp; //stores intermediate results
Mat temp2; //stores the final lane segments
int diff diffL diffR;
int laneWidth;
int diffThreshTop;
int diffThreshLow;
int ROIrows;
int vertical_left;
int vertical_right;
int vertical_top;
int smallLaneArea;
int longLane;
int vanishingPt;
float maxLaneWidth;
//to store various blob properties
Mat binary_image; //used for blob removal
int minSize;
int ratio;
float contour_area;
float blob_angle_deg;
float bounding_width;
float bounding_length;
Size2f sz;
vector< vector > contours;
vector hierarchy;
RotatedRect rotated_rect;
LaneDetect(Mat startframe)
{
//currframe = startframe; //if image has to be processed at original size
currframe = Mat(320480CV_8UC10.0); //initialised the image size to 320x480
resize(startframe currframe currframe.size()); // resize the input to required size
temp = Mat(currframe.rows currframe.cols CV_8UC10.0);//stores possible lane markings
temp2 = Mat(currframe.rows currframe.cols CV_8UC10.0);//stores finally selected lane marks
vanishingPt = currframe.rows/2; //for simplicity right now
ROIrows = currframe.rows - vanishingPt; //rows in region of interest
minSize = 0.00015 * (currframe.cols*currframe.rows); //min size of any region to be selected as lane
maxLaneWidth = 0.025 * currframe.cols; //approximate max lane width based on image size
smallLaneArea = 7 * minSize;
longLane = 0.3 * currframe.rows;
ratio = 4;
//these mark the possible ROI for vertical lane segments and to filter vehicle glare
vertical_left = 2*currframe.cols/5;
vertical_right = 3*currframe.cols/5;
vertical_top = 2*currframe.rows/3;
namedWindow(“lane“2);
namedWindow(“midstep“ 2);
namedWindow(“currframe“ 2);
namedWindow(“laneBlobs“2);
getLane();
}
void updateSensitivity()
{
int total=0 average =0;
for(int i= vanishingPt; iame.rows; i++)
for(int j= 0 ; jame.cols; j++)
total += currframe.at(ij);
average = total/(ROIrows*currframe.cols);
cout<<“average : “< }
void getLane()
{
//medianBlur(currframe currframe5 );
- 上一篇:长整数乘以普通整数c语言代码
- 下一篇:数字水印源代码,C语言程序
相关资源
- 基于opencv园检测
- 植物大战僵尸基于OpenCv和C++实现
- OPENCV角点检测
- opencv标志识别
- 基于轮廓的倾斜仪表校正
- 在opencv中将两个图像给融合,让图像
- 使用OpenCV编写一个程序,该程序完成
- 使用 OpenCV 编制一个简单的徒手绘图程
- OpenCV解决PnP问题
- 基于opencv3.2的Moravec、Forstner、Harris算
- opencv+udp+c++ 的摄像头实时传输显示源
- MFC中嵌入显示opencv图像
- opencv调用海康摄像头
- 激光雷达数据读取以及显示C++需配置
- OpenCV在TI 达芬奇以及OMAP平台下的移植
- 双目视觉匹配得到视差图
- CvImgCtrl 演示程序
- 用OpenCV实现Photoshop色阶调整算法
- 贝叶斯抠图C++源代码
- emgucv&opencv图像处理函数说明
- opencv实现分水岭算法
- 人工势场法C++版及利用opencv(or matl
- OpenCV+C++图像处理项目14个
- 用VS2015+opencv3.4.2+C++编写Yolov3目标检测
- 计算图像的平均灰度值
- OpenCV2.4.8
- 基于opencv的人脸识别程序-代码详解
- OpenCV通过直方图均衡化增强图像对比
- OpenCV种子填充实现彩色图像分割的代
- 基于 OPENCV 对三角形 的 角度检测
评论
共有 条评论