48 ms·
Also, I'm pretty sure that COLORREF is xBGR format because colour data in memory is RGBx format and when you read it DWORD at a time on a little-endian machine,
by Asooka 8y ago
Also, I'm pretty sure that COLORREF is xBGR format because colour data in memory is RGBx format and when you read it DWORD at a time on a little-endian machine, you end up with xBGR in registers. So an array of COLORREFs in memory is RGBx format...
On the other hand, BMP is BGR format on disk and in memory[1] when using 24-bit colour. I think "opencv used BGR because BGR was the format of the default image file type on the first platform it was written for" might explain it better. Camera makers probably did the same thing - output BMPs before JPEG was developed.
[1] Yes, technically BMP also has bitmasks that let you store the colour channels in any order with any precision, but almost all BMPs I've come across just use the default BGR format.