I am trying to build a series of .fits images in Python and apply a threshold rule so that only high-value pixels stand out. My threshold rule is as follows:
threshold = 7000
test = np.greater_equal(cropped_image, threshold)
plt.imshow(test)
Thus, I return a black and white image that displays all pixels above the threshold as white and all pixels below the black threshold. However, what I would like to do - instead of creating a separate image - is to impose a color above the pixels that exceeds the threshold value.
I understand that the matplotlib module patchesis capable of superimposing colors and shapes on images; however, it seems to patchesrequire the user to enter fixed coordinate values that will indicate where the patch is located.
My question is, can it patchesbe changed so that patches can be placed above pixels that exceed the threshold? Or is there another module that would achieve this more efficiently? I haven’t found anything yet.
Thanks so much for any help!
source
share