多媒體安全 macros examples gamma.txt 報告學生:碩專 2a 王朝鵬 (9624713)...

Post on 19-Dec-2015

254 Views

Category:

Documents

11 Downloads

Preview:

Click to see full reader

TRANSCRIPT

多媒體安全 Macros Examples

Gamma.txt

報告學生:碩專 2A 王朝鵬(9624713)

指導教授:黃文楨 博士

何謂 Gamma Value ?

簡單來說, Gamma 是對比的度量工具,亦即中間色調數值的亮度,由如電腦螢幕等的裝置產生,或者產生於拍攝的影像中。較高的 Gamma 值 會 產 生 整 體 上 較 暗 的 影像 。 Windows 系 統 使 用 的 Gamma 值 ( 通常是 2.2) 比 Mac OS 系統為高 ( 通常是 1.8) ,結果相同的影像在 Windows 系統上看來就明顯地比在 Mac OS 系統上暗。所謂的 Gamma 是指亮度的變化曲線其數學關係為 L=X^r ,類似底片的特性曲線,提高 gamma 會讓提高整體影像的反差。

Garma.txt 巨集 – 亮度調整

包含三個巨集:1. Gamma2. Reset Gamma3. Show LUT

變數宣告:var gamma = 1;

(1) Gamma

1. macro “Gamma [F1]” {2. getLut(r, g, b);3. gamma =

getNumber(“Gamma (0.1 - 5.0):”, gamma);

4. for (i=0; i<256; i++) {5. r[i] = pow(r[i]/255,

gamma)*255;}

6. setLut(r, r, r); 7. }

定義 F1 快速鍵

顯示輸入視窗並取得所輸入的 Gamma 值,預設是 1

計算新的的 Gamma 值

重新以 R 陣列的值設定整個 LUT表

讀取圖片的 LUT 表

(2) Reset Gamma

1. macro "Reset Gamma [F2]" { 2. getLut(r, g, b);3. for (i=0; i<256; i++) {4. r[i]=i;5. } 6. setLut(r, r, r); 7. }

定義 F2 快速鍵

讀取圖片的 LUT 表

計算新的的 Gamma 值

重新以 R 陣列的值設定整個 LUT表

(3) Show LUT

1. macro "Show LUT" {2. run("Show LUT"); 3. }

呼叫內建功能顯示檢視表

Function – getLut()

用法: getLut(reds, greens, blues)說明:Returns three arrays containing the red, green and blue intensity values from the current lookup table.

Function – getNumber()

用法:getNumber(“prompt”, defaultValue)說明:Displays a dialog box and returns the number entered by the user. The first argument is the prompting message and the second is the value initially displayed in the dialog. Exits the macro if the user clicks on "Cancel" in the dialog. Returns defaultValue if the user enters an invalid number.

Function – setLut()

用法: setLut(reds, greens, blues)

說明:Creates a new lookup table and assigns it to the current image. Three input arrays are required, each containing 256 intensity values.

執行過程

執行過程

轉換圖片格式為 32Bit 的灰階圖片

執行過程

執行過程

執行過程

執行過程

The End.Thank you …

top related