public static HTextureInspectionModel Deserialize(Stream stream) { HTextureInspectionModel htextureInspectionModel = new HTextureInspectionModel(); htextureInspectionModel.DeserializeTextureInspectionModel(HSerializedItem.Deserialize(stream)); return(htextureInspectionModel); }
public HTextureInspectionModel Clone() { HSerializedItem serializedItemHandle = this.SerializeTextureInspectionModel(); HTextureInspectionModel htextureInspectionModel = new HTextureInspectionModel(); htextureInspectionModel.DeserializeTextureInspectionModel(serializedItemHandle); serializedItemHandle.Dispose(); return(htextureInspectionModel); }
internal static int LoadNew( IntPtr proc, int parIndex, int err, out HTextureInspectionModel obj) { obj = new HTextureInspectionModel(HTool.UNDEF); return(obj.Load(proc, parIndex, err)); }
/// <summary>Train a texture inspection model.</summary> /// <param name="textureInspectionModel">Handle of the texture inspection model.</param> public static void TrainTextureInspectionModel(HTextureInspectionModel textureInspectionModel) { IntPtr proc = HalconAPI.PreCall(2099); HalconAPI.Store(proc, 0, (HTool)textureInspectionModel); int procResult = HalconAPI.CallProcedure(proc); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)textureInspectionModel); }
/// <summary>Get the training images contained in a texture inspection model.</summary> /// <param name="textureInspectionModel">Handle of the texture inspection model.</param> /// <returns>Training images contained in the texture inspection model.</returns> public static HImage GetTextureInspectionModelImage( HTextureInspectionModel textureInspectionModel) { IntPtr proc = HalconAPI.PreCall(2075); HalconAPI.Store(proc, 0, (HTool)textureInspectionModel); HalconAPI.InitOCT(proc, 1); int err = HalconAPI.CallProcedure(proc); HImage himage; int procResult = HImage.LoadNew(proc, 1, err, out himage); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)textureInspectionModel); return(himage); }
internal static int LoadNew( IntPtr proc, int parIndex, int err, out HTextureInspectionModel[] obj) { HTuple tuple; err = HTuple.LoadNew(proc, parIndex, err, out tuple); obj = new HTextureInspectionModel[tuple.Length]; for (int index = 0; index < tuple.Length; ++index) { obj[index] = new HTextureInspectionModel(tuple[index].IP); } return(err); }
/// <summary>Add training images to the texture inspection model.</summary> /// <param name="image">Image of flawless texture.</param> /// <param name="textureInspectionModel">Handle of the texture inspection model.</param> /// <returns>Indices of the images that have been added to the texture inspection model.</returns> public static HTuple AddTextureInspectionModelImage( HImage image, HTextureInspectionModel textureInspectionModel) { IntPtr proc = HalconAPI.PreCall(2043); HalconAPI.Store(proc, 1, (HObjectBase)image); HalconAPI.Store(proc, 0, (HTool)textureInspectionModel); HalconAPI.InitOCT(proc, 0); int err = HalconAPI.CallProcedure(proc); HTuple tuple; int procResult = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, err, out tuple); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)image); GC.KeepAlive((object)textureInspectionModel); return(tuple); }
/// <summary> /// Inspection of the texture within an image. /// Modified instance represents: Handle of the inspection results. /// </summary> /// <param name="image">Image of the texture to be inspected.</param> /// <param name="noveltyRegion">Novelty regions.</param> /// <param name="textureInspectionModel">Handle of the texture inspection model.</param> public HTextureInspectionResult( HImage image, out HRegion noveltyRegion, HTextureInspectionModel textureInspectionModel) { IntPtr proc = HalconAPI.PreCall(2044); HalconAPI.Store(proc, 1, (HObjectBase)image); HalconAPI.Store(proc, 0, (HTool)textureInspectionModel); HalconAPI.InitOCT(proc, 0); HalconAPI.InitOCT(proc, 1); int err1 = HalconAPI.CallProcedure(proc); int err2 = this.Load(proc, 0, err1); int procResult = HRegion.LoadNew(proc, 1, err2, out noveltyRegion); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); GC.KeepAlive((object)image); GC.KeepAlive((object)textureInspectionModel); }
/// <summary> /// Inspection of the texture within an image. /// Modified instance represents: Handle of the inspection results. /// </summary> /// <param name="image">Image of the texture to be inspected.</param> /// <param name="textureInspectionModel">Handle of the texture inspection model.</param> /// <returns>Novelty regions.</returns> public HRegion ApplyTextureInspectionModel( HImage image, HTextureInspectionModel textureInspectionModel) { this.Dispose(); IntPtr proc = HalconAPI.PreCall(2044); HalconAPI.Store(proc, 1, (HObjectBase)image); HalconAPI.Store(proc, 0, (HTool)textureInspectionModel); HalconAPI.InitOCT(proc, 0); HalconAPI.InitOCT(proc, 1); int err1 = HalconAPI.CallProcedure(proc); int err2 = this.Load(proc, 0, err1); HRegion hregion; int procResult = HRegion.LoadNew(proc, 1, err2, out hregion); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); GC.KeepAlive((object)image); GC.KeepAlive((object)textureInspectionModel); return(hregion); }