mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Return FR_NO_FILE if built-in cascade not found
This commit is contained in:
parent
6c1d1ede81
commit
9d51051ba8
@ -292,6 +292,8 @@ error:
|
||||
|
||||
int imlib_load_cascade_from_flash(cascade_t *cascade, const char *path)
|
||||
{
|
||||
FRESULT res=FR_OK;
|
||||
|
||||
if (strcmp(path, "frontalface") == 0) {
|
||||
cascade->window.w = frontalface_window_w;
|
||||
cascade->window.h = frontalface_window_h;
|
||||
@ -316,8 +318,11 @@ int imlib_load_cascade_from_flash(cascade_t *cascade, const char *path)
|
||||
cascade->num_rectangles_array= (int8_t *)eye_num_rectangles_array;
|
||||
cascade->weights_array = (int8_t *)eye_weights_array;
|
||||
cascade->rectangles_array = (int8_t *)eye_rectangles_array;
|
||||
} else {
|
||||
res = FR_NO_FILE;
|
||||
}
|
||||
return 0;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int imlib_load_cascade(cascade_t *cascade, const char *path)
|
||||
|
||||
@ -1,24 +1,30 @@
|
||||
import sensor, time
|
||||
|
||||
# Reset sensor
|
||||
sensor.reset()
|
||||
# Set sensor brightness
|
||||
|
||||
# Sensor settings
|
||||
sensor.set_contrast(1)
|
||||
# Set sensor gainceiling
|
||||
sensor.set_gainceiling(16)
|
||||
# Set framesize
|
||||
sensor.set_framesize(sensor.QCIF)
|
||||
# Set sensor to grayscale
|
||||
sensor.set_framesize(sensor.QQVGA)
|
||||
sensor.set_pixformat(sensor.GRAYSCALE)
|
||||
|
||||
# Load Haar Cascade
|
||||
face_cascade = HaarCascade("/frontalface.cascade")
|
||||
face_cascade = HaarCascade("frontalface")
|
||||
print(face_cascade)
|
||||
|
||||
# FPS clock
|
||||
clock = time.clock()
|
||||
while (True):
|
||||
clock.tick()
|
||||
# Capture snapshot
|
||||
image = sensor.snapshot()
|
||||
objects = image.find_features(face_cascade, threshold=0.65, scale=1.65)
|
||||
# Find objects
|
||||
objects = image.find_features(face_cascade, threshold=0.65, scale=1.85)
|
||||
# Draw objects
|
||||
for r in objects:
|
||||
image.draw_rectangle(r)
|
||||
#Add delay to see drawing on FB
|
||||
time.sleep(10)
|
||||
#Add delay to see drawing on FB
|
||||
time.sleep(100)
|
||||
|
||||
print (clock.fps())
|
||||
|
||||
@ -1,18 +1,17 @@
|
||||
import sensor, time
|
||||
#sensor.reset()
|
||||
# Set framesize
|
||||
sensor.set_framesize(sensor.QQVGA)
|
||||
# Set sensor to grayscale
|
||||
sensor.set_pixformat(sensor.GRAYSCALE)
|
||||
# Set sensor contrast
|
||||
# Reset sensor
|
||||
sensor.reset()
|
||||
|
||||
# Sensor settings
|
||||
sensor.set_contrast(1)
|
||||
# Set sensor gainceiling
|
||||
sensor.set_gainceiling(16)
|
||||
sensor.set_framesize(sensor.QQVGA)
|
||||
sensor.set_pixformat(sensor.GRAYSCALE)
|
||||
|
||||
def find_face():
|
||||
global sensor, time
|
||||
# Load Haar Cascade
|
||||
face_cascade = HaarCascade("/frontalface.cascade")
|
||||
face_cascade = HaarCascade("frontalface")
|
||||
while (True):
|
||||
image = sensor.snapshot()
|
||||
objects = image.find_features(face_cascade, threshold=0.65, scale=1.85)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user