Posts: 3
Threads: 1
Likes Received: 0 in 0 posts
Likes Given: 0
Joined: Mar 2018
Hi!
Since Monday I've got a tinker board. I'm using opencv (version 3.3.1) and want to use the picamera v2 but I can't access it. I used the tinker board CSI-camera wiki as reference.
I can accessing it via the terminal
Code:
gst-launch-1.0 v4l2src ! videoconvert ! autovideosink
command
What command should I use if I want to get the camera image via cv2.VideoCapture () ?
Thanks in advance!!
Jan-Willem
•
Posts: 232
Threads: 39
Likes Received: 40 in 22 posts
Likes Given: 0
Joined: Feb 2017
As at
https://tinkerboarding.co.uk/wiki/index....CSI-camera
Code:
cap = cv2.VideoCapture("v4l2src ! video/x-raw,format=NV12,width=640,height=480 ! videoconvert ! appsink")
while cap.isOpened():
ret, frame = cap.read()
•
Posts: 3
Threads: 1
Likes Received: 0 in 0 posts
Likes Given: 0
Joined: Mar 2018
Thank you, both
Code:
while cap.isOpened():
and
won't give access to the camera. I put a
Code:
print('frame', frame)
in the loop to see what information comes through. In the first case noting happens at all and in the second case the print gives 'none'
Jan-Willem
•
Posts: 3
Threads: 1
Likes Received: 0 in 0 posts
Likes Given: 0
Joined: Mar 2018
03-26-2018, 07:35 AM
(This post was last modified: 03-26-2018, 08:25 AM by jan-willem.)
Anyone?
This is my python code:
Code:
import cv2
import sys
import os
import time
cap = cv2.VideoCapture("v4l2src ! video/x-raw,format=NV12,width=640,height=480 ! videoconvert ! appsink")
cv2.setNumThreads(4)
time.sleep(1.0)
while cap.isOpened:
ret, webcam = cap.read()
cv2.imshow('webcam',webcam)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows
and this is the traceback I get:
Code:
Traceback (most recent call last):
File "/home/linaro/Desktop/2.py", line 14, in <module>
cv2.imshow('webcam',webcam)
cv2.error: /home/linaro/opencv-3.3.1/modules/highgui/src/window.cpp:331: error: (-215) size.width>0 && size.height>0 in function imshow
•