资源简介
基于C++的MFC 利用opencv 实现图片的显示。程序使用VS2010编写
代码片段和文件信息
#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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-12-01 16:18 MFC显示图片\
目录 0 2014-12-01 16:15 MFC显示图片\Debug\
文件 56320 2013-02-22 14:43 MFC显示图片\Debug\Intel_OpenCL_ICD32.dll
文件 165888 2014-12-01 16:18 MFC显示图片\Debug\LiveWire.exe
文件 1179712 2014-12-01 16:18 MFC显示图片\Debug\LiveWire.ilk
文件 6245376 2014-12-01 16:18 MFC显示图片\Debug\LiveWire.pdb
文件 17920 2012-05-15 06:20 MFC显示图片\Debug\OpenCL.dll
文件 53024 2014-03-04 22:29 MFC显示图片\Debug\OpenCL32.dll
文件 744960 2011-08-17 10:21 MFC显示图片\Debug\opencv_calib3d231.dll
文件 1243136 2011-08-17 10:10 MFC显示图片\Debug\opencv_calib3d231d.dll
文件 795136 2013-03-02 02:03 MFC显示图片\Debug\opencv_calib3d244.dll
文件 1551360 2013-03-02 01:59 MFC显示图片\Debug\opencv_calib3d244d.dll
文件 786432 2013-12-29 12:11 MFC显示图片\Debug\opencv_calib3d248.dll
文件 1543680 2013-12-29 12:14 MFC显示图片\Debug\opencv_calib3d248d.dll
文件 548352 2011-08-17 10:27 MFC显示图片\Debug\opencv_contrib231.dll
文件 1072640 2011-08-17 10:16 MFC显示图片\Debug\opencv_contrib231d.dll
文件 1163264 2013-03-02 02:03 MFC显示图片\Debug\opencv_contrib244.dll
文件 2481152 2013-03-02 01:59 MFC显示图片\Debug\opencv_contrib244d.dll
文件 1150464 2013-12-29 12:12 MFC显示图片\Debug\opencv_contrib248.dll
文件 2464768 2013-12-29 12:14 MFC显示图片\Debug\opencv_contrib248d.dll
文件 1717760 2011-08-17 10:17 MFC显示图片\Debug\opencv_core231.dll
文件 2335744 2011-08-17 10:08 MFC显示图片\Debug\opencv_core231d.dll
文件 2075648 2013-03-02 02:01 MFC显示图片\Debug\opencv_core244.dll
文件 3423232 2013-03-02 01:58 MFC显示图片\Debug\opencv_core244d.dll
文件 2098688 2013-12-29 12:09 MFC显示图片\Debug\opencv_core248.dll
文件 3473920 2013-12-29 12:13 MFC显示图片\Debug\opencv_core248d.dll
文件 146944 2013-12-29 12:12 MFC显示图片\Debug\opencv_createsamples.exe
文件 879104 2011-08-17 10:20 MFC显示图片\Debug\opencv_features2d231.dll
文件 1554432 2011-08-17 10:10 MFC显示图片\Debug\opencv_features2d231d.dll
文件 730112 2013-03-02 02:03 MFC显示图片\Debug\opencv_features2d244.dll
文件 1478656 2013-03-02 01:59 MFC显示图片\Debug\opencv_features2d244d.dll
............此处省略683个文件信息
相关资源
- mfc 调用redis
- MFC视频播放器源码(支持avi/wma/mp3等格
- CreatBitmap图片合成源码
- 基于opencv的模板匹配代码
- mfc绘图大全(画直线、矩形、椭圆)
- MFC控件重绘
- hook,捕获所有案件,查找所有窗口,
- (学习)VS2010之MFC入门到精通教程
- opencv图片扫描以及校正
- opencv手部轮廓识别以及轨迹识别
- MFC文档_视图_框架_模板结构体系深入
- 简单员工管理系统(适合初学MFC)
- opencv2 3D标定.cpp
- 基于opencv漫水填充算法综合
- MFC五子棋游戏
- MFC UDP编程
- MFC的异步网络通讯应用程序
- C++MFC模块讲解,黑发程序员课程整理
- 一个简单而强大的基于MFC的web server源
- 基于MFC的VC++仿QQ浏览器源码(雏形)
- opencv激光中心线的提取
- MFCaccess.rar
- VC++MFC课程设计的学生成绩管理系统
- MFC 日历控件 万年历 Calendar自绘
- CrystalDiskInfo-HDD/SSD硬盘信息,SMART信息
- MFC自定义界面HUI,高效简单,含详细
- OpenCV Computer Vision Application Programming
- 仿射密码-Affine cipher
- c++MFC车牌自动识别定位,只能定位和
- mfc+sql 酒店客房管理系统
评论
共有 条评论