Presentation is loading. Please wait.

Presentation is loading. Please wait.

Digital Image Processing

Similar presentations


Presentation on theme: "Digital Image Processing"— Presentation transcript:

1 Digital Image Processing
Some Special Techniques Dithering 11/19/2018 Duong Anh Duc - Digital Image Processing

2 Duong Anh Duc - Digital Image Processing
Dithering Dithering, also called Halftoning or Color Reduction, is the process of rendering an image on a display device with fewer colors than are in the image. (Mateus Pins and Hermann Hild) The number of different colors in an image or on a device is used called its Color Resolution. Dithering, also called Halftoning or Color Reduction, is the process of rendering an image on a display device with fewer colors than are in the image. The number of different colors in an image or on a device is used called its Color Resolution. The term 'resolution' means 'fineness' and is used to describe the level of detail in a digitally sampled signal. It is used most often in referring to the Spatial Resolution, which is the basic sampling rate for a digitized image. 11/19/2018 Duong Anh Duc - Digital Image Processing

3 Duong Anh Duc - Digital Image Processing
Dithering If the display device has a higher spatial resolution than the image that you are trying to reproduce, it can show a very good image even if its color resolution is less. This is what we will call 'dithering' and is the subject of this work. Dithering is a one-way operation. Once an image has been dithered, although it may look like a good reproduction of the original, information is permanently lost. Many image processing functions fail on dithered images. If the display device has a higher spatial resolution than the image that you are trying to reproduce, it can show a very good image even if its color resolution is less. This is what we will call 'dithering' and is the subject of this work. It is important to emphasize here that dithering is a one-way operation. Once an image has been dithered, although it may look like a good reproduction of the original, information is permanently lost. Many image processing functions fail on dithered images. For these reasons, dithering must be considered only as a way to produce an image on hardware at would otherwise be incapable of displaying it. The data representing an image should always be kept in full detail. 11/19/2018 Duong Anh Duc - Digital Image Processing

4 Duong Anh Duc - Digital Image Processing
Dithering 11/19/2018 Duong Anh Duc - Digital Image Processing

5 Dithering Grey-scale and colour simulation
Dithering on a screen or printer is analogous to the half-toning techniques used in the print industry. A CRT can be considered to be a complex colour “dithering” device with variable colour intensity. 11/19/2018 Duong Anh Duc - Digital Image Processing

6 Dithering Grey-scale and colour simulation
We need to display colour and grey-scale images on output devices that have a lower information-carrying capacity. Cheap printers are bi-level or CMYK - clearly we need to add colours/intensities to approximate an image. 11/19/2018 Duong Anh Duc - Digital Image Processing

7 Dithering Methods (Digital Halftoning)
Threshold dithering ordered dither stochastic dither dot diffusion .... Error diffusion dithering Floyd-Steinberg Burkes Stucki Sierra Jarvis, Judice and Ninke Stevenson and Arce 11/19/2018 Duong Anh Duc - Digital Image Processing

8 Dithering in Printing Industry
Newspapers black ink on light paper, rasterization of theimages enables also grey levels, equal pointdensity everywhere, variable size Color printing every primary color is rasterized separately,different printing angles ensure unbiased results 11/19/2018 Duong Anh Duc - Digital Image Processing

9 Simple shading techniques A series of examples
Original picture, half-toning simulation by a non-PostScript laser printer. The original image has an 8-bit grey scale palette. The laser printer has only got a 1-bit palette (ie bi-level, black and white) and must simulate the original shading. 11/19/2018 Duong Anh Duc - Digital Image Processing

10 Simple shading techniques An example
Bayer - Ordered Dithering This method uses a set of regular arrays of values, leading to a regular (and visually poor) output. This method creates abrupt changes between areas, changes that do not exist on the original. Such artefacts are not desirable. 11/19/2018 Duong Anh Duc - Digital Image Processing

11 Simple shading techniques An example
Burkes This method uses an error-distribution algorithm to minimise percieved errors. Changes in the average intensity vary quite smoothly, resolution permitting, leading to a more acceptable image. 11/19/2018 Duong Anh Duc - Digital Image Processing

12 Simple shading techniques An example
Floyd-Steinberg FS dithering is popular and commonly used. It is robust and quite general. FS dithering works best on images with few high-contrast transitions. 11/19/2018 Duong Anh Duc - Digital Image Processing

13 Duong Anh Duc - Digital Image Processing
Threshold Dithering every pixel is compared to a threshold t: t can be: equal everywhere (e.g. (b–a)/2,arbitrary value, mean value, median, ...) location dependent (defined locally or globally) p  t  a p > t  b 11/19/2018 Duong Anh Duc - Digital Image Processing

14 Constant Threshold Dithering
sample image threshold values result (values between 0 and 9) corresponds to rounding 11/19/2018 Duong Anh Duc - Digital Image Processing

15 Principle of Dithering
Available values a, b Missing value x between a and b shall besimulated by mixing a-pixels and b-pixels 11/19/2018 Duong Anh Duc - Digital Image Processing

16 Principle of Dithering
11/19/2018 Duong Anh Duc - Digital Image Processing

17 Dithering a Uniform Area
for a uniform area regular application of this pattern will produce this grey tone interval borders all grey levels in this interval will be mapped to 1/4 11/19/2018 Duong Anh Duc - Digital Image Processing

18 Dithering a Uniform Area
This can be done by using a different threshold for every pixel (using the interval borders) 11/19/2018 Duong Anh Duc - Digital Image Processing

19 Duong Anh Duc - Digital Image Processing
Threshold Matrix Distances between interval borders are equal, therefore it suffices to define the sequence of the pixel values in the matrix: instead of only i.e. for an nxn matrix: values  [0,n2–1] Value k corresponds to threshold value: 2k+1/2n2 11/19/2018 Duong Anh Duc - Digital Image Processing

20 Duong Anh Duc - Digital Image Processing
Dither Matrix Example dither matrix threshold matrix Value k corresponds to threshold value: 2k+1/2n2 11/19/2018 Duong Anh Duc - Digital Image Processing

21 Threshold Matrix Dithering Example
sample image threshold values result (values between 0 and 9) 11/19/2018 Duong Anh Duc - Digital Image Processing

22 Generation of Threshold Matrices
recursive method: 4 copies of smaller matrices 11/19/2018 Duong Anh Duc - Digital Image Processing

23 Generation of Threshold Matrices
Direct method: use of magic squares example magic squares produce fewer diagonal stripes 11/19/2018 Duong Anh Duc - Digital Image Processing

24 Dithering between Grey Levels
threshold values have to lie between a and b: calculation is done separately for every pixel (not once for a dithering matrix) 11/19/2018 Duong Anh Duc - Digital Image Processing

25 Grey Level Dithering Example
11/19/2018 Duong Anh Duc - Digital Image Processing

26 Dot Diffusion Dithering
11/19/2018 Duong Anh Duc - Digital Image Processing

27 Duong Anh Duc - Digital Image Processing
Stochastic Dithering? Use of random numbers as threshold values expectation value of total error = 0 no regular artificial patterns possible Unfortunately: very bad results! (due to bad distribution of random numbers) 11/19/2018 Duong Anh Duc - Digital Image Processing

28 Forced Random Matrix Dithering
Improved "random" matrices  very good results Method: insert threshold values one by one into matrix, always use the position farthest away from all previous points Repulsive force field: precalculate large threshold matrices: 300x300 very good results! 11/19/2018 Duong Anh Duc - Digital Image Processing

29 Error distribution algorithms Floyd-Steinberg (1975)
If an image has a pixel with a normalised value of 0.5, ie half intensity, we cannot accurately represent it with a black or white dot. However, we can remember the error and feed it into the approximation calculation for the surrounding pixels. The error value gets distributed locally and the eye reintegrates the values, “recreating” the grey scale. 11/19/2018 Duong Anh Duc - Digital Image Processing

30 Floyd-Steinberg Distribution Weighting
Current Pixel 3/8 error Current scan line of image 3/8 error 1/4 error Next scan line of image 11/19/2018 Duong Anh Duc - Digital Image Processing

31 Dithering Some drawbacks
A dithered image is an image with less information in it than the original. Resolution and apparent colour content are a trade-off, particularly with thermal wax transfer printers etc. Accurate conversion between original images and dithered images is generally one-way. Some dithering methods cause ugly banding on some images. Careful choice of dithering methods can minimise this problem. 11/19/2018 Duong Anh Duc - Digital Image Processing

32 Diffusion Direction Variations
to gain better results, the error is distributed toseveral neighbors (with weights) 11/19/2018 Duong Anh Duc - Digital Image Processing

33 Error Diffusion Dithering Example
sample image threshold values result (values between 0 and 9) corresponds to rounding 11/19/2018 Duong Anh Duc - Digital Image Processing

34 Duong Anh Duc - Digital Image Processing
Serpentine Method Artificial stripes can be reduced drastically byprocessing the scanlines in serpentine order no additional memory necessary 11/19/2018 Duong Anh Duc - Digital Image Processing

35 Colour Systems Colour in the environment
Diffuse reflection of white light gives an object its colour. Perception of colour is, therefore, dependent upon lighting. Specular reflection has the colour content of the light source - what is the colour of a mirror? Colour is an everyday experience. 11/19/2018 Duong Anh Duc - Digital Image Processing

36 Colour Systems Colour in the environment
Colour can be measured in terms of the frequency or wavelength of electromagnetic radiation (light). Some light sources have a narrow band of frequencies, eg lasers, but this is rare. Incandescent lighting has a broad range of frequencies. Sodium lamps have two bright frequencies. 11/19/2018 Duong Anh Duc - Digital Image Processing

37 Colour Systems Measuring Colour
Violet Blue Cyan Green Yellow Orange Red Light Wavelength (nanometres) Wavelength and intensity are measurable quantities - intensity expresses the energy per unit area carried by the radiation. This is not an intuitive way of specifying colours! 11/19/2018 Duong Anh Duc - Digital Image Processing

38 Colour Systems Colour Matching
The eye cannot discern between a colour made of a single wavelength and a “visually identical” colour made of a mixture of wavelengths. This allows monitors (RGB) and magazines (CMYK) to show the “same” pictures. The eye is very sensitive to colour and can distinguish between approximately different shades of colour. 11/19/2018 Duong Anh Duc - Digital Image Processing

39 Colour Systems Colour Matching
For practical purposes, the physical descrip-tion of colour is abandoned in favour of a more natural way of describing what we see. Any colour shade can be matched by mixing three monochromatic primary colours, by definition. Colour matching is an important problem for commercial users of print and video. 11/19/2018 Duong Anh Duc - Digital Image Processing

40 Colour Systems Primary Colours
In the real world we do not have pure, single-wavelength colour sources to add - this means that some colour shades are impossible to match. A way of specifying colours in a sensible way was developed by the CIE (Comission Internationale de L’Eclairage) in 1931. The CIE chromaticity diagram is widely used. 11/19/2018 Duong Anh Duc - Digital Image Processing

41 Colour Systems The CIE Chromaticity Diagram
The CIE diagram represents all hue and saturation values, with normalised intensity. The outer curve represents all the visible 100% saturated or pure colours. Cyan Blue Red White Yellow Green Magenta 11/19/2018 Duong Anh Duc - Digital Image Processing

42 Colour Systems The RGB colour cube
A system with three independent variables can be represented by a three-dimensional position. The RGB colour cube represents all of the colours that an RGB monitor can create, in a non-normalized form. Yellow Green White Black Cyan Blue Magenta Red (Greys) 11/19/2018 Duong Anh Duc - Digital Image Processing

43 Colour Systems The RGB colour cube
A system with three independent variables can be represented by a three-dimensional position. The RGB colour cube represents all of the colours that an RGB monitor can create, in a non-normalized form. Green Yellow Cyan White Red Blue Magenta 11/19/2018 Duong Anh Duc - Digital Image Processing

44 Colour Systems The HSV model
Hue, Saturation, Value is a more intuitive model. “Value” is brightness, constant value hexagons lie parallel to the top surface. Grey shades run up the vertical axis, black at the bottom and white at the top. V=0 Green 120 Yellow 60 Cyan 180 Red 0 Blue 240 Magenta 300 V=1 11/19/2018 Duong Anh Duc - Digital Image Processing

45 Colour Systems The HLS model
The Hue, Lightness, Saturation model was developed by Tektronix. HLS is similar to HSV but with a double cone. This and other models are combinations of the CIE, RGB and HSV models. Translations are always possible. L=0 Green 120 Yellow 180 Cyan 60 Red 240 L=1 Blue 0 Magenta 300 11/19/2018 Duong Anh Duc - Digital Image Processing

46 Duong Anh Duc - Digital Image Processing
References - dither.txt – everything you ever wanted to know about dithering! Computer Graphics, (C version) by D. Hearn and P. Baker: Section 4 of Chapter 15, Halftone Patterns and Dithering Techniques Chapter 15, Colour Models and Colour Applications 11/19/2018 Duong Anh Duc - Digital Image Processing

47 Digital Image Processing
Some Special Techniques Thinning (Lọc xương) 11/19/2018 Duong Anh Duc - Digital Image Processing

48 Duong Anh Duc - Digital Image Processing
Thinning Các pixel trên một ảnh có thể chia làm 2 loại: Pixel nền Pixel thuộc một đối tượng Ở đây ta chỉ quan tâm đến loại sau. Các pixel thuộc một đối tượng lại có thể chia làm 2 loại: Điểm biên Điểm bên trong Thinning là quá trình biến đổi để trên ảnh chỉ còn các điểm biên và nền. 11/19/2018 Duong Anh Duc - Digital Image Processing

49 Duong Anh Duc - Digital Image Processing
Thinning Thinning là quá trình loại bỏ các pixel phụ (dư thừa) để làm đối tượng trở nên đơn giản hơn, chỉ gồm các thành phần mảnh, không có diện tích. Thinning rất giống với phép co: xóa liên tiếp các pixel dư thừa cho đến khi chỉ còn khung xương đối tượng. 11/19/2018 Duong Anh Duc - Digital Image Processing

50 Duong Anh Duc - Digital Image Processing
Thinning Thinning phải thỏa các tính chất cơ bản sau: Đối tượng kết quả phải mảnh, có độ rộng 1 pixel Các pixel tạo nên khung xương phải định vị gần tâm của mặt cắt đối tượng. Đảm bảo tính liên thông giống như đối tượng ban đầu. 11/19/2018 Duong Anh Duc - Digital Image Processing

51 Duong Anh Duc - Digital Image Processing
Thuật toán Zhang – Suen Tư tưởng cơ bản: Việc giải quyết có xóa hay không xóa 1 pixel sẽ chỉ phụ thuộc vào 8 pixel lân cận với nó. Bốn quy tắc để quyết định xóa hay không xóa 1 pixel: 11/19/2018 Duong Anh Duc - Digital Image Processing

52 Duong Anh Duc - Digital Image Processing
Quy tắc 1 Pixel p có thể được xóa nếu 1 < N8(p) < 7 với N8(p) là số lân cận 8 của p. Điều kiện N8(p) > 1 đảm bảo điểm đầu mút của đối tượng không bị xóa, không bị bào mòn. Điều kiện N8(p)<7 đảm bảo đối tượng không bị đục lỗ (trong trường hợp N8(p)=8) hoặc bào mòn quá mức (trong trường hợp N8(p)=7). 11/19/2018 Duong Anh Duc - Digital Image Processing

53 Duong Anh Duc - Digital Image Processing
Quy tắc 2: Pixel p được xóa nếu chỉ số đếm (counting index hay crossing index - CI) của nó bằng 1. Định nghĩa: Chỉ số đếm là số ngã rẽ từ pixel đang xét. 11/19/2018 Duong Anh Duc - Digital Image Processing

54 Cách tính crossing index - CI
Ví dụ: p 1 p 1 p CI=0 CI=1 CI=2 1 p 1 p 1 p CI=2 CI=3 CI=4 11/19/2018 Duong Anh Duc - Digital Image Processing

55 Duong Anh Duc - Digital Image Processing
Quy tắc 3: Trong pha thứ nhất, ảnh sẽ được quét từ trên xuống dưới và từ trái sang phải. Một pixel chỉ được xóa nếu thỏa cả 2 điều kiện: Có ít nhất 1 trong các lân cận 1, 3, 5 là pixel nền. Có ít nhất 1 trong các lân cận 3, 5, 7 là pixel nền. 1 7 p 3 5 11/19/2018 Duong Anh Duc - Digital Image Processing

56 Duong Anh Duc - Digital Image Processing
Quy tắc 4: Trong pha thứ nhất, ảnh sẽ được quét từ dưới lên trên và từ phải sang trái. Một pixel chỉ được xóa nếu thỏa cả 2 điều kiện: Có ít nhất 1 trong các lân cận 1, 3, 7 là pixel nền. Có ít nhất 1 trong các lân cần 1, 5, 7 là pixel nền. 1 7 p 3 5 11/19/2018 Duong Anh Duc - Digital Image Processing


Download ppt "Digital Image Processing"

Similar presentations


Ads by Google