DirectShow:图片的抓取---从摄像头流中捕捉一张图片zzDirectshow中的视频捕捉
2012-08-08 17:06
519 查看
在播放媒体文件的过程中,有一个很有用的功能,就是在当前播放的位置抓取图,实现这种图片抓取功能的方法很多,我们这里只介绍常用的两种。
第1种方法最简单,它使用1BasicVideo::GetCurrentImage接口方法,代码如下。
heel SnapshotBitmap(IBasicVideo*pBa8icVideo, const char*OutFile)
if (pBasicVldeo)
{
long bitmapSize=0;
//首先获得图像大小
if(SUCCEEDED(pEasicVidee->GetcurrentImage(&bitmapSize,0)))
{
bool pass=false;
//分配图像帧内存
unsigned char*buffer=new unsigned char[bitmapSize];
//获取图像帧数据
if(SUCCEEDED(pBasicVideo->GetCurrentImage(&bitmapSize,(long*)buffer)))
{
BITMAPFILEHEADER hdr;
LPBITMAPINFOHEADER ipbi;
ipbi=(LPBITMAPINFOHEADER)buffer;
int nColors=1<<ipbi->biBitCount;
if(nColors>256)
//always is”BM”
hdr.bfType =((WORD)(‘M’<<8)|’B’);
hdr.bfSize =bitmapSize+sizeof(hdr);
hdr.bfReservedl =0;
hdr.bfReserved2
第1种方法最简单,它使用1BasicVideo::GetCurrentImage接口方法,代码如下。
heel SnapshotBitmap(IBasicVideo*pBa8icVideo, const char*OutFile)
if (pBasicVldeo)
{
long bitmapSize=0;
//首先获得图像大小
if(SUCCEEDED(pEasicVidee->GetcurrentImage(&bitmapSize,0)))
{
bool pass=false;
//分配图像帧内存
unsigned char*buffer=new unsigned char[bitmapSize];
//获取图像帧数据
if(SUCCEEDED(pBasicVideo->GetCurrentImage(&bitmapSize,(long*)buffer)))
{
BITMAPFILEHEADER hdr;
LPBITMAPINFOHEADER ipbi;
ipbi=(LPBITMAPINFOHEADER)buffer;
int nColors=1<<ipbi->biBitCount;
if(nColors>256)
//always is”BM”
hdr.bfType =((WORD)(‘M’<<8)|’B’);
hdr.bfSize =bitmapSize+sizeof(hdr);
hdr.bfReservedl =0;
hdr.bfReserved2
相关文章推荐
- DirectShow:图片的抓取 zz从摄像头流中捕捉一张图片zzDirectshow中的视频捕捉zz
- windows mobile中使用DirectShow开发视频流之从摄像头流中捕捉一张图片
- 利用ov511的webeye v2000摄像头实现YUV420P格式转RGB24格式来抓取一张图片
- Directshow捕捉摄像头视频的类CameraCapture(SDK)
- [转] 从摄像头流中捕捉一张图片
- 利用ov511的webeye v2000摄像头实现YUV420P格式转RGB24格式来抓取一张图片
- C# WinForm DirectShow视频采集及图片抓取实例DxSnap
- 利用ov511的webeye v2000摄像头实现YUV420P格式转RGB24格式来抓取一张图片
- delphi 摄像头视频图像捕捉 不用directshow来实现 还有其它什么方法吗?
- [引]C# WinForm DirectShow视频采集及图片抓取实例DxSnap
- [引]C# WinForm DirectShow视频采集及图片抓取实例DxSnap
- DirectShow编程实现摄像头视频捕捉
- 利用ov511的webeye v2000摄像头实现YUV420P格式转RGB24格式来抓取一张图片
- OpenCV:从摄像头或AVI文件捕捉视频流并进行边缘检测
- 主题:android调用系统摄像头拍照图片和视频
- DirectShow:图片的抓取
- 调用系统图片库选择图片,调用摄像头拍摄图片保存图片,调用摄像头录像保存录像视频片段
- VS2008+MFC+opencv 显示视频图像/捕捉摄像头视频界面
- Directshow(SDK)学习笔记九_视频捕捉
- VC+DirectShow对视频进行图片处理