슈퍼픽셀 분할
이 연습에서는 얼굴 탐지 Machine Learning 모델에 이미지를 전달하기 전에, 같은 이미지에 비지도 분할을 적용해 보겠습니다.
즉, 이 이미지를 $265 \times 191 = 50,615$개의 픽셀에서 $400$개의 영역으로 줄일 거예요.
face_image로 미리 로드되어 있습니다.show_image() 함수도 미리 로드되어 있습니다.
이 연습은 강의의 일부입니다
Python으로 배우는 이미지 처리
연습 안내
segmentation모듈에서slic()함수를 가져오세요.color모듈에서label2rgb()함수를 가져오세요.slic()를 사용해 400개 영역으로 분할을 얻으세요.- 원본 이미지 위에 분할 결과를 겹쳐 비교하려면
label2rgb()를 사용하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Import the slic function from segmentation module
from skimage.____ import ____
# Import the label2rgb function from color module
from skimage.____ import ____
# Obtain the segmentation with 400 regions
segments = ____(____, ____= ____)
# Put segments on top of original image to compare
segmented_image = ____(____, ____, kind='avg')
# Show the segmented image
show_image(segmented_image, "Segmented image, 400 superpixels")