Skip to content

Commit 0659e27

Browse files
ConfigExtract + related
- Updated formatting and style
1 parent 4d7216c commit 0659e27

File tree

6 files changed

+127
-260
lines changed

6 files changed

+127
-260
lines changed

main/boofcv-feature/src/main/java/boofcv/abst/feature/detect/extract/ConfigExtract.java

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,23 @@
2020

2121
import boofcv.struct.Configuration;
2222

23-
/**
24-
* General configuration for {@link NonMaxSuppression}.
25-
*
26-
* @author Peter Abeles
27-
*/
23+
/// General configuration for [NonMaxSuppression].
2824
public class ConfigExtract implements Configuration {
29-
/**
30-
* Search radius of the non-maximum region. Most common value is 1 for a 3x3 region. Default is 1.
31-
*/
25+
/// Search radius of the non-maximum region. Most common value is 1 for a 3x3 region. Default is 1.
3226
public int radius = 1;
33-
/**
34-
* Minimum feature intensity it will consider when detecting a maximum. For local minimums
35-
* it will use a value of -threshold. Defaults to 0.
36-
*/
27+
/// Minimum feature intensity it will consider when detecting a maximum. For local minimums
28+
/// it will use a value of -threshold. Defaults to 0.
3729
public float threshold = 0;
38-
/**
39-
* Size of border around the image in which pixels are not considered. Default is 0.
40-
*/
30+
/// Size of border around the image in which pixels are not considered. Default is 0.
4131
public int ignoreBorder = 0;
42-
/**
43-
* Is a strict test used to test for local maximums. If strict the local maximum must be greater than
44-
* all its neighbors, otherwise it just needs to be greater than or equal to its neighbors. Default is true.
45-
*/
32+
/// Is a strict test used to test for local maximums. If strict the local maximum must be greater than
33+
/// all its neighbors, otherwise it just needs to be greater than or equal to its neighbors. Default is true.
4634
public boolean useStrictRule = true;
4735

48-
/**
49-
* If false then local maximums will be found
50-
*/
36+
/// If false then local maximums will be found
5137
public boolean detectMinimums = false;
5238

53-
/**
54-
* If true then local maximums will be found
55-
*/
39+
/// If true then local maximums will be found
5640
public boolean detectMaximums = true;
5741

5842
public static ConfigExtract max( int radius, float threshold, int ignoreBorder, boolean useStrictRule ) {
@@ -86,9 +70,7 @@ public ConfigExtract( int radius, float threshold, int ignoreBorder, boolean use
8670
this.useStrictRule = useStrictRule;
8771
}
8872

89-
/**
90-
* Constructor which defaults to an ignore border of 0 and to using a strict rule
91-
*/
73+
/// Constructor which defaults to an ignore border of 0 and to using a strict rule
9274
public ConfigExtract( int radius, float threshold ) {
9375
this(radius, threshold, 0, true);
9476
}
@@ -105,8 +87,7 @@ public ConfigExtract setTo( ConfigExtract src ) {
10587
return this;
10688
}
10789

108-
@Override
109-
public void checkValidity() {
90+
@Override public void checkValidity() {
11091
if (radius <= 0)
11192
throw new IllegalArgumentException("Search radius must be >= 1");
11293
if (ignoreBorder < 0)

main/boofcv-feature/src/main/java/boofcv/abst/feature/detect/extract/NonMaxLimiter.java

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,13 @@
3030
import org.ddogleg.struct.FastArray;
3131
import org.jetbrains.annotations.Nullable;
3232

33-
/**
34-
* Adds the ability to specify the maximum number of points that you wish to return. The selected
35-
* points will be sorted by feature intensity. If maximums and minimums are found then the total
36-
* number refers to the total combined number of features. The intensity that it sorts by is the absolute value.
37-
*
38-
* @author Peter Abeles
39-
*/
33+
/// Adds the ability to specify the maximum number of points that you wish to return. The selected
34+
/// points will be sorted by feature intensity. If maximums and minimums are found then the total
35+
/// number refers to the total combined number of features. The intensity that it sorts by is the absolute value.
4036
public class NonMaxLimiter {
4137
@Getter NonMaxSuppression nonmax;
4238

43-
/** Maximum number of features it can return. If %le; 0 then there will be no limit */
39+
/// Maximum number of features it can return. If %le; 0 then there will be no limit
4440
@Getter @Setter int maxTotalFeatures;
4541

4642
// Detected minimums and maximums
@@ -54,12 +50,10 @@ public class NonMaxLimiter {
5450
// Just the selected features
5551
FastArray<LocalExtreme> foundSelected = new FastArray<>(LocalExtreme.class);
5652

57-
/**
58-
* Configures the limiter
59-
*
60-
* @param nonmax Non-maximum suppression algorithm
61-
* @param maxTotalFeatures The total number of allowed features it can return. Set to a value &le; 0 to disable.
62-
*/
53+
/// Configures the limiter
54+
///
55+
/// @param nonmax Non-maximum suppression algorithm
56+
/// @param maxTotalFeatures The total number of allowed features it can return. Set to a value &le; 0 to disable.
6357
public NonMaxLimiter( NonMaxSuppression nonmax,
6458
FeatureSelectLimitIntensity<LocalExtreme> selector,
6559
int maxTotalFeatures ) {
@@ -77,14 +71,11 @@ public NonMaxLimiter( NonMaxSuppression nonmax,
7771
});
7872
}
7973

80-
/**
81-
* Extracts local max and/or min from the intensity image. If more than the maximum features are found then
82-
* only the most intense ones will be returned
83-
*
84-
* @param intensity Feature image intensity
85-
*/
74+
/// Extracts local max and/or min from the intensity image. If more than the maximum features are found then
75+
/// only the most intense ones will be returned
76+
///
77+
/// @param intensity Feature image intensity
8678
public void process( GrayF32 intensity ) {
87-
8879
originalMin.reset();
8980
originalMax.reset();
9081
nonmax.process(intensity, null, null, originalMin, originalMax);
@@ -114,16 +105,12 @@ public FastAccess<LocalExtreme> getFeatures() {
114105
return foundSelected;
115106
}
116107

117-
/**
118-
* Data structure which provides information on a local extremum.
119-
*/
108+
/// Data structure which provides information on a local extremum.
120109
@SuppressWarnings({"NullAway.Init"})
121110
public static class LocalExtreme implements Comparable<LocalExtreme> {
122-
/**
123-
* Absolute value of image intensity
124-
*/
111+
/// Absolute value of image intensity
125112
public float intensity;
126-
/** true if it was a maximum (positive) or minimum (negative intensity) */
113+
/// true if it was a maximum (positive) or minimum (negative intensity)
127114
public boolean max;
128115
public Point2D_I16 location;
129116

@@ -134,18 +121,15 @@ public LocalExtreme set( float intensity, boolean max, Point2D_I16 location ) {
134121
return this;
135122
}
136123

137-
/**
138-
* Returns the value of the feature in the intensity image. Adds the sign back
139-
*/
124+
/// Returns the value of the feature in the intensity image. Adds the sign back
140125
public float getIntensitySigned() {
141126
if (max)
142127
return intensity;
143128
else
144129
return -intensity;
145130
}
146131

147-
@Override
148-
public int compareTo( LocalExtreme o ) {
132+
@Override public int compareTo( LocalExtreme o ) {
149133
if (intensity < o.intensity) {
150134
return 1;
151135
} else if (intensity > o.intensity) {

main/boofcv-feature/src/main/java/boofcv/abst/feature/detect/extract/NonMaxSuppression.java

Lines changed: 63 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -23,125 +23,94 @@
2323
import boofcv.struct.image.GrayF32;
2424
import org.jetbrains.annotations.Nullable;
2525

26-
/**
27-
* <p>
28-
* Detects local minimums and/or maximums in an intensity image inside square regions. This is known as non-maximum
29-
* suppression. The detector can be configured to ignore pixels along the image border by a user specified distance.
30-
* Some implementations require candidate locations for the features. This allows for a sparse algorithm to be used,
31-
* resulting in a significant speed boost. Pixel values with a value of -Float.MAX_VALUE or Float.MAX_VALUE will
32-
* not be considered for local minimum/maximum, respectively. This is a good way to ignore previously detected
33-
* features.
34-
* </p>
35-
*
36-
* <p>
37-
* Not all implementations will search for both minimums or maximums. Be sure you are using the correct one. If
38-
* you don't intend on detecting a minimum or maximum pass in null for the candidate list and the output found list.
39-
* </p>
40-
*
41-
* <p>
42-
* An extractor which uses candidate features must always be provided them. However, an algorithm which does not
43-
* use candidate features will simply ignore that input and operate as usual. Can check capabilities at runtime
44-
* using the {@link #canDetectMinimums()} and {@link #canDetectMaximums()} functions.
45-
* </p>
46-
*
47-
* <p>
48-
* A border can be specified around the outside of the image in which extremes can't be detected. However, a pixel
49-
* outside this border can influence if a pixel is a maximum inside, if the local search radius extends that far.
50-
* This is specified by the border parameter and the valid region is defined as follows:<br>
51-
* border &le; x &lt; width-border AND border &le; y &lt; height-border</p>
52-
*
53-
* @author Peter Abeles
54-
*/
26+
///
27+
/// Detects local minimums and/or maximums in an intensity image inside square regions. This is known as non-maximum
28+
/// suppression. The detector can be configured to ignore pixels along the image border by a user specified distance.
29+
/// Some implementations require candidate locations for the features. This allows for a sparse algorithm to be used,
30+
/// resulting in a significant speed boost. Pixel values with a value of -Float.MAX_VALUE or Float.MAX_VALUE will
31+
/// not be considered for local minimum/maximum, respectively. This is a good way to ignore previously detected
32+
/// features.
33+
///
34+
///
35+
/// Not all implementations will search for both minimums or maximums. Be sure you are using the correct one. If
36+
/// you don't intend on detecting a minimum or maximum pass in null for the candidate list and the output found list.
37+
///
38+
///
39+
/// An extractor which uses candidate features must always be provided them. However, an algorithm which does not
40+
/// use candidate features will simply ignore that input and operate as usual. Can check capabilities at runtime
41+
/// using the [#canDetectMinimums()] and [#canDetectMaximums()] functions.
42+
///
43+
///
44+
/// A border can be specified around the outside of the image in which extremes can't be detected. However, a pixel
45+
/// outside this border can influence if a pixel is a maximum inside, if the local search radius extends that far.
46+
/// This is specified by the border parameter and the valid region is defined as follows:
47+
/// border &le; x &lt; width-border AND border &le; y &lt; height-border
5548
public interface NonMaxSuppression {
5649

57-
/**
58-
* Process a feature intensity image to extract the point features. If a pixel has an intensity
59-
* value == -Float.MAX_VALUE or Float.MAX_VALUE it will not be considered for a local min or max, respectively.
60-
* If an algorithm only detect local minimums or maximums and null can be passed in for unused lists. This is
61-
* the recommended procedure since it will force an exception to be thrown if a mistake was made.
62-
*
63-
* @param intensity (Input) Feature intensity image. Not modified.
64-
* @param candidateMin (Input) (Optional) List of candidate local minimum features. Can be null if not used.
65-
* @param candidateMax (Input) (Optional) List of candidate local maximum features Can be null if not used.
66-
* @param foundMin (Output) Storage for found minimums. Can be null if not used.
67-
* @param foundMax (Output) Storage for found maximums. Can be null if not used.
68-
*/
50+
/// Process a feature intensity image to extract the point features. If a pixel has an intensity
51+
/// value == -Float.MAX_VALUE or Float.MAX_VALUE it will not be considered for a local min or max, respectively.
52+
/// If an algorithm only detect local minimums or maximums and null can be passed in for unused lists. This is
53+
/// the recommended procedure since it will force an exception to be thrown if a mistake was made.
54+
///
55+
/// @param intensity (Input) Feature intensity image. Not modified.
56+
/// @param candidateMin (Input) (Optional) List of candidate local minimum features. Can be null if not used.
57+
/// @param candidateMax (Input) (Optional) List of candidate local maximum features Can be null if not used.
58+
/// @param foundMin (Output) Storage for found minimums. Can be null if not used.
59+
/// @param foundMax (Output) Storage for found maximums. Can be null if not used.
6960
void process( GrayF32 intensity,
7061
@Nullable ListIntPoint2D candidateMin, @Nullable ListIntPoint2D candidateMax,
7162
@Nullable QueueCorner foundMin, @Nullable QueueCorner foundMax );
7263

73-
/**
74-
* Returns true if the algorithm requires a candidate list of corners.
75-
*
76-
* @return true if candidates are required.
77-
*/
64+
/// Returns true if the algorithm requires a candidate list of corners.
65+
///
66+
/// @return true if candidates are required.
7867
boolean getUsesCandidates();
7968

80-
/**
81-
* Maximum value for detected minimums
82-
*
83-
* @return threshold for feature selection
84-
*/
69+
/// Maximum value for detected minimums
70+
///
71+
/// @return threshold for feature selection
8572
float getThresholdMinimum();
8673

87-
/**
88-
* Minimum value for detected maximums
89-
*
90-
* @return threshold for feature selection
91-
*/
74+
/// Minimum value for detected maximums
75+
///
76+
/// @return threshold for feature selection
9277
float getThresholdMaximum();
9378

94-
/**
95-
* Change the feature selection threshold for finding local minimums.
96-
*
97-
* @param threshold The new selection threshold.
98-
*/
79+
/// Change the feature selection threshold for finding local minimums.
80+
///
81+
/// @param threshold The new selection threshold.
9982
void setThresholdMinimum( float threshold );
10083

101-
/**
102-
* Change the feature selection threshold for finding local maximums.
103-
*
104-
* @param threshold The new selection threshold.
105-
*/
84+
/// Change the feature selection threshold for finding local maximums.
85+
///
86+
/// @param threshold The new selection threshold.
10687
void setThresholdMaximum( float threshold );
10788

108-
/**
109-
* Defines the region inside the image in which a pixel can be an extreme.
110-
* valid region is: border &le; x &lt; width-border AND border &le; y &lt; height-border
111-
*
112-
* @param border Border size in pixels.
113-
*/
89+
/// Defines the region inside the image in which a pixel can be an extreme.
90+
/// valid region is: border &le; x &lt; width-border AND border &le; y &lt; height-border
91+
///
92+
/// @param border Border size in pixels.
11493
void setIgnoreBorder( int border );
11594

116-
/**
117-
* Returns the size of the image border.
118-
*
119-
* @return border size
120-
*/
95+
/// Returns the size of the image border.
96+
///
97+
/// @return border size
12198
int getIgnoreBorder();
12299

123-
/**
124-
* Species the search radius for the feature
125-
*
126-
* @param radius Radius in pixels
127-
*/
100+
/// Species the search radius for the feature
101+
///
102+
/// @param radius Radius in pixels
128103
void setSearchRadius( int radius );
129104

130-
/**
131-
* Describes how large the region is that is being searched. The radius is the number of
132-
* pixels away from the center.
133-
*
134-
* @return Search radius
135-
*/
105+
/// Describes how large the region is that is being searched. The radius is the number of
106+
/// pixels away from the center.
107+
///
108+
/// @return Search radius
136109
int getSearchRadius();
137110

138-
/**
139-
* True if it can detect local maximums.
140-
*/
111+
/// True if it can detect local maximums.
141112
boolean canDetectMaximums();
142113

143-
/**
144-
* True if it can detect local minimums.
145-
*/
114+
/// True if it can detect local minimums.
146115
boolean canDetectMinimums();
147116
}

0 commit comments

Comments
 (0)