Ask Your Question

mario jack's profile - activity

2015-04-02 00:20:21 -0600 asked a question imwrite('messigray.png',img) - returns "FALSE"

I'm just working with code from the python tutorials.

In certain cases the imwrite('messigray.png',img) returns "FALSE" value. In this case no Image is stored.

What is the reason for this?

2015-04-02 00:20:20 -0600 asked a question beginner errors with Raspberry PI / Opencv / Python
  • I've installed today opencv 2.4.10
  • I'm using some standard code from the tutorial:

    import numpy as np import sys sys.path.append('/usr/local/lib/python2.7/site-packages')

    import cv2
    
    cap = cv2.VideoCapture(0)
    
        # Capture frame-by-frame
    ret, frame = cap.read()
    
        # Our operations on the frame come here
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    
        # Display the resulting frame
    cv2.imshow('frame',gray)
    
    #cv2.imwrite("I2.jpg",img)
    
    # When everything done, release the capture
    cap.release()
    cv2.destroyAllWindows()
    

*

  • I'm getting the following error messages:

    OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /home/pi/opencv-2.4.10/modules/imgproc/src/color.cpp, line 3739 Traceback (most recent call last): File "I2_video.py", line 14, in <module> gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) cv2.error: /home/pi/opencv-2.4.10/modules/imgproc/src/color.cpp:3739: error: (-215) scn == 3 || scn == 4 in function cvtColor