How to VECTORIZE this code and then convert it into a GPU code ?

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

 采纳的回答

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