ronakreddy18 commited on
Commit
5e04dd7
·
verified ·
1 Parent(s): 7d30b60

Update pages/LIFE_CYCLE_OF_MACHINE_LEARNING.py

Browse files
pages/LIFE_CYCLE_OF_MACHINE_LEARNING.py CHANGED
@@ -631,6 +631,91 @@ This explanation provides both the purpose and practical use cases of `cv2.Video
631
  if st.button("Back to Data Collection"):
632
  st.session_state.page = "data_collection"
633
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
634
 
635
 
636
 
 
631
  if st.button("Back to Data Collection"):
632
  st.session_state.page = "data_collection"
633
 
634
+ -----###AFFINE TRANSFORMATION MATRIX------------
635
+
636
+ import streamlit as st
637
+
638
+ # Header for Affine Transformation Matrix
639
+ st.header("Affine Transformation Matrix")
640
+
641
+ # Description of Affine Transformation
642
+ st.markdown("""
643
+ An **Affine Transformation** is a linear mapping method that preserves points, straight lines, and planes. In other words, it maintains the structure of the original object while allowing for operations like translation, scaling, rotation, reflection, and shearing. Affine transformations are widely used in computer graphics, computer vision, image processing, and geometry.
644
+
645
+ Affine transformations can be represented by a **transformation matrix** of the following form:
646
+
647
+ \\[
648
+ T(x, y) = \\begin{bmatrix} a & b & tx \\\\ c & d & ty \\\\ 0 & 0 & 1 \\end{bmatrix} \\begin{bmatrix} x \\\\ y \\\\ 1 \\end{bmatrix}
649
+ \\]
650
+
651
+ - The **matrix elements (a, b, c, d)** control the linear transformation (scaling, rotation, and shearing).
652
+ - The elements **tx and ty** represent translation (shifting the coordinates).
653
+
654
+ ### How the Transformation Works
655
+ Given a point \\((x, y)\\), applying an affine transformation produces a new point \\((x', y')\\) calculated as:
656
+
657
+ \\[
658
+ \\begin{bmatrix} x' \\\\ y' \\\\ 1 \\end{bmatrix} = \\begin{bmatrix} a & b & tx \\\\ c & d & ty \\\\ 0 & 0 & 1 \\end{bmatrix} \\begin{bmatrix} x \\\\ y \\\\ 1 \\end{bmatrix}
659
+ \\]
660
+
661
+ This means:
662
+ - \\(x' = a \\cdot x + b \\cdot y + tx\\)
663
+ - \\(y' = c \\cdot x + d \\cdot y + ty\\)
664
+
665
+ Affine transformations can be visualized as applying a series of transformations to geometric shapes.
666
+ """)
667
+
668
+ # Key Points Section
669
+ st.header("Key Points of Affine Transformations")
670
+
671
+ st.markdown("""
672
+ ### 1. **Preserves Collinearity**
673
+ - Points that lie on a straight line before transformation remain on a straight line after transformation.
674
+
675
+ ### 2. **Preserves Ratios of Distances**
676
+ - The ratio of distances between points on a line remains unchanged after transformation.
677
+
678
+ ### 3. **Common Operations**
679
+ Affine transformations can perform the following operations:
680
+ - **Translation**: Moves the object along the x and y axes.
681
+ - **Scaling**: Changes the size of the object (uniform or non-uniform).
682
+ - **Rotation**: Rotates the object around a specific point (usually the origin).
683
+ - **Shearing**: Skews the object along one or both axes.
684
+ - **Reflection**: Mirrors the object about a specific axis (e.g., x-axis or y-axis).
685
+
686
+ ### 4. **2D Affine Transformation Matrix**
687
+ The general 2D affine transformation matrix can be expressed as:
688
+
689
+ \\[
690
+ \\begin{bmatrix} a & b & tx \\\\ c & d & ty \\\\ 0 & 0 & 1 \\end{bmatrix}
691
+ \\]
692
+
693
+ Where:
694
+ - \\(a, b, c, d\\) represent the linear transformations (scaling, rotation, shearing).
695
+ - \\(tx, ty\\) represent translation.
696
+
697
+ ### 5. **Combining Transformations**
698
+ - Multiple affine transformations can be combined by multiplying their matrices.
699
+ - **Order Matters**: The order in which transformations are applied affects the final result (matrix multiplication is non-commutative).
700
+
701
+ ### 6. **Applications of Affine Transformations**
702
+ - **Computer Graphics**: Transforming and rendering shapes and images.
703
+ - **Image Processing**: Geometric operations like rotation, scaling, and shearing of images.
704
+ - **Computer Vision**: Object detection, pattern recognition, and image alignment.
705
+ - **Robotics**: Coordinate transformations for motion planning and navigation.
706
+ - **Geographical Information Systems (GIS)**: Map projection and alignment.
707
+
708
+ ### 7. **Homogeneous Coordinates**
709
+ Using homogeneous coordinates \\((x, y, 1)\\) allows us to unify translation with linear transformations in a single matrix operation. This simplifies the combination and chaining of multiple transformations.
710
+ """)
711
+
712
+ # Navigation Button
713
+ if st.button("Back to Data Collection"):
714
+ st.session_state.page = "data_collection"
715
+
716
+
717
+
718
+
719
 
720
 
721