Implementation of the similar logic can also be seen at https://www.academicblock.com/technology/web-tools/convert-an-image-to-black-and-white This Matlab GUI code ...