Task 084: artistic image filters - Brush Strokes

The challenge is to design and implement an algorithm that calculates the effect of an artistic image filter on a given raster image. The result should be similar to impressionist painting techniques - for examples, see the Wikipedia page on of impressionism.

Renoir

Overview

The template application 084filter from the repository grcis serves as the basis of this project. This is a simple application in which it is possible to load an input image, enter a text parameter, and generate an output image. Within the application, the method Filter.Recompute() is responsible for calculating the output image. This method must be re-written, and the relevant location in the source Filter.cs indicated via comment brackets:

  // !!!{{
  // !!!}}

Technical details

The method Filter.Recompute() has the following parameters:
  • Bitmap input input file (if this is null, the function must properly deal with that case)
  • string param - an optional string parameter. If you use it, you'll have to define yourself what it can contain, and in and in what format (the pilot implementation uses rectangular cell size - one or two numbers separated by a comma)
The return value is calculated image in Bitmap format, and may be null.

Programming details

The sample application demonstrates several technical aspects:
  1. create an instance of output raster image in the fixed format of Format24bppRgb
  2. vquick access to binary data pixels - using methods Bitmap.LockBits() and unsafe blocks that indicate access to a locked memory block (a slow alternative to / with another algorithm / is also available)
  3. calculation in a separate thread - with the appropriate frequency in cycles, it is possible to control the value of the global logical variable Form1.cont (if this is set to false the algorithm should shut down as quickly as possible)
  4. Drag & Drop input image - the input file can be transferred in the form of mouse dragging from any Windows application that supports D & D

Inspiration

  • blurring done with an unconventional filter shape
  • rank filter (median) with an unconventional shape
  • shape of the filter depending on the local properties of the image (e.g., filter in a shape of a line segment orthogonal to the gradient of the image)
  • reduction of the set of colors (see Colour Reproduction slides)
  • techniques similar to (or based on) mosaics ("tiling")

Original and unconventional approaches are positively evaluated. The result and flexibility (parameters) of your algorithm are more important than its speed and complexity.

Infrastructure

If you need functions for conversion between RGB and HSV, please refer to the file common/MathSupport.cs. Greyscale conversion functions can be found in common/RasterDrawing.cs

What to hand in

You have to send us the file Filter.cs.
In the procedure InitParams() you can read any parameters you need.
If you use this string parameter param as input, do not forget to define and describe its semantics.
If you are using images to drive the input, and if you have achieved a nice result with a particular input image, you can also send us that image. But please watch the size of the mail attachment, and use some web upload service if it is too large (Dropbox, GoogleDrive, uloz.to), and just send us the URL instead.

Also, when submitting the file, please make sure that it includes meaningful comments that describe the algorithm you chose: how you chose it, where you found information on it (literature), or which application inspired you (Photoshop, GiMP, ..). You should also clearly describe what the intended results of the filter are!

Deadline

Hand in until: 4. 12. 2022

Points

Basis: 7 points, bonus up to 7 points.

Project

Visual Studio project: 084filter.

Source file

Modify and hand in the source file: Filter.cs
Please return your name in the InitParams() function!

Data

Your algorithm should work on any input image. For test purposes, you can use images from the repository directory data, and also the images sail.png, silverstone-17671.png, maran-18587.png, monarch.png, skyline129-178-246.png.


Copyright (C) 2015-2022 J. Pelikán & A. Wilkie, last change: 2022-11-09 15:36:12 +0100 (Wed, 09 Nov 2022)