• 大小: 52.25MB
    文件类型: .rar
    金币: 2
    下载: 0 次
    发布日期: 2024-02-01
  • 语言: C/C++
  • 标签: opencv  

资源简介

VS2013 / MFC + OpenCV 2.4.9实现视频的播放暂停和结束

资源截图

代码片段和文件信息

#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 == sizeof(IplImage) &&\
((IplImage*)img)->imageDat

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件   92930048  2016-04-01 12:57  VideoPlayer\VideoPlayer\ipch\videoplayer-ad21e016\videoplayer-a9b86e10.ipch

     文件   92930048  2016-03-01 22:29  VideoPlayer\VideoPlayer\ipch\videoplayer-f68dbe16\videoplayer-a9b86e10.ipch

     文件       6547  2016-02-25 16:08  VideoPlayer\VideoPlayer\VideoPlayer\CvvImage.cpp

     文件       1925  2016-02-29 14:42  VideoPlayer\VideoPlayer\VideoPlayer\CvvImage.h

     文件       4112  2016-03-01 21:01  VideoPlayer\VideoPlayer\VideoPlayer\ReadMe.txt

    .......     67777  2013-07-22 01:18  VideoPlayer\VideoPlayer\VideoPlayer\res\VideoPlayer.ico

     文件        678  2016-03-01 21:01  VideoPlayer\VideoPlayer\VideoPlayer\res\VideoPlayer.rc2

     文件       1608  2016-03-01 21:24  VideoPlayer\VideoPlayer\VideoPlayer\resource.h

     文件        144  2016-03-01 21:01  VideoPlayer\VideoPlayer\VideoPlayer\stdafx.cpp

     文件       1578  2016-03-01 21:01  VideoPlayer\VideoPlayer\VideoPlayer\stdafx.h

     文件        234  2016-03-01 21:01  VideoPlayer\VideoPlayer\VideoPlayer\targetver.h

     文件     109032  2016-03-02 15:31  VideoPlayer\VideoPlayer\VideoPlayer\VideoPlayer.aps

     文件       2439  2016-03-01 21:01  VideoPlayer\VideoPlayer\VideoPlayer\VideoPlayer.cpp

     文件        473  2016-03-01 21:01  VideoPlayer\VideoPlayer\VideoPlayer\VideoPlayer.h

     文件      11022  2016-03-02 15:31  VideoPlayer\VideoPlayer\VideoPlayer\VideoPlayer.rc

     文件       6255  2016-04-01 12:59  VideoPlayer\VideoPlayer\VideoPlayer\VideoPlayer.vcxproj

     文件       2265  2016-03-01 21:39  VideoPlayer\VideoPlayer\VideoPlayer\VideoPlayer.vcxproj.filters

     文件       5692  2016-04-01 12:58  VideoPlayer\VideoPlayer\VideoPlayer\VideoPlayerDlg.cpp

     文件        853  2016-03-01 22:29  VideoPlayer\VideoPlayer\VideoPlayer\VideoPlayerDlg.h

     文件    1818624  2015-02-16 13:45  VideoPlayer\VideoPlayer\VideoPlayer\屌丝男士.mov

     文件   88539136  2016-04-01 12:59  VideoPlayer\VideoPlayer\VideoPlayer.sdf

     文件        979  2016-03-01 21:01  VideoPlayer\VideoPlayer\VideoPlayer.sln

    ..A..H.     35840  2016-04-01 12:59  VideoPlayer\VideoPlayer\VideoPlayer.v12.suo

     目录          0  2016-04-01 12:59  VideoPlayer\VideoPlayer\VideoPlayer\Debug\VideoPlayer.tlog

     目录          0  2016-04-01 12:57  VideoPlayer\VideoPlayer\ipch\videoplayer-ad21e016

     目录          0  2016-03-01 22:29  VideoPlayer\VideoPlayer\ipch\videoplayer-f68dbe16

     目录          0  2016-04-01 12:59  VideoPlayer\VideoPlayer\VideoPlayer\Debug

     目录          0  2016-03-01 21:01  VideoPlayer\VideoPlayer\VideoPlayer\res

     目录          0  2016-04-01 12:59  VideoPlayer\VideoPlayer\Debug

     目录          0  2016-03-02 12:33  VideoPlayer\VideoPlayer\ipch

............此处省略6个文件信息

评论

共有 条评论