Phaneendrabayi commited on
Commit
dd2ffc3
·
verified ·
1 Parent(s): 91491a8

Update pages/Life_cycle_of_ML.py

Browse files
Files changed (1) hide show
  1. pages/Life_cycle_of_ML.py +6 -6
pages/Life_cycle_of_ML.py CHANGED
@@ -808,7 +808,7 @@ def affine_transformation_demo():
808
  file_bytes = np.asarray(bytearray(uploaded_file.read()), dtype=np.uint8)
809
  image = cv2.imdecode(file_bytes, cv2.IMREAD_COLOR)
810
  rows, cols = image.shape[:2]
811
- st.image(image, caption="Original Image", channels="BGR", use_column_width=True)
812
 
813
  st.write("---")
814
  st.header("1. Translation")
@@ -839,7 +839,7 @@ def affine_transformation_demo():
839
 
840
  translation_matrix = np.float32([[1, 0, tx], [0, 1, ty]])
841
  translated_image = cv2.warpAffine(image, translation_matrix, (cols, rows))
842
- st.image(translated_image, caption="Translated Image", channels="BGR", use_column_width=True)
843
 
844
  st.write("---")
845
  st.header("2. Rotation")
@@ -868,7 +868,7 @@ def affine_transformation_demo():
868
  center = (cols // 2, rows // 2)
869
  rotation_matrix = cv2.getRotationMatrix2D(center, angle, 1)
870
  rotated_image = cv2.warpAffine(image, rotation_matrix, (cols, rows))
871
- st.image(rotated_image, caption="Rotated Image", channels="BGR", use_column_width=True)
872
 
873
  st.write("---")
874
  st.header("3. Scaling")
@@ -896,7 +896,7 @@ def affine_transformation_demo():
896
  sy = st.slider("Scaling Factor in Y", 0.5, 2.0, 1.0)
897
 
898
  scaled_image = cv2.resize(image, (int(cols * sx), int(rows * sy)))
899
- st.image(scaled_image, caption="Scaled Image", channels="BGR", use_column_width=True)
900
 
901
  st.write("---")
902
  st.header("4. Shearing")
@@ -925,7 +925,7 @@ def affine_transformation_demo():
925
 
926
  shearing_matrix = np.float32([[1, shx, 0], [shy, 1, 0]])
927
  sheared_image = cv2.warpAffine(image, shearing_matrix, (cols, rows))
928
- st.image(sheared_image, caption="Sheared Image", channels="BGR", use_column_width=True)
929
 
930
  st.write("---")
931
  st.header("5. Cropping")
@@ -939,7 +939,7 @@ def affine_transformation_demo():
939
  y2 = st.slider("Crop End (Y-axis)", rows // 2, rows, rows - 50)
940
 
941
  cropped_image = image[y1:y2, x1:x2]
942
- st.image(cropped_image, caption="Cropped Image", channels="BGR", use_column_width=True)
943
 
944
  ipynb_file_path = "Affine_Transformation.ipynb"
945
 
 
808
  file_bytes = np.asarray(bytearray(uploaded_file.read()), dtype=np.uint8)
809
  image = cv2.imdecode(file_bytes, cv2.IMREAD_COLOR)
810
  rows, cols = image.shape[:2]
811
+ st.image(image, caption="Original Image", channels="BGR")
812
 
813
  st.write("---")
814
  st.header("1. Translation")
 
839
 
840
  translation_matrix = np.float32([[1, 0, tx], [0, 1, ty]])
841
  translated_image = cv2.warpAffine(image, translation_matrix, (cols, rows))
842
+ st.image(translated_image, caption="Translated Image", channels="BGR")
843
 
844
  st.write("---")
845
  st.header("2. Rotation")
 
868
  center = (cols // 2, rows // 2)
869
  rotation_matrix = cv2.getRotationMatrix2D(center, angle, 1)
870
  rotated_image = cv2.warpAffine(image, rotation_matrix, (cols, rows))
871
+ st.image(rotated_image, caption="Rotated Image", channels="BGR")
872
 
873
  st.write("---")
874
  st.header("3. Scaling")
 
896
  sy = st.slider("Scaling Factor in Y", 0.5, 2.0, 1.0)
897
 
898
  scaled_image = cv2.resize(image, (int(cols * sx), int(rows * sy)))
899
+ st.image(scaled_image, caption="Scaled Image", channels="BGR")
900
 
901
  st.write("---")
902
  st.header("4. Shearing")
 
925
 
926
  shearing_matrix = np.float32([[1, shx, 0], [shy, 1, 0]])
927
  sheared_image = cv2.warpAffine(image, shearing_matrix, (cols, rows))
928
+ st.image(sheared_image, caption="Sheared Image", channels="BGR")
929
 
930
  st.write("---")
931
  st.header("5. Cropping")
 
939
  y2 = st.slider("Crop End (Y-axis)", rows // 2, rows, rows - 50)
940
 
941
  cropped_image = image[y1:y2, x1:x2]
942
+ st.image(cropped_image, caption="Cropped Image", channels="BGR")
943
 
944
  ipynb_file_path = "Affine_Transformation.ipynb"
945