Sathwikchowdary commited on
Commit
54df7c2
·
verified ·
1 Parent(s): 9eb0fcc

Update pages/Info _of_Image.py

Browse files
Files changed (1) hide show
  1. pages/Info _of_Image.py +72 -46
pages/Info _of_Image.py CHANGED
@@ -1,6 +1,4 @@
1
  import streamlit as st
2
- import pandas as pd
3
- import numpy as np
4
 
5
  # Custom CSS for styling
6
  custom_css = """
@@ -23,65 +21,93 @@ custom_css = """
23
  p {
24
  color: #FFFFFF; /* White text for paragraphs */
25
  }
 
 
 
 
 
 
 
 
 
26
  </style>
27
  """
28
 
29
  # Inject the CSS into the app
30
  st.markdown(custom_css, unsafe_allow_html=True)
 
 
31
  st.markdown("<h2 style='text-align: left; color: Black;'>What is IMAGE</h2>", unsafe_allow_html=True)
32
  st.markdown(
33
  "<p style='font-size: 16px; color: White; font-style: italic;'>"
34
- "An image is a visual depiction of a subject, such as a person, object, scene, or idea, created or captured through means like photography, drawing, painting, or digital tools. It can take various forms, including photographs, illustrations, artworks, or computer-generated visuals."
35
- "</p>",
36
- unsafe_allow_html=True
37
- )
38
- st.markdown("<h2 style='text-align: left; color: Black;'>Features of IMAGE</h2>", unsafe_allow_html=True)
39
- st.markdown(
40
- "<p style='font-size: 16px; color: White; font-style: italic;'>"
41
- "Pixels: Images are composed of small dots called pixels, each containing color data that together create the overall image."
42
- "</p>",
43
- unsafe_allow_html=True
44
- )
45
- st.markdown(
46
- "<p style='font-size: 16px; color: White; font-style: italic;'>"
47
- "File Formats: Images can be stored in different formats,"
48
- "JPEG/JPG: Widely used for photographs and online images due to their efficient balance between quality and file size."
49
- "PNG: Preferred for high-quality visuals or images requiring transparency, such as logos."
50
- "GIF: Commonly utilized for basic animations or compact graphics."
51
- "</p>",
52
- unsafe_allow_html=True
53
- )
54
- st.markdown("<h2 style='text-align: left; color: Black;'>Basic Operations in IMAGE</h2>", unsafe_allow_html=True)
55
- st.markdown(
56
- "<p style='font-size: 16px; color: White; font-style: italic;'>"
57
- "For performing this Basic Operations we use cv2 function from opencv library"
58
- "cv2 is the Python module for OpenCV (Open Source Computer Vision Library), a powerful library used for computer vision and image processing tasks. It provides a wide range of tools and algorithms for analyzing and manipulating images and videos."
59
  "</p>",
60
  unsafe_allow_html=True
61
  )
62
- st.markdown("<h3 style='text-align: left; color: Black;'>Why cv2 is Used</h3>", unsafe_allow_html=True)
63
- st.markdown(
64
- "<p style='font-size: 16px; color: White; font-style: italic;'>"
65
- "cv2 is used for various ways like:"
66
- "1.Image Processing"
67
- "2.Video Analysis"
68
- "3.Feature Detection"
69
- "4.Image Transformations"
70
- "</p>",
71
- unsafe_allow_html=True
72
- )
73
- st.markdown("<h3 style='text-align: left; color: Black;'>Operations Used</h3>", unsafe_allow_html=True)
74
- st.markdown("1.imread()")
75
- st.markdown("2.imshow()")
76
- st.markdown("3.imwrite()")
77
- st.markdown("4.cv2.waitkey()")
78
- st.markdown("5.destroyallwindows()")
79
 
80
- # Add a link to the code
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  st.markdown(
82
  "<p style='font-size: 16px; color: White;'>"
83
  "You can view and run the code in Colab: "
84
  "<a href='https://colab.research.google.com/drive/1fvP-k70HJnp1iCN7Vs-tkfFs8vq--WGc?usp=sharing' target='_blank' style='color: #FFD700;'>Colab Notebook</a>"
85
  "</p>",
86
  unsafe_allow_html=True
87
- )
 
1
  import streamlit as st
 
 
2
 
3
  # Custom CSS for styling
4
  custom_css = """
 
21
  p {
22
  color: #FFFFFF; /* White text for paragraphs */
23
  }
24
+ button {
25
+ font-size: 16px;
26
+ font-weight: bold;
27
+ padding: 10px 20px;
28
+ margin: 10px 5px;
29
+ border-radius: 10px;
30
+ border: none;
31
+ cursor: pointer;
32
+ }
33
  </style>
34
  """
35
 
36
  # Inject the CSS into the app
37
  st.markdown(custom_css, unsafe_allow_html=True)
38
+
39
+ # Page Content
40
  st.markdown("<h2 style='text-align: left; color: Black;'>What is IMAGE</h2>", unsafe_allow_html=True)
41
  st.markdown(
42
  "<p style='font-size: 16px; color: White; font-style: italic;'>"
43
+ "An image is a visual depiction of a subject, such as a person, object, scene, or idea, created or captured through means like photography, drawing, painting, or digital tools."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  "</p>",
45
  unsafe_allow_html=True
46
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
+ # Buttons
49
+ col1, col2, col3 = st.columns(3)
50
+ with col1:
51
+ if st.button("Colour Space"):
52
+ st.markdown("<h3 style='text-align: left; color: Gold;'>Colour Space</h3>", unsafe_allow_html=True)
53
+ st.markdown(
54
+ "<p style='font-size: 16px; color: White;'>"
55
+ "Colour spaces define how colors are represented in an image. Common spaces include RGB (Red, Green, Blue), HSV (Hue, Saturation, Value), and LAB. "
56
+ "Using OpenCV, you can convert between color spaces with functions like `cv2.cvtColor()`."
57
+ "</p>",
58
+ unsafe_allow_html=True
59
+ )
60
+
61
+ with col2:
62
+ if st.button("Video Formation"):
63
+ st.markdown("<h3 style='text-align: left; color: Gold;'>Video Formation</h3>", unsafe_allow_html=True)
64
+ st.markdown(
65
+ "<p style='font-size: 16px; color: White;'>"
66
+ "To create videos, you can use OpenCV's `cv2.VideoWriter` class. It allows capturing frames and saving them as a video file. "
67
+ "Specify the codec, frame rate, and resolution for the output."
68
+ "</p>",
69
+ unsafe_allow_html=True
70
+ )
71
+ st.markdown(
72
+ "<p style='font-size: 16px; color: White;'>Example:</p>"
73
+ "<pre style='background: #333; color: white; padding: 10px;'>"
74
+ "import cv2\n"
75
+ "fourcc = cv2.VideoWriter_fourcc(*'XVID')\n"
76
+ "out = cv2.VideoWriter('output.avi', fourcc, 20.0, (640, 480))\n"
77
+ "# Capture frames and write them using out.write(frame)"
78
+ "</pre>",
79
+ unsafe_allow_html=True
80
+ )
81
+
82
+ with col3:
83
+ if st.button("Affine Methods"):
84
+ st.markdown("<h3 style='text-align: left; color: Gold;'>Affine Methods</h3>", unsafe_allow_html=True)
85
+ st.markdown(
86
+ "<p style='font-size: 16px; color: White;'>"
87
+ "Affine transformations involve operations like scaling, rotating, and translating images. OpenCV functions like `cv2.getAffineTransform` "
88
+ "and `cv2.warpAffine` are used for these tasks."
89
+ "</p>",
90
+ unsafe_allow_html=True
91
+ )
92
+ st.markdown(
93
+ "<p style='font-size: 16px; color: White;'>Example:</p>"
94
+ "<pre style='background: #333; color: white; padding: 10px;'>"
95
+ "import cv2\n"
96
+ "import numpy as np\n"
97
+ "rows, cols = img.shape[:2]\n"
98
+ "pts1 = np.float32([[50, 50], [200, 50], [50, 200]])\n"
99
+ "pts2 = np.float32([[10, 100], [200, 50], [100, 250]])\n"
100
+ "M = cv2.getAffineTransform(pts1, pts2)\n"
101
+ "dst = cv2.warpAffine(img, M, (cols, rows))\n"
102
+ "</pre>",
103
+ unsafe_allow_html=True
104
+ )
105
+
106
+ # Link to Colab
107
  st.markdown(
108
  "<p style='font-size: 16px; color: White;'>"
109
  "You can view and run the code in Colab: "
110
  "<a href='https://colab.research.google.com/drive/1fvP-k70HJnp1iCN7Vs-tkfFs8vq--WGc?usp=sharing' target='_blank' style='color: #FFD700;'>Colab Notebook</a>"
111
  "</p>",
112
  unsafe_allow_html=True
113
+ )