Thursday, February 19, 2009

To Flip or not to Flip, Image Orientation in Directshow

Here's a good insights regarding the cases where you need image flipping when coding filter in Directshow. There's quite lengthy narration on the history and the details on the article, but here's some important point :

  • Some Color Format use top-down orientation (the start of the image is on upper-left corner, e.g: RGB) other use bottom-up (start from lower-right corner, e.g: YUV)
  • The given height value show whether the image follow the orientation. Positive means the data follow the orientation, negative means it is inverted
With that two point in mind you could decide when to flip it or not. For example, if you need image with top-down orientation and got RGB with positive height value (means it's bottom-up oriented) you need to do the flipping while if the height value is negative (RGB but with top-down orientation) you don't need to.

No comments: