본문 바로가기
SoftWare/OpenCV

[OpenCV] binarization 2진화

by 학수씨 2012. 11. 17.

int threshold=128;

const static int ThresholdType[]={

CV_THRESH_BINARY,CV_THRESH_BINARY_INV,CV_THRESH_TRUNC,

CV_THRESH_TOZERO,CV_THRESH_TOZERO_INV};


int ThresholdTypeSize=sizeof(ThresholdType)/sizeof(int);

IplImage* imgGray = cvCreateImage( cvGetSize(imgIn), IPL_DEPTH_8U, 1);

IplImage* imgBinary = cvCreateImage( cvGetSize(imgIn), IPL_DEPTH_8U, 1);


cvCvtColor(imgIn, imgGray, CV_RGB2GRAY);

cvThreshold(imgGray, imgBinary, threshold, 255, ThresholdType[x]);

'SoftWare > OpenCV' 카테고리의 다른 글

opencv image 접근 방법 및 성능 그리고 병렬처리  (0) 2015.03.16
Android JNI OpenCV 성능  (0) 2015.02.11
opencv 1.x VS opencv 2.x 성능차이  (0) 2015.02.09
OpenCV Vibrance&Saturation  (0) 2015.01.13
[OpenCV] Gray [흑백]  (0) 2012.11.17

댓글