Emgu CV估计刚度变换

时间:2014-05-13 05:49:32

标签: c# opencv emgucv

尝试使用opencv函数时遇到问题。返回的错误是: OpenCV:两个输入图像都必须是8uC1或8uC3类型

以下是代码:

Image<Gray, Byte> prev_grey = frames.ElementAt(0).Convert<Gray, Byte>();
IntPtr prev = CvInvoke.cvCreateImage(prev_grey.Size, IPL_DEPTH.IPL_DEPTH_8U, 1);
CvInvoke.cvSetImageCOI(prev, 0); // Select the channel to copy into
CvInvoke.cvCopy(prev_grey, prev, IntPtr.Zero);
Matrix<float> prev2 = new Matrix<float>(prev_grey.Rows, prev_grey.Cols, prev);

curr_grey = frames.ElementAt(i).Convert<Gray, Byte>();
IntPtr curr = CvInvoke.cvCreateImage(curr_grey.Size, IPL_DEPTH.IPL_DEPTH_8U, 1);
CvInvoke.cvSetImageCOI(curr, 0); // Select the channel to copy into
CvInvoke.cvCopy(curr_grey, curr, IntPtr.Zero);
Matrix<float> curr2 = new Matrix<float>(curr_grey.Rows, curr_grey.Cols, curr);

Matrix<double> affine = new Matrix<double>(curr_grey.Rows, curr_grey.Cols);
CvInvoke.cvEstimateRigidTransform(prev2.Ptr, curr2.Ptr, affine.Ptr, false);

0 个答案:

没有答案