美文网首页matlab学习
matlab 图像反畸变

matlab 图像反畸变

作者: Kerwin_H | 来源:发表于2019-06-21 09:28 被阅读0次

%图像畸变

clear

A =[720 0 360; 

    0    810 405; 

    0 0 1]; 

D = [-0.267 0.636 0 0 0]; 

fx = A(1,1); 

fy = A(2,2); 

cx = A(1,3); 

cy = A(2,3); 

k1 = D(1); 

k2 = D(2); 

k3 = D(5); 

p1 = D(3); 

p2 = D(4); 

K = A; 

Idistorted = imread('F:\a01.png'); 

Idistorted = rgb2gray(Idistorted); 

Idistorted = im2double(Idistorted); 

I = zeros(size(Idistorted)); 

[i, j] = find(~isnan(I)); 

% Xp = the xyz vals of points on the z plane 

Xp = (K)\[j i ones(length(i),1)]'; 

% Now we calculate how those points distort i.e forward map them through the distortion 

r2 = Xp(1,:).^2+Xp(2,:).^2; 

x = Xp(1,:); 

y = Xp(2,:); 

x = x.*(1+k1*r2 + k2*r2.^2 + k3*r2.^3) + 2*p1.*x.*y + p2*(r2 + 2*x.^2); 

y = y.*(1+k1*r2 + k2*r2.^2 + k3*r2.^3) + 2*p2.*x.*y + p1*(r2 + 2*y.^2); 

% u and v are now the distorted cooridnates 

u = reshape(fx*x + cx,size(I)); 

v = reshape(fy*y + cy,size(I)); 

% Now we perform a backward mapping in order to undistort the warped image coordinates 

I = interp2(Idistorted, u, v); 

subplot(121); imagesc(Idistorted); 

subplot(122); imagesc(I);

imwrite(I,'a04.png') %export picture

相关文章

  • matlab 图像反畸变

    %图像畸变 clear A =[720 0 360; 0 810 405; 0 0 1]; D = [-...

  • matlab 根据相机内参批量处理反畸变

    %批量反畸变 file_path = 'F:\\calib_img0\';% 图像文件夹路径 img_path_l...

  • 径向畸变和反射模型

    径向畸变:图像的点坐标沿着与图像中心的径向距离成比例地靠近和远离,靠近图像中心称为桶形畸变,远离图像中心称为枕形畸...

  • 相机标定

    透镜畸变 径向畸变:远离透镜中心的光线弯曲比靠近中心的严重切向畸变:透镜与图像平面不平行而产生 畸变矫正 对于径向...

  • 摄像头标定 Python + OpenCV

    〇、基础 一些单孔摄像机(照相机)会给图像带来很多畸变。畸变主要有两种:径向畸变和切向畸变。如下图所示,用红色直线...

  • 图像处理入门书推荐

    《MATLAB图像处理实例详解》 《数字图像处理》 冈萨雷斯 《图像识别与项目实践――VC++、MATLAB技术实...

  • Matlab怎么用?matlab视频教程matlab图像处理视频

    Matlab怎么用?matlab视频教程matlab图像处理视频教程零基础入门matlab教程视频 MATLAB有...

  • ENVI:正射校正

    正射校正:对图像空间和几何畸变进行校正生成多中心投影平面正射图像的处理过程,它除了能纠正一般系统因素产生的畸变外,...

  • regionprops

    Matlab图像处理函数:regionprops 这里给出在Matlab图像处理工具箱中非常重要的一个图像分析函数...

  • OpenCV-Python教程:46.摄像头标定

    基础 今天的针孔摄像头对图像做了很多扭曲,两个主要的扭曲是径向畸变和切向畸变。 由于径向畸变,直线会显示成曲线,当...

网友评论

    本文标题:matlab 图像反畸变

    本文链接:https://www.haomeiwen.com/subject/gtpeqctx.html