sum up pixels by using simple continued fraction

When i read an image, there are pixels show in workspace. I need to sum up the first row of pixels by using simple continued fraction. I wish to add those pixels by looping, but i don't know how to assign the position of pixels into loop.
For example, this is the pixels for the first row of image:
[255;255;255;241;220;211;211;221;244;255;255;255]
Now I find the simple continued fraction by using this method:
A = Z(1)+1/(Z(2)+1/(Z(3)+1/(Z(4)+1/(Z(5)+1/(Z(6)+1/(Z(7)+1/(Z(8)+1/(Z(9)+1/(Z(10)+1/(Z(11)+1/Z(12)))))))))));
Can simple continued fraction perform by using looping? Thank you.

Respuestas (1)

Guillaume
Guillaume el 4 de Mayo de 2017
Your question is confusing since you're talking about rows yet you show a column vector in your example.
To compute the continuous fraction of all the rows at once:
A = Inf;
for column = fliplr(double(Z)) %conversion to double just in case Z is uint8
A = 1./A + column;
end

Categorías

Más información sobre Images en Centro de ayuda y File Exchange.

Preguntada:

el 4 de Mayo de 2017

Editada:

el 4 de Mayo de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by