当我在 C# 中使用 Halcon 运算符find_model_shape时出现问题。这个算子占用的内存即使按照Halcon所说的使用clear_shape_model也无法释放。
当形状搜索参数设置得越复杂时,find_shape_model 占用的内存似乎就越大。
我只想知道使用这个操作符后如何释放内存。
private void button1_Click(object sender, EventArgs e)
{
HTuple hv_ModelId = null;
HTuple hv_ModelRow = null;
HTuple hv_ModelColumn = null;
HTuple hv_ModelAngle = null;
HTuple hv_ModelScore = null;
HObject ho_Image = null;
HOperatorSet.GenEmptyObj(out ho_Image);
ho_Image.Dispose();
HOperatorSet.ReadImage(out ho_Image, "0.bmp");
HOperatorSet.SetSystem("border_shape_models", "false");
HOperatorSet.ReadShapeModel("0.shm", out hv_ModelId);
HOperatorSet.FindShapeModel(ho_Image, hv_ModelId, 0,
3.14, 0.75, 0, 0.5, "least_squares", 6, 0.75, out hv_ModelRow,
out hv_ModelColumn, out hv_ModelAngle, out hv_ModelScore);
hv_ModelRow = null;
hv_ModelColumn = null;
hv_ModelAngle = null;
hv_ModelScore = null;
ho_Image.Dispose();
HOperatorSet.ClearShapeModel(hv_ModelId);
hv_ModelId = null;
}