/// <summary> /// Get the longest contour with in a region /// </summary> /// <param name="image"></param> /// <param name="location"></param> /// <param name="cannyLow"></param> /// <param name="cannyHigh"></param> /// <returns></returns> private HObject GetContour(HImage image, FindLineLocation location, int cannyLow = 20, int cannyHigh = 40) { HObject region; HOperatorSet.GenRectangle2(out region, location.Y, location.X, MathUtils.ToRadian(location.Angle), location.Len1, location.Len2); var imageEdge = image.ReduceDomain(new HRegion(region)); return(imageEdge.EdgesSubPix("canny", 3, cannyLow, cannyHigh)); }
public FindLineLocation FindLineLocationRelativeToAbsolute(FindLineLocation relativeLocation) { var point = PointRelativeToAbsolute(relativeLocation.X, relativeLocation.Y); var angle = DegreeRelativeToAbsolute(relativeLocation.Angle); return(new FindLineLocation() { Angle = angle, Len1 = relativeLocation.Len1, Len2 = relativeLocation.Len2, X = point.ImageX, Y = point.ImageY, ImageIndex = relativeLocation.ImageIndex, Name = relativeLocation.Name }); }