(feat) add more highlight methods
This commit is contained in:
29
main.py
29
main.py
@@ -1,7 +1,15 @@
|
||||
import cv2
|
||||
|
||||
from src.data import load_data
|
||||
from src.img_utils import apply_color_overlay, blur_background, desaturate_background
|
||||
from src.img_utils import (
|
||||
apply_color_overlay,
|
||||
apply_composite_overlay,
|
||||
apply_gradient_heatmap_overlay,
|
||||
apply_spotlight_heatmap,
|
||||
blur_background,
|
||||
desaturate_background,
|
||||
draw_border,
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
@@ -19,6 +27,25 @@ def main():
|
||||
desaturate_result = desaturate_background(image, mask)
|
||||
cv2.imwrite(".tmp-data/highlight_desaturated.jpg", desaturate_result)
|
||||
|
||||
gradient_heatmap_result = apply_gradient_heatmap_overlay(image, mask, colormap=cv2.COLORMAP_JET, alpha=0.6)
|
||||
cv2.imwrite(".tmp-data/highlight_gradient_heatmap.jpg", gradient_heatmap_result)
|
||||
|
||||
spotlight_result = apply_spotlight_heatmap(image, mask, darkness_factor=0.2)
|
||||
cv2.imwrite(".tmp-data/highlight_spotlight_heatmap.jpg", spotlight_result)
|
||||
|
||||
composite_result = apply_composite_overlay(
|
||||
image, mask, colormap=cv2.COLORMAP_JET, foreground_alpha=0.6, background_alpha=0.5
|
||||
)
|
||||
cv2.imwrite(".tmp-data/highlight_composite.jpg", composite_result)
|
||||
|
||||
bordered_image = draw_border(
|
||||
image,
|
||||
mask,
|
||||
color=(50, 255, 50), # A bright green color
|
||||
thickness=8,
|
||||
)
|
||||
cv2.imwrite(".tmp-data/highlight_border.jpg", bordered_image)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user