Develop a two NeatVision programs capable of automatically counting the number of lines in the grey scale image lines.gif in a robust manner. What are the advantages and disadvantages of each approach?


A.

NeatVision Counter

Using a threshold of 100, the image is converted to binary.

Image Converted to Binary

The image is passed through an erode loop twice to thin the lines making it easier for the limb end detector.

Erode Loop - 2 Passes

The limb end detector marks the ends of each line. Each line has 2 points.

Limb End Detector - 1 Pass

The white blob counter counts the limb ends. The mathsdivide operator divides the number of points by 2, giving the final result of 5, which is the correct number of lines.

B.

Neatvision Counter 2

Using a threshold of 100, the image is converted to binary. Hough transform will only work with a binary image.

Image Converted to Binary Counter B

The Hough Transform is used to segment and detect the number of lines.

Hough Transform

Using a threshold of 100, the image is converted to binary again.

Image Converted to Binary 2nd Pass

The image is eroded 5 times, to remove the excess data and dilated once. Whiteblobcount is used to count the lines.

Image Eroded 5 - Passes

Chapter 2 – Testing

A.

Salt and Pepper Noise :

The maximum threshold of Salt and Pepper Noise is 0.0001.

Salt and Pepper Noise Additive

Binary Image

B.

Salt and Pepper Noise :

The system is not robust to any Salt and Pepper Noise. Testing ceased at 0.000001.

Salt and Pepper Noise Additive B

A.

Gaussian Noise :

The maximum threshold of Gaussian Noise is 0.8.

Gaussian Noise Additive A

Binary Image

B.

Gaussian Noise :

The maximum threshold of Gaussian Noise is 1.3.

Gaussian Noise Additive BBinary Image

A.

Raleigh Noise :

The maximum threshold of Raleigh Noise is 26.

Raleigh Noise Additive A

Raleigh Noise Additive Test Image

B.

Raleigh Noise :

The maximum threshold of Raleigh Noise is 17.7.

Raleigh Noise Additive B

Raleigh Noise Additive Test Image B

A.

Poisson Noise :

The maximum threshold of Poisson Noise is 27.

Poisson Noise Additive A

Poisson Noise Test Image A

B.

Poisson Noise :

The maximum threshold of Poisson Noise is 16.0.

Poisson Noise Additive NeatVision Counter B

Poisson Noise Test Image B

A.

Additive White Noise :

This system is not robust to additive noise.

B.

Additive White Noise :

This system is not robust to additive noise.

Robustness to Scaled Images :

The original image is 256 x 256. The height and width were increased or decreased depending on the purpose.

A.

Minumum Scaled Threshold :

The image was scaled down but would not function. The minimum threshold is the same size as the original.

B.

Minumum Scaled Threshold :

The image was scaled down but would not function. The minimum threshold is the same size as the original.

A.

Maximum Scaled Threshold :

The maximum threshold is 260 x 260

Max Scaled Threshold NeatVision Counter A

Max Scaled Threshold NeatVision Counter A Test Image

B.

Maximum Scaled Threshold :

The image was scaled up but would not function. The maximum threshold is the same size as the original.

Distorting Width

A.

Minimum Width Threshold :

The minimum threshold of the width is 254.

Minimum Width Threshold NeatVision Counter A

Minimum Width Threshold NeatVision Counter A Test Image

B.

Minimum Width Threshold :

The width of the image was decreased but would not function. The minimum threshold is the same size as the original.

A.

Maximum Width Threshold :

The maximum width is 263.

Maximum Width Threshold NeatVision Counter A

B.

Maximum Width Threshold

The maximum threshold of the width is 274.

Maximum Width Threshold NeatVision Counter B

Maximum Width Threshold NeatVision Counter B Test Image

Distorting Height

A.

Maximum Height Threshold :

The maximum height was 263.

Maximum Height Threshold NeatVision Counter A Test Image

B.

Maximum Height Threshold :

The height of the image was increased but would not function. The maximum threshold is the same size as the original.

Maximum Height Threshold NeatVision Counter B

A.

Minimum height Threshold :

The height of the image was decreased but would not function. The minimum threshold is the same size as the original.

B.

Minimum height Threshold :

The height of the image was decreased but would not function. The minimum threshold is the same size as the original.

A.

Robustness to Image Rotation:

This system was not robust to any rotational changes.

Image Rotation NeatVision Counter A

B.

Robustness to Image Rotation

Image Rotation NeatVision Counter B

The system would only function at 0 and 180 degrees.

A.

Robustness to another image

Bcode2 was tried but the system failed.

B.

Robustness to another image

Bcode2 was tried but the system failed.

Bcode2

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. www.neatvision.com, NeatVision Developers Guide

The .pdf version of this report is available below.

NeatVision Counters

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

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)