imgcodecs: Add rgb flag for imread and imdecode #25809
Try to `imread` images by RGB to save R-B swapping costs.
## How to use it?
```
img_rgb = cv2.imread("PATH", IMREAD_COLOR_RGB) # OpenCV decode the image by RGB format.
```
## TODO
- [x] Fix the broken code
- [x] Add imread rgb test
- [x] Speed test of rgb mode.
## Performance test
| file name | IMREAD_COLOR | IMREAD_COLOR_RGB |
| --------- | ------ | --------- |
| jpg01 | 284 ms | 277 ms |
| jpg02 | 376 ms | 366 ms |
| png01 | 62 ms | 60 ms |
| Png02 | 97 ms | 94 ms |
Test with [image_test.zip](https://github.com/user-attachments/files/15982949/image_test.zip)
```.cpp
string img_path = "/Users/mzh/work/data/image_test/png02.png";
int loop = 20;
TickMeter t;
double t0 = 10000;
for (int i = 0; i < loop; i++)
{
t.reset();
t.start();
img_bgr = imread(img_path, IMREAD_COLOR);
t.stop();
if (t.getTimeMilli() < t0) t0 = t.getTimeMilli();
}
std::cout<<"bgr time = "<<t0<<std::endl;
t0 = 10000;
for (int i = 0; i < loop; i++)
{
t.reset();
t.start();
img_rgb = imread(img_path, IMREAD_COLOR_RGB);
t.stop();
if (t.getTimeMilli() < t0) t0 = t.getTimeMilli();
}
std::cout<<"rgb time = "<<t0<<std::endl;
```
### 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
imgcodecs: support IMWRITE_JPEG_LUMA/CHROMA_QUALITY with internal libjpeg-turbo #25647Close#25646
- increase JPEG_LIB_VERSION for internal libjpeg-turbo from 62 to 70
- add log when using IMWRITE_JPEG_LUMA/CHROMA_QUALITY with JPEG_LIB_VERSION<70
- add document IMWRITE_JPEG_LUMA/CHROMA_QUALITY requests JPEG_LIB_VERSION >= 70
### 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
Add imread #24415
### 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.
- [x] The feature is well documented and sample code can be built with the project CMake
Hello everyone,
I created this new version of the imread function and I think it can be very useful in several cases.
It is actually passed to it object on which you want to upload the image.
The advantages can be different like in case one needs to open several large images all the same in sequence.
one can use the same pointer and the system would not allocate memory each time.
Normaly, we sets IMWRITE_* flags for imwrite() params.
But imgcodecs expects to use some TIFFTAG_* directory.
This patch introduce IMWRITE_TIFF_ROWSPERSTRIP and
IMWRITE_TIFF_PREDICTOR instead of TIFFTAG_*.
Documentation transition to fresh Doxygen #25042
* current Doxygen version is 1.10, but we will use 1.9.8 for now due to issue with snippets (https://github.com/doxygen/doxygen/pull/10584)
* Doxyfile adapted to new version
* MathJax updated to 3.x
* `@relates` instructions removed temporarily due to issue in Doxygen (to avoid warnings)
* refactored matx.hpp - extracted matx.inl.hpp
* opencv_contrib - https://github.com/opencv/opencv_contrib/pull/3638
Extend the signature of imdecodemulti() #24405
(Edited after addressing Reviewers' comments.)
Add an argument to `imdecodemulti()` to enable optional selection of pages of multi-page images.
Be default, all pages are decoded. If used, the additional argument may specify a continuous selection of pages to decode.
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [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] I agree to contribute to the project under Apache 2 License.
- [X] The PR is proposed to the proper branch
- [ ] 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.
- [ ] 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
OpenEXR encoder: add capability to set the DWA compression level
* OpenEXR encoder: add capability to set the DWA compression level from outside
* Do not try to call `header.dwaCompressionLevel()` if OpenEXR is not version 3 or later
* Minor cleanup
Add reading of specific images from multipage tiff
* Add reading of specific images from multipage tiff
* Fix build issues
* Add missing flag for gdal
* Fix unused param warning
* Remove duplicated code
* change public parameter type to int
* Fix warnings
* Fix parameter check
OpenEXR compression options
* Adding possibility to select the compression type for the OpenEXR format.
There are compression modes other than the default that are more suited for certain data. Mainly grainy/noisy data.
* Code review fixes.
Co-authored-by: Daniel Rydstrom <daniel.rydstrom@sick.se>