Save image containing plotted lines

7 ビュー (過去 30 日間)
Johannes Hope Denstadli
Johannes Hope Denstadli 2020 年 3 月 19 日
コメント済み: Adam Danz 2020 年 3 月 19 日
I have not found a good method for plotting lines onto an image and save this image within the script. I use this script to plot the lines onto a black background, and the figure correctly shows the lines. The problem is when i save the image using the "saveas" function. The saved image does not contain the drawn lines. Does anyone know how to save the image containing the lines without doing so manually? Is there a method for exporting the image containing the lines directly to the workspace?
Fig = figure;
imshow(Z_black), hold on
for k = 1:length(lines)
% blah,blah,blah...
plot([xL, xR], [yL, yR], 'LineWidth',1,'Color','white');
end
saveas(Fig,'HoughLines.png')
  3 件のコメント
Johannes Hope Denstadli
Johannes Hope Denstadli 2020 年 3 月 19 日
Both saveas() and savefig() did not contain the plotted lines for some reason, but found that this worked.
F = getframe;
BW = imbinarize(F.cdata);
Adam Danz
Adam Danz 2020 年 3 月 19 日
It seems that you want to capture the data within the axes as opposed to the figure files. If you check out the documentation for saveas, you'll see that this saves the entire figure to file.

サインインしてコメントする。

回答 (1 件)

the cyclist
the cyclist 2020 年 3 月 19 日
I would expect
print('-dpng','-r600','HoughLines.png')
to work.
You could also try the export_fig utility from the File Exchange.

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by