Ask Your Question

jkz's profile - activity

2019-11-12 07:04:28 -0600 received badge  Famous Question (source)
2017-07-23 10:41:56 -0600 received badge  Notable Question (source)
2016-10-05 11:28:08 -0600 received badge  Popular Question (source)
2014-04-19 17:32:20 -0600 asked a question Error CreateImage()

Hi there! I'm getting this error

imageResized=cv.CreateImage((64,64),8, 1)
NameError: name 'cv' is not defined

Here is my code:
import numpy as np
import cv2

cap = cv2.VideoCapture(0)

while(True):
    retval, frame = cap.read()
    cv2.imshow("frame",frame)
    cv2.waitKey(10)
    a = (200,80)#(x,y)
    b = (450,400)#(x,y)
    cv2.rectangle(frame,a, b, (0,255,0),3)
    crop_frame=frame[80:400,200:450] #y,x

    cv2.imwrite("face.jpg", frame)

    frame=cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)   
    imageResized=cv.CreateImage((64,64),8, 1)
    cv.Resize(cv.fromarray(frame), imageResized)
    vector = numpy.asarray(frame)
    print vector

I've changed to cv2.CreateImage and get this: "AttributeError: 'module' object has no attribute 'CreateImage'" Can you guys help me? thanks