On-line check the Industrial Vision Calibration board, less hundreds of oceans, more than thousands of oceans, just want to print a calibration map on A4 paper, is the kind of black and white squares. The standard size of A4 paper is 210*297mm. After a couple of hours, actually trying to understand it was easy. From the perspective of each pixel, consider which small box it eventually falls into, and if the sum of the rows falling into the small squares is odd, it is set to white.can be used as a simple on-plane test。 First of all to prepare a A4 with the same proportion of pure black picture, 3a4.bmp, can be generated by the computer's own drawing. Then the set to white place is set to white on the line. The code is as follows
#include <opencv\cv.h> #include <opencv\highgui.h> #include <iostream>using namespace cv;using namespace Std;int Main () {Mat frame = Imread ("3a4.bmp");//cols*rows = 630*891int NC = frame.channels (); int nwidthofroi = 90;for (int j=0;j<frame.rows;j++) {uchar* data= frame.ptr<uchar> (j); for (int i=0;i<frame.cols*nc;i+=nc) { if ((I/nc/nwidthofroi + j/nwidthofroi)% 2) {//Bgrdata[i/nc*nc + 0] = 255;d ATA[I/NC*NC + 1] = 255;d ATA[I/NC*NC + 2] = 25 5;}}} Imshow ("Test", frame); Waitkey (0); return 0;}
The resulting graph is as follows
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
OpenCV Generating a calibration map