{"id":1358,"date":"2017-05-11T17:23:31","date_gmt":"2017-05-11T08:23:31","guid":{"rendered":"http:\/\/rageworx.info\/?p=1358"},"modified":"2017-05-11T17:27:59","modified_gmt":"2017-05-11T08:27:59","slug":"clahe-shading-correction","status":"publish","type":"post","link":"https:\/\/rageworx.info\/?p=1358","title":{"rendered":"CLAHE shading correction"},"content":{"rendered":"<p>Applying CLAHE to medical images may going to some shaded on each edge side of object. So I have to correct this problem with fast processing in real time.<\/p>\n<p>To make up a prototype correction, I have used same source RAW image, here is a source image in down scaled from 16bit gray scale RAW.<\/p>\n<p><a href=\"http:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/raw_img_src.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1360\" src=\"http:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/raw_img_src.jpg\" alt=\"\" width=\"451\" height=\"451\" srcset=\"https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/raw_img_src.jpg 451w, https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/raw_img_src-200x200.jpg 200w, https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/raw_img_src-300x300.jpg 300w, https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/raw_img_src-150x150.jpg 150w\" sizes=\"auto, (max-width: 451px) 100vw, 451px\" \/><\/a><\/p>\n<p>Applied CLAHE with 16&#215;16 in clip limit of 100.0f. And I could recognized shaded areas at each edge of object. Shaded area marked as red boxes in below.<\/p>\n<p><a href=\"http:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/clahe_img.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1362\" src=\"http:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/clahe_img.jpg\" alt=\"\" width=\"452\" height=\"451\" srcset=\"https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/clahe_img.jpg 452w, https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/clahe_img-200x200.jpg 200w, https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/clahe_img-300x300.jpg 300w, https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/clahe_img-150x150.jpg 150w\" sizes=\"auto, (max-width: 452px) 100vw, 452px\" \/><\/a><\/p>\n<p>To correct shaded area, generate gaussian blur mask with big radials, but it really heavy to processing in fast time as realtime. So I made it fastest way with my &#8216;Resize engine&#8217; that made with OpenMP and AVX instructions. To generate fastest blurred mask, down scale with bi-linear filter to 2.5% size. Then doing up scale again with B-Spline filter to original size. And Invert it.<\/p>\n<p><a href=\"http:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/shade_mask_extract_from_CLAHE.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1361\" src=\"http:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/shade_mask_extract_from_CLAHE-500x339.jpg\" alt=\"\" width=\"500\" height=\"339\" srcset=\"https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/shade_mask_extract_from_CLAHE-500x339.jpg 500w, https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/shade_mask_extract_from_CLAHE.jpg 650w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>Then calculate to do shade correction with generated shade mask, ins fastest math functions with original image.<\/p>\n<p><a href=\"http:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/diffs.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1359\" src=\"http:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/diffs-500x231.jpg\" alt=\"\" width=\"500\" height=\"231\" srcset=\"https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/diffs-500x231.jpg 500w, https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/diffs-768x355.jpg 768w, https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/diffs-800x370.jpg 800w, https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/diffs.jpg 912w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>To complete image processing, need to fill background areas.<\/p>\n<p><a href=\"http:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/correcting_flow.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1363\" src=\"http:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/correcting_flow-500x311.jpg\" alt=\"\" width=\"500\" height=\"311\" srcset=\"https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/correcting_flow-500x311.jpg 500w, https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/correcting_flow-768x477.jpg 768w, https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/correcting_flow-800x497.jpg 800w, https:\/\/rageworx.info\/wp-content\/uploads\/2017\/05\/correcting_flow.jpg 937w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>It simply corrected but little bit lacks on details of bone level. But definitely better than hard shaded levels after window leveling. Expect for next will find more improved processing algorithm, and it will be a function of librawprocessor.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Applying CLAHE to medical images may going to some shaded on each edge side of object. So I have to correct this problem with fast processing in real time. To make up a prototype correction, I have used same source RAW image, here is a source image in down scaled&#8230; <a href=\"https:\/\/rageworx.info\/?p=1358\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,438,3],"tags":[507,509,195,447,446,510,508],"class_list":["post-1358","post","type-post","status-publish","format-standard","hentry","category-development","category-medical","category-raphs","tag-clahe","tag-correction","tag-image","tag-librawprocessor","tag-medical","tag-raw","tag-shade"],"_links":{"self":[{"href":"https:\/\/rageworx.info\/index.php?rest_route=\/wp\/v2\/posts\/1358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rageworx.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rageworx.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rageworx.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rageworx.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1358"}],"version-history":[{"count":0,"href":"https:\/\/rageworx.info\/index.php?rest_route=\/wp\/v2\/posts\/1358\/revisions"}],"wp:attachment":[{"href":"https:\/\/rageworx.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rageworx.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rageworx.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}