Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Object detection rectangle doesn't cover whole object

$
0
0
Hello everyone, I just started to work with openCV. I decided to use this library to detect an object on image and cut it from them. I trained cascade, unfortunately it doesn't work very well. I tried it on several images and every time rectangle doesn't cover a whole object. Here are examples: [1](https://pp.vk.me/c637826/v637826722/2d3cb/X3yMDYPNpcc.jpg), [2](https://pp.vk.me/c637826/v637826722/2d3c2/_9A9FCAMT4g.jpg), [3](https://pp.vk.me/c637826/v637826722/2d3b9/EWoprUX4_PM.jpg) import cv2 image = cv2.imread("data/test/4.jpg") resized = image #resized = cv2.resize(image, (500, 500)) gray = cv2.cvtColor(resized, cv2.COLOR_BGR2GRAY) detector = cv2.CascadeClassifier("output/cascade/cascade.xml") rects = detector.detectMultiScale(gray, scaleFactor=1.3, minNeighbors=10, minSize=(100, 100)) # loop over the cat faces and draw a rectangle surrounding each for (i, (x, y, w, h)) in enumerate(rects): cv2.rectangle(resized, (x, y), (x + w, y + h), (0, 0, 255), 2) # show the detected cat faces cv2.imshow("Bags", resized) cv2.waitKey(0) Could anyone help me to understand what do I need to tune or fix. I used handbags images from ImageNet.

Viewing all articles
Browse latest Browse all 19555

Trending Articles