doubt in specific line

2 ビュー (過去 30 日間)
Rd
Rd 2020 年 7 月 23 日
コメント済み: Rd 2020 年 7 月 24 日
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;

採用された回答

Arthur Roué
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é
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)
Rd
Rd 2020 年 7 月 24 日
i understood.Thank you for your brief explanation.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by