标签:div include mat 变换 映射 linear nbsp read 效果
1 #include <opencv2/opencv.hpp> 2 #include <iostream> 3 #include <math.h> 4 5 using namespace cv; 6 using namespace std; 7 8 9 int main(int argc, char** argv) 10 { 11 Mat src,dst; 12 Mat map_x, map_y; 13 src = imread("3 input.bmp"); 14 15 imshow("原图像", src); 16 17 //创建和原图一样的效果图,x重映射图,y重映射图 18 dst.create(src.size(), src.type()); 19 map_x.create(src.size(), CV_32FC1); 20 map_y.create(src.size(), CV_32FC1); 21 22 //遍历所有像素点,改变map_x & map_y的值 23 for (int j = 0; j < src.rows; j++) 24 { 25 for (int i = 0; i < src.cols; i++) 26 { 27 map_x.at<float>(j, i) = static_cast<float>(i); 28 map_y.at<float>(j, i) = static_cast<float>(src.rows - j); 29 } 30 } 31 32 //进行重映射操作 33 remap(src, dst, map_x, map_y, INTER_LINEAR); 34 35 imshow("效果图", dst); 36 37 waitKey(0); 38 return 0; 39 40 }
标签:div include mat 变换 映射 linear nbsp read 效果
原文地址:https://www.cnblogs.com/long5683/p/9692168.html