Javacv: opencv_core.inRange() not allowing opencv_core.Scalar as input type

Created on 19 Apr 2020  路  3Comments  路  Source: bytedeco/javacv

frame=cv2.imread('lena.jpg')
hsv=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
l_b=np.array([110,50,50])
u_b=np.array([130,255,255])

mask=cv2.inRange(hsv,l_b,u_b)
cv2.imshow('frame',mask)

Error-
OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\coresrc\arithm.cpp:1758: error: (-209:Sizes of input arguments do not match) The lower boundary is neither an array of the same size and same type as src, nor a scalar in function 'cv::inRange'

Is there anyway to overcome this error and get the output in opencv python environment?

question

Most helpful comment

I found out the problem.
#replace this line
hsv=cv2.cvtColor(frame,cv2.COLOR_BGR2HSV)

All 3 comments

I am having the same problem as this guy.
https://github.com/bytedeco/javacv/issues/684

You have also given him the answer. But that was in java environment. I am programming in python and was wondering what I should change in the code

I found out the problem.
#replace this line
hsv=cv2.cvtColor(frame,cv2.COLOR_BGR2HSV)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iamazy picture iamazy  路  4Comments

chenhl05 picture chenhl05  路  4Comments

myScoopAndroidCamera picture myScoopAndroidCamera  路  4Comments

Bahramudin picture Bahramudin  路  3Comments

fif10 picture fif10  路  3Comments