<s> import freenect <EOL> import matplotlib . pyplot as mp <EOL> import signal <EOL> import frame_convert <EOL> mp . ion ( ) <EOL> image_rgb = None <EOL> image_depth = None <EOL> keep_running = True <EOL> def display_depth ( dev , data , timestamp ) : <EOL> global image_depth <EOL> data = frame_convert . pretty_depth ( data ) <EOL> mp . gray ( ) <EOL> mp . figure ( <NUM_LIT:1> ) <EOL> if image_depth : <EOL> image_depth . set_data ( data ) <EOL> else : <EOL> image_depth = mp . imshow ( data , interpolation = '<STR_LIT>' , animated = True ) <EOL> mp . draw ( ) <EOL> def display_rgb ( dev , data , timestamp ) : <EOL> global image_rgb <EOL> mp . figure ( <NUM_LIT:2> ) <EOL> if image_rgb : <EOL> image_rgb . set_data ( data ) <EOL> else : <EOL> image_rgb = mp . imshow ( data , interpolation = '<STR_LIT>' , animated = True ) <EOL> mp . draw ( ) <EOL> def body ( * args ) : <EOL> if not keep_running : <EOL> raise freenect . Kill <EOL> def handler ( signum , frame ) : <EOL> global keep_running <EOL> keep_running = False <EOL> print ( '<STR_LIT>' ) <EOL> signal . signal ( signal . SIGINT , handler ) <EOL> freenect . runloop ( depth = display_depth , <EOL> video = display_rgb , <EOL> body = body ) </s>
