Ejemplo n.º 1
0
def image_capture(queue, run, source):
        vidFile = cv2.VideoCapture(source)
        vidFile.set(3, 640)     #horizontal pixels
        vidFile.set(4, 480)     #vertical pixels
        flag, frame=vidFile.read()
        while vidFile.isOpened():
                #print "capture loop"
                if runTk == 0:
                        print "\nrunTk kill this thread\n"
                        break
                else:
                      try:
                         if settingsCon['newdata']:
                                 flag, frame=vidFile.read()
                                 #print "Image queued"
                                 if(None==settingsCon['ccam']):
                                   (h,w,c)= frame.shape
                                   camSet=camProperties()
                                   settingsCon['ccam']=projection.cammera(w,h,camSet[0],camSet[1])
                                   settingsCon['ccam'].set_position(camSet[2], camSet[3])
                         
                         if flag==0:
                            print "\nflag kill this thread\n"
                            break
                         #cv2.imshow("Input file", frame)
                         queue.put(frame)
                         cv2.waitKey(20)
                       
                        
                      except:
                         print "continue"
                         continue
        vidFile.release()
        print "Gotov je tred ovo nije problem"        
Ejemplo n.º 2
0
                        print 'Can not get size of video'
        vidFile.release()


settingsCon = singleton.settings()


if __name__ == '__main__':
   args=sys.argv     
   settingsCon = singleton.settings()
   
   source =  0#"final84angle.avi"

   h, w = getVideoSize(source)
   camSet=camProperties()
   settingsCon['ccam']=projection.cammera(w,h,camSet[0],camSet[1])
   settingsCon['ccam'].set_position(camSet[2], camSet[3])
   videoSize = 'Video size: %d x %d'%(w,h)
   print videoSize

   queue = Queue.Queue(maxsize=5)
   global var1
   var1 = IntVar()
   var1.set('2')
   
   settingsCon['mute'] = IntVar()
   settingsCon['minArea'] = IntVar()
   settingsCon['maxArea'] = IntVar()
   settingsCon['bgHistory'] = IntVar()
   settingsCon['bgTresh'] = IntVar()
   settingsCon['freq'] = StringVar()
Ejemplo n.º 3
0
            #print "nista nista nista"
            return (0,0,updateMotion((0,0,-1),settingsP))
        #print "pre"
        ny=cam.get_distance_pixel(cam.res_y-y)
        #print "posle"
        nx=cam.get_cord_pixel(ny,x)
        #print('{}, {}'.format(int(nx), int(ny)))
        return (nx,ny,updateMotion((nx,ny,diffrence),settingsP))
    else:
        if(event!=(0,0)):
            lastp=event
        
def end():
    que.put(-1)
#planer=threading.Thread(target=updateMotion, args = (quein,))
#planer.start()
if __name__=='__main__':
    root = tk.Tk()
    photo = tk.PhotoImage(file="prvi.gif")
    ycord=photo.height()
    cam=cammera(photo.width(),photo.height(),math.pi/4,math.pi/5)
    cam.set_position(21.0,31.0)
    label = tk.Label(root,image=photo)
    label.image = photo # keep a reference!
    label.pack()
    label.bind('<Motion>', motionE)
    root.mainloop()
    end()
    playing.join()
#planer.join()