Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjust Brightness for qvideowidget inserted into the QGraphicsscene and QGraphicsView

Tags:

qt

I am playing video using the Qgrpahicsscene, QgraphicsView, qvideowidget

videoWidget = new QVideoWidget;

QGraphicsScene *scene = new QGraphicsScene;

QGraphicsView *graphicsView = new QGraphicsView(scene);

scene->addWidget(videoWidget);

the video playing correctly, what i need is when i adjust brightness in videowidget it is not reflecting and i have checked the videowidget brightness level it is setting. please share some ideas, thanks in advance

like image 293
Sivam Avatar asked Oct 04 '22 03:10

Sivam


2 Answers

Update the scene after the change of brightness. Like this:

videoWidget->setBrightness(bright);
scene->update(scene->sceneRect());
like image 153
Roney Gomes Avatar answered Oct 13 '22 10:10

Roney Gomes


You can achieve pretty much all kinds of effects and corrections with the use of shaders, brightness in particular is a very simple fragment shader, just multiply each pixel's luminosity by a real multiplier. With QML you even have the ready to use shader effects as well as the QML video effects example.

Brightness/Contrast

All ready to use effects

QML video effects example

You could use shaders even with widgets if you go for a QGLWidget base widget and still get the great performance.

like image 20
dtech Avatar answered Oct 13 '22 10:10

dtech