Search code examples
c#wpfcameradirectshow

Directshow stream images are sometimes flipped


I'm using the wpfmediakit with two ids ethernet cameras over the uEye drivers and sometimes when I launch the app the video feed is upside down. I am using the contols just like the documentation on the projects front page. I have observed two things,

  1. The video feed is perfectly normal when used with usb cameras (microsoft, logitech and ueye usb cameras)
  2. When I'm use the demo application the video feed is always correct

Has anyone experienced similar issues?


Solution

  • When the image is flipped upside down in DirectShow, there is one common cause for such artifact:

    The normal image row order for RGB images is bottom-to-top, that is last row goes first. The top-to-bottom format also exists and goes with negative value in biHeight field of underlying media type. It is quite rare and some components might be ignoring this. A similar but much more rare thing is that YUV images are always top-to-bottom, regardless of biHeight sign, and some buggy components are incorrectly flipping such images.

    All in all, somewhere in the pipeline the top-to-bottom order is likely to be confused with bottom-to-top and as a result the image is flipped.