我有一个灰色图像,我想从每 8 个像素一起获取像素值(像素块) 我如何从灰色图像中读取这个像素块?这是我制作的代码
void main()
{
Mat img = imread("Frame.jpg",0);
if(!img.data)
std::cout << "error";
double minVal, maxVal;
minMaxLoc(img,&minVal,&maxVal,NULL,NULL);
double Threshold = 0.5 * (minVal + maxVal);
int i,j;
for (i=0;i<img.rows;i++)
for(j=0;j<img.cols;j++)
unsigned char Pixel = img.at<unsigned char>(i,j);
namedWindow( "Display window", CV_NORMAL );// Create a window for display.
imshow( "Display window", img );
waitKey(0);
}
谢谢