IDS peak ICV v1.2.0
Loading...
Searching...
No Matches
MedianFilter Class Reference

Public Member Functions

None __init__ (self)
 Creates an instance of the MedianFilter class with a default kernel size of 3x3.
 
int kernel_size (self)
 Gets the current kernel size used for the median filter.
 
None kernel_size (self, int kernel_size)
 Sets the size of the kernel used for the median filter.
 
Image process (self, Union[Image, ids_peak_ipl.Image] image)
 Applies the median filter to the given image and returns the filtered result.
 

Protected Attributes

int _kernel_size = 3
 

Detailed Description

Class for applying a median filter to an image.

The MedianFilter class applies a median filter to reduce noise in an image. It replaces each pixel value with the median value of its neighboring pixels, based on a defined kernel size.

Since
ids_peak_icv 1.1

Definition at line 11 of file median_filter.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ ( self)

Creates an instance of the MedianFilter class with a default kernel size of 3x3.

Since
ids_peak_icv 1.1

Definition at line 23 of file median_filter.py.

Member Function Documentation

◆ kernel_size() [1/2]

int kernel_size ( self)

Gets the current kernel size used for the median filter.

Returns
int: The size of the kernel.
Since
ids_peak_icv 1.1

Definition at line 33 of file median_filter.py.

◆ kernel_size() [2/2]

None kernel_size ( self,
int kernel_size )

Sets the size of the kernel used for the median filter.

Parameters
kernel_sizeSize of the kernel. Must be an odd number greater than 1. Also, it has to be smaller than the image size.
Since
ids_peak_icv 1.1

Definition at line 45 of file median_filter.py.

◆ process()

Image process ( self,
Union[Image, ids_peak_ipl.Image] image )

Applies the median filter to the given image and returns the filtered result.

This function processes the entire image and reduces noise using the specified kernel size. The output image will have the same pixel format and dimensions as the input image.

Note
This operation disregards any specified image regions. It processes the entire image.
Parameters
imageThe input image to which the median filter will be applied. It can be of type Image or ids_peak_ipl.Image.
Returns
Image: The filtered image with reduced noise.
Exceptions
NotSupportedExceptionIf the input image is of an unsupported format.
NotPossibleExceptionIf the KernelSize is not a valid odd number greater than 1.
OutOfRangeExceptionIf the kernel size is bigger than the given image.
Since
ids_peak_icv 1.1

Definition at line 57 of file median_filter.py.

Field Documentation

◆ _kernel_size

_kernel_size = 3
protected

Definition at line 30 of file median_filter.py.