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. Is there a simple way to access pixels of an image informations and manipulate them in Qt?
Forum Updated to NodeBB v4.3 + New Features

Is there a simple way to access pixels of an image informations and manipulate them in Qt?

Scheduled Pinned Locked Moved General and Desktop
10 Posts 2 Posters 2.5k Views 1 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.
  • H Offline
    H Offline
    hor_313
    wrote on last edited by
    #1

    Hi dears

    I want to know in an image I have loaded in my program , what are the values of RGB of every pixels?
    Is there a simple way for it in Qt or I must use some libraries like OpenCV?

    Thanks a lot

    1 Reply Last reply
    0
    • U Offline
      U Offline
      utcenter
      wrote on last edited by
      #2

      Yes, you need the QImage class. It allows pixel level access.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hor_313
        wrote on last edited by
        #3

        [quote author="utcenter" date="1367673243"]Yes, you need the QImage class. It allows pixel level access.[/quote]

        Can you take an example? :D

        1 Reply Last reply
        0
        • U Offline
          U Offline
          utcenter
          wrote on last edited by
          #4

          You can get the pixel information:
          @
          uint color = image.pixel(10, 10);@

          color will be a 4x8 bit components of the color of the pixel at x 10 and y 10

          @image.setPixel(20, 20, color);@

          the pixel at x 20 and y 20 will become the same color as the pixel at 10 10

          1 Reply Last reply
          0
          • H Offline
            H Offline
            hor_313
            wrote on last edited by
            #5

            Thanks a lot dear friend

            I want to read the all RGB values of all pixels of an image and show them in a textplain box

            can you take an example about this :D

            1 Reply Last reply
            0
            • U Offline
              U Offline
              utcenter
              wrote on last edited by
              #6

              It is not that hard to do that yourself, plus I don't think I'd be making you a favor if I do what begin to suspect is your homework for you.

              1 Reply Last reply
              0
              • H Offline
                H Offline
                hor_313
                wrote on last edited by
                #7

                [quote author="utcenter" date="1367679753"]It is not that hard to do that yourself, plus I don't think I'd be making you a favor if I do what begin to suspect is your homework for you.[/quote]

                ok , thank you
                but what is the unit in your example?
                is it a type or a structure?

                1 Reply Last reply
                0
                • U Offline
                  U Offline
                  utcenter
                  wrote on last edited by
                  #8

                  uint is an unsigned int. Sounds like you need a little more C++ before you rush into Qt, you really need the basics. Otherwise you wouldn't need help with such a simple assignment.

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    hor_313
                    wrote on last edited by
                    #9

                    Oh I got it :))

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      hor_313
                      wrote on last edited by
                      #10

                      I read it unit !! :D

                      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