Update architecture
This commit is contained in:
@@ -22,4 +22,11 @@ public class FilteringService {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package services;
|
||||
|
||||
import app.state.AppState;
|
||||
import com.google.inject.Inject;
|
||||
import domain.image.Image;
|
||||
import domain.image.GrayScaleMatrix;
|
||||
import domain.image.Image;
|
||||
import domain.image.processing.complex.ComplexMatrix;
|
||||
import domain.image.processing.fourier.Fourier;
|
||||
import infrastructure.image.io.ImageLoader;
|
||||
@@ -17,42 +15,25 @@ import java.io.IOException;
|
||||
*/
|
||||
public class ImageService {
|
||||
|
||||
private final AppState appState;
|
||||
|
||||
@Inject
|
||||
public ImageService(AppState appState) {
|
||||
this.appState = appState;
|
||||
public Image createImage(int red, int green, int blue, int height, int width) {
|
||||
return new Image(red, green, blue, height, width);
|
||||
}
|
||||
|
||||
public void createImage(int red, int green, int blue, int height, int width) {
|
||||
Image image = new Image(red, green, blue, height, width);
|
||||
appState.setImage(image);
|
||||
}
|
||||
|
||||
public void loadImage(File f) throws IOException {
|
||||
Image image = ImageLoader.loadImage(f);
|
||||
appState.setImage(image);
|
||||
public Image loadImage(File file) throws IOException {
|
||||
return ImageLoader.loadImage(file);
|
||||
}
|
||||
|
||||
public void saveImage(Image image) throws IOException {
|
||||
ImageSaver.saveImage(image);
|
||||
}
|
||||
|
||||
public ComplexMatrix computeFourier(){
|
||||
GrayScaleMatrix matrix = appState.getImage().toGrayScale();
|
||||
public ComplexMatrix computeFourier(Image image) {
|
||||
GrayScaleMatrix matrix = image.toGrayScale();
|
||||
ComplexMatrix fourier = Fourier.Fourier2D(matrix.getRawData());
|
||||
return Fourier.decroise(fourier);
|
||||
}
|
||||
|
||||
public Image getImage(){
|
||||
return appState.getImage();
|
||||
public GrayScaleMatrix getGrayScale(Image image) {
|
||||
return image.toGrayScale();
|
||||
}
|
||||
|
||||
public void setImage(Image img){
|
||||
appState.setImage(img);
|
||||
}
|
||||
|
||||
public GrayScaleMatrix getGrayScale(){
|
||||
return appState.getImage().toGrayScale();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user