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. Qimagereader and cliprect example
Forum Updated to NodeBB v4.3 + New Features

Qimagereader and cliprect example

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 875 Views 2 Watching
  • 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.
  • B Offline
    B Offline
    BinuJanardhanan
    wrote on last edited by
    #1

    I am developing an image viewer to load and show high-resolution image. I am planning to use Qimagereader and cliprect function.
    Anybody please help me to know how to map the region of interest coordinate maping to high resolution image.
    That means how can i use cliprect function ?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      I have not seem any examples so i made you one.

      
      #include <QImageReader>
      #include <QDebug>
      
      MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
      {
          ui->setupUi(this);
      
          QImageReader reader("e:/test.jpg");
          reader.setClipRect(QRect(100, 100, 100, 100));
          QImage img;
          if ( reader.canRead()) {
              img = reader.read();
              ui->label->setPixmap(QPixmap::fromImage(img)); // test show it
          } else
              qDebug() << "cannot read image";
      

      that will load and draw 100,100, to 200,200 from the test image

      alt text

      and result is
      alt text

      and seems to check out in photoshop
      alt text

      I didnt have any real satelite images to test with.

      B 1 Reply Last reply
      2
      • mrjjM mrjj

        Hi
        I have not seem any examples so i made you one.

        
        #include <QImageReader>
        #include <QDebug>
        
        MainWindow::MainWindow(QWidget *parent) :
            QMainWindow(parent),
            ui(new Ui::MainWindow)
        {
            ui->setupUi(this);
        
            QImageReader reader("e:/test.jpg");
            reader.setClipRect(QRect(100, 100, 100, 100));
            QImage img;
            if ( reader.canRead()) {
                img = reader.read();
                ui->label->setPixmap(QPixmap::fromImage(img)); // test show it
            } else
                qDebug() << "cannot read image";
        

        that will load and draw 100,100, to 200,200 from the test image

        alt text

        and result is
        alt text

        and seems to check out in photoshop
        alt text

        I didnt have any real satelite images to test with.

        B Offline
        B Offline
        BinuJanardhanan
        wrote on last edited by
        #3

        @mrjj Thank you.

        I am looking for one more example. i e i am having a scaled image of an actual high resoultion image and that showing it in the application first.And i select a portion of the scaled image as region of interset via a rectangle draw and then i collect the region interest coorinates. Now i want to load that region of interest area from the actual high resolution image to the another widget of the application. So my question is how can i map the coordinates from the scaled image to actual high resolution image. ?

        jsulmJ 1 Reply Last reply
        0
        • B BinuJanardhanan

          @mrjj Thank you.

          I am looking for one more example. i e i am having a scaled image of an actual high resoultion image and that showing it in the application first.And i select a portion of the scaled image as region of interset via a rectangle draw and then i collect the region interest coorinates. Now i want to load that region of interest area from the actual high resolution image to the another widget of the application. So my question is how can i map the coordinates from the scaled image to actual high resolution image. ?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @BinuJanardhanan You ask exact same question in another thread!
          Please do not duplicate your questions!

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          B 1 Reply Last reply
          0
          • jsulmJ jsulm

            @BinuJanardhanan You ask exact same question in another thread!
            Please do not duplicate your questions!

            B Offline
            B Offline
            BinuJanardhanan
            wrote on last edited by
            #5

            @jsulm sorry for that.
            I put that question as a reply to the answer , i thought so he can easly identify my doubt. that why..

            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi
              . So my question is how can i map the coordinates from the scaled image to actual high resolution image. ?

              well, you have to calculate the other way of what you did to make it "scaled".

              B 1 Reply Last reply
              1
              • mrjjM mrjj

                Hi
                . So my question is how can i map the coordinates from the scaled image to actual high resolution image. ?

                well, you have to calculate the other way of what you did to make it "scaled".

                B Offline
                B Offline
                BinuJanardhanan
                wrote on last edited by
                #7

                @mrjj thanks.

                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