去畸变undistort的 cuda加速版本

本文介绍了一个使用CUDA进行图像畸变校正的方法。通过并行计算技术,在GPU上实现了快速的畸变校正算法,显著提高了处理速度。在1080Ti上处理时间仅需1ms,在TX2平台上也只需3ms。

undistort.h 做下声明

#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <iostream>

extern "C" void undistortcuda(float * src, float *dst,float *camera_matrix,float *dist,int width,int height);

undistort.cu

#include "cuda_runtime.h"
#include "cuda.h"

#include <iostream>
#include <string>

using namespace std; 


extern "C" void undistortcuda(float * src, float *dst,float *camera_matrix,float *dist,int width,int height);




__global__ void undistort_(float * src, float *dst, float *camera_matrix, float *distCoeffs, int width, int height)

{

    int xIndex = threadIdx.x + blockDim.x * blockIdx.x;

    int yIndex = threadIdx.y + blockDim.y * blockIdx.y;

    int idx = yIndex * width + xIndex;


    float k1 = distCoeffs[0];

    float k2 = distCoeffs[1];

    float p1 = distCoeffs[2];

    float p2 = distCoeffs[3];

    float k3 = distCoeff
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值