Filter API#
- class serket.image.AvgBlur2D(kernel_size)[source]#
Average blur 2D layer.
- Parameters:
kernel_size (
int|tuple[int,int]) â size of the convolving kernel.dtype â data type of the layer.
float32
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> layer = sk.image.AvgBlur2D(kernel_size=3) >>> print(layer(jnp.ones((1, 5, 5)))) [[[0.44444448 0.6666667 0.6666667 0.6666667 0.44444448] [0.6666667 1. 1. 1. 0.6666667 ] [0.6666667 1. 1. 1. 0.6666667 ] [0.6666667 1. 1. 1. 0.6666667 ] [0.44444448 0.6666667 0.6666667 0.6666667 0.44444448]]]
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.BilateralBlur2D(kernel_size, *, sigma_space, sigma_color)[source]#
Apply bilateral blur to a channel-first image.
- Parameters:
kernel_size (
int|tuple[int,int]) â kernel size. accepts int or tuple of two ints.sigma_space (
float|tuple[float,float]) â sigma in the coordinate space. accepts float or tuple of two floats.sigma_color (
float) â sigma in the color space. accepts float.
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> x = jnp.ones([1, 5, 5]) >>> layer = sk.image.BilateralBlur2D((3, 5), sigma_space=(1.2, 1.3), sigma_color=1.5) >>> print(layer(x)) [[[0.5231399 0.6869784 0.75100434 0.6869784 0.5231399 ] [0.70914114 0.9193193 1. 0.9193192 0.70914114] [0.70914114 0.9193193 1. 0.9193192 0.70914114] [0.70914114 0.9193193 1. 0.9193192 0.70914114] [0.5231399 0.6869784 0.75100434 0.6869784 0.5231399 ]]]
- class serket.image.BlurPool2D(kernel_size, strides)[source]#
Blur and downsample a channel-first image.
- Parameters:
kernel_size (
int|tuple[int,int]) â kernel size. accepts int or tuple of two ints.strides (
int|tuple[int,int]) â strides. accepts int or tuple of two ints.
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> x = jnp.arange(1, 26).reshape(1, 5, 5) >>> layer = sk.image.BlurPool2D(kernel_size=3, strides=2) >>> print(layer(x)) [[[ 1.6875 3.5 3.5625] [ 8.5 13. 11. ] [11.0625 16. 12.9375]]]
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.BoxBlur2D(kernel_size)[source]#
Box blur 2D layer.
- Parameters:
kernel_size (
int|tuple[int,int]) â size of the convolving kernel. Accepts int or tuple of two ints.dtype â data type of the layer.
float32
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> layer = sk.image.BoxBlur2D((3, 5)) >>> print(layer(jnp.ones((1, 5, 5)))) [[[0.40000004 0.53333336 0.6666667 0.53333336 0.40000004] [0.6 0.8 1. 0.8 0.6 ] [0.6 0.8 1. 0.8 0.6 ] [0.6 0.8 1. 0.8 0.6 ] [0.40000004 0.53333336 0.6666667 0.53333336 0.40000004]]]
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.ElasticTransform2D(kernel_size, sigma, alpha)[source]#
Apply an elastic transform to an image.
- Parameters:
kernel_size (
int|tuple[int,int]) â The size of the Gaussian kernel. either a single integer or a tuple of two integers.sigma (
float|tuple[float,float]) â The standard deviation of the Gaussian in the y and x directions,alpha (
float|tuple[float,float]) â The scaling factor that controls the intensity of the deformation in the y and x directions, respectively.
Example
>>> import serket as sk >>> import jax.random as jr >>> import jax.numpy as jnp >>> layer = sk.image.ElasticTransform2D(kernel_size=3, sigma=1.0, alpha=1.0) >>> key = jr.key(0) >>> image = jnp.arange(1, 26).reshape(1, 5, 5).astype(jnp.float32) >>> print(layer(image, key=key)) [[[ 1.0669159 2.2596366 3.210071 3.9703817 4.9207525] [ 5.70821 7.483665 8.857002 8.663773 8.794132 ] [13.809857 15.865877 15.109764 12.897442 13.0018215] [18.35189 18.817993 17.2193 15.731948 17.026705 ] [21. 21.659977 21.43855 21.138866 22.583244 ]]]
- __call__(image, *, key)#
Call self as a function.
- Parameters:
image (
Array)key (
Array)
- Return type:
Array
- class serket.image.FFTAvgBlur2D(kernel_size)[source]#
Average blur 2D layer using FFT.
- Parameters:
kernel_size (
int|tuple[int,int]) â size of the convolving kernel.dtype â data type of the layer.
float32
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> layer = sk.image.FFTAvgBlur2D(kernel_size=3) >>> print(layer(jnp.ones((1, 5, 5)))) [[[0.44444448 0.6666667 0.6666667 0.6666667 0.44444448] [0.6666667 1. 1. 1. 0.6666667 ] [0.6666667 1. 1. 1. 0.6666667 ] [0.6666667 1. 1. 1. 0.6666667 ] [0.44444448 0.6666667 0.6666667 0.6666667 0.44444448]]]
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.FFTBlurPool2D(kernel_size, strides)[source]#
Blur and downsample a channel-first image using FFT.
- Parameters:
kernel_size (
int|tuple[int,int]) â kernel size. accepts int or tuple of two ints.strides (
int|tuple[int,int]) â stride. accepts int or tuple of two ints.
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> x = jnp.arange(1, 26).reshape(1, 5, 5) >>> layer = sk.image.FFTBlurPool2D(kernel_size=3, strides=2) >>> print(layer(x)) [[[ 1.6875 3.5 3.5625] [ 8.5 13. 11. ] [11.0625 16. 12.9375]]]
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.FFTBoxBlur2D(kernel_size)[source]#
Box blur 2D layer using FFT.
- Parameters:
kernel_size (
int|tuple[int,int]) â size of the convolving kernel. Accepts int or tuple of two ints.dtype â data type of the layer.
float32
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> layer = sk.image.BoxBlur2D((3, 5)) >>> print(layer(jnp.ones((1, 5, 5)))) [[[0.40000004 0.53333336 0.6666667 0.53333336 0.40000004] [0.6 0.8 1. 0.8 0.6 ] [0.6 0.8 1. 0.8 0.6 ] [0.6 0.8 1. 0.8 0.6 ] [0.40000004 0.53333336 0.6666667 0.53333336 0.40000004]]]
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.FFTElasticTransform2D(kernel_size, sigma, alpha)[source]#
Apply an elastic transform to an image using FFT.
- Parameters:
kernel_size (
int|tuple[int,int]) â The size of the Gaussian kernel. either a single integer or a tuple of two integers.sigma (
float|tuple[float,float]) â The standard deviation of the Gaussian in the y and x directions,alpha (
float|tuple[float,float]) â The scaling factor that controls the intensity of the deformation in the y and x directions, respectively.
Example
>>> import serket as sk >>> import jax.random as jr >>> import jax.numpy as jnp >>> layer = sk.image.FFTElasticTransform2D(kernel_size=3, sigma=1.0, alpha=1.0) >>> key = jr.key(0) >>> image = jnp.arange(1, 26).reshape(1, 5, 5).astype(jnp.float32) >>> print(layer(image, key=key)) [[[ 1.0669159 2.2596366 3.210071 3.9703817 4.9207525] [ 5.70821 7.483665 8.857002 8.663773 8.794132 ] [13.809857 15.865877 15.109764 12.897442 13.0018215] [18.35189 18.817993 17.2193 15.731948 17.026705 ] [21. 21.659977 21.43855 21.138866 22.583244 ]]]
- __call__(image, *, key)#
Call self as a function.
- Parameters:
image (
Array)key (
Array)
- Return type:
Array
- class serket.image.FFTGaussianBlur2D(kernel_size, *, sigma=1.0)[source]#
Apply Gaussian blur to a channel-first image using FFT.
- Parameters:
kernel_size (
int|tuple[int,int]) â kernel size. accepts int or tuple of two ints.sigma (
float|tuple[float,float]) â sigma. Defaults to 1. accepts float or tuple of two floats.dtype â data type of the layer.
float32
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> layer = sk.image.FFTGaussianBlur2D(kernel_size=3) >>> print(layer(jnp.ones((1, 5, 5)))) [[[0.5269764 0.7259314 0.7259314 0.7259314 0.5269764] [0.7259314 1. 1. 1. 0.7259314] [0.7259314 1. 1. 1. 0.7259314] [0.7259314 1. 1. 1. 0.7259314] [0.5269764 0.7259314 0.7259314 0.7259314 0.5269764]]]
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.FFTLaplacian2D(kernel_size)[source]#
Apply Laplacian filter to a channel-first image using FFT.
- Parameters:
kernel_size (
int|tuple[int,int]) â size of the convolving kernel. Accepts int or tuple of two ints.dtype â data type of the layer.
float32
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> layer = sk.image.FFTLaplacian2D(kernel_size=(3, 5)) >>> print(layer(jnp.ones((1, 5, 5)))) [[[-9. -7. -5. -7. -9.] [-6. -3. 0. -3. -6.] [-6. -3. 0. -3. -6.] [-6. -3. 0. -3. -6.] [-9. -7. -5. -7. -9.]]]
Note
The laplacian considers all the neighbors of a pixel.
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.FFTMotionBlur2D(kernel_size, *, angle=0.0, direction=0.0)[source]#
Apply motion blur to a channel-first image using FFT.
- Parameters:
kernel_size (
int) â motion kernel width and height. It should be odd and positive.angle (
float) â angle of the motion blur in degrees (anti-clockwise rotation).direction (
float) â direction of the motion blur.dtype â data type of the layer.
float32
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> x = jnp.arange(1, 17).reshape(1, 4, 4) + 0.0 >>> print(sk.image.MotionBlur2D(3, angle=30, direction=0.5)(x)) [[[ 0.7827108 2.4696379 3.3715053 3.8119273] [ 2.8356633 6.3387947 7.3387947 7.1810846] [ 5.117592 10.338796 11.338796 10.550241 ] [ 6.472714 10.020969 10.770187 9.100007 ]]]
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.FFTSobel2D(*a, **k)[source]#
Apply Sobel filter to a channel-first image using FFT.
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> x = jnp.arange(1,26).reshape(1, 5,5).astype(jnp.float32) >>> layer = sk.image.FFTSobel2D() >>> layer(x) [[[21.954498, 28.635643, 32.55764 , 36.496574, 33.61547 ], [41.036568, 40.792156, 40.792156, 40.792156, 46.8615 ], [56.603886, 40.792156, 40.792156, 40.792156, 63.529522], [74.323616, 40.792156, 40.792156, 40.792156, 81.706795], [78.24321 , 68.26419 , 72.249565, 76.23647 , 89.27486 ]]]
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.FFTUnsharpMask2D(kernel_size, *, sigma=1.0)[source]#
Apply unsharp mask to a channel-first image using FFT.
- Parameters:
kernel_size (
int|tuple[int,int]) â kernel size. accepts int or tuple of two ints.sigma (
float|tuple[float,float]) â sigma. Defaults to 1. accepts float or tuple of two floats.dtype â data type of the layer.
float32
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> layer = sk.image.FFTUnsharpMask2D(kernel_size=3) >>> print(layer(jnp.ones((1, 5, 5)))) [[[1.4730237 1.2740686 1.2740686 1.2740686 1.4730237] [1.2740686 1. 1. 1. 1.2740686] [1.2740686 1. 1. 1. 1.2740686] [1.2740686 1. 1. 1. 1.2740686] [1.4730237 1.2740686 1.2740686 1.2740686 1.4730237]]]
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.GaussianBlur2D(kernel_size, *, sigma=1.0)[source]#
Apply Gaussian blur to a channel-first image.
- Parameters:
kernel_size (
int|tuple[int,int]) â kernel size. accepts int or tuple of two ints.sigma (
float|tuple[float,float]) â sigma. Defaults to 1. accepts float or tuple of two floats.dtype â data type of the layer.
float32
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> layer = sk.image.GaussianBlur2D(kernel_size=3) >>> print(layer(jnp.ones((1, 5, 5)))) [[[0.5269764 0.7259314 0.7259314 0.7259314 0.5269764] [0.7259314 1. 1. 1. 0.7259314] [0.7259314 1. 1. 1. 0.7259314] [0.7259314 1. 1. 1. 0.7259314] [0.5269764 0.7259314 0.7259314 0.7259314 0.5269764]]]
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.JointBilateralBlur2D(kernel_size, *, sigma_space, sigma_color)[source]#
Apply joint bilateral blur to a channel-first image.
- Parameters:
kernel_size (
int|tuple[int,int]) â kernel size. accepts int or tuple of two ints.sigma_space (
float|tuple[float,float]) â sigma in the coordinate space. accepts float or tuple of two floats.sigma_color (
float) â sigma in the color space. accepts float.
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> x = jnp.ones([1, 5, 5]) >>> guide = jnp.ones([1, 5, 5]) >>> layer = sk.image.JointBilateralBlur2D((3, 5), sigma_space=(1.2, 1.3), sigma_color=1.5) >>> print(layer(x, guide)) [[[0.5231399 0.6869784 0.75100434 0.6869784 0.5231399 ] [0.70914114 0.9193193 1. 0.9193192 0.70914114] [0.70914114 0.9193193 1. 0.9193192 0.70914114] [0.70914114 0.9193193 1. 0.9193192 0.70914114] [0.5231399 0.6869784 0.75100434 0.6869784 0.5231399 ]]]
- class serket.image.Laplacian2D(kernel_size)[source]#
Apply Laplacian filter to a channel-first image.
- Parameters:
kernel_size (
int|tuple[int,int]) â size of the convolving kernel. Accepts int or tuple of two ints.dtype â data type of the layer.
float32
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> layer = sk.image.Laplacian2D(kernel_size=(3, 5)) >>> print(layer(jnp.ones((1, 5, 5)))) [[[-9. -7. -5. -7. -9.] [-6. -3. 0. -3. -6.] [-6. -3. 0. -3. -6.] [-6. -3. 0. -3. -6.] [-9. -7. -5. -7. -9.]]]
Note
The laplacian considers all the neighbors of a pixel.
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.MedianBlur2D(kernel_size)[source]#
Apply median filter to a channel-first image.
- Parameters:
kernel_size (
int|tuple[int,int]) â size of the convolving kernel. Accepts int or tuple of two ints.
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> x = jnp.arange(1, 26).reshape(1, 5, 5) + 0.0 >>> print(x) [[[ 1. 2. 3. 4. 5.] [ 6. 7. 8. 9. 10.] [11. 12. 13. 14. 15.] [16. 17. 18. 19. 20.] [21. 22. 23. 24. 25.]]] >>> print(sk.image.MedianBlur2D(3)(x)) [[[ 0. 2. 3. 4. 0.] [ 2. 7. 8. 9. 5.] [ 7. 12. 13. 14. 10.] [12. 17. 18. 19. 15.] [ 0. 17. 18. 19. 0.]]]
- class serket.image.MotionBlur2D(kernel_size, *, angle=0.0, direction=0.0)[source]#
Apply motion blur to a channel-first image.
- Parameters:
kernel_size (
int) â motion kernel width and height. It should be odd and positive.angle (
float) â angle of the motion blur in degrees (anti-clockwise rotation).direction (
float) â direction of the motion blur.dtype â data type of the layer.
float32
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> x = jnp.arange(1, 17).reshape(1, 4, 4) + 0.0 >>> print(sk.image.MotionBlur2D(3, angle=30, direction=0.5)(x)) [[[ 0.7827108 2.4696379 3.3715053 3.8119273] [ 2.8356633 6.3387947 7.3387947 7.1810846] [ 5.117592 10.338796 11.338796 10.550241 ] [ 6.472714 10.020969 10.770187 9.100007 ]]]
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.Sobel2D(*a, **k)[source]#
Apply Sobel filter to a channel-first image.
- Parameters:
dtype â data type of the layer. Defaults to
float32.
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> x = jnp.arange(1,26).reshape(1, 5,5).astype(jnp.float32) >>> layer = sk.image.Sobel2D() >>> layer(x) [[[21.954498, 28.635643, 32.55764 , 36.496574, 33.61547 ], [41.036568, 40.792156, 40.792156, 40.792156, 46.8615 ], [56.603886, 40.792156, 40.792156, 40.792156, 63.529522], [74.323616, 40.792156, 40.792156, 40.792156, 81.706795], [78.24321 , 68.26419 , 72.249565, 76.23647 , 89.27486 ]]]
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- class serket.image.UnsharpMask2D(kernel_size, *, sigma=1.0)[source]#
Apply unsharp mask to a channel-first image.
- Parameters:
kernel_size (
int|tuple[int,int]) â kernel size. accepts int or tuple of two ints.sigma (
float|tuple[float,float]) â sigma. Defaults to 1. accepts float or tuple of two floats.dtype â data type of the layer.
float32
Example
>>> import serket as sk >>> import jax.numpy as jnp >>> layer = sk.image.UnsharpMask2D(kernel_size=3) >>> print(layer(jnp.ones((1, 5, 5)))) [[[1.4730237 1.2740686 1.2740686 1.2740686 1.4730237] [1.2740686 1. 1. 1. 1.2740686] [1.2740686 1. 1. 1. 1.2740686] [1.2740686 1. 1. 1. 1.2740686] [1.4730237 1.2740686 1.2740686 1.2740686 1.4730237]]]
- __call__(image)#
Call self as a function.
- Parameters:
image (
Array)- Return type:
Array
- serket.image.avg_blur_2d(image, kernel_size, dtype=None)[source]#
Average blur.
- Parameters:
image (
Array) â 2D input array. shape is (height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- Return type:
Array- Returns:
Average blurred array. shape is (height, width).
- serket.image.bilateral_blur_2d(image, kernel_size, sigma_space, sigma_color, dtype=None)[source]#
Bilateral blur.
- Parameters:
image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.sigma_space (
tuple[float,float]) â sigma of gaussian kernel.sigma_color (
float) â sigma of gaussian kernel.dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- serket.image.blur_pool_2d(image, kernel_size, strides)[source]#
Blur pooling see https://arxiv.org/abs/1904.11486
- Parameters:
image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.strides (
tuple[int,int]) â stride of the convolution. Accepts tuple of two ints.
- Return type:
Array
- serket.image.box_blur_2d(image, kernel_size, dtype=None)[source]#
Box blur.
- Parameters:
image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- Return type:
Array- Returns:
Box blurred array. shape is
(height, width).
- serket.image.elastic_transform_2d(key, image, kernel_size, sigma, alpha, dtype=None)[source]#
Elastic transform.
- Parameters:
key (
Array) â jax random key.image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.sigma (
tuple[float,float]) â sigma of gaussian kernel.alpha (
tuple[float,float]) â alpha of gaussian kernel.dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- serket.image.fft_avg_blur_2d(image, kernel_size, dtype=None)[source]#
Average blur using FFT.
- Parameters:
image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- Return type:
Array- Returns:
Average blurred array. shape is
(height, width).
- serket.image.fft_blur_pool_2d(image, kernel_size, strides)[source]#
Blur pooling see https://arxiv.org/abs/1904.11486
- Parameters:
image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.strides (
tuple[int,int]) â stride of the convolution. Accepts tuple of two ints.
- Return type:
Array
- serket.image.fft_box_blur_2d(image, kernel_size, dtype=None)[source]#
Box blur using FFT.
- Parameters:
image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- Return type:
Array- Returns:
Box blurred array. shape is
(height, width).
- serket.image.fft_elastic_transform_2d(key, image, kernel_size, sigma, alpha, dtype=None)[source]#
Elastic transform using FFT.
- Parameters:
key (
Array) â jax random key.image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.sigma (
tuple[float,float]) â sigma of gaussian kernel.alpha (
tuple[float,float]) â alpha of gaussian kernel.dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- serket.image.fft_filter_2d(image, weight, strides=(1, 1))[source]#
Filtering wrapping
serketfft_conv_general_dilated- Parameters:
image (
Array) â 2D input array. shape is (height, width).weight (
Array) â convolutional kernel. shape is (height, width).strides (
tuple[int,int]) â stride of the convolution. Accepts tuple of two ints.
- Return type:
Array
- serket.image.fft_gaussian_blur_2d(image, kernel_size, sigma, dtype=None)[source]#
Gaussian blur using FFT.
- Parameters:
image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.sigma (
tuple[float,float]) â sigma of gaussian kernel.dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- Return type:
Array
- serket.image.fft_laplacian_2d(image, kernel_size, dtype=None)[source]#
Laplacian using FFT.
- Parameters:
image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- Return type:
Array- Returns:
Laplacian array. shape is
(height, width).
- serket.image.fft_motion_blur_2d(image, kernel_size, angle, direction, dtype=None)[source]#
Motion blur using FFT.
- Parameters:
image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â motion kernel width and height. It should be odd and positive.angle (
float) â angle of the motion blur in degrees (anti-clockwise rotation).direction (
int|float) â direction of the motion blur in degrees (anti-clockwise rotation).dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- Return type:
Array
- serket.image.fft_sobel_2d(image, dtype=None)[source]#
Sobel filter using FFT.
- Parameters:
image (
Array) â 2D input array. shape is(height, width).dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- Return type:
Array
- serket.image.fft_unsharp_mask_2d(image, kernel_size, sigma, dtype=None)[source]#
Unsharp mask using FFT.
- Parameters:
image (
Array) â 2D input array. shape is (height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.sigma (
tuple[float,float]) â sigma of gaussian kernel.dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- Return type:
Array- Returns:
Unsharp masked array. shape is (height, width).
- serket.image.filter_2d(image, weight, strides=(1, 1))[source]#
Filtering wrapping
jax.lax.conv_general_dilated.- Parameters:
image (
Array) â 2D input array. shape is(height, width).weight (
Array) â convolutional kernel. shape is(height, width).strides (
tuple[int,int]) â stride of the convolution. Accepts tuple of two ints.
- Return type:
Array
- serket.image.gaussian_blur_2d(image, kernel_size, sigma, dtype=None)[source]#
Gaussian blur.
- Parameters:
image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.sigma (
tuple[float,float]) â sigma of gaussian kernel.dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- Return type:
Array
- serket.image.joint_bilateral_blur_2d(image, guidance, kernel_size, sigma_space, sigma_color, dtype=None)[source]#
Joint bilateral blur.
- Parameters:
image (
Array) â 2D input array. shape is(height, width).guidance (
Array) â 2D guidance array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.sigma_space (
tuple[float,float]) â sigma of gaussian kernel.sigma_color (
float) â sigma of gaussian kernel.dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- serket.image.laplacian_2d(image, kernel_size, dtype=None)[source]#
Laplacian.
- Parameters:
image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- Return type:
Array- Returns:
Laplacian array. shape is
(height, width).
- serket.image.median_blur_2d(image, kernel_size)[source]#
Median blur
- Parameters:
image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.
- Return type:
Array
- serket.image.motion_blur_2d(image, kernel_size, angle, direction, dtype=None)[source]#
Motion blur.
- Parameters:
image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â motion kernel width and height. It should be odd and positive.angle (
float) â angle of the motion blur in degrees (anti-clockwise rotation).direction (
int|float) â direction of the motion blur in degrees (anti-clockwise rotation).dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- Return type:
Array
- serket.image.sobel_2d(image, dtype=None)[source]#
Sobel filter.
- Parameters:
image (
Array) â 2D input array. shape is(height, width).dtype (
Union[dtype,str,Any,None]) â data type of the kernel.
- Return type:
Array
- serket.image.unsharp_mask_2d(image, kernel_size, sigma, dtype=None)[source]#
Unsharp mask.
- Parameters:
image (
Array) â 2D input array. shape is(height, width).kernel_size (
tuple[int,int]) â size of the convolving kernel. Accepts tuple of two ints.sigma (
tuple[float,float]) â sigma of gaussian kernel.dtype (
Union[dtype,str,Any,None]) â data type of the kernel. Defaults toNoneto use the same data type asarray.
- Return type:
Array- Returns:
Unsharp masked array. shape is
(height, width).