How to divide an OpenCV Mat in rectangular sub-regions?
问题 I want to divide a simple Mat (200x200) in different regions (10x10). I make 2 loops, then I create a Rect where I indicate the variables I want in each iteration (x, y, width, height) . Finally, I save this region of the image inside a vector of Mat s. But something is wrong with my code: Mat face = Mat(200, 200, CV_8UC1); vector<Mat> regions; Mat region_frame; int width = face.cols * 0.05; int heigth = face.rows * 0.05; for(int y=0; y<=(face.rows - heigth); y+=heigth) { for(int x=0; x<=