{"id":3446,"date":"2019-10-14T17:59:17","date_gmt":"2019-10-14T21:59:17","guid":{"rendered":"https:\/\/blogs.mathworks.com\/steve\/?p=3446"},"modified":"2019-10-14T17:59:17","modified_gmt":"2019-10-14T21:59:17","slug":"using-the-color-threshold-app-again","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/steve\/2019\/10\/14\/using-the-color-threshold-app-again\/","title":{"rendered":"Using the Color Threshold app again"},"content":{"rendered":"<div class=\"content\"><p>Back in the summer I had another chance to use the Color Thresholder, a very nice app that's in the Image Processing Toolbox. I happened to come across a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/answers\/470711-any-way-to-polish-improve-the-output-produced-by-the-lab-colour-space-segmentation\">question on MATLAB Answers<\/a> - someone was looking for a way to segment the yellow region in this image:<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/www.mathworks.com\/matlabcentral\/answers\/uploaded_files\/227979\/b4.jpeg\" alt=\"\"> <\/p><p>I proposed using the Color Thresholder and the L*a*b* color space, and I showed this screen shot to demonstrate how to apply it to this problem:<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/steve\/files\/Screen-Shot-2019-07-08-at-1.26.10-PM.png\" alt=\"\"> <\/p><p>I first wrote about the Color Thresholder back in 2014, shortly after the app first appeared (<a href=\"https:\/\/blogs.mathworks.com\/steve\/2014\/04\/25\/color-thresholder-app-in-r2014a\">\"Color Thresholder App in R2014a\"<\/a>). In that post, I played around with picture of candy lying on my desk:<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/2010\/mms.jpg\" alt=\"\"> <\/p><p>Besides figuring out how to segment all the different candy colors, I also discovered how to characterize the color of my desk:<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/steve\/files\/color-thresholder-desk.jpg\" alt=\"\"> <\/p><p>The Color Thresholder is a very useful tool. Give it a look!<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_c2ad3d5c38e449008ed14a1383f70212() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='c2ad3d5c38e449008ed14a1383f70212 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' c2ad3d5c38e449008ed14a1383f70212';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2019 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_c2ad3d5c38e449008ed14a1383f70212()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2019b<br><\/p><\/div><!--\r\nc2ad3d5c38e449008ed14a1383f70212 ##### SOURCE BEGIN #####\r\n%%\r\n% Back in the summer I had another chance to use the Color Thresholder,\r\n% a very nice app that's in the Image Processing Toolbox. I happened to\r\n% come across a\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/answers\/470711-any-way-to-polish-improve-the-output-produced-by-the-lab-colour-space-segmentation\r\n% question on MATLAB Answers> - someone was looking for a way to segment\r\n% the yellow region in this image:\r\n%\r\n% <<https:\/\/www.mathworks.com\/matlabcentral\/answers\/uploaded_files\/227979\/b4.jpeg>>\r\n%\r\n% I proposed using the Color Thresholder and the L*a*b* color space,\r\n% and I showed this screen shot to demonstrate how to apply it to this\r\n% problem:\r\n%\r\n% <<https:\/\/blogs.mathworks.com\/steve\/files\/Screen-Shot-2019-07-08-at-1.26.10-PM.png>>\r\n%\r\n% I first wrote about the Color Thresholder back in 2014, shortly after\r\n% the app first appeared (<https:\/\/blogs.mathworks.com\/steve\/2014\/04\/25\/color-thresholder-app-in-r2014a \r\n% \"Color Thresholder App in R2014a\">). In that post, I played around\r\n% with picture of candy lying on my desk:\r\n%\r\n% <<https:\/\/blogs.mathworks.com\/images\/steve\/2010\/mms.jpg>>\r\n%\r\n% Besides figuring out how to segment all the different candy colors, I\r\n% also discovered how to characterize the color of my desk:\r\n%\r\n% <<https:\/\/blogs.mathworks.com\/steve\/files\/color-thresholder-desk.jpg>>\r\n%\r\n% The Color Thresholder is a very useful tool. Give it a look!\r\n\r\n##### SOURCE END ##### c2ad3d5c38e449008ed14a1383f70212\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/steve\/files\/Screen-Shot-2019-07-08-at-1.26.10-PM.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><p>Back in the summer I had another chance to use the Color Thresholder, a very nice app that's in the Image Processing Toolbox. I happened to come across a question on MATLAB Answers - someone was... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/steve\/2019\/10\/14\/using-the-color-threshold-app-again\/\">read more >><\/a><\/p>","protected":false},"author":42,"featured_media":3444,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/3446"}],"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=3446"}],"version-history":[{"count":1,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/3446\/revisions"}],"predecessor-version":[{"id":3448,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/3446\/revisions\/3448"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/media\/3444"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/media?parent=3446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/categories?post=3446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/tags?post=3446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}