|
Algorithm 3 Connected Domain Filtering Method |
| Part I |
1: |
Give a gray binary image or a gradient binary image . |
| 2: |
Process and get ’s anti-color image . |
| 3: |
Get the connected domain set and the number k of the connected domain. |
| 4: |
fori = 1, …, k
do
|
| 5: |
Get the area of the connected domain , the minimum bounding rectangle (with length and width ). |
| 6: |
Set each value of . |
| 7: |
if
is satisfied |
| 8: |
is judged to be a defect. |
| 9: |
end
|
| 10: |
end
|
| 11: |
Output the results. |
| Part II |
1: |
Given a gradient binary image . |
| 2: |
Get the width of . |
| 3: |
Set the step length and a rectangular search box with a width of and a length of . Set number of connected domains . |
| 4: |
fori = 1, …, …, do |
| 5: |
Use to traverse from top to bottom in steps of . |
| 6: |
For the
, get k connected domains. |
| 7: |
for
j = 1, …, k
do
|
| 8: |
Get the area of the connected domain , the minimum bounding rectangle (with length and width ). |
| 9: |
Set each value of . |
| 10: |
if
is satisfied. |
| 11: |
and save the coordinate of the connected domain . |
| 12: |
end
|
| 13: |
end
|
| 14: |
Set and . |
| 15: |
if
is satisfied. |
| 16: |
The
contains defects. |
| 17: |
end
|
| 18: |
end
|
| 19: |
Output the results. |