Imfuse two images together from different sizes

13 vues (au cours des 30 derniers jours)
Marina Ghobrial
Marina Ghobrial le 17 Mai 2021
Réponse apportée : DGM le 17 Mai 2021
I want to imfuse two images with one another that are two different matrixes.
A and moving are the images on top of one another. The first image (moving) is much smaller so I tried resizing it by utilizing the resize command. Can you please help
hold on;
C = imfuse(A, originalfalsecolor','Scaling','joint','ColorChannels',[1 2 0]);
C = imresize(C, 0.75);
imshow(C)
J = imresize(moving, [616 220]);
imshow (J)
%M = imresize( A,[size(moving,1) size(moving,2)]);
[D,RD] =imfuse(A, moving,'ColorChannels',[1 2 0]);
D = imresize(D, 0.75);
imshow(D)
  1 commentaire
Marina Ghobrial
Marina Ghobrial le 17 Mai 2021
the resize did not work by the way

Connectez-vous pour commenter.

Réponses (1)

DGM
DGM le 17 Mai 2021
If the images are different sizes, you need to at least know where to put one image with relation to the other -- i.e. an offset. imfuse uses registration objects, but you don't seem to be using any of the functionality of imfuse anyway. Why not just do it the simple way?
A = imread('peppers.png'); % bigger picture
B = imread('lsbwm.bmp'); % smaller picture
sb = size(B);
offset = [100 100]; % specify where the picture goes
chantoswap = [1 2 3]; % specify which channels to swap
% just directly put the image content there
% if you want to extend beyond the edges of the parent image, then you'll
% need to deal with that. (e.g. pad A, place B, crop result)
outpict = A;
outpict(offset(1)+(1:sb(1)),offset(2)+(1:sb(2)),chantoswap) = B(:,:,chantoswap);
imshow(outpict)
I'm sure someone else can come up with a solution using imfuse, but I never use it.

Community Treasure Hunt

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

Start Hunting!

Translated by