PDA

View Full Version : Flip Video Horizontal, Flip Video vertical not enabled



sulabh
April 5, 2017, 13:53:18
Hello,

Ihave ordered the frame grabber DFG/SV1/PCIe from your company. As I have used the frame grabber for our imaging purpose, I found out that it does not supports FlipH and FlipV functionality. This functionality can be found in the SDK provided by you in documentation section (As we have used the inbuilt sample applications DemoApp and the corresponding check boxes Flip Video Horizontal and Flip Video vertical is not active). Is it because of the frame grabber I have ordered or I have to take another one which supports these functionalities.

Thanks in advance.

Stefan Geissler
April 5, 2017, 14:26:13
Hello

If a device does not support flipping, you can use the RotateFlip filter of IC Imaging Control in order to flip the image by software.

sulabh
April 5, 2017, 15:21:24
Hello

If a device does not support flipping, you can use the RotateFlip filter of IC Imaging Control in order to flip the image by software.

Hi Stefan,

Thanks for the information.

DShowLib::InitLibrary();
atexit(ExitLibrary);
m_pGrabber = new Grabber();
//Check for available devices
Grabber::tVidCapDevListPtr pVidCapDevList = m_pGrabber->getAvailableVideoCaptureDevices();
if( pVidCapDevList == 0 || pVidCapDevList->empty() )
{return;}
//Open the Device
for ( Grabber::tVidCapDevList::iterator it = pVidCapDevList->begin(); it != pVidCapDevList->end(); ++it )
{ m_pGrabber->openDev( *it );
break;}
//Set Filter
smart_com<IFrameFilter> pFlipFilter = FilterLoader::createFilter("Rotate Flip", "");
m_pGrabber->setDeviceFrameFilters(pFlipFilter.get());

Flip is not working because I see that nowhere i define the rotation i need (e.g. 90°, 180° or 270°). Probably i need to set it on pFLipFilter. However i dont find function to set these parameters. How can i set these parameters?

thank you in advance

Stefan Geissler
April 5, 2017, 15:46:56
Hi Sulabh

you made a good start so far. But you may also tell the filter, what to do for flipping.

That is flip:


pFlipFilter->setParameter( "Flip V", true);
pFlipFilter->setParameter( "Flip H", false);


Rotation and flipping are different things. That is rotation:


pFlipFilter->setParameter( "Rotation Angle", 180);


Please refer to https://www.theimagingsource.com/support/documentation/ic-imaging-control-cpp/stdfilterRotateFlip.htm

sulabh
April 6, 2017, 07:47:05
Hi Sulabh

you made a good start so far. But you may also tell the filter, what to do for flipping.

That is flip:


pFlipFilter->setParameter( "Flip V", true);
pFlipFilter->setParameter( "Flip H", false);


Rotation and flipping are different things. That is rotation:


pFlipFilter->setParameter( "Rotation Angle", 180);


Please refer to https://www.theimagingsource.com/support/documentation/ic-imaging-control-cpp/stdfilterRotateFlip.htm

Hello Stefan,

Thank you again for your reply. As you have mentioned I did what you have mentioned before. However the live stream is still not flipped or rotated. This is what i have tried.


DShowLib::InitLibrary();
atexit(ExitLibrary);
m_pGrabber = new Grabber();
//Check for available devices
Grabber::tVidCapDevListPtr pVidCapDevList = m_pGrabber->getAvailableVideoCaptureDevices();
if( pVidCapDevList == 0 || pVidCapDevList->empty() )
{return;}
//Open the Device
for ( Grabber::tVidCapDevList::iterator it = pVidCapDevList->begin(); it != pVidCapDevList->end(); ++it )
{ m_pGrabber->openDev( *it );
break;}
smart_com<IFrameFilter> pFilter = FilterLoader::createFilter( "Rotate Flip", "" );
pFilter->setParameter( "Rotate Angle", 180 );
m_pGrabber->setDeviceFrameFilters(pFilter.get());

Stefan Geissler
April 6, 2017, 08:28:32
Hello

The parameter is not "Rotate Angle", it is "Rotation Angle" as shown at
https://www.theimagingsource.com/support/documentation/ic-imaging-control-cpp/stdfilterRotateFlip.htm


pFilter->getParameter( "Rotation Angle", lAngle );

I must admit, it took more than a few seconds, until I saw this in your code.

sulabh
April 6, 2017, 08:37:42
Hello

The parameter is not "Rotate Angle", it is "Rotation Angle" as shown at
https://www.theimagingsource.com/support/documentation/ic-imaging-control-cpp/stdfilterRotateFlip.htm


pFilter->getParameter( "Rotation Angle", lAngle );

I must admit, it took more than a few seconds, until I saw this in your code.

Hi,

I did mistake in typing it is Rotation Angle. Issue has not been solved yet!! also why do you say getparameters().

sulabh
April 6, 2017, 08:48:33
long lAngle = 270;
smart_com<IFrameFilter> pFilter = FilterLoader::createFilter( "Rotate Flip", "" );
pFilter->getParameter( "Rotation Angle", lAngle );qDebug() << lAngle;
pFilter->setParameter( "Rotation Angle", lAngle );qDebug() << lAngle;
m_pGrabber->setDeviceFrameFilters(pFilter.get());


output is
0
0

It is strange because i set it 270, however it is not changing

Stefan Geissler
April 6, 2017, 09:19:50
Hello

If you get the value first, then it is 0 obviously. because that is the default value. Then you set the 0 again.

Stefan

sulabh
April 6, 2017, 09:24:03
Hi,


pFilter->setParameter( "Rotation Angle", 90); qDebug() << lAngle;
output is : 90

However the video is still not flipped. I guess might be the problem is with

m_pGrabber->setDeviceFrameFilters(pFilter.get());

Stefan Geissler
April 7, 2017, 14:40:25
Hi Sulabh

Sorry for the delay of my answer, but my Visual Studios refused to work yesterday evening. I tested the code on my own and the filter works as expected.


grabber.openDev("DFK 33GX174e");

smart_com<IFrameFilter> pFilter = FilterLoader::createFilter( "Rotate Flip", "" );
pFilter->setParameter( "Rotation Angle", 180 );
grabber.setDeviceFrameFilters(pFilter.get());

grabber.setVideoFormat("Y800 (1920x1200)");
grabber.setFPS(25.0);


The image is upside down.


pFilter->setParameter( "Rotation Angle", 90 );

Rotates the image around 90 degrees.

One question: If you do want to display the image upside down, means rotated by 180°, why do not you rotate the camera itself? The tripod adapter can be be mounted on all for sides.


pFilter->setParameter( "Flip V", true);
That flips the image as expected.

sulabh
April 10, 2017, 09:02:36
Hello Stefan,

Thank you again for your reply. It would be nice if you can answer few of my questions.
I have a frame grabber with two ports and each port is connected with a camera. When you say
grabber.openDev("DFK 33GX174e"); do you mean you are accesing the frame grabber card or do you mean the one of the camera attached to the frame grabber port.

Also can you let me know how can i get the name of cameras attached to frame grabber. Usually only 1 channel is active at a time so to switch between cameras i change it by following code :


//Selecting Channels
for ( Grabber::tInChnList::iterator it = pInpChnList->begin(); it != pInpChnList->end(); ++it )
{
m_pGrabber->setInputChannel(*it);
}


Because in my case it is the frame grabber card which is opened.

Also due to complexity of camera setup i cannot use tripod adapter.

Stefan Geissler
April 10, 2017, 11:27:22
Hello Sulabh

I am very sorry, I did not adapt the code I used to your device. Grabber::openDev() opens a device with its name. In my case, it is a DFK 33GX174e, because the camera simply lied on my desk. In your case it is DFG/SV1


grabber.openDev("DFK/SV1");
You may refer to the documentation about "openDev()" at https://www.theimagingsource.com/support/documentation/ic-imaging-control-cpp/meth_descGrabber_openDev.htm

And of course, you can not get camera information via the video channel of analogue cameras.


Also due to complexity of camera setup i cannot use tripod adapter.
Right. I forgot, you do not use one of our cameras, but an analogue cameras. I am sorry for that.

Are you able to Rotate the image now?

sulabh
April 10, 2017, 12:07:39
Hello Sulabh

I am very sorry, I did not adapt the code I used to your device. Grabber::openDev() opens a device with its name. In my case, it is a DFK 33GX174e, because the camera simply lied on my desk. In your case it is DFG/SV1


grabber.openDev("DFK/SV1");
You may refer to the documentation about "openDev()" at https://www.theimagingsource.com/support/documentation/ic-imaging-control-cpp/meth_descGrabber_openDev.htm

And of course, you can not get camera information via the video channel of analogue cameras.


Right. I forgot, you do not use one of our cameras, but an analogue cameras. I am sorry for that.

Are you able to Rotate the image now?

Hello Stefan,

No i dont have any success yet.
I am sure device is open because i am able to get frame rates and other features (get available input channels & set input channel).
As asked before i am using the frame grabber DFG/SV1/PCIe with analog cameras it does not supports FlipH and FlipV functionality. So is it because of frame grabber or cameras (Actually i dont have any idea about it).

Regards,
Sulabh Tiwari

Stefan Geissler
April 10, 2017, 12:26:45
Hello

The DFG/SV1 does not support flipping. The Rotate Flip filter does this in software. Thus I am running out of ideas, why the code, that works on my computer does not work on your computer. Which video format do you use? Which pixelformat do you use in the sink?

sulabh
April 10, 2017, 12:51:54
Hello

The DFG/SV1 does not support flipping. The Rotate Flip filter does this in software. Thus I am running out of ideas, why the code, that works on my computer does not work on your computer. Which video format do you use? Which pixelformat do you use in the sink?

Hello Stefan,

Here is all my code (updated with sink) :



DShowLib::InitLibrary();
atexit(ExitLibrary);
m_pGrabber = new Grabber();
//Check for available devices
Grabber::tVidCapDevListPtr pVidCapDevList = m_pGrabber->getAvailableVideoCaptureDevices();
if( pVidCapDevList == 0 || pVidCapDevList->empty() )
{return;}
//Open the Device
for ( Grabber::tVidCapDevList::iterator it = pVidCapDevList->begin(); it != pVidCapDevList->end(); ++it )
{ m_pGrabber->openDev( *it );
break;}
//Check available input channels
Grabber::tInChnListPtr pInpChnList = m_pGrabber->getAvailableInputChannels();
//Check if input channel exists or not
if( pInpChnList == 0 || pInpChnList->empty() )
{return;}
//Select Channels
for ( Grabber::tInChnList::iterator it = pInpChnList->begin(); it != pInpChnList->end(); ++it )
{
m_pGrabber->setInputChannel(*it);

i++;
if(i==2){break;}
}
//m_pGrabber->openDev("@device:pnp:\\\\?\\pci#ven_109e&dev_036e&subsys_00000000&rev_11#5&12a6b002&0&000008#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\\global");//This is the device name that i got from my QCameraInfo class
tFrameHandlerSinkPtr pSink = FrameHandlerSink::create( eRGB24, 3 );
m_pGrabber->setSinkType( pSink );
smart_com<IFrameFilter> pFilter = FilterLoader::createFilter( "Rotate Flip", "" );
pFilter->setParameter( "Rotation Angle", 270 );
m_pGrabber->setDeviceFrameFilters(pFilter.get());