Hi, I am using opencv 3.0.0 on ubuntu 16.04 with python 2.7.12 in virtual environment. When I am writing the following program, import cv2 import os.path import numpy as np
print os.path.isfile("/home/user/.VIRTUALENVS/cv/lib/python2.7/site-packages/ped1.avi") cap = cv2.VideoCapture("/home/user/.VIRTUALENVS/cv/lib/python2.7/site-packages/ped1.avi")
ret, frame1 = cap.read() print ret prvs = cv2.cvtColor(frame1,cv2.COLOR_BGR2GRAY)
the output I am getting is as follows:
True
False
Traceback (most recent call last): File "/home/varun/.VIRTUALENVS/cv/lib/python2.7/site-packages/check.py", line 10, in <module> prvs = cv2.cvtColor(frame1,cv2.COLOR_BGR2GRAY) error: /home/varun/opencv/modules/imgproc/src/color.cpp:7564: error: (-215) scn == 3 || scn == 4 in function cvtColor
The false statement is showing that program is not reading the file. File does exist there. I tried solutions given here and here but still it is not working. Please help. Thanks in advance.