Changeset 724 for trunk/src/geometry_calib.m
- Timestamp:
- Feb 27, 2014, 8:57:02 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/geometry_calib.m
r699 r724 283 283 %------------------------------------------------------------------------ 284 284 %% read the current calibration points 285 index=[]; 285 286 Coord=get(handles.ListCoord,'Data'); 286 287 Coord(:,6)=[]; 287 288 % apply the calibration, whose type is selected in handles.calib_type 289 GeometryCalib=[]; 288 290 if ~isempty(Coord) 289 291 calib_cell=get(handles.calib_type,'String'); … … 292 294 else 293 295 msgbox_uvmat('ERROR','No calibration points, abort') 296 end 297 if isempty(GeometryCalib) 294 298 return 295 end 299 end 296 300 Z_plane=[]; 297 301 if ~isempty(Coord) … … 542 546 center_optim=0; 543 547 run(fullfile(path_UVMAT,'toolbox_calib','go_calib_optim'));% apply fct 'toolbox_calib/go_calib_optim' 544 GeometryCalib.CalibrationType='3D_linear'; 545 GeometryCalib.fx_fy=fc'; 546 GeometryCalib.Cx_Cy=cc'; 547 GeometryCalib.kc=kc(1); 548 GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function 549 GeometryCalib.Tx_Ty_Tz=Tc_1'; 550 GeometryCalib.R=Rc_1; 551 GeometryCalib.R(2,1:3)=-GeometryCalib.R(2,1:3);%inversion of the y image coordinate 552 GeometryCalib.Tx_Ty_Tz(2)=-GeometryCalib.Tx_Ty_Tz(2);%inversion of the y image coordinate 553 GeometryCalib.Cx_Cy(2)=ny-GeometryCalib.Cx_Cy(2);%inversion of the y image coordinate 554 GeometryCalib.omc=(180/pi)*omc_1;%angles in degrees 555 GeometryCalib.ErrorRMS=[]; 556 GeometryCalib.ErrorMax=[]; 548 if exist('Rc_1','var') 549 GeometryCalib.CalibrationType='3D_linear'; 550 GeometryCalib.fx_fy=fc'; 551 GeometryCalib.Cx_Cy=cc'; 552 GeometryCalib.kc=kc(1); 553 GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function 554 GeometryCalib.Tx_Ty_Tz=Tc_1'; 555 GeometryCalib.R=Rc_1; 556 GeometryCalib.R(2,1:3)=-GeometryCalib.R(2,1:3);%inversion of the y image coordinate 557 GeometryCalib.Tx_Ty_Tz(2)=-GeometryCalib.Tx_Ty_Tz(2);%inversion of the y image coordinate 558 GeometryCalib.Cx_Cy(2)=ny-GeometryCalib.Cx_Cy(2);%inversion of the y image coordinate 559 GeometryCalib.omc=(180/pi)*omc_1;%angles in degrees 560 GeometryCalib.ErrorRMS=[]; 561 GeometryCalib.ErrorMax=[]; 562 else 563 msgbox_uvmat('ERROR',['calibration function ' fullfile('toolbox_calib','go_calib_optim') ' did not converge: use multiple views or option 3D_extrinsic']) 564 GeometryCalib=[]; 565 end 557 566 558 567 %------------------------------------------------------------------------ … … 609 618 run(fullfile(path_UVMAT,'toolbox_calib','go_calib_optim'));% apply fct 'toolbox_calib/go_calib_optim' 610 619 611 GeometryCalib.CalibrationType='3D_quadr'; 612 GeometryCalib.fx_fy=fc';613 GeometryCalib.Cx_Cy=cc';614 GeometryCalib.kc=kc(1);615 GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function 616 GeometryCalib.Tx_Ty_Tz=Tc_1'; 617 if ~exist('Rc_1','var') 618 msgbox_uvmat('ERROR',['calibration function ' fullfile('toolbox_calib','go_calib_optim') ' did not converge: use multiple views or option 3D_extrinsic'])619 return620 end 621 GeometryCalib.R=Rc_1; 622 GeometryCalib.R(2,1:3)=-GeometryCalib.R(2,1:3);%inversion of the y image coordinate 623 GeometryCalib.Tx_Ty_Tz(2)=-GeometryCalib.Tx_Ty_Tz(2);%inversion of the y image coordinate 624 GeometryCalib.Cx_Cy(2)=ny-GeometryCalib.Cx_Cy(2);%inversion of the y image coordinate 625 GeometryCalib.omc=(180/pi)*omc_1;%angles in degrees 626 GeometryCalib.ErrorRMS=[]; 627 GeometryCalib.ErrorMax=[];628 620 if exist('Rc_1','var') 621 GeometryCalib.CalibrationType='3D_quadr'; 622 GeometryCalib.fx_fy=fc'; 623 GeometryCalib.Cx_Cy=cc'; 624 GeometryCalib.kc=kc(1); 625 GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function 626 GeometryCalib.Tx_Ty_Tz=Tc_1'; 627 GeometryCalib.R=Rc_1; 628 GeometryCalib.R(2,1:3)=-GeometryCalib.R(2,1:3);%inversion of the y image coordinate 629 GeometryCalib.Tx_Ty_Tz(2)=-GeometryCalib.Tx_Ty_Tz(2);%inversion of the y image coordinate 630 GeometryCalib.Cx_Cy(2)=ny-GeometryCalib.Cx_Cy(2);%inversion of the y image coordinate 631 GeometryCalib.omc=(180/pi)*omc_1;%angles in degrees 632 GeometryCalib.ErrorRMS=[]; 633 GeometryCalib.ErrorMax=[]; 634 else 635 msgbox_uvmat('ERROR',['calibration function ' fullfile('toolbox_calib','go_calib_optim') ' did not converge: use multiple views or option 3D_extrinsic']) 636 GeometryCalib=[]; 637 end 629 638 630 639 %------------------------------------------------------------------------ … … 633 642 path_uvmat=which('geometry_calib');% check the path detected for source file uvmat 634 643 path_UVMAT=fileparts(path_uvmat); %path to UVMAT 635 x_1=double(Coord(:,4:5)');%image coordi antes644 x_1=double(Coord(:,4:5)');%image coordinates 636 645 X_1=double(Coord(:,1:3)');% phys coordinates 637 646 huvmat=findobj(allchild(0),'Tag','uvmat'); … … 641 650 n_ima=1; 642 651 GeometryCalib.CalibrationType='3D_extrinsic'; 652 fx=str2num(get(handles.fx,'String')); 653 fy=str2num(get(handles.fy,'String')); 654 Cx=str2num(get(handles.Cx,'String')); 655 Cy=str2num(get(handles.Cy,'String')); 656 errormsg=''; 657 if isempty(fx) 658 errormsg='focal length fx needs to be introduced'; 659 elseif isempty(fy) 660 errormsg='focal length fy needs to be introduced'; 661 elseif isempty(Cx) 662 errormsg='shift Cx to image centre needs to be introduced'; 663 elseif isempty(Cy) 664 errormsg='shift Cy to image centre needs to be introduced'; 665 end 666 if ~isempty(errormsg) 667 GeometryCalib=[]; 668 msgbox_uvmat('ERROR',errormsg) 669 return 670 end 643 671 GeometryCalib.fx_fy(1)=str2num(get(handles.fx,'String')); 644 672 GeometryCalib.fx_fy(2)=str2num(get(handles.fy,'String')); … … 660 688 GeometryCalib.Cx_Cy(2)=ny-GeometryCalib.Cx_Cy(2);%inversion of the y image coordinate 661 689 GeometryCalib.omc=(180/pi)*omc'; 662 %GeometryCalib.R(3,1:3)=-GeometryCalib.R(3,1:3);%inversion for z upward663 664 665 690 666 691 %------------------------------------------------------------------------ … … 1161 1186 set(handles.Psi,'String',num2str(GeometryCalib.omc(3),4)) 1162 1187 end 1163 if isfield(GeometryCalib,'SourceCalib') 1188 if isfield(GeometryCalib,'SourceCalib')&& isfield(GeometryCalib.SourceCalib,'PointCoord') 1164 1189 calib=GeometryCalib.SourceCalib.PointCoord; 1165 1190 Coord=[calib zeros(size(calib,1),1)];
Note: See TracChangeset
for help on using the changeset viewer.