Skip to content

Instantly share code, notes, and snippets.

@seyyah
Created November 28, 2012 12:48
Show Gist options
  • Select an option

  • Save seyyah/4161019 to your computer and use it in GitHub Desktop.

Select an option

Save seyyah/4161019 to your computer and use it in GitHub Desktop.
close all;
clear all;
clc;
a = readim('gri.png','')
b = smooth(a,5)
[c,thres] = threshold(b,'isodata',Inf)
close all;
clear all;
clc;
im = imread('test2.jpg');
r = im(:, :, 1);
g = im(:, :, 2);
b = im(:, :, 3);
subplot(221), imshow(im), title('im')
subplot(222), imshow(r), title('R')
subplot(223), imshow(g), title('G')
subplot(224), imshow(b), title('B')
bw = (g > 120);
figure(2);
subplot(221), imshow(im), title('im')
subplot(222), imshow(g), title('G')
subplot(223), imshow(bw), title('BW')
gri = rgb2gray(im);
gri2 = uint8(0.3*double(r) + 0.6*double(g) + 0.1*double(b));
bw2 = (gri2 > 65);
figure(3),
subplot(221); imshow(gri)
subplot(222); imshow(gri2)
subplot(222); imshow(bw2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment