Ask Your Question

Revision history [back]

You just need to run a QR code scanner and find the center of the returned bounding box using @holger suggestion. OpenCV already has a QRCodeDetector class just for this exact function. You can use the method detectAndDecode() to search for a QR code and it returns a bounding box with the QR code region. From this box compute its center as suggested by @holger and voila, you have attained the centroid. Refer to this tutorial having both C++ and Python implementations.

You just need to run a QR code scanner detector and find the center of the returned bounding box using @holger suggestion. box. OpenCV already has a QRCodeDetector class just for this exact function. You can use the method detectAndDecode() to search for a QR code and it returns a bounding box with the QR code region. From this box compute its center as suggested by @holger and voila, you have attained the centroid. Refer to this tutorial having both C++ and Python implementations.