Unregistered
May 18, 2006, 16:45:06
Hi,
I am trying to set up a small filter chain of two filters. The first one is a color classification filter, which takes an RGB24 image and converts it into a RGB8 image (of course does some color lookup and so on too).
The second one is the binarization filter from the samples.
I have set up the input and output type methods as follows:
void CColorClassifierFilter::getSupportedInputTypes( DShowLib::FrameTypeInfoArray& arr ) const
{
// This filter works for 24-bit-color images only
arr.addFrameType( eRGB24 );
}
bool CColorClassifierFilter::getTransformOutputTypes( const DShowLib::FrameTypeInfo& in_type, DShowLib::FrameTypeInfoArray& out_types ) const
{
FrameTypeInfo out_type = eRGB8;
out_type.dim = in_type.dim;
out_type.buffersize = out_type.dim.cx * out_type.dim.cy;
out_types.push_back( out_type );
return true;
}
and
void CBinarizationFilter::getSupportedInputTypes( DShowLib::FrameTypeInfoArray& arr ) const
{
// This filter works for 8-bit-gray images only
arr.push_back( eRGB8 );
}
bool CBinarizationFilter::getTransformOutputTypes( const DShowLib::FrameTypeInfo& in_type, DShowLib::FrameTypeInfoArray& out_types ) const
{
// We don't change the image type, output = input
out_types.push_back( in_type );
return true;
}
When I run them seperatly they work fine. If I hook them together like:
// Set filter parameters.
tFrameFilterList filterList;
// Use .get to extract a plain pointer from the smart pointer.
filterList.push_back( &m_binarizationFilter );
filterList.push_back( &m_ColorClassifierFilter );
m_Grabber.setDeviceFrameFilters( filterList );
The program hangs (or is caught in an endless loop) and writes the following error messages to the debugger:
TffdshowBase::Constructor
TffdshowDecVideo::Constructor
Join filter graph
CheckInputType: , 1024, 768
CheckInputType: , 1024, 768
CheckInputType: , 1024, 768
CheckInputType: , 1024, 768
CheckInputType: , 1024, 768
Removed from filter graph
Destructor
or
TffdshowBase::Constructor
TffdshowDecVideo::Constructor
Join filter graph
CheckInputType: , 1024, 768
CheckInputType: Y800, 1024, 768
Removed from filter graph
Destructor
Any idea what I am doing wrong???
If I change the order of the Filters I get an (expected) exception....
Thanks in advance for any suggestions...
Fabian
I am trying to set up a small filter chain of two filters. The first one is a color classification filter, which takes an RGB24 image and converts it into a RGB8 image (of course does some color lookup and so on too).
The second one is the binarization filter from the samples.
I have set up the input and output type methods as follows:
void CColorClassifierFilter::getSupportedInputTypes( DShowLib::FrameTypeInfoArray& arr ) const
{
// This filter works for 24-bit-color images only
arr.addFrameType( eRGB24 );
}
bool CColorClassifierFilter::getTransformOutputTypes( const DShowLib::FrameTypeInfo& in_type, DShowLib::FrameTypeInfoArray& out_types ) const
{
FrameTypeInfo out_type = eRGB8;
out_type.dim = in_type.dim;
out_type.buffersize = out_type.dim.cx * out_type.dim.cy;
out_types.push_back( out_type );
return true;
}
and
void CBinarizationFilter::getSupportedInputTypes( DShowLib::FrameTypeInfoArray& arr ) const
{
// This filter works for 8-bit-gray images only
arr.push_back( eRGB8 );
}
bool CBinarizationFilter::getTransformOutputTypes( const DShowLib::FrameTypeInfo& in_type, DShowLib::FrameTypeInfoArray& out_types ) const
{
// We don't change the image type, output = input
out_types.push_back( in_type );
return true;
}
When I run them seperatly they work fine. If I hook them together like:
// Set filter parameters.
tFrameFilterList filterList;
// Use .get to extract a plain pointer from the smart pointer.
filterList.push_back( &m_binarizationFilter );
filterList.push_back( &m_ColorClassifierFilter );
m_Grabber.setDeviceFrameFilters( filterList );
The program hangs (or is caught in an endless loop) and writes the following error messages to the debugger:
TffdshowBase::Constructor
TffdshowDecVideo::Constructor
Join filter graph
CheckInputType: , 1024, 768
CheckInputType: , 1024, 768
CheckInputType: , 1024, 768
CheckInputType: , 1024, 768
CheckInputType: , 1024, 768
Removed from filter graph
Destructor
or
TffdshowBase::Constructor
TffdshowDecVideo::Constructor
Join filter graph
CheckInputType: , 1024, 768
CheckInputType: Y800, 1024, 768
Removed from filter graph
Destructor
Any idea what I am doing wrong???
If I change the order of the Filters I get an (expected) exception....
Thanks in advance for any suggestions...
Fabian