replace custom yuyv_to_rgb24 implementation by cvtColor
This commit is contained in:
parent
80747088e3
commit
838947bb8e
@ -1516,49 +1516,10 @@ yuv411p_to_rgb24(int width, int height,
|
||||
|
||||
#ifdef HAVE_CAMV4L2
|
||||
static void
|
||||
yuyv_to_rgb24 (int width, int height, unsigned char *src, unsigned char *dst)
|
||||
{
|
||||
unsigned char *s;
|
||||
unsigned char *d;
|
||||
int l, c;
|
||||
int r, g, b, cr, cg, cb, y1, y2;
|
||||
|
||||
l = height;
|
||||
s = src;
|
||||
d = dst;
|
||||
while (l--) {
|
||||
c = width >> 1;
|
||||
while (c--) {
|
||||
y1 = *s++;
|
||||
cb = ((*s - 128) * 454) >> 8;
|
||||
cg = (*s++ - 128) * 88;
|
||||
y2 = *s++;
|
||||
cr = ((*s - 128) * 359) >> 8;
|
||||
cg = (cg + (*s++ - 128) * 183) >> 8;
|
||||
|
||||
r = y1 + cr;
|
||||
b = y1 + cb;
|
||||
g = y1 - cg;
|
||||
SAT(r);
|
||||
SAT(g);
|
||||
SAT(b);
|
||||
|
||||
*d++ = b;
|
||||
*d++ = g;
|
||||
*d++ = r;
|
||||
|
||||
r = y2 + cr;
|
||||
b = y2 + cb;
|
||||
g = y2 - cg;
|
||||
SAT(r);
|
||||
SAT(g);
|
||||
SAT(b);
|
||||
|
||||
*d++ = b;
|
||||
*d++ = g;
|
||||
*d++ = r;
|
||||
}
|
||||
}
|
||||
yuyv_to_rgb24(int width, int height, unsigned char* src, unsigned char* dst) {
|
||||
using namespace cv;
|
||||
cvtColor(Mat(height, width, CV_8UC2, src), Mat(height, width, CV_8UC3, dst),
|
||||
COLOR_YUV2BGR_YUYV);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -49,6 +49,7 @@
|
||||
|
||||
#include "opencv2/imgcodecs.hpp"
|
||||
|
||||
#include "opencv2/imgproc.hpp"
|
||||
#include "opencv2/imgproc/imgproc_c.h"
|
||||
#include "opencv2/imgcodecs/imgcodecs_c.h"
|
||||
#include "opencv2/videoio/videoio_c.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user