Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Change video brightness in QGraphicsView not working!

Change video brightness in QGraphicsView not working!

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • vicky.vigiaV Offline
    vicky.vigiaV Offline
    vicky.vigia
    wrote on last edited by
    #1

    Hi Team,

    I am trying to render the video using the GraphicsView display widget and also used QGraphicsView class, but my settings for brightness and saturation etc. are not getting rendered! I have used update() for every object now, just pasting the code, I am strucggeling with:

    m_dragVid->setBrightness(66);
    m_dragVid->setSaturation(77);
    // nothing below works!
    scene->update();
    viditem->update();
    m_dragVid->update();
    ui->graphicsView->update();
    ui->graphicsView->updateSceneRect(m_dragVid->geometry());
    

    Please help me!

    Best,
    Vicky

    Pl45m4P 1 Reply Last reply
    0
    • vicky.vigiaV vicky.vigia

      Hi Team,

      I am trying to render the video using the GraphicsView display widget and also used QGraphicsView class, but my settings for brightness and saturation etc. are not getting rendered! I have used update() for every object now, just pasting the code, I am strucggeling with:

      m_dragVid->setBrightness(66);
      m_dragVid->setSaturation(77);
      // nothing below works!
      scene->update();
      viditem->update();
      m_dragVid->update();
      ui->graphicsView->update();
      ui->graphicsView->updateSceneRect(m_dragVid->geometry());
      

      Please help me!

      Best,
      Vicky

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      Hi @vicky-vigia,

      I guess your "video" is a QVideoWidget?! Then check out this: https://bugreports.qt.io/browse/QTBUG-35299 and have a look at this example (https://doc.qt.io/qt-5/qtmultimedia-multimediawidgets-player-example.html)

      Or what kind of type is m_dragVid?
      Is there a reason why you are using a QGraphicsView for your video?


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      1
      • vicky.vigiaV Offline
        vicky.vigiaV Offline
        vicky.vigia
        wrote on last edited by
        #3

        Thank you for your reply.
        Yes, my video is a QVideoWidget (m_dragVid).
        The reason I am using QGraphicsView is that I want to render multiple video objects on my layout. And each can be moved, resized, basically interacted via mouse and UI controls separately. I tried doing the same using QVideoWidgets but wasn't able to, maybe I was doing it wrong!

        Best,
        Vicky

        Pl45m4P 1 Reply Last reply
        0
        • vicky.vigiaV vicky.vigia

          Thank you for your reply.
          Yes, my video is a QVideoWidget (m_dragVid).
          The reason I am using QGraphicsView is that I want to render multiple video objects on my layout. And each can be moved, resized, basically interacted via mouse and UI controls separately. I tried doing the same using QVideoWidgets but wasn't able to, maybe I was doing it wrong!

          Best,
          Vicky

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by Pl45m4
          #4

          @vicky-vigia

          What about a QDockWidget with a QVideoWidget inside for each video? You can move them around on your parent (docking area) window and resize / edit all of them separately.


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          1 Reply Last reply
          2
          • vicky.vigiaV Offline
            vicky.vigiaV Offline
            vicky.vigia
            wrote on last edited by
            #5

            Okay, I will try this and come back here!

            Thanks for your guidance!

            1 Reply Last reply
            1
            • vicky.vigiaV Offline
              vicky.vigiaV Offline
              vicky.vigia
              wrote on last edited by
              #6

              Hi Team,

              I am back! The QDockWidget(QVideoWidget) is working now, thanks! But, not sure, if this is what I want. As I am unable to resize it, while the video is running, using the UI controls in my main window.

              I want to set the position of the video, which is in my dockwidget, using a text field to let's say providing X, Y location. The code I tried is:

              void MainWindow::on_txtLocationX_textChanged(const QString &arg1)
              {
                  int ypos = ui->txtLocationY->text().toInt();
                  ui->dockVid->setGeometry(10, ypos, 200, 200);
              
              }
              

              And similarly for rotation. Cause now, if I do the following, it crashes!

              m_dragVid->rotateVideo(10);
              

              Thanks again for your help!

              Pl45m4P 1 Reply Last reply
              0
              • vicky.vigiaV vicky.vigia

                Hi Team,

                I am back! The QDockWidget(QVideoWidget) is working now, thanks! But, not sure, if this is what I want. As I am unable to resize it, while the video is running, using the UI controls in my main window.

                I want to set the position of the video, which is in my dockwidget, using a text field to let's say providing X, Y location. The code I tried is:

                void MainWindow::on_txtLocationX_textChanged(const QString &arg1)
                {
                    int ypos = ui->txtLocationY->text().toInt();
                    ui->dockVid->setGeometry(10, ypos, 200, 200);
                
                }
                

                And similarly for rotation. Cause now, if I do the following, it crashes!

                m_dragVid->rotateVideo(10);
                

                Thanks again for your help!

                Pl45m4P Offline
                Pl45m4P Offline
                Pl45m4
                wrote on last edited by Pl45m4
                #7

                @vicky-vigia said in Change video brightness in QGraphicsView not working!:

                As I am unable to resize it, while the video is running, using the UI controls in my main window

                Resizing the DockWidget-Window as well as the QVideoWidget inside the dockWidget should work with your UI-controls.

                @vicky-vigia said in Change video brightness in QGraphicsView not working!:

                m_dragVid->rotateVideo(10);

                In this example (https://doc.qt.io/archives/qt-5.6/qtmultimedia-multimediawidgets-videographicsitem-videoplayer-cpp.html) the video is a QGraphicsVideoItem type. Did you use the code from this example?


                If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                ~E. W. Dijkstra

                1 Reply Last reply
                1
                • vicky.vigiaV Offline
                  vicky.vigiaV Offline
                  vicky.vigia
                  wrote on last edited by
                  #8

                  Thanks for the reply.
                  I tried resizing the dock + video, it resized but crashed, it seems I am messing up with the position and H and W params, will try more and I think I can fix that!

                  I have followed the MediaPlayer example. What is the name of the example, you have referred to? I will do a lookup in my QT editor.

                  Best,
                  Vicky

                  Pl45m4P 1 Reply Last reply
                  0
                  • vicky.vigiaV vicky.vigia

                    Thanks for the reply.
                    I tried resizing the dock + video, it resized but crashed, it seems I am messing up with the position and H and W params, will try more and I think I can fix that!

                    I have followed the MediaPlayer example. What is the name of the example, you have referred to? I will do a lookup in my QT editor.

                    Best,
                    Vicky

                    Pl45m4P Offline
                    Pl45m4P Offline
                    Pl45m4
                    wrote on last edited by Pl45m4
                    #9

                    @vicky-vigia

                    The code file from my last reply is from this Qt example: https://doc.qt.io/archives/qt-5.6/qtmultimedia-multimediawidgets-videographicsitem-example.html

                    @vicky-vigia said in Change video brightness in QGraphicsView not working!:

                    I tried resizing the dock + video, it resized but crashed, it seems I am messing up with the position and H and W params, will try more and I think I can fix that!

                    Depends on what you need and what kind of video do you have. If you have access to all single frames of each video, you could also show the frames as QLabel, but then there is no myVid->setSaturation() :)


                    If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                    ~E. W. Dijkstra

                    1 Reply Last reply
                    1
                    • vicky.vigiaV Offline
                      vicky.vigiaV Offline
                      vicky.vigia
                      wrote on last edited by
                      #10

                      Thank you for your reply. I will check the example and learn more from it.

                      Regarding rendering frames as QLabel objects, I want to know more. As I am planning to use FFMPEG and do some advance video-frames manipulations like these and these and some more.

                      Any help, suggestions, pointers to the right documentation and examples, is much appreciated!

                      Pl45m4P 1 Reply Last reply
                      0
                      • vicky.vigiaV vicky.vigia

                        Thank you for your reply. I will check the example and learn more from it.

                        Regarding rendering frames as QLabel objects, I want to know more. As I am planning to use FFMPEG and do some advance video-frames manipulations like these and these and some more.

                        Any help, suggestions, pointers to the right documentation and examples, is much appreciated!

                        Pl45m4P Offline
                        Pl45m4P Offline
                        Pl45m4
                        wrote on last edited by Pl45m4
                        #11

                        @vicky-vigia said in Change video brightness in QGraphicsView not working!:

                        Regarding rendering frames as QLabel objects, I want to know more

                        You can use a QLabel as placeholder to display images / video frames.

                        @vicky-vigia said in Change video brightness in QGraphicsView not working!:

                        As I am planning to use FFMPEG and do some advance video-frames manipulations

                        You can use FFMPEG for your manipulations and show the result in your Qt GUI.
                        Have a look here:
                        https://www.bogotobogo.com/Qt/Qt5_QProcess_QFileDialog_QTextEdit_FFmpeg.php
                        and here:
                        https://www.bogotobogo.com/Qt/Qt5_QWebView_FFmpeg_Converter_Media_Player.php

                        void Dialog::on_playInputButton_clicked()
                        {
                            QString program = "C:/FFmpeg/bin/ffplay";
                            QStringList arguments;
                            QString input = ui->fromLineEdit->text();
                            arguments << input;
                            mInputPlayProcess->start(program, arguments);
                        }
                        

                        You can set your arguments inside your GUI to convert / edit the video.


                        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                        ~E. W. Dijkstra

                        1 Reply Last reply
                        2
                        • vicky.vigiaV Offline
                          vicky.vigiaV Offline
                          vicky.vigia
                          wrote on last edited by vicky.vigia
                          #12

                          Alright, awesome, thanks!
                          Any related example for QLabel?

                          - Vicky
                          
                          Pl45m4P 1 Reply Last reply
                          0
                          • vicky.vigiaV vicky.vigia

                            Alright, awesome, thanks!
                            Any related example for QLabel?

                            - Vicky
                            
                            Pl45m4P Offline
                            Pl45m4P Offline
                            Pl45m4
                            wrote on last edited by
                            #13

                            @vicky-vigia

                            Here's everything you need to know about QLabel (https://doc.qt.io/qt-5/qlabel.html)
                            setPicture or setPixmap for single images / frames
                            (In one of my projects I use OpenCV to display video frames from webcam on a QLabel).


                            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                            ~E. W. Dijkstra

                            1 Reply Last reply
                            2

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved