Results 1 to 6 of 6

Thread: QImage contains smaller QImage

  1. #1
    Join Date
    Nov 2015
    Posts
    67

    Default QImage contains smaller QImage

    how can i check if a large QImage contains a smaller QImage?

    Lets say in the large QImage contains is a picture of a cat (the cat in this image has the same size as the cat in the following small Qimage) and the small QImage is the cat. Now i want to know if the small QImage so the cat is in the large QImage.

    thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    866
    Thanks
    69
    Thanked 58 Times in 56 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QImage contains smaller QImage

    Hi,

    There is no nothing to do with Qt.
    You have to use some kind of machine vision algorithm. You can check some free machine vision libraries like OpenCV. Take a look at template matching.
    Òscar Llarch i Galán

  3. #3
    Join Date
    Nov 2015
    Posts
    67

    Default Re: QImage contains smaller QImage

    Can i compare to certain areas (not single pixels) of two QImages somehow with Qt?

  4. #4
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    866
    Thanks
    69
    Thanked 58 Times in 56 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QImage contains smaller QImage

    Hi,

    You will have to create your own algorithm. As I told you, Qt does not have machine vision algorithms.

    You can create sub-images of the main image and compare every pixel with the "pattern image" but this a very slow alorithm. Machine vision libraries have more powerful techniques that will be faster. Using OpenCV you can create a Mat image passing the QImage pixel pointer and then apply a pattern matching process.
    Òscar Llarch i Galán

  5. #5
    Join Date
    Nov 2015
    Posts
    67

    Default Re: QImage contains smaller QImage

    opencv seems ununable for somebody who never worked with it. There is like no good documentation how to use it in qt. Every video on youtube is for old versions, in the new ones every path of the files is different and an official documentation also misses necessary information. Is there a other libary for Qt, which can do the same things?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QImage contains smaller QImage

    If the pattern (cat) is pixel-perfect identical to the cat in the picture then a naive algorithm would be to scan the big image pixel by pixel until you find a pixel that is identical to the top-left pixel in the pattern. When such pixel is found, try to match all the remaining pixels of the pattern (break on first non-matching pixel). Unless a match is found, continue scanning the original image.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. How to add new QImage to the left side of old QImage??
    By ganapathi in forum Qt Programming
    Replies: 7
    Last Post: 16th February 2016, 08:54
  2. Replies: 5
    Last Post: 16th May 2011, 21:15
  3. QImage
    By hazardpeter in forum Newbie
    Replies: 2
    Last Post: 31st July 2009, 15:19
  4. What's faster: QPixmap-to-QImage or QImage-to-QPixmap
    By forrestfsu in forum Qt Programming
    Replies: 2
    Last Post: 15th December 2006, 17:11
  5. Replies: 3
    Last Post: 15th March 2006, 11:44

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.