How to add two binay images and add the result to a third image?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Meshooo
el 18 de Ag. de 2014
Comentada: Image Analyst
el 19 de Ag. de 2014
Dear all,
I have one array that includes 5 binary images [I1, I2, I3, I4, I5].
I want to have a new array [R1, R2, R3, R4] where:
R1 = I1 + I2
R2 = R1 + I3
R3 = R2 + I4
R4 = R3 + I5
How to make a for loop for that?
Any help will be very appreciated.
Thank you very much.
Meshoo
0 comentarios
Respuesta aceptada
Image Analyst
el 18 de Ag. de 2014
Try this:
R1 = int32(I1) + int32(I2);
R2 = R1 + int32(I3);
R3 = R2 + int32(I4);
R4 = R3 + int32(I5);
output_R = [R1, R2, R3, R4];
imshow(output_R, []); % The [] are important.
8 comentarios
Image Analyst
el 19 de Ag. de 2014
Not a good idea. Remember you said "Sometimes I have 100, 120, etc." So now I refer you to the FAQ about why this is a bad idea: http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F
Más respuestas (1)
Ahmet Cecen
el 18 de Ag. de 2014
Here is how to make a loop for that:
R(:,1)=I(:,1)+I(:,2); %Initialization
for i=2:4
R(:,i)=R(:,i-1)+I(:,i+1); %This is the loop that you asked for.
end
5 comentarios
Image Analyst
el 18 de Ag. de 2014
Yes. Did you read our comments about what information is required?
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!