Implement Butterworth filters
This commit is contained in:
@@ -18,15 +18,20 @@ public class FilteringService {
|
||||
return filteredMatrix.toImage();
|
||||
}
|
||||
|
||||
public Image butterworthLowPassFiltering(GrayScaleMatrix matrix, float percentage, int order) {
|
||||
double cutoff = percentage * getMaxCutoff(matrix.getWidth(), matrix.getHeight());
|
||||
GrayScaleMatrix filteredMatrix = GlobalLinearFiltering.butterworthLowPassFiltering(matrix, cutoff, order);
|
||||
return filteredMatrix.toImage();
|
||||
}
|
||||
|
||||
public Image butterworthHighPassFiltering(GrayScaleMatrix matrix, float percentage, int order) {
|
||||
double cutoff = percentage * getMaxCutoff(matrix.getWidth(), matrix.getHeight());
|
||||
GrayScaleMatrix filteredMatrix = GlobalLinearFiltering.butterworthHighPassFiltering(matrix, cutoff, order);
|
||||
return filteredMatrix.toImage();
|
||||
}
|
||||
|
||||
private double getMaxCutoff(int width, int height) {
|
||||
return Math.sqrt(Math.pow(width / 2.0, 2) + Math.pow(height / 2.0, 2));
|
||||
}
|
||||
|
||||
public Image butterworthLowPassFiltering(GrayScaleMatrix matrix, float v) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Image butterworthHighPassFiltering(GrayScaleMatrix matrix, float v) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user