Upload
razzougui-sarah
View
222
Download
0
Embed Size (px)
Citation preview
8/13/2019 59213325 Content Based Image Retrieval
1/63
CBIR: Content Based Image Retrieval
ByRami Al-Tayeche (237262)
&Ahmed Khalil (296918)
Supervi!r" #r!$e!r Aye%ul uhadar
A rep!r' umi''ed i par'ial $ul$illme' !$ 'he re*uireme'!$ 9+,+98 %ieeri% #r!.ec'
/epar'me' !$ Sy'em ad !mpu'er %ieeri%0acul'y !$ %ieeri%
arle'! iveri'y
April + 23
8/13/2019 59213325 Content Based Image Retrieval
2/63
Abstract
The purp!e !$ 'hi rep!r' i '! decrie !ur reearch ad !lu'i! '! 'he pr!lem !$
dei%i% a Content Based Image Retrieval CBIRy'em, 4' !u'lie 'he pr!lem 'he
pr!p!ed !lu'i! 'he $ial !lu'i! ad 'he acc!mplihme' achieved, /ue '! 'he
e!rm!u icreae i ima%e da'aae i5e a ell a i' va' depl!yme' i vari!u
applica'i! 'he eed $!r B4R devel!pme' ar!e, 0ir'ly 'hi rep!r' !u'lie a
decrip'i! !$ 'he primi'ive $ea'ure !$ a ima%e 'e'ure c!l!ur ad hape, Thee
$ea'ure are e'rac'ed ad ued a 'he ai $!r a imilari'y chec e'ee ima%e, The
al%!ri'hm ued '! calcula'e 'he imilari'y e'ee e'rac'ed $ea'ure are 'he eplaied,
:ur $ial reul' a aMatLabuil' !$'are applica'i! i'h a ima%e da'aae 'ha'
u'ili5ed 'e'ure ad c!l!ur $ea'ure !$ 'he ima%e i 'he da'aae a 'he ai !$
c!mpari! ad re'rieval, The 'ruc'ure !$ 'he $ial !$'are applica'i! i illu'ra'ed,
0ur'herm!re 'he reul' !$ i' per$!rmace are illu'ra'ed y a de'ailed eample,
i
8/13/2019 59213325 Content Based Image Retrieval
3/63
Acknowledgements
;e !uld lie '! 'ha !ur upervi!r #r!$e!r Aye%ul uhadar $!r her c!'iu!u
$eedac ad upp!r' 'hr!u%h!u' 'he year 'ha' helped u 'hr!u%h!u' !ur pr!.ec', ;e
!uld al! lie '! 'ha #r!$e!r Richard /aereau Ai'a' #r!$e!r a' 'he
/epar'me' !$ Sy'em ad !mpu'er %ieeri% $!r hi $eedac, 0ur'herm!re e
ac!led%e 'he upp!r' ad $eedac !$ !ur c!llea%ue ad $ried :ama Adai
8/13/2019 59213325 Content Based Image Retrieval
4/63
Table of Contents
1. INTRODUCTION TO CBIR ............... .............. .............. .............. .............. .............. ............... ...... ...... ....1
1,1 /044AT4::R ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,198.1.1 Quadratic Distance Metric ...........................................................................................................198.1.2 Histogras ....................................................................................................................................198.1.3 !ii"arit# Matri$ ...........................................................................................................................208.1.% Resu"ts ...........................................................................................................................................2%
8,2 TTR ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,288.2.1 raid'!tructured (a)e"et *ransfor ......................................................................................288.2.2 +nerg# ,e)e" .................................................................................................................................298.2.3 +uc"idean Distance ...................................................................................................................... .30
8,3 C4 ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,, ,,,,,,, ,,,,,, ,,,,,,, ,,,,,,, ,,,,,,, ,,,,,, ,,,,,,, ,,,,,,, ,,,,,, ,,,,,,, ,,,,,,, ,,,,,, ,,,,,,, ,,,,,,38,+ /ATABAS ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,33
8,@ A=#> ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,338.5.1 -o"our +$traction Matching ....................................................................................................3%8.5.2 *e$ture +$traction Matching ...................................................................................................35
/. CONCLU#ION# ............. .............. .............. .............. ............... .............. .............. .............. .............. ...... ..."'
10. RE)ERENCE# .............. .............. .............. .............. .............. ............... .............. .............. ......... ..... ..... ..."-
11. !PPENDICE# .............. ............... .............. .............. .............. .............. ............... ............ ..... ..... ..... ..... ....$1
A##
8/13/2019 59213325 Content Based Image Retrieval
5/63
-/R !#stes ....................................................................................................................................... ..%1Haar (a)e"et .........................................................................................................................................%2Dauechies (a)e"et ...............................................................................................................................%2
A##
8/13/2019 59213325 Content Based Image Retrieval
6/63
)I,URE: BOUND!R43B!#ED 5 RE,ION3B!#ED 61'7................................................................1*
)I,URE: COLOUR &I#TO,R!M# O) T(O IM!,E#.....................................................................21
)I,URE: MIN+O(#+I DI#T!NCE !PPRO!C&...........................................................................2"
)I,URE: 8U!DR!TIC DI#T!NCE !PPRO!C&............................................................................2$
)I,URE: #IMIL!RIT4 M!TRI !9 (IT& ! DI!,ON!L O) ONE#6"7....................................2$
)I,URE: TE#TED IM!,E#.................................................................................................................2%
)I,URE: P4R!MID3#TRUCTURED (!ELET TR!N#)ORM.....................................................2/
)I,URE: ,UI DE#I,N9 !DEMO.)I,................................................................................................"1
)I,URE: MENU EDITOR #PECI)IC!TION )OR T&E MENU...................................................."2
)I,URE: !PPLIC!TION (INDO( !T RUNTIME......................................................................."2
)I,URE: IM!,E D!T!B!#E.............................................................................................................""
)I,URE: T&E 8UER4 IM!,E: "*1.BMP........................................................................................"$
)I,URE: COLOUR RE#ULT# )OR T&E #E!RC&IN, )OR "*1.BMP.........................................."%
)I,URE: TETURE RE#ULT# )OR T&E #E!RC&IN, )OR "*1.BMP........................................"'
List of Tables
T!BLE: COLOUR M!P !ND NUMBER O) PIEL# )OR T&E PREIOU# IM!,E...................-
T!BLE: COLOUR M!P# O) T(O IM!,E#. ......................................................................................22
T!BLE: COLOUR DI#T!NCE# )OR COMPRE##ED IM!,E# ............. .............. .............. ......... .2%
T!BLE: COLOUR DI#T!NCE# )OR UNCOMPRE##ED IM!,E# ............ ............... .......... ..... ...2'
T!BLE: COLOUR DI#T!NCE BET(EEN 8UER4 !ND RE#ULT# ............. ............... ........ ..... .."%
T!BLE: EUCLIDE!N DI#T!NCE BET(EEN 8UER4 !ND RE#ULT# ............ ............... .........."'
v
8/13/2019 59213325 Content Based Image Retrieval
7/63
1. Introd;tion to CBIR
A pr!ce!r ec!me icreai%ly p!er$ul ad mem!rie ec!me icreai%ly
cheaper 'he depl!yme' !$ lar%e ima%e da'aae $!r a varie'y !$ applica'i! have !
ec!me realiale, /a'aae !$ ar' !r a'elli'e ad medical ima%ery have ee
a''rac'i% m!re ad m!re uer i vari!u pr!$ei!al $ield D $!r eample %e!%raphy
medicie archi'ec'ure adver'ii% dei% $ahi! ad pulihi%, $$ec'ively ad
e$$icie'ly accei% deired ima%e $r!m lar%e ad varied ima%e da'aae i ! a
ecei'y E1F,
1.1 De
8/13/2019 59213325 Content Based Image Retrieval
8/63
1.2 !??li;ations o< CBIR
ample !$ B4R applica'i! are E+F"
Crime ?revention:Au'!ma'ic $ace rec!%i'i! y'em ued y p!lice $!rce,
#e;rit@ C>e;A:0i%er pri' !r re'ia cai% $!r acce privile%e,
Medi;al Diagnosis:i% B4R i a medical da'aae !$ medical ima%e '! aid
dia%!i y ide'i$yi% imilar pa' cae,
Intelle;tal Pro?ert@:Trademar ima%e re%i'ra'i! here a e cadida'e
mar i c!mpared i'h ei'i% mar '! eure ! ri !$ c!$ui% pr!per'y
!erhip,
1." CBIR #@stems
Several B4R y'em curre'ly ei' ad are ei% c!'a'ly devel!ped, ample
are E@F"
QBIC!r Quer B Image Contenta devel!ped y 4B= Almade Reearch
e're '! all! uer '! %raphically p!e ad re$ie *uerie aed ! mul'iple
viual pr!per'ie uch a c!l!ur 'e'ure ad hape E@F, 4' upp!r' *uerie aed
! ipu' ima%e uer-c!'ruc'ed e'che ad elec'ed c!l!ur ad 'e'ure
pa''er E2F,
!IR Image "nginey Gira%e 4c, lie HB4 eale ima%e re'rieval aed !
primi'ive a''riu'e uch a c!l!ur 'e'ure ad 'ruc'ure, 4' eamie 'he piel i
'he ima%e ad per$!rm a aalyi pr!ce derivi% ima%e charac'eri5a'i!
$ea'ure E@F,
2
8/13/2019 59213325 Content Based Image Retrieval
9/63
!isual#""$ ad%eb#""$ere devel!ped y 'he /epar'me' !$ lec'rical
%ieeri% !lumia iveri'y, B!'h 'hee y'em upp!r' c!l!ur ad pa'ial
l!ca'i! ma'chi% a ell a 'e'ure ma'chi% E@F,
&eTraa devel!ped y 'he /epar'me' !$ lec'rical ad !mpu'er
%ieeri% iveri'y !$ ali$!ria, 4' upp!r' c!l!ur hape pa'ial lay!u'
ad 'e'ure ma'chi% a ell a ima%e e%me'a'i! E@F,
MAR# !rMultimedia Analsis and Retrieval #stema devel!ped y 'he
Becma 4'i'u'e $!r Advaced Sciece ad Tech!l!%y iveri'y !$ 4lli!i,
4' upp!r' c!l!ur pa'ial lay!u' 'e'ure ad hape ma'chi% E@F,
!i'er !r !isual Information (rocessing for "n)anced Retrievala devel!ped
a' 'he !mpu'er Gii! Cr!up iveri'y !$ Ceeva, 4' upp!r' c!l!ur ad
'e'ure ma'chi% E@F,
E0!r m!re i$!rma'i! eeppendi$ ' 4 Recoended ReadingsF
2. Prolem Motivation
4ma%e da'aae ad c!llec'i! ca e e!rm!u i i5e c!'aii% hudred
'h!uad !r eve milli! !$ ima%e, The c!ve'i!al me'h!d !$ ima%e re'rieval i
earchi% $!r a ey!rd 'ha' !uld ma'ch 'he decrip'ive ey!rd ai%ed '! 'he ima%e
y a huma ca'e%!ri5er E6F, urre'ly uder devel!pme' eve 'h!u%h everal y'em
ei' i 'he re'rieval !$ ima%e aed ! 'heir c!'e' called Content Based Image
Retrieval CBIR, ;hile c!mpu'a'i!ally epeive 'he reul' are $ar m!re accura'e 'ha
c!ve'i!al ima%e idei%, ece 'here ei' a 'rade!$$ e'ee accuracy ad
c!mpu'a'i!al c!', Thi 'rade!$$ decreae a m!re e$$icie' al%!ri'hm are u'ili5ed ad
icreaed c!mpu'a'i!al p!er ec!me iepeive,
3
8/13/2019 59213325 Content Based Image Retrieval
10/63
". Prolem #tatement
The pr!lem iv!lve e'eri% a ima%e a a *uery i'! a !$'are applica'i!
'ha' i dei%ed '! empl!y B4R 'echi*ue i e'rac'i% viual pr!per'ie ad ma'chi%
'hem, Thi i d!e '! re'rieve ima%e i 'he da'aae 'ha' are viually imilar '! 'he *uery
ima%e,
$. Pro?osed #oltion
The !lu'i! ii'ially pr!p!ed a '! e'rac' 'he primi'ive $ea'ure !$ a *uery
ima%e ad c!mpare 'hem '! 'h!e !$ da'aae ima%e, The ima%e $ea'ure uder
c!idera'i! ere c!l!ur 'e'ure ad hape, Thu ui% ma'chi% ad c!mpari!
al%!ri'hm 'he c!l!ur 'e'ure ad hape $ea'ure !$ !e ima%e are c!mpared ad
ma'ched '! 'he c!rrep!di% $ea'ure !$ a!'her ima%e, Thi c!mpari! i per$!rmed
ui% c!l!ur 'e'ure ad hape di'ace me'ric, 4 'he ed 'hee me'ric are per$!rmed
!e a$'er a!'her ! a '! re'rieve da'aae ima%e 'ha' are imilar '! 'he *uery, The
imilari'y e'ee $ea'ure a '! e calcula'ed ui% al%!ri'hm ued y ell !
B4R y'em uch a 4B=I HB4, 0!r each peci$ic $ea'ure 'here a a peci$ic
al%!ri'hm $!r e'rac'i! ad a!'her $!r ma'chi%,
%. !;;om?lis>ments
;ha' a acc!mplihed a a !$'are applica'i! 'ha' re'rieved ima%e aed
! 'he $ea'ure !$ 'e'ure ad c!l!ur !ly, !l!ur e'rac'i! ad c!mpari! ere
per$!rmed ui% co"our histogras ad 'he uadratic distance a"gorith repec'ively,
+
8/13/2019 59213325 Content Based Image Retrieval
11/63
Te'ure e'rac'i! ad c!mpari! are per$!rmed ui% a energ# "e)e" a"gorith ad
'he+uc"idean distance a"gorith repec'ively, /ue '! 'he 'ime i' '!! '! reearch 'he
al%!ri'hm ued '! chec c!l!ur imilari'y ad 'he 'rial ad $ailure i'h di$$ere' ima%e
$!rma' 'here a ! 'ime '! %! ! '! 'he e' imp!r'a' $ea'ure hich a hape, Thi
a u$!r'ua'e ice e had acc!mplihed a l!' i 'erm !$ reearch ! 'he '!pic,
'. Overvie o< Re?ort
Thi rep!r' i divided i'! 'hree mai ec'i!, The $ir' ec'i! deal i'h a
%eeral i'r!duc'i! '! B4R, The ec!d c!cer 'he ac%r!ud !$ 'he $ea'ure
empl!yed i B4R, The 'hird deal i'h 'he 'echical par' hich i a $ull eplaa'i! !$
'he al%!ri'hm ued ad h! 'hey !red ad a me'i! !$ 'he 'hi% 'ha' didI' !r,
*. Ba;Agrond
*.1 Color
*.1.1 De
8/13/2019 59213325 Content Based Image Retrieval
12/63
eye ad 'he pr!cei% !$ 'ha' i$!rma'i! i 'he rai, ;e ue c!l!ur everyday '! 'ell
'he di$$erece e'ee !.ec' place ad 'he 'ime !$ day E7F, ually c!l!ur are
de$ied i 'hree dimei!al c!l!ur pace, Thee c!uld ei'her eR*B(Red Cree ad
Blue)+#!(ue Sa'ura'i! ad Galue) !r+#B(ue Sa'ura'i! ad Bri%h'e), The
la' '! are depede' ! 'he huma percep'i! !$ hue a'ura'i! ad ri%h'e,
=!' ima%e $!rma' uch a,("*BM( *IF ue 'he RCB c!l!ur pace '! '!re
i$!rma'i! E7F, The RCB c!l!ur pace i de$ied a a ui' cue i'h red %ree ad
lue ae, Thu a vec'!r i'h 'hree c!-!rdia'e repree' 'he c!l!ur i 'hi pace,
;he all 'hree c!!rdia'e are e' '! 5er! 'he c!l!ur perceived i lac, ;he all 'hree
c!!rdia'e are e' '! 1 'he c!l!ur perceived i hi'e E7F, The !'her c!l!ur pace !pera'e
i a imilar $ahi! u' i'h a di$$ere' percep'i!,
*.1.2 Met>ods o< Re?resentation
The mai me'h!d !$ repree'i% c!l!ur i$!rma'i! !$ ima%e i B4R y'em
i 'hr!u%h c!l!ur hi'!%ram, A c!l!ur hi'!%ram i a 'ype !$ ar %raph here each ar
repree' a par'icular c!l!ur !$ 'he c!l!ur pace ei% ued, 4 =a'>a $!r eample y!u
ca %e' a c!l!ur hi'!%ram !$ a ima%e i 'he RCB !r SG c!l!ur pace, The ar i a
c!l!ur hi'!%ram are re$erred '! a i ad 'hey repree' 'he -ai, The umer !$ i
deped ! 'he umer !$ c!l!ur 'here are i a ima%e, The y-ai de!'e 'he umer
!$ piel 'here are i each i, 4 !'her !rd h! may piel i a ima%e are !$ a
par'icular c!l!ur,
A eample !$ a c!l!ur hi'!%ram i 'he SG c!l!ur pace ca e ee i'h 'he
6
8/13/2019 59213325 Content Based Image Retrieval
13/63
$!ll!i% ima%e"
Figure- #am'le Image and its Corres'onding +istogram.
T! vie a hi'!%ram umerically !e ha '! l!! a' 'he c!l!ur map !r 'he umeric
repree'a'i! !$ each i,
Colour Ma'
/01a0is2
&umber of (i0els 'er Bin
/1a0is2+ # !
,9922 ,9882 ,9961 16,9@69 ,9@69 ,9882 2+2,972@ ,96+7 ,976@ 273,9176 ,9137 ,9@69 372,998 ,898 ,9176 18@,9@69 ,92@@ ,9+12 2+,92 ,8627 ,898 13@,92 ,8+31 ,8@1 166,998 ,8196 ,878 179
,8@+9 ,8@1 ,89+1 188,823@ ,823@ ,89+1 2+1,8+71 ,83@3 ,8@+9 1+,83@3 ,7961 ,8392 198
, , , ,, , , ,, , , ,
7
8/13/2019 59213325 Content Based Image Retrieval
14/63
Table- Colour Ma' and &umber of 'i0els for t)e (revious Image3
A !e ca ee $r!m 'he c!l!ur map each r! repree' 'he c!l!ur !$ a i, The r! i
c!mp!ed !$ 'he 'hree c!!rdia'e !$ 'he c!l!ur pace, The $ir' c!!rdia'e repree'
hue 'he ec!d a'ura'i! ad 'he 'hird value 'herey %ivi% SG, The perce'a%e !$
each !$ 'hee c!!rdia'e are ha' mae up 'he c!l!ur !$ a i, Al! !e ca ee 'he
c!rrep!di% piel umer $!r each i hich are de!'ed y 'he lue lie i 'he
hi'!%ram,
Hua'i5a'i! i 'erm !$ c!l!ur hi'!%ram re$er '! 'he pr!ce !$ reduci% 'he umer
!$ i y 'ai% c!l!ur 'ha' are very imilar '! each !'her ad pu''i% 'hem i 'he ame
i, By de$aul' 'he maimum umer !$ i !e ca !'ai ui% 'he hi'!%ram
$uc'i! i =a'>a i 2@6, 0!r 'he purp!e !$ avi% 'ime he 'ryi% '! c!mpare c!l!ur
hi'!%ram !e ca *ua'i5e 'he umer !$ i, :vi!uly *ua'i5a'i! reduce 'he
i$!rma'i! re%ardi% 'he c!'e' !$ ima%e u' a a me'i!ed 'hi i 'he 'rade!$$
he !e a' '! reduce pr!cei% 'ime,
There are '! 'ype !$ c!l!ur hi'!%ram Cl!al c!l!ur hi'!%ram (*C+) ad >!cal
c!l!ur hi'!%ram (LC+), A C repree' !e h!le ima%e i'h a i%le c!l!ur
hi'!%ram, A > divide a ima%e i'! $ied l!c ad 'ae 'he c!l!ur hi'!%ram !$
each !$ 'h!e l!c E7F, > c!'ai m!re i$!rma'i! a!u' a ima%e u' are
c!mpu'a'i!ally epeive he c!mpari% ima%e, JThe C i 'he 'radi'i!al me'h!d
$!r c!l!ur aed ima%e re'rieval, !ever i' d!e !' iclude i$!rma'i! c!ceri%
'he c!l!ur di'riu'i! !$ 'he re%i! E7F !$ a ima%e , Thu he c!mpari% C !e
mi%h' !' alay %e' a pr!per reul' i 'erm !$ imilari'y !$ ima%e,
8
8/13/2019 59213325 Content Based Image Retrieval
15/63
*.2. Te=tre
*.2.1 De
8/13/2019 59213325 Content Based Image Retrieval
16/63
Re%ulari'y
R!u%he
Te'ure i !e !$ 'he m!' imp!r'a' de$ii% $ea'ure !$ a ima%e, 4' i charac'eri5ed y
'he pa'ial di'riu'i! !$ %ray level i a ei%h!rh!!d E8F, 4 !rder '! cap'ure 'he
pa'ial depedece !$ %ray-level value hich c!'riu'e '! 'he percep'i! !$ 'e'ure a
'!-dimei!al depedece 'e'ure aalyi ma'ri i 'ae i'! c!idera'i!, Thi
'!-dimei!al ma'ri i !'aied y dec!di% 'he ima%e $ile .pe% mp e'c,
*.2.2 Met>ods o< Re?resentation
There are 'hree pricipal appr!ache ued '! decrie 'e'ure 'a'i'ical 'ruc'ural
ad pec'ralL
S'a'i'ical 'echi*ue charac'eri5e 'e'ure ui% 'he 'a'i'ical pr!per'ie !$
'he %rey level !$ 'he p!i'Mpiel c!mprii% a ur$ace ima%e, Typically
'hee pr!per'ie are c!mpu'ed ui%" 'he %rey level c!-!ccurrece ma'ri !$
'he ur$ace !r 'he avele' 'ra$!rma'i! !$ 'he ur$ace,
S'ruc'ural 'echi*ue charac'eri5e 'e'ure a ei% c!mp!ed !$ imple
primi'ive 'ruc'ure called J'eel (!r 'e'ure eleme'), Thee are arra%ed
re%ularly ! a ur$ace acc!rdi% '! !me ur$ace arra%eme' rule,
Spec'ral 'echi*ue are aed ! pr!per'ie !$ 'he 0!urier pec'rum ad
decrie %l!al peri!dici'y !$ 'he %rey level !$ a ur$ace y ide'i$yi% hi%h-
eer%y pea i 'he 0!urier pec'rum E9F,
0!r !p'imum clai$ica'i! purp!e ha' c!cer u are 'he 'a'i'ical 'echi*ue !$
1
Figure- "0am'les of Te0tures.
8/13/2019 59213325 Content Based Image Retrieval
17/63
charac'eri5a'i!L Thi i ecaue i' i 'hee 'echi*ue 'ha' reul' i c!mpu'i% 'e'ure
pr!per'ieL The m!' p!pular 'a'i'ical repree'a'i! !$ 'e'ure are"
!-!ccurrece =a'ri
Tamura Te'ure
;avele' Tra$!rm
*.2.2.1 Co3o;;rren;e Matri=
:ri%ially pr!p!ed y R,=, aralic 'he c!-!ccurrece ma'ri repree'a'i! !$
'e'ure $ea'ure epl!re 'he %rey level pa'ial depedece !$ 'e'ure E2F, A ma'hema'ical
de$ii'i! !$ 'he c!-!ccurrece ma'ri i a $!ll! E+F"
- Cive a p!i'i! !pera'!r(/i452
- le'Ae a ma'ri
- h!e eleme'A6i7657i 'he umer !$ 'ime 'ha' p!i' i'h %rey level
(i'ei'y)g6i7 !ccur i 'he p!i'i! peci$ied y( rela'ive '! p!i' i'h
%rey levelg657,
- >e' Ce 'he n =nma'ri 'ha' i pr!duced y dividi%Ai'h 'he '!'al
umer !$ p!i' pair 'ha' a'i$y(, C6i7657 i a meaure !$ 'he .!i'
pr!aili'y 'ha' a pair !$ p!i' a'i$yi%( ill have valueg6i7g657,
- Ci called a c!-!ccurrece ma'ri de$ied y(,
ample $!r 'he !pera'!r(are" Jia!ve5 !r Ji!e p!i'i! '! 'he ri%h' ad '!
el!5 e'c, E+F
Thi ca al! e illu'ra'ed a $!ll!L >e' te a 'rala'i! 'he a c!-!ccurrece
ma'ri -t!$ a re%i! i de$ied $!r every %rey-level a y E1F"
11
8/13/2019 59213325 Content Based Image Retrieval
18/63
- a 1 c a r d s s t R 3 s a 3 s t 1t ( ) N ( ) O E F E F P= + = + =2
ere -ta i 'he umer !$ i'e-c!uple de!'ed y s s t'ha' are epara'ed y a
'rala'i! vec'!r t i'h aei% 'he %rey-level !$s ad ei% 'he %rey-level !$s t,
0!r eample i'h a 8 %rey-level ima%e repree'a'i! ad a vec'!r t'ha' c!ider !ly
!e ei%h!ur e !uld $id E1F"
Figure- Image e0am'le
Figure- Classical Co1occurrence matri0
A' $ir' 'he c!-!ccurrece ma'ri i c!'ruc'ed aed ! 'he !rie'a'i! ad di'ace
e'ee ima%e piel, The meai%$ul 'a'i'ic are e'rac'ed $r!m 'he ma'ri a 'he
'e'ure repree'a'i! E2F, aralic pr!p!ed 'he $!ll!i% 'e'ure $ea'ure E1F"
1, A%ular Sec!d =!me'
2, !'ra'
3, !rrela'i!
12
8/13/2019 59213325 Content Based Image Retrieval
19/63
+, Gariace
@, 4vere Sec!d /i$$ere'ial =!me'
6, Sum Avera%e
7, Sum Gariace
8, Sum 'r!py
9, 'r!py
1, /i$$erece Gariace
11, /i$$erece 'r!py
12, =eaure !$ !rrela'i! 1
13, =eaure !$ !rrela'i! 2
1+, >!cal =ea
ece $!r each aralic 'e'ure $ea'ure e !'ai a c!-!ccurrece ma'ri, Thee c!-
!ccurrece ma'rice repree' 'he pa'ial di'riu'i! ad 'he depedece !$ 'he %rey
level i'hi a l!cal area, ach /i452'h
e'ry i 'he ma'rice repree' 'he pr!aili'y !$
%!i% $r!m !e piel i'h a %rey level !$ IiI '! a!'her i'h a %rey level !$ I5I uder a
prede$ied di'ace ad a%le, 0r!m 'hee ma'rice e' !$ 'a'i'ical meaure are
c!mpu'ed called $ea'ure vec'!r E11F,
*.2.2.2 Tamra Te=tre
By !ervi% pych!l!%ical 'udie i 'he huma viual percep'i! Tamura epl!red
'he 'e'ure repree'a'i! ui% c!mpu'a'i!al appr!ima'i! '! 'he 'hree mai 'e'ure
$ea'ure !$" c!aree c!'ra' ad direc'i!ali'y E2 12F, ach !$ 'hee 'e'ure $ea'ure
are appr!ima'ely c!mpu'ed ui% al%!ri'hmL
13
8/13/2019 59213325 Content Based Image Retrieval
20/63
8/13/2019 59213325 Content Based Image Retrieval
21/63
have a $ii'e dura'i! ad arup' cha%e i $re*uecy, Thi acc!u' $!r 'he e$$iciecy
!$ avele' 'ra$!rm, Thi i ecaue avele' 'ra$!rm c!ver' a i%al i'! a erie
!$ avele' hich ca e '!red m!re e$$icie'ly due '! $ii'e 'ime ad ca e
c!'ruc'ed i'h r!u%h ed%e 'herey e''er appr!ima'i% real-!rld i%al E1+F,
ample !$ avele' are !i$le' =!rle' =eica a' aar ad /auechie, :$ 'hee
aar i 'he imple' ad m!' idely ued hile /auechie have $rac'al 'ruc'ure ad
are vi'al $!r curre' avele' applica'i! E2F, Thee '! are !u'lied el!"
+aar %avelet
The aar avele' $amily i de$ied a E2F"
Figure- +aar %avelet "0am'le.
E0!r m!re i$!rma'i! eeppendi$ ' 4 Recoended ReadingsF
1@
8/13/2019 59213325 Content Based Image Retrieval
22/63
8aubec)ies %avelet
The /auechie avele' $amily i de$ied a E2F"
Figure- 8aubec)ies %avelet "0am'le
E0!r m!re i$!rma'i! eeppendi$ ' 4 Recoended ReadingsF
>a'er i 'hi rep!r' i 'he #r!.ec' /e'ail $ur'her de'ail re%ardi% 'he avele' 'ra$!rm
ill e '!uched up!,
16
8/13/2019 59213325 Content Based Image Retrieval
23/63
*." #>a?e
*.".1 De
8/13/2019 59213325 Content Based Image Retrieval
24/63
*.".2 Met>ods o< Re?resentation
0!r repree'i% hape $ea'ure ma'hema'ically e have E16F"
B!udary-aed"
#!ly%!al =!del !udary par'i'i!i%
0!urier /ecrip'!r
Splie hi%her !rder c!'ruc'
urva'ure =!del
Re%i!-aed"
Super*uadric
0!urier /ecrip'!r
4mplici' #!ly!mial
BlumI ele'!
The m!' ucce$ul repree'a'i! $!r hape ca'e%!rie are 0!urier /ecrip'!r ad
=!me' 4varia' E2F"
The mai idea !$ 0!urier /ecrip'!r i '! ue 'he 0!urier 'ra$!rmed !udary
a 'he hape $ea'ure,
The mai idea !$ =!me' ivaria' i '! ue re%i!-aed m!me' hich are
ivaria' '! 'ra$!rma'i! a 'he hape $ea'ure,
18
8/13/2019 59213325 Content Based Image Retrieval
25/63
-. Proe;t Details
-.1 Color
-.1.1 8adrati; Distan;e Metri;
The e*ua'i! e ued i derivi% 'he di'ace e'ee '! c!l!ur hi'!%ram i
'he *uadra'ic di'ace me'ric"
( ) ( ) ( )d Q 0 H H 3 H H Q 0t
Q 0
2 =
The e*ua'i! c!i' !$ 'hree 'erm, The deriva'i! !$ each !$ 'hee 'erm ill e
eplaied i 'he $!ll!i% ec'i!, The $ir' 'erm c!i' !$ 'he di$$erece e'ee '!
c!l!ur hi'!%ram !r m!re preciely 'he di$$erece i 'he umer !$ piel i each i,
Thi 'erm i !vi!uly a vec'!r ice i' c!i' !$ !e r!, The umer !$ c!lum i
'hi vec'!r i 'he umer !$ i i a hi'!%ram, The 'hird 'erm i 'he 'rap!e !$ 'ha'
vec'!r, The middle 'erm i 'he imilari'y ma'ri, The $ial reul' d repree' 'he c!l!ur
di'ace e'ee '! ima%e, The cl!er 'he di'ace i '! 5er! 'he cl!er 'he ima%e are
i c!l!ur imilari'y, The $ur'her 'he di'ace $r!m 5er! 'he le imilar 'he ima%e are i
c!l!ur imilari'y,
-.1.2 &istograms
;e ued Cl!al c!l!ur hi'!%ram i e'rac'i% 'he c!l!ur $ea'ure !$ ima%e, 4
aaly5i% 'he hi'!%ram 'here ere a $e iue 'ha' had '! e deal' i'h, 0ir' 'here a
19
8/13/2019 59213325 Content Based Image Retrieval
26/63
'he iue !$ h! much e !uld *ua'i5e 'he umer !$ i i a hi'!%ram, By de$aul'
'he umer !$ i repree'ed i a ima%eI c!l!ur hi'!%ram ui% 'he im)ist/2
$uc'i! i =a'>a i 2@6, =eai% 'ha' i !ur calcula'i! !$ imilari'y ma'ri ad
hi'!%ram di$$erece 'he pr!cei% !uld e c!mpu'a'i!ally epeive, 4i'ially e
decided '! *ua'i5e 'he umer !$ i '! 2, Thi mea 'ha' c!l!ur 'ha' are di'ic' ye'
imilar are ai%ed '! 'he ame i reduci% 'he umer !$ i $r!m 2@6 '! 2, Thi
!vi!uly decreae 'he i$!rma'i! c!'e' !$ ima%e u' decreae 'he 'ime i
calcula'i% 'he c!l!ur di'ace e'ee '! hi'!%ram, : 'he !'her had eepi% 'he
umer !$ i a' 2@6 %ive a m!re accura'e reul' i 'erm !$ c!l!ur di'ace, >a'er !
e e' ac '! 2@6 i due '! !me ic!i'ecie !'aied i 'he c!l!ur di'ace
e'ee ima%e, Thi had !'hi% '! d! i'h *ua'i5i% 'he ima%e u' ra'her i'h 'he
'ype !$ ima%e e here ui% hich ill e $ur'her ela!ra'ed la'er ! i 'he Reul'
ec'i!,
The ec!d iue a i hich c!l!ur pace !uld e pree' !ur c!l!ur map, Sh!uld i'
e R,B!r Q Thi a !lved ri%h' aay he e $!ud 'ha' QBICI imilari'y
ma'ri e*ua'i! a ui% 'he c!l!ur pace i i' calcula'i!, There haI' ee ay
evidece '! h! hich c!l!ur pace %eera'e 'he e' re'rieval reul' 'hu 'he ue !$
'hi c!l!ur pace did !' re'ric' u a ayay,
-.1." #imilarit@ Matri=
A ca e ee $r!m 'he c!l!ur hi'!%ram !$ '! ima%e QadIi 'he $i%ure
el! 'he c!l!ur pa''er !erved i 'he c!l!ur ar are '!'ally di$$ere', Thi i $ur'her
c!$irmed he !e ee 'he repec'ive c!l!ur map i 'he $!ll!i% 'aleL
2
8/13/2019 59213325 Content Based Image Retrieval
27/63
(a) 4ma%e H
(a) 4ma%e 4
Figure- Colour +istograms of two images3
21
8/13/2019 59213325 Content Based Image Retrieval
28/63
Colour Ma' of image Q Colour Ma' of image I
,968
,898 ,78+3
,9922 ,9882 ,9961
,9373
,9@9 ,823@
,9@69 ,9@69 ,9882
,998 ,8@1 ,776@ ,972@ ,96+7 ,976@
,92@@
,8@88 ,839
,9176 ,9137 ,9@69
,8627
,827@ ,7961
,998 ,898 ,9176
,998
,8+31 ,7216
,9@69 ,92@@ ,9+12
,9137
,8392 ,6627
,92 ,8627 ,898
,9@9
,7882 ,6@1
,92 ,8+31 ,8@1
,9+@1
,827@ ,682+
,998 ,8196 ,878
,9@69
,7882 ,@922
,8@+9 ,8@1 ,89+1
,9137
,776@ ,@961
,823@ ,823@ ,89+1
,9+12
,7961 ,@@69
,8+71 ,83@3 ,8@+9
,8+71
,78+3 ,7176
,83@3 ,7961 ,8392
,827
@
,78+3 ,67+
@
,8+31 ,78+ ,78+3
,92
,8392 ,6667
,7961 ,78+ ,83@3
,898
,7333 ,@8+3
,7882 ,772@ ,7882
,92
,7216 ,@333
,823@ ,831+ ,8118
, , , , , ,
, , , , , ,, , , , , ,
Table- Colour Ma's of two images3
A imple di'ace me'ric iv!lvi% 'he u'rac'i! !$ 'he umer !$ piel i 'he 1 'i
!$ !e hi'!%ram $r!m 'he 1'i !$ a!'her hi'!%ram ad ! ! i !' ade*ua'e, Thi
me'ric i re$erred '! a aMino:si';or Distance Metric h! el! hich !ly
22
8/13/2019 59213325 Content Based Image Retrieval
29/63
c!mpare 'he Jame i e'ee c!l!ur hi'!%ram E3F,
Figure- Minkowski 8istance A''roac).
Thi i 'he mai rea! $!r ui% 'he *uadra'ic di'ace me'ric, =!re preciely i' i 'he
middle 'erm !$ 'he e*ua'i! !r imilari'y ma'riA'ha' help u !verc!me 'he pr!lem !$
di$$ere' c!l!ur map, The imilari'y ma'ri i !'aied 'hr!u%h a c!mple al%!ri'hm"
( ) ( ) ( )( ) ( ) ( )( )a
) ) s h s h s h s h
2 i
2 i 2 2 i i 2 2 i i
c ! c ! i i
= + +
1@
2 2 21
2
hich aically c!mpare !e c!l!ur i !$+Qi'h all 'h!e !$+I'! 'ry ad $id !u'
hich c!l!ur i i 'he m!' imilar a h! el!"
23
8/13/2019 59213325 Content Based Image Retrieval
30/63
Figure- Quadratic 8istance A''roac).
Thi i c!'iued u'il e have c!mpared all 'he c!l!ur i !$ +Q, 4 d!i% ! e %e' a
& =&ma'ri&repree'i% 'he umer !$ i, ;ha' idica'e he'her 'he c!l!ur
pa''er !$ '! hi'!%ram are imilar i 'he dia%!al !$ 'he ma'ri h! el!, 4$ 'he
dia%!al e'irely c!i' !$ !e 'he 'he c!l!ur pa''er are ide'ical, The $ur'her 'he
umer i 'he dia%!al are $r!m !e 'he le imilar 'he c!l!ur pa''er are, Thu 'he
pr!lem !$ c!mpari% '!'ally urela'ed i i !lved,
Figure- #imilarit Matri0 A4 wit) a diagonal of ones.6
8/13/2019 59213325 Content Based Image Retrieval
31/63
$ial e*ua'i! Quadratic 8istance Metric, Surprii%ly a umer !$ ic!i'ecie ep'
appeari% i 'erm !$ 'he c!l!ur di'ace e'ee cer'ai ima%e, 4ma%e 'ha' here
'!'ally urela'ed had c!l!ur di'ace maller 'ha 'h!e 'ha' here very imilar, A
eample !$ 'hi ca e ee i'h 'he $!ll!i% 'hree ima%e" a m!*ue a h!cey %ame
ad a!'her pic'ure !$ 'he ame h!cey %ame a ee el!L
/a2 faceoff< /b2 faceoff= /c2 mos>ue
Figure- Tested Images.
A ca e ee $r!m 'he $!ll!i% 'ale 'he reul' are !' c!i'e' i'h h! 'he
ima%e l!! '! 'he huma eye,
Images Colour distance between image )istograms
$ace!$$3 v $ace!$$+ 1,77
$ace!$$3 v m!*ue 9,99
Table- Colour 8istances for Com'ressed Images.
Thi a d!e a%ai ad a%ai i'h a umer !$ ima%e ad reul'ed i 'he ame
ic!i'ecie, ;ha' 'ured !u' '! e 'he caue !$ all 'hi ere 'he 'ype !$ ima%e e
2@
8/13/2019 59213325 Content Based Image Retrieval
32/63
ere ui%, A' $ir' e 'h!u%h' 'he !ly 'hi% 'ha' c!uld %ive ic!i'e' reul' lie 'hi
a c!mpari% ima%e !$ di$$ere' i5e u' e had rei5ed all 'he ima%e i !ur
da'aae '! 2@62@6 e$!re 'e'i% !ur al%!ri'hm, The ima%e e had i !ur da'aae
here all 2+-i',("*, The pr!lem i'h,("*ima%e i 'ha' 'hey are c!mpreed ad
'he c!mprei! al%!ri'hm eem '! a$$ec' 'he ay 'he hi'!%ram are derived, ;e $!ud
'hi !u' y c!ver'i% !me !$ 'he ima%e i !ur da'aae '! 8-i' uc!mpreed i'
map, The ame ima%e 'ha' here 'e'ed i,("*$!rma' here 'e'ed a%ai aBM(,
;ha' reul'ed a c!i'e' i'h h! 'he ima%e l!!ed '! 'he huma eye, 4ma%e 'ha'
l!!ed imilar %ave mall c!l!ur di'ace c!mpared '! 'h!e 'ha' l!!ed very di$$ere',
Thi ca e ee i 'he $!ll!i% 'ale hich h! 'he ame ima%e a 'h!e i 'he
previ!u 'ale u' iBM($!rma',
Images Colour distance between image )istograms
$ace!$$3 v $ace!$$+ +,39
$ace!$$3 v m!*ue 6,1
Table- Colour 8istances for ?ncom'ressed Images.
4 reali5i% 'ha' !ur err!r a due '! ima%e $!rma' e decided '! c!ver' all !ur ima%e
'! uc!mpreedBM(, Thi !vi!uly i !' c!i'e' i'h $ull CBIR sstems
availale i 'he mare' hich 'ae ay 'ype !$ ima%e a a *uery i ay $!rma' u' $!r
'he purp!e !$ 'hi pr!.ec' e did !' a' '! delve i'! c!mprei! iue,
4 c!ver'i% all !$ !ur ima%e '! 8-i' uc!mpreedBM( 'here a a li%h' cha%e i
'he ay e deal' i'h 'heir repec'ive c!l!ur map, ;ha' e previ!uly did a ide a
ima%e e$!re ui% 'he im)ist $uc'i!, ;ha' idei% d!e i *ua'i5e 'he c!l!ur map
26
8/13/2019 59213325 Content Based Image Retrieval
33/63
y le''i% 'he uer peci$y 'he umer !$ i, Thi !vi!uly reduce 'he pr!cei%
'ime i 'erm !$ calcula'i% c!l!ur di'ace ice y!u d!I' have 2@6 i '! c!mpare,
;he l!adi% 8-i' uc!mpreed ima%e i'! a variale =a'>a d!e !' le' y!u
*ua'i5e 'heir c!l!ur map, 4' %ive y!u a err!r he y!u 'ry '! ide 'hem, Thu e
here $!rced '! 'ic '! 'he de$aul' value !$ 2@6 i $!r all !ur c!l!ur hi'!%ram,
27
8/13/2019 59213325 Content Based Image Retrieval
34/63
-.2 Te=tre
-.2.1 P@ramid3#tr;tred (avelet Trans
8/13/2019 59213325 Content Based Image Retrieval
35/63
Figure- (ramid1#tructured %avelet Transform3
-.2.2 Energ@ Level
er%y >evel Al%!ri'hm"
1, /ec!mp!e 'he ima%e i'!fouru-ima%e
2, alcula'e 'he eer%y !$ all dec!mp!ed ima%e a' 'he ame cale ui% E2F"
( )+ M
>
n
i
===
1 11
hereMad& are 'he dimei! !$ 'he ima%e ad@ i 'he i'ei'y !$ 'he piel
l!ca'ed a' r! iad c!lum5 i 'he ima%e map,
3, Repea' $r!m 'ep 1 $!r 'he l!-l! u-ad ima%e u'il ide indi e*ual '! @,
4creme' ind,
i% 'he a!ve al%!ri'hm 'he eer%y level !$ 'he u-ad ere calcula'ed ad
$ur'her dec!mp!i'i! !$ 'he l!-l! u-ad ima%e, Thi i repea'ed $ive 'ime '!
reach $i$'h level dec!mp!i'i!, Thee eer%y level value are '!red '! e ued i 'he
uclidea di'ace al%!ri'hm,
29
8/13/2019 59213325 Content Based Image Retrieval
36/63
-.2." E;lidean Distan;e
uclidea /i'ace Al%!ri'hm"
1, /ec!mp!e *uery ima%e,
2, Ce' 'he eer%ie !$ 'he $ir' d!mia' kchael,
3, 0!r ima%e ii 'he da'aae !'ai 'he keer%ie,
+, alcula'e 'he uclidea di'ace e'ee 'he '! e' !$ eer%ie ui% E2F"
( )D $ #i 9 i 9 9
9
= =
2
1
@, 4creme' i, Repea' $r!m 'ep 3,
i% 'he a!ve al%!ri'hm 'he *uery ima%e i earched $!r i 'he ima%e da'aae, The
uclidea di'ace i calcula'ed e'ee 'he *uery ima%e ad every ima%e i 'he
da'aae, Thi pr!ce i repea'ed u'il all 'he ima%e i 'he da'aae have ee
c!mpared i'h 'he *uery ima%e, p! c!mple'i! !$ 'he uclidea di'ace al%!ri'hm
e have a array !$ uclidea di'ace hich i 'he !r'ed, The $ive '!pm!' ima%e
are 'he diplayed a a reul' !$ 'he 'e'ure earch,
-." ,UI
The Craphical er 4'er$ace a c!'ruc'ed ui%MatLab *?I8" !r
*ra')ical ?ser Interface 8esign "nvironment, i% 'he lay!u' '!!l pr!vided y
*?I8" e dei%ed 'he $!ll!i% %raphical uer i'er$ace $i%ure (aDemo.
8/13/2019 59213325 Content Based Image Retrieval
37/63
Figure- *?I 8esign4 a8emo3fig.
4 addi'i! '! 'he a!ve !u'lied dei% e al! dei%ed a imple meu 'ruc'ure ui%
'heMenu "ditor a h! el!"
31
8/13/2019 59213325 Content Based Image Retrieval
38/63
Figure- Menu "ditor s'ecification for t)e menu.
The a!ve dei% yield 'he $!ll!i% applica'i! id! ! ru 'ime"
Figure- A''lication window at runtime.
The hadler $!r clici% ! 'he u''! are c!ded ui% =a'>a c!de '! per$!rm 'he
32
8/13/2019 59213325 Content Based Image Retrieval
39/63
eceary !pera'i!, EThee are availale ippendi$ ' -4 Mat,a -ode,F
-.$ Dataase
The ima%e da'aae 'ha' e ued i !ur pr!.ec' c!'ai i'y 8-i' uc!mpreed
i' mapBM( 'ha' have ee rad!mly elec'ed $r!m 'he ;!rld ;ide ;e, The
$!ll!i% $i%ure depic' a ample !$ ima%e i 'he da'aae"
Figure- Image 8atabase.
-.% E=am?le
T! dem!'ra'e 'he pr!.ec' applica'i! e impleme'ed 'he $!ll!i% eample"
;e 'ar'ed 'he applica'i! y 'ypi% a8emo ad prei% re'ur i 'he =a'>a
!mmad ;id!, The applica'i! id! 'ar'ed,
4 'he applica'i! id! e elec'ed 'he ?ptions meu ad elec'ed !earch
33
8/13/2019 59213325 Content Based Image Retrieval
40/63
Dataase, Thi ealed 'he r!i% id! '! r!e '! a BM( $ile,
p! hi%hli%h'i% aBM( $ile 'he elec' u''! ecame ealed, Note::ly 8-i'
uc!mpreedBM( are ui'ale $!r 'hi applica'i!, 4 'hi eample e elec'ed
uer image-
8/13/2019 59213325 Content Based Image Retrieval
41/63
Figure- Colour Results for t)e searc)ing for
8/13/2019 59213325 Content Based Image Retrieval
42/63
'he+uc"idean Distance Metric e !'aied 'he $!ll!i% '!p + reul'"
Figure- Te0ture Results for t)e searc)ing for
8/13/2019 59213325 Content Based Image Retrieval
43/63
e$$ec'ive ad e$$icie' re'rieval y'em, The devel!pme' !$ 'hee y'em 'ar'ed i'h
re'rievi% ima%e ui% 'e'ual c!!'a'i! u' la'er i'r!duced ima%e re'rieval aed !
c!'e', Thi came '! e ! a B4R !r !'e' Baed 4ma%e Re'rieval, Sy'em
ui% B4R re'rieve ima%e aed ! viual $ea'ure uch a c!l!ur 'e'ure ad hape a
!pp!ed '! depedi% ! ima%e decrip'i! !r 'e'ual idei%, 4 'hi pr!.ec' e have
reearched vari!u m!de !$ repree'i% ad re'rievi% 'he ima%e pr!per'ie !$ c!l!ur
'e'ure ad hape, /ue '! lac !$ 'ime e ere !ly ale '! $ully c!'ruc' a
applica'i! 'ha' re'rieved ima%e ma'che aed ! c!l!ur ad 'e'ure !ly,
The applica'i! per$!rm a imple c!l!ur-aed earch i a ima%e da'aae $!r a ipu'
*uery ima%e ui% c!l!ur hi'!%ram, 4' 'he c!mpare 'he c!l!ur hi'!%ram !$
di$$ere' ima%e ui% 'he Quadratic Distance +uation, 0ur'her ehaci% 'he earch
'he applica'i! per$!rm a 'e'ure-aed earch i 'he c!l!ur reul' ui% avele'
dec!mp!i'i! ad eer%y level calcula'i!, 4' 'he c!mpare 'he 'e'ure $ea'ure
!'aied ui% 'he+uc"idean Distance +uation, A m!re de'ailed 'ep !uld $ur'her
ehace 'hee 'e'ure reul' ui% a hape-aed earch,
B4R i 'ill a devel!pi% ciece, A ima%e c!mprei! di%i'al ima%e pr!cei% ad
ima%e $ea'ure e'rac'i! 'echi*ue ec!me m!re devel!ped B4R mai'ai a 'eady
pace !$ devel!pme' i 'he reearch $ield, 0ur'herm!re 'he devel!pme' !$ p!er$ul
pr!cei% p!er ad $a'er ad cheaper mem!rie c!'riu'e heavily '! B4R
devel!pme', Thi devel!pme' pr!mie a immee ra%e !$ $u'ure applica'i! ui%
B4R,
37
8/13/2019 59213325 Content Based Image Retrieval
44/63
10. Reee Re%ie ad S'am! Ce!r%e JA Si%a'ure aed
! /elauay Craph ad !-!ccurrece =a'ri >a!ra'!ire 4$!rma'i*ue e'
38
8/13/2019 59213325 Content Based Image Retrieval
45/63
Sy'ema'i*ue iveriy' !$ #ari #ari 0race uly 22 0!ud a'"
h''p"MM,ma'h-i$!,uiv-pari@,$rMip-laMareauMareau,pd$
2, Sharmi Siddi*ue JA ;avele' Baed Techi*ue $!r Aalyi ad lai$ica'i!
!$ Te'ure 4ma%e arle'! iveri'y :''aa aada #r!., Rep, 7,@93
April 22,
3, Th!ma Seidl ad a-#e'er Krie%el J$$icie' er-Adap'ale Similari'y
Search i >ar%e =ul'imedia /a'aae i #r!ceedi% !$ 'he 23 rd4'era'i!al
!$erece ! Gery >ar%e /a'a Bae G>/B97 A'he Creece Au%u' 1997
0!ud a'"
h''p"MM,vld,!r%Mc!$M1997M#@6,#/0
+, 0:>/:;ree ?n',ine Dictionar# ?f -oputing Jc!!ccurrece ma'ri =ay
199@ E:lie /!cume'F Availale a'"
h''p"MM$!ld!c,d!c,ic,ac,uM$!ld!cM$!ld!c,c%iQc!!ccurrecema'ri
@, !li , Ge'ere ad /r, =a''he !!per JA Revie !$ !'e'-Baed 4ma%e
Re'rieval Sy'em E:lie /!cume'F Availale a'"
h''p"MM,.'ap,ac,uMrep!r'Mh'mM.'ap-@+,h'ml
6, >ida C, Shapir! ad Ce!r%e , S'!cma -oputer @ision #re'ice all
21,
7, She%.iu ;a% JA R!u' B4R Appr!ach i% >!cal !l!r i'!%ram
/epar'me' !$ !mpu'er Sciece iveri'y !$ Aler'a dm!'! Aler'a
aada Tech, Rep, TR 1-13 :c'!er 21 0!ud a'"
h''p"MMci'eeer,.,ec,c!mMa%1r!u',h'ml
8, R, ai R, Ka'uri ad B, C, SchucMachine @ision =cCra ill
4'era'i!al di'i! 199@,
39
http://www.math-info.univ-paris5.fr/sip-lab/barbeau/barbeau.pdfhttp://www.vldb.org/conf/1997/P506.PDFhttp://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?cooccurrence+matrixhttp://www.jtap.ac.uk/reports/htm/jtap-054.htmlhttp://citeseer.nj.nec.com/wang01robust.htmlhttp://www.math-info.univ-paris5.fr/sip-lab/barbeau/barbeau.pdfhttp://www.vldb.org/conf/1997/P506.PDFhttp://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?cooccurrence+matrixhttp://www.jtap.ac.uk/reports/htm/jtap-054.htmlhttp://citeseer.nj.nec.com/wang01robust.html8/13/2019 59213325 Content Based Image Retrieval
46/63
9, 0:>/:;ree ?n',ine Dictionar# ?f -oputing J'e'ure =ay 199@ E:lie
/!cume'F Availale a'"
h''p"MM$!ld!c,d!c,ic,ac,uM$!ld!cM$!ld!c,c%iQ*ueryU'e'ure
1, JTe'ure cla !'e $!r -oputeriAed age na"#sis M/!cume'F Availale a'"
h''p"MM,iy,liu,eMcvlM#r!.ec'MG4S4T-
.!.!MurveyMurvey!B4RM!de26,h'ml
1+, 0:>/:;ree ?n',ine Dictionar# ?f -oputing Javele' =ay 199@
E:lie /!cume'F Availale a'"
h''p"MM$!ld!c,d!c,ic,ac,uM$!ld!cM$!ld!c,c%iQ*ueryUavele'
1@, >eic! #ulihi% Cr!up >> Jhape E:lie /!cume'F Availale a'"
h''p"MMdic'i!ary,re$erece,c!mMearchQ*Uhape
+
http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=texturehttp://www.cb.uu.se/~ingela/Teaching/ImageAnalysis/Texture2002.pdfhttp://www.brunel.ac.uk/~csstgdm/622.pdfhttp://km.doc.ic.ac.uk/pr-p.techasith-2002/Docs/OSE.dochttp://www.isy.liu.se/cvl/Projects/VISIT-bjojo/survey/surveyonCBIR/node26.htmlhttp://www.isy.liu.se/cvl/Projects/VISIT-bjojo/survey/surveyonCBIR/node26.htmlhttp://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=wavelethttp://dictionary.reference.com/search?q=shapehttp://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=texturehttp://www.cb.uu.se/~ingela/Teaching/ImageAnalysis/Texture2002.pdfhttp://www.brunel.ac.uk/~csstgdm/622.pdfhttp://km.doc.ic.ac.uk/pr-p.techasith-2002/Docs/OSE.dochttp://www.isy.liu.se/cvl/Projects/VISIT-bjojo/survey/surveyonCBIR/node26.htmlhttp://www.isy.liu.se/cvl/Projects/VISIT-bjojo/survey/surveyonCBIR/node26.htmlhttp://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=wavelethttp://dictionary.reference.com/search?q=shape8/13/2019 59213325 Content Based Image Retrieval
47/63
16, Be.ami B, Kimia JSymme'ry-Baed Shape Repree'a'i! >a!ra'!ry $!r
%ieeri% =aM=achie Sy'em (>=S) 4B= ;a'! Reearch e'er
:c'!er 1999 0!ud a'"
h''p"MM,lem,r!,eduMvii!M#ree'a'i!MKimiaM4B=-:c'-99M'al,h'ml
17, =arie''e B!ue' Ali Khecha$ ad eri Briad JShape Repree'a'i! $!r
4ma%e Re'rieval 1999 E:lie /!cume'F Availale a'"
h''p"MM,!m,e-'echi,'u-darm'ad',deMacmmm99MepMmarie''eM
11. !??endi;es
!??endi= 3 !: Re;ommended Readings
CBIR #@stems
h''p"MM,.'ap,ac,uMrep!r'Mh'mM.'ap-@+,h'ml
+1
http://www.lems.brown.edu/vision/Presentations/Kimia/IBM-Oct-99/talk.htmlhttp://www.kom.e-technik.tu-darmstadt.de/acmmm99/ep/marinette/http://www.jtap.ac.uk/reports/htm/jtap-054.htmlhttp://www.lems.brown.edu/vision/Presentations/Kimia/IBM-Oct-99/talk.htmlhttp://www.kom.e-technik.tu-darmstadt.de/acmmm99/ep/marinette/http://www.jtap.ac.uk/reports/htm/jtap-054.html8/13/2019 59213325 Content Based Image Retrieval
48/63
&aar (avelet
h''p"MMama'h,c!l!rad!,eduMc!ureM+72M2SprM>aMaarMhaar,h'ml
Dae;>ies (avelet
h''p"MMama'h,c!l!rad!,eduMc!ureM+72M2SprM>aM/BMd,h'ml
!??endi= 3 B: ,lossar@
CBIR (!'e' Baed 4ma%e Re'rieval)- The pr!ce !$ re'rievi%ima%e aed ! viual $ea'ure uch a 'e'ure ad c!l!ur,
Color distan;e The de%ree !$ imilari'y e'ee '! c!l!ur hi'!%ramrepree'ed y a umerical di'ace, The cl!er 'he di'ace i'! 5er! 'he m!re imilar '! ima%e are i 'erm !$ c!l!ur,The $ur'her aay 'he di'ace i $r!m 5er! 'he le imilar,
Color >istogram a hi'!%ram 'ha' repree' 'he c!l!ur i$!rma'i! !$ aima%e, The -ai repree' all 'he di$$ere' c!l!ur $!ud i'he ima%e, ach peci$ic c!l!ur i re$erred '! a a i, The y-ai repree' 'he umer !$ piel i each i,
Color s?a;e 'he 'hree dimei!al pace i hich c!l!ur i de$ied,
E;lidean distan;e e*ua'i! ued '! c!mpare avera%e i'ei'ie !$ piel,
,loal ;olor
>istogram
'he c!l!ur hi'!%ram !$ 'he h!le ima%e,
+2
http://amath.colorado.edu/courses/4720/2000Spr/Labs/Haar/haar.htmlhttp://amath.colorado.edu/courses/4720/2000Spr/Labs/DB/db.htmlhttp://amath.colorado.edu/courses/4720/2000Spr/Labs/Haar/haar.htmlhttp://amath.colorado.edu/courses/4720/2000Spr/Labs/DB/db.html8/13/2019 59213325 Content Based Image Retrieval
49/63
ue Sa'ura'i! Galue c!l!ur pace,
Lo;al ;olor >istogram 'he c!l!ur hi'!%ram !$ a uec'i! !$ a ima%e,
8adrati; metri; e*ua'i! ued '! calcula'e 'he c!l!ur di'ace, !i' !$'hree 'erm c!l!ur hi'!%ram di$$erece 'rap!e !$ c!l!urhi'!%ram di$$erece ad imilari'y ma'ri,
8antiation Reduci% 'he umer !$ c!l!ur i i a c!l!ur map y 'ai%c!l!ur 'ha' are very imilar '! each !'her ad pu''i% 'hem i'he ame i,
8BIC B4R y'em devel!ped y 4B=,
R,B Red Cree Blue c!l!ur pace
#imilarit@ matri= =a'ri 'ha' de!'e 'he imilari'y e'ee '! e' !$ da'a,Thi i ide'i$ied y 'he dia%!al !$ 'he ma'ri, The cl!er 'hee' !$ da'a 'he cl!er 'he dia%!al i '! !e, The $ar'her 'hee' !$ da'a 'he $ar'her 'he dia%!al i $r!m !e,
!??endi= 3 C: MatLa Code
aDemo.m
function varargout = Demo(varargin)
% ------------------------------------------------------------% DEMO Application M-file for Demo.fig% DEMO, by itself, creates a ne DEMO or raises t!e e"isting% singleton#.%% $ = DEMO returns t!e !anle to a ne DEMO or t!e !anle to% t!e e"isting singleton#.%% DEMO(&'AA'*&,!Ob+ect,eventData,!anles,...) calls t!e local% function name 'AA'* in DEMO.M it! t!e given input arguments.
%% DEMO(&roperty&,&alue&,...) creates a ne DEMO or raises t!e% e"isting singleton#. tarting from t!e left, property value pairsare% applie to t!e /01 before Demo2Opening3unction gets calle. An% unrecogni4e property name or invali value ma5es propertyapplication% stop. All inputs are passe to Demo2Opening3cn via varargin.%
+3
8/13/2019 59213325 Content Based Image Retrieval
50/63
% #ee /01 Options - /01 allos only one instance to run (singleton).%% ee also6 /01DE, /01DA7A, /01$A8DE
% Eit t!e above te"t to moify t!e response to !elp Demo
% ast Moifie by /01DE v9.: 9;-Oct-9
% Open 31/-filefig = openfig(mfilename,&reuse&)> % /enerate a structure of !anlesto pass to callbac5s, an store it.!anles = gui!anles(fig)>guiata(fig, !anles)>
%isp(&populate;BB&)>
% opulate t!e listbo"loa2listbo"(initial2ir,!anles)
% Ceturn figure !anle as first output argument if nargout < varargout;F = fig> en
elseif isc!ar(varargin;F) % 18O*E 8AMED 0308'71O8 OC 'AA'*
try @varargout;6nargoutF = feval(varargin6F)> % 3EA sitc!yar
catc! isp(lasterr)> en
en
% En initiali4ation coe - DO 8O7 ED17% ------------------------------------------------------------
++
8/13/2019 59213325 Content Based Image Retrieval
51/63
% ------------------------------------------------------------% E"ecutes +ust before Demo is mae visible.% ------------------------------------------------------------function Demo2Opening3cn(!Ob+ect, eventata, !anles, varargin)% 7!is function !as no output args, see Output3cn.% !Ob+ect !anle to figure% eventata reserve - to be efine in a future version of MA7A% !anles structure it! !anles an user ata (see /01DA7A)% varargin comman line arguments to Demo (see ACAC/18)
% '!oose efault comman line output for Demo...!anles.output = !Ob+ect>
% 1nitiali4e t!e options...!anles.option = &input&>
% 0pate !anles structure...guiata(!Ob+ect, !anles)>
% ------------------------------------------------------------
% ------------------------------------------------------------% Outputs from t!is function are returne to t!e comman line.% ------------------------------------------------------------function varargout = Demo2Output3cn(!Ob+ect, eventata, !anles)% varargout cell array for returning output args (see ACAC/O07)>% !Ob+ect !anle to figure% eventata reserve - to be efine in a future version of MA7A% !anles structure it! !anles an user ata (see /01DA7A)
% /et efault comman line output from !anles structurevarargout;F = !anles.output>% ------------------------------------------------------------
% ------------------------------------------------------------% 'allbac5 for list bo" - open .fig it! guie, ot!erise use open% ------------------------------------------------------------function varargout = listbo";2'allbac5(!, eventata, !anles)% !Ob+ect !anle to listbo"; (see /'O)% eventata reserve - to be efine in a future version of MA7A% !anles structure it! !anles an user ata (see /01DA7A)
% $ints6 contents = get(!Ob+ect,&tring&) returns listbo"; contents ascell array% contentsget(!Ob+ect,&alue&)F returns selecte item fromlistbo";
mouse2event = get(!anles.figure;,&election7ype&)>ine"2selecte = get(!anles.listbo";,&alue&)>file2list = get(!anles.listbo";,&tring&)>filename = file2listine"2selecteF>
+@
8/13/2019 59213325 Content Based Image Retrieval
52/63
8/13/2019 59213325 Content Based Image Retrieval
53/63
use!itebg = ;>if use!itebg set(!Ob+ect,&ac5groun'olor&,&!ite&)>else set(!Ob+ect,&ac5groun'olor&,get(
8/13/2019 59213325 Content Based Image Retrieval
54/63
% ------------------------------------------------------------% E"ecutes on selection of &Iuite& from t!e menubar.% ------------------------------------------------------------function Juite2'allbac5(!Ob+ect, eventata, !anles)% !Ob+ect !anle to 'loseMenu1tem (see /'O)% eventata reserve - to be efine in a future version of MA7A% !anles structure it! !anles an user ata (see /01DA7A)
selection = Juestlg(&Are you sure you ant to JuiteK&,... @&'lose & get(!anles.figure;,&8ame&) &...&,... &Les&,&8o&,&Les&)>if strcmp(selection,&8o&) return>en
elete(!anles.figure;)
% ------------------------------------------------------------
% ------------------------------------------------------------% E"ecutes on selection of &1nput 7o Database& from t!e menubar.% ------------------------------------------------------------function inputDatabase2'allbac5(!Ob+ect, eventata, !anles)% !Ob+ect !anle to 'loseMenu1tem (see /'O)% eventata reserve - to be efine in a future version of MA7A% !anles structure it! !anles an user ata (see /01DA7A)
% ome coe to input t!e selecte image to t!e atabase...
set(!anles.input, &'!ec5e&, &On&)>set(!anles.searc!, &'!ec5e&, &Off&)>
set(!anles.listbo";, &Enable&, &On&)>set(!anles.te"t;, &Enable&, &On&)>set(!anles.popupmenu, &Enable&, &On&)>
!anles.option = &input&> % 7!is means t!at t!e option is toinput to atabase...
guiata(!Ob+ect, !anles)
% ------------------------------------------------------------
% ------------------------------------------------------------% E"ecutes on selection of &earc! Database& from t!e menubar.% ------------------------------------------------------------function searc!Database2'allbac5(!Ob+ect, eventata, !anles)% !Ob+ect !anle to 'loseMenu1tem (see /'O)% eventata reserve - to be efine in a future version of MA7A% !anles structure it! !anles an user ata (see /01DA7A)
+8
8/13/2019 59213325 Content Based Image Retrieval
55/63
% ome coe to searc! t!e atabase for t!e selecte image...
set(!anles.input, &'!ec5e&, &Off&)>set(!anles.searc!, &'!ec5e&, &On&)>
set(!anles.listbo";, &Enable&, &On&)>set(!anles.te"t;, &Enable&, &On&)>set(!anles.popupmenu, &Enable&, &On&)>
!anles.option = &searc!&> % 7!is means t!at t!e option is tosearc! atabase...
guiata(!Ob+ect, !anles)
% ------------------------------------------------------------
% ------------------------------------------------------------% E"ecutes on button press in selectbutton.% ------------------------------------------------------------function selectutton2'allbac5(!Ob+ect, eventata, !anles)% !Ob+ect !anle to selectutton (see /'O)% eventata reserve - to be efine in a future version of MA7A% !anles structure it! !anles an user ata (see /01DA7A)
ine"2selecte = get(!anles.listbo";,&alue&)>file2list = get(!anles.listbo";,&tring&)>filename = file2listine"2selecteF>
@nepat!,name,e"t,ver = fileparts(filename)>
!anles.filename = strcat(name,e"t)>
@!anles.Juery", !anles.Juerymap = imrea(filename)> %rea t!eimage file.c(&'6Nro+ect&)>
figure
ims!o(!anles.Juery", !anles.Juerymap)> %7!is isplays t!e image.
% Obtain $ format of t!e image...!anles.Juery!sv = rgb9!sv(!anles.Juerymap)>
guiata(!Ob+ect,!anles)
set(!anles.selectutton, &Enable&, &Off&)>
set(!anles.listbo";, &Enable&, &Off&)>set(!anles.te"t;, &Enable&, &Off&)>set(!anles.popupmenu, &Enable&, &Off&)>
set(!anles.input, &Enable&, &Off&)>
+9
8/13/2019 59213325 Content Based Image Retrieval
56/63
set(!anles.searc!, &Enable&, &Off&)>
% !anles.option
sitc! !anles.optioncase &input& set(!anles.inpututton, &Enable&, &On&)>case &searc!& set(!anles.searc!utton, &Enable&, &On&)>en
% ------------------------------------------------------------
% ------------------------------------------------------------% E"ecutes on button press in inpututton.% ------------------------------------------------------------function inpututton2'allbac5(!Ob+ect, eventata, !anles)% !Ob+ect !anle to transform;button (see /'O)% eventata reserve - to be efine in a future version of MA7A
% !anles structure it! !anles an user ata (see /01DA7A)
set(!anles.inpututton, &Enable&, &Off&)>
% Open atabase t"t file... for reaing...fi = fopen(&atabase.t"t&)>
e"ists =
!ile ; tline = fgetl(fi)> if Gisc!ar(tline), brea5, en % Meaning6 En of 3ile... if (strcmp(tline, !anles.filename))
e"ists = ;> brea5> enen
fclose(fi)>
if Ge"ists fi = fopen(&atabase.t"t&, &a&)> fprintf(fi,&%sNr&,!anles.filename)> fclose(fi)>en
guiata(!Ob+ect, !anles)
msgbo"(&Database upate it! file name...&, &uccess...&)>
set(!anles.input, &'!ec5e&, &Off&)>set(!anles.searc!, &'!ec5e&, &Off&)>set(!anles.input, &Enable&, &On&)>set(!anles.searc!, &Enable&, &On&)>
@
8/13/2019 59213325 Content Based Image Retrieval
57/63
% ------------------------------------------------------------
% ------------------------------------------------------------% E"ecutes on button press in searc!utton.% ------------------------------------------------------------function searc!utton2'allbac5(!Ob+ect, eventata, !anles)% !Ob+ect !anle to transform9button (see /'O)% eventata reserve - to be efine in a future version of MA7A% !anles structure it! !anles an user ata (see /01DA7A)
set(!anles.searc!utton, &Enable&, &Off&)>
% 'olour searc!...
% Open atabase t"t file... for reaing...fi = fopen(&atabase.t"t&)>
resultalues = @> % Cesults matri"...result8ames = F>i = ;> % 1nices...+ = ;>
!ile ; imagename = fgetl(fi)> if Gisc!ar(imagename), brea5, en % Meaning6 En of 3ile...
@, C/map = imrea(imagename)> $map = rgb9!sv(C/map)>
D = Juaratic(!anles.Juery", !anles.Juerymap, , $map)>
resultalues(i) = D> result8ames(+) = imagenameF> i = i P ;> + = + P ;>en
fclose(fi)>
% orting colour results...
@sortealues, ine" = sort(resultalues)> % orte results... t!evector ine"
% is use to fin t!eresulting files.
fi = fopen(&colourCesults.t"t&, &P&)> % 'reate a file, over-rite ol ones.
for i = ;6;< % tore top ;< matc!es... tempstr = c!ar(result8ames(ine"(i)))> fprintf(fi, &%sNr&, tempstr)>
@1
8/13/2019 59213325 Content Based Image Retrieval
58/63
isp(result8ames(ine"(i)))> isp(sortealues(i))> isp(& &)>en
fclose(fi)>
%return>
isp(&'olour part one...&)>isp(&'olour results save...&)>isp(&&)>
isplayCesults(&colourCesults.t"t&, &'olour Cesults...&)>
isp(&7e"ture part starting...&)>
% 7e"ture searc!...
JueryEnergies = obtainEnergies(!anles.Juery", Q)> % Obtain
top Q energies of t!e image.
% Open colourCesults t"t file... for reaing...fi = fopen(&colourCesults.t"t&)>
fresultalues = @> % Cesults matri"...fresult8ames = F>i = ;> % 1nices...+ = ;>
!ile ; imagename = fgetl(fi)> if Gisc!ar(imagename), brea5, en % Meaning6 En of 3ile...
@, C/map = imrea(imagename)>
imageEnergies = obtainEnergies(, Q)>
E = euclieanDistance(JueryEnergies, imageEnergies)>
fresultalues(i) = E>
fresult8ames(+) = imagenameF> i = i P ;> + = + P ;>en
fclose(fi)>isp(&7e"ture results obtaine...&)>
% orting final results...
@sortealues, ine" = sort(fresultalues)> % orte results...t!e vector ine" % is use to fin t!eresulting files.
@2
8/13/2019 59213325 Content Based Image Retrieval
59/63
fi = fopen(&te"tureCesults.t"t&, &P&)> % 'reate a file, over-rite ol ones.
for i = ;6R % tore top : matc!es... imagename = c!ar(fresult8ames(ine"(i)))> fprintf(fi, &%sNr&, imagename)>
isp(imagename)> isp(sortealues(i))> isp(& &)>en
fclose(fi)>isp(&7e"ture results save...&)>
isplayCesults(&te"tureCesults.t"t&, &7e"ture Cesults...&)>
guiata(!Ob+ect,!anles)
set(!anles.input, &'!ec5e&, &Off&)>set(!anles.searc!, &'!ec5e&, &Off&)>set(!anles.input, &Enable&, &On&)>set(!anles.searc!, &Enable&, &On&)>
% ------------------------------------------------------------
de;om?ose.m
% Hor5s to ecompose t!e passe image matri"...
% ------------------------------------------------------------% E"ecutes on being calle, it! input image matri".% ------------------------------------------------------------function @7l, 7r, l, r = ecompose(imMatri")
@A,,',D = t9(imMatri",&b;&)>
7l = coemat(A)> % 7op left...7r = coemat()> % 7op rig!t...l = coemat(')> % ottom left...r = coemat(D)> % ottom rig!t...
% Display t!e image ecomposition... @3or testing purposes%figure%colormap(gray)%imagesc(@7l, 7r> l, r)>
% ------------------------------------------------------------
@3
8/13/2019 59213325 Content Based Image Retrieval
60/63
Fadrati;.m
% Hor5s to obtain t!e Iuaratic Distance beteen to 'olour images
% ------------------------------------------------------------% E"ecutes on being calle, it! inputs6% ; - number of pi"els of ;st image% 9 - number of pi"els of 9n image% map; - $ colour map of ;st image% map9 - $ colour map of 9n image% ------------------------------------------------------------function value = Juaratic(;, map;, 9, map9)
% Obtain t!e !istograms of t!e to images...@count;, y; = im!ist(;, map;)>@count9, y9 = im!ist(9, map9)>
% Obtain t!e ifference beteen t!e pi"el counts...J = count; - count9>s = abs(J)>
% Obtain t!e similarity matri"...A = similarityMatri"(map;, map9)>
% Obtain t!e Juaratic istance... = s.A#s> = S;T9> = T ;eU>
% Ceturn t!e istance metric.
value = >
% ------------------------------------------------------------
similarit@Matri=.m
% Hor5s to obtain t!e imilarity Matri" beteen to $ color% !istograms. 7!is is to be use in t!e $istogram Iuaratic% Distance eJuation.
% ------------------------------------------------------------% E"ecutes on being calle, it! input matrices 1 an V.% ------------------------------------------------------------function value = similarityMatri"(1, V)
% Obtain t!e Matri" elements... r - ros, c - columns. 7!e% general assumption is t!at t!ese imentions are t!e same% for bot! matrices.
@+
8/13/2019 59213325 Content Based Image Retrieval
61/63
@r, c = si4e(1)>
A = @>
for i = ;6r for + = ;6r % (s+ # sin !+ - si # sin !i)S9 M; = (1(i, 9) # sin(1(i, ;)) - V(+, 9) # sin(V(+, ;)))S9> % (s+ # cos !+ - si # cos !i)S9 M9 = (1(i, 9) # cos(1(i, ;)) - V(+, 9) # cos(V(+, ;)))S9> % (v+ - vi)S9 M = (1(i, ) - V(+, ))S9>
M< = sJrt(M; P M9 P M)>
%A(i, +) = ; - ;TsJrt(:) # M A(i, +) = ; - (M
en
en
%Obtain imilarity Matri"...value = A>
% ------------------------------------------------------------
otainEnergies.m
% Hor5s to obtain t!e first &n& energies of t!e passe grayscaleimage...
% ------------------------------------------------------------% E"ecutes on being calle, it! input matri" W constant &n&.% ------------------------------------------------------------function value = obtainEnergies(iMatri", n)
m = iMatri"> % 7!e matri" to be ecompose...
energies = @>
i = ;>
for + = ;6: @tl, tr, bl, br = ecompose(m)>
energies(i) = energyevel(tl)> energies(iP;) = energyevel(tr)> energies(iP9) = energyevel(bl)> energies(iP) = energyevel(br)>
@@
8/13/2019 59213325 Content Based Image Retrieval
62/63
i = i P R>
m = tl>en%Obtain array of energies...sorte = -sort(-energies)> % orte in escening orer...value = sorte(;6n)>
% ------------------------------------------------------------
% Hor5s to obtain t!e energy level of t!e passe matri"...
% ------------------------------------------------------------% E"ecutes on being calle, it! input matri".% ------------------------------------------------------------function value = energyevel(aMatri")
% Obtain t!e Matri" elements... r - ros, c - columns.@r, c = si4e(aMatri")>
%Obtain energyevel...value = sum(sum(abs(aMatri")))T(r#c)>
% ------------------------------------------------------------
e;lideanDistan;e.m
% Hor5s to obtain t!e Eucliean Distance of t!e passe vector...
% ------------------------------------------------------------% E"ecutes on being calle, it! input vectors an L.% ------------------------------------------------------------function value = euclieanDistance(, L)
@r, c = si4e()> % 7!e lengt! of t!e vector...
e = @>
% Eucliean Distance = sJrt @ (";-y;)S9 P ("9-y9)S9 P ("-y)S9 ...
for i = ;6c e(i) = ((i)-L(i))S9>en
Eucli = sJrt(sum(e))>
@6
8/13/2019 59213325 Content Based Image Retrieval
63/63
%Obtain energyevel...value = Eucli>
% ------------------------------------------------------------
% Hor5s to isplay t!e images name in a te"t file passe to it...
% ------------------------------------------------------------% E"ecutes on being calle, it! inputs6% filename - t!e name of t!e te"t file t!at !as t!e% list of images% !eaer - t!e figure !eaer name% ------------------------------------------------------------
function isplayCesults(filename, !eaer)
figure(&osition&,@9
subplot(9,:,i)> subimage(", map)> "label(imagename)>
i = i P ;>en
fclose(fi)>%--------------------------------------------------------------