How to set default background for figures to be negative

1 view (last 30 days)
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!

Answers (0)

Categories

Find more on Graphics Object Identification 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!

Translated by