Skip to content

Commit

Permalink
Fix a wrong file name issue on boot time
Browse files Browse the repository at this point in the history
  • Loading branch information
JeongJun-Lee committed Oct 10, 2024
1 parent adbf744 commit aeb0e21
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 46 deletions.
6 changes: 3 additions & 3 deletions mu/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@
"02-04-02_Aqlli_avtomobil.py",
"02-05-01_Chiziq_trekeri.py",
"02-05-02_Chiziq_trekeri.py",
"03-01_AI_Radiokarnay",
"03-02_AI_Kamera",
"03-03_AI_Obyekt_topish",
"03-01_AI_Radiokarnay.py",
"03-02_AI_Kamera.py",
"03-03_AI_Obyekt_topish.py",
"04-01_Fonar.py",
"04-03-01_Aqlli_avtomobil_2.py",
"04-03-02_Aqlli_avtomobil_2.py",
Expand Down
50 changes: 7 additions & 43 deletions mu/resources/neopia/03-02_AI_Kamera.py
Original file line number Diff line number Diff line change
@@ -1,48 +1,12 @@
from pgzhelper import *
from pgzhelper import Util
from neopia import *

n = Neosoco()
fd = FaceDetection()

WIDTH = 640
HEIGHT = 480
pygame_img = None
detected = False
red_led = Actor('red_led_off', (600, 60))
red_led.images = ['red_led_on', 'red_led_off']
red_led.scale = 0.5
red_led.fps = 15

fd = FaceDetection()
if fd.camera_open(1) is False:
game.exit()

def draw():
if detected:
screen.blit(pygame_img, (0, 0))
red_led.draw()
n.led_on()
n.buzzer()
n.led_off()
else:
screen.blit('living_room', (0, 0))

def update():
global pygame_img
global detected

frame, faces = fd.start_detection(just_rtn_frame=True)
pygame_img = Util.opencv_to_pygame_img(frame)

if faces > 0:
detected = True
red_led.next_image()
print('Detected!!!')
else:
detected = False


def on_key_down(key):
if key == keys.SPACE:
game.exit()
if fd.camera_open(0):
while True:
if fd.start_detection() > 0:
print('Kimdir kirdi!!!')
n.led_on()
n.buzzer()
n.led_off()

0 comments on commit aeb0e21

Please sign in to comment.