资源简介
基于opencv的人脸先检测,然后采用分水岭算法进行分割。
代码片段和文件信息
#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-06-01 19:27 8.3\
文件 94924 2014-07-11 10:12 8.3\8.3.aps
文件 11922 2014-07-11 14:24 8.3\8.3.rc
文件 7088 2014-07-11 10:11 8.3\8.3.vcxproj
文件 2716 2014-07-11 10:11 8.3\8.3.vcxproj.filters
文件 143 2013-02-06 11:25 8.3\8.3.vcxproj.user
文件 6606 2015-06-01 18:42 8.3\CvvImage.cpp
文件 1875 2014-07-05 16:36 8.3\CvvImage.h
目录 0 2015-06-01 19:31 8.3\Debug\
文件 1980 2014-07-04 16:26 8.3\face_segment.cpp
文件 428 2013-02-06 11:25 8.3\face_segment.h
文件 14339 2015-06-01 19:17 8.3\face_segmentDlg.cpp
文件 1403 2014-07-11 15:08 8.3\face_segmentDlg.h
文件 919871 2013-01-28 07:17 8.3\haarcascade_frontalface_alt.xm
文件 4969 2014-07-11 10:09 8.3\MenuIcon.cpp
文件 1249 2013-02-07 10:30 8.3\MenuIcon.h
文件 2088960 2013-07-02 12:36 8.3\opencv_core246.dll
文件 1905664 2013-07-02 12:37 8.3\opencv_imgproc246.dll
文件 667648 2013-07-02 12:37 8.3\opencv_objdetect246.dll
文件 2941 2013-02-06 11:25 8.3\ReadMe.txt
目录 0 2015-06-01 19:27 8.3\Release\
目录 0 2015-06-01 19:01 8.3\res\
文件 3580 2014-07-11 09:36 8.3\resource.h
文件 67777 2009-08-31 02:31 8.3\res\face_segment.ico
文件 664 2013-02-06 11:25 8.3\res\My83.rc2
文件 46592 2014-07-11 09:43 8.3\res\Thumbs.db
文件 318 2014-07-11 09:36 8.3\res\保存.ico
文件 318 2014-07-04 16:12 8.3\res\打开图片.ico
文件 2862 2014-07-04 16:12 8.3\res\退出.ico
文件 136 2013-02-06 11:25 8.3\stdafx.cpp
文件 1632 2013-02-06 11:25 8.3\stdafx.h
............此处省略28个文件信息
- 上一篇:实现蓝牙传输文件源代码
- 下一篇:概率图模型学习理论及其应用_赵悦_清华大学出版社
相关资源
- Opencv3.4SUFR纵向图像平滑拼接
- OpenCV Linux依赖库ippicv_linux_20151201.tgz
- 使用OpenCV 手势识别
- win32平台的opencv3.3.0
- OpenCV-2.1.0-win32-vs2008
- OpenCV3编程入门_毛星云编著_电子工业
- OpenCV2.3.1库已编译完成,可以直接添加
- opencv2.2.0-win.zip
- OpenCV LBP特征提取源代码
- OpenCV实现SfM:双目三维重建
- opencv相机标定程序
- 基于opencv的图片旋转实现
- QT+OpenCV+VS Gerber光绘文件识别
- 海康威视实时视频预览+opencv实时处理
- 计盒维数/盒维数OpenCV计算图片分形维
- 《OpenCV教程》电子书+源代码
-
opencv2.fr
amework - 基于opencv的二维码畸变矫正QT程序
- OpenCV 3.3.0&opencv;_contrib-3.3.0 编译成功后
- opencv310 release Win32 Dll Lib
- 【OpenCV3版】《OpenCV3编程入门》书本配
- opencv车辆识别、标记并计数
- OpenCV中文参考手册
- 人脸检测exe程序可直接运行
- Opencv中查找轮廓,并用直线拟合,检
- opencv需要的常用dllcv100、cv200.dll、ml
- opencv彩色三通道图片反色
- 车牌识别opencv
- OpenCV教程--基础篇
- 人脸识别+opencv
评论
共有 条评论