Medical Image Segmentation - Otsu thresholding

Gyuha Park·2021년 8월 18일
0

Medical Image Analysis

목록 보기
6/21
post-thumbnail

1. Thresholding

Segmentation의 가장 기본적인 알고리즘으로 thresholding이 있다. Intensity 값이 특정 threshold 값 보다 큰 값만 선택하는 것이 핵심이다. 위 그림에서 왼쪽 image를 threshold 값 200을 기준으로 thresholding을 하면 오른쪽 image와 같이 출력 될 수 있다.

2. Otsu Thresholding

Otsu thresholding은 threshold 값을 자동으로 정하는 알고리즘이다. 위 그림처럼 먼저 image의 intensity 값에 따라 histogram을 그린다.

여기서 foreground와 background로 나뉜다고 가정한다. 그러므로 특정 threshold에 따라 foreground와 background로 histogram을 분리한다. 그리고 분리된 두 개의 histogram에 대해서 data의 비율 ww, data의 평균 μ\mu, data의 표준편차 σ\sigma를 계산한다.

1) Background

Wb=10+5+6+810+5+6+8+2+6+5=2942=0.690W_b=\cfrac{10+5+6+8}{10+5+6+8+2+6+5}=\cfrac{29}{42}=0.690

μb=1×10+2×5+3×6+4×810+5+6+8=2.414\mu_b=\cfrac{1\times10+2\times5+3\times6+4\times8}{10+5+6+8}=2.414

σb=((12.414)2×10+((22.414)2×5)+((32.414)2×6)+((42.414)2×8)10+5+6+8=1.484\sigma_b=\cfrac{((1-2.414)^2\times10+((2-2.414)^2\times5)+((3-2.414)^2\times6)+((4-2.414)^2\times8)}{10+5+6+8}=1.484

2) Foreground

Wf=10+5+6+810+5+6+8+2+6+5=1342=0.310W_f=\cfrac{10+5+6+8}{10+5+6+8+2+6+5}=\cfrac{13}{42}=0.310

μf=5×2+6×6+7×52+6+5=6.231\mu_f=\cfrac{5\times2+6\times6+7\times5}{2+6+5}=6.231

σf=((56.231)2×2+((66.231)2×6)+((76.231)2×5)2+6+5=0.485\sigma_f=\cfrac{((5-6.231)^2\times2+((6-6.231)^2\times6)+((7-6.231)^2\times5)}{2+6+5}=0.485

Otsu thresholding은 두 histogram을 최대한 분리하는 threshold 값을 찾는 것이 목적이다. 따라서 histogram 간 분산(Between Class Variance) σB2\sigma_B^2는 최대화하고 histogram 내 분산(Within Class Variance) σW2\sigma_W^2는 최소화해야 한다.

σW2=Wbσb2+Wfσf2\sigma_W^2=W_b\sigma_b^2+W_f\sigma_f^2

σB2=σσW2=Wb(μbμ)2+Wf(μfμ)2=WbWf(μbμf)2\sigma_B^2=\sigma-\sigma_W^2=W_b(\mu_b-\mu)^2+W_f(\mu_f-\mu)^2=W_bW_f(\mu_b-\mu_f)^2

max(σB2(T)σW2(T))\max\left(\cfrac{\sigma_B^2(T)}{\sigma_W^2(T)}\right)

위 예시에서는 0.512가 나왔다.

profile
Live on mission ✞

0개의 댓글