Presentation is loading. Please wait.

Presentation is loading. Please wait.

Image Enhancement Christoph Lampert / Chris Wojtan Some slides adapted from Selim Aksoy, Bilkent University.

Similar presentations


Presentation on theme: "Image Enhancement Christoph Lampert / Chris Wojtan Some slides adapted from Selim Aksoy, Bilkent University."— Presentation transcript:

1 Image Enhancement Christoph Lampert / Chris Wojtan Some slides adapted from Selim Aksoy, Bilkent University

2 Representing an Image in Code 2D matrix of values, starting from the upper left (start counting at zero) Integer, floating point, …, ? boolean (0=black, 1=white) floating point (0.0=black, 1.0=white) 8-bit integer (0=black, 255=white) – most common Whatever is convenient Floating point is good for continuous math (exponentiation, division, …) Integers are useful for dividing up values into discrete sets (histograms, segmentation, …) 2 Pixel [1][3]

3 ImageJ You will write some code for homework Accessing and writing in an image image.get(10,15); tells us the pixel value at row 10, column 15 image.set(10, 25, 0); sets that pixel value to black Repeating an operation for every pixel for (int y=0; y<yMax; y++) for (int x=0; x<xMax; x++) image.set(x, y, 0); 3

4 Beware – “casting” between int and double Most images need ints in the end, but intermediate computation should be in doubles. int always rounds to an integer. This is usually undesired. int y = 0.9;// y=0 int y = 128/255;// y=0 int y = sin(x);// y=0 “Cast” between the two types (double) will treat a number like a real value (int) will treat a number like an integer int x = 100; int num_pixels = 1024; double f = (double) x / (double) num_pixels; int output_value = (int) (f * 255.0); 4

5 ImageJ Demos Black.java Linear.java SineWave.java Checker.java Circle.java Max.java Template.java Compute_Histogram.java 5

6 6 Image enhancement The principal objective of enhancement is to process an image so that the result is more suitable than the original for a specific application. Enhancement can be done in Spatial domain, Frequency domain. Common reasons for enhancement include Improving visual quality, Improving machine recognition accuracy.

7 7 Image enhancement First, we will consider point processing where enhancement at any point depends only on the image value at that point.

8 8 Image enhancement First, we will consider point processing where enhancement at any point depends only on the image value at that point. For gray level images, we will use a transformation function of the form s = T(r) where “r” is the original pixel value and “s” is the new value after enhancement.

9 Thresholding if image.get(x,y) < T image.set(x,y,0); else image.set(x,y,255); Images from http://www.svi.nl/SeedAndThreshold

10 10 Image enhancement

11 11 Image enhancement

12 12 Image enhancement

13 13 Image enhancement

14 14 Image enhancement

15 15 Image enhancement Contrast stretching:

16 16 Image enhancement

17 17 Histogram processing

18 18 Histogram processing 01 00 12 12 22 11 23 22 26 24 77 64 34 45 55 65 0 1 2 3 4 5 6 7 3 5 9 2 44 3 2

19 19 Histogram processing 01 00 12 12 22 11 23 22 26 24 77 64 34 45 55 65 0 1 2 3 4 5 6 7 9 0 0.3 321.0

20 20 Histogram processing

21 21 Histogram processing Intuitively, we expect that an image whose pixels tend to occupy the entire range of possible gray levels, tend to be distributed uniformly will have a high contrast and show a great deal of gray level detail. It is possible to develop a transformation function that can achieve this effect using histograms.

22 22 Histogram equalization http://fourier.eng.hmc.edu/e161/lectures/contrast_transform/node3.html

23 23 Histogram equalization

24 CS 484, Fall 2012©2012, Selim Aksoy 24 Histogram equalization Adapted from Wikipedia

25 CS 484, Fall 2012©2012, Selim Aksoy 25 Histogram specification http://fourier.eng.hmc.edu/e161/lectures/contrast_transform/node3.html whatever the heck you want The math is similar, but your new image has a histogram close to any p(y), instead of a uniform distribution.

26 26

27 CS 484, Fall 2012©2012, Selim Aksoy 27 Histogram equalization Original RGB imageHistogram equalization of each individual band/channel Histogram stretching by removing 2% percentile from each individual band/channel

28 Enhancement using logical operations Boolean operations

29 Enhancement using logical operations Boolean operations

30 Enhancement using logical operations Boolean operations NOT AND OR XOR INPUTOUTPUT ABNOT AA AND BA OR BA XOR BA AND NOT B 0010000 0110110 1000111 1101100

31 31 Enhancement using arithmetic operations Addition/Subtraction

32 Enhancement using arithmetic operations Multiplication

33 Enhancement using arithmetic operations Masking, alpha channel = arithmetic operations

34 34 Geometric Transformations

35 35 Geometric Transformations

36 36 Geometric Transformations

37 37 Geometric Transformations in Code


Download ppt "Image Enhancement Christoph Lampert / Chris Wojtan Some slides adapted from Selim Aksoy, Bilkent University."

Similar presentations


Ads by Google