Skip to content

Instantly share code, notes, and snippets.

@amarlearning
Created July 28, 2018 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amarlearning/238ff29ba026e3ec8000be50bdd534e2 to your computer and use it in GitHub Desktop.
Save amarlearning/238ff29ba026e3ec8000be50bdd534e2 to your computer and use it in GitHub Desktop.
def hand_histogram(frame):
global hand_rect_one_x, hand_rect_one_y
hsv_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
roi = np.zeros([90, 10, 3], dtype=hsv_frame.dtype)
for i in range(total_rectangle):
roi[i * 10: i * 10 + 10, 0: 10] = hsv_frame[hand_rect_one_x[i]:hand_rect_one_x[i] + 10,
hand_rect_one_y[i]:hand_rect_one_y[i] + 10]
hand_hist = cv2.calcHist([roi], [0, 1], None, [180, 256], [0, 180, 0, 256])
return cv2.normalize(hand_hist, hand_hist, 0, 255, cv2.NORM_MINMAX)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment