1
I detect people using Opencv and python, but I need to customize my ROI. I can only draw it rectangular, I would like a custom shape as in the picture.
1
I detect people using Opencv and python, but I need to customize my ROI. I can only draw it rectangular, I would like a custom shape as in the picture.
Browser other questions tagged python opencv
You are not signed in. Login or sign up in order to post.
You can create a non-rectangular ROI using an image size mask (fully zeroed image) and drawing the polygon you want (white dots).
– Begnini
How could I do that? Is there an example I can follow?
– Márcio
I put an example in https://gist.github.com/begnini/0194ba7f26e23a8c18d37f6188062922
– Begnini
I looked there, I ran the code, but it’s all black. I loaded my image in "image = cv2.imread ( ' myImage.jpg ' )" and gave a cv2.imshow ("Roi", Masked) and everything went black.
– Márcio
My code generates the following image https://i.imgur.com/kojGSku.jpg
– Begnini
Are you displaying the image with cv2.imshow('Roi',Masked)? Here is giving error precisely in imshow to display the Masked. It gives accessibility error "Error retrieving Accessibility bus address", but only when I have it displayed with imshow, if I comment the imshow, it runs without error, but I don’t see anything. rsrsrs
– Márcio
I created a polyline (cv.polylines) to serve as a base and can see the drawing of the area to have a reference. But I’m having trouble detecting, with you in a rectangle. Uso o código da seguinte forma: gray = cv2.cvtColor(frame[:,:], cv2.COLOR_BGR2GRAY)

 detect_area = gray[y_DetectAreaA:y_DetectAreaA+h_DetectAreaA, x_DetectAreaA:x_DetectAreaA+w_DetectAreaA]


people = faceCascade.detectMultiScale( detect_area, scaleFactor=1.4, minNeighbors=45, minSize=(35, 35), flags=cv2.CASCADE_SCALE_IMAGE )
– Márcio