Skip to content

Instantly share code, notes, and snippets.

@felipe-araujo
Created October 8, 2011 16:07
Show Gist options
  • Save felipe-araujo/1272474 to your computer and use it in GitHub Desktop.
Save felipe-araujo/1272474 to your computer and use it in GitHub Desktop.
OpenCV 2.1 utilities (C++)
// convert between colorspaces
Mat in, out
cvtColor(in, out, CV_RGB2GRAY);
// threshold
threshold(in, out, 20, 256, THRESH_BINARY);
threshold(in, out, 20, 256, THRESH_BINARY_INV);
// video capture
VideoCapture cap(0);
if(!cap.isOpened()) exit(-1);
cap.set(CV_CAP_PROP_FRAME_WIDTH, 250);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 250);
cap >> in;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment