基于opencv的图像的无失真放大
2017-07-28 14:46
246 查看
//无失真放大
void DistortionFreeAmplification(const Mat& tmpGrayMat, Mat& dstMat, int times = 8)
{
dstMat = cv::Mat(tmpGrayMat.rows * times, tmpGrayMat.cols * times, tmpGrayMat.type());
for (int i=0; i<tmpGrayMat.rows; i++)
{
for (int j=0; j<tmpGrayMat.cols; j++)
{
const uchar * qtr = tmpGrayMat.ptr<uchar>(i, j);
for (int k=0; k<times; k++)
{
for (int l=0; l<times; l++)
{
uchar * ptr = dstMat.ptr<uchar>(times * i + l, times * j + k);
for (int m = 0; m < tmpGrayMat.channels(); m++)
{
ptr[m] = qtr[m];
}
}
}
}
}
}
void DistortionFreeAmplification(const Mat& tmpGrayMat, Mat& dstMat, int times = 8)
{
dstMat = cv::Mat(tmpGrayMat.rows * times, tmpGrayMat.cols * times, tmpGrayMat.type());
for (int i=0; i<tmpGrayMat.rows; i++)
{
for (int j=0; j<tmpGrayMat.cols; j++)
{
const uchar * qtr = tmpGrayMat.ptr<uchar>(i, j);
for (int k=0; k<times; k++)
{
for (int l=0; l<times; l++)
{
uchar * ptr = dstMat.ptr<uchar>(times * i + l, times * j + k);
for (int m = 0; m < tmpGrayMat.channels(); m++)
{
ptr[m] = qtr[m];
}
}
}
}
}
}
相关文章推荐
- OpenCV2计算机编程手册(二)基于类的图像处理
- OpenCV_基于Laplacian算子的图像边缘增强
- 基于Opencv3和Qt5的图像处理GUI
- 基于OpenCV的视频图像组态 (7) :轮子动画效果
- 基于OpenCV的视频图像组态 (10): CEF浏览器与图形软件互嵌
- 基于opencv的单张图像去雾算法(一)
- 基于qml创建最简单的图像处理程序(3)-使用opencv&qml进行图像处理
- 基于opencv和c++的图像处理:直方图均衡化
- 基于C++和OpenCv的SIFT_图像局部特征检测算法代码的实现
- 基于 opencv图像去噪
- 基于OpenCV的图像测量
- 基于mschart控件,绘制工控采集类曲线,可对图像进行缩放,拖动滚动条显示放大后的图像
- 基于OpenCV的视频图像组态 (7) :轮子动画效果
- 基于OpenCV的视频图像组态 (8) :随机线条动画效果
- 【图像处理】基于OpenCV底层实现的图片旋转
- 基于opencv的单张图像去雾算法(二)
- VS2010实现opencv基于DCT的图像压缩
- 基于vs2010和opencv的图像转化到hsv空间再emd匹配
- 基于Opencv计算图像的均值和方差
- 基于OpenCV的视频图像组态 (14):音量控制