Click4Ai

315.

Easy

Image Thresholding

=======================

Description:

Thresholding is a technique to separate an image into two parts based on the intensity of the pixels. It's a fundamental operation in image processing and computer vision.

Example:

Consider an image with a binary object on a white background. We can use thresholding to separate the object from the background.

Constraints:

* The input image is a 2D array of pixel intensities.

* The threshold value is a scalar.

* The output image is a binary array where pixels with intensity above the threshold are set to 1 and below the threshold are set to 0.

Goal:

Implement a function to perform image thresholding using NumPy.

Test Cases

Test Case 1
Input: [[10, 20, 30], [40, 50, 60]]
Expected: [[0, 0, 0], [0, 0, 0]]
Test Case 2
Input: [[100, 200, 300], [400, 500, 600]]
Expected: [[1, 1, 1], [1, 1, 1]]
+ 3 hidden test cases