Error Spyder Python + opencv 3
Question: I have installed Opencv 3.1.4 on Spyder Python 2.7, all running on Windows
Vista 32bits.

My code is

    
    
    import cv2
    
    import sys
    
    cascPath = "C:\opencv\sources\data\haarcascades\haarcascade_frontalface_default.xml"
    faceCascade = cv2.CascadeClassifier(cascPath)
    
    video_capture = cv2.VideoCapture(0)
    
    while True:
        # Capture frame-by-frame
        ret, frame = video_capture.read()
    
        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    
        faces = faceCascade.detectMultiScale(
            gray,
            scaleFactor=1.1,
            minNeighbors=5,
            minSize=(30, 30),
            flags=cv2.cv.CV_HAAR_DO_CANNY_PRUNING
        )
    
        # Draw a rectangle around the faces
        for (x, y, w, h) in faces:
            cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
    
        # Display the resulting frame
        cv2.imshow('Video', frame)
        print faces
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
    
    # When everything is done, release the capture
    video_capture.release()
    cv2.destroyAllWindows()
    

But I have this error

    
    
    runfile('C:/Anaconda2/Scripts/tracking-video-fonctionnel.py', wdir='C:/Anaconda2/Scripts')
    Traceback (most recent call last):
    
      File "<ipython-input-2-3b1671aa3a09>", line 1, in <module>
        runfile('C:/Anaconda2/Scripts/tracking-video-fonctionnel.py', wdir='C:/Anaconda2/Scripts')
    
      File "C:\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 699, in runfile
        execfile(filename, namespace)
    
      File "C:\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile
        exec(compile(scripttext, filename, 'exec'), glob, loc)
    
      File "C:/Anaconda2/Scripts/tracking-video-fonctionnel.py", line 20, in <module>
        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    
    error: C:\builds\master_PackSlaveAddon-win32-vc12-static\opencv\modules\imgproc\src\color.cpp:7456: error: (-215) scn == 3 || scn == 4 in function cv::ipp_cvtColor

However, this code is running on an other computer with the same spyder and
opencv but on Windows 7 64bits

I think the issue is on opencv because I can't import cv2.cv but I can import
cv2

Thank's


Answer: I have found a solution, it's to install a 2.x version of opencv

