Files
test/sexp_effects/effects/outline.sexp
gilesb 406cc7c0c7 Initial commit: video effects processing system
Add S-expression based video effects pipeline with modular effect
definitions, constructs, and recipe files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:34:45 +00:00

23 lines
927 B
Common Lisp

;; Outline effect - shows only edges
;; @param thickness int [1, 10] default 2
;; @param threshold int [20, 300] default 100
;; @param color list default (0 0 0)
;; @param fill_mode string default "original"
(define-effect outline
((thickness 2) (threshold 100) (color (list 0 0 0)) (fill_mode "original"))
(let* ((edge-img (edges frame (/ threshold 2) threshold))
(dilated (if (> thickness 1)
(dilate edge-img thickness)
edge-img))
(base (cond
((= fill_mode "original") (copy frame))
((= fill_mode "white") (make-image (width frame) (height frame) (list 255 255 255)))
(else (make-image (width frame) (height frame) (list 0 0 0))))))
(map-pixels base
(lambda (x y c)
(let ((edge-val (luminance (pixel dilated x y))))
(if (> edge-val 128)
color
c))))))