{"id":277,"date":"2012-01-01T10:12:33","date_gmt":"2012-01-01T10:12:33","guid":{"rendered":"http:\/\/ahay.org\/blog\/?p=277"},"modified":"2015-09-04T12:13:16","modified_gmt":"2015-09-04T12:13:16","slug":"program-of-the-month-sfsmooth","status":"publish","type":"post","link":"https:\/\/ahay.org\/blog\/2012\/01\/01\/program-of-the-month-sfsmooth\/","title":{"rendered":"Program of the month: sfsmooth"},"content":{"rendered":"<p><a href=\"\/RSF\/sfsmooth.html\">sfsmooth<\/a>, one of the most useful Madagascar programs, implements smoothing by triangle filtering. <\/p>\n<p>The idea of triangle filtering is explained in Jon Claerbout&#8217;s <a href=\"http:\/\/sepwww.stanford.edu\/data\/media\/public\/sep\/prof\/index.html\">books<\/a> <em>Processing versus Inversion<\/em> and <em>Image Estimation by Example<\/em>. You can find the explanation in the chapter <a href=\"\/RSF\/book\/gee\/ajt\/paper_html\/node15.html\">Smoothing with box and triangle<\/a>. The triangle filter of radius is a correlation of two box filters. In the <em>Z<\/em>-transform notation,<br \/>\n$$T_k(Z) = B_k(1\/Z)\\,B_k(Z)$$<br \/>\nwhere<br \/>\n$$B_k(Z) = \\displaystyle \\frac{1}{k}\\,\\left(1+Z+Z^2+\\cdots+Z^k\\right) = \\frac{1}{k}\\,\\frac{1-Z^{k+1}}{1-Z}$$<br \/>\nand $k$ is the smoothing radius. Triangle filtering is a very efficient operation, because it requires only $N$ multiplications for the input of size $N$. <\/p>\n<p>Triangle filtering serves as a good approximation to more expensive Gaussian filtering. Repeated triangle filtering rapidly approaches Gaussian filtering (a consequence of the central limit theorem). The following example from <a href=\"\/RSF\/book\/jsg\/shape\/smoo.html\">jsg\/shape\/smoo<\/a> demonstrates how repeated application of triangle smoothing turns a triangle filter into a Gaussian filter <\/p>\n<p><img decoding=\"async\" src=\"\/RSF\/book\/jsg\/shape\/smoo\/Fig\/tri.png\" alt=\"\" title=\"\" \/> <\/p>\n<p>The following example from <a href=\"\/RSF\/book\/gee\/ajt\/triangle.html\">gee\/ajt\/triangle<\/a> demonstrated how <strong>sfsmooth<\/strong> handles boundary conditions: the energy is reflected from the side in order to preserve the zero-frequency (DC) component of the input signal. Repeated smoothing or smoothing with a very large radius turns every signal into a constant. <\/p>\n<p><img decoding=\"async\" src=\"\/RSF\/book\/gee\/ajt\/triangle\/Fig\/triend.png\" alt=\"\" title=\"\" \/> <\/p>\n<p>In multiple dimensions, triangle smoothing is applied sequentially in different directions, possible with different radii (controlled by <strong>rect#=<\/strong> ) parameter. The following example from <a href=\"\/RSF\/book\/gee\/ajt\/mound.html\">gee\/ajt\/mound<\/a> shows shapes created by 2-D triangle smoothing after one pass and two passes (<strong>repeat=2<\/strong>). <\/p>\n<p><img decoding=\"async\" src=\"\/RSF\/book\/gee\/ajt\/mound\/Fig\/pyram.png\" alt=\"\" title=\"\" \/> <img decoding=\"async\" src=\"\/RSF\/book\/gee\/ajt\/mound\/Fig\/mound.png\" alt=\"\" title=\"\" \/><\/p>\n<p>Triangle smoothing is theoretically a self-adjoint operator. Numerically, the adjoint and forward operators are different. The action is controlled by the <strong>adj=<\/strong> parameter. <\/p>\n<p>For smoothing with a box instead of a triangle, use <a href=\"\/RSF\/sfboxsmooth.html\">sfboxsmooth<\/a>. <\/p>\n<p>For a different approach to smoothing, try <a href=\"\/RSF\/sfgaussmooth.html\">sfgaussmooth<\/a>, which implements smoothing by recursive Gaussian filtering. <\/p>\n<h3 id=\"previousprogramsofthemonth\">Previous programs of the month<\/h3>\n<ul>\n<li><a href=\"\/blog\/2011\/07\/03\/program-of-the-month-sfnoise\/\">sfnoise<\/a><\/li>\n<li><a href=\"\/blog\/2011\/08\/09\/program-of-the-month-sfgraph\/\">sfgraph<\/a><\/li>\n<li><a href=\"\/blog\/2011\/09\/03\/program-of-the-month-sfclip\/\">sfclip<\/a><\/li>\n<li><a href=\"\/blog\/2011\/10\/01\/program-of-the-month-sfagc\/\">sfagc<\/a><\/li>\n<li><a href=\"\/blog\/2011\/11\/05\/program-of-the-month-sfenvelope\/\">sfenvelope<\/a><\/li>\n<li><a href=\"\/blog\/2011\/12\/03\/programs-of-the-month-sfcontour\/\">sfcontour<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>sfsmooth, one of the most useful Madagascar programs, implements smoothing by triangle filtering. The idea of triangle filtering is explained in Jon Claerbout&#8217;s books Processing versus Inversion and Image Estimation by Example. You can find the explanation in the chapter Smoothing with box and triangle. The triangle filter of radius is a correlation of two [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","activitypub_content_warning":"","activitypub_content_visibility":"local","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-277","post","type-post","status-publish","format-standard","hentry","category-programs"],"_links":{"self":[{"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/posts\/277","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/comments?post=277"}],"version-history":[{"count":3,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/posts\/277\/revisions"}],"predecessor-version":[{"id":22402,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/posts\/277\/revisions\/22402"}],"wp:attachment":[{"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/media?parent=277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/categories?post=277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/tags?post=277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}