Info

この質問は閉じられています。 編集または回答するには再度開いてください。

how do i divide image into subblocks in 1:2:1 proportion like shown in the figure

2 ビュー (過去 30 日間)
teja jayavarapu
teja jayavarapu 2018 年 1 月 31 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
please help me with this

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 1 月 31 日
[r, c, p] = size(YourImage);
rq = floor(r/4); rh = floor(r/2); rq3 = r - rq - rh;
rparts = [rq rh rq3];
cq = floor(c/4); ch = floor(c/2); cq3 = c - cq - ch;
cparts = [cq ch cq3];
blocks = mat2cell(YourImage, rparts, cparts, p);
I do operations this way because of the possibility that the size is not exactly divisible by 4, and wanting to be sure that we do not get an off-by-one due to round-off.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by