I have completed the pose estimation of the datamatrix. In order to perform the estimation I have used the corners provided by the library libdmtx and the OpenCV function solvePnP(). The estimation seems accurate but I tried to improve the precision using all the corners visible and the function solvePnPRansac(), which uses a RANSAC (Random sample consensus) approach to separate the inliers from the outliers. For now this improvement does not work because the function solvePnPRansac() crashes when it has to deal with a large number of points.
I will try to fix this problem in the future.
The next step will be to connect the localization node with the EKF using the new Robotics System Toolbox for MATLAB.