How to set default background for figures to be negative

1 回表示 (過去 30 日間)
xiaojuezi
xiaojuezi 2020 年 4 月 13 日
I'm currently using matlab's rasterization functionality. After I plot a curve, I saved the whole image to a matrix using
img = print(gcf,'-r72','-RGBImage');
I set the default background as:
set (gcf, 'color', [0.0,0.0,0.0])
set(gcf, 'InvertHardcopy', 'off')
This gives [0,0,0] for every pixel in img. As I would like to distinguish my curve and the rest of the pixels, I would like to set
img(y,x,:) = [-1,-1,-1]
for all [y,x] that doesn't belong to my curve. In addition, I might have multiple curves, it would be tedious to check every curve. The optimal would be pre-settting each position with a negative value and update the positions where the curves lie.
As my curve has a varying color, it is not possible to directly mark the curve. Would there be any way to set the background like this?
Thank you very much!

回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by