您的位置:首页 > 运维架构

基于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];
}
}
}
}
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: