From f2c133ac51c28a92243f0a616e3931dd7df15297 Mon Sep 17 00:00:00 2001 From: Alex Severin Date: Mon, 27 May 2024 20:50:54 +0300 Subject: [PATCH] rename arguments back and remove deprecated --- src/gradients.rs | 46 +++++----------------------------------------- 1 file changed, 5 insertions(+), 41 deletions(-) diff --git a/src/gradients.rs b/src/gradients.rs index ee982b7f..01faac4d 100644 --- a/src/gradients.rs +++ b/src/gradients.rs @@ -7,14 +7,14 @@ use crate::map::{ChannelMap, WithChannel}; use image::{GenericImage, GenericImageView, GrayImage, Luma, Pixel}; use itertools::multizip; -/// A special version of `gradient()` function for greyscale images which doesn't require giving a +/// A special version of `gradient()` function for grayscale images which doesn't require giving a /// pixel mapping function. -pub fn gradients_greyscale( +pub fn gradients_grayscale( image: &GrayImage, - kernel1: Kernel, - kernel2: Kernel, + horizontal_kernel: Kernel, + vertical_kernel: Kernel, ) -> Image> { - gradients(image, kernel1, kernel2, |p| p) + gradients(image, horizontal_kernel, vertical_kernel, |p| p) } // TODO: Returns directions as well as magnitudes. @@ -157,69 +157,41 @@ fn gradient_magnitude(dx: f32, dy: f32) -> u16 { /// Convolves an image with the [`HORIZONTAL_SOBEL`](static.HORIZONTAL_SOBEL.html) /// kernel to detect horizontal gradients. -#[deprecated( - since = "0.25.0", - note = "users should instead use `filter_clamped(image, kernel::SOBEL_HORIZONTAL_3X3)` which is more flexible and explicit" -)] pub fn horizontal_sobel(image: &GrayImage) -> Image> { filter_clamped(image, kernel::SOBEL_HORIZONTAL_3X3) } /// Convolves an image with the [`VERTICAL_SOBEL`](static.VERTICAL_SOBEL.html) /// kernel to detect vertical gradients. -#[deprecated( - since = "0.25.0", - note = "users should instead use `filter_clamped(image, kernel::SOBEL_VERTICAL_3X3)` which is more flexible and explicit" -)] pub fn vertical_sobel(image: &GrayImage) -> Image> { filter_clamped(image, kernel::SOBEL_VERTICAL_3X3) } /// Convolves an image with the [`HORIZONTAL_SCHARR`](static.HORIZONTAL_SCHARR.html) /// kernel to detect horizontal gradients. -#[deprecated( - since = "0.25.0", - note = "users should instead use `filter_clamped(image, kernel::SCHARR_HORIZONTAL_3X3)` which is more flexible and explicit" -)] pub fn horizontal_scharr(image: &GrayImage) -> Image> { filter_clamped(image, kernel::SCHARR_HORIZONTAL_3X3) } /// Convolves an image with the [`VERTICAL_SCHARR`](static.VERTICAL_SCHARR.html) /// kernel to detect vertical gradients. -#[deprecated( - since = "0.25.0", - note = "users should instead use `filter_clamped(image, kernel::SCHARR_VERTICAL_3X3)` which is more flexible and explicit" -)] pub fn vertical_scharr(image: &GrayImage) -> Image> { filter_clamped(image, kernel::SCHARR_VERTICAL_3X3) } /// Convolves an image with the [`HORIZONTAL_PREWITT`](static.HORIZONTAL_PREWITT.html) /// kernel to detect horizontal gradients. -#[deprecated( - since = "0.25.0", - note = "users should instead use `filter_clamped(image, kernel::PREWITT_HORIZONTAL_3X3)` which is more flexible and explicit" -)] pub fn horizontal_prewitt(image: &GrayImage) -> Image> { filter_clamped(image, kernel::PREWITT_HORIZONTAL_3X3) } /// Convolves an image with the [`VERTICAL_PREWITT`](static.VERTICAL_PREWITT.html) /// kernel to detect vertical gradients. -#[deprecated( - since = "0.25.0", - note = "users should instead use `filter_clamped(image, kernel::PREWITT_VERTICAL_3X3)` which is more flexible and explicit" -)] pub fn vertical_prewitt(image: &GrayImage) -> Image> { filter_clamped(image, kernel::PREWITT_VERTICAL_3X3) } /// Returns the magnitudes of gradients in an image using Sobel filters. -#[deprecated( - since = "0.25.0", - note = "users should instead use `gradients_greyscale(image, kernel::SOBEL_HORIZONTAL_3X3, Kernel::SOBEL_VERTICAL_3X3)` which is more flexible and explicit" -)] pub fn sobel_gradients(image: &GrayImage) -> Image> { gradients( image, @@ -230,10 +202,6 @@ pub fn sobel_gradients(image: &GrayImage) -> Image> { } /// Returns the magnitudes of gradients in an image using Prewitt filters. -#[deprecated( - since = "0.25.0", - note = "users should instead use `gradients_greyscale(image, kernel::PREWITT_HORIZONTAL_3X3, Kernel::PREWITT_VERTICAL_3X3)` which is more flexible and explicit" -)] pub fn prewitt_gradients(image: &GrayImage) -> Image> { gradients( image, @@ -309,10 +277,6 @@ pub fn prewitt_gradients(image: &GrayImage) -> Image> { /// max_gradient /// ); /// # } -#[deprecated( - since = "0.25.0", - note = "users should instead use `gradients(image, kernel::SOBEL_HORIZONTAL_3X3, Kernel::SOBEL_VERTICAL_3X3, f)` which is more flexible and explicit" -)] pub fn sobel_gradient_map(image: &Image

, f: F) -> Image where P: Pixel + WithChannel + WithChannel,