This would allows setting a few values in each filter & make some functions more "specific".
Right now, in the following example , it's not yet possible to set the style & name used for each histogram curve.
@interactive(bins=(512, [256, 4096, 64]))
def compute_histogram(rgb, bins=512):
style="-"
name="histo"
luma = torch.mean(rgb, dim=(-3))
# histo, histo_bins = torch.histogram(luma, bins=256, range=(0,1), density=True) # Not working on a GPU
histo, histo_bins = histogram(luma, bins=bins, range=(0,1), density=True)
return (histo, histo_bins, style, name),
# ----------------------------------------------------------------------------
def stack_histograms(*histos) -> torch.FloatTensor:
"""Stack several histograms into a curve
No custom legend so far!
"""
histo_curve = Curve(
[
(histo_bins[:-1].detach().to("cpu").numpy(), histo.detach().to("cpu").numpy(), "-", f"{name} {index}")
for index, (histo, histo_bins, style, name) in enumerate(histos)
],
grid=True,
title="Histogram",
xlim=(0., 1.),
ylim=(0., 0.01)
)
return histo_curve
stack histograms works fine (no need to provide the exact amount of inputs .
BUT you can't set style or names in the main pipeline .
I wished I could write:
hist = compute_histogram(rgb , style="b-", name="rgb gamma")
This would allows setting a few values in each filter & make some functions more "specific". Right now, in the following example , it's not yet possible to set the style & name used for each histogram curve.
stack histograms works fine (no need to provide the exact amount of inputs . BUT you can't set style or names in the main pipeline . I wished I could write:
hist = compute_histogram(rgb , style="b-", name="rgb gamma")