栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

opencv学习-智能视觉作业(一)

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

opencv学习-智能视觉作业(一)

在该实验中主要通过opencv使用拍摄的棋盘格对相机进行calibration.求出相机的内参和外参.实验设备为basler工业相机.
注:opencv的sample中有标准示例程序,这里的程序是自己写的仅供练习.

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using namespace cv;
using namespace std;
string imageList[]={string("./n1.JPG"),string("./n2.JPG"),string("./n3.JPG"),string("./n4.JPG"),
string("./n5.JPG"),string("./n6.JPG"),string("./n7.JPG"),string("./n8.JPG"),
string("./n9.JPG"),string("./n10.JPG"),string("./n11.JPG"),string("./n12.JPG")
};
CvSize boardSize(5,7);
int photo_size=12;
float squareSize=50;
int main(){
	vector< Point3f > CornerPoints;
	vector> ObjectPoints;
	vector> imagePoints;
	vector save_view;
	bool have_set=false;
	CvSize ImageSize;
	for(int i=0;i ptvec;
		int  corner_count=9; 
		//the error for find==0:https://blog.csdn.net/u011651743/article/details/51099543
		bool found = findChessboardCorners( view, boardSize, ptvec ,CALIB_CB_ADAPTIVE_THRESH );
		//for more precise ,use  cvFindCornerSubPix
		
		drawChessboardCorners(view,boardSize,ptvec,found);
		imshow("input", view);
		save_view.push_back(view);
		imagePoints.push_back(ptvec);
		if(have_set==false){
			have_set=true;
			for(int j=0;j(0,0) = 1;
	
	Mat distCoeffs;
	distCoeffs=Mat::zeros(8, 1, CV_64F);
	int iFixedPoint = -1;
	
	vector rvecs;vector tvecs;
	
	double rms = calibrateCamera(ObjectPoints, imagePoints, ImageSize,
                        cameraMatrix, distCoeffs, rvecs, tvecs,
                         CALIB_FIX_ASPECT_RATIO  | CALIB_USE_LU);
	cout< projectedPoints;
		cv::projectPoints(ObjectPoints[i], rvecs[i], tvecs[i],cameraMatrix,
			distCoeffs, projectedPoints);
		err = norm(imagePoints[i], projectedPoints, NORM_L2);
		cout<(3,1)<<);
		//		}
		//	}
			
		//cout<
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/290372.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号