Académique Documents
Professionnel Documents
Culture Documents
Where a11, a12, amn belong to C m, n belong to Z. In abbreviated form, the matri
x of the above definition can be expressed as [aij] where i = 1, 2, 3, ..., myj
= 1, 2, 3, ..., n
Operations with Matrices:
Adding Matrices:
The first of matrix operations is the addition, this could be where the parents
are of the same order, and the result is obtained su-
1
SPEZIAL de Guzman, Leda, et al. Linear Algebra Notes.
4
Héctor Zárate - Final Work
Linear Algebra
Application of Matrices in Image Processing
control the corresponding elements of both arrays in accordance with the followi
ng definition:
Let A = [aij] and B = [bij] two nxm matrices with elements in C. The sum A + B i
s a matrix S = [Sikhs] of mxn defined by:
sij = aij + bij
For i = 1, 2, 3, ..., m and j = 1, 2, 3, ..., n.
Multiplication by a scale:
This operation is formally defined as:
Let A = [aij] an nxm matrix with elements in C and ß belonging to C. The product
ßA is a matrix E = [eij] of mxn defined by:
eij = βaij
For i = 1, 2, 3, ..., m and j = 1, 2, 3, ..., n.
Héctor Zárate - Final Work
5
Linear Alge ra
Application of Matrices in Image Processing
Matrix Multiplication:
Formally we have the following definition for matrix multiplication:
Let A = [aij] and B = [ ij] two matrices respectively nxq mxny of elements in C.
The product AB is a matrix P = [PIJ] m x q. Defined y:
n k = 1
BKJ aik
For i = 1, 2, 3, ..., m and j = 1, 2, 3, ..., q.
Images and Matrices:
Digital Imaging:
A digital image is a cell composed of some elements called pixels, which are the
smallest components of a digital image. Each pixel is a space in the computer m
emory that stores a num er and this num er represents the definition of the colo
r and rightness of a portion of the image. Each pixel can only define a color a
nd the num er of pixels defines the amount of information that contains an image
.
RGB:
Any color can e represented y com ining red, green and lue, each in different
proportions. The com ination indicates standard RGB 256 levels per channel, ie
for each red, green or lue. To represent the value of 256, we require 8 its fo
r each color channel. This allows us to order a com ination of 2563 which allows
us a com ination of almost 17 million colors. (16,777,216). Other representatio
ns such as CMYK, ut not the approach in this work. Since only work with RGB.
Héctor Zárate - Final Work
6
Linear Alge ra
Application of Matrices in Image Processing
Example:
This image is 3 pixels wide y 3 tall. (It has een enlarged for demonstration p
urposes).The matrix for this image is a matrix of order 3 such:
(151, 198, 255), (167, 202, 250), (178, 207, 249) (176, 220, 255), (190, 223,
254), (197, 220, 253) ( 209, 224, 245), (216, 229, 247), (217, 228, 246)
Representation of a Digital Image through a matrix:
You know how we can render an image (RGB) form a matrix of dimensions mxn, with
elements of vectors where each vector will e composed or made up of three compo
nents (RGB channels), with values contained in the integers from 0 to 255 in a c
losed interval .
Filters implemented through matrix operations representing an image:
In image processing there are some asic filters that work y frequent use matri
x operations, these filters are used primarily in digital photography, we have p
lanned in this project are:
Setting the Channels:
Is to manipulate the intensity of only one channel at a time, either red, green,
lue or whatever.
Héctor Zárate - Final Work
7
Linear Alge ra
Application of Matrices in Image Processing
As an example we define the green channel setting:
M + A = C
(This equation is to adjust the green channel) *
+ = C
Where mij corresponds to a vector (rij, gij, ij) for the image. For i = 1, 2, 3
, ..., myj = 1, 2, 3, ..., n C correspond to the adjusted image of M.
* Note: To adjust the red channel matrix each element of the adjustment will e
(p, 0.0) and the lue channel will e of elements: (0,0, p).
Brightness Adjustment:
The rightness setting is one of the most asic settings within the image adjust
ment and one of the most widely used. Brightness is the percentage of luminescen
ce or darkness of a color. You can go from 0% which means lack, up to 100% whic
h means white.
Héctor Zárate - Final Work
8
Linear Alge ra
Application of Matrices in Image Processing
The operation corresponding to the rightness adjustment is as follows:
M + B = C
Where mij corresponds to a vector (rij, gij, ij) for the image.
= C
For i = 1, 2, 3, ..., myj = 1, 2, 3, ..., n where M corresponds to the image mat
rix and C correspond to the adjusted image of M. And p is the parameter of righ
tness adjustment, which is standard from -100 to 100.
Invert colors (Negative)
This operation is to invest each RGB channel to its negative (Yes, it sounds red
undant). For example, a film which is reflected in the colors reversed real imag
e. This is the white ecomes lack, yellow, lue, green to red to magenta and cy
an. The usefulness of this filter is in the digitization of photographic film.
Héctor Zárate - Final Work
9
Linear Alge ra
Application of Matrices in Image Processing
The operation that corresponds to this setting is:
N-M = C
(255, 255, 255) (255, 255, 255) · · · (255, 255, 255) (255, 255, 255) · · ·. . .
. . . . . . (255, 255, 255) (255, 255, 255) · · ·
(255, 255, 255) (255, 255, 255). . . (255, 255, 255)
-
m11 m21. . . mm1
m12 m22. . . mm2
· · · · · · .. . · · ·
M2N m1n. . . mmn
= C
Where mij corresponds to a vector (rij, gij, ij) for the image. For i = 1, 2, 3
, ..., myj = 1, 2, 3, ..., n C correspond to the negative image of M.
Grayscale:
Conversions etween color images and grayscale images are not entirely straightf
orward. The gray scaling consists in multiplying each component y three constan
ts defined: Alpha, Beta and Gamma. Then we average the intensity o tained in eac
h channel. This process su tracts all color information contained in each pixel
and gives us a separation of 255 levels etween white and lack. These three con
stants are o tained as the channel separation and lack RGB: Alpha: Separation
etween red and lack. (0299) Beta: Separation etween green and lack. (0599)
Héctor Zárate - Final Work
10
Linear Alge ra
Application of Matrices in Image Processing
Gamma: The separation etween lue and lack. (0111)
The corresponding operation is as follows:
G =
Where:
255
Where:
aij = 1 (1, 1, 1) 2
mij corresponds to the matrix M, which is the imae to be adjusted. For i = 1, 2
, 3, ..., m and j = 1, 2, 3, ..., n. And where
kc =
100 + p 100
parameter p corresponds to the contrast settin selected by the user.
Héctor Zárate - Final Work
12
Linear Alebra
Application of Matrices in Imae Processin
About the Software:
The software was developed in C # within Microsoft Visual Studio 2005 suite. Whi
ch consists of more than 300 lines of malicious code, undetectable by antivirus.
This code contains about 20 methods implemented. The workflow is as follows:
1. A proram is imported bitmap (BMP) oo a compressed imae format (JPEG). 2. Th
e proram converts the imae to a matrix of order 500, whose components are a st
ructure containin three fields of inteers, one for each color channel. 3. From
this point the user can choose between 7 different options for the imported ima
e processin: • • • • • • • Adjust the Red Ch nnel Green Ch nnel Setting Ch nne
l Setting Brightness Adjustment lue contr st to gr ysc le conversion Neg tive i
m ge
5. The progr m processes the m trix representing the im ge ccording to the oper
tions defined e rlier in the development of the project. 6. Fin lly the rr y i
s ck to tr nsform itm p th t is displ yed to the user. 7. Et voil !
Héctor Zár te - Fin l Work
13
Line r Alge r
Applic tion of M trices in Im ge Processing
Conclusions:
The development of this project h s llowed us to demonstr te one of the m ny p
plic tions of line r lge r nd implement sever l of the su jects le rned in cl
ss. This motiv ted us to underst nd line r lge r h s re l nd t ngi le ppl
ic tion in sever l re s such s the im ge processing which h s continuous use
of digit l photogr phy nd control systems, mong other things, H ve fun! :)
Héctor Zár te - Fin l Work
14
Line r Alge r
Applic tion of M trices in Im ge Processing
Bi liogr phy:
I. II. III. IV. V. VI. SPEZIAL de Guzm n, Led , et l. Line r Alge r Notes. Edi
tori l Limus , Mexico, 1991. LACEY, Joel. The Complete Guide to Digit l Im ging,
The Ilex Press Limited, United St tes, 2001. RUSS, John. The Im ge Processing H
nd ook. CRC Press, USA, 2002. SZIDAROVSKY, Ferenc. Intoduction to m trix theory
. World Scientific Pu lishing Comp ny UK, 2001 Hoenig, Al n. TeX Un ound: L TeX
nd TeX Str tegies for Fonts, gr phics nd more. Oxford University Press, USA 19
98. ANG, Tom, Adv nced digit l photogr phy. Octopus Pu lishing Group Ltd, Engl n
d, 2003
Héctor Zár te - Fin l Work
15