Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.

Archive for February, 2013

Hell! It’s about time!

Finally it’s time to show something off. No more boring talk about things happening too slow and that I work behind the scenes with nothing that can be showed off. Now finally something to show off beginning of the work and how the program will do its comparison. I haven’t done the transforms myself, I am using OpenCV for this, but now I can practically show it. I expect by end of week have a “simple” image comparison to show off, using Hu Invariants.


First this is how the picture looks like before anything is done with it. It’s my pretty debug picture I talked about before.


This is how it looks like after I have transformed it into grey scale instead.


The grey scale picture is then turned into a binary image, by using adaptive thresholding. The thresholding adapts pixel for pixel, and compare it to it’s neighbours for a thresholding. It gives off some sort of contours, and removes noise in the picture. Probably lots of work can be put here to ensure the thresholding have good parameters or even tests a few different for best result.


The binary image is then used to take out the contours of the image. The contours can then be used to create Central moments and with that Hu invariants. Using Hu invariants two shapes can then be compared to each other, independant of roation. This steps shown off right now is just the basic first steps, required for more complex things, and does not really show off any work I have done, it’s just graphical and thus is easy to show. I hope that by end of week have something more exciting to show off that shows off something I have actually done and not just showing that I can make a library run.




This might not look too exciting, what this is, is that the picture is loaded in through a QT gui, sent to OpenCV, handled by OpenCV, then converted to QTs format and printed out on the screen.

The picture on screen is 512×512 and is a test picture to see if anything weird happens , and if something weird happens it’s easy to identify what is happening.

Base is done.

Basics of the program is up and running. There isn’t really much to show, since it’s pretty boring behind the scene stuff.


I have stumbled upon some problems here and there, and realized my lack of experience slapping me in the face a few times.

Slow week

Monday was planned milestone, but my presentation got delayed to Tuesday. From Wednesday on I have been starting to lay down the ground work. I have decided to use OpenCV, since it gives me so much help manipulating pictures.  The boredom of making a library work, slowed down the pace slightly. I am not very good at doing things I don’t find fun, but with some slow but steady struggling I now have OpenCV up and running in my program.

Next week I will finally get to implement my algorithms, and I can see how well they will work in action. That will be the make or break of it. I will see how well my theoretical idea works out in the end. I expect some things will pose problems, and I will notice what my algorithm will handle and what it wont. By end of next week I will probably have something up.

Milestone 2

Milestone two is done now. It’s supposed to be proof of concept, but since my project was more research centric, I didn’t really have a proof of concept but more like a concluded research.

Milstone 2

Conclusion of the week.

Like Rebecca Black says; “It’s Friday”. The work week is done, and on Monday there is the second milestone. I will discuss and tell about the techniques I have decided to work with now.

First off I will be using a combination of Fourier Descriptors and Hu Moments to describe my pictures. To use them I will  find contours of my picture and then I will use HuM/FD to describe the contours. Then using the HuM/FD I will compare it to another picture. Comparisons done that way will ignore rotation, translation, skewing, and scaling. Doing comparisons using HuM’s is very easy and can be done fast on already pre processed pictures.

Step by step:

  • Take the picture turn it into greyscale since colour is irrelevant.
  • Find the contours of all shapes in the picture
  • Turn the contours into fourier descriptions and Central Moments, which then is turned into Hu Moments.
  • Compare fourier descriptors and Hu Moments between two pictures.

Compare colour by taking a histogram of picture and by mixing together pixels into bigger groups and compare those. Colour is secondary to shape and will just be a nice extra feature, for slightly better results.

For searching the Hu moments will be used as a low cost comparison, and a general colour of picture as well. I will probably discuss more details about searching the future since right now main focus is to get single picture comparison to work. I still have to figure out how to compare pictures when there is very many shapes in the picture in which order to compare them etc.

Third and last week of research

Being in the middle of my third week of research. I finally found the grand father of papers on the topic of image comparison and pattern recognition; “Visual  Pattern  Recognition  by  Moment  Invariants” by Hu Ming-Kuei from 1962.

In this paper he makes mathematical proofs for and explains how his 7 invariants works. They are usually used for pattern recognition independent of rotation, translation, mirroring and skewing. Pretty much every paper on the topic refers back to his paper. It seems to be a cornerstone, and while I haven’t fully grasped how to use it and how to combine it with other things, what seems to be a strong solution for my problem is to combine his invariants with  fourier transformations.

If things works out as planned I have a working solution both for comparison and searching. End of week I will probably write some more details about everything and some sort of conclusion of my research. I will write about my solution and explain how it works a bit then.

Tons of research

After a initial week or writing documents, and doing some research, my research was a bit lacking, and what I had so far was a bit lacking. The nature of the project also means it is in need of a longer period of research than just one week. The week have been spent reading papers about image comparison, Fourier transformation and uses of it, and looking at Google image search. Also I will most probably be using OpenCV to not have to ease my workload a little bit and focus more on the algorithm.

Fourier Transfrom

Showing off a pretty Fourier transform. For now I just leave this in the air, I will most probably be using Fourier transformation, and I will talk more about them when more details are fleshed out.

Making an algorithm that can take any image and compare it to any other without any restriction probably is too difficult to accomplish during this 2 month project, so I will need to put down some restrictions. Focus will be on comparison of shapes in pictures IE a grey scale picture(or conversion to that). And then a simple colour comparison will be run by using a histogram of the colours. Comparison will also be restricted to pictures of same size, but hopefully it will be able to detect rotations. This is the initial plan, next week will focus on how to do the shape comparing.

Kudos to Dr Johannes Hirche for input and feedback on project, and for suggestions for changes.