TomorrowP 2017-05-03 13:58 采纳率: 0%
浏览 2840
已结题

新人求助!基于球面透视投影的鱼眼镜头全景视图矫正

clc;clear all;
tic;
I0=extraction_fish('a00.jpg'); %提取轮廓
R=round((size(rgb2gray(I0),1))/2);
[heigh,width]=size(rgb2gray(I0));
u0=R;
v0=R;
%theta=2*pi/36;
nwidth=2*R;
nheigh=2*R;
x0=round(nwidth/2);
y0=round(nheigh/2);
I1=uint8(zeros(nheigh,nwidth,3));
for i=1:nwidth
for j=1:nheigh
x=i-x0;
y=j-y0;
u=R*x/(sqrt(x^2+y^2+R^2));
v=R*y/(sqrt(x^2+y^2+R^2));
xft=round(u+u0);

yft=round(v+v0);
if (xft<=0)||(xft>width)||(yft<=0)||(yft>heigh)
I1(i,j,:)=0;
elseif (xft > 1) && (xft 1) && (yft <heigh)
xx= u+u0;
yy=v+v0;
a = double(uint16(xx));
b = double(uint16(yy));
x11 = double(I0(a,b,:)); % x11 <- origImg(a,b)
x12 = double(I0(a,b+1,:)); % x12 <- origImg(a,b+1)
x21 = double(I0(a+1,b,:)); % x21 <- origImg(a+1,b)
x22 = double(I0(a+1,b+1,:)); % x22 <- origImg(a+1,b+1)
I1(i,j,:) = uint8( (b+1-yy) * ((xx-a)*x21 + (a+1-xx)*x11) + (yy-b) * ((xx-a)*x22 +(a+1-xx) * x12) ); %双线性插值
else

I1(i,j,:) = I0(xft,yft,:); % else,apply nearest interpolate
end
end
end
figure;
subplot(1,2,1),imshow(I0);
subplot(1,2,2),imshow(I1);
toc;
time=toc;
这是运行代码,结果如下图片说明
想知道怎么使图像矫正后仍然完整,怎么显示出消失的边缘

  • 写回答

1条回答 默认 最新

  • devmiao 2017-05-03 21:32
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记