Top Banner
Computer Graphics Computer Graphics Exercise 1 Exercise 1 Halftoning and Color Halftoning and Color Transfer Transfer Due date: 24.03.05 Due date: 24.03.05
21

Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

Dec 20, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

Computer GraphicsComputer Graphics

Exercise 1Exercise 1

Halftoning and Color TransferHalftoning and Color Transfer

Due date: 24.03.05Due date: 24.03.05

Page 2: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

Part 1Part 1

HalftoningHalftoning

Page 3: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

General DescriptionGeneral Description

The purpose of this part of the exercise is The purpose of this part of the exercise is to generate half tone images with two to generate half tone images with two techniques:techniques:

i.i. Ordered Dithering. Ordered Dithering.

ii.ii. Error Distribution. Error Distribution.

Page 4: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

Original ImageOriginal Image

Page 5: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

Ordered DitheringOrdered Dithering

Page 6: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

Error DiffusionError DiffusionPropagate the error to the Four surrounding neighbours

Page 7: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

Program UsageProgram Usage

The program should be named The program should be named ““halftoning.exehalftoning.exe”. ”.

The programs gets from the The programs gets from the command linecommand line TWOTWO parameters: parameters:

1.1. Option Option –d–d or or –e–e

2.2. Input filenameInput filename

Page 8: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

Program UsageProgram Usage

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

Page 9: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

Part 2Part 2

Color TransferColor Transfer

Page 10: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

General DescriptionGeneral Description

The purpose of this part is to implement a The purpose of this part is to implement a simple algorithm that transfers the colors simple algorithm that transfers the colors of one image onto another image.of one image onto another image.

Page 11: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

ExampleExample

ColorsColors

Result:Result:

Page 12: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

The algorithmThe algorithm

You will find an affine mapping (Matrix + You will find an affine mapping (Matrix + translation) between the translation) between the colorcolor spaces of the two spaces of the two images.images.

For every pixel For every pixel ii of the first image, you take its of the first image, you take its color color ppii = ( = (rrii, g, gii, b, bii)), and apply the mapping M. , and apply the mapping M.

You obtain the new color for pixel You obtain the new color for pixel ii::

( )M A p p t

( )i iM p p

Page 13: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

In detailIn detail

R

B

G

R

B

GHow to finda good mapping?

Page 14: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

Mapping by PCAMapping by PCA

R

B

G

R

B

G

Find the axes by PCAFind the axes by PCA Compute the oriented bounding boxesCompute the oriented bounding boxes Define Define MM as the affine mapping between those boxes! as the affine mapping between those boxes!

Page 15: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

Program UsageProgram Usage

The program should be named The program should be named ““ColorTransfer.exeColorTransfer.exe”. ”.

The programs gets from the The programs gets from the command linecommand line TWOTWO parameters: parameters:

1.1. First input filename (the one to map the First input filename (the one to map the colors onto) colors onto)

2.2. Second input filename (the one to take Second input filename (the one to take the colors from)the colors from)

Page 16: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

Program UsageProgram Usage

The program generates one output imageThe program generates one output image

res_<input_name_1>res_<input_name_1>

Page 17: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

General GuidelinesGeneral Guidelines

Page 18: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

Important Remarks Important Remarks

You should write the programs in C or C+You should write the programs in C or C++. +.

Document your program thoroughly. Document your program thoroughly. In this assignment there is In this assignment there is nono need to need to

open a window or use OpenGL in any open a window or use OpenGL in any way. way.

Page 19: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

Important RemarksImportant Remarks

The work can be done in pairs.The work can be done in pairs. Submit your work on diskettes (or CD’s). Submit your work on diskettes (or CD’s).

Hardcopy of the documentation.Hardcopy of the documentation. Points will be rewarded for nice and Points will be rewarded for nice and

original images.original images.

Page 20: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

More Important RemarksMore Important Remarks

Don't forget to check the number of Don't forget to check the number of parameters that your program receives.parameters that your program receives.

Don't forget to check memory allocations, Don't forget to check memory allocations, if they succeeded or failed. if they succeeded or failed.

Pay attention to the difference between Pay attention to the difference between bytes, int’s and float’s (Rounding error).bytes, int’s and float’s (Rounding error).

Pay attention to the borders of the image.Pay attention to the borders of the image.

Page 21: Computer Graphics Exercise 1 Halftoning and Color Transfer Due date: 24.03.05.

A Little HelpA Little Help

IrfanView – An image viewer, editor.IrfanView – An image viewer, editor. FreeImage – A open source library for FreeImage – A open source library for

working with images.working with images. NewMat10 – matrix and linear algebra NewMat10 – matrix and linear algebra

librarylibrary

See the links on the exercise webpageSee the links on the exercise webpage