DirectShow设置亮度、对比度等属性
2021-05-11
845
0
在DirectShow,对很多设置可以通过 IAMVideoProcAmp接口设置亮度、对比度等属性.
下面m_pVideo是源设备Filter.
IAMVideoProcAmp *pProcAmp = 0;
hr = m_pVideo->QueryInterface(IID_IAMVideoProcAmp, (void**)&pProcAmp);
if (SUCCEEDED(hr))
{
long Min, Max, Step, Default, Flags, Val;
// 亮度.
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);
}
}
//对比度
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);
}
}
//饱和度
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);
}
}
}
原文来源:https://blog.csdn.net/cn_xinxin/article/details/2276159
https://docs.microsoft.com/en-us/previous-versions/ms893692(v=msdn.10)
Linux参见:https://www.cnblogs.com/blfshiye/p/5151167.html
HID人机交互QQ群:564808376
UAC音频QQ群:218581009
UVC相机QQ群:331552032
BOT&UASP大容量存储QQ群:258159197
STC-USB单片机QQ群:315457461
USB技术交流QQ群2:580684376
USB技术交流QQ群:952873936