Filter löschen
Filter löschen

regarding masking the image

1 Ansicht (letzte 30 Tage)
Rd
Rd am 21 Jul. 2020
Verschoben: DGM am 5 Mai 2023
kindly expalin the following line
mask_h and mask_w are the scalar inputs
mask = zeros(mask_h,mask_w);
mask(1:mask_h/2,:) = -1;
mask(mask_h/2 + 1:end,:) = 1;

Akzeptierte Antwort

waqas
waqas am 21 Jul. 2020
Verschoben: DGM am 5 Mai 2023
First line is defining a zero matrix With mask_h rows and mask_w columns.
In the second line, all the entries in first half of the rows are being assigned a value of -1.
For third line, rest of the rows, i.e., all the entries from half of the rows till the end are assigned a value of 1.
You are using Matlab indexing to assign values of 1 or -1 to the entries based on their location in the matrix.
  2 Kommentare
Rd
Rd am 21 Jul. 2020
Verschoben: DGM am 5 Mai 2023
Thanks a lot.
waqas
waqas am 21 Jul. 2020
Verschoben: DGM am 5 Mai 2023
My pleasure. If your query is resolved then I would suggest to accept the answer.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by