Hi,
I am seeking some advice about how to tackle a programming problem.
I'm not wanting code just some suggested ways of handling the problem.

I am trying to develop a program that displays images that have similar visual properties. For each image, and for each of the rgb colors I have developed numbers in the way of a profile eg. 1 image might be R132.05,G124.12,B104.60.

Now I have established that + or - say 2% of each of these values is relevant.
Assume I have a few hundred images, I would like to be able to group images that fall within +or- 2% margin of each image for each of the rgb stats.

I would see the outcome as being say a few groups of 5 or 6 images each, with a lot that are not similar enough to group.

All suggestions welcome.

Thank you

Recommended Answers

All 6 Replies

Get your list of image values.
Sort these values.
Set minimum group threshold size (minG)
Set maximum difference (minD)
Set i = 0
While (i < number of images - minG) {
    Set j = i - 1
    While (j >= 0) {
        Calculate difference between image i and image j
        if  difference > minD break out of loop
        subtract one from j
    }
    Set k = i + 1
    While (k < number of image) {
        Calculate difference between image i and image k
        if difference > minD break out of loop
        add one to k
    }
    if (k - j - 1 >= minG) then record as group range j+1, k-1
    add one to i
}

You'll need the minimum group size otherwise you might run into lots of little groups. For example, let's say image 1 and 2 are close enough, but 3 isn't close enough to 1. So we have group of 1 and 2. But 3, 4, 5 and 6 are all close enough to 2, so we also have group 2-6. Even with the code above you'll still get overlapping (and sub) groups. You'll have to adjust the value of i in the last line if you wish to skip these.

y not use any classification algorithm like kmean algo for grouping the images it will make the group of images with minimum difference.... it is based on the idea of measuring the distance of each entity with all others and chose with the minimum 1

Momerath,
Thanks for your comments. Looking at your method it seems as though it only has a difference on one dimension, whereas I need it on 3 simultaneously. This is the hard part for me.
abel, I'm sorry some of your comment appears to be missiing, I couldn't comprehend what you eman.

i mean that you should use any of the classification algorithms like "kMean" it will help you in grouping the images on the basis of there difference with eachother... i think it will work for 3D also ..... it is based on the idea of calculating the distance between two objects and plassing them in one group if the difference between them is minimum... are you getting my point?

some days back i have used kmean algorithm for matching voices for my voice recognition system and it worked well for me even in text independent voice recognition

Momerath,
Thanks for your comments. Looking at your method it seems as though it only has a difference on one dimension, whereas I need it on 3 simultaneously. This is the hard part for me.
abel, I'm sorry some of your comment appears to be missiing, I couldn't comprehend what you eman.

There is no specification on what 'difference' means in the psuedo code. It can be one, two, three, anything that you want as long as you know what it means. That's why it's psuedo code, and not an algorithm for finding the difference.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.