doubt in specific line
조회 수: 2 (최근 30일)
이전 댓글 표시
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;
댓글 수: 0
채택된 답변
Arthur Roué
2020년 7월 23일
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
Arthur Roué
2020년 7월 23일
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)
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!