Vous êtes sur la page 1sur 19

Session II

Binary Image Compression


Schemes

06/18/15

Topic Outline

Binary Images

Typical Applications of Binary Images

Packbits Encoding
CCITT Group 3 1-D compression
CCITT Group 3 2-D compression

06/18/15

Binary Images
A binary image containing black and white
pixels is generated when a document is
scanned in a binary mode.
Binary 1 represents a black pixel and
binary 0 a white pixel.

06/18/15

Typical Applications of Binary


Images
Office/business documents
Handwriting text
Line graphics
Engineering drawing

06/18/15

Packbits Encoding
(Run-length Encoding)

A consecutive string of characters is


replaced by two bytes. The first byte
contains a number representing the
number of times the characters is
repeated, and the second byte contains
the character itself.

06/18/15

Example-Run-Length Encoding
000000000000001111111000000000001111
is represented as:
Byte1

Byte2

Byte3

Byte3

Byte3

Byte3

Byte3

Byte3

...

0x14

0x00

0x07

0x01

0x11

0x00

0x04

0x01

...

06/18/15

Byte3

Byte3

Salient Features of Run-Length


Encoding
Typical compression ration: to 1/5
Included in TIFF 6.0 specification with
identifier as 32773.
Reverse compression or Negative
Compression

06/18/15

CCITT Group 3 1-D compression

Based on Run-Length
Assumes that a typical scan line has long runs of
pixels of the same color (black or white)
For black and white images, not for gray scale or
color
Huffman encoding a modified version of runlength
Shorter codes were developed for frequently
occurring run length, and longer codes were
developed for less frequent run length.

06/18/15

Makeup and Terminating Codes


Make-up codes: used to represent run
length in multiples of 64 pixels.
Terminating codes: used to represent run
lengths of less than 64 pixels.

06/18/15

Example- CCITT Group 3 1-D


The run length of 132 white pixels is
encoded by the following two codes:
Makeup code for 128 white pixels
--- 10010
Terminating code for 4 white pixels
--- 1011
Compression ratio --- 14.666667

06/18/15

10

Table for Run-length codes


for CCITT Group 3
White
run length

Code word

Black
run length

Code word

00110101

0000110111

000111

010

0111

11

1000

10

1011

011

1100

0011

1110

0010

1111

00011

10011

000101

10100

000100

64

11011

64

0000001111

128

10010

128

000011001001

06/18/15

11

Table for CCITT Group 3 1-D File


Format

EOL

Data

Line 1

EOL

Data

Line 2

EOL

Data

EOL

EOL

EOL

EOL

Line n

-The file is terminated by a number of EOL if there is no change in the line from the
previous line.

06/18/15

12

CCITT Group 3.1D


- Advantages and Disadvantages

Advantages of CCITT Group 3.1D


Simple

to implement in both hardware and software.


Worldwide standard foe facsimile which is accepted
for document imaging application.

Disadvantages of CCITT Group 3.1D


One-dimensional,

low compression ratio.


Does not provide any error protection mechanism.

06/18/15

13

CCITT Group 3 2-D compression


Modified run length encoding.
Combines a one-dimensional encoding
scheme with a two-dimensional coding
scheme.
Two dimensional encoding offers higher
compression because statistically, many
lines differ very little from the lines above
or the line below.

06/18/15

14

2D Encoding

K factor --- the image is divided into several groups of K


lines.
The first line of every group of K lines is encoded using the
CCITT Group 3 1D method.
This line becomes the reference line for the next line, and
two-dimensional scheme is used along with one
dimensional scheme to encode the rest of the scan lines in
the group K lines.
Why K factor?
When a transmission error occurs due to bad
communication link, the group 3 1D coding can be used
to synchronize and correct the error.

06/18/15

15

Data Formatting for CCITT Group 3


2-D
The 2D scheme uses a combination of
additional codes called vertical code, pass
code, and horizontal code to encode every
line in the group K lines.
Only one type of pass code: 0001
Only one type of horizontal code: 001
Seven types of vertical code

06/18/15

16

Example

06/18/15

17

06/18/15

18

Standardization effort known by the acronym JPEG,for


Joint Photographic Experts Group, working towards
establishing the first international digital image
compression standard for continuous-tone (multilevel)
still images, both grayscale and color.
The joint in JPEG refers to a collaboration between
CCITT and ISO.
JPEG convened officially as the ISO committee
designated JTC1/SC2/WG10, but operated in close
informal collaboration with CCITT SGVIII.
JPEG is an ISO Standard and a CCITT
Recommendation.

06/18/15

19

Vous aimerez peut-être aussi