Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do I correct this code?

This is my code.

import cv import numpy as np img=cv.imread("D:\OpenCV2.2\doc\logo.png",1) hsv=cv.CreateImage(cv.GetSize(img),8,3) cv.CvtColor(img,hsv,cv.CV_BGR2HSV) mas=cv.CreateImage(cv.GetSize(img),8,1) cv.InRangeS(hsv,(110,50,50),(130,255,255),mas) res=cv.CreateImage(cv.GetSize(img),8,1) cv.bitwise_and(img,img,res,mask=mas)

This is the error I get: Traceback (most recent call last): File "<pyshell#10>", line 1, in <module> cv.bitwise_and(img,img,res,mask=mas) TypeError: Scalar value for argument '<unknown>' is longer than 4

click to hide/show revision 2
No.2 Revision

updated 2015-05-14 11:50:10 -0600

berak gravatar image

How do I correct this code?

This is my code.

  

import cv import numpy as np img=cv.imread("D:\OpenCV2.2\doc\logo.png",1) hsv=cv.CreateImage(cv.GetSize(img),8,3) cv.CvtColor(img,hsv,cv.CV_BGR2HSV) mas=cv.CreateImage(cv.GetSize(img),8,1) cv.InRangeS(hsv,(110,50,50),(130,255,255),mas) res=cv.CreateImage(cv.GetSize(img),8,1) cv.bitwise_and(img,img,res,mask=mas)

cv.bitwise_and(img,img,res,mask=mas)

This is the error I get: Traceback (most recent call last): File "<pyshell#10>", line 1, in <module> cv.bitwise_and(img,img,res,mask=mas) TypeError: Scalar value for argument '<unknown>' is longer than 4