ndarray-vision icon indicating copy to clipboard operation
ndarray-vision copied to clipboard

Add separate apply and calculate threshold methods

Open volks73 opened this issue 1 year ago • 0 comments

The image processing threshold methods are defined as traits for the ArrayBase and Image types that use the Otsu and Mean algorithms for calculating a threshold value and immediately applying the threshold. It could be useful to break out the one defined method into an "apply" and "calculate" methods, so that the threshold value could be calculated and obtained without immediately applying it to the image or array.

For example, the fn threshold_otsu would become:

...
fn threshold_calculate_otsu(&self) -> Result<f64, Error>;

fn threshold_apply_otsu(&self) -> Result<Self::Output, Error>;
...

The threshold_apply_otsu would be the same as the current threshold_otsu method, but the threshold_calculate_otsu method would simply return the threshold value, which could be used to do additional image processing or explicitly applied to an image using the new-ish threshold_apply method from PR #56.

volks73 avatar Jan 12 '23 20:01 volks73