image help
이전 댓글 표시
What is the meaning of the following code and why it is running in infinite loop??
image=imread('pp.jpg'); [rows,cols]=size(image); pixels=[];
for i=1:rows
for j=1:cols
pixels=[pixels;image(i,j)];
end
end
채택된 답변
추가 답변 (1개)
Jakob Sørensen
2012년 3월 20일
0 개 추천
It shouldn't be infinite, but very possibly it will take a long time to run it. It seems to plot the image in a very weird and time consuming way, over and over again. I can't think of any reason to use that kind of code, but maybe someone else can. What is it you want to do?
댓글 수: 3
Andreas Goser
2012년 3월 20일
In addition. Please verfiy by displaying i or j within the loop if it increments as it should to find out "infinite vs.long time".
Jakob Sørensen
2012년 3월 20일
Also just noted another thing, which explain why it seemed so confusing. "image" is the name of a function Matlab used to plot images (see "help image"), so using it as a variable name, why not disastrous, isn't very smart.
pdp rpa
2012년 3월 22일
카테고리
도움말 센터 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!