We consider the ill-posed problem of localizing (finding the position of) the discontinuity lines of a function of two variables that is smooth outside the discontinuity lines and has a discontinuity of the first kind at each point of such lines. A uniform square grid with step τ is considered, and it is assumed that the mean values of a perturbed function over squares with side τ are known at each node of the grid. The perturbed function approximates the exact function in the space L2(ℝ2). The perturbation level δ is known. To solve the problem under consideration, we design and study global discrete algorithms that are based on averaging procedures and approximate the discontinuity lines by a set of points of a uniform grid. The main result of the paper is the development of an approach to the global study of localization algorithms. We formulate conditions for the exact function, thus defining a class of correctness. Within this class, we perform a theoretical study of the proposed algorithms, introduce the characteristics to be estimated (the concept of approximating a set of discontinuity lines by a set of points of a uniform grid), and develop methods for deriving the estimates. To achieve this goal, we use a simplified statement: the discontinuity lines are straight line segments, and the proposed localization algorithm has the simplest thinning block. It is established that the localization error of the algorithm has order O(δ). Estimates of other important parameters characterizing the localization algorithm are given.