Sathwikchowdary commited on
Commit
4e4ee5e
·
verified ·
1 Parent(s): 362ac29

Update pages/Translation_Affine.py

Browse files
Files changed (1) hide show
  1. pages/Translation_Affine.py +101 -0
pages/Translation_Affine.py CHANGED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import numpy as np
4
+
5
+ # Custom CSS for styling
6
+ custom_css = """
7
+ <style>
8
+ html, body, [data-testid="stAppViewContainer"] {
9
+ background-image: linear-gradient(
10
+ rgba(0, 0, 0, 0.6),
11
+ rgba(0, 0, 0, 0.6)
12
+ ),
13
+ url("https://www.istockphoto.com/photo/tech-or-space-background-abstract-3d-illustration-gm1367865109-437999705?utm_source=pixabay&utm_medium=affiliate&utm_campaign=SRP_photo_sponsored&utm_content=https%3A%2F%2Fpixabay.com%2Fphotos%2Fsearch%2Fbackground%2520datascience%2F&utm_term=background+datascience.jpg");
14
+ background-size: cover;
15
+ background-position: center;
16
+ background-repeat: no-repeat;
17
+ background-attachment: fixed;
18
+ color: white; /* Ensures all text is readable */
19
+ }
20
+ h2, h3 {
21
+ color: #FFD700; /* Gold color for headings */
22
+ }
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
+
32
+ st.markdown("<h2 style='text-align: left; color: Black;'>What is Translation </h2>", unsafe_allow_html=True)
33
+ st.markdown(
34
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
35
+ "Translation of an Image refers to the process of shifting an image in the horizontal (x-axis) and vertical (y-axis) directions without altering its dimensions or content. In computer vision and image processing, this operation is performed using geometric transformations."
36
+ "</p>",
37
+ unsafe_allow_html=True
38
+ )
39
+ st.markdown(
40
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
41
+ "Steps to Translate an Image:"
42
+ "</p>",
43
+ unsafe_allow_html=True
44
+ )
45
+ st.markdown(
46
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
47
+ "Load the image using cv2.imread()."
48
+ "</p>",
49
+ unsafe_allow_html=True
50
+ )
51
+ st.markdown(
52
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
53
+ "Create a translation matrix specifying the x and y shifts."
54
+ "</p>",
55
+ unsafe_allow_html=True
56
+ )
57
+ st.markdown(
58
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
59
+ "Use the cv2.warpAffine() function to apply the translation."
60
+ "</p>",
61
+ unsafe_allow_html=True
62
+ )
63
+ st.markdown("<h2 style='text-align: left; color: Black;'>What is Affine </h2>", unsafe_allow_html=True)
64
+ st.markdown(
65
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
66
+ "An Affine Transformation is a geometric operation that maintains the integrity of points, straight lines, and planes. It encompasses actions such as translation, scaling, rotation, reflection, and shearing. While it does not guarantee the preservation of angles or distances, it ensures that parallel lines remain parallel throughout the transformation."
67
+ "</p>",
68
+ unsafe_allow_html=True
69
+ )
70
+ st.markdown("<h3 style='text-align: left; color: Black;'> Affine Methods </h3>", unsafe_allow_html=True)
71
+ st.markdown(
72
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
73
+ "OpenCV provides the cv2.warpAffine() function to apply affine transformations."
74
+ "</p>",
75
+ unsafe_allow_html=True
76
+ )
77
+ st.markdown(
78
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
79
+ "Translation: Shifts the image by a certain amount in the x and y directions."
80
+ "</p>",
81
+ unsafe_allow_html=True
82
+ )
83
+ st.markdown(
84
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
85
+ "Scaling: Resizes the image by a scaling factor."
86
+ "</p>",
87
+ unsafe_allow_html=True
88
+ )
89
+ st.markdown(
90
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
91
+ "Rotation: Rotates the image around a specified center."
92
+ "</p>",
93
+ unsafe_allow_html=True
94
+ )
95
+ st.markdown(
96
+ "<p style='font-size: 16px; color: White; font-style: italic;'>"
97
+ "Shearing: Skews the image in one direction (x or y)."
98
+ "</p>",
99
+ unsafe_allow_html=True
100
+ )
101
+