












Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Objectives of this cours are: Introduction to programming, Learn a high-level programming language, Programming concepts and Problem solving. This lecture explains terms like Image Processing, Pixel and Bitmaps, Representation of Colors, Anatomy of Files, X-Raying Binary Files, X-Raying Bmp Files, Matlab Image Formats, Reading Image Files, Displaying Image Data, Converting To Gray Scale
Typology: Slides
1 / 20
This page cannot be seen from the preview
Don't miss anything!













% A = imread(FILENAME, FORMAT)
data = imread('lena.png','png');
l = imread('lena.png');
r = l; r(:,:,2:3) = 0; figure imshow(r)
g = l; g(:,:,1:2:3) = 0; figure imshow(g)
b = l; b(:,:,1:2) = 0; figure imshow(b)
% imwrite(A, FILENAME, FORMAT)
imwrite(data, 'lena gray.png', 'png');
function pdata = filter lena(fname, fmt, F) data = imread([fname,'.',fmt], fmt); [n m c] = size(data); pdata = zeros(n,m,c); ddata = double(data); %convert from uint8 to double % ignoring a thin frame around the picture for i = 2:n− 1 % move to the next row for j = 2:m− 1 % move to the next column for k = 1:3 % apply the filter to all 3 layers pdata(i,j,k) = ... sum(sum(F .* ddata(i−1:i+1, j−1:j+1, k))); end end end pdata = uint8(floor(pdata)); %convert back to uint imwrite(pdata, [fname,' filtered.',fmt], fmt);
Fa = ones(3)/9; Fb = ones(3)/5; Fb([1 3],[1 3]) = 0;
I = imread('lena.png'); Ia = filter lena('lena','png',Fa); Ib = filter lena('lena','png',Fb);
subplot(1,3,1); imshow(I) subplot(1,3,2); imshow(Ia) subplot(1,3,3); imshow(Ib)