A device and method for operating an in vivo imaging device (10A) wherein the illumination produced by the device may be varied in intensity and / or duration, and / or the gain level or other parameters may be varied, according to, for example, the amount of illumination produced by the device which is reflected back to the device. In addition, a method is provided for detecting problematic pixels in an imaging device. This method may define and exclude non-functional pixels, based on for example an initial short exposure that enables a threshold saturation level to be reached only for problematic pixels. Moreover, a method is described for determining when an in vivo device enters the body, for example by calculating the progress of a dark frame, based on the light saturation threshold of the dark frame.