Ask Your Question

Revision history [back]

Videocapture in opencv 3.0.0 is not reading the video

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.

Videocapture in opencv 3.0.0 is not reading the video

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, program,

import cv2
import os.path
import numpy as np

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")

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)

cv2.cvtColor(frame1,cv2.COLOR_BGR2GRAY)

the then output that I am getting is as follows:

True

True
False
  

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

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.