chickadee » leptonic » pix-color-content

pix-color-contentprocedure
  • in - PPIX
  • in - RREF GREF BREF: int32 - reference values for red,green,blue component.
    • RREF/GREF/BREF must all be 0 or all not 0. When not 0, ref values describe an unbalanced white point, or mean color of background of scanned images. Set to 0 to turn off color transforms.
  • in - MINGRAY: int32
    • Pixels less than mingray are set to 0,0,0. set mingray to 0 to turn off filtering dark pixels.
  • out - RCONT GCONT BCONT: ptr to ppix - (optional, set to #f if unused)
    • If used, filled with R/G/B 8bpp ppix corresponding to component color content.
  • returns: 0 if “OK”, 1 on error.
(import scheme.base leptonic)
(include "leptonic-types.scm")
(define-external imgpix ppix (pix-read "myimage.jpg"))
(define-external rcont ppix)
(define-external gcont ppix)
(define-external bcont ppix)
(define r (pix-color-content imgpix 0 0 0 20 (location rcont)
    (location gcont) (location bcont)))
(if (zero? r)
    (begin
       ;; -- use the ppixs: rcont, gcont, bcont --
       (pix-destroy (location imgpix))
       (pix-destroy (location rcont))
       (pix-destroy (location gcont))
       (pix-destroy (location bcont)))
    ;; -- handle error --)