Example #1
0
def show_img(img):
    display = Display()
    img.show()

    # Wait for user to close the window or break out of it.
    while display.isNotDone():
        try:
            pass
        except KeyboardInterrupt:
            display.done = True
        if display.mouseRight:
            display.done = True
    display.quit()
Example #2
0
        if ((tmpImg.width + tmpImg.height) == 2 * box_dim):
            #            cv2.imshow('classify',tmpImg.getNumpyCv2())
            tmpImg.save(display)
            result = tkMessageBox.askquestion(
                "Wildebeest!",
                "Is this one? (no if you don't know)",
                icon='warning',
                type='yesnocancel')
            if result == 'yes':
                save_path = "yes/img-" + str(counter) + ".png"
                tmpImg.save(save_path)
                fcount += 1
                counter += 1
            if result == 'no':
                save_path = "no/img-" + str(counter) + ".png"
                tmpImg.save(save_path)
                counter += 1
            if result == 'cancel':
                display.done = True
                break

        # Display the resulting frame
#       cv2.imshow('frame',frame)
#       if cv2.waitKey(1) & 0xFF == ord('q'):
#           break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
display.quit()
from time import sleep

kinect  = Kinect()
display = Display((640, 480))

pdepth = kinect.getDepth().invert()

ds = MOGSegmentation(history = 500, nMixtures = 5, backgroundRatio = 0.1, noiseSigma = 5, learningRate = 0.3)
ds.addImage(pdepth)

while not display.isDone():
    depth = kinect.getDepth()
    ds.addImage(depth)

    df = ds.getSegmentedImage(False)

    """
    if df is not None:
        print "diffed"
        blobs = df.dilate(3).findBlobs()

        if blobs is not None:
            df.dl().polygon(blobs[-1].mConvexHull, color = Color.RED)   
    """

    df.save(display)    

    if display.mouseLeft:
        display.done = True
        del kinect
        #pg.quit()