SlideShare a Scribd company logo
Computer GraphicsComputer Graphics
Exercise 1Exercise 1
Halftoning and Color TransferHalftoning and Color Transfer
Due date: 20.11.05Due date: 20.11.05
Part 1Part 1
HalftoningHalftoning
General DescriptionGeneral Description
The purpose of this part of the exercise isThe purpose of this part of the exercise is
to generate half tone images with twoto generate half tone images with two
techniques:techniques:
i.i. Ordered Dithering.Ordered Dithering.
ii.ii. Error Distribution.Error Distribution.
Original ImageOriginal Image
Ordered DitheringOrdered Dithering
Error DiffusionError Diffusion
Propagate the error to the Four surrounding neighbours
Program UsageProgram Usage
The program should be namedThe program should be named
““halftoning.exehalftoning.exe”.”.
The programs gets from theThe programs gets from the command linecommand line
TWOTWO parameters:parameters:
1.1. OptionOption –d–d oror –e–e
2.2. Input filenameInput filename
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)
Part 2Part 2
Color TransferColor Transfer
General DescriptionGeneral Description
 The purpose of this part is to implement aThe purpose of this part is to implement a
simple algorithm that transfers the colorssimple algorithm that transfers the colors
of one image onto another image.of one image onto another image.
ExampleExample
ColorsColors
Result:Result:
The algorithmThe algorithm
 You will find an affine mapping (Matrix +You will find an affine mapping (Matrix +
translation) between thetranslation) between the colorcolor spaces of the twospaces of the two
images.images.
 For every pixelFor every pixel ii of the first image, you take itsof the first image, you take its
colorcolor ppii = (= (rrii, g, gii, b, bii)), and apply the mapping M., and apply the mapping M.
 You obtain the new color for pixelYou obtain the new color for pixel ii::
( )M A= +p p t
( )i iM′ =p p
In detailIn detail
R
B
G
R
B
GHow to find
a good mapping?
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
 DefineDefine MM as the affine mapping between those boxes!as the affine mapping between those boxes!
Program UsageProgram Usage
The program should be namedThe program should be named
““ColorTransfer.exeColorTransfer.exe”.”.
The programs gets from theThe programs gets from the command linecommand line
TWOTWO parameters:parameters:
1.1. First input filename (the one to map theFirst input filename (the one to map the
colors onto)colors onto)
2.2. Second input filename (the one to takeSecond input filename (the one to take
the colors from)the colors from)
Program UsageProgram Usage
The program generates one output imageThe program generates one output image
res_<input_name_1>res_<input_name_1>
General GuidelinesGeneral Guidelines
Important RemarksImportant 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 isIn this assignment there is nono need toneed to
open a window or use OpenGL in anyopen a window or use OpenGL in any
way.way.
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 andPoints will be rewarded for nice and
original images.original images.
More Important RemarksMore Important Remarks
 Don't forget to check the number ofDon'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 betweenPay 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.
A Little HelpA Little Help
 IrfanView – An image viewer, editor.IrfanView – An image viewer, editor.
 FreeImage – A open source library forFreeImage – A open source library for
working with images.working with images.
 NewMat10 – matrix and linear algebraNewMat10 – matrix and linear algebra
librarylibrary
 See the links on the exercise webpageSee the links on the exercise webpage

More Related Content

Similar to Ex1

Open CV - 電腦怎麼看世界
Open CV - 電腦怎麼看世界Open CV - 電腦怎麼看世界
Open CV - 電腦怎麼看世界
Tech Podcast Night
 
engine terminology 2
 engine terminology 2 engine terminology 2
engine terminology 2
Alexballantyne
 
C Language Unit-1
C Language Unit-1C Language Unit-1
C Language Unit-1
kasaragadda srinivasrao
 
Unit1 jwfiles
Unit1 jwfilesUnit1 jwfiles
Unit1 jwfilesmrecedu
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsamitsarda3
 
Computer graphics
Computer graphics Computer graphics
Computer graphics
shafiq sangi
 
Computational Methods in Physics for Students
Computational Methods in Physics for StudentsComputational Methods in Physics for Students
Computational Methods in Physics for Students
MaheshPatil527151
 
Ijsrdv1 i4049
Ijsrdv1 i4049Ijsrdv1 i4049
Ijsrdv1 i4049ijsrd.com
 
C++ project
C++ projectC++ project
C++ project
AjaibalajiP
 
Engineterminoligy finished
Engineterminoligy finishedEngineterminoligy finished
Engineterminoligy finished
Collegeemailbrandon
 
Engine Terminology
Engine TerminologyEngine Terminology
Engine Terminology
raimondklavins
 
SFScon 2020 - Hlib Babii - DVC version control your datasets and ML experiments
SFScon 2020 - Hlib Babii - DVC version control your datasets and ML experimentsSFScon 2020 - Hlib Babii - DVC version control your datasets and ML experiments
SFScon 2020 - Hlib Babii - DVC version control your datasets and ML experiments
South Tyrol Free Software Conference
 
Researched definition
Researched definitionResearched definition
Researched definition
Arron96
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminology
Jaket123
 
1 of 6 LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
1 of 6  LAB 5 IMAGE FILTERING ECE180 Introduction to.docx1 of 6  LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
1 of 6 LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
mercysuttle
 
Y1 gd engine_terminology (1)
Y1 gd engine_terminology (1) Y1 gd engine_terminology (1)
Y1 gd engine_terminology (1)
TomCrook
 
making_changes_m1_v4a.pdf
making_changes_m1_v4a.pdfmaking_changes_m1_v4a.pdf
making_changes_m1_v4a.pdf
Saikiran336411
 
Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4) Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4)
TomCrook
 
Retrobjects - Fun with C64 and NES
Retrobjects - Fun with C64 and NESRetrobjects - Fun with C64 and NES
Retrobjects - Fun with C64 and NES
ESUG
 
project_final_seminar
project_final_seminarproject_final_seminar
project_final_seminarMUKUL BICHKAR
 

Similar to Ex1 (20)

Open CV - 電腦怎麼看世界
Open CV - 電腦怎麼看世界Open CV - 電腦怎麼看世界
Open CV - 電腦怎麼看世界
 
engine terminology 2
 engine terminology 2 engine terminology 2
engine terminology 2
 
C Language Unit-1
C Language Unit-1C Language Unit-1
C Language Unit-1
 
Unit1 jwfiles
Unit1 jwfilesUnit1 jwfiles
Unit1 jwfiles
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Computer graphics
Computer graphics Computer graphics
Computer graphics
 
Computational Methods in Physics for Students
Computational Methods in Physics for StudentsComputational Methods in Physics for Students
Computational Methods in Physics for Students
 
Ijsrdv1 i4049
Ijsrdv1 i4049Ijsrdv1 i4049
Ijsrdv1 i4049
 
C++ project
C++ projectC++ project
C++ project
 
Engineterminoligy finished
Engineterminoligy finishedEngineterminoligy finished
Engineterminoligy finished
 
Engine Terminology
Engine TerminologyEngine Terminology
Engine Terminology
 
SFScon 2020 - Hlib Babii - DVC version control your datasets and ML experiments
SFScon 2020 - Hlib Babii - DVC version control your datasets and ML experimentsSFScon 2020 - Hlib Babii - DVC version control your datasets and ML experiments
SFScon 2020 - Hlib Babii - DVC version control your datasets and ML experiments
 
Researched definition
Researched definitionResearched definition
Researched definition
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminology
 
1 of 6 LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
1 of 6  LAB 5 IMAGE FILTERING ECE180 Introduction to.docx1 of 6  LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
1 of 6 LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
 
Y1 gd engine_terminology (1)
Y1 gd engine_terminology (1) Y1 gd engine_terminology (1)
Y1 gd engine_terminology (1)
 
making_changes_m1_v4a.pdf
making_changes_m1_v4a.pdfmaking_changes_m1_v4a.pdf
making_changes_m1_v4a.pdf
 
Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4) Y1 gd engine_terminology (1) (4)
Y1 gd engine_terminology (1) (4)
 
Retrobjects - Fun with C64 and NES
Retrobjects - Fun with C64 and NESRetrobjects - Fun with C64 and NES
Retrobjects - Fun with C64 and NES
 
project_final_seminar
project_final_seminarproject_final_seminar
project_final_seminar
 

Recently uploaded

How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 

Recently uploaded (20)

How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 

Ex1

  • 1. Computer GraphicsComputer Graphics Exercise 1Exercise 1 Halftoning and Color TransferHalftoning and Color Transfer Due date: 20.11.05Due date: 20.11.05
  • 3. General DescriptionGeneral Description The purpose of this part of the exercise isThe purpose of this part of the exercise is to generate half tone images with twoto generate half tone images with two techniques:techniques: i.i. Ordered Dithering.Ordered Dithering. ii.ii. Error Distribution.Error Distribution.
  • 6. Error DiffusionError Diffusion Propagate the error to the Four surrounding neighbours
  • 7. Program UsageProgram Usage The program should be namedThe program should be named ““halftoning.exehalftoning.exe”.”. The programs gets from theThe programs gets from the command linecommand line TWOTWO parameters:parameters: 1.1. OptionOption –d–d oror –e–e 2.2. Input filenameInput filename
  • 8. 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)
  • 9. Part 2Part 2 Color TransferColor Transfer
  • 10. General DescriptionGeneral Description  The purpose of this part is to implement aThe purpose of this part is to implement a simple algorithm that transfers the colorssimple algorithm that transfers the colors of one image onto another image.of one image onto another image.
  • 12. The algorithmThe algorithm  You will find an affine mapping (Matrix +You will find an affine mapping (Matrix + translation) between thetranslation) between the colorcolor spaces of the twospaces of the two images.images.  For every pixelFor every pixel ii of the first image, you take itsof the first image, you take its colorcolor ppii = (= (rrii, g, gii, b, bii)), and apply the mapping M., and apply the mapping M.  You obtain the new color for pixelYou obtain the new color for pixel ii:: ( )M A= +p p t ( )i iM′ =p p
  • 13. In detailIn detail R B G R B GHow to find a good mapping?
  • 14. 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  DefineDefine MM as the affine mapping between those boxes!as the affine mapping between those boxes!
  • 15. Program UsageProgram Usage The program should be namedThe program should be named ““ColorTransfer.exeColorTransfer.exe”.”. The programs gets from theThe programs gets from the command linecommand line TWOTWO parameters:parameters: 1.1. First input filename (the one to map theFirst input filename (the one to map the colors onto)colors onto) 2.2. Second input filename (the one to takeSecond input filename (the one to take the colors from)the colors from)
  • 16. Program UsageProgram Usage The program generates one output imageThe program generates one output image res_<input_name_1>res_<input_name_1>
  • 18. Important RemarksImportant 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 isIn this assignment there is nono need toneed to open a window or use OpenGL in anyopen a window or use OpenGL in any way.way.
  • 19. 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 andPoints will be rewarded for nice and original images.original images.
  • 20. More Important RemarksMore Important Remarks  Don't forget to check the number ofDon'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 betweenPay 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.
  • 21. A Little HelpA Little Help  IrfanView – An image viewer, editor.IrfanView – An image viewer, editor.  FreeImage – A open source library forFreeImage – A open source library for working with images.working with images.  NewMat10 – matrix and linear algebraNewMat10 – matrix and linear algebra librarylibrary  See the links on the exercise webpageSee the links on the exercise webpage