フィルターのクリア

How do I fuse together 4 images (of the same dimensions) together in a checkerboard-like fashion?

2 ビュー (過去 30 日間)
I am aware of the imfuse 'checkerboard' arguement, but imfuse can only take 2 images to checkerboard. I want to make something very similar but instead alternate rectangles by 4 images instead of 2. Is there an easy way to do this?

採用された回答

DGM
DGM 2021 年 8 月 23 日
編集済み: DGM 2021 年 8 月 23 日
Consider the example:
% generate test images
% this part uses MIMT from FEX, but it's otherwise not needed
inpict = imread('cameraman.tif'); % raw single-channel source
A = uint8(repmat(double(inpict),[1 1 3]).*permute([1 0.3 0.8],[1 3 2]));
B = imtweak(A,'lchab',[1 1 0.25]);
C = imtweak(A,'lchab',[1 1 0.50]);
D = imtweak(A,'lchab',[1 1 0.75]);
% make mask
sout = size(inpict);
squaresize = [32 32];
xx = mod(0:(sout(2)-1),squaresize(2)*2)<squaresize(2);
yy = mod(0:(sout(1)-1),squaresize(1)*2)<squaresize(1);
m = uint8(xx & yy');
% combine images
outpict = A.*m + B.*circshift(m,squaresize.*[1 0]) ...
+ C.*circshift(m,squaresize.*[0 1]) ...
+ D.*circshift(m,squaresize.*[1 1]);
  1 件のコメント
Mia Grahn
Mia Grahn 2021 年 8 月 23 日
Thanks so much for your help! I ended up utilizing your second method, and it worked very well, thank you!

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

その他の回答 (0 件)

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by