0001 function result = handleIgnoreFilter(bnd, optionStruct)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 flagIgnore = 0;
0027 if optionStruct.minConvexity && ...
0028 bnd.convexity < optionStruct.minConvexity
0029 flagIgnore = 1;
0030 end
0031 if optionStruct.minDiameter && ...
0032 bnd.meanWidthHull < optionStruct.minDiameter
0033 flagIgnore = 2;
0034 end
0035 if optionStruct.maxSphericity && ...
0036 bnd.sphericity > optionStruct.maxSphericity
0037 flagIgnore = 3;
0038 end
0039 if optionStruct.maxSphericity2 && ...
0040 bnd.sphericity2 > optionStruct.maxSphericity2
0041 flagIgnore = 4;
0042 end
0043 if optionStruct.maxAngleGap && ...
0044 bnd.largestAngleGap > optionStruct.maxAngleGap
0045 flagIgnore = 5;
0046 end
0047 if optionStruct.minBrightFraction && ~isfield(bnd, 'brightFraction')
0048 error('elk:bnd:inputError', ['If bright fraction from image shall ' ...
0049 'be checked, you must provide the image for obtainBnd']);
0050 end
0051 if optionStruct.minBrightFraction && isfield(bnd, 'brightFraction') && ...
0052 bnd.brightFraction < optionStruct.minBrightFraction
0053 flagIgnore = 6;
0054 end
0055 if flagIgnore
0056 result = bnd;
0057
0058 result.hrep.A = [];
0059 result.hrep.h = [];
0060 result.vrep.V = [0 0];
0061 result.lambda = mean(bnd.polarDistance);
0062
0063 result.circumfence = 2*pi*result.lambda;
0064 result.meanWidth = 2*result.lambda;
0065 result.roughness = max(bnd.polarDistance) - min(bnd.polarDistance);
0066 result.squareRoughness = inf;
0067 result.flagIgnore = flagIgnore;
0068 else
0069 result = [];
0070 end