5

I am trying to run this code:

import cv2
import numpy as np

src = np.array([[10, 20, 40, 50],
                 [50, 20, 50, 20],
                 [10, 10, 30, 60],
                 [20, 40, 60, 70]])

dst1 = cv2.blur(src, ksize=(3, 3), borderType = cv2.BORDER_CONSTANT)
print(dst1)
dst2 = cv2.GaussianBlur(src, ksize=(3, 3), sigmaX=0, borderType = cv2.BORDER_CONSTANT)

And I got an error:

 dst2 = cv2.GaussianBlur(src, ksize=(3, 3), sigmaX=0, borderType = cv2.BORDER_CONSTANT)
    cv2.error: OpenCV(4.5.5) /Users/runner/work/opencv-python/opencv-python/opencv/modules/imgproc/src/filter.simd.hpp:3045:  
    error: (-213:The function/feature is not implemented) 
    Unsupported combination of source format (=4), and buffer format (=5) in function 'getLinearRowFilter'
1
  • thank you very much!!! I solved this error. I added dtype=np.uint8 ! Commented May 27, 2022 at 16:10

1 Answer 1

3

if you construct an np.array like that, it's (default) format is np.int32, which is not supported. rather make it:

src = np.array([[10, 20, 40, 50],
                [50, 20, 50, 20],
                [10, 10, 30, 60],
                [20, 40, 60, 70]], np.uint8) # <-- correct type !!!
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.