from src.stream.video import Video

from src.domain.polygon import Polygon
from src.domain.line import Line
from src.domain.point import Point
from src.config.configCam import ConfigCam

from src.channelBuffer.channelBufferMqtt import ChannelBufferMqtt

channelBuffer = ChannelBufferMqtt()

_array = [[[80, 81], [128, 79]], [[128, 79], [190, 137]], [[190, 137], [118, 149]], [[118, 149], [79, 79]]]


arrayPoly = []

poly = Polygon()
poly.setName("ForaDaFaixa")

arrayPoly.insert(0, poly)

for i in _array:
    poly.addLine(Line(Point(i[0][0],i[0][1]), Point(i[1][0],i[1][1])))

stream = Video('videos/videoContagem.mp4');
stream.setConfig(ConfigCam())
stream.setPolys(arrayPoly)
stream.setChannelBuffer(channelBuffer)
stream.play()
import numpy as np
import cv2

from src.util.geometria import Geometria
from src.domain.point import Point
from src.domain.label import Label
from src.domain.polygon import Polygon

g = Geometria();

polyDefault = Polygon()
polyDefault.setName("Default")

# OBJETO RESPONSAVEL POR IDENTIFICAR OBJETOS UNICOS NO PLANO
# RECEBE UMA INSTANCIA DO OBJETO Moviment

class Identify:
    def __init__(self, deslocamentoMax=20):
        self._centers = None
        Identify.deslocamentoMax = deslocamentoMax
        Identify.mediumLine = 30000
        Identify.largeLine = 50000
        self.color = (0,255,0)
        self.colorFont = (255,255,0)
        self.areaList = []
        self.hasLine = False

    def setMoviment(self, moviment):
        self.moviment = moviment

    def lineController(self):
import numpy as np
import cv2

from src.stream.video import Video

from src.domain.polygon import Polygon
from src.domain.line import Line
from src.domain.point import Point
from src.config.configCam import ConfigCam

arrayPoly = []

poly = Polygon()
poly.setName("Subiu")
poly.addLine(Line(Point(0, 0), Point(0,0)))
poly.addLine(Line(Point(0,0), Point(0,0)))
poly.addLine(Line(Point(0,0), Point(0,0)))
poly.addLine(Line(Point(0,0), Point(0,0)))
arrayPoly.insert(0, poly)

stream = Video("videos/videoVeiculos.mp4");
stream.setConfig(ConfigCam())
stream.setPolys(arrayPoly)
stream.play()
Ejemplo n.º 4
0
import numpy as np
import cv2

from src.stream.video import Video

from src.domain.polygon import Polygon
from src.domain.line import Line
from src.domain.point import Point
from src.config.configCam import ConfigCam

from src.channelBuffer.channelBufferVoid import ChannelBufferVoid

arrayPoly = []

polyOff = Polygon()
polyOff.setName("Fora")
polyOff.setClass("off")
#Point(Coluna, Linha)
polyOff.addLine(Line(Point(1, 400), Point(370, 400)))
polyOff.addLine(Line(Point(370, 400), Point(900, 680)))
polyOff.addLine(Line(Point(900, 680), Point(1030, 680)))
polyOff.addLine(Line(Point(1030, 680), Point(1030, 1)))
polyOff.addLine(Line(Point(1030, 1), Point(1, 1)))
polyOff.addLine(Line(Point(1, 1), Point(1, 400)))
arrayPoly.insert(0, polyOff)

polyLine = Polygon()
polyLine.setName("Fila")
polyLine.setClass("line")
#Point(Coluna, Linha)
polyLine.addLine(Line(Point(140, 410), Point(340, 400)))