Skip to content

Filter throws error when the number of image channel is greater than 512 #527

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

Open
1 of 4 tasks
chjz1024 opened this issue Aug 20, 2021 · 2 comments
Open
1 of 4 tasks
Labels

Comments

@chjz1024
Copy link

chjz1024 commented Aug 20, 2021

Expected behaviour

opencv filter should return the filtered image with the same number of channel as input, i.e.

a = np.random.randint(255, size=(100,100,600)).astype(np.uint8)
cv2.blur(a, ksize=[3,3]).shape # should be (100,100,600)

Actual behaviour

error: OpenCV(4.5.3) /tmp/pip-req-build-xw6jtoah/opencv/modules/core/src/matrix.cpp:1102: error: (-215:Assertion failed) dims <= 2 && step[0] > 0 in function 'locateROI'

Steps to reproduce

  • example code
  • Ubuntu20.04
  • x86
  • opencv-python 4.5.3
Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • I'm using the latest version of opencv-python
@alalek
Copy link
Member

alalek commented Aug 20, 2021

512 is current limitation for number of channels: https://github.com/opencv/opencv/blob/4.5.3/modules/core/include/opencv2/core/hal/interface.h#L69

You may want to split channels/process/merge channels of your input because channels are processed independently through filters.

@chjz1024
Copy link
Author

@alalek Many thanks for your quick response. But I'm still curious about this implementation. Is there any explicit reason for limiting the maximum number of channels or it's just a historical issue?

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

No branches or pull requests

2 participants