mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #25616 from savuor:rv/yuv_docs
YUV codes for cvtColor: descriptions added #25616 This PR contains descriptions for various RGB <-> YUV color conversion codes as well as detailed comments in the source code. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [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 - [ ] 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. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
committed by
GitHub
parent
d97df262f6
commit
1fa96b161f
@@ -115,6 +115,9 @@ void cvtYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
CV_CPU_DISPATCH_MODES_ALL);
|
||||
}
|
||||
|
||||
// 4:2:0, two planes in one array: Y, UV interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
void cvtTwoPlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int dst_width, int dst_height,
|
||||
@@ -129,6 +132,9 @@ void cvtTwoPlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
dst_width, dst_height, dcn, swapBlue, uIdx);
|
||||
}
|
||||
|
||||
// 4:2:0, two planes: Y, UV interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
void cvtTwoPlaneYUVtoBGR(const uchar * y_data, const uchar * uv_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int dst_width, int dst_height,
|
||||
@@ -139,6 +145,9 @@ void cvtTwoPlaneYUVtoBGR(const uchar * y_data, const uchar * uv_data, size_t src
|
||||
cvtTwoPlaneYUVtoBGR(y_data, src_step, uv_data, src_step, dst_data, dst_step, dst_width, dst_height, dcn, swapBlue, uIdx);
|
||||
}
|
||||
|
||||
// 4:2:0, two planes: Y, UV interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
void cvtTwoPlaneYUVtoBGR(const uchar * y_data, size_t y_step, const uchar * uv_data, size_t uv_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int dst_width, int dst_height,
|
||||
@@ -153,6 +162,9 @@ void cvtTwoPlaneYUVtoBGR(const uchar * y_data, size_t y_step, const uchar * uv_d
|
||||
CV_CPU_DISPATCH_MODES_ALL);
|
||||
}
|
||||
|
||||
// 4:2:0, three planes in one array: Y, U, V
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
void cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int dst_width, int dst_height,
|
||||
@@ -166,6 +178,9 @@ void cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
CV_CPU_DISPATCH_MODES_ALL);
|
||||
}
|
||||
|
||||
// 4:2:0, three planes in one array: Y, U, V
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
void cvtBGRtoThreePlaneYUV(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
@@ -179,6 +194,9 @@ void cvtBGRtoThreePlaneYUV(const uchar * src_data, size_t src_step,
|
||||
CV_CPU_DISPATCH_MODES_ALL);
|
||||
}
|
||||
|
||||
// 4:2:0, two planes: Y, UV interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
void cvtBGRtoTwoPlaneYUV(const uchar * src_data, size_t src_step,
|
||||
uchar * y_data, uchar * uv_data, size_t dst_step,
|
||||
int width, int height,
|
||||
@@ -193,6 +211,9 @@ void cvtBGRtoTwoPlaneYUV(const uchar * src_data, size_t src_step,
|
||||
CV_CPU_DISPATCH_MODES_ALL);
|
||||
}
|
||||
|
||||
// 4:2:2 interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
void cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
@@ -206,6 +227,9 @@ void cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
CV_CPU_DISPATCH_MODES_ALL);
|
||||
}
|
||||
|
||||
// 4:2:2 interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 14-bit fixed-point arithmetics is used
|
||||
void cvtOnePlaneBGRtoYUV(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
@@ -379,6 +403,9 @@ void cvtColorYUV2BGR(InputArray _src, OutputArray _dst, int dcn, bool swapb, boo
|
||||
h.depth, dcn, swapb, crcb);
|
||||
}
|
||||
|
||||
// 4:2:2 interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
void cvtColorOnePlaneYUV2BGR( InputArray _src, OutputArray _dst, int dcn, bool swapb, int uidx, int ycn)
|
||||
{
|
||||
CvtHelper< Set<2>, Set<3, 4>, Set<CV_8U>, FROM_UYVY > h(_src, _dst, dcn);
|
||||
@@ -387,6 +414,9 @@ void cvtColorOnePlaneYUV2BGR( InputArray _src, OutputArray _dst, int dcn, bool s
|
||||
dcn, swapb, uidx, ycn);
|
||||
}
|
||||
|
||||
// 4:2:2 interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 14-bit fixed-point arithmetics is used
|
||||
void cvtColorOnePlaneBGR2YUV( InputArray _src, OutputArray _dst, bool swapb, int uidx, int ycn)
|
||||
{
|
||||
CvtHelper< Set<3, 4>, Set<2>, Set<CV_8U>, TO_UYVY > h(_src, _dst, 2);
|
||||
@@ -402,6 +432,9 @@ void cvtColorYUV2Gray_ch( InputArray _src, OutputArray _dst, int coi )
|
||||
extractChannel(_src, _dst, coi);
|
||||
}
|
||||
|
||||
// 4:2:0, three planes in one array: Y, U, V
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
void cvtColorBGR2ThreePlaneYUV( InputArray _src, OutputArray _dst, bool swapb, int uidx)
|
||||
{
|
||||
CvtHelper< Set<3, 4>, Set<1>, Set<CV_8U>, TO_YUV > h(_src, _dst, 1);
|
||||
@@ -424,6 +457,9 @@ void cvtColorYUV2Gray_420( InputArray _src, OutputArray _dst )
|
||||
h.src(Range(0, h.dstSz.height), Range::all()).copyTo(h.dst);
|
||||
}
|
||||
|
||||
// 4:2:0, three planes in one array: Y, U, V
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
void cvtColorThreePlaneYUV2BGR( InputArray _src, OutputArray _dst, int dcn, bool swapb, int uidx)
|
||||
{
|
||||
if(dcn <= 0) dcn = 3;
|
||||
@@ -433,9 +469,10 @@ void cvtColorThreePlaneYUV2BGR( InputArray _src, OutputArray _dst, int dcn, bool
|
||||
dcn, swapb, uidx);
|
||||
}
|
||||
|
||||
// http://www.fourcc.org/yuv.php#NV21 == yuv420sp -> a plane of 8 bit Y samples followed by an interleaved V/U plane containing 8 bit 2x2 subsampled chroma samples
|
||||
// http://www.fourcc.org/yuv.php#NV12 -> a plane of 8 bit Y samples followed by an interleaved U/V plane containing 8 bit 2x2 subsampled colour difference samples
|
||||
|
||||
// 4:2:0, two planes in one array: Y, UV interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
// see also: http://www.fourcc.org/yuv.php#NV21, http://www.fourcc.org/yuv.php#NV12
|
||||
void cvtColorTwoPlaneYUV2BGR( InputArray _src, OutputArray _dst, int dcn, bool swapb, int uidx )
|
||||
{
|
||||
if(dcn <= 0) dcn = 3;
|
||||
@@ -445,6 +482,9 @@ void cvtColorTwoPlaneYUV2BGR( InputArray _src, OutputArray _dst, int dcn, bool s
|
||||
dcn, swapb, uidx);
|
||||
}
|
||||
|
||||
// 4:2:0, two planes: Y, UV interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
void cvtColorTwoPlaneYUV2BGRpair( InputArray _ysrc, InputArray _uvsrc, OutputArray _dst, int dcn, bool swapb, int uidx )
|
||||
{
|
||||
int stype = _ysrc.type();
|
||||
|
||||
@@ -1015,7 +1015,7 @@ struct YCrCb2RGB_i<ushort>
|
||||
|
||||
///////////////////////////////////// YUV420 -> RGB /////////////////////////////////////
|
||||
|
||||
static const int ITUR_BT_601_CY = 1220542;
|
||||
static const int ITUR_BT_601_CY = 1220542;
|
||||
static const int ITUR_BT_601_CUB = 2116026;
|
||||
static const int ITUR_BT_601_CUG = -409993;
|
||||
static const int ITUR_BT_601_CVG = -852492;
|
||||
@@ -1023,14 +1023,14 @@ static const int ITUR_BT_601_CVR = 1673527;
|
||||
static const int ITUR_BT_601_SHIFT = 20;
|
||||
|
||||
// Coefficients for RGB to YUV420p conversion
|
||||
static const int ITUR_BT_601_CRY = 269484;
|
||||
static const int ITUR_BT_601_CGY = 528482;
|
||||
static const int ITUR_BT_601_CBY = 102760;
|
||||
static const int ITUR_BT_601_CRU = -155188;
|
||||
static const int ITUR_BT_601_CGU = -305135;
|
||||
static const int ITUR_BT_601_CBU = 460324;
|
||||
static const int ITUR_BT_601_CGV = -385875;
|
||||
static const int ITUR_BT_601_CBV = -74448;
|
||||
static const int ITUR_BT_601_CRY = 269484; // 0.299055 * (236-16)/256 * (1 << ITUR_BT_601_SHIFT)
|
||||
static const int ITUR_BT_601_CGY = 528482; // 0.586472 * (236-16)/256 * (1 << ITUR_BT_601_SHIFT)
|
||||
static const int ITUR_BT_601_CBY = 102760; // 0.114035 * (236-16)/256 * (1 << ITUR_BT_601_SHIFT)
|
||||
static const int ITUR_BT_601_CRU = -155188; // -0.148 * (1 << (ITUR_BT_601_SHIFT-1))
|
||||
static const int ITUR_BT_601_CGU = -305135; // -0.291 * (1 << (ITUR_BT_601_SHIFT-1))
|
||||
static const int ITUR_BT_601_CBU = 460324; // 0.439 * (1 << (ITUR_BT_601_SHIFT-1))
|
||||
static const int ITUR_BT_601_CGV = -385875; // -0.368 * (1 << (ITUR_BT_601_SHIFT-1))
|
||||
static const int ITUR_BT_601_CBV = -74448; // -0.071 * (1 << (ITUR_BT_601_SHIFT-1))
|
||||
|
||||
//R = 1.164(Y - 16) + 1.596(V - 128)
|
||||
//G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128)
|
||||
@@ -1867,15 +1867,22 @@ static const int RGB2YUV422_SHIFT = 14;
|
||||
// separately. For U and V, they are reduced by half to account for two RGB pixels contributing
|
||||
// to the same U and V values. In other words, the U and V contributions from the two RGB pixels
|
||||
// are averaged. The integer versions are obtained by multiplying the float versions by 16384
|
||||
// and rounding to the nearest integer.
|
||||
// and rounding to the nearest integer so that resulting values are in these bounds:
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
|
||||
int c_RGB2YUV422Coeffs_i[10] = {1024, 8192, 4211, 8258, 1606,
|
||||
-1212, -2384, 3596, -3015, -582};
|
||||
static const int R2Y422 = 4211; // 0.299077 * (236 - 16) / 256 * 16384
|
||||
static const int G2Y422 = 8258; // 0.586506 * (236 - 16) / 256 * 16384
|
||||
static const int B2Y422 = 1606; // 0.114062 * (236 - 16) / 256 * 16384
|
||||
|
||||
static const int R2U422 = -1212; // -0.148 * 8192
|
||||
static const int G2U422 = -2384; // -0.291 * 8192
|
||||
static const int B2U422 = 3596; // 0.439 * 8192
|
||||
static const int G2V422 = -3015; // -0.368 * 8192
|
||||
static const int B2V422 = -582; // -0.071 * 8192
|
||||
|
||||
static inline void RGB2Y(const uchar r, const uchar g, const uchar b, uchar& y)
|
||||
{
|
||||
int y_ = r * c_RGB2YUV422Coeffs_i[2] + g * c_RGB2YUV422Coeffs_i[3] +
|
||||
b * c_RGB2YUV422Coeffs_i[4] + c_RGB2YUV422Coeffs_i[0]*256;
|
||||
int y_ = r * R2Y422 + g * G2Y422 + b * B2Y422 + (1 << RGB2YUV422_SHIFT) * 16;
|
||||
y = saturate_cast<uchar>(((1 << (RGB2YUV422_SHIFT-1)) + y_) >> RGB2YUV422_SHIFT);
|
||||
}
|
||||
|
||||
@@ -1885,12 +1892,10 @@ static inline void RGB2UV(const uchar r1, const uchar g1, const uchar b1,
|
||||
{
|
||||
int sr = r1 + r2, sg = g1 + g2, sb = b1 + b2;
|
||||
|
||||
int u_ = sr * c_RGB2YUV422Coeffs_i[5] + sg * c_RGB2YUV422Coeffs_i[6] +
|
||||
sb * c_RGB2YUV422Coeffs_i[7] + c_RGB2YUV422Coeffs_i[1]*256;
|
||||
int u_ = sr * R2U422 + sg * G2U422 + sb * B2U422 + (1 << (RGB2YUV422_SHIFT-1)) * 256;
|
||||
u = saturate_cast<uchar>(((1 << (RGB2YUV422_SHIFT-1)) + u_) >> RGB2YUV422_SHIFT);
|
||||
|
||||
int v_ = sr * c_RGB2YUV422Coeffs_i[7] + sg * c_RGB2YUV422Coeffs_i[8] +
|
||||
sb * c_RGB2YUV422Coeffs_i[9] + c_RGB2YUV422Coeffs_i[1]*256;
|
||||
int v_ = sr * B2U422 + sg * G2V422 + sb * B2V422 + (1 << (RGB2YUV422_SHIFT-1)) * 256;
|
||||
v = saturate_cast<uchar>(((1 << (RGB2YUV422_SHIFT-1)) + v_) >> RGB2YUV422_SHIFT);
|
||||
}
|
||||
|
||||
@@ -2000,14 +2005,17 @@ void cvtYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
CvtColorLoop(src_data, src_step, dst_data, dst_step, width, height, YCrCb2RGB_f<float>(dcn, blueIdx, isCbCr));
|
||||
}
|
||||
|
||||
typedef void (*cvt_2plane_yuv_ptr_t)(uchar * /* dst_data*/,
|
||||
size_t /* dst_step */,
|
||||
int /* dst_width */,
|
||||
int /* dst_height */,
|
||||
const uchar* /* _y1 */,
|
||||
size_t /* _y1_step */,
|
||||
const uchar* /* _uv */,
|
||||
size_t /* _uv_step */);
|
||||
// 4:2:0, two planes: Y, UV interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
typedef void (*cvt_2plane_yuv_ptr_t)(uchar * /* dst_data */,
|
||||
size_t /* dst_step */,
|
||||
int /* dst_width */,
|
||||
int /* dst_height */,
|
||||
const uchar* /* _y1 */,
|
||||
size_t /* _y1_step */,
|
||||
const uchar* /* _uv */,
|
||||
size_t /* _uv_step */);
|
||||
|
||||
void cvtTwoPlaneYUVtoBGR(const uchar * y_data, size_t y_step, const uchar * uv_data, size_t uv_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
@@ -2035,21 +2043,24 @@ void cvtTwoPlaneYUVtoBGR(const uchar * y_data, size_t y_step, const uchar * uv_d
|
||||
cvtPtr(dst_data, dst_step, dst_width, dst_height, y_data, y_step, uv_data, uv_step);
|
||||
}
|
||||
|
||||
typedef void (*cvt_3plane_yuv_ptr_t)(uchar * /* dst_data */,
|
||||
size_t /* dst_step */,
|
||||
int /* dst_width */,
|
||||
int /* dst_height */,
|
||||
size_t /* _stride */,
|
||||
const uchar* /* _y1 */,
|
||||
const uchar* /* _u */,
|
||||
const uchar* /* _v */,
|
||||
int /* ustepIdx */,
|
||||
int /* vstepIdx */);
|
||||
// 4:2:0, three planes in one array: Y, U, V
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
typedef void (*cvt_3plane_yuv_ptr_t)(uchar * /* dst_data */,
|
||||
size_t /* dst_step */,
|
||||
int /* dst_width */,
|
||||
int /* dst_height */,
|
||||
size_t /* _stride */,
|
||||
const uchar* /* _y1 */,
|
||||
const uchar* /* _u */,
|
||||
const uchar* /* _v */,
|
||||
int /* ustepIdx */,
|
||||
int /* vstepIdx */);
|
||||
|
||||
void cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int dst_width, int dst_height,
|
||||
int dcn, bool swapBlue, int uIdx)
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int dst_width, int dst_height,
|
||||
int dcn, bool swapBlue, int uIdx)
|
||||
{
|
||||
CV_INSTRUMENT_REGION();
|
||||
|
||||
@@ -2075,6 +2086,9 @@ void cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
cvtPtr(dst_data, dst_step, dst_width, dst_height, src_step, src_data, u, v, ustepIdx, vstepIdx);
|
||||
}
|
||||
|
||||
// 4:2:0, three planes in one array: Y, U, V
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
void cvtBGRtoThreePlaneYUV(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
@@ -2093,6 +2107,9 @@ void cvtBGRtoThreePlaneYUV(const uchar * src_data, size_t src_step,
|
||||
cvt(Range(0, height/2));
|
||||
}
|
||||
|
||||
// 4:2:0, two planes: Y, UV interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
void cvtBGRtoTwoPlaneYUV(const uchar * src_data, size_t src_step,
|
||||
uchar * y_data, uchar * uv_data, size_t dst_step,
|
||||
int width, int height,
|
||||
@@ -2109,12 +2126,15 @@ void cvtBGRtoTwoPlaneYUV(const uchar * src_data, size_t src_step,
|
||||
cvt(Range(0, height/2));
|
||||
}
|
||||
|
||||
typedef void (*cvt_1plane_yuv_ptr_t)(uchar * /* dst_data */,
|
||||
size_t /* dst_step */,
|
||||
// 4:2:2 interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 20-bit fixed-point arithmetics
|
||||
typedef void (*cvt_1plane_yuv_ptr_t)(uchar * /* dst_data */,
|
||||
size_t /* dst_step */,
|
||||
const uchar * /* src_data */,
|
||||
size_t /* src_step */,
|
||||
int /* width */,
|
||||
int /* height */);
|
||||
size_t /* src_step */,
|
||||
int /* width */,
|
||||
int /* height */);
|
||||
|
||||
void cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
@@ -2145,6 +2165,9 @@ void cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
cvtPtr(dst_data, dst_step, src_data, src_step, width, height);
|
||||
}
|
||||
|
||||
// 4:2:2 interleaved
|
||||
// Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
// 14-bit fixed-point arithmetics is used
|
||||
void cvtOnePlaneBGRtoYUV(const uchar * src_data, size_t src_step,
|
||||
uchar * dst_data, size_t dst_step,
|
||||
int width, int height,
|
||||
|
||||
@@ -576,6 +576,7 @@ inline int hal_ni_cvtLabtoBGR(const uchar * src_data, size_t src_step, uchar * d
|
||||
@param uIdx U-channel index in the interleaved U/V plane (0 or 1)
|
||||
Convert from YUV (YUV420sp (or NV12/NV21) - Y plane followed by interleaved U/V plane) to BGR, RGB, BGRA or RGBA.
|
||||
Only for CV_8U.
|
||||
Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
*/
|
||||
inline int hal_ni_cvtTwoPlaneYUVtoBGR(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int dst_width, int dst_height, int dcn, bool swapBlue, int uIdx) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
@@ -594,6 +595,7 @@ inline int hal_ni_cvtTwoPlaneYUVtoBGR(const uchar * src_data, size_t src_step, u
|
||||
@param uIdx U-channel index in the interleaved U/V plane (0 or 1)
|
||||
Convert from YUV (YUV420sp (or NV12/NV21) - Y plane followed by interleaved U/V plane) to BGR, RGB, BGRA or RGBA.
|
||||
Only for CV_8U.
|
||||
Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
*/
|
||||
inline int hal_ni_cvtTwoPlaneYUVtoBGREx(const uchar * y_data, size_t y_step, const uchar * uv_data, size_t uv_step,
|
||||
uchar * dst_data, size_t dst_step, int dst_width, int dst_height,
|
||||
@@ -614,6 +616,7 @@ inline int hal_ni_cvtTwoPlaneYUVtoBGREx(const uchar * y_data, size_t y_step, con
|
||||
@param uIdx U-channel plane index (0 or 1)
|
||||
Convert from BGR, RGB, BGRA or RGBA to YUV (YUV420sp (or NV12/NV21) - Y plane followed by interleaved U/V plane).
|
||||
Only for CV_8U.
|
||||
Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
*/
|
||||
inline int hal_ni_cvtBGRtoTwoPlaneYUV(const uchar * src_data, size_t src_step,
|
||||
uchar * y_data, size_t y_step, uchar * uv_data, size_t uv_step,
|
||||
@@ -633,6 +636,7 @@ inline int hal_ni_cvtBGRtoTwoPlaneYUV(const uchar * src_data, size_t src_step,
|
||||
@param uIdx U-channel plane index (0 or 1)
|
||||
Convert from YUV (YUV420p (or YV12/YV21) - Y plane followed by U and V planes) to BGR, RGB, BGRA or RGBA.
|
||||
Only for CV_8U.
|
||||
Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
*/
|
||||
inline int hal_ni_cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int dst_width, int dst_height, int dcn, bool swapBlue, int uIdx) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
@@ -649,6 +653,7 @@ inline int hal_ni_cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step,
|
||||
@param uIdx U-channel plane index (0 or 1)
|
||||
Convert from BGR, RGB, BGRA or RGBA to YUV (YUV420p (or YV12/YV21) - Y plane followed by U and V planes).
|
||||
Only for CV_8U.
|
||||
Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
*/
|
||||
inline int hal_ni_cvtBGRtoThreePlaneYUV(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int scn, bool swapBlue, int uIdx) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
@@ -664,8 +669,9 @@ inline int hal_ni_cvtBGRtoThreePlaneYUV(const uchar * src_data, size_t src_step,
|
||||
@param swapBlue if set to true B and R destination channels will be swapped (write RGB)
|
||||
@param uIdx U-channel index (0 or 1)
|
||||
@param ycn Y-channel index (0 or 1)
|
||||
Convert from UYVY, YUY2 or YVYU to BGR, RGB, BGRA or RGBA.
|
||||
Convert from interleaved YUV 4:2:2 (UYVY, YUY2 or YVYU) to BGR, RGB, BGRA or RGBA.
|
||||
Only for CV_8U.
|
||||
Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
*/
|
||||
inline int hal_ni_cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int dcn, bool swapBlue, int uIdx, int ycn) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
@@ -678,8 +684,9 @@ inline int hal_ni_cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step, u
|
||||
@param swapBlue if set to true B and R destination channels will be swapped (write RGB)
|
||||
@param uIdx U-channel index (0 or 1)
|
||||
@param ycn Y-channel index (0 or 1)
|
||||
Convert from BGR, RGB, BGRA or RGBA to UYVY, YUY2 or YVYU.
|
||||
Convert from BGR, RGB, BGRA or RGBA to interleaved YUV 4:2:2 (UYVY, YUY2 or YVYU).
|
||||
Only for CV_8U.
|
||||
Y : [16, 235]; Cb, Cr: [16, 240] centered at 128
|
||||
*/
|
||||
inline int hal_ni_cvtOnePlaneBGRtoYUV(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int scn, bool swapBlue, int uIdx, int ycn) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user