Update app.py
Browse files
app.py
CHANGED
@@ -27,9 +27,9 @@ if uploaded_image:
|
|
27 |
|
28 |
# Check if the user clicks a button
|
29 |
if st.button('Detect Saliency'):
|
30 |
-
# Create a blue background image
|
31 |
blue_background = np.zeros_like(np.array(image))
|
32 |
-
blue_background[:] = (
|
33 |
|
34 |
# Preprocess the image
|
35 |
img = image.resize((384, 288))
|
@@ -66,7 +66,7 @@ if uploaded_image:
|
|
66 |
center_y = int(M["m01"] / M["m00"])
|
67 |
cv2.putText(label_map, str(i + 1), (center_x, center_y), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 0, 0), 2, cv2.LINE_AA)
|
68 |
|
69 |
-
# Blend the colorized image with the
|
70 |
alpha = 0.7 # Adjust the alpha value to control blending strength
|
71 |
blended_img = cv2.addWeighted(blue_background, 1 - alpha, colorized_img, alpha, 0)
|
72 |
|
|
|
27 |
|
28 |
# Check if the user clicks a button
|
29 |
if st.button('Detect Saliency'):
|
30 |
+
# Create a blue background image with the same dimensions as the original image
|
31 |
blue_background = np.zeros_like(np.array(image))
|
32 |
+
blue_background[:] = (255, 0, 0) # Set the background to blue (in BGR format)
|
33 |
|
34 |
# Preprocess the image
|
35 |
img = image.resize((384, 288))
|
|
|
66 |
center_y = int(M["m01"] / M["m00"])
|
67 |
cv2.putText(label_map, str(i + 1), (center_x, center_y), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 0, 0), 2, cv2.LINE_AA)
|
68 |
|
69 |
+
# Blend the colorized image with the blue background
|
70 |
alpha = 0.7 # Adjust the alpha value to control blending strength
|
71 |
blended_img = cv2.addWeighted(blue_background, 1 - alpha, colorized_img, alpha, 0)
|
72 |
|