1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

How to transfer new intensity values to an OLD IMAGE?

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

  1. metamofia

    metamofia New Member

    Joined:
    Sep 28, 2009
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    0
    Hi, this is my code below:
    Code:
    void
     
    
    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
    {
    array1[i]=0;
    }
     
    
    if (no_of_rows == 512 && no_of_cols == 512) {
     
    
    
    for (i=0; i<262144; i++) {
    array1[image[i]]++;
    }
    }
     
    
    
    else if (no_of_rows == 256 && no_of_cols == 256) {
     
    
    
    for (i=0; i<65536; i++) {
    array1[image256[i]]++;
    }
    }
     
    
    
    //** Step 2 **\\  
    
     
    
    for (i=0; i<256; i++) {
    cdf[i]=0;
    }
     
    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