Pb With a Loop with BGRA Transparent image

The same LOOP is working in BGR but not in BGRA : What is the problem about cv::Vec4b on a pixel loop ? Thx

int x2, y2;
for (int x = 0; x < imgMos.cols; x++)
x2 = x + m_mos.mx0;
for (int y = 0; y < imgMos.rows; y++)
y2 = y + m_mos.my0;
if ((x2 >= 0) && (x2 < imTemp.cols) && (y2 >= 0) && (y2 < imTemp.rows))
imTemp.atcv::Vec4b(y2, x2)[0] = imgMos.atcv::Vec4b(y, x)[0];
imTemp.atcv::Vec4b(y2, x2)[1] = imgMos.atcv::Vec4b(y, x)[1];
imTemp.atcv::Vec4b(y2, x2)[2] = imgMos.atcv::Vec4b(y, x)[2];
imTemp.atcv::Vec4b(y2, x2)[3] = imgMos.atcv::Vec4b(y, x)[3];

check the type of your data.
CV_8UC3 is 16
CV_8UC4 is 24

the bug is likely in part of your code that you have kept a secret so far

you aren’t new here. you know how this works. minimal reproducible example. and please edit your post and put code formatting style around your code (type ``` before and after your code, on a single line with nothing else)