Sei sulla pagina 1di 5

* Project Name: Image Viewer

* Programmer: msi_333
* Type: Multimedia
* Technology: Java
* IDE: NetBeans
* Description: This is an image processing project created using java. Includes many image filters
with different sizes and for different uses on images :
- Applying Filters
1- Threshold (using dynamic threashold).
2- Invert .
3- Yellow Invert.
4- 3x3 Blur .
5- 3x3 Sharpen .
6- 3x3 Edge Detection.
7- 5x5 Edge Detection.
8- Custom Filter (user enter any Filter).
9- Canny Detector.

- Applying Noise
1- Gaussian Noise.
2- Impluse Noise.

- Applying Enhancement
1 - Binirization (Using Threashold)
2 - Brightness
- Image Operations :
1- Zoom out.
2- Zoom in.
3- Rotation CCW.
4- Rotation CC.
5- Select (Part of image).
6- RGB Histogram.

Other Features :
- Can Load any image with extention (jpg,gif,png) and make the operations on it then he can save
it on the harddisk.
- User can refresh the Orginal Image at any time to get it back.
- Can Print the image after operations.
- The user can make more than one operations after each other on the same image. For example
he can user Invert filter then use edge 3x3 filter then he can save image.
Attachment:
File comment: Screenshots

ImageViewer1.GIF [ 67.83 KiB | Viewed 9609 times ]

This projects have follow structure


Code:
Package : EnhancementOpr , includes
/Binirization.java
/Filter.java

Binirization.java :
java code
?
package EnhancementOpr;
1 import java.lang.reflect.Array;
2 import java.awt.*;
3 import java.awt.event.*;
4 import java.awt.image.*;
import java.awt.geom.GeneralPath;
5 import com.sun.image.codec.jpeg.*;
6 import java.io.*;
7 import javax.imageio.*;
8 import java.awt.image.BufferedImage;
9
10 /**
*
11 * @author sami
12 */
13 public class Binirization {
14
15 public static int THRESHABOVE = 255;
16 public static int THRESHBELOW = 0;
private BufferedImage bufi;
17 private Raster data;
18 private DataBuffer datab;
19 private int width, height;
20 private int threshold;
21 private int datav [];
private int datanew[];
22 private BufferedImage bufnew;
23 /** Creates a new instance of Binirization */
24 public Binirization(BufferedImage newimg) {
25 bufi=newimg;
}
26
27 public static int getColor(int b, int g, int r) {
28 return (int)Math.pow(2,16)*r + 256*g + b;
29 }
30 public void setThreshold(int threshold){
31 this.threshold=threshold;
}
32
33 public int getWidth(){
34 return data.getWidth();
35 }
36
37 public int getHight(){
38 return data.getHeight();
}
39
40 public void DoBinirization(){
41
42
43 width=bufi.getWidth();
44 height=bufi.getHeight();
45 BufferedImage bi = new BufferedImage(width, height,bufi.getType());
46 for(int i=0;i<width;i++) {
for(int j=0;j<height;j++) {
47 int rgb =bufi.getRGB(i,j);
48
49 int r = (rgb >> 16) & 0xff;
50 int g = (rgb >> <img src="./images/smilies/icon_cool.gif" alt="8)" titl
51 int b = (rgb >> 0) & 0xff;
52
53 // Calculate the brightness
if(r>threshold||g>threshold||b>threshold)
54 {
55 r=255;
56 g=255;
57 b=255;
}
58
else
59 {
60 r=0;
61 g=0;
62 b=0;
}
63
64
65 // Return the result
66 rgb= (rgb & 0xff000000) | (r << 16) | (g << <img src="./images/smilies
67 bi.setRGB(i, j,rgb);
}
68
69 bufnew=bi;
70
71 }
72 }
73
74 public BufferedImage getImg(){
75
76 return bufnew;
}
77
78
79
80 }
81
82
83
84
85
86
87
88
89
90
91
92
93
94
Filter.java :
java code
?
package EnhancementOpr;
1 import java.io.*;
2 import java.awt.image.*;
3
4
5 public abstract class Filter {
6
7 public abstract BufferedImage filter(BufferedImage image, BufferedImage output);
8
9
10 public BufferedImage filter(BufferedImage image) {
return filter(image, null);
11 }
12
13
14 public BufferedImage verifyOutput(BufferedImage output, BufferedImage input) {
15 return verifyOutput(output, input.getWidth(), input.getHeight(), input.getType
16 }
17
18
public BufferedImage verifyOutput(BufferedImage output, BufferedImage input, int ty
19 return verifyOutput(output, input.getWidth(), input.getHeight(), type);
20 }
21
22 public BufferedImage verifyOutput(BufferedImage output, int width, int height, int t
23
24 if (output != null && output.getWidth() == width &&
25 output.getHeight() == height && output.getType() == type) return outpu
26
return new BufferedImage(width, height, type);
27 }
28 }
29
30
31
32

Code:
Package : imageviewer , includes
/CustomFilter.java
/EdgeDetector.java
/EnhancementPanel.java
/Image_Print.java
/ImageComponent.java
/ImageProcess.java
/Main.java
/noisePanel.java
/RGBFrame.java
/ShowFrame.java
/ViewerFrame.java
/NoiseFilters
/NoiseFilters/NoiseFilter.java

Potrebbero piacerti anche