{"action":"created","issue":{"url":"https://api.github.com/repos/jcupitt/libvips/issues/303","labels_url":"https://api.github.com/repos/jcupitt/libvips/issues/303/labels{/name}","comments_url":"https://api.github.com/repos/jcupitt/libvips/issues/303/comments","events_url":"https://api.github.com/repos/jcupitt/libvips/issues/303/events","html_url":"https://github.com/jcupitt/libvips/issues/303","id":83996592,"number":303,"title":"HSV/HSL/HSB","user":{"login":"Jondeen","id":763025,"avatar_url":"https://avatars.githubusercontent.com/u/763025?v=3","gravatar_id":"","url":"https://api.github.com/users/Jondeen","html_url":"https://github.com/Jondeen","followers_url":"https://api.github.com/users/Jondeen/followers","following_url":"https://api.github.com/users/Jondeen/following{/other_user}","gists_url":"https://api.github.com/users/Jondeen/gists{/gist_id}","starred_url":"https://api.github.com/users/Jondeen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jondeen/subscriptions","organizations_url":"https://api.github.com/users/Jondeen/orgs","repos_url":"https://api.github.com/users/Jondeen/repos","events_url":"https://api.github.com/users/Jondeen/events{/privacy}","received_events_url":"https://api.github.com/users/Jondeen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jcupitt/libvips/labels/question","name":"question","color":"02e10c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-06-02T12:19:08Z","updated_at":"2015-06-02T13:45:09Z","closed_at":null,"body":"Hi again,\r\n\r\nI see there are no colourspaces defined for the HS*-formats. Are there any shortcuts to these formats I'm not aware of?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/jcupitt/libvips/issues/comments/107957530","html_url":"https://github.com/jcupitt/libvips/issues/303#issuecomment-107957530","issue_url":"https://api.github.com/repos/jcupitt/libvips/issues/303","id":107957530,"user":{"login":"jcupitt","id":580843,"avatar_url":"https://avatars.githubusercontent.com/u/580843?v=3","gravatar_id":"","url":"https://api.github.com/users/jcupitt","html_url":"https://github.com/jcupitt","followers_url":"https://api.github.com/users/jcupitt/followers","following_url":"https://api.github.com/users/jcupitt/following{/other_user}","gists_url":"https://api.github.com/users/jcupitt/gists{/gist_id}","starred_url":"https://api.github.com/users/jcupitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcupitt/subscriptions","organizations_url":"https://api.github.com/users/jcupitt/orgs","repos_url":"https://api.github.com/users/jcupitt/repos","events_url":"https://api.github.com/users/jcupitt/events{/privacy}","received_events_url":"https://api.github.com/users/jcupitt/received_events","type":"User","site_admin":false},"created_at":"2015-06-02T13:45:09Z","updated_at":"2015-06-02T13:45:09Z","body":"Oh OK, if this is fresh code then LCh should perform much better. It's really good for segmentation.\r\n\r\nConvert your sRGB to  LCh with `x = x.colourspace(\"lch\")`, then to find pixels close to a certain hue do:\r\n\r\n```python\r\nmask = ((target_hue + threshold) % 360 - x[2]) % 360 < 2 * threshold\r\n```\r\n\r\nErm, I've probably messed that up. Anyway, `x[2]` will get band 2, the hue. You probably need to exclude very dark pixels and pixels near the neutral axis as well, so something like:\r\n\r\n```python\r\nmask &= x[1] > 10 & x[0] > 10\r\n```"}}