设置首页收藏本站
开启左侧

惊!!Halcon图像渲染内存泄漏!

[复制链接]
CallmeGC_ 发表于 2025-8-6 16:17:30 | 显示全部楼层 |阅读模式
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);
}

奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表