Skip to content

ObjectDetection

Robomation RnD Center edited this page Jul 8, 2026 · 1 revision

ObjectDetection (사물 인식 찾기)

카메라 영상에서 COCO 80개 클래스의 사물을 찾아 위치, 크기, 신뢰도를 제공하는 사물 인식 AI 확장 모듈입니다.

인스턴스 선언

object_detection = ObjectDetection(0)
이름 구분 설명 범위 / 종류 기본값
index 드롭다운 옵션 인스턴스 번호 (0부터 시작) 0 이상 정수 0

함수

device

사물 인식에 사용할 카메라 장치를 선택합니다. 카메라 이름(문자열), 인덱스, 또는 Camera 객체를 전달할 수 있습니다.

매개변수

이름 구분 설명 범위 / 종류 기본값
unit 드롭다운 옵션 카메라 지정 값 카메라 라벨(str) / 인덱스(int) / Camera 객체 -

예제

object_detection = ObjectDetection(0)

object_detection.device('')

load_model

사물 인식 모델을 로드합니다. waitTrue 이면 모델 로드가 완료될 때까지 최대 15초 동안 기다립니다.

매개변수

이름 구분 설명 범위 / 종류 기본값
wait 체크박스 로드 완료 대기 여부 True / False True

예제

object_detection = ObjectDetection(0)

object_detection.load_model(wait=True)

max_objects

동시에 인식할 사물의 최대 개수를 설정합니다.

매개변수

이름 구분 설명 범위 / 종류 기본값
data 입력값 (블록) 최대 사물 수 0 ~ 10 정수 -

예제

object_detection = ObjectDetection(0)

object_detection.max_objects(5)

confidence_threshold

사물 인식의 신뢰도 임계값을 설정합니다. 이 값 이상의 사물만 감지된 것으로 처리됩니다.

매개변수

이름 구분 설명 범위 / 종류 기본값
data 입력값 (블록) 신뢰도 임계값 0 ~ 1 실수 -

예제

object_detection = ObjectDetection(0)

object_detection.confidence_threshold(0.5)

detect_once

사물을 한 번만 인식합니다.

매개변수: 없음

예제

object_detection = ObjectDetection(0)

object_detection.detect_once()

detect_continuous

사물을 연속적으로 인식하기 시작합니다.

매개변수: 없음

예제

object_detection = ObjectDetection(0)

object_detection.detect_continuous()

stop

연속 사물 인식을 정지합니다.

매개변수: 없음

예제

object_detection = ObjectDetection(0)

object_detection.stop()

display

사물 인식 결과를 카메라 화면에 표시할지 여부를 설정합니다.

매개변수

이름 구분 설명 범위 / 종류 기본값
on 드롭다운 옵션 표시 ON / OFF 표시(True/1), 숨기기(False/0) True

예제

object_detection = ObjectDetection(0)

object_detection.display(True)
object_detection.display(False)

object

지정한 사물 클래스의 위치/크기 값을 반환합니다.

매개변수

이름 구분 설명 범위 / 종류 기본값
unit 드롭다운 옵션 사물 이름 COCO 80개 클래스 ('person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'cat', 'dog', 'apple', 'cup', 'laptop', 'cell_phone' 등) -
pos 드롭다운 옵션 좌표/크기 종류 x, y, min_x, max_x, min_y, max_y, width, height, area -

반환값 — 지정한 좌표/크기 값 (정수)

예제

object_detection = ObjectDetection(0)

object_detection.object('person', 'x')
object_detection.object('bicycle', 'y')
object_detection.object('person', 'width')
object_detection.object('car', 'area')

get_distance

두 사물 클래스 사이의 거리를 반환합니다. type 을 생략하면 직선 거리를 반환합니다.

매개변수

이름 구분 설명 범위 / 종류 기본값
unit1 드롭다운 옵션 첫 번째 사물 이름 COCO 80개 클래스 -
unit2 드롭다운 옵션 두 번째 사물 이름 COCO 80개 클래스 -
type 드롭다운 옵션 거리 종류 직선 거리(생략 또는 None), 수평 거리('horizontal'), 수직 거리('vertical') None

반환값 — 두 사물 사이의 거리 (실수)

예제

object_detection = ObjectDetection(0)

object_detection.get_distance('person', 'bicycle')
object_detection.get_distance('person', 'car', 'horizontal')

object_detected

지정한 사물 클래스가 (신뢰도 임계값 이상으로) 감지되었는지 여부를 반환합니다.

매개변수

이름 구분 설명 범위 / 종류 기본값
unit 드롭다운 옵션 사물 이름 COCO 80개 클래스 -

반환값 — 감지되었으면 True, 아니면 False (bool)

예제

object_detection = ObjectDetection(0)

object_detection.object_detected('person')

object_confidence

지정한 사물 클래스의 신뢰도 점수를 반환합니다.

매개변수

이름 구분 설명 범위 / 종류 기본값
unit 드롭다운 옵션 사물 이름 COCO 80개 클래스 -

반환값 — 신뢰도 점수 (실수, 0 ~ 1)

예제

object_detection = ObjectDetection(0)

object_detection.object_confidence('person')

model_state

사물 인식 모델의 로드 상태를 정수로 반환합니다.

매개변수: 없음

반환값 — 모델 로드 상태 (정수, 로드 완료 시 2)

예제

object_detection = ObjectDetection(0)

object_detection.model_state()

detected

어떤 사물이라도 감지되었는지 여부를 반환합니다.

매개변수: 없음

반환값 — 사물이 감지되었으면 True, 아니면 False (bool)

예제

object_detection = ObjectDetection(0)

if object_detection.detected():
    print("사물을 찾았습니다")

Clone this wiki locally