{"id":55,"date":"2006-05-05T07:00:50","date_gmt":"2006-05-05T12:00:50","guid":{"rendered":"https:\/\/blogs.mathworks.com\/steve\/?p=55"},"modified":"2007-10-02T08:39:26","modified_gmt":"2007-10-02T13:39:26","slug":"spatial-transformations-inverse-mapping","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/steve\/2006\/05\/05\/spatial-transformations-inverse-mapping\/","title":{"rendered":"Spatial transformations: Inverse mapping"},"content":{"rendered":"<p>\r\nI wrote <a href=\"https:\/\/blogs.mathworks.com\/steve\/?p=53\">last week<\/a> about the <em>forward mapping<\/em> method of spatially transforming images. Because of the disadvantages of the forward mapping method, most of the practical implementations use a different technique, called <em>inverse mapping<\/em>.\r\n<\/p>\r\n\r\n<p>\r\nHere's how it works:\r\n<\/p>\r\n\r\n<p>\r\nLocate your output image pixel grid somewhere in output space. Then for each output pixel on the grid:\r\n<ul>\r\n<li> Apply the inverse spatial transformation to determine the corresponding location in input space: <em>(u<sub>k<\/sub>,v<sub>k<\/sub>) = T<sup>-1<\/sup>{(x<sub>k<\/sub>,y<sub>k<\/sub>)}<\/em>. <\/li>\r\n<li> Using the input image pixels nearest to <em>(u<sub>k<\/sub>,v<sub>k<\/sub>)<\/em>, interpolate to get an approximate value for the input image at <em>(u<sub>k<\/sub>,v<sub>k<\/sub>)<\/em>. <\/li>\r\n<li> Use that value for the <em>k<\/em>-th output pixel. <\/li>\r\n<\/ul>\r\n<\/p>\r\n\r\n<p>\r\nThis diagram illustrates the procedure:\r\n<\/p>\r\n\r\n<p>\r\n<img src=https:\/\/blogs.mathworks.com\/images\/steve\/55\/inverse_mapping.png>\r\n<\/p>\r\n\r\n<p>\r\nThis method completely avoids problems with gaps and overlaps. You just have to decide which interpolation method to you, and you also have to establish a rule for what value to use when \r\n<em>(u<sub>k<\/sub>,v<sub>k<\/sub>)<\/em> isn't within the input image pixel grid.\r\n<\/p>\r\n\r\n<p>\r\nThe inverse mapping does have its own disadvantages. I'll talk about those later, when I discuss more of the design details of specific Image Processing Toolbox functions.\r\n<\/p>","protected":false},"excerpt":{"rendered":"<p>\r\nI wrote last week about the forward mapping method of spatially transforming images. Because of the disadvantages of the forward mapping method, most of the practical implementations use a... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/steve\/2006\/05\/05\/spatial-transformations-inverse-mapping\/\">read more >><\/a><\/p>","protected":false},"author":42,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/55"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/comments?post=55"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/55\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/media?parent=55"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/categories?post=55"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/tags?post=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}