Update forensics/ela_hybrid.py
Browse files- forensics/ela_hybrid.py +10 -8
forensics/ela_hybrid.py
CHANGED
@@ -50,12 +50,14 @@ def save_hybrid_image(hybrid_array, save_path: str):
|
|
50 |
np.save(save_path, hybrid_array)
|
51 |
print(f"Saved hybrid ELA image to {save_path}")
|
52 |
|
|
|
|
|
|
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
}
|
|
|
50 |
np.save(save_path, hybrid_array)
|
51 |
print(f"Saved hybrid ELA image to {save_path}")
|
52 |
|
53 |
+
def visualize_hybrid(hybrid_array: np.ndarray):
|
54 |
+
"""Return a list of 2 images: [RGB Image, ELA Map (grayscale)], as PIL Images."""
|
55 |
+
from PIL import Image
|
56 |
|
57 |
+
# Extract RGB (3 channels at front)
|
58 |
+
rgb_image = Image.fromarray((hybrid_array[:, :, :3] * 255).astype(np.uint8))
|
59 |
+
|
60 |
+
# Extract ELA channels (last 3)
|
61 |
+
ela_image = Image.fromarray((hybrid_array[:, :, 3:] * 255).astype(np.uint8))
|
62 |
+
|
63 |
+
return [rgb_image, ela_image]
|
|