SlideShare una empresa de Scribd logo
1 de 8
Descargar para leer sin conexión
Image Printing Based on Halftoning

                                                 Cody A. Ray

                                                April 29, 2010


1        Project Goal

This objective of this project was to develop an image printing program based on the
concept of halftoning.1 The following figure shows ten shades of gray approximated by dot
patterns. Each gray level is represented by a 3 x 3 pattern of black and white dots. A 3 x 3
area full of black dots is the approximation to gray-level black, or 0. Similarly, a 3 x 3 area
of white dots represents gray level 9, or white. The other dot patterns are approximations
to gray levels in between these two extremes. A gray-level printing scheme based on dots
patterns such as these is called “halftoning.” Note that each pixel in an input image will
correspond to 3 x 3 pixels on the printed image, so spatial resolution will be reduced to
33% of the original in both the vertical and horizontal direction.




                 Figure 1: Halftone Dot Pattern Approximating Ten Shades of Gray
    1
        Due to differences in printer capabilities, half-tone images were written to file rather than printed.




                                                         1
2    Findings and Conclusions

This halftoning specification, containing only ten shades of gray and having the dots evenly
spaced and sized, leaves much to be desired in the quality of the halftoned image. While
this specification was simple to implement and has reasonable runtime performance, there
are a few clear disadvantages. The multidimensional reduction in spatial resolution is
clearly unacceptable, resulting in a very low-quality halftoned image. Furthermore, the
resulting three-fold increase in size creates logistical difficulties in scaling images for various
applications (e.g., printing, word processing, etc). The disadvantages definitely outweigh
the advantages, and this halftoning specification is not recommended to be used.


3    Supporting Data

The system was implemented in MATLAB and tested with images that came with the
textbook or were pre-installed with MATLAB.
To ensure the logic was correctly implemented, the first test conducted was with a matrix
rather than an actual image. Listing 1 shows the input image in img, the image after
scaling to the full grayscale range mid img, and the resulting halftone image out img. In
this halftone matrix, each pixel is replaced by the corresponding set of black and white
dots, where a black dot is represented by 0 and a white dot by 1.


                          Listing 1: Testing the Halftoning System
in img =

      1      2      3
      4      5      6
      7      8      9


mid img =

      0      1      2
      3      5      6
      7      8      9


out img =

      0      0      0       0      1      0        0     1      0
      0      0      0       0      0      0        0     0      0
      0      0      0       0      0      0        0     0      1



                                               2
1      1      0      1      1      1        1    1      1
     0      0      0      0      0      0        0    0      1
     0      0      1      1      0      1        1    0      1
     1      1      1      1      1      1        1    1      1
     0      0      1      1      0      1        1    1      1
     1      1      1      1      1      1        1    1      1


A visual comparison of out img and mid img to the dot configurations in Fig. 1 shows that
the system is implemented correctly per specification.
The first image with which the program was tested was the football photograph bundled
with MATLAB. However, as the program only accepts monochromatic images, the photo-
graph was first converted to grayscale with the command rgb2gray. For this report, the
original image was scaled using photoshop prior to halftone processing so that the halftoned
image (which is three times as large) can fit on the page. The original (unscaled) image
appears in Fig. 2, and the halftoned image is shown in Fig. 3.




                       Figure 2: Original Football Image (Unscaled)

The second image tested was the near-famous image of “Lena” distributed with the text-
book Digital Image Processing by Gonzales and Woods. The note from above regarding
scaling for the report applies to this image as well. Additionally, the image was first con-
verted from BMP format to JPG format using the ImageMagick convert command.

                                             3
Figure 3: Halftoned Football Image




Figure 4: Original Lena Image (Scaled)


                  4
Figure 5: Halftoned Lena Image




              5
A      Computer Programs


                              Listing 2: Source Code of halftone.m
 1   %   Image Printing Based on Halftoning
 2   %   Cody A. Ray, codyaray@drexel.edu
 3   %   April 29, 2010
 4   %
 5   %   This program rewrites an image based on halftoning.
 6   %
 7   %   For halftoning, we use ten shades of gray approximated by dot patterns
 8   %   (see below). Each gray level is represented by a 3 x 3 pattern of black
 9   %   and white dots. A 3 x 3 area full of black dots is the approximation to
10   %   gray−level black, or 0. Similarly, a 3 x 3 area of white dots represents
11   %   gray level 9, or white. The other dot patterns are approximations to
12   %   gray levels in between these two extremes. A gray−level printing scheme
13   %   based on dots patterns such as these is called "halftoning." Note that
14   %   each pixel in an input image will correspond to 3 x 3 pixels on the
15   %   printed image, so spatial resolution will be reduced to 33% of the
16   %   original in both the vertical and horizontal direction.
17
18   % Algorithm:
19   % (1) Read in monochromatic image
20   % (2) Scale gray levels to span full half−toning range
21   % (3) Map gray levels to halftones
22   % (4) Store corresponding half−tone for each pixel
23   % (5) Return halftone image
24
25   function out img = halftone(in img)
26
27   % Scale gray levels to span full half−toning range
28
29   mini = min(min(in img));
30   maxi = max(max(in img));
31   step = (maxi−mini)/10;
32
33   mid img = zeros(size(in img));
34   for k = 0:9
35       lmin = mini+step*k;
36       lmax = lmin+step;
37       [i,j] = ind2sub(size(in img),find(in img≥lmin&in img≤lmax));
38       for l = 1:length(i)
39           mid img(i(l),j(l)) = k;
40       end
41   end
42
43   mid img
44
45   % Map gray levels to halftones


                                               6
46
47   w = 1;
48   b = 0;
49
50   gray0   =   [b,b,b;b,b,b;b,b,b];
51   gray1   =   [b,w,b;b,b,b;b,b,b];
52   gray2   =   [b,w,b;b,b,b;b,b,w];
53   gray3   =   [w,w,b;b,b,b;b,b,w];
54   gray4   =   [w,w,b;b,b,b;w,b,w];
55   gray5   =   [w,w,w;b,b,b;w,b,w];
56   gray6   =   [w,w,w;b,b,w;w,b,w];
57   gray7   =   [w,w,w;b,b,w;w,w,w];
58   gray8   =   [w,w,w;w,b,w;w,w,w];
59   gray9   =   [w,w,w;w,w,w;w,w,w];
60
61   % Store corresponding half−tone for each pixel
62
63   out img = zeros(size(mid img)*3);
64   for i = 1:size(mid img,1)
65       for j = 1:size(mid img,2)
66           switch mid img(i,j)
67               case 0
68                   level = gray0;
69               case 1
70                   level = gray1;
71               case 2
72                   level = gray2;
73               case 3
74                   level = gray3;
75               case 4
76                   level = gray4;
77               case 5
78                   level = gray5;
79               case 6
80                   level = gray6;
81               case 7
82                   level = gray7;
83               case 8
84                   level = gray8;
85               case 9
86                   level = gray9;
87           end
88
89               new i = i + 2*(i−1);
90               new j = j + 2*(j−1);
91               out img(new i:new i+2,new j:new j+2) = level;
92         end
93   end




                                                7
Listing 3: Source Code of usage.m
 1   %   Image Printing Based on Halftoning
 2   %   Cody A. Ray, codyaray@drexel.edu
 3   %   April 29, 2010
 4   %
 5   %   Sample usage of the halftone command
 6
 7   % clearing memory and command window
 8   clc; clear all; close all;
 9
10   % input image
11   file in   = 'football.jpg';
12   path in   = ['../imgin/' file in];
13   in img    = imread(path in);
14   figure, imshow(in img), title('Input Image');
15
16   % output halftone
17   file out = ['halftone−' file in];
18   path out = ['../imgout/' file out];
19   out img   = halftone(in img);
20   figure, imshow(out img), title('Halftoned Image');
21   imwrite(out img, path out);




                                                8

Más contenido relacionado

La actualidad más candente

Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphicsShaishavShah8
 
Design and Simulation of Radix-8 Booth Encoder Multiplier for Signed and Unsi...
Design and Simulation of Radix-8 Booth Encoder Multiplier for Signed and Unsi...Design and Simulation of Radix-8 Booth Encoder Multiplier for Signed and Unsi...
Design and Simulation of Radix-8 Booth Encoder Multiplier for Signed and Unsi...ijsrd.com
 
hidden surface elimination using z buffer algorithm
hidden surface elimination using z buffer algorithmhidden surface elimination using z buffer algorithm
hidden surface elimination using z buffer algorithmrajivagarwal23dei
 
Lecture 9-online
Lecture 9-onlineLecture 9-online
Lecture 9-onlinelifebreath
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.Mohd Arif
 
Visual Cryptography
Visual CryptographyVisual Cryptography
Visual CryptographyAneeshGKumar
 
Ellipses drawing algo.
Ellipses drawing algo.Ellipses drawing algo.
Ellipses drawing algo.Mohd Arif
 
Lect 03 - first portion
Lect 03 - first portionLect 03 - first portion
Lect 03 - first portionMoe Moe Myint
 
Region filling
Region fillingRegion filling
Region fillinghetvi naik
 
2 d viewing computer graphics
2 d viewing computer graphics2 d viewing computer graphics
2 d viewing computer graphicsKALESHWAR KUMAR
 
Anti- aliasing computer graphics
Anti- aliasing computer graphicsAnti- aliasing computer graphics
Anti- aliasing computer graphicsSafayet Hossain
 
Image enhancement in the spatial domain1
Image enhancement in the spatial domain1Image enhancement in the spatial domain1
Image enhancement in the spatial domain1shabanam tamboli
 

La actualidad más candente (20)

Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphics
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Design and Simulation of Radix-8 Booth Encoder Multiplier for Signed and Unsi...
Design and Simulation of Radix-8 Booth Encoder Multiplier for Signed and Unsi...Design and Simulation of Radix-8 Booth Encoder Multiplier for Signed and Unsi...
Design and Simulation of Radix-8 Booth Encoder Multiplier for Signed and Unsi...
 
Histogram processing
Histogram processingHistogram processing
Histogram processing
 
hidden surface elimination using z buffer algorithm
hidden surface elimination using z buffer algorithmhidden surface elimination using z buffer algorithm
hidden surface elimination using z buffer algorithm
 
Lecture 9-online
Lecture 9-onlineLecture 9-online
Lecture 9-online
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.
 
Visual Cryptography
Visual CryptographyVisual Cryptography
Visual Cryptography
 
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
bresenham circles and polygons in computer graphics(Computer graphics tutorials)bresenham circles and polygons in computer graphics(Computer graphics tutorials)
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
 
Topdown parsing
Topdown parsingTopdown parsing
Topdown parsing
 
Ellipses drawing algo.
Ellipses drawing algo.Ellipses drawing algo.
Ellipses drawing algo.
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Lect 03 - first portion
Lect 03 - first portionLect 03 - first portion
Lect 03 - first portion
 
Morphological operations
Morphological operationsMorphological operations
Morphological operations
 
Depth Buffer Method
Depth Buffer MethodDepth Buffer Method
Depth Buffer Method
 
Region filling
Region fillingRegion filling
Region filling
 
2 d viewing computer graphics
2 d viewing computer graphics2 d viewing computer graphics
2 d viewing computer graphics
 
Anti- aliasing computer graphics
Anti- aliasing computer graphicsAnti- aliasing computer graphics
Anti- aliasing computer graphics
 
Image enhancement in the spatial domain1
Image enhancement in the spatial domain1Image enhancement in the spatial domain1
Image enhancement in the spatial domain1
 
Hog and sift
Hog and siftHog and sift
Hog and sift
 

Destacado

Introduction to Digital Image Processing Using MATLAB
Introduction to Digital Image Processing Using MATLABIntroduction to Digital Image Processing Using MATLAB
Introduction to Digital Image Processing Using MATLABRay Phan
 
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDBBuilding a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDBCody Ray
 
Digital image processing using matlab: filters (detail)
Digital image processing using matlab: filters (detail)Digital image processing using matlab: filters (detail)
Digital image processing using matlab: filters (detail)thanh nguyen
 
Đề cương môn xử lý ảnh
Đề cương môn xử lý ảnhĐề cương môn xử lý ảnh
Đề cương môn xử lý ảnhJean Valjean
 
Matlab Working With Images
Matlab Working With ImagesMatlab Working With Images
Matlab Working With Imagesmatlab Content
 
Hidden surfaces
Hidden surfacesHidden surfaces
Hidden surfacesMohd Arif
 
Illumination model
Illumination modelIllumination model
Illumination modelAnkur Kumar
 
REFLECTION AND REFRACTION OF LIGHT
REFLECTION AND REFRACTION OF LIGHTREFLECTION AND REFRACTION OF LIGHT
REFLECTION AND REFRACTION OF LIGHTfourangela
 
Reflection and Refraction
Reflection and RefractionReflection and Refraction
Reflection and Refractionmeenng
 
Histogram equalization
Histogram equalizationHistogram equalization
Histogram equalization11mr11mahesh
 

Destacado (20)

Halftoning in Computer Graphics
Halftoning  in Computer GraphicsHalftoning  in Computer Graphics
Halftoning in Computer Graphics
 
Halftone
HalftoneHalftone
Halftone
 
Halftone
HalftoneHalftone
Halftone
 
halftone
halftonehalftone
halftone
 
Introduction to Digital Image Processing Using MATLAB
Introduction to Digital Image Processing Using MATLABIntroduction to Digital Image Processing Using MATLAB
Introduction to Digital Image Processing Using MATLAB
 
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDBBuilding a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
 
Illumination Model
Illumination ModelIllumination Model
Illumination Model
 
IMAGE PROCESSING
IMAGE PROCESSINGIMAGE PROCESSING
IMAGE PROCESSING
 
Digital image processing using matlab: filters (detail)
Digital image processing using matlab: filters (detail)Digital image processing using matlab: filters (detail)
Digital image processing using matlab: filters (detail)
 
Đề cương môn xử lý ảnh
Đề cương môn xử lý ảnhĐề cương môn xử lý ảnh
Đề cương môn xử lý ảnh
 
Matlab Working With Images
Matlab Working With ImagesMatlab Working With Images
Matlab Working With Images
 
Hidden surfaces
Hidden surfacesHidden surfaces
Hidden surfaces
 
Illumination model
Illumination modelIllumination model
Illumination model
 
10 surat masuk (pdf)
10 surat masuk (pdf)10 surat masuk (pdf)
10 surat masuk (pdf)
 
Illumination.
Illumination.Illumination.
Illumination.
 
REFLECTION AND REFRACTION OF LIGHT
REFLECTION AND REFRACTION OF LIGHTREFLECTION AND REFRACTION OF LIGHT
REFLECTION AND REFRACTION OF LIGHT
 
Reflection and Refraction
Reflection and RefractionReflection and Refraction
Reflection and Refraction
 
Unit step function
Unit step functionUnit step function
Unit step function
 
Light.ppt
Light.pptLight.ppt
Light.ppt
 
Histogram equalization
Histogram equalizationHistogram equalization
Histogram equalization
 

Similar a Image Printing Based on Halftoning

Similar a Image Printing Based on Halftoning (20)

ModuleII.ppt
ModuleII.pptModuleII.ppt
ModuleII.ppt
 
ModuleII.ppt
ModuleII.pptModuleII.ppt
ModuleII.ppt
 
ModuleII.ppt
ModuleII.pptModuleII.ppt
ModuleII.ppt
 
ModuleII090.pdf
ModuleII090.pdfModuleII090.pdf
ModuleII090.pdf
 
DSP presentation_latest
DSP presentation_latestDSP presentation_latest
DSP presentation_latest
 
h.pdf
h.pdfh.pdf
h.pdf
 
Gabor Filter
Gabor FilterGabor Filter
Gabor Filter
 
Count that face
Count that faceCount that face
Count that face
 
Image Enhancement in the Spatial Domain1.ppt
Image Enhancement in the Spatial Domain1.pptImage Enhancement in the Spatial Domain1.ppt
Image Enhancement in the Spatial Domain1.ppt
 
Fast Segmentation of Sub-cellular Organelles
Fast Segmentation of Sub-cellular OrganellesFast Segmentation of Sub-cellular Organelles
Fast Segmentation of Sub-cellular Organelles
 
The method of comparing two image files
 The method of comparing two image files The method of comparing two image files
The method of comparing two image files
 
The method of comparing two image files
The method of comparing two image filesThe method of comparing two image files
The method of comparing two image files
 
DIP_Lecture5.pdf
DIP_Lecture5.pdfDIP_Lecture5.pdf
DIP_Lecture5.pdf
 
DIP_Lecture5.pdf
DIP_Lecture5.pdfDIP_Lecture5.pdf
DIP_Lecture5.pdf
 
JonathanWestlake_ComputerVision_Project1
JonathanWestlake_ComputerVision_Project1JonathanWestlake_ComputerVision_Project1
JonathanWestlake_ComputerVision_Project1
 
RC3-deScreen_s
RC3-deScreen_sRC3-deScreen_s
RC3-deScreen_s
 
Image Processing using Matlab . Useful for beginners to learn Image Processing
Image Processing using Matlab . Useful for beginners to learn Image ProcessingImage Processing using Matlab . Useful for beginners to learn Image Processing
Image Processing using Matlab . Useful for beginners to learn Image Processing
 
project presentation-90-MCS-200003.pptx
project presentation-90-MCS-200003.pptxproject presentation-90-MCS-200003.pptx
project presentation-90-MCS-200003.pptx
 
Image processing with matlab
Image processing with matlabImage processing with matlab
Image processing with matlab
 
Basics of Digital Images
Basics of  Digital ImagesBasics of  Digital Images
Basics of Digital Images
 

Más de Cody Ray

Cody A. Ray DEXA Report 3/21/2013
Cody A. Ray DEXA Report 3/21/2013Cody A. Ray DEXA Report 3/21/2013
Cody A. Ray DEXA Report 3/21/2013Cody Ray
 
Cognitive Modeling & Intelligent Tutors
Cognitive Modeling & Intelligent TutorsCognitive Modeling & Intelligent Tutors
Cognitive Modeling & Intelligent TutorsCody Ray
 
Robotics: Modelling, Planning and Control
Robotics: Modelling, Planning and ControlRobotics: Modelling, Planning and Control
Robotics: Modelling, Planning and ControlCody Ray
 
Psychoacoustic Approaches to Audio Steganography
Psychoacoustic Approaches to Audio SteganographyPsychoacoustic Approaches to Audio Steganography
Psychoacoustic Approaches to Audio SteganographyCody Ray
 
Psychoacoustic Approaches to Audio Steganography Report
Psychoacoustic Approaches to Audio Steganography Report Psychoacoustic Approaches to Audio Steganography Report
Psychoacoustic Approaches to Audio Steganography Report Cody Ray
 
Text-Independent Speaker Verification
Text-Independent Speaker VerificationText-Independent Speaker Verification
Text-Independent Speaker VerificationCody Ray
 
Text-Independent Speaker Verification Report
Text-Independent Speaker Verification ReportText-Independent Speaker Verification Report
Text-Independent Speaker Verification ReportCody Ray
 
Object Recognition: Fourier Descriptors and Minimum-Distance Classification
Object Recognition: Fourier Descriptors and Minimum-Distance ClassificationObject Recognition: Fourier Descriptors and Minimum-Distance Classification
Object Recognition: Fourier Descriptors and Minimum-Distance ClassificationCody Ray
 

Más de Cody Ray (8)

Cody A. Ray DEXA Report 3/21/2013
Cody A. Ray DEXA Report 3/21/2013Cody A. Ray DEXA Report 3/21/2013
Cody A. Ray DEXA Report 3/21/2013
 
Cognitive Modeling & Intelligent Tutors
Cognitive Modeling & Intelligent TutorsCognitive Modeling & Intelligent Tutors
Cognitive Modeling & Intelligent Tutors
 
Robotics: Modelling, Planning and Control
Robotics: Modelling, Planning and ControlRobotics: Modelling, Planning and Control
Robotics: Modelling, Planning and Control
 
Psychoacoustic Approaches to Audio Steganography
Psychoacoustic Approaches to Audio SteganographyPsychoacoustic Approaches to Audio Steganography
Psychoacoustic Approaches to Audio Steganography
 
Psychoacoustic Approaches to Audio Steganography Report
Psychoacoustic Approaches to Audio Steganography Report Psychoacoustic Approaches to Audio Steganography Report
Psychoacoustic Approaches to Audio Steganography Report
 
Text-Independent Speaker Verification
Text-Independent Speaker VerificationText-Independent Speaker Verification
Text-Independent Speaker Verification
 
Text-Independent Speaker Verification Report
Text-Independent Speaker Verification ReportText-Independent Speaker Verification Report
Text-Independent Speaker Verification Report
 
Object Recognition: Fourier Descriptors and Minimum-Distance Classification
Object Recognition: Fourier Descriptors and Minimum-Distance ClassificationObject Recognition: Fourier Descriptors and Minimum-Distance Classification
Object Recognition: Fourier Descriptors and Minimum-Distance Classification
 

Último

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 

Último (20)

Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 

Image Printing Based on Halftoning

  • 1. Image Printing Based on Halftoning Cody A. Ray April 29, 2010 1 Project Goal This objective of this project was to develop an image printing program based on the concept of halftoning.1 The following figure shows ten shades of gray approximated by dot patterns. Each gray level is represented by a 3 x 3 pattern of black and white dots. A 3 x 3 area full of black dots is the approximation to gray-level black, or 0. Similarly, a 3 x 3 area of white dots represents gray level 9, or white. The other dot patterns are approximations to gray levels in between these two extremes. A gray-level printing scheme based on dots patterns such as these is called “halftoning.” Note that each pixel in an input image will correspond to 3 x 3 pixels on the printed image, so spatial resolution will be reduced to 33% of the original in both the vertical and horizontal direction. Figure 1: Halftone Dot Pattern Approximating Ten Shades of Gray 1 Due to differences in printer capabilities, half-tone images were written to file rather than printed. 1
  • 2. 2 Findings and Conclusions This halftoning specification, containing only ten shades of gray and having the dots evenly spaced and sized, leaves much to be desired in the quality of the halftoned image. While this specification was simple to implement and has reasonable runtime performance, there are a few clear disadvantages. The multidimensional reduction in spatial resolution is clearly unacceptable, resulting in a very low-quality halftoned image. Furthermore, the resulting three-fold increase in size creates logistical difficulties in scaling images for various applications (e.g., printing, word processing, etc). The disadvantages definitely outweigh the advantages, and this halftoning specification is not recommended to be used. 3 Supporting Data The system was implemented in MATLAB and tested with images that came with the textbook or were pre-installed with MATLAB. To ensure the logic was correctly implemented, the first test conducted was with a matrix rather than an actual image. Listing 1 shows the input image in img, the image after scaling to the full grayscale range mid img, and the resulting halftone image out img. In this halftone matrix, each pixel is replaced by the corresponding set of black and white dots, where a black dot is represented by 0 and a white dot by 1. Listing 1: Testing the Halftoning System in img = 1 2 3 4 5 6 7 8 9 mid img = 0 1 2 3 5 6 7 8 9 out img = 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2
  • 3. 1 1 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 A visual comparison of out img and mid img to the dot configurations in Fig. 1 shows that the system is implemented correctly per specification. The first image with which the program was tested was the football photograph bundled with MATLAB. However, as the program only accepts monochromatic images, the photo- graph was first converted to grayscale with the command rgb2gray. For this report, the original image was scaled using photoshop prior to halftone processing so that the halftoned image (which is three times as large) can fit on the page. The original (unscaled) image appears in Fig. 2, and the halftoned image is shown in Fig. 3. Figure 2: Original Football Image (Unscaled) The second image tested was the near-famous image of “Lena” distributed with the text- book Digital Image Processing by Gonzales and Woods. The note from above regarding scaling for the report applies to this image as well. Additionally, the image was first con- verted from BMP format to JPG format using the ImageMagick convert command. 3
  • 4. Figure 3: Halftoned Football Image Figure 4: Original Lena Image (Scaled) 4
  • 5. Figure 5: Halftoned Lena Image 5
  • 6. A Computer Programs Listing 2: Source Code of halftone.m 1 % Image Printing Based on Halftoning 2 % Cody A. Ray, codyaray@drexel.edu 3 % April 29, 2010 4 % 5 % This program rewrites an image based on halftoning. 6 % 7 % For halftoning, we use ten shades of gray approximated by dot patterns 8 % (see below). Each gray level is represented by a 3 x 3 pattern of black 9 % and white dots. A 3 x 3 area full of black dots is the approximation to 10 % gray−level black, or 0. Similarly, a 3 x 3 area of white dots represents 11 % gray level 9, or white. The other dot patterns are approximations to 12 % gray levels in between these two extremes. A gray−level printing scheme 13 % based on dots patterns such as these is called "halftoning." Note that 14 % each pixel in an input image will correspond to 3 x 3 pixels on the 15 % printed image, so spatial resolution will be reduced to 33% of the 16 % original in both the vertical and horizontal direction. 17 18 % Algorithm: 19 % (1) Read in monochromatic image 20 % (2) Scale gray levels to span full half−toning range 21 % (3) Map gray levels to halftones 22 % (4) Store corresponding half−tone for each pixel 23 % (5) Return halftone image 24 25 function out img = halftone(in img) 26 27 % Scale gray levels to span full half−toning range 28 29 mini = min(min(in img)); 30 maxi = max(max(in img)); 31 step = (maxi−mini)/10; 32 33 mid img = zeros(size(in img)); 34 for k = 0:9 35 lmin = mini+step*k; 36 lmax = lmin+step; 37 [i,j] = ind2sub(size(in img),find(in img≥lmin&in img≤lmax)); 38 for l = 1:length(i) 39 mid img(i(l),j(l)) = k; 40 end 41 end 42 43 mid img 44 45 % Map gray levels to halftones 6
  • 7. 46 47 w = 1; 48 b = 0; 49 50 gray0 = [b,b,b;b,b,b;b,b,b]; 51 gray1 = [b,w,b;b,b,b;b,b,b]; 52 gray2 = [b,w,b;b,b,b;b,b,w]; 53 gray3 = [w,w,b;b,b,b;b,b,w]; 54 gray4 = [w,w,b;b,b,b;w,b,w]; 55 gray5 = [w,w,w;b,b,b;w,b,w]; 56 gray6 = [w,w,w;b,b,w;w,b,w]; 57 gray7 = [w,w,w;b,b,w;w,w,w]; 58 gray8 = [w,w,w;w,b,w;w,w,w]; 59 gray9 = [w,w,w;w,w,w;w,w,w]; 60 61 % Store corresponding half−tone for each pixel 62 63 out img = zeros(size(mid img)*3); 64 for i = 1:size(mid img,1) 65 for j = 1:size(mid img,2) 66 switch mid img(i,j) 67 case 0 68 level = gray0; 69 case 1 70 level = gray1; 71 case 2 72 level = gray2; 73 case 3 74 level = gray3; 75 case 4 76 level = gray4; 77 case 5 78 level = gray5; 79 case 6 80 level = gray6; 81 case 7 82 level = gray7; 83 case 8 84 level = gray8; 85 case 9 86 level = gray9; 87 end 88 89 new i = i + 2*(i−1); 90 new j = j + 2*(j−1); 91 out img(new i:new i+2,new j:new j+2) = level; 92 end 93 end 7
  • 8. Listing 3: Source Code of usage.m 1 % Image Printing Based on Halftoning 2 % Cody A. Ray, codyaray@drexel.edu 3 % April 29, 2010 4 % 5 % Sample usage of the halftone command 6 7 % clearing memory and command window 8 clc; clear all; close all; 9 10 % input image 11 file in = 'football.jpg'; 12 path in = ['../imgin/' file in]; 13 in img = imread(path in); 14 figure, imshow(in img), title('Input Image'); 15 16 % output halftone 17 file out = ['halftone−' file in]; 18 path out = ['../imgout/' file out]; 19 out img = halftone(in img); 20 figure, imshow(out img), title('Halftoned Image'); 21 imwrite(out img, path out); 8