Skip to main content

Posts

Featured Post

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...
Recent posts

Modules, Classes and Objects (Python): Simple Explanation

First let us start with dictionary.. The dictionary is defined in the format: key:value  For example, dict={'name' : 'Python', 'version' : 2.7, 'new version' : 3.5}  In the dictionary, name is associated to python, version is associated to 2.7 and so on. Now we start with definition of MODULES.. Modules are like dictionaries, we can think module is a python file (*.py) and then it can be imported and used. The modules can contain some functions and variables. For example, if i have a dictionary like this mydict={'Job' : "Research"} then its module can be created as #this file need to be saved as mydict.py def Job():     print("Research") #let also define a variable domain="Image Processing" Now we can access the file (technically module need to be imported) import mydict   mydict.Job()   print (mydict.domain) Lets go to CLASSES now.. Class is an another construct to create a functi...

Error Diffusion Block Truncation Coding Images (EDBTC, ED_BTC, ED-BTC) - MATLAB CODE

Ref Paper:  Improved block truncation coding using modified error diffusion Abstract:  Block truncation coding (BTC) is an efficient compression technique, offering good image quality. Nonetheless, the blocking effect inherent in BTC causes severe perceptual artefact when compression ratio is increased. Conversely, error diffusion (EDF) enjoys the benefit of diffusing the quantised error into neighbouring pixels. Consequently, the average tones in any local areas of the error-diffused image are preserved unchanged. Presented is a hybrid approach which combines the proposed modified EDF with BTC. As documented in experimental results, image quality is much better than BTC, and the complexity is even lower than traditional BTC. MATLAB CODE: https://github.com/SankarSrin/EDBTC

Ordered Dithering Block Truncation Coding Image (Ref: Improved block truncation coding based on the void-and-cluster dithering approach ) - ODBTC MATLAB CODE

Ordered dithering block truncation coding image (OD-BTC) is an improved version of BTC integrating the ordered dithering of halftoning. Before getting into this, please refer to  ORDERED DITHERING: http://imageprocessing-sankarsrin.blogspot.com/2016/12/digital-half-toning-ordered-dithering.html BTC: http://imageprocessing-sankarsrin.blogspot.com/2016/12/block-truncation-coding-image.html OD-BTC Generation: (the same steps are also followed in the provided code) 1) Define the dithering screen 2) Process the image in a block wise manner (block size can be 4, 8, 16..)        a) Find Maximum and Minimum of the block               b) Calculate its difference      c) Multiply the difference with the dither screen and add the minimum value and the dither screen for the block is constructed (DA)      d) Perform thresholding between the actual image ...

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

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);

Enhanced Block Truncation Coding Image using Digital Multi-tone Screen

Abstract— An improved version of Block Truncation Coding (BTC) termed Multitone Block Truncation Coding (MTBTC) is proposed. The presented framework exploits the digital multi toning strategy to obtain a superior quality BTC images. Previously, the halftone techniques such as ordered dithering, error diffusion and dot diffusion are extended to obtain different version of BTC. Though it performs good, there are still many scope for improvements. In recent times digital multitoning is gaining prominence and advanced multitone screens such as direct multibit search and clustered dot screens are developed. This multitone screen can enhance the visual quality significantly and offer more homogenous and noise free output for halftone images. Considering this properties, an upgradation to the halftone based BTC is proposed in this paper through the use of sophisticated multitone screens. From the simulation results, it is concluded that the proposed framework can provide very high qualit...

Ulichney Digital Halftoning- Ordered Dithering (Dispersed Dot, Clustered Dot ) MATLAB, Python Code

To understand digital halftoning and ordered dithering please check this page http://imageprocessing-sankarsrin.blogspot.tw/2016/12/digital-half-toning-ordered-dithering.html Python Code: https://github.com/SankarSrin/Digital-Halftoning MATLAB Code: %%%%%%%Function to generate Ulichney Halftone Patterns%%%%%%%%%% %%   Author: %%   Mr. Sankarasrinivasan %%   Research Fellow, Multimedia Signal Processing Lab, NTUST, Taiwan %%   Advisor: Prof. Jing Ming Guo %%   Dated: Apr, 2018 %met=1 (clustered dot 4x4); met=2 (clustered dot 8x8) met=3 dispersed dot function [HOD]=Ulichney(im,met) im=im2double(im); [s1 s2]=size(im); if(met==1)   od=[12 05 06 13;     04 00 01 07;     11 03 02 08;     15 10 09 14;]/15;   bs=4; elseif(met==2)    od=[0.567 0.635 0.608 0.514 0.424 0.365 0.392 0.486     0.847 0.878 0.910 0.698 0.153 0.122 0.090 0.3...