Example #1
0
def capture(l,i):
    try:
        h = Hog_D()
        while True:
            #l.acquire()
            cap = cv2.VideoCapture("http://192.168.1.20"+ str(i) +":800" + str(i) +"/img.png")
            #l.release()

            # Print a message saying we received the image.
            #if cap is not None:
            #    sys.stdout.write("Received image " + str(i) + " ")
            #    for j in range(0,i):
            #        sys.stdout.write(".")
            #    sys.stdout.write("x")
            #    for j in range(i,7):
            #        sys.stdout.write(".")
            #    sys.stdout.write("\n")

            # Run the hog algorithm to find the location of the human being.
            ret, image = cap.read()
            if image is not None:
                l.acquire()
                r = h.get(image)
                l.release()
                if r is not None:
                    cv2.rectangle(image, (r[0],r[1]), (r[0]+r[2],r[1]+r[3]), (0,255,0), 5)
                cv2.imshow("people detector "+str(i), image)
            if cv2.waitKey(1) == 27:
                break
        cap.release()
        cv2.destroyAllWindows()
    except:
        pass