I have three RGB values,i want to know color of this RGB values,how can i do this
16 次查看(过去 30 天)
显示 更早的评论
Currently i am not able to make this code sorry.......But i just want to know the color of RGB values
My valyes are..
R = 239;
G = 189;
B = 87;
I want to know the Color of this RGB values please anyone can help me ...
My RGB values are continusly changed depend upon that color Image..
2 个评论
Jonas
2022-11-30
编辑:Jonas
2022-11-30
you "want to know the color"
you mean you want a description with text?, e.g. input [255,0,0], output 'red'?
you could define some reference points and describe the colors yourself. After that, you could choose the predefined color names based on the minimum distance to any given RGB value
you could use already existing table data for such a task if you dont want to do this yourself, see e.g. here
采纳的回答
Image Analyst
2022-11-30
You could make up an image with only those color values and show it
rows = 30;
columns = 40;
R = 239 * ones(rows, columns, 'uint8');
G = 189 * ones(rows, columns, 'uint8');
B = 87 * ones(rows, columns, 'uint8');
rgbImage = cat(3, R, G, B);
imshow(rgbImage);
5 个评论
Image Analyst
2022-12-1
@Shri.s see official documents:
and this one is really cool. They did a study of how different countries call the different colors:
And just for fun:
https://labs.tineye.com/multicolr/ TinEye Labs - Multicolr Search Lab
更多回答(1 个)
DGM
2022-12-1
编辑:DGM
2023-3-16
I have no idea what's going on here either, but I can guess.
If you want a color name, then you can use Stephen's colornames() tool. Of course, if you want a named color, you'll have to specify the context within which it's defined (i.e. the palette).
R = 239;
G = 189;
B = 87;
mytuple = [R G B]/255 % unit-scale double
palettes = colornames(); % a list of all available palettes
matchname = cell(numel(palettes),1);
swatchchart = zeros(numel(palettes),2,3);
for p = 1:numel(palettes)
[matchname(p) matchtuple] = colornames(palettes{p},mytuple);
swatchchart(p,1,:) = mytuple;
swatchchart(p,2,:) = matchtuple;
end
% the closest match within each palette
[palettes matchname]
ans =
30×2 cell array
{'Alphabet' } {'Orpiment' }
{'AmstradCPC' } {'15 Orange' }
{'AppleII' } {'13 Yellow' }
{'Bang' } {'79 Light Brilliant Gamboge'}
{'BS381C' } {'353 Deep Cream' }
{'CGA' } {'14 Yellow' }
{'Crayola' } {'Mango' }
{'CSS' } {'Goldenrod' }
{'dvips' } {'Dandelion' }
{'Foster' } {'Butterscotch' }
{'HTML4' } {'Yellow' }
{'ISCC' } {'67 Brilliant Orange Yellow'}
{'Kelly' } {'3 Yellow' }
{'MacBeth' } {'12 Orange Yellow' }
{'MATLAB' } {'Yellow' }
{'Natural' } {'Yellow' }
{'R' } {'Goldenrod2' }
{'RAL' } {'1012 Lemon Yellow' }
{'Resene' } {'Ronchi' }
{'Resistor' } {'-1 Gold' }
{'SherwinWilliams'} {'6676 Butterfield' }
{'SVG' } {'Goldenrod' }
{'Tableau' } {'9 Olive' }
{'Thesaurus' } {'Yellow: Mustard' }
{'Trubetskoy' } {'3 Yellow' }
{'Wikipedia' } {'Maximum Yellow Red' }
{'Wolfram' } {'Orange' }
{'X11' } {'Goldenrod2' }
{'xcolor' } {'Brown' }
{'xkcd' } {'Macaroni And Cheese' }
% compare the matches (left) to the original color (right)
imshow(swatchchart)
If you want to refine the results, you can.
% calculate the color distance between each
DE = imcolordiff(swatchchart(:,1,:),swatchchart(:,2,:));
% get rid of anything that has an excessive distance
goodmatches = DE<6; % pick some distance
palettes = palettes(goodmatches);
matchname = matchname(goodmatches);
swatchchart = swatchchart(repmat(goodmatches,[1 2 3]));
swatchchart = reshape(swatchchart,[],2,3);
% the closest match within each palette
[palettes matchname]
ans =
11×2 cell array
{'Bang' } {'79 Light Brilliant Gamboge'}
{'BS381C' } {'353 Deep Cream' }
{'Foster' } {'Butterscotch' }
{'ISCC' } {'67 Brilliant Orange Yellow'}
{'R' } {'Goldenrod2' }
{'Resene' } {'Ronchi' }
{'SherwinWilliams'} {'6676 Butterfield' }
{'Thesaurus' } {'Yellow: Mustard' }
{'Wikipedia' } {'Maximum Yellow Red' }
{'X11' } {'Goldenrod2' }
{'xkcd' } {'Macaroni And Cheese' }
% compare the matches (left) to the original color (right)
imshow(swatchchart)
Then again, you've asked both for the color of RGB values, and for RGB values of a color image. So I can't even know which is the known and which is the unknown.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!