I\'m trying to read a datamatrix barcodes on the bottom of microtubes. I tried libdmtx which has python bindings and works reasonably well when the dots of the matrix are square
For python 3 compatibility you need to modify the above code as this:
contours, hierarchy = cv2.findContours(thr.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) areas = map(lambda x: cv2.contourArea(cv2.convexHull(x)), contours) areas = list(areas) max_i = areas.index(max(areas))