Changeset 1173 for trunk/src/geometry_calib.m
- Timestamp:
- Feb 25, 2025, 5:52:46 PM (2 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/geometry_calib.m
r1165 r1173 726 726 727 727 %------------------------------------------------------------------------ 728 function GeometryCalib=calib_3D_extrinsic(Coord,est_dist, Intrinsic)728 function [GeometryCalib,errormsg]=calib_3D_extrinsic(Coord,est_dist, Intrinsic) 729 729 %------------------------------------------------------------------ 730 errormsg=''; 730 731 path_uvmat=which('geometry_calib');% check the path detected for source file uvmat 731 732 path_UVMAT=fileparts(path_uvmat); %path to UVMAT … … 740 741 ny=str2double(get(hhuvmat.num_Npy,'String')); 741 742 x_1(2,:)=ny-x_1(2,:);%reverse the y image coordinates 742 n_ima=1;743 %n_ima=1; 743 744 GeometryCalib.CalibrationType='3D_extrinsic'; 744 745 fx=Intrinsic.fx; … … 747 748 Cy=Intrinsic.Cy; 748 749 kc=Intrinsic.kc; 749 errormsg='';750 750 if isempty(fx) 751 751 errormsg='focal length fx needs to be introduced'; … … 759 759 if ~isempty(errormsg) 760 760 GeometryCalib=[]; 761 msgbox_uvmat('ERROR',errormsg)762 return761 msgbox_uvmat('ERROR',errormsg) 762 return 763 763 end 764 764 GeometryCalib.fx_fy(1)=fx; … … 896 896 %------------------------------------------------------------------------ 897 897 choice=get(handles.CheckEnableMouse,'Value'); 898 if choice 898 if choice% if button selected 899 set(handles.CheckEnableMouse,'BackgroundColor',[1 1 0]) 899 900 huvmat=findobj(allchild(0),'tag','uvmat'); 900 901 if ishandle(huvmat) … … 907 908 set(hhuvmat.MenuRuler,'checked','off')%desactivate ruler 908 909 end 910 if ~isequal(get(hhuvmat.TransformName,'Value'),1) %active if transform function is activated to return to the raw image 911 set(hhuvmat.TransformName,'Value',1) 912 uvmat('TransformName_Callback',hObject,eventdata,hhuvmat); %file input with xml reading in uvmat 913 set(hhuvmat.CheckFixLimits,'Value',0)% put FixedLimits option to 'off' (to sse the whole field) 914 PLOT_Callback(hObject, eventdata, handles) 915 end 916 else 917 set(handles.CheckEnableMouse,'BackgroundColor',[0.7 0.7 0.7]) 909 918 end 910 919 … … 1298 1307 Heading=s.Heading; 1299 1308 end 1309 checkcoord=false; 1300 1310 if isfield (s,'GeometryCalib') 1301 GeometryCalib=s.GeometryCalib; 1302 fx=1;fy=1;Cx=0;Cy=0;kc=0; %default 1303 CoordCell={}; 1304 Tabchar={};%default 1305 val_cal=1;%default 1306 if ~isempty(GeometryCalib) 1307 % choose the calibration option 1308 if isfield(GeometryCalib,'CalibrationType') 1309 calib_list=get(handles.calib_type,'String'); 1310 for ilist=1:numel(calib_list) 1311 if strcmp(calib_list{ilist},GeometryCalib.CalibrationType) 1312 val_cal=ilist; 1313 break 1311 GeometryCalib=s.GeometryCalib; 1312 %fx=1;fy=1;Cx=0;Cy=0;kc=0; %default 1313 %CoordCell={}; 1314 %Tabchar={};%default 1315 val_cal=1;%default 1316 if ~isempty(GeometryCalib) 1317 % choose the calibration option 1318 if isfield(GeometryCalib,'CalibrationType') 1319 calib_list=get(handles.calib_type,'String'); 1320 for ilist=1:numel(calib_list) 1321 if strcmp(calib_list{ilist},GeometryCalib.CalibrationType) 1322 val_cal=ilist; 1323 break 1324 end 1314 1325 end 1315 1326 end 1316 end 1317 display_intrinsic(GeometryCalib,handles)%intrinsic param 1318 %extrinsic param 1319 if isfield(GeometryCalib,'Tx_Ty_Tz') 1320 Tx_Ty_Tz=GeometryCalib.Tx_Ty_Tz; 1321 set(handles.Tx,'String',num2str(GeometryCalib.Tx_Ty_Tz(1),4)) 1322 set(handles.Ty,'String',num2str(GeometryCalib.Tx_Ty_Tz(2),4)) 1323 set(handles.Tz,'String',num2str(GeometryCalib.Tx_Ty_Tz(3),4)) 1324 end 1325 if isfield(GeometryCalib,'omc') 1326 set(handles.Phi,'String',num2str(GeometryCalib.omc(1),4)) 1327 set(handles.Theta,'String',num2str(GeometryCalib.omc(2),4)) 1328 set(handles.Psi,'String',num2str(GeometryCalib.omc(3),4)) 1329 end 1330 if isfield(GeometryCalib,'SourceCalib')&& isfield(GeometryCalib.SourceCalib,'PointCoord') 1331 calib=GeometryCalib.SourceCalib.PointCoord; 1332 Coord=[calib zeros(size(calib,1),1)]; 1333 set(handles.ListCoord,'Data',Coord) 1334 end 1335 PLOT_Callback(handles.geometry_calib, [], handles) 1336 set(handles.APPLY,'BackgroundColor',[1 0 1]) 1337 end 1338 set(handles.calib_type,'Value',val_cal) 1339 1340 if isempty(CoordCell)% allow mouse action by default in the absence of input points 1327 display_intrinsic(GeometryCalib,handles)%intrinsic param 1328 %extrinsic param 1329 if isfield(GeometryCalib,'Tx_Ty_Tz') 1330 %Tx_Ty_Tz=GeometryCalib.Tx_Ty_Tz; 1331 set(handles.Tx,'String',num2str(GeometryCalib.Tx_Ty_Tz(1),4)) 1332 set(handles.Ty,'String',num2str(GeometryCalib.Tx_Ty_Tz(2),4)) 1333 set(handles.Tz,'String',num2str(GeometryCalib.Tx_Ty_Tz(3),4)) 1334 end 1335 if isfield(GeometryCalib,'omc') 1336 set(handles.Phi,'String',num2str(GeometryCalib.omc(1),4)) 1337 set(handles.Theta,'String',num2str(GeometryCalib.omc(2),4)) 1338 set(handles.Psi,'String',num2str(GeometryCalib.omc(3),4)) 1339 end 1340 if isfield(GeometryCalib,'SourceCalib')&& isfield(GeometryCalib.SourceCalib,'PointCoord') 1341 calib=GeometryCalib.SourceCalib.PointCoord; 1342 Coord=[calib zeros(size(calib,1),1)]; 1343 set(handles.ListCoord,'Data',Coord) 1344 checkcoord=true; 1345 end 1346 PLOT_Callback(handles.geometry_calib, [], handles) 1347 set(handles.APPLY,'BackgroundColor',[1 0 1]) 1348 end 1349 set(handles.calib_type,'Value',val_cal) 1350 end 1351 if checkcoord % does not allow mouse action by default in the presence of input points 1352 set(handles.CheckEnableMouse,'Value',0) 1353 set(handles.CheckEnableMouse,'BackgroundColor',[0.7 0.7 0.7]) 1354 else % allow mouse action by default in the absence of input points 1341 1355 set(handles.CheckEnableMouse,'Value',1) 1342 1356 set(handles.CheckEnableMouse,'BackgroundColor',[1 1 0]) 1343 else % does not allow mouse action by default in the presence of input points 1344 set(handles.CheckEnableMouse,'Value',0) 1345 set(handles.CheckEnableMouse,'BackgroundColor',[0.7 0.7 0.7]) 1346 end 1347 end 1357 end 1358 1348 1359 %------------------------------------------------------------------------ 1349 1360 %---display calibration intrinsic parameters … … 1456 1467 Coord=get(handles.ListCoord,'Data'); 1457 1468 iline=eventdata.Indices(1);% selected line number 1458 if size(Coord,1)<iline+numel(Input)1469 if numel(Input)>1 && size(Coord,1)<iline+numel(Input) 1459 1470 Coord=[Coord ; zeros(iline+numel(Input)-size(Coord,1),6)];% append zeros to fit the new column 1460 1471 end
Note: See TracChangeset
for help on using the changeset viewer.