本文整理汇总了C#中OutputArray.?.Fix方法的典型用法代码示例。如果您正苦于以下问题:C# OutputArray.?.Fix方法的具体用法?C# OutputArray.?.Fix怎么用?C# OutputArray.?.Fix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputArray
的用法示例。
在下文中一共展示了OutputArray.?.Fix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Detect
/// <summary>
/// Finds lines in the input image.
/// This is the output of the default parameters of the algorithm on the above shown image.
/// </summary>
/// <param name="image">A grayscale (CV_8UC1) input image. </param>
/// <param name="lines">A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line.
/// Where Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly oriented depending on the gradient.</param>
/// <param name="width">Vector of widths of the regions, where the lines are found. E.g. Width of line.</param>
/// <param name="prec">Vector of precisions with which the lines are found.</param>
/// <param name="nfa">Vector containing number of false alarms in the line region,
/// with precision of 10%. The bigger the value, logarithmically better the detection.</param>
public virtual void Detect(InputArray image, OutputArray lines,
OutputArray width = null, OutputArray prec = null, OutputArray nfa = null)
{
if (image == null)
throw new ArgumentNullException(nameof(image));
if (lines == null)
throw new ArgumentNullException(nameof(lines));
image.ThrowIfDisposed();
lines.ThrowIfNotReady();
width?.ThrowIfNotReady();
prec?.ThrowIfNotReady();
nfa?.ThrowIfNotReady();
NativeMethods.imgproc_LineSegmentDetector_detect_OutputArray(ptr, image.CvPtr, lines.CvPtr,
Cv2.ToPtr(width), Cv2.ToPtr(prec), Cv2.ToPtr(nfa));
GC.KeepAlive(image);
lines.Fix();
width?.Fix();
prec?.Fix();
nfa?.Fix();
}
示例2: SolvePnPRansac
/// <summary>
/// computes the camera pose from a few 3D points and the corresponding projections. The outliers are possible.
/// </summary>
/// <param name="objectPoints">Array of object points in the object coordinate space, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel,
/// where N is the number of points. List<Point3f> can be also passed here.</param>
/// <param name="imagePoints">Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, where N is the number of points.
/// List<Point2f> can be also passed here.</param>
/// <param name="cameraMatrix">Input 3x3 camera matrix</param>
/// <param name="distCoeffs">Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements.
/// If the vector is null, the zero distortion coefficients are assumed.</param>
/// <param name="rvec">Output rotation vector that, together with tvec , brings points from the model coordinate system
/// to the camera coordinate system.</param>
/// <param name="tvec">Output translation vector.</param>
/// <param name="useExtrinsicGuess">If true, the function uses the provided rvec and tvec values as initial approximations
/// of the rotation and translation vectors, respectively, and further optimizes them.</param>
/// <param name="iterationsCount">Number of iterations.</param>
/// <param name="reprojectionError">Inlier threshold value used by the RANSAC procedure.
/// The parameter value is the maximum allowed distance between the observed and computed point projections to consider it an inlier.</param>
/// <param name="confidence">The probability that the algorithm produces a useful result.</param>
/// <param name="inliers">Output vector that contains indices of inliers in objectPoints and imagePoints .</param>
/// <param name="flags">Method for solving a PnP problem</param>
public static void SolvePnPRansac(
InputArray objectPoints,
InputArray imagePoints,
InputArray cameraMatrix,
InputArray distCoeffs,
OutputArray rvec,
OutputArray tvec,
bool useExtrinsicGuess = false,
int iterationsCount = 100,
float reprojectionError = 8.0f,
double confidence = 0.99,
OutputArray inliers = null,
SolvePnPFlags flags = SolvePnPFlags.Iterative)
{
if (objectPoints == null)
throw new ArgumentNullException(nameof(objectPoints));
if (imagePoints == null)
throw new ArgumentNullException(nameof(imagePoints));
if (cameraMatrix == null)
throw new ArgumentNullException(nameof(cameraMatrix));
if (rvec == null)
throw new ArgumentNullException(nameof(rvec));
if (tvec == null)
throw new ArgumentNullException(nameof(tvec));
objectPoints.ThrowIfDisposed();
imagePoints.ThrowIfDisposed();
cameraMatrix.ThrowIfDisposed();
distCoeffs.ThrowIfDisposed();
rvec.ThrowIfDisposed();
tvec.ThrowIfDisposed();
IntPtr distCoeffsPtr = ToPtr(distCoeffs);
NativeMethods.calib3d_solvePnPRansac_InputArray(
objectPoints.CvPtr, imagePoints.CvPtr, cameraMatrix.CvPtr, distCoeffsPtr,
rvec.CvPtr, tvec.CvPtr, useExtrinsicGuess ? 1 : 0, iterationsCount,
reprojectionError, confidence, ToPtr(inliers), (int)flags);
rvec.Fix();
tvec.Fix();
inliers?.Fix();
}