openCV doc
陰影を考慮した二値化処理
Gallery
元画像(QRコード)
dst Niblack(1985)
dst Sauvola(1997)
dst Wolf(2004)
dst Nicole(2009)
dst Otsu(1979)
what process?
環境光が不安定な場所で撮られた画像の場合,そのまま二値化をすると
影のかかっている部分が黒くなってしまい物体検出や文字認識で精度が下がってしまう可能性がある。
しかし、この関数を使うと影の部分も考慮して二値化してくれる。
この関数では、引数を与えることで4つの手法を反映させることができる。
・Niblackが考えた手法(1985)
Wayne Niblack. An introduction to digital image processing. Strandberg Publishing Company, 1985.
・Sauvolaらが考えた手法(1997)
Jaakko Sauvola, Tapio Seppanen, Sami Haapakoski, and Matti Pietikainen. Adaptive document binarization. In Document Analysis and Recognition, 1997., Proceedings of the Fourth International Conference on, volume 1, pages 147–152. IEEE, 1997.
・Wolfらが考えた手法(2004)
Christian Wolf and J-M Jolion. Extraction and recognition of artificial text in multimedia documents. Pattern Analysis & Applications, 6(4):309–326, 2004.
・Nicoleらが考えた手法(2009)
Khurram Khurshid, Imran Siddiqi, Claudie Faure, and Nicole Vincent. Comparison of niblack inspired binarization methods for ancient documents. In IS&T/SPIE Electronic Imaging, pages 72470U–72470U. International Society for Optics and Photonics, 2009.
[パラメータ]
・maxValue : 二値化のタイプを THRESH_BINARY or THRESH_BINARY_INV にしたときの白い部分の画素値
・type : 二値化のタイプ(THRESH_BINARY、THRESH_BINARY_INV、THRESH_OTSUなど)
・blockSize : 隣接行列(カーネル)のサイズ
・k : この関数独自のパラメータ。(0.0 〜 1.0)
・binarizationMethod : 陰影を考慮した二値化処理のタイプ。BINARIZATION_NIBLACK、BINARIZATION_SAUVOLA、BINARIZATION_WOLF、BINARIZATION_NICKの4種類ある。デフォルトで何も指定しない場合はBINARIZATION_NIBLACKで処理される。(※python版ではどの値を入れてもBINARIZATION_NIBLACKしか処理されない。)
cook code C++
cook code Python
Reference