资源简介
无需资源分,简单的车道线检测程序,供初学者学习
代码片段和文件信息
#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 road\contour\calc.cpp
文件 915 2014-01-10 11:55 road\contour\calc.h
文件 373295 2016-05-06 10:13 road\contour\color_dst.jpg
文件 10281 2016-05-09 11:14 road\contour\contour.cpp
文件 5720 2016-05-06 10:25 road\contour\contour.vcxproj
文件 1485 2014-01-09 11:15 road\contour\contour.vcxproj.filters
文件 143 2013-11-25 11:18 road\contour\contour.vcxproj.user
文件 135841 2016-05-09 11:16 road\contour\Debug\calc.obj
文件 2836 2016-05-09 11:16 road\contour\Debug\cl.command.1.tlog
文件 42164 2016-05-09 11:16 road\contour\Debug\CL.read.1.tlog
文件 1978 2016-05-09 11:16 road\contour\Debug\CL.write.1.tlog
文件 9294 2016-05-09 11:15 road\contour\Debug\contour.Build.CppClean.log
文件 34304 2013-11-25 11:20 road\contour\Debug\contour.exe
文件 406 2016-05-09 11:16 road\contour\Debug\contour.exe.em
文件 472 2016-05-09 11:16 road\contour\Debug\contour.exe.em
文件 381 2016-05-09 11:16 road\contour\Debug\contour.exe.intermediate.manifest
文件 86 2016-05-09 11:16 road\contour\Debug\contour.lastbuildstate
文件 9816 2016-05-09 11:16 road\contour\Debug\contour.log
文件 142573 2016-05-09 11:16 road\contour\Debug\contour.obj
文件 1179648 2016-05-09 11:15 road\contour\Debug\contour.pch
文件 0 2016-05-09 11:15 road\contour\Debug\contour.write.1.tlog
文件 204 2016-05-09 11:16 road\contour\Debug\contour_manifest.rc
文件 2 2016-05-09 11:16 road\contour\Debug\li
文件 2 2016-05-09 11:16 road\contour\Debug\li
文件 2 2016-05-09 11:16 road\contour\Debug\li
文件 2 2016-05-09 11:16 road\contour\Debug\li
文件 2 2016-05-09 11:16 road\contour\Debug\li
文件 2 2016-05-09 11:16 road\contour\Debug\li
文件 2992 2016-05-09 11:16 road\contour\Debug\li
文件 6464 2016-05-09 11:16 road\contour\Debug\li
............此处省略63个文件信息
- 上一篇:频谱仪指导说明书
- 下一篇:CLOUDERA-Manager_中文手册全
评论
共有 条评论