+ All Categories
Home > Documents > Some Technics

Some Technics

Date post: 14-Apr-2016
Category:
Upload: truong-van-truong
View: 241 times
Download: 0 times
Share this document with a friend
Description:
Kỹ thuật
56
05/07/22 05/07/22 Duong Anh Duc - Digital Image Proc Duong Anh Duc - Digital Image Proc essing essing 1 Digital Image Processing Some Special Techniques Some Special Techniques Dithering Dithering
Transcript
Page 1: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 11

Digital Image Processing

Some Special TechniquesSome Special TechniquesDitheringDithering

Page 2: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 22

DitheringDithering Dithering, also called Halftoning or Color Dithering, also called Halftoning or Color

Reduction, is the process of rendering an Reduction, is the process of rendering an image on a display device with fewer colors image on a display device with fewer colors than are in the image. (than are in the image. (Mateus Pins and Mateus Pins and Hermann HildHermann Hild) )

The number of different colors in an image or The number of different colors in an image or on a device is used called its Color Resolution. on a device is used called its Color Resolution.

Page 3: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 33

DitheringDithering If the display device has a higher spatial resolution If the display device has a higher spatial resolution

than the image that you are trying to reproduce, it can than the image that you are trying to reproduce, it can show a very good image even if its color resolution is show a very good image even if its color resolution is less. This is what we will call 'dithering' and is the less. This is what we will call 'dithering' and is the subject of this work. subject of this work.

Dithering is a one-way operation. Dithering is a one-way operation. Once an image has been dithered, although it may look like Once an image has been dithered, although it may look like

a good reproduction of the original, information is a good reproduction of the original, information is permanently lost. permanently lost.

Many image processing functions fail on dithered images. Many image processing functions fail on dithered images.

Page 4: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 44

DitheringDithering

Page 5: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 55

DitheringDitheringGrey-scale and colour simulationGrey-scale and colour simulation

Dithering on a screen or printer is analogous to Dithering on a screen or printer is analogous to the half-toning techniques used in the print the half-toning techniques used in the print industry.industry.

A CRT can be considered to be a complex A CRT can be considered to be a complex colour “dithering” device with variable colour colour “dithering” device with variable colour intensity.intensity.

Page 6: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 66

DitheringDitheringGrey-scale and colour simulationGrey-scale and colour simulation

We need to display colour and grey-scale We need to display colour and grey-scale images on output devices that have a lower images on output devices that have a lower information-carrying capacity.information-carrying capacity.

Cheap printers are bi-level or CMYK - clearly Cheap printers are bi-level or CMYK - clearly we need to add colours/intensities to we need to add colours/intensities to approximate an image.approximate an image.

Page 7: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 77

Dithering MethodsDithering Methods(Digital Halftoning)(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 Stevenson and Arce ……

Page 8: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 88

Dithering in Printing IndustryDithering in Printing Industry

Newspapersblack ink on light paper, rasterization of theimages

enables also grey levels, equal pointdensity everywhere, variable size

Color printingevery primary color is rasterized

separately,different printing angles ensure unbiased results

Page 9: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 99

Simple shading techniquesSimple shading techniquesA series of examplesA series of examples

Original picture, half-toning Original picture, half-toning simulation by a non-PostScript simulation by a non-PostScript laser printer.laser printer.

The original image has an 8-The original image has an 8-bit grey scale palette.bit grey scale palette.

The laser printer has only got The laser printer has only got a 1-bit palette (ie bi-level, a 1-bit palette (ie bi-level, black and white) and must black and white) and must simulatesimulate the original shading. the original shading.

Page 10: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 1010

Simple shading techniquesSimple shading techniquesAn exampleAn example

Bayer - Ordered DitheringBayer - Ordered Dithering This method uses a set of This method uses a set of

regular arrays of values, regular arrays of values, leading to a regular (and leading to a regular (and visually poor) output.visually poor) output.

This method creates abrupt This method creates abrupt changes between areas, changes between areas, changes that do not exist on changes that do not exist on the original. Such the original. Such artefactsartefacts are are not desirable.not desirable.

Page 11: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 1111

Simple shading techniquesSimple shading techniquesAn exampleAn example

BurkesBurkes This method uses an error-This method uses an error-

distribution algorithm to distribution algorithm to minimise percieved errors.minimise percieved errors.

Changes in the average Changes in the average intensity vary quite smoothly, intensity vary quite smoothly, resolution permitting, leading resolution permitting, leading to a more acceptable image.to a more acceptable image.

Page 12: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 1212

Simple shading techniquesSimple shading techniquesAn exampleAn example

Floyd-SteinbergFloyd-Steinberg FS dithering is popular and FS dithering is popular and

commonly used. It is commonly used. It is robust and quite general.robust and quite general.

FS dithering works best on FS dithering works best on images with few high-images with few high-contrast transitions.contrast transitions.

Page 13: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 1313

Threshold DitheringThreshold 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

Page 14: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 1414

Constant Threshold DitheringConstant Threshold Dithering

sample image threshold values result

(values between 0 and 9)corresponds to rounding

Page 15: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 1515

Principle of DitheringPrinciple of Dithering

Available values a, b Missing value x between a and b shall

besimulated by mixing a-pixels and b-pixels

Page 16: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 1616

Principle of DitheringPrinciple of Dithering

Page 17: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 1717

Dithering a Uniform AreaDithering a Uniform Area

for a uniform area regular application ofthis patternwill producethis grey toneinterval borders

all grey levels in this intervalwill be mapped to 1/4

Page 18: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 1818

Dithering a Uniform AreaDithering a Uniform Area

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

Page 19: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 1919

Threshold MatrixThreshold 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

Page 20: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 2020

Dither Matrix ExampleDither Matrix Example

dither matrix threshold matrix

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

Page 21: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 2121

Threshold Matrix Dithering ExampleThreshold Matrix Dithering Example

sample image threshold values result

(values between 0 and 9)

Page 22: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 2222

Generation of Threshold MatricesGeneration of Threshold Matrices

recursive method: 4 copies of smaller matrices

Page 23: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 2323

Generation of Threshold MatricesGeneration of Threshold Matrices

Direct method: use of magic squaresexample

magic squares producefewer diagonal stripes

Page 24: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 2424

Dithering between Grey LevelsDithering 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)

Page 25: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 2525

Grey Level Dithering ExampleGrey Level Dithering Example

Page 26: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 2626

Dot Diffusion DitheringDot Diffusion Dithering

Page 27: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 2727

Stochastic Dithering?Stochastic Dithering?

Use of random numbers as threshold valuesexpectation value of total error = 0no regular artificial patterns possible

Unfortunately: very bad results!(due to bad distribution of random numbers)

Page 28: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 2828

Forced Random Matrix DitheringForced 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: 300x300very good results!

Page 29: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 2929

Error distribution algorithmsError distribution algorithmsFloyd-Steinberg (1975)Floyd-Steinberg (1975)

If an image has a pixel with a normalised value of If an image has a pixel with a normalised value of 0.5, ie half intensity, we cannot accurately 0.5, ie half intensity, we cannot accurately represent it with a black or white dot.represent it with a black or white dot.

However, we can However, we can rememberremember the error and feed it the error and feed it into the approximation calculation for the into the approximation calculation for the surrounding pixels.surrounding pixels.

The error value gets distributed locally and the The error value gets distributed locally and the eye reintegrates the values, “recreating” the grey eye reintegrates the values, “recreating” the grey scale.scale.

Page 30: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 3030

Floyd-SteinbergFloyd-SteinbergDistribution WeightingDistribution Weighting

3/8 error

CurrentPixel

1/4 error

3/8 error

Next scan line of image

Current scan line of image

Page 31: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 3131

DitheringDitheringSome drawbacksSome drawbacks

A dithered image is an image with less information in A dithered image is an image with less information in it than the original.it than the original.

Resolution and apparent colour content are a trade-Resolution and apparent colour content are a trade-off, particularly with thermal wax transfer printers etc.off, particularly with thermal wax transfer printers etc.

Accurate conversion between original images and Accurate conversion between original images and dithered images is generally one-way.dithered images is generally one-way.

Some dithering methods cause ugly banding on some Some dithering methods cause ugly banding on some images. Careful choice of dithering methods can images. Careful choice of dithering methods can minimise this problem.minimise this problem.

Page 32: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 3232

Diffusion Direction VariationsDiffusion Direction Variations

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

Page 33: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 3333

Error Diffusion Dithering ExampleError Diffusion Dithering Example

sample image threshold values result

(values between 0 and 9)corresponds to rounding

Page 34: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 3434

Serpentine MethodSerpentine Method

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

no additional memory necessary

Page 35: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 3535

Diffuse reflection of white light gives an object Diffuse reflection of white light gives an object its colour.its colour.

Perception of colour is, therefore, dependent Perception of colour is, therefore, dependent upon lighting.upon lighting.

Specular reflection has the colour content of Specular reflection has the colour content of the light source - what is the colour of a mirror?the light source - what is the colour of a mirror?

Colour is an everyday experience.Colour is an everyday experience.

Colour SystemsColour SystemsColour in the environmentColour in the environment

Page 36: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 3636

Colour can be measured in terms of the Colour can be measured in terms of the frequency or wavelength of electromagnetic frequency or wavelength of electromagnetic radiation (light).radiation (light).

Some light sources have a narrow band of Some light sources have a narrow band of frequencies, eg lasers, but this is rare.frequencies, eg lasers, but this is rare.

Incandescent lighting has a broad range of Incandescent lighting has a broad range of frequencies.frequencies.

Sodium lamps have two bright frequencies.Sodium lamps have two bright frequencies.

Colour SystemsColour SystemsColour in the environmentColour in the environment

Page 37: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 3737

Colour SystemsColour SystemsMeasuring ColourMeasuring Colour

Wavelength and intensity are measurable Wavelength and intensity are measurable quantities - intensity expresses the energy per quantities - intensity expresses the energy per unit area carried by the radiation.unit area carried by the radiation.

This is not an intuitive way of specifying colours!This is not an intuitive way of specifying colours!

400 480 500 520 580 600 650 700 720Light Wavelength (nanometres)

Violet Blue Cyan Green Yellow Orange Red

Page 38: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 3838

Colour SystemsColour SystemsColour MatchingColour Matching

The eye cannot discern between a colour made The eye cannot discern between a colour made of a single wavelength and a “visually identical” of a single wavelength and a “visually identical” colour made of a mixture of wavelengths.colour made of a mixture of wavelengths.

This allows monitors (RGB) and magazines This allows monitors (RGB) and magazines (CMYK) to show the “same” pictures.(CMYK) to show the “same” pictures.

The eye is very sensitive to colour and can The eye is very sensitive to colour and can distinguish between approximately 300 000 distinguish between approximately 300 000 different different shadesshades of colour. of colour.

Page 39: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 3939

Colour SystemsColour SystemsColour MatchingColour Matching

For practical purposes, the physical descrip-For practical purposes, the physical descrip-tion of colour is abandoned in favour of a more tion of colour is abandoned in favour of a more natural way of describing what we see.natural way of describing what we see.

Any colour shade can be matched by mixing Any colour shade can be matched by mixing three monochromatic primary colours, by three monochromatic primary colours, by definition.definition.

Colour matching is an important problem for Colour matching is an important problem for commercial users of print and video.commercial users of print and video.

Page 40: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 4040

Colour SystemsColour SystemsPrimary ColoursPrimary Colours

In the real world we do not have pure, single-In the real world we do not have pure, single-wavelength colour sources to add - this means wavelength colour sources to add - this means that some colour shades are impossible to that some colour shades are impossible to match.match.

A way of specifying colours in a sensible way A way of specifying colours in a sensible way was developed by the CIE (Comission was developed by the CIE (Comission Internationale de L’Eclairage) in 1931.Internationale de L’Eclairage) in 1931.

The CIE chromaticity diagram is widely used.The CIE chromaticity diagram is widely used.

Page 41: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 4141

Colour SystemsColour SystemsThe CIE Chromaticity DiagramThe CIE Chromaticity Diagram

The CIE diagram represents The CIE diagram represents all hue and saturation values, all hue and saturation values, with normalised intensity. with normalised intensity. The outer curve represents The outer curve represents all the visible 100% saturated all the visible 100% saturated or pure colours.or pure colours.

Cyan

Blue

RedWhite

Yellow

Green

Magenta

Page 42: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 4242

Colour SystemsColour SystemsThe RGB colour cubeThe RGB colour cube

A system with three A system with three independent variables independent variables can be represented by a can be represented by a three-dimensional three-dimensional position.position.

The RGB colour cube The RGB colour cube represents all of the represents all of the colours that an RGB colours that an RGB monitor can create, in a monitor can create, in a non-normalized form.non-normalized form.

YellowGreen

White

Black

Cyan

Blue Magenta

Red(Greys)

Page 43: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 4343

Colour SystemsColour SystemsThe RGB colour cubeThe RGB colour cube

A system with three A system with three independent variables independent variables can be represented by a can be represented by a three-dimensional three-dimensional position.position.

The RGB colour cube The RGB colour cube represents all of the represents all of the colours that an RGB colours that an RGB monitor can create, in a monitor can create, in a non-normalized form.non-normalized form.

Yellow

Green

WhiteCyan

Blue

Magenta

Red

Page 44: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 4444

Colour SystemsColour SystemsThe HSV modelThe HSV model

Hue, Saturation, Value is a Hue, Saturation, Value is a more intuitive model.more intuitive model.

““Value” is brightness, Value” is brightness, constant value hexagons constant value hexagons lie parallel to the top lie parallel to the top surface.surface.

Grey shades run up the Grey shades run up the vertical axis, black at the vertical axis, black at the bottom and white at the bottom and white at the top.top. V=0

Green 120 Yellow 60

Cyan 180Red 0

Blue 240 Magenta 300

V=1

Page 45: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 4545

Colour SystemsColour SystemsThe HLS modelThe HLS model

The Hue, Lightness, Saturation The Hue, Lightness, Saturation model was developed by model was developed by Tektronix.Tektronix.

HLS is similar to HSV but with a HLS is similar to HSV but with a double cone.double cone.

This and other models are This and other models are combinations of the CIE, RGB combinations of the CIE, RGB and HSV models.and HSV models.

Translations are always possible.Translations are always possible. L=0

Green 120

Yellow 180

Cyan 60

Red 240

L=1

Blue 0

Magenta 300

Page 46: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 4646

ReferencesReferences

http://www.efg2.com/Lab/Library/http://www.efg2.com/Lab/Library/ImageProcessingImageProcessing/DHALF.TXT/DHALF.TXT - dither.txt – everything you ever - dither.txt – everything you ever wanted to know about dithering!wanted to know about dithering!

Computer Graphics, (C version) by D. Hearn and Computer Graphics, (C version) by D. Hearn and P. Baker:P. Baker:Section 4 of Chapter 15, Halftone Patterns and Section 4 of Chapter 15, Halftone Patterns and

Dithering TechniquesDithering TechniquesChapter 15, Colour Models and Colour Applications Chapter 15, Colour Models and Colour Applications

Page 47: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 4747

Digital Image Processing

Some Special TechniquesSome Special TechniquesThinning (Lọc xương)Thinning (Lọc xương)

Page 48: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 4848

ThinningThinning

Các pixel trên một ảnh có thể chia làm 2 loại:Các pixel trên một ảnh có thể chia làm 2 loại: Pixel nềnPixel nền Pixel thuộc một đối tượngPixel thuộc một đối tượngỞ đây ta chỉ quan tâm đến loại sau.Ở đâ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 Các pixel thuộc một đối tượng lại có thể chia làm 2 loại:làm 2 loại:

Điểm biênĐiểm biên Điểm bên trongĐiểm bên trong

Thinning là quá trình biến đổi để trên ảnh chỉ Thinning là quá trình biến đổi để trên ảnh chỉ còn các điểm biên và nền.còn các điểm biên và nền.

Page 49: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 4949

ThinningThinning

ThinningThinning là quá trình loại bỏ các pixel phụ là quá trình loại bỏ các pixel phụ (dư thừa) để làm đối tượng trở nên đơn g(dư thừa) để làm đối tượng trở nên đơn giiản ản hơnhơn, ch, chỉỉ g gồmồm c cácác th thànhành ph phầnần m mảnhảnh, kh, khôông ng ccóó di diệnện t tích. ích.

Thinning rất giống với phép co: xóa liên tiếp 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 các pixel dư thừa cho đến khi chỉ còn khung xương đối tượng. xương đối tượng.

Page 50: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 5050

ThinningThinning

ThinThinnning phải thỏa các tính chất cơ bản sau:ing 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Đố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 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.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 Đảm bảo tính liên thông giống như đối tượng ban

đầu.đầu.

Page 51: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 5151

Thuật toán Zhang – SuenThuật toán Zhang – Suen

Tư tưởng cơ bản:Tư tưởng cơ bản: Việc giải quyết có xóa hay không xóa 1 pixel sẽ 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ó.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 Bốn quy tắc để quyết định xóa hay không

xóa 1 pixelxóa 1 pixel::

Page 52: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 5252

Quy tắc 1Quy tắc 1

Pixel Pixel pp có thể được xóa nếu 1 < N8( có thể được xóa nếu 1 < N8(pp) < 7 với ) < 7 với N8(N8(pp) là số lân cận 8 của ) là số lân cận 8 của p.p.

Điều kiện N8(Điều kiện N8(pp) > 1 đảm bảo điểm đầu mút của đối ) > 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. tượng không bị xóa, không bị bào mòn.

Điều kiện N8(Điều kiện N8(pp)<7 đảm bảo đối tượng không bị đục )<7 đảm bảo đối tượng không bị đục lỗ (trong trường hợp N8(lỗ (trong trường hợp N8(pp)=8) hoặc bào mòn quá )=8) hoặc bào mòn quá mức (trong trường hợp N8(mức (trong trường hợp N8(pp)=7).)=7).

Page 53: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 5353

Quy tắc 2:Quy tắc 2:

Pixel Pixel pp được xóa nếu chỉ số đếm (counting được xóa nếu chỉ số đếm (counting index hay crossing index - CI) của nó bằng 1. index hay crossing index - CI) của nó bằng 1.

Định nghĩa:Định nghĩa: Chỉ số đếm là số ngã rẽ từ pixel Chỉ số đếm là số ngã rẽ từ pixel đang xét.đang xét.

Page 54: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 5454

Cách tính Cách tính crossing index - CIcrossing index - CI

Ví dụ:Ví dụ:

pp

CI=0

11

11 pp

11 11CI=1

11 11

11 pp

11 11CI=2

11 pp

11CI=2

11 11

11 pp

11CI=3

11 11

pp

11 11CI=4

Page 55: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 5555

Quy tắc 3:Quy tắc 3:

Trong pha thứ nhất, ảnh sẽ được quét từ Trong pha thứ nhất, ảnh sẽ được quét từ trên xuống dưới và từ trái sang phải. trên xuống dưới và từ trái sang phải. MMột ột pixel chỉ được xóa nếu thỏa cả 2 điều kiệnpixel 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 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.Có ít nhất 1 trong các lân cận 3, 5, 7 là pixel nền.

11

77 pp 33

55

Page 56: Some Technics

04/27/2304/27/23 Duong Anh Duc - Digital Image ProcessingDuong Anh Duc - Digital Image Processing 5656

Quy tắc 4:Quy tắc 4:

Trong pha thứ nhất, ảnh sẽ được quét từ Trong pha thứ nhất, ảnh sẽ được quét từ dưới lên trên và từ phải sang trái. dưới lên trên và từ phải sang trái. MMột pixel ột pixel chỉ được xóa nếu thỏa cả 2 điều kiệnchỉ đượ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, 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.Có ít nhất 1 trong các lân cần 1, 5, 7 là pixel nền.

11

77 pp 33

55


Recommended