Delphi-OpenCV cvTransform 为什么执行这个函数时出错?

问题描述 投票:0回答:0
uses
  ocv.core.types_c;

procedure TransformPoint;
var
  SourcePoint: TCvPoint2D32f;
  AffineMatrix: pCvMat;
  TransformedPoint: TCvPoint2D32f;
begin
  // Set the coordinates of the source point
  SourcePoint.x := 2;
  SourcePoint.y := 3;

  // Create and fill the affine transformation matrix
  AffineMatrix := cvCreateMat(2, 3, CV_32FC1);
  cvSetReal2D(AffineMatrix, 0, 0, 1.2);
  cvSetReal2D(AffineMatrix, 0, 1, 0.3);
  cvSetReal2D(AffineMatrix, 0, 2, 2.5);
  cvSetReal2D(AffineMatrix, 1, 0, -0.5);
  cvSetReal2D(AffineMatrix, 1, 1, 0.8);
  cvSetReal2D(AffineMatrix, 1, 2, 1.0);

  // Perform the transformation of the point
  cvTransform(@SourcePoint, @TransformedPoint, AffineMatrix);

  // Display the results of the transformation
  Writeln('Source point: (', SourcePoint.x, ', ', SourcePoint.y, ')');
  Writeln('Transformed point: (', TransformedPoint.x, ', ', TransformedPoint.y, ')');

  // Release resources
  cvReleaseMat(@AffineMatrix);
end;

为什么执行这个函数会出错?我该如何解决这个问题?救命!

我尝试将不同类型传递给函数,但仍然收到运行时错误。图书馆的所有其他功能都运行良好。谁能帮我找出为什么会出现此错误以及如何解决它?预先感谢您!

opencv delphi delphi-xe7
© www.soinside.com 2019 - 2024. All rights reserved.