So I've seen few solutions on internet, but each of them recomends using other libraries f.e. matplotlib
if this one doesn't work, but I would like to know if it's maybe possible to repair it, cause I could use opencv
image manipulation functions in further part of a code, so I would be glad if there was anyway to stay with opencv
image import.
Here's my code:
if len(message.attachments) == 0:
print('[INFO] Message doesn't contain any attachments')
pass
else:
print('[INFO] Message contains attachments')
dir = os.listdir(path)
for filename in dir:
i = 0
img = cv2.imread(path + filename)
for attachment in message.attachments:
img2 = cv2.imread(attachment.url)
print(attachment.url)
print(img)
print(img2)
if img2 == img:
print('[LOG] It' same as ' + filename)
await message.delete()
await message.channel.send("You've reapeated Image")
else:
print('[LOG] User sent appropriate image')
message
is an message
object from discord.py
, representing last image sent by specified user;
message.attachments
is a list of images send with message
object;
I've tried both attachment.url
and attachment.proxy_url
, but neither of them works;
EDIT: I've forgot to add, that both images, the one from path, and the one from url, are registered as None
question from:
https://stackoverflow.com/questions/65900615/cv2-imread-returns-nonetype 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…