210 likes | 222 Views
Generate halftone images using ordered dithering and error distribution techniques. Implement a color transfer algorithm to transfer colors from one image to another.
E N D
Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05
Part 1 Halftoning
General Description The purpose of this part of the exercise is to generate half tone images with two techniques: i. Ordered Dithering. ii. Error Distribution.
Error Diffusion Propagate the error to the Four surrounding neighbours
Program Usage The program should be named “halftoning.exe”. The programs gets from the command lineTWO parameters: • Option –d or –e • Input filename
Program Usage The program generates one output image • dither_<input_name> (-d option) • errdiff_<input_name> (-e option)
Part 2 Color Transfer
General Description • The purpose of this part is to implement a simple algorithm that transfers the colors of one image onto another image.
Example Colors Result:
The algorithm • You will find an affine mapping (Matrix + translation) between the color spaces of the two images. • For every pixel i of the first image, you take its color pi = (ri, gi, bi), and apply the mapping M. • You obtain the new color for pixel i:
B B G G R R In detail How to find a good mapping?
B B G G R R Mapping by PCA • Find the axes by PCA • Compute the oriented bounding boxes • Define M as the affine mapping between those boxes!
Program Usage The program should be named “ColorTransfer.exe”. The programs gets from the command lineTWO parameters: • First input filename (the one to map the colors onto) • Second input filename (the one to take the colors from)
Program Usage The program generates one output image res_<input_name_1>
Important Remarks • You should write the programs in C or C++. • Document your program thoroughly. • In this assignment there is no need to open a window or use OpenGL in any way.
Important Remarks • The work can be done in pairs. • Submit your work on diskettes (or CD’s). Hardcopy of the documentation. • Points will be rewarded for nice and original images.
More Important Remarks • Don't forget to check the number of parameters that your program receives. • Don't forget to check memory allocations, if they succeeded or failed. • Pay attention to the difference between bytes, int’s and float’s (Rounding error). • Pay attention to the borders of the image.
A Little Help • IrfanView – An image viewer, editor. • FreeImage – A open source library for working with images. • NewMat10 – matrix and linear algebra library • See the links on the exercise webpage