Skip to content

Broken BGR color conversion utilities in opencv/modules/imgcodecs/src/utils.cpp. #16215

@JanuszL

Description

@JanuszL

058367f#diff-c868f69925dd124c54190546d4843841 break BGR color conversion utilities in opencv/modules/imgcodecs/src/utils.cpp.
Before this commit when swap channels is set to 0 we have a following formula:
rgba[0]*cB + rgba[1]*cG + rgba[2]*cR

As rgba, in this case, is really BGRA data it works fine.

After this change:
rgba[0]*cRGB0 + rgba[1]*cG + rgba[2]*cRGB2
where
cRGB0 = cR
cRGB0 = cB

It is used by ../modules/imgcodecs/src/grfmt_tiff.cpp which reads RBG data, but uses icvCvt_BGRA2Gray_8u_C4C1R for conversion but with channel swapped.

relates #14760

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions