【发布时间】:2018-03-31 07:33:26
【问题描述】:
我正在尝试使用我自己的内核来模糊图像(用于教育目的)。但是我的内核只是让我的整个图像变白。我的模糊内核正确吗?我相信我尝试应用的模糊滤镜的正确名称是标准化模糊。
void blur_img(const Mat& src, Mat& output) {
// src is a 1 channel CV_8UC1
float kdata[] = { 0.0625f, 0.125f, 0.0625f, 0.125f, 0.25f, 0.125f, 0.0625f, 0.125f, 0.0625f };
//float kdata[] = { -1,-1,-1, -1,8,-1, -1,-1,-1}; // outline filter works fine
Mat kernel(3, 3, CV_32F, kdata);
// results in output being a completely white image
filter2D(src, output, CV_32F, kernel);
}
【问题讨论】: