2

I want to predict disease and I want to try to make the image have some noise or disruption in specific spot or randomly spot is there any method or solution for it?? is there any way to add noise (random value) to image with tensorflow

I read the image and convert it to array and make a copy of it and then add to it some number is that right?? and i have noticed that when convert it the array became values of zeros and ones even it in rgb form. i expect the some value in the array or the value in the image change to another values so when imshow (the image) notice some noise (different from guassian noise) so when the input to the model become different from the original image

a-eng
  • 23
  • 5
  • Couldn't you just generate a random float (or int) and replace a random pixel value with that? – Djinn Nov 27 '22 at 06:14
  • that's my point but couldn't find a way for it , adding random pixel to image?? – a-eng Nov 27 '22 at 18:20
  • Images are represented as nested arrays of ints or floats. So all you'd have to do is randomly pick a coordinate and change the value. – Djinn Nov 27 '22 at 22:17

1 Answers1

0
for i in range(width//2):
for j in range(height//2):
  y = random.randint(20,200)
  x = random.randint(20,200)
  n = random.randint(10,100)
  im_p.putpixel((x,y),(n,n,n))
a-eng
  • 23
  • 5
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 21 '23 at 21:59