#!/usr/bin/python import pygame as pg from operator import add from simplecv.factory import Factory from simplecv.display import Display from simplecv.image_set import ImageSet d = Display(flags=pg.FULLSCREEN) #create video streams cam = Factory.Kinect() #initialize the camera frames_to_blur = 4 frames = ImageSet() depth = cam.getDepth().stretch(0, 200) while True: new_depth = cam.getDepth().stretch(0, 200) img = cam.getImage() diff_1 = new_depth - depth diff_2 = depth - new_depth diff = diff_1 + diff_2 img_filter = diff.binarize(0) motion_img = img - img_filter motion_img_open = motion_img.morph_open() frames.append(motion_img_open) if len(frames) > frames_to_blur: frames.pop(0)
sudo apt-get install python-zbar Then line up the item in the red box and left click the mouse to tell the program to try and read the barcode ''' print __doc__ import time import csv from simplecv import Color, ColorCurve, Camera, Image, pg, np, cv from simplecv.display import Display cam = Camera() display = Display((800, 600)) data = "None" mydict = dict() myfile = "barcode-list.csv" while display.isNotDone(): display.checkEvents() #check for mouse clicks img = cam.getImage() img.draw_rectangle(img.width / 4, img.height / 4, img.width / 2, img.height / 2, color=Color.RED, width=3) if display.mouseLeft: # click the mouse to read img.draw_text("reading barcode... wait", 10, 10)