vision_detect · Object, QR, hand and pose recognition¶
Detects objects, QR codes, poses, hand gestures and markers.
Class:
putTextPIL()
Detect
- openpibo.vision_detect.putTextPIL(img, text, points, size=30, colors=(255, 255, 255))[source]¶
Writes text on an image. (Korean/English supported - uses pillow)- COPY
- Parameters:
img (numpy.ndarray) – Image object
text (str) – Text to display
points (tuple(int, int)) – Top-left coordinates of the text block (x, y)
size (int) – Font size of the text
colors (tuple(int, int, int)) – Text color BGR value (b, g, r) or hex value ‘#rrggbb’
- class openpibo.vision_detect.Detect[source]¶
Bases:
objectFunctions:
load_hand_gesture_model()detect_object()detect_qr()detect_pose()analyze_pose()classify_image()object_tracker_init()track_object()detect_marker()detect_marker_vis()A class that provides various detection functions.
Object detection among 80 classes (YOLO11s, onnxruntime)
QR/barcode detection (pyzbar)
Pose detection
Image classification
example:
from openpibo.vision_detect import Detect detect = Detect() # 아래의 모든 예제 이전에 위 코드를 먼저 사용합니다.
- load_hand_gesture_model(modelpath='/home/pi/.model/hand/gesture_recognizer.task')[source]¶
Loads a hand gesture recognition model.
- Parameters:
modelpath (str) – Path of the hand gesture recognition model
- recognize_hand_gesture(image)[source]¶
Recognizes hand gestures.
- Parameters:
img (numpy.ndarray) – Image object
- Returns:
Hand gesture recognition result depending on the model
- recognize_hand_gesture_vis(img, items)[source]¶
Displays the hand gesture recognition result.
- Parameters:
img (numpy.ndarray) – Image object
items (array) – Hand gesture recognition result
- load_object_model(modelpath='/home/pi/.model/object/yolo11s.onnx')[source]¶
Loads a detection model.
- Parameters:
modelpath (str) – Path of the object detection model
- detect_object(img)[source]¶
Displays the object detection result.
- Parameters:
img (numpy.ndarray) – Image object
items (array) – Object detection result
- detect_object_vis(img, items)[source]¶
Displays the object detection result.
- Parameters:
img (numpy.ndarray) – Image object
items (array) – Object detection result
- detect_qr(img)[source]¶
Detects QR codes and barcodes in an image.
example:
img = camera.read() detect.detect_qr(img)
- Parameters:
img (numpy.ndarray) – Image object
- Returns:
{"data": content, "type": barcode / QR code, "position":(startX,startY,endX,endY)}
- detect_qr_vis(img, items)[source]¶
Displays the QR/barcode result.
- Parameters:
img (numpy.ndarray) – Image object
items (array) – QR detection result
- detect_pose(img)[source]¶
Detects poses in an image.
example:
img = camera.read() detect.detect_pose(img)
- Parameters:
img (numpy.ndarray) – Image object
- Returns:
detection result
- detect_pose_vis(img, items)[source]¶
Displays the pose.
- Parameters:
img (numpy.ndarray) – Image object
items (array) – Pose data
- analyze_pose(data)[source]¶
Analyzes the result of the detect_pose function.
example:
img = camera.read() result = detect.detect_pose(img) detect.analyze_pose(result)
- Parameters:
data (dict) – Image object
- Returns:
list of detected poses ['left_hand_up', 'right_hand_up', 'clap']
- object_tracker_init(img, p)[source]¶
Sets up an object tracker in an image.
example:
img = camera.read() detect.object_tracker_init(img)
- Parameters:
img (numpy.ndarray) – Image object
- track_object(img)[source]¶
Updates the object tracker in an image.
example:
img = camera.read() detect.object_tracker_init(img, (10,10,100,100)) position = detect.track_object(img)
- Parameters:
img (numpy.ndarray) – Image object
- Returns:
x1,y1,x2,y2 updated object position
- track_object_vis(img, item)[source]¶
Displays the marker result.
- Parameters:
img (numpy.ndarray) – Image object
items (array) – Marker result