So i'm trying to make a function that segmens out parts of the blood vessels of an eyeball as a part of my math course, however i get the same result no matter what threshold i put in, so i assume i must have done something very wrong in the following code:
def threshold_image(retina, threshold):
tImage = retina
for pixel in tImage.shape:
if pixel <=threshold:
pixel=1
else:
pixel=0
return tImage
img2 = threshold_image(img, 3)
io.imshow(img2, cmap=cm.Greys_r)
plt.show()
My plan was, to make a function that goes through every pixel of the picture, and then apply the threshold, and if it was above the threshold, the pixel would become 0(black), and if it was within it would be 1(white). However, im currently just getting the same picture i gave it as a result