Randomized algorithms for statistical image analysis and site percolation on square lattices