Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I had same error, but I was doing distance from camera to object.And I solved it problem by using cv2.COLOR_BGR2GRAY.

gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)

to:

gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

This will solved your error problem.

I had same error, but I was doing distance from camera to object.And I solved it problem by using cv2.COLOR_BGR2GRAY.

gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)

to:

gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

If this doesn't work. Try this:

gray = cv2.cvtColor(cv2.UMat(image), cv2.COLOR_RGB2GRAY)

This will solved your error problem.