资源简介
一个小工具,需要的直接可以用于改写。里面的CvvImage.h和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();
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 == sizeof(IplImage) && \
((IplImag
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-11-16 13:52 MFC_OpenCV_Image_Video\
目录 0 2014-11-16 13:52 MFC_OpenCV_Image_Video\Debug\
文件 105472 2014-11-16 14:32 MFC_OpenCV_Image_Video\Debug\MFC_OpenCV_Image_Video.exe
文件 1043752 2014-11-16 14:32 MFC_OpenCV_Image_Video\Debug\MFC_OpenCV_Image_Video.ilk
文件 4516864 2014-11-16 14:32 MFC_OpenCV_Image_Video\Debug\MFC_OpenCV_Image_Video.pdb
目录 0 2014-11-16 14:42 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\
文件 15420416 2014-11-16 14:42 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video.ncb
文件 932 2014-11-16 13:35 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video.sln
文件 23040 2014-11-16 14:42 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video.suo
文件 6546 2014-11-11 20:55 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\CvvImage.cpp
文件 1536 2014-11-11 21:30 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\CvvImage.h
目录 0 2014-11-16 14:32 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\Debug\
文件 10062 2014-11-16 14:32 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\Debug\BuildLog.htm
文件 140288 2014-11-16 13:52 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\Debug\CvvImage.obj
文件 920 2014-11-16 13:52 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\Debug\MFC_OpenCV_Image_Video.exe.em
文件 984 2014-11-16 13:52 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\Debug\MFC_OpenCV_Image_Video.exe.em
文件 861 2014-11-16 14:32 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\Debug\MFC_OpenCV_Image_Video.exe.intermediate.manifest
文件 131038 2014-11-16 14:07 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\Debug\MFC_OpenCV_Image_Video.obj
文件 25296896 2014-11-16 13:52 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\Debug\MFC_OpenCV_Image_Video.pch
文件 23732 2014-11-16 13:52 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\Debug\MFC_OpenCV_Image_Video.res
文件 157055 2014-11-16 14:32 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\Debug\MFC_OpenCV_Image_VideoDlg.obj
文件 62 2014-11-16 14:32 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\Debug\mt.dep
文件 466699 2014-11-16 13:52 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\Debug\stdafx.obj
文件 1387520 2014-11-16 14:32 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\Debug\vc90.idb
文件 2953216 2014-11-16 14:32 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\Debug\vc90.pdb
文件 5552 2014-11-11 16:08 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\dirent.h
文件 59544 2014-11-16 13:52 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video.aps
文件 2292 2014-11-16 13:35 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video.cpp
文件 600 2014-11-16 13:35 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video.h
文件 5923 2014-11-16 13:52 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video.rc
文件 6549 2014-11-16 14:02 MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video\MFC_OpenCV_Image_Video.vcproj
............此处省略11个文件信息
相关资源
- MFC+VS2013+OPENCV3.0打开摄像头,拍照并处
- MFC PDF教程全套
- 仿Wireshark抓包工具MFC实现
- MFC画有角度的椭圆
- 学习OpenCV(中文版)252853
- mfc编程共85个
- VS2015大漠注册找图
- MFC销售管理SaleSystem.rar
- 基于MFC的图像处理课程设计
- 基于MFC编写的FTP客户端(使用VS)
- VS2017C++windows桌面应用程序项目OpenCV及
- High-speed Charting Control--MFC
- MFC下父窗口与子窗口的数据发送
- ATM页面程序MFC对话框
- MFC显示BMP格式图片
- mfc/cuda/opengl程序
- MFC北京公交车查询系统C/C++
- MFC局域网聊天室可屏蔽、可私聊C++ 客
- MFC航空客运订票系统
- 基于MFC的虚拟键盘
- OGRE嵌入MFC代码以及嵌入过程说明
- MFC实现rtsp视频流的播放
- teechart代码教程
- 基于C++的基础车牌识别
- 基于opencv的C++车牌识别
- GDI+绘制矩形,并且实现可旋转、缩放
- MFC 绘制半透明文字并保存为背景透明
- MFC 常用界面组件集合CGridCtrl
- C++MFC学习资料整合大全
- DES加解密 MFC
评论
共有 条评论