zw版【转发·台湾nvp系列Delphi例程】HALCON AngleLl
procedure TForm1.Button1Click(Sender: TObject);
var
Row1, Row2 : OleVariant;
Column1, Column2 : OleVariant;
AngleLl : OleVariant;
sys : HSystemX;
op : HOperatorSetX;
deg : OleVariant;
ht : HTupleX;
val : double;
begin
Randomize;
sys := CoHSystemX.Create;
op := CoHOperatorSetX.Create;
ht := CoHTupleX.Create;
sys.SetSystem(‘width‘, 640);
sys.SetSystem(‘height‘, 480);
HWindowXCtrl1.HalconWindow.SetPart(0, 0, 479, 639);
HWindowXCtrl1.HalconWindow.ClearWindow;
HWindowXCtrl1.HalconWindow.SetColor(ht.TupleConcat(‘red‘, ‘white‘));
Row1 := ht.TupleConcat(240, 460);
Column1 := ht.TupleConcat(10, 10);
Row2 := ht.TupleConcat(240, 10);
Column2 := ht.TupleConcat(630, Random(630));
HWindowXCtrl1.HalconWindow.DispLine(Row1, Column1, Row2, Column2);
op.AngleLl(ht.TupleSelect(Row1, 0), ht.TupleSelect(Column1, 0), ht.TupleSelect(Row2, 0), ht.TupleSelect(Column2, 0), ht.TupleSelect(Row1, 1), ht.TupleSelect(Column1, 1), ht.TupleSelect(Row2, 1), ht.TupleSelect(Column2, 1), AngleLl);
op.TupleDeg(AngleLl, deg);
val := double(deg);
Label1.Caption := Format(‘%7.3f‘, [val]);
end;