How to save an image with plotted lines and annotations

16 次查看(过去 30 天)
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 个评论
Jed
Jed 2014-3-19
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!!

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2014-3-19
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 个评论
Image Analyst
Image Analyst 2014-4-8
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by