Last active
May 25, 2017 20:09
-
-
Save erogol/e35f58d7f94c9bf6540b0d9571c619a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# thresholding difference frame for filling holes and noise reduction | |
# finding contours of moving regions | |
thresh = cv2.threshold(frameDelta, conf["delta_thresh"], 255, | |
cv2.THRESH_BINARY)[1] | |
thresh = cv2.dilate(thresh, None, iterations=2) | |
im2 ,cnts, _ = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, | |
cv2.CHAIN_APPROX_SIMPLE) | |
# loop over the contours | |
for c in cnts: | |
# if the contour is too small, ignore it | |
if cv2.contourArea(c) < conf["min_area"]: | |
continue | |
# compute the bounding box for the contour, draw it on the frame, | |
# and update the text | |
(x, y, w, h) = cv2.boundingRect(c) | |
cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2) | |
text = "Occupied" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment