displayName to path
This commit is contained in:
1 parent
6b98475e32
commit
64e784aecb
4 files changed
+20
-17
No files matched your search
@@ -5,13 +5,13 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
public abstract class Parameter {
|
||||
private final String name;
|
||||
private final String displayName;
|
||||
private final String path;
|
||||
private final String type;
|
||||
private Object value;
|
||||
|
||||
public Parameter(String name, String displayName, String type) {
|
||||
public Parameter(String name, String path, String type) {
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
this.path = path;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ public abstract class Parameter {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
@@ -30,7 +30,7 @@ public abstract class Parameter {
|
||||
public ObjectNode getNode(ObjectMapper mapper) {
|
||||
ObjectNode node = mapper.createObjectNode();
|
||||
node.put("name", this.name);
|
||||
node.put("displayName", this.displayName);
|
||||
node.put("path", this.path);
|
||||
node.put("type", this.type);
|
||||
return node;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
public class SelectParameter extends Parameter {
|
||||
private final String[] options;
|
||||
|
||||
public SelectParameter(String name, String displayName, String[] options) {
|
||||
super(name, displayName, "select");
|
||||
public SelectParameter(String name, String path, String[] options) {
|
||||
super(name, path, "select");
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public class AlgorithmController {
|
||||
|
||||
algorithms.add(new Algorithm("Filtre négatif", "negative", new ArrayList<Parameter>(),
|
||||
(Planar<GrayU8> input, List<Object> para) -> {
|
||||
ImageProcessing.oppositeColors(input);
|
||||
ImageProcessing.negativeFilter(input);
|
||||
}));
|
||||
|
||||
algorithms.add(new Algorithm("Filtre sépia", "sepia", new ArrayList<Parameter>(),
|
||||
@@ -86,7 +86,11 @@ public class AlgorithmController {
|
||||
(Planar<GrayU8> input, List<Object> para) -> {
|
||||
ImageProcessing.deleteArea(input, (int[]) para.get(0), FillingType.valueOf((String) para.get(1)));
|
||||
}));
|
||||
|
||||
algorithms.add(new Algorithm("Filtre de bruit", "noise",
|
||||
Arrays.asList(new IntegerParameter("intensity", "Intensité", 1, 100, 1)),
|
||||
(Planar<GrayU8> input, List<Object> para) -> {
|
||||
ImageProcessing.gaussianNoiseFilter(input, (int) para.get(0));
|
||||
}));
|
||||
return algorithms;
|
||||
}
|
||||
|
||||
|
||||
@@ -502,7 +502,7 @@ public final class ImageProcessing {
|
||||
*
|
||||
* @param input L'image à inverser
|
||||
*/
|
||||
public static void oppositeColors(Planar<GrayU8> input) {
|
||||
public static void negativeFilter(Planar<GrayU8> input) {
|
||||
BoofConcurrency.loopFor(0, input.height, y -> {
|
||||
for (int x = 0; x < input.width; x++) {
|
||||
for (int j = 0; j < input.getNumBands(); j++) {
|
||||
@@ -733,18 +733,17 @@ public final class ImageProcessing {
|
||||
/**
|
||||
* Effectue un filtre de type bruit gaussien sur l'image donnée en paramètre.
|
||||
*
|
||||
* @param input L'image à modifier
|
||||
* @param mean La moyenne du bruit
|
||||
* @param stdDev L'écart type du bruit
|
||||
* @param input L'image à modifier
|
||||
* @param intensity L'intensité du bruit
|
||||
*/
|
||||
public static void gaussianNoiseFilter(Planar<GrayU8> input, double mean, double stdDev) {
|
||||
public static void gaussianNoiseFilter(Planar<GrayU8> input, int intensity) {
|
||||
BoofConcurrency.loopFor(0, input.height, y -> {
|
||||
for (int x = 0; x < input.width; x++) {
|
||||
int rgb[] = getRGBValue(input, x, y);
|
||||
for (int i = 0; i < rgb.length; i++) {
|
||||
for (int i = 0; i < input.getNumBands(); i++) {
|
||||
Random rand = new Random();
|
||||
// Genere une valeur de bruit aleatoire a partir d'une distribution gaussienne
|
||||
double noise = rand.nextGaussian() * stdDev + mean;
|
||||
double noise = rand.nextGaussian() * intensity * 10;
|
||||
rgb[i] = (int) Math.round(rgb[i] + noise);
|
||||
// On vérifie que la valeur est comprise entre 0 et 255
|
||||
rgb[i] = Math.max(0, Math.min(255, rgb[i]));
|
||||
|
||||
Reference in new issue
Block a user