R - 芝浦工業大学

Download Report

Transcript R - 芝浦工業大学

Computer Graphics
第1回
Introduction
芝浦工業大学情報工学科
青木 義満
Computer Graphics
画像の基礎知識
芝浦工業大学情報工学科
青木 義満
今日の講義内容
 画像の基礎知識



2005/9/13
デジタル画像の概要
標本化と量子化
ヒストグラムと画像補正
Computer Graphics
3
光の正体
 人間に知覚される電磁波
 380 nm ~ 780 nm (nm = 10-9m) の範囲が可視光
2005/9/13
Computer Graphics
4
色が見える原理
 「色」が人間に知覚されるために必要な3要素
 なぜリンゴは赤く見える?
全ての色を含む
可視光
光
物体
視覚
2005/9/13
特定の色の
光を反射(物体色)
Computer Graphics
5
演色性
 物体の色は蛍光灯の下と白熱灯の下とでは
違って見える
→ 光源の演色性
→ 見える色は物体の持つ色のみでは決まら
ず,光源の分光特性に左右される
2005/9/13
Computer Graphics
6
混色と3原色
 混色

異なる色を混合して,別の色を作ること
 3原色(3色刺激)


2005/9/13
他の二つを混色してももう一つの色を作ることのでき
ないような,独立した3つの色
適当な割合で混色すると,任意の色を生成可能
→ 三色性
Computer Graphics
7
加法混色
 混ぜると明るく白くなる混色
例)白いスクリーンの上に異な
る色の光を重ねて投影
 3原色
赤(R), 緑(G),青(B)
→ カラーテレビの色表示
→ デジタル画像
2005/9/13
Computer Graphics
8
減法混色
 混ぜると暗く黒くなる混色
例)白い紙の上で水彩絵の具を混ぜ合
わせる
 3原色
シアン(C), マゼンタ(M),黄(Y)
→ カラー印刷
2005/9/13
Computer Graphics
9
物体像の獲得
Image Formation
2005/9/13
Computer Graphics
10
物体像の獲得
Image Formation
2005/9/13
Computer Graphics
11
物体像の獲得
Image Formation
projection
through lens
image of object
2005/9/13
Computer Graphics
12
人間の視覚における画像の獲得
 デジタル画像,銀塩写真,印刷物 → 3原色で表現,なぜ?
 人の眼が3原色の光をそれぞれ感じ,様々な色調を脳の中に
描くようにできている
 角膜・水晶体 → レンズの役割
 網膜=撮像素子(フィルム),2種類の視細胞(幹体と錐体),
→ 簡略化した人の目のつくり。
1. 角膜、2. 水晶体、3. ガラス体、
4. 網膜、5. 錐体、6. 幹体
2005/9/13
Computer Graphics
13
デジタルカメラにおける画像の獲得
光電変換!
→ 簡略化した人の目のつくり。
1. 角膜、2. 水晶体、3. ガラス体、
4. 網膜、5. 錐体、6. 幹体
2005/9/13
Computer Graphics
14
アナログ画像とデジタル画像
 アナログ画像


写真,紙の上に書かれた図形
連続値
標本化(Sampling)
量子化(Quantization)
 デジタル画像


通常画像と呼んでいるのはこちらの方
離散値(座標は整数値しか取らない)
2005/9/13
Computer Graphics
15
標本化(Sampling)と量子化(Quantization)
画像のA/D変換
標本化(Sampling)
 座標(X, Y)を離散的な値に変換 ~空間的離散化
 アナログ画像を格子状に分割し(標本化格子),その格子内の濃
淡の平均値を取り出す操作


一つ一つの格子(標本点) → 画素(Pixel)
標本化格子の間隔(標本間隔)
・標本間隔
・画像解像度
・データ量
2005/9/13
小
高
大
大
低
小
Computer Graphics
標本化定理
シャノンの標本化定理
ナイキスト周波数
16
標本化(Sampling)と量子化(Quantization)
画像のA/D変換
量子化(Quantization)
 濃淡値


f を離散的な値に変換 ~信号強度の離散化
量子化された値 → 量子化レベル,濃淡レベル,画素値
濃淡レベル数 2G → Gビット量子化


256レベル( 28 ) = 8ビット量子化
一般の写真(8ビット),X線写真(10ビット)
 量子化誤差,ダイナミックレンジ
2005/9/13
Computer Graphics
17
標本化(Sampling)と量子化(Quantization)
デジタル画像
アナログ画像
2005/9/13
Computer Graphics
18
画素(Pixel)
 濃淡や色を表す最小単位
 画像の大きさを画素単位で表すことが多い
例) 640 X 480 画素(ピクセル)
400万画素 (デジタルカメラ)
Pixel Location: p = (r , c)
Pixel Value: I(p) = I(r , c)
2005/9/13
Computer Graphics
画素(Pixel)
Pixel : [ p, I(p)]
19
Sampling and Quantization
real image
2005/9/13
sampled
quantized
Computer Graphics
sampled &
quantized
20
Sampling and Quantization
column index
row index
pixel grid
real image
2005/9/13
sampled
quantized
Computer Graphics
sampled &
quantized
21
Take the average
within each square.
Sampling
I C  ,  
I S (r, c)
continuous image
sampled image
2005/9/13
Computer Graphics
22
Take the average
within each square.
Sampling
I C  ,  
I S (r, c)
continuous image
sampled image
2005/9/13
Computer Graphics
23
Take the average
within each square.
Sampling
I C  ,  
I S (r, c)
continuous image
sampled image
2005/9/13
Computer Graphics
24
Take the average
within each square.
Sampling
I C  ,  
I S (r, c)
continuous image
sampled image
2005/9/13
Computer Graphics
25
カラー画像とモノクローム(モノクロ)画像
(R,G,B)
3成分/pixel
輝度値(濃淡値)
1成分/pixel
2005/9/13
Computer Graphics
26
Color Images




Are constructed from three
intensity maps.
Each intensity map is pro-jected
through a color filter (e.g., red,
green, or blue, or cyan, magenta,
or yellow) to create a
monochrome image.
The intensity maps are overlaid
to create a color image.
Each pixel in a color image is a
three element vector.
2005/9/13
Computer Graphics
27
2005/9/13
Computer Graphics
28
狭義の画像処理
〜画像の階調補正



2005/9/13
ヒストグラム
コントラスト変換
ガンマ補正
Computer Graphics
29
ヒストグラム(濃淡画像)
•
各濃淡レベル(輝度値)の画素の数を数えあげたもの
→
hI g   the number
of pixels in I
with graylevelg.
輝度値の分布がわかる
Luminosity
画素数
輝度値
2005/9/13
Computer Graphics
30
ヒストグラム(カラー画像)

フルカラー画像

R,G,B,輝度(R, G, Bの平均)
の4つのヒストグラム
R
hI R
G
L
Luminosity
hI L
hIG
B
hI B
2005/9/13
Computer Graphics
31
ヒストグラム(カラー画像1)
0.03
0.025
0.02
0.015
0.01
0.005
0
0
50
red pdf
green pdf
2005/9/13
Computer Graphics
100
150
200
250
blue pdf
luminosity pdf
32
ヒストグラム(カラー画像2)
0.015
0.01
0.005
0
0
50
red pdf
green pdf
2005/9/13
Computer Graphics
100
150
200
250
blue pdf
luminosity pdf
33
ルックアップテーブル

入力値を出力先に合わせて変換するためのテーブル
→ ディスプレイ,プリンタ
127
ダイナミックレンジ
y=x (標準)
0
出力濃淡レベル
255
変換関数
0
127
255
index value
...
...
101
64
102
68
103
69
104
70
105
70
106
71
...
...
入力濃淡レベル
2005/9/13
Computer Graphics
34
コントラスト変換
画像が明るすぎたり暗すぎたりする場合,微妙な濃淡の変化を強調し
たい場合 → 画像を見やすく
a pixel with
this value
2005/9/13
cell index
input
...0
64
...
128
...
... 0
...32
128
...
192
...
224
255
255
...
output
contents

Computer Graphics
is mapped to
this value
35
ルックアップテーブル
(変換関数)の生成例
For example:
Let a  2.
Let x 0,,255
 x ; a   255


1
1  ea ( x127) / 32 
2005/9/13
2
Computer Graphics
36
127
255
画像全体を明るく
明るさの調整
2005/9/13
Computer Graphics
g
0
I k r, c  g, if I k r, c  256
J k r, c  
if I k r, c  g  255
255,
g  0 and k 1,2,3 is the bandindex.
0
127
255
transform mapping
37
255
画像全体を暗く
明るさの調整
g  0 and k 1,2,3  is the bandindex.
2005/9/13
Computer Graphics
0
127
255-g
if I k r, c  g  0
0,
J k r, c  
I k r, c  g, if I k r, c
0
127
255
transform mapping
38
127
255
コントラストの調整
コントラストの強調
傾き>1
if Tk r, c  0,
0,

J k r, c  Tk r, c, if 0  Tk r, c  255,
255,
if Tk r, c  255. k 1,2,3 

2005/9/13
Computer Graphics
0
Let Tk (r, c)  a I k r, c  127  127, where a  1.0
0
127
255
transform mapping
39
127
255
コントラストの調整
コントラストの減少
Tk (r, c)  aI k r, c  127  127,
2005/9/13
Computer Graphics
0
where 0  a  1.0 and k 1, 2, 3 .
傾き<1
0
127
255
transform mapping
40
ヒストグラム平坦化



画像のダイナミックレンジを広げ,細部まで明瞭に
同一対象物を撮影した複数の画像のコントラストを統一
濃淡分布 → 一様分布,正規分布に変換
2005/9/13
Computer Graphics
41
ヒストグラム平坦化の結果
ヒストグラム平坦化
(Histogram Equalization)
Luminosity
before
J r, c  EQI r, c
 255I r0,c  pI  
2005/9/13
Computer Graphics
after
42
階調補正処理
まとめ
2005/9/13
Computer Graphics
43
コントラストの調整
- contrast
2005/9/13
original
Computer Graphics
+ contrast
44
明るさの調整
- brightness
2005/9/13
original
Computer Graphics
+ brightness
45
ヒストグラム補正
histogram mod
2005/9/13
original
Computer Graphics
histogram EQ
46
画像の補正処理
2005/9/13
- brightness
original
+ brightness
- contrast
original
+ contrast
Computer Graphics
47
カラーバランスと彩度変化
2005/9/13
Computer Graphics
48