text_html_output_1.png
import cv2

import matplotlib.pyplot as plt

img = cv2.imread('/kaggle/input/brain-tumor-mri-images-44c/Carcinoma T2/112._big_gallery.jpeg')
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
threshold_value = 70
max_value = 255
threshold_type = cv2.THRESH_BINARY
_, binary_img = cv2.threshold(gray_img, threshold_value, max_value, threshold_type)

img1 = img
img2 = gray_img
img3 = binary_img
fig, axs = plt.subplots(1, 3, figsize=(12, 4))
fig.suptitle('Binarization of Image')
axs[0].imshow(cv2.cvtColor(img1, cv2.COLOR_BGR2RGB))
axs[1].imshow(img2, cmap='gray')
axs[2].imshow(img3)
for ax in axs:
    ax.set_xticks([])
    ax.set_yticks([])
plt.show()