笔记

本文介绍了一种使用XF OpenCV库实现的图像缩放加速算法。该算法通过多级下采样处理,实现了从源图像到目标图像的快速缩放。文中详细展示了算法流程,包括输入图像尺寸获取、图像复制、多级缩放处理及最终结果输出等关键步骤。
#include "xf_resize_config.h"

 

#define nlevels 2

 

void resize_accel(xf::cv::Mat<TYPE, HEIGHT, WIDTH, NPC_T>& _src, xf::cv::Mat<TYPE, NEWHEIGHT, NEWWIDTH, NPC_T>& _dst) {

 

        unsigned short in_width, in_height;

    unsigned short out_width, out_height;

 

    in_width = _src.cols;

    in_height = _src.rows;

 

        xf::cv::Mat<TYPE, HEIGHT, WIDTH, NPC_T> imgInput(in_height, in_width);

    imgInput.copyTo(_src.data);

 

        for (int level = 0; level < nlevels; ++level) {

            out_width = in_width/2;

            out_height = in_width/2;

                xf::cv::Mat<TYPE, NEWHEIGHT, NEWWIDTH, NPC_T> imgOutput(out_height, out_width);

 

        xf::cv::resize<INTERPOLATION, TYPE, HEIGHT, WIDTH, NEWHEIGHT, NEWWIDTH, NPC_T, MAXDOWNSCALE>(imgInput, imgOutput);

 

        in_width = imgOutput.cols;

        in_height = imgOutput.rows;

                xf::cv::Mat<TYPE, HEIGHT, WIDTH, NPC_T> imgInput(in_height, in_width);

            imgInput.copyTo(imgOutput.data);

 

        if (level == nlevels -1)

            _dst.copyTo(imgOutput.data);

        }

}

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值