Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

double_threshold #1

Open
james77777778 opened this issue Dec 12, 2019 · 0 comments
Open

double_threshold #1

james77777778 opened this issue Dec 12, 2019 · 0 comments

Comments

@james77777778
Copy link

I think task4: double_threshold has an error that we should use x, y to check the neighbors which might be a strong edge pixel.
Following is my correct version and it works.

for i in index_weak_edge_pixel:
    x = i[0]
    y = i[1]
    if(x > 0 and y > 0 and x < 511 and y < 511):
        north = (x-1, y)
        south = (x+1, y)
        east = (x, y+1)
        west = (x, y-1)
        north_east = (x-1, y+1)
        north_west = (x-1, y-1)
        south_west = (x+1, y-1)
        south_east = (x+1, y+1)
        # check if any of the 8 neighbors is a strong edge pixel
        if((strong_edge_pixel[north] > 0) or
           (strong_edge_pixel[south] > 0) or
           (strong_edge_pixel[east] > 0) or
           (strong_edge_pixel[west] > 0) or
           (strong_edge_pixel[north_east] > 0) or
           (strong_edge_pixel[north_west] > 0) or
           (strong_edge_pixel[south_west] > 0) or
           (strong_edge_pixel[south_east] > 0)):
            final_image[x][y] = 1  # classify the pixel as an edge pixel

I just notify if others want to use this code and thanks author for this great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant