0

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?

2
  • You can use rectangle function in cv2 Commented Jul 10, 2020 at 9:01
  • 1
    What is the output of your trained model? Commented Jul 10, 2020 at 9:02

1 Answer 1

1

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:

Geeks for geeks sample on how to use

CV2 rectangle documentation

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.