Info
この質問は閉じられています。 編集または回答するには再度開いてください。
to move a virtual window
1 回表示 (過去 30 日間)
古いコメントを表示
hai
i have a image i have to move a window of height 700 and width 30 over the image continuously from left to right i have used the following code by i can't get the answe
Actually i am having a 605X700 image and a window of size 30X700 first i have to go from 1-30 then 2-31 and 3-32 and 4-33 and so on and the code i have used is below
a=1;
b=30;
for i=1:700
for j=a:b
if(b<=700)
yvalue=sum(fmap1(i,j));
a=a+1;
b=b+1;
end
end
end
please help me thanks in advance
1 件のコメント
Jan
2011 年 9 月 23 日
What do you want to calculate? I assume "fmap1(i,j)" is a scalar value, so why do you apply a SUM?
回答 (2 件)
Walter Roberson
2011 年 9 月 23 日
Looks to me as if you should be using blockproc() or blkproc()
2 件のコメント
Walter Roberson
2011 年 9 月 26 日
Sounds like you failed to specify the overlap to blkproc()
Your code is overwriting "yvalue" each time through the loop, so at the end of the loops, yvalue will contain only the result for the very last iteration.
Jan
2011 年 9 月 26 日
I cannot find out, what you want to calculate. If you want a running mean, this methods solves the problem:
fmap1 = rand(605, 700);
b = 30;
yvalue = zeros(605 - b, 700);
for i = 1:605 - b
yvalue(i, :) = sum(fmap1(i:i + b - 1, :));
end
This is not efficient, because most of the rows are added repeatedly. But it is as near to your original code as possible. If you want something else, you have the chance to explain it here.
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!