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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? distor2calib.m

?? 這是一個(gè)很好的標(biāo)定工具箱
?? M
字號(hào):
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)

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产不卡一区视频| 99这里只有久久精品视频| 国产精品乱人伦中文| 欧美日韩电影在线| 国产传媒日韩欧美成人| 婷婷一区二区三区| 中文字幕字幕中文在线中不卡视频| 91麻豆精品91久久久久同性| 972aa.com艺术欧美| 国产九色精品成人porny| 污片在线观看一区二区| 亚洲黄色免费网站| 国产欧美日韩精品一区| 欧美成人精品福利| 欧美精品1区2区3区| av电影在线不卡| 国产精品亚洲专一区二区三区| 五月天婷婷综合| 伊人一区二区三区| 亚洲色图欧美在线| 欧美激情在线一区二区| 26uuu精品一区二区三区四区在线| 欧美久久久久免费| 欧美亚洲综合色| 99久久久精品| 99久久免费视频.com| 福利一区在线观看| 国产乱理伦片在线观看夜一区| 久久机这里只有精品| 美女性感视频久久| 久久99精品网久久| 美女脱光内衣内裤视频久久网站| 五月天激情综合网| 日本亚洲三级在线| 免费视频一区二区| 免费看日韩精品| 青青草原综合久久大伊人精品优势| 夜夜嗨av一区二区三区四季av| 亚洲色大成网站www久久九九| 国产欧美日韩精品a在线观看| 久久精品日韩一区二区三区| 久久久夜色精品亚洲| 国产亚洲精品免费| 国产日产欧美一区| 国产精品国产三级国产| 成人欧美一区二区三区在线播放| 国产精品国产三级国产aⅴ无密码| 国产精品久久一卡二卡| 亚洲视频狠狠干| 亚洲黄一区二区三区| 亚洲国产精品久久艾草纯爱 | 国产精品美女www爽爽爽| 欧美激情一区二区三区不卡 | 色综合 综合色| 91豆麻精品91久久久久久| 欧美视频一二三区| 91精品午夜视频| 久久综合九色综合欧美98| 国产亚洲欧美在线| 中文字幕欧美一| 一区二区三区四区在线| 天堂一区二区在线免费观看| 久久草av在线| 成人激情图片网| 精品视频一区二区不卡| 日韩欧美一区中文| 欧美国产精品一区二区三区| 亚洲精品综合在线| 麻豆一区二区99久久久久| 高清不卡在线观看| 欧美精品日韩精品| 久久久国产午夜精品| 亚洲色欲色欲www| 男女激情视频一区| 99精品一区二区三区| 欧美亚洲动漫精品| 欧美va在线播放| 亚洲欧美在线aaa| 美女尤物国产一区| 91麻豆福利精品推荐| 欧美一卡二卡在线| 国产精品欧美一区喷水| 婷婷综合久久一区二区三区| 国产成人在线观看| 欧美另类一区二区三区| 欧美激情在线观看视频免费| 日韩中文欧美在线| 99久久国产综合精品色伊| 这里是久久伊人| 自拍视频在线观看一区二区| 六月丁香综合在线视频| a级精品国产片在线观看| 日韩欧美一级片| 一区二区免费在线播放| 国产成人a级片| 日韩欧美亚洲一区二区| 亚洲欧美偷拍卡通变态| 韩国精品免费视频| 欧美三级资源在线| 国产精品久久久久久久久免费桃花 | 精品乱人伦一区二区三区| 亚洲精品视频观看| 国产精品一区三区| 9191久久久久久久久久久| 中文字幕欧美一| 国产精品系列在线观看| 日韩一级片在线观看| 一区二区三区免费在线观看| 国产成人综合精品三级| 日韩免费在线观看| 午夜精品福利在线| 色视频欧美一区二区三区| 国产亚洲欧美日韩日本| 精品亚洲成av人在线观看| 欧美人与性动xxxx| 亚洲自拍都市欧美小说| av男人天堂一区| 国产调教视频一区| 国产伦精品一区二区三区视频青涩 | 欧美一级专区免费大片| 一区二区高清视频在线观看| 国产成a人无v码亚洲福利| 久久嫩草精品久久久精品一| 免费成人在线网站| 91精品国产乱码久久蜜臀| 亚洲无线码一区二区三区| 在线观看亚洲a| 亚洲精品欧美在线| 色婷婷av一区二区| 一区二区三区在线不卡| 99国产欧美另类久久久精品| 国产精品婷婷午夜在线观看| 成人高清在线视频| 成人欧美一区二区三区在线播放| www.亚洲精品| 亚洲久草在线视频| 日本丶国产丶欧美色综合| 一区二区在线看| 欧美午夜精品电影| 秋霞电影一区二区| 精品国产乱码久久| 国产91精品一区二区| 国产精品视频线看| 97精品国产露脸对白| 一区二区三区四区在线播放| 欧美亚洲高清一区二区三区不卡| 亚洲电影一区二区| 日韩一区二区在线看片| 久久99国产精品麻豆| 国产人久久人人人人爽| 91丨九色丨蝌蚪丨老版| 一区二区三区国产豹纹内裤在线| 在线观看国产精品网站| 日韩精品一级中文字幕精品视频免费观看 | 99久久夜色精品国产网站| 亚洲欧美国产77777| 欧美午夜宅男影院| 日本aⅴ亚洲精品中文乱码| 精品国产乱码久久久久久影片| 国产美女视频一区| 亚洲欧美另类久久久精品2019| 在线免费亚洲电影| 免费视频最近日韩| 中文字幕va一区二区三区| 欧美中文字幕一区二区三区亚洲 | 国产精品综合一区二区| 国产精品污污网站在线观看| 欧美在线啊v一区| 久久精品国产网站| 国产精品久久久久毛片软件| 欧美日韩一级视频| 国产高清久久久| 亚洲精品日产精品乱码不卡| 日韩欧美在线不卡| 99久久久国产精品免费蜜臀| 日韩电影在线一区二区三区| 国产欧美日韩另类一区| 欧美亚洲一区二区在线| 国产一区二区三区免费观看| 一区二区三区在线视频观看| 精品国产一区二区精华| 色综合欧美在线视频区| 久久成人免费电影| 亚洲免费毛片网站| 精品卡一卡二卡三卡四在线| 91香蕉视频mp4| 久久99蜜桃精品| 亚洲一区二区三区免费视频| 久久蜜桃av一区二区天堂| 色婷婷av一区二区三区之一色屋| 激情综合一区二区三区| 亚洲综合色噜噜狠狠| 久久久精品免费网站| 欧美夫妻性生活| 99久久精品免费看| 国产一区二区电影| 日本欧美一区二区三区乱码 | 国产综合色在线| 午夜日韩在线电影| 日韩一区在线免费观看|