@@ -5,7 +5,8 @@ use image::Pixel;
55/// Applies a median filter of given dimensions to an image. Each output pixel is the median
66/// of the pixels in a `(2 * x_radius + 1) * (2 * y_radius + 1)` kernel of pixels in the input image.
77///
8- /// Pads by continuity. Performs O(max(x_radius, y_radius)) operations per pixel.
8+ /// Sampling outside of image boundaries is controlled by `extend`.
9+ /// Performs O(max(x_radius, y_radius)) operations per pixel.
910///
1011/// # Examples
1112/// ```
@@ -34,14 +35,17 @@ use image::Pixel;
3435/// // 9 | 9 100 11 | 11
3536/// // -----------------
3637/// // 9 9 100 11 11
38+ /// //
39+ /// // Here we choose `Border<P>` corresponding to it:
40+ /// let extend = Border::Replicate;
3741///
3842/// let filtered = gray_image!(
3943/// 2, 3, 3;
4044/// 9, 7, 7;
4145/// 9, 11, 11
4246/// );
4347///
44- /// assert_pixels_eq!(median_filter(&image, 1, 1, Border::Replicate ), filtered);
48+ /// assert_pixels_eq!(median_filter(&image, 1, 1, extend ), filtered);
4549/// # }
4650/// ```
4751///
@@ -323,7 +327,7 @@ impl HistSet {
323327 }
324328 }
325329
326- /// Safety: requires pixel.channels.len() <= self.data.len()
330+ /// Safety: requires P::CHANNEL_COUNT <= self.data.len()
327331 unsafe fn incr < P : Pixel < Subpixel = u8 > > ( & mut self , pixel : P ) {
328332 let channels = pixel. channels ( ) ;
329333 unsafe {
@@ -335,7 +339,7 @@ impl HistSet {
335339 }
336340 }
337341
338- /// Safety: requires pixel.channels.len() <= self.data.len()
342+ /// Safety: requires P::CHANNEL_COUNT <= self.data.len()
339343 unsafe fn decr < P : Pixel < Subpixel = u8 > > ( & mut self , pixel : P ) {
340344 let channels = pixel. channels ( ) ;
341345 unsafe {
@@ -347,7 +351,7 @@ impl HistSet {
347351 }
348352 }
349353
350- /// Safety: requires pixel.channels.len() <= self.data.len()
354+ /// Safety: requires P::CHANNEL_COUNT <= self.data.len()
351355 unsafe fn set_to_median < P : Pixel < Subpixel = u8 > > ( & self , pixel : & mut P ) {
352356 let channels = pixel. channels_mut ( ) ;
353357 unsafe {
0 commit comments