first steps on lab 9
This commit is contained in:
parent
14bec7a4f0
commit
f7c76c1bcf
Binary file not shown.
Binary file not shown.
BIN
src/lab9_image_processing/09b-ImageProcessing-FR.pdf
Normal file
BIN
src/lab9_image_processing/09b-ImageProcessing-FR.pdf
Normal file
Binary file not shown.
@ -16,8 +16,9 @@ public class ImageFilters {
|
|||||||
/**
|
/**
|
||||||
* Write your code hereunder
|
* Write your code hereunder
|
||||||
*/
|
*/
|
||||||
|
int[][] foo = a.clone();
|
||||||
|
|
||||||
return null;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,18 +5,21 @@ public class ImageProcessing {
|
|||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
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
|
* Create the windows from images
|
||||||
*/
|
*/
|
||||||
ImageGraphics org = new ImageGraphics(imageUsed, "Original", -450, -250);
|
ImageGraphics org = new ImageGraphics(imageUsed, "Original", -450, -200);
|
||||||
ImageGraphics cpy = new ImageGraphics(imageUsed, "Copy", 0, -250);
|
ImageGraphics cpy = new ImageGraphics(imageUsed2, "Copy", 0, -200);
|
||||||
|
|
||||||
int[][] thePixels = org.getPixelsBW();
|
int[][] thePixels = org.getPixelsBW();
|
||||||
int[][] theCopy = ImageFilters.duplicate(thePixels);
|
int[][] theCopy = ImageFilters.duplicate(thePixels);
|
||||||
|
|
||||||
// Simple copy and display
|
//Simple copy and display
|
||||||
|
org.setPixelsBW(thePixels);
|
||||||
cpy.setPixelsBW(theCopy);
|
cpy.setPixelsBW(theCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
src/lab9_image_processing/TestArray.java
Normal file
21
src/lab9_image_processing/TestArray.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user