Dropbox 的文件掃描功能

算是講 Dropbox 的「Dropbox 的 Document Detecting」這篇的續集,在抓出文件位置後講顏色的校準:「Fast Document Rectification and Enhancement」。

要怎麼把左邊的原始圖轉換成右邊的圖,包括了座標轉換以及顏色校準:

顏色校準的部份講到了這張很有名的圖。在圖片上,A 與 B 的區塊顏色是相同的,但你校準出來的時候必須跟人腦的感覺相同:

Here’s a great illustration of this “illusion,” in which the two tiles marked A and B have the same pixel values, but appear to be very different:

這是最後的成果,左邊是原始圖,中間是將背景改成白色,其他顏色保留,而右邊則是試著修正顏色:

Left: the original image. Middle: an enhanced image, with the background becoming white and the foreground preserved in exact R, G, B values. Note that the colors appear faded. Right: an enhanced image that tries to correct for the perceptual discrepancy.

應該是在 Dropbox 裡面的專案,是個有不少數學可以玩的專案...

Dropbox 的 Document Detecting

Dropbox 發表了他們所研究的 Document Detecting 技術:「Fast and Accurate Document Detection for Scanning」。

他們希望抓出這張圖裡面「文件」的「邊緣」:

Canny edge detector 會跑出這樣,很明顯多了很多不太正確的邊線,對於後續判斷上會困難不少:

剛好也是最近看到的另外一篇文章「Image Kernels Explained Visually」在講 Image Kernel,有些地方有點類似的東西,交叉看頗有感覺的...

Anyway,Dropbox 最後的成果很不錯啊,可以看示範:

OS X El Capitan (10.11) 軟體授權文件的白話翻譯

有人把 OS X El Capitan 的軟體授權文件翻譯成白話的 22 條英文說明:「OS X El Capitan License: in Plain English」,也就是這份文件:

其實有不少有趣 (?) 的設計...

避免文件大量 Reflow...

今天的 Hacker News 文摘上看到關於 Reflow 的問題:「Preventing 'layout thrashing'」。

Reflow 指的是改變 DOM 後造成的畫面重新計算以及 render。

Google 有給過一些資訊:「Minimizing browser reflow」,Mozilla 也有給「Notes on HTML Reflow」,不過這兩篇都是概念性的文章...

文章的作者寫了 FastDom,把 read 與 write 包起來一起處理 (read 一包,write 一包),不過這樣寫的時候就要小心當下真正的 DOM 的值了...

不過如果只是處理 ordering 的問題,叫 FastDom 好像怪怪的...