Jump to content
Sign in to follow this  
ManyanJin10

Video capture via Open cv + Gstreamer wirh CSI camera no response.

Recommended Posts

Hi I've just start Tinker 2S (Debian ver) user.

It's very cool small computer and enjoy to connect camera.

I'm using MIPI cam(IMX219) . GStreamer pipeline command line is no problem showing video.

But try to integrate python code, no response from camera. 

I want to ask you guys how should I do.

below is test python code.

 

Quote

import cv2
#import time
#import tkinter as tk
#from PIL import Image, ImageTk

src = "gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! videoconvert ! autovideosink"
#,cv2.CAP_GSTREAMER appsink drop=true sync=false
cap=cv2.VideoCapture(src, cv2.CAP_GSTREAMER)
#time.sleep(3)
    
while cap.isOpened():
    ret, frame_read = cap.read()
    cv2.imshow('Read',frame_read)
    cv2.waitKey(30)
cap.release()

python 3.7.3

Opencv version =opencv-python 4.6.0.66

numpy 1.21.6

pip 22.1.2

 

Edited by ManyanJin10
module version added

Share this post


Link to post
Share on other sites

hello @ManyanJin10

which debian os are you using? if you're using one of the official releases from tinker-board.asus.com

may i know the version? thank you.

Share this post


Link to post
Share on other sites

Hello @tooz,

I downloaded TinkerOS image, Tinker Board 2 Debian 10 V2.0.4 from tinker-board.asus.com .

If execute pipeline "gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! videoconvert ! autovideosink"

in the termial, capture process is no problem.

 

.

 

Share this post


Link to post
Share on other sites

hello @ManyanJin10

you can try to modify this line to:

 src = "gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! videoconvert ! appsink"

 

Share this post


Link to post
Share on other sites

Good morning! Tooz.

I changed parameter according to your advice, but no response from command line of python

"python xxx(above code).py"

To confirm video capture process is started or not, I inserted "cap.isOpened "status.

As a result of check, cap.isOpened is failed. video stream doesn't overlay via gstreamer and show in the Opencv.

 

 

 

 

Share this post


Link to post
Share on other sites

Hi tooz.

 

Regarding this issue, I resolved myself with your advice.

I found my Opencv set GStreamer "No".

That's why I uninstalled opencv and build source after working well.

 

Thank you for your supporting!

sample.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...