Qt里显示halcon VS2015


思路是在Qt上面布局一堆Qwidet,然后通过Qwidget的winID()传给open_window里用。




	void h_open_window(const std::vector<QWidget*> &rt)
	{
		using namespace Halcon;
		Halcon::set_check("give_error");
		for (int i = 0; i < MAX_WINDOW_NUM; i++)
		{
			Halcon::set_check("~father");
			printf("w: %d h: %d\n", (Hlong)rt[i]->width(), (Hlong)rt[i]->height());
			open_window(0, 0, (Hlong)rt[i]->width(), (Hlong)rt[i]->height(), (Hlong)rt[i]->winId(), "visible", "", &hdisp_hand[i]);
		}
	}
	//halcon显示图片用
	HTuple hdisp_hand[MAX_WINDOW_NUM];

	void h_disp_obj(const Halcon::Hobject & obj, const Halcon::HTuple & disp_hand)
	{
		try
		{
			Halcon::set_check("~give_error");
			Hlong w, h;
			Halcon::get_image_pointer1(obj, NULL, NULL, &w, &h);
			Halcon::HDevWindowStack::Push(disp_hand);
			Halcon::HDevWindowStack::SetActive(disp_hand);
			Halcon::set_part(disp_hand, NULL, NULL, h, w);
			disp_obj(obj, disp_hand);
		}
		catch (Halcon::HException &except)
		{
			Halcon::set_check("give_error");
			Halcon::set_tposition(disp_hand, 0, 1);
			Halcon::write_string(disp_hand, except.message);
		}
	}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值