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 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 ::  
Python :: how i get url value in get_queryset function in drf 
Python :: how to create image folder in numpy aray 
Python :: run a shell script from python 
Python :: reduce dataframe merge 
Python :: signup class 
Python :: python 3 docs 
:: python global lists 
Python :: assert in selenium python 
Python :: how to set a hyperlink in python 
Python :: url routing in django 
Python :: argparse parse path 
Python :: bytestring python 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =