Summer Fang
Summer Fang

Reputation: 286

Opencv Cascade classification instead of detection

I have trained my classifiers by using Cascade classification from opencv for object classification.

I have three classes and I have got three *.xml files.

I know one region of the image must be one of the three classes.

However by using opencv, only detectMultiScale function is provided, I must scan the image (or ROI) to find all possible objects in it.

Is there method to classify whether one image(or roi) is matching a specified object or not?

Thank you!

Upvotes: 0

Views: 244

Answers (1)

jrsh
jrsh

Reputation: 380

From your question I understand that you want to classify three separate ROIs of an image. You might want to create three crops for the defined ROIs:

import cv2
img = cv2.imread("full_image.png")
crop_img1 = img[y:y+h, x:x+w]
#create crop_img2 and crop_img3 analogously

And apply a classifier on each of the three cropped images.

Upvotes: 2

Related Questions