Reputation: 2653
In OpenCV's C++ API, one can do elementwise boolean operations (and, or, xor, not) using a syntax like this:
Mat a, b;
Mat c = a & b;
and similarly with the others. I know there is no operator overloading in Java; I'm looking for how the Java API exposes the same functionality that was exposed in C++ in that form. I've found the Core.bitwise_*
functions already, but those are per bit, not per matrix element.
Upvotes: 3
Views: 942
Reputation: 957
Mat a, b; // Set these to what you need.
Mat result = new Mat();
Core.bitwise_and(a, b, result);
You can do the same with Core.bitwise_or(...)
Upvotes: 0
Reputation: 11163
This is operator overloading. In java operator overloading is not supported. But if you require something like this you can introduce a method to do this.
For example -
Mat a, b;
Mat c;
c = Mat.doOperation(a, b);
Where doOperation() is a static method in Mat
-
public static doOperation(Mat a, Mat b){
//do whatever you want
}
Upvotes: 2