You need to determine the source of the intensity changes. If it's just that you have a bad lamp, like it's flickering and the whole image is brighter or darker by the same amount, you can just subtract them and pick the appropriate threshold. If there is other junk in the image you have to decide if it's really sperm or some other matter, or it it's really part of the background. If your intensity does not go up or down by a constant, and changes region by region, then you need to equalize each region, for example by adapthisteq() or imbothat(). Not really sure what would cause this kind of "lumpy" changes to the background - lamps usually do it all over the image in the same amount. Maybe you have crickets running over your lamp that change the intensity in different parts of your image????
Best Answer