[−][src]Function imageproc::stats::percentile
pub fn percentile(image: &GrayImage, p: u8) -> u8
Returns the p
th percentile of the pixel intensities in an image.
We define the p
th percentile intensity to be the least x
such
that at least p
% of image pixels have intensity less than or
equal to x
.
Panics
If p > 100
.
Examples
use imageproc::stats::percentile; let image = gray_image!( 1, 2, 3, 4, 5; 6, 7, 8, 9, 10); // The 0th percentile is always 0 assert_eq!(percentile(&image, 0), 0); // Exactly 10% of pixels have intensity <= 1. assert_eq!(percentile(&image, 10), 1); // Fewer than 15% of pixels have intensity <=1, so the 15th percentile is 2. assert_eq!(percentile(&image, 15), 2); // All pixels have intensity <= 10. assert_eq!(percentile(&image, 100), 10);