Skip to content

Instantly share code, notes, and snippets.

@mattgaidica
Created November 26, 2018 01:18
Show Gist options
  • Save mattgaidica/f9f3d88dd4ae7d0143b963f96c2e06c2 to your computer and use it in GitHub Desktop.
Save mattgaidica/f9f3d88dd4ae7d0143b963f96c2e06c2 to your computer and use it in GitHub Desktop.
function colors = mycmap(filename,varargin)
% read image
A = imread(filename);
% set number of elements to return
n = size(A,2);
if ~isempty(varargin)
n = varargin{1};
end
% create colors (cmap)
colors = double(squeeze(imresize(A,[1,n]))) ./ 255;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment