Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Pillow opencv convert RGB to BRG or RGB to 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 :: Resource stopwords not found 
Python :: simulate gravity in pythpn 
Python :: python code to demonstrate inheritance with animal class 
Python :: split column and rename them 
Python :: selenium proxy with authentication 
Python :: quote_from_bytes() expected bytes 
Python :: pd.loc 
Python :: dense in keras 
Python :: unpersist cache pyspark 
Python :: pandas options 
Python :: cmap perlin noise python 
Python :: python os path safe string 
Python :: dataframe concatenate 
Python :: zoom in librosa.display.specshow() 
Python :: how to record youtube cc in python 
Python :: list dictionary to json file python with tab 
Python :: find out length of a string in pixels python 
Python :: iterate rows and columns dataframe 
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 :: 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
5+4 =