Re: [問題] 關閉白平衡?
看了這一串討論,我有一點建議:在對這些基本觀念感到疑惑時,是不是先做些功課再來
討論會省去很多時間?畢竟這些觀念是客觀的事實而不是主觀的認知。如果沒有先弄清楚
原理就去做沒有控制環境控制變因的粗糙實驗,然後以此支持自己認為的論點,基本上就
是一種Cargo Cult Science [1],這樣似是而非論點很容易使得許多新手(e.g., me) 遭
到誤導。
關於白平衡跟RAW檔的關係,我直接引用並節錄兩篇對於白平衡的介紹。
第一篇來自[2],順道大略翻譯成中文。
By far the best white balance solution is to photograph using the RAW file
format (if your camera supports them), as these allow you to set the WB
*after* the photo has been taken. RAW files also allow one to set the WB
based on a broader range of color temperature and green-magenta shifts.
至今攝影最佳的白平衡解決辦法是使用RAW檔(如果你的照相機支援此格式),因為RAW允許
在拍攝相片*之後*再設定白平衡。RAW檔同時允許你依據更廣色溫範圍和紅綠偏移來設定
白平衡。
Performing a white balance with a raw file is quick and easy. You can either
adjust the temperature and green-magenta sliders until color casts are
removed, or you can simply click on a neutral reference within the image (see
next section). Even if only one of your photos contains a neutral reference,
you can click on it and then use the resulting WB settings for the remainder
of your photos (assuming the same lighting).
使用RAW檔來執行非常迅速且簡單。你可以調整色溫和紅綠色偏直到影像中的色偏被移除
,或者你可以簡單地選定一個中性參考點,你可以點他一下然後用此白平衡設定應用在其
餘的相片(假設都是在同一個場景底下拍攝的)
第二篇來自 [3]
RAW File Format
A discussion in WB would not be complete without a mention of the RAW file
format available in many advanced digital cameras. When you save an image in
RAW file format, you are saving it the way the image sensor sees it --
without applying any adjustments (including white balance) to it. In fact,
the camera ignores any WB setting you dial in.
白平衡的討論必定會牽扯到每台進階的數位相機都支援的RAW檔。當你以RAW檔儲存影像時
,你儲存的是原始的影像感光元件的數據,不包含任何調整(包括白平衡)。事實上,照相
機會忽略任何你輸入的白平衡設定。
Later, in an image editing software with the appropriate RAW plug-in, you can
convert the RAW image to JPEG, and apply any colour temperature shift. Undo
your change and try again, ad infinitum, in as fine an increment as you wish,
until you obtain perfect colour balance.
之後,在一個支援RAW檔的影像編輯軟體中,你可以將RAW檔轉成JPEG檔,調整任何色溫偏
移。可以一試再試直到你得到最理想的白平衡。
關於RAW檔格式究竟存了甚麼檔案,請參考Wikipedia [4]中第二節File Contents。在第
三節Benefits中第四點也提到了RAW檔對於白平衡的功用。關於白平衡原理和運算,請參
考 [5]。
想了解較詳細的Image Sensing Pipeline過程的朋友,可以參考 [6] 中的2.3節The
Digital Camera和Figure 2.23。光線經由相機本體 (光圈、快門、和鏡頭所產生的光學
路徑)之後,經過Color Filter Array (e.g., Bayer Pattern ) 落在相機的Sensor chip
上,(CCD/CMOS)捕捉到的光訊號藉由Sense Amplifier來放大 (即所謂的ISO),放大之後
經由類比/數位轉換的電路(A/D)量化成12 bit (or 14 bit),並將此資料儲存成RAW檔。
RAW檔到生成JPEG的流程則會經過一連串的數位訊號處理(DSP)運算,可在機身上處理或是
交給任何一款支援RAW的軟體:Demosaicking => (Sharpening) => White Balance =>
Gamma Correction / Tone Curve (Contrast, Color Saturation) => Conversion to
8-bit JPEG Compression
所以RAW檔於數位攝影中相當於底片攝影裡”底片”的角色,紀錄的是感光資料,而後面
這一連串運算轉換感光資料到可以在電腦上展示的照片則相當於沖洗底片成照片的過程。
對於更廣的主題 - Color Reproduction請參考 [7]。
註:一般來說提到RAW檔,指的就是未經處理的感光資料,不過有些相機會自行對於RAW檔
做些影像處理 (e.g., Noise reduction, Lens-correction),這種情況便叫做Cooked
RAW [8]。
至於為什麼同一場景連續拍兩張影像不會得到一模一樣的結果,除了環境的光場本身可能
就有擾動之外,相機成像過程本身就有很多雜訊產生,常見的雜訊就有五種[9][10]:
1) Fixed pattern noise
2) Dark current noise
3) Shot noise
4) Amplifier noise
5) Quantization noise
如果對於機率中隨機變數 [11]有基本觀念的話,就會了解每一次拍照都是對這些隨機變
數的一次觀察,所以要得到同樣的影像幾乎是不可能的。
最後,其實現在相機系統都僅支援單一光源的白平衡(e.g., 日光、陰影、白光燈管等等)
。但是實際上現實世界我們所看到的場景都不是如此,尤其以室內最為嚴重,所以不管你
怎麼選色溫都只是逼近或是取捨而已。關於多個光源的白平衡(i.e., spatially
varying white balance) 最近幾年也有些研究成果,有興趣的可以參考[12]。
[1] http://calteches.library.caltech.edu/51/2/CargoCult.pdf
[2] http://www.cambridgeincolour.com/tutorials/white-balance.htm
[3] http://www.photoxels.com/tutorial_white-balance.html
[4] http://en.wikipedia.org/wiki/Raw_image_format
[5] http://en.wikipedia.org/wiki/Color_balance
[6] Szeliski R., Computer Vision: Algorithms and Applications, Springer 2010.
http://szeliski.org/Book/drafts/SzeliskiBook_20100517_draft.pdf
[7] R.W.G. Hunt, The Reproduction of Colour, Wiley-IS&T Series 2005
http://ppt.cc/@SE4
[8] http://en.wikipedia.org/wiki/Cooked_raw
[9] http://en.wikipedia.org/wiki/Image_noise
[10] Tsin, Y., Ramesh, V., and Kanade, T. (2001). Statistical calibration of
CCD imaging process. In Eighth International Conference on Computer Vision
(ICCV 2001), pages 480–487, Vancouver, Canada.
http://ppt.cc/xvdB
[11] http://en.wikipedia.org/wiki/Random_variable
[12] Light Mixture Estimation for Spatially Varying White Balance
Eugene Hsu, Tom Mertens, Sylvain Paris, Shai Avidan, Frédo Durand. ACM
Transactions on Graphics, 27(3), (Proc.Siggraph), August 2008
http://people.csail.mit.edu/ehsu/work/sig08lme/
以上跟大家分享
Feedback and bug report are welcome
Jia-Bin Huang
E-mail: jbhuang0604@gmail.com
Blog: http://jbhuang0604.blogspot.com/
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.104.128.66
推
07/10 12:15, , 1F
07/10 12:15, 1F
Hi Poppyer,
就我所知的,Cooked Raw通常是對於sensor感應到的數值做Noise Reduction或是
做implicit lens-correction。
我沒有辦法證明cooked raw跟白平衡設定沒有關係,因為找不到有測試直接說明。
(同樣的,這麼說也會很難證明Cooked Raw跟Gamma correction/tone curve等沒有關係)
不過,我認為Cooked Raw不會跟白平衡有關係。
理由是白平衡的運算是在對Raw檔做完demosaicking之後,也就是如果Cooked Raw要動到
白平衡的話,先得從Raw做demosaicking,得到每個pixel的R,G,B值,做完白平衡,
然後再取一次Baye Pattern回復原本Raw該有的格式。所以我想應該不會有廠商做這種
多餘而且對於影像品質沒有幫助的步驟。
這是我的理由。不過,我確實沒有辦法證明沒有關係,也許你是對的。
推
07/10 12:32, , 2F
07/10 12:32, 2F
※ 編輯: BenHuang 來自: 59.104.128.66 (07/10 13:00)
推
07/10 13:16, , 3F
07/10 13:16, 3F
推
07/10 13:22, , 4F
07/10 13:22, 4F
→
07/10 13:23, , 5F
07/10 13:23, 5F
→
07/10 13:23, , 6F
07/10 13:23, 6F
→
07/10 13:24, , 7F
07/10 13:24, 7F
→
07/10 13:24, , 8F
07/10 13:24, 8F
推
07/10 13:32, , 9F
07/10 13:32, 9F
推
07/10 13:36, , 10F
07/10 13:36, 10F
推
07/10 13:47, , 11F
07/10 13:47, 11F
推
07/10 14:03, , 12F
07/10 14:03, 12F
推
07/10 14:19, , 13F
07/10 14:19, 13F
推
07/10 14:54, , 14F
07/10 14:54, 14F
→
07/10 14:55, , 15F
07/10 14:55, 15F
→
07/10 15:20, , 16F
07/10 15:20, 16F
→
07/10 15:21, , 17F
07/10 15:21, 17F
→
07/10 15:23, , 18F
07/10 15:23, 18F
推
07/10 15:43, , 19F
07/10 15:43, 19F
→
07/10 16:09, , 20F
07/10 16:09, 20F
→
07/10 16:10, , 21F
07/10 16:10, 21F
推
07/10 16:25, , 22F
07/10 16:25, 22F
推
07/10 17:26, , 23F
07/10 17:26, 23F
推
07/10 17:28, , 24F
07/10 17:28, 24F
推
07/10 17:44, , 25F
07/10 17:44, 25F
推
07/10 17:50, , 26F
07/10 17:50, 26F
推
07/10 18:54, , 27F
07/10 18:54, 27F
推
07/10 21:52, , 28F
07/10 21:52, 28F
→
07/11 00:31, , 29F
07/11 00:31, 29F
推
07/11 00:40, , 30F
07/11 00:40, 30F
→
07/11 01:39, , 31F
07/11 01:39, 31F
→
07/11 01:53, , 32F
07/11 01:53, 32F
→
07/11 01:54, , 33F
07/11 01:54, 33F
Hi arenptt,
1. 請問有沒有相關的reference?
2. 假設真有這種做法(用white balance來控制Sense amplifier),好處是甚麼?
出來的結果,跟後端自行設定白平衡應該是等價的 (也許Quantization noise不一樣)
3. 由於Sensor不完美的緣故,本來每個pixel上的sensor對於光的感應度就不盡相同
所以產生了同步雜訊 Fixed Pattern Noise (FPN),一般在處理這個問題的做法會去做
Flat-field correction來補償FPN和Dark current noise所產生的non-uniformity
http://en.wikipedia.org/wiki/Flat-field_correction
不曉得你所指的 是不是Flat-field correction中處理Gain的部分?
推
07/11 11:48, , 34F
07/11 11:48, 34F
推
07/11 15:03, , 35F
07/11 15:03, 35F
※ 編輯: BenHuang 來自: 140.109.23.131 (07/11 20:39)
→
07/11 23:49, , 36F
07/11 23:49, 36F
→
07/11 23:52, , 37F
07/11 23:52, 37F
→
07/11 23:52, , 38F
07/11 23:52, 38F
→
07/11 23:54, , 39F
07/11 23:54, 39F
→
07/11 23:57, , 40F
07/11 23:57, 40F
→
07/11 23:58, , 41F
07/11 23:58, 41F
→
07/12 00:00, , 42F
07/12 00:00, 42F
→
07/12 00:02, , 43F
07/12 00:02, 43F
1. 了解
2. 我的意思是 RGB sensor 從接受 光子 => 電荷 => 電壓這個過程有許多放大器
標準的CMOS sensor architecture:
CMOS Active Pixel Sensor Array -> Column Amplifiers -> Programmable gain
amplifiers -> Analog-to-digital converters
若要根據某個設定好的WB來對RGB分別設定不同的Gain 一定是在某一級做了更改
我相信當然有可能有廠商這麼做
我比較感興趣的是 為什麼?有甚麼好處?
儘管可以先動WB 所存的Cooked RAW仍然可以隨意再調整WB
跟標準的RAW比起來 差別只在量化電壓訊號之前或之後
若忽略量化誤差的話 這兩個做法應該是等價的
我想如果有這種sensor作法存在
他這麼做的理由並不在於要得到比較好的感光資料(Cooked RAW),提供使用者後製
而是要簡化整個流程/成本,目標只是最後的jpeg檔。
所以在高階的相機比較看不到這種可能的做法 (我還沒有找到可公開的參考資料@@)
3. Flat-field correction針對每個sensor只有兩項 (Gain 跟 Offset)
我原本以為你可能指的是Gain的這個動作
※ 編輯: BenHuang 來自: 59.104.128.66 (07/12 01:28)
推
07/12 01:03, , 44F
07/12 01:03, 44F
→
07/12 01:03, , 45F
07/12 01:03, 45F
→
07/12 01:16, , 46F
07/12 01:16, 46F
推
07/12 02:32, , 47F
07/12 02:32, 47F
→
07/13 01:26, , 48F
07/13 01:26, 48F
→
07/13 01:29, , 49F
07/13 01:29, 49F
→
07/13 01:30, , 50F
07/13 01:30, 50F
→
07/13 01:32, , 51F
07/13 01:32, 51F
→
07/13 01:34, , 52F
07/13 01:34, 52F
推
07/13 02:47, , 53F
07/13 02:47, 53F
→
07/13 08:01, , 54F
07/13 08:01, 54F
→
07/13 08:04, , 55F
07/13 08:04, 55F
討論串 (同標題文章)