Errors using distance metric in MATLAB -


my test feature vector 'testpg' , trained feature vector 'trainpg' , both of dimension 2000*1 .i aiming find distance between 2 histogram feature vectors , hence do

distance =  norm(trainpg-testpg) 

next compare scalar threshold value check whether satisfies condition , above code works scalar value of distance ie : eg distance = 5.4 scalar

but when change code use other histogram based distance metric doesn't work

i used pdist2 function http://www.mathworks.com/matlabcentral/fileexchange/29004-feature-points-in-image--keypoint-extraction/content/fps_in_image/fps%20in%20image/help%20functions/searchingmatches/pdist2.m

the new code used is

distance = pdist2(trainpg,testpg, 'chisq') d = size(distance)

here getting subscripted assignment dimension mismatch error dimensions of distance 2000*2000 instead of 1*1

how scalar value distances?

if dimensions 2000 x 1 both of feature vectors, should do:

distance = pdist2(trainpg.',testpg.', 'chisq'); 

pdist2 considers each row different sample. need take transpose, telling matlab 2000-d feature of single example rather 1-d feature 2000 examples. side note, may want check histogram intersection distance, if feature histogram. here code.


Comments

Popular posts from this blog

how to do line continuation in perl debugger for entering raw multi-line text (EOT)? -

javascript - Create websocket without connecting -

android - Linear layout children not scrolling -