Download as pdf or txt
Download as pdf or txt
You are on page 1of 49

Procesimi i imazheve

Procesimi i imazheve

Image Editing Digital Imaging

Computer Vision

Image processing Edge Detection

Segmentation

Ligjerues: Astrit Hyseni

Procesimi i imazheve Digital Imaging KrijimiinjImazhi Dixhitalizimi injpamje Image Editing (preprocessing) Error Correction Eliminimiizhurms(noise) Rritja/Zvoglimiikontrastit Crop /prerjaefotografis Rrotullimi Image Processing Procesiinxjerrjessinformatavenganjimazh Edge Detection Segmentimi Identifikimiiobjektevennjimazh ReprezentimiiObjekteve ComputerVision/Image Analysis Ekstrahimi /Analizaeatributeveteobjekteve AtributetGjeometrike Klasifikimidheinterpretimiiobjekteve
Ligjerues: Astrit Hyseni

Procesimi i imazheve

Ligjerues: Astrit Hyseni

Procesimi i imazheve Digital Imaging Dixhitalizimi Sparinanevojitetnjburimienergjis0( gjatsiavalore) Secilapiknskenereflektondritnnmnyrvetanake

E ( x, y, z, )

r ( x, y, z, )

Dritaereflektuarshtfunksioniburimittdritsdhevetivereflektuesetesiprfaqeve tjera:

c( x, y, z, ) = E ( x, y, z, ) r ( x, y, z, )

E ( x, y, z, )
c( x, y, z, ) = E ( x, y, z, ) r ( x, y, z, )

KAMERA(c( x, y, z, )) =
Ligjerues: Astrit Hyseni

Procesimi i imazheve Digital Imaging dixhitalizimi Ngakoordinatatreale(worldcoordinates)nkoordinatatimazhit.

( x 1 , y 1 ) = [ c p ( x 1 , y 1 , ) = P ( c ( x , y , z , )])

Ligjerues: Astrit Hyseni

Procesimi i imazheve Diskretizimi Cka nenkuptojme mediskretizim? Analog Digital

Cka eshte nje signaldiskret? Kohe diskrete,vlera analoge Cka eshte nje signaldigjital? kohe diskrete,vlera diskrete SignalAnalog signaldiskret analoge,kohe diskrete) Signaldiskret +vlera diskrete diskrete,kohe analoge) Sampling. (vlera Quantization. (vlera

Cka po i bje kjo te dixhitalizimi i nje imazhi? Sampling pixel Quantization intenziteti,ngjyra
Ligjerues: Astrit Hyseni

Procesimi i imazheve Diskretizimi Aliasing Ngalatinishtjaalias(http://www.etymonline.com/index.php?term=alias) dickatjeter,ndryshe,krahasoalien. Aliasingeshtegabimgjatemostrimittenjesignalitevazhdueshem.

Ligjerues: Astrit Hyseni

Procesimi i imazheve Diskretizimi Aliasing Aliasingnenje imazh.

Ligjerues: Astrit Hyseni

Procesimi i imazheve Diskretizimi Aliasing Simund ta perkufizojme nje imazh permes nje funksioni?

Funksion2dimensionalosenjematrice f ( x, y )
Ligjerues: Astrit Hyseni

f ( x, y ) [0,255]
10

Procesimi i imazheve

MATLABImageProcessingToolbox.
Vektoret Definimi i nje vektori? >> v = [3 1 4 5 12 15] Sitransformojme nje vektore nga rreshti neshtylle v = [3 1 7 -21 5 6]' Cfare vektori jep sintaksa v = [1:8] Simund ta krijojme nje vektore nete njejten menyre mirepo meinkrement 0.5 v = [1:0.5:4] Cfare rezultati kthen v(1:3)? 3 1 4 Cfare rezultati kthen v(1:2:4)? 3 4 Detyre krijo nje vektore meelementet prej 0,deri ne4nehapa nga 1 u = [0:-1:-4]
11

Ligjerues: Astrit Hyseni

Procesimi i imazheve

Vektoret Definimi i nje vektori? >> v = [3 1 4 5 12 15] Sitransformojme nje vektore nga rreshti neshtylle v = [3 1 7 -21 5 6]' Cfare vektori jep sintaksa v = [1:8] Simund ta krijojme nje vektore nete njejten menyre mirepo meinkrement 0.5 v = [1:0.5:4] Cfare rezultati kthen v(1:3)? 3 1 4 Cfare rezultati kthen v(1:2:4)? 3 4 Detyre krijo nje vektore meelementet prej 0,deri ne4nehapa nga 1 u = [0:-1:-4]

Ligjerues: Astrit Hyseni

12

Procesimi i imazheve

Vektoret Definimi i nje vektori? >> v = [3 1 4 5 12 15] Sitransformojme nje vektore nga rreshti neshtylle v = [3 1 7 -21 5 6]' Cfare vektori jep sintaksa v = [1:8] Simund ta krijojme nje vektore nete njejten menyre mirepo meinkrement 0.5 v = [1:0.5:4] Cfare rezultati kthen v(1:3)? 3 1 4 Cfare rezultati kthen v(1:2:4)? 3 4 Detyre krijo nje vektore meelementet prej 0,deri ne4nehapa nga 1 u = [0:-1:-4]

Ligjerues: Astrit Hyseni

13

Procesimi i imazheve

HISTOGRAMET Ngastatistika,kashtnjHistogram? Shprndarjeedensitetitttdhnave. Naj shembull? TehyratbuxhetoreteKosovsne10vitetefundit? Teimazhetgri?Sieprcaktojmformalishtnjimazhgri?

I ( x, y ) [0,255]
h(i) numriipixelave prejimazhitI qkavlerneintenzitetit i

h(i ) = card{(u , v) | I (u , v) = i}
Ligjerues: Astrit Hyseni

14

Procesimi i imazheve

Ligjerues: Astrit Hyseni

15

Procesimi i imazheve

Detyre:lexoimazhinlulja01,shenderro neimazhgridhetregohistogramin afer sikurse nefiguren larte. Imread,subplot, subimage,imhist gri_I =0.2989*R+0.5870*G+0.1140 Vetiteimazheveqmundtanalizohenprmeshistogramit. Kontrasti Dinamika Ndriimi
Ligjerues: Astrit Hyseni

16

Procesimi i imazheve

rgb_lulja1 = imread('Lulja_01.jpg'); gri_I=.2989*rgb_lulja(:,:,1)+.5870*rgb_lulja(:,:,2)+.1140*rgb_lulja(:,:,3); subplot(1,2,1); subimage(gri_I); subplot(1,2,2); imhist(gri_I);


Ligjerues: Astrit Hyseni

17

Procesimi i imazheve

Detyre:lexoimazhet lulja01,02,03,shenderroi neimazhgridhetregohistogramete tyre nenje matrix3x2 Imread,subplot, subimage,imhist gri_I =0.2989*R+0.5870*G+0.1140

Ligjerues: Astrit Hyseni

18

Procesimi i imazheve

Ligjerues: Astrit Hyseni

19

Procesimi i imazheve

Detyre:lexoimazhetndertesa01,02,03,shndrro nimazhgridhetregohistogramet e tyrenenjmatrix 3x2

Ligjerues: Astrit Hyseni

20

Procesimi i imazheve

Ligjerues: Astrit Hyseni

21

Procesimi i imazheve

Bining
8 Bit

28 = 256 214 = 16384

h(i ) = card{(u , v) | I (u , v) = i}
14 bit? Bin =kov/kofe Njhistogram imadhesise B(Bnumriikovafe)

h(i) = card{(u, v) | a j I (u, v) < a j +1},0 j < B


K a j = j = j kB B
Ligjerues: Astrit Hyseni

22

Procesimi i imazheve

214 = 16384
214 kB = = 64 256

h(0) 0 I (u , v) < 64 h(1) 64 I (u, v) < 128 h(2) 128 I (u, v) < 192 . h( j ) a j I (u , v) < a j +1 . h(255) 16320 I (u, v) < 16384

Ligjerues: Astrit Hyseni

23

Procesimi i imazheve

POINToperators(Operacionet punktuale)

I ' ( x, y ) = f ( I ( x, y )) i ' f (i )
Siinterpretohetshprehjamelarte? Tentonimeiprmenddisaoperacionepunktuale? Operacionethomogjene Tepavarurangakoordinatat(prsecilinpixel funksionishtinjjte) NdrrimiikontrastitdheIndriimit Invertimi iimazheve Treshholding /Binarizimi Operacionetjohomogjene

I ' ( x, y ) = f ( I ( x, y ), x, y )
24

Prmisimi selektiv ikontrastitp.sh.


Ligjerues: Astrit Hyseni

Procesimi i imazheve

OperatoretPunktual Ndrrimiikontrastitdhendriimit. kake kontrasti?

f k (i ) = i 1.5

f n (i ) = i + 10

Kushtrreziku? Overflow?] If i>255theni=255 IfI<0thenI=0 clamping Sieimplementojm nmatlab? Detyr: Lexoimazhinndertesa01.tif,rritjakontrastinper 30%dhetregonenje raster 2x2 imazhinmehistogram pararritjessekontrastitdhepasrritjessekontrastit

Ligjerues: Astrit Hyseni

25

Procesimi i imazheve

OperatoretPunktual

Ligjerues: Astrit Hyseni

26

Procesimi i imazheve
Pse thjesht kur mujna mekompliku? clc; gri_I = imread('..\images\ndertesa_01.tif'); [rows,columns]=size(gri_I); subplot(2,2,1); subimage(gri_I); subplot(2,2,3); imhist(gri_I); gri_I =gri_I*1.3; for i=1:rows for j=1:columns if gri_I(i,j)>255 gri_I(i,j)=255; elseif gri_I(i,j)<0 gri_I(i,j)=0; end end end subplot(2,2,2); subimage(gri_I); subplot(2,2,4); imhist(gri_I); Pse mekompliku kur mujna thjesht clc; gri_I = imread('..\images\ndertesa_01.tif'); subplot(2,2,1); subimage(gri_I); subplot(2,2,3); imhist(gri_I); gri_I = gri_I*1.3; gri_I = max(min(gri_I,255),0); subplot(2,2,2); subimage(gri_I); title(sprintf('I(x,y)=I(x,y)*%2.2f ',1.3)); subplot(2,2,4); imhist(gri_I);

Ligjerues: Astrit Hyseni

27

Procesimi i imazheve

Pointoperatorsmem shum imazhe.

I ' ( x, y ) = f ( I 1 ( x, y ), I 2 ( x, y ).....I n ( x, y ))
AlphaBlending

I ' ( x, y ) = I BG ( x, y ) + (1 ) I FG ( x, y )
Lexoimazhinplazhi.tifsisfond,imazhinanija.tifsikurse prapavi dhebashkoitedyjat mealpha blending mefaktore 0.5.

Ligjerues: Astrit Hyseni

28

Procesimi i imazheve

Pointoperatorsmeme shume fotografi.

Ligjerues: Astrit Hyseni

29

Procesimi i imazheve

Ushtrimlexoniimazhinpoezi_per_lenen.gif dhepermes operacionevepunktuale tentonimeizolu tekstin.Tregonine secilinhapimazhineperpunuar dhehistogramin perkates.

Ligjerues: Astrit Hyseni

30

Procesimi i imazheve

Ligjerues: Astrit Hyseni

31

Procesimi i imazheve

Pointoperatorsmem shum imazhe.

I ' ( x, y ) = f ( I 1 ( x, y ), I 2 ( x, y ).....I n ( x, y ))
Operacionet Aritmekore Substrahimi

I ' ( x, y ) = I BG ( x, y ) + (1 ) I FG ( x, y )

Ligjerues: Astrit Hyseni

32

Procesimi i imazheve

Filtert

I ' ( x, y ) =

p 0 = I ( x, y )

p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 9 I ( x 1, y 1) + I ( x, y 1) + I ( x + 1, y 1) + 1 I ' ( x, y ) = I ( x 1, y 1) + I ( x, y 1) + I ( x + 1, y 1) + 9 I ( x 1, y 1) + I ( x, y 1) + I ( x + 1, y 1)

1 1 1 I ' ( x, y ) = I ( x + i , v + j ) 9 j =11 i =1
Ligjerues: Astrit Hyseni

33

Procesimi i imazheve

Filtert
I ( x 1, y 1) + I ( x, y 1) + I ( x + 1, y 1) + 1 I ' ( x, y ) = I ( x 1, y 1) + I ( x, y 1) + I ( x + 1, y 1) + 9 I ( x 1, y 1) + I ( x, y 1) + I ( x + 1, y 1)

1 9 H (i, j ) = 1 19 9
1 1

1 1 1

9 9 9

1 1 1 1 9 1 = 1 1 1 1 9 9 1 1 1 1 9
Filter Linear

I ' ( x, y ) = I ( x + i, v + j ) H (i, j )
i = 1 j = 1

Ligjerues: Astrit Hyseni

34

Procesimi i imazheve

Filtert Linear - Implementimi

I ' ( x, y ) =
Ligjerues: Astrit Hyseni

i = 11 j = 1

I ( x + i, v +

j ) H (i, j )
35

Procesimi i imazheve

Filtert Linear - Implementimi

Ligjerues: Astrit Hyseni

36

Procesimi i imazheve

Filterat Linear
Nj lloj tjetr i nj filteri linear. Si interpretohet ky filter.

Matrice enormalizuar

H (i, j ) = s H ' (i, j )


Si?

Ligjerues: Astrit Hyseni

37

Procesimi i imazheve

Filterat Linear

H (i, j ) = s H ' (i, j )

s=

1 H ' (i, j )

Adobephotoshop /Customfilter

Ligjerues: Astrit Hyseni

38

Procesimi i imazheve

Filterat Linear

a)Boxfilter

b)GaussFilter

c)laplace filter

Ligjerues: Astrit Hyseni

39

Procesimi i imazheve

Vetit formale t filterave linear

I ' ( x, y ) = I ( x + i, v + j ) H (i, j )
i = 1 j = 1

I ' ( x, y ) = I ( x i, v j ) H (i, j )
i = j =

LinearCorrelation

I ' ( x, y ) = I ( x + i, v + j ) H (i, j )
i = j =

LinearConvultion

Ligjerues: Astrit Hyseni

40

Procesimi i imazheve

Vetite ekonvulvimit linear Komutativiteti

I *H = H *I
Lineariteti

( I ) * H = I * ( H ) = * ( I H )

( I1 + I 2 ) * H = ( I1 * H ) + ( I 2 * H )
Asociativiteti

A * ( B * C ) = ( A * B) * C

Ligjerues: Astrit Hyseni

41

Procesimi i imazheve Ndarja efilterave

I * H = I * ( H 1 * H 2 * H 3 ...H n )
Ndarjanedydimenzionex,y

Hx,y (i, j) = Hx (i) Hy ( j)


Ligjerues: Astrit Hyseni

42

Procesimi i imazheve Filterat jolineare

I ' ( x, y ) = min{I ( x + i, y + j ) | (i, j ) R} = min( Rx , y ) I ' ( x, y ) = max{I ( x + i, y + j ) | (i, j ) R} = max( Rx , y )

maxfilter
Ligjerues: Astrit Hyseni

minfilter
43

Procesimi i imazheve

Medianfilteri

I ' ( x , y ) = median ( R x , y ) median ( p 0 , p 1 , p 2 ,.... p k ,.... p 2 k ) = p k

Ligjerues: Astrit Hyseni

44

Procesimi i imazheve

WeightedMedianfilteri

Ligjerues: Astrit Hyseni

45

Procesimi i imazheve

Edge Detection
Simundtashprehimformalishtnjteh? Sishtdefinicioniinjderivati?

Ligjerues: Astrit Hyseni

46

Procesimi i imazheve

Edge Detection
Funksioniiintenzitetit nnjdimenzion (vetem nkordinatn xp.sh.)dhe derivati

I ( x. y ) =

(I x) + I y
2

Ligjerues: Astrit Hyseni

47

Procesimi i imazheve

Edge Detection
Funksioniiintenzitetit nnjdimenzion (vetem nkordinatn xp.sh.)dhe derivati

Ligjerues: Astrit Hyseni

48

Procesimi i imazheve

Edge Detection
I x x I ( x, y ) = = I y y
I ( x. y ) =

I ( x, y ) x
x

I ( x, y ) y

(I x) + I y
2

2
y

Ligjerues: Astrit Hyseni

49

You might also like