filter2D: problems with large kernels (Bug #1552)
Description
For small kernel sizes, the Python cv2-wrapper for filter2D works fine:
1import numpy as np
2import cv2
3
4# Generate a homogenous image
5img = np.uint8(np.ones((750,1000)))
6
7# For a medium size kernel, the "filter2D" works
8filterSize = 11
9myFilter = np.ones((filterSize, filterSize))/filterSize**2
10imFiltered = cv2.filter2D(img, -1, myFilter)
11print 'ok'
However, when the kernel gets any larger, "filter2D" crashes:
1# But for a larger kernel, it breaks
2filterSize = 13
3myFilter = np.ones((filterSize, filterSize))/filterSize**2
4imFiltered = cv2.filter2D(img, -1, myFilter)
with the error message
OpenCV Error: Assertion failed (depth == tdepth || tdepth == CV_32F) in unknown function, file ..\..\..\OpenCV-2.3.1\modules\imgproc\src\templmatch.cpp, line 61
Traceback (most recent call last):
File "C:\Users\p20529\Coding\Python\Dev\openCV\problem.py", line 18, in <module>
imFiltered = cv2.filter2D(img, -1, myFilter)
cv2.error: ..\..\..\OpenCV-2.3.1\modules\imgproc\src\templmatch.cpp:61: error: (-215) depth == tdepth || tdepth == CV_32F
Associated revisions
fixed bug #1552
History
Updated by Vadim Pisarevsky over 1 year ago
fixed in r7207
- Status changed from Open to Done
- Pull request set to fixed
Updated by Andrey Kamaev about 1 year ago
- Description changed from For small kernel sizes, the Python cv2-wrapper for filter2D works fine: <... to For small kernel sizes, the Python cv2-wrapper for filter2D works fine: <... More
- Target version set to 2.4.0