\r
BufferedImage input_image;\r
BufferedImage output_image;\r
+ BufferedImage output_image_gray;\r
BufferedImage image;\r
int width;\r
int height;\r
public void setUp() throws Exception {\r
LoadFile file = new LoadFile();\r
input_image = file.Load_File("test.jpg");\r
- \r
- BlackandWhite bw_image = new BlackandWhite();\r
- output_image = bw_image.Black_and_White(input_image);\r
+\r
}\r
\r
/**\r
\r
@Test\r
public void testBlackandWhite() {\r
- \r
+ BlackandWhite bw_image = new BlackandWhite();\r
+ output_image = bw_image.Black_and_White(input_image);\r
+ \r
try {\r
\r
width = output_image.getWidth();\r
} catch (Exception e) {}\r
\r
}\r
-\r
+ @Test\r
+ public void testGray() {\r
+ GrayScale g_image = new GrayScale();\r
+ output_image_gray = g_image.Gray_Scale(input_image);\r
+ try {\r
+ \r
+ width = output_image_gray.getWidth();\r
+ height = output_image_gray.getHeight();\r
+ \r
+ for(int i=0; i<height; i++){\r
+ \r
+ for(int j=0; j<width; j++){\r
+ \r
+ Color c = new Color(output_image_gray.getRGB(j, i));\r
+ \r
+ int red = (int)c.getRed();\r
+ int green = (int)c.getGreen();\r
+ int blue = (int)c.getBlue();\r
+ \r
+ assertTrue((red==green)&&(red==blue));\r
+ \r
+ }\r
+ } \r
+ } catch (Exception e) {}\r
+ \r
+ }\r
}\r