チェンジセット 2865

差分発生行の前後
無視リスト:
コミット日時:
2009/07/02 17:18:29 (8 ヶ月前)
コミッタ:
keno
ログメッセージ:

QRCodeDetecter.as: deployed an adaptive thresholding(based on @Saqoosha's idea)

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/QRCodeReader/branches/keno/src/com/logosware/utils/QRcode/QRCodeDetecter.as

    r2812 r2865  
    9696                         
    9797                        // グレー化 
    98                         bd.applyFilter(bd, IMAGE_RECT, ORIGIN_POINT, new ColorMatrixFilter(grayConst)); 
    99                         bd.applyFilter(bd, IMAGE_RECT, ORIGIN_POINT, new ConvolutionFilter(5, 5, [ 
    100                                 0, -1, -1, -1, 0, 
    101                                 -1, -1, -2, -1, -1, 
    102                                 -1, -2, 25, -2, -1, 
    103                                 -1, -1, -2, -1, -1, 
    104                                 0, -1, -1, -1, 0 
    105                         ])); 
    106                         bd.applyFilter(bd, IMAGE_RECT, ORIGIN_POINT, new BlurFilter(3, 3)); 
     98                        // this idea is based on Saqoosha's article. http://blog.jactionscripters.com/2009/05/18/adaptive-thresholding-experiment/#more-351 
     99                        bd2.applyFilter(bd, IMAGE_RECT, ORIGIN_POINT, new BlurFilter(64, 64)); 
     100                        bd2.draw( image, null, null, BlendMode.SUBTRACT ); 
     101                         
    107102                        // 二値化 
    108                         bd.threshold(bd, IMAGE_RECT, ORIGIN_POINT, ">", threshold, 0xFFFFFFFF, 0x0000FF00); 
    109                         bd.threshold(bd, IMAGE_RECT, ORIGIN_POINT, "!=", 0xFFFFFFFF, 0xFF000000); 
     103                        bd.fillRect(IMAGE_RECT, 0xFFFFFFFF); 
     104                        bd.threshold(bd2, IMAGE_RECT, ORIGIN_POINT, ">", 0x00001000, 0xFF000000, 0x0000FF00); 
    110105                         
    111106                        // ラベリング