Sunset Lake Software - Comments for "Erosion/dilation operators" http://www.sunsetlakesoftware.com/forum/erosiondilation-operators Comments for "Erosion/dilation operators" en I ended up implementing http://www.sunsetlakesoftware.com/forum/erosiondilation-operators#comment-1437 <p>I ended up implementing dilation and erosion for both single-channel images and RGB ones in the latest commits I posted yesterday. I went with a two-pass separable kernel to reduce the number of texture reads required for sampling over a rectangular area, and provided shaders for dilation sizes of 3, 5, 7, and 9. I didn't add a step size to this, but I can see an easy way to do so.</p> <p>I also created opening and closing filters using pairs of the erosion and dilation filters.</p> <p>See the GPUImageErosionFilter, GPUImageDilationFilter, GPUImageOpeningFilter, and GPUImageClosingFilter for my implementations. The FilterShowcase also has examples of the RGB variants of these running against live video. The 9-pixel sampling size opening and closing filters run at 10 FPS on an iPhone 4, which isn't bad.</p> <p>The only downside to the separable kernel is that it doesn't allow for arbitrary shapes in the dilation area (circles, diamonds, etc.), so you always end up with rectangular features. I can see creating a second set of operations that do a one-pass filtering over an arbitrary area, but those will probably be slower.</p> pubDate Mon, 04 Jun 2012 14:49:44 +0000 dc:creator Brad Larson guid false comment 1437 at http://www.sunsetlakesoftware.com Wrote the last post under a http://www.sunsetlakesoftware.com/forum/erosiondilation-operators#comment-1436 <p>Wrote the last post under a pseudonym, but this is really the same guy.</p> <p>It's not a great implementation, but it works. It uses a square structuring element, and you can specify the size of the square and the step size of the elements in the square. For example, a dilation size of 7 and step size 2 would look like this:</p> <p>1 0 1 0 1 0 1<br /> 0 0 0 0 0 0 0<br /> 1 0 1 0 1 0 1<br /> 0 0 0 [0] 0 0 0<br /> 1 0 1 0 1 0 1<br /> 0 0 0 0 0 0 0<br /> 1 0 1 0 0 0 1</p> <p>Where the bracketed 0 is the center pixel. If you want to use it, I can email it to you or send you a link.</p> <p>By the way, thanks for this awesome framework!</p> pubDate Mon, 04 Jun 2012 05:32:24 +0000 dc:creator jeff guid false comment 1436 at http://www.sunsetlakesoftware.com I was just working on this http://www.sunsetlakesoftware.com/forum/erosiondilation-operators#comment-1423 <p>I was just working on this myself. If you'd like, I could try to incorporate your code.</p> pubDate Thu, 31 May 2012 15:16:27 +0000 dc:creator Brad Larson guid false comment 1423 at http://www.sunsetlakesoftware.com Ended up hacking one up, http://www.sunsetlakesoftware.com/forum/erosiondilation-operators#comment-1422 <p>Ended up hacking one up, wasn't too bad.</p> pubDate Thu, 31 May 2012 07:48:05 +0000 dc:creator theo guid false comment 1422 at http://www.sunsetlakesoftware.com