Results 1 to 14 of 14

Thread: Processing and Displaying Image on Widget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2016
    Posts
    7
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Processing and Displaying Image on Widget

    OK, I got everything working as the base of my project. At this point I can communicate with camera, and receive its frames, and just display them in my widget.
    But I have an issue.
    My camera supports up to 100 frames/sec, but I am barely displaying 15 frames/sec.
    My camera resolution is 480x640 and I am just receiving 8bits grayscale frames. So each frame has 480 x 640 x 8 = 300KBytes of data and if I want to receive them at rate of 100 fps, I have to receive them 300KBytes/frame x 100 frames/sec = 30000 KBytes/sec, about 30MBytes/sec, which is half of the speed of the USB2.0. So I think my USB2.0 should be able to do handle that amount of data transfer.

    So I think the issue is in my software, but I am not doing any processing in my code, I am just displaying frames. I have created a class with a paint event, and I have promoted a Qwidget to this class to display on it.

    I don't know if Qwidget can handle transferring this amount of data?
    Does any one has any suggestion or solution?

    cheers

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Processing and Displaying Image on Widget

    For such high througput rendering you probably have to use a more direct rendering approach, e.g. OpenGL.

    It might be worthwhile to look into creating a QCamera backend and then use the existing video widget infrastructure.

    Cheers,
    _

  3. #3
    Join Date
    Mar 2016
    Posts
    7
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Processing and Displaying Image on Widget

    Do you know any tutorials that start from foundation and builds up to it?
    I don't have any experience with OpenGL.
    I found most tutorials to be about QGLWidget.
    But in the new versions of Qt 5, QOpenGLWidget is intended to be a modern replacement for QGLWidget.
    I haven't been able find a good tutorial for QOpenGLWidget.

    cheers

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Processing and Displaying Image on Widget

    No, sorry, I haven't had anything to do with that yet myself either.

    Cheers,
    _

  5. #5
    Join Date
    Mar 2016
    Posts
    7
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Processing and Displaying Image on Widget

    I was wondering if this would work?
    a function is getting a pointer to a QImage as a parameter.
    I want to copy the entire QImage to a buffer of that is going to hold 100 QImages.

    Qt Code:
    1. public:
    2. void function(QImage *frame);
    3.  
    4. protected:
    5. enum{size = 100};
    6. QImage *data[size];
    7. int front; // points to the front of the buffer
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void Buffer::function(QImage *frame)
    2. {
    3. ++front; // Increment front.
    4. if (front == size)
    5. front = 0; // Wrap around.
    6.  
    7. data[front] = frame;
    8. }
    To copy to clipboard, switch view to plain text mode 

    cheers

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Processing and Displaying Image on Widget

    Sure, why not.
    I assume you handle deletion of the QImage pointers somewhere else?

    Cheers,
    _

Similar Threads

  1. Replies: 7
    Last Post: 2nd December 2013, 16:06
  2. image processing
    By IRON_MAN in forum Qt Programming
    Replies: 4
    Last Post: 18th November 2009, 13:37
  3. Image processing
    By NicNac in forum Newbie
    Replies: 25
    Last Post: 2nd November 2008, 10:05
  4. Image processing via matrix
    By jones.79 in forum Qt Programming
    Replies: 10
    Last Post: 22nd September 2008, 00:42
  5. Image Processing using Qt
    By danielperaza in forum Qt Programming
    Replies: 2
    Last Post: 9th March 2008, 18:15

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.