Changeset 928 for trunk/src/transform_field
- Timestamp:
- Mar 5, 2016, 5:57:11 PM (9 years ago)
- Location:
- trunk/src/transform_field
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/transform_field/ima_edge_detection.m
r924 r928 4 4 %%%% Use the general syntax for transform fields with a single input and parameters %%%% 5 5 % OUTPUT: 6 % Data Out: output field structure6 % Data: output field structure 7 7 % 8 8 %INPUT: … … 29 29 %======================================================================= 30 30 31 function Data Out=ima_edge_detection(DataIn,Param)31 function Data=ima_edge_detection(Data,Param,Data_1) 32 32 33 33 %% request input parameters 34 if isfield(Data In,'Action') && isfield(DataIn.Action,'RUN') && isequal(DataIn.Action.RUN,0)34 if isfield(Data,'Action') && isfield(Data.Action,'RUN') && isequal(Data.Action.RUN,0) 35 35 prompt = {'npx';'npy';'threshold'}; 36 36 dlg_title = 'get the filter size in x and y'; … … 42 42 end 43 43 answer = inputdlg(prompt,dlg_title,num_lines,def); 44 Data Out.TransformInput.FilterBoxSize_x=str2num(answer{1}); %size of the filtering window45 Data Out.TransformInput.FilterBoxSize_y=str2num(answer{2}); %size of the filtering window46 Data Out.TransformInput.LumThreshold=str2num(answer{3}); %size of the filtering window44 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 47 47 return 48 48 end 49 49 50 DataOut=DataIn; %default51 %DataOut.A=255*edge(DataIn.A);52 50 53 51 %definition of the cos shape matrix filter … … 62 60 Mfiltre=Mfiltre/(sum(sum(Mfiltre)));%normalize filter 63 61 62 Afilt=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; 64 66 65 67 66 Afilt=filter2(Mfiltre,DataIn.A(100:end-100,100:end-100));% smooth the image, excluding the edges (spurious reflexions) 68 69 70 % 67 71 Amax=max(max(Afilt)); 68 72 Amin=min(min(Afilt)); 73 % Data.A( Data_1.A(100:end-100,100:end-100)==100)=(Amin+Amax)/2; 74 75 76 69 77 Athreshold=(Amin+Amax)*Param.TransformInput.LumThreshold; 70 78 % 71 % Data Out.A=zeros(size(DataIn.A,1),size(DataIn.A,2),3);72 Data Out.A=(DataIn.A>Athreshold);%transform to the initial image format73 % Data Out.A(:,:,1)=DataIn.A;%transform to the initial image format, red74 STATS = regionprops(Data Out.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 82 STATS = regionprops(Data.A, 'FilledArea','MinorAxisLength','MajorAxisLength','PixelIdxList'); 75 83 Area=zeros(size(STATS)); 76 84 for iobj=1:numel(STATS) 77 85 Area(iobj)=STATS(iobj).FilledArea; 78 86 end 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; 82 90 for iobj=1:numel(STATS) 83 91 if iobj~=main_obj 84 Data Out.A(STATS(iobj).PixelIdxList)=0;92 Data.A(STATS(iobj).PixelIdxList)=0; 85 93 end 86 94 end 87 95 88 Data Out.A=Amax*DataOut.A;96 Data.A=Amax*Data.A; 89 97 -
trunk/src/transform_field/ima_patch_detection.m
r924 r928 87 87 DataOut=DataIn; %default 88 88 %Amask=imread('/fsnet/project/coriolis/2015/15MINI_MEDDY/0_REF_FILES/mask_patch.png'); 89 plot_mask(DataIn.A,Param.TransformInput.LumThreshold) 89 hfig=findobj(allchild(0),'Tag','set_threshold'); 90 hThreshold=findobj(hfig,'Tag','Threshold'); 91 Threshold=str2num(get(hThreshold,'String')); 92 plot_mask(DataIn.A,Threshold) 90 93 % Athreshold=Param.TransformInput.LumThreshold; 91 94 % %
Note: See TracChangeset
for help on using the changeset viewer.