Ask Your Question

GennyLimite's profile - activity

2017-03-15 07:31:43 -0600 commented question Calculating MyHistogram

Thank u so much Eduardo.

I changed the size and it is going well. Obvious the result isn't the same of the opencv function "calchist but the trand i think is similar.

2017-03-15 06:54:51 -0600 asked a question Calculating MyHistogram

Hi all,

I'm trying to do a version of mine to calcolute an Histogram.

I think that the logic is this, but i don't know why it's going in segmentation fault.

Can anyone help me?

    //My Hist
    int Occorrenze[255];
    for(int i=0;i<255;i++)
            Occorrenze[i]=0;

    for(int i=0;i<src.rows;i++)
    {
            for(int j=0;j<src.cols;j++)
            {
                    Occorrenze[src.at<uchar>(i,j)]++;
            }
    }
    Mat MyHist(255,255,CV_8U);
    for(int colonna=0;colonna<255;colonna++)
    {
            int numero=0;
            int flag=0;
            while(numero != Occorrenze[colonna] && flag==0)
            {
                    MyHist.at<uchar>((255-numero),colonna)=255;
                    numero++;
                    if(numero==255)
                            flag=1;
            }
    }
    namedWindow("Hist",WINDOW_AUTOSIZE);
    imshow("Hist",MyHist);

thank u so much