• 大小: 2.37MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-12
  • 语言: 其他
  • 标签: opencv  车道线  

资源简介

基于opencv的车道线检测

资源截图

代码片段和文件信息

#include “StdAfx.h“
#include “calc.h“

#define IF_PTR_NULL(ptr result)\
{\
if ((NULL) == (ptr))\
{\
printf(“%s:%d [%s] “__FILE____LINE____FUNCTION__);\
printf(“NULL == ptr \n“);\
return result;\
}\
}


void cvThin( IplImage* src IplImage* dst int iterations)
{
CvSize size = cvGetSize(src);

cvCopy(src dst);
int n = 0i = 0j = 0;
for(n=0; n {
IplImage* t_image = cvCloneImage(dst);
for(i=0; i {
for(j=0; j {
if(CV_IMAGE_ELEM(t_imageucharij)==1)
{
int ap=0;
int p2 = (i==0)?0:CV_IMAGE_ELEM(t_imageuchar i-1 j);
int p3 = (i==0 || j==size.width-1)?0:CV_IMAGE_ELEM(t_imageuchar i-1 j+1);
if (p2==0 && p3==1)
{
ap++;
}
int p4 = (j==size.width-1)?0:CV_IMAGE_ELEM(t_imageucharij+1);
if(p3==0 && p4==1)
{
ap++;
}
int p5 = (i==size.height-1 || j==size.width-1)?0:CV_IMAGE_ELEM(t_imageuchari+1j+1);
if(p4==0 && p5==1)
{
ap++;
}
int p6 = (i==size.height-1)?0:CV_IMAGE_ELEM(t_imageuchari+1j);
if(p5==0 && p6==1)
{
ap++;
}
int p7 = (i==size.height-1 || j==0)?0:CV_IMAGE_ELEM(t_imageuchari+1j-1);
if(p6==0 && p7==1)
{
ap++;
}
int p8 = (j==0)?0:CV_IMAGE_ELEM(t_imageucharij-1);
if(p7==0 && p8==1)
{
ap++;
}
int p9 = (i==0 || j==0)?0:CV_IMAGE_ELEM(t_imageuchari-1j-1);
if(p8==0 && p9==1)
{
ap++;
}
if(p9==0 && p2==1)
{
ap++;
}
if((p2+p3+p4+p5+p6+p7+p8+p9)>1 && (p2+p3+p4+p5+p6+p7+p8+p9)<7)
{
if(ap==1)
{
if(!(p2 && p4 && p6))
{
if(!(p4 && p6 && p8)) 
{
CV_IMAGE_ELEM(dstucharij)=0;
}
}
}
}

}
}
}
cvReleaseImage(&t_image);
t_image = cvCloneImage(dst);
for(i=0; i {
for(int j=0; j {
if(CV_IMAGE_ELEM(t_imageucharij)==1)
{
int ap=0;
int p2 = (i==0)?0:CV_IMAGE_ELEM(t_imageuchar i-1 j);
int p3 = (i==0 || j==size.width-1)?0:CV_IMAGE_ELEM(t_imageuchar i-1 j+1);
if (p2==0 && p3==1)
{
ap++;
}
int p4 = (j==size.width-1)?0:CV_IMAGE_ELEM(t_imageucharij+1);
if(p3==0 && p4==1)
{
ap++;
}
int p5 = (i==size.height-1 || j==size.width-1)?0:CV_IMAGE_ELEM(t_imageuchari+1j+1);
if(p4==0 && p5==1)
{
ap++;
}
int p6 = (i==size.height-1)?0:CV_IMAGE_ELEM(t_imageuchari+1j);
if(p5==0 && p6==1)
{
ap++;
}
int p7 = (i==size.height-1 || j==0)?0:CV_IMAGE_ELEM(t_imageuchari+1j-1);
if(p6==0 && p7==1)
{
ap++;
}
int p8 = (j==0)?0:CV_IMAGE_ELEM(t_imageucharij-1);
if(p7==0 && p8==1)
{
ap++;
}
int p9 = (i==0 || j==0)?0:CV_IMAGE_ELE

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      11735  2014-01-10 14:05  contour\calc.cpp

     文件        915  2015-02-11 00:40  contour\calc.h

     文件       9618  2014-01-10 15:55  contour\contour.cpp

     文件       5077  2015-01-30 11:47  contour\contour.vcxproj

     文件       1485  2014-01-09 11:15  contour\contour.vcxproj.filters

     文件        143  2013-11-25 11:18  contour\contour.vcxproj.user

     文件       5570  2015-02-12 01:37  contour\Debug\cl.command.1.tlog

     文件     115224  2015-02-12 01:37  contour\Debug\CL.read.1.tlog

     文件       2904  2015-02-12 01:37  contour\Debug\CL.write.1.tlog

     文件       1998  2013-11-25 11:21  contour\Debug\contour.Build.CppClean.log

     文件      34304  2013-11-25 11:20  contour\Debug\contour.exe

     文件        406  2013-11-25 11:21  contour\Debug\contour.exe.embed.manifest

     文件        472  2015-02-11 00:32  contour\Debug\contour.exe.embed.manifest.res

     文件        381  2014-01-10 15:56  contour\Debug\contour.exe.intermediate.manifest

     文件         54  2015-02-12 01:37  contour\Debug\contour.lastbuildstate

     文件       2280  2015-02-12 01:37  contour\Debug\contour.log

     文件          0  2015-02-12 01:37  contour\Debug\contour.unsuccessfulbuild

     文件        853  2015-01-30 12:58  contour\Debug\contour.vcxprojResolveAssemblyReference.cache

     文件          0  2013-11-25 11:21  contour\Debug\contour.write.1.tlog

     文件        204  2013-11-25 11:21  contour\Debug\contour_manifest.rc

     文件          2  2015-02-11 00:33  contour\Debug\link-cvtres.read.1.tlog

     文件          2  2015-02-11 00:33  contour\Debug\link-cvtres.write.1.tlog

     文件          2  2015-02-11 00:33  contour\Debug\link.2568-cvtres.read.1.tlog

     文件          2  2015-02-11 00:33  contour\Debug\link.2568-cvtres.write.1.tlog

     文件          2  2015-02-11 00:33  contour\Debug\link.2568.read.1.tlog

     文件          2  2015-02-11 00:33  contour\Debug\link.2568.write.1.tlog

     文件          2  2015-02-11 00:33  contour\Debug\link.3852-cvtres.read.1.tlog

     文件          2  2015-02-11 00:33  contour\Debug\link.3852-cvtres.write.1.tlog

     文件          2  2015-02-11 00:33  contour\Debug\link.3852.read.1.tlog

     文件          2  2015-02-11 00:33  contour\Debug\link.3852.write.1.tlog

............此处省略58个文件信息

评论

共有 条评论