出于好奇,我正在尝试构建一个项目对象检测,如果闭路电视检测到一个人,它可以通知我。
import telebot
# Replace 'YOUR_TELEGRAM_BOT_TOKEN' with your actual bot token
bot = telebot.TeleBot('YOUR_TELEGRAM_BOT_TOKEN')
def send_image(image_path):
with open(image_path, 'rb') as f:
# Replace 'YOUR_TELEGRAM_CHAT_ID' with the actual chat ID where you want to send the image
bot.send_photo('YOUR_TELEGRAM_CHAT_ID', f)
# After detecting an object with YOLO, call the 'send_image' function with the path of the detected image
send_image('path/to/detected/image.jpg')
==============
import discord
# Replace 'YOUR_DISCORD_BOT_TOKEN' with your actual bot token
client = discord.Client()
bot_token = 'YOUR_DISCORD_BOT_TOKEN'
async def send_image(image_path):
# Replace 'YOUR_DISCORD_CHANNEL_ID' with the actual channel ID where you want to send the image
channel = client.get_channel('YOUR_DISCORD_CHANNEL_ID')
with open(image_path, 'rb') as f:
image = discord.File(f)
await channel.send(file=image)
# After detecting an object with YOLO, call the 'send_image' function with the path of the detected image
await send_image('path/to/detected/image.jpg')
============