- Timestamp:
- Nov 4, 2013, 9:34:10 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/create_grid.m
r156 r694 110 110 set(handles.z,'String',num2str(input_grid.z)); 111 111 end 112 if isfield(input_grid,'CheckWhite') 113 if input_grid.CheckWhite 114 set(handles.white,'Value',1) 115 set(handles.black,'Value',0) 116 else 117 set(handles.white,'Value',0) 118 set(handles.black,'Value',1) 119 end 120 end 112 121 end 113 122 … … 141 150 varargout{1}=[xarray yarray zarray]; 142 151 varargout{2}=T; 143 varargout{3}=get(handles.white,'Value') 152 varargout{3}=get(handles.white,'Value'); 144 153 end 145 154 -
trunk/src/geometry_calib.m
r693 r694 540 540 est_aspect_ratio=0; 541 541 est_fc=[1;1]; 542 %fc=[25;25]/0.012;543 542 center_optim=0; 544 run(fullfile(path_UVMAT,'toolbox_calib','go_calib_optim')); 543 run(fullfile(path_UVMAT,'toolbox_calib','go_calib_optim'));% apply fct 'toolbox_calib/go_calib_optim' 545 544 GeometryCalib.CalibrationType='3D_linear'; 546 545 GeometryCalib.fx_fy=fc'; 547 %GeometryCalib.focal=fc(2);548 %GeometryCalib.dpx_dpy=[1 1];549 546 GeometryCalib.Cx_Cy=cc'; 550 %GeometryCalib.sx=fc(1)/fc(2);551 547 GeometryCalib.kc=kc(1); 552 %GeometryCalib.kappa1=-kc(1)/fc(2)^2;553 548 GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function 554 549 GeometryCalib.Tx_Ty_Tz=Tc_1'; … … 611 606 est_dist=[1;0;0;0;0]; 612 607 est_aspect_ratio=1; 613 %est_fc=[0;0];614 %fc=[25;25]/0.012;615 608 center_optim=0; 616 run(fullfile(path_UVMAT,'toolbox_calib','go_calib_optim')); 609 run(fullfile(path_UVMAT,'toolbox_calib','go_calib_optim'));% apply fct 'toolbox_calib/go_calib_optim' 617 610 618 611 GeometryCalib.CalibrationType='3D_quadr'; 619 612 GeometryCalib.fx_fy=fc'; 620 %GeometryCalib.focal=fc(2);621 %GeometryCalib.dpx_dpy=[1 1];622 613 GeometryCalib.Cx_Cy=cc'; 623 %GeometryCalib.sx=fc(1)/fc(2);624 614 GeometryCalib.kc=kc(1); 625 %GeometryCalib.kappa1=-kc(1)/fc(2)^2;626 615 GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function 627 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 return 620 end 628 621 GeometryCalib.R=Rc_1; 629 622 GeometryCalib.R(2,1:3)=-GeometryCalib.R(2,1:3);%inversion of the y image coordinate … … 656 649 addpath(fct_path) 657 650 GeometryCalib.Cx_Cy(2)=ny-GeometryCalib.Cx_Cy(2);%reverse Cx_Cy(2) for calibration (inversion of px ordinate) 658 % [omc1,Tc1,Rc1,H,x,ex,JJ] = compute_extrinsic(x_1,X_1,...659 % [Calib.f Calib.f*Calib.sx]',...660 % [Calib.Cx Calib.Cy]',...661 % [-Calib.kappa1*Calib.f^2 0 0 0 0]);662 651 [omc,Tc1,Rc1,H,x,ex,JJ] = compute_extrinsic(x_1,X_1,... 663 652 (GeometryCalib.fx_fy)',GeometryCalib.Cx_Cy',[GeometryCalib.kc 0 0 0 0]); 664 653 rmpath(fct_path); 665 654 GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function … … 876 865 grid_input=CalibData.grid;%retrieve the previously used grid 877 866 end 878 [T,CalibData.grid, white_test]=create_grid(grid_input,'detect_grid');%display the GUI create_grid, read the set of phys coordinates T867 [T,CalibData.grid,CalibData.grid.CheckWhite]=create_grid(grid_input,'detect_grid');%display the GUI create_grid, read the set of phys coordinates T 879 868 set(handles.geometry_calib,'UserData',CalibData)%store the phys grid parameters for later use 880 869 … … 922 911 Rangx=DataOut.AX; 923 912 Rangy=DataOut.AY; 924 if white_test913 if CalibData.CheckWhite 925 914 Amod=double(Amod);%case of white grid markers: will look for image maxima 926 915 else 927 916 Amod=-double(Amod);%case of black grid markers: will look for image minima 928 917 end 929 % figure(12) %display corrected image930 % Amax=max(max(Amod));931 % image(Rangx,Rangy,uint8(255*Amod/Amax))932 918 933 919 %% detection of local image extrema in each direction … … 946 932 i0max=min(i0+ind_range_x,size(Amod,2)); 947 933 Asub=Amod(j0min:j0max,i0min:i0max); 948 x_profile=sum(Asub,1); 949 y_profile=sum(Asub,2); 950 [Amax,ind_x_max]=max(x_profile); 951 [Amax,ind_y_max]=max(y_profile); 934 935 936 937 x_profile=sum(Asub,1);%profile of subimage summed over y 938 y_profile=sum(Asub,2);%profile of subimage summed over x 939 %%%% 940 % if ipoint==5 941 % figure(10) 942 % imagesc(Asub) 943 % figure(11) 944 % plot(x_profile,'r') 945 % hold on 946 % plot(y_profile,'b') 947 % end 948 %%%% 949 [tild,ind_x_max]=max(x_profile); 950 [tild,ind_y_max]=max(y_profile); 952 951 %sub-pixel improvement using moments 953 952 x_shift=0; 954 953 y_shift=0; 955 954 if ind_x_max+2<=numel(x_profile) && ind_x_max-2>=1 956 Atop=x_profile(ind_x_max-2:ind_x_max+2); 955 Atop=x_profile(ind_x_max-2:ind_x_max+2);% extract x profile around the max 957 956 x_shift=sum(Atop.*[-2 -1 0 1 2])/sum(Atop); 958 957 end 959 958 if ind_y_max+2<=numel(y_profile) && ind_y_max-2>=1 960 Atop=y_profile(ind_y_max-2:ind_y_max+2); 959 Atop=y_profile(ind_y_max-2:ind_y_max+2);% extract y profile around the max 961 960 y_shift=sum(Atop.*[-2 -1 0 1 2]')/sum(Atop); 962 961 end 963 Delta(ipoint,1)=( x_shift+ind_x_max+i0min-i0-1)*Dx;%shift from the initial guess964 Delta(ipoint,2)=( y_shift+ind_y_max+j0min-j0-1)*Dy;962 Delta(ipoint,1)=(i0min+ind_x_max-1+x_shift-i0)*Dx;%shift from the initial guess 963 Delta(ipoint,2)=(j0min+ind_y_max-1+y_shift-j0)*Dy; 965 964 end 966 965 Tmod=T(:,(1:2))+Delta;% 'phys' coordinates of the detected points … … 1033 1032 end 1034 1033 [s,errormsg]=imadoc2struct(fileinput,'GeometryCalib'); 1034 if ~isfield(s,'GeometryCalib') 1035 msgbox_uvmat('ERROR','invalid input file: no geometry_calib data') 1036 return 1037 end 1035 1038 GeometryCalib=s.GeometryCalib; 1039 if ~(isfield(GeometryCalib,'SourceCalib')&&isfield(GeometryCalib.SourceCalib,'PointCoord')) 1040 msgbox_uvmat('ERROR','invalid input file: no calibration points') 1041 return 1042 end 1036 1043 Coord=GeometryCalib.SourceCalib.PointCoord; 1037 1044 Coord=[Coord zeros(size(Coord,1),1)]; -
trunk/src/series.m
r682 r694 2590 2590 % ff=functions(list_transform{end}); 2591 2591 if isequal(TransformName,'more...'); 2592 % coord_fct=''; 2593 % prompt = {'Enter the name of the transform function'}; 2594 % dlg_title = 'user defined transform'; 2595 % num_lines= 1; 2596 [FileName, PathName] = uigetfile( ... 2597 {'*.m', ' (*.m)'; 2598 '*.m', '.m files '; ... 2599 '*.*', 'All Files (*.*)'}, ... 2600 'Pick a transform function',get(handles.TransformPath,'String')); 2601 if isequal(FileName,0) 2592 % [FileName, PathName] = uigetfile( ... 2593 % {'*.m', ' (*.m)'; 2594 % '*.m', '.m files '; ... 2595 % '*.*', 'All Files (*.*)'}, ... 2596 % 'Pick a transform function',get(handles.TransformPath,'String')); 2597 2598 FileName=uigetfile_uvmat('Pick a transform function',get(handles.TransformPath,'String'),'.m'); 2599 if isempty(FileName) 2602 2600 return %browser closed without choice 2603 2601 end 2604 if isequal(PathName(end),'/')||isequal(PathName(end),'\')2605 PathName(end)=[];2606 end2602 % if isequal(PathName(end),'/')||isequal(PathName(end),'\') 2603 % PathName(end)=[]; 2604 % end 2607 2605 [TransformPath,TransformName,TransformExt]=fileparts(FileName);% removes extension .m 2608 2606 if ~strcmp(TransformExt,'.m') … … 2626 2624 TransformPathListUser{ilist-nb_builtin_transform}=TransformPathList{ilist}; 2627 2625 end 2626 TransformPathListUser=TransformPathListUser'; 2627 TransformListUser=TransformListUser'; 2628 2628 save (profil_perso,'TransformPathListUser','TransformListUser','-append'); %store the root name for future opening of uvmat 2629 2629 end
Note: See TracChangeset
for help on using the changeset viewer.