将函数openCV转换为openCvSharp
我有这个问题,我想在C#上使用cv :: initundistortrectifymap,并且我正在使用opencvSharp -cv2.InundundistOrtRectifyMap。该问题是参数“ InputArray R”不正确。有人为这个问题提供了例子。
这是C ++代码:
cv::initUndistortRectifyMap(mt, mtdist,cv::Mat(), cv::getOptimalNewCameraMatrix(mt, mtdist, imageSize, 1, imageSize, 0), imageSize, CV_16SC2, map1, map2);
这是C#代码:
Cv2.InitUndistortRectifyMap(mt, mtdist,map(wrong), Cv2.GetOptimalNewCameraMatrix(mt, mtdist, src.Size(), 1, src.Size(), out rect, false), src.Size(), MatType.CV_16SC2, map1, map2);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
r
参数确实是可选的。它是用于其他立体声转换的。您可以给它一个空的垫子或UMAT,根据文档,它将使用身份矩阵,而不做其他转换。
OPENCV文档:
代码示例:
其中
tokentracker.newumat()
使用您的代码:
注意:在此示例中,我没有使用
Resourcetracker
。因此,new Mat()
具有不受管理的内存。The
r
parameter is really an optional one. It's for additional stereo transformation.You can give it an empty Mat or UMat and according to the documentation it will use the identity matrix instead, doing no additional transformation.
OpenCV documentation:
https://docs.opencv.org/3.4/da/d54/group__imgproc__transform.html#ga7dfb72c9cf9780a347fbe3d1c47e5d5a
Code Example:
Where
tokenTracker.NewUMat()
is creating a new managed UMat viaResourcesTracker tokenTracker
.Using your code:
Note: I did not used a
ResourceTracker
in this example. So thenew Mat()
has unmanaged memory.