mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Create an Hyperion image
Former-commit-id: ea4c1a605f618b8581456c4db1ab015bcb46508b
This commit is contained in:
parent
c65cf872d1
commit
f90f076ca4
@ -593,8 +593,7 @@ void V4L2Grabber::process_image(const uint8_t * data)
|
||||
int width = (_width + _pixelDecimation/2) / _pixelDecimation;
|
||||
int height = (_height + _pixelDecimation/2) / _pixelDecimation;
|
||||
|
||||
|
||||
QImage image(width, height, QImage::Format_RGB888);
|
||||
Image<ColorRgb> image(width, height);
|
||||
|
||||
for (int ySource = _pixelDecimation/2, yDest = 0; ySource < _height; ySource += _pixelDecimation, ++yDest)
|
||||
{
|
||||
@ -605,14 +604,14 @@ void V4L2Grabber::process_image(const uint8_t * data)
|
||||
uint8_t u = (xSource%2 == 0) ? data[index] : data[index-2];
|
||||
uint8_t v = (xSource%2 == 0) ? data[index+2] : data[index];
|
||||
|
||||
uint8_t r, g, b;
|
||||
yuv2rgb(y, u, v, r, g, b);
|
||||
|
||||
image.setPixel(xDest, yDest, qRgb(r, g, b));
|
||||
ColorRgb & rgb = image(xDest, yDest);
|
||||
yuv2rgb(y, u, v, rgb.red, rgb.green, rgb.blue);
|
||||
}
|
||||
}
|
||||
|
||||
image.save("screenshot.png");
|
||||
// store as PNG
|
||||
QImage pngImage((const uint8_t *) image.memptr(), width, height, 3*width, QImage::Format_RGB888);
|
||||
pngImage.save("screenshot.png");
|
||||
}
|
||||
|
||||
int V4L2Grabber::xioctl(int request, void *arg)
|
||||
|
@ -4,6 +4,10 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// util includes
|
||||
#include <utils/Image.h>
|
||||
#include <utils/ColorRgb.h>
|
||||
|
||||
/// Capture class for V4L2 devices
|
||||
///
|
||||
/// @see http://linuxtv.org/downloads/v4l-dvb-apis/capture-example.html
|
||||
|
Loading…
Reference in New Issue
Block a user