Created
May 30, 2013 10:08
-
-
Save ochilab/5676919 to your computer and use it in GitHub Desktop.
OpenCVSharpでの2値化処理
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private IplImage binarize(IplImage src, int threshould) { | |
//グレースケールに変換 | |
IplImage gray = new IplImage(src.Width,src.Height, BitDepth.U8, 1); | |
src.CvtColor(gray, ColorConversion.BgrToGray); | |
//二値化処理 | |
Cv.Threshold(gray, gray, threshould, 255, ThresholdType.Binary); | |
return gray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
最初にグレースケール変換する際のgrayのサイズはsrcと同じにしておくこと。