Skip to content

bmp decoder fix scale factor and IMREAD_COLOR incorrect result#23446

Merged
asmorkalov merged 3 commits intoopencv:4.xfrom
tantei3:bmp_fix
Apr 6, 2023
Merged

bmp decoder fix scale factor and IMREAD_COLOR incorrect result#23446
asmorkalov merged 3 commits intoopencv:4.xfrom
tantei3:bmp_fix

Conversation

@tantei3
Copy link
Copy Markdown
Contributor

@tantei3 tantei3 commented Apr 1, 2023

Merge with extra: opencv/opencv_extra#1050

For 32 bits per pixel with 3 or 4 channel destination images, apply scale factor and mask to parse BMP files correctly

closes #23445

Pull Request Readiness Checklist

  • I agree to contribute to the project under Apache 2 License.
  • 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
  • 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

Signed-off-by: Shreesh Adiga <16567adigashreesh@gmail.com>
@asmorkalov asmorkalov self-requested a review April 2, 2023 08:42
@asmorkalov asmorkalov self-assigned this Apr 2, 2023
@asmorkalov asmorkalov added bug category: imgcodecs pr: needs test New functionality requires minimal tests set pr: needs rebase Rebase patch (and squash fixup commits) on the top of target branch labels Apr 2, 2023
@asmorkalov
Copy link
Copy Markdown
Contributor

@tantei3 Thanks a lot for the prompt patch! I just tried branch 3.4 and the issue is there too. Please rebase the PR on top of 3.4 (or cherry-pick), push it to the same branch and change the PR target to 3.4. Also it's good to have some test for the issue. Could you create PR with the same branch name to opencv/opencv_extra repo with smallest possible image like 16x16 or 32x32 and implement test for it.

@tantei3
Copy link
Copy Markdown
Contributor Author

tantei3 commented Apr 2, 2023

@asmorkalov test case has been added. Regarding rebase,3.4 branch doesn't seem to have the previous 32 bit mask related changes done in #20875 and so would seem to me like those previous changes would also require to be imported. So do you want me to include those commits and then update this PR against 3.4 target branch?

@asmorkalov
Copy link
Copy Markdown
Contributor

Got it, please ignore my request about 3.4. I'll take a look on it later.

@asmorkalov asmorkalov removed pr: needs test New functionality requires minimal tests set pr: needs rebase Rebase patch (and squash fixup commits) on the top of target branch labels Apr 3, 2023
@opencv-alalek opencv-alalek added this to the 4.8.0 milestone Apr 6, 2023
@asmorkalov
Copy link
Copy Markdown
Contributor

Thanks a lot for the contribution! The patch was tested manually with Ubuntu 18.04.

@asmorkalov asmorkalov merged commit 8336a96 into opencv:4.x Apr 6, 2023
@asmorkalov asmorkalov mentioned this pull request May 31, 2023
thewoz pushed a commit to thewoz/opencv that referenced this pull request Jan 4, 2024
**Merge with extra**: opencv/opencv_extra#1050

For 32 bits per pixel with 3 or 4 channel destination images, apply scale factor and mask to parse BMP files correctly

closes opencv#23445 

### Pull Request Readiness Checklist
- [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.
- [ ] The feature is well documented and sample code can be built with the project CMake
thewoz pushed a commit to thewoz/opencv that referenced this pull request May 29, 2024
**Merge with extra**: opencv/opencv_extra#1050

For 32 bits per pixel with 3 or 4 channel destination images, apply scale factor and mask to parse BMP files correctly

closes opencv#23445 

### Pull Request Readiness Checklist
- [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.
- [ ] The feature is well documented and sample code can be built with the project CMake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BMP image not loading correctly

4 participants