MES联动集成松下摄像头实现设备安全报警

在危险作业区域,如何通过摄像头已有警戒范围和人员识别功能反馈到MES系统实现系统报警。

需要安装松下摄像头开发SDK。

代码下载:https://download.csdn.net/download/bjhtgy/89688177

SDK:https://download.csdn.net/download/bjhtgy/89688181

以下是代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CabAlarmSystem
{
    public partial class Main : Form
    {
        System.Media.SoundPlayer sndPlayer = null;
        bool isperson = false;

        public Main()
        {
            InitializeComponent();
        }

        private void Main_Load(object sender, EventArgs e)
        {
            axpsalarmrcvctrl.OnAlarmRcvEnable = 1;
            sndPlayer = new System.Media.SoundPlayer(Application.StartupPath + @"/Alarm/ALARM.WAV");
            toolTip.SetToolTip(bt_CloseAlarm, "关闭贮柜报警");
            foreach (Control control in this.Controls)
            {
                if (control.GetType() == typeof(CameraControl))
                {
                    CameraControl cameracontrol = control as CameraControl;
                    cameracontrol.ParentPoint = this.Location;
                }
            }
        }
       
        private void axpsalarmrcvctrl_OnAlarmRcv(object sender, AxPSALARMRCVLib._IpsalarmrcvctrlEvents_OnAlarmRcvEvent e)
        {
            foreach (Control control in this.Controls)
            {
                if (control.GetType() == typeof(CameraControl))
                {
                    CameraControl cameracontrol = control as CameraControl;

                    if (cameracontrol.Ip == e.ipaddr)
                    {
                        cameracontrol.ParentPoint = this.Location;
                        //在标志位置1并且侦测到移动报警,则触发信号
                        if (e.messageID == "40" && isperson==true)
                        {
                            isperson = false;
                            cameracontrol.Alarm = true;
                            sndPlayer.PlayLooping();
                            cameracontrol.pictureBox.Visible = true;
                            cameracontrol.button.PerformClick();
                        }
                        if (e.messageID == "41" && isperson == true)
                        {
                            isperson = false;
                            cameracontrol.Alarm = true;
                            sndPlayer.PlayLooping();
                            cameracontrol.pictureBox.Visible = true;
                            pb_Machine01.BackgroundImage = Image.FromFile("Images\\Stop.jpg");
                        }
                        if (e.messageID == "42" && isperson == true)
                        {
                            isperson = false;
                            cameracontrol.Alarm = true;
                            sndPlayer.PlayLooping();
                            cameracontrol.pictureBox.Visible = true;
                            pb_Machine01.BackgroundImage = Image.FromFile("Images\\Stop.jpg");
                            MessageBox.Show("紧急报警!");
                        }
                        //这个是用来侦测人体热信号的,如果这个触发。标志位置true
                        if (e.messageID == "00")
                        {
                            isperson = true;
                        }
                    }
                }
            }
           
        }

        private void bt_CloseAlarm_Click(object sender, EventArgs e)
        {
            sndPlayer.Stop();
            pb_Machine01.BackgroundImage = Image.FromFile("Images\\Run.jpg");
            foreach (Control control in this.Controls)
            {
                if (control.GetType() == typeof(CameraControl))
                {
                    CameraControl cameracontrol = control as CameraControl;
                    if (cameracontrol.Alarm == true)
                    {
                        cameracontrol.pictureBox.Visible = false;
                    }
                }
            }
        }
    }
}
 

  • 21
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值