【OpenCV】用cvCalibrateCamera2函数做标定出错,大家帮忙看下吧
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了【OpenCV】用cvCalibrateCamera2函数做标定出错,大家帮忙看下吧相关的知识,希望对你有一定的参考价值。
用cvCalibrateCamera2做标定,编译通过,运行却出错。
我用4张靶标图片,48个点,基本定义如下:
CvMat *object_points = cvCreateMat(4*48, 3, CV_32FC1); // 定标点的世界坐标
CvMat *image_points = cvCreateMat(4*48, 2, CV_32FC1); // 定标点的图象坐标
CvMat *point_counts = cvCreateMat(4, 1, CV_32FC1);
cvSetData( point_counts, &numcorners, sizeof(int)); //numcorners=48
CvMat *distortion = cvCreateMat(1, 4, CV_32FC1); // 形变向量d
CvMat *cameraMatrix = cvCreateMat(3, 3, CV_32FC1); // 内参矩阵A
CvMat *transVects = cvCreateMat(4, 3, CV_32FC1); // 平移向量t
CvMat *rotMatrixes = cvCreateMat(4, 3, CV_32FC1); // 旋转矩阵R
编译通过,运行出错,提示:
unsupported format or combination of formats(the array of point counters must be 1-demensional integer vector),in function cvCalibrateCamera2,C:\User\VP\opencv\cv\src\cvcvcalibration.cpp(1307)
不知是什么原因?
函数定义:
void cvCalibrateCamera2( const CvMat* object_points, const CvMat* image_points,
const CvMat* point_counts, CvSize image_size,
CvMat* intrinsic_matrix, CvMat* distortion_coeffs,
CvMat* rotation_vectors=NULL,
CvMat* translation_vectors=NULL,
int flags=0 );
改成
CvMat *point_counts = cvCreateMat(4, 1, CV_32SC1);
应该是整数 参考技术B wwhmyself 老兄:
我用你的代码跑了一下结果运行错误为:
Opencv GUI Handler
NULL pointer(NULL array pointer is passed)
in function cvGetMat,D:\Program Files\OpenCV\cxcore\src\cxarray.cpp(2780)
请帮忙指点错误在那。感谢!
怎么用python opencv连线画图?
怎么用opencv在图上点四个点,把四点连接,组成一个封闭的图形?
参考技术A import cv2import numpy as np
img_size = (210,210)
image = np.ones(img_size) * 255
x1 = 10
y1 =10
x2 = 200
y2 = 200
lineThickness = 2
cv2.line(image, (x1, y1), (x1, y2), (0,255,0), lineThickness)
cv2.line(image, (x1, y1), (x2, y1), (0,255,0), lineThickness)
cv2.line(image, (x1, y2), (x2, y2), (0,255,0), lineThickness)
cv2.line(image, (x2, y1), (x2, y2), (0,255,0), lineThickness)
cv2.imshow('oo',image)
cv2.waitKey()
以上是关于【OpenCV】用cvCalibrateCamera2函数做标定出错,大家帮忙看下吧的主要内容,如果未能解决你的问题,请参考以下文章
用OpenCV开发人脸识别软件,用Java好还是用C/C++好