AKS: Image Enhancement Software

34

Transcript of AKS: Image Enhancement Software

Page 1: AKS: Image Enhancement Software
Page 2: AKS: Image Enhancement Software

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.

Page 3: AKS: Image Enhancement Software

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.

Page 4: AKS: Image Enhancement Software

PIXELDepending 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. ARGBis an advanced form of RGBwhich also supports ALPHAor TRANSPERENCY values.

Page 5: AKS: Image Enhancement Software

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…

Page 6: AKS: Image Enhancement Software

BASIC IMAGE EDITING

TOOLSAKS 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.

Page 7: AKS: Image Enhancement Software

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.

Page 8: AKS: Image Enhancement Software

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%

Page 9: AKS: Image Enhancement Software

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.

Page 10: AKS: Image Enhancement Software

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)

Page 11: AKS: Image Enhancement Software

EFFECT : BRIGHTNESS

Original Image Brightness enhanced by 15 units

Page 12: AKS: Image Enhancement Software

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

Page 13: AKS: Image Enhancement Software

EFFECT : GRAYSCALE

Original Image After Gray scaling

Page 14: AKS: Image Enhancement Software

FILTER : NEGATIVERemember 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)

Page 15: AKS: Image Enhancement Software

EFFECT : NEGATIVE

Original Image After Applying Negative Filter

Page 16: AKS: Image Enhancement Software

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.

Page 17: AKS: Image Enhancement Software

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

Page 18: AKS: Image Enhancement Software

EFFECT : MONOCHROME

Original Image

After Applying

Level 24

Monochrome Filter

Page 19: AKS: Image Enhancement Software

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)

Page 20: AKS: Image Enhancement Software

EFFECT : COLOR BALANCE

Page 21: AKS: Image Enhancement Software

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.

Page 22: AKS: Image Enhancement Software

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

Page 23: AKS: Image Enhancement Software

EFFECT : CONTRAST

Original Image After enhancing Contrast by 10

Page 24: AKS: Image Enhancement Software

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

Page 25: AKS: Image Enhancement Software

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.

Page 26: AKS: Image Enhancement Software

BLUR : ALGORITHM (for radius

3)R = 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)

Page 27: AKS: Image Enhancement Software

EFFECT : BLUR

Original Image

After 4th Iteration

Of Blur Filter

Page 28: AKS: Image Enhancement Software

FILTER : EDGE DETECTIONSo 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.

Page 29: AKS: Image Enhancement Software

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

Page 30: AKS: Image Enhancement Software

EFFECT : EDGE DETECTION

Vertical Edge Detection Original Image Horizontal Edge Detection

Page 31: AKS: Image Enhancement Software

EFFECT : EDGE DETECTIONafter changing Brightness and contrast

Original Image Vertical Edge Detection BC enhanced Edge Detection

Page 32: AKS: Image Enhancement Software

EFFECT : EDGE DETECTIONafter a Bit of Blurring

Original Image Vertical Edge Detection Blurred Edge Detection

Page 33: AKS: Image Enhancement Software

REFERENCE

Contrast and Other Filtershttp://www.codeproject.com/cs/media/csharpgraphicfilters11.asp

Hue Saturationhttp://www.ncsu.edu/scivis/lessons/colormodels/color_models2.html

C# TutorialsWROX PUBLICATION’S BEGINNING VISUAL C#

Page 34: AKS: Image Enhancement Software

THANK YOU