Hi, all. I’m iteratively rotating then testing an image with the Haar Cascade face detection algorithm to account for head and/or camera tilt. For example:
sensor.reset()
sensor.set_contrast(3)
sensor.set_gainceiling(16)
sensor.set_framesize(sensor.HQVGA)
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.skip_frames(time = 2000)
face_cascade = image.HaarCascade(“frontalface”, stages=25)
while (True):
# Capture snapshot
img = sensor.snapshot()
for angle in [-30, 30, 30]:
img.rotation_corr(x_rotation=0.0, y_rotation=0.0, z_rotation=angle)
objects = img.find_features(face_cascade, threshold=0.75, scale_factor=1.25)
This works reasonably well with three angles as above, but if I attempt a more granular series of rotations, even with only five angles, performance devolves substantially as does the image itself.
e.g.: for angle in [-30, 15, 15, 15, 15]:
The resultant image after the fifth rotation is very grainy and overall performance suffers.
Any suggestions as to how to optimize this?
Thanks,
Rick