Skip to content
Kurt Pachinger edited this page Oct 2, 2022 · 27 revisions

A photo with faces uses foreground extraction and feature segmentation to output: recolorized and depth.

Presets

  • Set quality slider for speed or resolution.
  • Set default colors for region or id.

Displays

  • Hover src (onionskin) to view ROI, colorization, & depth(s).
  • Hover dst (recolored composite) to interact with depth map.

ROI Layer Masks

  • Set slider to magnify details.
  • Hover to view mask GrabCut refinements.
  • Click to set mask colorization.
  • Hover to highlight mask palette in color wheel.

Color Wheel (HSV)

  • Plot ROI relative sample size from kmeans.

sto

GC

GrabCut mask values:

  • .BGD -- Background
  • .FGD -- Foreground
  • .PR_BGD -- Probable Background
  • .PR_FGD -- Probable Foreground

PYR

Scale factor for reduction in cast.segment and cast.palette.

batch

Count of complete invocations of cast.init.

delete (mat)

Overwrite mat and resize to 1, to release memory.

mask

div#mask contains batch output with: feature masks, kmeans counts, color pickers.

orient (file)

Orient and resize image file input with loadImage.

resize (obj, prc, centered): obj

Resize a Mat or Rect.

roi

Canvas#roi provides visual feedback to user of OpenCV feature mask ROI.

src

Canvas#chromaImg from sto.orient is the provided image.

swatch

  • Stores data from feature ROI in cast.palette such as .bg, .eye, .hair, .iris, .lips, .skin, and also .bump.
  • Properties include: count, depth, face, kmeans, mat, to.

update (complete, loading): complete

The origin of value complete determines progress:

  • cast.orient: call cast.init
  • cast.segment and cast.palette: update UI progress from sto.updated
  • Abort/Complete: call cast.composite, Pixi, chart

updated

Named setTimeout reference from sto.update.

var

  • .bmp -- Mat for depth of PIXI.filters.DisplacementFilter
  • .dst -- Mat for cast.composite (copy of src)
  • .hsv -- Mat for cast.diff and cast.pyramid
  • .src -- Mat from cast.init from #chromaImg (responsive)

cast

absdiff (arr)

Multiple faces within an image are presented as eigen.

composite (complete)

Background, colorized features, and depth are masked and flattened for destination.

diff (rect, face): obj

The inrange duotone used in cast.palette may not work on a complex feature ROI, such as lips and hair. Diff is a manual probe of average HSV differences which paints each pixel with a weighted radius boundary. It returns a contour mask if preset criteria are satisfied, or fails to default.

init

The sequence of instructions to create ROI masks with GrabCut. For example: segment extracts foreground, palette requires skin before lips, hair can affect the alpha overlap of eyes.

layer (idx, name, mat)

Append different masks from cast.palette inRange and cast.pyramid GrabCut. User can preview changes with colorize picker.

palette (rect, lim)

Uses cast.diff, inRange and cast.pyramid to refine feature masks.

pyramid (rect)

GrabCut dependency hierarchy from feature relationships creates mask for cast.recolor.

recolor (mat, mask, col)

Multiply blend Mat within mask with color. The Canvas sto.var.dst is binary and flattened, so alternatively a Canvas#color contains regions of solid color.

roi_ui (rect, color)

Draw ROI rectangle on sto.roi for review.

segment (face)

Extract foreground mask by bisecting haarCascade face ROI.

chart(complete)

Plots a d3 hsl color wheel linked to feature mask kmeans palette.

Pixi(complete)

Links the faces' depth maps to cursor position for a parallax effect.