Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to install OpenCV_python to read JPEG2000 files?

Is Jasper still the recommended way to read and write JP2 files in OpenCV. I heard there were security issues with it and OpenCV is moving to OpenJPEG. Has that happened yet?

I tried to use OpenCV with Jasper by enabling it in Python code as follows:

os.environ['OPENCV_IO_ENABLE_JASPER'] = 'true'

However, when I attempt to read an ESA Sentinel-2 image like this:

img_nir = cv2.imread(nir_path, 0)

I still get this error:

cv2.error: OpenCV(4.1.2) D:\Build\OpenCV\opencv-4.1.2\modules\imgcodecs\src\grfmt_jpeg2000.cpp:104: error: (-213:The function/feature is not implemented) imgcodecs: Jasper (JPEG-2000) codec is disabled. You can enable it via 'OPENCV_IO_ENABLE_JASPER' option. Refer for details and cautions here: https://github.com/opencv/opencv/issu... in function 'cv::initJasper'

I installed OpenCV in an anaconda virtual environment like this:

python -m pip install opencv_python-4.1.2-cp37-cp37m-win_amd64.whl

What's the current recommended way to read and write JP2 files in OpenCV_python?

How to install OpenCV_python to read JPEG2000 files?

Is Jasper still the recommended way to read and write JP2 files in OpenCV. OpenCV? I heard there were security issues with it and OpenCV is moving to OpenJPEG. Has that happened yet?

I tried to use OpenCV with Jasper by enabling it in Python code as follows:

os.environ['OPENCV_IO_ENABLE_JASPER'] = 'true'

However, when I attempt to read an ESA Sentinel-2 image like this:

img_nir = cv2.imread(nir_path, 0)

I still get this error:

cv2.error: OpenCV(4.1.2) D:\Build\OpenCV\opencv-4.1.2\modules\imgcodecs\src\grfmt_jpeg2000.cpp:104: error: (-213:The function/feature is not implemented) imgcodecs: Jasper (JPEG-2000) codec is disabled. You can enable it via 'OPENCV_IO_ENABLE_JASPER' option. Refer for details and cautions here: https://github.com/opencv/opencv/issu... in function 'cv::initJasper'

I installed OpenCV in an anaconda virtual environment like this:

python -m pip install opencv_python-4.1.2-cp37-cp37m-win_amd64.whl

What's the current recommended way to read and write JP2 files in OpenCV_python?

How to install OpenCV_python to read JPEG2000 files?

Is Jasper still the recommended way to read and write JP2 files in OpenCV? I heard there were security issues with it and OpenCV is moving to OpenJPEG. Has that happened yet?

I tried to use OpenCV with Jasper by enabling it in Python code as follows:

os.environ['OPENCV_IO_ENABLE_JASPER'] = 'true'

However, when I attempt to read an ESA Sentinel-2 image like this: this...

img_nir = cv2.imread(nir_path, 0)

I still get this error:

cv2.error: OpenCV(4.1.2) D:\Build\OpenCV\opencv-4.1.2\modules\imgcodecs\src\grfmt_jpeg2000.cpp:104: error: (-213:The function/feature is not implemented) imgcodecs: Jasper (JPEG-2000) codec is disabled. You can enable it via 'OPENCV_IO_ENABLE_JASPER' option. Refer for details and cautions here: https://github.com/opencv/opencv/issu... in function 'cv::initJasper'

I installed OpenCV in an anaconda Python 3.7 virtual environment on Windows 10 like this:

python -m pip install opencv_python-4.1.2-cp37-cp37m-win_amd64.whl

What's the current recommended way to read and write JP2 files in OpenCV_python?