AdeptSight Image Processing Tools Lee Haney January 21, 2010.

42
AdeptSight Image Processing Tools Lee Haney January 21, 2010

Transcript of AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Page 1: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

AdeptSight Image Processing Tools

Lee HaneyJanuary 21, 2010

Page 2: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Background information...

I was raised in North Webster, Indiana.

Page 3: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Proof positive the rumor is false!!!

Page 4: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

What are image processing tools?

• Most tools locate or measure.– Histogram/caliper– Line finder – Blob finder

• Image processing tool modifies an image.– Input image is acted upon by tool.– New image buffer is the result.– Some operations require two images.– Multiple tools can be combined.

Input Image

New Image

Operation

Page 5: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Why use them?

• Locator tool may be insufficient– Variably-shaped part

• Poor illumination– Uneven lighting surface

• Need to enhance or modify features

Page 6: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Types of image processing tools

• Assignment• Arithmetic• Logical• Filtering• Morphological• Histogram• Transform• Color matching

Page 7: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Tool Parameters

• Operation• Source image• Operand image• Scaling• Clipping• Data type

Page 8: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Scaling

• Occurs after tool operation .• Each resulting pixel is multiplied by

scale factor.• Scaling factor can range from 0-10,000• Not all operations support scaling.

Page 9: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Clipping

• Computations can result in new values which extend past data type boundaries.

• Performed after image processing and scaling.

• Normal clipping– Result < minimum, set output to minimum.– Result > maximum, set output to maximum.

• Absolute clipping– Absolute value of result– Result > maximum, set output to maximum.

Page 10: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

AdeptSight 3 Considerations

• Data types– Unsigned 8-bit integer (0-255)– Signed 16-bit integer – Signed 32-bit integer – However, stick to the default 8-bit integer.

• Cannot work on color images

Page 11: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Types of image processing tools

• Assignment• Arithmetic• Logical• Filtering• Morphological• Histogram• Transform• Color matching

Page 12: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Assignment Operations

• Initialization– Output image pixels are set to constant

value.– Specify image size.

• Copy– Input image is copied to output image.

• Inversion– Input pixels are inverted (255-pixel).

• No scaling and clipping is needed.

Page 13: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Types of image processing tools

• Assignment

• Arithmetic• Logical• Filtering• Morphological• Histogram• Transform• Color matching

Page 14: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Arithmetic Operations

• Two modes for usage.– Input image and operand image.– Input image and constant.

• Addition• Subtraction• Multiplication• Division• Lightest – Maximum value used.• Darkest – Minimal value used.• Scaling and clipping are options.

Page 15: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Types of image processing tools

• Assignment• Arithmetic

• Logical• Filtering• Morphological• Histogram• Transform• Color matching

Page 16: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Logical Operations

• Requires two images of same size.• Logical operator performed on pixel by

pixel basis.• Supported operations

– AND– NAND– OR– NOR– XOR

• No scaling and clipping option.

Page 17: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Types of image processing tools

• Assignment• Arithmetic• Logical

• Filtering• Morphological• Histogram• Transform• Color matching

Page 18: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Filtering Basics

• Neighboring pixels in input image are processed to determine value of output pixel.

• Kernel specifies size of neighborhood and the weighting of each pixel.

Page 19: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Averaging Kernel

• Pixel from input image is replaced in output image by the average of all pixels in kernel.

• Removes noise and blurs edges.

3x3

1 1 1

1 1 1

1 1 1

5x5

1 1 1 1 1

1 1 1 1 1

1 1 1 1 1

1 1 1 1 1

1 1 1 1 1

7x7

1 1 1 1 1 1 1

1 1 1 1 1 1 1

1 1 1 1 1 1 1

1 1 1 1 1 1 1

1 1 1 1 1 1 1

1 1 1 1 1 1 1

1 1 1 1 1 1 1

Page 20: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Gaussian Kernel

• Acts like a low-pass filter.• Removes noise.• Blurs image.

3x3

1 2 1

2 4 2

1 2 1

5x5

2 7 12 7 2

7 31 52 31 7

12 52 127 52 12

7 31 52 31 7

2 7 12 7 2

7x7

1 1 2 2 2 1 1

1 3 4 5 4 3 1

2 4 7 8 7 4 2

2 5 8 10 8 5 2

2 4 7 8 7 4 2

1 3 4 5 4 3 1

1 1 2 2 2 1 1

Page 21: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Horizontal Prewitt Kernel

• Detects horizontal gradients or edges.• Typically used with absolute clipping.• May need to scale.

3x3

1 1 1

0 0 0

-1 -1 -1

Page 22: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Vertical Prewitt Kernel

• Detects vertical gradients or edges.• Typically used with absolute clipping.• May need to scale.

3x3

-1 0 1

-1 0 1

-1 0 1

Page 23: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Sobel Horizontal Kernel

• Responds to horizontal edges.• Typically use in absolute clipping mode.• May need to scale.

3x3

1 2 1

0 0 0

-1 -2 -1

5x5

1 4 7 4 1

2 10 17 10 2

0 0 0 0 0

-2 -10 -17 -10 -2

-1 -4 -7 -4 -1

7x7

1 4 9 13 9 4 1

3 11 26 34 26 11 3

3 13 30 40 30 13 3

0 0 0 0 0 0 0

-3 -13 -30 -40 -30 -13 -3

-3 -11 -26 -34 -26 -11 -3

-1 -4 -9 -13 -9 -4 -1

Page 24: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Sobel Vertical Kernel

• Responds to vertical edges.• Typically use in absolute clipping mode.• May need to scale.

3x3

-1 0 1

-2 0 2

-1 0 1

5x5

-1 -2 0 2 1

-4 -10 0 10 4

-7 -17 0 17 7

-4 -10 0 10 4

-1 -2 0 2 1

7x7

-1 -3 -3 0 3 3 1

-4 -11 -13 0 13 11 4

-9 -26 -30 0 30 26 9

-13 -34 -40 0 40 34 13

-9 -26 -30 0 30 26 9

-4 -11 -13 0 13 11 4

-1 -3 -3 0 3 3 1

Page 25: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Laplacian Kernel

• Circular gradient filter.• Highlights all edges.• Typically use in absolute clipping mode.

3x3

-1 -1 -1

-1 8 -1

-1 -1 -1

5x5

-1 -3 -4 -3 -1

-3 0 6 0 -3

-4 6 20 6 -4

-3 0 6 0 -3

-1 -3 -4 -3 -1

7x7

-2 -3 -4 -6 -4 -3 -2

-3 -5 -4 -3 -4 -5 -3

-4 -4 9 20 9 -4 -4

-6 -3 20 36 20 -3 -6

-4 -4 9 20 9 -4 -4

-3 -5 -4 -3 -4 -5 -3

-2 -3 -4 -6 -4 -3 -2

Page 26: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Sharpen Kernel

• Output pixels are the subtraction of the average of the input image pixels.

3x3

-1 -1 -1

-1 9 -1

-1 -1 -1

5x5

-1 -1 -1 -1 -1

-1 -1 -1 -1 -1

-1 -1 25 -1 -1

-1 -1 -1 -1 -1

-1 -1 -1 -1 -1

7x7

-1 -1 -1 -1 -1 -1 -1

-1 -1 -1 -1 -1 -1 -1

-1 -1 -1 -1 -1 -1 -1

-1 -1 -1 49 -1 -1 -1

-1 -1 -1 -1 -1 -1 -1

-1 -1 -1 -1 -1 -1 -1

-1 -1 -1 -1 -1 -1 -1

Page 27: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

SharpenLow Kernel

• Sharpens and smooths at the same time.

3x3

-1 -1 -1

-1 16 -1

-1 -1 -1

5x5

-1 -3 -4 -3 -1

-3 0 6 0 -3

-4 6 40 6 -4

-3 0 6 0 -3

-1 -3 -4 -3 -1

7x7

-2 -3 -4 -6 -4 -3 -2

-3 -5 -4 -3 -4 -5 -3

-4 -4 9 20 9 -4 -4

-6 -3 20 72 20 -3 -6

-4 -4 9 20 9 -4 -4

-3 -5 -4 -3 -4 -5 -3

-2 -3 -4 -6 -4 -3 -2

Page 28: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Median Filter

• Output pixel is equal to the input image’s neighborhood median.

• Reduces impulsive noise.• Doesn’t destroy edges by blurring as an

averaging filter does.• Non-linear filter

Page 29: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Custom Kernel

• Define kernel that you want.• Currently no way to define this kernel.• Not sure if this will be supported.

Page 30: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Types of image processing tools

• Assignment• Arithmetic• Logical• Filtering

• Morphological• Histogram• Transform• Color matching

Page 31: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Dilate Operation

• Output pixel is replaced by highest grey value of kernel neighborhood.

• Results in expanded of bright regions.• Operation is typically iterated.• Useful for connecting broken regions.• AdeptSight kernel is limited to 3x3.

Page 32: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Erode Operation

• Output pixel is replaced by lowest grey value of kernel neighborhood.

• Results in expanded of dark regions.• Operation is typically iterated.• Useful for removing thin light areas.• AdeptSight kernel is limited to 3x3.

Page 33: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Close Operation

• Equivalent to a dilate operation followed by an erode operation.

• Has the effect of removing small dark particles and holes

Page 34: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Open Operation

• Equivalent to an erode operation followed by a dilate operation.

• Has effect of removing peaks from an image, leaving only the image background.

Page 35: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Types of image processing tools

• Assignment• Arithmetic• Logical• Filtering• Morphological

• Histogram• Transform• Color matching

Page 36: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Equalization Operation

• Enhances the input image by flattening the histogram of the input image.

• Equalization is more beneficial for human viewers than machine vision.

Page 37: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Stretching Operation

• Increases the contrast an image.• Applies a simple piecewise linear

intensity transformation based on the input image’s histogram.

Page 38: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Light/Dark Threshold Operations

• Operation compares each pixel value to specified threshold.

• If light threshold, pixels >= threshold are set to max, remaining set to min.

• If dark threshold, pixels <= threshold are set to max, remaining set to min.

Page 39: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Types of image processing tools

• Assignment• Arithmetic• Logical• Filtering• Morphological• Histogram

• Transform• Color matching

Page 40: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Transform Operations

• Fast Fourier Transform (FFT) • Discrete Cosine Transform (DCT)• Results

– 1D Linear– 2D Linear – 2D Logarithmic– Histogram

• Unlikely you will use transforms.

Page 41: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Types of image processing tools

• Assignment• Arithmetic• Logical• Filtering• Morphological• Histogram• Transform

• Color Matching

Page 42: AdeptSight Image Processing Tools Lee Haney January 21, 2010.

Color Matching

• Executes on 3-band images.• Create 1 or more filters

– Specify target color as RGB or HSL– Define range in HSL coordinates

• Filters are applied to each pixel.• Resulting image can be color or

grayscale.• Segments image into similar colors

– Use locator or blob tool to locate instances.

• Be mindful of tool’s processing time.