Problem in cv_image.shape

I’m triying to run the practice and show the image filtered into rqt, but i’m getting this error, what can i do?:


Hi @nygage,

It may be an error on your code. Is your filtered image and cv2 image?

It will be helpful if you could add more information about your problem.


Hi, I have exactly the same error. I don’t know if it’s problem of my code, because I haven’t edited the and it seems the error is in this file.

Hi @alber172498,

Have you edited The error may come from this file. When you set an image by calling set_image_filtered the image is sent from my_solution to the drone_teleop by converting it from cv2 image to message image. At arrival, the message image is converted again to cv2 image in order to show it through the drone_teleop GUI.
The error shows up at this point, but it may come from before. At least, I don’t get this error, that’s why I’m asking for more information about it.


Yes, I edited I’m going to revise my code, if I have some question I will put here again.

Hi @pariasp,
I have the same problem as my teammates.When I try to print the mask with set_image_threshed(mask), I get the same error:

Hi @Klego,

If i’m right I would say that it’s a problem in your code. Make sure that the set_image_threshed input must be a cv2 image.


@pariasp 'm using the set image with this line, same i was using in the web interface.
img_f1 = cv2.inRange(img_HSV, value_min_HSV, value_max_HSV)
And it not works.

I’m using the same method as @nygage

Hi guys @nygage @Klego,

Sorry for the late response. I’ve just found your problem. I assume that your img_HSV has only one channel. It seems that msg to image conversion fails on one channel images. It will be fixed soon.

For the moment you can work with this workaround: stack your channel into a three channel image. Something like this:

image_HSV_3 = np.dstack((image_HSV, image_HSV, image_HSV))