{"id":2439,"date":"2017-01-03T07:00:39","date_gmt":"2017-01-03T12:00:39","guid":{"rendered":"https:\/\/blogs.mathworks.com\/steve\/?p=2439"},"modified":"2019-11-01T16:50:31","modified_gmt":"2019-11-01T20:50:31","slug":"aliasing-and-image-resizing-part-1","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/steve\/2017\/01\/03\/aliasing-and-image-resizing-part-1\/","title":{"rendered":"Aliasing and image resizing &#8211; part 1"},"content":{"rendered":"<div class=\"content\"><p>Happy New Year!<\/p><p>I'm going to kick off 2017 with two or three posts about <i>antialiasing<\/i>. Specifically, I will discuss what antialiasing means in the context of image resizing, and I will explain how the <tt>imresize<\/tt> function does it.<\/p><p>Let me show you two pairs of images. Image A is a \"zone plate\" image that I made using my function <tt>imzoneplate<\/tt>. (You can get this function from the <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/35961-zone-plate-test-image\/\">MATLAB Central File Exchange<\/a>).<\/p><p>Image A1 shows a bunch of concentrating cirles, some with a bright and some with a dark center, arranged on a grid.<\/p><p><b>Image A<\/b><\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/steve\/files\/zone-plate.png\" alt=\"\"> <\/p><p><b>Image A1<\/b><\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/steve\/files\/zone-plate-182x182-na.png\" alt=\"\"> <\/p><p>OK, here are images B and B1. Image B is a texture image drawn from a photograph of blue jeans.<\/p><p>Image B1 shows a thumbnail image with another texture that is rotated roughly 90 degrees from the texture in image B.<\/p><p><b>Image B<\/b><\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/steve\/files\/jeans.png\" alt=\"\"> <\/p><p><b>Image B1<\/b><\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/steve\/files\/jeans-52x52-na.png\" alt=\"\"> <\/p><p>As you may have guessed, image A1 is a thumbnail-resized version of image A, and image B1 is a thumbnail-resized version of image B.<\/p><p>Here's a GIF animation that I made. It shows several different thumbnails of image B that are made with slightly different sizes. As the thumbnail sizes change, you can see the geometrical pattern actually seem to swing around in different directions.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/steve\/files\/jeans-animation.gif\" alt=\"\"> <\/p><p>Next time I'll talk about what causes this effect and what can be done about it.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_1c5310667cfa46cca5fd7cca48c5e3d5() {\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='1c5310667cfa46cca5fd7cca48c5e3d5 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 1c5310667cfa46cca5fd7cca48c5e3d5';\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 2016 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_1c5310667cfa46cca5fd7cca48c5e3d5()\"><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; R2016b<br><\/p><\/div><!--\r\n1c5310667cfa46cca5fd7cca48c5e3d5 ##### SOURCE BEGIN #####\r\n%%\r\n% Happy New Year!\r\n%\r\n% I'm going to kick off 2017 with two or three posts about _antialiasing_.\r\n% Specifically, I will discuss what antialiasing means in the context of\r\n% image resizing, and I will explain how the |imresize| function does it.\r\n%\r\n% Let me show you two pairs of images. Image A is a \"zone plate\" image that\r\n% I made using my function |imzoneplate|. (You can get this function from\r\n% the <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/35961-zone-plate-test-image\/ \r\n% MATLAB Central File Exchange>).\r\n%\r\n% Image A1 shows a bunch of concentrating cirles, some with a bright\r\n% and some with a dark center, arranged on a grid.\r\n%\r\n% *Image A*\r\n%\r\n% <<https:\/\/blogs.mathworks.com\/steve\/files\/zone-plate.png>>\r\n%\r\n% *Image A1*\r\n%\r\n% <<https:\/\/blogs.mathworks.com\/steve\/files\/zone-plate-182x182-na.png>>\r\n%\r\n% OK, here are images B and B1. Image B is a texture image drawn from a\r\n% photograph of blue jeans.\r\n%\r\n% Image B1 shows a thumbnail image with another texture that is rotated\r\n% roughly 90 degrees from the texture in image B.\r\n%\r\n% *Image B*\r\n%\r\n% <<https:\/\/blogs.mathworks.com\/steve\/files\/jeans.png>>\r\n%\r\n% *Image B1*\r\n%\r\n% <<https:\/\/blogs.mathworks.com\/steve\/files\/jeans-52x52-na.png>>\r\n%\r\n% As you may have guessed, image A1 is a thumbnail-resized version of image\r\n% A, and image B1 is a thumbnail-resized version of image B.\r\n%\r\n% Here's a GIF animation that I made. It shows several different thumbnails\r\n% of image B that are made with slightly different sizes. As the thumbnail\r\n% sizes change, you can see the geometrical pattern actually seem to swing\r\n% around in different directions.\r\n%\r\n% <<https:\/\/blogs.mathworks.com\/steve\/files\/jeans-animation.gif>>\r\n%\r\n% Next time I'll talk about what causes this effect and what can be done\r\n% about it.\r\n\r\n##### SOURCE END ##### 1c5310667cfa46cca5fd7cca48c5e3d5\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/steve\/files\/zone-plate.png\" onError=\"this.style.display ='none';\" \/><\/div><p>Happy New Year!I'm going to kick off 2017 with two or three posts about antialiasing. Specifically, I will discuss what antialiasing means in the context of image resizing, and I will explain how the... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/steve\/2017\/01\/03\/aliasing-and-image-resizing-part-1\/\">read more >><\/a><\/p>","protected":false},"author":42,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[156],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/2439"}],"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=2439"}],"version-history":[{"count":3,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/2439\/revisions"}],"predecessor-version":[{"id":2444,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/2439\/revisions\/2444"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/media?parent=2439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/categories?post=2439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/tags?post=2439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}