## NeatVision Counters

Mar 302010

### 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. Using a threshold of 100, the image is converted to binary. The image is passed through an erode loop twice to thin the lines making it easier for the limb end detector. The limb end detector marks the ends of each line. Each line has 2 points. 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. Using a threshold of 100, the image is converted to binary. Hough transform will only work with a binary image. The Hough Transform is used to segment and detect the number of lines. Using a threshold of 100, the image is converted to binary again. The image is eroded 5 times, to remove the excess data and dilated once. Whiteblobcount is used to count the lines. # Chapter 2 – Testing

## Salt and Pepper Noise :

The maximum threshold of Salt and Pepper Noise is 0.0001.  B.

Salt and Pepper Noise :

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

Gaussian Noise :

The maximum threshold of Gaussian Noise is 0.8.  B.

Gaussian Noise :

The maximum threshold of Gaussian Noise is 1.3.

A.

Raleigh Noise :

The maximum threshold of Raleigh Noise is 26.  B.

Raleigh Noise :

The maximum threshold of Raleigh Noise is 17.7.  A.

Poisson Noise :

The maximum threshold of Poisson Noise is 27.  B.

Poisson Noise :

The maximum threshold of Poisson Noise is 16.0.  A.

This system is not robust to additive noise.

B.

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  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.  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. B.

Maximum Width Threshold

The maximum threshold of the width is 274.  Distorting Height

A.

Maximum Height Threshold :

The maximum height was 263. 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. 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. B.

Robustness to Image Rotation 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. # 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

NeatVision Counters

VN:F [1.8.8_1072]
VN:F [1.8.8_1072]

## Edge Detection And NeatVision Counter

Mar 302010

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.

# Chapter 1. Review

## 1.1 Laplacian Edge Detector:

The NeatVision implementation used to demonstrate this detector is shown in Figure
1.1. [A] 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.  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.  This result is off no use to our
aim. ### 2.2.2 YUV Colour Plane:

This plane matches the human perception of colour better than the previous.  The V output has the most distinctive difference. ### 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.   The A output is promising as it is very distinctive.

### 2.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.  This plane is off no use to this particular task. ### 2.2.5 CMY Colour Plane

This outputs cyan, magenta and yellow.  This plane is not relevant. ### 2.2.6 HSI Color Plane

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

### 2.2.7 YIQ Colour Plane

This plane has two separate components, Luminance Y, the brightness information and the Chrominance, the colour information.  The I and Q output were selected to go through to testing as the contrast is quite distinctive. ## 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.  ## 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. ## 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.

### Revised Program:

This calculates the threshold using the MIDTHRESH operator which sets it to 127. ## 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.

## 2.7 Revised Counter: # 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 Revised Counter:
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%. 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%.

### Revised Counter:

The threshold level was 24 for Raleigh with an accuracy rating of 96%. ### 3.1.5 Poisson Noise

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

### Revised Counter:

The Poisson threshold was 28 with 90% accuracy.

## 3.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.

### Revised Counter:

The minimum threshold was the same 196 x 208.

### 3.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.

### Revised Counter:

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

### 3.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. The maximum threshold for width is 291.

### 3.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. The maximum threshold is a disappointing 309.

## 3.3 Robustness to 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 The .pdf version of this report is available below.

Edge Detection And NeatVision Counter

VN:F [1.8.8_1072]