I am trying to get a qrcode with opencv, in order to do this I have the following code:
import cv2
import numpy as np
...
data, bbox,rectifiedImage = qrDecoder.detectAndDecode(frame)
...
The code runs ok, but when detect the QRCode and I want get data, I got this
Library QUIRC is not linked. No decoding is performed. Take it to the OpenCV repository.
I tried with pip install quirc
, but doesn't work and I installed opencv with sudo apt-get install python3-opencv
.
How can I fix this?
CodePudding user response:
The version of OpenCV you get with the apt
package is always fairly old. Additionally, there's no guarantee that all the modules (here: the QR decoder) were given the required dependencies (here: quirc). Installing additional packages wouldn't solve this because OpenCV needs them at build time, before packaging.
To get the most recent version, install it via pip:
$ pip3 install opencv-python
There is the opencv-python
package that only contains the main modules, and there is opencv-contrib-python
, which additionally contains "contrib" modules. The packages are mutually incompatible, so only install one of them.