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
이전 댓글 표시
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
답변 (1개)
Walter Roberson
2015년 8월 24일
0 개 추천
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
kaavya subramani
2015년 8월 24일
편집: Walter Roberson
2015년 8월 24일
kaavya subramani
2015년 8월 24일
Walter Roberson
2015년 8월 24일
for p = 1 : num_of_frames
cc = frames(:,:,p); %fetch frame #p somehow
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
[maxcount(p), maxquarter(p)] = max(count);
end
now you have the maximum counts for each frame in maxcount and the index of the quarter in maxquarter, with each of them being vectors with one element per frame.
I could not tell from your description what you need to do with the information about which quarter the maximum count was in.
I do not know how to calculate the likelihood ratios that you are asking for.
kaavya subramani
2015년 8월 25일
편집: Walter Roberson
2015년 8월 25일
Walter Roberson
2015년 8월 25일
mean of what ?
sigma usually represents standard deviation, not variance. But either way, variance of what ?
kaavya subramani
2015년 8월 25일
kaavya subramani
2015년 8월 25일
카테고리
도움말 센터 및 File Exchange에서 Video Formats and Interfaces에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!