SlideShare uma empresa Scribd logo
1 de 8
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

Image enhancement
Image enhancementImage enhancement
Image enhancementvsaranya169
 
Techniques of Brain Cancer Detection from MRI using Machine Learning
Techniques of Brain Cancer Detection from MRI using Machine LearningTechniques of Brain Cancer Detection from MRI using Machine Learning
Techniques of Brain Cancer Detection from MRI using Machine LearningIRJET Journal
 
Facial emotion recognition
Facial emotion recognitionFacial emotion recognition
Facial emotion recognitionAnukriti Dureha
 
UNetEliyaLaialy (2).pptx
UNetEliyaLaialy (2).pptxUNetEliyaLaialy (2).pptx
UNetEliyaLaialy (2).pptxNoorUlHaq47
 
Image classification using cnn
Image classification using cnnImage classification using cnn
Image classification using cnnSumeraHangi
 
Color image processing
Color image processingColor image processing
Color image processingrmsurya
 
Convolutional neural network
Convolutional neural networkConvolutional neural network
Convolutional neural networkMojammilHusain
 
Digital Image Fundamentals
Digital Image FundamentalsDigital Image Fundamentals
Digital Image FundamentalsKalyan Acharjya
 
Visual Saliency Prediction with Deep Learning - Kevin McGuinness - UPC Barcel...
Visual Saliency Prediction with Deep Learning - Kevin McGuinness - UPC Barcel...Visual Saliency Prediction with Deep Learning - Kevin McGuinness - UPC Barcel...
Visual Saliency Prediction with Deep Learning - Kevin McGuinness - UPC Barcel...Universitat Politècnica de Catalunya
 
Content based image retrieval(cbir)
Content based image retrieval(cbir)Content based image retrieval(cbir)
Content based image retrieval(cbir)paddu123
 
Image classification using convolutional neural network
Image classification using convolutional neural networkImage classification using convolutional neural network
Image classification using convolutional neural networkKIRAN R
 
Content based image retrieval
Content based image retrievalContent based image retrieval
Content based image retrievalrubaiyat11
 
Image classification using cnn
Image classification using cnnImage classification using cnn
Image classification using cnnRahat Yasir
 
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...Ulaş Bağcı
 
Cat and dog classification
Cat and dog classificationCat and dog classification
Cat and dog classificationomaraldabash
 

Mais procurados (20)

Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Techniques of Brain Cancer Detection from MRI using Machine Learning
Techniques of Brain Cancer Detection from MRI using Machine LearningTechniques of Brain Cancer Detection from MRI using Machine Learning
Techniques of Brain Cancer Detection from MRI using Machine Learning
 
Facial emotion recognition
Facial emotion recognitionFacial emotion recognition
Facial emotion recognition
 
UNetEliyaLaialy (2).pptx
UNetEliyaLaialy (2).pptxUNetEliyaLaialy (2).pptx
UNetEliyaLaialy (2).pptx
 
Image classification using cnn
Image classification using cnnImage classification using cnn
Image classification using cnn
 
Edge detection
Edge detectionEdge detection
Edge detection
 
Color image processing
Color image processingColor image processing
Color image processing
 
Convolutional neural network
Convolutional neural networkConvolutional neural network
Convolutional neural network
 
Digital Image Fundamentals
Digital Image FundamentalsDigital Image Fundamentals
Digital Image Fundamentals
 
Visual Saliency Prediction with Deep Learning - Kevin McGuinness - UPC Barcel...
Visual Saliency Prediction with Deep Learning - Kevin McGuinness - UPC Barcel...Visual Saliency Prediction with Deep Learning - Kevin McGuinness - UPC Barcel...
Visual Saliency Prediction with Deep Learning - Kevin McGuinness - UPC Barcel...
 
Color detection
Color detectionColor detection
Color detection
 
Content based image retrieval(cbir)
Content based image retrieval(cbir)Content based image retrieval(cbir)
Content based image retrieval(cbir)
 
Image classification using convolutional neural network
Image classification using convolutional neural networkImage classification using convolutional neural network
Image classification using convolutional neural network
 
Content based image retrieval
Content based image retrievalContent based image retrieval
Content based image retrieval
 
Image classification using cnn
Image classification using cnnImage classification using cnn
Image classification using cnn
 
Vgg
VggVgg
Vgg
 
Human Emotion Recognition
Human Emotion RecognitionHuman Emotion Recognition
Human Emotion Recognition
 
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
 
Image denoising
Image denoising Image denoising
Image denoising
 
Cat and dog classification
Cat and dog classificationCat and dog classification
Cat and dog classification
 

Destaque

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
 

Destaque (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
 

Semelhante a Image Printing Based on Halftoning

ModuleII.ppt
ModuleII.pptModuleII.ppt
ModuleII.pptSKILL2021
 
ModuleII090.pdf
ModuleII090.pdfModuleII090.pdf
ModuleII090.pdfSamrajECE
 
DSP presentation_latest
DSP presentation_latestDSP presentation_latest
DSP presentation_latestHaowei Jiang
 
Image enhancement in the spatial domain1
Image enhancement in the spatial domain1Image enhancement in the spatial domain1
Image enhancement in the spatial domain1shabanam tamboli
 
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.pptShabanamTamboli1
 
Fast Segmentation of Sub-cellular Organelles
Fast Segmentation of Sub-cellular OrganellesFast Segmentation of Sub-cellular Organelles
Fast Segmentation of Sub-cellular OrganellesCSCJournals
 
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 filesMinh Anh Nguyen
 
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 filesMinh Anh Nguyen
 
JonathanWestlake_ComputerVision_Project1
JonathanWestlake_ComputerVision_Project1JonathanWestlake_ComputerVision_Project1
JonathanWestlake_ComputerVision_Project1Jonathan Westlake
 
RC3-deScreen_s
RC3-deScreen_sRC3-deScreen_s
RC3-deScreen_shenry kang
 
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 ProcessingAshok Kumar
 
project presentation-90-MCS-200003.pptx
project presentation-90-MCS-200003.pptxproject presentation-90-MCS-200003.pptx
project presentation-90-MCS-200003.pptxNiladriBhattacharjee10
 

Semelhante 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
 
Histogram processing
Histogram processingHistogram processing
Histogram processing
 
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
 

Mais 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
 

Mais 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

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 

Último (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

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