diff --git a/FaceDetectionComparison/face_detection_dlib_hog.py b/FaceDetectionComparison/face_detection_dlib_hog.py index bef5d322f..f26559be3 100644 --- a/FaceDetectionComparison/face_detection_dlib_hog.py +++ b/FaceDetectionComparison/face_detection_dlib_hog.py @@ -1,4 +1,4 @@ - +from __future__ import division import cv2 import dlib import time @@ -25,7 +25,7 @@ def detectFaceDlibHog(detector, frame, inHeight=300, inWidth=0): cvRect = [int(faceRect.left()*scaleWidth), int(faceRect.top()*scaleHeight), int(faceRect.right()*scaleWidth), int(faceRect.bottom()*scaleHeight) ] bboxes.append(cvRect) - cv2.rectangle(frameDlibHog, (cvRect[0], cvRect[1]), (cvRect[2], cvRect[3]), (0, 255, 0), round(frameHeight/150), 4) + cv2.rectangle(frameDlibHog, (cvRect[0], cvRect[1]), (cvRect[2], cvRect[3]), (0, 255, 0), int(round(frameHeight/150)), 4) return frameDlibHog, bboxes if __name__ == "__main__" : diff --git a/FaceDetectionComparison/face_detection_dlib_mmod.py b/FaceDetectionComparison/face_detection_dlib_mmod.py index 11b517b45..916940600 100644 --- a/FaceDetectionComparison/face_detection_dlib_mmod.py +++ b/FaceDetectionComparison/face_detection_dlib_mmod.py @@ -1,4 +1,4 @@ - +from __future__ import division import cv2 import dlib import time @@ -25,7 +25,7 @@ def detectFaceDlibMMOD(detector, frame, inHeight=300, inWidth=0): cvRect = [int(faceRect.rect.left()*scaleWidth), int(faceRect.rect.top()*scaleHeight), int(faceRect.rect.right()*scaleWidth), int(faceRect.rect.bottom()*scaleHeight) ] bboxes.append(cvRect) - cv2.rectangle(frameDlibMMOD, (cvRect[0], cvRect[1]), (cvRect[2], cvRect[3]), (0, 255, 0), round(frameHeight/150), 4) + cv2.rectangle(frameDlibMMOD, (cvRect[0], cvRect[1]), (cvRect[2], cvRect[3]), (0, 255, 0), int(round(frameHeight/150)), 4) return frameDlibMMOD, bboxes if __name__ == "__main__" : diff --git a/FaceDetectionComparison/face_detection_opencv_dnn.py b/FaceDetectionComparison/face_detection_opencv_dnn.py index ac6a69cd3..d1f0c0eee 100644 --- a/FaceDetectionComparison/face_detection_opencv_dnn.py +++ b/FaceDetectionComparison/face_detection_opencv_dnn.py @@ -1,4 +1,4 @@ - +from __future__ import division import cv2 import time import sys @@ -20,7 +20,7 @@ def detectFaceOpenCVDnn(net, frame): x2 = int(detections[0, 0, i, 5] * frameWidth) y2 = int(detections[0, 0, i, 6] * frameHeight) bboxes.append([x1, y1, x2, y2]) - cv2.rectangle(frameOpencvDnn, (x1, y1), (x2, y2), (0, 255, 0), round(frameHeight/150), 8) + cv2.rectangle(frameOpencvDnn, (x1, y1), (x2, y2), (0, 255, 0), int(round(frameHeight/150)), 8) return frameOpencvDnn, bboxes if __name__ == "__main__" : diff --git a/FaceDetectionComparison/face_detection_opencv_haar.py b/FaceDetectionComparison/face_detection_opencv_haar.py index 002939945..9a6b03ca1 100644 --- a/FaceDetectionComparison/face_detection_opencv_haar.py +++ b/FaceDetectionComparison/face_detection_opencv_haar.py @@ -1,4 +1,4 @@ - +from __future__ import division import cv2 import time import sys @@ -27,7 +27,7 @@ def detectFaceOpenCVHaar(faceCascade, frame, inHeight=300, inWidth=0): int(x2 * scaleWidth), int(y2 * scaleHeight)] bboxes.append(cvRect) cv2.rectangle(frameOpenCVHaar, (cvRect[0], cvRect[1]), (cvRect[2], cvRect[3]), (0, 255, 0), - round(frameHeight / 150), 4) + int(round(frameHeight / 150)), 4) return frameOpenCVHaar, bboxes if __name__ == "__main__" : diff --git a/FaceDetectionComparison/run-all.py b/FaceDetectionComparison/run-all.py index 0af5bd710..a4a36d96f 100644 --- a/FaceDetectionComparison/run-all.py +++ b/FaceDetectionComparison/run-all.py @@ -1,4 +1,4 @@ - +from __future__ import division import cv2 import dlib import time @@ -55,7 +55,7 @@ def detectFaceOpenCVHaar(faceCascade, frame, inHeight=300, inWidth=0): int(x2 * scaleWidth), int(y2 * scaleHeight)] bboxes.append(cvRect) cv2.rectangle(frameOpenCVHaar, (cvRect[0], cvRect[1]), (cvRect[2], cvRect[3]), (0, 255, 0), - round(frameHeight / 150), 4) + int(round(frameHeight / 150)), 4) return frameOpenCVHaar, bboxes @@ -77,7 +77,7 @@ def detectFaceOpenCVDnn(net, frame): x2 = int(detections[0, 0, i, 5] * frameWidth) y2 = int(detections[0, 0, i, 6] * frameHeight) bboxes.append([x1, y1, x2, y2]) - cv2.rectangle(frameOpencvDnn, (x1, y1), (x2, y2), (0, 255, 0), round(frameHeight/150), 8) + cv2.rectangle(frameOpencvDnn, (x1, y1), (x2, y2), (0, 255, 0), int(round(frameHeight/150)), 8) return frameOpencvDnn, bboxes @@ -102,7 +102,7 @@ def detectFaceDlibHog(detector, frame, inHeight=300, inWidth=0): cvRect = [int(faceRect.left()*scaleWidth), int(faceRect.top()*scaleHeight), int(faceRect.right()*scaleWidth), int(faceRect.bottom()*scaleHeight) ] bboxes.append(cvRect) - cv2.rectangle(frameDlibHog, (cvRect[0], cvRect[1]), (cvRect[2], cvRect[3]), (0, 255, 0), round(frameHeight/150), 4) + cv2.rectangle(frameDlibHog, (cvRect[0], cvRect[1]), (cvRect[2], cvRect[3]), (0, 255, 0), int(round(frameHeight/150)), 4) return frameDlibHog, bboxes @@ -127,7 +127,7 @@ def detectFaceDlibMMOD(detector, frame, inHeight=300, inWidth=0): cvRect = [int(faceRect.rect.left()*scaleWidth), int(faceRect.rect.top()*scaleHeight), int(faceRect.rect.right()*scaleWidth), int(faceRect.rect.bottom()*scaleHeight) ] bboxes.append(cvRect) - cv2.rectangle(frameDlibMMOD, (cvRect[0], cvRect[1]), (cvRect[2], cvRect[3]), (0, 255, 0), round(frameHeight/150), 4) + cv2.rectangle(frameDlibMMOD, (cvRect[0], cvRect[1]), (cvRect[2], cvRect[3]), (0, 255, 0), int(round(frameHeight/150)), 4) return frameDlibMMOD, bboxes