PDA

View Full Version : Using Filter



jakovn
November 12, 2008, 20:47:38
I have wizard created solution as a starting point and I need to use denoise filter

At top I added

#ifdef _DEBUG
smart_com<IFrameFilter> pFilter = FilterLoader::createFilter( "DeNoise", // Filter name.
"stdfiltersd.ftf" ); // Module file.
#else
smart_com<IFrameFilter> pFilter = FilterLoader::createFilter( "DeNoise", // Filter name.
"stdfilters.ftf" ); // Module file.
#endif

and on button click I want to enable it so I have


m_cGrabber.stopLive();
pFilter->setParameter("DeNoise Level",4);
m_cGrabber.startLive(false);

After I click button, live stopps for part of a second, and continues with no filter applied.
Am I missing something?

Stefan Geissler
November 13, 2008, 08:32:46
Hello,

No, I do not think, you are missing something. First of all, please pass an empty string to the second parameter of createFilter.

I am sure, you also added the new filter in "pFilte"r to the Grabber object, so it knows about the filter. This can be done by a call to


m_cGrabber.setDeviceFrameFilters( pFilter );

Related links are:
http://www.imagingcontrol.com/en_US/support/documentation/class/meth_descGrabber_setDeviceFrameFilters.htm
http://www.imagingcontrol.com/en_US/support/documentation/class/meth_descGrabber_setDisplayFrameFilters.htm

jakovn
November 13, 2008, 10:36:07
Hello Stefan,

I changed second param to "" but adding
m_cGrabber.setDeviceFrameFilters( pFilter );
I get error compiling C2664:'bool DShowLib::Grabber::setDevuceFrameFilters(DShowLib: :IFrameFilters *)' : cannot convert parameter 1 from 'smart_com<TComObj> *' to 'DShowLib::IFrameFilter *'
with
[
TComObj=DShowLib::IFrameFilter
]
Types pointed to are unrelated;

i do miss something

Stefan Geissler
November 13, 2008, 11:50:10
Ups,

Then it should be
m_cGrabber.setDeviceFrameFilters( pFilter->get() );
Sorry.

jakovn
November 13, 2008, 18:47:07
Thank you, it works!
I had to change it to
m_cGrabber.setDeviceFrameFilters( pFilter.get() );

If I need to disable it is it OK to call
m_cGrabber.setDeviceFrameFilters( 0 );
It works, just want to make sure it is correct way to do it

Stefan Geissler
November 14, 2008, 08:32:44
Yes, this can be done in this way.