Data Matrix and QR codes are one of the most popular types of two-dimensional (2D) matrix bar codes, which are the descendants of well-known 1D bar codes. However compared to 1D bar codes, they offer many benefits. They enable us to store much more information in the same area, omnidirectional readability, readability even with partial code corruption, error correction etc. We have proposed algorithms, which localizes Data Matrix and QR Codes in an images and decode informations, which are stored in them. In case of Data Matrix codes we use edge detection, connecting edge points, which have the same gradient angle, into continuous regions and by finding near perpendicular regions. In case of QR codes we start with image binarization, then we continue with QR Code localization, where we utilize typical Finder Patterns, which are presented in three corners of QR Code, and finally we identify perspective distortion. In an alternative algorithm, we identify areas in the image that may contain a QR code based on the density of dark points and density of edges in the floating window. Then we connect these areas and we evaluate the edge projections in them. The proposed algorithms are computationally efficient and work well for low-resolution images. When recognizing Data Matrix codes, the algorithms we designed achieved better results compared to competitive open-source and commercial solutions. When recognizing QR codes, the algorithms we designed achieved comparable results, while they were more computationally efficient.