%%% WARNING!!! This code is not in working condition yet.
%%% AS A RESULT, IT IS NOT SUPPORTED!!!
%%% -Jean-Yves Bouguet
%go_calib_optim_iter_weak
%
%Main calibration function. Computes the intrinsic andextrinsic parameters
%for the weak perspective camera model
%Runs as a script.
%
%INPUT: x_1,x_2,x_3,...: Feature locations on the images
% X_1,X_2,X_3,...: Corresponding grid coordinates
%
%OUTPUT: fc: Camera focal length
% cc: Principal point coordinates
% alpha_c: Skew coefficient
% kc: Distortion coefficients
% KK: The camera matrix (containing fc and cc)
% omc_1,omc_2,omc_3,...: 3D rotation vectors attached to the grid positions in space
% Tc_1,Tc_2,Tc_3,...: 3D translation vectors attached to the grid positions in space
% Rc_1,Rc_2,Rc_3,...: 3D rotation matrices corresponding to the omc vectors
%
%Method: Minimizes the pixel reprojection error in the least squares sense over the intrinsic
% camera parameters, and the extrinsic parameters (3D locations of the grids in space)
%
%Note: If the intrinsic camera parameters (fc, cc, kc) do not exist before, they are initialized through
% the function init_intrinsic_param.m. Otherwise, the variables in memory are used as initial guesses.
%
%Note: The row vector active_images consists of zeros and ones. To deactivate an image, set the
% corresponding entry in the active_images vector to zero.
%
%VERY IMPORTANT: This function works for 2D and 3D calibration rigs, except for init_intrinsic_param.m
%that is so far implemented to work only with 2D rigs.
%In the future, a more general function will be there.
%For now, if using a 3D calibration rig, quick_init is set to 1 for an easy initialization of the focal length
%%% Little modifications for weak perspective model:
center_optim = 0; % No center estimation for weak perspective model
%est_dist = zeros(5,1); % No distortion for weak perspective model
%est_alpha = 0; % No skew for weak perspective model
if ~exist('desactivated_images'),
desactivated_images = [];
end;
if ~exist('est_aspect_ratio'),
est_aspect_ratio = 1;
end;
if ~exist('est_fc');
est_fc = [1;1]; % Set to zero if you do not want to estimate the focal length (it may be useful! believe it or not!)
end;
if ~exist('recompute_extrinsic'),
recompute_extrinsic = 1; % Set this variable to 0 in case you do not want to recompute the extrinsic parameters
% at each iterstion.
end;
if ~exist('MaxIter'),
MaxIter = 30; % Maximum number of iterations in the gradient descent
end;
if ~exist('check_cond'),
check_cond = 1; % Set this variable to 0 in case you don't want to extract view dynamically
end;
if ~exist('center_optim'),
center_optim = 1; %%% Set this variable to 0 if your do not want to estimate the principal point
end;
if exist('est_dist'),
if length(est_dist) == 4,
est_dist = [est_dist ; 0];
end;
end;
if ~exist('est_dist'),
est_dist = [1;1;1;1;0];
end;
if ~exist('est_alpha'),
est_alpha = 0; % by default, do not estimate skew
end;
% Little fix in case of stupid values in the binary variables:
center_optim = double(~~center_optim);
est_alpha = double(~~est_alpha);
est_dist = double(~~est_dist);
est_fc = double(~~est_fc);
est_aspect_ratio = double(~~est_aspect_ratio);
fprintf(1,'\n');
if ~exist('nx')&~exist('ny'),
fprintf(1,'WARNING: No image size (nx,ny) available. Setting nx=640 and ny=480. If these are not the right values, change values manually.\n');
nx = 640;
ny = 480;
end;
check_active_images;
quick_init = 0; % Set to 1 for using a quick init (necessary when using 3D rigs)
% Check 3D-ness of the calibration rig:
rig3D = 0;
for kk = ind_active,
eval(['X_kk = X_' num2str(kk) ';']);
if is3D(X_kk),
rig3D = 1;
end;
end;
if center_optim & (length(ind_active) < 2) & ~rig3D,
fprintf(1,'WARNING: Principal point rejected from the optimization when using one image and planar rig (center_optim = 1).\n');
center_optim = 0; %%% when using a single image, please, no principal point estimation!!!
est_alpha = 0;
end;
if ~exist('dont_ask'),
dont_ask = 0;
end;
if center_optim & (length(ind_active) < 5) & ~rig3D,
fprintf(1,'WARNING: The principal point estimation may be unreliable (using less than 5 images for calibration).\n');
%if ~dont_ask,
% quest = input('Are you sure you want to keep the principal point in the optimization process? ([]=yes, other=no) ');
% center_optim = isempty(quest);
%end;
end;
% A quick fix for solving conflict
if ~isequal(est_fc,[1;1]),
est_aspect_ratio=1;
end;
if ~est_aspect_ratio,
est_fc=[1;1];
end;
if ~est_aspect_ratio,
fprintf(1,'Aspect ratio not optimized (est_aspect_ratio = 0) -> fc(1)=fc(2). Set est_aspect_ratio to 1 for estimating aspect ratio.\n');
else
if isequal(est_fc,[1;1]),
fprintf(1,'Aspect ratio optimized (est_aspect_ratio = 1) -> both components of fc are estimated (DEFAULT).\n');
end;
end;
if ~isequal(est_fc,[1;1]),
if isequal(est_fc,[1;0]),
fprintf(1,'The first component of focal (fc(1)) is estimated, but not the second one (est_fc=[1;0])\n');
else
if isequal(est_fc,[0;1]),
fprintf(1,'The second component of focal (fc(1)) is estimated, but not the first one (est_fc=[0;1])\n');
else
fprintf(1,'The focal vector fc is not optimized (est_fc=[0;0])\n');
end;
end;
end;
if ~center_optim, % In the case where the principal point is not estimated, keep it at the center of the image
fprintf(1,'Principal point not optimized (center_optim=0). Default state for weak perspective model');
if ~exist('cc'),
fprintf(1,'It is kept at the center of the image.\n');
cc = [(nx-1)/2;(ny-1)/2];
else
fprintf(1,'Note: to set it in the middle of the image, clear variable cc, and run calibration again.\n');
end;
else
fprintf(1,'Principal point optimized (center_optim=1) - (DEFAULT). To reject principal point, set center_optim=0\n');
end;
if ~center_optim & (est_alpha),
fprintf(1,'WARNING: Since there is no principal point estimation (center_optim=0), no skew estimation (est_alpha = 0)\n');
est_alpha = 0;
end;
if ~est_alpha,
fprintf(1,'Skew not optimized (est_alpha=0) - (DEFAULT)\n');
alpha_c = 0;
else
fprintf(1,'Skew optimized (est_alpha=1). To disable skew estimation, set est_alpha=0.\n');
end;
if ~prod(double(est_dist)),
fprintf(1,'Distortion not fully estimated (defined by the variable est_dist):\n');
if ~est_dist(1),
fprintf(1,' Second order distortion not estimated (est_dist(1)=0) - (DEFAULT for weak perspective model) . \n');
end;
if ~est_dist(2),
fprintf(1,' Fourth order distortion not estimated (est_dist(2)=0) - (DEFAULT for weak perspective model) .\n');
end;
if ~est_dist(5),
fprintf(1,' Sixth order distortion not estimated (est_dist(5)=0) - (DEFAULT for weak perspective model) .\n');
end;
if ~prod(double(est_dist(3:4))),
fprintf(1,' Tangential distortion not estimated (est_dist(3:4)~=[1;1]) - (DEFAULT for weak perspective model) .\n');
end;
end;
% Check 3D-ness of the calibration rig:
rig3D = 0;
for kk = ind_active,
eval(['X_kk = X_' num2str(kk) ';']);
if is3D(X_kk),
rig3D = 1;
end;
end;
% If the rig is 3D, then no choice: the only valid initialization is manual!
if rig3D,
quick_init = 1;
end;
alpha_smooth = 1; % set alpha_smooth = 1; for steepest gradient descent
% Conditioning threshold for view rejection
thresh_cond = 1e6;
%% Initialization of the intrinsic parameters (if necessary)
if ~exist('cc'),
fprintf(1,'Initialization of the principal point at the center of the image.\n');
cc = [(nx-1)/2;(ny-1)/2];
alpha_smooth = 0.4; % slow convergence
end;
if exist('kc'),
if length(kc) == 4;
fprintf(1,'Adding a new distortion coefficient to kc -> radial d
没有合适的资源?快使用搜索试试~ 我知道了~
toolbox_calib.rar_matlab圆形标定_matlab相机标定_圆形标定板_标定_标定板
共203个文件
m:192个
asv:6个
mat:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 19 下载量 126 浏览量
2022-07-15
04:23:52
上传
评论 5
收藏 946KB RAR 举报
温馨提示
改进过的张正友标定法,可以用于使用圆形标记点标定板的相机标定。
资源详情
资源评论
资源推荐
收起资源包目录
toolbox_calib.rar_matlab圆形标定_matlab相机标定_圆形标定板_标定_标定板 (203个子文件)
click_ima_calib.asv 11KB
center_ellipse_finder.asv 4KB
convert_sba_data.asv 3KB
calib_plot_results.asv 574B
zhifangtu.asv 365B
threeeD_rebuild.asv 117B
error.jpg 53KB
go_calib_optim_iter_weak.m 20KB
go_calib_optim_iter.m 19KB
go_calib_optim_iter_fisheye.m 18KB
calib_stereo.m 18KB
Meshing.m 14KB
go_calib_stereo.m 14KB
click_ima_calib_no_read.m 13KB
click_ima_calib3D.m 13KB
click_ima_calib_no_read_bak.m 13KB
click_ima_calib.m 11KB
scanner_calibration_script.m 11KB
ComputeStripes.m 11KB
project_points3.m 10KB
click_ima_calib_fisheye_no_read.m 10KB
fit_ellipse.m 10KB
project_points_fisheye.m 9KB
project_points_weak.m 9KB
project_points2.m 9KB
extract_grid_manual.m 9KB
extract_grid.m 9KB
click_ima_calib_bak.m 9KB
Distor2Calib.m 8KB
rectify_stereo_pair.m 7KB
ext_calib2.m 7KB
ginput4.m 7KB
project_points.m 7KB
reproject_calib_no_read.m 7KB
load_stereo_calib_files.m 7KB
visualize_distortions.m 6KB
click_calib_no_read.m 6KB
click_calib_fisheye_no_read.m 6KB
ginput3.m 6KB
rodrigues.m 6KB
stereo_gui.m 6KB
reproject_calib.m 6KB
ginput2.m 6KB
undistort_image_no_read.m 6KB
cornerfinder_saddle_point.m 6KB
saving_calib_fisheye.m 6KB
saving_calib.m 6KB
ext_calib_stereo.m 5KB
undistort_image.m 5KB
cornerfinder.m 5KB
compute_extrinsic_init_fisheye.m 5KB
init_intrinsic_param.m 5KB
compute_extrinsic_init.m 5KB
undistort_image_color.m 5KB
click_calib.m 5KB
ext_calib.m 5KB
cornerfinder2.m 5KB
edgefinder.m 5KB
manual_corner_extraction_no_read.m 5KB
check_directory.m 5KB
extrinsic_computation.m 5KB
undistort_sequence.m 4KB
projector_marker.m 4KB
analyse_error.m 4KB
recomp_corner_calib_fisheye_no_read.m 4KB
cam_proj_calib.m 4KB
saving_calib_ascii.m 4KB
center_ellipse_finder.m 4KB
saving_calib_ascii_fisheye.m 4KB
manual_corner_extraction.m 4KB
recomp_corner_calib_no_read.m 4KB
add_suppress.m 3KB
compute_homography.m 3KB
centercirclefinder.m 3KB
Calib_Results.m 3KB
error_analysis.m 3KB
TestFunction.m 3KB
saving_calib_no_results.m 3KB
convert_sba_data.m 3KB
recomp_corner_calib.m 3KB
export_calib_data.m 3KB
compute_extrinsic.m 3KB
ima_read_calib_no_read.m 3KB
readras.m 3KB
compute_extrinsic_refine2.m 3KB
go_calib_optim_fisheye_no_read.m 3KB
compute_extrinsic_refine_fisheye.m 3KB
go_calib_optim_no_read.m 3KB
go_calib_optim.m 3KB
compute_extrinsic_refine.m 3KB
data_calib.m 3KB
scanning_script.m 3KB
ima_read_calib.m 3KB
data_calib_no_read.m 3KB
cam_proj_calib_optim.m 2KB
error_cam_proj2.m 2KB
init_intrinsic_param_fisheye.m 2KB
mosaic_no_read.m 2KB
stereo_triangulation.m 2KB
centre_ellipse_moid.m 2KB
共 203 条
- 1
- 2
- 3
邓凌佳
- 粉丝: 65
- 资源: 1万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 2001~2022年上市公司数字赋能指数.dta
- 2001~2022年上市公司数字赋能指数.xlsx
- 信息办公石大在线财务管理系统(含源码)-shidacaiwu.rar
- 信息办公电信计费系统完整代码-netctossconformity.rar
- matlab实现TD-SCDMA中初始同步捕捉DwPTS下行同步导频时隙的仿真.zip
- 信息办公玉玺学生信息管理系统-webapps.rar
- 信息办公基于struts的图书管理系统-struts-ts.rar
- 管家婆分销ERP V1 V3 A8II TOP V10.0.2最新全版本通用
- 信息办公基于Ajax+J2EE的MicroERP源码下载-microerp-0.1.rar
- 信息办公双鱼林jsp人事工资系统-wagesmanagesystem.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论17