5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis...

27
5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentatio

Transcript of 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis...

Page 1: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology

Naples 2001

12th - 14th September

Image Analysis

Lecture 5Thresholding/Segmentation

Page 2: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

basic interactive methods

•manual editting

•removal of isolated “Noise” pixelsusing SigmaScanusing HIT/MISS filters.

pre-use of low-pass filters to overcome illumination problems

Thresholding:

Page 3: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

From Lecture 3: Optimum threshold occurs at minimum in intensity histogram

•But minimum not always present

•when it is, non-uniform illumination or other illumination issues can prevent ideal segmentation and editting is needed

Page 4: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

Often individual particles may touch

Or features have “holes” in them caused by illumination problems

Page 5: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

using Sigmascan

•manually using Sigmascan•other software using feature analysis facilities

[lecture 7 will cover feature analysis in depth]

Separating touching particles:

manual approach - used in this course

A problem:

When is a particle one particle or two touching particles?

Removing “holes”

Page 6: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

a)

f)e)d)

c)b)

Which, if any, of above are considered as touching particles, and which are single particles?

Page 7: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

Filling Holes - SigmaScan Method - Step 1

Select best threshold manually

Page 8: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

Filling Holes - SigmaScan Method - Step 2

Edge particles are not filled

Page 9: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

Filling Holes - SigmaScan Method - Step 3

Remove edge features

Page 10: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

•threshold image in manner covered in practical yesterday

•display threshold in say RED overlay

•use OVERLAY/MATHS - Fill Holes option

•if required use OVERLAY/MATHS - Delete Edge objects

Removing holes - Sigmascan - summary

Page 11: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

•Threshold image as well as possible

[particle white/background black]

•Use particle/feature analysis program

•Select background, and specify minimum area of feature to be much larger than largest hole.

•This should identify only background and not holes.

•Makes background white and particles black

•Negate image so that particles are now white

Alternative Approach:where analysis is NOT done in overlay plane:

Page 12: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

Manual Editting - to separate particles - step 1

Check drawing mode overlay is green

[measurements/settings/overlays].

Also check pen thickness is 3 pixels

Use annotation tool to draw separation

Page 13: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

Manual Editting - to separate particles - step 2

Annotation will normally be more than needed, so we need to identify the region which has both the green and red overlay i.e. blue in figure.

Select OVERLAY/MATH and options as shown.

Page 14: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

Manual Editting - to separate particles - step 3

Blue shows where breaks should be - so above OVERLAY/MATH option will only show where particles are and not join.

Page 15: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

Problem where thresholding leaves small isolated pixels.

Where software has facilities for HIT and MISS transform, this may be used.

With SigmaScan the following may be used.

Page 16: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

Threshold image into overlay RED

OVERLAY/Filters as above gives image at bottom left - i.e. and erosion has reduced size of large particle, but removed small isolated pixels

NOTE: this is equivalent to normal erosion

Page 17: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

Using original RED overlay again.

OVERLAY/Filters as above gives image at bottom left - i.e. boundary of large particle is highlighted.

Page 18: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

With image at top left: OVERLAY/Maths

Select options as above - i.e.where overlay is either green or blue colour output yellow.

YELLOW overlay has desired result.

Page 19: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

In this example the output image is determined by multiplying the pixel value in question by 2 and all the 8 neighbouring ones by 1.

The kernel may be any size from 1 pixel up to almost any size, but many analysis facilities limit overall size (e.g. SigmaScan has a limit of 9 x 9 pixels).

1 1 1

1 2 1

1 1 1

Most filters operate by using a multiplier for each pixel in an area defined by a kernel.

Hit and Miss Filters: - background

78 65 64 62 61

72 70 68 60 59

70 70 66 62 60

68 72 64 61 66

72 68 61 60 62

69 66 62

69 66 63

68 65 62

78 65 64 62 61

72 70 68 60 59 69

70 70 66 62 60

68 72 64 61 66

72 68 61 60 62

78 65 64 62 61

72 70 68 60 59 69 66

70 70 66 62 60

68 72 64 61 66

72 68 61 60 62

78 65 64 62 61

72 70 68 60 59 69 66 62

70 70 66 62 60

68 72 64 61 66

72 68 61 60 62

Page 20: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

Hit and Miss Filters:

In the example, the kernel is passed over a binary image. The corresponding pixels in the output image are only ste to 1 if the kernel exactly matches the image at the location.

In this example, this match only occurs for isolated “noise” pixels.

Many HIT and MISS algorithms, have the ability to directly subtract the output value from the input image and in this way isolated pixels of “noise” can be removed directly.

These operate differently and only on BINARY IMAGES

0 0 0

0 1 0

0 0 0

a typical HIT and MISS Filter

Page 21: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

•Smooth the image over a large radius

•may be helpful when there is non-uniform illumination which would otherwise cause problems during thresholding.

•Image has non uniform illumination:

•It may be possible to generate a blank image to subtract from original.

•Otherwise, an approximation can be used.

•Process is known as image restoration

Low Pass Filters:

Page 22: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

•prepare a blank slide of resin of same thickness as normal thin sections.

•Photograph under same illumination conditions as for slide of interest.

Intensity of background may not be exactly same in both images

When a calibration image is available

Page 23: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

•Identify the intensity in both the actual (Ia) and calibration image (Io) at several locations corresponding to background

•find the ratio (R) of these intensities Ia/Io

•Subtract from actual image R * calibration image

•This should give a good estimate of restored image - usually better than using uncalibrated approach.

NOTE: In SIGMASCAN there is no direct way to add/subtract/ multiply an image by a constant - this must be done indirectly using Image/Filter and Image/Maths

Procedure:

Page 24: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

•find the ratio (R) of these intensities Ia/Io as above

•Use calibration image and filter using following custom filter. Note: the divisor should be set to value 100 / R.

In this case R = 1.96

and divisor = 100/1.96 = 51

Modification to procedure for SIGMASCAN

Page 25: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

when a calibration illumination image IS NOT VAILABLE.

generate image averaged over large radius

Image averaged using a filter radius of 72.

Radius must be chosen carefully and be larger than size of features of interest.

Usually some experimentation is necessary to find optimum radius

STEP 1:

Page 26: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

STEP 2: subtract averaged image from original

Though not perfect, the background illumination has been suppress making thresholding much easier.

Page 27: 5th Intensive Course on Soil Micromorphology Naples 2001 12th - 14th September Image Analysis Lecture 5 Thresholding/Segmentation.

5th Intensive Course on Soil Micromorphology - Naples 2001Image Analysis - Lecture 5: Thresholding/Segmentation

•Thresholding in many cases is not easy

•Aim to get good contrast of features of interest

•Minimise problems of non-uniform illumination

•May need Manual Editing to separate touching particles or fill holes or remove noise

•Accuracy of result will depend on the segmentation and care is needed

•Subjectivity may cause problems between different operators

Concluding Remarks