func main() { d := freenect.NewFreenectDevice(StartWithDevice) var s scanner.Scanner s.Init(os.Stdin) var cmd string var arg int = OutOfRange fmt.Print("gonect> ") tok := s.Scan() for tok != scanner.EOF { if scanner.TokenString(tok) == "Ident" { cmd = s.TokenText() } switch { case cmd == "help": showHelpMessage() break case cmd == "tilt": s.Scan() arg, _ = strconv.Atoi(s.TokenText()) if arg == OutOfRange { break } d.SetTiltDegs(arg) cmd = "" arg = OutOfRange case cmd == "led": s.Scan() led_string := s.TokenText() flash_led(d, led_string) break case cmd == "rgb_frame": s.Scan() filename := s.TokenText() freenect.SaveRGBAFrame(d, filename) break case cmd == "ir_frame": s.Scan() filename := s.TokenText() freenect.SaveIRFrame(d, filename) break case cmd == "depth_frame": s.Scan() filename := s.TokenText() freenect.SaveDepthFrame(d, filename) break case cmd == "quit": return } fmt.Printf("gonect> ") s.Scan() } }
func main() { d := freenect.NewFreenectDevice(0) fmt.Println("Number of devices: ", d.GetNumDevices()) DoTilting(d) DoLed(d) fmt.Println("Saving RGBA image to TestRGBA.jpg") freenect.SaveRGBAFrame(d, "TestRGBA.jpg") fmt.Println("Saving IR image to TestIR.jpg") freenect.SaveIRFrame(d, "TestIR.jpg") fmt.Println("Saving depth image to TestDepth.jpg") freenect.SaveDepthFrame(d, "TestDepth.jpg") d.Stop() d.Shutdown() }