We introduced a new algorithm called the histogramic intensity switching with dynamic mask allocation, a method that helps a robot to avoid obstacles using vision as the only sensing element. The algorithm uses histograms of images captured by a monochrome camera to achieve obstacle avoidance. Histograms with special masks on input images are used to result in an intensity switching based on the dominant regions of the masked image. The mask lengths are dynamically determined by a method called the Dynamic Mask Allocation (DMA). The method does not make use of any direct distance measurement of the obstacles and indirectly captures the essence of the principle behind time-to-collision (TTC). The algorithm is tested in real time on in-house developed robot called the VITAR.