/// <summary> /// Gets the gray values of specified row of the image. /// </summary> /// <param name="image">The image.</param> /// <param name="row">The row.</param> /// <returns> /// Tuple containing the gray values of the specified row of image /// </returns> public static HTuple GetGrayValuesOfLine(HImage image, int row) { // Feed the image to the script int imageWidth; int imageHeight; IntPtr imagePointer; System.String imageType; imagePointer = image.GetImagePointer1(out imageType, out imageWidth, out imageHeight); // Get gray values of center line in the image int AOIBeginRow = row; int AOIEndRow = AOIBeginRow; int AOIBeginCol = 0; int AOIEndCol = imageWidth - 1; HRegion AOIRegion = new HRegion(); AOIRegion.GenRegionLine(AOIBeginRow, AOIBeginCol, AOIEndRow, AOIEndCol); HTuple AOIRowPoints = new HTuple(); HTuple AOIColPoints = new HTuple(); AOIRegion.GetRegionPoints(out AOIRowPoints, out AOIColPoints); HTuple AOIGrayVals = image.GetGrayval(AOIRowPoints, AOIColPoints); return(AOIGrayVals); }
/// <summary>Gets the HALCON region described by the ROI.</summary> public override HRegion getRegion() { HRegion region = new HRegion(); region.GenRegionLine(row1, col1, row2, col2); return(region); }
/// <summary>Gets the HALCON region described by the ROI.</summary> public override HRegion getRegion() { HRegion region = new HRegion(); region.GenRegionLine(_StartRow, _StartColumn, _EndRow, _EndCol); return(region); }
/// <summary> /// 获取region /// </summary> /// <returns>region图形</returns> public override HRegion GetRegion() { HRegion region = new HRegion(); region.GenRegionLine(startRow, startCol, endRow, endCol); return(region); }
public static HRegion GenLineRegion(double startRow, double startCol, double endRow, double endCol) { HRegion line = new HRegion(); line.GenEmptyRegion(); line.GenRegionLine(startRow, startCol, endRow, endCol); return(line); }
/// <summary> /// Test the neighborhood. /// </summary> private void NeighborhoodTest() { HImage image = new HImage("byte", 512, 512); HRegion regionLine = new HRegion(); HRegion regionComplement = new HRegion(); HRegion regionConnected = new HRegion(); HTuple hv_DefWindow = new HTuple(); HWindow HalconWindow1 = HalconWindowControl1.HalconWindow; HWindow HalconWindow2 = HalconWindowControl2.HalconWindow; try { HalconWindow1.SetColored(6); HalconWindow2.SetColored(6); int numObjects; image.GenImageGrayRamp(0, 0, 128, 256, 256, 512, 512); // Display code image.DispImage(HalconWindow1); image.DispImage(HalconWindow2); regionLine.GenRegionLine(100, -1, 150, 512); regionComplement = regionLine.Complement(); HOperatorSet.SetSystem("neighborhood", 4); regionConnected = regionComplement.Connection(); image.DispImage(HalconWindow1); regionConnected.DispRegion(HalconWindow1); numObjects = regionConnected.CountObj(); label1.Text = "Number of objects 4-connected:" + numObjects.ToString(); regionConnected.Dispose(); HOperatorSet.SetSystem("neighborhood", 8); regionConnected = regionComplement.Connection(); image.DispImage(HalconWindow2); regionConnected.DispRegion(HalconWindow2); numObjects = regionConnected.CountObj(); label2.Text = "Number of objects 8-connected:" + numObjects.ToString(); HOperatorSet.CloseWindow(HDevWindowStack.Pop()); } catch (Exception) { throw; } finally { image.Dispose(); regionLine.Dispose(); regionConnected.Dispose(); regionComplement.Dispose(); } }
public DrawLine(double startRow, double startColumn, double endRow, double endColumn) { StartRow = startRow; StartColumn = startColumn; EndRow = endRow; EndColumn = endColumn; ROIType = ROIType.Line; Region = new HRegion(); Region.GenRegionLine(StartRow, StartColumn, EndRow, EndColumn); }
/// <summary>Gets the HALCON region described by the ROI.</summary> public override HRegion getRegion() { HRegion region = new HRegion(); region.GenRegionLine(row1, col1, row2, col2); return region; }
/// <summary>Gets the HALCON region described by the ROI.</summary> public override HRegion getRegion() { HRegion region = new HRegion(); region.GenRegionLine(_StartRow, _StartColumn, _EndRow, _EndCol); return region; }