OpenCV Generating a calibration map

Source: Internet
Author: User


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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.