Using NeatVision, a Java based image analysis and software development environment, which provides high level access to a wide range of image processing algorithms, I had to solve a number of problems.

Part 1 :

Compare and contrast the Roberts and Laplacian approaches to edge detection. Illustrate the tolerance to Gaussian noise of these operators with sample images of your own face.

Part 2 :

Develop a robust NeatVision program capable of automatically counting the number of surface mount components found in the image illustrated below, comp2.gif. State any assumptions clearly.

Chapter 1. Review

1.1 Laplacian Edge Detector:

The NeatVision implementation used to demonstrate this detector is shown in Figure
1.1. [A]

Figure 1.1 – Laplacian Edge Detector with/out Gaussian Interference & Figure 1.2 – Image passed through Laplacian Filter with Gaussian Noise, threshold of 10, of my face

There is a significant amount of distortion in the above image.

1.2 Roberts Edge Detector:

The program used to evaluate this technique is shown in Figure 1.3.

Figure 1.3 – Roberts Edge Detector with/out Gaussian Interference & Figure 1.4 – Image passed through Laplacian Filter with Gaussian Noise, threshold of 10, of my face


Figure 1.5 – Image passed through Laplacian Filter with Gaussian Noise, maximum threshold, of my face

These results show that the Laplacian operator is extremely sensitive to Gaussian noise.

Chapter2. Design

I completed this assignment before I realized that I was not allowed to use the SINGLE threshold operator with my choice of threshold. I have included the design and results of my original program and my new program which utilizes the MIDTHRES operator.

2.1 Rationale

In order to count the components in comp2, the image must be transformed to binary, the background as black and the components as white. The background would need to be removed. This will be done by separating the image into its individual RBG values.

2.1.1 Outline of Procedure

I. Split the image into RBG values
II. Remove the circuit board from the background.
III. Remove all limb ends.
IV. Convert Image to Binary
V. Use REMISO
VI. Use DILATE
VII. Use ERODE
VIII. Use WHITEBLOBCOUNT

2.2 Colour Plane Extraction

I tested all colour plane extractors and recorded all results. The aim of this is to
remove the background, the green PCB board.

2.2.1 RGB Colour Plane

The output of this plane is Red, Green and Blue. [1] This result is off no use to our
aim.

Figure 2.1 – RGB Colour Plane System & Figure 2.2 – RGB Colour Plane Image Output

2.2.2 YUV Colour Plane:

This plane matches the human perception of colour better than the previous. [1] The V output has the most distinctive difference.

Figure 2.3 – YUV Colour Plane System & Figure 2.4 – YUV Colour Plane Image Output

2.2.3 LAB Colour Plane

This plane is contains the most complete colour model when describing the colours visible to the human eye. It is perceptually linear meaning that a change of the same amount in a color value should produce a change of about the same visual importance.  [2] The A output is promising as it is very distinctive.

Figure 2.5 – LAB Colour Plane System & Figure 2.6 – LAB Colour Image Output2.2.4 XYZ Colour Plane

This is based on direct measurements of the human eye, and serves as the basis from which many other color spaces are defined. [3] This plane is off no use to this particular task.

Figure 2.7 – XYZ Colour Plane System & Figure 2.8 – XYZ Colour Plane Image Output

2.2.5 CMY Colour Plane

This outputs cyan, magenta and yellow. [4] This plane is not relevant.

Figure 2.9 – CMY Colour Plane System & Figure 2.10 – CMY Colour Plane System

2.2.6 HSI Color Plane

This outputs Hue, Saturation and Intensity of an image. [1] This is better than the previous but ultimately of no use.

Figure 2.11 – HSI Colour Plane System & Figure 2.12 – HSI Colour Plane Image Output2.2.7 YIQ Colour Plane

This plane has two separate components, Luminance Y, the brightness information and the Chrominance, the colour information. [1] The I and Q output were selected to go through to testing as the contrast is quite distinctive.

Figure 2.13 – YIQ Colour Plane System & Figure 2.14 – YIQ Colour Plane Image Output

2.3 Selection of Colour Plane:

The V output from the YUV plane, A output from the LAB plane, I and Q outputs from the YIO planes were tested in the following manner, Figure 2.15. The results achieved are displayed in Figure 2.16 and 2.17. I chose the YUV plane, the left image of Figure 2.16, as this had the least amount of isolated white pixels compared to its counterparts. The components looked fuller.

Figure 2.15 – Colour Plane Selection & Figure 2.16 – Left Image: YUV V Output, Right Image: LAB A Output

Figure 2.17 – Left Image: YIQ I Output, Right Image: YIQ Q Output

2.4 Removing the noise:

Utilizing the V signal, I tested both combinations of the OPEN and CLOSE operators and tested the ERODE operator. [A] The erode operator would be used later on in this project. The right image in Figure shows the CLOSE followed by OPEN which is more satisfactory as the image looks more fuller and there are less white pixels found in the components. They would be more resistant to the erode operator when removing the rails.

Figure 2.18 – Noise Removal Selection & Figure 2.19 – Left Image: OPEN CLOSE, Right Image: CLOSE OPEN

2.5 Dynamic Threshold and Inversion:

The ACC operator was added to convert the image to grey scale in order to perform dynamic thresholding of the image. The average intensity of each pixel of the image was calculated with a cast from a Double to an Integer, DtoI, operator. The threshold was set to 140. This was fed through the SINGLE threshold operator. The image was inverted after going through the INV operator as shown in Figure 2.21. This image is now a binary representation of the original image.

Figure 2.20 – Dynamic Threshold and Inversion & Figure 2.21 – Image Output after Thresholding and InversionRevised Program:

This calculates the threshold using the MIDTHRESH operator which sets it to 127.

Figure 2.22 – Medium Thresholding and Inversion - Figure 2.23 – Image Output after Medium Thresholding and Inversion

2.6 Removing Components and Counter:

Initially I had 3 loops, ERODE, REMISO and DILATE but I was able to limit the REMISO to a single operation. The erode loop “erodes” 6 times and the REMISO removes isolated white pixels. The final loop dilates the image 12 times before being counted by the WhiteBlobCount er. The output INT shows the correct amount of components, 17.

Figure 2.25 – Removal of Components and Counter with a Dynamic Threshold - Figure 2.26 – Final Image Output after Counting2.7 Revised Counter:

Figure 2.27 – Removal of Components and Counter with a Static Medium Threshold - Figure 2.28 – Final Image Output after Counting

Chapter 3. Testing

3.1 Robustness to Image Noise

The program was tested 50 times for each Noise Generator.

3.1.1 Salt and Pepper Noise:

At 0.12, the accuracy of my program is only 52%. At 0.04, this rises to 92%.
0.04

Figure 3.1 – Dynamic Thresholder with Salt and Pepper Noise, threshold of 0.04 - Figure 3.2 – Image Output after Salt n Pepper Noise, threshold of 0.04

Revised Counter:
0.03

Figure 3.3 – Static Thresholder with Salt and Pepper Noise, threshold of 0.03 - Figure 3.4 – Image Output after Salt n Pepper Noise, threshold of 0.03

3.1.2 Gaussian Noise:

This was tested in the same manner as the previous. The threshold level of Gaussian noise was 67 with an accuracy rating of 92%.

Figure 3.7 – Medium Thresholder with Gaussian Noise, threshold of 50 - Figure 3.8 – Image Output after Gaussian Noise, threshold of 50

3.1.3 Additive Noise

Neither program functioned with any white noise.

3.1.4 Raleigh Noise

The threshold level of Raleigh noise was 45 with an accuracy rating of 92%.

Figure 3.9 – Dynamic Thresholder with Raleigh Noise, threshold of 45 - Figure 3.10 – Image Output after Raleigh Noise, threshold of 45Revised Counter:

The threshold level was 24 for Raleigh with an accuracy rating of 96%.

Figure 3.11 – Static Thresholder after Raleigh Noise, threshold of 24 - Figure 3.12 – Image Output after Raleigh Noise, threshold of 24

3.1.5 Poisson Noise

The threshold level of Poisson noise was 42 with an accuracy rating of 94%.

Figure 3.13 – Dynamic Thresholder with Poisson Noise, threshold of 42 - Figure 3.14 – Image Output after Poisson Noise, threshold of 42Revised Counter:

The Poisson threshold was 28 with 90% accuracy.

Figure 3.15 – Static Thresholder with Poisson Noise, threshold of 28 - Figure 3.16 – Image Output after Poisson Noise, threshold of 283.2 Robustness to Scaled Images

I kept the image approximately the same proportion as the original, 286 x 300. The image was scaled using the SCALE operator. The image scaled down considerably but scaling up was not as significant.

3.2.1 Minimum Threshold

Figure shows the program to scale down and the results are in Figure. The minimum threshold resulted of the image is 196 x 208.

Figure 3.17 – System to Scale Images - Figure 3.18 – Left: Original Image, Right: Minimum Scaled ImageRevised Counter:

The minimum threshold was the same 196 x 208.

Figure 3.19 – Revised System to Scale Images - Figure 3.20 – Left: Original Image, Right: Minimum Scaled Image3.2.2 Maximum Threshold

I scaled the image using the same method as the previous stage. The maximum threshold of the image was 297 x 309.

Figure 3.21 – System to Scale Images - Figure 3.22 – Left: Original Image, Right: Maximum Scaled ImageRevised Counter:

The maximum threshold of the image was the same at 297 x 309.

Figure 3.23 – Revised System to Scale Images - Figure 3.24 – Left: Original Image, Right: Maximum Scaled Image3.2.3 Distorting Width

The result for both programs was the same. The height remained unchanged while the width was altered. The minimum threshold for width is 216.

Figure 3.25 – Left: Original Image, Right: Minimum Width ThresholdThe maximum threshold for width is 291.

Figure 3.26 – Left: Original Image, Right: Maximum Width Threshold3.2.4 Distorting Height

The result for both programs was the same. The width remained unchanged while the height was altered. The minimum threshold is 202.

Figure 3.27 – Left: Original Image, Right: Minimum Height ThresholdThe maximum threshold is a disappointing 309.

Figure 3.28 – Left: Original Image, Right: Maximum Height Threshold3.3 Robustness to Image Rotation

Figure 3.29 – Dynamic Thresholder with Image Rotation - Figure 3.30 – Static Thresholder with Image Rotation

Results for both systems were identical. The rotate operator was used to rotate the image. Initially I had the original image rotated but this was not working as the ROTATE operator utilizes grey scale images. The program worked correctly for 0, 90, 270 and 360 degrees. 180 did not work.
The threshold degree values were calculated. The ranges giving correct results were 0–2, 90–92, 264-272 and 355-362.

3.4 Robustness to another image

The program was tested with comp1.jpg and resulted with the correct output, 9.

Bibliography:

A. Machine Vision Algorithms in Java, Paul F. Whelan and Derek Molloy.

References:

1. http://www.eeng.dcu.ie/%7Ewhelanp/EE425/protected_material/, EE425
Course Notes, Colour Image Analysis
2. http://en.wikipedia.org/wiki/Lab_color_space
3. http://en.wikipedia.org/wiki/Xyz_color_space
4. http://en.wikipedia.org/wiki/Color_models#CMYK_color_model
5. www.neatvision.com, NeatVision Developers Guide

Figure 3.31 – Final Program with a Different ImageThe .pdf version of this report is available below.

Edge Detection And NeatVision Counter

VN:F [1.8.8_1072]
Rating: 0.0/10 (0 votes cast)
VN:F [1.8.8_1072]
Rating: 0 (from 0 votes)

Related posts:

  1. NeatVision Counters
  2. Java Paint Applet
  3. Macromedia’s Flash For Remote Access Medical Imaging
  4. C++ Compression / Decompression Application

Leave a Reply

(required)

(required)