Help needed with histogram

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Help needed with histogram

mayurmatur
can anyone hint how to start off to write a own code for Histogram
generation..

Reply | Threaded
Open this post in threaded view
|

Re: Help needed with histogram

dennymelkay
--- In [hidden email], "mayurmatur" <mayurmatur@...> wrote:
>
> can anyone hint how to start off to write a own code for Histogram
> generation..
>

Given a 8 bit grayscale image stored in a matrix named image

unsigned int imWidth, imHeight, grayLevel;
// initialize the array to zeros
for(unsigned int i = 0; i <= 255; i++)
{
    Histogram[i] = 0;
}

// calculate the histogram
for(unsigned int i = 0, j; i < imWidth; i++)
{
    for(j = 0; j < imHeight; j++)
        {
           grayLevel = image[i,j];
           Histogram[grayLevel]++;
        }
}

Hope this helps,
Regards,
Denny.

Reply | Threaded
Open this post in threaded view
|

Re: Help needed with histogram

mayurmatur
-Thanks a lot Denny...it really helped me..