calculating euclidean distance

I have a dataset of images(175images),i have found the mean of that and have saved,next i have query image from dataset,now i want to calculate euclidean distance and want to retrieve that image,
i did
for n=1:175; Distance=EuD( Features{1,n},FeaturesQuery); D{n}=Distance;
end
i get error as
Cell contents assignment to a non-cell array object.
Error in ==> MAIN at 116 D{n}=Distance; please help
Features=<1x175 cell>
FeaturesQuery=104.8872
please help

답변 (2개)

Tom Lane
Tom Lane 2012년 2월 17일

1 개 추천

It is likely that you have assigned D to some value, perhaps a plain numeric value, earlier in the function. So it is not a cell array, and you can't assign into it using cell array notation. Just before you start the loop in which you want to assign into cells of D, try inserting either of the following lines:
clear D
D = cell(1,175);
Image Analyst
Image Analyst 2012년 2월 17일

0 개 추천

I just did this:
for n=1:175
Distance=10; %EuD( Features{1,n},FeaturesQuery);
D{n}=Distance;
end
and it ran fine. I didn't even preallocate D to be a cell array of length 175. No errors or warnings whatsoever. Now, we don't know what EuD returns but I thought you could toss anything you wanted into a cell so I'm not sure why the "D{n}=Distance" line would complain, regardless of what class type Distance was. Let me ask you, what class type and/or value does Distance have?

댓글 수: 7

FIR
FIR 2012년 2월 17일
it has double values,I am performing image retrieval using CLD,
I have found distance now,and have sorted,my first value is zero ,from this how i can retrieve the image,if i taake another image,there will be no zero value ,in this case i want to display no image found,please help
FIR
FIR 2012년 2월 17일
it has double values,I am performing image retrieval using CLD,
I have found distance now,and have sorted,my first value is zero ,from this how i can retrieve the image,if i taake another image,there will be no zero value ,in this case i want to display no image found,please help
Image Analyst
Image Analyst 2012년 2월 17일
I assigned a double (10) and had no problem. Can you run my code?
FIR
FIR 2012년 2월 17일
I ran i get same error
Cell contents assignment to a non-cell array object.
i am using r2010a
Image Analyst
Image Analyst 2012년 2월 17일
I don't think you did run my code, or you would not have gotten the error. I think Tom Lane has hit the nail on the head. Just change 75 to 175 in his code and try it.
FIR
FIR 2012년 2월 18일
Yesterday ur code did not work,but now its working,may be i have not used clear D ,i have extracted features of 40 images and stored,and gave a taken query image ,and have extracted same features,now i want to compare those and if it is from same dataset ,the retrieved image and query image must be displaed,if it not from same dataset ,"Image not found "
NAVEEN KUMAR
NAVEEN KUMAR 2017년 4월 27일
Sir i need a solution to the above query please help me out

댓글을 달려면 로그인하십시오.

태그

질문:

FIR
2012년 2월 17일

댓글:

2017년 4월 27일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by