shubham680 commited on
Commit
8b4edfe
·
verified ·
1 Parent(s): 7e37608

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -14
app.py CHANGED
@@ -56,21 +56,24 @@ scal = st.checkbox("Scaling")
56
  shearing=st.checkbox("Shearing")
57
  crop=st.checkbox("Crop")
58
 
59
- transformation = []
60
- if trans:
61
- transformation.append("Translation")
62
- if rot:
63
- transformation.append("Rotation")
64
- if scal:
65
- transformation.append("Scaling")
66
- if shearing:
67
- transformation.append("Shearing")
68
- if crop:
69
- transformation.append("Crop")
70
-
71
- st.button("Submit")
72
-
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
 
76
  if uploaded_file is not None:
@@ -80,6 +83,18 @@ if uploaded_file is not None:
80
  img=cv2.imdecode(img_array,cv2.IMREAD_COLOR)
81
  # Convert BGR to RGB as streamlit expects RGB colorspace
82
  img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
 
85
 
 
56
  shearing=st.checkbox("Shearing")
57
  crop=st.checkbox("Crop")
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
+
61
+ btn=st.button("Submit")
62
+ # count=len(transformation)
63
+ # for i in range(image_count):
64
+ # for j in transformation:
65
+ # if i=="Translation":
66
+ # tx=250
67
+ # ty=250
68
+ # tm=np.array([[1,0,tx],[0,1,ty]],dtype=np.float32)
69
+ def transalation(img):
70
+ tx=np.random.randint(2,60)
71
+ ty=np.random.randint(2,55)
72
+ tm=np.array([[1,0,tx],[0,1,ty]],dtype=np.float32)
73
+ trans_img=cv2.warpAffine(img,tm)
74
+ img=cv2.imdecode(trans_img,cv2.IMREAD_COLOR)
75
+ img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
76
+ st.image(img_rgb, caption="Uploaded Image (OpenCV)", use_container_width=True)
77
 
78
 
79
  if uploaded_file is not None:
 
83
  img=cv2.imdecode(img_array,cv2.IMREAD_COLOR)
84
  # Convert BGR to RGB as streamlit expects RGB colorspace
85
  img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
86
+ transformation = []
87
+ if trans:
88
+ transalation(img_rgb)
89
+ transformation.append("Translation")
90
+ if rot:
91
+ transformation.append("Rotation")
92
+ if scal:
93
+ transformation.append("Scaling")
94
+ if shearing:
95
+ transformation.append("Shearing")
96
+ if crop:
97
+ transformation.append("Crop")
98
 
99
 
100