Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Algorithms
  4. Alogorithim to compare two pictures

Alogorithim to compare two pictures

Scheduled Pinned Locked Moved Algorithms
4 Posts 4 Posters 4 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.
  • W Offline
    W Offline
    w209
    wrote on last edited by
    #1

    hey can any one give me an algorithim on comparing two pictures

    L F S 3 Replies Last reply
    0
    • W w209

      hey can any one give me an algorithim on comparing two pictures

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      public static bool ImagesEqual(image1, image2) {
      if (wid1!=wid2) return false;
      if (hei1!=hei2) return false;
      if (crc1!=crc2) return false;
      foreach(PixelPair p1,p2 in image1,image2) if (p1!=p2) return false;
      return true;
      }

      Luc Pattyn [Forum Guidelines] [My Articles]


      this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google


      1 Reply Last reply
      0
      • W w209

        hey can any one give me an algorithim on comparing two pictures

        F Offline
        F Offline
        FriendOfAsherah
        wrote on last edited by
        #3

        Would use XOR functions ( blend with XOR , I think its possible with GDI images ... I used it some time ago to overlay two biztmaps to see where tehre is a differnce )

        1 Reply Last reply
        0
        • W w209

          hey can any one give me an algorithim on comparing two pictures

          S Offline
          S Offline
          schoetbi
          wrote on last edited by
          #4

          Hi, it depends what you like to match. If the pictures need to be exactly == binary identical, you could just use a md5 checksum, or something like this. If you want to search for "similar" pictures e.g. showing the same thing but scaled (image for email, etc. ) then you could use a cooccourence matrix over the colors in the image. If you want to check also if the contrast was changed then you need an even more elaborate algorithm, maybe doing a color histogram and then do a cross correllation. But these are only ideas... Regards, Tobias

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups