I have a question and hope that you can help me.
I need to count objects in a bakery production line. Unfortunately this is not ideal for image processing. The machine has to be accessible, people cast shadows walking by and working at the machine. The lighting can vary slightly depending on which ceiling light is on and also depending on the daylight.
But there is fairly good contrast between the objects and the transportation belt.
Usually the image looks similar to this:
This is part of a retrofit for a production line. People need to work exactly where the camera is. What you see are about 1 cm wide lines of dough. Sometimes they tear apart and clutter the machine after some minutes. And this is the crucial place, here you the cluttering happens, it is where people fix is and the only place where you can see the dough before it enters the oven.
The center of the image is brighter, especially the right quarter is usually darker, can be even more that it is in the image.
So far my approach is
- Gaussian Blur
- Thresholding
- Morphological Opening (
several times, stupid, idempotent) - Find Contours
I could not find a threshold manually that is robost and Otsu's threshold is also not fixing the problem. The threshold is always messing up the right quarter. The other part of the image works like a charm.
Installing an additional light might fix the problem, but that is not likely to happen anytime soon. I tried to brighten up the right side with a flashlight and it works like a charm then. :)
I also tried "normal" Histogram Equalization and CLAHE, but without success. Also the suggestions from Automatic contrast and brightness adjustment of a color photo of a sheet of paper with OpenCV, also no improvement.
So, the task looks rather simple to me, but I am out of luck and there is probably a simple solution that I am missing.
Ideas?
Edit:
remove gradient of a image without a comparison image describes the bandpass / lowpass filtering as mentioned in the comments (big median blur or big gaussian blur).