This commit is contained in:
Max 2021-09-21 14:08:22 +01:00
parent 5c3106935d
commit 0adf8c0841
4 changed files with 19 additions and 0 deletions

View File

@ -7,6 +7,9 @@ import logging
import platform import platform
import math import math
import os
import psutil
logging.basicConfig(level='INFO') logging.basicConfig(level='INFO')
@dataclass @dataclass
@ -51,6 +54,10 @@ class VideoStream:
def update(self): def update(self):
while self.running: while self.running:
success, frame = self.stream.read() success, frame = self.stream.read()
if not success:
current_system_pid = os.getpid()
ThisSystem = psutil.Process(current_system_pid)
ThisSystem.terminate()
assert success assert success
self.buffer = frame self.buffer = frame
self.stream.release() self.stream.release()

View File

@ -6,6 +6,8 @@ import sys
import threading import threading
import time import time
from queue import Queue from queue import Queue
import os
import psutil
import flask import flask
from flask import jsonify, request from flask import jsonify, request

View File

@ -7,6 +7,9 @@ import platform
import math import math
from dataclasses import dataclass from dataclasses import dataclass
import os
import psutil
logging.basicConfig(level='DEBUG') logging.basicConfig(level='DEBUG')
class CUDA: class CUDA:
@ -54,6 +57,10 @@ class VideoStream:
def update(self): def update(self):
while self.running: while self.running:
success, frame = self.stream.read() success, frame = self.stream.read()
if not success:
current_system_pid = os.getpid()
ThisSystem = psutil.Process(current_system_pid)
ThisSystem.terminate()
assert success assert success
self.buffer = frame self.buffer = frame
self.stream.release() self.stream.release()

View File

@ -5,6 +5,9 @@ import platform
import time import time
from dataclasses import dataclass from dataclasses import dataclass
import os
import psutil
import cv2 import cv2
import apriltag_detector import apriltag_detector