[Python] How to add stripe noise to an image? (Matlab, Python, C++)

Discussão em 'Python' iniciado por Stack, Junho 28, 2025.

  1. Stack

    Stack Membro Participativo

    I want to add artificial noise to the image, what should I do?

    You want to put stripes at regular pixel intervals, as shown in the figure below:

    [​IMG]

    I wrote the code below to put black stripes on one line for every three lines

    for i = 1:512
    counter = counter + 1;
    if counter > 3
    counter = 0;
    end
    for j = 1:512
    if counter < 3
    img{i,j} = 255;
    elseif counter == 3
    img{i,j} = 0;
    end
    end
    end

    fr = imread("image.bmp")

    sum = fr + img;


    I thought I could simply add the stripe arrangement and image made like this.

    However, the pixel that should be zero value was not created because the pixel value of the original image was included. The result was added only white stripes with a value of 0.

    Please let me know if there is a function or code to put stripe noise in the mat wrap.

    Continue reading...

Compartilhe esta Página