Computer Graphics Exercise 1 Halftoning and Color Transfer

  • Slides: 21
Download presentation
Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24. 03. 05

Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24. 03. 05

Part 1 Halftoning

Part 1 Halftoning

General Description The purpose of this part of the exercise is to generate half

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.

Original Image

Original Image

Ordered Dithering

Ordered Dithering

Error Diffusion Propagate the error to the Four surrounding neighbours

Error Diffusion Propagate the error to the Four surrounding neighbours

Program Usage The program should be named “halftoning. exe”. The programs gets from the

Program Usage The program should be named “halftoning. exe”. The programs gets from the command line TWO parameters: 1. Option –d or –e 2. Input filename

Program Usage The program generates one output image • dither_<input_name> (-d option) • errdiff_<input_name>

Program Usage The program generates one output image • dither_<input_name> (-d option) • errdiff_<input_name> (-e option)

Part 2 Color Transfer

Part 2 Color Transfer

General Description Ø The purpose of this part is to implement a simple algorithm

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:

Example Colors Result:

The algorithm Ø You will find an affine mapping (Matrix + translation) between the

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: Ø

In detail B B How to find a good mapping? G R

In detail B B How to find a good mapping? G R

Mapping by PCA B B G G R R Find the axes by PCA

Mapping by PCA B B G G R R 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 “Color. Transfer. exe”. The programs gets from

Program Usage The program should be named “Color. Transfer. exe”. The programs gets from the command line TWO parameters: 1. First input filename (the one to map the colors onto) 2. Second input filename (the one to take the colors from)

Program Usage The program generates one output image res_<input_name_1>

Program Usage The program generates one output image res_<input_name_1>

General Guidelines

General Guidelines

Important Remarks Ø You should write the programs in C or C++. Ø Document

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 Open. GL in any way.

Important Remarks Ø The work can be done in pairs. Ø Submit your work

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

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 Ø Irfan. View – An image viewer, editor. Ø Free. Image

A Little Help Ø Irfan. View – An image viewer, editor. Ø Free. Image – A open source library for working with images. Ø New. Mat 10 – matrix and linear algebra library Ø See the links on the exercise webpage