% 功能:标定椭圆参数
%
clc;close all;clear all;
a = 400;
%b = 160;
Hnine = 1;
data = imread('C:\Documents and Settings\Administrator\桌面\a\90.bmp');
[M N ] = size(data);
%data(287:289,359:361) = 255;
data(288,:) = 255;
data(:,360) = 255;
figure;imshow(data);
test1 = 0;
test2 = 0;
test3 = 0;
test4 = 0;
rec1 = 0;
rec2 = 0;
data_then = zeros(M,N);
datatest = zeros(M,N);
ftest = zeros(M,N);
ftest = data;
x = 0;
y = 0;
%figure;
for i = 72
for j = 1:N
x_pie = j-N/2; % 矩阵坐标转论文(图像中点即原点)坐标
y_pie = M/2-i;
%datatest(i,j) = (x_pie^2 + y_pie^2)/(210*210+145*145)*255;
b = a*(y_pie/x_pie);
if(x_pie<0)
a = -abs(a);
end
if(y_pie<0)
b = -abs(b);
end
end
% x = a*(1 - y_pie*y_pie/b/b).^0.5;
% y = b*(1 - x_pie*x_pie/a/a).^0.5;
bb = 10;
aa = 308;
tuoyuan = @(xx) (bb*(1-xx.*xx/aa/aa).^0.5);
x = x_pie;
if(x_pie>aa | x_pie<-aa)
x_pie = aa;
end
y = tuoyuan(x_pie);
% x = x_pie/;
% y = y_pie/2;
if(x<-360 | x>360)
rec1 = rec1+1;
end
if(y<-288 | y>288)
rec2 = rec2+1;
end
i_index = M/2 - y; % 论文坐标转矩阵坐标
j_index = x + N/2 ;
i_index = uint32(i_index);
j_index = uint32(j_index);
if(i_index>M)
i_index = M;
test1 = test1 + 1;
elseif(i_index<1)
i_index = 1;
test2 = test2 + 1;
end
if(j_index>N)
j_index = N;
test3 = test3 + 1;
else if(j_index<1)
j_index = 1;
test4 = test4 +1;
end
ftest(i_index,j_index) = 0;
ftest(i,j) = 0;
imshow(uint8(ftest));
data_then(i,j) = data(i_index,j_index);
end
end
%figure;imshow(uint8(datatest),[]);
figure;imshow(uint8(data_then));
%
% %% -----------------透镜形变校正------------------------
% A = [
% 13,59,-1,0,0,0,585,2655
% 0,0,0,13,59,-1,338,1534
% -68,58,-1,0,0,0,7344,-6264
% 0,0,0,68,-58,1,1496,-1276
% 51,124,-1,0,0,0,2601,6324
% 0,0,0,51,124,-1,6324,15376
% -113,122,-1,0,0,0,12769,-13786
% 0,0,0,113,-122,1,13786,-14884
% %-30,106,-1,0,0,0,900,-3180,30
%
% ];
% B = [45 26 -108 -22 51 -124 -113 -122 ]';
%
% value = det(A);
% Ali = inv(A);
% Htmp = Ali*B;
%
% H = zeros(3,3);
% for i = 1:8
% H(i) = Htmp(i)*Hnine;
% end
% H(9) = Hnine;
%
% H = H';
%
% h = inv(H);
%
%
% data_then = zeros(M,N,NN);
% test1 = 0;
% test2 = 0;
% test3 = 0;
% test4 = 0;
% for i = 1:M
% for j = 1:N
% X = j-N/2; % 矩阵坐标转论文(图像中点即原点)坐标
% Y = M/2-i;
%
% x_pie = (h(1,1)*X + h(1,2)*Y + h(1,3))/(h(3,1)*X + h(3,2)*Y + h(3,3));
% y_pie = (h(2,1)*X + h(2,2)*Y + h(2,3))/(h(3,1)*X + h(3,2)*Y + h(3,3));
%
% i_index = M/2 - y_pie; % 论文坐标转矩阵坐标
% j_index = x_pie + N/2;
%
% i_index = uint32(i_index);
% j_index = uint32(j_index);
% if(i_index>M)
% i_index = M;
% test1 = test1 + 1
% elseif(i_index<1)
% i_index = 1;
% test2 = test2 + 1
% end
%
% if(j_index>N)
% j_index = N;
% test3 = test3 + 1
% elseif(j_index<1)
% j_index = 1;
% test4 = test4 +1
% end
%
%
% data_then(i,j,:) = data(i_index,j_index,:);
% end
% end
%
% figure;imshow(uint8(data_then));
没有合适的资源?快使用搜索试试~ 我知道了~
鱼眼镜头校正matlab程序
共29个文件
m:13个
bmp:6个
asv:5个
5星 · 超过95%的资源 需积分: 50 338 下载量 5 浏览量
2015-02-09
09:18:16
上传
评论 1
收藏 3.14MB RAR 举报
温馨提示
包含测试图像、测试结果 采用matlab实现鱼眼镜头标定 方法简答,可靠,标定效果可以
资源推荐
资源详情
资源评论
收起资源包目录
鱼眼校正.rar (29个子文件)
校正
截图.jpg 126KB
test.m 2KB
trapezial_correction.m 2KB
90.bmp 406KB
test2.asv 4KB
test.asv 2KB
trapezial_correction.asv 3KB
060.bmp 406KB
Untitled.m 1KB
090r.fig 277KB
Untitled3.m 4KB
rec2.m 2KB
090l.bmp 406KB
markpoint.m 621B
090r.bmp 406KB
fitellipse.m 3KB
060-1.fig 270KB
Untitled6.m 4KB
Untitled5.m 4KB
shiyan5.m 4KB
rec2.asv 2KB
rec.asv 3KB
080.bmp 406KB
Thumbs.db 36KB
rec.m 3KB
trapezial_correction-wrong.m 2KB
circ.m 533B
correct_image_061g.bmp 3.82MB
060.fig 262KB
共 29 条
- 1
qq_25467373
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页