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 :: add colorbar without changing subplot size 
Python :: django base path on level up 
Python :: how to customize simplejwt error response message in django restframework 
Python :: format json data ipynb 
Python :: how to sort in python 
Python :: pandas convert string to numpy array 
Python :: Python try with else clause 
Python :: null=true django 
Python :: python - remove exta space in column 
Python :: Python NumPy squeeze function Example 
Python :: how to access app.config globally in flask app 
Python :: pandas redondear un valor 
Python :: scikit decision tree 
Python :: how to append to an empty dataframe pandas 
Python :: pandas sequential numbering within group 
Python :: Access python http.server on google colab 
Python :: python init dict by list 
Python :: how to add to beginning of linked list python 
Python :: find daily aggregation in pandas 
Python :: Python NumPy ndarray.T Example to convert an array 
Python :: python Cerberus 
Python :: s=0 def sum(x,y): n=int(input("enter no. of terms") for i in range(n): l=int(input("enter no.")) s=s+l print(s) sum() 
Python :: remove SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame 
Python :: python square 
Python :: python get global variable by name 
Python :: how can i aggregate without group by in pandas 
Python :: printed in a comma-separated sequence on a single line. 
Python :: python docstrings example 
Python :: merge two dict python 
Python :: how to create tupple in python 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =