Image Processing - Fundamental Programming Concepts - Lecture Slides, Slides of Computer Programming

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

2012/2013

Uploaded on 08/17/2013

zaid
zaid 🇮🇳

4.5

(2)

59 documents

1 / 20

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Today is Lena Day
Colors, RGB
Image files
MATLAB Demos
Lecture 11 Image Processing
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14

Partial preview of the text

Download Image Processing - Fundamental Programming Concepts - Lecture Slides and more Slides Computer Programming in PDF only on Docsity!

Today is Lena Day

Colors, RGB

Image files

MATLAB Demos

Pixel and Bitmaps

Pixel = Picture Element

Bitmaps store color information of pixels

Anatomy of Files

Text Files vs. Binary Files

Example Text files:

.txt (plain), .html (markup)

Example Binary files:

.exe .bmp .png .zip

X-raying Binary Files

Use hexdump

File formats

File headers

MATLAB Image Formats

imformats

shows information about the image formats MATLAB can

work on

imfinfo

shows information related to an image file

Reading Image Files

imread

reads an image file and returns image data in an array

Usage

% A = imread(FILENAME, FORMAT)

data = imread('lena.png','png');

[Red, Green, Blue] Lena

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)

[Red, Green, Blue] Lena

Converting to Gray Scale

Writing Image Files

imwrite

writes the image to a file

Usage

% imwrite(A, FILENAME, FORMAT)

imwrite(data, 'lena gray.png', 'png');

Applying the Filter

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);

Applying the Filter

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)

Edge Detection

Fx =

 Fy =

Dx = Fx. ∗ I Dy = Fy. ∗ I |∇I | =

D x^2 + D y^2

Edge Detection