How to save an image with plotted lines and annotations

11 views (last 30 days)
Hi, i am doing a batch processing task and for each image i will get a thresholded image with lines plotted ontop showing the initial point of spray and final point of spray and a value for the length of spray. However, i am needing to save all of this to one file like the image below. My matlab knowledge is depressingly basic. I was trying to use the imwrite function below as this will allow me to put all the processed images in the same folder, however, i do not know how to add the plotted lines and annotations to the thresholded image.Does anyone know how to do this? Thank you in advance!
% plot thresholded image
imagesc(BWpen);axis image; hold on;
% plot max penetration onto BWpen
plot(result(:,1),result(:,2),'r-.')
[And the line for nozzle exit]
% annotate with length of penetration
text(InjectorX-60,InjectorY-30,...
sprintf('%1.3f',meani)],'color','b','FontSize',14,'FontWeight','bold');
% attempt to write into folder
imwrite([BWpen], ['cropped\' filelist(k).name]);
  1 Comment
Jed
Jed on 19 Mar 2014
And sorry, secondly, how could i write the values of the maximum penetration for each image into a file so that i could later draw graphs from them? [where the value for maximum penetration is given by 'meani'.in the above code] Thank yoooouu!!

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 19 Mar 2014
export_fig() (the most downloaded MATLAB app of all time) is probably the most common way. See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_save_my_figure.2C_axes.2C_or_image.3F_I.27m_having_trouble_with_the_built_in_MATLAB_functions.
  14 Comments
Image Analyst
Image Analyst on 8 Apr 2014
I don't know. I've just used it for capturing screenshots of the entire figure, not of just one axes on the figure. I'd try to contact Oliver Woodford, who wrote export_fig. Worst case, read it in, crop it (hopefully it's the same size every time) and re-save it.

Sign in to comment.

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!