资源简介
opencv学习,道路检测
代码片段和文件信息
/*源文件 CvvImage.cpp*/
#include “StdAfx.h“
#include “CvvImage.h“
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CV_INLINE RECT NormalizeRect( RECT r );
CV_INLINE RECT NormalizeRect( RECT r )
{
int t;
if( r.left > r.right )
{
t = r.left;
r.left = r.right;
r.right = t;
}
if( r.top > r.bottom )
{
t = r.top;
r.top = r.bottom;
r.bottom = t;
}
return r;
}
CV_INLINE CvRect RectToCvRect( RECT sr );
CV_INLINE CvRect RectToCvRect( RECT sr )
{
sr = NormalizeRect( sr );
return cvRect( sr.left sr.top sr.right - sr.left sr.bottom - sr.top );
}
CV_INLINE RECT CvRectToRect( CvRect sr );
CV_INLINE RECT CvRectToRect( CvRect sr )
{
RECT dr;
dr.left = sr.x;
dr.top = sr.y;
dr.right = sr.x + sr.width;
dr.bottom = sr.y + sr.height;
return dr;
}
CV_INLINE IplROI RectToROI( RECT r );
CV_INLINE IplROI RectToROI( RECT r )
{
IplROI roi;
r = NormalizeRect( r );
roi.xOffset = r.left;
roi.yOffset = r.top;
roi.width = r.right - r.left;
roi.height = r.bottom - r.top;
roi.coi = 0;
return roi;
}
void FillBitmapInfo( BITMAPINFO* bmi int width int height int bpp int origin )
{
assert( bmi && width >= 0 && height >= 0 && (bpp == 8 || bpp == 24 || bpp == 32));
BITMAPINFOHEADER* bmih = &(bmi->bmiHeader);
memset( bmih 0 sizeof(*bmih));
bmih->biSize = sizeof(BITMAPINFOHEADER);
bmih->biWidth = width;
bmih->biHeight = origin ? abs(height) : -abs(height);
bmih->biPlanes = 1;
bmih->biBitCount = (unsigned short)bpp;
bmih->biCompression = BI_RGB;
if( bpp == 8 )
{
RGBQUAD* palette = bmi->bmiColors;
int i;
for( i = 0; i < 256; i++ )
{
palette[i].rgbBlue = palette[i].rgbGreen = palette[i].rgbRed = (BYTE)i;
palette[i].rgbReserved = 0;
}
}
}
CvvImage::CvvImage()
{
m_img = 0;
}
void CvvImage::Destroy()
{
cvReleaseImage( &m_img );
}
CvvImage::~CvvImage()
{
Destroy();
}
bool CvvImage::Create( int w int h int bpp int origin )
{
const unsigned max_img_size = 10000;
if( (bpp != 8 && bpp != 24 && bpp != 32) ||
(unsigned)w >= max_img_size || (unsigned)h >= max_img_size ||
(origin != IPL_ORIGIN_TL && origin != IPL_ORIGIN_BL))
{
assert(0); // most probably it is a programming error
return false;
}
if( !m_img || Bpp() != bpp || m_img->width != w || m_img->height != h )
{
if( m_img && m_img->nSize == sizeof(IplImage))
Destroy();
/* prepare IPL header */
m_img = cvCreateImage( cvSize( w h ) IPL_DEPTH_8U bpp/8 );
}
if( m_img )
m_img->origin = origin == 0 ? IPL_ORIGIN_TL : IPL_ORIGIN_BL;
return m_img != 0;
}
void CvvImage::CopyOf( CvvImage& image int desired_color )
{
Ip
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1747968 2016-04-08 10:25 RoadDetect\Release\RoadDetect.exe
文件 7251 2015-05-27 10:52 RoadDetect\RoadDetect\CvvImage.cpp
文件 2054 2015-05-27 10:51 RoadDetect\RoadDetect\CvvImage.h
文件 3070 2016-04-07 20:22 RoadDetect\RoadDetect\ReadMe.txt
文件 67777 2009-08-31 02:31 RoadDetect\RoadDetect\res\RoadDetect.ico
文件 676 2016-04-07 20:22 RoadDetect\RoadDetect\res\RoadDetect.rc2
文件 1826 2016-04-07 20:40 RoadDetect\RoadDetect\resource.h
文件 105956 2016-04-07 21:09 RoadDetect\RoadDetect\RoadDetect.aps
文件 2045 2016-04-07 20:22 RoadDetect\RoadDetect\RoadDetect.cpp
文件 466 2016-04-07 20:22 RoadDetect\RoadDetect\RoadDetect.h
文件 10716 2016-04-07 21:09 RoadDetect\RoadDetect\RoadDetect.rc
文件 6774 2016-04-08 08:46 RoadDetect\RoadDetect\RoadDetect.vcxproj
文件 2191 2016-04-07 20:40 RoadDetect\RoadDetect\RoadDetect.vcxproj.filters
文件 143 2016-04-07 20:21 RoadDetect\RoadDetect\RoadDetect.vcxproj.user
文件 5519 2016-04-08 10:05 RoadDetect\RoadDetect\RoadDetectDlg.cpp
文件 923 2016-04-07 20:52 RoadDetect\RoadDetect\RoadDetectDlg.h
文件 143 2016-04-07 20:22 RoadDetect\RoadDetect\stdafx.cpp
文件 1632 2016-04-07 20:22 RoadDetect\RoadDetect\stdafx.h
文件 234 2016-04-07 20:22 RoadDetect\RoadDetect\targetver.h
文件 48820 2016-04-07 20:59 RoadDetect\RoadDetect\TestRoadPicture\10.jpg
文件 93612 2016-04-07 20:59 RoadDetect\RoadDetect\TestRoadPicture\11.jpg
文件 600900 2016-04-07 21:00 RoadDetect\RoadDetect\TestRoadPicture\17.jpg
文件 272726 2016-04-07 21:00 RoadDetect\RoadDetect\TestRoadPicture\20.jpg
文件 1043792 2016-04-07 20:58 RoadDetect\RoadDetect\TestRoadPicture\3.png
文件 797888 2016-04-07 20:58 RoadDetect\RoadDetect\TestRoadPicture\4.jpg
文件 880977 2016-04-07 20:58 RoadDetect\RoadDetect\TestRoadPicture\5.png
文件 74131 2016-04-07 20:58 RoadDetect\RoadDetect\TestRoadPicture\6.jpg
文件 207229 2016-04-07 20:58 RoadDetect\RoadDetect\TestRoadPicture\7.jpg
文件 134509 2016-04-07 20:59 RoadDetect\RoadDetect\TestRoadPicture\8.jpg
文件 311201 2016-04-07 20:59 RoadDetect\RoadDetect\TestRoadPicture\9.jpg
............此处省略11个文件信息
- 上一篇:西门子200模块CAD
- 下一篇:房屋收租管理系统v2.019破解版
评论
共有 条评论