I’m trying to do the color filter with the function that appears in the API but I get an error all time
Can you send a screenshot or paste the contents of the error?
I have the same problem,
This is the error:
File “”, line 3, in execute
image_HSV = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
NameError: global name ‘cv2’ is not defined
It seems to be a problem with importing the OpenCV library. Have you run to the first cell where the
imports are?. Can you attach a screenshot with the Jupyter’s column?
The problem has already solved. I had to import the cv2 library
Hello, I have this error and it is not solved.
img_HSV =cv2.cvtColor(img, cv2.COLOR_RGB2HSV)
error: /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgproc/src/color.cpp:11178: error: (-215) (scn == 3 || scn == 4) && (depth == 0 || depth == 5) in function cvtColor
I tried to replicate the error by creating a simple program that imports the libraries, loads the cat and tries to segment the image. The cell I executed just after importing the libraries and loading the cat is the following one:
def execute(self): img = self.getImage() img_HSV =cv2.cvtColor(img, cv2.COLOR_RGB2HSV) self.set_color_image(img_HSV) cat.setExecute(execute)
The overall scheme of this test program is this:
Can you try a program like this and tell us the results? Attach screenshot with the errors to have more information.
hi, with getImage it works correctly, but to make the camera change as it appears in the example, it gives error.
Hi. Notice how in OpenCV, to switch between color spaces, it is not RGB2HSV as we would normally do but it is BGR2HSV. OpenCV treats the RGB color space differently than we are used to.
Try that change and tell us the results.