aboutsummaryrefslogtreecommitdiff
path: root/nicla/signs_detect.py
diff options
context:
space:
mode:
authorUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2023-06-06 12:08:31 +0200
committerUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2023-06-06 12:08:31 +0200
commite239429c8885a7c152194a9f25401204258a0fbd (patch)
tree2a33d0003e705a75c7c6e7884606d61e4796a491 /nicla/signs_detect.py
parent46acbbb6fd27cc00dadcc9118d774ae674f8eef5 (diff)
cleanup
Diffstat (limited to 'nicla/signs_detect.py')
-rw-r--r--nicla/signs_detect.py21
1 files changed, 0 insertions, 21 deletions
diff --git a/nicla/signs_detect.py b/nicla/signs_detect.py
index c996a88..baf62e8 100644
--- a/nicla/signs_detect.py
+++ b/nicla/signs_detect.py
@@ -1,12 +1,7 @@
-# Hello World Example
-#
-# Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!
-
import sensor, image, time
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
-#sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.HVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS.
@@ -15,28 +10,20 @@ clock = time.clock() # Create a clock object to track the FPS.
def init_kpts(str):
temp_img = image.Image(f"./{str}.jpg", copy_to_fb=True)
temp_img.to_grayscale()
-
kpts = temp_img.find_keypoints(max_keypoints=128, threshold=kpts_threshold, corner_detector=kpts_corner, scale_factor=1.2)
return kpts
def match_kpts(kpts0, kpts1):
if kpts0 is not None and kpts1 is not None:
-
match = image.match_descriptor(kpts0, kpts1, threshold=70)
#print("matched:%d dt:%d"%(match.count(), match.theta()))
-
if match.count() > 0:
print(match.count())
-
return match.count() > 1
-
else:
return 0
def read_red_sign(val, img, kpts):
-
- #img.draw_keypoints(kpts,255)
-
if match_kpts(kpts, stop):
img.draw_rectangle(val.rect())
#img.draw_cross(match.cx(), match.cy(), size=10)
@@ -80,7 +67,6 @@ while(True):
img = img.to_grayscale()
if(len(blobs_r) > 0 or len(blobs_b) > 0):
-
kpts_img = img.find_keypoints(max_keypoints=255, threshold=kpts_threshold, corner_detector=kpts_corner)
for index, b in enumerate(blobs_r):
@@ -88,10 +74,3 @@ while(True):
for index, b in enumerate(blobs_b):
read_blu_sign(b, img, kpts_img)
-
-
- # Note: OpenMV Cam runs about half as fast when connected
- # to the IDE. The FPS should increase once disconnected.
- #img = gr
-
- #print("EOC")