Logical operations in OpenCV with Java

In the OpenCV C ++ API, it is possible to perform elementary logical operations (and, or, xor, not) using syntax like this:

Mat a, b;
Mat c = a & b;

      

and similarly to others. I know there is no operator overloading in Java; I'm looking for how the Java API provides the same functionality that was exposed in C ++ in this form. I've already found functions Core.bitwise_*

, but they are on a bit, not a matrix element.

+3
java c ++ logical-operators opencv


source to share


1 answer


This is operator overloading. Operator overloading is not supported in java. But if you need something like this, you can introduce a method to do it.

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
}

      

+2


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics