对DirectShow驱动的摄像头进行改变分辨率的编程?

CrazyFrog2006 2006-08-31 01:49:35
大家好,我需要对一个DirectShow驱动的摄像头进行编程,编程的内容包括能灵活的改变分辨率(摄像头默认的为1280x1024,我希望能灵活改变,例如640x480,320x240等),改变色调等,有人告诉我说有现成的套件可以使用,谁知道这些套件是什么?怎么使用?如果没有现成的套件,如何编程改变分辨率的大小呢?
...全文
693 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
duangexin521 2006-10-31
  • 打赏
  • 举报
回复
楼主,不知道你实现了没有啊?小弟现在也在做这个,能不能把你原代码发给我参考一下~~谢谢拉~~
duan.gexin@byd.com.cn
zigzeg 2006-09-13
  • 打赏
  • 举报
回复
能不能在设置媒体类型时 设置图片的大小?
(我手边没有文档,只是凭记忆写的,有些变量结构体拼写不正确,请大家不要太在意. 非常感谢.)

AM_MEIDA_TYPE mt;

mt.maintype = media_video
mt.subtype = xxxrgb_24;
mt.formattype = formattype_videiinfo ;

videoinforhead vih;
vih.biHeader.bmWidth = 320;
vih.biHeader.bmHeight = 240;

mt.pbformat = (byte*)( &vih );
mt.cbformat = sizeof(videoinforhead);

xxx . setmediatype(&mt);
.
.
renderstram( xx .... xxx);
.
.
getmediatype( &mt );


为什么我设置的并没有改变,还是默认值?
非常感谢~~
zigzeg 2006-09-13
  • 打赏
  • 举报
回复
关注~~~~
yyhzpk 2006-08-31
  • 打赏
  • 举报
回复
CComPtr<IAMStreamConfig> pCfg = 0;;
hr = pVideoCaptureOutPin->QueryInterface(IID_IAMStreamConfig, (void **)&pCfg);
if (FAILED(hr))
return hr;

int iCount = 0, iSize = 0;
hr = pCfg->GetNumberOfCapabilities(&iCount, &iSize);
// AM_MEDIA_TYPE *pmtConfig2;
// Check the size to make sure we pass in the correct structure.
if (iSize == sizeof(VIDEO_STREAM_CONFIG_CAPS))
{
// Use the video capabilities structure.
for (int iFormat = 0; iFormat < iCount; iFormat++)
{
VIDEO_STREAM_CONFIG_CAPS scc;
VIDEOINFOHEADER* pVih;
BITMAPINFOHEADER* pBih = NULL;
AM_MEDIA_TYPE *pmtConfig;
hr = pCfg->GetStreamCaps(iFormat, &pmtConfig, (BYTE*)&scc);
if (SUCCEEDED(hr))
{
/* Examine the format, and possibly use it. */
pVih = (VIDEOINFOHEADER*)pmtConfig->pbFormat;
pBih = &pVih->bmiHeader;
int width = pBih->biWidth;
int height = pBih->biHeight;
if (width == m_iWidth && (height == m_iHeight || height == -m_iHeight))
{
pVih->AvgTimePerFrame = 10000000/m_nFrameRate;
hr = pCfg->SetFormat(pmtConfig);
// Delete the media type when you are done.
DeleteMediaType(pmtConfig);
pmtConfig = NULL;
hr = pCfg->GetFormat(&pmtConfig);
pVih = (VIDEOINFOHEADER*)pmtConfig->pbFormat;
pBih = &pVih->bmiHeader;
DeleteMediaType(pmtConfig);
break;
}
}
}
}
CrazyFrog2006 2006-08-31
  • 打赏
  • 举报
回复
自己顶一个!热切希望高手指点

2,543

社区成员

发帖
与我相关
我的任务
社区描述
专题开发/技术/项目 多媒体/流媒体开发
社区管理员
  • 多媒体/流媒体开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧