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. [SOLVED] How to compare two images?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] How to compare two images?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 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.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    I want to compare 2 images to find out if they are the same pixel by pixel..

    so 1st thought was to compare them pixel by pixel with "QImage::pixel":http://doc.qt.digia.com/stable/qimage.html#pixel-2
    2nd to use the "scanLine":http://doc.qt.digia.com/stable/qimage.html#scanLine

    is there any other way?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sidewinder
      wrote on last edited by
      #2

      What about "QImage::operator==":http://doc.qt.digia.com/stable/qimage.html#operator-eq-eq ?

      "Never memorize what you can look up in books."
      Albert Einstein

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Code_ReaQtor
        wrote on last edited by
        #3

        There is another way I heard of... "Perceptual Hash":http://phash.org/ , but never tried it. In any way, pixel by pixel or scanline might be problematic if the size of the 2 images are not the same or the color was modified in any way (e.g. losses).

        Please visit my open-source projects at https://github.com/Code-ReaQtor.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Or you just do a memcmp on the data representing each image.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Leon
            wrote on last edited by
            #5

            [quote author="sidewinder" date="1360841983"]What about "QImage::operator==":http://doc.qt.digia.com/stable/qimage.html#operator-eq-eq ?[/quote]

            Works perfectly and takes only 4 milleseconds to compare 2 images of 300 kb :)
            Thank u!

            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