예제 #1
0
    def test_scanner( self, widget = None ):
        self.xml.get_widget( 'main_stop' ).set_sensitive(False)
        self.xml.get_widget( 'main_record' ).set_sensitive(False)

        tty_dev = self.device_list['tty'][self.tty_combo.get_active()]
        
        control = Control( tty_dev )
        control.reset();
        
        control.write(0)
        time.sleep(3)
        
        control.close()
        
        self.xml.get_widget( 'main_stop' ).set_sensitive(True)
        self.xml.get_widget( 'main_record' ).set_sensitive(True)
        return False
예제 #2
0
    def test_scanner(self, widget=None):
        self.xml.get_widget('main_stop').set_sensitive(False)
        self.xml.get_widget('main_record').set_sensitive(False)

        tty_dev = self.device_list['tty'][self.tty_combo.get_active()]

        control = Control(tty_dev)
        control.reset()

        control.write(0)
        time.sleep(3)

        control.close()

        self.xml.get_widget('main_stop').set_sensitive(True)
        self.xml.get_widget('main_record').set_sensitive(True)
        return False
예제 #3
0
def main():
    parser = optparse.OptionParser("pylatscan_cli <options> <target>");
    parser.add_option("-d","--device", action = "store", type="string", dest="device", default="/dev/video0")
    parser.add_option("-t","--tty", action = "store", type="string", dest="port", default="/dev/ttyUSB0")
    parser.add_option("-x","--width", action = "store", type="int", dest="width", default="640")
    parser.add_option("-y","--height", action = "store", type="int", dest="height", default="480")
    parser.add_option("-s","--steps", action = "store", type="choice", choices = ['1','2','4','8'], dest="steps", default="4", help="steps per turn")
    parser.add_option("-p","--path", action = "store", type="string", default="/usr/bin/uvccapture", dest="path", help="path to uvcapture binary")
    
    (options, target) = parser.parse_args()
    
    if len(target) == 0:
        parser.error( "You need to provide a target directory" )
    
    
    target = target[0]    
    control = Control(options.port)
    steps   = int(options.steps)
    target  = str.rstrip( target, '/' )
    pfx    = time.strftime("%Y%m%d%H%M%S");
    
    control.reset();
    
    start = time.time();    
    max = 400/int(options.steps);
    
    for i in range( 0, max):
        #print "I: scanning %s of %s" % ( i, 400/steps)
        control.write(2);

        filename = os.path.realpath('%s/left_%s_%04d.jpg' % ( target, pfx, i ))
        grab_frame( options, filename )
        print "I: %03d/%d recorded %s" % ( i, max, filename )
        
        control.write(3);
        control.write(4);

        filename = os.path.realpath('%s/right_%s_%04d.jpg' % ( target, pfx, i ))
        grab_frame( options, filename )
        
        print "I: %03d/%d recorded %s" % ( i, max, filename )
        
        control.write(5);
        control.write(6);

        filename = os.path.realpath('%s/color_%s_%04d.jpg' % ( target, pfx, i ))
        grab_frame( options, filename )
        print "I: %03d/%d recorded %s" % ( i, max, filename )

        control.write(7);

        for i in range(0,steps):
            control.step()
    
    duration = time.time() - start