I am a beginner working on a project that requires input video from raspberrypi(live streaming) to my pc that runs on Ubuntu 16.04. I use netcat ad raspivid to stream the video using the commands,
nc.traditional -l -p 9090|mplayer -fps 50 -cache 1024 -
on the pc and
raspivid-w 1280 -h 720 -t 999999 -o -|nc IPaddrofPC 9090
on the pi.
I am able to receive and view the video streaming in mplayer.
Now I want to use the video for image processing in opencv. I used the following code,
> import cv2
> cap=cv2.videoCapture("/dev/stdin")
> print(cap.isOpened())
> while(cap.isOpened==True):
> ret, frame= cap.read()
> gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
> cv2.imshow('video',gray)
> if cv2.waitKey(1) & 0xFF == ord('q'):
> break
>
> cv2.destroyAllWindows()
I don't get any output or even any errors. The program keeps running. Any print statement before videoCapture works so I could figure out that the problem is with the line cv2.videoCapture("/dev/stdin"). I have been spending 2 days over it checking all possibilities and also checked if the dependable packages are all available. I couldn't find the solution. It would be better if I have an error but I don't get that too. Please help.