0
点赞
收藏
分享

微信扫一扫

halcon的Hobject转HObject


非托管C++代码:

class CPLUSALOG_API_20211029 CCTest
{
public:
CCTest();
int* Get();
~CCTest();
protected:
Hobject* m_pRegion;
}
CCTest::CCTest()
{
m_pRegion = new Hobject();
Halcon::gen_circle(m_pRegion, 10.0, 10, 10);
}
int* CCTest::Get()
{
return (int*)m_pRegion->Id();
}CCTest::~CCTest()
{
delete m_pRegion;
}
C#代码:
public class CTest
{
public CTest(System.IntPtr ptr)
{
m_region = new HObject(ptr);
HTuple tArea, tRow, tCol;
HOperatorSet.AreaCenter(m_region, out tArea, out tRow, out tCol);
}
HObject m_region;
}


调用方,托管C++代码:
     CCTest ctest;
             ProjectBaseLib::NGClass::CTest^ test = gcnew ProjectBaseLib::NGClass::CTest((System::IntPtr)ctest.Get());

调用结果:
面积:314

举报

相关推荐

0 条评论