INK study
article thumbnail

๐Ÿค” Segmentation์ด๋ž€?

- Image segmentaion : ์ด๋ฏธ์ง€๋ฅผ ๋น„์Šทํ•œ ์ •๋ณด๋ฅผ ๊ฐ€์ง„ ๋‹จ์œ„๋กœ ๋‚˜๋ˆˆ ๊ฒƒ

๋”๋ณด๊ธฐ

๐Ÿ’ก ํด๋ž˜์‹ํ•œ ์ ‘๊ทผ์ด๋‹ค.

1. Point clustering : ๋น„์Šทํ•œ ์ข…๋ฅ˜๋ผ๋ฆฌ ๋ฌถ์Œ

2. Image segmentation 

3. Semantic segmentation : ์ด๋ฏธ์ง€ ๋‚ด์˜ ์˜๋ฏธ์žˆ๋Š” ํด๋ž˜์Šค๋“ค๋ผ๋ฆฌ ๋ถ„ํ• 

4. Video object segmentation : ์›€์ง์ด๋Š” ์‚ฌ์ง„, ์˜์ƒ(๋น„๋””์˜ค)์˜ ์˜๋ฏธ์žˆ๋Š” ๊ฐ์ฒด,object๋งŒ์„ ๋ถ„ํ• 

 

- segmentation method์˜ ๋ฐฉ๋ฒ•

 

๐Ÿค”Image thresholding ์ด๋ž€?

Single threshold

ํ”ฝ์…€์˜ grayLevel > T ์ด๋ฉด ํ•˜์–—๋‹ค

ํ”ฝ์…€์˜ grayLevel <= T ์ด๋ฉด ์–ด๋‘ก๋‹ค.

- Threshold๋ฅผ ๊ธฐ์ค€์œผ๋กœ 255, 0์œผ๋กœ ๋‚˜๋‰จ.

์™ผ์ชฝ์€ ์›๋ณธ, ์˜ค๋ฅธ์ชฝ์€ single thresholdํ•œ ๊ฒฐ๊ณผ

- ์ด๋ฏธ์ง€์˜ ์ˆจ๊ฒจ์ง„ ํ”ฝ์…€์„ ๋ณผ ์ˆ˜ ์žˆ์Œ.

 

Double threshold

- threshold๋ฅผ 2๊ฐœ๋กœ ์ง€์ • -> ๋งŽ์ด ์“ธ์ˆ˜๋ก ๋ณต์žกํ•ด์ง„๋‹ค.

T1๊ณผ T2์‚ฌ์ด์— ํ”ฝ์…€์ด ์กด์žฌํ•  ๊ฒฝ์šฐ white

๊ทธ์™ธ์ด๋ฉด black์œผ๋กœ ์ฒ˜๋ฆฌ

 

 

๐Ÿค” thresholding ์„ ์ด์šฉํ•œ ๊ฐ„๋‹จํ•œ ์‹ค์ œ ์‚ฌ๋ก€๋“ค

1. ๊ธ€์”จ๊ฐ€ ์ž‘์„ฑ๋œ ์ข…์ด์‚ฌ์ง„์—์„œ ๋ฐฐ๊ฒฝ์„ ์—†์• ๊ณ , ๊ธ€์”จ๋งŒ ๋‚˜์˜ค๋„๋ก ์กฐ์ •

2. thresholdingํ•˜๊ธฐ ์ „์— smoothing filter๋ฅผ ํ†ตํ•ด ์ž์ž˜ํ•œ ๋จผ์ง€๊ฐ™์€๊ฑฐ๋ฅผ ์—†์• ๊ณ , ํผ์ง€๋ง‰ํ•œ ๊ฑฐ๋งŒ thresholding๋˜์„œ ๋ณด์ด๋„๋ก ์กฐ์ •

 

๐Ÿค” ์ ์ ˆํ•œ thresholding์„ ์ฐพ๋Š” ๋ฐฉ๋ฒ•

๋”๋ณด๊ธฐ

์—ฌ๋Ÿฌ๋ฒˆ thresholding์„ ํ†ตํ•ด ์ ์ ˆํ•œ ๊ฐ’์„ ์ฐพ๋Š”๊ฑด ์ •๋ง ์‰ฝ์ง€์•Š์Œ.

๋”ฐ๋ผ์„œ, ์ด๋ฏธ์ง€์— ๋Œ€ํ•œ ํžˆ์Šคํ† ๊ทธ๋žจ์„ ๊ทธ๋ ค ํ”ฝ์…€๊ฐ’๋“ค์„ ๋ด„. ์ด๋•Œ, ์ด์ง„ํ™”๊ฐ€ ๊ฐ€๋Šฅํ•œ ์ด๋ฏธ์ง€์—ฌ์•ผํ•จ.

๋ฐฐ๊ฒฝ์— ๋Œ€ํ•œ ํ”ฝ์…€๊ฐ’๊ณผ object์— ๋Œ€ํ•œ ํ”ฝ์…€๊ฐ’์ด ๋ชจ์—ฌ์ ธ ์žˆ๋Š” ํžˆ์Šคํ† ๊ทธ๋žจ์„ ๋ณผ ์ˆ˜ ์žˆ์Œ. (๋ฐฐ๊ฒฝ๊ณผ ์ „๊ฒฝ์œผ๋กœ ๋šœ๋ ทํ•˜๊ฒŒ ๋‚˜๋‰จ)

- threshold๋Š” 0~255 ์ค‘ ๋”ฑ ํ•œ ๊ตฌ๊ฐ„์„ ๊ณจ๋ผ์•ผํ•œ๋‹ค.

threshold๋Š” ๋‘ ํžˆ์Šคํ† ๊ทธ๋žจ์˜ ์‚ฌ์ด๊ฐ’์ด๋‹ค.

 

Otsu's method

otsu์˜ ์ด์ง„ํ™”๋Š” ์ด๋ฏธ์ง€ ์ฒ˜๋ฆฌ์—์„œ ์ž๋™ ์ด์ง„ํ™”์˜ ํ•œ ํ˜•ํƒœ์ด๋‹ค.

์ด๋ฏธ์ง€์—์„œ ๊ฐ€์žฅ ์ข‹์€ ์ด์ง„ํ™” ๊ฐ’์„ ์ž๋™์œผ๋กœ ๊ณ„์‚ฐํ•˜์—ฌ ์ด๋ฏธ์ง€๋ฅผ ๋‘ ๊ฐœ์˜ ํด๋ž˜์Šค๋กœ ๋ถ„ํ• ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ์œ„ํ•ด Otsu์˜ ๋ฐฉ๋ฒ•์€ ์ด๋ฏธ์ง€์˜ ํ”ฝ์…€๊ฐ’์„ ๋‘ ๊ฐœ์˜ ํด๋ž˜์Šค๋กœ ๋ถ„๋ฅ˜ํ•˜๊ธฐ ์œ„ํ•ด ์ ์ ˆํ•œ ์ž„๊ณ„๊ฐ’(threshold)์„ ์ฐพ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

 

Otsu์˜ ๋ฐฉ๋ฒ•์€ ์ด๋ฏธ์ง€์˜ ํ”ฝ์…€๊ฐ’ ๋ถ„ํฌ์—์„œ within-class variance์™€ between-class variance๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ž„๊ณ„๊ฐ’์„ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค.

within-class variance : ํด๋ž˜์Šค ๋‚ด๋ถ€์˜ ๋ถ„์‚ฐ

between-class variance : ํด๋ž˜์Šค ๊ฐ„์˜ ๋ถ„์‚ฐ์„ ์˜๋ฏธ

 

Otsu์˜ ๋ฐฉ๋ฒ•์„ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋‹ค์Œ ๋‹จ๊ณ„๋ฅผ ์ˆ˜ํ–‰ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค:

  1. ์ด๋ฏธ์ง€์˜ grayscale ๊ฐ’์„ ํžˆ์Šคํ† ๊ทธ๋žจ์œผ๋กœ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
  2. ์ด๋ฏธ์ง€์˜ ํ”ฝ์…€๊ฐ’ ๋ถ„ํฌ์—์„œ ํด๋ž˜์Šค ๋‚ด๋ถ€์™€ ํด๋ž˜์Šค ๊ฐ„ ๋ถ„์‚ฐ์„ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค.
  3. ๋ชจ๋“  ๊ฐ€๋Šฅํ•œ threshold ๊ฐ’์„ ์‹œ๋„ํ•˜์—ฌ ํด๋ž˜์Šค ๊ฐ„ ๋ถ„์‚ฐ์„ ์ตœ๋Œ€ํ™”ํ•˜๋Š” ์ตœ์ ์˜ threshold ๊ฐ’์„ ์ฐพ์Šต๋‹ˆ๋‹ค.
  4. ์ตœ์ ์˜ threshold ๊ฐ’์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด๋ฏธ์ง€๋ฅผ ์ด์ง„ํ™”ํ•ฉ๋‹ˆ๋‹ค.

profile

INK study

@ongsimi_

์ฝ์–ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!