This paper presents a proposed methodology developed to obtain the geometry of masonry walls. The methodology is based on the automatic recognition of boundaries. The geometry is used to proceed to the numerical simulation of damages based on a simple model, which allows determinate the cracking process due the tensile stresses in joints. Masonry units are considered as lineal and elastic elements, and the non-elastic processes are considered to exist only in the joints. Two examples are included showing two different walls: a regular mansonry wall built with bricks, and an irregular masonry wall with limestone stones as masonry units.