Borrar filtros
Borrar filtros

doubt in specific line

1 visualización (últimos 30 días)
Rd
Rd el 23 de Jul. de 2020
Comentada: Rd el 24 de Jul. de 2020
img_filt_up = img_filt(1:floor(img_h/2),:);
[~, y_up] = max(img_filt_up);
% Lower part of filtred image
img_filt_lo = img_filt(half_img_h:end,:);
[~,y_lo] = min(img_filt_lo);
Could you please explain the following line
region(y_up(i):y_lo(i)+size(img_filt_lo,1), i) = 1;

Respuesta aceptada

Arthur Roué
Arthur Roué el 23 de Jul. de 2020
The line is settings to 1 elements of matrix region from row y_up(i) to row y_lo(i)+size(img_filt_lo,1) in column i.
I suppose i is your index in a for loop, but it would be simpler to answer with a bit of context .
  3 comentarios
Arthur Roué
Arthur Roué el 23 de Jul. de 2020
The function size returns a row vector whose elements are the lengths of the corresponding dimensions.
For instance,
% m is a 2 x 3 matrix
m = [1, 1, 1;
2, 2 ,2]
size(m)
ans =
2 3
When calling size with a second argument, you get the number of element of the specific dimension
size(m,1)
>> 2
size(m,2)
>> 3
In Matlab, rows are dimension 1 and column dimension 2.
% Return the number element in 1st dimension (row) of img_filt_lo
size(img_filt_lo,1)
Rd
Rd el 24 de Jul. de 2020
i understood.Thank you for your brief explanation.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by