1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to transfer new intensity values to an OLD IMAGE?

Discussion in 'C' started by metamofia, Oct 21, 2009.

  1. metamofia

    metamofia New Member

    Sep 28, 2009
    Likes Received:
    Trophy Points:
    Hi, this is my code below:
    CLEO_MedivisionView::OnToolsHistogramequalization() {
    int i;  
    unsigned int array1[256];  
    unsigned int cdf[256];  
    unsigned int arrayhe[256];  
    //** Step 1 **\\
    for (i=0;i<256;i++) // count each distinct pixel value in the image
    if (no_of_rows == 512 && no_of_cols == 512) {
    for (i=0; i<262144; i++) {
    else if (no_of_rows == 256 && no_of_cols == 256) {
    for (i=0; i<65536; i++) {
    //** Step 2 **\\  
    for (i=0; i<256; i++) {
    cdf[0] = array1[0];
    // finding cumulative distribution
    for (i=1; i<256; i++) {
    cdf[i] = array1[i] + cdf[i-1];
    for (i=0; i<256; i++) // applying the HE algorithm
    arrayhe[i] = (cdf[i]*255/262144)+0.5;

    as u can see, this set of codes is done as histogram equalization of an image. the current image i used for testing is a 512*512 image and its in 8-bit.. so im sure the algorithm is correct because the cdf[] did return me the cumulative values and the values in arrayhe[] seems probable too.. right now im not too sure how to transfer this value in arrayhe[], containing the new intensity values, to the OLD IMAGE.. im on the verge to complete this project so a decent help would be much appreciated
    Last edited by a moderator: Oct 21, 2009

Share This Page