You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

wxpy_uploader.py 1.1 kB

7 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #coding=utf-8
  2. from wxpy import *
  3. import numpy
  4. import cv2
  5. import time
  6. import os
  7. from hyperlpr import pipline
  8. def recognize(filename):
  9. image = cv2.imread(filename)
  10. #通过文件名读入一张图片 放到 image中
  11. return pipline.RecognizePlateJson(image)
  12. #识别一张图片并返回json结果
  13. # 人脸检测的功能,这里用到了OpenCV里面的人脸检测代码
  14. # 由于接收和处理图片都需要一点点时间 这里偷懒直接用sleep
  15. # 建议更改成多进程模式,否则容易造成进程混乱
  16. bot = Bot(console_qr=True, cache_path=True)
  17. # friend = bot.friends().search(u'庾金科')[0]
  18. # friend.send(u'你好,车牌识别功能已开启测试')
  19. @bot.register(Friend,PICTURE)
  20. def face_msg(msg):
  21. image_name = msg.file_name
  22. friend = msg.chat
  23. print msg.chat
  24. print '接收图片'
  25. # face(image_name)
  26. msg.get_file('' + msg.file_name)
  27. # time.sleep(1)
  28. json_text = recognize(image_name)
  29. # face(image_name)
  30. # time.sleep(0.5)
  31. msg.reply(json_text)
  32. msg.reply_image("0.jpg")
  33. # msg.reply(json_text)
  34. os.remove(image_name)
  35. embed()