Ask Your Question
-1

syntax error for cv2.inRange[Solved]

asked 2019-12-04 02:59:35 -0500

MingCheng gravatar image

updated 2019-12-04 10:03:01 -0500

supra56 gravatar image

Hi, May I ask that why I get a syntax error for the line output = cv.inRange(hsv, lower_blue, upper_blue). The code is shown below:

import numpy as np
import cv2  as cv   
con=[]
image = cv.imread('2.jpg')
hsv = cv.cvtColor(image, cv.COLOR_RGB2HSV)

lower_blue = np.array([1,80,53])
upper_blue = np.array([53,205,255]
output = cv.inRange(hsv, lower_blue, upper_blue)
con = cv.findContours(output.copy(),cv.RETR_LIST,cv.CHAIN_APPROX_NONE)
print(con)
#print(hier)
cv.imshow('img', image)
cv.waitKey(0)

Thank you for the help

edit retag flag offensive close merge delete

Comments

and the error is ?

berak gravatar imageberak ( 2019-12-04 03:33:34 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2019-12-04 03:47:21 -0500

mvuori gravatar image

The row "upper_blue =..." lacks a ")" at its end

edit flag offensive delete link more

Comments

Thank you, I was too careless.

MingCheng gravatar imageMingCheng ( 2019-12-04 03:59:03 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-12-04 02:59:35 -0500

Seen: 30 times

Last updated: Dec 04