opencv图像平移

opencv图像平移

			cv::Mat P_mat = cv::Mat::zeros(2, 3, CV_32FC1);
			P_mat.at<float>(0, 0) = 1;
			P_mat.at<float>(0, 2) = 0; //水平平移量
			P_mat.at<float>(1, 1) = 1;
			P_mat.at<float>(1, 2) = 0; //竖直平移量
			cv::warpAffine(temp, temp, P_mat, temp.size() + cv::Size(500, 1000));//图像尺寸扩张Size(500,1000)(默认扩张方式)

	//用固定颜色填充扩张的边界
	//cv::Scalar borderColor = Scalar(255, 255, 255);
	//cv::warpAffine(temp, temp, P_mat, temp.size() + cv::Size(500, 1000), 1, BORDER_CONSTANT, borderColor);


	//复制边缘填充
	//cv::warpAffine(temp, temp, P_mat, temp.size() + cv::Size(500, 1000), 1, BORDER_REPLICATE);

你可能感兴趣的:(opencv,计算机视觉,图像处理)