first steps on lab 9

This commit is contained in:
Rémi Heredero 2021-12-20 21:23:46 +01:00
parent 14bec7a4f0
commit f7c76c1bcf
6 changed files with 30 additions and 5 deletions

Binary file not shown.

View File

@ -16,8 +16,9 @@ public class ImageFilters {
/**
* Write your code hereunder
*/
int[][] foo = a.clone();
return null;
return foo;
}
/**

View File

@ -5,18 +5,21 @@ public class ImageProcessing {
public static void main(String[] args) {
final String imageUsed = "/images/rice.jpg";
//final String imageUsed = "/images/rice.jpg";
final String imageUsed = "/images/imageProcessing.jpg";
final String imageUsed2 = "/images/imageProcessing_empty.jpg";
/**
* Create the windows from images
*/
ImageGraphics org = new ImageGraphics(imageUsed, "Original", -450, -250);
ImageGraphics cpy = new ImageGraphics(imageUsed, "Copy", 0, -250);
ImageGraphics org = new ImageGraphics(imageUsed, "Original", -450, -200);
ImageGraphics cpy = new ImageGraphics(imageUsed2, "Copy", 0, -200);
int[][] thePixels = org.getPixelsBW();
int[][] theCopy = ImageFilters.duplicate(thePixels);
//Simple copy and display
org.setPixelsBW(thePixels);
cpy.setPixelsBW(theCopy);
}
}

View File

@ -0,0 +1,21 @@
package lab9_image_processing;
public class TestArray {
public static void main(String[] args) {
double[] foo = new double[1000];
for (int i = 0; i < foo.length; i++) {
foo[i] = i+1;
}
System.out.println(new TestArray().average(foo));
}
public double average(double[] tableau){
double total = 0.0;
for (double d : tableau) {
total += d;
}
return (total/tableau.length);
}
}