Opencv haar cascade negative images - python

I want to make an object detector with OpenCV haarcascade. When my project is working, the background will be always white.
How should I add negative images?
Thank you for your support.

Related

ocr image cleansing with python opencv

I'm currently learning about computer vision OCR. I have an image that needs to be scan. I face a problem during the image cleansing.
I use opencv2 in python to do the things. This is the original image:
image = cv2.imread(image_path)
cv2.imshow("imageWindow", image)
I want to cleans the above image, the number at the middle (64) is the area I wanted to scan. However, the number got cleaned as well.
image[np.where((image > [0,0,105]).all(axis=2))] = [255,255,255]
cv2.imshow("imageWindow", image)
What should I do to correct the cleansing here? I wanted to make the screen where the number 64 located is cleansed coz I will perform OCR scan afterwards.
Please help, thank you in advance.
What you're trying to do is called "thresholding". Looks like your technique is recoloring pixels that fall below a certain threshold, but the LCD digit darkness varies enough in that image to throw it off.
I'd spend some time reading about thresholding, here's a good starting place:
Thresholding in OpenCV with Python. You're probably going to need an adaptive technique (like Adaptive Gaussian Thresholding), but you may find other ways that work for your images.

Using a different face detector with dlib's landmark detector

I am currently working on a python implementation of Adrian Rosebrock's video blink detector with dlib blog post:
https://www.pyimagesearch.com/author/adrian/
Basically, I am using dlib's frontal face detector and passing the bounding box around the face to dlib's landmark detector as seen in this picture:
https://imgur.com/xvkfNeG
Sometimes dlib's frontal face detector doesn't find a face, but other face detectors like OpenCV's do. Adrian's blog made it sound like I could use openCV's frontal face detector and pass the bounding box along instead.
However when I do this the landmark detector can't find the eyes of the person correctly as seen in this photo:
https://imgur.com/3eAFFsQ
Is there way I could use an alternative face detector with dlib's landmark detector? Or am I stuck using dlib's frontal face detector because the bounding box passed by a different face detector will be ever so slightly incorrect for the dlib landmark detector?
Thank you for your time!
Checking the images you are providing it just look like you are not passing the correct parameters to the plotting method. The results look correct, just upside-down.
You can use your own face detector. You just have to use dlib.rectangle() function. First, find the bounding boxes from your face detector and after that map them to dlib.rectangle(x,y,w,h).
Then you can pass the bounding boxes from this list to predictor(img, rect).

Dlib face detection from low brightness image

I want to detect face from image with low brightness. I'm using dlib for detecting the face from image. But the dlib detector is detecting no face at all. I've the following code to detect faces from image.
detector=dlib.get_frontal_face_detector()
faces=detector(image)
when i try to print the length of the faces it displays zero.
Can anybody help me, what shall I do? Is there other way to detect images from low brightness images? thanks.
Dlib face detector is a very precise one. But as a cost it has low recall, especially when images are bad and/or faces are small.
Try another face detector, like
Seeta https://github.com/seetaface/SeetaFaceEngine
Pico https://github.com/nenadmarkus/pico
or OpenCV
Those may provide detections. But false detections as well.

Counting people in an image using opencv and python

I am new to openCV and python both. I am trying to count people in an image. The image is supposed to be captured with an overhead camera or the way a CCTV camera is placed.
I have converted the colored image into binary image and then inverted the binary image. Then I used bitwise OR on original and inverted binary image so that the background is white and the people are colored.
How to count these people? Is it necessary to use a classifier or can i just count the contours ,if yes then how to count them?
Plus there are some issues with the technique I'm using.
Faces of people are light in color so sometimes only hair are getting extracted.
The dark objects other than people also get extracted.
If the floor is dark it won't give the binary image that is needed.
So is there any other method to achieve what I'm trying to do here?
Not sure but it may worth to check there.
It explain how to perform face recognition using openCV and python in pictures and extand it to webcam here, it's not quite what your looking for but may give you some clue/

Logo recognition in OpenCV

I am currently making an application with OpenCV and a web server that finds certain car brands as part of an ongoing game in my family.
However, I don't know where to start. I googled it but all I found was a post on finding a yellow ball. I want to find a car logo from a picture (which could be angled or glaring) so I identify the car brand and add points to the score.
I know it seems like a tall order but could anybody help?
You could probably use Haar cascades in openCv to do this. You will need to train haar detectors with both positive and negative samples of the logo but there is already utilities in openCv to help you with this. Just read up about haar in openCv documentation

Categories

Resources