Can anybody help me with cvConvertScale??

hi, anyvbody can help me??? I am confused with cvConvertScale(IplImage* src, IplImage* dst, scale, shift) function. I know that the scale values is used to scale the pixel values.

I have tried out by setting the scale values as 7.0 and setting the shift value as 0. I have assumed that the pixel values will be multipled by 7 times. But the result of the pixel values is weird!

Please help me? Is the pixel values being multipled by 7times? i am really confused! Many thanks! =)

This is a good resource:
http://www.cs.indiana.edu/cgi-pub/oleyk-…-penCVHelp/

Here is the function in questions:
http://www.cs.indiana.edu/cgi-pub/oleyk-…-nvertScale

Hi theo,

Thanks. I have read up the website provided! It also states that the result will be scale factor will be multipled to the pixel values + shift.

But i tried to access the pixel values the result is weird! Can i check with you whether my codes of accesing the image pixel is correct?

The codes:

int nl= I->height; // number of lines
int nc= I->width * I->nChannels; // total number of element per line
int step = I->widthStep;

// get the pointer to the image buffer
unsigned char *data= reinterpret_cast<unsigned char *>(I->imageData);
for (int i=1; i<*n; i++) {
for (int j=0; j<nc; j+= I->nChannels) {
printf("%d\n", data[j]); //3 channels
printf("%d\n", data[j+1]);
printf("%d\n", data[j+2]);
}
data+= step;
}

Thanks so much!

Regards,
Angeline