Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,22 +63,21 @@ 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=(
|
| 67 |
-
img=cv2.imdecode(trans_img,cv2.IMREAD_COLOR)
|
| 68 |
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 69 |
-
st.image(img_rgb, caption="
|
| 70 |
|
| 71 |
|
| 72 |
if uploaded_file is not None:
|
| 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 |
-
|
| 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(
|
| 82 |
transformation.append("Translation")
|
| 83 |
if rot:
|
| 84 |
transformation.append("Rotation")
|
|
|
|
| 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=(img.shape[1],img.shape[0]))
|
|
|
|
| 67 |
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 68 |
+
st.image(img_rgb, caption="Translation Applied", use_container_width=True)
|
| 69 |
|
| 70 |
|
| 71 |
if uploaded_file is not None:
|
| 72 |
# Converting the image into array
|
| 73 |
img_array=np.asarray(bytearray(uploaded_file.read()),dtype=np.uint8)
|
| 74 |
+
# Decode or converting the array back to image array
|
| 75 |
+
img=cv2.imdecode(img_array,cv2.IMREAD_COLOR)
|
| 76 |
# # Convert BGR to RGB as streamlit expects RGB colorspace
|
| 77 |
# img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 78 |
transformation = []
|
| 79 |
if trans:
|
| 80 |
+
transalation(img)
|
| 81 |
transformation.append("Translation")
|
| 82 |
if rot:
|
| 83 |
transformation.append("Rotation")
|