Error en bucle
Hola. Tengo un problema en este bucle que no se encontrar. Hago la L2-norm para hallar la diferencia entre una imagen que contiene la media de todas las imágenes de un vÃdeo con cada una de las imágenes. Cuanto le hago un plot obtengo, por ejemplo para 10 imágenes, 9 puntos con el mismo valor y el 10 con un valor muy grande. Si lo hago para 50, 49 con el mismo valor y el ultimo con un valor muy grande.
distance = zeros(num_images,1);
res = 0;
for h=1:num_images
for j=1:240
for l=1:320
aux1 = images(h,j,l); % Every pixel of every image of the set
aux2 = result (j,l); %Avg image of all the set
aux3 = (aux1 - aux2)^2; % Compare the pixel
res = res + real(aux3); %Sum to get the difference with the avg image.
end
end
distance(h) = sqrt(res);
res=0;
end
figure();
plot(1:1:num_images,distance)
Y aquà el plot:
http://img156.imageshack.us/my.php?image=97439697vp4.jpg
Gracias. un saludo
distance = zeros(num_images,1);
res = 0;
for h=1:num_images
for j=1:240
for l=1:320
aux1 = images(h,j,l); % Every pixel of every image of the set
aux2 = result (j,l); %Avg image of all the set
aux3 = (aux1 - aux2)^2; % Compare the pixel
res = res + real(aux3); %Sum to get the difference with the avg image.
end
end
distance(h) = sqrt(res);
res=0;
end
figure();
plot(1:1:num_images,distance)
Y aquà el plot:
http://img156.imageshack.us/my.php?image=97439697vp4.jpg
Gracias. un saludo