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.

 Respuesta aceptada

Image Analyst
Image Analyst el 28 de Abr. de 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 comentarios

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 el 28 de Abr. de 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 el 28 de Abr. de 2013
Editada: troy el 28 de Abr. de 2013
how to modify the for loop of i and j to get value odd number? thanks sir.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de Abr. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by