0
image = camera.read()
image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)

When I'm starting a program - got this:

Traceback:
    File "file", line 55, in <module>
        image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
TypeError: src is not a numerical tuple

How can I fix it?

4
  • you need to add more information about your image imageand the rest of your code ... Commented Oct 12, 2014 at 23:27
  • ex.ua/load/131174966 - File with part of code Commented Oct 12, 2014 at 23:48
  • sorry, I don't understand Russian! Commented Oct 13, 2014 at 0:09
  • this is a link with py script. Only Ukrainian Hosting :) Commented Oct 13, 2014 at 14:03

2 Answers 2

2

I think camera.read() returns a tuple, the first element being a bool and the next element is the frame itself.

so try this:

ret, image = camera.read()
image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
Sign up to request clarification or add additional context in comments.

1 Comment

fyi, here's a link that may be helpful to you: opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/…
0

Check the documentation of cvtColor , probably your structure is wrong, check the structure of your image

link

Parameters:

src – input image: 8-bit unsigned, 16-bit unsigned ( CV_16UC... ), or single-precision floating-point.

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.