Digital image processing
This presentation is the property of its rightful owner.
Sponsored Links
1 / 56

Digital Image Processing PowerPoint PPT Presentation


  • 79 Views
  • Uploaded on
  • Presentation posted in: General

Digital Image Processing. Some Special Techniques Dithering. 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 )

Download Presentation

Digital Image Processing

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Digital image processing

Digital Image Processing

Some Special Techniques

Dithering

Duong Anh Duc - Digital Image Processing


Dithering

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.

Duong Anh Duc - Digital Image Processing


Dithering1

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.

Duong Anh Duc - Digital Image Processing


Dithering2

Dithering

Duong Anh Duc - Digital Image Processing


Dithering grey scale and colour simulation

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

Duong Anh Duc - Digital Image Processing


Dithering grey scale and colour simulation1

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

Duong Anh Duc - Digital Image Processing


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

Dithering Methods(Digital Halftoning)

Duong Anh Duc - Digital Image Processing


Dithering in printing industry

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

Duong Anh Duc - Digital Image Processing


Simple shading techniques a series of examples

Simple shading techniquesA 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.

Duong Anh Duc - Digital Image Processing


Simple shading techniques an example

Simple shading techniquesAn 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.

Duong Anh Duc - Digital Image Processing


Simple shading techniques an example1

Simple shading techniquesAn 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.

Duong Anh Duc - Digital Image Processing


Simple shading techniques an example2

Simple shading techniquesAn 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.

Duong Anh Duc - Digital Image Processing


Threshold dithering

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

Duong Anh Duc - Digital Image Processing


Constant threshold dithering

Constant Threshold Dithering

sample image

threshold values

result

(values between 0 and 9)

corresponds to rounding

Duong Anh Duc - Digital Image Processing


Principle of dithering

Principle of Dithering

  • Available values a, b

  • Missing value x between a and b shall besimulated by mixing a-pixels and b-pixels

Duong Anh Duc - Digital Image Processing


Principle of dithering1

Principle of Dithering

Duong Anh Duc - Digital Image Processing


Dithering a uniform area

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

Duong Anh Duc - Digital Image Processing


Dithering a uniform area1

Dithering a Uniform Area

  • This can be done by using a different threshold for every pixel (using the interval borders)

Duong Anh Duc - Digital Image Processing


Threshold matrix

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

Duong Anh Duc - Digital Image Processing


Dither matrix example

Dither Matrix Example

dither matrix

threshold matrix

Value k corresponds to threshold value: 2k+1/2n2

Duong Anh Duc - Digital Image Processing


Threshold matrix dithering example

Threshold Matrix Dithering Example

sample image

threshold values

result

(values between 0 and 9)

Duong Anh Duc - Digital Image Processing


Generation of threshold matrices

Generation of Threshold Matrices

  • recursive method: 4 copies of smaller matrices

Duong Anh Duc - Digital Image Processing


Generation of threshold matrices1

Generation of Threshold Matrices

  • Direct method: use of magic squares

example

magic squares produce

fewer diagonal stripes

Duong Anh Duc - Digital Image Processing


Dithering between grey levels

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)

Duong Anh Duc - Digital Image Processing


Grey level dithering example

Grey Level Dithering Example

Duong Anh Duc - Digital Image Processing


Dot diffusion dithering

Dot Diffusion Dithering

Duong Anh Duc - Digital Image Processing


Stochastic dithering

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)

Duong Anh Duc - Digital Image Processing


Forced random matrix dithering

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!

Duong Anh Duc - Digital Image Processing


Error distribution algorithms floyd steinberg 1975

Error distribution algorithmsFloyd-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.

Duong Anh Duc - Digital Image Processing


Floyd steinberg distribution weighting

Floyd-SteinbergDistribution Weighting

Current

Pixel

3/8 error

Current scan line of image

3/8 error

1/4 error

Next scan line of image

Duong Anh Duc - Digital Image Processing


Dithering some drawbacks

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

Duong Anh Duc - Digital Image Processing


Diffusion direction variations

Diffusion Direction Variations

  • to gain better results, the error is distributed toseveral neighbors (with weights)

Duong Anh Duc - Digital Image Processing


Error diffusion dithering example

Error Diffusion Dithering Example

sample image

threshold values

result

(values between 0 and 9)

corresponds to rounding

Duong Anh Duc - Digital Image Processing


Serpentine method

Serpentine Method

  • Artificial stripes can be reduced drastically byprocessing the scanlines in serpentine order

no additional memory necessary

Duong Anh Duc - Digital Image Processing


Colour systems colour in the environment

Colour SystemsColour 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.

Duong Anh Duc - Digital Image Processing


Colour systems colour in the environment1

Colour SystemsColour 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.

Duong Anh Duc - Digital Image Processing


Colour systems measuring colour

Colour SystemsMeasuring Colour

  • 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!

VioletBlueCyanGreenYellowOrangeRed

400480500520580600650700720

Light Wavelength (nanometres)

Duong Anh Duc - Digital Image Processing


Colour systems colour matching

Colour SystemsColour 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 300 000 different shades of colour.

Duong Anh Duc - Digital Image Processing


Colour systems colour matching1

Colour SystemsColour 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.

Duong Anh Duc - Digital Image Processing


Colour systems primary colours

Colour SystemsPrimary 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.

Duong Anh Duc - Digital Image Processing


Colour systems the cie chromaticity diagram

Green

Yellow

Cyan

White

Red

Magenta

Blue

Colour SystemsThe 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.

Duong Anh Duc - Digital Image Processing


Colour systems the rgb colour cube

Yellow

Green

Cyan

White

(Greys)

Red

Black

Blue

Magenta

Colour SystemsThe 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.

Duong Anh Duc - Digital Image Processing


Colour systems the rgb colour cube1

Colour SystemsThe 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

Duong Anh Duc - Digital Image Processing


Colour systems the hsv model

Green 120

Yellow 60

Cyan 180

V=1

Red 0

Magenta 300

Blue 240

V=0

Colour SystemsThe 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.

Duong Anh Duc - Digital Image Processing


Colour systems the hls model

L=1

Green 120

Cyan 60

Blue 0

Yellow 180

Red 240

Magenta 300

L=0

Colour SystemsThe 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.

Duong Anh Duc - Digital Image Processing


References

References

  • http://www.efg2.com/Lab/Library/ImageProcessing/DHALF.TXT - 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

Duong Anh Duc - Digital Image Processing


Digital image processing1

Digital Image Processing

Some Special Techniques

Thinning (Lọc xương)

Duong Anh Duc - Digital Image Processing


Thinning

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.

  • Duong Anh Duc - Digital Image Processing


    Thinning1

    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.

    Duong Anh Duc - Digital Image Processing


    Thinning2

    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.

    Duong Anh Duc - Digital Image Processing


    Thu t to n zhang suen

    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:

    Duong Anh Duc - Digital Image Processing


    Quy t c 1

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

    Duong Anh Duc - Digital Image Processing


    Quy t c 2

    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.

    Duong Anh Duc - Digital Image Processing


    C ch t nh crossing index ci

    Cách tính crossing index - CI

    • Ví dụ:

    CI=0

    CI=1

    CI=2

    CI=2

    CI=3

    CI=4

    Duong Anh Duc - Digital Image Processing


    Quy t c 3

    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.

    Duong Anh Duc - Digital Image Processing


    Quy t c 4

    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.

    Duong Anh Duc - Digital Image Processing


  • Login