Final Year Project: Pixmat A Photo Editor
Final Year Project: Pixmat A Photo Editor
PIXMAT
1010111011000000011111111111100000000000000000000000111000111
1001010110101100000000000000000000000000000000111111111111111
1111100000000001111111111110110000000010101010101000000000000
A photo editor
0000000000000000000000000000000001111111111110000000000100000
0000000000000000100000000000000000000000000001111111111110010
1010110101011010101010101010101011101010110000000000000000000
010100001001010100111111111111
06/18/2020 2
INTRODUCTION
This is a simple photo editing tool
which provide some basic image
editing operations like crop an image,
resize an image, rotate an image,
colour effect , gray scale, negative of
image etc.
06/18/2020 3
Technologies used
• JRE 6.0 or higher
• Netbeans 6.0 or higher as IDE
• Windows operating system
06/18/2020 4
Functional Block Diagram
06/18/2020 5
Data Flow Diagram
• Context Level DFD
Load Image
PIXMAT
06/18/2020 6
Data Flow Diagram
1 Level DFD
06/18/2020 7
Flow Chart of PIXMAT
Crop
Resize
Rotate
Gray Scale
Negative
Color Effects
06/18/2020 8
Concept
Digital Image Processing
Pixel
Pixel matrix
Computer Graphics
Scaling
Rotation
RGB color model
06/18/2020 9
How Image convert into
Digital format?
Ex.
8bit 1 0 1 1 0 1 0 1
=181
JPG Image = 32bit image
α= 1 0 1 1 0 1 0 1
Red= 1 0 1 1 0 1 0 1
Green= 1 0 1 1 0 1 0 1
Blue=
06/18/2020 10
How Image convert into
Digital format?
JPG Image Pixel Array
-65536 -16711936
-256
-16776961
=
06/18/2020 11
Resize an Image
• This operation can be carried out by
multiplying the coordinate value (x, y) of each
pixel by scaling factors sx and sy to produce the
transformed coordinates (x’, y’).
x’= x* sx , y’= y* sy
To control the location of scaled object we
select a fixed point (xf, yf)
06/18/2020 12
Resize an Image
• . A object or image then scaled relative to the fixed
point by sacling the distance from each vertex to
the fixed point. For a vertex with coordinate (x,y),
the scaled coordinates (x’, y’) are calculated as
x’= xf + (x - xf)sx, y’= yf + (y - yf)sy
or
x’= x* sx + xf(1-sx)
y’= y* sy + yf(1-sy)
06/18/2020 13
Rotate an Image
06/18/2020 16
Different operations
• Crop
• Adding Color effects
• Gray scale
• Negative
• Resize
• Rotate
06/18/2020 17
Crop an Image
CPI(CroP Image) Algorithm
• Step 1: Create Pixel Array from source Image
-1234 45695 -1234 45695 -1234 45695 -1234 45695 -1234 45695
85461 11236 85461 11236 85461 11236 85461 11236 85461 11236
23655 23678 23655 23678 23655 23678 23655 23678 23655 23678
-2566 12365 -2566 12365 -2566 12365 -2566 12365 -2566 12365
= -236
-1234
85461
23655
256
45695
11236
23678
-236
-1234
85461
23655
256
45695
11236
23678
-236
-1234
85461
23655
256
45695
11236
23678
-236
45695
11236
23678
256
-1234
85461
23655
-1234
-1234
85461
23655
45695
45695
11236
23678
-2566 12365 -2566 12365 -2566 12365 12365 -2566 -2566 12365
-236 256 -236 256 -236 256 256 -236 -236 256
06/18/2020 18
Crop an Image
• Step 2: Create a new Pixel Array & put only
those pixel value which are in the range of
cropped area
=
1221 1221 1221 1221 1221 1221 1221 1221
06/18/2020 19
Crop an Image
• Step 3: Create a cropped image by putting
each pixel value from new pixel array into
buffer & save it as image file
=
1221 1221 1221 1221 1221 1221 1221 1221
06/18/2020 20
Color Effects
Getting Color values from a pixel:
• The pixel structure for with 32 bit pixel is
8 bit for Alpha 8 bit for Red color 8 bit for Green color 8 bit for Blue color
06/18/2020 21
Color Effects
• Pseudo code: GET_COL_PIXEL( pix)
input: pixel
output: alpha,red,green,blue
pixel <- pix
alpha <-(pixel >> 24)
red <- (pixel >> 16)
green <- (pixel >> 8)
blue <- (pixel)
06/18/2020 22
Color Effects
• Putting Color values in a pixel
8 bit Alpha
8 bit Red
8 bit Green
8 bit Blue
06/18/2020 23
Color Effects
• Pseudo code: GET_PIX_COL(alpha, red, green, blue)
Input: alpha,red,green,blue
Output: newPixel
newPixel <- 0
newPixel <- newPixel + alpha
newPixel <- newPixel << 8
newPixel <- newPixel + red
newPixel <- newPixel << 8
newPixel <- newPixel + green
newPixel <- newPixel << 8
newPixel <- newPixel + blue
return newPixel
06/18/2020 24
Color Effects
06/18/2020 25
Color Effects
• GET_COL_PIXEL( pix)
• GET_PIX_COL(alpha, red, 0, 0)
• GET_PIX_COL(alpha,0 , green, 0)
• GET_PIX_COL(alpha, 0, 0, blue)
• GET_PIX_COL(alpha, red, 0, blue) //(magenta)
• GET_PIX_COL(alpha, 0, green, blue) //(Cyan)
• GET_PIX_COL(alpha, red, green, 0) //(Yellow)
06/18/2020 26
Getting B/W image from a Color Image
06/18/2020 27
Getting B/W image from a Color Image
Pseudo code: BW( image)
Input: source_image
Output: output_image
pixel[w][h] <- IMAGE_INTO_PIXEL(source_image)
x<- 0
y<-0
while x<=w do
while y<= h do
alpha <-(pixel[x][y] >> 24)
red <- (pixel[x][y] >>16)
06/18/2020 28
Getting B/W image from a Color Image
06/18/2020 31
Resize an Image
Input: source_Image
Output: scale_Image
h<- height of source_image
w<- width of source_Image
p<-percent
r<- (w*p)/100;
c<-(height*p)/100
pixel1[w][h] <- IMAGE_INTO_PIXEL(source_image)
pixel2[r][c]
x<- 0
y<- 0
06/18/2020 32
Resize an Image
while x<=w do
while y<= h do
sx<- x * w / r;
sy<- y * h / c;
pixel2[x][y] <- pixel value of source image at position sx, sy
y<-y+1
end while
x<-x+1
end while
scale_image <- PIXEL_INTO_IMAGE (pixel2, r,c)
return scale_image
06/18/2020 33
Resize an Image
06/18/2020 34
Rotate an Image
• ROTATE_IMAGE(image, angle)
• Input: source_Image
• Output: rotate_Image
• h<- height of source_image
• w<- width of source_Image
• sin = sin (angle)
• cos = cos (angle)
• x0 <- 0.5 * (w - 1); // point to rotate about
• y0 <- 0.5 * (h - 1);
• x<-0
• y<-0
06/18/2020 35
Rotate an Image
• pixel2[w][h]
• pixel[w][h] <- IMAGE_INTO_PIXEL(source_image) while x<=w do
• while y<= h do
• a <- x - x0;
• b <- y - y0;
• xx<- (+a * cos - b * sin + x0);
• yy<- (+a * sin + b * cos + y0);
• if xx>= 0 && xx< width && yy>= 0 && yy < height && y<height then
• pixel2[x][y]<-pixel value of source_image at position xx,yy
• end if
• y=y+1
• x=x+1
• rotate_image <- PIXEL_INTO_IMAGE (pixel2, w,h)
• return rotate_image
06/18/2020 36
GUI
06/18/2020 37
Select Image File
06/18/2020 38
Select Image File
06/18/2020 39
Crop Image
06/18/2020 40
Resize Image
06/18/2020 41
Rotate Image
06/18/2020 42
Color Effects
06/18/2020 43
Gray Scale
06/18/2020 44
Negative
06/18/2020 45
Gray Inverse
06/18/2020 46
Red
06/18/2020 47
Green
06/18/2020 48
Blue
06/18/2020 49
Magenta
06/18/2020 50
Cyan
06/18/2020 51
Yellow
06/18/2020 52
Sepia
06/18/2020 53
Save Image
06/18/2020 54
Limitation
• Only one image can edit at a time
• Extension of output image is same as
input image
• Output folder & input folder are
same
• Tool can run only if JRE preinstalled
06/18/2020 55
Conclusion
• Computer graphics concept are used for resize, rotation
are simpler then other algorithm available in market
such as bilinear interpolation, nearest neighbor etc.
• But algorithm work slowly if image size is too large in
future this draw back can be reduce by improving the
performance of algorithm
• The algorithm implemented in this project are the basic
algorithms in Digital Image Processing hence as future
expect the improvement in these algorithms is possible
to enhance the applications of Digital Image Processing.
06/18/2020 56
Future Work
• Interfacing Printer
• Interfacing Camera
• Add clip art
• Add text to the image
• Improving GUI
06/18/2020 57
Thank you
Any Query ?...
06/18/2020 58