Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Access IP camera from Qt
Forum Update on Monday, May 27th 2025

Access IP camera from Qt

Scheduled Pinned Locked Moved Solved Mobile and Embedded
ip cameracameraqml
18 Posts 5 Posters 14.9k 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.
  • S SGaist
    21 May 2016, 22:25

    What type of camera is it ?

    M Offline
    M Offline
    mkrr
    wrote on 23 May 2016, 16:59 last edited by
    #6

    @SGaist

    I'm using a camera D-LINK DCS-930L. Thanks

    1 Reply Last reply
    0
    • M mvuori
      22 May 2016, 09:04

      "Very slow" doesn't tell much. But apparently you are asking for a frame every 200 ms, giving 5 fps, which obviously is very slow if you expect normal video display quality...

      M Offline
      M Offline
      mkrr
      wrote on 23 May 2016, 17:07 last edited by
      #7

      @mvuori Yes, I think strange too. But, I'm using the same program to do written on serial port. Each written on serial port is with interval around 300ms. The return of the serial port, is writing on QML too.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 23 May 2016, 20:36 last edited by
        #8

        Are you doing any blocking function call ? e.g. for your serial port ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        M 1 Reply Last reply 23 May 2016, 21:13
        0
        • S SGaist
          23 May 2016, 20:36

          Are you doing any blocking function call ? e.g. for your serial port ?

          M Offline
          M Offline
          mkrr
          wrote on 23 May 2016, 21:13 last edited by
          #9

          @SGaist No, I'm using a Qthread to execute the serial port

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 23 May 2016, 22:22 last edited by
            #10

            Can you describe the various parts of your application so we can ensure that they are not influencing each other.

            By the way, there's no need to set cache each time. Just set the property where you declarer image1. That's one less thing consuming time uselessly.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            M 1 Reply Last reply 2 Jun 2016, 17:16
            0
            • S SGaist
              23 May 2016, 22:22

              Can you describe the various parts of your application so we can ensure that they are not influencing each other.

              By the way, there's no need to set cache each time. Just set the property where you declarer image1. That's one less thing consuming time uselessly.

              M Offline
              M Offline
              mkrr
              wrote on 2 Jun 2016, 17:16 last edited by mkrr 6 Feb 2016, 17:17
              #11

              @SGaist It's my main function:

              int main(int argc, char *argv[])
              {
                  QApplication app(argc, argv);
                  QDeclarativeView *engine = new QmlApplicationViewer();
                  
                  Gps *gps = new Gps(); // Class to read Gps (serial port 0). Interval: 10000ms
                  
                  SerialPort *serial = new SerialPort(); // Read Serial Port (serial port 1). Interval: 300ms
                  
                 if(serial->getMonitor()) {
                      qDebug() << "Starting Monitor";
                      Monitor *monitor = new Monitor(engine, serial);
                      serial->setMonitor(monitor);
                  }
                  return app.exec();
              }
              

              The class SerialPort start the write on serial port with a forever loop. Its working well, without delays.

              When the serial read the response, the response is sent to monitor Class and this class is responsable to format the digits and write on screen (QML file). Therefore, each 300 ms my QML file is updated too (with the response of serial port).

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 2 Jun 2016, 19:51 last edited by
                #12

                Then where's the camera in that setup ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                M 1 Reply Last reply 2 Jun 2016, 20:21
                0
                • S SGaist
                  2 Jun 2016, 19:51

                  Then where's the camera in that setup ?

                  M Offline
                  M Offline
                  mkrr
                  wrote on 2 Jun 2016, 20:21 last edited by
                  #13

                  @SGaist The camera is loaded in a different QML, look:

                  import QtQuick 1.1
                  
                  Rectangle {
                      width: 300
                      height: 400
                  
                      Image {
                          id: camera1
                          objectName: "camera1"
                          x: 39
                          y: 0
                          width: 160
                          height: 120
                          source: "http://192.168.0.110/image/jpeg.cgi"
                          cache: false
                  
                          Timer {
                              interval: 300
                              running: true
                              repeat: true
                              onTriggered: {
                                  camera1.source = "http://192.168.0.110/image/jpeg.cgi";
                              }
                          }
                      }
                  ...
                  }
                  
                  

                  The QML is loaded on Monitor class:

                  Monitor::Monitor(QDeclarativeView *engine, Monitor *m)
                  {
                      engine->setSource(QUrl("qrc:/views/Monitor.qml"));
                  
                      window = qobject_cast< QObject * >( engine->rootObject() );
                  
                      engine->showFullScreen();
                      monitor = m;
                  
                      engine->rootContext()->setContextProperty("mainmonitor",this);
                  }
                  
                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kolegs
                    wrote on 3 Jun 2016, 08:49 last edited by
                    #14

                    You can also try to load next image when previous one is loaded by checking the status.
                    I use this in my application when loading jpeg from cameras.
                    You just need to set 2 Image objects and show them when Image is ready

                    M 1 Reply Last reply 3 Jun 2016, 13:43
                    0
                    • K kolegs
                      3 Jun 2016, 08:49

                      You can also try to load next image when previous one is loaded by checking the status.
                      I use this in my application when loading jpeg from cameras.
                      You just need to set 2 Image objects and show them when Image is ready

                      M Offline
                      M Offline
                      mkrr
                      wrote on 3 Jun 2016, 13:43 last edited by
                      #15

                      @kolegs how I can do to check the status? Could you show an exemple? Are you using the QML Time to update the frames? Thank you

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kolegs
                        wrote on 4 Jun 2016, 11:58 last edited by
                        #16

                        You just need to create two Images with same position add property

                        visible: status == Image.ready
                        

                        and on also add sth like this

                        onStatusChanged:{
                           if(status == Image.ready){
                              //here reload the other image
                              image2.source = "";
                              image2.source = cameraSource;
                           }
                        }
                        

                        Add the same thing in image2 but this timer reload image1

                        onStatusChanged:{
                           if(status == Image.ready){
                              //here reload the other image
                              image1.source = "";
                              image1.source = cameraSource;
                           }
                        }
                        

                        Also at creation just set source to cameraSource for one image and for the other leave it empty,.

                        Hope it helps.

                        M C 2 Replies Last reply 10 Jun 2016, 19:25
                        1
                        • K kolegs
                          4 Jun 2016, 11:58

                          You just need to create two Images with same position add property

                          visible: status == Image.ready
                          

                          and on also add sth like this

                          onStatusChanged:{
                             if(status == Image.ready){
                                //here reload the other image
                                image2.source = "";
                                image2.source = cameraSource;
                             }
                          }
                          

                          Add the same thing in image2 but this timer reload image1

                          onStatusChanged:{
                             if(status == Image.ready){
                                //here reload the other image
                                image1.source = "";
                                image1.source = cameraSource;
                             }
                          }
                          

                          Also at creation just set source to cameraSource for one image and for the other leave it empty,.

                          Hope it helps.

                          M Offline
                          M Offline
                          mkrr
                          wrote on 10 Jun 2016, 19:25 last edited by
                          #17

                          @kolegs Thank you so much. I created this code and the performance was very better. I'm reading two IP cameras now with it.

                          Of course that the delay is existing (each 2 seconds the image is updated). I think that I need to improve my code. I'm using 98% of my CPU, but I need to do many routines :(

                          Thank you so much again

                          1 Reply Last reply
                          0
                          • K kolegs
                            4 Jun 2016, 11:58

                            You just need to create two Images with same position add property

                            visible: status == Image.ready
                            

                            and on also add sth like this

                            onStatusChanged:{
                               if(status == Image.ready){
                                  //here reload the other image
                                  image2.source = "";
                                  image2.source = cameraSource;
                               }
                            }
                            

                            Add the same thing in image2 but this timer reload image1

                            onStatusChanged:{
                               if(status == Image.ready){
                                  //here reload the other image
                                  image1.source = "";
                                  image1.source = cameraSource;
                               }
                            }
                            

                            Also at creation just set source to cameraSource for one image and for the other leave it empty,.

                            Hope it helps.

                            C Offline
                            C Offline
                            claudia0078
                            Banned
                            wrote on 27 Dec 2019, 05:37 last edited by
                            #18
                            This post is deleted!
                            1 Reply Last reply
                            0

                            • Login

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