Read sequence of image



  • Hello!

    Hello I would like to read images from the same folder after each other. I know how can I open one image, but now I would like to give the folder name and make the same image processing on each image in the folder.

    Could you help me how can I do that?

    Andras


  • Moderators

    This reads all jpg and png files:
    @
    QDir dir("<path-to-dir>");
    foreach( QFileInfo imageFileInfo, dir.entryInfoList ( QStringList() << ".jpg" << ".png", QDir::Files, QDir::NoSort )
    {
    QFile imageFile( imageFileInfo.absoluteFilePath() );
    //do your reading like you already did
    }
    @



  • Thank you! This QStringList was that what I am looking for.



  • A small bug:forgot a parenthese in line 2
    [quote author="raven-worx" date="1368709740"]This reads all jpg and png files:
    @
    QDir dir("<path-to-dir>");
    foreach( QFileInfo imageFileInfo, dir.entryInfoList ( QStringList() << ".jpg" << ".png", QDir::Files, QDir::NoSort )
    {
    QFile imageFile( imageFileInfo.absoluteFilePath() );
    //do your reading like you already did
    }
    @[/quote]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.