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
Example #2
0
 def __init__(self, i, l):
     threading.Thread.__init__(self)
     self.i = i
     self.l = l
     self.running = True
     self.h = Hog_D()
     self.hog = None
     self.image = None
Example #3
0
class capture(threading.Thread):

    def __init__(self, i, l):
        threading.Thread.__init__(self)
        self.i = i
        self.l = l
        self.running = True
        self.h = Hog_D()
        self.hog = None
        self.image = None

    def stop(self):
        self.running = False

    def getHog(self):
        r = None
        r = self.hog
        return r

    def getImage(self):
        img = None
        img = self.image
        return img

    def run(self):
        i = self.i

        while self.running == True:
            image = url_to_image("http://192.168.1.20"+ str(i) +":800" + str(i) +"/img.png")

            self.l.acquire()
            self.image = image
            self.l.release()

            # Run the hog algorithm to find the location of the human being.
            if image is not None:
                hog = self.h.hog_f(image)
                self.l.acquire()
                self.hog = hog
                self.l.release()
Example #4
0
import cv2
#import numpy as np
import time
from hog_try import Hog_D

streams = [
"0"#,
#"1"#,
#"2",
#"3",
#"4",
#"5",
#"6",
#"7"
]
h = Hog_D()
while True:
    for i in streams:
        cap = cv2.VideoCapture("http://192.168.1.20"+ i +":800" + i +"/img.png")
        ret, image = cap.read()
        if image is not None:
            r = h.hog_f(image)
            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()