Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Accessing pixel pointer

Hi guys

Can you explain to me how the accessing pixel has been done in the double loop ? how do they change rows and cols and pixel's value?

for(int i=0;i<cv_ptr->image.rows;i++)
    {   
        float* ptr_img_A = cv_ptr->image.ptr<float>(i); 

        for(int j=0;j<cv_ptr->image.cols;j++)
        {                   
            *ptr_img_B=255*(*ptr_img_A)/3.5;
             ptr_img_A++;   
        }           
    }

Thank you.

Accessing pixel pointer

Hi guys

Can you explain to me how the accessing pixel has been done in the double loop ? how do they change rows and cols and pixel's value?value like what is the (1,1) pixel coordinates for example ?

for(int i=0;i<cv_ptr->image.rows;i++)
    {   
        float* ptr_img_A = cv_ptr->image.ptr<float>(i); 

        for(int j=0;j<cv_ptr->image.cols;j++)
        {                   
            *ptr_img_B=255*(*ptr_img_A)/3.5;
             ptr_img_A++;   
        }           
    }

Thank you.