Skip to content

Instantly share code, notes, and snippets.

@seyyah
Last active December 27, 2015 03:58
Show Gist options
  • Select an option

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

Select an option

Save seyyah/7262939 to your computer and use it in GitHub Desktop.
DIP LAB
clear all; close all; clc;
im = imread('http://i.imgur.com/TwDQZKO.jpg');
r = im(:,:, 1);
g = im(:,:, 2);
b = im(:,:, 3);
figure(1);
subplot(2,2,1); imshow(im); title('Boninon');
subplot(2,2,2); imshow(r); title('R');
subplot(2,2,3); imshow(g); title('G');
subplot(2,2,4); imshow(b); title('B');
bwr = abs(double(r) - 80) <= 80;
bwg = abs(double(g) - 240) <= 80;
bwb = abs(double(b) - 60) <= 80;
bw = bwr .* bwg .* bwb;
figure(2);
subplot(2,2,1); imshow(im); title('Bonibon');
subplot(2,2,2); imshow(bwr); title('bwr');
subplot(2,2,3); imshow(bwg); title('bwg');
subplot(2,2,4); imshow(bw); title('bw');
bw3 = cat(3, bw,bw,bw);
img = uint8(double(im) .* bw3);
figure(3);
imshow(img)
clear all; close all; clc;
r = uint8(ones(200,200) * 0);
g = uint8(ones(200,200) * 255);
b = uint8(ones(200,200) * 255);
rgb = cat(3, r, g, b);
imshow(rgb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment