vigra
vigra copied to clipboard
Accumulators: add per-channel histograms for multi-channel inputs
Hello ukoethe, I'd like to work on this issue . Can you please provide some description ? I understand it but i can't figure out how to proceed.
thanks chaithuzz2
Thanks for offering your help. Unfortunately, this is not an easy issue. The relevant code is in accumulator.hxx
, starting at line 5288. You will see that the assumption of scalar data is hard-wired in the histogram classes. To generalize, the histograms must become MultiArray<2, double>
(instead of TinyVector<doubel, BinCount>
or MultiArray<1, double>
). Moreover, the members left_outliers
, right_outliers
, scale_
, offset_
and inverse_scale_
must become vectors of length equal to the number of channels. All functions (including setMinMax()
and computeStandardQuantiles()
) must be rewritten or overloaded to handle non-scalar data.
To refactor in a systematic way, I suggest the following steps:
- Change the types as described, but hard code array size initializion for scalar data only. Then get the test suite (which is in
test/objectfeatures
) running again. - Implement a
reshape()
function similar to the one in some other accumulators that appropriately adjusts the array shapes. Get the tests running again, and add a test for proper reshape on multi-channel input. - Implement the generalized function versions and correspoonding tests. It may be necessary to temporally comment out some functionality (e.g. the quantile stuff and corresponding tests) to get the tests running for intermediate code states.
Finally, it is also necessary to generalize the Python bindings, but we can talk about this later.