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.
답변 (1개)
Guillaume
2017년 5월 4일
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
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!