I have a red image - just for testing. The RGB Color is (217/18/36).
I perform the following code:
void QuaterImage(Mat& SrcImage, Mat& DestImage, bool Downsample) {
int newWidth = 0, newHeight = 0;
int newOrigWidth = 0, newOrigHeight = 0;
if (SrcImage.cols % 2 > 0) { newOrigWidth = SrcImage.cols - 1; } else { newOrigWidth = SrcImage.cols; }
if (SrcImage.rows % 2 > 0) { newOrigHeight = SrcImage.rows - 1; } else { newOrigHeight = SrcImage.rows; }
if (SrcImage.depth() != CV_8U) { return; }
newHeight = newOrigHeight / 2;
newWidth = newOrigWidth / 2;
DestImage = Mat(newWidth, newHeight, SrcImage.type());
int r = 0, c = 0;
uchar* DataPtr = SrcImage.ptr<uchar>(0);
std::cout << std::to_string(*DataPtr) << std::endl;
return;
}
It always returns "205".
If I change the image to be complettely yellow, it returns the exact same value. How can that be?
Regards, Jan