[Part 1] Basic Image Processing with Matlab
Monday, September 18, 2017
Find out more about image processing here. How to separate and rearrange the RGB layers, show grayscale img, black and white img, negative img. Easy Steps!
Problems...
1) Make program to take file picture from computer!
2) Make program to separate the layers (RGB)!
3) Make program to rearrange the layers!
4) Make program to show the grayscale image!
5) Make program to show the black and white image!
6) Make program to show negative image!
Solutions..
%TAKE FILE PICTURE FROM COMPUTER
I = imread ('E:\junris belajar\belajar imv\eded.png'); %read the file in the folder of your picture
figure(1); %add figure 1
imshow(I); %show the picture
%SEPARATE LAYER
R = I(:,:,1); figure; imshow(R); %show Red layer on the figure
G = I(:,:,2); figure; imshow(G); %show Green layer on the figure
B = I(:,:,3); figure; imshow(B); %show Blue layer on the figure
%REARRANGE LAYER
X = cat(3,G,R,B); figure; imshow(X); %show the Green Red Blue layer on the figure
Y = cat(3,B,G,R); figure; imshow(Y); %show the Blue Green Red layer on the figure
Z = cat(3,B,R,G); figure; imshow(Z); %show the Blue Red Gren layer on the figure
%GRAYSCALE IMAGE
H = rgb2gray(I); figure; imshow(H); %convert RGB to Grayscale then show it on the figure
%BLACK AND WHITE IMAGE
W = im2bw(I); figure; imshow(W); %convert image to black white image then show it on figure
%NEGATIVE IMAGE
A = imcomplement(I); figure; imshow(A); %using the imcomplement command to show negative image or A = 255 - I;
Happy Learning!
Matlab Programming |
Lesson 1: Image Processing
Problems...
1) Make program to take file picture from computer!
2) Make program to separate the layers (RGB)!
3) Make program to rearrange the layers!
4) Make program to show the grayscale image!
5) Make program to show the black and white image!
6) Make program to show negative image!
Solutions..
%TAKE FILE PICTURE FROM COMPUTER
I = imread ('E:\junris belajar\belajar imv\eded.png'); %read the file in the folder of your picture
figure(1); %add figure 1
imshow(I); %show the picture
%SEPARATE LAYER
R = I(:,:,1); figure; imshow(R); %show Red layer on the figure
G = I(:,:,2); figure; imshow(G); %show Green layer on the figure
B = I(:,:,3); figure; imshow(B); %show Blue layer on the figure
%REARRANGE LAYER
X = cat(3,G,R,B); figure; imshow(X); %show the Green Red Blue layer on the figure
Y = cat(3,B,G,R); figure; imshow(Y); %show the Blue Green Red layer on the figure
Z = cat(3,B,R,G); figure; imshow(Z); %show the Blue Red Gren layer on the figure
%GRAYSCALE IMAGE
H = rgb2gray(I); figure; imshow(H); %convert RGB to Grayscale then show it on the figure
%BLACK AND WHITE IMAGE
W = im2bw(I); figure; imshow(W); %convert image to black white image then show it on figure
%NEGATIVE IMAGE
A = imcomplement(I); figure; imshow(A); %using the imcomplement command to show negative image or A = 255 - I;
Happy Learning!