Hi sir, please find the attached code,and correct it,i need to find likelihood ratio for 'n 4x4 block', in 'n frames'.i dontno to explain clearly,if u see the code u can able to understand what i want.please look after it
1 view (last 30 days)
Show older comments
for p=1:num of frames
i1 = cc(1:96,1:96);
i2 = cc(1:96,97:192);
i3 = cc(97:192,1:96);
i4 = cc(97:192,97:192);
y = {i1, i2, i3, i4};
for i=1:length(y)
ui = edge(y{i},'canny');
count(i) = length(find(ui(:)==1));
end
[~, o] = max(count);
% finding likelihood ratio
for o=1:length(o)
lr=(((var(mean(o))+var(mean(o+1))/2)+((mean(mean(o))-mean(mean(o+1))/2)^2)^2)/(var(mean(o))*var(mean(o+1)));
end
end
0 Comments
Answers (1)
Walter Roberson
on 24 Aug 2015
You have no 4 x 4 blocks.
That code will count the number of canny == 1 results in each y, so count will be a vector the same length as the cell array y. [~, o] = max(count); will then find the index in count where the value is largest. o is going to be a scalar. Then for o=1:length(o) is going to be for o=1:1 (because length() of a scalar is 1) so inside the "for" loop, the "o" you calculated is going to be overwritten with the value 1.
Your "lr" formula does not look correct to me.
7 Comments
See Also
Categories
Find more on Computer Vision with Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!