Loop in a array
이전 댓글 표시
Hi,
I have a question. I have an image with three bands. How can I apply a loop for do an operation to all the pixels?
image1=imread('image_1.tif'); %I've load the image. Has a length of 4x4x3
band1a= image_1(:,:,1);
band2a= image_1( :,:,2);
band3b= image_1(:,:,3);
for i = 1:numel(band1b)
(...) this is the part of the operation
output= ?
Thanks a lot in advance,
댓글 수: 5
Sabarinathan Vadivelu
2012년 11월 26일
Which operation u have to perform on all the pixels?
Emmanuelle
2012년 11월 26일
Jan
2012년 11월 26일
Please post a running piece of code. In the original question, "band1b" is not defined and we cannot guess its value. In the comment "l1, l2, t2, interplan, b1abc" is not defined.
Usually interpolations can be performed for a full vector or even a matrix directly without a loop.
Emmanuelle
2012년 11월 26일
편집: Emmanuelle
2012년 11월 27일
Emmanuelle
2012년 11월 27일
답변 (1개)
Image Analyst
2012년 11월 26일
0 개 추천
What is image_1? All you have shown up until that point is image1, which is a different variable.
댓글 수: 3
Emmanuelle
2012년 11월 27일
Image Analyst
2012년 11월 27일
Regarding "I know it could be something confusing but what I want is to get this last three values (spout1_c, spout2_c and spout3_c) for every pixel, in every band." How about this:
image1(:, :, 1) = spout1_a;
image1(:, :, 2) = spout1_b;
image1(:, :, 3) = spout1_c;
Emmanuelle
2012년 11월 27일
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!