Skip to content

cv::imread/imdecode cannot load JPEG2000 codestream #19083

@tailsu

Description

@tailsu
System information (version)
  • OpenCV => 4.4
  • Operating System / Platform => MacOS Big Sur
  • Compiler => Clang 12
Detailed description

The JPEG2000 standard defines both a "codestream" format and a file format for JP2K data. A codestream should ideally always be wrapped in the file format container, but in practice raw codestreams are sometimes found in the wild.

The OpenCV integration of OpenJPEG can read the JP2K file format, but not raw codestreams (also checked today's master). OpenJPEG itself has no problem reading codestreams (tested with the opj_decompress tool).

A codestream can be identified by its 4-byte header FF 4F FF 51.

OpenCV's JP2K file signature check should test for both the file header and the codestream header.

Steps to reproduce

Call cv::imread on the attached file.
balloon.j2c.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions