Is there anyway to interactively change the color of a data point in an imagesc plot?

4 vues (au cours des 30 derniers jours)
Say I had an imagesc plot and wanted to change one of the values from black to white. Is there anyway to do that in the plot itself, or is there any way to maybe use a GUI to allow the user to do that?
Here is the code for reference
nRows = 20;
nCols = 50;
Matrix = zeros(nRows,nCols);
Rndm = randi([0 1],size(Matrix));
imagesc(Rndm)
colormap(gca, gray)
  4 commentaires
Walter Roberson
Walter Roberson le 25 Jan 2020
Well, you could do it with techniques such as first converting your image to rgb using mat2gray() followed by im2uint8() followed by ind2rgb() . After that, you could use ginput() or similar to designate points you wanted to change the color of, and some kind of interface indicating the color you wanted to change to, and store the results in a matrix .
Alex Weaver
Alex Weaver le 25 Jan 2020
I don’t have access to a computer at the moment but I will try that tomorrow, thank you!

Connectez-vous pour commenter.

Réponses (1)

Alex Weaver
Alex Weaver le 28 Jan 2020
That did the trick, thank you for the help!

Catégories

En savoir plus sur Color and Styling dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by