Вы находитесь на странице: 1из 10

1

DATA COMPRESSION AND ENCODING USING COLORS

Residence : College :
Vedula House, VEDA Institute of Information
H no 6-16/1, Technology Pvt. Ltd., (VEDA IIT)
Savarkar Nagar, Annapurna Studios lane,
Nacharam X Roads, Plot No. 90, Road No 2,
Hyderabad 500076. Banjara Hills,
Hyderabad - 500 034

Phone : +91 9949055417


Email : anand.vedula@gmail.com
2

Abstract: Introduction:
The coding formats available today like Color is the result of interaction between
the barcodes have proved to be a light source, an object and an observer.
successful because of their various In case of reflected light, the light falling
applications like coding of products by a on an object will be reflected or
manufacturer, coding of books by a absorbed depending on the surface
publisher, etc. The continuous characteristics such as reflectance and
advancement in the sensors technology transmittance. For example, red paper
can provide advancement in the coding will absorb most of the greenish and
format. The improvement in color bluish part of the spectrum while
sensors technology can give rise to a reflecting the reddish part, making it
better and efficient coding technique. appear red to the observer.
One such method “color code
technology”, is proposed and described Any color is the combination of three
in this thesis. primary colors Red, Green and Blue in
fixed quantities. A color is stored in a
Due to its advantages like the computer in form of three numbers
compactness, security, and efficiency, representing the quantities of Red, Green
this code is well suited to be used as a and Blue respectively. This
substitute for all available codes like the representation is called RGB
barcode. representation which is used in
computers to store images in BMP,
In this paper, we provide some insight JPEG and PDF formats. Here each pixel
into color perception, measurement, is represented as values for Red, Green
specification, and look at couple of ways and Blue.
on how data can be produced by a color
sensor. Then we study the designing of Thus any color can be uniquely
the color code encoding technology and represented in the three dimensional
its decoding using color sensor and a RGB cube as values of Red, Green and
method to compress data using colors. Blue.
3

RGB color cube: Numeric representations:


• Color science talks about colors
in the range 0.0 (minimum) to
1.0 (maximum). Most color
formulae take these values. For
instance, full intensity red is
The RGB color model is an additive (1.0, 0.0, 0.0).
model in which Red, Green and Blue are
• The color values may be written
combined in various ways to produce
as percentages, from 0%
other colors. By using appropriate
(minimum) to 100% (maximum).
combination of Red, Green and Blue
Full intensity red is 100%, 0%,
intensities, many colors can be
0%.
represented. Typically, 24 bits are used
to store a color pixel. This is usually • The color values may be written
apportioned with 8 bits each for red, as numbers in the range 0 to 255,
green and blue, giving a range of 256 simply by multiplying the range
possible values, or intensities, for each 0.0 to 1.0 by 255. This is
3
hue. With this system, 16 777 216 (256 commonly found in computer
24
or 2 ) discrete combinations of hue and science, where programmers
intensity can be specified. have found it convenient to store
A color in the each color value in one 8-bit
RGB color model can be described by byte. This convention has
indicating how much of each of the red, become so widespread that many
green and blue color is included. Each writers now consider the range 0
can vary between the minimum (no to 255 authoritative and do not
color) and maximum (full intensity). If give a context for their values.
all the colors are at minimum the result Full intensity red is (255, 0, 0).
is black. If all the colors at maximum, • The same range of 0 to 255 can
the result is white. A confusing aspect of be written in hexadecimal too
the RGB color model is that these colors with prefix #. For example Red is
may be written in several different ways. (#ff, #00, #00).
4

Color sensor circuit and operation: Thus we get three output voltage levels
for a single color. Each output depends
on the intensity or hue of respective
color. The maximum possible output
voltage is given the value 255 on scale
and the whole length is divided into 256
equal parts (pixel length). Though output
is analog, we are considering it as digital
i.e. step function of a value is
considered. For example, the range of
A light to analog-voltage-color sensor 123.01 to 123.99 is considered as 123.
comprises an array of photodiodes Thus, the output of our sensor is exactly
behind color filters and an integrated computer representation and can be
current-to-voltage conversion circuit directly fed into computer using
(usually a transimpedence amplifier). interfacing circuits (multiplier).
Light falling on each of the photodiodes
is converted into a photocurrent, the Color sensing:

magnitude of which is dependent on


both the brightness wavelength
(wavelength due to the color filter) of
the incident light. The red, green and
blue transmissive color filters will
reshape and optimize the photodiode’s
spectral response. Properly designed
filters will result in a spectral response
A light source and an object are kept
for the filtered photodiode array that
very near to each other. Light reflects on
mimics that of the human eye. The
the object and falls on the sensor’s
photocurrents from each of the three
lenses. Then sensor operation takes place
photodiodes are converted to VRout,
and three output voltages are obtained
VGout, VBout using a current-to-voltage
for Red, Blue and Green respectively.
converter.
5

Data representation using colors: Example:


In computers, we generally use 256
color mode for displaying colors. Hence
each coordinate axis R,G,B are divided
into 256 parts each. Resolution used is
Res = 256.

For giving numbers to cells in the cube,


we start from Red axis, then Green and
then Blue. When a color is represented
in (red, green, blue) format where red,
green and blue correspond to the This is a low resolution (Res = 16) RGB
coordinate axis of a particular color, its color cube in Red and Green axes. As
corresponding number is given by defined earlier, each cell represents a
different number starting from origin as
N = (red) + (Res * green) + (Res * Res * 0. After completing two dimensions,
blue) third dimension can be taken for more
Thus each color can be uniquely numbers.
represented by a number depending on
Color fading:
the resolution. A simple C program can
do this conversion. Higher the Color fading can be a major drawback of
resolution, more the numbers can be this technology. Because of color fading,
represented using colors. data may be represented wrongly. Color
generally fades with time. Disadvantages
Using RGB 256 color mode, 256
due to fading can be minimized by
different shades of each color are
selecting the resolution such that cell
uniquely represented in a computer.
size is larger than maximum possible
Therefore 256 * 256 * 256 = 16777216
fading. As the technology and precision
different colors can distinguished. If we
of devices increases, resolution can be
represent each color with a number, then
increased but the concept is same.
we’ll have 16777216 numbers.
6

Barcode reader: Advantages:

Bar coder readers decodes a bar code by There are two basic advantages to
scanning across the bar code and barcode over manual data entry: Speed,
measuring the intensity of the light and Accuracy. For 12 characters of data,
reflected back. The light variation is keyboard entry takes 6 seconds.
converted into digital signal. Due to Scanning a 12 character barcode takes
barcode design, it does not matter we 0.3 seconds. The error rate for typing is
scan from the left to right or from the one substitution error in every 300
right to left. characters types. Error rated for barcode
range from 1 substitution error in every
15,000 to 36 trillion characters scanned
(depending on the type of barcode). Data
is coded easily using some coding
softwares before printing barcode label
and decoded using corresponding
A barcode reader contains two parts. The decoding software. Thus barcode
first part is the scanner that scans the represented data is secured.
image and coverts into digital
representation (01111000). It consists of Disadvantages:

a photo-resist (resistance depends on


The size of barcode label depends on the
intensity of light) and a current to
maximum number it can represent. As
voltage converter. Output of the barcode
the number increases, size of barcode
reader depends on the intensity of
increases. Generally maximum number
reflected light. The black bars represent
used is 9999. Barcode reader cannot
1’s and white spaces represent 0’s.length
scan properly if the label is crumpled or
of bar does is not significant. The second
distorted (this usually happens while
part is the decoder which combines the
transportation) or label is tilted while
binary digital signals into a series of
feeding it to reader. Since a single dot
characters. The decoded information is
scans the whole label, scanning time
sent to the computer via keyboard or
increases as its length increases.
serial interfaces.
7

Color code versus Barcode: Data security:

Disadvantages with barcode can be Data printed using color code can be
rectified using rainbow code. Color code made secured by using an encoding
defines more numbers than barcode. A technique. Key (X, Y, Z) can be used for
small circle is enough to represent any encoding purpose. For example, if we
number. Since we won’t be using more have to print a color representing (R, G,
than 1 lakh on barcode, we can even B), then instead of printing that color
represent last two digits as paisa. E.g. (R+X, G+Y, B+Z) can be printed. X, Y,
256 can be taken as 2.56, 16777216 as Z values can be positive or negative
167772.16 etc. Even if the label is integers. The person who knows the key
crumpled, the color won’t change. Thus can move back and get to the original
data in color code is more reliable. The cell. Thus the data printed using color
sensor need not be placed horizontally. It code technology is highly reliable and
can be focused on the circle from any secured. Confidential data can be
angle. Data scanning time is also less transmitted using this “Key” concept.
because only a small dot needs to be
Data Encoding and Compression
sensed and output voltages will be
using ASCII:
available in no time (propagation delay
from input to output is very less). Since
American Standard Code for
we are already representing colors using
Information Interchange (ASCII) is a
256 color mode in a computer, data can
character encoding based on the English
be fed into computer very easily. An
alphabet. ASCII codes represent text in
ordinary inkjet printer can print all these
computers, communications equipment,
colors.
and other devices that work with text.
Using ASCII, 128 characters are
Barcodes are being used widely because
encoded. Each character is represented
they have many advantages and very few
by 7 bits.
disadvantages. If we can rectify those
few disadvantages using color codes,
they will easily replace barcodes in all
applications.
8

Data encoding:

In RGB 256 color mode, a pixel is Bit sequence no


represented by 24 bits, in which 8 bits (0bbbbbbb 0bbbbbbb 0bbbbbbb) 1
represent the intensity of each color. For (0bbbbbbb 0bbbbbbb 1bbbbbbb) 2
example, a color (80, 121, 150) is (0bbbbbbb 1bbbbbbb 0bbbbbbb) 3
represented as (01010000 01111001 (0bbbbbbb 1bbbbbbb 1bbbbbbb) 4
10010110). In our model, we divide this (1bbbbbbb 0bbbbbbb 0bbbbbbb) 5
cube into 8 parts. Sequences starting (1bbbbbbb 0bbbbbbb 1bbbbbbb) 6
with (0bbbbbbb 0bbbbbbb 0bbbbbbb) (1bbbbbbb 1bbbbbbb 0bbbbbbb) 7
where b stands for binary bit 1 or 0 come (1bbbbbbb 1bbbbbbb 1bbbbbbb) 8
under first cube.
9

We use first sub cube (1) to define all • We can use a key as defined
the characters in ASCII table. The first earlier and send different colors
128 parts of each color are used to representing the data. The
denote a character in the ASCII table. receiver can recover the original
For convenience, we use the same order. data only if he knows the key.
Since a color is defined by three
coordinates, three different characters Data compression:

can be defined by using a color. The Red


In the above approach, we are not using
value defines the first character, Green
all the colors efficiently. By using the
value defines the second character and
remaining colors in the other 7
Blue value defines third character.
coordinates, we can use the whole cube

By using this scheme, an MS-word very efficiently and even data

document can be converted to a bitmap compression can be achieved.

image. Every three characters will be


The remaining seven sub cubes contain
denoted by a pixel of corresponding
256 * 256 * 156 * 7/8 = 14680064
color.
colors. There are nearly 10000000

To achieve data encoding for English words and templates used in MS

transmitting secured and confidential word (Including all fonts and formats).

data, the following methods can be used. We can make a database where each
color (from these remaining seven sub
• We can shuffle the order and cubes) represents a word. Then any word
maintain a database of shuffled which has more than 3 letters (or
order. Three different databases characters) can be defined by a color
can be maintained for Red, Green which requires three 8 bit numbers to be
and Blue for more security. Thus represented. The words which are not in
characters are shuffled before the dictionary (names, places etc) are not
transmission and after reception; compressed and are represented by
the receiver can retrieve original colors in first quadrant.
data by using same set of
databases.
10

Thus by using a database, any word, no Conclusion:


matter how many characters it has, can
Color sensors have a wide range of
be represented by a color which requires
applications. They can completely
only 24 bits to be represented. Thus data
replace barcode readers. Using colors,
can be compressed to a large extent.
large amount of data can be printed on
By using the above concepts of encoding small space and can be retrieved back
and compression, large amounts can be effectively. Data entry into computer is
compressed and transmitted in a more very easy because same RGB concept is
secured way. Even if the data is hacked already used there. They are the future
by unauthorized person, he cannot because there is no limit on number of
decode it unless he has the same colors and as technology advances, more
database and knows the key. number of colors can be defined more
precisely from the same RGB cube. Data
Using the concept of compression, more
transferred by using colors is more
amounts of data (word documents) can
secured. Data compression is done by
be printed in very less space (as images).
maintaining a data base and sending
Printing data is very easy because an
templates which represent the word.
ordinary printer can print all the 256
Thus data compression using this
mode colors. It prints colors by mixing
technology is more efficient and error
magenta, cyan and yellow in subtractive
free.
color mixing. Cyan, Magenta and
Yellow are opposite to Red, Green and References:
Blue in the RGB cube. A printer uses
1. Sensors Handbook by: Soloman and
CMY subtractive mixing because white
Sabrie
paper is used for taking printouts and ink
2.http://www.keyence.com/products/sensors
need not be wasted to print white.
3. http://en.wikipedia.org/wiki/ASCII
4.http://en.wikipedia.org/wiki/RGB_color_
model
5.http://www.taltech.com/TALtech_web/res
ources/intro_to_bc/bcpwork.htm

Вам также может понравиться