Mini Project 1: Grayscale to Binary Image

Mini Project 1: Grayscale to Binary Image

Problem statement

In this exercise, you are given a grayscale image whose pixel values are stored in a 2-D array named image.

In the grayscale image, we use a single 8-bit integer to represent the brightness of the pixel. 0 represents black, while 255 represents white. Everything between 0 and 255 represents different shades of gray.

Your task is to apply thresholding to convert the grayscale image to a black and white one.

Sample input image

Sample output image