亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? distor2calib.m

?? OPENCV系列的
?? M
字號:
function [fc_2,Rc_2,Tc_2,H_2,distance,V_vert,V_hori,x_all_c,V_hori_pix,V_vert_pix,V_diag1_pix,V_diag2_pix]=Distor2Calib(k_dist,grid_pts_centered,n_sq_x,n_sq_y,Np,W,L,Xgrid_2,f_ini,N_iter,two_focal);

% Computes the calibration parameters knowing the
% distortion factor k_dist

% grid_pts_centered are the grid point coordinates after substraction of
% the optical center.

% can give an optional guess for the focal length f_ini (can set to [])
% can provide the number of iterations for the Iterative Vanishing Point Algorithm

% if the focal length is known perfectly, then, there is no need to iterate,
% and therefore, one can fix: N_iter = 0;

% California Institute of Technology
% (c) Jean-Yves Bouguet - October 7th, 1997



%keyboard;

if exist('two_focal'),
   if isempty(two_focal),
      two_focal=0;
   end;
else
   two_focal = 0;
end;


if exist('N_iter'),
   if ~isempty(N_iter),
      disp('Use number of iterations provided');
   else
      N_iter = 10;
   end;
else
   N_iter = 10;
end;

if exist('f_ini'),
   if ~isempty(f_ini),
      disp('Use focal provided');
      if length(f_ini)<2, f_ini=[f_ini;f_ini]; end;
      fc_2 = f_ini;
      x_all_c = [grid_pts_centered(1,:)/fc_2(1);grid_pts_centered(2,:)/fc_2(2)];
      x_all_c = comp_distortion(x_all_c,k_dist); % we can this time!!!
   else
     fc_2 = [1;1];
     x_all_c = grid_pts_centered;
   end;
else
   fc_2 = [1;1];
   x_all_c = grid_pts_centered;
end;


dX = W/n_sq_x;
dY = L/n_sq_y;


N_x = n_sq_x+1;
N_y = n_sq_y+1;


x_grid = zeros(N_x,N_y);
y_grid = zeros(N_x,N_y);





%%% Computation of the four vanishing points in pixels


   x_grid(:) = grid_pts_centered(1,:);
   y_grid(:) = grid_pts_centered(2,:);
         
   for k=1:n_sq_x+1,
      [U,S,V] = svd([x_grid(k,:);y_grid(k,:);ones(1,n_sq_y+1)]);
      vert(:,k) = U(:,3);
   end;
   
   for k=1:n_sq_y+1,
      [U,S,V] = svd([x_grid(:,k)';y_grid(:,k)';ones(1,n_sq_x+1)]);
      hori(:,k) = U(:,3);
   end;
   
   % 2 principle Vanishing points:
   [U,S,V] = svd(vert);
   V_vert = U(:,3);
   [U,S,V] = svd(hori);
   V_hori = U(:,3);
   
   

   % Square warping:
   
   
   vert_first = vert(:,1) - dot(V_vert,vert(:,1))/dot(V_vert,V_vert) * V_vert;
   vert_last = vert(:,n_sq_x+1) - dot(V_vert,vert(:,n_sq_x+1))/dot(V_vert,V_vert) * V_vert;
   
   hori_first = hori(:,1) - dot(V_hori,hori(:,1))/dot(V_hori,V_hori) * V_hori;
   hori_last = hori(:,n_sq_y+1) - dot(V_hori,hori(:,n_sq_y+1))/dot(V_hori,V_hori) * V_hori;
   
   
   x1 = cross(hori_first,vert_first);
   x2 = cross(hori_first,vert_last);
   x3 = cross(hori_last,vert_last);
   x4 = cross(hori_last,vert_first);
   
   x1 = x1/x1(3);
   x2 = x2/x2(3);
   x3 = x3/x3(3);
   x4 = x4/x4(3);
   
   
   
   [square] = Rectangle2Square([x1 x2 x3 x4],W,L);

   y1 = square(:,1);
   y2 = square(:,2);
   y3 = square(:,3);
   y4 = square(:,4);

   H2 = cross(V_vert,V_hori);
   
   V_diag1 = cross(cross(y1,y3),H2);
   V_diag2 = cross(cross(y2,y4),H2);

   V_diag1 = V_diag1 / norm(V_diag1);
   V_diag2 = V_diag2 / norm(V_diag2);

   V_hori_pix = V_hori;
   V_vert_pix = V_vert;
   V_diag1_pix = V_diag1;
   V_diag2_pix = V_diag2;


% end of computation of the vanishing points in pixels.








if two_focal, % only if we attempt to estimate two focals...
   % Use diagonal lines also to add two extra vanishing points (?)
   N_min = min(N_x,N_y);
   
   if N_min < 2,
      use_diag = 0;
      two_focal = 0;
      disp('Cannot estimate two focals (no existing diagonals)');   
   else
      use_diag = 1;
      Delta_N = abs(N_x-N_y);
      N_extra = round((N_min - Delta_N - 1)/2);
      diag_list = -N_extra:Delta_N+N_extra;
      N_diag = length(diag_list);
      diag_1 = zeros(3,N_diag);
      diag_2 = zeros(3,N_diag);
   end;
else   
   % Give up the use of the diagonals (so far)
   % it seems that the error is increased
   use_diag = 0;
end;



% The vertical lines: vert, Horizontal lines: hori
vert = zeros(3,n_sq_x+1);
hori = zeros(3,n_sq_y+1);
 
for counter_k = 1:N_iter, 	% the Iterative Vanishing Points Algorithm to
                                % estimate the focal length accurately
   
   x_grid(:) = x_all_c(1,:);
   y_grid(:) = x_all_c(2,:);
         
   for k=1:n_sq_x+1,
      [U,S,V] = svd([x_grid(k,:);y_grid(k,:);ones(1,n_sq_y+1)]);
      vert(:,k) = U(:,3);
   end;
   
   for k=1:n_sq_y+1,
      [U,S,V] = svd([x_grid(:,k)';y_grid(:,k)';ones(1,n_sq_x+1)]);
      hori(:,k) = U(:,3);
   end;
   
   % 2 principle Vanishing points:
   [U,S,V] = svd(vert);
   V_vert = U(:,3);
   [U,S,V] = svd(hori);
   V_hori = U(:,3);
   
   

   % Square warping:
   
   
   vert_first = vert(:,1) - dot(V_vert,vert(:,1))/dot(V_vert,V_vert) * V_vert;
   vert_last = vert(:,n_sq_x+1) - dot(V_vert,vert(:,n_sq_x+1))/dot(V_vert,V_vert) * V_vert;
   
   hori_first = hori(:,1) - dot(V_hori,hori(:,1))/dot(V_hori,V_hori) * V_hori;
   hori_last = hori(:,n_sq_y+1) - dot(V_hori,hori(:,n_sq_y+1))/dot(V_hori,V_hori) * V_hori;
   
   
   x1 = cross(hori_first,vert_first);
   x2 = cross(hori_first,vert_last);
   x3 = cross(hori_last,vert_last);
   x4 = cross(hori_last,vert_first);
   
   x1 = x1/x1(3);
   x2 = x2/x2(3);
   x3 = x3/x3(3);
   x4 = x4/x4(3);
   
   
   
   [square] = Rectangle2Square([x1 x2 x3 x4],W,L);

   y1 = square(:,1);
   y2 = square(:,2);
   y3 = square(:,3);
   y4 = square(:,4);

   H2 = cross(V_vert,V_hori);
   
   V_diag1 = cross(cross(y1,y3),H2);
   V_diag2 = cross(cross(y2,y4),H2);

   V_diag1 = V_diag1 / norm(V_diag1);
   V_diag2 = V_diag2 / norm(V_diag2);

   
   
   
   % Estimation of the focal length, and normalization:
   
   % Compute the ellipsis of (1/f^2) positions:
   % a * (1/fx)^2 + b * (1/fx)^2 = -c
   
   
   a1 = V_hori(1);
   b1 = V_hori(2);
   c1 = V_hori(3);
   
   a2 = V_vert(1);
   b2 = V_vert(2);
   c2 = V_vert(3);
   
   a3 = V_diag1(1);
   b3 = V_diag1(2);
   c3 = V_diag1(3);
   
   a4 = V_diag2(1);
   b4 = V_diag2(2);
   c4 = V_diag2(3);
   
   
   if two_focal,
      
      
      A = [a1*a2 b1*b2;a3*a4 b3*b4];
      b = -[c1*c2;c3*c4];
      
      f = sqrt(abs(1./(inv(A)*b)));

   else
      
      f = sqrt(abs(-(c1*c2*(a1*a2 + b1*b2) + c3*c4*(a3*a4 + b3*b4))/(c1^2*c2^2 + c3^2*c4^2)));
      
      f = [f;f];
      
   end;
   

   
   % REMARK:
   % if both a and b are small, the calibration is impossible.
   % if one of them is small, only the other focal length is observable
   % if none is small, both focals are observable
   
   
   fc_2 = fc_2 .* f;
   
      
   % DEBUG PART: fix focal to 500...
   %fc_2= [500;500]; disp('Line 293 to be earased in Distor2Calib.m');
   
   
   % end of focal compensation
   
   % normalize by the current focal:
   
   x_all = [grid_pts_centered(1,:)/fc_2(1);grid_pts_centered(2,:)/fc_2(2)];
   
   % Compensate by the distortion factor:
   
   x_all_c = comp_distortion(x_all,k_dist);
   
end;
   
% At that point, we hope that the distortion is gone...

x_grid(:) = x_all_c(1,:);
y_grid(:) = x_all_c(2,:);

for k=1:n_sq_x+1,
   [U,S,V] = svd([x_grid(k,:);y_grid(k,:);ones(1,n_sq_y+1)]);
   vert(:,k) = U(:,3);
end;

for k=1:n_sq_y+1,
   [U,S,V] = svd([x_grid(:,k)';y_grid(:,k)';ones(1,n_sq_x+1)]);
   hori(:,k) = U(:,3);
end;

% Vanishing points:
[U,S,V] = svd(vert);
V_vert = U(:,3);
[U,S,V] = svd(hori);
V_hori = U(:,3);

% Horizon:

H_2 = cross(V_vert,V_hori);
   
%   H_2 = cross(V_vert,V_hori);

% pick a plane in front of the camera (positive depth)
if H_2(3) < 0, H_2 = -H_2; end;


% Rotation matrix:

if V_hori(1) < 0, V_hori = -V_hori; end;

V_hori = V_hori/norm(V_hori);
H_2 = H_2/norm(H_2);

V_hori = V_hori - dot(V_hori,H_2)*H_2;

Rc_2 = [V_hori cross(H_2,V_hori) H_2];

Rc_2 = Rc_2 / det(Rc_2);

%omc_2 = rodrigues(Rc_2);

%Rc_2 = rodrigues(omc_2);

% Find the distance of the plane for translation vector:

xc_2 = [x_all_c;ones(1,Np)];

Zc_2 = 1./sum(xc_2 .* (Rc_2(:,3)*ones(1,Np)));

Xo_2 = [sum(xc_2 .* (Rc_2(:,1)*ones(1,Np))).*Zc_2 ; sum(xc_2 .* (Rc_2(:,2)*ones(1,Np))).*Zc_2];

XXo_2 = Xo_2 - mean(Xo_2')'*ones(1,Np);

distance_x = norm(Xgrid_2(1,:))/norm(XXo_2(1,:));
distance_y = norm(Xgrid_2(2,:))/norm(XXo_2(2,:));


distance = sum(sum(XXo_2(1:2,:).*Xgrid_2(1:2,:)))/sum(sum(XXo_2(1:2,:).^2));

alpha = abs(distance_x - distance_y)/distance;

if (alpha>0.1)&~two_focal,
   disp('Should use two focals in x and y...');
end;

% Deduce the translation vector:

Tc_2 = distance * H_2;





return;

   V_hori_pix/V_hori_pix(3)
   V_vert_pix/V_vert_pix(3)
   V_diag1_pix/V_diag1_pix(3)
   V_diag2_pix/V_diag2_pix(3)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一级视频| 久久久亚洲国产美女国产盗摄 | 樱桃国产成人精品视频| 久久精工是国产品牌吗| 91浏览器打开| 久久精品在线观看| 日韩精品国产精品| 色综合中文字幕| 国产日韩精品一区二区三区在线| 天堂精品中文字幕在线| 91麻豆精品一区二区三区| 久久综合国产精品| 美日韩一级片在线观看| 欧美日韩一区二区三区在线| 国产精品毛片无遮挡高清| 韩国欧美国产1区| 欧美高清视频在线高清观看mv色露露十八 | 2021久久国产精品不只是精品| 亚洲午夜一二三区视频| 丰满少妇在线播放bd日韩电影| 欧美一区二区三区在线观看视频| 亚洲精品乱码久久久久久久久 | 亚洲国产精品欧美一二99| 成人妖精视频yjsp地址| 精品日韩欧美一区二区| 日本中文字幕不卡| 欧美日韩一区不卡| 午夜精品成人在线| 在线精品视频一区二区三四| 亚洲人成电影网站色mp4| 国产一区二区三区电影在线观看| 日韩欧美123| 奇米色一区二区| 日韩精品一区二区三区老鸭窝| 亚洲图片欧美综合| 91黄色小视频| 亚洲一级二级在线| 欧美性大战久久久久久久| 亚洲一区二区在线免费看| 色综合久久天天| 悠悠色在线精品| 欧美顶级少妇做爰| 久久精品国产亚洲aⅴ| 日韩一区二区免费在线电影| 蜜臀av一区二区在线免费观看 | 九九**精品视频免费播放| 日韩欧美国产精品一区| 国产在线精品一区在线观看麻豆| 久久久91精品国产一区二区三区| 国产白丝精品91爽爽久久 | 日韩成人一区二区| 欧美变态口味重另类| 国产丶欧美丶日本不卡视频| 久久精品夜色噜噜亚洲a∨| 国产98色在线|日韩| 亚洲欧洲av色图| 欧美性色黄大片手机版| 蜜臀av性久久久久蜜臀aⅴ| 亚洲精品在线免费观看视频| 不卡的电影网站| 一区二区三区高清| 日韩免费在线观看| 国产成人免费视| 一区二区三区蜜桃网| 91精品国产免费久久综合| 国产米奇在线777精品观看| 亚洲人成亚洲人成在线观看图片| 欧美日韩免费高清一区色橹橹 | 欧美国产精品一区| 欧美性猛交xxxx黑人交| 久草这里只有精品视频| 国产精品久久久久一区二区三区 | 欧美午夜精品免费| 激情国产一区二区| 亚洲视频一二三区| 日韩一区二区在线观看视频播放| 处破女av一区二区| 三级欧美韩日大片在线看| 国产情人综合久久777777| 在线一区二区三区四区五区| 狠狠色2019综合网| 亚洲国产精品一区二区久久恐怖片| 久久综合久久综合九色| 欧美三级视频在线| 粉嫩在线一区二区三区视频| 视频一区二区三区在线| 国产精品美女一区二区三区| 欧美一级高清片在线观看| 91麻豆6部合集magnet| 国产精品综合在线视频| 五月综合激情日本mⅴ| 亚洲欧洲一区二区在线播放| 欧美sm美女调教| 欧美狂野另类xxxxoooo| 97久久超碰国产精品电影| 国产一区二区免费视频| 亚洲成人精品在线观看| 亚洲欧洲色图综合| 久久精品亚洲精品国产欧美kt∨ | 日本中文字幕一区二区有限公司| 亚洲免费在线视频一区 二区| 欧美精品一区二区三区视频| 欧美精品久久天天躁| 91久久久免费一区二区| av在线一区二区三区| 国产麻豆成人传媒免费观看| 麻豆传媒一区二区三区| 天堂va蜜桃一区二区三区漫画版| 亚洲精品福利视频网站| 亚洲人一二三区| 中文字幕一区二区三区不卡在线 | av在线不卡电影| 成人性视频免费网站| 久久国产精品露脸对白| 日韩成人av影视| 天堂av在线一区| 视频一区欧美日韩| 日本不卡视频在线观看| 麻豆国产91在线播放| 日韩电影免费在线| 久久精品72免费观看| 狠狠久久亚洲欧美| 国产精品白丝jk黑袜喷水| 国产在线精品一区二区三区不卡 | 久久嫩草精品久久久久| 国产清纯白嫩初高生在线观看91 | 国产91丝袜在线播放0| 粉嫩av亚洲一区二区图片| 成人网在线免费视频| 不卡的av电影在线观看| 色悠悠久久综合| 欧美综合天天夜夜久久| 欧美精品一级二级三级| 日韩一区二区在线观看| 久久综合色8888| 欧美极品美女视频| 亚洲天堂免费看| 亚洲成av人片www| 男男gaygay亚洲| 国产成人精品免费看| 99久久精品费精品国产一区二区| 91精品办公室少妇高潮对白| 91麻豆精品国产91久久久资源速度 | 波多野结衣中文一区| 91美女片黄在线| 69堂精品视频| 国产三级三级三级精品8ⅰ区| 亚洲欧美日韩电影| 青青青伊人色综合久久| 国产白丝网站精品污在线入口| 91在线视频观看| 91.麻豆视频| 国产精品无人区| 亚洲成av人影院| 国产成人av一区二区| 在线观看亚洲精品视频| 日韩欧美一级在线播放| 综合久久久久久久| 人人爽香蕉精品| 91香蕉视频黄| 日韩美一区二区三区| 亚洲伦理在线精品| 韩国v欧美v日本v亚洲v| 欧美亚州韩日在线看免费版国语版| 久久综合狠狠综合久久综合88| 亚洲一区二区3| 黑人巨大精品欧美黑白配亚洲| 色美美综合视频| 国产视频在线观看一区二区三区| 伊人开心综合网| 国产成人午夜精品5599| 欧美精品乱码久久久久久按摩| 国产精品免费视频一区| 蓝色福利精品导航| 欧美视频在线一区二区三区| 国产蜜臀97一区二区三区| 麻豆成人91精品二区三区| 在线观看亚洲精品视频| 亚洲国产精品t66y| 狠狠色综合播放一区二区| 精品视频123区在线观看| 中文字幕一区二区三区乱码在线| 久久99久久99| 欧美精品一二三四| 夜色激情一区二区| 成人白浆超碰人人人人| 久久综合久久鬼色中文字| 日韩国产成人精品| 欧美性videosxxxxx| 国产精品国产精品国产专区不蜜| 国产经典欧美精品| 久久香蕉国产线看观看99| 久久精品国内一区二区三区| 91精品欧美久久久久久动漫| 日韩国产一二三区| 欧美丰满少妇xxxxx高潮对白| 亚洲第一久久影院| 欧美久久久影院| 美女一区二区久久| 日韩一级黄色大片|