nrtk.impls.perturb_image.generic.cv2.blur
Implements PerturbImage blurs: average, Gaussian, and median, with customizable kernel sizes.
- Classes:
AverageBlurPerturber: Applies average blurring to an image. GaussianBlurPerturber: Applies Gaussian blurring to an image, useful for reducing noise
and detail with a smooth effect.
- MedianBlurPerturber: Applies median blurring to an image, commonly used for removing
salt-and-pepper noise while preserving edges.
- Dependencies:
OpenCV (cv2) for image processing.
numpy for handling image data.
- Usage:
Each blur perturber class can be instantiated with a specific kernel size, controlling the intensity and spread of the blur. The perturb method applies the blur effect to an input image, returning the processed result.
- Example:
avg_blur = AverageBlurPerturber(ksize=3) blurred_image, boxes = avg_blur.perturb(input_image, boxes)
gauss_blur = GaussianBlurPerturber(ksize=5) blurred_image, boxes = gauss_blur.perturb(input_image, boxes)
median_blur = MedianBlurPerturber(ksize=3) blurred_image, boxes = median_blur.perturb(input_image, boxes)
- Note:
Each class requires OpenCV for functionality. An ImportError will be raised if OpenCV is not available. The boxes returned from perturb are identical to the boxes passed in.
Classes
Applies average blurring to the image stimulus. |
|
Applies Gaussian blurring to the image stimulus. |
|
Applies median blurring to the image stimulus. |