Combine multiple images (imfuse)
    40 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    MechenG
 el 21 de Ag. de 2024
  
    
    
    
    
    Comentada: MechenG
 el 21 de Ag. de 2024
            Hi, I am trying to dispaly 3 images using the below command. My A, B, C are in the format of 656 x 875 x 3 unit 8. I think the error is because of unit 8 format. I tried imfuse() as well, although it works for two images, but not for three images.
A = imread('1.bmp');
B = imread('2.bmp');
C = imread('3.bmp');
overlay_im = cat(3, A, B, C);
imshow(overlay_im);
However, the above code throws below error
Error in imshow (line 253)
    images.internal.imageDisplayParseInputs({'Parent','Border','Reduce'},preparsed_varargin{:});
Error in image_comb (line 276)
imshow(overlay_im);
0 comentarios
Respuesta aceptada
  Jatin
 el 21 de Ag. de 2024
        
      Editada: Jatin
 el 21 de Ag. de 2024
  
      The issue encountered is due to how images are combined. The “cat” function is concatenating the images along the third dimension. Since the images are already in RGB, concatenating them is an incorrect format for display with “imshow”. 
About using “imfuse” function, the document clearly states that “imfuse” creates a composite image from two images. You can use the “imfuse” function from MATLAB as below for your task: 
A = imread('1.bmp'); 
B = imread('2.bmp'); 
C = imread('3.bmp'); 
%blend A,B as fusedAB and then with C as fusedABC
fusedAB = imfuse(A, B, 'blend'); 
fusedABC = imfuse(fusedAB, C, 'blend'); 
imshow(fusedABC); 
If you want to display your images side by side, try using "subplot" as below:
A = imread('1.bmp'); 
B = imread('2.bmp'); 
C = imread('3.bmp');
%creating new figure
figure;
subplot(1, 3, 1);
imshow(A);
subplot(1, 3, 2);
imshow(B);
subplot(1, 3, 3);
imshow(C);
You can also refer to the below MATLAB Answer and documentations for more details: 
Hope this helps!
0 comentarios
Más respuestas (1)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

