Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ofxPlotFinders

Image-to-stroke plot finders.

Turns preprocessed greyscale layers into stroke buffers (ofPolyline / ofPath beziers). Optional RegionSet export uses the same find() pass (FinderRunFlags::EmitRegions).

  • IPlotFinder — one algorithm per implementation
  • PlotFinderId — stable {family, name} ids (maps to PlotFinderType in ofxPlotter)
  • FinderCapabilities — declared partition / fill / region-export metadata
  • FinderContext — read/write bridge to PlotDoc generation state
  • FinderRegistry — lookup and run(PlotFinderType, …)

Algorithms live under src/finders/ (one .cpp per finder). Shared helpers: src/sketch/ (sketch finders), src/HatchHelpers.* (parallel hatch line tracing). For scratch buffers, capabilities, regions, and commit-time geometry classification, see ARCHITECTURE.md.

Finders (registered)

PlotFinderId PlotFinderType Display name
sketch / lines SketchLines Sketch Lines
sketch / curves SketchCurves Sketch Curves
sketch / flowfield SketchFlowField Sketch Flow Field
sketch / sobel SketchSobelEdges Sketch Sobel Edges
hatch / cross CrossHatch Cross Hatch
hatch / parallel ParallelHatch Parallel Hatch
hatch / streamline StreamlineHatch Streamline Hatch
hatch / adaptive AdaptiveHatch Adaptive Hatch
spiral / default Spiral Spiral (modulated)
spiral / archimedean ArchimedeanSpiral Archimedean Spiral
spiral / logarithmic LogarithmicSpiral Logarithmic Spiral
spiral / adaptive AdaptiveSpiral Adaptive Spiral
stipple / dots Stippling Stippling
stipple / voronoi VoronoiStippling Voronoi Stippling
structure / grid GridFinder Grid
structure / maze MazeFinder Maze
structure / voronoi VoronoiFill Voronoi Fill
composite / chain CompositeFinder Composite
contour / edges Contours Contours
potrace / regions Potrace Potrace

Usage

#include "ofxPlotFinders.h"

PlotDoc doc(registry);
plotfind::FinderContext ctx(doc);
plotfind::FinderRegistry::instance().run(PlotFinderType::SketchLines, ctx, onProgress);

List available finders:

for (const auto& id : plotfind::FinderRegistry::instance().listIds()) {
    ofLog() << id.family << "/" << id.name;
}

Export partition regions (same find() pass):

plotfind::FinderContext ctx(doc);
const plotfind::RegionSet regions = plotfind::FinderRegistry::instance().runForRegions(
    PlotFinderType::CompositeFinder, ctx, onProgress);
for (const auto& region : regions.regions) {
    ofLog() << region.label << " avg=" << region.avgBrightness;
}

Paths and regions together:

plotfind::FinderRegistry::instance().run(
    PlotFinderType::Potrace, ctx, onProgress,
    plotfind::FinderRunFlags::EmitPaths | plotfind::FinderRunFlags::EmitRegions);

External semantic regions (faces, segmentation) use IRegionProvider and runFinderPerRegion(). Heavier external library backed providers (e.g. OpenCV) live in optional ofxPlotRegions.

Tests

Unit + golden smoke tests via ofxImGuiTestSuite:

cd addons/ofxPlotFinders/example-test
make -j4

Sources: tests/ · details: tests/README.md

Dependencies

Piece Role
ofxPlotter PlotDoc, PlotterComponents.h
ofxEnTTKit ECS layer components
ofxPotrace libpotrace (GPL) for the Potrace finder

TODO: ofxPotrace should be an external finder and register here...

Layout

src/
  ofxPlotFinders.h       # umbrella include
  IPlotFinder.h
  FinderCapabilities.h
  FinderContext.h / .cpp
  FinderRegistry.h / .cpp
  RegionTypes.h / RegionHelpers.h
  HatchHelpers.h / .cpp  # parallel hatch line tracing
  IRegionProvider.h
  finders/               # one algorithm per pair .h/.cpp
  sketch/                # shared sketch helpers
tests/                   # IM_REGISTER_TEST suites
example-test/            # ofxImGuiTestSuite runner app
.clang-format

Related addons (ofxPlot)

Addon GitHub
ofxPlotFinders (this) ofxyz/ofxPlotFinders
ofxPlotter ofxyz/ofxPlotter
ofxPlotProcessors ofxyz/ofxPlotProcessors
ofxPlotRegions ofxyz/ofxPlotRegions

Licence

GPL today, MIT After Potrace dep has moved out.

About

Plot finders turn images into strokes.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages