代码拉取完成,页面将自动刷新
import os
import sys
import logging
import cv2
import time
import traceback
from multiprocessing import Process, Queue
from nodes.Node import Node
from nodes.SourceNode import SourceNode
from nodes.ElementNode import ElementNode
from nodes.VideoListSourceNode import VideoListSourceNode
#from utils import *
class FishVideoListSourceNode(VideoListSourceNode):
def __init__(self, name="FishVideoListSourceNode", parent=None, videoDir="VideoDir"):
super(FishVideoListSourceNode,self).__init__()
SourceNode.__init__(self, name,parent,videoDir,SourceNode.SOURCE_TYPE_MULTI_CHANNEL_VIDEO)
def closeAction(self):
print("+++++++++++++++++++++++++++++++++________++++++++++++++++++++++++++++++++++++++++++")
print("---------------------------------Close Action -------------------------------------")
#def open(self,idx):
# self._capture = cv2.VideoCapture(self._videoList[idx])
# dict = {}
# dict["VideoID"]=idx
# dict["VideoFile"]=self._videoList[idx]
# StoreGlobalDict(SHM_VIDEO_NAME, dict)
# return self._capture.isOpened()
def run(self):
fileIdx = 0
self.setStatus(Node.NODE_STATUS_RUNNING)
while(True):
if fileIdx >= len(self._videoList):
break
self.open(fileIdx)
frameIndex = 0
while(self._capture.isOpened()):
#logging.info('VideoListCxSourceNode: Node is running...')
if self._stopFlag:
break
if self._pauseFlag:
continue
(grabbed, frame) = self._capture.read()
if not grabbed:
break
if frame is not None:
#height, width, channels = frame.shape
frameIndex += 1
frame = cv2.resize(frame, (960, 540))
self.passFrame([frame, fileIdx, frameIndex])
logging.info("FishVideoListSourceNode: " + str(frameIndex) + " Frames pushed into frame pool.")
time.sleep(0.005)
fileIdx += 1
self.close()
self.setStatus(Node.NODE_STATUS_EXITED)
logging.info("+++++++++++++++++++ FishVideListSourceNode is completed. ++++++++++++++++++++++++")
#sys.exit()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。