Calculates comprehensive per-frame analytics from raw artwork_colors data and artwork_stats totals. The calculated metrics are stored in the artwork_frame_analytics database table.
This function processes timelapse frame data to generate: - **Temporal metrics**: Interpolated elapsed time, strokes, and BPM - **Color composition**: Unique colors, dominant colors, diversity metrics - **Delta metrics**: Frame-to-frame changes in colors and pixels - **Phase detection**: Creative technique phases based on palette changes
Usage
.comp_frame_analytics(color_data, stats_data)
create_frame_analytics(artist, artwork, artwork_colors, artwork_stats)Arguments
- color_data
data.table. Per-frame color histograms (frame, hex, N, R, G, B).
- stats_data
List or data.table. Artwork totals (brush_strokes, drawing_hours, drawing_minutes).
- artist
Character. Artist UUID
- artwork
Character. Artwork UUID
- artwork_colors
data.table. Per-frame color histogram with columns: art_uuid, artist_uuid, frame, hex, N (pixel count). REQUIRED.
- artwork_stats
data.table with one row containing artwork totals: brush_strokes, drawing_hours, drawing_minutes, ave_bpm. REQUIRED.
Value
data.table with 21 columns of per-frame statistics: - `art_uuid`, `artist_uuid`, `frame` - Temporal: `elapsed_minutes`, `elapsed_hours`, `cumulative_strokes`, `estimated_bpm` - Color: `unique_colors`, `total_pixels`, `dominant_hex`, `dominant_pixels`, `color_diversity`, `avg_red`, `avg_green`, `avg_blue` - Delta: `colors_added`, `colors_removed`, `pixels_added`, `palette_change_score` - Phase: `technique_phase` - Metadata: `created_utc`
data.table with per-frame metrics (no artist/artwork metadata)
Details
## Calculation Methods
**Temporal Interpolation** (linear): “` elapsed_minutes = total_minutes * ((frame - min_frame) / (max_frame - min_frame)) “`
**Color Composition** (aggregated per frame): “` unique_colors = COUNT(DISTINCT hex) color_diversity = unique_colors / dominant_pixels “`
**Delta Metrics** (frame-to-frame): “` palette_change_score = (add_ratio * 0.4) + (remove_ratio * 0.3) + (pixel_ratio * 0.3) “`
**Phase Detection**: - New phase when `palette_change_score > 0.5`
Functions
.comp_frame_analytics(): Pure computation - calculate frame analytics from color datacreate_frame_analytics(): Create frame analytics from artwork color and stats data
See also
[artutils::get_frame_analytics()]
Other pipeline functions:
build-record,
commit_artwork(),
createArtworkHash,
create_gallery_images(),
frame-metrics,
render_certificate(),
validate_table_list()
