How to put together multiple number of images with graphs on top of them in a single vertical montage?
    28 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
the images need to be read.
It's a line plot.
the line separates two regions in the image.
like the image below there are multiple number of images with various length of the orange part.
I need to plot the black line on top of the image and display all the images together one after another.

5 commentaires
  Rohit Kulkarni
      
 le 5 Juil 2022
				@DARSHAN KUMAR BISWAS do you want to do something similar to this https://in.mathworks.com/help/matlab/creating_plots/combine-multiple-plots.html ?
  Adam Danz
    
      
 le 5 Juil 2022
				I suggest editing your question to make the goal clearer.  It will increase your chances of getting help and will decrease the amount of time spent by volunteers looking into the wrong problem. 
Réponses (1)
  Leepakshi
 le 28 Fév 2025
        Hi Darshan,
I was unable to understand from your question but seems that you want to overlay line plots on multiple images and display all the images in a vertical sequence.  
Seems like same question has been asked by you in https://in.mathworks.com/matlabcentral/answers/1753355-how-to-plot-multiple-graph-on-top-of-images-together?s_tid=answers_rc1-3_p3_Topic  
The below workaround might resolve your issue:
1. Loop through each image file in imageFiles. 
2. Read the image using imread. 
3. Create a new figure with imshow to display the image. 
4. Use plot to overlay a line on the image. The line is defined by its x and y coordinates. In this example, the line is horizontal and centered vertically on the image. 
5. Capture the current figure (image with the line plot) using getframe and store it in montageImages. 
% Assume images are stored in a cell array 
imageFiles = {'image1.png', 'image2.png', 'image3.png'}; % Add your image filenames 
numImages = numel(imageFiles); 
montageImages = cell(1, numImages); % To store images with plots 
for i = 1:numImages 
    % Read the image 
    img = imread(imageFiles{i}); 
    % Create a figure and plot the image 
    figure('Visible', 'off'); % Create an invisible figure 
    imshow(img); hold on; 
    % Define the line plot (example line) 
    x = [10, size(img, 2) - 10]; % Example x-coordinates 
    y = [size(img, 1)/2, size(img, 1)/2]; % Example y-coordinates 
    plot(x, y, 'k-', 'LineWidth', 2); % Plot a black line 
    % Capture the plot as an image 
    frame = getframe(gca); 
    montageImages{i} = frame.cdata; % Store the image with plot 
    close; % Close the figure 
end 
% Display all images in a vertical montage 
montage(montageImages, 'Size', [numImages, 1]);
0 commentaires
Voir également
Catégories
				En savoir plus sur Modify Image Colors dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



