Halcon图像渲染为什么会有内存泄漏啊,有没有大佬指导一下!
//图像渲染
void CHSummaryProcess::imageRender(HalconCpp::HImage& in_Image, HImage& out_Image, Data data, Result tmpResult, int camCount, int camidx, HTuple& hv_WindowHandle1)
{
//halcon写字需要提前声明utf8
SetSystem("filename_encoding", "utf8");
//图像渲染
HTuple hv_WidthOut, hv_HeightOut;
GetImageSize(in_Image, &hv_WidthOut, &hv_HeightOut);
HTuple hv_WindowHandle;
OpenWindow(0, 0, hv_WidthOut, hv_HeightOut, 0, "invisible", "", &hv_WindowHandle);
SetPart(hv_WindowHandle, 0, 0, hv_HeightOut, hv_WidthOut); // 设置显示区域为整个图像
if (!out_Image.IsInitialized())
{
DispObj(in_Image, hv_WindowHandle);
}
else
{
DispObj(out_Image, hv_WindowHandle);
}
//画线段
SetColor(hv_WindowHandle, "green");
SetLineWidth(hv_WindowHandle, 5); // 设置线宽为5个像素
//画交点
for (int i = 0; i < ((camidx == 0) ? 4 : 2); i++)
{
DispCross(hv_WindowHandle, data.Point_pix[i].x, data.Point_pix[i].y, 5, 0);
}
DumpWindowImage(&out_Image, hv_WindowHandle);
ClearWindow(hv_WindowHandle);
CloseWindow(hv_WindowHandle);
}
|