<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%> <%@ page import="java.io.*" %> <%@ page import="com.oreilly.servlet.*"%> <%@ page import="com.oreilly.servlet.multipart.*"%> <%@ page import="java.util.*"%> <%@ page import="java.io.*"%> <%@ page import="javax.imageio.*"%> <%@ page import="java.awt.image.*"%> Insert title here <% MultipartRequest multi = new MultipartRequest(request,"C:\\Upload", 5*1024*1024, "utf-8", new DefaultFileRenamePolicy()); String tmp; Enumeration files = multi.getFileNames(); tmp = (String)files.nextElement(); String filename = multi.getFilesystemName(tmp); int inW, inH,outW=0, outH=0; int count=1; File inFp; FileInputStream inFs; inFp = new File("C:/Upload/" + filename); // Ä®¶ó À̹ÌÁö ó¸® BufferedImage cImage = ImageIO.read(inFp); inW = cImage.getHeight(); inH = cImage.getWidth(); // (2) JSP¿¡¼­ ¹è¿­ ó¸® int[][][] inImage = new int[3][inH][inW]; // ¸Þ¸ð¸® ÇÒ´ç // ÆÄÀÏ --> ¸Þ¸ð¸® for (int i=0; i> 16) & 0xFF; // Red inImage[1][i][k] = (rgb >> 8) & 0xFF; // Green inImage[2][i][k] = (rgb ) & 0xFF; // Blue } } int[][][] outImage = null; // ¹ÝÀüÇϱâ(1) outH = inH; outW = inW; // ¸Þ¸ð¸® ÇÒ´ç outImage = new int[3][outH][outW]; // ÁøÂ¥ ¿µ»óó¸® ¾Ë°í¸®Áò for (int rgb=0; rgb<3; rgb++) for(int i=0; i ¹öÆÛÀ̹ÌÁö for (int i=0; i 255) value = 255; if (value < 0) value = 0; outImage[rgb][i][k] = value; } // (4) °á°ú¸¦ ÆÄÀÏ·Î ¾²±â outFname =Integer.toString(count) + filename ; outFp = new File("C:/Out/"+outFname); // Ä®¶ó À̹ÌÁö ÀúÀå outCImage = new BufferedImage(outH, outW, BufferedImage.TYPE_INT_RGB); outFs = new FileOutputStream(outFp.getPath()); // ¸Þ¸ð¸® --> ¹öÆÛÀ̹ÌÁö for (int i=0; i0){ value = (value+10)/10; // ÁøÂ¥ ¿µ»óó¸® ¾Ë°í¸®Áò for (int rgb=0; rgb<3; rgb++) for(int i=0; i 127){ if(pixel * value > 255 ) pixel = 255; pixel *= value; } else pixel /= value; outImage[rgb][i][k] = pixel; } } } else{ value = -(value - 10) / 10; // ÁøÂ¥ ¿µ»óó¸® ¾Ë°í¸®Áò for (int rgb=0; rgb<3; rgb++) for(int i=0; i 127){ if(pixel / value < 127 ) pixel = 127; pixel /= value; } else{ if(pixel * value > 127); pixel /= value; } outImage[rgb][i][k] = pixel; } } } // (4) °á°ú¸¦ ÆÄÀÏ·Î ¾²±â outFname = Integer.toString(count) + filename ; outFp = new File("C:/Out/"+outFname); // Ä®¶ó À̹ÌÁö ÀúÀå outCImage = new BufferedImage(outH, outW, BufferedImage.TYPE_INT_RGB); outFs = new FileOutputStream(outFp.getPath()); // ¸Þ¸ð¸® --> ¹öÆÛÀ̹ÌÁö for (int i=0; i 127) RGB = 255; else RGB=0; outImage[0][i][k] = RGB; outImage[1][i][k] = RGB; outImage[2][i][k] = RGB; } } // (4) °á°ú¸¦ ÆÄÀÏ·Î ¾²±â outFname = Integer.toString(count) + filename ; outFp = new File("C:/Out/"+outFname); // Ä®¶ó À̹ÌÁö ÀúÀå outCImage = new BufferedImage(outH, outW, BufferedImage.TYPE_INT_RGB); outFs = new FileOutputStream(outFp.getPath()); // ¸Þ¸ð¸® --> ¹öÆÛÀ̹ÌÁö for (int i=0; i high) high = pixel; } } low +=50; high -=50; for (int rgb=0; rgb<3; rgb++) for(int i=0; i255) outValue = 255; else if(outValue < 0) outValue = 0; outImage[rgb][i][k] = outValue; } } // (4) °á°ú¸¦ ÆÄÀÏ·Î ¾²±â outFname = Integer.toString(count) + filename ; outFp = new File("C:/Out/"+outFname); // Ä®¶ó À̹ÌÁö ÀúÀå outCImage = new BufferedImage(outH, outW, BufferedImage.TYPE_INT_RGB); outFs = new FileOutputStream(outFp.getPath()); // ¸Þ¸ð¸® --> ¹öÆÛÀ̹ÌÁö for (int i=0; i 255) x = 255; if(x < 0) x = 0; outImage[rgb][i][k] = x; } } // (4) °á°ú¸¦ ÆÄÀÏ·Î ¾²±â outFname = Integer.toString(count) + filename ; outFp = new File("C:/Out/"+outFname); // Ä®¶ó À̹ÌÁö ÀúÀå outCImage = new BufferedImage(outH, outW, BufferedImage.TYPE_INT_RGB); outFs = new FileOutputStream(outFp.getPath()); // ¸Þ¸ð¸® --> ¹öÆÛÀ̹ÌÁö for (int i=0; i 255) x = 255; if(x < 0) x = 0; outImage[rgb][i][k] = (int)x; } } // (4) °á°ú¸¦ ÆÄÀÏ·Î ¾²±â outFname = Integer.toString(count) + filename ; outFp = new File("C:/Out/"+outFname); // Ä®¶ó À̹ÌÁö ÀúÀå outCImage = new BufferedImage(outH, outW, BufferedImage.TYPE_INT_RGB); outFs = new FileOutputStream(outFp.getPath()); // ¸Þ¸ð¸® --> ¹öÆÛÀ̹ÌÁö for (int i=0; i 255) x = 255; if(x < 0) x = 0; outImage[rgb][i][k] = (int)x; } } // (4) °á°ú¸¦ ÆÄÀÏ·Î ¾²±â outFname = Integer.toString(count) + filename ; outFp = new File("C:/Out/"+outFname); // Ä®¶ó À̹ÌÁö ÀúÀå outCImage = new BufferedImage(outH, outW, BufferedImage.TYPE_INT_RGB); outFs = new FileOutputStream(outFp.getPath()); // ¸Þ¸ð¸® --> ¹öÆÛÀ̹ÌÁö for (int i=0; i 255) x = 255; if(x < 0) x = 0; outImage[rgb][i][k] = (int)x; } } // (4) °á°ú¸¦ ÆÄÀÏ·Î ¾²±â outFname = Integer.toString(count) + filename ; outFp = new File("C:/Out/"+outFname); // Ä®¶ó À̹ÌÁö ÀúÀå outCImage = new BufferedImage(outH, outW, BufferedImage.TYPE_INT_RGB); outFs = new FileOutputStream(outFp.getPath()); // ¸Þ¸ð¸® --> ¹öÆÛÀ̹ÌÁö for (int i=0; i255) v = 255; else if(v<0) v = 0; outImage[rgb][i][k] = v; } } // (4) °á°ú¸¦ ÆÄÀÏ·Î ¾²±â outFname = Integer.toString(count) + filename ; outFp = new File("C:/Out/"+outFname); // Ä®¶ó À̹ÌÁö ÀúÀå outCImage = new BufferedImage(outH, outW, BufferedImage.TYPE_INT_RGB); outFs = new FileOutputStream(outFp.getPath()); // ¸Þ¸ð¸® --> ¹öÆÛÀ̹ÌÁö for (int i=0; i=max) max = x; } } if(max > 255) max = 255; if(max < 0) max = 0; outImage[rgb][i][k] = (int)max; } } // (4) °á°ú¸¦ ÆÄÀÏ·Î ¾²±â outFname = Integer.toString(count) + filename ; outFp = new File("C:/Out/"+outFname); // Ä®¶ó À̹ÌÁö ÀúÀå outCImage = new BufferedImage(outH, outW, BufferedImage.TYPE_INT_RGB); outFs = new FileOutputStream(outFp.getPath()); // ¸Þ¸ð¸® --> ¹öÆÛÀ̹ÌÁö for (int i=0; i=max) max = x; x = Math.abs(tmpImage7[rgb][i][k+1] = tmpImage7[rgb][i+2][k+1]); if(x>=max) max = x; x = Math.abs(tmpImage7[rgb][i][k+2] = tmpImage7[rgb][i+2][k]); if(x>=max) max = x; x = Math.abs(tmpImage7[rgb][i+1][k+2] = tmpImage7[rgb][i+1][k]); if(x>=max) max = x; if(max > 255) max = 255; if(max < 0) max = 0; outImage[rgb][i][k] = (int)max; } } // (4) °á°ú¸¦ ÆÄÀÏ·Î ¾²±â outFname = Integer.toString(count) + filename ; outFp = new File("C:/Out/"+outFname); // Ä®¶ó À̹ÌÁö ÀúÀå outCImage = new BufferedImage(outH, outW, BufferedImage.TYPE_INT_RGB); outFs = new FileOutputStream(outFp.getPath()); // ¸Þ¸ð¸® --> ¹öÆÛÀ̹ÌÁö for (int i=0; i 255) x = 255; if(x < 0) x = 0; outImage[rgb][i][k] = x; } } // (4) °á°ú¸¦ ÆÄÀÏ·Î ¾²±â outFname = Integer.toString(count) + filename ; outFp = new File("C:/Out/"+outFname); // Ä®¶ó À̹ÌÁö ÀúÀå outCImage = new BufferedImage(outH, outW, BufferedImage.TYPE_INT_RGB); outFs = new FileOutputStream(outFp.getPath()); // ¸Þ¸ð¸® --> ¹öÆÛÀ̹ÌÁö for (int i=0; i 255) x = 255; if(x < 0) x = 0; outImage[rgb][i][k] = x; } } // (4) °á°ú¸¦ ÆÄÀÏ·Î ¾²±â outFname = Integer.toString(count) + filename ; outFp = new File("C:/Out/"+outFname); // Ä®¶ó À̹ÌÁö ÀúÀå outCImage = new BufferedImage(outH, outW, BufferedImage.TYPE_INT_RGB); outFs = new FileOutputStream(outFp.getPath()); // ¸Þ¸ð¸® --> ¹öÆÛÀ̹ÌÁö for (int i=0; i 255) x = 255; if(x < 0) x = 0; outImage[rgb][i][k] = (int)x; } } // (4) °á°ú¸¦ ÆÄÀÏ·Î ¾²±â outFname = Integer.toString(count) + filename ; outFp = new File("C:/Out/"+outFname); // Ä®¶ó À̹ÌÁö ÀúÀå outCImage = new BufferedImage(outH, outW, BufferedImage.TYPE_INT_RGB); outFs = new FileOutputStream(outFp.getPath()); // ¸Þ¸ð¸® --> ¹öÆÛÀ̹ÌÁö for (int i=0; i ¹öÆÛÀ̹ÌÁö for (int i=0; i ¹öÆÛÀ̹ÌÁö for (int i=0; i ¾Ë°í¸®Áò¿¡ ÀÇÁ¸ outH = (int)(inH/2); outW = (int)(inW/2); // ¸Þ¸ð¸® ÇÒ´ç outImage = new int[3][outH][outW]; // ÁøÂ¥ ¿µ»óó¸® ¾Ë°í¸®Áò for (int rgb=0; rgb<3; rgb++) for(int i=0; i ¹öÆÛÀ̹ÌÁö for (int i=0; i ¹öÆÛÀ̹ÌÁö for (int i=0; i ¹öÆÛÀ̹ÌÁö for (int i=0; i ¹öÆÛÀ̹ÌÁö for (int i=0; i