资源简介
此程序中我们实现选取路径并加载显示图片,然后还可在显示的图片中标记ROI感兴趣区域。
代码片段和文件信息
#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-13 16:04 MFC_OpencvTest2_ROI\
目录 0 2014-11-13 19:49 MFC_OpencvTest2_ROI\Debug\
文件 114688 2014-11-14 15:12 MFC_OpencvTest2_ROI\Debug\MFC_OpencvTest2_ROI.exe
文件 1077628 2014-11-14 15:12 MFC_OpencvTest2_ROI\Debug\MFC_OpencvTest2_ROI.ilk
文件 4844544 2014-11-14 15:12 MFC_OpencvTest2_ROI\Debug\MFC_OpencvTest2_ROI.pdb
目录 0 2014-11-14 15:19 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\
文件 28412928 2014-11-14 15:20 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI.ncb
文件 923 2014-11-13 16:03 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI.sln
文件 38912 2014-11-14 15:20 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI.suo
文件 6546 2014-11-11 20:55 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\CvvImage.cpp
文件 1536 2014-11-11 21:30 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\CvvImage.h
目录 0 2014-11-14 15:12 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\
文件 18604 2014-11-14 15:12 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\BuildLog.htm
文件 140195 2014-11-13 19:57 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\CvvImage.obj
文件 118606 2014-11-14 15:12 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\ImageInfo.obj
文件 920 2014-11-13 16:04 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\MFC_OpencvTest2_ROI.exe.em
文件 984 2014-11-13 16:04 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\MFC_OpencvTest2_ROI.exe.em
文件 861 2014-11-14 15:12 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\MFC_OpencvTest2_ROI.exe.intermediate.manifest
文件 162704 2014-11-14 15:12 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\MFC_OpencvTest2_ROI.obj
文件 24838144 2014-11-13 19:57 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\MFC_OpencvTest2_ROI.pch
文件 23668 2014-11-14 13:45 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\MFC_OpencvTest2_ROI.res
文件 208184 2014-11-14 15:12 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\MFC_OpencvTest2_ROIDlg.obj
文件 62 2014-11-14 15:12 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\mt.dep
文件 466515 2014-11-13 19:57 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\stdafx.obj
文件 1518592 2014-11-14 15:12 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\vc90.idb
文件 3313664 2014-11-14 15:12 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\Debug\vc90.pdb
文件 5552 2014-11-11 16:08 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\dirent.h
文件 542 2014-11-13 16:30 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\ImageInfo.cpp
文件 672 2014-11-14 15:19 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\ImageInfo.h
文件 59400 2014-11-14 13:45 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI.aps
文件 2253 2014-11-13 16:03 MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI\MFC_OpencvTest2_ROI.cpp
............此处省略14个文件信息
相关资源
- CEF:MFC 对话框 DemoVS2013
- MFC 音乐播放器傻 瓜教程
- MFC聊天室与文件传输
- MFC多语言界面切换
- 牛哥推荐很好的CMFCOutlookBar
- MSDN中文版下载261719
- OpenCV 4 Cookbook_ C++ 4th Edition.pdf Robert
- opencv摄像机名称及id获取,以及串口名
- MFC写的QQ应用程序
- 进程/作业调度:时间片轮转调度算法
- MFC窗口打开ppt,可通过UDP控制。
- MFC教程.zip
- MFC课程设计:职工信息管理系统
- OpenCV和MFC的+界面程序+各种图像处理操
- 基于OpenCV3( Python / C++ ) 的车道检测
- 深入浅出mfc侯捷 简体中文版
-
MFC Media pla
yer控件制作的播放器 - MFC TAB control
- PictureControl
- 不用MFC写的小游戏
- mfc数据库图书管理系统
- c++实现基于停等协议的可靠udp传输的
- MFC+VS2013+OPENCV3.0打开摄像头,拍照并处
- 基于MFC的OpenCV视频图像显示小工具
- MFC PDF教程全套
- 仿Wireshark抓包工具MFC实现
- MFC画有角度的椭圆
- 学习OpenCV(中文版)252853
- mfc编程共85个
- VS2015大漠注册找图
评论
共有 条评论