Hi I am a Matlab beginner, I would like to ask help about degrading an image file by adding in a certain amount of random noise data.
The percentage of the noise will be in a range of 0-100, indicating how the output will be:
0 will be no modification, 25 indicates that 75% of the image's content and 25% of noise, 75 indicates that 25% of the image's content and 75% noise, 100 would indicate the output should be the same size as the contents of the image, but containing all random noise and none of the original image data.
The following is my codes:
function out_image = image_plus_noise( in_image, percent_noise )
in_image = imread('sample_image.png');
image_proportion = 0.25;
percent_noise = rand(0:100);
my_percent_noise = uint8(percent_noise);
out_image = in_image{in_image}*image_proportion + percent_noise{my_percent_noise}*(1-image_proportion);
imshow(out_image)
However I can't run it correctly, there is a bug on line 6. Can anyone tell me what kinda bug I have? Am I on the right track?*