【发布时间】:2014-05-04 11:42:15
【问题描述】:
我们如何在opencv中制作小插图过滤器?我们需要为它实现任何算法还是只使用 BGR 的值?我们如何制作这种类型的过滤器。我看到了它的实现here,但我没有清楚地理解它。任何有完整算法指导和实施指导的人都会受到高度评价。
Abid rehman K 回答后我在 c++ 中尝试过这个
int main()
{
Mat v;
Mat img = imread ("D:\\2.jpg");
img.convertTo(v, CV_32F);
Mat a,b,c,d,e;
c.create(img.rows,img.cols,CV_32F);
d.create(img.rows,img.cols,CV_32F);
e.create(img.rows,img.cols,CV_32F);
a = getGaussianKernel(img.cols,300,CV_32F);
b = getGaussianKernel(img.rows,300,CV_32F);
c = b*a.t();
double minVal;
double maxVal;
cv::minMaxLoc(c, &minVal, &maxVal);
d = c/maxVal;
e = v*d ; // This line causing error
imshow ("venyiet" , e);
cvWaitKey();
}
d 显示正确,但 e=v*d 行导致运行时错误
OpenCV Error: Assertion failed (type == B.type() && (type == CV_32FC1 || type ==
CV_64FC1 || type == CV_32FC2 || type == CV_64FC2)) in unknown function, file ..
\..\..\src\opencv\modules\core\src\matmul.cpp, line 711
【问题讨论】:
-
你没有做 c=b*a.T 函数。
-
我是不是忘记在这里上传了,实际上我上传了
d图片,它显示了没有图片的小插曲 -
@Ahmad 不是不想帮你,而是阿比德的回答已经够好了。
-
是的,毫无疑问,它的答案令人印象深刻,但我正在尝试我的 C++ 工作,而我只是遇到了障碍
-
问题是
v和d都是CV_32F,这不是该操作支持的格式。
标签: c++ opencv image-processing filter computer-vision