Inverse homography using drawTriangles()

Flash player version 10+ native drawTriangles() method is perfect for programming homography (2D transformation that preserves lines) because of its support for UVT data. In general case, however, homography requires solving 8×8 linear equations system, so noone can be arsed to code that. Instead they implement one of two special cases - mapping rectangle to or from quadrilateral. So far, only 1st case was implemented using drawTriangles, while 2nd case was done using filters. Well, no longer so – it turned out, inverting T values in Zeh code was sufficient to make it work backwards:

One interesting thing about this code is that noone really knows exactly how it works :) I didn’t have to study all the math behind Zeh code in order to “invert” it, and Zeh… well, let me quote:

I was lucky enough to get what I wanted working after a good amount of crazy trial and error (and beer)

8 Responses to “Inverse homography using drawTriangles()”


  1. 2 Jean-Marc Le Roux October 22, 2010 at 13:36

    Nive one !

    That should be very helpful in FlarToolkit right ?

    • 3 makc3d October 23, 2010 at 03:48

      Who knows. I never checked how do they compare quadrilaterals to marker reference data, probably a bunch of getPixel calls. Can’t be too slow, 8×8 grid means only 64 of them.

  2. 4 nicoptere October 23, 2010 at 02:25

    why is there no sound?

  3. 6 Mark Lundin November 1, 2010 at 18:39

    Thats pretty neat. I completely forgot you could use drawTriangles to do this.


  1. 1 Mark Lundin: Things I know & things I've stolen Trackback on December 2, 2010 at 16:39
  2. 2 Meet qtrack « ¿noʎ ǝɹɐ ʍoɥ 'ʎǝɥ Trackback on December 29, 2010 at 21:06

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Old stuff

October 2010
M T W T F S S
« Sep   Nov »
 123
45678910
11121314151617
18192021222324
25262728293031

Oh, btw…


Follow

Get every new post delivered to your Inbox.