{"id":4067,"date":"2020-04-06T15:57:58","date_gmt":"2020-04-06T19:57:58","guid":{"rendered":"https:\/\/blogs.mathworks.com\/steve\/?p=4067"},"modified":"2020-04-06T16:00:04","modified_gmt":"2020-04-06T20:00:04","slug":"geometric-transformation-of-points-getting-started","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/steve\/2020\/04\/06\/geometric-transformation-of-points-getting-started\/","title":{"rendered":"Geometric Transformation of Points &#8211; Getting Started"},"content":{"rendered":"<div class=\"content\"><p>I like to think of geometric transformations of images (stretching, shrinking, rotating, etc.) by starting with the geometric transformations of points. You could think of a geometric point transformation as just moving a point from one location to another, like this:<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/steve\/files\/simple-transform.png\" alt=\"\"> <\/p><p>But that terminology quickly gets a little confusing. (What does it mean to move a point in a coordinate system to another location?) It helps to get little more systematic in our notation and thinking. Let's try defining a geometric transformation of a point as a mapping from a location in one coordinate system to a location (usually different) in another coordinate system. Here's a diagram to illustrate:<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/steve\/files\/dipum3e-fig-6-1.png\" alt=\"\"> <\/p><p><i><a href=\"http:\/\/imageprocessingplace.com\/DIPUM-3E\/dipum3e_main_page.htm\"><b>DIPUM3E<\/b><\/a> Figure 6.1<\/i><\/p><p>The Cartesian coordinate system $(w,z)$ is called the <i>input space<\/i>, and the Cartesian coordinate system $(x,y)$ is called the <i>output space<\/i>. (Note that Image Processing Toolbox documentation uses $(u,v)$ for the input space.) The mapping $T\\{\\cdot\\}$ is called the <i>forward mapping<\/i>, or <i>forward transformation<\/i>. The mapping $T^{-1}\\{\\cdot\\}$ is called the <i>inverse mapping<\/i>, or <i>inverse transformation<\/i>. In the diagram above, $(x,y) = T\\{(w,z)\\} = (w\/2,z\/2)$.<\/p><p>To give you a hint of where I'm going with this, imagine transforming a bunch of points according to the mapping $(x,y) = T\\{(w,z)\\} = (w\/2,z\/2)$. Specifically, imagine transforming all the points along the curve on the left, below:<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/steve\/files\/dipum3e-fig-6-2.png\" alt=\"\"> <\/p><p><i><a href=\"http:\/\/imageprocessingplace.com\/DIPUM-3E\/dipum3e_main_page.htm\"><b>DIPUM3E<\/b><\/a> Figure 6.2<\/i><\/p><p>On the right, you can see where the mapping moves all those points. And, if you squint and use your imagine, you can start to see how this idea might form the basis for shrinking an image.<\/p><p>More on this later.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_2cee3b60efdc48ad9b212126a46b46cc() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='2cee3b60efdc48ad9b212126a46b46cc ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 2cee3b60efdc48ad9b212126a46b46cc';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2020 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_2cee3b60efdc48ad9b212126a46b46cc()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2020a<br><\/p><\/div><!--\r\n2cee3b60efdc48ad9b212126a46b46cc ##### SOURCE BEGIN #####\r\n%% Geometric Transformation of Points\r\n% I like to think of geometric transformations of images (stretching,\r\n% shrinking, rotating, etc.) by starting with the geometric\r\n% transformations of points. You could think of a geometric point\r\n% transformation as just moving a point from one location to another,\r\n% like this:\r\n%\r\n% <<https:\/\/blogs.mathworks.com\/steve\/files\/simple-transform.png>>\r\n%\r\n% But that terminology quickly gets a little confusing. (What does it\r\n% mean to move a point in a coordinate system to another location?) It\r\n% helps to get little more systematic in our notation and thinking.\r\n% Let's try defining a geometric transformation of a point as a mapping\r\n% from a location in one coordinate system to a location (usually\r\n% different) in another coordinate system. Here's a diagram to\r\n% illustrate:\r\n%\r\n% <<https:\/\/blogs.mathworks.com\/steve\/files\/dipum3e-fig-6-1.png>>\r\n%\r\n% _<http:\/\/imageprocessingplace.com\/DIPUM-3E\/dipum3e_main_page.htm\r\n% *DIPUM3E*> Figure 6.1_\r\n%\r\n% The Cartesian coordinate system $(w,z)$ is called the _input space_,\r\n% and the Cartesian coordinate system $(x,y)$ is called the _output\r\n% space_. (Note that Image Processing Toolbox documentation uses $(u,v)$\r\n% for the input space.) The mapping $T\\{\\cdot\\}$ is called the _forward\r\n% mapping_, or _forward transformation_. The mapping $T^{-1}\\{\\cdot\\}$ is\r\n% called the _inverse mapping_, or _inverse transformation_. In the\r\n% diagram above, $(x,y) = T\\{(w,z)\\} = (w\/2,z\/2)$.\r\n%\r\n% To give you a hint of where I'm going with this, imagine transforming\r\n% a bunch of points according to the mapping $(x,y) = T\\{(w,z)\\} =\r\n% (w\/2,z\/2)$. Specifically, imagine transforming all the points along\r\n% the curve on the left, below:\r\n%\r\n% <<https:\/\/blogs.mathworks.com\/steve\/files\/dipum3e-fig-6-2.png>>\r\n%\r\n% _<http:\/\/imageprocessingplace.com\/DIPUM-3E\/dipum3e_main_page.htm\r\n% *DIPUM3E*> Figure 6.2_\r\n%\r\n% On the right, you can see where the mapping moves all those points.\r\n% And, if you squint and use your imagine, you can start to see how this\r\n% idea might form the basis for shrinking an image.\r\n%\r\n% More on this later.\r\n##### SOURCE END ##### 2cee3b60efdc48ad9b212126a46b46cc\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/steve\/files\/dipum3e-fig-6-1.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><p>I like to think of geometric transformations of images (stretching, shrinking, rotating, etc.) by starting with the geometric transformations of points. You could think of a geometric point... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/steve\/2020\/04\/06\/geometric-transformation-of-points-getting-started\/\">read more >><\/a><\/p>","protected":false},"author":42,"featured_media":4063,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1291],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/4067"}],"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=4067"}],"version-history":[{"count":7,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/4067\/revisions"}],"predecessor-version":[{"id":4085,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/4067\/revisions\/4085"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/media\/4063"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/media?parent=4067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/categories?post=4067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/tags?post=4067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}