码迷,mamicode.com
首页 > Windows程序 > 详细

VS2017 C#用halcon采集本地图片

时间:2018-10-29 14:14:27      阅读:430      评论:0      收藏:0      [点我收藏+]

标签:ict   isp   threading   地图   open   partial   private   and   lin   

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HalconDotNet;

namespace ReadHalconImage
{
public partial class Form1 : Form
{
private HTuple WindowID;
private HObject Image;

public Form1()
{
InitializeComponent();

Image = new HObject();

CreateHalconWindow();

LoadImage();
}


public void CreateHalconWindow()
{
HTuple FatherWindow = this.DisplayVideo_pictureBox.Handle;

HOperatorSet.SetWindowAttr("background_color", "yellow");

HOperatorSet.OpenWindow(0, 0, this.DisplayVideo_pictureBox.Width, this.DisplayVideo_pictureBox.Height, FatherWindow, "visible", "", out WindowID);


}

public void LoadImage()
{
HOperatorSet.ReadImage(out Image, "1.bmp");

HTuple width = null, height = null;

HOperatorSet.GetImageSize(Image, out width, out height);

HOperatorSet.SetColor(WindowID, "yellow");

HOperatorSet.SetPart(WindowID, 0, 0, height, width);
HOperatorSet.DispObj(Image, WindowID);

}


}


}

 

VS2017 C#用halcon采集本地图片

标签:ict   isp   threading   地图   open   partial   private   and   lin   

原文地址:https://www.cnblogs.com/mayayun/p/9870153.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!