iphone - Derive a transform matrix given an image and the transformed image? -
iphone - Derive a transform matrix given an image and the transformed image? -
i'm working on project involving finding paths using a* algorithm (thanks, patrick lester, great tutorial). series of png maps supplied, points of involvement specified coordinates received web service , problem show paths between points. bit of disaster @ first because various levels not located in same coordinate scheme , moving 1 level involved unintentional shift in x , y coordinates instead of changing z - making cost , heuristic of level alter strange, non-optimal paths beingness generated.
to prepare have broken pathing calculation per-level solutions move new level intermediate, non-calculated step. instead chose create of level maps part of 1 coordinate scheme if @ lift on 1 level, lift nowadays on levels reaches @ same x , y coordinate.
only problem coordinates of points of involvement used original maps. coordinates don't match meaningful on new maps. while confident pathing working nicely scheme whole isn't because start , end points of path not beingness plotted correctly in map system.
to new maps (all located in 1 coordinate space) old maps each transformed in simple , repeatable way. figure if coordinate , apply same transform applied map refers to, well. maps rotated, resized , translated.
given image , resulting transformed image there way derive transformation matrix? it's iphone project ideally i'm looking cgaffinetransform. each map manipulate old map 1 time again new map , record transformation beingness done curious whether there way work backwards here.
(readers - if can help tag question improve please do, it's little out of area)
for finding transformation need minimum of point coordinates (original , transformed) equal number of parameters.
if working images, , not perfect geometrical entities, least squares computation much better. using more points, cut down errors induced space quantization (ie pixels).
if google "fit affine transformation to the lowest degree squares" you'll find code several functions purpose, including this one in python.
hth!
iphone graphics 2d transform
Comments
Post a Comment