在DirectShow,对很多设置可以通过 IAMVideoProcAmp接口设置亮度、对比度等属性
下面m_pVideo是源设备Filter,
CComPtr <IAMVideoProcAmp> pProcAmp;
hr = m_pVideo->QueryInterface(IID_IAMVideoProcAmp, (void**)&pProcAmp);
if(SUCCEEDED(hr))
{
long Min, Max, Step, Default, Flags, Val;
// 亮度. g_Brightness;
if( g_Brightness > 0 )
{
hr = pProcAmp->GetRange(VideoProcAmp_Brightness, &Min, &Max, &Step,
&Default, &Flags);
if(SUCCEEDED(hr))
{
hr = pProcAmp->Get(VideoProcAmp_Brightness, &Val, &Flags);
Val = Min+(Max-Min)*g_Brightness/100;
pProcAmp->Set(VideoProcAmp_Brightness, Val, Flags);
}
}
//对比度g_Contrast
if( g_Contrast > 0 )
{
hr = pProcAmp->GetRange(VideoProcAmp_Contrast, &Min, &Max, &Step,
&Default, &Flags);
if(SUCCEEDED(hr))
{
hr = pProcAmp->Get(VideoProcAmp_Contrast, &Val, &Flags);
Val = Min+(Max-Min)*g_Contrast/100;
pProcAmp->Set(VideoProcAmp_Contrast, Val, Flags);
}
}
//饱和度g_Saturation
if( g_Saturation > 0 )
{
hr = pProcAmp->GetRange(VideoProcAmp_Saturation, &Min, &Max, &Step,
&Default, &Flags);
if(SUCCEEDED(hr))
{
hr = pProcAmp->Get(VideoProcAmp_Saturation, &Val, &Flags);
Val = Min+(Max-Min)*g_Saturation/100;
pProcAmp->Set(VideoProcAmp_Saturation, Val, Flags);
}
}
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/cn_xinxin/archive/2008/04/10/2276159.aspx