Ask Your Question

Revision history [back]

click to hide/show revision 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);

image description

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);

image description