• 大小: 41.39MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-05
  • 语言: C/C++
  • 标签: OpenCV  MFC  

资源简介

包括整个工程的源代码,在OpenCV2.4.3+VS2008平台编译通过。

资源截图

代码片段和文件信息

#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 )
{
IplImage* img = image.GetImage();
if( img )
{
CopyOf( img desired_color );
}
}
#define HG_IS_IMAGE(img)                                                  \
((img) != 0 && ((const IplImage*)(img))->nSize ==

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-11-09 18:51  VideoPlayer\
     目录           0  2015-11-09 18:51  VideoPlayer\Debug\
     文件    22531072  2015-11-09 18:51  VideoPlayer\Debug\VideoPlayer.pdb
     目录           0  2015-11-10 13:49  VideoPlayer\Release\
     文件     2259968  2015-11-10 13:49  VideoPlayer\Release\VideoPlayer.exe
     文件    14748672  2015-11-10 13:49  VideoPlayer\Release\VideoPlayer.pdb
     目录           0  2015-11-10 13:49  VideoPlayer\VideoPlayer\
     文件        6606  2015-10-25 12:52  VideoPlayer\VideoPlayer\CvvImage.cpp
     文件        1925  2015-10-25 12:52  VideoPlayer\VideoPlayer\CvvImage.h
     目录           0  2015-11-09 18:51  VideoPlayer\VideoPlayer\Debug\
     文件        8886  2015-11-09 18:51  VideoPlayer\VideoPlayer\Debug\BuildLog.htm
     文件      165064  2015-11-09 18:51  VideoPlayer\VideoPlayer\Debug\CvvImage.obj
     文件         682  2015-11-09 16:49  VideoPlayer\VideoPlayer\Debug\VideoPlayer.exe.embed.manifest
     文件         748  2015-11-09 16:49  VideoPlayer\VideoPlayer\Debug\VideoPlayer.exe.embed.manifest.res
     文件         640  2015-11-09 18:51  VideoPlayer\VideoPlayer\Debug\VideoPlayer.exe.intermediate.manifest
     文件       25187  2015-11-09 16:48  VideoPlayer\VideoPlayer\Debug\VideoPlayer.obj
     文件    40239104  2015-11-09 16:48  VideoPlayer\VideoPlayer\Debug\VideoPlayer.pch
     文件       79580  2015-11-09 18:51  VideoPlayer\VideoPlayer\Debug\VideoPlayer.res
     文件       71989  2015-11-09 16:48  VideoPlayer\VideoPlayer\Debug\VideoPlayerDlg.obj
     文件          67  2015-11-09 16:49  VideoPlayer\VideoPlayer\Debug\mt.dep
     文件      614463  2015-11-09 16:48  VideoPlayer\VideoPlayer\Debug\stdafx.obj
     文件     2214912  2015-11-09 18:51  VideoPlayer\VideoPlayer\Debug\vc90.idb
     文件     4075520  2015-11-09 18:51  VideoPlayer\VideoPlayer\Debug\vc90.pdb
     文件        2809  2015-11-09 16:48  VideoPlayer\VideoPlayer\ReadMe.txt
     目录           0  2015-11-10 13:49  VideoPlayer\VideoPlayer\Release\
     文件        8670  2015-11-10 13:49  VideoPlayer\VideoPlayer\Release\BuildLog.htm
     文件      888457  2015-11-09 18:51  VideoPlayer\VideoPlayer\Release\CvvImage.obj
     文件         640  2015-11-10 13:49  VideoPlayer\VideoPlayer\Release\VideoPlayer.exe.intermediate.manifest
     文件      884903  2015-11-09 22:06  VideoPlayer\VideoPlayer\Release\VideoPlayer.obj
     文件    38076416  2015-11-09 18:51  VideoPlayer\VideoPlayer\Release\VideoPlayer.pch
     文件      587612  2015-11-09 22:29  VideoPlayer\VideoPlayer\Release\VideoPlayer.res
............此处省略24个文件信息

评论

共有 条评论