{"id":285,"date":"2009-09-09T17:08:38","date_gmt":"2009-09-09T21:08:38","guid":{"rendered":"https:\/\/blogs.mathworks.com\/steve\/2009\/09\/09\/many-steps-needed-for-some-color-space-conversions\/"},"modified":"2019-10-28T16:57:44","modified_gmt":"2019-10-28T20:57:44","slug":"many-steps-needed-for-some-color-space-conversions","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/steve\/2009\/09\/09\/many-steps-needed-for-some-color-space-conversions\/","title":{"rendered":"Many steps needed for some color-space conversions"},"content":{"rendered":"<p>\r\nIt can take a lot of computational work sometimes to convert between color spaces. I was recently looking at the computational steps needed to convert between <a href=\"http:\/\/en.wikipedia.org\/wiki\/SRGB\">sRGB<\/a> and a particular CMYK space known as US Web-coated SWOP, often just called <a href=\"http:\/\/en.wikipedia.org\/wiki\/SWOP\">CMYK SWOP<\/a>.\r\n<\/p>\r\n\r\n<p>\r\nThe Image Processing Toolbox ships with <a href=\"http:\/\/en.wikipedia.org\/wiki\/ICC_profile\">ICC profiles<\/a> corresponding to each of these spaces. If you give these profiles to <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2009b\/toolbox\/images\/index.html?\/access\/helpdesk\/help\/releases\/R2009b\/toolbox\/images\/makecform.html\"><tt>makecform<\/tt><\/a> and <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2009b\/toolbox\/images\/index.html?\/access\/helpdesk\/help\/releases\/R2009b\/toolbox\/images\/applycform.html\"><tt>applycform<\/tt><\/a> in order to convert sRGB color values to CMYK SWOP values, <tt>applycform<\/tt> will perform the following steps:\r\n<\/p>\r\n\r\n<ol>\r\n<li>Linearize the sRGB values using the red, green, and blue tone reproduction curves.<\/li>\r\n<li>Convert linearized RGB values to the sRGB profile connection space (XYZ) by multiplying by a matrix based on the red, green, and blue colorant tags.<\/li>\r\n<li>Adjust the black point to compensate for the difference between the ICC <a href=\"http:\/\/www.color.org\/ICC_Minor_Revision_for_Web.pdf\">version 2<\/a> profile (sRGB) and the ICC <a href=\"http:\/\/www.color.org\/ICC1v42_2006-05.pdf\">version 4<\/a> profile (CMYK SWOP). (This adjustment is a scale and an offset.)<\/li>\r\n<li>Convert from the sRGB profile connection space (XYZ) to the CMYK SWOP profile connection space (Lab).<\/li>\r\n<li>Scale by (257\/256) to adjust ICC version 2 16-bit Lab encoding to ICC version 4 encoding.<\/li>\r\n<li>Apply one-dimensional pre-shaper curves.<\/li>\r\n<li>Apply pre-matrix.<\/li>\r\n<li>Apply one-dimensional input tables.<\/li>\r\n<li>Perform <a href=\"https:\/\/blogs.mathworks.com\/steve\/2006\/11\/24\/tetrahedral-interpolation-for-colorspace-conversion\/\">three-dimensional tetrahedral interpolation<\/a> using the multidimensional grid tables.<\/li>\r\n<li>Apply one-dimensional output tables.<\/li>\r\n<\/ol>\r\n\r\n<p>\r\nWhew! That's a lot to track.\r\n<\/p>\r\n\r\n<p>\r\n<em>Note added 29-Oct-2013:<\/em> Please visit the <a href=\"https:\/\/www.mathworks.com\/discovery\/color-profile.html\">discovery page on Color Profiles<\/a> for more information on color processing with MATLAB.\r\n<\/p>","protected":false},"excerpt":{"rendered":"<p>\r\nIt can take a lot of computational work sometimes to convert between color spaces. I was recently looking at the computational steps needed to convert between sRGB and a particular CMYK space known... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/steve\/2009\/09\/09\/many-steps-needed-for-some-color-space-conversions\/\">read more >><\/a><\/p>","protected":false},"author":42,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[114,112],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/285"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/comments?post=285"}],"version-history":[{"count":8,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/285\/revisions"}],"predecessor-version":[{"id":3653,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/285\/revisions\/3653"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/media?parent=285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/categories?post=285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/tags?post=285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}