Image Analysis and Enhancement
Description
Demonstrates two levels of parallelism in a real-world image processing pipeline:
-
Fan-out parallelism: The histogram's derived statistics (min, max, average brightness, pixel count) are computed simultaneously from the histogram data and output to stdout independently.
-
Data parallelism: The contrast stretch operation remaps every pixel independently using min/max from the histogram, then writes the enhanced image.
The flow reads a grayscale image, computes its histogram and statistics, applies contrast stretching to enhance the image, and writes the result.
image_read → pixels
├─→ histogram → min ─┬─→ stdout (statistics, fan-out parallel)
│ max ─┤
│ average ─┤
│ count ─┘
│ │
│ min, max → contrast_stretch (data parallel)
│ │
└── pixels ────────────────┘
└─→ image_write (enhanced output)
Root Diagram
Click image to navigate flow hierarchy.
Functions Diagram
Click image to view functions graph.
Features Used
- Provided functions (histogram, contrast_stretch — compiled to WASM)
- Context Functions
args/getfor input/output filenamesimage_readto read a PNG image as grayscale pixelsimage_writeto write the enhanced imagestdoutto output statistics
- Library Functions (
to_stringfor formatting) - Fan-out: histogram outputs feed multiple independent paths simultaneously
- Data parallelism: contrast stretch processes all pixels independently