shubham680 commited on
Commit
a318b47
·
verified ·
1 Parent(s): b992ea8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -15
app.py CHANGED
@@ -56,19 +56,12 @@ scal = st.checkbox("Scaling")
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,dsize=(300,300))
74
  img=cv2.imdecode(trans_img,cv2.IMREAD_COLOR)
@@ -80,12 +73,12 @@ if uploaded_file is not None:
80
  # Converting the image into array
81
  img_array=np.asarray(bytearray(uploaded_file.read()),dtype=np.uint8)
82
  # Decode or converting the array back to image
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")
 
56
  shearing=st.checkbox("Shearing")
57
  crop=st.checkbox("Crop")
58
 
59
+
 
60
  btn=st.button("Submit")
61
+
 
 
 
 
 
 
62
  def transalation(img):
63
+ tx=3 #np.random.randint(2,60)
64
+ ty=5 #np.random.randint(2,55)
65
  tm=np.array([[1,0,tx],[0,1,ty]],dtype=np.float32)
66
  trans_img=cv2.warpAffine(img,tm,dsize=(300,300))
67
  img=cv2.imdecode(trans_img,cv2.IMREAD_COLOR)
 
73
  # Converting the image into array
74
  img_array=np.asarray(bytearray(uploaded_file.read()),dtype=np.uint8)
75
  # Decode or converting the array back to image
76
+ # img=cv2.imdecode(img_array,cv2.IMREAD_COLOR)
77
+ # # Convert BGR to RGB as streamlit expects RGB colorspace
78
+ # img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
79
  transformation = []
80
  if trans:
81
+ transalation(img_array)
82
  transformation.append("Translation")
83
  if rot:
84
  transformation.append("Rotation")