The presentation for a .NET based image manipulation software, that we developed for our Final Year engineering project in 2007. BE(IT) IIIT Kolkata, WBUT.
2. PREFACE
The idea behind AKS image
editing and processing software
(IEPS) was to design a replica of
a software which is synonymous
to image editing, a software
that can make impossible
possible and the real unreal.
Yes, it has been inspired from
ADOBE PHOTOSHOP. In fact AKS inherits a major portion of
its interface from this magical IPES. Though we may never be
able to replicate PHOTOSHOP completely, but we intend to get
a glimpse of the underlying processes that enables it to create
magic.
3. INTRODUCTION
Before we start delving
deep into image
processing, we must
first know, what exactly
is a digital image. A
digital image is a 2-
Dimensional Matrix of
digital color units called
Pixels.
4. PIXEL
Depending on the image type,
different formats of Pixel are
used to represent them. A
few of them are mentioned
here. For example,
MONOCHROME is used to
represent Black and White
images, RGB for color
images and CMYK is used
for printing purposes. ARGB
is an advanced form of RGB
which also supports ALPHA
or TRANSPERENCY values.
5. AKS
AKS, like many other image editing software,
has a variety of Image Processing filters to
enhance the image provided. These filters
include Brightness, Contrast, Negative,
Grayscale, Monochrome, Color Balance etc.
But along with these, it also has the capability
of editing multiple images at a time. It can also
handle multiple layers. It can erase a portion of
the image and can also paint them. Lets start
with the basic tools…
6. BASIC IMAGE EDITING
TOOLS
AKS has a list of basic
image editing tools,
which can be pretty
handy while editing
images. These include,
paint brush, eraser, fill
tool, rotator, zoom,
color picker etc.
7. PAINT BRUSH
Paint brush is one of the
most basic tools which
is also one of the most
useful one. In AKS we
have implemented a
variable size brush
which can color
images with millions of
colors.
8. ZOOM
We don’t need an introduction to this tool. This quite popular
tool comes loaded with the capability to zoom from 1% to
500%
9. ERASER
Eraser is another basic
tool and is as useful
as the paint brush.
This too has a variable
size brush and can
remove portions of
images when needed.
Let’s see the effect of
variable size eraser on
the image drawn in
the previous page.
10. FILTER : BRIGHTNESS
The brightness filter is one of the easiest filter
that can be implemented. In this filter we
add a certain value (say br) to each of R, G
and B channel. This way the luminosity of
the image increases.
LOOP X: 0 to ImgHeight
LOOP Y: 0 to ImgWidth
PIXEL(x,y) = COL(R + br, G + br, B +br)
12. FILTER : GRAYSCALE
This filter averages the values of all three
RGB channels to calculates the brightness
of the specified PIXEL. On RGB scale, this
level of GRAY can be represented by
assigning the same value to all three RGB
channels.
LOOP X: 0 to ImgHeight
LOOP Y: 0 to ImgWidth
g = (R + G + B) / 3
PIXEL(x,y) = g
14. FILTER : NEGATIVE
Remember the film camera roll, sometimes also
called the NEGATIVE. We too can create the
same effect by using the NEGATIVE filter. To
get things done we need to subtract the value of
each channel from 255 (i.e the max. value)
which will yield the negative value of the
respective channel.
LOOP X: 0 to ImgHeight
LOOP Y: 0 to ImgWidth
R = 255 – R
G = 255 – G
B = 255 – B
PIXEL(x,y) = COLOR(R, G, B)
16. FILTER : MONOCHROME
Monochrome Images have only 2 colors,
the foreground and the background color.
To get this type of effect first we need to
get the grayscale value of each pixel.
Then we check them if they are above the
threshold value or not. If they are, then the
corresponding monochrome pixel will have
foreground color, else it’ll be of
background color. In AKS, the threshold
value is provided by the user.
17. MONOCHROME : ALGORITHM
LOOP X: 0 to ImgHeight
LOOP Y: 0 to ImgWidth
g = toGray( pixel( X,Y ) )
IF( g > threshold)
pixel(X,Y) = 1
ELSE pixel(X,Y) = 0
18. EFFECT : MONOCHROME
Original Image
After Applying
Level 24
Monochrome Filter
19. FILTER : COLOR BALANCE
This filter is almost same as the brightness
filter, just that, it has the capability to modify
individual color channels.
LOOP X: 0 to ImgHeight
LOOP Y: 0 to ImgWidth
Col = pixel( X, Y )
pixel (X,Y) = COLOR (Col.R + inpR,
Col.G + inpG, Col.B + inpB)
21. FILTER : CONTRAST
Contrast is determined by the difference in
the color and brightness of the object and
other objects within the same field of view.
This filter first checks the brightness of each
channels of each Pixel, depending on which
it decides whether it will be darkened or
brightened. Then according to the contrast
value, we can increase or decrease the
brightness of each and every channel of all
the pixels available.
22. CONTRAST ALGORITHM for 1
channel
contrast = (100.0 + nContrast) / 100.0
LOOP X: 0 to ImgHeight
LOOP Y: 0 to ImgWidth
channel = channel – 127
channel = channel * contrast
channel = channel + 127
IF(channel < 0) THEN channel = 0
IF (channel > 255) THEN channel = 255
24. CONTRAST vs. BRIGHTNESS
So, Which one works better? Well actually, for the right
amount of enhancement, as shown below we need both.
Original
Contrast
Enhanced
Contrast
increased by
10
Brightness
enhanced
brightness
increased by 10
Both
Contrast
and
Brightness
enhanced
Brightness and
contrast
enhanced by 10
each
25. FILTER : BLUR
Blur filter is a slightly complex filter which a
filtered pixel, instead of depending on its own
value, depends on the neighboring pixels. We
have to take the average of each channel
from all the neighboring pixels. The radius of
the neighbors considered determines the
amount of blur. Alternatively, one can iterate
again and again on fixed blurring radius to
obtain variable blur amounts.
26. BLUR : ALGORITHM (for radius
3R) = 0
G = 0
B = 0
LOOP X: 0 to ImgHeight
LOOP Y: 0 to ImgWidth
LOOP i: -1 to 1
LOOP j: -1 to 1
R = R + pixel (X+i, Y+j).R
G = G + pixel (X+i, Y+j).R
G = G + pixel (X+i, Y+j).R
R = R / 9
G = G/9
B = B / 9
pixel (X, Y) = color (R, G, B)
27. EFFECT : BLUR
Original Image
After 4th Iteration
Of Blur Filter
28. FILTER : EDGE DETECTION
So far, so good… but what about Edge Detection.
Edge detection is the technique we use to find
out the edges in an image. These type of filters,
along with others, are used by computers for
image recognition. Like BLUR filter, this filter too
depends on its neighboring pixels. Before
detecting edge, we need to convert the image
into grayscale. Once converted, we can
compare the values of its neighboring pixels,
which would indicate an edge if its greater than
a certain value. This value should be large
enough to ignore the gradient and detect the
edges. This scan can be done horizontally and
vertically. All of the edges will be visible if both
are done.
29. EDGE DETECTION (HORIZONTAL) :
ALGORITHM
LOOP X: 0 to ImgHeight
LOOP Y: 0 to ImgWidth
gl = toGray( pixel( X - 1,Y ) )
gr = toGray( pixel( X + 1, Y) )
diff = gl – gr
IF( diff > -10 AND diff < 10)
pixel(X,Y) = 0
ELSE pixel(X,Y) = 1