Significance
In camera calibration, it is often necessary to print a black and white checkerboard, which is often required for projector calibration.
Matlab Source code
Close All;clear all;clc;width=1024x768;the width of the%patternheight=768;%pattern's HighImg_final=Zeros(height,width); reinforceconner=0;% strengthen corner pointsrow=Ten;the number of rows in a checkerboard in a%patternCol= -;the number of columns in a checkerboard in the%patternlength= $;size of checkerboard in%patternOrg_x= (height-row*length)/2;%pattern The position of the longitudinal axis, which is placed by default in the middleOrg_y= (width-col*length)/2;%pattern position on the horizontal axis, by default in the middlecolor1=1; color2=color1;img=Zeros(row*length, col*length); for I=0:(row-1) Color2=color1; for J=0:(col-1)ifcolor2==1imgI*length+1:(I+1)*length-1,J*length+1:(J+1)*length-1) =color2;End If you do not add, you can comment out %Color2=~color2;EndColor1=~color1;EndImg_final (org_x:org_x+row*length-1, org_y:org_y+col*length-1) =img; img_final=~img_final; Figure;imshow (img_final); Imwrite (Img_final,' Cheesboard.bmp ',' BMP ');
Create a picture
MATLAB Drawing Checker Program