Binary Image Library
Functions
C:/Users/Malcolm/Documents/temp/binaryimagelibrary/halftone.c File Reference
#include <stdlib.h>
#include <assert.h>

Functions

unsigned char * randomhalftone (unsigned char *grey, int width, int height)
 
unsigned char * floydsteinberg (unsigned char *grey, int width, int height)
 
unsigned char * stucki (unsigned char *grey, int width, int height)
 
unsigned char * ordereddisperseddot (unsigned char *grey, int width, int height, int order)
 
unsigned char * orderedclustereddot (unsigned char *grey, int width, int height, int order)
 

Detailed Description

Halftone functions.

Half toning is when we represent a greyscale iamge as a binary image, using filters and dithering to give a visual representation of the grey.

maggie.jpg
Margaret Thatcher (1925-2013) greyscale photograph

Function Documentation

unsigned char* floydsteinberg ( unsigned char *  grey,
int  width,
int  height 
)

Halftoning with Floyd-Steinberg error diffusion.

Parameters
grey- the greyscale image
width- image width
height- image height
Returns
Halftoned binary image.
maggiefloyd.gif
unsigned char* orderedclustereddot ( unsigned char *  grey,
int  width,
int  height,
int  order 
)

Ordered clustered dot dithering.

Parameters
[in]grey- the greyscale image
width- image width
height- image height
order- 3, 4, or8
Returns
The dithered image.
maggieclust3.gif
order = 3
maggieclust4.gif
order = 4
maggieclust8.gif
order = 8

NB : The predefined dither matrices are the same as matrices used in the Netpbm package (http://netpbm.sourceforge.net) and are defined in Ulichney's book. See also : The newsprint web site at http://www.cl.cam.ac.uk/~and1000/newsprint/ for more technical info on this dithering technique

unsigned char* ordereddisperseddot ( unsigned char *  grey,
int  width,
int  height,
int  order 
)

Ordered dithering with a Bayer matrix of size 2^order by 2^order.

Parameters
grey- the greycale image
width- image width
height- image height
order- size of matrix (1-4)
Returns
halftoned binary image
maggiedisp1.gif
order = 1
maggiedisp2.gif
order = 2
maggiedisp3.gif
order = 3
maggiedisp4.gif
order = 4
unsigned char* randomhalftone ( unsigned char *  grey,
int  width,
int  height 
)

Halftoning with random dither.

Parameters
grey- the greyscale image
width- image width
height- image height
Returns
Halftoned binary image.
maggierandom.gif
unsigned char* stucki ( unsigned char *  grey,
int  width,
int  height 
)

Halftoning with Stucki error diffusion.

Parameters
grey- the greyscale image
width- image width
height- image height
Returns
Halftoned binary image.
maggiestucki.gif