SlideShare ist ein Scribd-Unternehmen logo
1 von 8
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

Chapter 8 image compression
Chapter 8 image compressionChapter 8 image compression
Chapter 8 image compressionasodariyabhavesh
 
Chapter 6 color image processing
Chapter 6 color image processingChapter 6 color image processing
Chapter 6 color image processingasodariyabhavesh
 
Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)RohitK71
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filtersA B Shinde
 
Digital Image Processing_ ch2 enhancement spatial-domain
Digital Image Processing_ ch2 enhancement spatial-domainDigital Image Processing_ ch2 enhancement spatial-domain
Digital Image Processing_ ch2 enhancement spatial-domainMalik obeisat
 
Interpixel redundancy
Interpixel redundancyInterpixel redundancy
Interpixel redundancyNaveen Kumar
 
Point processing
Point processingPoint processing
Point processingpanupriyaa7
 
Visible surface identification
Visible surface identificationVisible surface identification
Visible surface identificationPooja Dixit
 
Character generation
Character generationCharacter generation
Character generationAnkit Garg
 
Image Enhancement - Point Processing
Image Enhancement - Point ProcessingImage Enhancement - Point Processing
Image Enhancement - Point ProcessingGayathri31093
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial DomainA B Shinde
 
Fundamentals and image compression models
Fundamentals and image compression modelsFundamentals and image compression models
Fundamentals and image compression modelslavanya marichamy
 

Was ist angesagt? (20)

Color models
Color modelsColor models
Color models
 
Chapter 8 image compression
Chapter 8 image compressionChapter 8 image compression
Chapter 8 image compression
 
Anti aliasing Computer Graphics
Anti aliasing Computer GraphicsAnti aliasing Computer Graphics
Anti aliasing Computer Graphics
 
Sharpening spatial filters
Sharpening spatial filtersSharpening spatial filters
Sharpening spatial filters
 
Region based segmentation
Region based segmentationRegion based segmentation
Region based segmentation
 
Chapter 6 color image processing
Chapter 6 color image processingChapter 6 color image processing
Chapter 6 color image processing
 
Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)Computer graphics curves and surfaces (1)
Computer graphics curves and surfaces (1)
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filters
 
Digital Image Processing_ ch2 enhancement spatial-domain
Digital Image Processing_ ch2 enhancement spatial-domainDigital Image Processing_ ch2 enhancement spatial-domain
Digital Image Processing_ ch2 enhancement spatial-domain
 
Interpixel redundancy
Interpixel redundancyInterpixel redundancy
Interpixel redundancy
 
Canny Edge Detection
Canny Edge DetectionCanny Edge Detection
Canny Edge Detection
 
Point processing
Point processingPoint processing
Point processing
 
Visible surface identification
Visible surface identificationVisible surface identification
Visible surface identification
 
Edge detection
Edge detectionEdge detection
Edge detection
 
Character generation
Character generationCharacter generation
Character generation
 
Morphological operations
Morphological operationsMorphological operations
Morphological operations
 
Image Enhancement - Point Processing
Image Enhancement - Point ProcessingImage Enhancement - Point Processing
Image Enhancement - Point Processing
 
Chap6 image restoration
Chap6 image restorationChap6 image restoration
Chap6 image restoration
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Fundamentals and image compression models
Fundamentals and image compression modelsFundamentals and image compression models
Fundamentals and image compression models
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie Image Printing Based on Halftoning

Ähnlich wie 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
Image enhancement in the spatial domain1Image enhancement in the spatial domain1
Image enhancement in the spatial domain1
 
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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 

Kürzlich hochgeladen (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 

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