MATLAB: Doubt in specific line

specific line

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;

Best Answer

  • 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 .