I don't understand about this row and column??

who know about this code? if N=8 and L=512
for i= N:N:L-N
for j = 1:L
and this one
for i= 1:L
for j= N:N:L-N
what is the different? thanx for any advance.

 Réponse acceptée

Image Analyst
Image Analyst le 28 Avr 2013
Well the first one starts at row (or column) 8 while the second one starts at 1. There are some other differences but you can just print them out to see:
N=8
L=512
i= N:N:L-N
j = 1:L
i= 1:L
j= N:N:L-N
Then look in the command window to see what they are.

4 commentaires

ok i actually want value for pixel image by divide 8x8 and then want to find threshold. then i use this code
I2 = imread('......');
I2 = rgb2gray (I2);
N=8; %N= window size (8x8)
[L,L]=size(I2);
L2=L/N;
S=zeros(L,L);
for i=1:L2
for j=1:L2
S=I2((i-1)*N+1:i*N,(j-1)*N+1:j*N);
S= sum((I2(i,j)-I2(i,j+1))+(I2(i+2,j)-I2(i+2,j+1))+(I2(i+4,j)-I2(i+4,j+1)));
end;
end;
then, why the ans in the workspace only show value 82? why not the answer is in 64x64? i mean, like row 2 and column 2 have value, row 3 and column 3 have value until 64. the workspace only show for row 1 and column 1 only. i hope u understand what i mean.
troy
troy le 28 Avr 2013
u mean for the second it star form 1 then do loop until 512?
S is the rectangular sub-image at that location. So to get the sum at each location, you'd do
theSum(i, j) = sum(S(:));
Not sure how you want to find the threshold though.
troy
troy le 28 Avr 2013
Modifié(e) : troy le 28 Avr 2013
how to modify the for loop of i and j to get value odd number? thanks sir.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by