Esempio n. 1
0
def getProcMet(var, input):
        v = var.get()
        settingsCon = singleton.settings()
        settPlay=(float(settingsCon['minSpeed'].get()),float(settingsCon['maxSpeed'].get()),
                  float(settingsCon['minFreq'].get()),float(settingsCon['maxFreq'].get()),
                  float(settingsCon['audioRate'].get()),float(settingsCon['positionBuff'].get()),settingsCon['mute'].get())
        global background
        if v == 1:
                 #print "m1"
                 if background==None:
                        background = input
                 output=manualDetect.manualDetect(input, background, int(settingsCon['debug'].get()))
                 fff=play_move.motion(output[1],settingsCon['ccam'],settPlay)
                 showFreq(fff)
                 return output[0]
        elif v == 2:
                if background!=None:
                        background = None
                #print "m2"
                output=bgSubtraction.bgSubtraction(input, (), int(settingsCon['debug'].get()))
                #print "bilopre"
                #print "calling ", output[1]
                fff=play_move.motion(output[1],settingsCon['ccam'],settPlay)
                #print fff
                showFreq(fff)

                return output[0]

        elif v == 3:
                #print "m3"
                output=haarcascades.haarcascades(input, 1, int(settingsCon['debug'].get()))
                fff=play_move.motion(output[1],settingsCon['ccam'],settPlay)
                showFreq(fff)
                return output[0]
                
        else:
                if background!=None:
                        background = None
                #print "m0"
                output=hogDetect.hogDetect(input, (), ())
                fff=play_move.motion(output[1],settingsCon['ccam'],settPlay)
                showFreq(fff)
                return output[0]
Esempio n. 2
0
def getProcMet(var, input):
        v = var.get()
        settingsCon = singleton.settings()
        settPlay=(float(settingsCon['minSpeed'].get()),float(settingsCon['maxSpeed'].get()),
                  float(settingsCon['minFreq'].get()),float(settingsCon['maxFreq'].get()),
                  float(settingsCon['audioRate'].get()),float(settingsCon['positionBuff'].get()),settingsCon['mute'].get())
        #print v
        if v == 1:
                 output=manualDetect.manualDetect(input, background, debug)
                 fff=play_move.motion(output[1],settingsCon['ccam'],settPlay)
                 showFreq(fff)
                 return output[0]
        elif v == 2:
                output=bgSubtraction.bgSubtraction(input, (), debug)
                #print "bilopre"
                #print "calling ", output[1]
                fff=play_move.motion(output[1],settingsCon['ccam'],settPlay)
                #print fff
                showFreq(fff)
                #else :print "BUG"
                #print "bilosta"
                #if(output[1]==(0,0)):
                #        print "ne sviraj majke ti ga"
                return output[0]

                
                
        elif v == 3:
                output=haarcascades.haarcascades(input, 1, debug)
                fff=play_move.motion(output[1],settingsCon['ccam'],settPlay)
                showFreq(fff)
                return output[0]
                
        else:
                output=hogDetect.hogDetect(input, (), ())
                fff=play_move.motion(output[1],settingsCon['ccam'],settPlay)
                showFreq(fff)
                return output[0]
Esempio n. 3
0
def update_image(image_label, queue, var):
        
        try:
           #frame = None
           framein = queue.get(False)
           frame = getProcMet(var,framein)
           #print 'frame', frame.shape
           im = cv2.cvtColor(frame,cv2.COLOR_BGR2RGB)
           a = Image.fromarray(im)
           b = ImageTk.PhotoImage(image=a)
           image_label.configure(image=b)
           image_label._image_cache = b  # avoid garbage collection
           settingsCon = singleton.settings()
           #Scrollso text in the bootom right corner
           tTime =time.time()
           if tTime>settingsCon['oldTime'] + 0.2:
                   banner(settingsCon['banner'].get())
                   settingsCon['oldTime']=tTime            
           
           root.update()
           

        except:
                x=1
#!/usr/bin/python
from Tkinter import *
import threading
import Queue
import tkMessageBox
import numpy as np
#from multiprocessing import Process, Queue
from Queue import Empty
import cv2
from PIL import Image, ImageTk
import time
import Tkinter as tk
import ttk
import singleton

settingsCon = singleton.settings()

def manualDetect(input, bgrnd, debug):
        if bgrnd == None:
                return (input,(0,0))
                
        else:
                try:
                        image = input#cv2.GaussianBlur(input,(5,5),3)#3
                        maiorArea = 0
                        mask = cv2.absdiff(image,bgrnd)
                        gray = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY)
                        _, gray = cv2.threshold(gray, 50,255,cv2.THRESH_BINARY)

                        gray=cv2.dilate(gray, None, 3)#Opening is just another name of erosion followed by dilation.
                        #It is useful in removing noise, as we explained above. Here we use the function
Esempio n. 5
0
def banner(text):
        settingsCon = singleton.settings()
        text = text[1:] + text [0]
        settingsCon['banner'].set(text)