码迷,mamicode.com
首页 > 其他好文 > 详细

openCV 图片的处理

时间:2018-01-17 18:19:28      阅读:437      评论:0      收藏:0      [点我收藏+]

标签:odk   bka   aaa   web   div   decode   pre   mlu   处理   

将 base64为的字符串转换为图片

data = ‘‘‘/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a
HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy
MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAeAUADASIA
AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA
AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3
ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm
p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA
AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx
BhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK
U1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3
uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD12iii
mAUUUUAFFFFABRRRQAUxpokljieVFkkzsQsAWx1wO+KV3SONpJGVUUEszHAAHc1yF1qLyeITLa3V
vfi0RpIUxliz4DRps+98oJDYIGfm9QJAdjRXCSatq2nXbR3FxcQMHgeRZYxKoQjEj8Z+XfjAUjrg
YPTsdNnlutMtriYp5ksSyHYpAGRnGCT602gLVFFFIAooooAKKKKACiiigAooooAKKKKACiiigAoo
ooAq31/Fp8IklWVyxKxxwxl3dsE4AHsD14rnLvxJf7ZreNLa1mcAxNcOBKm4javkoXZmwQc4HuOO
dbxPax3OgXBlhSZYds5RztyEIZgCBkEqGGR61xQn1JZPIhgvElzK4trYJZxb04dV2EmfBGOCGwPf
jGpJp2A9IgmWeFZF4zwVyCVI4KnBIyDkHnqKkrnPCN1G9vc2cXkeTC4khFvJvRY3GQuT827IbIYA
8+mAOjrSLurgFFFFUAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAMmaRIJHij82RVJVN23ccc
DPbNcxJFdWVpeTzQXzz3lxIwht4klYx4wqyEqwAHTAJ4bvzjqqKAOGghMeqSW1nLbfabpVKKk7xI
pVRlXWPaQw+bqADnPykFT3NRS21vPJHJNBFI8RzGzoCUPqM9Og/KpabYBRRRSAKKKKACiiigAooo
oAKKKKACiiigAooooAKKKKAKeq2017pdxaQOiPOnllnBIVW4Y4HfaTj3xTYNLghuJptqkvcm5QKN
uxjGEPTrn5j/AMC/Gr1FKyvcCvbWNnZbvslpBBvxu8qMLux0zj6mrFFFMAooooAKKKKACiiigAoo
ooA//9k=‘‘‘

img_data = base64.b64decode(data)
with open(img.png, wb) as f:
    f.write(img_data)

这样就可以在当前目录下生成一张名为img的图片啦

openCV 图片的处理

标签:odk   bka   aaa   web   div   decode   pre   mlu   处理   

原文地址:https://www.cnblogs.com/yugengde/p/8303691.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!