I'm working on sign language recognition (hand gestures) using OpenCV. I want to select a particular region (ROI) as input from the entire frame and give it to the model. Right now, I'm able to do the same with the entire frame but can't have ROI. This is the code I've tried so far :
_, image_frame = cam_capture.read()
r = cv2.rectangle(image_frame, upper_left, bottom_right, (100, 50, 200), 5)
rect_img = image_frame[upper_left[1] : bottom_right[1], upper_left[0] : bottom_right[0]]
sketcher_rect = rect_img
sketcher_rect = sketch_transform(sketcher_rect)
cv2.resize(sketcher_rect, (28,28), interpolation = cv2.INTER_AREA)
pred_probab, pred_class = keras_predict(model, sketcher_rect)
print(pred_class, pred_probab)
cv2.imshow('image_frame',sketcher_rect)
Any help ?