Wednesday, November 22, 2017

matlab - How to Remove a Glare / Clipped Brightness from an Image?


I have an image


enter image description here


Is there any way of removing the bright white spots ? Please help thanks


Edit:


After operating with gaussian and then displaying using imagesc get the following output which clearly shows the bright red spots How do i get rid of them


enter image description here


Red Channel :


enter image description here


Green channel:



enter image description here


Blue channel:


enter image description here


Edit 2:


Defect detection using Gabor filter


enter image description here


Its Histogram :


enter image description here


How to calculate its appropriate threshold adaptivily.?



Answer




Let's assume glare portions are the only saturated areas in the image. Detection can be performed by thresholding the intensity (code in Mathematica):


saturated = Binarize[ColorConvert[img, "Grayscale"], .9]

enter image description here


Then we need only to replace the portions of the image around the saturation mask (enlarging the mask is done by the morphological function Dilation). Inpainting using texture synthesis (using the function Inpaint) seems to work well in this example, though I can not test it as input to your defect-detection algorithm:


Inpaint[img, Dilation[saturated, DiskMatrix[20]]]

enter image description here


No comments:

Post a Comment

digital communications - Understanding the Matched Filter

I have a question about matched filtering. Does the matched filter maximise the SNR at the moment of decision only? As far as I understand, ...