好久没写呆码了

今天发个重映射

#include "opencv2/video/tracking.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <ctype.h>
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#include<opencv2/opencv.hpp>
#include<string.h>
#include<vector>
using namespace cv;
using namespace std; /*****************************************************重映射****************************************/ int main()
{
//【0】变量定义
Mat srcImage,dstImage,img;
Mat map_x, map_y;
VideoCapture capture();
while ()
{
//【1】载入原始图
capture >> srcImage;
imshow("原始图", srcImage);
//【2】创建和原始图一样的效果图,x重映射图,y重映射图
dstImage.create(srcImage.size(), srcImage.type());
map_x.create(srcImage.size(), CV_32FC1);
map_y.create(srcImage.size(), CV_32FC1);
//【3】双层循环,遍历每一个像素点,改变map_x & map_y的值
for (int j = ; j < srcImage.rows; j++)
{
for (int i = ; i < srcImage.cols; i++)
{
//改变map_x & map_y的值.
map_x.at<float>(j, i) = static_cast<float>(i);
map_y.at<float>(j, i) = static_cast<float>(srcImage.rows - j);
}
}
remap(srcImage, dstImage, map_x, map_y, INTER_LINEAR, BORDER_CONSTANT, Scalar(, , ));
imshow("【程序窗口】", dstImage);
waitKey();
}
return ;
}
05-11 15:08