资源简介
源码为简单的车道线是别的源码,可做到简易低干扰效果的滤波,得到二值化后车道线的图像
代码片段和文件信息
#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_facedetect_v4l2)
- 基于opencv的模板匹配代码
- opencv图片扫描以及校正
- opencv手部轮廓识别以及轨迹识别
- opencv2 3D标定.cpp
- 基于opencv漫水填充算法综合
- opencv激光中心线的提取
- OpenCV Computer Vision Application Programming
- 基于图割的图像分割OpenCV+MFC实现
- 识别魔方颜色
- opencv版俄罗斯方块源码
- VS2013 / MFC + OpenCV 2.4.9实现视频的播放
- 粒子滤波器+目标跟踪的C++实现,VS2
- 张平OpenCV算法精讲基于python和C++教材
- 虹膜识别开源代码OSIRIS4.1基于opencv
- Sift特征点提取与匹配opencv库
- YCbCr、混合高斯以及YCbCg肤色检测模型
- 光流法代码
- OpenCV打开摄像机显示在MFC窗口工程源
- 使用c++读取图像到二维矩阵
- 三维点云的圆柱面拟合
- MFC+OPENCV摄像机标定程序
- 基于特征脸的人脸识别MFC+OpenCV
- opencv图像处理MFC
- OPENCV人脸检测加角点检测并输出坐标
- FillHole.rar
- 道路提取算法 c++ opencv
- PCA代码实现详解
- opencv卡尔曼滤波
- SeamCarving opencv c++
评论
共有 条评论