Ignore:
Timestamp:
Oct 29, 2013, 12:28:57 PM (10 years ago)
Author:
sommeria
Message:

bug repaired geometry_calib/Detect grid, + corrections in get_field

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/geometry_calib.m

    r682 r693  
    5050% Edit the above text to modify the response to help geometry_calib
    5151
    52 % Last Modified by GUIDE v2.5 02-Sep-2013 16:47:27
     52% Last Modified by GUIDE v2.5 29-Oct-2013 06:46:10
    5353
    5454% Begin initialization code - DO NOT edit
     
    114114set(handles.Copy,'Position',[151 Height-394 120 30])%  rank 6
    115115set(handles.CLEAR_PTS,'Position',[297 Height-394 120 30])%  rank 6
     116set(handles.ClearLine,'Position',[297 Height-364 120 30])%  rank 6
    116117set(handles.phys_title,'Position',[38 Height-426 125 20])%  rank 7
    117118set(handles.CoordUnit,'Position',[151 Height-426 120 30])%  rank 7
     
    230231    Data=get(handles.ListCoord,'Data');
    231232    Data(:,6)=zeros(size(Data,1),1);
    232     Data(index,6)=1;% indicate in the list the point with max deviation (possible mistake)
     233    Data(index,6)=-1;% indicate in the list the point with max deviation (possible mistake)
    233234    set(handles.ListCoord,'Data',Data)% indicate in the list the point with max deviation (possible mistake)
    234235    figure(handles.geometry_calib)
     
    881882huvmat=findobj(allchild(0),'Name','uvmat');
    882883UvData=get(huvmat,'UserData');
    883 A=UvData.Field.A;
     884A=UvData.Field.A;%currently displayed image
    884885npxy=size(A);
    885886X=[CalibData.grid.x_0 CalibData.grid.x_1 CalibData.grid.x_0 CalibData.grid.x_1]';%corner absissa in the phys coordinates (cm)
    886887Y=[CalibData.grid.y_0 CalibData.grid.y_0 CalibData.grid.y_1 CalibData.grid.y_1]';%corner ordinates in the phys coordinates (cm)
    887888
    888 %calculate transform matrices for plane projection
     889%calculate transform matrices for plane projection: rectangle assumed to be viewed in perspective
    889890% reference: http://alumni.media.mit.edu/~cwren/interpolator/ by Christopher R. Wren
    890891B = [ X Y ones(size(X)) zeros(4,3)        -X.*corners_X -Y.*corners_X ...
     
    898899
    899900% transform grid image into 'phys' coordinates
    900 GeometryCalib.CalibrationType='linear';
     901GeometryCalib.CalibrationType='3D_linear';
    901902GeometryCalib.fx_fy=[1 1];
    902903GeometryCalib.Tx_Ty_Tz=[Amat(1,3) Amat(2,3) 1];
     
    918919DataOut=phys(Data,Calib);
    919920rmpath(fullfile(path_UVMAT,'transform_field'))
    920 Amod=DataOut.A;
     921Amod=DataOut.A;% current imgage expressed in 'phys' coord
    921922Rangx=DataOut.AX;
    922923Rangy=DataOut.AY;
     
    936937ind_range_y=ceil(abs(GeometryCalib.R(2,2)*CalibData.grid.Dy/3));% range of search of image ma around each point obtained by linear interpolation from the marked points
    937938nbpoints=size(T,1);
     939%lokk for image maxima around each expected pgrid point
    938940for ipoint=1:nbpoints
    939941    i0=1+round((T(ipoint,1)-Rangx(1))/Dx);%round(Xpx(ipoint));
     
    962964    Delta(ipoint,2)=(y_shift+ind_y_max+j0min-j0-1)*Dy;
    963965end
    964 Tmod=T(:,(1:2))+Delta;
    965 [Xpx,Ypx]=px_XYZ(GeometryCalib,Tmod(:,1),Tmod(:,2));
    966 % for ipoint=1:nbpoints
    967 %      Coord{ipoint,1}=num2str(T(ipoint,1),4);%display coordiantes with 4 digits
    968 %      Coord{ipoint,2}=num2str(T(ipoint,2),4);%display coordiantes with 4 digits
    969 %      Coord{ipoint,3}=num2str(T(ipoint,3),4);%display coordiantes with 4 digits;
    970 %      Coord{ipoint,4}=num2str(Xpx(ipoint),4);%display coordiantes with 4 digits
    971 %      Coord{ipoint,5}=num2str(Ypx(ipoint),4);%display coordiantes with 4 digits
    972 % end
     966Tmod=T(:,(1:2))+Delta;% 'phys' coordinates of the detected points
     967Tmod(:,2)=flipdim(Tmod(:,2),1);% inverse the order of y coordinates
     968[Xpx,Ypx]=px_XYZ(GeometryCalib,Tmod(:,1),Tmod(:,2));% image coordinates of the detected points
    973969Coord=[T Xpx Ypx zeros(size(T,1),1)];
    974970set(handles.ListCoord,'Data',Coord)
     
    12501246    Data=get(handles.ListCoord,'Data');
    12511247    Data(:,6)=zeros(size(Data,1),1);
    1252     Data(iline,6)=1;% mark the selected line
     1248    Data(iline,6)=-1;% mark the selected line
    12531249    set(handles.ListCoord,'Data',Data)
    12541250    update_calib_marker(Data(iline,:))
     
    13401336    set(hhh,'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range])
    13411337end
     1338
     1339%------------------------------------------------------------------------
     1340% --- Executes on button press in ClearLine: remove the selected line in the table Coord
     1341%------------------------------------------------------------------------
     1342function ClearLine_Callback(hObject, eventdata, handles)
     1343
     1344Coord=get(handles.ListCoord,'Data');
     1345ind=find(Coord(:,6));%find the marker '-' for line selection
     1346if isempty(ind)
     1347    msgbox_uvmat('WARNING','no line suppressed, select a line in the table')
     1348else
     1349    answer=msgbox_uvmat('INPUT_Y-N',['suppress line ' num2str(ind) '?']);
     1350    if isequal(answer,'Yes')
     1351Coord(:,6)=zeros(size(Coord,1),1);% desactivate the current line mark
     1352Coord(ind,:)=[];
     1353PLOT_Callback(hObject,eventdata,handles)
     1354set(handles.APPLY,'BackgroundColor',[1 0 1])
     1355set(handles.ListCoord,'Data',Coord);
     1356    end
     1357end
Note: See TracChangeset for help on using the changeset viewer.