Skip to main content

Clustered-Dot Screen Design for Digital Multitoning - MATLAB Code

Digital Multi-toning is simply an up-gradation of conventional halftone technique. In halftone, a gray scale image is converted to a binary image useful for black and white printing (only use black cartridge). Similarly, digital color halftoning deals with production of printable format color images.

Multitoning is a slight variation to halftone in which instead of binary image, it also use intermediate values of gray scale.



function [Y]=CDM()


%CDM- Clustered Dot Multitoning
%Code by: Sankarasrinivasan S,
%Multimedia Signal Processing Lab
%NTUST, Taipei

%Input Image
im=imread('cameraman.tif');

%Reference
%Y. F. Liu and J. M. Guo, "Clustered-Dot Screen Design for Digital Multitoning," in IEEE Transactions on Image Processing, vol. 25, no. 7, pp. 2971-2982, July 2016.
%Clustered Dot Multitone Screen- Genereated using the referred paper.

DA=[130 94 143 158 176 182 121 159 216 247 254 136 161 169 39 52 239 73 10 27 98 75 9 60 144 192 227 212 199 183 156 224 254 128 40 52 214 190 31 55 90 100 52 18 67 112 140 233 199 187 146 108 243 229 137 131 171 149 35 8 132 96 42 24 60 168 135 92 254 204 176 195 248 234 164 188 243 252 122 11 95 182 26 9 152 165 51 7 217 255 114 92 206 221 164 75 222 241 213 48 77 140 37 20 64 87 44 29 61 180 149 131 255 248 195 67 106 219 231 84 154 178 144 11 137 112 48 38 103 161 141 54 113 243 253 104 193 210 237 194 231 212 25 8 92 110 22 11 174 202 133 24 147 166 123 109 254 245 173 72 199 131 36 147 206 160 51 9 35 76 58 18 96 150 166 191 224 244 254 238 218 128 81 62 243 216 93 27 44 78 55 211 162 167 71 96 116 178 189 221 254 232 170 180 205 132 31 11 99 106 47 24 7 28 152 104 119 138 153 190 220 234 138 61 181 121 200 59 139 44 146 79 57 12 20 81 114 245 255 149 188 208 241 232 245 255 234 202 174 37 43 85 98 71 8 21];
DA=vec2mat(DA,16);
DA(:,:,1)=DA;
DA1=[81 88 136 153 169 164 115 128 206 243 237 125 146 166 29 48 229 68 4 19 83 71 3 15 108 185 223 208 194 176 152 219 247 124 36 46 210 65 23 40 85 78 48 13 62 103 107 213 195 174 118 103 237 223 112 96 155 141 27 1 118 88 34 19 56 161 114 87 250 200 126 183 241 229 159 177 237 248 78 4 84 178 17 1 149 160 45 3 213 124 103 81 202 216 157 68 206 231 209 33 72 121 29 16 59 70 39 22 55 170 145 119 236 227 188 63 99 191 225 79 110 173 134 5 73 106 44 32 99 154 136 43 90 236 248 97 184 206 223 188 226 198 19 1 87 80 17 4 168 181 129 14 141 160 119 101 250 240 126 63 186 120 30 58 197 156 47 3 31 69 53 2 84 142 158 182 219 234 250 229 214 124 73 41 239 201 89 14 39 68 50 204 145 155 67 85 109 171 185 210 249 228 163 176 197 117 24 4 90 77 41 14 1 20 93 100 112 133 148 186 214 229 124 36 177 115 192 54 132 36 88 69 51 2 7 64 109 240 250 103 172 204 217 223 196 250 226 198 167 26 32 75 93 58 1 16];
DA1=vec2mat(DA1,16);
DA(:,:,2)=DA1;

%3-Tone multitone screen.
T=2; %No of screen size is less than 3
bs=16;
[s1 s2]=size(im);

MT=ones(bs,bs);
NT=ones(bs,bs);
for i=1:bs:s1
    for j=1:bs:s2 
        bl=im(i:i+(bs-1),j:j+(bs-1));                 
        for nT=1:1:T   
        MT=(bl>=DA(:,:,nT));   
        M(:,:,nT)=MT;   
        end
   

       for x=1:1:bs
           for y=1:1:bs                   
              if(M(x,y,1)==1 )
                  blc(x,y)=1;
              elseif(M(x,y,2)==1)
                  blc(x,y)=0.5;     
                           
              else
                  blc(x,y)=0;
              end
           
           end
       end
     
 
 Y(i:i+(bs-1),j:j+(bs-1))=blc;
       end 
end
 
imshow(Y);
end



Comments

Popular posts from this blog

Image RGB to CMYK : Image Conversion - MATLAB Code (RGB to CMYK, CMYK to RGB)

MATAB use makecform and applycform functions to perform this color model conversion  Ref: makecform:  https://www.mathworks.com/help/images/ref/makecform.html Ref: applycform:  https://www.mathworks.com/help/images/ref/applycform.html RGB to CMYK: I_rgb = imread('lena_color.jpg'); %Read the color image  C = makecform('srgb2cmyk');     %srgb (standard rgb) to cmyk  I_CMYK= applycform(I_rgb,C); TO SAVE IN CMYK Format imwrite(I_CMYK, 'test.tiff'); USE IMFINFO to confirm the conversion imfinfo('test.tiff') the command gives the output ... Width: 512 Height: 512 BitDepth: 32 ColorType: 'CMYK' ... CMYK to RGB: I_CMYK = imread('lena_color.jpg'); %Read the color image  C = makecform('cmyk2srgb');     %srgb (standard rgb) to cmyk  I_rgb= applycform(I_CMYK, C);

Digital Half Toning - Ordered Dithering - MATLAB Code Bayer/ Ulichney

Digital Half-toning is a technique to convert the gray scale / color image (in the range 0-255) to binary images (in the range 0-1)  that is useful for printing (especially black and white printers). Though at first glance dots are clearly visible, as Human Vision System is a low pass filter, when dots are printed closely and viewed from the specific distance it can be perceived as a continuous tone image (i.e. gray scale). In general, half toning techniques is widely used in newspapers, journals and magazines printing.  Halftoning algorithms aims for better #Image Quality #Low Complexity #Optimal ink usage Coming to the topic, Ordered dithering is one of the standard technique to produce halftone image from continuous (gray scale) images. Let us assume, the first block containing 'B' is an image matrix and the  'H' is the threshold matrix. And the process is simply a element wise (pixel wise) comparison; if element of B > H (g...

Direct Binary Search Halftoning (DBS) - MATLAB Code (Efficient Direct Binary Search, Halftoning)

Direct binary approach is a heuristic optimization method and is proven to be very powerful to  obtain optimized binary patterns. The approach achieves the least minimum square error between the perceived halftone and original image, though swap and toggle operation. The swap operation consists of switching the current pixel with eight of its neighborhood pixels. Toggle operation is about switching the values between 0 to 1 or vice versa (as shown in Fig. below)      With each iteration, the perceived error starts to reduce and in finally a superior halftone quality is achieved. The method is computationally very expensive and difficult to implement in hardware. The code for Efficient DBS is provided in the link: (MATLAB Code) https://github.com/SankarSrin/EDBS-Halftoning