From 6561b600ec07a863a5f651fdc176de53d94da447 Mon Sep 17 00:00:00 2001 From: vikas Date: Fri, 26 Oct 2018 09:34:03 +0530 Subject: [PATCH] bug fix in handPose code --- HandPose/handPoseImage.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/HandPose/handPoseImage.py b/HandPose/handPoseImage.py index d9bf2f29b..2d3db8256 100644 --- a/HandPose/handPoseImage.py +++ b/HandPose/handPoseImage.py @@ -1,3 +1,4 @@ +from __future__ import division import cv2 import time import numpy as np @@ -8,11 +9,11 @@ POSE_PAIRS = [ [0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[0,9],[9,10],[10,11],[11,12],[0,13],[13,14],[14,15],[15,16],[0,17],[17,18],[18,19],[19,20] ] net = cv2.dnn.readNetFromCaffe(protoFile, weightsFile) -frame = cv2.imread("right-frontal.jpg") +frame = cv2.imread("g3.jpg") frameCopy = np.copy(frame) frameWidth = frame.shape[1] frameHeight = frame.shape[0] -aspect_ratio = float(frameWidth)/frameHeight +aspect_ratio = frameWidth/frameHeight threshold = 0.1 @@ -20,7 +21,7 @@ # input image dimensions for the network inHeight = 368 inWidth = int(((aspect_ratio*inHeight)*8)//8) -inpBlob = cv2.dnn.blobFromImage(frame, 1.0 / 255, (inHeight, inWidth), (0, 0, 0), swapRB=False, crop=False) +inpBlob = cv2.dnn.blobFromImage(frame, 1.0 / 255, (inWidth, inHeight), (0, 0, 0), swapRB=False, crop=False) net.setInput(inpBlob)