Changeset 61 for trunk/src/geometry_calib.m
- Timestamp:
- Mar 24, 2010, 12:51:51 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/geometry_calib.m
r60 r61 43 43 % Edit the above text to modify the response to help geometry_calib 44 44 45 % Last Modified by GUIDE v2.5 23-Mar-2010 06:22:3345 % Last Modified by GUIDE v2.5 23-Mar-2010 16:19:01 46 46 47 47 % Begin initialization code - DO NOT edit … … 148 148 %case of calibration (ImaDoc) input file 149 149 % hcalib=get(handles.calib_type,'parent'); 150 CalibData=get(handles. figure1,'UserData');150 CalibData=get(handles.geometry_calib,'UserData'); 151 151 CalibData.XmlInput=fileinput; 152 152 if isfield(s,'Heading') … … 154 154 end 155 155 156 set(handles. figure1,'UserData',CalibData);%store the heading in the interface 'UserData'156 set(handles.geometry_calib,'UserData',CalibData);%store the heading in the interface 'UserData' 157 157 if isfield(s,'GeometryCalib') 158 158 Calib=s.GeometryCalib; … … 312 312 delete(h_dataview) 313 313 end 314 CalibData=get(handles. figure1,'UserData');%read the calibration image source on the interface userdata314 CalibData=get(handles.geometry_calib,'UserData');%read the calibration image source on the interface userdata 315 315 316 316 if isfield(CalibData,'XmlInput') … … 791 791 set(hh,'YData',ObjectData.Coord(:,2)) 792 792 end 793 pause(.1) 794 figure(handles.geometry_calib) 793 795 794 796 % -------------------------------------------------------------------- … … 807 809 %------------------------------------------------------------------------ 808 810 %hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib 809 CalibData=get(handles. figure1,'UserData');811 CalibData=get(handles.geometry_calib,'UserData'); 810 812 Tinput=[];%default 811 813 if isfield(CalibData,'grid') … … 813 815 end 814 816 [T,CalibData.grid]=create_grid(grid_input);%display the GUI create_grid 815 set(handles. figure1,'UserData',CalibData)817 set(handles.geometry_calib,'UserData',CalibData) 816 818 817 819 %grid in phys space … … 844 846 %----------------------------------------------------------------------- 845 847 %hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib 846 CalibData=get(handles. figure1,'UserData');848 CalibData=get(handles.geometry_calib,'UserData'); 847 849 Tinput=[];%default 848 850 if isfield(CalibData,'translate') … … 851 853 T=translate_points(Tinput);%display translate_points GUI and get shift parameters 852 854 CalibData.translate=T; 853 set(handles. figure1,'UserData',CalibData)855 set(handles.geometry_calib,'UserData',CalibData) 854 856 %translation 855 857 Coord_cell=get(handles.ListCoord,'String'); … … 872 874 function MenuRotatePoints_Callback(hObject, eventdata, handles) 873 875 %hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib 874 CalibData=get(handles. figure1,'UserData');876 CalibData=get(handles.geometry_calib,'UserData'); 875 877 Tinput=[];%default 876 878 if isfield(CalibData,'rotate') … … 879 881 T=rotate_points(Tinput);%display translate_points GUI and get shift parameters 880 882 CalibData.rotate=T; 881 set(handles. figure1,'UserData',CalibData)883 set(handles.geometry_calib,'UserData',CalibData) 882 884 %----------------------------------------------------- 883 885 %rotation … … 915 917 function MenuDetectGrid_Callback(hObject, eventdata, handles) 916 918 917 CalibData=get(handles. figure1,'UserData');919 CalibData=get(handles.geometry_calib,'UserData'); 918 920 grid_input=[];%default 919 921 if isfield(CalibData,'grid') … … 921 923 end 922 924 [T,CalibData.grid]=create_grid(grid_input);%display the GUI create_grid 923 set(handles. figure1,'UserData',CalibData)%store the phys grid for later use925 set(handles.geometry_calib,'UserData',CalibData)%store the phys grid for later use 924 926 925 927 %read the four last point coordiantes in pixels … … 978 980 [Amax,ind_x_max]=max(x_profile); 979 981 [Amax,ind_y_max]=max(y_profile); 980 Delta(ipoint,1)=(ind_x_max-ind_range-1)*Dx;%shift from the initial guess 981 Delta(ipoint,2)=(ind_y_max-ind_range-1)*Dy; 982 %sub-pixel improvement using moments 983 x_shift=0; 984 y_shift=0; 985 if ind_x_max+2<=2*ind_range+1 && ind_x_max-2>=1 986 Atop=x_profile(ind_x_max-2:ind_x_max+2); 987 x_shift=sum(Atop.*[-2 -1 0 1 2])/sum(Atop); 988 end 989 if ind_y_max+2<=2*ind_range+1 && ind_y_max-2>=1 990 Atop=y_profile(ind_y_max-2:ind_y_max+2); 991 y_shift=sum(Atop.*[-2 -1 0 1 2]')/sum(Atop); 992 end 993 Delta(ipoint,1)=(x_shift+ind_x_max-ind_range-1)*Dx;%shift from the initial guess 994 Delta(ipoint,2)=(y_shift+ind_y_max-ind_range-1)*Dy; 982 995 end 983 996 Tmod=T(:,(1:2))+Delta;
Note: See TracChangeset
for help on using the changeset viewer.