Ask Your Question

Revision history [back]

Detecting multiple data matrix codes from high resolution image

We're working on some software using OpenCV for high resolution image processing. We are trying to detect multiple datamatrix codes at once from a 40 megapixel image, and are running into some limitations because of the current implementation in OpenCV. The current implementation of OpenCV's findDataMatrix function seems to gather multiple candidate datamatrixes from the image source file, but return directly after finding one success case without processing the other candidates. The short-circuiting is on rows 442 - 464 in modules/objdetect/src/datamatrix.cpp .

We are able to work around the problem by covering the detected datamatrixes and calling the detection function multiple times, but because of the high resolution this processing time is turning into a significant bottleneck. As an example, on my laptop (1.40GHz Intel Core 2 Duo SU9400) each call to the findDataMatrix-function takes about 10 seconds on a grayscale image (7152 x 5468 pixels). With a test image with 35 datamatrix codes on it, the completion time for this operation was 6 minutes on this machine. If the image is black and white, the processing time is lower, but codes are not detected as reliably. We are aiming for a processing time of < 1 minute for each image of this size.

It would seem that the fix for this would be for the implementation to process the full image in one pass, which probably would solve all of our current issues. However, looking at the roadmap it would seem that no action is planned for the datamatrix code in the near future. A fix doesn't seem too difficult, but we have no idea if there is a good reason for the current functionality, or if it is just an initial solution which was intended to be returned to. Developing the OpenCV code is not something that we have done before, and the initial effort seems significant. Is there someone who might be able to help us with a patch for this code, or does someone have other suggestions for our situation?