release version: # R32 (release), REISION: 6.1, GCID: 27863751, BOARD: t210ref, EABI: aarch64, ATE: Mon Jul 26 19:20:30 UC 2021
Yes I am opening the camera using cv2 like this:
def show_frame():
global tkImage
global notCaptured
if cap.isOpened() and notCaptured:
#canvas.pack_forget()
hasFrame, frame = cap.read()
if hasFrame is True:
frame = cv2.resize(frame, (800, 600))
cv2image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)
img = Image.fromarray(cv2image)
tkImage = ImageTk.PhotoImage(img)
canvas.create_image(0, 0, anchor=NW, image=tkImage)
window.after(10, show_frame)
def gstreamer_pipeline(
capture_width=1280,
capture_height=720,
display_width=640,
display_height=480,
framerate=60,
flip_method=0,
):
return (
"nvarguscamerasrc ! "
"video/x-raw(memory:NVMM), "
"width=(int)%d, height=(int)%d, "
"format=(string)NV12, framerate=(fraction)%d/1 ! "
"nvvidconv flip-method=%d ! "
"video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! "
"videoconvert ! "
“video/x-raw, format=(string)BGR ! appsink”
% (
capture_width,
capture_height,
framerate,
flip_method,
display_width,
display_height,
)
)
and then when I capture a frame I do this:
def threadCapture():
t2 = Thread(target=capture())
t2.start()
def capture():
global notCaptured
notCaptured=False
(So when captured it stops the loop showing the video frame per frame ,kinda freezes on the las frame then )
then i have a play button supposed to make the video stream run again but it doesn’t work.
def Play():
global video
global videoList
global indexVideo
global cap
global fps
global frame_count
global duration
canvas.pack_forget()
cap = cv2.VideoCapture(gstreamer_pipeline(flip_method=0), cv2.CAP_GSTREAMER)
#cap = cv2.VideoCapture(0)
fps = cap.get(cv2.CAP_PROP_FPS) # OpenCV2 version 2 used "CV_CAP_PROP_FPS"
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
detect_objectsYolo()