Ignore:
Timestamp:
Mar 5, 2016, 5:57:11 PM (9 years ago)
Author:
sommeria
Message:

corrections

Location:
trunk/src/transform_field
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/transform_field/ima_edge_detection.m

    r924 r928  
    44%%%%  Use the general syntax for transform fields with a single input and parameters %%%%
    55% OUTPUT:
    6 % DataOut:   output field structure
     6% Data:   output field structure
    77%
    88%INPUT:
     
    2929%=======================================================================
    3030
    31 function DataOut=ima_edge_detection(DataIn,Param)
     31function Data=ima_edge_detection(Data,Param,Data_1)
    3232
    3333%% request input parameters
    34 if isfield(DataIn,'Action') && isfield(DataIn.Action,'RUN') && isequal(DataIn.Action.RUN,0)
     34if isfield(Data,'Action') && isfield(Data.Action,'RUN') && isequal(Data.Action.RUN,0)
    3535    prompt = {'npx';'npy';'threshold'};
    3636    dlg_title = 'get the filter size in x and y';
     
    4242    end
    4343    answer = inputdlg(prompt,dlg_title,num_lines,def);
    44     DataOut.TransformInput.FilterBoxSize_x=str2num(answer{1}); %size of the filtering window
    45     DataOut.TransformInput.FilterBoxSize_y=str2num(answer{2}); %size of the filtering window
    46     DataOut.TransformInput.LumThreshold=str2num(answer{3}); %size of the filtering window
     44    Data.TransformInput.FilterBoxSize_x=str2num(answer{1}); %size of the filtering window
     45    Data.TransformInput.FilterBoxSize_y=str2num(answer{2}); %size of the filtering window
     46    Data.TransformInput.LumThreshold=str2num(answer{3}); %size of the filtering window
    4747    return
    4848end
    4949
    50 DataOut=DataIn; %default
    51 %DataOut.A=255*edge(DataIn.A);
    5250
    5351%definition of the cos shape matrix filter
     
    6260Mfiltre=Mfiltre/(sum(sum(Mfiltre)));%normalize filter
    6361
     62Afilt=filter2(Mfiltre,Data.A);% smooth the image, excluding the edges (spurious reflexions)
     63
     64    %Afilt=filter2(Mfiltre,Data.A(100:end-100,100:end-100));% smooth the image, excluding the edges (spurious reflexions)
     65  %Data.A= double(Data.A)-Afilt;
    6466
    6567
    66     Afilt=filter2(Mfiltre,DataIn.A(100:end-100,100:end-100));% smooth the image, excluding the edges (spurious reflexions)
     68   
     69   
     70%     
    6771    Amax=max(max(Afilt));
    6872    Amin=min(min(Afilt));
     73%     Data.A( Data_1.A(100:end-100,100:end-100)==100)=(Amin+Amax)/2;
     74
     75 
     76 
    6977    Athreshold=(Amin+Amax)*Param.TransformInput.LumThreshold;
    7078%     
    71 %     DataOut.A=zeros(size(DataIn.A,1),size(DataIn.A,2),3);
    72     DataOut.A=(DataIn.A>Athreshold);%transform to the initial image format
    73 %     DataOut.A(:,:,1)=DataIn.A;%transform to the initial image format, red
    74 STATS = regionprops(DataOut.A, 'FilledArea','MinorAxisLength','MajorAxisLength','PixelIdxList');
     79%     Data.A=zeros(size(Data.A,1),size(Data.A,2),3);
     80    Data.A=(Data.A>Athreshold);%transform to the initial image format
     81%     Data.A(:,:,1)=Data.A;%transform to the initial image format, red
     82STATS = regionprops(Data.A, 'FilledArea','MinorAxisLength','MajorAxisLength','PixelIdxList');
    7583Area=zeros(size(STATS));
    7684for iobj=1:numel(STATS)
    7785    Area(iobj)=STATS(iobj).FilledArea;
    7886end
    79 [Area, main_obj]=max(Area);
    80     MajorAxisLength=STATS(main_obj).MajorAxisLength
    81     MinorAxisLength=STATS(main_obj).MinorAxisLength
     87[Area, main_obj]=max(Area)
     88    MajorAxisLength=STATS(main_obj).MajorAxisLength;
     89    MinorAxisLength=STATS(main_obj).MinorAxisLength;
    8290for iobj=1:numel(STATS)
    8391    if iobj~=main_obj
    84     DataOut.A(STATS(iobj).PixelIdxList)=0;
     92    Data.A(STATS(iobj).PixelIdxList)=0;
    8593    end
    8694end
    8795
    88 DataOut.A=Amax*DataOut.A;
     96Data.A=Amax*Data.A;
    8997 
  • trunk/src/transform_field/ima_patch_detection.m

    r924 r928  
    8787DataOut=DataIn; %default
    8888%Amask=imread('/fsnet/project/coriolis/2015/15MINI_MEDDY/0_REF_FILES/mask_patch.png');
    89 plot_mask(DataIn.A,Param.TransformInput.LumThreshold)
     89hfig=findobj(allchild(0),'Tag','set_threshold');
     90hThreshold=findobj(hfig,'Tag','Threshold');
     91Threshold=str2num(get(hThreshold,'String'));
     92plot_mask(DataIn.A,Threshold)
    9093% Athreshold=Param.TransformInput.LumThreshold;
    9194% %
Note: See TracChangeset for help on using the changeset viewer.