MATLAB: Want to remove white patches of a image
image analysisimage processing
Related Solutions
Of course it's always better to get a good image to begin with rather than to repair a bad image, so to get rid of specular reflections you should use the well known technique of crossed polarizers. Put one in front of the light, and other in front of the lens and rotate it until the specular reflections go away.
Let me know if you are unwilling or unable to get a good image to begin with by using the method I highly suggest trying, and I can let you know of worse, inferior techniques to try to remove them in software, but post processing in software should NOT be your first line of attack.
I'd use a profilometer instead of a camera if you can so you can get range data. For example a kinect camera. Or at least a stereo pair so that you can detect big anomalies in the range. If you use visible light cameras you'd need to correct your horrible lighting situation. You can get rid of the small specular reflections (glints) by using crossed polarizers. This is a very common technique where you have a polarizing sheet in front of your lamp, and another rotatable one in front of the lens. Rotate the lens polarizer until the glints disappear. It could also be good to have a baffle around the top of the bottle end so that you can separate the lighting into two zones, one for the end, and one for the main part of the bottle. The overhead lighting should be flood illumination to get rid of any shadows that could be caused by little variances in the bottle shape (logos, etc.). The light below the baffle board should be coming in from all sides, like a circline circular fluorescent light or at least 4 or more LED light bars arranged around the perimeter. This light should be very bright so that holes in the end will be lighter. Splitting the light up this way will make the true holes easier to see and find.
Alternatively I think a better test for holes would be an air pressure test. Blow air into a sealed bottle. Low pressure indicates a leak. It has the advantage that it will detect leaks anywhere not just on the end. I think air pressure testers are fairly available in industry.
If you want to visualize the airflow you can use Schlieren Flow Imaging which lets you see invisible things like air currents. Also see this link.
Anyway, the main point is your images are too complicated to find the holes, especially the really small ones. Improvements in your image capture situation will pay off a great deal. It's always better to start with a good image than to try to fix up a bad image, which may not even be possible, or only partially possible but lead to spurious/incorrect results.
Best Answer