During vectorization matlab giving me error for this if condition which contains SHORT CIRCUITED OR conditions :- if I(m,n,2)<120||I(m,n,1)>155||I(m,n,3)>160

 採用された回答

James Tursa
James Tursa 2017 年 4 月 12 日

0 投票

Try this:
x = I(:,:,2)<120 | I(:,:,1)>155 | I(:,:,3)>160;
gsc = 0.2989*I(:,:,1) + 0.5870*I(:,:,2) + 0.1140*I(:,:,3);
I([x,x,x]) = [gsc(x),gsc(x),gsc(x)];

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で GPU Computing についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by