A pattern processing apparatus comprising: a storage unit configured to store an original pattern image for distortion calibration, formed by a plurality of pattern elements arrayed in a grid, together with coordinate information of the pattern elements; a projection unit configured to project the original pattern image; an acquisition unit configured to acquire a projected pattern image together with coordinate information of the acquired pattern elements forming the projected pattern image; an adjacent element identification unit configured to identify, for each of the acquired pattern elements thus acquired, adjacent elements, in at least two directions, each having the shortest distance to the each of the acquired pattern elements, wherein the distances between the each of the acquired pattern elements and other acquired pattern elements are calculated using the coordinate information; a connection unit configured to connect and group, as a connected component, the acquired pattern elements that are adjacent to one another; and an assigning unit configured to assign, for each acquired pattern element included in a connected component, position information in an array in the order from the acquired pattern element which is a starting point of the connected component, among the acquired pattern elements included in the connected component, according to a predetermined regularity, wherein, for distortion calibration, an amount of distortion is calculated based on a comparison with the stored original pattern image with respect to pattern elements assigned to the same position information; characterised by: a checking unit configured to perform grid checking of each connected component, wherein, for each connected component, a check score is initialised, said connected component is traversed starting from the acquired pattern element which is the starting point of the connected component, and for each position information in the array where an acquired pattern element is not present, the check score is incremented, and wherein the checking unit is further configured to determine whether the check score exceeds a predetermined threshold value, and exclude, in the case the threshold value is exceeded, the connected component from the pattern image for calibration. a storage unit configured to store an original pattern image for distortion calibration, formed by a plurality of pattern elements arrayed in a grid, together with coordinate information of the pattern elements; an acquisition unit configured to acquire a projected pattern image together with coordinate information of the acquired pattern elements forming the projected pattern image; an adjacent element identification unit configured to identify, for each of the acquired pattern elements thus acquired, adjacent elements, in at least two directions, each having the shortest distance to the each of the acquired pattern elements, wherein the distances between the each of the acquired pattern elements and other acquired pattern elements are calculated using the coordinate information; a connection unit configured to connect and group, as a connected component, the acquired pattern elements that are adjacent to one another; and an assigning unit configured to assign, for each acquired pattern element included in a connected component, position information in an array in the order from the acquired pattern element which is a starting point of the connected component, among the acquired pattern elements included in the connected component, according to a predetermined regularity, wherein, for distortion calibration, an amount of distortion is calculated based on a comparison with the stored original pattern image with respect to pattern elements assigned to the same position information; a checking unit configured to perform grid checking of each connected component, wherein, for each connected component, a check score is initialised, said connected component is traversed starting from the acquired pattern element which is the starting point of the connected component, and for each position information in the array where an acquired pattern element is not present, the check score is incremented, and wherein the checking unit is further configured to determine whether the check score exceeds a predetermined threshold value, and exclude, in the case the threshold value is exceeded, the connected component from the pattern image for calibration.