none
I want to Rotate a video with some angle.

    Question

  • hi all,

    i m making a windows application in C#. i am capturing a video in a panel, and  i want to rotate this video by Some degree at the time of caputring through C# code...........
    ,plz  any one can help me...
     
    thanks in advance.

    Thursday, April 23, 2009 9:30 AM

Answers

  • Generally, you need a transformation filter to rotate the video data. In most cases it is implemented in C++, or perhaps you would prefer to find a third party filter that does the task. For C# related questions you should rather ask there: DirectShow .NET Forums
    http://alax.info/blog/tag/directshow
    Thursday, April 23, 2009 12:30 PM
  • IIRC, LeadTools has (a commercial) one.  See my Links page.

    There is no sample one that I am aware of.  You can adapt the resize filter on my site, as I pointed out to another poster a few days ago.

    Filters are generally in C++ though, not in .NET.
    My dshow site is http://tmhare.mvps.org.  Please use Vote As Helpful and Mark As Answer where appropriate.
    Friday, April 24, 2009 6:26 AM
    Moderator
  • It depends how or what level you want to do. If you can use DirectShow Filter, you can get IMediaSample buffer, before rendering. Refer In-Place transform example, which manipulates Sample image. You can do the similar rotation you want.
    david.tac

    You can't use an in-place transform filter to do a rotation because, except in the rare case of square video (width == height), the media type on the output pin is different than that on the input pin.

    Also, there is a more recent thread where I have given some sample code and Ralf has pointed to his SF project which has a sample implementation of rotation.
    My dshow site is http://tmhare.mvps.org.  Please use Vote As Helpful and Mark As Answer where appropriate.
    Thursday, April 30, 2009 9:53 PM
    Moderator
  • You can do a rotate for a square image in an inplace transform filter.  Look at the code I provided through the link in my last response.  I'm not sure why you think an inplace sample would be better than a regular transform filter like ezrgb24 or the resize filter on my Downloads page which shows how to have a different dimension media sample on the input and output pins.
    My dshow site is http://tmhare.mvps.org.  Please use Vote As Helpful and Mark As Answer where appropriate.
    Friday, May 01, 2009 8:47 PM
    Moderator

All replies

  • Generally, you need a transformation filter to rotate the video data. In most cases it is implemented in C++, or perhaps you would prefer to find a third party filter that does the task. For C# related questions you should rather ask there: DirectShow .NET Forums
    http://alax.info/blog/tag/directshow
    Thursday, April 23, 2009 12:30 PM
  • hi,
     i m beginer in directshow where i could found rotation filter. can you provide me any test application for that....
     thanks....
    Friday, April 24, 2009 6:13 AM
  • IIRC, LeadTools has (a commercial) one.  See my Links page.

    There is no sample one that I am aware of.  You can adapt the resize filter on my site, as I pointed out to another poster a few days ago.

    Filters are generally in C++ though, not in .NET.
    My dshow site is http://tmhare.mvps.org.  Please use Vote As Helpful and Mark As Answer where appropriate.
    Friday, April 24, 2009 6:26 AM
    Moderator
  • It depends how or what level you want to do. If you can use DirectShow Filter, you can get IMediaSample buffer, before rendering. Refer In-Place transform example, which manipulates Sample image. You can do the similar rotation you want.
    david.tac
    Thursday, April 30, 2009 8:17 PM
  • It depends how or what level you want to do. If you can use DirectShow Filter, you can get IMediaSample buffer, before rendering. Refer In-Place transform example, which manipulates Sample image. You can do the similar rotation you want.
    david.tac

    You can't use an in-place transform filter to do a rotation because, except in the rare case of square video (width == height), the media type on the output pin is different than that on the input pin.

    Also, there is a more recent thread where I have given some sample code and Ralf has pointed to his SF project which has a sample implementation of rotation.
    My dshow site is http://tmhare.mvps.org.  Please use Vote As Helpful and Mark As Answer where appropriate.
    Thursday, April 30, 2009 9:53 PM
    Moderator
  • No. What I meant was to use that as a reference how to get ImageSample buffer. For the Geometry, even it is squre-shaped, (w=h), you still can not do rotate, because some pixels are rotated outside the rectangle buffer. Rotating Image is just a similar manipulation as image transform. So IN-Place example, is a good reference for the question that was asked.
    david.tac
    Friday, May 01, 2009 2:03 PM
  • You can do a rotate for a square image in an inplace transform filter.  Look at the code I provided through the link in my last response.  I'm not sure why you think an inplace sample would be better than a regular transform filter like ezrgb24 or the resize filter on my Downloads page which shows how to have a different dimension media sample on the input and output pins.
    My dshow site is http://tmhare.mvps.org.  Please use Vote As Helpful and Mark As Answer where appropriate.
    Friday, May 01, 2009 8:47 PM
    Moderator