Laex / Delphi-OpenCV-Class

Experimental Delphi binding for OpenCV 4.XX
Apache License 2.0
87 stars 26 forks source link

find contours give always 'External exception E06D7363' #23

Closed shineworld closed 1 year ago

shineworld commented 2 years ago

Hi Laex, I've tried to use findcountous passing it a TMat but I always get the exception:

'External exception E06D7363'

function TCncVisionMarkerCircleDetection.GetMarkerCircle(Source: TMat): TGeoRect;
var
  Image: TInputArray;
  Contours: TOutputArray;
  Hierachy: TOutputArray;
begin
  try
    Image := TInputArray(Source);
    findContours(Image, Contours, Hierachy, Ord(RETR_LIST), Ord(CHAIN_APPROX_SIMPLE));
    if Contours.getMat().empty then Exit;
    < bla bla bla >   
  except
    on E: Exception do
    begin
      var m: string := E.Message;
    end;
  end;

Do you have a working sample code ?

Laex commented 1 year ago
// Image := TInputArray(Source);

{->} Var {->} _contour:Vector<Vector>; {->} Contours:=_contour; findContours(Source, Contours, Hierachy, Ord(RETR_LIST), Ord(CHAIN_APPROX_SIMPLE)); if Contours.getMat().empty then Exit;

Laex commented 1 year ago

Var Contours: Vector<Vector<\TPoint>>; "\" - need delete (the parser eats)

Laex commented 1 year ago
function TCncVisionMarkerCircleDetection.GetMarkerCircle(Source: TMat): TGeoRect;
var
  //Image: TInputArray;
  Contours: Vector<Vector<TPoint>>;
  Hierachy: TOutputArray;
begin
  try
//    Image := TInputArray(Source);
    findContours(Source, Contours, Hierachy, Ord(RETR_LIST), Ord(CHAIN_APPROX_SIMPLE));
    if Contours.empty then Exit;
    < bla bla bla >   
  except
    on E: Exception do
    begin
      var m: string := E.Message;
    end;
  end;