import cv2
import numpy as np
from PIL import Image
from PIL import ImageEnhance def getline(frame): img = Image.fromarray(frame.astype('uint8')).convert('RGB')
enh_col = ImageEnhance.Color(img)
color = 1.5
image_colored = enh_col.enhance(color)
enh_con = ImageEnhance.Contrast(image_colored)
contrast = 1.5
image_colored = enh_con.enhance(contrast) frame = np.array(image_colored)
cv2.imshow("img1",frame)

Python PIL 的image类和numpy array之间的互换的更多相关文章

  1. 「Python」Convert map object to numpy array in python 3

    转自Stackoverflow.备忘用. Question In Python 2 I could do the following: import numpy as np f = lambda x: ...

  2. Python自定义一个数组类,支持数组之间的四则运算和其他常见方法

    class MyArray: '''保证输入的内容是整型.浮点型''' def ___isNumber(self, num): if not isinstance(num, (int,float)): ...

  3. python numpy array 的一些问题

    1 将list转换成array 如果list的嵌套数组是不规整的,如 a = [[1,2], [3,4,5]] 则a = numpy.array(a)之后 a的type是ndarray,但是a中得元素 ...

  4. Python Numpy Array

    Numpy 是Python中数据科学中的核心组件,它给我们提供了多维度高性能数组对象. Arrays Numpy.array   dtype 变量 dtype变量,用来存放数据类型, 创建数组时可以同 ...

  5. python numpy array 与matrix 乘方

    python numpy array 与matrix 乘方 编程语言 waitig 1年前 (2017-04-18) 1272℃ 百度已收录 0评论 数组array 的乘方(**为乘方运算符)是每个元 ...

  6. Python 将numpy array由浮点型转换为整型

    Python 将numpy array由浮点型转换为整型 ——使用numpy中的astype()方法可以实现,如:

  7. python的numpy.array

    为什么要用numpy Python中提供了list容器,可以当作数组使用.但列表中的元素可以是任何对象,因此列表中保存的是对象的指针,这样一来,为了保存一个简单的列表[1,2,3].就需要三个指针和三 ...

  8. Python过滤掉numpy.array中非nan数据实例

    代码 需要先导入pandas arr的数据类型为一维的np.array import pandas as pd arr[~pd.isnull(arr)] 补充知识:python numpy.mean( ...

  9. python numpy.array插入一行或一列

    numpy.array插入一行或一列 import numpy as np a = np.array([[1,2,3],[4,5,6],[7,8,9]]) b = np.array([[0,0,0]] ...

随机推荐

  1. C#选择文件、选择文件夹、打开文件

    1.选择文件用OpenDialog OpenFileDialog dialog = new OpenFileDialog(); dialog.Multiselect = true;//该值确定是否可以 ...

  2. 英语口语练习系列-C13-聚会

    词汇 音频 1. apartment [əˈpɑ:tmənt] n. 公寓 a big / small apartment 一个大的/小的公寓 in an apartment 在公寓 2. arm [ ...

  3. 机器学习系列-tensorflow-01-急切执行API

    tensorflow急切执行概述 Eager execution is an imperative, define-by-run interface where operations are exec ...

  4. [CC-COUPLES]Couples sit next to each other

    [CC-COUPLES]Couples sit next to each other 题目大意: 有\(n(n\le5\times10^5)\)对小伙伴共\(2n\)个人坐成一圈.刚开始编号为\(i\ ...

  5. pymysql 使用twisted异步插入数据库:基于crawlspider爬取内容保存到本地mysql数据库

    本文的前提是实现了整站内容的抓取,然后把抓取的内容保存到数据库. 可以参考另一篇已经实现整站抓取的文章:Scrapy 使用CrawlSpider整站抓取文章内容实现 本文也是基于这篇文章代码基础上实现 ...

  6. Ubuntu编译安装配置Redis以及基本使用

    1.首先下载redis curl -O http://download.redis.io/releases/redis-4.0.8.tar.gz 2.解压压缩包 .tar.gz 3.安装TCL测试工具 ...

  7. JAVA笔记--static

    1.static 修饰变量 public class MyClass { static int i = 4; } 其中static 修饰变量,表示变量 i 属于 MyClass 类,所有的对象共享一个 ...

  8. 高速公路 [HAOI2012] [线段树]

    Description Y901高速公路是一条重要的交通纽带,政府部门建设初期的投入以及使用期间的养护费用都不低,因此政府在这条高速公路上设立了许多收费站. Y901高速公路是一条由N-1段路以及N个 ...

  9. redis:set集合类型的操作(无序集合)

    1. set集合类型的操作(无序集合) 集合具有无序性(没有顺序).确定性(描述是确定的).唯一性(没有重复的元素) 1.1. sadd key member [member ...] 语法:sadd ...

  10. Tyrion 中文文档(含示例源码)

    原文出处: Mr.Seven   Tyrion是一个基于Python实现的支持多个WEB框架的Form表单验证组件,其完美的支持Tornado.Django.Flask.Bottle Web框架.Ty ...