# Revision history [back]

### Exception in cvConvertScale in OpenCV calling solvePnP

I'm trying to use solvePnP from OpenCV (through OpenCvSharp) but I get an exception that I don't understand.

An unhandled exception of type 'OpenCvSharp.OpenCVException' occurred in OpenCvSharp.dll
Additional information: src.size == dst.size && src.channels() == dst.channels()


After some searching, I found that it comes from cvConvertScale in convert.cpp

Here is how I use it:

var objectPoints = new OpenCvSharp.CPlusPlus.Point3f[4] { o1, o2, o3, o4 };
var imagePoints = new OpenCvSharp.CPlusPlus.Point2f[4] { i1, i2, i3, i4 };
var intrinsic = new double[3, 3] { { d1, d2, d3 }, { d4, d5, d6}, { d7, d8, d9 } };

double[] rvec, tvec;

OpenCvSharp.CPlusPlus.Cv2.SolvePnP(objectPoints,
imagePoints,
intrinsic,
null, out rvec, out tvec);


If I understand this exception right, it means there is a conversion of sort happening and the source and destination matrixes don't have the same size or the same number of channels. But both my list of points are of the same size. My camera matrix is 3x3 which should be fine. I don't get it.

Could someone shed some light on this ?