python直线缺陷检测,使用Python和openCV进行打印缺陷检测并发送信号

I'm using image processing to find defective pens with their writing. Reference image and a defective image is shown below.

Go9Qf.png

I used python and openCV and I got below image using XOR (subtraction) operation.

5YRj7.png

Now I want to send a digital signal when such a defective pen is detected. How can I do that?

解决方案

Well there are different ways to achieve communication between a PLC and your python script. I have had some succes with communication between a Siemens S7-1200 with using the snap7 module which you can install via pip. It is quite simple to use and I could read/write inputs, outputs, markers,... I am not sure but I think that LOGO has a similar communitaion protocol as the S7. You could check out this link Snap7 - LOGO. You can also just google "snap7 python" and read the documentation.

There is another module called libnodave. I have not tried it but I heard people had succses with it. You can also google it and read the documentation.

I have also had succses with communicating the S7-200 (older PLC) which doesn't have an ethernet port. I used Arduino and an I/O shield that has 24V rele outputs. You can easily communicate with Arduino via Serial communication and this solution could definetly be used for LOGO. Note that Arduino is not an robust solution and it could get interferences from near high voltage devices. You could make a faradei cage to supress the interference though I have never tried it.

You can also try an on-machine modules that can get signal from almost anything and communicate with PLC but theye are probably expensive.

Hope it helps a bit or at least widen your area on finding the solution. If you wish, I can post sample codes for arduino communication or the snap7 library communication. Cheers!

Note: This kind of question would be better on Signal Processing Stack Exchange

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值