Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

convert PIL RGB to opencv BRG

import PIL
import numpy as np
img = PIL.Image.open("myimage.png") # The image is load in RGB order.
img = np.asarray(img)'''The Image.open() method opens a file in binary 
format which needs to be converted to numpy however the order is still
RGB. Below is the conversion to BGR is done:'''
screen = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
# It is also possible to go in reverse:
screen = cv2.cvtColor(screen, cv2.COLOR_BGR2RGB)
Comment

PREVIOUS NEXT
Code Example
Python :: pandas group by decending 
Python :: autokeras import colab 
Python :: alexa python get slot value 
Python :: An example of how to associate a color to each bar and plot a color bar 
Python :: py list 3d 
Python :: argsort in descending order numpy 
Python :: python unicode function 
Python :: use model from checkpoint tensorflow 
Python :: Import "sendgrid" could not be resolved django 
Python :: entry tkinter 
Python :: blender python get current filename 
Python :: python array linspace 
Python :: int to byte array python 
Python :: dobj in spacy 
Python :: python program to check whether a specified value is contained in a group of values 
Python :: get the first element that is larger than 
Python :: python trace code execution 
Python :: py random.sample 
Python :: mechanize python #3 
Python :: Python NumPy ascontiguousarray Function Example Scalar to an array 
Python :: run python script task scheduler 
Python :: Converting a HDFDataset to numpy array 
Python :: python chunk text 
Python :: python docs 
Python :: flask get request port 
Python :: django give access to media folder 
Python :: encoding character or string to integer in python 
Python :: python integers 
Python :: code pandas from url 
Python :: stdin and stdout python 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =