I am using OpenMV in a course project for intruder detection. At first, I tried taking snapshots of my face, but here’s the problem: the images I captured could not be found in Drive D. Also, if I have an old image in Drive D and try to call itand use it in a code, I get an error message: “OS error: Couldn’t find the file.” What should I do?
Hi, you need to reset the board for any new files to show up on the PC. The computer thinks the camera is a USB drive that can’t create files on it’s own, so, it doesn’t rescan the disk except on mount.
As for the camera not being able to find the image you mentioned, os it on the disk? After you reset the system you should be able to see the file on the disk.
I’m sorry for the question but How to reset the board for H7 cam? because i tried to reset it using this code (import machine
machine.reset()) but still the same problem the images i snapshot it didn’t upload in the folder “faces” that i created in the internal storage of the H7 cam
Hi, the Image() constructor opens an image file. It doesn’t save them. You have to call `img.save(“Path”) to save an image.
When I try to recall the image I recently snapped, I still get the same error saying the OS can’t read or recall it even after reset the system
Please post the code from the IDE using the preformatted text option in the forum post editor.
import sensor, image, time
from pyb import Servo, Pin
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time=2000)
clock = time.clock()
servo = Servo(1) # Use P7 pin (Servo 1)
buzzer = Pin("P8", Pin.OUT_PP) # Use P8 pin for buzzer
known_faces = []
for i in range(20):
face = image.Image("/Faces/face_44212-%d.jpg" % i)
known_faces.append(face)
background = sensor.snapshot().copy()
def is_known_face(test_img):
for face in known_faces:
match = test_img.find_lbp(face)
if match > 0:
return True
return False
def door_open():
servo.angle(90)
print("Door Opened")
def door_close():
servo.angle(0)
buzzer.high()
print("Door Closed")
time.sleep(1)
buzzer.low()
while True:
clock.tick()
img = sensor.snapshot()
diff = img.difference(background)
blobs = diff.find_blobs(thresholds=[(20, 255)], pixels_threshold=200, area_threshold=200)
if blobs:
print("Movement Detected")
face_cascade = image.HaarCascade("frontalface", stages=25)
faces = img.find_features(face_cascade, threshold=0.5, scale_factor=1.5)
if faces:
for face_rect in faces:
face_img = img.copy(roi=face_rect)
img.draw_rectangle(face_rect)
if is_known_face(face_img):
print("Authorized Face Detected")
door_open()
else:
print("Intruder Face Detected")
door_close()
else:
print("No face detected")
door_close()
time.sleep(1)
Remove the “/” from the path. That’s an absolute path which doesn’t represent the “/sd” or “/flash” folder where files would be.
Still the same error
Are you doing?
known_faces = []
for i in range(20):
face = image.Image("Faces/face_44212-%d.jpg" % i)
known_faces.append(face)
Yes , I do.
# Untitled - By: Omar Elbeltagy - Mon Aug 4 2025
import sensor, image, time
from pyb import Servo, Pin
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time=2000)
clock = time.clock()
servo = Servo(1) # Use P7 pin (Servo 1)
buzzer = Pin("P8", Pin.OUT_PP) # Use P8 pin for buzzer
known_faces = []
for i in range(20):
face = image.Image("Faces/face_44212-%d.jpg" % i)
known_faces.append(face)
background = sensor.snapshot().copy()
def is_known_face(test_img):
for face in known_faces:
match = test_img.find_lbp(face)
if match > 0:
return True
return False
def door_open():
servo.angle(90)
print("Door Opened")
def door_close():
servo.angle(0)
buzzer.high()
print("Door Closed")
time.sleep(1)
buzzer.low()
while True:
clock.tick()
img = sensor.snapshot()
diff = img.difference(background)
blobs = diff.find_blobs(thresholds=[(20, 255)], pixels_threshold=200, area_threshold=200)
if blobs:
print("Movement Detected")
face_cascade = image.HaarCascade("frontalface", stages=25)
faces = img.find_features(face_cascade, threshold=0.5, scale_factor=1.5)
if faces:
for face_rect in faces:
face_img = img.copy(roi=face_rect)
img.draw_rectangle(face_rect)
if is_known_face(face_img):
print("Authorized Face Detected")
door_open()
else:
print("Intruder Face Detected")
door_close()
else:
print("No face detected")
door_close()
time.sleep(1) # Delay for stability
The name of the files need to match the string you are using…
known_faces = []
for i in range(20):
face = image.Image("Faces/face_44212-%d.jpg" % i)
known_faces.append(face)
Will match:
Faces/face_44212-0.jpg
Faces/face_44212-1.jpg
Faces/face_44212-2.jpg
Faces/face_44212-3.jpg
Faces/face_44212-4.jpg
Faces/face_44212-5.jpg
and etc.
I`m sorry but still the same problem. I use an old version of OpenMV , Does it consider as a cause for this error ?
No, it shouldn’t, is the path you are passing to Image()
face_63190.jpg and the like?
![]()
you mean like this ?
or this
![]()
The second… but again, you have to match the file name. The path matches none of the files you showed.


