matrix_to_img — 2D bridge op

• Data kinds: matrix → image

• Call: fullseye.apply(img, "matrix_to_img", a=0.5, b=0.5) (the 2-D model is one image plus two scalar knobs a,b∈[0,1])

matrix_to_img: input → output

*The figure is the actual output on a synthetic 128×128 input. Left: input, right: output. Point clouds are drawn as a top-down scatter (brightness = z), 1-D series as a line plot, volumes as the maximum-intensity projection along z, videos as the middle frame, complex images as magnitude; return values that are not pictures are shown as the values themselves.*

Sweeping knob a (0.1 / 0.5 / 0.9, the other knob at its default):

▸ matrix_to_img: knob a sweep (docs site)

Sweeping knob b (0.1 / 0.5 / 0.9, the other knob at its default):

▸ matrix_to_img: knob b sweep (docs site)

Stages (the ops that come before → this op, left to right):

▸ matrix_to_img: stages (docs site)

On other images (synthetic scene / photo / coins. Top row: inputs, bottom row: their outputs. Knobs at default):

▸ matrix_to_img: other inputs (docs site)

Usage

Turns a matrix into gray levels for viewing and back into an image — this is not a cast.

The outbound bridge (img_to_matrix) is stated explicitly to be a pure cast that changes neither values nor shape, but making the return trip a cast as well would be a lie: matrix values do not fit in [0,1], and if the minimum is simply stretched to black and the maximum to white, you cannot tell where 0 is. The signs of covariance, correlation and pseudo-inverse mean nothing unless that can be read.

• a → strength of log compression. With k = 10**(3a) - 1, y = sign(x) * log1p(k|x|) / log1p(k) (linear at a=0, 1000-fold compression at a=1). For matrices whose magnitudes spread over many orders, like condition numbers, it prevents the small entries from all collapsing to black.

• b → reference. b < 0.5 stretches the data's min–max to [0,1]; b >= 0.5 places 0 at 0.5 and scales symmetrically by the maximum of |x| (for signed matrices; 0.5 is neutral, bright = positive, dark = negative).

• Returns: float64 of the same shape as the input, range [0,1]. A matrix whose elements are all equal gives a uniform 0.5 (falls back to neutral so that the min–max side does not divide by 0 either).

Detailed usage guide

• gallery2d_bridge family guide

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Try it in Studio

The program below has been verified to run (same input as the figure). In Studio's help this block becomes buttons that load and run it on the spot.

img_to_matrix 0.50 0.50
matrix_to_img 0.50 0.50

▸ Load this pipeline  ·  Load & run

Runnable examples (verified samples that actually call this op)

• gallery2d_bridge — py -3.11 examples/gallery2d_bridge.py

Ops the type connects to (they accept image as input)

identity · gaussian · mean_box · bilateral · unsharp · median · min_filter · max_filter

Same category (bridge)

img_to_points · img_to_keypoints · img_to_signal · img_to_projection_profile · img_to_counts · img_to_matrix · img_to_video · img_to_volume


*Provenance: ops.py — 2D operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.