1 | initial version |
a filter kernel is just another cv::Mat:
Mat_<float> kernel(3,3);
kernel << 1, 4, 6, -1, 3, 5, -1, -2, 2;
Mat image = ...
Mat res;
filter2D(image, res, CV_32F, kernel);
2 | No.2 Revision |
a filter kernel is just another cv::Mat:
Mat_<float> kernel(3,3);
kernel << 1, 4, 6, -1, 3, 5, -1, -2, 2;
// or, if the Mat_<float> is too weird for you, like this:
float kdata[] = {1, 4, 6, -1, 3, 5, -1, -2, 2};
Mat kernel(3,3,CV_32F, kdata);
Mat image = ...
Mat res;
filter2D(image, res, CV_32F, kernel);