Recent progress in electronics has allowed the construction of affordable mobile robots. This opens many new opportunities, in particular in the context of collective robotics. However, while several algorithms in this field require global localization, this capability is not yet available in low-cost robots without external electronics. In this paper, we propose a solution to this problem, using only approximate dead-reckoning and infrared sensors measuring the grayscale intensity of a known visual pattern on the ground. Our approach builds on a recursive Bayesian filter, of which we demonstrate two implementations: a dense Markov Localization and a particle-based Monte Carlo Localization. We show that both implementations allow accurate localization on a large variety of patterns, from pseudo-random black and white matrices to grayscale images. We provide a theoretical estimate and an empirical validation of the necessary traveled distance for convergence. We demonstrate the real-time localization of a Thymio II robot. These results show that our system solves the problem of absolute localization of inexpensive robots. This provides a solid base on which to build navigation or behavioural algorithms.