거기 누구 있나요?
이번 연습에서는 밤에 촬영된 이미지에 사람이 있는지 여부를 확인해 봅니다.
night_image로 미리 로드되어 있습니다.feature 모듈의 분류기 Cascade 클래스는 이미 임포트되어 있습니다. 또한 이미지에서 얼굴을 표시하고 잘라 별도로 보여 주는 show_detected_face() 함수도 준비되어 있습니다.
이 연습은 강의의 일부입니다
Python으로 배우는 이미지 처리
연습 안내
data모듈에서 학습된 파일을 로드하세요.- 해당 학습 파일로 감지기 캐스케이드를 초기화하세요.
- 검색 창의 최소 크기를 10픽셀, 최대 크기를 200픽셀로 설정하여 이미지에서 얼굴을 감지하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Load the trained file from data
trained_file = ____.lbp_frontal_face_cascade_filename()
# Initialize the detector cascade
detector = ____(____)
# Detect faces with min and max size of searching window
detected = detector.detect_multi_scale(img = night_image,
scale_factor=1.2,
step_ratio=1,
min_size=(____),
max_size=(____))
# Show the detected faces
show_detected_face(night_image, detected)