- What are the dimensions.
- What are the min and max of the data.
- Is the data double or some other type?
How to use colormap() for a vector of images X in order to display indexed images from vector X?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have made a Neural network for clothes color matching. It uses indexed images of clothes stored in a vector X. when I try to display these indexed images they appear to be pale instead of colored. I am using a custom function displayData for display. Although Neural network with indexed images is working correctly (with reasonable accuracy) but it displays to user only pale images in beginning and during testing. I came to know that somewhere I should use colormap() function. I called colormap() right after calling displayData but it does not work
fprintf('Loading cloth Data\n')
load('myclothingdata.mat');
m = size(X, 1);
[sel] = randperm(size(X, 1));
sel = sel(1:100);
displayData(X(sel, :));
% colormap()
fprintf('Press enter for next step.\n');
It calls the following displayData function
the output is as follows, showing indexed images of clothes
4 Commenti
Risposte (1)
Benjamin Kraus
il 4 Set 2018
The issue you are encountering is that displayData is normalizing the image data so that the maximum value of each image is equal to 1. It is then using imagesc to display the image using the full range of the colormap. Because your image is indexed and using a special map, the map is being lost by normalizing the data.
Unfortunately, I don't think you are going to be able to use displayData unmodified, it just isn't designed to handle indexed images.
However, you could try something potentially better. displayData is relying on -1 being a special value, which it is using to display gray lines. Because you are working with indexed colors, you can just add a gray/black color to the end of your map. Relatively small changes to displayData should allow you to get this working.
For example:
- Replace -1 (Setup blank display) with the last color in your map, max(X(:)+1.
- Remove the normalization using max_val.
- Replace the call to imagesc with just a regular call to image.
4 Commenti
Benjamin Kraus
il 6 Set 2018
"If you can't get it working and want more assistance ... make sure to update the post to describe what new things you have tried and what issue you are running into."
Vedere anche
Categorie
Scopri di più su Colormaps in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!