This is a sample of how to apply edge filters to a set of images using F# and Accord.NET. The framework provides several Filters for image manipulating. Since I’m interested in edge enhancement I’ll limit my scope to those filters. In particular I’ve selected the
Using Paket, here is a sample
This is the boring setup stuff.
// Ref: http://accord-framework.net/docs/html/N_Accord_Imaging_Filters.htm
Loading and applying the filter is straight-forward. The only additional point worthy of mention is that most of the edge filters require the image to be in grayscale. That conversion is included in this function.
// Process image and save a result file with edge filter applied
The below code gets a list of qualifying images, then sends them through the filtering function.
// Is file an image file?
Below is an example of the edge filter applied.