edge tracking by hysteresis python

Solutions on MaxInterview for edge tracking by hysteresis python by the best coders in the world

showing results for - "edge tracking by hysteresis python"
Bodie
30 May 2019
1bottom_to_top = image.copy()
2 
3for row in range(image_row - 1, 0, -1):
4    for col in range(image_col - 1, 0, -1):
5        if bottom_to_top[row, col] == weak:
6            if bottom_to_top[row, col + 1] == 255 or bottom_to_top[row, col - 1] == 255 or bottom_to_top[row - 1, col] == 255 or bottom_to_top[
7                row + 1, col] == 255 or bottom_to_top[
8                row - 1, col - 1] == 255 or bottom_to_top[row + 1, col - 1] == 255 or bottom_to_top[row - 1, col + 1] == 255 or bottom_to_top[
9                row + 1, col + 1] == 255:
10                bottom_to_top[row, col] = 255
11            else:
12                bottom_to_top[row, col] = 0
13 
14right_to_left = image.copy()
15 
16for row in range(1, image_row):
17    for col in range(image_col - 1, 0, -1):
18        if right_to_left[row, col] == weak:
19            if right_to_left[row, col + 1] == 255 or right_to_left[row, col - 1] == 255 or right_to_left[row - 1, col] == 255 or right_to_left[
20                row + 1, col] == 255 or right_to_left[
21                row - 1, col - 1] == 255 or right_to_left[row + 1, col - 1] == 255 or right_to_left[row - 1, col + 1] == 255 or right_to_left[
22                row + 1, col + 1] == 255:
23                right_to_left[row, col] = 255
24            else:
25                right_to_left[row, col] = 0
26 
27left_to_right = image.copy()
28 
29for row in range(image_row - 1, 0, -1):
30    for col in range(1, image_col):
31        if left_to_right[row, col] == weak:
32            if left_to_right[row, col + 1] == 255 or left_to_right[row, col - 1] == 255 or left_to_right[row - 1, col] == 255 or left_to_right[
33                row + 1, col] == 255 or left_to_right[
34                row - 1, col - 1] == 255 or left_to_right[row + 1, col - 1] == 255 or left_to_right[row - 1, col + 1] == 255 or left_to_right[
35                row + 1, col + 1] == 255:
36                left_to_right[row, col] = 255
37            else:
38                left_to_right[row, col] = 0
39