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

 Respuesta aceptada

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)];

Más respuestas (0)

Categorías

Productos

Preguntada:

el 12 de Abr. de 2017

Comentada:

el 12 de Abr. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by