How to vectorize this code to eliminate nested For loops?
古いコメントを表示
Would like to know how this code is vectorized:
for r=1:rows
for c=1:cols
if ((Lin <= Limg(r,c)) && (Limg(r,c) <= Hin))
enhanceImg(r,c) = Lout + (Hout - Lout) * ((Limg(r,c) - Lin) / (Hin - Lin))^gamma;
elseif (Limg(r,c) > Lin)
enhanceImg(r,c) = Hout;
else
enhanceImg(r,c) = Lout;
end
end
end
Lin, Hin, Lout, Hout, gamma are scalar values.
1 件のコメント
Greg
2018 年 9 月 6 日
+1 for a very well formed question. Clear and concise, showed an attempt, and described relevant variable sizes.
That all makes it much easier to answer.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Sparse State-Space Models についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!