[ros-users] OpenCV cv::Mat to CvMat

Patrick Mihelich mihelich at willowgarage.com
Wed Jul 21 23:21:43 UTC 2010

Hi Phil,

You're looking for
The error probably means you haven't shaped either your objectPoints or
imagePoints correctly; check the documentation and make sure the dimensions
and channel type are what OpenCV expects.


On Wed, Jul 21, 2010 at 3:22 PM, Phil Osteen <prosteen at ufl.edu> wrote:

> Hi I have written a ROS node that implements a camera calibration
> given intrinsic parameters and a chessboard pattern.
> I want to use FindExtrinsicCameraParams2, and it would be nice to
> have a templated cv:: function for it, but I cannot find one
> anywhere in my environment. Is the ROS version of OpenCV missing
> any C++ functionality versus OpenCV2.1?
> So, I resorted to trying to convert the cv::Mat objects I have to
> CvMat objects using the simple operator. I assume, since there is
> no data copying, that the matrix header is the only change made. I
> also assume that I can use the cvFindExtrinsicCameraParams2
> function with my newly-created CvMat objects.
> I run into an error, however, since I cannot directly copy-paste
> my code so here's a quick rundown.
> // I have a populated STL vector of Mats
> vector<Mat> distortion_coeffs;
> //I create cv::Mats
> Mat distortion(rows,cols,CV_64FC3);
> //Then, populate all of them except tvec,rvec
> distortion_coeffs[0].copyTo(distortion);
> //Then copy to the old CvMat struct
> CvMat distortion_old = distortion;
> // Then call cvFindExtrinsicCameraParams2
> OpenCV Error: Incorrect size of input array (Either the number of
> channels or columns or rows must be =1) in
> cvConvertPointsHomogeneous, file
> /opt/ros/boxturtle/stacks/vision_opencv/opencv2/build/opencv-svn/src/cv/cvfundam.cpp
> I am running boxturtle on Ubuntu Karmic 2.6.31-14. Thanks for any
> help.
> --
> Phil Osteen
> BS Aerospace Engineering, University of Florida
> MS Mechanical Engineering, University of Florida
> Research Assistant, Center for Intelligent Machines and Robotics
> (UF)
> Researcher, Grupo de Sistemas y Automatica, Universidad de
> Sevilla
> Robotics Research Engineer, Motile Robotics Inc
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20100721/f9639afc/attachment-0003.html>

More information about the ros-users mailing list