Android OpenCV - 在矩阵上应用数学运算符
Android OpenCV - Applying math operators on matrices
我正在将一些 cpp 代码翻译成 android。在 cpp 中,有一些重载方法用于在 opencv 矩阵之间执行数学运算符。它在安卓中不起作用。
CPP 代码:
int thresh = 30, N = 11;
Mat gray0(image.size(), CV_8U), gray;
for (int l = 0; l < N; l++) {
if (l == 0)
{
// apply Canny. Take the upper threshold from slider
// and set the lower to 0 (which forces edges merging)
Canny(gray0, gray, 0, thresh, 5);
// dilate canny output to remove potential
// holes between edge segments
dilate(gray, gray, Mat(), Point(-1, -1));
}
else
{
// apply threshold if l!=0:
gray = gray0 >= (l + 1) * 255 / N;
}
}
我被困在else
部分。
需要在安卓中编写该代码。任何帮助将不胜感激。
在opencv库中找到它。运算符可在 Core.compare
中找到。
答:Core.compare(gray0, new Scalar((l+1) * 255/N), gray, Core.CMP_GE);
相关文章:
- 没有运算符"="与这些操作数匹配,JUCE 窗口演示应用程序
- 运算符'<'不能应用于类型 'string' 和 'string' 的操作数
- 应用于运算符而不是构造函数的显式关键字
- 应用于无符号类型的一元减号运算符
- C++中基本二元数学运算符的名称
- 如何将字符字符串用作数学运算符
- 在C++中生成随机数学运算符
- 将作为数学运算符的字符添加到随机字符串中
- 如何将 decltype 应用于运算符 [] 声明中的成员函数
- Objective-C与应用数学算法的C
- 重载数学运算符
- Android OpenCV - 在矩阵上应用数学运算符
- 数学运算符未注册为输入
- 在构造过程中应用type_id运算符
- 元编程中有哪些数学运算符可用
- 使结构体的所有数学运算符操作同一成员
- 接受一个浮点数和一个数学运算符
- 为指向数组的指针应用新运算符的一种防错方法
- 为什么我的变量在应用位移运算符后没有更改?
- 为什么我得到不同的结果当我应用sizeof运算符