zw版【转发·台湾nvp系列Delphi例程】HALCON ObjToInteger1-4

zw版【转发·台湾nvp系列Delphi例程】HALCON ObjToInteger1

procedure TForm1.Button1Click(Sender: TObject);
var
img, img1 : THImageX;
value : OleVariant;
//tuple : THTupleX;
w, h : OleVariant;
begin
//tuple := THTupleX.Create(nil);
img := THImageX.Create(nil);
img.ReadImage(‘ic0‘);
w := img.GetImageSize(h);
HWindowXCtrl1.HalconWindow.SetPart(0,0,h-1,w-1);
img.DispObj(HWindowXCtrl1.HalconWindow);
value := img.ObjToInteger(1,-1);
//ShowMessage(tuple.TupleSelect(value,0));
img1 := THImageX.Create(nil);
img1.IntegerToObj(value);
w := img1.GetImageSize(h);
HWindowXCtrl2.HalconWindow.SetPart(0,0,h-1,w-1);
img1.DispObj(HWindowXCtrl2.HalconWindow);
//ShowMessage(IntToStr(img.TestEqualObj(img1.DefaultInterface)));
img1.Free;
img.Free;
//tuple.Destroy;
end;

----------------

zw版【转发·台湾nvp系列Delphi例程】HALCON ObjToInteger2

procedure TForm1.Button1Click(Sender: TObject);
var
img, img1 : THImageX;
value : OleVariant;
//tuple : THTupleX;
w, h : OleVariant;
begin
//tuple := THTupleX.Create(nil);
img := THImageX.Create(nil);
img.ReadImage(‘ic0‘);
w := img.GetImageSize(h);
HWindowXCtrl1.HalconWindow.SetPart(0,0,h-1,w-1);
img.DispObj(HWindowXCtrl1.HalconWindow);
value := img.ObjToInteger(1,-1);
//ShowMessage(tuple.TupleSelect(value,0));
img1 := THImageX.Create(nil);
img1.IntegerToObj(value);
w := img1.GetImageSize(h);
HWindowXCtrl2.HalconWindow.SetPart(0,0,h-1,w-1);
img1.DispObj(HWindowXCtrl2.HalconWindow);
//ShowMessage(IntToStr(img.TestEqualObj(img1.DefaultInterface)));
img1.Free;
img.Free;
//tuple.Destroy;
end;

--------------
zw版【转发·台湾nvp系列Delphi例程】HALCON ObjToInteger3

procedure TForm1.Button1Click(Sender: TObject);
var
img, img1 : HImageX;
value : OleVariant;
w, h : OleVariant;
filename : OleVariant;
tuple : HTupleX;
begin
tuple := CoHTupleX.Create;
img := CoHImageX.Create;
filename := VarArrayOf([‘ic0‘, ‘keypad‘, ‘ic_pin‘, ‘pcb‘]);
img.ReadImage(filename);
value := img.ObjToInteger(1,-1);
img1 := CoHImageX.Create();
img1.IntegerToObj(value);
w := img1.GetImageSize(h);
HWindowXCtrl1.HalconWindow.SetPart(0,0,tuple.TupleSelect(h,0)-1,tuple.TupleSelect(w,0)-1);
img1.SelectObj(1).DispObj(HWindowXCtrl1.HalconWindow);
HWindowXCtrl2.HalconWindow.SetPart(0,0,tuple.TupleSelect(h,1)-1,tuple.TupleSelect(w,1)-1);
img1.SelectObj(2).DispObj(HWindowXCtrl2.HalconWindow);
HWindowXCtrl3.HalconWindow.SetPart(0,0,tuple.TupleSelect(h,2)-1,tuple.TupleSelect(w,2)-1);
img1.SelectObj(3).DispObj(HWindowXCtrl3.HalconWindow);
HWindowXCtrl4.HalconWindow.SetPart(0,0,tuple.TupleSelect(h,3)-1,tuple.TupleSelect(w,3)-1);
img1.SelectObj(4).DispObj(HWindowXCtrl4.HalconWindow);
img1 := nil;
img := nil;
tuple := nil;
end;

----------------
zw版【转发·台湾nvp系列Delphi例程】HALCON ObjToInteger4

procedure TForm1.Button1Click(Sender: TObject);
var
img, img1 : HImageX;
value : OleVariant;
w, h : OleVariant;
filename : OleVariant;
tuple : HTupleX;
ho_Region, ho_Region1 : HRegionX;
begin
tuple := CoHTupleX.Create;
img := CoHImageX.Create;
filename := VarArrayOf([‘ic0‘, ‘ic_pin‘, ‘pcb‘, ‘pcb_layout‘]);
img.ReadImage(filename);
ho_Region := img.BinThreshold();
value := img.ObjToInteger(1,-1);
img1 := CoHImageX.Create();
img1.IntegerToObj(value);
value := ho_Region.ObjToInteger(1, -1);
ho_Region1 := CoHRegionX.Create;
ho_Region1.IntegerToObj(value);
w := img1.GetImageSize(h);
HWindowXCtrl1.HalconWindow.SetPart(0,0,tuple.TupleSelect(h,0)-1,tuple.TupleSelect(w,0)-1);
HWindowXCtrl1.HalconWindow.SetDraw(‘margin‘);
HWindowXCtrl1.HalconWindow.SetColor(‘red‘);
img1.SelectObj(1).DispObj(HWindowXCtrl1.HalconWindow);
ho_Region1.SelectObj(1).DispObj(HWindowXCtrl1.HalconWindow);
HWindowXCtrl2.HalconWindow.SetPart(0,0,tuple.TupleSelect(h,1)-1,tuple.TupleSelect(w,1)-1);
HWindowXCtrl2.HalconWindow.SetDraw(‘margin‘);
HWindowXCtrl2.HalconWindow.SetColor(‘red‘);
img1.SelectObj(2).DispObj(HWindowXCtrl2.HalconWindow);
ho_Region1.SelectObj(2).DispObj(HWindowXCtrl2.HalconWindow);
HWindowXCtrl3.HalconWindow.SetPart(0,0,tuple.TupleSelect(h,2)-1,tuple.TupleSelect(w,2)-1);
HWindowXCtrl3.HalconWindow.SetDraw(‘margin‘);
HWindowXCtrl3.HalconWindow.SetColor(‘red‘);
img1.SelectObj(3).DispObj(HWindowXCtrl3.HalconWindow);
ho_Region1.SelectObj(3).DispObj(HWindowXCtrl3.HalconWindow);
HWindowXCtrl4.HalconWindow.SetPart(0,0,tuple.TupleSelect(h,3)-1,tuple.TupleSelect(w,3)-1);
HWindowXCtrl4.HalconWindow.SetDraw(‘margin‘);
HWindowXCtrl4.HalconWindow.SetColor(‘red‘);
img1.SelectObj(4).DispObj(HWindowXCtrl4.HalconWindow);
ho_Region1.SelectObj(4).DispObj(HWindowXCtrl4.HalconWindow);
img1 := nil;
img := nil;
tuple := nil;
ho_Region := nil;
ho_Region1 := nil;
end;

时间: 2025-01-15 13:23:37

zw版【转发·台湾nvp系列Delphi例程】HALCON ObjToInteger1-4的相关文章

zw版【转发·台湾nvp系列Delphi例程】HALCON DirectFile

zw版[转发·台湾nvp系列Delphi例程]HALCON DirectFile unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, OleCtrls, HALCONXLib_TLB, StdCtrls, ExtCtrls;type TForm1 = class(TForm) HWindowXCtrl1: THWindowXCtrl

zw版【转发·台湾nvp系列Delphi例程】HALCON CheckDifference

zw版[转发·台湾nvp系列Delphi例程]HALCON CheckDifference unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, HALCONXLib_TLB;type TForm1 = class(TForm) HWindowXCtrl1: THWindowXCtrl; But

zw版【转发·台湾nvp系列Delphi例程】.NET调用HALCON COM控件内存释放模式

zw版[转发·台湾nvp系列Delphi例程].NET调用HALCON COM控件内存释放模式 ------------------------------------方法一 :Imports System.Runtime.InteropServices Marshal.ReleaseComObject(COM物件)COM 物件 = Nothing 方法二 :COM 物件 = NothingGC.Collect()GC.WaitForPendingFinalizers() 方法三 :Import

zw版【转发·台湾nvp系列Delphi例程】HALCON HImage与Bitmap格式转换

zw版[转发·台湾nvp系列Delphi例程]HALCON HImage与Bitmap格式转换 (Delphi Prism)namespace HImage_Bitmap_Prism;interfaceuses System.Drawing, System.Collections, System.Collections.Generic, System.Windows.Forms, System.ComponentModel, System.Drawing, System.Drawing.Imag

zw版【转发·台湾nvp系列Delphi例程】HALCON AddNoiseWhite

zw版[转发·台湾nvp系列Delphi例程]HALCON AddNoiseWhite unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, HALCONXLib_TLB;type TForm1 = class(TForm) HWindowXCtrl1: THWindowXCtrl; Butto

zw版【转发·台湾nvp系列Delphi例程】HALCON HWindow Overlayer 1

zw版[转发·台湾nvp系列Delphi例程]HALCON HWindow Overlayer 1 ------------------------------------HALCON HWindow Overlayer 1 unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, OleCtrls, HALCONXLib_TLB, St

zw版【转发·台湾nvp系列Delphi例程】HALCON Component Histogram

zw版[转发·台湾nvp系列Delphi例程]HALCON Component Histogram unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, HALCONXLib_TLB;type TForm1 = class(TForm) HWindowXCtrl1: THWindowXCtrl;

zw版【转发·台湾nvp系列Delphi例程】HALCON Cast 使用方式

zw版[转发·台湾nvp系列Delphi例程]HALCON Cast 使用方式 procedure TForm1.Button1Click(Sender: TObject);var img, img1 : HImageX; img2, img3 : IHUntypedObjectX; w , h : OleVariant; mtype : OleVariant;begin img := CoHImageX.Create; img.ReadImage('fabrik'); img.GetImage

zw版【转发·台湾nvp系列Delphi例程】Delphi 使用 HALCON库件COM控件数据格式转换

zw版[转发·台湾nvp系列Delphi例程]Delphi 使用 HALCON库件COM控件数据格式转换 Delphi 使用 HALCON库件COM控件数据格式转换,与IHObjectX接口有关 var rg0,rg1 : HRegionX;begin rg0 := CoHRegionX.Create; rg0.GenRectangle1(10,10,150,150); rg1 := CoHRegionX.Create; rg1.GenRectangle1(200,200,250,250); r

zw版【转发·台湾nvp系列Delphi例程】HALCON BinThreshold

zw版[转发·台湾nvp系列Delphi例程]HALCON BinThreshold unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, OleCtrls, HALCONXLib_TLB, StdCtrls;type TForm1 = class(TForm) Button1: TButton; HWindowXCtrl1: THW