I am trying to threshold an image based on a hardcoded value.I am doing it by assigning the original image to a variable. This variable is used for thresholding. But, when I execute this, the original image is also getting thresholded. Am I doing something wrong? Or is there any other way to do this? The code is provided below:
import numpy as np
from scipy.misc import imread
import matplotlib.pyplot as plt
img1 = imread('4.2.04.tiff')
imgx = img1
imgx[img1>=150] = 0
plt.figure()
plt.imshow(np.uint8(img1))
plt.show()
plt.title('Original Image after thresholding')
plt.figure()
plt.imshow(np.uint8(imgx))
plt.title('Thresholded Image')