How would I vectorise this code
古いコメントを表示
tempSum = 0;
for m = topLeft(2) : topLeft(2) + widthhight(2) -8
for n = topLeft(1) : topLeft(1) + widthhight(1) -8
for x = 0 : 8
for y = 0 : 8
tempSum = tempSum + double(double(i(n+y,m+x)) * kernel(y+1,x+1));
end
end
result(n + 4,m + 4) = tempSum/81;
tempSum=0;
end
end
2 件のコメント
Walter Roberson
2020 年 3 月 6 日
conv2() some subset of i with kernel as being the thing to convolve with. Use the 'valid' option, I suspect.
Josh Webb
2020 年 3 月 6 日
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Parallel Computing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!