filter2D: problems with large kernels (Bug #1552)


Added by tomhaslwanter - about 13 years ago. Updated about 13 years ago.


Status:Done Start date:
Priority:Blocker Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:core
Target version:2.4.0
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

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

problem.py - Python code for reproducing the problem (1006 Bytes) tomhaslwanter -, 2012-01-20 08:06 pm


Associated revisions

Revision 18ce0dff
Added by Vadim Pisarevsky about 13 years ago

fixed bug #1552

Revision 85edb9e9
Added by Roman Donchenko almost 11 years ago

Merge pull request #1552 from Exocoder:gtk3

History

Updated by Vadim Pisarevsky about 13 years ago

fixed in r7207

  • Status changed from Open to Done
  • (deleted custom field) set to fixed

Updated by Andrey Kamaev about 13 years ago

  • Target version set to 2.4.0
  • 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

Also available in: Atom PDF