Add support for QNX #25832
Build and test instruction for QNX:
https://github.com/chachoi-world/qnx-ports/blob/main/opencv/README.md
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
3rdparty: libtiff: fix for small version expression problems for built-in tiff460 #25257Close#25256
1. fix to show build-int libtiff version
2. fix to set value of LIBTIFF_VERSION define.
(RELEASE-DATE file coms from original libtiff 4.6.0)
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
Zlib-ng is zlib replacement with optimizations for "next generation" systems. Its optimization may benifits image library decode and encode speed such as libpng. In our tests, if using zlib-ng and libpng combination on a x86_64 machine with AVX2, the time of `imdecode` amd `imencode` will drop 20% approximately. This patch enables zlib-ng's optimization if `CV_DISABLE_OPTIMIZATION` is OFF. Since Zlib-ng can dispatch intrinsics on the fly, port work is much easier.
Related discussion: https://github.com/opencv/opencv/issues/22573
Currently, if `PNG_FOUND`, cmake scripts will check include and parse
header while we can use `PNG_VERSION_STRING` conveniently. If
`BUILD_PNG`, parse version from `PNG_LIBPNG_VER_STRING` directly is more
convenient than parsing major, minor and patch and concatenate them.
The comment of png.h also supports this.
```
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
```
https://github.com/glennrp/libpng/blob/libpng16/png.h#L287
This patch also modifies `ocv_parse_header_version` macro to receive
another parameter to make it more general.
The reason why changing `PNG_VERSION` to `PNG_VERSION_STRING` is to be
consistent with cmake's FindPNG.
This patch removes `HAVE_LIBPNG_PNG_H` variable because `PNG_INCLUDE_DIR`
is where to find png.h, etc according to
https://cmake.org/cmake/help/latest/module/FindPNG.html.
This patch also removes `PNG_PNG_INCLUDE_DIR` variable which is an
advanced variable used in cmake's FindPNG and is not used in opencv.
Currently, if OpenJPEG is found, only version information in summary is
correct and the information right after `find_package(OpenJPEG)` is
wrong.
```
-- Found system OpenJPEG: openjp2 (found version "")
```
The reason is OpenJPEGConfig.cmake only sets `OPENJPEG_MAJOR_VERSION`,
`OPENJPEG_MINOR_VERSION` and `OPENJPEG_BUILD_VERSION` but not `OPENJPEG_VERSION`.
Currently cmake scripttry to use regex to parse VER_MAJOR, VER_MINOR,
VER_REVISION from ZLIB_VERSION. However, ZLIB_VERSION is "1.3" which
means that there is no VER_REVISION.
You can reproduce using "-DBUILD_ZLIB=ON"
```
-- ZLib: zlib (ver 1.3.#define ZLIB_VERSION "1.3")
```
This patch add a new macro ocv_parse_header_version to extract version
information.
Add support for external libspng. #24718
Fixes https://github.com/opencv/opencv/issues/24683
Related patch to libspng: https://github.com/randy408/libspng/pull/264
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
Add AVIF support through libavif. #23596
This is to fix https://github.com/opencv/opencv/issues/19271
Extra: https://github.com/opencv/opencv_extra/pull/1069
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
* fix find zlib.so instead of zlib.a when NDK >= 19
On Android platform, `libopencv_imgcodecs.a` is built, expected to
depend on `libz.so`. However, since Android NDK r19, NDK's `libz.a`
is found instead of `libz.so`, leading to link error
(not found libz.a) on machines without same NDK version & direcotry.
Since Android NDK-r19, toolchain pieces are installed to
`$NDK/toolchains/llvm/prebuilt/<host-tag>/...`, including `libz.so`.
Also installed to old paths (`<NDK>/platforms` and `<NDK>/sysroot`)
in NDK r19, r20, r21, but since NDK 22, old paths are removed.
- https://github.com/android/ndk/wiki/Changelog-r19
- https://github.com/android/ndk/wiki/Changelog-r22
With this commit, `libz.so` can be correctly found in NDK<19 and NDK>=19.
`ZLIB_LIBRARIES` is also simplified as `z`, by appending match (regex)
patterns for new toolchain installation directory's libz.so's paths.
* simplify libz.so match pattern for abbreviation
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>
* created new decoder and encoder for PFM
pfm file format stores binary RGB or grayscale float images.
* added test for pfm codec
* replaced large with short licence header
* little/big-endian-check is now compile time
* fixed width/height confusion, improved big/little endian recognition, fixed scaling issue and Improved signature check
* adapted tests to handle float images well
* removed data-dependency: lena.pfm
the lena image is now loaded is pam and converted to pfm.
* fixed bug in endianess detection macro
* Added endianess detection for android and win
* removed fancy endianess detection
endianess detection will be implemented in cmake scripts soonish.
* fixed minor warnings
* fixed stupid elif defined bug
* silenced some implicit cast warnings
* replaced std::to_string with std::stringstream solution
std::to_string variant did not build on android.
* replaced new endianess macros with existing ones
* improved readability
Now the HAVE_* macros are set using cvconfig.h. Previously most
of them already were there, but were always undefined. One,
HAVE_COCOA, I had to add.
This also makes the CMake code more consistent; now, WITH_* variables
are always checked in cmake/*, while HAVE_* variables are checked in
modules/highgui/CMakeLists.txt.