PDA

View Full Version : Difficulty in making a standard filter to work



cytonome
April 12, 2013, 22:05:30
Hello,

I'm trying to make a "Rotate Flip" to work with 90 degree rotation. Once applied I hope getting an image snapped and saved to compare with the previously captured non-rotated one. I'm omitting the irrelevant code below.

Here is what I'm doing:

// set filter
static smart_com<IFrameFilter> pRotFlipFilter = FilterLoader::createFilter( "Rotate Flip");
std::cerr << "pRotFlipFilter settings " << pRotFlipFilter->getSettings() <<std::endl;

// check if the grabber is in livemode
if( grabber.isLive() )
grabber.stopLive();
bool flag = grabber.setDeviceFrameFilters( pRotFlipFilter.get() );
DWORD err = GetLastError();
if( grabber.getLastError() )
std::cout << "setDeviceFrameFilters err= " << grabber.getLastError().c_str() << std::endl;

The printouts until now:

Available frame filters:
0:
Name: Bayer to Y800
Path: stdfilters.ftf
Filter class: generic
1:
Name: DeBayer
Path: stdfilters.ftf
Filter class: generic
2:
Name: DeNoise
Path: stdfilters.ftf
Filter class: generic
3:
Name: ROI
Path: stdfilters.ftf
Filter class: generic
4:
Name: Rotate Flip
Path: stdfilters.ftf
Filter class: generic

pRotFlipFilter settings <FrameFilter>
<param name="Flip H" type="bool">false</param>
<param name="Flip V" type="bool">false</param>
<param name="Rotation Angle" type="long">0</param>
</FrameFilter>

setDeviceFrameFilters err= This function cannot be called when livemode is active

Note, that "if( grabber.isLive() )" check returned false. Hoping that something is wrong with the error reporting mechanism, but otherwise fine, I continue:

pRotFlipFilter->beginParamTransfer();

if( eNO_ERROR != pRotFlipFilter->setParameter( "Rotation Angle", 90 ) )
std::cerr << "Error setting parameter 'Rotation Angle'" << std::endl;

pRotFlipFilter->endParamTransfer();

std::cerr << "pRotFlipFilter settings " << pRotFlipFilter->getSettings() <<std::endl;

Here is what I get, note that Rotation Angle was correctly set to 90:


pRotFlipFilter settings <FrameFilter>
<param name="Flip H" type="bool">false</param>
<param name="Flip V" type="bool">false</param>
<param name="Rotation Angle" type="long">90</param>
</FrameFilter>


When I continue with:

grabber.startLive(false);
...
pHandlerSink->snapImages( 1 );
pHandlerSink->getLastAcqMemBuffer()->save( "c:\\temp\\image.bmp" );

I don't see the saved image rotated. Any ideas ?

My camera is DMK 23GP031, libraries are of 3.2 version.

Thank you,
Vladimir

Michael Kirmse
April 15, 2013, 14:33:30
Hello Vladimir,

I have tried to reproduce your issue, but your code works fine here. For me it seems, that the grabber is still live when you try to set the filter and therefore setting the filter fails and the image is not rotated.
I am not sure what is causing this. For further investigation, would you please send us a small sample project that is able to reproduce this behavior?
You can either upload it as an attachment to your post or send it via email to support (at) imagingcontrol.com.

Thank you in advance.

Michael Kirmse
April 15, 2013, 15:47:22
One other thing you could try: After calling grabber.stopLive();, let the program idle some time (for example using Sleep(1500);) and then try to set the filter.

cytonome
April 15, 2013, 19:58:09
Thank you, Michael

As a matter of fact, I'm trying to setup the filter before starting the live grabber. For the sake of sanity, say if didn't close properly earlier, I run grabber.isLive(), which returns false.

Note, that "if( grabber.isLive() )" check returned false, so "grabber.stopLive();" didn't get executed. However, following your advice I added the two lines unconditionally:
grabber.stopLive();
Sleep(1500);

It didn't change the results. I also tried the ROI filter with the same result.

I'll zip up the project and email to support imagingcontrol.com. Note that I used this project for testing various API functions, so there is a lot of irrelevant and redundant code in there.

Best,
Vladimir

cytonome
April 18, 2013, 14:25:55
Hello Michael,

I emailed you the zipped project on Monday. Please confirm that you got all what you need to investigate.

Thank you,
Vladimir

Michael Kirmse
April 18, 2013, 14:46:10
Hello Vladimir,

I am afraid, something may have gone wrong here. I did not receive your email. Please use this form http://www.theimagingsource.com/en_US/company/contact/ to contact us in order to try again.

I am very sorry for the inconvenience.