|
16-Halcon和C#驱动相机拍照--相机类Class
百度网盘链接:https://pan.baidu.com/s/1cFoSLEaFkIfa9z7Hix055Q 提取码:xgaw
具体链接在halcom.cn论坛,联系人QQ:3283892722
该论坛是一个学习交流平台,我会逐一的和大家分享学习。
欢迎大家录制视频,并提交给我,我来设置视频,你可在论坛进行打赏分享。
视频专用播放器:http://halcom.cn/forum.php?mod=viewthread&tid=258&extra=page%3D1
代码如下:- 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 ANCcamera_Halcon
- {
- public partial class Form1 : Form
- {
- HObject ho_Image = null;
- HTuple hv_Width = 1280, hv_Height = 720;
- ANCcameraClass ANCCamera = new ANCcameraClass();
- public Form1()
- {
- InitializeComponent();
- ANCCamera.Init();
- }
- private void btnRealSnap_Click(object sender, EventArgs e)
- {
- ANCCamera.RealTimeSnapImage(hWindowControl1);
- }
- private void StopRealSnap_Click(object sender, EventArgs e)
- {
- ANCCamera.StopRealTimeSnapImage();
- }
- private void SnapImage_Click(object sender, EventArgs e)
- {
- HOperatorSet.GenEmptyObj(out ho_Image);
- ho_Image.Dispose();
- ANCCamera.getCurrentImage(out ho_Image);
- HOperatorSet.SetPart(hWindowControl2.HalconWindow, 0, 0, hv_Height - 1, hv_Width - 1);
- HOperatorSet.DispObj(ho_Image, hWindowControl2.HalconWindow);
- }
- private void Form1_FormClosing(object sender, FormClosingEventArgs e)
- {
- ANCCamera.DeleteInit();
- }
- }
- }
复制代码
|
|