ovl.image_filters.kernels module¶
-
ovl.image_filters.kernels.
cross_kernel
(size)[source]¶ Returns a cross (ones in a cross) kernel for morphological functions Example of a (5,5) cross:
| 0 0 1 0 0 || 0 0 1 0 0 || 1 1 1 1 1 || 0 0 1 0 0 || 0 0 1 0 0 |Parameters: size – a tuple of size 2 of 2 odd integers denoting the size of the kernel f.g. (5, 5) :return: the numpy.array of the cross shape
-
ovl.image_filters.kernels.
ellipse_kernel
(size)[source]¶ Returns an ellipse (ones in the shape of an ellipse) kernel for morphological functions Example of a (5,5) ellipse:
| 0 0 1 0 0 || 1 1 1 1 1 || 1 1 1 1 1 || 1 1 1 1 1 || 0 0 1 0 0 |Parameters: size – a tuple of size 2 of 2 odd integers denoting the size of the kernel f.g. (5, 5) :return: the kernel
-
ovl.image_filters.kernels.
horizontal_line_kernel
(size)[source]¶ Returns an horizontal line (a horizontal line of ones) kernel for morphological functions Example of a (5,5) horizontal line:
| 0 0 0 0 0 || 0 0 0 0 0 || 1 1 1 1 1 || 0 0 0 0 0 || 0 0 0 0 0 |Parameters: size – a tuple of size 2 of 2 odd integers denoting the size of the kernel f.g. (5, 5) :return: the kernel
-
ovl.image_filters.kernels.
is_odd_size
(size) → bool[source]¶ Validates that a kernel shape is of odd ints and of size 2
Parameters: size – the shape (size) to be checked Returns: doesnt raise an error if it’s ok.
-
ovl.image_filters.kernels.
rectangle_kernel
(size)[source]¶ Returns a rectangle (all ones) kernel for morphological functions Example of a (5,5) rectangle:
| 1 1 1 1 1 || 1 1 1 1 1 || 1 1 1 1 1 || 1 1 1 1 1 || 1 1 1 1 1 |Parameters: size – a tuple of size 2 of 2 odd integers denoting the size of the kernel f.g. (5, 5) :return: the numpy.array of the cross shape
-
ovl.image_filters.kernels.
validate_odd_size
(size)[source]¶ Validates that a kernel shape is of odd ints and of size 2
Parameters: size – the shape (size) to be checked Returns: False if size is invalid
-
ovl.image_filters.kernels.
vertical_line_kernel
(size)[source]¶ Returns a vertical line (a vertical line of ones) kernel for morphological functions Example of a (5,5) vertical line:
| 0 0 1 0 0 || 0 0 1 0 0 || 0 0 1 0 0 || 0 0 1 0 0 || 0 0 1 0 0 |Parameters: size – a tuple of size 2 of 2 odd integers denoting the size of the kernel f.g. (5, 5) :return: the kernel