{"action":"reopened","issue":{"url":"https://api.github.com/repos/Itseez/opencv/issues/5953","labels_url":"https://api.github.com/repos/Itseez/opencv/issues/5953/labels{/name}","comments_url":"https://api.github.com/repos/Itseez/opencv/issues/5953/comments","events_url":"https://api.github.com/repos/Itseez/opencv/issues/5953/events","html_url":"https://github.com/Itseez/opencv/issues/5953","id":126204906,"number":5953,"title":"CLAHE filter crashes with pixel values > 12bit and behaves very different compared to 8bit","user":{"login":"mattzzw","id":1312120,"avatar_url":"https://avatars.githubusercontent.com/u/1312120?v=3","gravatar_id":"","url":"https://api.github.com/users/mattzzw","html_url":"https://github.com/mattzzw","followers_url":"https://api.github.com/users/mattzzw/followers","following_url":"https://api.github.com/users/mattzzw/following{/other_user}","gists_url":"https://api.github.com/users/mattzzw/gists{/gist_id}","starred_url":"https://api.github.com/users/mattzzw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattzzw/subscriptions","organizations_url":"https://api.github.com/users/mattzzw/orgs","repos_url":"https://api.github.com/users/mattzzw/repos","events_url":"https://api.github.com/users/mattzzw/events{/privacy}","received_events_url":"https://api.github.com/users/mattzzw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-12T15:32:23Z","updated_at":"2016-01-12T21:23:48Z","closed_at":null,"body":"I am using OpenCV 3.1 with 16bit tiff files (pixel values raning from 0 to 2^16) but any 16bit array with values > 2^12 will do.\r\n\r\nReading the image with imread and flag CV_LOAD_IMAGE_GRAYSCALE works fine. The CLAHE result is comparable to other CLAHE implementations (e.g. jimage).\r\n\r\nHowever, using flag CV_LOAD_IMAGE_UNCHANGED the application crashes in the moment clahe.appy() is being called.\r\n\r\nIf CLAHE input pixel values are scaled down to 12bit, the application does not crash and some kind of CLAHE filtering is applied but I highly doubt that CLAHE processing is done correctly in this case because the behaviour of the filter is very different compared to 8 bit input data (uint8). E.g. inceasing clip factor or tile number lets the image become way too bright.\r\n\r\nThe 16bit processing was added with \r\nhttps://github.com/Itseez/opencv/pull/3033 resulting in https://github.com/Itseez/opencv/commit/563200fbf63525ad64952a481f896e4551154dc7"}}