inverse halftoning using inverse methods - diva portal643165/fulltext01.pdf · s kerheten och tillg...

49
Department of Science and Technology Institutionen för teknik och naturvetenskap Linköpings Universitet Linköpings Universitet SE-601 74 Norrköping, Sweden 601 74 Norrköping Examensarbete LITH-ITN-MT-EX--07/004--SE Inverse Halftoning Using Inverse Methods Oscar Gustavsson 2007-02-09

Upload: doandang

Post on 13-Jul-2019

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Department of Science and Technology Institutionen för teknik och naturvetenskap Linköpings Universitet Linköpings Universitet SE-601 74 Norrköping, Sweden 601 74 Norrköping

ExamensarbeteLITH-ITN-MT-EX--07/004--SE

Inverse Halftoning UsingInverse Methods

Oscar Gustavsson

2007-02-09

Page 2: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

LITH-ITN-MT-EX--07/004--SE

Inverse Halftoning UsingInverse Methods

Examensarbete utfört i medieteknikvid Linköpings Tekniska Högskola, Campus

Norrköping

Oscar Gustavsson

Handledare Björn KruseExaminator Björn Kruse

Norrköping 2007-02-09

Page 3: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

RapporttypReport category

Examensarbete B-uppsats C-uppsats D-uppsats

_ ________________

SpråkLanguage

Svenska/Swedish Engelska/English

_ ________________

TitelTitle

FörfattareAuthor

SammanfattningAbstract

ISBN_____________________________________________________ISRN_________________________________________________________________Serietitel och serienummer ISSNTitle of series, numbering ___________________________________

NyckelordKeyword

DatumDate

URL för elektronisk version

Avdelning, InstitutionDivision, Department

Institutionen för teknik och naturvetenskap

Department of Science and Technology

2007-02-09

x

x

LITH-ITN-MT-EX--07/004--SE

Inverse Halftoning Using Inverse Methods

Oscar Gustavsson

This Master´s thesis discusses the problems concerning inverse halftoning, which means converting ahalftone image into a continuous tone one. The thesis evaluates the use of inverse methods, showingpromising results. The algorithm is implemented and tested using Matlab and serves as a prototype forpossible full scale applications.

The work is based upon previously published articles on the subject, along with basic halftoning andprinting theory. This serves as a starting point from which the proposed method is developed, and theresults are in some areas competitive against other, previously published approaches.

inverse halftoning,descreening,inverse methods

Page 4: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Upphovsrätt

Detta dokument hålls tillgängligt på Internet – eller dess framtida ersättare –under en längre tid från publiceringsdatum under förutsättning att inga extra-ordinära omständigheter uppstår.

Tillgång till dokumentet innebär tillstånd för var och en att läsa, ladda ner,skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat förickekommersiell forskning och för undervisning. Överföring av upphovsrättenvid en senare tidpunkt kan inte upphäva detta tillstånd. All annan användning avdokumentet kräver upphovsmannens medgivande. För att garantera äktheten,säkerheten och tillgängligheten finns det lösningar av teknisk och administrativart.

Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsman iden omfattning som god sed kräver vid användning av dokumentet på ovanbeskrivna sätt samt skydd mot att dokumentet ändras eller presenteras i sådanform eller i sådant sammanhang som är kränkande för upphovsmannens litteräraeller konstnärliga anseende eller egenart.

För ytterligare information om Linköping University Electronic Press seförlagets hemsida http://www.ep.liu.se/

Copyright

The publishers will keep this document online on the Internet - or its possiblereplacement - for a considerable time from the date of publication barringexceptional circumstances.

The online availability of the document implies a permanent permission foranyone to read, to download, to print out single copies for your own use and touse it unchanged for any non-commercial research and educational purpose.Subsequent transfers of copyright cannot revoke this permission. All other usesof the document are conditional on the consent of the copyright owner. Thepublisher has taken technical and administrative measures to assure authenticity,security and accessibility.

According to intellectual property law the author has the right to bementioned when his/her work is accessed as described above and to be protectedagainst infringement.

For additional information about the Linköping University Electronic Pressand its procedures for publication and for assurance of document integrity,please refer to its WWW home page: http://www.ep.liu.se/

© Oscar Gustavsson

Page 5: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Abstract

This Master´s thesis discusses the problems concerning inverse halftoning, which means con-verting a halftone image into a continuous tone one. The thesis evaluates the use of inversemethods, showing promising results. The algorithm is implemented and tested using Matlaband serves as a prototype for possible full scale applications.

The work is based upon previously published articles on the subject, along with basic halfton-ing and printing theory. This serves as a starting point from which the proposed method isdeveloped, and the results are in some areas competitive against other, previously publishedapproaches.

i

Page 6: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Acknowledgements

I would like to thank Tobias Lindahl and Bjorn Kruse for many interesting discussions. I alsosend my deepest gratitude to Ancie Eriksson for proof reading the report, and my father for allhis support.

ii

Page 7: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Contents

1 Introduction 11.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Basic Concepts 32.1 Inverse Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 The Printing Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.3 Halftoning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.3.1 Halftoning Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.4 Colour Halftones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3 Inverse Halftoning 73.1 Why Inverse Halftoning? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73.2 Approaches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3.2.1 Frequency or Spatial Filtering . . . . . . . . . . . . . . . . . . . . . . . . . 83.2.2 Adaptive Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.2.3 Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4 Halftones in the Fourier Domain 94.1 Colour Halftones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

4.1.1 Moire Peaks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104.2 Extracting the Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4.2.1 Gaussian Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124.2.2 Interpolate Phase Angle . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

5 Proposed Method 145.1 Identify Screen Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155.2 Reproducing Halftone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165.3 Enhance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.4 Colour Halftones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205.5 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

iii

Page 8: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

6 Conclusions 246.1 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246.2 Future Research . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

A Colour Spaces 27A.1 RGB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27A.2 CMY and CMYK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

B Fourier Analysis 29B.1 Varieties of the Fourier Transform . . . . . . . . . . . . . . . . . . . . . . . . . . 29B.2 Fourier Analysis of Images in Matlab . . . . . . . . . . . . . . . . . . . . . . . . . 30

B.2.1 Basic Matlab Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 30B.2.2 The Log Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

C Images 32

D Glossary of Technical Terms 37

iv

Page 9: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

List of Figures

1.1 Inverse halftoning performed using the proposed method. Original image courtesyof Bjorn Kruse. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2.1 The halftone dot is built up piece by piece by the exposure dots. This figure showsa 4x4 screen cell that has 17 gray levels. . . . . . . . . . . . . . . . . . . . . . . . 4

2.2 An image halftoned using three different methods. Original image courtesy ofOscar Gustafsson. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.3 Halftoning notations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.4 Moire patterns are formed when two or more patterns are combined. . . . . . . . 62.5 An image halftoned using two different angles. Note that the screen pattern is

less noticeable at 45◦. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

4.1 A halftoned image (a) and its Fourier spectra (b). Please note the peaks that areformed due to the screen pattern. Original image courtesy of Oscar Gustafsson. 10

4.2 Fourier spectra of the C channel of a halftoned image. Note the residue from theother screens. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4.3 Cropped Fourier spectra illustrating the formation of a moire peak, here as a sumof the cyan and magenta vectors. . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4.4 The notation of the vectors u and v. . . . . . . . . . . . . . . . . . . . . . . . . . 124.5 Visualizing the accuracy of the screen parameter estimation. The image is of size

1000x1000 and the cell width is about seven pixels. . . . . . . . . . . . . . . . . . 134.6 Showing a 9x9 area of the phase angle interpolated using bicubic interpolation.

The image used is 1000x1000 pixels in size. . . . . . . . . . . . . . . . . . . . . . 13

5.1 A diagram visualizing the method. . . . . . . . . . . . . . . . . . . . . . . . . . . 145.2 The original halftone used in this example. . . . . . . . . . . . . . . . . . . . . . . 155.3 Artifacts caused by filtering with a Gaussian low pass filter kernel. The ruined

pixels at the left and bottom of (a) are the result of large filter kernels. (b) is theresult after cutting off the Gaussian curve too early. The images are cropped. . . 16

5.4 A Gaussian curve and how much of the area different standard deviations accountfor. Note that this is the two dimensional case, and that the kernels used forfiltering in this thesis are three dimensional. . . . . . . . . . . . . . . . . . . . . . 16

5.5 The fourier spectra of the image found in figure 5.2. Note that the spectra isstretched horizontally due to the fact that the image is not square. . . . . . . . . . 16

v

Page 10: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

5.6 The original image low passed with a Gaussian filter kernel that just about re-moves the screen pattern. Compare with figure 5.2. . . . . . . . . . . . . . . . . . 16

5.7 The reproduced halftone is created using the parameters extracted from the orig-inal halftone. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

5.8 The accuracy of the screen parameter estimation is illustrated. . . . . . . . . . . . 18

5.9 The correlation between an original halftone and the reproduced one. The peakin the middle suggests that the difference is small. It is possible, if one wants to,to interpolate and find the maximum so that the offset vector can be made evenmore accurate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

5.10 The result from equation 5.4. The image is altered, so that a gray level of 0.5corresponds to a value of zero. Also, the image is enhanced by multiplying allcomponents by three. The screen pattern is visible. . . . . . . . . . . . . . . . . . 19

5.11 The result after low pass filtering the image in figure 5.10 to hide the screen pattern. 195.12 High pass filtering the image in figure 5.11 yields this result. Note how well the

sharp edges are preserved, while smooth areas are removed. . . . . . . . . . . . . 20

5.14 The average influence per pixel Idiff has at different recursions. . . . . . . . . . . 20

5.15 The result after applying the method. Compare it to the original halftone infigure 5.2 and its low passed version in figure 5.6. . . . . . . . . . . . . . . . . . . 20

5.13 Histograms of the band passed version of Idiff using 256 bins at three differentrecursions. The histograms are cropped. . . . . . . . . . . . . . . . . . . . . . . . 21

5.16 The Fourier spectra of the result in figure 5.15. Compare it to figure 5.5. . . . . . 21

5.17 The colour halftone used in this example. Original image courtesy of Ford. . . . . 215.18 The C colour channel after having been converted to CMYK. . . . . . . . . . . . 22

5.19 The parameter estimation is less accurate in this case, as seen in this figure. . . . 22

5.20 The result after applying the method to all four colour channels. . . . . . . . . . . 225.21 This figure illustrates moire formation when halftoning an already halftoned im-

age with (a) and without (b) using the proposed method first. . . . . . . . . . . . 23

A.1 The RGB corrdinate system, or the RGB cube. . . . . . . . . . . . . . . . . . . . 27

A.2 Primary and secondary colors of the additive colour space RGB. . . . . . . . . . 28A.3 Primary and secondary colors of the subtractive colour space CMY. . . . . . . . . 28

B.1 An image (a) and its Fourier spectra (b). The spectra is normalized. Originalimage courtesy of Oscar Gustafsson. . . . . . . . . . . . . . . . . . . . . . . . . . 31

B.2 The Fourier spectra in B.1(b) with the log transform in equation B.6 applied toit. Note how the lower values are enhanced. The spectra is normalized. . . . . . . 31

C.1 Two of the halftones used for testing in this thesis. (a) is a gray scale halftonethat has not left the computer, while (b) is a scanned, colour halftone printed inCMYK. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

vi

Page 11: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

C.2 Images illustrating inverse halftoning on the gray scale halftone in figure C.1(a)using the proposed method. (b) is the result of low pass filtering the original usinga Gaussian filter kernel that just about removes the screen pattern. (a) shows theresulting continuous tone image after twelve recursions. Note the difference insharpness between (a) and (b). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

C.3 Images illustrating inverse halftoning on the colour halftone in figure C.1(b) usingthe proposed method. (b) shows the low passed version of the original. (a) showsthe resulting image after twelve recursions. . . . . . . . . . . . . . . . . . . . . . . 35

C.4 Histograms of the images used to enhance the low passed versions of the originalat different states of the algorithm. (a-c) are the result of a perfect gray scaleimage, (d-f) a gray scale scanned image, (g-i) a scanned colour image (C channel)and (j-l) a perfect colour image (also C channel). Note the convergence presentin all cases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

vii

Page 12: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Chapter 1

Introduction

Most large scale printing devices today are in-capable of printing an image directly from acomputer without any processing. Printing canonly be done binary; either an area is cov-ered with ink, or it is not. This causes prob-lems when trying to print images with contin-uous tone, so therefore a binary representation(halftone) built up by small dots is created [3].This process makes the image printable, but italso degrades it. This thesis discusses the prob-lems in trying to use this scrambled image, andto restore the continuous tone.

1.1 Background

Several publications have been made duringthe last decade in the inverse halftoning area.Many focus on only one type of halftones, andmany only deal with gray scale images. Thisthesis evaluates a new approach to the problemthat turns out to be quite promising. The re-sulting image is free from the screen pattern itpreviously had, and can be printed, or perhapssaved in a database. The method evaluated isof inverse nature, which means that the prob-lem is solved using backward reasoning.

The desired result is a continuous tone imagefree from patterns and noise up to the pointwhere it is possible to print it again perhaps us-ing different techniques, parameters or printing

Figure 1.1: Inverse halftoning performed usingthe proposed method. Original image courtesyof Bjorn Kruse.

media. Only if this is possible, the method´sperformance is satisfactory. This thesis willdiscuss whether the given approach will meetup to these standards. In figure 1.1 an exampleof how the proposed method performs is given.

1.2 Methods

The project started with literature studies andresearch on the subject. It turned out thatthere were many interesting articles available,

1

Page 13: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

and many useful ideas that in fact have beenimplemented here in this thesis. These articles,together with the initial idea of using inversemethods, served as a basis for the upcomingwork. The algorithm was implemented in Mat-lab and tests on various kinds of halftones wereconducted during the whole development.

It is obvious that inverse halftoning is an in-verse process; the main idea is to restore whatthe halftoning has done to the image. The con-cept of an inverse method, however, can be de-scribed as a way of reasoning backward in orderto go forward [4]. It is important to distinguishbetween them, as they might sound alike.

The results when it comes to image quality arerather subjective. SNR1 will not be measuredsince the original continuous tone image sincelong is gone. The aim is to get as close to re-trieving the original halftone detail as possible,not the original, continuous tone image detail.

1.3 Outline

This thesis has a few sections that an experi-enced reader might want to skip. These coverssome basics that are essential to readers notfamiliar with them. Here follows a short com-pilation of what the chapters contain.

Chapter 2 covers the basics of printing andwhat halftoning is.

Chapter 3 brings up what inverse halfton-ing involves, what problems one might befaced with and how others have tried tosolve them.

Chapter 4 explains how halftones behave inthe Fourier domain and what informationcan be extracted from them. Especially

1Signal to noise ratio.

important is section 4.2 which brings upessential parts of the final algorithm.

Chapter 5 presents the proposed method bygiving an example. This is the single mostimportant part of this report.

Chapter 6 discusses the method and pro-poses future work.

Appendix A is a brief summary of colourspaces one should be familiar with.

Appendix B explains a fundamental part ofthis thesis, namely Fourier analysis. Someimportant Fourier domain properties arediscussed and some examples are given.

Appendix C contains resulting images.

Appendix D lists a number of expressionsone should be familiar with.

2

Page 14: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Chapter 2

Basic Concepts

This chapter covers some basics in printingand halftoning theory along with some notationclarifications. This chapter is written primar-ily for readers unfamiliar with the subject, asis appendix D, which is a glossary of technicalterms. Sections 2.2, 2.3 and 2.4 are based on[3], unless otherwise stated.

2.1 Inverse Methods

Inverse methods are discussed in [4], and thissection is a small compilation what they areand how they are defined.

When trying to prove theorems or problems,one often (maybe unintentionally) uses one orseveral methods. These have been categorizedand named, and someone familiar with the sub-ject might recognize terms such as resolution-based or tableau-based methods. The tableau-based methods try to break down goals intosubgoals, which are then broken down intoeven smaller subgoals until the level of axiom1

is met. This kind of problem solving is calledforward reasoning.

The inverse method is in a sense the oppositeof the above; it tries not to create subgoals outof goals, but rather to define new goals out ofalready solved subgoals, or to build the tree

1A self-evident truth that requires no proof.

from the leaves. It can also be described as amethod that tries to prove or solve somethingby starting at the axioms and working its wayupward. This is a rather delicate task, as thenumber of axioms often are infinite.

The concept of solving problems in inversemanners is less known than the forward ap-proach, and this thesis will try to utilize someof its properties to solve the problems with in-verse halftoning. If you are interested in thissubject, then [4] is a good starting point.

2.2 The Printing Process

The printing process involves the transferral ofsome kind of document (text, images or both)from a computer to a printing media of choice.Everything from paper to glass can be printed,and of course all these different types of mate-rials have specific properties, and therefore re-quire specific printing techniques. When print-ing small quantities, an ink jet printer is oftenused (not covered in this thesis). This tech-nique however, is not fast enough nor econom-ically feasible when it comes to printing largequantities. This is where printing presses areused.

The most commonly used printing techniquefor standard applications today is offset print-ing. This method is based on the lithographic

3

Page 15: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

principal which involves separating printingand non printing areas of the plates usingchemical properties. Other methods for print-ing is flexograph and screen printing. The mostsignificant advantage of these methods is thatthey can print on some media that offset print-ing cannot. They do however produce lowerquality results. All these methods uses binaryprinting plates of some kind, and can be usedboth for colour and gray scale printing.

2.3 Halftoning

The biggest issue when printing today is thefact that an image produced on a computernormally cannot be reproduced in continuoustone on paper. Printing plates are in realitybinary; a specific area is either covered in ink,or it is not. To solve the problem of repro-ducing tones, the image has to be convertedin some way to make it compatible with theprinter. The technique for doing this is calledhalftoning, and the main idea is to create abinary image with small dots of ink and, byadjusting the size or density of them, fool theeye in seeing different intensities. In order tocreate this binary version of the image, a RIP(Raster Image Processor) is used. The result-ing binary image is transferred to the printingplates, which later on is used in the printingprocess, as described in section 2.2. The up-coming section covers different ways that thebinary image can be constructed.

2.3.1 Halftoning Methods

There are several ways that the binary image(halftone) can be built up in order to simulatethe continuous tone of the original image. Thedifferent methods all have their advantages anddrawbacks. The halftoning techniques mostcommonly used today are:

Figure 2.1: The halftone dot is built up piece bypiece by the exposure dots. This figure shows a4x4 screen cell that has 17 gray levels.

Amplitude modulated - The screen is buildup by different sized halftone dots in a reg-ular pattern.

Frequency modulated - Exposure dots aredispersed in an irregular pattern.

Hybrid - A mixture of the two mentionedabove [7].

Amplitude modulated halftoning, or AM, ismost common today due to its simplicity andlow production cost. The image is, in thiscase, represented as a regular screen patternrotated at an arbitrary angle. The patternconsists of small dots, and to fool the eye tosee different intensities, the size of these dotsvaries. The method is best suited for reproduc-ing smoother areas, whereas sharp edges areslightly blurred. There are two major subcat-egories of AM halftoning, namely clustered dotand dispersed dot [8]. The first method triesto put the exposure dots as close to each otheras possible, while the latter does the opposite.An example of how a 4x4 clustered halftonedot is built up from zero to 100% intensity isfound in figure 2.1. The number of intensities

4

Page 16: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

(a) AM, clustered dot. (b) AM, dispersed dot. (c) FM halftoning

Figure 2.2: An image halftoned using three different methods. Original image courtesy of OscarGustafsson.

that can be represented is:

gray levels =(

dpi

lpi

)2

+ 1 (2.1)

The number of gray levels can also be calcu-lated using the width A and height B of thescreen cell:

gray levels = A ∗ B + 1; (2.2)

A more compact representation of the screencell buildup is to use a matrix:

Tr =

⎛⎜⎜⎝

13 7 8 145 1 2 96 4 3 1016 12 11 15

⎞⎟⎟⎠ (2.3)

The approach of frequency modulated (FM )halftoning is somewhat different. This time,the size of the dot is constant, but insteadthe number of points printed in a specific areavaries. This method is more seldom usedbecause it demands a much more controlledand expensive printing process. On the pos-itive side, it preserves high frequencies bet-ter. There are no angles in FM halftoning, sotherefore there is no interference between dif-ferent screens in colour printing. This methodcan be combined with AM halftoning, and isthen called hybrid halftoning. If AM is used in

smooth areas, and FM at sharper edges, bothmethods are used where they perform best.This idea is not used often in real life, but itis interesting and some research has been doneon the subject. [7] explains hybrid halftoningfurther.

When it comes to this thesis, it only coversthe inverse halftoning of AM, clustered dothalftones. The halftone techniques are all dif-ferent, and the method proposed is specificallycreated to deal with the properties this typeof halftoning has. The three different meth-ods AM clustered dot, dispersed dot and FMhalftoning are illustrated in figure 2.2.

In order to fully understand how a halftone isbuilt up, the following list clarifies some nota-tions. Also see figure 2.3.

Exposure dot - The small, binary dot that aprinter prints. The resolution is measuredin dpi, or dots per inch.

Halftone dot - A cluster of several exposuredots.

Halftone cell - A (most often) quadratic cellwhich contains a halftone dot. Measuredin lpi (lines per inch).

Screen - A number of cells in a regular pat-tern.

5

Page 17: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Screen Cell Halftone Dot Exposure Dot

Figure 2.3: Halftoning notations.

Depending on the material to be printed, dif-ferent resolutions are used. An offset printercan print at about 65-300 lpi, but for examplenewspaper paper is so low in quality that it isonly possible to print at a maximum of 85 lpion it. With high quality magazine paper it ishowever possible to print at 150-300 lpi.

2.4 Colour Halftones

When printing in colour, the same methods asabove apply, with the difference that the imageis printed using several halftones in differentcoloured inks. The by far most common way toprint today is by using the CMYK (cyan, ma-genta, yellow and black) colour space. Imagesto be printed often reside on a hard drive in acomputer being composed of the three coloursR, G and B (red, green and blue). Hence aconversion to CMYK must be done, which un-fortunately is quite troublesome. The C, M,Y and K components heavily depend on whatkind of printing media is to be used. For ex-ample a newspaper or a poster needs differentcolour compositions to give the same result.This is discussed more thoroughly in [3].

When the correct CMYK image has beenconstructed, the four layers are individually

+ =

Figure 2.4: Moire patterns are formed whentwo or more patterns are combined.

(a) 75◦ (b) 45◦

Figure 2.5: An image halftoned using two dif-ferent angles. Note that the screen pattern isless noticeable at 45◦.

halftoned. If the case of AM, clustered dothalftoning, the angles with which each colourchannel is printed is important when it comesto image quality. Some default angles oftenmentioned in literature are 15◦ (cyan), 75◦

(magenta), 0◦ (yellow) and 45◦ (black). Theseare chosen to minimize the interference be-tween the colours (see figure 2.4). The rea-son for choosing 0◦ for yellow is because it isthe angle at which the screen pattern is mostvisible, and it is therefore used for the colourwhich is less dominant. 45◦ on the other handhides the screen significantly more, and it istherefore used for the most prominent colour(black). The angles chosen for cyan and ma-genta are somewhere in between. Look at fig-ure 2.5 to see a halftone at two different angles.

6

Page 18: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Chapter 3

Inverse Halftoning

This chapter covers the problems with inversehalftoning and how one might solve them. Sev-eral publications covering the subject have beenmade, and some of the most interesting onesare presented in section 3.2.

3.1 Why Inverse Halftoning?

Inverse halftoning is the process of converting ahalftoned image into a continuous tone versionof itself. The input image is often scanned froma magazine or newspaper. The main reason forspending time and effort doing inverse halfton-ing is the fact that an already halftoned imagewill produce moire patterns when halftonedonce more [1]. The reason for this is that thescreen pattern already present in the image willinterfere with the screen pattern used whenhalftoning once more.

The definition of what inverse halftoning iswould be: To remove all signs of introducedpatterns in a halftone. These patterns can ei-ther be the screen itself or moire caused by in-terference from the different printing colours.

3.2 Approaches

Today, there are several commercial productsavailable that can handle inverse halftoning.

These are, however, often for professional useand are therefore expensive. Some examples ofsoftware that can be used for inverse halftoningare:

RepliDot, Layout Ltd - A Photoshop plugin used to handle scanned halftones [12].It costs 2000 US dollars.

Silverfast, LaserSoft Imaging - A Scannersoftware that costs about 300-900 US dol-lars [13].

DescreenIt, Jetsoft Development - Stan-dalone application that is used for de-screening [14]. Price: 100 US dollars.

FoveaPro, Reindeer Graphics - An Imageprocessing software [15]. Price: 800 USdollars.

None of these products have been tested in thisthesis, and the reason for listing them is toshow that there is in fact a market for inversehalftoning.

During the project, an Epson Perfection 1260scanner was used, and its inverse halftoningsoftware did not perform well at all. It seemslike the image has been slightly low pass fil-tered, leaving the screen pattern visible. Thescanner test performed in [9] confirms this ex-perience; all scanners in the test performedpoorly.

7

Page 19: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Common to all software mentioned above isthat there is little to no information on thetechnical details and what methods have beenused, which is unfortunate, but not surprising.Of course, the developers have no interest insharing the methods used in their software tocompeting companies. The following sectionswill instead cover some interesting techniquesfound in literature.

3.2.1 Frequency or Spatial Filtering

The most straightforward way to handle theproblem would be to use some kind of low passfilter to remove the screen pattern. The screenis very distinct in frequency and angle, so cre-ating a filter that removes the screen is noproblem. The problem lies in the removal ofhigh frequency information, and the absenceof it will show in the end result.

A simple approach is to use a Gaussian lowpass filter, either in the spatial or the Fourierdomain. The result when filtering with a Gaus-sian kernel that just about removes the screenpattern will be significantly blurred. To solvethis problem, one might think that a steepercurve would cut off less of the higher frequen-cies. The fact is that it does, but it will alsocause ringing effects, and the closer to the ideallow pass filter a kernel gets, the worse the arti-facts [2]. It gets even worse if one wishes to re-move the moire patterns in the halftone. Theselie at frequencies lower than those of the screenpatterns, so therefore a lower cutoff frequencyis needed in order to remove them [1].

3.2.2 Adaptive Filtering

Adaptive filtering means using a filter thatchanges based on how the underlying imagelooks. In [1], the author uses a spatial ker-nel rotated to the same angle as the screen,

and this seems to preserve at least some of thehigher frequencies. The removal of the moireis then done manually by suppressing its peaksin the Fourier spectra. This method producesan image free from the screen and moire pat-terns with a higher sharpness than that of aGaussian low pass filtered one.

The authors of [5] proposes another adaptivefiltering technique to perform inverse halfton-ing. The main problem this method addressesis the removal of moire patterns. The averag-ing kernel that traverses the image changes sizedepending on the moire strength in the currentpixel. The authors find the method somewhatsatisfying, but sharp edges in the resulting im-ages could be sharper.

3.2.3 Machine Learning

There are several different kinds of halftoningmethods, and to create a method that can dealwith all of them is a challenge. The authorsof [6] use a decision tree learning algorithmcalled ID3 to achieve just that. The methodhas has the ability of handing several halftonetechniques, and the implemented program useshalftone images as training sets, which it buildsthe tree from. This learning process takes sometime, but the actual inverse halftoning is quitefast. Also, the algorithm seems to perform verywell, but is only tested on perfect, gray scalehalftones that have never left the computer.

8

Page 20: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Chapter 4

Halftones in the Fourier Domain

When looking at the Fourier spectra of a nat-ural image taken by a camera, one might ob-serve that it is often lacking high, concentratedpeaks. This is due to the fact that nature isvery stochastic, and does not contain many reg-ular patterns. This fact can be used when ana-lyzing halftones, because a halftone is in fact anatural image with the introduction of a regularpattern which shows in the Fourier domain.

Figure 4.1 is an example of a natural, halftonedimage and its transform, showing high peaksrepresenting the frequency and angle of thescreen pattern. The spectra is, if the inputimage contains real and positive values, conju-gate symmetric [2]:

F(u, v) = F(−u,−v) (4.1)

From the spectra in figure 4.1(b) it is easy toget information about the screen used. In thehalftone,the screen pattern has an angle of ap-proximately 75◦ counter clockwise, which is thesame angle as the peaks are rotated. The fourmost dominant peaks represent the frequencyin both directions of the screen and its mir-rored counterparts. The lesser dominant peaksare in fact integer multiples of the real peaks[1]. There is a relationship between the dis-tance from the center of the spectra to the peakand the cell width in the spatial plane. The in-terpretation of all these peaks will be discussedfurther in 4.2.

4.1 Colour Halftones

Colour halftones behave somewhat differentlyin the Fourier domain than gray scale halftonesdo, and introduce several obstacles and prob-lems. First of all, a colour image is made up ofseveral colour channels. The image was orig-inally printed in cyan, magenta, yellow andblack, then scanned and converted into red,green and blue. This conversion along withthe printing makes it hard, if not impossible toperfectly separate all printing colours. Whenusing four different printing colours there aresixteen ways to mix them, and out of of these,nine are black [1]. One of the black colours ismade up of cyan, magenta and yellow mixedtogether, and the other eight are combinationsof the primary colours and black. The RGBto CMYK conversion algorithm in A.2 doesseparate the colours somewhat, but the result-ing channels do have residue from the otherchannels. One example of a spectra belong-ing to a former CMYK image converted fromRGB back to CMYK is found in figure 4.2.The figure shows the C channel of the im-age, and here it is important to distinguishbetween all the different peaks, as it is easyto get confused. The notations are the sameas in [5]. Firstly, and most importantly arethe peaks representing the cyan screen. Thesepeaks should, if the colour separation processhas performed according to plan, be second

9

Page 21: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

(a)

(b)

Figure 4.1: A halftoned image (a) and itsFourier spectra (b). Please note the peaks thatare formed due to the screen pattern. Originalimage courtesy of Oscar Gustafsson.

most dominant (most dominant is the compo-nent in the middle of the spectra). Also, if thescreen pattern is orthogonal, the angle betweenthe peaks is 90◦. These kinds of peaks are fromnow on referred to as channel peaks. These

Figure 4.2: Fourier spectra of the C channel ofa halftoned image. Note the residue from theother screens.

peaks also have integer multiples at higher fre-quencies than the channel peaks themselves [1].Apart from the C channel peaks, residue peaks(and their integer multiples) from M, Y and Kare also present at their respective angle andfrequency being less dominant than the mainchannel peak.

4.1.1 Moire Peaks

The peaks mentioned above lie at the fre-quency of the channel peaks or higher. Unfor-tunately, the printing process, using differentscreens at different angles, introduces interfer-ence patterns, or peaks. These moire patternsare originating from integer multiple combina-tions of all channel peaks [1]. Most of the moirepeaks formed are so weak that they are noteven visible [1]. However, some of the peakscan be rather strong, and clearly noticeable.There is one moire peak for each pair of chan-nel (and residue) peaks, and they are formedat the location of the sum of the two vectors for

10

Page 22: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

C

MMoiré

Figure 4.3: Cropped Fourier spectra illustratingthe formation of a moire peak, here as a sumof the cyan and magenta vectors.

each channel peak [5] (see figure 4.3). As seenin the figure, the frequency of the moire peakis somewhat lower than those of the channelpeaks. This implies that a lower cutoff fre-quency has to be chosen if they are to be re-moved by low pass filtering. This is a problem,as a cutoff frequency this low will remove a lotof important detail.

4.2 Extracting the Screen

The Fourier domain is a powerful tool for iden-tifying the screen within a halftone. In moredetail, this extraction process involves obtain-ing the following parameters:

• Screen angle

• Screen frequency, or cell width in pixels

• Screen offset vector

This section will not cover the estimation ofthe following:

• Threshold matrix

• Halftoning method

The reason for not trying to obtain the thresh-old matrix is that this information would behard to get to because the halftone dots areblurred in the printing process. It might bepossible, however, to extract the threshold ma-trix out of halftones not yet printed. Thescreen pattern with which the halftone is pro-duced is presumed to be orthogonal and ofclustered dot type, and the frequencies areassumed to be the same in both directions.This simplifies the calculations as only one fre-quency and angle must be extracted. For clar-ity, however, both screen vectors are taken intoconsideration. It is also presupposed that theFourier spectra on which the extraction shouldbe performed has dominant channel peaks withmagnitude higher than that of all other com-ponents (center of spectra excluded). If thisis true, all that has to be done is to write analgorithm that finds the position of the chan-nel peaks representing the screen pattern. Thefollowing notations, extraction and Gaussianinterpolation is taken from [1].

It is important to take into consideration thatthe spectra is symmetric (see equation 4.1),which means that a peak has a mirrored coun-terpart. When trying to extract two vectorsorthogonal to each other, the extraction algo-rithm has four different vectors to choose a pairfrom from. The notation of choice is found infigure 4.4 and equation 4.2.

u1 > 0; v1 ≤ 0;u2 ≤ 0; v2 > 0 (4.2)

The relationship between screen vectors in thespatial plane and the previously extracted vec-tors in the Fourier domain is:(

x1

y1

)=

1u1v2 − u2v1

(0 −MN 0

)(u1

v1

)(4.3)

(x2

y2

)=

1u1v2 − u2v1

(0 M

−N 0

)(u2

v2

)(4.4)

11

Page 23: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

u

v

u1v1

u2v2

(0,0)

Figure 4.4: The notation of the vectors u andv.

where M and N is the width and height of theimage. The two screen vectors should, if thescreen is orthogonal, have the same length andshould be rotated 90◦ relative to each other.These vectors are used to calculate the angleand frequency of the dominant screen pattern,but in order to exactly position it, an offsetvector is needed. It is given by:(

x0

y0

)= −φ(u1,v1)

(x2

y2

)+−φ(u2,v2)

(x1

y1

)(4.5)

The screen angle can easily be calculated fromthe vectors (x1, y1)t or (x2, y2)t as follows:

α = tan−1

(y1

x1

)= 90◦ + tan−1

(y2

x2

)(4.6)

The screen size (in pixels) is given by:

l =√

x21 + y2

1 =√

x22 + y2

2 (4.7)

The resolution of a Fourier spectra is oftenquite coarse, especially if a small image hasbeen used. This results in inaccurate estima-tions. The upcoming sections covers a fewtechniques to make the estimations more ex-act.

4.2.1 Gaussian Interpolation

This method interpolates new positions of thepeaks found by fitting them onto a Gaussiancurve. The peak position is fundamental inthe sense that all information (angle, frequencyand offset vector) depend on it. The interpo-lation is done using the following equations:

(ucorr

vcorr

)=

12

⎛⎜⎝

qu2−qu1

qu2+qu1

qv2−qv1

qv2+qv1

⎞⎟⎠ (4.8)

qu1 = log

( |F (u, v)||F (u + 1, v)|

)(4.9)

qu2 = log

( |F (u, v)||F (u − 1, v)|

)(4.10)

qv1 = log

( |F (u, v)||F (u, v + 1)|

)(4.11)

qv2 = log

( |F (u, v)||F (u, v − 1)|

)(4.12)

Where (ucorr vcorr)t is the new coordinate.This produces more accurate positions, butwill most probably make the coordinates nonintegers. Equation 4.5 takes a coordinate asan argument, and because the Fourier spectrais discreet, some kind of interpolation of thephase angle is needed. This is discussed in theupcoming section.

4.2.2 Interpolate Phase Angle

If the peak coordinate is not an integer, thensome kind of interpolation has to be done inorder to calculate the phase angle. The mostcommonly used interpolation techniques are:

• Nearest neighbour interpolation

• Bilinear interpolation

• Bicubic interpolation

12

Page 24: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Figure 4.5: Visualizing the accuracy of thescreen parameter estimation. The image isof size 1000x1000 and the cell width is aboutseven pixels.

Figure 4.6: Showing a 9x9 area of the phaseangle interpolated using bicubic interpolation.The image used is 1000x1000 pixels in size.

The bicubic interpolation method is illustratedin figure 4.6 using a 1000x1000 image halftonedwith a cell width of seven pixels. Because ofthe fact that the phase shifts so rapidly, theinterpolation techniques have difficulties giv-ing accurate results. In cases of smaller im-ages with smaller cell widths, the accuracy getseven lower. In this thesis, bicubic interpolationis used as its smoothness intuitively should re-

semble the continuous phase angle most out ofthe three interpolation techniques.

The result after performing the extraction canbe seen in figure 4.5, and it looks promising.This example is, however, done on a perfecthalftone that has not left the computer. Theaccuracy has proved to be at its best on largerimages with clear screen patterns and with acell width of at least five pixels.

13

Page 25: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Chapter 5

Proposed Method

The method proposed in this thesis uses asomewhat new approach. The main idea is totry to use an inverse method which basicallyuses a low passed, screen pattern free versionof the original halftone, which later on is im-proved by addition of high frequency informa-tion. This information is collected by halfton-ing the low passed image in the same way as theoriginal, then looking at the difference betweenthe result and the original halftone. The new,improved result is then fed back into the algo-rithm to be improved even further. Recursionsare done either a predefined number of times,or until some condition is fulfilled. The methodis more thoroughly explained in this chapter,and is visualized in figure 5.1.

For an inverse halftoning method to work inreality, it has to meet several requirements.With these fulfilled, the method The ones thismethod tries to fulfill are:

• It must be reasonably fast and memoryefficient.

• It should work on images acquired using ascanner and on digital halftones that havenever left the computer.

• It should work on AM, clustered dot typehalftones.

• It should be fully automatic, and none ofthe parameters concerning screen angle,

Original halftone

Extract screen

Low pass7 5 9 4 1 38 2 6

Halftoning

Calculate difference

Result Enhance

Figure 5.1: A diagram visualizing the method.

screen frequency or offset vector should berequired.

• The result should be able to be halftonedagain without any disturbing moire ef-fects.

• It should work on both CMYK colour andon gray scale halftones.

This thesis proposes a method that tries tomeet these demands, and it shows promisingresults. The following sections is a chronolog-ically ordered list of the steps the method in-volves. The method is presented with an ex-ample, as it is an intuitive way of explaining it.The example explains inverse halftoning of the

14

Page 26: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Figure 5.2: The original halftone used in thisexample.

grayscale image of size 800x528 pixels found infigure 5.2. The image has not been scanned,and serves as an example of when the methodperforms at its best. At the end of this chapter,a colour halftone example is discussed.

Most images are too small to show any finedetail, so therefore they are also found in ap-pendix C in larger versions.

5.1 Identify Screen Pattern

The upcoming step utilizes the equations andalgorithms found in 4.2 to, as accurately aspossible, extract the parameters involving thescreen pattern. The algorithm searches theFourier spectra for peaks, which it uses to cal-culate the following:

Cell width - the distance between the centerof the screen cells in pixels.

Screen angle - the angle in degrees withwhich the screen is rotated.

Offset vector - the vector from the center ofthe image to the closest black cell.

The image in this example yielded the follow-ing results:

• Cell width: 6.34 pixels.

• Screen angle: 44.92◦.

• Offset vector (−5.50,−0.13)t

The spectra used is found in figure 5.5, andwith the information gained it is now possi-ble to create a spatial, low pass Gaussian filterkernel to smooth out the screen pattern. Thiskernel is used to filter the image using the Mat-lab function filter2 that basically uses convo-lution. The choice of kernel design parameters(the standard deviation σ, and the size of thekernel) are somewhat subjective as the filtermust be able to completely remove the screen,but must not blur it excessively. σ determineshow steep the cutoff should be, and can be de-fined as the distance from the curve center tothe point where the curve has reached 60.7% ofits maximum value. Tests on various halftoneshave shown that to choose a σ that is half thedistance between two screen cells plus one is acompromise that works well. In this case σ isset to 6.34/2 + 1. When it comes to the size ofthe kernel, a size that cuts of the curve at threetimes the value of σ is suitable. In the two di-mensional case, outside this value only 0.13%of the area resides [10]. This is also a compro-mise between the artifacts at the edges of theimage a large kernel causes and the rectangu-lar pattern superimposed on the image a tooabruptly cut off Gaussian curve creates. Lookat figure 5.3 for an example of these effects.The size of the kernel must be an integer, sotherefore 3σ is rounded upwards. See figure 5.4for a feeling of what the Gaussian curve lookslike.

The low pass filtered version of the image isfound in figure 5.6. The filtering done to re-move the screen pattern causes the loss of highfrequency detail, and it is this hard to reachinformation that all inverse halftoning algo-rithms try to preserve; as does this one. Themethod proposed uses this screen pattern free

15

Page 27: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

(a) (b)

Figure 5.3: Artifacts caused by filtering witha Gaussian low pass filter kernel. The ruinedpixels at the left and bottom of (a) are the resultof large filter kernels. (b) is the result aftercutting off the Gaussian curve too early. Theimages are cropped.

1σ 2σ 3σ-2σ -1σ 0-3σ

34.1%

13.6% 2.1% 0.1%

Figure 5.4: A Gaussian curve and how much ofthe area different standard deviations accountfor. Note that this is the two dimensional case,and that the kernels used for filtering in thisthesis are three dimensional.

image as a starting point, and tries to add thehigh frequencies to it later on.

As of now, the low passed version of the orig-inal halftone is the best result available in theeffort of removing the screen pattern. Thisresult is not adequate, and a comparison be-tween the original halftone and the low passedversion of it will show that the original isin fact sharper in detailed areas. The pro-posed method deals with the problem of restor-ing the high frequencies in an inverse manner,as described in section 2.1. Instead of solv-ing the task at hand by traversing downward

Figure 5.5: The fourier spectra of the imagefound in figure 5.2. Note that the spectra isstretched horizontally due to the fact that theimage is not square.

Figure 5.6: The original image low passed witha Gaussian filter kernel that just about removesthe screen pattern. Compare with figure 5.2.

via subgoals, which is basically what has beendone so far, the algorithm now tries to workits way backwards by reproducing the originalhalftone, and with it, tries to achieve a resultas sharp in detail as the original halftone aspossible.

5.2 Reproducing Halftone

Apart from being useful in determining the ap-propriate Gaussian filter kernel, the informa-tion gained in the last section can be used to

16

Page 28: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

create a screen pattern that mimics the oneof the original. In this case, the halftoningmethod is supposed to be of AM, clustered dottype (described in section 2.3.1). The methodused is of great importance, as they are totallydifferent in many aspects. If any other halftoneis used, then the results will be ill-defined.

There are surely several ways to create ahalftone with a certain cell width, angle andoffset. This thesis proposes a straightforwardapproach that performs well. The first prob-lem that arises is that it is hard to create athreshold matrix with dimensions that are notintegers. This is solved by choosing a matrix ofinteger size that is larger than the cell widthof the screen that is to be reproduced, thenthe original image is resized to fit. An easyway is to for example use a threshold matrixof size 7x7 specified as (inspired by a 4x4 ma-trix found in [3]):

Tr =

⎛⎜⎜⎜⎜⎜⎜⎜⎜⎝

46 42 30 26 31 38 4741 25 14 10 15 22 4337 21 9 2 6 16 3229 13 5 1 3 11 2736 20 8 4 7 17 3345 24 19 12 18 23 3949 40 35 28 34 44 48

⎞⎟⎟⎟⎟⎟⎟⎟⎟⎠

(5.1)

This matrix will create a clustered dot, butit is somewhat arbitrary, and not necessarilythe same as used in the original. The reasonfor this is that the original threshold matrixis unknown. If the image has a cell width offive pixels, and a threshold matrix of size 7x7is used, then the image should be resized by afactor K defined as:

K =threshold size

cell width(5.2)

This means a factor of 1.4 in this case. Whenresizing, bilinear interpolation is used. Thisinterpolation technique is simple, fast and per-forms well. The threshold matrix is concate-nated to cover the whole image, plus some

Figure 5.7: The reproduced halftone is createdusing the parameters extracted from the origi-nal halftone.

more to make room for rotation. This largematrix is hereafter called the threshold image.It is important that the cell width of the origi-nal image is smaller than 7 (in this case); thenthe image will be enlarged, thus introducinginformation and not removing it. An arbi-trary rotation of the threshold image is made,as is an offset of the original image specifiedby the results from the screen extraction algo-rithm. Both are performed using bilinear in-terpolation. Now, simple threshold halftoningis done using the low passed original halftoneand the concatenated, rotated threshold im-age. The result (found in figure 5.7) shouldproduce a screen pattern that resembles theoriginal one, although with a slightly blurredunderlying picture. Figure 5.8 tries to illus-trate how well the parameter estimation works.The most sensitive parameter is the offset vec-tor that is calculated via the phase angle atthe peaks. As seen in figure 4.6, the phase an-gle is fluctuating rapidly and it is difficult toestimate it.

One way to create a more accurate offset wouldbe to analyze the correlation between the twohalftones, and then try to interpolate a newcoordinate and feedback it into the algorithm.The correlation coefficient is best suited for

17

Page 29: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

γ(x, y) =∑

s

∑t[f(s, t) − f(s, t)][w(x + s, y + t) − w]{∑

s

∑t[f(s, t) − f(s, t)]2

∑s

∑t[w(x + s, y + t) − w]2

} 12

(5.3)

Figure 5.8: The accuracy of the screen param-eter estimation is illustrated.

this task as it is independent of changes in am-plitude of the two input images [2]. The algo-rithm for calculating it is found in equation 5.3,where one of the images is defined as f and theother one as w. w should be cropped uniformlyaround its center. It is enough to remove twoto three pixels on each edge, but that dependson how well the images match the cell width.w is the average value of w (only computedonce) while f is the average of f at the coordi-nates currently common to both images. If fis 500x500 pixels and w is 498x498 the resultwill be a 5x5 matrix. The higher the valuesof this matrix, the more the images resembleeach other at that offset vector. Using bicubicinterpolation a new maximum and its positioncan be found (look at figure 5.9 for an exam-ple). This information can then be fed backinto the algorithm as described above. Thismethod, unfortunately, turned out to be at its

12

34

5

1

2

3

4

50.2

0.4

0.6

0.8

1

Figure 5.9: The correlation between an originalhalftone and the reproduced one. The peak inthe middle suggests that the difference is small.It is possible, if one wants to, to interpolate andfind the maximum so that the offset vector canbe made even more accurate.

best when it is not needed; that is when dealingwith large images. When dealing with smallerimages (500x500 pixels or smaller) with smallcell widths (about four pixels or smaller) theaccuracy is not good enough. The results inthis thesis have not been achieved using thismethod, but it is an interesting thought and istherefore brought up.

5.3 Enhance

Now a reproduced halftone has been made,with dots that coincide with the original ones.If the difference between the two halftonesis calculated, some interesting features willemerge. Both images have screen patterns thatlie on top of each other (at least in the perfectcase). If the screens are put aside for a mo-ment, and the underlying images are in focus,

18

Page 30: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

the reproduced image is slightly blurred whencompared to the original. The difference be-tween the images is small (close to zero) in lowdetail areas, while the edges differ more notice-ably. The difference is given by:

Idiff = Horiginal − Hreproduced (5.4)

When applying this idea on the current ex-ample, a result such as the one in figure 5.10will be achieved. If the images Horiginal andHreproduced were the same, the result would beall zero. A low pass filtering is done to removethe screen pattern, and because the frequencyof the pattern is the same, or higher than thatof the original screen, the same standard devi-ation is used. This time, however, the curve iscut off at 4σ instead of 3σ. This is because theartifacts in figure 5.3(b) will accumulate in theupcoming recursions. The downside of a largerkernel is a slightly larger band of ruined pixelsat the edges of the image (see figure 5.3(a)).

The result of the low pass filtering is found infigure 5.11 and contains little information inthe low frequency areas while sharp edges areenhanced. One problem arises when calculat-ing the difference in equation 5.4 and that isthe possibility of both low frequency noise andnew moire effects (moire is appearing if the re-produced screen does not match the originalone). This time though, these patterns can beremoved, as they are formed at low frequen-cies, while the sharp edges lie at higher ones. Ahigh pass filtering is made by removing the re-sult after low pass filtering the image with theordinary Gaussian kernel one more time. If thelow frequencies are removed the high ones mustbe left. The σ and size of the kernel are thesame as before. This assumption is rather em-pirical, but has proved to produce good results.These two sub sequential filters leave a band offrequencies more or less untouched. These fre-quencies lie approximately at the sharp edgesas can be seen in figure 5.12.

Figure 5.10: The result from equation 5.4. Theimage is altered, so that a gray level of 0.5 cor-responds to a value of zero. Also, the imageis enhanced by multiplying all components bythree. The screen pattern is visible.

Figure 5.11: The result after low pass filter-ing the image in figure 5.10 to hide the screenpattern.

Now Idiff is free from most low frequency in-formation, and it is time to use it to enhancethe low passed original. This is done by addingthe images:

Hresult = Hlp + Idiff (5.5)

Hlp is the low passed original. Now, Hresult

should appear slightly sharper than Hlp. Theresulting image is now fed back into the algo-rithm a number of times and serves as newstarting points just as Hlp has done so far.Hresult is halftoned, compared to the original,

19

Page 31: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Figure 5.12: High pass filtering the image infigure 5.11 yields this result. Note how well thesharp edges are preserved, while smooth areasare removed.

and a new Idiff is created to sharpen the im-age, making it closer and closer to the original.Intuitively, the difference between the two im-ages (Idiff ) should get less and less influentialas the images look more and more alike. Fig-ure 5.14 shows a diagram of how much Idiff

influences the image on an average per pixelbasis given by:

Iinfluence =N∑

x=1

M∑y=1

|Idiff (x, y)| (5.6)

The difference is slowly declining until abouttwelve recursions are made. At this point,the difference starts to converge and fluctu-ate. Experiments have shown that any recur-sions beyond this point only seems to add un-wanted noise to the image, therefore these arenot recommended. Surprisingly, this conver-gence has appeared simultaneously in almostall halftones that has been tested. Figure 5.13shows three histograms of the band passed ver-sion of Idiff (as the one in figure 5.12) us-ing 256 bins. These show that the image isconverging toward somewhere around bin 128,which means a value around zero. In ap-pendix C, more histograms from other casesare presented.

0 5 10 15 20 251.5

2

2.5

3

3.5

4

4.5

5

5.5x 10

−3

Recursions

Mea

n in

flue

nce

Figure 5.14: The average influence per pixelIdiff has at different recursions.

Figure 5.15: The result after applying themethod. Compare it to the original halftonein figure 5.2 and its low passed version in fig-ure 5.6.

Figure 5.15 shows the final result after twelverecursions. The first impression is that it is sig-nificantly sharper than the low passed halftone(see figure 5.6). The images are found in ap-pendix C in larger versions. All results will bediscussed thoroughly in section 5.5.

5.4 Colour Halftones

Colour halftones have previously been dis-cussed in this thesis, and they behave in many

20

Page 32: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Bin

P(I)

(a) One recursion

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

BinP(

I)

(b) Five recursions

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Bin

P(I)

(c) Nine recursions

Figure 5.13: Histograms of the band passed version of Idiff using 256 bins at three differentrecursions. The histograms are cropped.

Figure 5.16: The Fourier spectra of the resultin figure 5.15. Compare it to figure 5.5.

ways just like gray scale halftones. This sectionwill discuss how the method performs whencolour halftones are used and which problemsthat arise.

The image in this example is scanned using anEpson Perfection 1260 scanner with a resolu-tion of 600 dpi and is found in figure 5.17. Thescanner is a commercially available unit madein 2002 [16] that produces images in the RGBcolour space. The first task at hand is to con-vert the image to CMYK as explained in A.2.The C channel of the output can be found infigure 5.18. Inaccuracy in the colour separa-tion will produce weaker and mixed up screenpatterns, resulting in less dominant peaks inthe Fourier spectra which makes the estima-

Figure 5.17: The colour halftone used in thisexample. Original image courtesy of Ford.

tion of the screen parameters more uncertain.In this case, the image size is 512x512 pixelsand has a cell width of about five pixels, whichare both on the lower end of what the parame-ter extraction algorithm tolerates. The screenparameter accuracy is illustrated in figure 5.19,and is slightly lower than in the previous exam-ple (see figure 5.8). Despite all these setbacksand problems, the method produces the imagefound in figure 5.20. This time, the screensdo not lie on top of each other as in previous

21

Page 33: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Figure 5.18: The C colour channel after havingbeen converted to CMYK.

cases. This does not seem to affect the methodperformance significantly (resulting images arefound in appendix C). As seen in the result,there is some moire left in the image. As de-scribed in section 4.1.1, the moire peaks areformed at frequencies lower than those of thechannel and residue peaks. The low pass fil-tering has been performed to remove the twolatter peaks; no effort has been done to removethe moire.

5.5 Results

At the beginning of this chapter, a list of im-portant properties of inverse halftoning meth-ods were listed. The first demand was thatit should be reasonably fast and memory effi-cient. When using the program on a 800x500pixel gray scale, halftoned image using an av-erage, up to date computer, the computationtime at twelve recursions is below two min-utes and the maximum memory usage 170megabytes. These tests are performed using

Figure 5.19: The parameter estimation is lessaccurate in this case, as seen in this figure.

Figure 5.20: The result after applying themethod to all four colour channels.

the tic and toc commands in Matlab and theavailable memory presented by the Task Man-ager in Windows XP. It is clear that a contem-porary computer has no problem in handlingthis method. An optimized version of the pro-gram would probably run faster.

22

Page 34: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

(a) (b)

Figure 5.21: This figure illustrates moire for-mation when halftoning an already halftonedimage with (a) and without (b) using the pro-posed method first.

Other demands were that the method shouldwork on both gray scale and colour AM, clus-tered dot halftones that are either printed orunprinted. The only problems here are whenusing colour halftones. The transformationfrom RGB to CMYK colour space is sensitive,and the presence of moire from the printing isstill present in the end result. A better colourseparation would help in solving the first prob-lem, but when it comes to the latter, someother method must be applied. This problemhas been discussed in [1] and [5].

When it comes to automatization, there is notmuch more to wish for. The method takesan RGB or gray scale image, and produces anend result completely without user interaction.One thing that possibly could be improved isthe choice number of recursions the programshould perform. At this point, a fixed, prede-fined number of recursions are made, but itwould be possible to automatically stop theprocess at any point, given any condition.

The last demand of the method, is that theremust not be any disturbing patterns prominentenough to show in another, arbitrary halfton-ing. This means that the image must be print-able after the method is applied. The images infigure 5.21 shows how moire is formed when a

halftone is halftoned once more with and with-out proper inverse halftoning. AM, clustereddot halftoning is used.

One thing that comes to mind when evaluatingthis method is to discuss how sensitive it is tochanges in the parameter estimations. Severalexperiments were made by manually introduc-ing errors to different parameters. It turns outthat the cell width estimation is of most im-portance. The cell width determines the sizeand shape of the Gaussian curve, so a small er-ror here will either blur the image too much orleave a screen pattern visible. The angle esti-mation is less important, however, an error ofabout one to two degrees will start to producepatterns. The last parameter, the offset vector,has turned out to be of very little importance.The initial low pass filtering of Idiff seems toproduce virtually the exact same result, evenwhen the offset vector is several pixels awayfrom its correct position. Further investiga-tions showed that the offset does affect the endresult, but to such a small degree that it is neg-ligible. This is most probably the reason whycolour halftones turn out so well, despite theincorrect offset vector.

23

Page 35: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Chapter 6

Conclusions

A new method for inverse halftoning has beendeveloped in Matlab, and it shows promisingresults. The images produced are definitelysharper than those produced using just low passfiltering.

6.1 Results

The method can handle scanned images or per-fect halftones that has not been printed, andthe demands from chapter 5 are all met. Thealgorithm requires no information whatsoeverconcerning the halftoning method used, otherthan the fact that it is of AM, clustered dottype, and a standard computer of today hasno problems with handling the method when itcomes to performance issues. Considering thatthe method is implemented in Matlab withoutperformance and optimization taken into con-sideration, it is safe to say that it would runsignificantly faster when implemented in, forexample, C++.

The method is fully capable of handling grayscale halftones, and is competitive comparedto other methods discussed in literature. Itsincapabilities of removing moire from colourhalftones makes it, or at least in its currentstate, somewhat improper to use on colourhalftones as a real life application.

6.2 Future Research

The main problem is the moire mentionedabove, which can be removed, or at least re-duced using various methods. My suggestionfor dealing with this problem is that some kindof adaptive low pass filtering is used such theone explained in [5]. In [1], the author usesa more blunt approach which involves manualdeletion of the peaks. This is also an alterna-tive.

Another problem is if the scanned image is dis-torted in some way which makes the screenpattern non orthogonal or if the screen fre-quency varies. This must be dealt with in someway using some other approach. Perhaps it isnecessary to look at the image in the spatial do-main and not do a generalization of the screensusing Fourier analysis as is done in this thesis.Also, the overall accuracy in determining howa halftone is built up can be better. One ideais to use integer multiples of the peaks in theFourier spectra to create averages, which prob-ably will produce better results. This idea isalso discussed in [1]. The method could also beimprove if the result could be surveyed in someway during the recursions, and that the recur-sions would seize at some point, given somecondition.

24

Page 36: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Bibliography

[1] J. Rydenius, ”Inverse Halftoning of Scanned Colour Images”, Master’s Thesis, Dept. ofElectrical Engineering, Linkoping University, Sweden, 1997.

[2] Rafael C. Gonzales and Richard E. Woods, Digital Image Processing, Prentice-Hall, Inc,2002, ISBN 0-201-18075-8.

[3] K. Johansson, P. Lundberg and R. Ryberg, A Guide To Graphic Print Production, JohnWiley & Sons, Inc, 2003, ISBN 0-471-27347-3.

[4] A. Degtyarev and A. Voronkov, The Inverse Method, in A. Robinson and A. Voronkov,eds, Handbook of Automated Reasoning, Vol. I, Elsevier Science, chapter 4, pp. 179-272,2001.

[5] Youngmee Han, Jongmin Kim and Minhwan Kim, ”A New Moire [sic] Smoothing Methodfor Color Inverse Halftoning”, Korea ,2002.

[6] Hae Yong Kim and Ricardo L. de Queiroz, ”Inverse Halftoning By Decision Tree Learning”,Brazil ,2003.

[7] S. Gooran and B. Kruse, ”Hybrid Halftoning”, Internal Research Report LiTH-ITN-R-2004-1, Linkoping University, Sweden, 2004.

[8] R. Ulichney, ”A Review of Halftoning Techniques,” in Proceedings SP1E Cot, Proc. SP1E3963, pp. 378 391, 2000.

[9] BeHardware, ”Roundup: 6 Scanners”, available at www.behardware.com/art/lire/552, 8December 2006.

[10] Wikipedia, ”CMYK Color Model”, available at wikipedia.org/wiki/Cmyk, 19 December2006.

[11] Wikipedia, ”Normal Distribution”, available at wikipedia.org/wiki/Normal distribution,21 December 2006.

[12] ThePowerXChange, available at www.thepowerxchange.com/product 1644 detailed.html,8 January 2007.

[13] SilverFast, available at www.silverfast.com/buyonline/en.html, 8 January 2007.

25

Page 37: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

[14] ScanHelp, available at www.scanhelp.com/288int/descreenit/index.html, 8 January 2007.

[15] Reindeer Graphics, available at www.reindeergraphics.com, 8 January 2007.

[16] Epson, available at files.support.epson.com/pdf/pr126 /pr126 sl.pdf, 8 January 2007.

26

Page 38: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Appendix A

Colour Spaces

A colour can be represented in several waysdepending on the application. A distinguish-ment can be made between colour spaces madetypically for computers, and colour spaces usedin printing processes. In order to understandthe halftoning and inverse halftoning processes,at least some colour space theory is required.Here follows a quick summary of some of themost important colour spaces, or at least theones one might come across when working withhalftones and printing.

The information in this appendix is a compi-lation of information found in [2] and [3] if nototherwise stated. The colour spaces that willbe brought up are:

RGB - an additive colour space often used inmonitors and scanners.

CMY - a subtractive colour space used forprinting.

CMYK - the same as CMY, but with the ad-dition of black (K).

There are several more colour spaces that areimportant in other cases, but within the scopeof inverse halftoning, an understanding of theseare all that is necessary.

R

B

G

Figure A.1: The RGB corrdinate system, orthe RGB cube.

A.1 RGB

RGB stands for red, green and blue whichare the primary colours of this colour space.RGB is used in virtually every monitor, pro-jector and scanner all over the world and isthe most common way to represent colour inimage file formats. RBG is an additive colourspace based on a Cartesian coordinate system,and is illustrated in figure A.1. Additive meansthat an increase in one of the components R,G or B will result in a brighter colour.

27

Page 39: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Figure A.2: Primary and secondary colors ofthe additive colour space RGB.

A.2 CMY and CMYK

While RGB is the colour space of choice whenit comes to different types of monitors, CMYand CMYK are the colour spaces mostly usedfor printing. CMY and CMYK are subtrac-tive colour spaces (see figure A.2) which meansthat when more colour is added, the result getsdarker. The letters C, M, Y and K stand forcyan, magenta, yellow and black. The reasonfor adding black in CMYK is that when print-ing black using CMY (C, M and Y at the sametime), the result gets dark brown. In theory,this mixture should be black, but due to imper-fections in the pigments used, that is not thecase. Another reason for using black is whenprinting thin, black objects (such as text), onlya slight mis pass will show if a letter is printedin C, M and Y.

When printing an image, the original is oftenin RBG format. This calls for a conversionbetween the two colour spaces and this causesproblems. The transformation between RBGand CMYK is device dependent and gives agreat degree of freedom to the user. Printingan image in a newspaper or on a poster calls fordifferent CMYK conversions. Also, an imagemade for a specific application can be hard touse in another one. In this thesis, a conversionthat maximizes the black colour is used [10]:

Figure A.3: Primary and secondary colors ofthe subtractive colour space CMY.

VC′M ′Y ′ = (1 − R, 1 − G, 1 − B) (A.1)

ifmin(C ′,M ′, Y ′) = 1 (A.2)

thenVCMY K = (0, 0, 0, 1) (A.3)

elseK = min(C ′,M ′, Y ′) (A.4)

VCMY K =(

C ′−K

1−K,M ′−K

1−K,Y ′−K

1−K,K

)(A.5)

Separating the colours is hard, and the algo-rithm is not absolutely safe. Most often itproduces channels that contain much informa-tion from the corresponding screen, but residuefrom other screens are inevitable. When itcomes to converting CMYK to RGB, a trans-formation is used that converts the image viathe CMY colour space [10]:

VC′M ′Y ′ =

⎧⎨⎩

C ′ = C(1 − K) + KM ′ = M(1 − K) + KY ′ = Y (1 − K) + K

(A.6)

VRGB =

⎧⎨⎩

R = 1 − C ′

G = 1 − M ′

B = 1 − Y ′(A.7)

28

Page 40: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Appendix B

Fourier Analysis

Fourier analysis was invented by a man namedJean Baptist Joseph Fourier in the 19:th cen-tury and has, especially in the later 20:th cen-tury, completely revolutionized signal process-ing. The main idea Fourier had was that anyfunction can be separated into one or severalsine and/or cosine functions. This transfor-mation has one characteristic, namely that it isreversible, which makes is possible to transforma signal, work in the Fourier, or frequency do-main, and then make a conversion back to itsoriginal form. This chapter will first discussthe Fourier transform in general and then howit can be used in image processing. This chap-ter is a summary of important subjects foundin [2].

B.1 Varieties of the Fourier

Transform

The Fourier transform converts some kind ofsignal (discreet or continuous) into the fre-quency domain. There are several varieties ofthe Fourier transform that are used in differentsituations. Due to the fact that the signals inimage processing are two dimensional and dis-creet, a certain version of the Fourier transformis used called the two dimensional DFT (Dis-creet Fourier Transform) given by the equa-tion:

F(u, v) =1

MN

M−1∑u=0

N−1∑v=0

f(x, y)e−j2π(uxM

+ vyN )

(B.1)The inverse of above is given by:

f(x, y) =M−1∑u=0

N−1∑v=0

F(u, v)ej2π( uxM

+ vyN ) (B.2)

In equations B.1 and B.2, M and N are thedimensions of the image while (x, y) and (u, v)are the coordinates in the spatial and fre-quency domain respectively. This transformhas a time complexity of O(N2M2), whichcan be quite computationally heavy. There-fore, the FFT (Fast Fourier Transform) wasdeveloped, which has a time complexity ofO(NMlogNM). This is the transform used foranalyzing image frequency properties in thisthesis.

The transform can be analyzed in several ways.As seen in equation B.1, the components of theFourier transform are complex. When it comesto image processing, the most important prop-erty of the Fourier transform is the magnitude,given by:

|F(u, v)| = [R(u, v)2 + I(u, v)2]1/2 (B.3)

R(u, v) and I(u, v) are the real and imaginaryparts of F(u, v), respectively. Other quantities

29

Page 41: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

worth mentioning are the phase angle definedas:

φ(u, v) = tan−1

[I(u, v)R(u, v)

](B.4)

and the power spectrum:

P (u, v)= |F(u, v)|2 =R2(u, v)+I2(u, v) (B.5)

B.2 Fourier Analysis of Im-

ages in Matlab

Matlab is a tool widely used and well suited forFourier analysis. This section will cover inter-esting properties of transformed images usingpractical, basic examples as well as more ad-vanced topics. This section is most suited forreaders not familiar with basic Matlab com-mands and visualization of Fourier spectra.

B.2.1 Basic Matlab Commands

The most fundamental piece of code importsa jpeg image and converts it from its origi-nal eight bit integer interval [0-255] to a deci-mal representation with interval [0,1] using thetype double. Also, a conversion to gray scaleis made after which the image is viewed usingimshow. The code for doing this is:

image = imread(’mandrill.jpg’);image = double(image)/255;image = rgb2gray(image);imshow(image);

To apply the Fourier transform, the fft2 func-tion is used. When visualizing the spectra itis common to shift the origin of F(u, v) to thecenter of the image. This can be done by usingthe Matlab function fftshift :

fourier = fftshift(fft2(image));

The center of the spectra (which is a dis-creet signal) lies at ((M/2) + 1, (N/2) + 1) or

((M−1)/2)+1, (N −1)/2)+1) when the imagehas even or odd dimensions respectively (Mand N are the dimensions of the image). Anexample of a Fourier transformed image can beseen seen in figure B.1. The spectra is shifted,but otherwise untouched. It is worth notingthat the Fourier transform of an image has thesame size as the image itself. The code formaking a three dimensional plot is:

[M N]=size(image);[x,y] = meshgrid(1:M,1:N);surf(x,y,abs(fourier))

This plot visualizes the magnitude of the spec-tra (see equation B.3) using the abs function.This spectra can now be subjected to numer-ous ways of filtering or alterations, and anytime transformed back into the spatial planeusing the inverse transform. Worth noting isthat in order to be correctly inverted, the spec-tra must be shifted back to its original positionusing ifftshift. The inverse is made by typing:

inverse = ifft2(ifftshift(fourier));

Given that the spectra is untouched, the in-verse will produce the exact same image.

B.2.2 The Log Transform

A Fourier transform often has a very large dy-namic range. It is not uncommon that a spec-tra ranges from 0 to 106 or higher. As seen inthe figure B.1, the spectra has a peak in thecenter that is significantly higher than its sur-roundings. This is a problem when trying to vi-sualize it as a gray scale image; eight bits (256levels) are not enough to linearly represent allthe detail at the lower values and the peaks si-multaneously. This is why most Fourier spec-tra in image processing publications have beenaltered using some kind of transformation toexpand the lower values, while compressing thehigher ones.

30

Page 42: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

(a)

0

20

40

60

0

20

40

60

0

0.2

0.4

0.6

0.8

1

uv

|F(u

,v)|

(b)

Figure B.1: An image (a) and its Fourier spec-tra (b). The spectra is normalized. Originalimage courtesy of Oscar Gustafsson.

One approach often used is the log transform1:

s = c log(1 + r) (B.6)

where s is the resulting image and r (r ≥ 0) isthe input. The variable c is a parameter thatdecides how much the lower values should beenhanced. The spectra in figure B.2 has beenaltered with the transform using c = 0.08. To

1The natural logarithm e is used.

0

20

40

60

0

20

40

60

0

0.2

0.4

0.6

0.8

1

uv

|F(u

,v)|

Figure B.2: The Fourier spectra in B.1(b) withthe log transform in equation B.6 applied to it.Note how the lower values are enhanced. Thespectra is normalized.

do the transformation in Matlab, use a com-mand such as:

logTrans = 0.1*log(1+abs(fourier));

Here, the value of c is 0.1. The higher thevalue of c, the more the lower values will beenhanced.

31

Page 43: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Appendix C

Images

This appendix contains some resulting imagesand figures.

32

Page 44: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

(a)

(b)

Figure C.1: Two of the halftones used for testing in this thesis. (a) is a gray scale halftone thathas not left the computer, while (b) is a scanned, colour halftone printed in CMYK.

33

Page 45: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

(a)

(b)

Figure C.2: Images illustrating inverse halftoning on the gray scale halftone in figure C.1(a)using the proposed method. (b) is the result of low pass filtering the original using a Gaussianfilter kernel that just about removes the screen pattern. (a) shows the resulting continuous toneimage after twelve recursions. Note the difference in sharpness between (a) and (b).

34

Page 46: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

(a)

(b)

Figure C.3: Images illustrating inverse halftoning on the colour halftone in figure C.1(b) usingthe proposed method. (b) shows the low passed version of the original. (a) shows the resultingimage after twelve recursions.

35

Page 47: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Bin

P(I)

(a) Image A, one recursion

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

BinP(

I)

(b) Image A, five recursions

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Bin

P(I)

(c) Image A, nine recursions

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Bin

P(I)

(d) Image B, one recursion

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Bin

P(I)

(e) Image B, five recursions

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Bin

P(I)

(f) Image B, nine recursions

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Bin

P(I)

(g) Image C, one recursion

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Bin

P(I)

(h) Image C, five recursions

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Bin

P(I)

(i) Image C, nine recursions

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Bin

P(I)

(j) Image D, one recursion

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Bin

P(I)

(k) Image D, five recursions

110 115 120 125 130 135 140 1450

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Bin

P(I)

(l) Image D, nine recursions

Figure C.4: Histograms of the images used to enhance the low passed versions of the original atdifferent states of the algorithm. (a-c) are the result of a perfect gray scale image, (d-f) a grayscale scanned image, (g-i) a scanned colour image (C channel) and (j-l) a perfect colour image(also C channel). Note the convergence present in all cases.

36

Page 48: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Appendix D

Glossary of Technical Terms

This appendix contains explanations of someof the technical terms used in this report.

Axiom - A self-evident truth that requires noproof.

Binary image - An image containing onlytwo different values: zero or one. Ahalftone is a binary image.

Cell width - The width of a screen cell. Inthis thesis this is measured in pixels.

Channel peak - A peak in the Fourier do-main that represents the frequency andangle of the halftone screen. In case ofcolour halftones, this is the peak of thecurrent colour. Also see residue peak andmoire peak.

CMY - A colour space with the colours cyan,magenta and yellow.

CMYK - A colour space consisting of thecolours cyan, magenta, yellow and black.Often used when printing.

Cutoff frequency - The frequency at whicheverything above or below should be re-moved when filtering.

dpi - Dots per inch. The resolution of the ex-posure dots a printer is printing.

Exposure dot - A small dot. Measured indpi.

Filter kernel - A matrix used for filtering ineither the spatial or frequency domain.

Halftone - A binary representation of an im-age that simulates continuous tone. Com-patible with binary printers.

Halftone dot - A cluster of exposure dotsforming a larger dot.

Halftoning - The process of converting a con-tinuous tone image into a halftone.

Inverse halftoning - The process of convert-ing a halftone to a continuous tone imagewithout removing too much detail.

Inverse method - A method that utilizesbackward reasoning; that is to think back-wards in order to make progress.

lpi - Lines per inch. The number of screencells a printer prints per inch.

Moire - Two or more different superimposedfrequencies create a new one. This effectis called moire.

Moire peak - A peak in the Fourier domainrepresenting the frequency and angle of amoire pattern.

Offset vector - The vector from the center ofa scanned halftoned image to the center ofits nearest black screen cell. Measured inpixels.

37

Page 49: Inverse Halftoning Using Inverse Methods - DiVA portal643165/FULLTEXT01.pdf · s kerheten och tillg ngligheten finns det l sningar av teknisk och administrativ art. ... 5.7 The reproduced

Residue peak - Peaks from the other colourchannels.

RGB - A colour space consisting of red, greenand blue. Used in colour monitors, digitalcameras and scanners.

SNR - Signal to noise ratio. This is a powerratio between the signal and the back-ground noise.

Screen - A number of screen cells ordered ina regular pattern.

Screen angle - The angle at which the screenis rotated.

38