PETROUEDGE_BASE - Base function for PETROUEDGE.
Contents
Syntax
emap = PETROUEDGE_BASE(I,mask);
See also
Ressembles: PETROUEDGE, CANNYEDGE_BASE, EDGECORNER_BASE, ROTHWELLEDGE_BASE, CONGRUENCYEDGE_BASE, COMPASSEDGE_BASE, ANISOEDGE_BASE, ELDERZUCKEREDGE_BASE, KOETHEDGE_BASE, SDGDEDGE_BASE. Requires: IMFILTER, GRADIENT, CANNYEDGEMAP_BASE.
Function implementation
function edgemap = petrouedge_base(I, mask)
dealing with multispectral images
C = size(I,3); if C>1 edgemap = false(size(I)); for c=1:C edgemap(:,:,c) = petrouedge_base(I(:,:,c), mask); end return; end
create the smoothing masks proposed by J.Kittler et M.Petrou
M0 = ... [0 , 0 , 0.00049 , 0.02135 , 0.06300 , 0.08423 , 0.06300 , 0.02135 , 0.00049 , 0 , 0 ;... 0 , 0.00394 , 0.08423 , 0.26622 , 0.45502 , 0.53485 , 0.45502 , 0.26622 , 0.08423 , 0.00394 , 0 ;... 0.00049 , 0.08423 , 0.38409 , 0.83549 , 1.24773 , 1.14549 , 1.24773 , 0.83549 , 0.38409 , 0.08423 , 0.00049 ;... 0.02135 , 0.26622 , 0.83549 , 1.60099 , 2.28535 , 2.56577 , 2.28535 , 1.60099 , 0.83549 , 0.26622 , 0.02135 ;... 0.06300 , 0.45502 , 1.24773 , 2.28535 , 3.23228 , 3.63454 , 3.23228 , 2.28535 , 1.24773 , 0.45502 , 0.06300 ;... 0.08423 , 0.53485 , 1.14549 , 2.56577 , 3.63454 , 4.10412 , 3.63454 , 2.56577 , 1.14549 , 0.53485 , 0.08423 ;... 0.06300 , 0.45502 , 1.24773 , 2.28535 , 3.23228 , 3.63454 , 3.23228 , 2.28535 , 1.24773 , 0.45502 , 0.06300 ;... 0.02135 , 0.26622 , 0.83549 , 1.60099 , 2.28535 , 2.56577 , 2.28535 , 1.60099 , 0.83549 , 0.26622 , 0.02135 ;... 0.00049 , 0.08423 , 0.38409 , 0.83549 , 1.24773 , 1.14549 , 1.24773 , 0.83549 , 0.38409 , 0.08423 , 0.00049 ;... 0 , 0.00394 , 0.08423 , 0.26622 , 0.45502 , 0.53485 , 0.45502 , 0.26622 , 0.08423 , 0.00394 , 0 ;... 0 , 0 , 0.00049 , 0.02135 , 0.06300 , 0.08423 , 0.06300 , 0.02135 , 0.00049 , 0 , 0 ]; %#ok M1 = ... [ 0 , 0 , 0.00053 , 0.02298 , 0.06760 , 0.09028 , 0.06760 , 0.02298 , 0.00053 , 0 , 0;... 0 , 0.00425 , 0.09028 , 0.28319 , 0.48086 , 0.56374 , 0.48086 , 0.28319 , 0.09028 , 0.00425 , 0;... 0.00053 , 0.09028 , 0.40687 , 0.87229 , 1.28632 , 1.45179 , 1.28632 , 0.87229 , 0.40687 , 0.09028 , 0.00053;... 0.02298 , 0.28319 , 0.87229 , 1.63271 , 2.28095 , 2.53746 , 2.28095 , 1.63271 , 0.87229 , 0.28319 , 0.02298;... 0.06760 , 0.48086 , 1.28632 , 2.28095 , 3.12403 , 3.46058 , 3.12403 , 2.28095 , 1.28632 , 0.48086 , 0.06760;... 0.09028 , 0.56374 , 1.45179 , 2.53746 , 3.46058 , 3.83311 , 3.46058 , 2.53746 , 1.45179 , 0.56374 , 0.09028;... 0.06760 , 0.48086 , 1.28632 , 2.28095 , 3.12403 , 3.46058 , 3.12403 , 2.28095 , 1.28632 , 0.48086 , 0.06760;... 0.02298 , 0.28319 , 0.87229 , 1.63271 , 2.28095 , 2.53746 , 2.28095 , 1.63271 , 0.87229 , 0.28319 , 0.02298;... 0.00053 , 0.09028 , 0.40687 , 0.87229 , 1.28632 , 1.45179 , 1.28632 , 0.87229 , 0.40687 , 0.09028 , 0.00053;... 0 , 0.00425 , 0.09028 , 0.28319 , 0.48086 , 0.56374 , 0.48086 , 0.28319 , 0.09028 , 0.00425 , 0;... 0 , 0 , 0.00053 , 0.02298 , 0.06760 , 0.09028 , 0.06760 , 0.02298 , 0.00053 , 0 , 0]; %#ok M2 = ... [ 0 , 0 , 0.00053 , 0.02324 , 0.06837 , 0.09129 , 0.06837 , 0.02324 , 0.00053 , 0 , 0;... 0 , 0.00430 , 0.09129 , 0.28605 , 0.48251 , 0.56859 , 0.48251 , 0.28605 , 0.09129 , 0.00430 , 0;... 0.00053 , 0.09129 , 0.41071 , 0.87841 , 1.29256 , 1.45757 , 1.29256 , 0.87841 , 0.41071 , 0.09129 , 0.00053;... 0.02324 , 0.28605 , 0.87841 , 1.63761 , 2.27956 , 2.53211 , 2.27956 , 1.63761 , 0.87841 , 0.28605 , 0.02324;... 0.06837 , 0.48251 , 1.29256 , 2.27956 , 3.10617 , 3.43309 , 3.10617 , 2.27956 , 1.29256 , 0.48251 , 0.06837;... 0.09129 , 0.56859 , 1.45757 , 2.53211 , 3.43309 , 3.79245 , 3.43309 , 2.53211 , 1.45757 , 0.56859 , 0.09129;... 0.06837 , 0.48251 , 1.29256 , 2.27956 , 3.10617 , 3.43309 , 3.10617 , 2.27956 , 1.29256 , 0.48251 , 0.06837;... 0.02324 , 0.28605 , 0.87841 , 1.63761 , 2.27956 , 2.53211 , 2.27956 , 1.63761 , 0.87841 , 0.28605 , 0.02324;... 0.00053 , 0.09129 , 0.41071 , 0.87841 , 1.29256 , 1.45757 , 1.29256 , 0.87841 , 0.41071 , 0.09129 , 0.00053;... 0 , 0.00430 , 0.09129 , 0.28605 , 0.48251 , 0.56859 , 0.48251 , 0.28605 , 0.09129 , 0.00430 , 0;... 0 , 0 , 0.00053 , 0.02324 , 0.06837 , 0.09129 , 0.06837 , 0.02324 , 0.00053 , 0 , 0]; %#ok % % Note that Paplinski and Boyce [PB95] used a 2D edge half operator h obtained % % from the 1D filter introduced by Spacek [Spac86] and improved by Petrou and % % Kittler [PK91] to perform the directional filtering in four directions % % (0 90 180 270) by rotating the filter mask; in percentage values, the upper % % quarter of this filter is: % h = [ 0 8 11 8 2 0 0;... % 0 16 26 26 13 1 0 ;... % 0 26 48 52 33 8 0 ;... % 0 43 80 80 53 17 0 ;... % 0 68 100 94 61 21 0 ]; % % [PB95] A.P. Paplinski and J.F. Boyce: "Computational aspects of % % segmentation of a class of medical images using the concept of % % conjugate images", Tech. report 95-06, Monash University, 1995.
select the smoothing filter
M = eval(['M' num2str(mask)]);
effective filtering
A = imfilter(I, M, 'symmetric','same'); [gy, gx] = gradient(A);
edge map extraction using standard non maxima suppression and hysteresis thresholding
edgemap = cannyedgemap_base(gx, gy, 'edge', [], [], [], []);
end % end of petrouedge_base