Commit
·
808697d
1
Parent(s):
b25a6fa
updating overlay
Browse files
app.py
CHANGED
|
@@ -49,11 +49,14 @@ def plot_outlines(img, masks):
|
|
| 49 |
bytes_image = io.BytesIO()
|
| 50 |
plt.savefig(bytes_image, format='png', facecolor=fig.get_facecolor(), edgecolor='none')
|
| 51 |
bytes_image.seek(0)
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
| 53 |
del bytes_image
|
| 54 |
fig.clf()
|
| 55 |
plt.close(fig)
|
| 56 |
-
return
|
| 57 |
|
| 58 |
def plot_overlay(img, masks):
|
| 59 |
img = normalize99(img.astype(np.float32).mean(axis=-1))
|
|
|
|
| 49 |
bytes_image = io.BytesIO()
|
| 50 |
plt.savefig(bytes_image, format='png', facecolor=fig.get_facecolor(), edgecolor='none')
|
| 51 |
bytes_image.seek(0)
|
| 52 |
+
img_arr = np.frombuffer(bytes_image.getvalue(), dtype=np.uint8)
|
| 53 |
+
bytes_image.close()
|
| 54 |
+
img = cv2.imdecode(img_arr, 1)
|
| 55 |
+
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 56 |
del bytes_image
|
| 57 |
fig.clf()
|
| 58 |
plt.close(fig)
|
| 59 |
+
return img
|
| 60 |
|
| 61 |
def plot_overlay(img, masks):
|
| 62 |
img = normalize99(img.astype(np.float32).mean(axis=-1))
|