Weird edge detection behavior when the blurred image border pixel extrapolation method changes
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 1k
- Avg merge
- 22h 17m
- Merged PRs (30d)
- 3
Description
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied Python reproduction with OpenCV 4.10.0 and compare the GaussianBlur outputs and subsequent Canny results for BORDER_REPLICATE and BORDER_DEFAULT. Trace how the GaussianBlur border argument is handled and determine whether the differing edge results are expected; done means the behavior has a clear resolution and is corrected or documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- opencv, python
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100