SCBC, Life Connect Web-based Church Management System with Predictive Analytics 1
ENVERGA UNIVERSITY
Java
Digital Image Processing
Jubert A. Reyes
July 21, 2019
Submitted in partial fulfillment
of the requirements of
MIT205 Image Processing and Computer
Vision
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 2
ENVERGA UNIVERSITY
Table of Contents
Table of Contents .................................................................................................................. 2
List of Figures ........................................................................................................................ 3
I. GRAYSCALE CONVERSION ....................................................................................... 4
II. GRAYSCALE WITH COLOR ISOLATION ............................................................... 6
III. FLIP HORIZONTAL ................................................................................................. 8
IV. FLIP VERTICAL..................................................................................................... 10
V. ROTATE RIGHT......................................................................................................... 12
VI. ROTATE LEFT ....................................................................................................... 15
........................................................................................................................................... 16
VII. IMAGE SCALING ................................................................................................... 18
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 3
ENVERGA UNIVERSITY
List of Figures
Figure 1 - Grayscale Conversion, [Link]
Figure 2 - Grayscale Conversion, [Link]
Figure 3 - Grayscale with Color Isolation, [Link]
Figure 4 - Grayscale with Color Isolation, [Link]
Figure 5 - Flip Horizontal, [Link]
Figure 6 - Flip Horizontal, [Link]
Figure 7 - Flip Vertical, [Link]
Figure 8 - Flip Vertical, [Link]
Figure 9 - Rotate Right, [Link]
Figure 10 - Rotate Right, [Link]
Figure 11 - Rotate Left, [Link]
Figure 12 - Rotate Left, [Link]
Figure 13 - Image Scaling, [Link]
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 4
ENVERGA UNIVERSITY
I. GRAYSCALE CONVERSION
1. package ImgProcess;
2.
3. import [Link].*;
4. import [Link];
5. import [Link].*;
6. import [Link];
7.
8. public class GrayScale {
9.
10. BufferedImage image;
11. int width;
12. int height;
13.
14. public GrayScale() {
15.
16. try {
17. File input = new File("/Users/jubertreyes/Desktop/[Link]");
18. image = [Link](input);
19. width = [Link]();
20. height = [Link]();
21.
22. for(int i=0; i<height; i++) {
23.
24. for(int j=0; j<width; j++) {
25.
26. Color c = new Color([Link](j, i));
27. int red = (int)([Link]() * 0.299);
28. int green = (int)([Link]() * 0.587);
29. int blue = (int)([Link]() *0.114);
30. Color newColor = new Color(red+green+blue,
31.
32. red+green+blue,red+green+blue);
33.
34. [Link](j,i,[Link]());
35. }
36. }
37.
38. File ouptut = new File("/Users/jubertreyes/Desktop/[Link]");
39. [Link](image, "jpg", ouptut);
40.
41. } catch (IOException e) {}
42. }
43.
44. static public void main(String args[]) throws Exception {
45. GrayScale obj = new GrayScale();
46. }
47. }
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 5
ENVERGA UNIVERSITY
Figure 1 Grayscale Conversion, [Link]
Figure 2. Grayscale Conversion, [Link]
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 6
ENVERGA UNIVERSITY
II. GRAYSCALE WITH COLOR ISOLATION
1. package ImgProcess;
2.
3. import [Link].*;
4. import [Link];
5. import [Link].*;
6. import [Link];
7.
8. public final class RedOnly {
9.
10. BufferedImage image;
11. int width;
12. int height;
13.
14. public RedOnly() {
15.
16. try {
17. File input = new File("/Users/jubertreyes/Desktop/[Link]");
18. image = [Link](input);
19. width = [Link]();
20. height = [Link]();
21.
22. for(int i=0; i<height; i++) {
23.
24. for(int j=0; j<width; j++) {
25.
26. Color c = new Color([Link](j, i));
27. Color newColor;
28.
29. if(isRed([Link](), [Link](), [Link]() ))
30. {
31. int red = (int)([Link]());
32. int green = (int)([Link]());
33. int blue = (int)([Link]());
34. newColor = new Color(red, green, blue);
35. }
36. else
37. {
38. int red = (int)([Link]() * 0.299);
39. int green = (int)([Link]() * 0.587);
40. int blue = (int)([Link]() *0.114);
41. newColor = new Color(red+green+blue,
42. red+green+blue,red+green+blue);
43. }
44.
45. [Link](j,i,[Link]());
46. }
47. }
48.
49. File ouptut = new File("/Users/jubertreyes/Desktop/[Link]");
50. [Link](image, "jpg", ouptut);
51.
52. } catch (IOException e) {}
53. }
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 7
ENVERGA UNIVERSITY
54.
55. boolean isRed(int r, int g, int b) {
56. return r/3 > g && r/2 > b;
57. }
58.
59. static public void main(String args[]) throws Exception {
60. RedOnly obj = new RedOnly();
61. }
62. }
Figure 4. Grayscale with Color Isolation, [Link]
Figure 3. Grayscale with Color Isolation, [Link]
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 8
ENVERGA UNIVERSITY
III. FLIP HORIZONTAL
1. package ImgProcess;
2.
3. import [Link];
4. import [Link];
5. import [Link];
6. import [Link];
7.
8. public class FlipHoriz {
9.
10. BufferedImage image, image2;
11. int width;
12. int height;
13.
14. public FlipHoriz() {
15.
16. try {
17. File input = new File("/Users/jubertreyes/Desktop/[Link]");
18. image = [Link](input);
19. image2 = [Link](input);
20. width = [Link]();
21. height = [Link]();
22.
23. for (int i = 0; i < height; i++) {
24.
25. for (int j = 0; j < width; j++) {
26. [Link](j, i, [Link]([Link]() -j-1,i));
27.
28. }
29. }
30.
31. File output = new File("/Users/jubertreyes/Desktop/[Link]");
32. [Link](image2, "jpg", output);
33.
34. } catch (IOException e) {
35. }
36.
37. }
38.
39. static public void main(String args[]) throws Exception {
40. FlipHoriz obj = new FlipHoriz();
41. }
42. }
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 9
ENVERGA UNIVERSITY
Figure 6. Flip Horizontal, [Link]
Figure 5. Flip Horizontal, [Link]
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 10
ENVERGA UNIVERSITY
IV. FLIP VERTICAL
1. package ImgProcess;
2.
3. import [Link];
4. import [Link].*;
5. import [Link];
6.
7. public class FlipVert {
8.
9. BufferedImage image, image2;
10. int width;
11. int height;
12.
13. public FlipVert() {
14.
15. try {
16. File input = new File("/Users/jubertreyes/Desktop/[Link]");
17. image = [Link](input);
18. image2 = [Link](input);
19. width = [Link]();
20. height = [Link]();
21.
22. for(int i=0; i<height; i++) {
23.
24. for(int j=0; j<width; j++) {
25.
26. [Link](j, (height - 1) - i, [Link](j, i));
27. }
28. }
29.
30. File ouptut = new File("/Users/jubertreyes/Desktop/[Link]");
31. [Link](image2, "jpg", ouptut);
32.
33. } catch (IOException e) {}
34. }
35.
36. static public void main(String args[]) throws Exception {
37. FlipVert obj = new FlipVert();
38. }
39. }
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 11
ENVERGA UNIVERSITY
Figure 8. Flip Vertical, [Link]
Figure 7. Flip Vertical, [Link]
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 12
ENVERGA UNIVERSITY
V. ROTATE RIGHT
1. package ImgProcess;
2.
3. import [Link];
4. import [Link].*;
5. import [Link];
6.
7. public class RotateRight {
8.
9. BufferedImage image;
10. int width;
11. int height;
12.
13. public RotateRight() {
14.
15. try {
16. File input = new File("/Users/jubertreyes/Desktop/[Link]");
17. image = [Link](input);
18. // image2 = [Link](input);
19. width = [Link]();
20. height = [Link]();
21. BufferedImage image2 = new BufferedImage(height, width, [Link]());
22. for(int y=0; y<height; y++) {
23.
24. for(int x=0; x<width; x++) {
25.
26. [Link]((height-1)-y, x, [Link](x, y));
27. }
28. }
29.
30. File ouptut = new File("/Users/jubertreyes/Desktop/[Link]");
31. [Link](image2, "jpg", ouptut);
32.
33. } catch (IOException e) {}
34. }
35.
36. static public void main(String args[]) throws Exception {
37. RotateRight obj = new RotateRight();
38. }
39. }
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 13
ENVERGA UNIVERSITY
Figure 9. Rotate Right, [Link]
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 14
ENVERGA UNIVERSITY
Figure 10. Rotate Right, [Link]
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 15
ENVERGA UNIVERSITY
VI. ROTATE LEFT
1. package ImgProcess;
2.
3. import [Link];
4. import [Link].*;
5. import [Link];
6.
7. public class RotateLeft {
8.
9. BufferedImage image;
10. int width;
11. int height;
12.
13. public RotateLeft() {
14.
15. try {
16. File input = new File("/Users/jubertreyes/Desktop/[Link]");
17. image = [Link](input);
18. width = [Link]();
19. height = [Link]();
20.
21. BufferedImage image2 = new BufferedImage(height, width, [Link]());
22. for(int y=0; y<height; y++) {
23.
24. for(int x=0; x<width; x++) {
25. [Link](y, (width - 1) - x, [Link](x, y));
26. }
27. }
28.
29. File ouptut = new File("/Users/jubertreyes/Desktop/[Link]");
30. [Link](image2, "jpg", ouptut);
31.
32. } catch (IOException e) {}
33. }
34.
35. static public void main(String args[]) throws Exception {
36. RotateLeft obj = new RotateLeft();
37. }
38. }
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 16
ENVERGA UNIVERSITY
Figure 11. Rotate Left, [Link]
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 17
ENVERGA UNIVERSITY
Figure 12. Rotate Left, [Link]
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 18
ENVERGA UNIVERSITY
VII. IMAGE SCALING
1. package ImgProcess;
2.
3. import [Link];
4. import [Link].*;
5. import [Link];
6.
7. public class ReSize {
8.
9. BufferedImage image;
10. int width;
11. int height;
12. int i =2;
13. public ReSize() {
14.
15. try {
16. File input = new File("/Users/jubertreyes/Desktop/[Link]");
17. image = [Link](input);
18. width = [Link]();
19. height = [Link]();
20.
21. BufferedImage image2 = new BufferedImage(height, width, [Link]());
22.
23. for(int y=0; y<height; y++) {
24.
25. for(int x=0; x<width; x++) {
26.
27. [Link](x, y, [Link](x, y));
28. }
29. }
30. File ouptut = new File("/Users/jubertreyes/Desktop/[Link]");
31. [Link](image2, "jpg", ouptut);
32.
33. } catch (IOException e) {}
34. }
35. static public void main(String args[]) throws Exception {
36. ReSize obj = new ReSize();
37. }
38. }
SCBC, Life Connect Web-based Church Management System with Predictive Analytics 19
ENVERGA UNIVERSITY
Figure 13. Image Scaling, [Link]