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

Weird edge detection behavior when the blurred image border pixel extrapolation method changes #1035

Open
Rektino opened this issue Oct 3, 2024 · 0 comments

Comments

@Rektino
Copy link

Rektino commented Oct 3, 2024

Expected behaviour

The canny edge detector should yield very similar images when the blurred image has two different pixel extrapolation methods for the border, since only the border is affected by this.

Actual behaviour

Edge detection is being affected by the selected method. When I select cv.BORDER_REPLICATE I get many more edges than when cv.BORDER_DEFAULT is selected. This does not make sense.

Steps to reproduce

Code running on Windows 11
OpenCV version : 4.10.0
Python version : 3.11.4

CODE :

img = cv.imread('../Photos/park.jpg')
#Gaussian blur
blur1 = cv.GaussianBlur(img , (7,7) , cv.BORDER_REPLICATE)
blur2 = cv.GaussianBlur(img, (7,7) , cv.BORDER_DEFAULT)
cv.imshow('Original' , img)
cv.imshow('Blurred 1' , blur1)
cv.imshow('Blurred 2' , blur2)

#Canny edge detector:
canny1 = cv.Canny(blur1 , 150,210)
cv.imshow('Canny (1) edges w/ 150-210' , canny1)

canny2 = cv.Canny(blur2 , 150 , 210)
cv.imshow('Canny (2) edges w/ 150-210' , canny2)

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