Skip to content

색깔 찾기 ​

인스턴스 선언 ​

색깔 찾기(ColorDetection) 블록을 작업 영역에 추가하면, Python 코드에는 다음과 같은 인스턴스 선언이 자동으로 삽입됩니다:

python
color_detection = ColorDetection(0)
# 여러 인스턴스가 있는 경우
color_detection_1 = ColorDetection(1)

매개변수 ​

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

카메라 장치 선택하기 ​

색깔 찾기를 위한 카메라를 설정합니다.

device

매개변수 ​

이름구분설명범위 / 종류기본값
unit드롭다운 옵션카메라 장치 이름시스템 카메라 라벨-

Python ​

python
color_detection = ColorDetection(0)

color_detection.device('')

색 등록하기 ​

색깔 찾기를 통해 인식할 색깔을 추가합니다.

register_color

매개변수 ​

이름구분설명범위 / 종류기본값
color드롭다운 옵션색깔 이름검정(black), 빨강(red), 노랑(yellow), 초록(green), 청록(cyan), 파랑(blue), 자홍(magenta), 흰색(white)-
wait체크박스완료 대기 여부TRUE / FALSETRUE

Python ​

python
color_detection = ColorDetection(0)

color_detection.register_color('red', wait=True)

색 삭제하기 ​

색깔 찾기를 통해 인식할 색깔에서 해당 색깔을 삭제합니다.

delete_color

매개변수 ​

이름구분설명범위 / 종류기본값
color드롭다운 옵션색깔 이름검정(black), 빨강(red), 노랑(yellow), 초록(green), 청록(cyan), 파랑(blue), 자홍(magenta), 흰색(white)-
wait체크박스완료 대기 여부TRUE / FALSETRUE

Python ​

python
color_detection = ColorDetection(0)

color_detection.delete_color('blue', wait=True)

면적 조건 설정하기 ​

인식할 색깔 영역 넓이의 최소 크기를 정합니다. 영역의 넓이가 이 이상인 경우에만 화면에 표시됩니다.

area_condition

매개변수 ​

이름구분설명범위 / 종류기본값
data입력값 (블록)면적 조건값0 이상 실수-

Python ​

python
color_detection = ColorDetection(0)

color_detection.area_condition(50)

한 번 인식하기 ​

인식 가능한 색깔 중, 현재 화면에 있는 색깔들을 찾아 딱 한번 영역을 표시합니다.

detect_once

매개변수 ​

(없음)

Python ​

python
color_detection = ColorDetection(0)

color_detection.detect_once()

연속 인식 시작 / 중지 ​

인식 가능한 색깔 중, 현재 화면에 있는 색깔들을 계속해서 따라가며 화면 상에 영역을 표시합니다.

detect_continuous

매개변수 ​

이름구분설명범위 / 종류기본값
unit드롭다운 옵션동작시작(start), 중지(stop)-

Python ​

python
color_detection = ColorDetection(0)

# unit = "start"
color_detection.detect_continuous()
# unit = "stop"
color_detection.stop()

인식 화면 표시하기 ​

카메라 화면에 색깔 찾기 결과를 표시할지 말지를 결정합니다.

display

매개변수 ​

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

Python ​

python
color_detection = ColorDetection(0)

color_detection.display(True)
color_detection.display(False)

색 정보 ​

지정한 색의 위치/크기 값을 반환합니다.

color_data

매개변수 ​

이름구분설명범위 / 종류기본값
color드롭다운 옵션색깔 이름검은색(black), 빨간색(red), 노란색(yellow), 초록색(green), 청록색(cyan), 파란색(blue), 자홍색(magenta), 흰색(white)-
pos드롭다운 옵션좌표/크기 종류x, y, 최소 X(min_x), 최대 X(max_x), 최소 Y(min_y), 최대 Y(max_y), 너비(width), 높이(height), 넓이(area)-

Python ​

python
color_detection = ColorDetection(0)

color_detection.color('red', 'x')
color_detection.color('green', 'y')
color_detection.color('blue', 'area')

특정 색 감지 여부 ​

선택한 색깔을 찾았는지 여부

color_detected

매개변수 ​

이름구분설명범위 / 종류기본값
color드롭다운 옵션색깔 이름검정(black), 빨강(red), 노랑(yellow), 초록(green), 청록(cyan), 파랑(blue), 자홍(magenta), 흰색(white)-

Python ​

python
color_detection = ColorDetection(0)

color_detection.color_detected('red')