How to loop on a data cube of an image
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I'm trying to calculate gradient at each pixel in a data cube of an image an i'm getting this error "index out of bounds because size(X)=[280,307,191]."
Any help would be much appreciated Thank you
2 commentaires
Réponse acceptée
Image Analyst
le 7 Avr 2013
Somewhere in your code where you're indexing x, y, and z, the value(s) of at least one of those indexes is greater than 280, 307, and 191, respectively.
2 commentaires
Image Analyst
le 8 Avr 2013
Modifié(e) : Image Analyst
le 8 Avr 2013
You will be using the debugger. Go here if you don't know how yet: http://blogs.mathworks.com/videos/2012/07/03/debugging-in-matlab/
Plus de réponses (2)
Walter Roberson
le 8 Avr 2013
You establish x, y, and bands according to the content of the noisy image, but then your triple nested for loop has you looping using those values as indices, such as in
for i = 1:1: x
Question: in your line
current_grad(i,j,k) = gradient(i,j,k);
is "gradient" the gradient function? If so then why are you applying the function to the indices i, j, k, rather than to the content of the image? And does it make sense to be applying the gradient function only to a point at a time?
8 commentaires
Walter Roberson
le 8 Avr 2013
Which MATLAB version are you using? And are you using the Student license?
Image Analyst
le 8 Avr 2013
I cannot help you do the upgrade. You'll have to contact the Mathworks to do that.
Rawan hamdi
le 8 Avr 2013
Modifié(e) : Walter Roberson
le 8 Avr 2013
2 commentaires
Walter Roberson
le 8 Avr 2013
You establish x, and y according to the content of the noisy image, but then your triple nested for loop has you looping using those values as indices.
Also, you are overwriting G in each iteration of the triple-nested loop.
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!