Ignore:
Timestamp:
Mar 24, 2010, 12:51:51 AM (11 years ago)
Author:
sommeria
Message:

gestion of projection objects improved. Implementation of view_field.fig
introduction of a circle to mark vectors with the mouse
various cleaning and debugging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/geometry_calib.m

    r60 r61  
    4343% Edit the above text to modify the response to help geometry_calib
    4444
    45 % Last Modified by GUIDE v2.5 23-Mar-2010 06:22:33
     45% Last Modified by GUIDE v2.5 23-Mar-2010 16:19:01
    4646
    4747% Begin initialization code - DO NOT edit
     
    148148%case of calibration (ImaDoc) input file
    149149% hcalib=get(handles.calib_type,'parent');
    150 CalibData=get(handles.figure1,'UserData');
     150CalibData=get(handles.geometry_calib,'UserData');
    151151CalibData.XmlInput=fileinput;
    152152if isfield(s,'Heading')
     
    154154end
    155155
    156 set(handles.figure1,'UserData',CalibData);%store the heading in the interface 'UserData'
     156set(handles.geometry_calib,'UserData',CalibData);%store the heading in the interface 'UserData'
    157157if isfield(s,'GeometryCalib')
    158158    Calib=s.GeometryCalib;
     
    312312    delete(h_dataview)
    313313end
    314 CalibData=get(handles.figure1,'UserData');%read the calibration image source on the interface userdata
     314CalibData=get(handles.geometry_calib,'UserData');%read the calibration image source on the interface userdata
    315315
    316316if isfield(CalibData,'XmlInput')
     
    791791    set(hh,'YData',ObjectData.Coord(:,2))
    792792end
     793pause(.1)
     794figure(handles.geometry_calib)
    793795
    794796% --------------------------------------------------------------------
     
    807809%------------------------------------------------------------------------
    808810%hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib
    809 CalibData=get(handles.figure1,'UserData');
     811CalibData=get(handles.geometry_calib,'UserData');
    810812Tinput=[];%default
    811813if isfield(CalibData,'grid')
     
    813815end
    814816[T,CalibData.grid]=create_grid(grid_input);%display the GUI create_grid
    815 set(handles.figure1,'UserData',CalibData)
     817set(handles.geometry_calib,'UserData',CalibData)
    816818
    817819%grid in phys space
     
    844846%-----------------------------------------------------------------------
    845847%hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib
    846 CalibData=get(handles.figure1,'UserData');
     848CalibData=get(handles.geometry_calib,'UserData');
    847849Tinput=[];%default
    848850if isfield(CalibData,'translate')
     
    851853T=translate_points(Tinput);%display translate_points GUI and get shift parameters
    852854CalibData.translate=T;
    853 set(handles.figure1,'UserData',CalibData)
     855set(handles.geometry_calib,'UserData',CalibData)
    854856%translation
    855857Coord_cell=get(handles.ListCoord,'String');
     
    872874function MenuRotatePoints_Callback(hObject, eventdata, handles)
    873875%hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib
    874 CalibData=get(handles.figure1,'UserData');
     876CalibData=get(handles.geometry_calib,'UserData');
    875877Tinput=[];%default
    876878if isfield(CalibData,'rotate')
     
    879881T=rotate_points(Tinput);%display translate_points GUI and get shift parameters
    880882CalibData.rotate=T;
    881 set(handles.figure1,'UserData',CalibData)
     883set(handles.geometry_calib,'UserData',CalibData)
    882884%-----------------------------------------------------
    883885%rotation
     
    915917function MenuDetectGrid_Callback(hObject, eventdata, handles)
    916918
    917 CalibData=get(handles.figure1,'UserData');
     919CalibData=get(handles.geometry_calib,'UserData');
    918920grid_input=[];%default
    919921if isfield(CalibData,'grid')
     
    921923end
    922924[T,CalibData.grid]=create_grid(grid_input);%display the GUI create_grid
    923 set(handles.figure1,'UserData',CalibData)%store the phys grid for later use
     925set(handles.geometry_calib,'UserData',CalibData)%store the phys grid for later use
    924926
    925927%read the four last point coordiantes in pixels
     
    978980    [Amax,ind_x_max]=max(x_profile);
    979981    [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;
    982995end
    983996Tmod=T(:,(1:2))+Delta;
Note: See TracChangeset for help on using the changeset viewer.