public static bool findLine(HObject image, HTuple handle, out HTuple row1, out HTuple col1, out HTuple row2, out HTuple col2, out HObject obj, out HObject contours, out HObject ho_Cross, out HTuple phi) { row1 = null; col1 = null; row2 = null; col2 = null; phi = null; HTuple hv_Row1, hv_Column1; HOperatorSet.GenEmptyObj(out obj); HOperatorSet.GenEmptyObj(out contours); HOperatorSet.GenEmptyObj(out ho_Cross); HTuple parameter; try { HOperatorSet.ApplyMetrologyModel(image, handle); HOperatorSet.GetMetrologyObjectResult(handle, 0, "all", "result_type", "all_param", out parameter); HOperatorSet.GetMetrologyObjectMeasures(out contours, handle, "all", "all", out hv_Row1, out hv_Column1); HOperatorSet.GenCrossContourXld(out ho_Cross, hv_Row1, hv_Column1, 6, 0.785398); if (4 == parameter.Length) { row1 = parameter[0]; col1 = parameter[1]; row2 = parameter[2]; col2 = parameter[3]; HOperatorSet.GenContourPolygonXld(out obj, row1.TupleConcat(row2), col1.TupleConcat(col2)); HOperatorSet.LineOrientation(row1, col1, row2, col2, out phi); HOperatorSet.ClearMetrologyObject(handle, "all"); HOperatorSet.ClearMetrologyModel(handle); return(true); } } catch (HalconException ex) { string msg = ex.GetErrorMessage(); } return(false); }