I want to understand each of the elements and statements from Line # 113 to Line # 135 in the ColorBlobDetectionActivity in the Color Blob Detection sample app for OpenCV4Android.

Line # 113 - 115: When the onTouch method is invoked, that is when the user touches a colored object, the int rows= mRgba.rows() and int cols = mRgba.cols() is calculated. Since mRgba is a Mat which was returned by onCameraFrame(), it means it represents a camera frame.So I think rows and cols now represent the number of pixels along x-axis, and that along y-axis of the frame. Is that correct?

Line # 117 and 118: What do xOffset and yOffset represent? Can you explain me this formula, I mean why are they doing what they are doing in (mOpenCvCameraView.getWidth() - cols) / 2; ?

I believe the rest of the method can be understood once I understand the above, that is when I understand what do rows, cols, xOffSet, yOffset, x and y represent?

Thank you so very much in advance.