Image 2

32
Image 2 Subject : T0934 / Multimedia Programming Foundation Session : 5 Tahun : 2009 Versi : 1/0

description

Image 2. Subject:T0934 / Multimedia Programming Foundation Session:5 Tahun:2009 Versi:1/0. Learning Outcomes. In the end of this session, students must be able to: Understand the basic principal of image transformation and enhancement - PowerPoint PPT Presentation

Transcript of Image 2

Page 1: Image 2

Image 2

Subject : T0934 / Multimedia Programming FoundationSession : 5Tahun : 2009Versi : 1/0

Page 2: Image 2

Bina Nusantara

Learning Outcomes

In the end of this session, students must be able to: – Understand the basic principal

of image transformation and enhancement

– Apply correct Java syntax to transform, enhance, and display an image

Page 3: Image 2

Course Outlines

• Digital Image Definition• Image Transformation• Image Enhancement• Java 2D API

Bina Nusantara

Page 4: Image 2

Digital Image Definition

• Image array of pixel Z(x,y)

Bina Nusantara

N

M

Z

X = width (0 – N)Y = height (0 – M) Z = pixel values

X = width (0 – N)Y = height (0 – M) Z = pixel values

X

Y

0

Page 5: Image 2

Digital Image Definition

• Image Z(x,y)• Z refers to RGB values or brightness

Bina Nusantara

Page 6: Image 2

Image Transform in Java

• drawImage– draw and scale an image

• ConvolveOp – blur or sharpen an image

• AffineTransformOp – transform an image

• Graphics2D.setClip – crop an image

Bina Nusantara

Page 7: Image 2

Image Enhancement in Java

•LookupOp– remap pixel colors (ex : a negative

image)

•RescaleOp – lighten/darken or reduce/increase

opacity of the image

Bina Nusantara

Page 8: Image 2

drawImage

Bina Nusantara

This is an example to draw image with Java2D

Page 9: Image 2

Image Transformation

newZ (x,y) = F(Z(x,y))= result of a Function

based on originalZ(x,y)

Horizontal Flipping x’ = N – xy’ = y

Bina Nusantara

Page 10: Image 2

Image Transformation

• Vertical Flippingx’ = xy’= M - y

Bina Nusantara

Page 11: Image 2

Image Transformation

• Rotation

Bina Nusantara

x' cos a -sin a 0 x y' = sin a cos a 0 y z' 0 0 1 Z

a

Matrix / KernelMatrix / Kernel

Page 12: Image 2

Image Rotation

• The basic algorithm is not used in practice– contains unwanted gaps or holes usually requires a greater

number of pixels than the source to properly display the rotation

• Therefore, interpolation is used to solve this problemBina Nusantara

Gaps/holesGaps/holes

Page 13: Image 2

Image Interpolation

Bina Nusantara

Interpolation

InterpolationInterpolation

using known data to estimate values at

unknown points.

using known data to estimate values at

unknown points.

Page 14: Image 2

Image Transformation

• Cropping

• Scale• Shear

Bina Nusantara

Page 15: Image 2

AffineTransformOp

Bina Nusantara

Rotate

Full codes are downloadable in Additional Material

Page 16: Image 2

AffineTransformOp

Bina Nusantara

Shear

Full codes are downloadable in Additional Material

Page 17: Image 2

AffineTransformOp

Bina Nusantara

Scale

Full codes are downloadable in Additional Material

Page 18: Image 2

AffineTransformOp

Bina Nusantara

Translate

Full codes are downloadable in Additional Material

Page 19: Image 2

Scale

Bina Nusantara

x’

y’

1

sx 0 0

0 sy 0

0 0 1

x

y

1

= *

Page 20: Image 2

RescaleOp

Bina Nusantara

Rescaling

Full codes are downloadable in Additional Material

Page 21: Image 2

Shear

Bina Nusantara

x’

y’

1

1 h 0

0 1 0

0 0 1

x

y

1

= *

Page 22: Image 2

Image Enhancement

Convolution • an operation in which the final pixel is the weighted sum of

the neighboring pixels• Use matrix/kernel as well convolution kernel / linear filter

Bina Nusantara

Page 23: Image 2

Convolution

• Blurring

Bina Nusantara

1 2 12 4 21 2 1

XYZ

Note : This is only an example of many blur kernel variations

Page 24: Image 2

Convolution

• Sharpening

Bina Nusantara

-1 -1 -1-1 9 -1-1 -1 -1

XYZ

Note : This is only an example of many sharpen kernel variations

Page 25: Image 2

Convolution

• Edge Detection

Bina Nusantara

-1 -1 -1-1 8 -1-1 -1 -1

XYZ

Note : This is only an example of many edge detection kernel variations

Page 26: Image 2

ConvolveOp

Bina Nusantara

Blur Full codes are downloadable in Additional Material

Page 27: Image 2

ConvolveOp

Bina Nusantara

Sharpen Full codes are downloadable in Additional Material

Page 28: Image 2

ConvolveOp

Bina Nusantara

Edge Full codes are downloadable in Additional Material

Page 29: Image 2

Image Enhancement

• Brighten/Darken

• Opacity

Bina Nusantara

Brighten Darken

Opacity 80% Opacity 50%

Page 30: Image 2

Graphics2D.setClip

Bina Nusantara

setClip is used to clip a portion of images to make a new image

Page 31: Image 2

LookupOp

Bina Nusantara

Invert Color

Full codes are downloadable in Additional Material

Page 32: Image 2

References

• Image Processing with Java 2D. 2008. http://www.javaworld.com/javaworld/jw-09-1998/jw-09-media.html?page=3

• Image Processing and Enhancement. 1999. http://java.sun.com/j2se/1.3/docs/guide/2d/spec/j2d-image.fm8.html

• Image Processing Fundamentals. 2009. http://www.ph.tn.tudelft.nl/Courses/FIP/noframes/fip.html

• Basic Concepts in Digital Image Processing. 2004. http://micro.magnet.fsu.edu/primer/digitalimaging/javaindex.html

• The Digital Darkroom. 2003. http://www.spinroot.com/pico/a3.pdf• Transforming Shapes, Text, and Images. 2008.

http://java.sun.com/docs/books/tutorial/2d/advanced/transforming.html• Digital Image Interpolation. 2009.

http://www.cambridgeincolour.com/tutorials/image-interpolation.htm• Image Convolution. 2009. http://www.eas.asu.edu/~karam/2dconvolution/• Image Filtering with GLSL - Convolution Kernels. 2009.

http://www.ozone3d.net/tutorials/image_filtering.php• Fundamentals of Image Processing. 2009.

http://www.cs.dartmouth.edu/~farid/tutorials/fip.pdf

Bina Nusantara