0

I am making a project where I want to re-identify person based on their soft features like cloth color. So I want to get the HSV and RGB histogram of their images and compare it later to check if it is the same person.

Code i made so far:

//This is small part of the project
        float[] hueHists=new float[255];
        float[] satHists = new float[255];


        DenseHistogram dh = new DenseHistogram(255, new RangeF(0, 255));
        DenseHistogram dh2 = new DenseHistogram(255,new RangeF(0, 255));
        Image<Hsv, byte> hsvImage = image.Convert<Hsv, byte>();

        for (int i = 0; i < 8; i++)
        {
            hsvImage.ROI = new Rectangle(0, i * 16, 64, 16);

            Image<Gray, byte>[] channels = hsvImage.Copy().Split();
            Image<Gray, byte> hue = channels[0];  
            Image<Gray, byte> sat = channels[1];  


            dh.Calculate<byte>(new Image<Gray, byte>[] { hue }, true, null);
            dh2.Calculate<byte>(new Image<Gray, byte>[] { sat }, true, null);

            float[] huehist = dh.GetBinValues();
            float[] sathist = dh2.GetBinValues();

            if(i==0)
            {
                huehist.CopyTo(hueHists,0);
                sathist.CopyTo(satHists,0);
            }
            else
            {
                hueHists = hueHists.Concat<float>(huehist).ToArray<float>();
                satHists = satHists.Concat<float>(sathist).ToArray<float>();
            }

        }

And also should I extract HSV and RGB histogram of complete image or extract after segmentation of image.

[Edit] I have extracted the histogram of a personA and matched it against other people's histogram (to check if he/she is personA or not). Problem the problem is with accuracy. my program can not correctly find same person. And I want to ask the better way to do it...

Help from opencv person is also appreciated

Thanks in advance.

Nabeel Zafar
  • 191
  • 10
  • What is your question actually? Where is the problem with the code you provided? – dymanoid Nov 17 '16 at 13:25
  • @dymanoid I have updated the question... My program can't tell if two pictures are of same person... And I can't find the problem... – Nabeel Zafar Nov 17 '16 at 14:39
  • 1
    You can never make a certain decision based on a histogram only. You have to perform a feature analysis or at least some pattern matching. Your question is too broad to answer it, this is actually a whole research area. – dymanoid Nov 17 '16 at 14:43
  • @dymanoid I am also using HOG to its texture information... I am certain that HOG is working fine... but HS histograms are not... I am following "http://ieeexplore.ieee.org/document/6951486/?reload=true" research paper... – Nabeel Zafar Nov 18 '16 at 04:40
  • @dymanoid Should i make 2D histogram for HS or separate histogram for H and S... btw thanks for your reply – Nabeel Zafar Nov 18 '16 at 04:41
  • 1
    take a look at [HSV histogram in C++](http://stackoverflow.com/a/29286584/2521214) – Spektre Nov 18 '16 at 08:43
  • @spektre this is not opencv however I got the exact idea I wanted... thanks... I used HOG+RGB+HS to track a person and it gave pretty good accuracy – Nabeel Zafar Nov 18 '16 at 14:02

0 Answers0