Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEADAS-005 (Filter Band: new filters added) #79

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
~ You should have received a copy of the GNU General Public License along
~ with this program; if not, see http://www.gnu.org/licenses/
-->
<!--Revisions:-->
<!--JAN2019 - Daniel Knowles - Updated with info about some existing and new filters-->

<html>
<head>
Expand Down Expand Up @@ -56,18 +58,44 @@ <h3>Create Filtered Band</h3>

<h4>Pre-defined Filters</h4>

<p>SNAP has the following pre-defined filters:</p>
<p>SNAP has the following categories of pre-defined filters:</p>

<ul>
<li><strong>Detect Lines</strong>: Horizontal Edges, Vertical Edges, Diagonal Edges, Compass Edge Detector, Roberts Cross</li>
<li><strong>Detect Gradients (Emboss)</strong>: Sobel</li>
<li><strong>Smooth and Blurr</strong>: Arithmetic Mean, Low-Pass</li>
<li><strong>Straylight</strong>: Straylight</li>
<li><strong>Sharpen</strong>: High-Pass</li>
<li><strong>Enhance Discontinuities</strong>: Laplace</li>
<li><strong>Non-Linear Filters</strong>: Minimum, Maximum, Mean, Median, Standard Deviation</li>
<li><strong>Morphological Filters</strong>: Erosion, Dilation, Opening, Closing</li>
</ul>


<p>Here is a description of a few of the pre-defined filters:</p>

<ul>
<li><strong>Arithmetic Mean 3x3</strong> Linear filter applied to a 3x3 grid with all pixels weighted equally and centered about the target pixel</li>
<li><strong>Arithmetic Mean 5x5</strong> Linear filter applied to a 5x5 grid with all pixels weighted equally and centered about the target pixel</li>
<li><strong>Arithmetic Mean 7x7</strong> Linear filter applied to a 7x7 grid with all pixels weighted equally and centered about the target pixel</li>
<li><strong>Weighted Circular Mean 3x3</strong> Linear filter applied to a 3x3 grid with pixels weighted to emulate a circle of 3 pixel diameter centered about the target pixel</li>
<li><strong>Weighted Circular Mean 5x5</strong> Linear filter applied to a 5x5 grid with pixels weighted to emulate a circle of 5 pixel diameter centered about the target pixel</li>
<li><strong>Weighted Mean 2x2</strong> Linear filter applied to a 3x3 grid with pixels weighted to emulate a 2x2 square grid centered about the target pixel</li>
<li><strong>Weighted Mean 4x4</strong> Linear filter applied to a 5x5 grid with pixels weighted to emulate a 4x4 square grid centered about the target pixel</li>
<li><strong>Straylight 3x3</strong> Same as the "Arithmetic Mean 3x3" filter but with the center pixel having zero weight such that all contribution comes from straylight</li>
<li><strong>Straylight 5x5</strong> Same as the "Arithmetic Mean 5x5" filter but with the center pixel having zero weight such that all contribution comes from straylight</li>
<li><strong>Straylight 5x5 #2</strong> Similar to the "Straylight 5x5" filter but with proximity weighting</li>
<li><strong>Straylight Circular (3x3)</strong> Same as the "Weighted Circular Mean 3x3" filter but with the center pixel having zero weight such that all contribution comes from straylight</li>
<li><strong>Straylight Circular (5x5)</strong> Same as the "Weighted Circular Mean 5x5" filter but with the center pixel having zero weight such that all contribution comes from straylight</li>
</ul>

<p><strong>Note:</strong> A key difference between the linear and non-linear filter is that for the linear filter, if any of the pixels contained within the
source grid are NaN then the resultant target pixel will be NaN. For the non-linear filter, if some (but not all) of the source pixels are NaN, then the
resultant target pixel will not be forced to be NaN.
</p>



<h4>User-defined Filters</h4>

<p>Users can define their own linear, non-linear, or morphological filters.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
*
* @author Norman
*/
// JAN2019 - Daniel Knowles - Added link to new Straylight filters

public class CreateFilteredBandDialog extends ModalDialog implements FilterSetForm.Listener {

public static final String TITLE = "Create Filtered Band"; /*I18N*/
Expand All @@ -41,6 +43,7 @@ public CreateFilteredBandDialog(Product product, String sourceBandName, String h
systemFilterSet.addFilter("Detect Lines", StandardFilters.LINE_DETECTION_FILTERS);
systemFilterSet.addFilter("Detect Gradients (Emboss)", StandardFilters.GRADIENT_DETECTION_FILTERS);
systemFilterSet.addFilter("Smooth and Blurr", StandardFilters.SMOOTHING_FILTERS);
systemFilterSet.addFilter("Straylight", StandardFilters.STRAYLIGHT_FILTERS);
systemFilterSet.addFilter("Sharpen", StandardFilters.SHARPENING_FILTERS);
systemFilterSet.addFilter("Enhance Discontinuities", StandardFilters.LAPLACIAN_FILTERS);
systemFilterSet.addFilter("Non-Linear Filters", StandardFilters.NON_LINEAR_FILTERS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
/**
* Created by Norman on 20.03.2014.
*/
// JAN2019 - Daniel Knowles - Added some new filters
// - Removed the "Arithmetic Mean 4x4" filter because it is misleading as it is not centered about the target pixel.

public class StandardFilters {
public static Filter[] LINE_DETECTION_FILTERS = {
new Filter("Horizontal Edges", "he", 3, 3, new double[]{
Expand Down Expand Up @@ -82,12 +85,10 @@ public class StandardFilters {
+1, +1, +1,
}, 9.0),

new Filter("Arithmetic Mean 4x4", "am4", 4, 4, new double[]{
+1, +1, +1, +1,
+1, +1, +1, +1,
+1, +1, +1, +1,
+1, +1, +1, +1,
}, 16.0),

// NOTE: Removed the "Arithmetic Mean 4x4" filter because it is misleading as it is not centered about the target pixel



new Filter("Arithmetic Mean 5x5", "am5", 5, 5, new double[]{
+1, +1, +1, +1, +1,
Expand All @@ -97,6 +98,55 @@ public class StandardFilters {
+1, +1, +1, +1, +1,
}, 25.0),

new Filter("Arithmetic Mean 7x7", "am7", 7, 7, new double[]{
+1, +1, +1, +1, +1, 1, 1,
+1, +1, +1, +1, +1, 1, 1,
+1, +1, +1, +1, +1, 1, 1,
+1, +1, +1, +1, +1, 1, 1,
+1, +1, +1, +1, +1, 1, 1,
+1, +1, +1, +1, +1, 1, 1,
+1, +1, +1, +1, +1, 1, 1,
}, 49.0),



// Linear filter applied to a 3x3 grid with pixels weighted to emulate 2x2 square grid centered about the target pixel
new Filter("Weighted Mean 2x2", "am2", 3, 3, new double[]{
0.25, 0.50, 0.25,
0.50, 1.00, 0.50,
0.25, 0.50, 0.25
}, 4.0),


// Linear filter applied to a 5x5 grid with pixels weighted to emulate 4x4 square grid centered about the target pixel
new Filter("Weighted Mean 4x4", "am4", 5, 5, new double[]{
0.25, 0.50, 0.50, 0.50, 0.25,
0.50, 1.00, 1.00, 1.00, 0.50,
0.50, 1.00, 1.00, 1.00, 0.50,
0.50, 1.00, 1.00, 1.00, 0.50,
0.25, 0.50, 0.50, 0.50, 0.25
}, 16.0),

// Linear filter applied to a 3x3 grid with pixels weighted to emulate a circle of 3 pixel diameter centered about the target pixel
new Filter("Weighted Circular Mean 3x3", "cm3", 3, 3, new double[]{
0.5454, 0.9717, 0.5454,
0.9717, 1.0000, 0.9717,
0.5454, 0.9717, 0.5454

}, 7.0684),


// Linear filter applied to a 5x5 grid with pixels weighted to emulate a circle of 5 pixel diameter centered about the target pixel
new Filter("Weighted Circular Mean 5x5", "cm5", 5, 5, new double[]{
0.1369, 0.7693, 0.9832, 0.7693, 0.1369,
0.7693, 1.0000, 1.0000, 1.0000, 0.7693,
0.9832, 1.0000, 1.0000, 1.0000, 0.9832,
0.7693, 1.0000, 1.0000, 1.0000, 0.7693,
0.1369, 0.7693, 0.9832, 0.7693, 0.1369
}, 19.6348),



new Filter("Low-Pass 3x3", "lp3", 3, 3, new double[]{
+1, +2, +1,
+2, +4, +2,
Expand All @@ -110,6 +160,61 @@ public class StandardFilters {
+1, +1, +1, +1, +1,
}, 60.0),
};



public static Filter[] STRAYLIGHT_FILTERS = {

// Same as the "Arithmetic Mean 3x3" filter but with the center pixel having zero weight such that all contribution comes from straylight
new Filter("Straylight 3x3", "str_am3", 3, 3, new double[]{
+1, +1, +1,
+1, +0, +1,
+1, +1, +1,
}, 8.0),


// Same as the "Arithmetic Mean 5x5" filter but with the center pixel having zero weight such that all contribution comes from straylight
new Filter("Straylight 5x5", "str_am5", 5, 5, new double[]{
+1, +1, +1, +1, +1,
+1, +1, +1, +1, +1,
+1, +1, +0, +1, +1,
+1, +1, +1, +1, +1,
+1, +1, +1, +1, +1,
}, 24.0),


// Similar to the "Straylight 5x5" filter but with proximity weighting
new Filter("Straylight 5x5 #2", "str_am52", 5, 5, new double[]{
+1, +1, +1, +1, +1,
+1, +2, +2, +2, +1,
+1, +2, 0, +2, +1,
+1, +2, +2, +2, +1,
+1, +1, +1, +1, +1,
}, 32.0),


// Same as the "Weighted Circular Mean 3x3" filter but with the center pixel having zero weight such that all contribution comes from straylight
new Filter("Straylight Circular (3x3)", "cm3", 3, 3, new double[]{
0.5454, 0.9717, 0.5454,
0.9717, 0.0000, 0.9717,
0.5454, 0.9717, 0.5454

}, 6.0684),


// Same as the "Weighted Circular Mean 5x5" filter but with the center pixel having zero weight such that all contribution comes from straylight
new Filter("Straylight Circular (5x5)", "cm5", 5, 5, new double[]{
0.1369, 0.7693, 0.9832, 0.7693, 0.1369,
0.7693, 1.0000, 1.0000, 1.0000, 0.7693,
0.9832, 1.0000, 0.0000, 1.0000, 0.9832,
0.7693, 1.0000, 1.0000, 1.0000, 0.7693,
0.1369, 0.7693, 0.9832, 0.7693, 0.1369
}, 18.6348),
};




public static Filter[] SHARPENING_FILTERS = {
new Filter("High-Pass 3x3 #1", "hp31", 3, 3, new double[]{
-1, -1, -1,
Expand Down