Results 1 to 8 of 8

Thread: Playing Image Sequence using Qt

  1. #1
    Join Date
    Feb 2016
    Location
    Venice, California
    Posts
    87
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Playing Image Sequence using Qt

    Hello All,
    I'm trying to build a simple player that plays a image sequence. I'm having a lot of trouble finding examples of this in Qt forum. I'm using PyQt, and I'm reading my way through QLabel .
    What I would like to know is,

    How do I read in a image sequence?
    How would I go about playing it in QLabel? (I assume QLabel is what I want to use?)
    How do I make a simple timeline so I can pause, start, stop and scrub the image sequence?

    Any help would be greatly appreciated!

    Thx

  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: Playing Image Sequence using Qt

    In what way do you have access to the images?
    Are they in a directory on disk?
    Do you need to just show a single image at any given time, replacing one with the next at regular intervals?

    Cheers,
    _

  3. #3
    Join Date
    Feb 2016
    Location
    Venice, California
    Posts
    87
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Playing Image Sequence using Qt

    I have a folder on my local drive.

    D:\ElementLibrary\Fire\Fire01\Fire01.001.jpeg
    D:\ElementLibrary\Fire\Fire01\Fire01.002.jpeg
    .....
    Here is a mockup of what I want to make. So...there's a viewer where the car is. Under that is a little timeline that can be used to play oR change frames. When I click on a image in the file browser I want it to automatically start playing.
    http://i67.tinypic.com/5347k3.jpg

    The interface is not an issue...yet...just playing the files. A few people have suggest using Phonon.VideoPlayer. But how do I get it to play image sequence.

    Here is a vid of what someone made. The is the main idea...
    https://vimeo.com/41345071


    Cheers!
    Last edited by Nfrancisj; 12th February 2016 at 19:44.

  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: Playing Image Sequence using Qt

    You don't have a video so don't bother with a video player.

    1) List the directory. QDir::entryInfoList(), and store it the result in a class member

    2) Create a QTimeLine object and connect a local slot to its frameChanged() signal

    3) Set the timeline's frame range form 0 to the number of items in your file list

    4) Start the time line

    5) In the slot connected to frameChanged() get the respective entry from the file list, load into a QPixmap and put that onto the label.

    Cheers,
    _

  5. #5
    Join Date
    Feb 2016
    Location
    Venice, California
    Posts
    87
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Playing Image Sequence using Qt

    Oh my! I think that just went over my head. Hahaha! Might be too advance for me I think.
    I have to read up on qtimeline and pixmap.

    Thank you very much for the direction. I appreciate it. Are there any example code somewhere you can adjust?

  6. #6
    Join Date
    Feb 2016
    Location
    Venice, California
    Posts
    87
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Playing Image Sequence using Qt

    Quote Originally Posted by anda_skoa View Post

    2) Create a QTimeLine object and connect a local slot to its frameChanged() signal

    5) In the slot connected to frameChanged() get the respective entry from the file list, load into a QPixmap and put that onto the label.
    _
    Can pls explain a bit more on #2 & #5 ?
    I don't understand what you mean by connect a local slot to frameChanged()
    I have:

    JpegSeq_PlaceHolderArray // will be Qdir stuff

    QTimelime myTimeline;

    myTimeline.frameChanged(JpegSeq_PlaceHolderArray) // setting frame seq into frame changed.

    Thx.


    Added after 18 minutes:


    Quote Originally Posted by Nfrancisj View Post
    Can pls explain a bit more on #2 & #5 ?
    I don't understand what you mean by connect a local slot to frameChanged()
    I have:

    JpegSeq_PlaceHolderArray // will be Qdir stuff

    QTimelime myTimeline;

    myTimeline.frameChanged(JpegSeq_PlaceHolderArray) // setting frame seq into frame changed.

    Thx.

    Sorry disregard this. I found the class in the docs. http://srinikom.github.io/pyside-doc...QTimeLine.html

    ...
    progressBar = QProgressBar(self)
    progressBar.setRange(0, 100)

    # Construct a 1-second timeline with a frame range of 0 - 100
    timeLine = QTimeLine(1000, self)
    timeLine.setFrameRange(0, 100)
    timeLine.frameChanged[int].connect(progressBar.setValue)

    # Clicking the push button will start the progress bar animation
    pushButton = QPushButton(QObject.tr("Start animation"), self)
    pushButton.clicked.connect(timeLine.start)
    ...
    Last edited by Nfrancisj; 14th February 2016 at 11:19.

  7. #7
    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: Playing Image Sequence using Qt

    And a local slot would be a method of the current class, something like

    ....connect(self.showNextImage)

    def showNextImage(index)

    Cheers,
    _

  8. #8
    Join Date
    Feb 2016
    Location
    Venice, California
    Posts
    87
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Playing Image Sequence using Qt

    Yes, hahaha. I knew the operation, but not the Term local slot.
    Thanks again. I'm sure I'll be back with more questions.

    Cheers!

Similar Threads

  1. Image sequence Questions...
    By Deep Thought in forum Qt Programming
    Replies: 5
    Last Post: 12th February 2016, 11:23
  2. Run QML files one after another in sequence
    By mvbhavsar in forum Newbie
    Replies: 4
    Last Post: 28th October 2013, 05:00
  3. every possible sequence
    By timmu in forum Qt Programming
    Replies: 3
    Last Post: 10th August 2012, 14:36
  4. Replies: 2
    Last Post: 18th June 2011, 08:57
  5. Frame sequence
    By bmn in forum Qt Programming
    Replies: 7
    Last Post: 22nd May 2008, 22:57

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.