I've used a sequential model including several convolutional layers to recognize thumb finger from index finger in images.
The trained model works pretty well to recognize if the picture has the thumb or index finger inside. Now, I want to add script to draw a box around the recognized finger in the new image which I want to apply the model on it.
I need the box to extract the finger from the image after recognition step. could someone help me please?
-
You can use rectangle function in cv2ikibir– ikibir2020-07-10 09:01:40 +00:00Commented Jul 10, 2020 at 9:01
-
1What is the output of your trained model?Rahul Kedia– Rahul Kedia2020-07-10 09:02:20 +00:00Commented Jul 10, 2020 at 9:02
Add a comment
|
1 Answer
Using cv2 rectangle function,
(locations, preditions) = detect_and_predict_class(test_image, model) # make predictions from your model
for (box, pred) in zip(locationss, predictions):
(startX, startY, endX, endY) = box # box coordinates returned from your model's predictions
cv2.rectangle(input_image, (startX, startY), (endX, endY), color, 2) # color is the color of the bounding box you would like & 2 is the thickness of the bounding box
Reference to sample example: