A method for detecting a capsule camera entering into or exiting the GI tract, includes (a) taking a first test image under the condition that an illumination system of the capsule camera is disabled (b) taking a second test image under the same condition as the first test image (c) comparing selected corresponding pixel values of the first test image and the second test image to determine if a significant change in pixel values has occurred and (d) upon detecting the significant change in pixel values, determining if the capsule camera has entered or exited the GI tract, and performing operations appropriate to follow such determination. The appropriate operations performed after detecting the capsule cameras exit from the GI tract includes stopping further taking or storing of images and, optionally, activating an audio signal to indicate the capsule camera has exited the GI tract. The appropriate operations performed after detecting the capsule cameras entering into the GI tract includes entering into an imaging mode for a next section of the GI tract, which may be the esophagus.