Last active
June 29, 2017 22:50
-
-
Save redrabbit/42543879ae3667ffadaf to your computer and use it in GitHub Desktop.
OpenCV thresholding
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
IplImage* createThresholding( IplImage* source, const CvScalar& min, const CvScalar& max ) | |
{ | |
const CvSize imgSize = cvSize( source->width, source->height ); | |
IplImage* hsv = cvCreateImage( imgSize, 8, 3 ); | |
cvCvtColor( source, hsv, CV_BGR2HSV ); | |
IplImage* mask = cvCreateImage( imgSize, 8, 1 ); | |
cvInRangeS( hsv, min, max, mask ); | |
cvReleaseImage( &hsv ); | |
return mask; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment