Search code examples
pythonopencvimage-processingsimplecvtemplate-matching

How to programmatically fill in RGB noise in the transparent region of an image using Python?


I need to process a lot of images using Python. All these images have some transparent region (alpha channel) of different sizes.

I need to programmatically fill in RGB noise in the transparent region of those images, but keep the non-transparent region unchanged. This is an example of changing the images.

How to do this programmatically in Python?


Solution

  • In my opinion you need to:

    1. Create a Mat that contains Gaussian noise (or what kind of noise you need to add in the images).
    2. For each image you copy the noise Mat into another one based on the alpha channel (used as mask)
    3. Add the two images (initial and noise_mask) to he initial image (or the inital_noisy_background)