1 | initial version |
no idea, if it really fits your situation, but an easy way to "splice" 2 8bit images into a 16bit one would be:
// our input:
Mat A(h,w,CV_8U);
Mat B(h,w,CV_8U);
now assuming, we want A as the "low nibble", and B as the "high nibble":
A.convertTo(A, CV_16U);
B.convertTo(B, CV_16U, 255); // shift 8 bits to the right
Mat C = A + B;
2 | No.2 Revision |
no idea, if it really fits your situation, but an easy way to "splice" 2 8bit images into a 16bit one would be:
// our input:
Mat A(h,w,CV_8U);
Mat B(h,w,CV_8U);
now assuming, we want A as the "low nibble", and B as the "high nibble":
A.convertTo(A, CV_16U);
B.convertTo(B, CV_16U, 255); // shift 8 bits to the right
left
Mat C = A + B;
3 | No.3 Revision |
no idea, if it really fits your situation, but an easy way to "splice" 2 8bit images into a 16bit one would be:
// our input:
Mat A(h,w,CV_8U);
Mat B(h,w,CV_8U);
now assuming, we want A as the "low nibble", and B as the "high nibble":
A.convertTo(A, CV_16U);
B.convertTo(B, CV_16U, 255); 256); // shift 8 bits to the left
Mat C = A + B;
4 | No.4 Revision |
no idea, if it really fits your situation, but an easy way to "splice" 2 8bit images into a 16bit one would be:
// our input:
Mat A(h,w,CV_8U);
Mat B(h,w,CV_8U);
now assuming, we want A as the "low nibble", and B as the "high nibble":
// if you think in bits, below is:
// 00000000AAAAAAAA
A.convertTo(A, CV_16U);
// BBBBBBBB00000000
B.convertTo(B, CV_16U, 256); // shift 8 bits to the left
// BBBBBBBBAAAAAAAA
Mat C = A + B;