Conversation
alalek
left a comment
There was a problem hiding this comment.
Thank you for the contribution!
f9026c8 to
fbe7e0f
Compare
|
@StefanBruens Great job! Could you make |
|
Please ignore CMake warnings for now. I need to upgrade builders and their configurations first. Let enable tests for OpenJPEG first. |
fbe7e0f to
86142b0
Compare
8677157 to
e7f039a
Compare
|
The Mac build already uses the OpenJPEG path. It fails due to the unimplemented RGB->gray conversion when IMREAD_GRAY is used. Should this just use cv::cvtColor, or fail? |
|
|
|
Last remaining error: |
Currently, the following input color spaces and depth conversions are supported: - 8 bit -> 8 bit - 16 bit -> 16 bit (IMREAD_UNCHANGED, IMREAD_ANYDEPTH) - RGB(a) -> BGR - RGBA -> BGRA (IMREAD_UNCHANGED) - Y(a) -> Y(a) (IMREAD_ANYCOLOR, IMREAD_GRAY, IMREAD_UNCHANGED)) - YCC -> Y (IMREAD_GRAY)
fa7677c to
2b0cee3
Compare
Please ignore this for now (this issue is related to infrastructure which will be updated before merge). There are several packages of OpenJPEG on Ubuntu 16.04:
Looks like they have different versions of OpenJPEG: 1.5 vs 2.1 Please adapt CMake to check applicable version of OpenJPEG (perhaps >= 2.0). or check version after that: |
This enables OpenJPEG based JPEG2000 imread support by default, which can be disabled by -DWITH_OPENJPEG=OFF. In case OpenJPEG is enabled and found, any checks for Jasper are skipped.
…ANGED With IMREAD_UNCHANGED, values are kept from the input image, without it components are downscaled to CV_8U range.
Support IMREAD_GRAY when input color space is RGB or unspecified. Support YUV input color space for BGR output.
No OpenJPEGVersion.cmake -> manual check required. |
2b0cee3 to
6d6424e
Compare
|
@StefanBruens Do you have a chance to finish your patch? it brings a lot of value to the library. |
Removed trailing whitespaces
e857531 to
98f498e
Compare
98f498e to
c37fd9a
Compare
c37fd9a to
6f928f6
Compare
Images with depth CV_8U and CV_16U are supported, with 1 to 4 channels.
- Removed code duplication - Added error handlers - Extracted functions
e97fae5 to
6054d18
Compare
…d requirements - Removed channels split in copyFromMatImpl. With ChannelsIterator no allocations are performed. - Split whole loop into 2 parts in copyToMat -> where std::copy and std::transforms are called.
6054d18 to
c9ff248
Compare
|
|
||
| bool Jpeg2KOpjDecoder::readHeader() | ||
| { | ||
| stream_.reset(opj_stream_create_default_file_stream(m_filename.c_str(), OPJ_STREAM_READ)); |
There was a problem hiding this comment.
m_filename.c_str()
Looks like imdecode() from in-memory buffers is not supported at this moment.
- Changed `nullptr` in CV_LOG* functions to `NULL` - Added `falls through` comment in decoder color space `switch` - Added warning about unsupported parameters for the encoder
42ccb46 to
80838b6
Compare
|
Updated I/O tests (#16922) show large output from OpenJPEG encoding process. Looks like lossless compression is applied. We need to tune default compression parameters. PSNR 30-35 threshold on mentioned tests should be enough for default compression values. |
|
I see this is very recent change (only 4 days ago), but I'm interested in testing openjpeg for my case (uint16 grayscale) to read/write from python. |
|
OpenCV 4.3.0 is coming soon. |
Jpeg2000 OpenJPEG port * OpenJPEG based JPEG2000 decoder implementation Currently, the following input color spaces and depth conversions are supported: - 8 bit -> 8 bit - 16 bit -> 16 bit (IMREAD_UNCHANGED, IMREAD_ANYDEPTH) - RGB(a) -> BGR - RGBA -> BGRA (IMREAD_UNCHANGED) - Y(a) -> Y(a) (IMREAD_ANYCOLOR, IMREAD_GRAY, IMREAD_UNCHANGED)) - YCC -> Y (IMREAD_GRAY) * Check for OpenJPEG availability This enables OpenJPEG based JPEG2000 imread support by default, which can be disabled by -DWITH_OPENJPEG=OFF. In case OpenJPEG is enabled and found, any checks for Jasper are skipped. * Implement precision downscaling for precision > 8 without IMREAD_UNCHANGED With IMREAD_UNCHANGED, values are kept from the input image, without it components are downscaled to CV_8U range. * Enable Jpeg2K tests when OpenJPEG is available * Add support for some more color conversions Support IMREAD_GRAY when input color space is RGB or unspecified. Support YUV input color space for BGR output. * fix: problems with unmanaged memory * fix: CMake warning - HAVE_OPENJPEG is undefined Removed trailing whitespaces * fix: CMake find_package OpenJPEG add minimal version * Basic JPEG2K encoder Images with depth CV_8U and CV_16U are supported, with 1 to 4 channels. * feature: Improved code for OpenJPEG2000 encoder/decoder - Removed code duplication - Added error handlers - Extracted functions * feature: Update conversion openjpeg array from/to Mat * feature: Extend ChannelsIterator to fulfill RandomAccessIterator named requirements - Removed channels split in copyFromMatImpl. With ChannelsIterator no allocations are performed. - Split whole loop into 2 parts in copyToMat -> where std::copy and std::transforms are called. * fix: Applied review comments. - Changed `nullptr` in CV_LOG* functions to `NULL` - Added `falls through` comment in decoder color space `switch` - Added warning about unsupported parameters for the encoder * feature: Added decode from in-memory buffers. Co-authored-by: Vadim Levin <vadim.levin@xperience.ai>
resolves #5849
relates #14058
Currently missing/incomplete: