- Timestamp:
- Dec 19, 2011, 5:00:54 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/geometry_calib.m
r332 r341 99 99 %set menu of calibration options 100 100 set(handles.calib_type,'String',{'rescale';'linear';'3D_linear';'3D_quadr';'3D_extrinsic'}) 101 inputxml='';101 % inputxml=''; 102 102 if exist('inputfile','var')&& ~isempty(inputfile) 103 103 struct.XmlInputFile=inputfile; 104 [Pathsub,RootFile,field_count,str2,str_a,str_b,ext]=name2display(inputfile); 105 if ~strcmp(ext,'.xml') 106 inputfile=[fullfile(Pathsub,RootFile) '.xml'];%xml file corresponding to the input file 104 % [Pathsub,RootFile,field_count,str2,str_a,str_b,ext]=name2display(inputfile); 105 [RootPath,~,RootFile,~,~,~,~,FileExt]=fileparts_uvmat(inputfile); 106 if ~strcmp(FileExt,'.xml') 107 inputfile=[fullfile(RootPath,RootFile) '.xml'];%xml file corresponding to the input file 107 108 end 108 109 set(handles.ListCoord,'String',{'......'}) … … 134 135 if ~isempty(huvmat) 135 136 handles=guidata(huvmat); 136 % set(handles.MenuMask,'enable','on')137 % set(handles.MenuGrid,'enable','on')138 % set(handles.MenuObject,'enable','on')139 % set(handles.MenuEdit,'enable','on')140 % set(handles.edit,'enable','on')141 137 hobject=findobj(handles.axes3,'tag','calib_points'); 142 138 if ~isempty(hobject) … … 179 175 GeometryCalib.ErrorRms(2)=sqrt(mean((Ypoints-y_ima).*(Ypoints-y_ima))); 180 176 [GeometryCalib.ErrorMax(2),index(2)]=max(abs(Ypoints-y_ima)); 181 [ EM,ind_dim]=max(GeometryCalib.ErrorMax);177 [~,ind_dim]=max(GeometryCalib.ErrorMax); 182 178 index=index(ind_dim); 183 179 %set the Z position of the reference plane used for calibration … … 222 218 hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat 223 219 RootPath=''; 224 RootFile='';220 % RootFile=''; 225 221 if ~isempty(hhuvmat.RootPath)&& ~isempty(hhuvmat.RootFile) 226 testhandle=1;222 % testhandle=1; 227 223 RootPath=get(hhuvmat.RootPath,'String'); 228 224 RootFile=get(hhuvmat.RootFile,'String'); … … 321 317 [Xpoints,Ypoints]=px_XYZ(GeometryCalib,X,Y,Z); 322 318 GeometryCalib.ErrorRms(1)=sqrt(mean((Xpoints-x_ima).*(Xpoints-x_ima))); 323 [GeometryCalib.ErrorMax(1) ,index(1)]=max(abs(Xpoints-x_ima));319 [GeometryCalib.ErrorMax(1)]=max(abs(Xpoints-x_ima)); 324 320 GeometryCalib.ErrorRms(2)=sqrt(mean((Ypoints-y_ima).*(Ypoints-y_ima))); 325 [GeometryCalib.ErrorMax(2),index(2)]=max(abs(Ypoints-y_ima)); 326 [EM,ind_dim]=max(GeometryCalib.ErrorMax); 327 % index=index(ind_dim); 321 [GeometryCalib.ErrorMax(2)]=max(abs(Ypoints-y_ima)); 322 % [EM,ind_dim]=max(GeometryCalib.ErrorMax); 328 323 %set the Z position of the reference plane used for calibration 329 324 Z_plane=[]; … … 360 355 end 361 356 CalibData=get(handles.geometry_calib,'UserData');%read the calibration image source on the interface userdata 362 InputFile='';357 % InputFile=''; 363 358 if isfield(CalibData,'XmlInputFile') 364 359 InputDir=fileparts(CalibData.XmlInputFile); … … 388 383 389 384 dataview(answer,SubCampaignTest,GeometryCalib); 390 391 % if isfield(Heading,'Device') && isequal([filename ext],Heading.Device)392 % [XmlInput,filename,ext]=fileparts(XmlInput);393 % Device=Heading.Device;394 % end395 % if isfield(Heading,'Experiment') && isequal([filename ext],Heading.Experiment)396 % [PP,filename,ext]=fileparts(XmlInput);397 % end398 % testinput=0;399 % if isfield(Heading,'SubCampaign') && isequal([filename ext],Heading.SubCampaign)400 % SubCampaignTest='y';401 % testinput=1;402 % elseif isfield(Heading,'Campaign') && isequal([filename ext],Heading.Campaign)403 % testinput=1;404 % % end405 % end406 % if ~testinput407 % filename='PROJETS';%default408 % if isfield(CalibData,'XmlInputFile')409 % [pp,filename]=fileparts(CalibData.XmlInputFile);410 % end411 % while ~isequal(filename,'PROJETS') && numel(filename)>1412 % filename_1=filename;413 % pp_1=pp;414 % [pp,filename]=fileparts(pp);415 % end416 % XmlInput=fullfile(pp_1,filename_1);417 % testinput=1;418 % end419 % if testinput420 % outcome=dataview(XmlInput,SubCampaignTest,GeometryCalib);421 % end422 385 423 386 %------------------------------------------------------------------------ … … 429 392 x_ima=Coord(:,4); 430 393 y_ima=Coord(:,5); 431 [px ,sx]=polyfit(X,x_ima,1);432 [py ,sy]=polyfit(Y,y_ima,1);433 T_x=px(2);434 T_y=py(2);394 [px]=polyfit(X,x_ima,1); 395 [py]=polyfit(Y,y_ima,1); 396 % T_x=px(2); 397 % T_y=py(2); 435 398 GeometryCalib.CalibrationType='rescale'; 436 399 GeometryCalib.fx_fy=[px(1) py(1)];%.fx_fy corresponds to pxcm along x and y 437 400 GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function 438 401 GeometryCalib.Tx_Ty_Tz=[px(2)/px(1) py(2)/py(1) 1]; 439 %GeometryCalib.R=[1,0,0;0,1,0;0,0,0];440 402 GeometryCalib.omc=[0 0 0]; 441 403 … … 452 414 XY_mat=[ones(size(X)) X Y]; 453 415 a_X1=XY_mat\x_ima; %transformation matrix for X 454 % x1=XY_mat*a_X1;%reconstruction455 % err_X1=max(abs(x1-x_ima));%error456 416 a_Y1=XY_mat\y_ima;%transformation matrix for X 457 % y1=XY_mat*a_Y1;458 % err_Y1=max(abs(y1-y_ima));%error459 % R=[a_X1(2),a_X1(3),0;a_Y1(2),a_Y1(3),0;0,0,1];460 417 R=[a_X1(2),a_X1(3);a_Y1(2),a_Y1(3)]; 461 418 epsilon=sign(det(R)); … … 469 426 GeometryCalib.fx_fy(2)=(a_Y1(3)/a_X1(2))*GeometryCalib.fx_fy(1); 470 427 GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function 471 %GeometryCalib.Tx_Ty_Tz=[a_X1(1) a_Y1(1) 1];472 428 GeometryCalib.Tx_Ty_Tz=[a_X1(1)/GeometryCalib.fx_fy(1) a_Y1(1)/GeometryCalib.fx_fy(2) 1]; 473 429 R(1,:)=R(1,:)/GeometryCalib.fx_fy(1); … … 740 696 741 697 742 %--------------------------------------------------------------------------743 function GeometryCalib=calib_tsai(Coord,handles)% OBSOLETE: old version using gauthier's bianry ccal_fo744 % NOT USED745 %------------------------------------------------------------------------746 %TSAI747 path_uvmat=which('uvmat');% check the path detected for source file uvmat748 path_UVMAT=fileparts(path_uvmat); %path to UVMAT749 xmlfile=fullfile(path_UVMAT,'PARAM.xml');%name of the file containing names of binary executables750 if exist(xmlfile,'file')751 t=xmltree(xmlfile);% read the (xml) file containing names of binary executables752 sparam=convert(t);% convert to matlab structure753 end754 if ~isfield(sparam,'GeometryCalibBin')755 msgbox_uvmat('ERROR',['calibration program <GeometryCalibBin> undefined in parameter file ' xmlfile])756 return757 end758 Tsai_exe=sparam.GeometryCalibBin;759 if ~exist(Tsai_exe,'file')%the binary is defined in /bin, default setting760 Tsai_exe=fullfile(path_UVMAT,Tsai_exe);761 end762 if ~exist(Tsai_exe,'file')763 msgbox_uvmat('ERROR',['calibration program ' sparam.GeometryCalibBin ' defined in PARAM.xml does not exist'])764 return765 end766 767 textcoord=num2str(Coord,4);768 dlmwrite('t.txt',textcoord,'');769 % ['!' Tsai_exe ' -fx 0 -fy t.txt']770 eval(['!' Tsai_exe ' -f t.txt > tsaicalib.log']);771 if ~exist('calib.dat','file')772 msgbox_uvmat('ERROR','no output from calibration program Tsai_exe: possibly too few points')773 end774 calibdat=dlmread('calib.dat');775 delete('calib.dat')776 %delete('t.txt')777 GeometryCalib.CalibrationType='tsai';778 GeometryCalib.focal=calibdat(10);779 GeometryCalib.dpx_dpy=[calibdat(5) calibdat(6)];780 GeometryCalib.Cx_Cy=[calibdat(7) calibdat(8)];781 GeometryCalib.sx=calibdat(9);782 GeometryCalib.kappa1=calibdat(11);783 GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function784 GeometryCalib.Tx_Ty_Tz=[calibdat(12) calibdat(13) calibdat(14)];785 Rx_Ry_Rz=calibdat(15:17);786 sa = sin(Rx_Ry_Rz(1)) ;787 ca=cos(Rx_Ry_Rz(1));788 sb=sin(Rx_Ry_Rz(2));789 cb =cos(Rx_Ry_Rz(2));790 sg =sin(Rx_Ry_Rz(3));791 cg =cos(Rx_Ry_Rz(3));792 r1 = cb * cg;793 r2 = cg * sa * sb - ca * sg;794 r3 = sa * sg + ca * cg * sb;795 r4 = cb * sg;796 r5 = sa * sb * sg + ca * cg;797 r6 = ca * sb * sg - cg * sa;798 r7 = -sb;799 r8 = cb * sa;800 r9 = ca * cb;801 %EN DEDUIRE MATRICE R ??802 GeometryCalib.R=[r1,r2,r3;r4,r5,r6;r7,r8,r9];803 804 698 %------------------------------------------------------------------------ 805 699 % --- determine the rms of calibration error … … 855 749 % RootFile=''; 856 750 if ~isempty(hhuvmat.RootPath)&& ~isempty(hhuvmat.RootFile) 857 testhandle=1;751 % testhandle=1; 858 752 RootPath=get(hhuvmat.RootPath,'String'); 859 753 RootFile=get(hhuvmat.RootFile,'String'); -
trunk/src/series.m
r339 r341 480 480 set(handles.waitbar_frame,'Units','pixels') 481 481 pos=get(handles.waitbar_frame,'Position'); 482 xima=0.5:pos(3)-0.5; 482 xima=0.5:pos(3)-0.5;% pixel positions on the image representing the existing file indices 483 483 yima=0.5:pos(4)-0.5; 484 484 [XIma,YIma]=meshgrid(xima,yima); … … 491 491 file_ima=double((i1_series(:,:,1)>0)'); 492 492 if size(file_ima,1)==1 493 file_ima=ones(pos(4),1)*file_ima; 494 end 495 CData(:,:,2)=interp2(Ind_i,Ind_j,file_ima,XIma,YIma,'nearest'); 493 CLine=interp1(ind_i,file_ima,xima,'nearest'); 494 CData(:,:,2)=ones(size(yima'))*CLine; 495 % file_ima=ones(pos(4),1)*file_ima; 496 % Ind_i= 497 else 498 CData(:,:,2)=interp2(Ind_i,Ind_j,file_ima,XIma,YIma,'nearest'); 499 end 496 500 set(handles.waitbar_frame,'CData',CData) 497 501 set(handles.waitbar_frame,'Units','normalized') … … 1489 1493 % set(handles.waitbar,'Position',waitbarpos) 1490 1494 1491 1495 if isfield(Series.IndexRange,'NbSlice') 1492 1496 Series.NbSlice=Series.IndexRange.NbSlice; 1497 end 1493 1498 if last_i < first_i | last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... 1494 1499 set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; -
trunk/src/set_object.m
r309 r341 673 673 ListObject=get(hhuvmat.ListObject,'String');%position in the objet list 674 674 IndexObj=get(hhuvmat.ListObject,'Value') 675 % name of the object 675 676 %% read the object on the GUI set_object 676 677 ObjectName=get(handles.TITLE,'String');%name of the current object defiend in set_object 677 678 ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object -
trunk/src/uvmat.m
r339 r341 555 555 fileinput=read_file_boxes(handles); 556 556 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 557 [ i1_series,i2_series,j1_series,j2_series,~,FileType,MovieObject]=find_file_series(fileinput);557 [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,~,FileType,MovieObject]=find_file_series(fileinput); 558 558 % initiate the input file series and refresh the current field view: 559 559 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject); … … 1040 1040 1041 1041 %[path,name,ext]=fileparts(fileinput_1); 1042 [ RootPath_1,SubDir_1,RootFile_1,i1,i2,j1,j2,FileExt_1]=fileparts_uvmat(fileinput_1);1043 [ i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput_1);1042 [~,SubDir_1,~,i1,i2,j1,j2,FileExt_1]=fileparts_uvmat(fileinput_1); 1043 [RootPath_1,RootFile_1,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput_1); 1044 1044 % [RootPath_1,RootFile_1,field_count,str2,str_a,str_b,FileExt_1,NomType_1,SubDir_1]=name2display(fileinput_1); 1045 1045 switch FileType
Note: See TracChangeset
for help on using the changeset viewer.