Skip to content

Instantly share code, notes, and snippets.

@dretax
Last active November 8, 2016 07:59
Show Gist options
  • Save dretax/e94e731b8b6f9ad9606c6bd6609117f4 to your computer and use it in GitHub Desktop.
Save dretax/e94e731b8b6f9ad9606c6bd6609117f4 to your computer and use it in GitHub Desktop.
img_bw = img_gray;
treshold_level = 0.4; % mean(mean(img_gray))
for i = 1 : info.Height
for j = 1 : info.Width
if (img_gray(i,j) > treshold_level)
img_bw(i, j) = 255;
else
img_bw(i, j) = 0;
end
end
end
figure
imshow(img_bw);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment