Filters - Harium/keel GitHub Wiki
Any algorithm to process images we call "filter", you can think about Intagram or Photoshop filters (yes, they are filters) but filters can be a lot more simple and do just very specific tasks, maybe changing all darker pixels to black or turning all the margin blue.
Why use filters?
Images are normally a complex pattern of colors, objects, forms and normally have a true meaning to humans. Now think about how hard is to teach a computer to see what(and how) we see. We usually want to work with just a piece of the image so, we use filter to find where is this piece or many of them.
Filters are used to change, find and/or removing these pieces of the image.
Strategy
The E-Motion's filters uses a Search Strategy to "walk" in an image.
Seach Strategy
Search Strategy is a combination of a Search Algorithm, a Color Strategy, a Component Modifier Strategy and a List of a Component Validation Strategy.
It looks excessively complex but it's not, Strategy pattern let us reuse a huge amount of code in the filters and all of these strategies are necessary.
Search Algorithms
You can start from left or for right, from upper, you can search just for odd pixels, and so.
Search Algorithms needs a ColorStrategy to validade a pixel.
Component Validation Strategy
Is a Strategy to validate a component founded by the Search Algorithm, if the component wasn't validated, it is discarded. There are some validation classes see: