Vectorize getting the intensity values from greyscale image
Mostrar comentarios más antiguos
Hi, im trying to vectorize this piece of code to increase calculation speed, y1, y2, y3 is 1288x1 arrays with different y-indexpoints in a image matrix:
for xNr = 1:1288
intensity1(xNr) = image(y1(xNr), xNr); % Find intensity.
intensity2(xNr) = image(y2(xNr), xNr); % Find intensity.
intensity3(xNr) = image(y3(xNr), xNr); % Find intensity.
end
Then I get 3 arrays with dimension 1288x1 with intensity values.
And when I try to vectorize:
xNr = (1:1288);
intensity1 = image(y1, xNr); % Find intensity.
intensity2 = image(y2, xNr); % Find intensity.
intensity3 = image(y3, xNr); % Find intensity.
I get 3 arrays with dimension 1288x1288 which is wrong.
Can this be vectorized so I get the same result as in the for-loop?
Thanks in advance
2 comentarios
KALYAN ACHARJYA
el 26 de Jun. de 2019
Editada: KALYAN ACHARJYA
el 26 de Jun. de 2019
Please clarify y1, y2 ?? or share the complete code
Aon
el 26 de Jun. de 2019
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!