Implement Butterworth filters

This commit is contained in:
2026-09-22 15:10:24 +02:00
parent b177ea5a38
commit 048ff5c792
9 changed files with 110 additions and 62 deletions

View File

@@ -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;
}
}