Exemplo n.º 1
0
 def takeTriggedPicture(self,nPicture = 1):
     print 'taking Trigged Picture'
     
     print 'Setting video mode and frame rate'
     video_mode = FCVideoMode._1280x960Y8
     frame_rate = FCFrameRate._15
 
     print "Getting context"
     #Here 1 to get the correct Chameleon
     #context = Context.from_index(0)
     context = Context.from_index(1)
     
     print "Setting color mode"
     context.SetColorProcessingMethod(FCColorMethod.EDGE_SENSING)
     
     print "Starting video mode"
     context.Start(video_mode, frame_rate)
 
     print "Sleeping for a bit"
     time.sleep(.1)
 
     start_time = time.clock()    
     print "grabbing image (Bypass == True)"
     cvimage, timestamp, acqtime, posttime = context.GrabImageCV(bypass = True)
     duration = time.clock() - start_time
     print "image acquired in %.5fms" % (duration * 1000.0)
     
     print "saving image"    
     cv.SaveImage("imageCiceroTrigged.png", cvimage)
     
     print "shutting down"    
     context.Stop()
     context.Destroy()
 
     return 0
Exemplo n.º 2
0
def main():    
    video_mode = FCVideoMode._1280x960Y8
    frame_rate = FCFrameRate._15

    print "Getting context"
    context = Context.from_index(0)
    
    print "Setting color mode"
    context.SetColorProcessingMethod(FCColorMethod.EDGE_SENSING)
    
    print "Starting video mode"
    context.Start(video_mode, frame_rate)

    print "Sleeping for a bit"
    time.sleep(.1)

    start_time = time.clock()    
    print "grabbing image (Bypass == True)"    
    cvimage, timestamp = context.GrabImageCV(bypass = True)
    duration = time.clock() - start_time
    print "image acquired in %.5fms" % (duration * 1000.0)

    for i in range(10):
        start_time = time.clock()    
        print "grabbing another image (Bypass == True)"    
        cvimage, timestamp = context.GrabImageCV(bypass = False, grayscale = True)
        duration = time.clock() - start_time
        print "image acquired in %.5fms" % (duration * 1000.0)

    print "saving image"    
    cv.SaveImage("image.png", cvimage)

    print "shutting down"    
    context.Stop()
    context.Destroy()
Exemplo n.º 3
0
    def takeSinglePicture(
            self):  #This fonction is for the Chameleon of the DMD
        print 'taking Single Picture'

        print 'Setting video mode and frame rate'
        video_mode = FCVideoMode._1280x960Y8
        frame_rate = FCFrameRate._15

        print "Getting context"
        #Here 1 to get the correct Chameleon
        #context = Context.from_index(0) #0 pour DMD et 1 pour Accordéon
        context = Context.from_index(0)

        print "Setting color mode"
        context.SetColorProcessingMethod(FCColorMethod.EDGE_SENSING)

        print "Starting video mode"
        context.Start(video_mode, frame_rate)

        print "Sleeping for a bit"
        time.sleep(.1)

        start_time = time.clock()
        print "grabbing image (Bypass == True)"
        cvimage, timestamp, acqtime, posttime = context.GrabImageCV(
            bypass=True)
        duration = time.clock() - start_time
        print "image acquired in %.5fms" % (duration * 1000.0)

        print "saving image"
        #cv.SaveImage("imageSingle.png", cvimage)
        #cv.SaveImage(name, cvimage)
        #Now done in CameraController

        print "shutting down"
        context.Stop()
        context.Destroy()

        return cvimage
Exemplo n.º 4
0
def camera_process(num_workers = 1):
    num_workers = num_workers

    flycontext = Context.from_index(0)
    flycontext.SetColorProcessingMethod(FCColorMethod.EDGE_SENSING)
    flycontext.Start(FCVideoMode._1280x960Y8, FCFrameRate._15)

    zmq_context = zmq.Context()
    
    my_sockets = []
    for i in range(num_workers):
        zmq_sender = zmq_context.socket(zmq.PUSH)
        zmq_sender.setsockopt(zmq.HWM, 2)            
        zmq_sender.bind("tcp://127.0.0.1:%d" % PORTSET[i][0])
        my_sockets.append(zmq_sender)
    
    while True:
        for s in my_sockets:            
            print "grabbing image"
            image = flycontext.GrabImagePIL()
    
            print "sending image"
            send_image(s, image)    
Exemplo n.º 5
0
    def takeSinglePicture(self): #This fonction is for the Chameleon of the DMD
        print 'taking Single Picture'
        
        print 'Setting video mode and frame rate'
        video_mode = FCVideoMode._1280x960Y8
        frame_rate = FCFrameRate._15
    
        print "Getting context"
        #Here 1 to get the correct Chameleon
        #context = Context.from_index(0) #0 pour DMD et 1 pour Accordéon
        context = Context.from_index(0)
        
        print "Setting color mode"
        context.SetColorProcessingMethod(FCColorMethod.EDGE_SENSING)
        
        print "Starting video mode"
        context.Start(video_mode, frame_rate)
    
        print "Sleeping for a bit"
        time.sleep(.1)
    
        start_time = time.clock()    
        print "grabbing image (Bypass == True)"
        cvimage, timestamp, acqtime, posttime = context.GrabImageCV(bypass = True)
        duration = time.clock() - start_time
        print "image acquired in %.5fms" % (duration * 1000.0)
        
        print "saving image"    
        #cv.SaveImage("imageSingle.png", cvimage)
        #cv.SaveImage(name, cvimage)
        #Now done in CameraController

        print "shutting down"    
        context.Stop()
        context.Destroy()
    
        return cvimage
Exemplo n.º 6
0
    def takeTriggedPicture(self, nPicture=1):
        print 'taking Trigged Picture'

        print 'Setting video mode and frame rate'
        video_mode = FCVideoMode._1280x960Y8
        frame_rate = FCFrameRate._15

        print "Getting context"
        #Here 1 to get the correct Chameleon
        #context = Context.from_index(0)
        context = Context.from_index(1)

        print "Setting color mode"
        context.SetColorProcessingMethod(FCColorMethod.EDGE_SENSING)

        print "Starting video mode"
        context.Start(video_mode, frame_rate)

        print "Sleeping for a bit"
        time.sleep(.1)

        start_time = time.clock()
        print "grabbing image (Bypass == True)"
        cvimage, timestamp, acqtime, posttime = context.GrabImageCV(
            bypass=True)
        duration = time.clock() - start_time
        print "image acquired in %.5fms" % (duration * 1000.0)

        print "saving image"
        cv.SaveImage("imageCiceroTrigged.png", cvimage)

        print "shutting down"
        context.Stop()
        context.Destroy()

        return 0