ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 90/270 degrees rotation of webcam video (DirectX
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Oribi

Netherlands
17 Posts

Posted - Jan 21 2014 :  01:39:38  Show Profile  Reply
Is it possible to rotate a camera feed (using DirectX) 90 or 270 degrees?

I'm currently using a 5 megapixel camera to capture images which I rotate using the TIEBitmap.Rotate() method after capturing them.
As you can imagine this slows down the capture rate considerable.

Is it possible to have the DirectX layer to perform the rotating instead?

--
Peter

Oribi

Netherlands
17 Posts

Posted - Jan 29 2014 :  06:21:29  Show Profile  Reply
The "Video Processing Project" (http://sourceforge.net/projects/videoprocessing/) contains a Rotate Filter which can be used to rotate images.

When I test this filter using GraphEdt everything works great, however when I add to the filter to the graph created by ImageEn the image appears to be corrupted (it is rotated though).

I currently use the following code to test this:

ImageEn.IO.DShowParams.SetVideoInput(0, 0, w, h, f);
ImageEn.IO.DShowParams.EnableSampleGrabber := true;
ImageEn.IO.DShowParams.Connect;
ImageEn.IO.DShowParams.SaveGraph('y:\graph1.grf');

// Get the Source Output Pin and the input Pin it is connected to
SourceFilter := ImageEn.IO.DShowParams.CurVideoInput;
SrcPinOut := GetPin(SourceFilter, IEPINDIR_OUTPUT);
SrcPinOut.ConnectedTo(DstPinIn);

// Break the existing link
SrcPinOut.Disconnect;
DstPinIn.Disconnect;

// Add the rotate filter
RotateFilter := CreateComObject(CLSID_RotateFilter) as IIEBaseFilter;
ImageEn.IO.DShowParams.Graph.AddFilter(RotateFilter, 'RotateFilter');

// Get the in- and outputpin of the rotate filter
RotateFilterIn := GetPin(RotateFilter, IEPINDIR_INPUT);
RotateFilterOut := GetPin(RotateFilter, IEPINDIR_OUTPUT);

// Place the Rotate Filter between the source
// and the original linked filter
ImageEn.IO.DShowParams.Graph.Connect(SrcPinOut, RotateFilterIn);
ImageEn.IO.DShowParams.Graph.Connect(RotateFilterOut, DstPinIn);

// Rotate 180 degrees
if RotateFilter.QueryInterface(ISettingsInterface, FilterSettings) = S_OK then
FilterSettings.SetParameter('rotationmode', '2');

// Save the new graph (for inspection using GraphEdt)
ImageEn.IO.DShowParams.SaveGraph('y:\graph2.grf');
ImageEn.IO.DShowParams.Run;

Does anyone know what I'm doing wrong?




Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: