I am cheking a function writed in a library dor digital image processing by other programmer,
1 2 3 4 5 6 7
bool convolve2DSeparable(unsignedchar* in, unsignedchar* out, int dataSizeX, int dataSizeY,
float* kernelX, int kSizeX, float* kernelY, int kSizeY)
{
//some input checking code
// find center position of kernel (half of kernel size)
kCenter = kSizeX >> 1; // center index of kernel
I do not understand what kCenter = kSizeX >> 1; means, the thing is KsizeX I know is an integer so I would expect more somenthing like kCenter = ceil(kSizeX/2); instead it is used >> which the only usage I know is as cin. Can somebody explaining me what I am missing
// it is reading the >> as a math operation in this case which is shift right 1 bit.
KCenter = kSize >> 1;
// it will not equal what you were trying to achieve.
It's the bitshift operator. It takes the binary representation of the variable and shifts the bits left (<<) or right (>>) the number of times specified.