Run visual c # halcon code error, like memory leaks, but I can't find the problem, try the Gc garbage collection,
The HTML code is as follows, template matching:
Private void Read_modelNCC ()
{
Try
{
Ho_Rectangle_model. The Dispose ();
HOperatorSet. ClearNccModel (hv_ModelID);
}
Catch
{}
Try
{
Hv_ModelID. The Dispose ();
HOperatorSet. ReadNccModel (get_path (" hv_ModelID. SBM "), the out hv_ModelID);
HOperatorSet. ReadRegion (out ho_Rectangle_model get_path (" ho_Rectangle_model. Hobj "));
//HOperatorSet. CLOSE
}
Catch
{
//label_state. Text=DateTime. Now. The ToString () + "\ r \ n" +
//Name_now + "\ r \ n +"
//"matching template was not found. Please create templates again!" + "" +" \ r \ n ";
}
}
Public void AffintModelNCC ()
{
Read_modelNCC ();
If (hv_ModelID. ToString ()=="[]" | | ho_Image_get. The ToString ()=="[]")
{
return;
}
# region template
//Matching 01: Get the reference position
Hv_ModelRegionArea. The Dispose (); Hv_RefRow. The Dispose (); Hv_RefColumn. The Dispose ();//cleaning
HOperatorSet. AreaCenter (ho_Rectangle_model out hv_ModelRegionArea, out hv_RefRow,
The out hv_RefColumn);
////show -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
# endregion
Using (HDevDisposeHelper dh=new HDevDisposeHelper ())
{
Try
{
Stopwatch sw=new Stopwatch();
Sw. Start ();
Hv_Row_find_model. The Dispose (); Hv_Column_find_model. The Dispose (); Hv_Angle_find_model. The Dispose (); Hv_Scale_find_model. The Dispose (); Hv_Score_find_model. The Dispose ();//cleaning
//HOperatorSet. FindScaledShapeModel (ho_Image_get hv_ModelID, (new HTuple (30)). TupleRad ()
//(new HTuple (d_angle_stop). TupleRad (), 0.95, 1.05, the Convert. ToDouble (TB_socre. Text), 1, 0.5, "least_squares," (new HTuple (5)). TupleConcat (
//1), 0.75, out hv_Row_find_model, out hv_Column_find_model, out hv_Angle_find_model, out hv_Scale_find_model, out hv_Score_find_model);
Hv_Row_find_model. The Dispose (); Hv_Column_find_model. The Dispose ();
Hv_Angle_find_model. The Dispose (); Hv_Scale_find_model. The Dispose (); Hv_Score_find_model. The Dispose ();//cleaning
HOperatorSet. FindNccModel (ho_Image_get hv_ModelID, (new HTuple (30)). TupleRad (),
(new HTuple (30)). TupleRad (), ModelScore, 1, 0.5, "false", 0, out hv_Row_find_model, out hv_Column_find_model,
The out hv_Angle_find_model out hv_Score_find_model);
//add
Hv_HomMat2D. The Dispose ();//cleaning