vision_detect · 사물·QR·손·포즈 인식¶
사물·QR코드·포즈·손동작·마커를 인식합니다.
Class:
putTextPIL()
Detect
- openpibo.vision_detect.putTextPIL(img, text, points, size=30, colors=(255, 255, 255))[소스]¶
이미지에 문자를 입력합니다. (한/영 가능 - pillow 이용)- COPY
- 매개변수:
img (numpy.ndarray) – 이미지 객체
text (str) – 표시할 문자열
points (tuple(int, int)) – 텍스트 블록 좌측상단 좌표 (x, y)
size (int) – 표시할 글자의 크기
colors (tuple(int, int, int)) – 글자 색깔 BGR 값 (b, g, r) or 16진수 값 ‘#rrggbb’
- class openpibo.vision_detect.Detect[소스]¶
기반 클래스:
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()인식과 관련된 다양한 기능을 사용할 수 있는 클래스입니다.
80개 class 안에서의 객체 인식 (YOLO11s, onnxruntime)
QR/바코드 인식 (pyzbar)
Pose 인식
이미지 분류
example:
from openpibo.vision_detect import Detect detect = Detect() # 아래의 모든 예제 이전에 위 코드를 먼저 사용합니다.
- load_hand_gesture_model(modelpath='/home/pi/.model/hand/gesture_recognizer.task')[소스]¶
손동작 인식 모델을 불러옵니다.
- 매개변수:
modelpath (str) – 손동작 인식 모델 경로
- recognize_hand_gesture(image)[소스]¶
손동작을 인식합니다.
- 매개변수:
img (numpy.ndarray) – 이미지 객체
- 반환:
모델에 따른 손동작 인식 결과
- recognize_hand_gesture_vis(img, items)[소스]¶
손동작 인식 결과를 표시합니다.
- 매개변수:
img (numpy.ndarray) – 이미지 객체
items (array) – 손동작 인식 결과
- load_object_model(modelpath='/home/pi/.model/object/yolo11s.onnx')[소스]¶
인식 모델을 불러옵니다.
- 매개변수:
modelpath (str) – 사물인식 모델 경로
- detect_object(img)[소스]¶
사물 인식 결과를 표시합니다.
- 매개변수:
img (numpy.ndarray) – 이미지 객체
items (array) – 사물 인식 결과
- detect_object_vis(img, items)[소스]¶
사물 인식 결과를 표시합니다.
- 매개변수:
img (numpy.ndarray) – 이미지 객체
items (array) – 사물 인식 결과
- detect_qr(img)[소스]¶
이미지 안의 QR코드 및 바코드를 인식합니다.
example:
img = camera.read() detect.detect_qr(img)
- 매개변수:
img (numpy.ndarray) – 이미지 객체
- 반환:
{"data": 내용, "type": 바코드 / QR코드, "position":(startX,startY,endX,endY)}
- detect_qr_vis(img, items)[소스]¶
QR/바코드 결과를 표시합니다.
- 매개변수:
img (numpy.ndarray) – 이미지 객체
items (array) – QR 인식 결과
- detect_pose(img)[소스]¶
이미지 안의 Pose를 인식합니다.
example:
img = camera.read() detect.detect_pose(img)
- 매개변수:
img (numpy.ndarray) – 이미지 객체
- 반환:
인식한 결과
- detect_pose_vis(img, items)[소스]¶
포즈를 표시 합니다.
- 매개변수:
img (numpy.ndarray) – 이미지 객체
items (array) – 포즈 데이터
- analyze_pose(data)[소스]¶
detect_pose 함수의 결과 값을 분석합니다.
example:
img = camera.read() result = detect.detect_pose(img) detect.analyze_pose(result)
- 매개변수:
data (dict) – 이미지 객체
- 반환:
인식한 포즈 리스트 ['left_hand_up', 'right_hand_up', 'clap']
- object_tracker_init(img, p)[소스]¶
이미지 안의 사물 트래커를 설정합니다.
example:
img = camera.read() detect.object_tracker_init(img)
- 매개변수:
img (numpy.ndarray) – 이미지 객체
- track_object(img)[소스]¶
이미지 안의 사물 트래커를 갱신합니다.
example:
img = camera.read() detect.object_tracker_init(img, (10,10,100,100)) position = detect.track_object(img)
- 매개변수:
img (numpy.ndarray) – 이미지 객체
- 반환:
x1,y1,x2,y2 업데이트 된 사물 위치
- track_object_vis(img, item)[소스]¶
마커 결과를 표시합니다.
- 매개변수:
img (numpy.ndarray) – 이미지 객체
items (array) – 마커 결과