diff --git a/mu/logic.py b/mu/logic.py index fc2866829..fc07f2266 100644 --- a/mu/logic.py +++ b/mu/logic.py @@ -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", diff --git a/mu/resources/neopia/03-02_AI_Kamera.py b/mu/resources/neopia/03-02_AI_Kamera.py index c5f0a95f0..4ba206d4f 100644 --- a/mu/resources/neopia/03-02_AI_Kamera.py +++ b/mu/resources/neopia/03-02_AI_Kamera.py @@ -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() \ No newline at end of file