1 | initial version |
Check this example
int blockSize=75;
int imageSize=blockSize*8;
Mat chessBoard(imageSize,imageSize,CV_8UC3,Scalar::all(0));
unsigned char color=0;
for(int i=0;i<imageSize;i=i+blockSize){
color=~color;
for(int j=0;j<imageSize;j=j+blockSize){
Mat ROI=chessBoard(Rect(i,j,blockSize,blockSize));
ROI.setTo(Scalar::all(color));
color=~color;
}
}
imshow("Chess boaed", chessBoard);
2 | No.2 Revision |
Check this example
int blockSize=75;
int imageSize=blockSize*8;
Mat chessBoard(imageSize,imageSize,CV_8UC3,Scalar::all(0));
unsigned char color=0;
for(int i=0;i<imageSize;i=i+blockSize){
color=~color;
for(int j=0;j<imageSize;j=j+blockSize){
Mat ROI=chessBoard(Rect(i,j,blockSize,blockSize));
ROI.setTo(Scalar::all(color));
color=~color;
}
}
imshow("Chess boaed", board", chessBoard);