%Read and display RGB image
img = imread('peppers.png');
figure, imshow(img)

%Convert image to grayscale and display
imgGray = rgb2gray(img);
figure, imshow(imgGray)
imgGray = double(imgGray);

%Threshold image (mex) and display
T = 130;
imgBinary = applyThreshold_mex(imgGray, T);
figure, imshow(imgBinary)