How can I convert an image to a web-safe color map in MATLAB? -


I want to convert images to web-safe colors using MATLAB. Is there any predetermined work for this? If not, what should be my first step to start?

The correct approach is, but you are challenging to take all those values ​​of the web page and in those maps There are some options for you to create maps that you can use ...

An option is to use the function to actually get the source for the page and using the function will give you the necessary numbers To parse ("Did they just suggest" Yes, I did. What can I say? I am alone, Doti, a rebel.):

  mapURL = 'http://en.wikipedia.org/wiki/Web_colors # Web safe_colors'; UrlText = urlread (mapURL); MatchExpr = ['& lt; Td style = "background: # \ w {3};" & Gt; ' ... '(?: & Lt; u & gt; \ *)? (\ W {3}) (?: \ * & Lt; / u & gt;)? & Lt; / Td> ']; ColorID = regexp (urltext, matchExpr, 'token'); ColorID = four ([colorID {:}]); [~, Web map map] = September (color ID, '036 9 cf'); WebSafeMap = (webSafeMap-1) ./5;   

However, after the above I realized that as a result there is a good regular structure for web safe color map values. This means that you can actually ignore all of the above mentioned mistakes and make yourself a map using your work. % 'WebSafeMap = [repmat (color value, 36,1) ... krone (color value, is (36,1)) ... repat (coron (color origin, grind (6,1)), 6,1) ];

And then you can easily remember again, say, actions using a RGB image and For example:

  imageRGB = imread ('peppers.png'); % # Load an implicit image image rgb = ind2rgb (rgb2ind (imageRGB, webSafeMap), webSafeMap); Imshow (imageRGB);   

a web-safe version of peppers.png

Comments