Skip to content

Instantly share code, notes, and snippets.

@squm
Created February 16, 2017 08:15
Show Gist options
  • Save squm/51838c8df48cce9e56cdd432e2b513fb to your computer and use it in GitHub Desktop.
Save squm/51838c8df48cce9e56cdd432e2b513fb to your computer and use it in GitHub Desktop.
Mat bitwise
void
bitwise() {
const uchar X = 0;
Mat mask = (Mat_<uchar>(1, 2) <<
1, X
);
threshold(mask, mask, X, 255, THRESH_BINARY);
cout << mask << endl;
Mat rgb =
Mat(1, 2, CV_8UC3, Scalar(1, 11, 111));
cout << rgb << endl;
bitwise_and(rgb, rgb, rgb, mask);
cout << rgb << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment