Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
two picture pixels
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I want to calculate the corresponding pixels of the two pictures. How can I do? This is my code. clear all; load watch
[m,n,c,f]=size(xw);
fd=zeros(1,324);
a=1; for i=1:325
fd(:,:,:,a)=mean(abs((xw(:,:,:,i+1))-(xw(:,:,:,i))));
a=a+1;
end
but have a error ??? Subscripted assignment dimension mismatch.
Error in ==> detectiontest at 12 fd(:,:,:,a)=mean(abs((xw(:,:,:,i+1))-(xw(:,:,:,i))));
0 comentarios
Respuestas (2)
Geoff
el 23 de Mayo de 2012
You are addressing fd(:,:,:,a) as a 4-dimensional array, but it is declared as a 1-dimensional array.
You need to make sure that the shape of the matrix you are assigning to on the left is the same as the shape of the matrix on the right. So you need to look at that call to mean and examine the dimensions of the result (using size). Most easily checked by doing this:
size( mean(abs(xw(:,:,:,1))) )
0 comentarios
Image Analyst
el 23 de Mayo de 2012
fd(:,:,:,a) is a 3D array, while the mean of a 3D array (which is what xw(:,:,:,i+1) is) is a 2D array. For example the mean of a 2D array returns the means of the columns so the mean is always one dimension less than what you took the mean of. So you're trying to assign a 2D array to a 3D array. You need to look up the definition of mean and figure out what you need to pass it to do whatever it is that you want to take the mean of.
0 comentarios
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!