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

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

procedure TForm1.Button1Click(Sender: TObject);
var
w, h : OleVariant;
hv_Fuse, hv_i : Integer;
begin
Op.ReadImage(ho_Image, Tuple.TupleAdd(‘color/color_fuses_0‘, hv_Count));
Op.GetImageSize(ho_Image, w, h);
Op.SetPart(hv_WH, 0, 0, h - 1, w - 1);
Op.DispObj(ho_Image, hv_WH);
Op.SetTposition(hv_WH, 12, 512);
Op.WriteString(hv_WH, Tuple.TupleAdd(Tuple.TupleAdd(‘color/color_fuses0‘, hv_Count), ‘.png‘));

Op.Decompose3(ho_Image, ho_Red, ho_Green, ho_Blue);
Op.TransFromRgb(ho_Red, ho_Green, ho_Blue, ho_Hue, ho_Saturation, ho_Intensity, ‘hsv‘);
Op.Threshold(ho_Saturation, ho_Saturated, 60, 255);
Op.ReduceDomain(ho_Hue, ho_Saturated, ho_HueSaturated);
for hv_Fuse := 0 to Tuple.TupleSub(Tuple.TupleLength(hv_FuseTypes), 1) do
begin
Op.Threshold(ho_HueSaturated, ho_CurrentFuse, Tuple.TupleSelect(hv_HueRanges, Tuple.TupleMult(hv_Fuse, 2)), Tuple.TupleSelect(hv_HueRanges, Tuple.TupleAdd(Tuple.TupleMult(hv_Fuse, 2), 1)));
Op.Connection(ho_CurrentFuse, ho_CurrentFuseConn);
Op.FillUp(ho_CurrentFuseConn, ho_CurrentFuseFill);
Op.SelectShape(ho_CurrentFuseFill, ho_CurrentFuseSel, ‘area‘, ‘and‘, 6000, 20000);
Op.AreaCenter(ho_CurrentFuseSel, hv_FuseArea, hv_Row1, hv_Column1);
Op.SetColor(hv_WH, ‘magenta‘);
for hv_i := 0 to Tuple.TupleSub(Tuple.TupleLength(hv_FuseArea), 1) do
begin
Op.SetTposition(hv_WH, Tuple.TupleSelect(hv_Row1, hv_i), Tuple.TupleSelect(hv_Column1, hv_i));
Op.WriteString(hv_WH, Tuple.TupleAdd(Tuple.TupleAdd(Tuple.TupleAdd(Tuple.TupleSelect(hv_FuseColors, hv_Fuse), ‘ ‘), Tuple.TupleSelect(hv_FuseTypes, hv_Fuse)), ‘ Ampere‘));
end;
Op.SetTposition(hv_WH, Tuple.TupleMult(24, Tuple.TupleAdd(hv_Fuse, 1)), 12);
Op.SetColor(hv_WH, ‘slate blue‘);
Op.WriteString(hv_WH, Tuple.TupleAdd(Tuple.TupleAdd(Tuple.TupleSelect(hv_FuseColors, hv_Fuse), ‘ Fuses: ‘), Tuple.TupleLength(hv_FuseArea)));
end;
hv_Count := hv_Count + 1;
if (hv_Count > 4) then
hv_Count := 0;
end;

时间: 2024-11-10 00:17:25

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

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