Created
March 11, 2020 14:11
-
-
Save mattgaidica/3ad4c3b7372c2df8777f2a35bfda476f to your computer and use it in GitHub Desktop.
Creates a color palette (i.e. colormap) by selecting points on an image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mypal = paletteMaker(paletteImPath) | |
% input: image path for your palette | |
% output: color palette as a colormap | |
im = imresize(imread(paletteImPath),0.5); | |
figure; | |
imshow(im); | |
[xs,ys,mypal] = impixel(); | |
for iColor = 1:size(mypal,1) | |
im = insertShape(im,'filledcircle',[xs(iColor) ys(iColor) size(im,1)/40],... | |
'color',mypal(iColor,:),'opacity',1); | |
im = insertShape(im,'circle',[xs(iColor) ys(iColor) size(im,1)/40],... | |
'color','black','lineWidth',10); | |
imshow(im); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment