On this page:
flomap-gradient-x
flomap-gradient-y
flomap-gradient
flomap-gradient-normal

4.6 Gradients and Normals

procedure

(flomap-gradient-x fm)  flomap

  fm : flomap

procedure

(flomap-gradient-y fm)  flomap

  fm : flomap
These return, per-component, estimates of the local x- and y-directional derivatives using a 3×3 Scharr operator.

procedure

(flomap-gradient fm)  
flomap flomap
  fm : flomap
Equivalent to (values (flomap-gradient-x fm) (flomap-gradient-y fm)).

Examples:

> (define-values (dx-fm dy-fm)
    (flomap-gradient (flomap-drop-components fm 1)))
> (values (flomap->bitmap (fm* 0.5 (fm+ 1.0 dx-fm)))
          (flomap->bitmap (fm* 0.5 (fm+ 1.0 dy-fm))))

image

image

procedure

(flomap-gradient-normal fm)  flomap

  fm : flomap
Given a one-component flomap, returns a 3-component flomap containing estimated normals. In other words, flomap-normal converts height maps to normal maps.

Examples:

> (flomap->bitmap sine-fm)

image

> (flomap->bitmap (flomap-gradient-normal sine-fm))

image

> (flomap-gradient-normal fm)

flomap-gradient-normal: expected argument of type <flomap

with 1 component>; given: (flomap #<flvector> 4 260 240)