Using blockproc to simply copy an array

2 ビュー (過去 30 日間)
Saud Alfalasi
Saud Alfalasi 2020 年 11 月 21 日
コメント済み: Saud Alfalasi 2020 年 11 月 22 日
Hi can I use blockproc to copy 3 arrays
and them merge them
redChannel = I(:, :, 1);
greenChannel = I(:, :, 2);
blueChannel = I(:, :, 3);
%% output functions
funr = redChannel + greenChannel + blueChannel;
fung = S(:,:,2);
funb = S(:,:,3);
blockSize = [64 64];
@(block_struct) (block_struct.data) * ones(size(block_struct.data));
%% blocks
blockyImageR = blockproc(I, blockSize, funr)
blockyImageR = blockproc(redChannel, blockSize, fung)
The above trials are not working.
output should be blocks of 64x64x3

回答 (1 件)

Matt J
Matt J 2020 年 11 月 22 日
Using sepblockfun from the file exchange,
blockSize = [64 64];
R=sepblockfun(I,[blockSize,3],'sum');
R=repelem(R,blockSize);
I(:,:,1)=R;
  1 件のコメント
Saud Alfalasi
Saud Alfalasi 2020 年 11 月 22 日
Hi Matt, thank you I will give this a try.
I would also like to try and pinpoint the minddle value of my block (coordinates 2,2) and do a quoteince differnce betwen it and the surrounding values. - is this possible?
Ideally what I want to do is not only change values in blocks but also manage the sequence of movement from block to block - example follwing some kind of sequence which results in going from block1 > block 7 > block 27
Will the sepblockfun allow this?
I'm trying to manipulate each element in each block with a set of conditons - ('if's, 'else's, 'for's - is this doable?

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

Community Treasure Hunt

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

Start Hunting!

Translated by