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 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Walter Roberson
2015-8-24
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Computer Vision with Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!