opencv学习笔记-掩膜操作
作者:互联网
#include <opencv2/opencv.hpp>
#include <iostream>
#include <math.h>
using namespace cv;
int main(int argc, char** argv) {
Mat src, dst;
src = imread("D:/hand.png");
if (!src.data) {
printf("could not load image...\n");
return -1;
}
double t = getTickCount();
//掩膜操作函数
Mat kernel = (Mat_<char>(3, 3) << 0, -1, 0, -1, 5, -1, 0, -1, 0);
filter2D(src, dst, src.depth(), kernel);
double t = getTickCount();
double timeconsume = (getTickCount() - t) / getTickFrequency();
printf("tim consume %.2f\n", timeconsume);
//计算操作所消耗的时间
double timeconsume = (getTickCount() - t) / getTickFrequency();
printf("tim consume %.2f\n", timeconsume);
imshow("input image", src);
imshow("contrast image demo", dst);
waitKey(0);
return 0;
}
标签:load,src,掩膜,int,笔记,opencv,include,Mat 来源: https://blog.csdn.net/weixin_51244852/article/details/118096324