When I tried Linear I noticed a performance/usability problem for my use case.
public Image Linear(double[] a, double[] b, bool? uchar = null);
I only wanted to multiply/add everything by a single values, not arrays. This is possible with the native API but not with the managed bindings.
The easy workaround is to create the arrays but the additional allocations can become costly...
using var scaled = image.Linear (new double [] { f }, new double [] { a });
Also while looking inside Linear implementation I noticed that a VOption instance is created, even if not needed for the call. That's another non-required memory allocation and it means some additional calls (e.g. in Call) gets executed when they are not needed.
I ended up doing
using var scaled = (Image) Operation.Call ("linear", null, image, f, a);
to avoid the issues but it's much less readable.
When I tried
LinearI noticed a performance/usability problem for my use case.I only wanted to multiply/add everything by a single values, not arrays. This is possible with the native API but not with the managed bindings.
The easy workaround is to create the arrays but the additional allocations can become costly...
Also while looking inside
Linearimplementation I noticed that aVOptioninstance is created, even if not needed for the call. That's another non-required memory allocation and it means some additional calls (e.g. inCall) gets executed when they are not needed.I ended up doing
to avoid the issues but it's much less readable.