Yanis Saadallah
Yanis Saadallah

Reputation: 1

How can I blur or pixify images in python by using matrixes?

I already have a function that converts an image to a matrix, and back. But I was wondering how to manipulate the matrix so that the picture becomes blurry, or pixified?

Upvotes: 0

Views: 215

Answers (2)

Avijit Dasgupta
Avijit Dasgupta

Reputation: 2065

To make it blurry filter it using any low-pass filter (mean filter, gaussian filter etc.).

Upvotes: 0

NoDataDumpNoContribution
NoDataDumpNoContribution

Reputation: 10859

I suggest to use scipy.

To blur use gaussian_filter from scipy.ndimage.

Documentation

Please note that blurring may require additional normalization because typically the maximum values go down (are smeared out).

To pixelate use downsampling, for example decimate from scipy.signal.

Documentation

In case of color images I suggest to apply the blurring or pixelation to each color separately.

Upvotes: 1

Related Questions