I've applied a global threshold to an image and the results can be seen in this post. How would I apply a different threshold to the bottom half of the image? Applying the same threshold throughout, leaves the bottom half black, which is not what I want. Sorry if this is a silly question.
EDIT: I could apply a threshold to the top half and a different to the bottom half, but the regions aren't exactly perfectly rectangular.
img = imread('result11.png');img_grey = rgb2gray(img);% Apply threshold
% md = median(img_grey(img_grey>0));
upper = 230;lower = 230;img_grey(img_grey >= upper) = 255;img_grey(img_grey <= lower) = 0;% img_grey_bin = img_grey > md;
figure, imshow(img_grey)BW1 = bwmorph(img_grey, 'clean');figure, imshow(BW1);
Best Answer