1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Simple matrix multiplication for Mat in iOS/Android

This commit is contained in:
Giles Payne
2021-10-05 20:16:06 +09:00
parent 24fcb7f813
commit 19a880bb91
8 changed files with 90 additions and 2 deletions
+20 -2
View File
@@ -466,16 +466,32 @@ public class Mat {
// C++: Mat Mat::mul(Mat m, double scale = 1)
//
// javadoc: Mat::mul(m, scale)
/**
* Element-wise multiplication with scale factor
* @param m operand with with which to perform element-wise multiplication
* @param scale scale factor
*/
public Mat mul(Mat m, double scale) {
return new Mat(n_mul(nativeObj, m.nativeObj, scale));
}
// javadoc: Mat::mul(m)
/**
* Element-wise multiplication
* @param m operand with with which to perform element-wise multiplication
*/
public Mat mul(Mat m) {
return new Mat(n_mul(nativeObj, m.nativeObj));
}
/**
* Matrix multiplication
* @param m operand with with which to perform matrix multiplication
* @see Core#gemm(Mat, Mat, double, Mat, double, Mat, int)
*/
public Mat matMul(Mat m) {
return new Mat(n_matMul(nativeObj, m.nativeObj));
}
//
// C++: static Mat Mat::ones(int rows, int cols, int type)
//
@@ -1732,6 +1748,8 @@ public class Mat {
private static native long n_mul(long nativeObj, long m_nativeObj);
private static native long n_matMul(long nativeObj, long m_nativeObj);
// C++: static Mat Mat::ones(int rows, int cols, int type)
private static native long n_ones(int rows, int cols, int type);
@@ -0,0 +1,3 @@
package org.opencv.core
operator fun Mat.times(other: Mat): Mat = this.matMul(other)