【发布时间】:2016-03-21 10:29:53
【问题描述】:
我正在将一些 cpp 代码翻译成 android。在 cpp 中,有一些重载方法可以在 opencv 矩阵之间进行数学运算符。它在android中不起作用。
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 部分。
需要在 android 中编写该代码。 任何帮助将不胜感激。
【问题讨论】:
-
cv::threshold(gray0, gray, (l+1)*255/N, 255, THRESH_BINARY);给出相同的结果。 reference
标签: android c++ opencv matrix operators